units
Internal unit systems for atomistic simulations.
import mlx_atomistic.units
Classes
Section titled “Classes”LennardJonesReducedUnits
Section titled “LennardJonesReducedUnits”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
| Name | Type | Default | Description |
|---|---|---|---|
sigma | float | 1.0 | |
epsilon | float | 1.0 | |
mass | float | 1.0 | |
boltzmann | float | 1.0 |
Properties
energyfloat— Energy unit.forcefloat— Force unit.lengthfloat— Length unit.temperaturefloat— Temperature unit.timefloat— Time unit tau = sigma * sqrt(mass / epsilon).velocityfloat— Velocity unit.
Methods
from_reduced_energy
Section titled “from_reduced_energy”def from_reduced_energy(value: float) -> floatConvert a reduced energy into the represented unit system.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | float |
Returns
float
from_reduced_length
Section titled “from_reduced_length”def from_reduced_length(value: float) -> floatConvert a reduced length into the represented unit system.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | float |
Returns
float
from_reduced_temperature
Section titled “from_reduced_temperature”def from_reduced_temperature(value: float) -> floatConvert a reduced temperature into the represented unit system.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | float |
Returns
float
to_reduced_energy
Section titled “to_reduced_energy”def to_reduced_energy(value: float) -> floatConvert an energy into reduced units.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | float |
Returns
float
to_reduced_length
Section titled “to_reduced_length”def to_reduced_length(value: float) -> floatConvert a length into reduced units.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | float |
Returns
float
to_reduced_temperature
Section titled “to_reduced_temperature”def to_reduced_temperature(value: float) -> floatConvert a temperature into reduced units.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | float |
Returns
float
MDUnitSystem
Section titled “MDUnitSystem”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
| Name | Type | Default | Description |
|---|---|---|---|
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 |
Properties
coordinate_scale_to_angstromfloat— Scale stored coordinates into Angstrom.force_to_acceleration_scalefloat— Scale(kJ/mol/length) / daltoninto stored-length/ps**2.kinetic_energy_scalefloat— Scale0.5 * dalton * velocity**2into kJ/mol.
Methods
from_metadata
Section titled “from_metadata”def from_metadata(units: Mapping[str, str]) -> MDUnitSystemCreate and validate a physical MD unit system from artifact metadata.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
units | Mapping[str, str] |
Returns
MDUnitSystem
validate
Section titled “validate”def validate() -> NoneReject reduced or ambiguous units for production artifacts.
Returns
None