Units

CVPack reports every value in OpenMM’s MD unit system. These classes and functions convert and serialize units and quantities.

class cvpack.units.Quantity(*args)[source]

Extension of the OpenMM Quantity class to allow serialization and deserialization.

in_md_units()[source]

The value of the quantity in MD units.

Return type:

Any

property value: Any

The value of the quantity.

class cvpack.units.Unit(data)[source]

Extension of the OpenMM Unit class to allow serialization and deserialization.

Parameters:

data (str | Unit | dict) – The data to be used to create the unit.

cvpack.units.in_md_units(quantity)[source]

Return a quantity in the MD unit system (e.g. mass in Da, distance in nm, time in ps, temperature in K, energy in kJ/mol, angle in rad).

As in kJ/mol, amounts of substance follow OpenMM’s per-mole convention: a quantity defined per particle, such as a pressure, is multiplied by Avogadro’s number (e.g. 1 bar becomes 0.0602 kJ/(mol nm^3)). Energies are written in kJ/mol.

Parameters:

quantity (Quantity | Real | ndarray | Vec3 | Sequence[Vec3] | Sequence[ndarray]) – The quantity to be converted.

Returns:

The quantity in the MD unit system.

Return type:

Quantity

cvpack.units.value_in_md_units(quantity)[source]

Return the value of a quantity in the MD unit system (e.g. mass in Da, distance in nm, time in ps, temperature in K, energy in kJ/mol, angle in rad).

Parameters:

quantity (Quantity | Real | ndarray | Vec3 | Sequence[Vec3] | Sequence[ndarray]) – The quantity to be converted.

Returns:

The value of the quantity in the MD unit system.

Return type:

Any