verlet#
Generic Verlet integrator
Classes#
Base class for dataclasses that should act like a JAX pytree node. |
|
A class that tracks the errors on the conserved quantity. |
|
Specialized Verlet hook. |
|
Specialized Verlet hook. |
|
Specialized Verlet hook. |
|
Specialized Verlet hook. |
|
Base class for dataclasses that should act like a JAX pytree node. |
Module Contents#
- class verlet.TemperatureStateItem(*args, **kwargs)#
Bases:
IMLCV.new_yaff.iterative.StateItemBase class for dataclasses that should act like a JAX pytree node.
- get_value(iterative)#
- class verlet.ConsErrTracker(*args, **kwargs)#
Bases:
IMLCV.base.datastructures.MyPyTreeNodeA class that tracks the errors on the conserved quantity. Given its superior numerical accuracy, the algorithm below is used to calculate the running average. Its properties are discussed in Donald Knuth’s Art of Computer Programming, vol. 2, p. 232, 3rd edition.
- update(ekin, econs)#
- get()#
- class verlet.VerletHook(*args, **kwargs)#
Bases:
IMLCV.new_yaff.iterative.HookSpecialized Verlet hook.
This is mainly used for the implementation of thermostats and barostats.
- __call__(iterative: VerletIntegrator)#
- abstract init(iterative: VerletIntegrator) tuple[Self, VerletIntegrator]#
- abstract pre(iterative: VerletIntegrator, **kwargs) tuple[Self, VerletIntegrator]#
- abstract post(iterative: VerletIntegrator, **kwargs) tuple[Self, VerletIntegrator]#
- class verlet.ThermostatHook(*args, **kwargs)#
Bases:
VerletHookSpecialized Verlet hook.
This is mainly used for the implementation of thermostats and barostats.
- abstract pre(iterative: VerletIntegrator, G1_add: jax.Array | None = None) tuple[Self, VerletIntegrator]#
- abstract post(iterative: VerletIntegrator, G1_add: jax.Array | None = None) tuple[Self, VerletIntegrator]#
- class verlet.BarostatHook(*args, **kwargs)#
Bases:
VerletHookSpecialized Verlet hook.
This is mainly used for the implementation of thermostats and barostats.
- abstract pre(iterative: VerletIntegrator, chainvel0: jax.Array | None = None) tuple[Self, VerletIntegrator]#
- abstract post(iterative: VerletIntegrator, chainvel0: jax.Array | None = None) tuple[Self, VerletIntegrator]#
- class verlet.NVE(*args, **kwargs)#
Bases:
VerletHookSpecialized Verlet hook.
This is mainly used for the implementation of thermostats and barostats.
- _: dataclasses.KW_ONLY#
- temp: float = 0.0#
Specialized Verlet hook.
This is mainly used for the implementation of thermostats and barostats.
- __call__(iterative)#
- init(iterative: VerletIntegrator) tuple[VerletHook, VerletIntegrator]#
- pre(iterative: VerletIntegrator) tuple[VerletHook, VerletIntegrator]#
- post(iterative: VerletIntegrator) tuple[VerletHook, VerletIntegrator]#
- class verlet.VerletIntegrator(*args, **kwargs)#
Bases:
IMLCV.base.datastructures.MyPyTreeNodeBase class for dataclasses that should act like a JAX pytree node.
- verlet_hook: VerletHook#
- _cons_err_tracker: ConsErrTracker | None = None#
- other_hooks: list[IMLCV.new_yaff.iterative.Hook]#
- static create(ff: IMLCV.new_yaff.ff.YaffFF, other_hooks: list[IMLCV.new_yaff.iterative.Hook], timestep: float, thermostat: ThermostatHook | None = None, barostat: BarostatHook | None = None, vel0: jax.Array | None = None, temp0: float = 300.0, scalevel0: bool = True, time0: float | None = None, ndof: int | None = None, counter0: int | None = None, key=42)#
Arguments:
- ff
A ForceField instance
Optional arguments:
- timestep
The integration time step (in atomic units)
- state
A list with state items. State items are simple objects that take or derive a property from the current state of the iterative algorithm.
- hooks
A function (or a list of functions) that is called after every iterative.
- vel0
An array with initial velocities. If not given, random velocities are sampled from the Maxwell-Boltzmann distribution corresponding to the optional arguments temp0 and scalevel0
- temp0
The (initial) temperature for the random initial velocities
- scalevel0
If True (the default), the random velocities are rescaled such that the instantaneous temperature coincides with temp0.
- time0
The time associated with the initial state.
- ndof
When given, this option overrides the number of degrees of freedom determined from internal heuristics. When ndof is not given, its default value depends on the thermostat used. In most cases it is 3*natom, except for the NHC thermostat where the number if internal degrees of freedom is counted. The ndof attribute is used to derive the temperature from the kinetic energy.
- counter0
The counter value associated with the initial state.
- propagate()#
- _compute_ekin()#
Auxiliary routine to compute the kinetic energy
This is used internally and often also by the Verlet hooks.
- compute_properties()#
- finalize()#
- call_hooks()#
- run(nstep=None)#