|
The
Molecular Dynamics class
(Motors)
is a subclass of the Molecular
Mechanics
(MolMech)
class.
The
Motors
class is defined in the
MolDynam
module in Yup.Models. The import statement would be
some variant of:
from
Yup.Methods.MolDynam import
Motors.
Data
Attributes
Data
attribute names are case-sensitive. Two
attributes (Temperature and ThermMethod) are read-only. This class will
malfunction if these attributes are created in an
assignment statement. To recover, delete the
attributes that have been created. Read-only attributes
must be set not by assignment but by calling the
appropriate methods. In addition to these data
attributes this class also inherits the attributes
from the MolMech
class: this means you have another set of attributes that you can query or set.
|
Attribute
|
Description
|
|
StepSize
|
The
step size to be used in the integration of
the equations of motion. The preset value
is 0.001 and the unit is
picosecond.
|
|
ThermalizationInterval
|
The
number of steps between adjustment of the
velocities. The velocities are adjusted to
the current target temperature using a
thermalization method. The preset value is
0, which means no adjustment.
|
|
CollisionFrequency
|
The default value is 0.0
ps-1. Langevin dynamics will be carried out if this is greater than 0.0. Otherwise, Newtonian dynamics.
|
|
CouplingConstant
|
The
is the ratio of the step size over the
coupling time constant (of the Berendsen
heat bath) and is therefore dimensionless.
The preset value is 0.01.
|
|
Temperature
|
This
is read-only. Returns the current
temperature [K]. To force the
model to a specific temperature, use the
set_Temperature()
method.
|
|
ThermMethod
|
This
is read-only. Returns the name of the
current thermalization method. To set a
thermalization method use the
set_ThermMethod()
method.
|
|
VelocityArchive
|
Name
of archive into which the Velocities will
be written at intervals defined in the
MolMech.ArchiveInterval
attribute. The default value is a blank
string which means that this archive is
not created regardless of the value of the
ArchiveInterval
attribute.
|
Methods
The
Motors
class defines the constructor function and three
methods.
The constructor function requires one argument, the
model on which the molecular dynamics method is to
be applied. This is a Model
object that is constructed by a force
field assembler.
|
Constructor
|
Number
of Arguments
|
Return
Value
|
|
Motors
|
1
|
The
new Motors object
|
|
Argument
|
Purpose
|
Preset
Value
|
|
a
Model object
|
the
model that is to be subjected to the
molecular mechanics
calculation
|
-
|
The
model object must be complete, i.e., the
Map,
Energy
and Coordinates
attributes must all be defined.
The set_ThermMethod
method selects the thermalization method that is to
be used to adjust velocities.
|
Method
|
Argument
Keyword
|
Return
Value
|
|
set_ThermMethod
|
"method"
|
-
|
|
Argument
|
Type
|
Preset
Value
|
|
method
|
String
|
-
|
The
method names are: 'NEW', 'SCALE' and 'BERENDSEN'.
The default setting is 'NEW'.
With
the 'NEW' method, the velocities are generated from
a Gaussian distribution so that the temperature of
the model is at the target value.
With
the 'SCALE' method, the velocities are scaled so
that the temperature of the model is at the target
value.
The
'BERENDSEN' method simulates a loosely coupled heat
bath and the degree of coupling can be adjusted
with the CouplingConstant
attribute.
The set_Temperature
method adjusts the velocities to force the model to
the specified temperature.
|
Method
|
Argument
Keyword
|
Return
Value
|
|
set_Temperature
|
"T"
|
-
|
|
Argument
|
Type
|
Preset
Value
|
|
T
|
Float
|
-
|
| ranseed |
Integer |
0 |
If
the prevailing temperature is below 0.1K, the
velocities are set to the specified value of
T
from the Gaussian distribution. If the model is at
a higher temperature, the velocities are scaled to
the specified value.
The
second argument can be used to cause the random number generator to be
seeded with a non-default value. With the default argument value of 0,
there is no change in the procedure described in the above paragraph.
If ranseed has a positive value, that value is used to seed the random number generator. If ranseed
is negative, then the current time (number of seconds since the
beginning of system time) is used to seed the random number generator.
The Verlet
method carries out a molecular dynamics calculation
using the Verlet method.
|
Method
|
Argument
Keywords
|
Return
Value
|
|
Verlet
|
"numstep",
"limit"
|
-
|
|
Argument
|
Type
|
Preset
Value
|
|
numstep
|
Integer
|
-
|
|
target
|
Float
|
None
|
|
limit
|
None, a group AtomMap, or a list of two integers
|
None
|
Molecular
dynamics can be restricted to a portion of a
system. Please see the Targeted Simulation section of the Introduction to see how to set limit.
Molecular
dynamics is carried out over
numstep
integrations of the equations of motion. The time
interval is therefore StepSize
x numstep
in units of picoseconds. The velocities are updated
using the selected thermalization method every
ThermalizationInterval
steps. If target
is None, the velocities are adjusted to the
prevailing temperature. If
target
is a temperature in K, the velocities are adjusted
every ThermalizationInterval
steps to the target temperature that is on a linear
trend between the starting temperature and the
value of target.
With the CollisionFrequency at the default value of 0.0 ps-1, regular Newtonian dynamics will be carried out. If set above 0.0, Langevin dynamics will be carried out.
The Energies method
provides a listing of components of the potential energy, the gradient
norm, the kinetic energy, the total energy and the temperature.
|
Method
|
Argument
Keywords
|
Return
Value
|
|
Energies
|
"option"
|
-
|
|
Argument
|
Type
|
Preset
Value
|
|
option
|
Integer
|
0
|
In the
default, the listing consists of a title line followed by a blank line
(1), the labels (2), the energy values (3) and a blank line followed by
a summary (4). Partial listings can be obtained by calling this method
with the option argument set to any of the four numbers listed within
parentheses.
Example
>>> from Yup.Models.TestTube.FFA import makecircle >>> from Yup.Methods.EnerMinim import Minimizers >>> from Yup.Methods.MolDynam import Motors >>> >>> M = makecircle( 100 ); O = Minimizers( M ); D = Motors( M ) >>> >>> D.set_ThermMethod( 'BERENDSEN' ) >>> D.ThermalizationInterval = 25 >>> minimize = O.SteepestDescent >>> dynamics = D.Verlet >>> >>> minimize( 1000 ); dynamics( 10000, 300.0 ); dynamics( 10000, 300.0 ); dynamics( 10000, 1.0 ); minimize( 1000 )
|
In
this example, we start with the required imports:
the makecircle()
method from the TestTube force field assembler, the
Minimizers class from the Energy Minimization
module and the Motors class from the MolDynam
module.
The
makecircle()
method assembles the force field for a circular
chain of beads, and the example asks for a chain of
100 beads and the Model that is returned is saved
in the variable M. M is then passed
to the Minimizers()
constructor function and the object that is
returned is then saved in the variable O. A
Motors object is also constructed and saved in the
variable D.
The
thermalization method is set to 'BERENDSEN' using
the set_ThermMethod()
method and the thermalization interval is set to
25. The steepest descent method is selected from
the EnerMinim class and saved to the variable
minimize. Similarly, the Verlet method is
selected from the Motors object and assigned to the
variable dynamics.
The
calculation consists of 1000 steps of energy
minimization at the start and again at the end of
the procedure. In between, molecular dynamics
simulations are carried out in three blocks of
10000 steps each. In the first block the
temperature is raised from the starting value which
is 0K to 300K. In the next block the temperature is
maintained at 300K. In the final block the
temperature target is lowered to 1K.
|