A DynamicalSystem object stores the dynamical state of a molecular dynamics simulation. It has methods to integrate the equations of motion using the Velocity-Verlet algorithm.
A DynamicalSystem is constructed from an Atoms object atoms. The initial velocities and accelerations can optionally be specificed as (3,atoms.n) arrays. The constraints and rigidbodies arguments can be used to specify the number of constraints and rigid bodies respectively (the default is zero in both cases).
Attributes:
Atoms object used to store all dynamical variables. Important properties include:
- pos
- Real vector. Positions of atoms.
- velo
- Real vector. Velocity of each atom.
- acc
- Real vector. Acceleration of each atom.
- avgpos
- Real vector. Time-averaged position of each atom.
- oldpos
- Real vector. Position of each atom at previous time step.
- mass
- Real scalar. Atomic masses.
- travel
- Integer vector. Travel across the periodic boundary conditions.
- move_mask
- Integer scalar. Mask used to fix atoms. Defaults to 1 for all atoms.
- damp_mask
- Integer salar. Mask to select atoms for damping. Defaults to 1 for all atoms.
- thermostat_mask
- Integer scalar. Mask to select which thermostat to use for each atom. Defaults to 1 for all atoms.
- avg_ke
- Real scalar. Time-averaged kinetic energy of each atom.
Time-averaged temperature
Averaging time, in fs
Current temperature
Increment of work done this time step
Total potential energy
Extended energy
Number of atoms
Number of constraints
Number of degrees of freedom
Number of rigid bodies
Number of integration steps
RNG seed, used by ‘ds_save_state’ and ‘ds_restore_state’ only.
Time
Increment of work done by thermostat
Total work done by thermostat
Total work done
Important DynamicalSystem methods are listed below:
Equivalent of Atoms.add_atoms(), but also amends the number of degrees of freedom correctly.
Equivalent of Atoms.remove_atoms(), but also amends the number of degrees of freedom correctly.
Add or remove heat from the system by scaling the atomic velocities.
Add a new thermostat to this DynamicalSystem. type_bn should be one of 0 (no thermostat), 1 (Langevin), 2 (Nose-Hoover), 3 (Nose-Hoover-Langevin) or 4 (Langevin NPT). t is the target temperature. q is the Nose-Hoover coupling constant. Only one of tau or gamma should be given. p is the external pressure for the case of Langevin NPT.
Advance the velocities by half the time-step dt and the positions by a full time-step. A typical MD loop should resemble the following code. See the Potentials and DynamicalSystems section of the quippy tutorial for more details.
ds.atoms.calc_connect()
for n in range(n_steps):
ds.advance_verlet1(dt)
pot.calc(ds.atoms, force=True, energy=True)
ds.advance_verlet2(dt, ds.atoms.force)
ds.print_status(epot=ds.atoms.energy)
if n % connect_interval == 0:
ds.atoms.calc_connect()
Advances the velocities by the second half time-step.
Equivalent to advance_verlet2() followed by advance_verlet1(). This allows a simple MD loop:
for n in range(n_steps):
pot.calc(ds.atoms, force=True, energy=True)
ds.advance_verlet(dt, ds.atoms.force)
ds.print_status(epot=ds.atoms.energy)
if n % connect_interval == 0:
ds.atoms.calc_connect()
Return the angular momentum of all the atoms in this DynamicalSystem, defined by

Optionally the origin can be specified, or only specific atoms in the list indices can be included.
Return the velocity of the center of mass, optionally including only the atoms in index_list.
Return the acceleration of the center of mass, optionally including only the atoms in index_list.
Enable damping, with damping time set to damp_time. Only atoms flagged in the damp_mask property will be affected.
Disable damping for this DynamicalSystem.
Return the total kinetic energy 
Return the total momentum
.
Optionally only include the contribution of a subset of atoms in the array indices.
Print a status line showing the current time, temperature, the mean temperature the total energy and the total momentum for this DynamicalSystem. If present, the optional label parameter should be a one character label for the log lines and is printed in the first column of the output. epot should be the potential energy if this is available. instantaneous has the same meaning as in temperature().
Rescale the atomic velocities to temperature temp. If the
current temperature is zero, we first randomise the
velocities. If mass_weighted is true, then the velocites are
weighted by
. Linear momentum is zeroed
automatically. If zero_l is true then the angular momentum is
also zeroed.
Generator to return snapshots from a trajectory. For each step, forces are evaluated using the Potential pot and the DynamicalSystem is advanced by a time dt (default 1 fs). n_steps (default 10 steps) are carried out in total, with the generator yielding a result every save_interval steps. The connectivity is recalculated every connect_interval steps. args_str can be used to supply extra arguments to Potential.calc().
Return the temperature, assuming each degree of freedom
contributes
. By default only moving and
thermostatted atoms are included — this can be overriden by
setting include_all to true. region can be used to restrict
the calculation to a particular thermostat
region. instantaneous controls whether the calculation should
be carried out using the current values of the velocities and
masses, or whether to return the value at the last Verlet step
(the latter is the default).
Change velocities to those that the system would have in the zero momentum frame. Optionalally zero the total momentum of a subset of atoms, specified by indices.