17.1.1.6. pysisyphus.dynamics package

17.1.1.6.1. Submodules

17.1.1.6.2. pysisyphus.dynamics.Gaussian module

class pysisyphus.dynamics.Gaussian.DummyColvar[source]

Bases: object

eval(x)[source]
class pysisyphus.dynamics.Gaussian.Gaussian(w=1, s=1, x0=None, colvar=None, dump_name=None)[source]

Bases: object

__init__(w=1, s=1, x0=None, colvar=None, dump_name=None)[source]
See:

https://doi.org/10.1016/j.cpc.2018.02.017

V(f(x)) = w * exp(-(f(x) - f0)**2 / (2*s**2))

F(x) = -dV/dx = -dV/df * df/dx

See also:

https://doi.org/10.1103/PhysRevLett.90.238302

calculate(coords, x0=None, gradient=False)[source]

Return potential and gradient for Gaussian(s) centered at x0.

dump(step, s, w, center)[source]
eval(coords, x0=None)[source]
gradient(coords, x0=None)[source]
property s
value(coords, x0=None)[source]
property w

17.1.1.6.3. pysisyphus.dynamics.colvars module

class pysisyphus.dynamics.colvars.CVBend(indices, **kwargs)[source]

Bases: Colvar

value(c3d)[source]
class pysisyphus.dynamics.colvars.CVDistance(indices, **kwargs)[source]

Bases: Colvar

value(c3d)[source]
class pysisyphus.dynamics.colvars.CVTorsion(indices, **kwargs)[source]

Bases: Colvar

value(c3d)[source]
class pysisyphus.dynamics.colvars.Colvar(force_agrad=False)[source]

Bases: object

eval(coords)[source]
gradient(c3d)[source]
abstract value(c3d)[source]
pysisyphus.dynamics.colvars.get_colvar(key, kwargs)[source]

17.1.1.6.4. pysisyphus.dynamics.driver module

class pysisyphus.dynamics.driver.MDResult(coords, t_ps, step, terminated, T, E_tot)

Bases: tuple

E_tot

Alias for field number 5

T

Alias for field number 4

coords

Alias for field number 0

step

Alias for field number 2

t_ps

Alias for field number 1

terminated

Alias for field number 3

pysisyphus.dynamics.driver.get_data_model(atoms, dump_steps)[source]
pysisyphus.dynamics.driver.md(geom, v0, steps, dt, remove_com_v=True, thermostat=None, T=298.15, timecon=100, term_funcs=None, constraints=None, constraint_kwargs=None, gaussians=None, verbose=True, print_stride=50, dump_stride=None, h5_group_name='run')[source]

Velocity verlet integrator.

Parameters:
  • geom (Geometry) -- The system for which the dynamics are to be run.

  • v0 (np.array, floats) -- Initial velocities in Bohr/fs.

  • steps (float) -- Number of simulation steps.

  • dt (float) -- Timestep in fs.

  • remove_com_v (bool, default=True) -- Remove center-of-mass velocity.

  • thermostat (str, optional, default None) -- Which and whether to use a thermostat.

  • T (float, optional, default=None) -- Desired temperature in thermostated runs.

  • timecon (float) -- Timeconsanst of the thermostat in fs.

  • term_funcs (dict, optional) -- Iterable of functions that are called with the atomic coordinates in every MD cycle and result in termination

  • constraints (2d iterable, optional) -- 2D iterable containing atom indices describing constrained bond lengths. of the MD integration when they evaluate to true.

  • constraint_kwargs (dict, optional) -- Keyword arguments for the constraint algorithm.

  • gaussians (list, optional, default=None) -- List of Gaussians to be used in a metadynamics run.

  • verbose (bool, default=True) -- Do additional printing when True.

  • print_stride (int, default=50) -- Report every n-th step.

  • dump_stride (int, default=None) -- If given, MD data will be dumped to a HDF5 file every n-th step.

  • str (h5_group_name =) -- Name of the HDF5 group, used for dumping.

  • optional -- Name of the HDF5 group, used for dumping.

