Skip to content

units

Internal unit systems for atomistic simulations.

import mlx_atomistic.units

class LennardJonesReducedUnits
def __init__(sigma: float = 1.0, epsilon: float = 1.0, mass: float = 1.0, boltzmann: float = 1.0)

Lennard-Jones reduced-unit system for v1 molecular dynamics.

The numerical MD kernels operate on dimensionless values by default: sigma = 1, epsilon = 1, particle mass = 1, and k_B = 1.

Parameters

NameTypeDefaultDescription
sigmafloat1.0
epsilonfloat1.0
massfloat1.0
boltzmannfloat1.0

Properties

  • energy float — Energy unit.
  • force float — Force unit.
  • length float — Length unit.
  • temperature float — Temperature unit.
  • time float — Time unit tau = sigma * sqrt(mass / epsilon).
  • velocity float — Velocity unit.

Methods

def from_reduced_energy(value: float) -> float

Convert a reduced energy into the represented unit system.

Parameters

NameTypeDefaultDescription
valuefloat

Returns

  • float
def from_reduced_length(value: float) -> float

Convert a reduced length into the represented unit system.

Parameters

NameTypeDefaultDescription
valuefloat

Returns

  • float
def from_reduced_temperature(value: float) -> float

Convert a reduced temperature into the represented unit system.

Parameters

NameTypeDefaultDescription
valuefloat

Returns

  • float
def to_reduced_energy(value: float) -> float

Convert an energy into reduced units.

Parameters

NameTypeDefaultDescription
valuefloat

Returns

  • float
def to_reduced_length(value: float) -> float

Convert a length into reduced units.

Parameters

NameTypeDefaultDescription
valuefloat

Returns

  • float
def to_reduced_temperature(value: float) -> float

Convert a temperature into reduced units.

Parameters

NameTypeDefaultDescription
valuefloat

Returns

  • float
class MDUnitSystem
def __init__(coordinates: str = 'angstrom', mass: str = 'dalton', charge: str = 'elementary_charge', energy: str = 'kilojoule_per_mole', time: str = 'picosecond', temperature: str = 'kelvin', coulomb_constant: float = COULOMB_CONSTANT_KJ_MOL_ANGSTROM, boltzmann_constant: float = BOLTZMANN_CONSTANT_KJ_MOL_K)

Explicit physical units used by production molecular mechanics kernels.

The recommended MLX production convention is Angstrom, ps, dalton, elementary charge, kJ/mol, and K. The Coulomb constant below matches those units when distances are stored in Angstrom.

Parameters

NameTypeDefaultDescription
coordinatesstr'angstrom'
massstr'dalton'
chargestr'elementary_charge'
energystr'kilojoule_per_mole'
timestr'picosecond'
temperaturestr'kelvin'
coulomb_constantfloatCOULOMB_CONSTANT_KJ_MOL_ANGSTROM
boltzmann_constantfloatBOLTZMANN_CONSTANT_KJ_MOL_K

Properties

  • coordinate_scale_to_angstrom float — Scale stored coordinates into Angstrom.
  • force_to_acceleration_scale float — Scale (kJ/mol/length) / dalton into stored-length/ps**2.
  • kinetic_energy_scale float — Scale 0.5 * dalton * velocity**2 into kJ/mol.

Methods

def from_metadata(units: Mapping[str, str]) -> MDUnitSystem

Create and validate a physical MD unit system from artifact metadata.

Parameters

NameTypeDefaultDescription
unitsMapping[str, str]

Returns

  • MDUnitSystem
def validate() -> None

Reject reduced or ambiguous units for production artifacts.

Returns

  • None