Closed AugustinLu closed 3 months ago
This seems like a very sensible idea. As you say, a simple scaling would be easy to add. Is it possible that more complex temperature programmes might be required at some point? If so, then we should plan for this as well.
If you would like, please feel free to make a branch from develop
to start adding this functionality.
Thank you for your kind reply. One other possible time evolution of the temperature is an exponential decay following Newton's law of cooling: $T(t) = T_{environment} + (T0 - T{environment}) e ^{-kt}$ In that case, the constant $k$ should be carefully defined, and the temperature will tend to (but never reach) the target final temperature.
For the time being, I guess it is more reasonable to only use the simple scaling method (i.e. constant cooling/heating rate) for molecular dynamics simulations.
I am creating a new branch to start adding this functionality. How can we link a branch to this issue?
How can we link a branch to this issue?
You can directly create a branch from development button in the right side of this page, or you can create a branch first, then search the created branch from development button.
Thank you for your reply.
So far, I do not have the rights to create a branch from this page.
The branch containing the proposed changes is located at: https://github.com/AugustinLu/CONQUEST-release/commit/91955c66a3042eaa750e3d2ec427710bd4ee5da6
I would like to discuss the strategy for the implementation of this cooling or heating process. Sorry for my late reply, but I have checked the pull request #253 recently and I think we need some changes about it.
As far as I understand, the present scheme defines the cooling rate from
the initial and final temperatures with the number of MD steps.
I believe it is much better to set the cooling or heating rate explicitly, because
we need to change Conquest_input
for each job if it is set from the initial temperature.
Note that we assume AtomMove.NumSteps
as # of MD steps for each job (not the total # of MD steps),
MDn_steps = fdf_integer('AtomMove.NumSteps', 100 )
and AtomMove.IonTemperature
as the fixed Target temperature.
temp_ion = fdf_double ('AtomMove.IonTemperature',0.0_double)
In the code, temp_ion
needs to be updated during the heating or cooling process,
but I don’t think it appropriate to use this keyword as an initial temperature.
Anyway.. I think what we need to do are the followings. A) introducing new keywords for heating or cooling process and B) add one file (md.temperature ?) to print out final temperature
A) For the new keywords, I think we need
MD.VariableTemperature
: showing that the MD is for cooling or heating process F(default) or TMD.VariableTemperatureMethod
: at present only “linear” (default) MD.VariableTemperatureRate
: cooling or heating rate in T/fs (since the unit of timestep is femto second.)MD.InitialTemperature
: initial temperature in the process (K)MD.FinalTemperature
: final temperature in the process (K)Please suggest the better names if some of them sound inappropriate or weird.
A0) Variable Temperature or not, method
MD.VariableTemperature
: showing that the MD is for cooling or heating process F(default) or TMD.VariableTemperatureMethod
: at present only “linear” (default) It may not be necessary, but I think it is better to prepare the logical keyword MD.VariableTemperature
, just for declaring that we want to perform MD for cooling or heating. (We still need to say that the MD is NVT or NPT).
At present, we only prepared the procedure to change the target temperature at a same rate. But, we may want to implement other ways to control the temperature in the future. So, it is probably better to prepare the keyword MD.VariableTemperatureMethod
now, though we only have keyword linear
at present.
A1) Cooling or Heating rate:
MD.VariableTemperatureRate
: cooling or heating rate in T/fs (since the unit of timestep is femto second.)For this, we need some discussion and agreements.
First, I assume negative values should be used for cooling processes. (and positive values for heating processes.)
But, this is just the definition, so the opposite way is also possible.
We can check this definition if we have MD.InitialTemperature
and MD.FinalTemperature
.
Second, I think the unit should be in K/fs (femto second). The value 1.0 means 10^15 K/s
This is because the unit of time step (AtomMove.Timestep
) is femto second.
Please let me know if you are unhappy with these suggestions.
A2) initial and final temperatures, and job control
MD.InitialTemperature
: initial temperature in the process (K)MD.FinalTemperature
: final temperature in the process (K)
MD.InitialTemperature
may not be necessary if we use MD.IonTemperature
for this. But I am afraid it may cause misunderstanding.
MD.FinalTemperature
will be used to stop CONQUEST when the target temperature reaches this temperature.
(To judge this, the sign of MD.VariableTemperatureRate
can be used. I mean, we need to check the present temperature is lower or higher the target temperature for cooling or heating process.)
The present temperature can be calculated from the initial temperature (in the present job) and the MD step (in the present job) with the values of MD.VariableTemperatureRate
and AtomMove.Timestep
.
The question is how to get "initial temperature" in the present run. (See the next.)
B) add one file (md.temperature ?) to print out final temperature
The problem is we do not have a way to get the initial (target) temperature when we restart the CONQUEST MD run.
From the atomic velocities read from 'md.checkpoints', we can calculate the "instantaneous" temperature, but this is not the final target temperature (th%T_ext
) in the last run.
I am not completely sure, but I have noticed that md.checkpoints
does not include the information of target temperature.
There might be two (or three) options to solve this.
md.checkpoints
md.temp
only in the case of MD calculations for cooling or heating process.InfoGlobal.i00
.I think B2) is better than other two options. For B1), the format of md.checkpoint
is changed and we cannot use the old files any more, although the change is only for MD simulations of heating or cooling process.
For B3), it is a little complicated. This file includes the information of atomic velocities which also exists in md.checkpoint
. But this file is basically for generating the matrix elements (like L or K matrix) and the file may not be generated with some specific option. So, it is not a good idea to use this file to include the information of the final temperature.
We can also get the information of the initial target temperature from the history of MD simulations (md.stats
). But I assume that time step can be different in different jobs. Considering such cases, I think B2) is the best.
Thank you for your valuable comments.
In revision f527f8bc7d9913c728e7129f568a278ec78e0974, an updated implementation is proposed, including the additional keywords.
The main change is that everything now revolves around the temperature change rate, thus AtomMove.NumSteps
no longer has any impact on the cooling/heating rate.
Support was added for the following keywords:
MD.VariableTemperature T
MD.VariableTemperatureMethod linear
MD.VariableTemperatureRate -0.5
MD.InitialTemperature 2000
MD.FinalTemperature 300
For now, we are considering that the temperature evolves linearly. At a later stage, an exponential decay could be implemented, for long simulations where we would like to mimic the real cooling of a system.
A positive (resp. negative) value for MD.VariableTemperatureRate
means heating (resp. cooling).
<html xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
**Type** | **Internal variable** | **Location** -- | -- | -- Bool | flag_variable_temperature | Module **md_control** String | md_variable_temperature_method | Module **md_control** Float | md_variable_temperature_rate | Module **md_control** Float | md_initial_temperature | Module **md_control** Float | md_final_temperature | Module **md_control** Float | temp_change_step | _Internal_ **md_run**
During NVT and NPT molecular dynamics simulations, the temperature of the thermostat is set by
AtomMove.IonTemperature
and remains constant. In some cases (ex: melt and quench), it might be useful to allow the thermostat's temperature to change. For instance, a linear evolution of the temperature for heating or cooling.This could be done by adding a keyword
AtomMove.IonTemperatureEnd
, which would define the final target temperature.AtomMove.IonTemperatureEnd
=AtomMove.IonTemperature
.AtomMove.IonTemperatureEnd
!=AtomMove.IonTemperature
, then the thermostat temperature evolves linearly fromAtomMove.IonTemperature
toAtomMove.IonTemperatureEnd
.