md module

Full Documentation for hippynn.molecular_dynamics.md module. Click here for a summary page.

class LangevinDynamics(force_db_name: str, temperature: float, frix: float, units_force: float = None, units_acc: float = None, seed: int | None = None)[source]

Bases: VariableUpdater

Implements the Langevin algorithm

post_step(dt: float, model_outputs: dict)[source]

Updates to variables performed during each step of MD simulation after HIPNN model evaluation

Parameters:
  • dt – timestep

  • model_outputs – dictionary of HIPNN model outputs

pre_step(dt: float)[source]

Updates to variables performed during each step of MD simulation before HIPNN model evaluation

Parameters:

dt – timestep

required_variable_data = ['position', 'velocity', 'mass']
class MolecularDynamics(variables: list[Variable], model: Predictor, device: device | None = None, dtype: dtype | None = None)[source]

Bases: object

Driver for MD run

get_data()[source]

Returns a dictionary of the recorded data

reset_data()[source]

Clear all recorded data

run(dt: float, n_steps: int, record_every: int | None = None)[source]

Run n_steps of MD algorithm.

Parameters:
  • dt – timestep

  • n_steps – number of steps to execute

  • record_every – frequency at which to store the data at a step in memory, record_every = 1 means every step will be stored, defaults to None

to(arg)[source]
to(arg: device)
to(arg: dtype)
property device
property dtype
property model
property variables
class NullUpdater[source]

Bases: VariableUpdater

Makes no change to the variable data at each step of MD.

post_step(dt, model_outputs)[source]

Updates to variables performed during each step of MD simulation after HIPNN model evaluation

Parameters:
  • dt – timestep

  • model_outputs – dictionary of HIPNN model outputs

pre_step(dt)[source]

Updates to variables performed during each step of MD simulation before HIPNN model evaluation

Parameters:

dt – timestep

class Variable(name: str, data: dict[str, Tensor], model_input_map: dict[str, str] = {}, updater: VariableUpdater = None, device: device | None = None, dtype: dtype | None = None)[source]

Bases: object

Tracks the state of a quantity (eg. position, cell, species, volume) on each particle or each system in an MD simulation. Can also hold additional data associated to that quantity (such as its velocity, acceleration, etc…)

to(arg)[source]
to(arg: device)
to(arg: dtype)
property data
property device
property dtype
property model_input_map
property updater
class VariableUpdater[source]

Bases: object

Parent class for algorithms that make updates to the data of a Variable during each step of an MD simulation.

Subclasses should redefine __init__, pre_step, post_step, and required_variable_data as needed. The inputs to pre_step and post_step should not be changed.

post_step(dt: float, model_outputs: dict)[source]

Updates to variables performed during each step of MD simulation after HIPNN model evaluation

Parameters:
  • dt – timestep

  • model_outputs – dictionary of HIPNN model outputs

pre_step(dt: float)[source]

Updates to variables performed during each step of MD simulation before HIPNN model evaluation

Parameters:

dt – timestep

required_variable_data = []
property variable
class VelocityVerlet(force_db_name: str, units_force: float = None, units_acc: float = None)[source]

Bases: VariableUpdater

Implements the Velocity Verlet algorithm

post_step(dt: float, model_outputs: dict)[source]

Updates to variables performed during each step of MD simulation after HIPNN model evaluation

Parameters:
  • dt – timestep

  • model_outputs – dictionary of HIPNN model outputs

pre_step(dt: float)[source]

Updates to variables performed during each step of MD simulation before HIPNN model evaluation

Parameters:

dt – timestep

required_variable_data = ['position', 'velocity', 'acceleration', 'mass']