QuantumATK Forum
QuantumATK => General Questions and Answers => Topic started by: lknife on June 12, 2017, 15:49
-
Dear all,
I want to restart the geometry optimization calculation which was stopped without finishing. I saved the trajectory file as doing the optimization. Then, how to use the trajectory file to restart the calculation? I have read the tutorial "Restarting a stopped calculation". However, in that tutorial, it was just said "you can take out some of the later images and set up a new optimization using this geometry as a starting point".
The question is: how can I do it? how to use the trajectory file as a starting point?
Thanks very much for your time and kind help!
-
If my previously saved trajectory filename is "trajectory.nc", when I want to restart the calculation, do I just need to add a code line "trajectory = nlread('trajectory.nc', Trajectory)[0]" to my original script as shown below?
---------------------------------------------------------------------
bulk_configuration = OptimizeGeometry(
bulk_configuration,
max_forces=0.01*eV/Ang,
max_stress=0.001*eV/Ang**3,
max_steps=1000,
max_step_length=0.2*Ang,
constraints=constraints,
trajectory_filename='trajectory.nc',
optimizer_method=LBFGS(),
constrain_bravais_lattice=True,
)
trajectory = nlread('trajectory.nc', Trajectory)[0]
------------------------------------------------------------------
Thanks a lot for anyone willing to help me!
-
No this will not work - in this case you read in the trajectory after performing the optimization, and do not extract the configuration.
You need to read in the trajectory before doing the optimization, and then also read in the actual configuration and set the calculator anew:
trajectory = nlread('trajectory.nc', Trajectory)[0]
bulk_configuration=trajectory.lastImage()
bulk_configuration.setCalculator(...)
bulk_configuration = OptimizeGeometry(
bulk_configuration,
max_forces=0.01*eV/Ang,
max_stress=0.001*eV/Ang**3,
max_steps=1000,
max_step_length=0.2*Ang,
constraints=constraints,
trajectory_filename='trajectory.nc',
optimizer_method=LBFGS(),
constrain_bravais_lattice=True,
)
The calculator is not saved in a trajectory, only the geometry is.
-
Thank you for your reply!
Attached is the .py file for restarting the calculation. Could you please have a look if it is correct now?
Thanks very much again for your kind help!
-
Looks ok to me. Remember that you can test the new code-lines used to read from the Trajectory by simply running the script on your laptop.
-
Thanks very much for your kind help!