55Each integrator handles batched simulations efficiently using PyTorch tensors and
66supports periodic boundary conditions.
77
8+ NVE:
9+ - Velocity Verlet integrator for constant energy simulations :func:`nve.nve_step`
10+ NVT:
11+ - Langevin thermostat integrator :func:`nvt.nvt_langevin_step`
12+ using BAOAB scheme [1]
13+ - Nosé-Hoover thermostat integrator :func:`nvt.nvt_nose_hoover_step` from [2]
14+ NPT:
15+ - Langevin barostat integrator :func:`npt.npt_langevin_step`
16+ - Nosé-Hoover barostat integrator :func:`npt.npt_nose_hoover_step` from [2]
17+
18+ References:
19+ [1] Leimkuhler B, Matthews C.2016 Efficient molecular dynamics using geodesic
20+ integration and solvent-solute splitting. Proc. R. Soc. A 472: 20160138
21+ [2] Martyna, G. J., Tuckerman, M. E., Tobias, D. J., & Klein, M. L. (1996).
22+ Explicit reversible integrators for extended systems dynamics.
23+ Molecular Physics, 87(5), 1117-1157.
24+
825Examples:
926 >>> import torch_sim as ts
1027 >>> state = ts.nvt_langevin_init(model, initial_state, kT=300.0 * units.temperature)
1633Notes:
1734 All integrators support batched operations for efficient parallel simulation
1835 of multiple systems.
36+
37+
1938"""
2039
2140# ruff: noqa: F401
4766
4867
4968class Integrator (StrEnum ):
50- """Flavor of molecular dynamics simulation."""
69+ """Enumeration of available molecular dynamics (MD) integrators.
70+
71+ Each member represents a different simulation ensemble or thermostat/barostat
72+ scheme. These values are used as keys in :data:`INTEGRATOR_REGISTRY`
73+ to select the corresponding initialization and stepping functions.
74+
75+ Available options:
76+ - ``nve``: Constant energy (microcanonical) ensemble.
77+ - ``nvt_langevin``: Langevin thermostat for constant temperature.
78+ - ``nvt_nose_hoover``: Nosé-Hoover thermostat for constant temperature.
79+ - ``npt_langevin``: Langevin barostat for constant temperature and pressure.
80+ - ``npt_nose_hoover``: Nosé-Hoover barostat for constant temperature
81+ and constant pressure.
82+
83+ Example:
84+ >>> integrator = Integrator.nvt_langevin
85+ >>> print(integrator.value)
86+ 'nvt_langevin'
87+
88+ """
5189
5290 nve = "nve"
5391 nvt_langevin = "nvt_langevin"
@@ -56,7 +94,29 @@ class Integrator(StrEnum):
5694 npt_nose_hoover = "npt_nose_hoover"
5795
5896
59- # Integrator registry - maps integrator names to (init_fn, step_fn) pairs
97+ #: Integrator registry - maps integrator names to (init_fn, step_fn) pairs.
98+ #:
99+ #: This dictionary associates each :class:`Integrator` enum value with a pair
100+ #: of callables:
101+ #:
102+ #: - **init_fn**: A function used to initialize the integrator state.
103+ #: - **step_fn**: A function that advances the state by one simulation step.
104+ #:
105+ #: Example:
106+ #:
107+ #: >>> init_fn, step_fn = INTEGRATOR_REGISTRY[Integrator.nvt_langevin]
108+ #: >>> state = init_fn(...)
109+ #: >>> new_state = step_fn(state, ...)
110+ #:
111+ #: The available integrators are:
112+ #:
113+ #: - ``Integrator.nve``: Velocity Verlet (microcanonical)
114+ #: - ``Integrator.nvt_langevin``: Langevin thermostat
115+ #: - ``Integrator.nvt_nose_hoover``: Nosé-Hoover thermostat
116+ #: - ``Integrator.npt_langevin``: Langevin barostat
117+ #: - ``Integrator.npt_nose_hoover``: Nosé-Hoover barostat
118+ #:
119+ #: :type: dict[Integrator, tuple[Callable[..., Any], Callable[..., Any]]]
60120INTEGRATOR_REGISTRY : Final [
61121 dict [Integrator , tuple [Callable [..., Any ], Callable [..., Any ]]]
62122] = {
0 commit comments