17.1.1.6.5. pysisyphus.dynamics.helpers module

pysisyphus.dynamics.helpers.dump_coords(atoms, coords, trj_fn)[source]
pysisyphus.dynamics.helpers.energy_forces_getter_closure(geom)[source]
pysisyphus.dynamics.helpers.get_mb_velocities(masses, cart_coords, T, remove_com_v=True, remove_rot_v=True, seed=None)[source]

Initial velocities from Maxwell-Boltzmann distribution.

Parameters:
  • masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses in amu.

  • cart_coords (iterable, 1d, shape (3 * number of atoms, )) -- Atomic cartesian coordinates. Needed for removal of rotation.

  • T (float) -- Temperature in Kelvin.

  • remove_com_v (bool, default=True, optional) -- Whether to remove center-of-mass velocity.

  • remove_rot_v (bool, default=True, optional) -- Whether to remove rotational velocity.

  • seed (int, default=None, optional) -- Seed for the random-number-generator.

Returns:

v -- Initial velocities in Bohr/fs.

Return type:

np.array, 2d, shape (number of atoms, 3)

pysisyphus.dynamics.helpers.get_mb_velocities_for_geom(geom, T, remove_com_v=True, remove_rot_v=True, seed=None)[source]

Initial velocities from Maxwell-Boltzmann distribution.

See 'get_mb_velocities' for explanation.

pysisyphus.dynamics.helpers.kinetic_energy_for_temperature(atom_number, T, fixed_dof=0)[source]

Kinetic energy for given temperature and number of atoms.

Each atom has three degrees of freedom (1/2 * 3 == 3/2).

Parameters:
  • atom_number (int) -- Number of atoms. Each atom has three degrees of freedom.

  • T (float) -- Temperature in Kelvin.

  • fixed_dof (int, optional, default=0) -- Number of fixed degrees of freedom, e.g. 3 when the center-of-mass velocity is removed.

Returns:

E_kin -- Kinetic energy in Hartree.

Return type:

float

pysisyphus.dynamics.helpers.kinetic_energy_from_velocities(masses, velocities)[source]

Kinetic energy for given velocities and masses.

Parameters:
  • masses (1d array, shape (number of atoms, )) -- Atomic masses in amu.

  • velocities (2d array, (number of atoms, 3)) -- Atomic velocities in Bohr/fs.

Returns:

E_kin -- Kinetic energy in Hartree.

Return type:

float

pysisyphus.dynamics.helpers.remove_com_velocity(v, masses, keep_norm=True)[source]

Remove center-of-mass velocity.

Returned units vary with the given input units.

Parameters:
  • v (np.array, 2d, shape (number of atoms, 3)) -- Velocities.

  • masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses.

  • keep_norm (bool, default=True) -- Whether to rescale v to its original norm, after removal of v_com.

Returns:

v -- Velocities without center-of-mass velocity.

Return type:

np.array

pysisyphus.dynamics.helpers.scale_velocities_to_energy(masses, v, E_desired)[source]

Scale velocities to a given temperature.

Parameters:
  • masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses in amu.

  • v (np.array, 2d, shape (number of atoms, 3)) -- (Unscaled) velocities in Bohr/fs.

  • E_desired (float) -- Desired kinetic energy in Hartree.

Returns:

v -- Scaled velocities in Bohr/fs.

Return type:

np.array, 2d, shape (number of atoms, 3)

pysisyphus.dynamics.helpers.scale_velocities_to_temperatue(masses, v, T_desired, fixed_dof=0)[source]

Scale velocities to a given temperature.

Parameters:
  • masses (np.array, 1d, shape (number of atoms, )) -- Atomic masses in amu.

  • v (np.array, 2d, shape (number of atoms, 3)) -- (Unscaled) velocities in Bohr/fs.

  • T_desired (float) -- Desired temperature in Kelvin.

  • fixed_dof (int, optional, default=0) -- Number of fixed degrees of freedom, e.g. 3 when the center-of-mass velocity is removed.

