sponge.function.VelocityGenerator

View Source On Gitee
class sponge.function.VelocityGenerator(temperature: float = 300, remove_translation: bool = True, seed: int = 0, seed2: int = 0, length_unit: str = None, energy_unit: str = None)[source]

A class to generate velocities for atoms in system according to temperature

Parameters
  • temperature (float) – Temperature

  • remove_translation (bool) – Whether to calculate distance under periodic boundary condition. Default: True

  • seed (int) – Random seed for standard normal. Default: 0

  • seed2 (int) – Random seed2 for standard normal. Default: 0

  • length_unit (str) – Length unit. Default: None

  • energy_unit (str) – energy unit. Default: None

Examples

>>> from sponge import UpdaterMD
>>> from sponge.function import VelocityGenerator
>>> vgen = VelocityGenerator(300)
>>> velocity = vgen(system.shape, system.atom_mass)
>>> opt = UpdaterMD(system=system,
...                 time_step=1e-3,
...                 velocity=velocity,
...                 integrator='velocity_verlet',
...                 temperature=300,
...                 thermostat='langevin')
set_temperature(temperature: float)[source]

set temperature.

Parameters

temperature (float) – temperature