Example 1: A simple sequence of calculations
# ----- Heat from 10K to 300K over 10ps modify environment start_temp 10.0 final_temp 300.0 velocities new end modify dynamics print 1000 scale_velo 100 scale_type new end dynamics 10000 # ----- Hold at 300K over 100ps, save coordinates every 1ps modify environment temperature 300.0 end modify dynamics scale_velo 0 archiv 1000 end dynamics 100000
This is a two part calculation. In the first part the starting temperature is set to 10K and the target final temperature is set to 300K. Then a new set of velocities is generated at the starting temperature (10K). Next the molecular dynamics method is modified so that the energies are printed every 1000 steps (instead of the preset value of 1) and the velocities are updated every 100 steps by generating new velocities each time. Since the step size is not modified it remains at the preset value of 0.001ps or 1fs. This means that the energy will be printed every 1ps and new velocities are generated every 0.1ps. Then 10000 steps of molecular dynamics is performed, i.e., for 10ps. Hence the system will be heated from 10K to 300K over 10ps. The velocities are reset 100 times over the course of the first part of the calculation over a linear ramp of the target temperature. So for velocities was set for a target temperature of 10K and the equations are then integrated for the next 100 steps. At the 101-th step, the velocities are regenerated at a new target temperature of 12.9K and this continues with the target temperature raised every 100 steps by 2.9K (final temperature 300K - initial temperature 10K divided into 100 resetting of the velocities).
In the second part of the calculation the environment is set at a constant target temperature of 300K and the molecular dynamics method is now set not to update the velocities (by setting the interval to zero). The coordinates will be saved to the output archive file every 1000 steps, i.e., every 1ps. Then a long molecular dynamics run is carried out at 300K for 100ps. The output archive will contain 100 sets of coordinates at the end of the simulation.
define RAMP 3 modify environment start_temp $1 final_temp $2 end monte_carlo $3 end
A simple macro called RAMP which takes three arguments is defined. The macro simply sets the starting temperature using the value passed in the first argument, the final temperature using the second argument then runs the Monte Carlo method for a number of cycles specified in the third argument. The name of the macro is in all uppercase. This is to make sure that it does not clash with a ysh keyword (which is not illegal but would have made the macro inaccessible and therefore useless). This also makes the name stand out.
include ramp.ysh modify monte_carlo print 10000 update 100 end # From To Thru # [K] [K] [cycles] # ------- ------- -------- RAMP 10000.0 10000.0 100000 RAMP 10000.0 1000.0 100000 RAMP 1000.0 100.0 100000 RAMP 100.0 10.0 100000 RAMP 10.0 0.0 100000
The macro defined in Example 2 is saved in the file "ramp.ysh" and is read back into this script. It is then used several times to script a repetitive set of calculations but first the monte carlo method is modified so that the energies are printed only every 10000 cycles (instead of the preset interval of 1) and the non-bond lists are updated every 100 cycles. Then the simulation is carried over over five linear ramps. In the first, the temperature target is held at a constant 10000K over 100000 cycles of monte carlo. Then the temperature target is reduced 10 fold in the next 100000 cycles continuing until the temperature target is brought down to zero. This anneals the system over a cooling curve that is approximately exponential. The use of the macro makes for a simpler and clearer script and overcomes to some extent a limitation of the program where temperature variations are limited to linear ramps.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|