Returns:

v -- Scaled velocities in Bohr/fs.

Return type:

np.array, 2d, shape (number of atoms, 3)

pysisyphus.dynamics.helpers.temperature_for_kinetic_energy(atom_number, E_kin, fixed_dof=0)[source]

Temperature for given kinetic energy and atom number.

Each atom has three degrees of freedom (1/2 * 3 == 3/2).

Parameters:
  • atom_number (int) -- Number of atoms. Each atom has three degrees of freedom.

  • E_kin (float) -- Kinetic energy in Hartree.

  • fixed_dof (int, optional, default=0) -- Number of fixed degrees of freedom, e.g. 3 when the center-of-mass velocity is removed.

Returns:

Temperature -- Temperature in Kelvin.

Return type:

float

pysisyphus.dynamics.helpers.unscaled_velocity_distribution(masses, T, seed=None)[source]

ρ ∝ exp(- v² * m / (2 * kT)) ln(ρ) ∝ - 1/2 * v² * m / kT v² ∝ -2 * ln(ρ) * kT / m v ∝ ±(-2 * ln(ρ) * kT / m)**0.5 v ∝ ±(-2 * k)**0.5 * (ln(ρ) * T / m)**0.5

The first term of the RHS is constant. As we later scale the velocities we neglect it. Don't use these velocities unscaled!

v ∝ ±(ln(ρ) * T / m)**0.5

17.1.1.6.6. pysisyphus.dynamics.lincs module

pysisyphus.dynamics.lincs.lincs_closure(geom, constraints, order=4)[source]

Drop conn_nums and keep conns_ in a list of list, instead of an array. We could do everything with

for i, conn_constr in enumerate(conns)

pass

instead of the pseudo-code way as given in the paper.

17.1.1.6.7. pysisyphus.dynamics.mdp module

pysisyphus.dynamics.mdp.MDPResult

alias of MDResult

pysisyphus.dynamics.mdp.mdp(geom, steps, dt, term_funcs=None, steps_init=None, E_excess=0.0, displ_length=0.1, epsilon=0.0005, ascent_alpha=0.05, max_ascent_steps=25, max_init_trajs=10, dump=True, seed=None, external_md=False)[source]
pysisyphus.dynamics.mdp.parse_raw_term_func(raw_term_func)[source]
pysisyphus.dynamics.mdp.parse_raw_term_funcs(raw_term_funcs)[source]
pysisyphus.dynamics.mdp.run_md(geom, dt, steps, v0=None, term_funcs=None, external=False)[source]

17.1.1.6.8. pysisyphus.dynamics.rattle module

pysisyphus.dynamics.rattle.rattle_closure(geom, constraints, dt, tol=0.001, max_cycles=25, energy_forces_getter=None, remove_com_v=True)[source]

17.1.1.6.9. pysisyphus.dynamics.thermostats module

pysisyphus.dynamics.thermostats.berendsen_closure(sigma, dof, dt, tau=100, rng=None)[source]

https://doi.org/10.1063/1.448118

pysisyphus.dynamics.thermostats.csvr_closure(sigma, dof, dt, tau=100, rng=None)[source]
Parameters:
  • sigma (float) -- Target average value of the kinetic energy (1/2 dof k_b T) in the same units as cur_kinetic_energy.

  • dof (int) -- Degrees of freedom.

  • tau (float) -- Timeconstant of the thermostat. tau : float Timeconstant of the thermostat.

  • rng (numpy.random.Generator, optional) -- Instances of a random number generator (RNG). If it is not provided the module-level RNG will be used.

pysisyphus.dynamics.thermostats.csvr_closure_2(sigma, dof, dt, tau=100, rng=None)[source]
pysisyphus.dynamics.thermostats.sum_noises(num, rng=None)[source]
Parameters:
  • num (int) -- Number of independent Gaussian noises to be squared.

  • rng (numpy.random.Generator, optional) -- Instances of a random number generator (RNG). If it is not provided the module-level RNG will be used.

17.1.1.6.10. Module contents