kups.application.md.integrators
¶
State-binding constructor for MD integration steps.
Dispatches on an integrator key to the state-agnostic step factories in kups.md.integrators, binding particle and system views from a concrete simulation state and wrapping them with a periodic-boundary-aware flow.
Integrator parameters may live on the state (systems.data.integrator_params)
or be passed directly via parameters=; in the latter case they are overlaid
onto the systems view with a constant lens and the state need not carry them.
make_md_step_from_state(state, derivative_computation, integrator, *, parameters=None)
¶
make_md_step_from_state(
state: Lens[
State,
IsState[
_MDParticleData, IsMDSystem[IsVerletParams]
],
],
derivative_computation: Propagator[State],
integrator: Literal["verlet"],
*,
parameters: None = None,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State,
IsState[
_MDParticleData,
IsMDSystem[IsBAOABLangevinParams],
],
],
derivative_computation: Propagator[State],
integrator: Literal["baoab_langevin"],
*,
parameters: None = None,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State,
IsState[_MDParticleData, IsMDSystem[IsCSVRParams]],
],
derivative_computation: Propagator[State],
integrator: Literal["csvr"],
*,
parameters: None = None,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State, IsState[_MDParticleData, IsMDSystemNPT]
],
derivative_computation: Propagator[State],
integrator: Literal["csvr_npt"],
*,
parameters: None = None,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State,
IsState[_MDParticleData, IsBAOABNPTLangevinSystem],
],
derivative_computation: Propagator[State],
integrator: Literal["baoab_npt_langevin"],
*,
parameters: None = None,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State, IsState[_MDParticleData, HasCell[Periodic3D]]
],
derivative_computation: Propagator[State],
integrator: Literal["verlet"],
*,
parameters: IsVerletParams,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State, IsState[_MDParticleData, HasCell[Periodic3D]]
],
derivative_computation: Propagator[State],
integrator: Literal["baoab_langevin"],
*,
parameters: IsBAOABLangevinParams,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State, IsState[_MDParticleData, HasCell[Periodic3D]]
],
derivative_computation: Propagator[State],
integrator: Literal["csvr"],
*,
parameters: IsCSVRParams,
) -> Propagator[State]
make_md_step_from_state(
state: Lens[
State, IsState[_MDParticleData, IsMDSystemNPTBase]
],
derivative_computation: Propagator[State],
integrator: Literal["csvr_npt"],
*,
parameters: IsCSVRNPTParams,
) -> 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."baoab_npt_langevin"— BAOAB NPT Langevin (Gao–Fang–Wang JCP 2016 fully-flexible-cell NPT). Requiresintegrator_params: IsBAOABNPTLangevinParamspluscell_momentumandcell_gradientsleaves on each system, and a :class:~kups.core.cell.TriclinicFramecell.
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 |
parameters
|
Any
|
Constant integrator parameters. When given they are overlaid
onto the systems view with a constant lens, so the state need not
carry |
None
|
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/application/md/integrators.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
require_baoab_npt_langevin_state(systems)
¶
Runtime check that the system table satisfies the BAOAB NPT Langevin shape.
Call this once on the initial state (outside of jit) before constructing
the integrator. Verifies that the cell is a 3D-periodic
:class:TriclinicFrame and that the integrator-params is a
:class:BAOABNPTLangevinParams-shaped bundle.