Public API

View Module Index

sire.units.angle(angle)[source]

Convert the passed argument into an angle. This will return ‘angle’ if it is already an angle, or will convert it into an angle with default units if this is a float or something that can be converted to a float

sire.units.clear_default_units()[source]

Clear the current set of default units. Note that you will need to set some units, or else the code will complain.

sire.units.convert((float)val, (TempBase)from_units, (TempBase)to_units) float :
C++ signature :

double convert(double,SireUnits::Dimension::TempBase,SireUnits::Dimension::TempBase)

convert( (float)val, (Unit)from_units, (TempBase)to_units) -> float :

C++ signature :

double convert(double,SireUnits::Dimension::Unit,SireUnits::Dimension::TempBase)

convert( (float)val, (Unit)from_units, (Unit)to_units) -> float :

C++ signature :

double convert(double,SireUnits::Dimension::Unit,SireUnits::Dimension::Unit)

convert( (float)val, (TempBase)to_units) -> float :

C++ signature :

double convert(double,SireUnits::Dimension::TempBase)

convert( (float)val, (Unit)to_units) -> float :

C++ signature :

double convert(double,SireUnits::Dimension::Unit)

sire.units.length(length)[source]

Convert the passed argument into a length. This will return length if it is already a length, or it will convert it into a length with default units if this is a float or something that can be converted to a float

sire.units.set_default_unit(unit: str)[source]

Set the default unit name for the unit named in the passed string.

For example, set_default_unit(“m”) would set the default length unit to “meters”, and will print it out using “m” as the string.

Calling set_default_unit(“kcal.mol-1”) would set the default molar energy unit to kcal_per_mol, and will print it out using “kcal.mol-1”

The string must be something that can be parsed by the units grammar in GeneralUnit, and should be units only - they cannot contain values.

sire.units.set_default_units(units)[source]

Set the default unit names for the units named in the passed list of strings.

For example, set_default_units([“m”]) would set the default length unit to “meters”, and will print it out using “m” as the string.

Calling set_default_unit([“kcal”, “kcal.mol-1”]) would set the default molar energy unit to kcal_per_mol, and will print it out using “kcal.mol-1”, and the default energy unit to “kcal”, printed out using “kcal”.

All of the strings must be something that can be parsed by the units grammar in GeneralUnit, and should be units only - they cannot contain values.

sire.units.set_energy_unit(energy, name: str = None)[source]

Set the default energy unit to be used for output and default conversions

sire.units.set_internal_units()[source]

Switch over to using default (AKMA-style) units for output and default conversions.

This uses:

mass: gram (g) energy: kilocalorie (kcal) length: angstrom time: picosecond quantity: mole charge: mod_electron charges

sire.units.set_length_unit(length, name: str = None)[source]

Set the default length unit to be used for output and default conversions

sire.units.set_mass_unit(mass, name: str = None)[source]

Set the default mass unit to be used for output and default conversions

sire.units.set_quantity_unit(q, name: str = None)[source]

Set the default quantity unit to be used for output and default conversions

sire.units.set_si_units(scaled: bool = True)[source]

Switch over to using SI units for output and default conversions

If ‘scaled’ is true, then units scaled appropriately for atomic-level simulations are chosen.

In this case, we would use

mass: gram (g) energy: kilojoule (J) length: nanometer time: picosecond quantity: mole charge: coulomb (C) angle: radian temperature: kelvin (K)

Unscaled, we would use

mass: kilogram (g) energy: joule (J) length: meter time: second quantity: mole charge: coulomb (C) angle: radian temperature: kelvin (K)

sire.units.set_time_unit(time, name: str = None)[source]

Set the default time unit to be used for output and default conversions

sire.units.angstrom Angstrom (length) unit
sire.units.picometer picometer (length) unit