kups.md.integrators
¶
CSVRStep
¶
Bases: Propagator[State]
Canonical Sampling through Velocity Rescaling (CSVR) thermostat step.
Implements the Bussi-Donadio-Parrinello algorithm for canonical sampling by stochastically rescaling velocities to maintain the target temperature. This produces correct canonical ensemble sampling unlike deterministic velocity rescaling (Berendsen thermostat).
The scaling factor \(\alpha^2\) is sampled from the conditional distribution:
The algorithm uses:
where:
- \(c_1 = e^{-\Delta t/\tau}\) — exponential decay factor
- \(c_2 = (1-c_1) \cdot K_{\text{target}}/(K_{\text{current}} \cdot N_{\text{dof}})\) — correction factor
- \(R_1 \sim \mathcal{N}(0,1)\) — Gaussian random variable
- \(R_2 \sim \chi^2(N_{\text{dof}}-1)\) — chi-squared random variable
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
State
|
Simulation state type |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
particles |
Lens[State, Table[ParticleId, IsCSVRParticleData]]
|
Lens to get/set indexed particle data (momenta \(\\mathbf{p}\), masses \(m\)) |
systems |
View[State, Table[SystemId, IsCSVRParams]]
|
View to extract system data (time step \(\\Delta t\), temperature \(T\), degrees of freedom \(N_{\\text{dof}}\), thermostat time constant \(\\tau\)) |
References
Bussi, G., Donadio, D., & Parrinello, M. (2007). Canonical sampling through velocity rescaling. J. Chem. Phys., 126(1), 014101. DOI: 10.1063/1.2408420
Source code in src/kups/md/integrators.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | |
__call__(key, state)
¶
Apply CSVR stochastic velocity rescaling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Array
|
JAX PRNG key for generating random noise |
required |
state
|
State
|
Current simulation state |
required |
Returns:
| Type | Description |
|---|---|
State
|
Updated state with rescaled momenta matching target temperature distribution |
Source code in src/kups/md/integrators.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | |
Flow
¶
Bases: Protocol
Protocol for position update flows with boundary conditions.
A flow defines how positions evolve under velocity updates, potentially including boundary conditions like periodic wrapping or reflections.
Source code in src/kups/md/integrators.py
__call__(state, dt, primal, tangent)
¶
Apply flow to update positions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
Current simulation state. |
required |
dt
|
Time
|
Timestep \(\Delta t\) (units: time). |
required |
primal
|
PyTree
|
Position \(\mathbf{r}\) (units: length). |
required |
tangent
|
PyTree
|
Velocity \(\mathbf{v}\) (units: length/time). |
required |
Returns:
| Type | Description |
|---|---|
PyTree
|
Updated position (units: length). |
Source code in src/kups/md/integrators.py
IsBAOABLangevinParams
¶
Bases: HasTimeStep, HasTemperature, HasFrictionCoefficient, Protocol
Integrator-params shape for :func:make_baoab_langevin_step.
Source code in src/kups/md/integrators.py
IsCSVRNPTParams
¶
Bases: HasTimeStep, HasTemperature, HasThermostatTimeConstant, HasTargetPressure, HasPressureCouplingTime, HasCompressibility, HasMinimumScaleFactor, Protocol
Integrator-params shape for :func:make_csvr_npt_step.
Source code in src/kups/md/integrators.py
IsCSVRParams
¶
Bases: HasTimeStep, HasTemperature, HasThermostatTimeConstant, Protocol
Integrator-params shape for :func:make_csvr_step.
Source code in src/kups/md/integrators.py
IsMDSystem
¶
Bases: HasCell[Periodic3D], HasIntegratorParams[P], Protocol
Protocol for an MD system row: a periodic cell plus bundled integrator parameters.
Source code in src/kups/md/integrators.py
IsMDSystemNPT
¶
Bases: IsMDSystem[IsCSVRNPTParams], Protocol
NPT MD system row: adds the cell-gradient leaf needed for the barostat.
Source code in src/kups/md/integrators.py
IsVerletParams
¶
Bases: HasTimeStep, Protocol
Integrator-params shape for :func:make_velocity_verlet_step.
Source code in src/kups/md/integrators.py
MomentumStep
¶
Bases: Propagator[State]
Update momenta using forces according to Newton's second law.
Implements the 'B' operator in splitting schemes, applying forces to update particle momenta. This is the dynamical update step that couples to the potential energy landscape.
The momentum update follows:
where \(\mathbf{F} = -\nabla U\) is the force derived from potential energy \(U\).
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
State
|
Simulation state type |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
particles |
Lens[State, Table[ParticleId, IsMomentumStepData]]
|
Lens to get/set indexed particle data (momenta \(\mathbf{p}\), forces \(\mathbf{F}\)) |
systems |
View[State, Table[SystemId, HasTimeStep]]
|
View to extract system data with time step \(\Delta t\) |
Source code in src/kups/md/integrators.py
__call__(key, state)
¶
Apply momentum update step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Array
|
JAX PRNG key (unused in this deterministic step). |
required |
state
|
State
|
Current simulation state. |
required |
Returns:
| Type | Description |
|---|---|
State
|
Updated state with new momenta. |
Source code in src/kups/md/integrators.py
PositionStep
¶
Bases: Propagator[State]
Update positions using velocities in molecular dynamics.
Implements the 'A' operator in splitting schemes, propagating positions forward in time using the current velocities. This is the kinematic update step in velocity Verlet and related integrators.
The position update follows:
where \(\mathbf{v} = \mathbf{p}/m\) is the velocity derived from momentum.
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
State
|
Simulation state type |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
particles |
Lens[State, Table[ParticleId, _PositionStepData]]
|
Lens to get/set indexed particle data (momenta \(\mathbf{p}\), positions \(\mathbf{r}\), masses \(m\)) |
systems |
View[State, Table[SystemId, HasTimeStep]]
|
View to extract system data with time step \(\Delta t\) |
flow |
Flow[State, Array]
|
Flow operator defining how positions evolve (handles boundary conditions) |
Source code in src/kups/md/integrators.py
__call__(key, state)
¶
Apply position update step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Array
|
JAX PRNG key (unused in this deterministic step). |
required |
state
|
State
|
Current simulation state. |
required |
Returns:
| Type | Description |
|---|---|
State
|
Updated state with new positions. |
Source code in src/kups/md/integrators.py
StochasticCellRescalingStep
¶
Bases: Propagator[State]
Stochastic cell rescaling barostat for NPT ensemble sampling.
Implements the isotropic stochastic cell rescaling algorithm (Bernetti & Bussi, 2020) that correctly samples the NPT ensemble. This first-order barostat includes a stochastic term to ensure proper volume fluctuations, unlike the Berendsen barostat which artificially suppresses fluctuations.
The algorithm scales both the simulation box and particle positions by a factor \(\mu\) determined by:
where:
- \(\tau_P\) = pressure coupling time constant
- \(P\) = instantaneous pressure
- \(P_0\) = target pressure
- \(\beta\) = isothermal compressibility
- \(k_B T\) = thermal energy
- \(V\) = box volume
- \(R \sim \mathcal{N}(0,1)\) = Gaussian random noise
The scaling is applied to both box and positions:
Important: The Cell must be reconstructed after scaling to ensure the cached volume is recomputed correctly.
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
State
|
Simulation state type |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
particles |
Lens[State, Table[ParticleId, _BarostatParticleData]]
|
Lens to get/set indexed particle data (positions \(\mathbf{r}\), momenta \(\mathbf{p}\), masses \(m\)) |
systems |
Lens[State, Table[SystemId, IsMDSystemNPT]]
|
Lens to get/set system data (lattice vectors \(\mathbf{L}\), stress tensor \(\mathbf{W}\), time step \(\Delta t\), temperature \(T\), target pressure \(P_0\), barostat time constant \(\tau_P\), compressibility \(\beta\), minimum scale factor \(\mu_{\text{min}}\)) |
References
Bernetti, M., & Bussi, G. (2020). Pressure control using stochastic cell rescaling. J. Chem. Phys., 153(11), 114107. DOI: 10.1063/5.0020514
Source code in src/kups/md/integrators.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
__call__(key, state)
¶
Apply stochastic cell rescaling for pressure control.
Scales the simulation box and particle positions by a factor determined from pressure deviation and stochastic fluctuations. The Cell is reconstructed to ensure cached volume is updated correctly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Array
|
JAX PRNG key for generating volume fluctuation noise |
required |
state
|
State
|
Current simulation state |
required |
Returns:
| Type | Description |
|---|---|
State
|
Updated state with rescaled box and positions matching NPT ensemble |
Source code in src/kups/md/integrators.py
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
StochasticStep
¶
Bases: Propagator[State]
Langevin thermostat stochastic step with exact Ornstein-Uhlenbeck solution.
Implements the 'O' operator in the BAOAB splitting scheme. This step exactly solves the Ornstein-Uhlenbeck stochastic differential equation:
The exact solution for timestep \(\Delta t\) is:
where \(\eta \sim \mathcal{N}(0,1)\) is Gaussian white noise. This preserves the correct Maxwell-Boltzmann distribution at temperature \(T\).
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
State
|
Simulation state type |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
particles |
Lens[State, Table[ParticleId, IsStochasticParticleData]]
|
Lens to get/set indexed particle data (momenta \(\mathbf{p}\), masses \(m\)) |
system |
View[State, Table[SystemId, IsBAOABLangevinParams]]
|
View to extract system data (time step \(\Delta t\), temperature \(T\), friction coefficient \(\gamma\)) |
References
Leimkuhler, B., & Matthews, C. (2013). Rational construction of stochastic numerical methods for molecular sampling. Appl. Math. Res. Express, 2013(1), 34-56. DOI: 10.1093/amrx/abs010
Source code in src/kups/md/integrators.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
__call__(key, state)
¶
Apply stochastic Ornstein-Uhlenbeck thermostat step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Array
|
JAX PRNG key for generating random noise |
required |
state
|
State
|
Current simulation state |
required |
Returns:
| Type | Description |
|---|---|
State
|
Updated state with thermostated momenta |
Source code in src/kups/md/integrators.py
WrapFlow
¶
Bases: Flow[State, PyTree]
Flow that applies the cell's wrap to updated positions.
After the base flow updates positions, applies the cell's wrap method.
On periodic axes this folds positions back into the box (minimum image
convention); on non-periodic axes wrap is the identity and positions
pass through unchanged.
Class Type Parameters:
| Name | Bound or Constraints | Description | Default |
|---|---|---|---|
State
|
Simulation state type |
required | |
PyTree
|
JAX PyTree type for positions |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
cell |
View[State, Cell]
|
View to extract the Cell from state |
flow |
Flow[State, PyTree]
|
Underlying flow operator (typically euclidean_flow) |
Example
Source code in src/kups/md/integrators.py
euclidean_flow(state, dt, primal, tangent)
¶
Flow in unbounded Euclidean space without boundary conditions.
Implements simple kinematic update:
Use this for non-periodic systems or when positions are handled differently.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Any
|
Current simulation state (unused but required by Flow protocol) |
required |
dt
|
Time
|
Timestep \(\Delta t\) (units: time) |
required |
primal
|
Array
|
Position \(\mathbf{r}\) (units: length) |
required |
tangent
|
Array
|
Velocity \(\mathbf{v}\) (units: length/time) |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Updated position \(\mathbf{r}_{\text{new}}\) (units: length) |
Source code in src/kups/md/integrators.py
make_baoab_langevin_step(particles, systems, derivative_computation, flow)
¶
Create BAOAB Langevin integrator for canonical (NVT) ensemble sampling.
BAOAB is a second-order splitting scheme for Langevin dynamics that provides efficient sampling of the canonical ensemble. The name comes from the sequence of operators: B (momentum kick), A (position update), O (Ornstein-Uhlenbeck), A (position update), B (momentum kick).
Algorithm steps:
- B: \(\mathbf{p}(t+\Delta t/4) = \mathbf{p}(t) + \mathbf{F}(t) \cdot \Delta t/2\) — half momentum step
- A: \(\mathbf{r}(t+\Delta t/2) = \mathbf{r}(t) + \mathbf{p}(t+\Delta t/4)/m \cdot \Delta t/2\) — half position step
- O: $\mathbf{p}(t+3\Delta t/4) = $ exact OU solution — stochastic thermostat
- A: \(\mathbf{r}(t+\Delta t) = \mathbf{r}(t+\Delta t/2) + \mathbf{p}(t+3\Delta t/4)/m \cdot \Delta t/2\) — half position step
- Compute \(\mathbf{F}(t+\Delta t)\) — force evaluation
- B: \(\mathbf{p}(t+\Delta t) = \mathbf{p}(t+3\Delta t/4) + \mathbf{F}(t+\Delta t) \cdot \Delta t/2\) — half momentum step
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles
|
Lens[State, Table[ParticleId, _MDParticleData]]
|
Lens to get/set indexed particle data (momenta \(\\mathbf{p}\), positions \(\\mathbf{r}\), forces \(\\mathbf{F}\), masses \(m\)) |
required |
systems
|
View[State, Table[SystemId, HasIntegratorParams[IsBAOABLangevinParams]]]
|
View to extract system data (time step \(\\Delta t\), thermal energy \(k_B T\), friction coefficient \(\\gamma\)) |
required |
derivative_computation
|
Propagator[State]
|
Propagator to compute forces \(\\mathbf{F}\) from state |
required |
flow
|
Flow[State, Array]
|
Flow operator for position updates (handles boundary conditions) |
required |
Returns:
| Type | Description |
|---|---|
SequentialPropagator[State]
|
SequentialPropagator implementing the BAOAB algorithm |
References
Leimkuhler, B., & Matthews, C. (2013). Rational construction of stochastic numerical methods for molecular sampling. Appl. Math. Res. Express, 2013(1), 34-56. DOI: 10.1093/amrx/abs010
Source code in src/kups/md/integrators.py
make_csvr_npt_step(particles, systems, derivative_computation, flow)
¶
Create NPT integrator for isothermal-isobaric (NPT) ensemble sampling.
Combines CSVR thermostat for temperature control with stochastic cell rescaling (Bernetti-Bussi 2020) for pressure control, integrated with velocity Verlet dynamics. This correctly samples the NPT ensemble with proper volume fluctuations.
Algorithm sequence per timestep:
- Apply CSVR velocity rescaling (temperature control)
- Velocity Verlet integration:
- \(\mathbf{p}(t+\Delta t/2) = \mathbf{p}(t) + \mathbf{F}(t) \cdot \Delta t/2\) — half momentum step
- \(\mathbf{r}(t+\Delta t) = \mathbf{r}(t) + \mathbf{p}(t+\Delta t/2)/m \cdot \Delta t\) — full position step
- Compute \(\mathbf{F}(t+\Delta t)\) — force evaluation
- \(\mathbf{p}(t+\Delta t) = \mathbf{p}(t+\Delta t/2) + \mathbf{F}(t+\Delta t) \cdot \Delta t/2\) — half momentum step
- Stochastic cell rescaling (pressure control)
- Recompute forces and stress after box/position scaling
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles
|
Lens[State, Table[ParticleId, _BarostatParticleData]]
|
Lens to get/set indexed particle data (momenta \(\\mathbf{p}\), positions \(\\mathbf{r}\), forces \(\\mathbf{F}\), masses \(m\)) |
required |
systems
|
Lens[State, Table[SystemId, IsMDSystemNPT]]
|
Lens to get/set system data (lattice vectors \(\\mathbf{L}\), stress tensor \(\\mathbf{W}\), time step \(\\Delta t\), temperature \(T\), target pressure \(P_0\), barostat time constant \(\\tau_P\), compressibility \(\\beta\), minimum scale factor \(\\mu_{\\text{min}}\), degrees of freedom \(N_{\\text{dof}}\), thermostat time constant \(\\tau_T\)) |
required |
derivative_computation
|
Propagator[State]
|
Propagator to compute forces \(\\mathbf{F}\) and stress tensor \(\\mathbf{W}\) from state |
required |
flow
|
Flow[State, Array]
|
Flow operator for position updates (handles boundary conditions) |
required |
Returns:
| Type | Description |
|---|---|
SequentialPropagator[State]
|
SequentialPropagator implementing the CSVR-NPT algorithm |
References
CSVR: Bussi, G., Donadio, D., & Parrinello, M. (2007). Canonical sampling through velocity rescaling. J. Chem. Phys., 126(1), 014101. DOI: 10.1063/1.2408420 SCR: Bernetti, M., & Bussi, G. (2020). Pressure control using stochastic cell rescaling. J. Chem. Phys., 153(11), 114107. DOI: 10.1063/5.0020514
Source code in src/kups/md/integrators.py
make_csvr_step(particles, systems, derivative_computation, flow)
¶
Create CSVR integrator for canonical (NVT) ensemble sampling.
Combines the CSVR thermostat with velocity Verlet integration to sample the canonical ensemble at constant temperature. The algorithm applies stochastic velocity rescaling before each velocity Verlet step.
Algorithm steps:
- Apply CSVR velocity rescaling (thermostat)
- Velocity Verlet integration:
- \(\mathbf{p}(t+\Delta t/2) = \mathbf{p}(t) + \mathbf{F}(t) \cdot \Delta t/2\) — half momentum step
- \(\mathbf{r}(t+\Delta t) = \mathbf{r}(t) + \mathbf{p}(t+\Delta t/2)/m \cdot \Delta t\) — full position step
- Compute \(\mathbf{F}(t+\Delta t)\) — force evaluation
- \(\mathbf{p}(t+\Delta t) = \mathbf{p}(t+\Delta t/2) + \mathbf{F}(t+\Delta t) \cdot \Delta t/2\) — half momentum step
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles
|
Lens[State, Table[ParticleId, _MDParticleData]]
|
Lens to get/set indexed particle data (momenta \(\\mathbf{p}\), positions \(\\mathbf{r}\), forces \(\\mathbf{F}\), masses \(m\)) |
required |
systems
|
View[State, Table[SystemId, HasIntegratorParams[IsCSVRParams]]]
|
View to extract system data (time step \(\\Delta t\), temperature \(T\), degrees of freedom \(N_{\\text{dof}}\), thermostat time constant \(\\tau\)) |
required |
derivative_computation
|
Propagator[State]
|
Propagator to compute forces \(\\mathbf{F}\) from state |
required |
flow
|
Flow[State, Array]
|
Flow operator for position updates (handles boundary conditions) |
required |
Returns:
| Type | Description |
|---|---|
SequentialPropagator[State]
|
SequentialPropagator implementing the CSVR+Verlet algorithm |
References
Bussi, G., Donadio, D., & Parrinello, M. (2007). Canonical sampling through velocity rescaling. J. Chem. Phys., 126(1), 014101. DOI: 10.1063/1.2408420
Source code in src/kups/md/integrators.py
make_md_step_from_state(state, derivative_computation, integrator)
¶
make_md_step_from_state(
state: Lens[
State,
IsState[
_MDParticleData, IsMDSystem[IsVerletParams]
],
],
derivative_computation: Propagator[State],
integrator: Literal["verlet"],
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State,
IsState[
_MDParticleData,
IsMDSystem[IsBAOABLangevinParams],
],
],
derivative_computation: Propagator[State],
integrator: Literal["baoab_langevin"],
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State,
IsState[_MDParticleData, IsMDSystem[IsCSVRParams]],
],
derivative_computation: Propagator[State],
integrator: Literal["csvr"],
) -> Propagator[State]
Build a single MD integration step from a typed state.
Constructs the appropriate integrator propagator by extracting views for
particles and systems from state and wrapping them with a
WrapFlow
for periodic-boundary-condition-aware distance computations.
Supported integrators:
"verlet"— Velocity Verlet (NVE ensemble, no thermostat). Requiresintegrator_params: IsVerletParams."baoab_langevin"— BAOAB Langevin (NVT via Langevin friction/noise). Requiresintegrator_params: IsBAOABLangevinParams."csvr"— CSVR (NVT via canonical-sampling velocity rescaling, constant volume). Requiresintegrator_params: IsCSVRParams."csvr_npt"— CSVR-NPT (NPT via CSVR thermostat with barostat). Requiresintegrator_params: IsCSVRNPTParamsand acell_gradientsleaf on each system.
The overloads narrow the required state protocol per integrator literal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
Lens[State, Any]
|
Lens into the sub-state with |
required |
derivative_computation
|
Propagator[State]
|
Propagator that computes forces/gradients and updates the state (e.g. a wrapped potential). |
required |
integrator
|
Integrator
|
String key selecting the integration algorithm. |
required |
Returns:
| Type | Description |
|---|---|
Propagator[State]
|
Propagator that advances the |
Propagator[State]
|
simulation by one time step. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/kups/md/integrators.py
make_velocity_verlet_step(particles, systems, derivative_computation, flow)
¶
Create a velocity Verlet integrator for molecular dynamics (NVE ensemble).
The velocity Verlet algorithm is a symplectic, time-reversible integrator that provides second-order accuracy in both positions and velocities. It conserves total energy and samples the microcanonical (NVE) ensemble.
Algorithm steps:
- \(\mathbf{p}(t+\Delta t/2) = \mathbf{p}(t) + \mathbf{F}(t) \cdot \Delta t/2\) — momentum half-step
- \(\mathbf{r}(t+\Delta t) = \mathbf{r}(t) + \mathbf{p}(t+\Delta t/2)/m \cdot \Delta t\) — position full-step
- Compute \(\mathbf{F}(t+\Delta t)\) — force evaluation
- \(\mathbf{p}(t+\Delta t) = \mathbf{p}(t+\Delta t/2) + \mathbf{F}(t+\Delta t) \cdot \Delta t/2\) — momentum half-step
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
particles
|
Lens[State, Table[ParticleId, _MDParticleData]]
|
Lens to get/set indexed particle data (momenta \(\\mathbf{p}\), positions \(\\mathbf{r}\), forces \(\\mathbf{F}\), masses \(m\)) |
required |
systems
|
View[State, Table[SystemId, HasIntegratorParams[IsVerletParams]]]
|
View to extract system data with time step \(\\Delta t\) |
required |
derivative_computation
|
Propagator[State]
|
Propagator to compute forces \(\\mathbf{F}\) from state |
required |
flow
|
Flow[State, Array]
|
Flow operator for position updates (handles boundary conditions) |
required |
Returns:
| Type | Description |
|---|---|
SequentialPropagator[State]
|
SequentialPropagator implementing the velocity Verlet algorithm |
References
Swope, W. C., Andersen, H. C., Berens, P. H., & Wilson, K. R. (1982). A computer simulation method for the calculation of equilibrium constants for the formation of physical clusters of molecules: Application to small water clusters. J. Chem. Phys., 76(1), 637-649. DOI: 10.1063/1.442716