The molecular dynamics driver
As a simple example, consider the dynamics simulation of 4 water molecules using MNDO energies and gradients, water4.chm in samples/dynamics. The first step is to create a dynamics object, here called dyn1. At this stage, a number of settings and initial options are provided.
# # Create the dynamics object # dynamics dyn1 coords=water4.pun \ theory=mndo \ temperature = 300 \ timestep = 0.001 \ ensemble = NVE \ energy_unit = "kcal mol-1"
The MD loop is implemented in your Tcl script. The commands you need are accessed through the name of the object (dyn1) followed by the command name. The MNDO command is triggered by the force command.
# # MD Loop # dyn1 initvel dyn1 output set count 1 while {$count < 500 } { if { [ expr $count % 10 ] == 0 } { dyn1 update } dyn1 force if { [ expr $count % 50 ] == 0 } { dyn1 trajectory } dyn1 step dyn1 printe incr count } dyn1 dumpdlp dyn1 dump
Individual matrices that are held by the dynamics object can be accessed individually (as ChemShell matrix objects, for example the current value of the kinetic energy.
set ke [ get_matrix_element matrix=dyn1.ke indices = { 0 0 } ]The kinetic energy, however, can also be accessed by
set ke [ dyn1 get kinetic_energy ]
Finally the object is destroyed to free up the memory.
dyn1 destroy
A classical example, a periodic water box, is also provided (water_shake_nve.chm). This illustrates the use of explicit shake constraints.