Skip to content

forcefields

Molecular mechanics force terms.

import mlx_atomistic.forcefields

class CoulombPotential
def __init__(charges: object | None = None, coulomb_constant: float = 1.0, cutoff: float | None = None, shift: bool = False, topology: Topology | None = None, one_four_scale: float = 1.0, name: str = 'coulomb', supports_virial: bool = True, analytic_virial_supported: bool = False)

Direct pair Coulomb potential in reduced units.

Parameters

NameTypeDefaultDescription
chargesobject | NoneNone
coulomb_constantfloat1.0
cutofffloat | NoneNone
shiftboolFalse
topologyTopology | NoneNone
one_four_scalefloat1.0
namestr'coulomb'
supports_virialboolTrue
analytic_virial_supportedboolFalse

Methods

def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the direct pair Coulomb energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def potential_energy(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> mx.array

Return the direct pair Coulomb energy.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.

Returns

  • mx.array — Total Coulomb energy as a scalar array.
class HarmonicAnglePotential
def __init__(angles: object, k: object, angle: object, name: str = 'angle', supports_virial: bool = True, analytic_virial_supported: bool = True)

Harmonic angle bend potential.

Parameters

NameTypeDefaultDescription
anglesobject
kobject
angleobject
namestr'angle'
supports_virialboolTrue
analytic_virial_supportedboolTrue

Methods

def analytic_virial_tensor(positions: mx.array, *, cell: Cell, pairs: object | None, masses: mx.array | None, molecule_ids: object | None) -> mx.array

Return the analytic molecular diagonal cell-strain virial.

Parameters

NameTypeDefaultDescription
positionsmx.array
cellCell
pairsobject | None
massesmx.array | None
molecule_idsobject | None

Returns

  • mx.array
def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the harmonic angle-bend energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneAccepted for interface uniformity and ignored; the term uses its stored index list. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def potential_energy(positions: mx.array, cell: Cell | None = None) -> mx.array

Return the harmonic angle-bend energy 0.5 * sum(k * (theta - theta0)**2).

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.

Returns

  • mx.array — Total angle-bend energy as a scalar array.
class HarmonicBondPotential
def __init__(bonds: object, k: object, length: object, name: str = 'bond', supports_virial: bool = True, analytic_virial_supported: bool = True)

Harmonic bond stretch potential.

Parameters

NameTypeDefaultDescription
bondsobject
kobject
lengthobject
namestr'bond'
supports_virialboolTrue
analytic_virial_supportedboolTrue

Methods

def analytic_virial_tensor(positions: mx.array, *, cell: Cell, pairs: object | None, masses: mx.array | None, molecule_ids: object | None) -> mx.array

Return the analytic molecular diagonal cell-strain virial.

Parameters

NameTypeDefaultDescription
positionsmx.array
cellCell
pairsobject | None
massesmx.array | None
molecule_idsobject | None

Returns

  • mx.array
def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the harmonic bond-stretch energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneAccepted for interface uniformity and ignored; the term uses its stored index list. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def potential_energy(positions: mx.array, cell: Cell | None = None) -> mx.array

Return the harmonic bond-stretch energy 0.5 * sum(k * (r - r0)**2).

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.

Returns

  • mx.array — Total bond-stretch energy as a scalar array.
class ImproperDihedralPotential(PeriodicDihedralPotential)
def __init__(dihedrals: object, k: object, periodicity: object, phase: object = 0.0, name: str = 'improper', supports_virial: bool = True, analytic_virial_supported: bool = True)

Periodic or CHARMM-harmonic improper torsion potential.

A positive periodicity uses the periodic torsion form inherited from PeriodicDihedralPotential. A zero periodicity is the artifact sentinel for the CHARMM harmonic form k * wrap(phi + phase)**2. The plus sign maps the stored CHARMM/OpenMM equilibrium angle onto this runtime’s opposite signed dihedral convention.

Parameters

NameTypeDefaultDescription
dihedralsobject
kobject
periodicityobject
phaseobject0.0
namestr'improper'
supports_virialboolTrue
analytic_virial_supportedboolTrue

Methods

def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the mixed improper energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.array
cellCell | NoneNone
pairsmx.array | NoneNone

Returns

  • tuple[mx.array, mx.array]
def potential_energy(positions: mx.array, cell: Cell | None = None) -> mx.array

Return the mixed periodic and CHARMM-harmonic improper energy.

Parameters

NameTypeDefaultDescription
positionsmx.array
cellCell | NoneNone

Returns

  • mx.array
class NonbondedPotential
def __init__(sigma: object, epsilon: object, charges: object, coulomb_constant: float = 1.0, cutoff: float | None = 2.5, lj_shift: bool = True, coulomb_shift: bool = False, electrostatics: NonbondedElectrostatics = 'cutoff', switch_distance: float | None = None, topology: Topology | None = None, lj_one_four_scale: float = 1.0, coulomb_one_four_scale: float = 1.0, exception_pairs: object = (), exception_charge_products: object | None = None, exception_sigma: object | None = None, exception_epsilon: object | None = None, atom_types: object | None = None, nbfix_pairs: object = (), nbfix_sigma: object | None = None, nbfix_epsilon: object | None = None, nbfix_type_pairs: object = (), nbfix_type_sigma: object | None = None, nbfix_type_epsilon: object | None = None, backend: NonbondedBackend = 'auto', ewald_config: EwaldReferenceConfig | None = None, pme_config: PMEConfig | None = None, pme_plan: PMEExecutionPlan | None = None, tile_size: int = 512, memory_budget_bytes: int | None = DEFAULT_DENSE_MEMORY_BUDGET_BYTES, lambda_lj: float = 1.0, lambda_electrostatics: float = 1.0, use_dispersion_correction: bool = False, name: str = 'nonbonded', supports_virial: bool = True)

Combined Lennard-Jones and Coulomb pair potential.

Parameters

NameTypeDefaultDescription
sigmaobject
epsilonobject
chargesobject
coulomb_constantfloat1.0
cutofffloat | None2.5
lj_shiftboolTrue
coulomb_shiftboolFalse
electrostaticsNonbondedElectrostatics'cutoff'
switch_distancefloat | NoneNone
topologyTopology | NoneNone
lj_one_four_scalefloat1.0
coulomb_one_four_scalefloat1.0
exception_pairsobject()
exception_charge_productsobject | NoneNone
exception_sigmaobject | NoneNone
exception_epsilonobject | NoneNone
atom_typesobject | NoneNone
nbfix_pairsobject()
nbfix_sigmaobject | NoneNone
nbfix_epsilonobject | NoneNone
nbfix_type_pairsobject()
nbfix_type_sigmaobject | NoneNone
nbfix_type_epsilonobject | NoneNone
backendNonbondedBackend'auto'
ewald_configEwaldReferenceConfig | NoneNone
pme_configPMEConfig | NoneNone
pme_planPMEExecutionPlan | NoneNone
tile_sizeint512
memory_budget_bytesint | NoneDEFAULT_DENSE_MEMORY_BUDGET_BYTES
lambda_ljfloat1.0
lambda_electrostaticsfloat1.0
use_dispersion_correctionboolFalse
namestr'nonbonded'
supports_virialboolTrue

Properties

  • has_exceptions bool — Whether explicit nonbonded pair overrides are active.
  • has_nbfix bool — Whether NBFIX LJ overrides are active.
  • has_soft_core bool — Whether lambda-scaled soft-core pair evaluation is active.
  • pme_plan_diagnostics dict[str, object] | None — Diagnostics for the bound PME plan, or None when unbound.

Methods

def analytic_virial_tensor(positions: mx.array, *, cell: Cell, pairs: object | None, masses: mx.array | None, molecule_ids: object | None) -> mx.array

Return the analytic molecular diagonal cell-strain virial.

Parameters

NameTypeDefaultDescription
positionsmx.arrayParticle coordinates, shape (n_atoms, 3).
cellCellSource orthorhombic periodic cell.
pairsobject | NoneNeighbor blocks or compact pairs held fixed during the local cell derivative.
massesmx.array | NoneOptional per-particle masses for molecular centers.
molecule_idsobject | NoneOptional contiguous per-particle molecule identifiers.

Returns

  • mx.array — The diagonal (3, 3) configurational virial tensor.

Raises

  • ValueError — If this configuration is outside the admitted analytic virial envelope.
def bind_pme_plan(plan: PMEExecutionPlan | Cell) -> NonbondedPotential

Return a copy explicitly bound to a compatible fixed-cell PME plan.

Parameters

NameTypeDefaultDescription
planPMEExecutionPlan | CellExisting compatible plan, or an orthorhombic cell from which to build one.

Returns

  • NonbondedPotential — A new potential that reuses the bound plan for every PME scope.

Raises

  • ValueError — If this potential is not configured for PME or the plan does not match its configuration.
def build_pme_plan(cell: Cell) -> PMEExecutionPlan

Build a compatible fixed-cell PME execution plan for this potential.

Parameters

NameTypeDefaultDescription
cellCellOrthorhombic periodic cell to bind.

Returns

  • PMEExecutionPlan — A materialized plan matching this potential’s PME configuration and
  • PMEExecutionPlan — Coulomb constant.

Raises

  • ValueError — If this potential does not use PME electrostatics.
def component_energies(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> dict[str, mx.array | object]

Return LJ and Coulomb energy components.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell for minimum-image distances. Defaults to None.
pairsmx.array | NoneNoneOptional precomputed neighbor/pair structure. Defaults to None.

Returns

  • dict[str, mx.array | object] — A dict of named energy components (e.g. "lj", "coulomb").
def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return total nonbonded energy and forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell for minimum-image distances. Defaults to None.
pairsmx.array | NoneNoneOptional precomputed neighbor/pair structure. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar total nonbonded energy and (n_atoms, 3) forces.

Raises

  • ValueError — If positions is not (n_atoms, 3).
def energy_forces_dlambda(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array, dict[str, mx.array]]

Return energy, forces, and analytic lambda derivatives.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell for minimum-image distances. Defaults to None.
pairsmx.array | NoneNoneOptional precomputed neighbor/pair structure. Defaults to None.

Returns

  • tuple[mx.array, mx.array, dict[str, mx.array]] — An (energy, forces, derivatives) tuple: scalar energy, (n_atoms, 3) forces, and a dict with "lambda_lj" and "lambda_electrostatics" dU/dλ terms.

Raises

  • ValueError — If the electrostatics mode is not "cutoff" (the only mode with analytic dU/dλ).
def energy_forces_for_scope(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None, *, scope: str = 'total') -> tuple[mx.array, mx.array]

Evaluate energy and forces through an explicit force scope.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell for minimum-image distances. Defaults to None.
pairsmx.array | NoneNoneOptional precomputed neighbor/pair structure. Defaults to None.
scopestr'total'Force-evaluation scope to evaluate. Defaults to "total".

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple for the scope: scalar energy and (n_atoms, 3) forces.

Raises

  • ValueError — If the scope is unsupported for this potential’s electrostatics or positions is not (n_atoms, 3).
def energy_forces_with_components(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array, dict[str, mx.array | object]]

Return total energy, forces, and LJ/Coulomb components in one pass.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell for minimum-image distances. Defaults to None.
pairsmx.array | NoneNoneOptional precomputed neighbor/pair structure. Defaults to None.

Returns

  • tuple[mx.array, mx.array, dict[str, mx.array | object]] — An (energy, forces, components) tuple: scalar total energy, (n_atoms, 3) forces, and a dict of "lj"/"coulomb" energies.

Raises

  • ValueError — If positions is not (n_atoms, 3).
def finite_difference_virial_tensor(positions: mx.array, *, cell: Cell, pairs: object | None, masses: mx.array | None, molecule_ids: object | None, strain_epsilon: float) -> mx.array

Return a component-wise finite-strain virial without total-energy cancellation.

Parameters

NameTypeDefaultDescription
positionsmx.array
cellCell
pairsobject | None
massesmx.array | None
molecule_idsobject | None
strain_epsilonfloat

Returns

  • mx.array
def force_scope_report(scope: str = 'total') -> dict[str, object]

Return support metadata for a force-evaluation scope.

Parameters

NameTypeDefaultDescription
scopestr'total'Force-evaluation scope to query. Defaults to "total".

Returns

  • dict[str, object] — A ForceScopeReport dict describing whether the scope is supported and how it is evaluated for this potential’s electrostatics.
def mixed_pair_parameters(pairs) -> tuple[mx.array, mx.array]

Return mixed sigma and epsilon, with NBFIX LJ overrides substituted.

Parameters

NameTypeDefaultDescription
pairsAtom-index pairs, shape (n_pairs, 2).

Returns

  • tuple[mx.array, mx.array] — A (sigma_ij, epsilon_ij) tuple of per-pair mixed LJ parameters, each shape (n_pairs,) (NBFIX overrides applied where defined).
class PairRestrictedNonbondedPotential
def __init__(potential: NonbondedPotential, pairs: object, name: str = 'pair_restricted_nonbonded', supports_virial: bool = True, analytic_virial_supported: bool = False)

Nonbonded potential evaluated only on an explicit atom-pair list.

Parameters

NameTypeDefaultDescription
potentialNonbondedPotential
pairsobject
namestr'pair_restricted_nonbonded'
supports_virialboolTrue
analytic_virial_supportedboolFalse

Methods

def component_energies(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> dict[str, mx.array]

Return LJ and Coulomb components, evaluated on the fixed pair list.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneIgnored; the fixed pair list supplied at construction is used. Defaults to None.

Returns

  • dict[str, mx.array] — A dict of named energy components (e.g. "lj", "coulomb").

Raises

  • ValueError — If the wrapped electrostatics needs full-system evaluation (ewald_reference / pme).
def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return total nonbonded energy and forces on the fixed pair list.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneIgnored; the fixed pair list supplied at construction is used. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).

Raises

  • ValueError — If the wrapped electrostatics needs full-system evaluation (ewald_reference / pme).
def energy_forces_for_scope(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None, *, scope: str = 'total') -> tuple[mx.array, mx.array]

Evaluate energy and forces through an explicit force scope on the fixed pair list.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneIgnored; the fixed pair list supplied at construction is used. Defaults to None.
scopestr'total'Force-evaluation scope, e.g. "total" or a direct/reciprocal-space component. Defaults to "total".

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).

Raises

  • ValueError — If scope is unsupported for pair-restricted evaluation.
def energy_forces_with_components(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array, dict[str, mx.array]]

Return energy, forces, and LJ/Coulomb components on the fixed pair list.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneIgnored; the fixed pair list supplied at construction is used. Defaults to None.

Returns

  • tuple[mx.array, mx.array, dict[str, mx.array]] — An (energy, forces, components) tuple.

Raises

  • ValueError — If the wrapped electrostatics needs full-system evaluation (ewald_reference / pme).
def force_scope_report(scope: str = 'total') -> dict[str, object]

Return force-scope support metadata for pair-restricted evaluation.

Parameters

NameTypeDefaultDescription
scopestr'total'Force-evaluation scope, e.g. "total" or a direct/reciprocal-space component. Defaults to "total".

Returns

  • dict[str, object] — A metadata dict describing whether the scope is supported and how it is evaluated; full-system scopes are marked unsupported.
class PeriodicDihedralPotential
def __init__(dihedrals: object, k: object, periodicity: object, phase: object = 0.0, name: str = 'dihedral', supports_virial: bool = True, analytic_virial_supported: bool = True)

Periodic torsion potential with the package dihedral-angle convention.

Parameters

NameTypeDefaultDescription
dihedralsobject
kobject
periodicityobject
phaseobject0.0
namestr'dihedral'
supports_virialboolTrue
analytic_virial_supportedboolTrue

Methods

def analytic_virial_tensor(positions: mx.array, *, cell: Cell, pairs: object | None, masses: mx.array | None, molecule_ids: object | None) -> mx.array

Return the analytic molecular diagonal cell-strain virial.

Parameters

NameTypeDefaultDescription
positionsmx.array
cellCell
pairsobject | None
massesmx.array | None
molecule_idsobject | None

Returns

  • mx.array
def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the periodic torsion energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneAccepted for interface uniformity and ignored; the term uses its stored index list. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def potential_energy(positions: mx.array, cell: Cell | None = None) -> mx.array

Return the periodic torsion energy sum(k * (1 + cos(n * phi + phase))).

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.

Returns

  • mx.array — Total periodic torsion energy as a scalar array.
class PositionalRestraintPotential
def __init__(reference_positions: object, mask: object, k: float, name: str = 'positional_restraint', supports_virial: bool = True, analytic_virial_supported: bool = False)

Harmonic positional restraint for selected atoms.

Parameters

NameTypeDefaultDescription
reference_positionsobject
maskobject
kfloat
namestr'positional_restraint'
supports_virialboolTrue
analytic_virial_supportedboolFalse

Methods

def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the positional-restraint energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneAccepted for interface uniformity but unused; restraints act on absolute positions. Defaults to None.
pairsmx.array | NoneNoneAccepted for interface uniformity and ignored; the term uses its stored index list. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def potential_energy(positions: mx.array, cell: Cell | None = None) -> mx.array

Return the positional-restraint energy 0.5 * k * sum(mask * |x - x_ref|**2).

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneAccepted for interface uniformity but unused; restraints act on absolute positions. Defaults to None.

Returns

  • mx.array — Total restraint energy as a scalar array.
class RBDihedralPotential
def __init__(dihedrals: object, c0: object, c1: object, c2: object, c3: object, c4: object, c5: object, name: str = 'rb_dihedral', supports_virial: bool = True, analytic_virial_supported: bool = False)

Ryckaert-Bellemans torsion potential.

Uses the OpenMM RB convention: E = sum(Cn * cos(phi - pi)^n), where phi is the package/OpenMM-style periodic dihedral angle.

Parameters

NameTypeDefaultDescription
dihedralsobject
c0object
c1object
c2object
c3object
c4object
c5object
namestr'rb_dihedral'
supports_virialboolTrue
analytic_virial_supportedboolFalse

Methods

def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return the Ryckaert-Bellemans torsion energy and per-atom forces.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneAccepted for interface uniformity and ignored; the term uses its stored index list. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def potential_energy(positions: mx.array, cell: Cell | None = None) -> mx.array

Return the Ryckaert-Bellemans torsion energy sum(Cn * cos(phi - pi)**n).

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.

Returns

  • mx.array — Total Ryckaert-Bellemans torsion energy as a scalar array.
class SoftCoreNonbondedPotential
def __init__(potential: NonbondedPotential, lambda_lj: float = 1.0, lambda_electrostatics: float = 1.0, name: str = 'soft_core_nonbonded', supports_virial: bool = True, analytic_virial_supported: bool = False)

Lambda-scaled wrapper around a combined nonbonded potential.

Parameters

NameTypeDefaultDescription
potentialNonbondedPotential
lambda_ljfloat1.0
lambda_electrostaticsfloat1.0
namestr'soft_core_nonbonded'
supports_virialboolTrue
analytic_virial_supportedboolFalse

Properties

  • electrostatics NonbondedElectrostatics — Electrostatics mode of the wrapped potential.
  • sigma mx.array — Per-atom Lennard-Jones sigma of the wrapped potential.

Methods

def component_energies(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> dict[str, mx.array | object]

Return LJ and Coulomb components from the lambda-scaled potential.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.

Returns

  • dict[str, mx.array | object] — A dict of named energy components (e.g. "lj", "coulomb").
def energy_forces(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array]

Return total energy and forces from the lambda-scaled potential.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def energy_forces_dlambda(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array, dict[str, mx.array]]

Return energy, forces, and analytic derivatives w.r.t. the coupling parameters.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.

Returns

  • tuple[mx.array, mx.array, dict[str, mx.array]] — An (energy, forces, derivatives) tuple; derivatives maps each coupling parameter to dE/dlambda.
def energy_forces_for_scope(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None, *, scope: str = 'total') -> tuple[mx.array, mx.array]

Evaluate energy and forces through an explicit force scope (lambda-scaled).

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.
scopestr'total'Force-evaluation scope, e.g. "total" or a direct/reciprocal-space component. Defaults to "total".

Returns

  • tuple[mx.array, mx.array] — An (energy, forces) tuple: scalar energy and per-atom forces of shape (n_atoms, 3).
def energy_forces_with_components(positions: mx.array, cell: Cell | None = None, pairs: mx.array | None = None) -> tuple[mx.array, mx.array, dict[str, mx.array | object]]

Return energy, forces, and LJ/Coulomb components from the lambda-scaled potential.

Parameters

NameTypeDefaultDescription
positionsmx.arrayAtomic coordinates, shape (n_atoms, 3).
cellCell | NoneNoneOptional periodic cell; when given, distances use the minimum-image convention. Defaults to None.
pairsmx.array | NoneNoneOptional explicit atom-pair list, shape (n_pairs, 2); None evaluates all unique pairs. Defaults to None.

Returns

  • tuple[mx.array, mx.array, dict[str, mx.array | object]] — An (energy, forces, components) tuple.
def force_scope_report(scope: str = 'total') -> dict[str, object]

Return force-scope support metadata from the wrapped potential.

Parameters

NameTypeDefaultDescription
scopestr'total'Force-evaluation scope, e.g. "total" or a direct/reciprocal-space component. Defaults to "total".

Returns

  • dict[str, object] — A metadata dict describing whether the scope is supported and how it is evaluated.