BioSimSpace.Types.Energy

class BioSimSpace.Types.Energy(*args)

An energy type.

__init__(*args)

Constructor.

*args can be a magnitude and unit, or a string representation of the energy, e.g. “78.4 kcal/mol”.

Parameters:
  • magnitude (float) – The magnitude.
  • unit (str) – The unit.
  • string (str) – A string representation of the energy.

Examples

Create an object representing an energy of -1038 kilo calories per mol and print the energy in kilo joules per mol.

>>> import BioSimSpace as BSS
>>> energy = BSS.Types.Energy(-1038, "kcal/mol")
>>> print(energy.kj_per_mol())

The same as above, except passing a string representation of the energy to the constructor.

>>> import BioSimSpace as BSS
>>> energy = BSS.Types.Energy("-1038 kcal/mol")
>>> print(energy.kj_per_mol())

The string matching is extremeley flexible, so all of the following would be valid arguments: “-1038 kcal/mol”, “-1.038e3 kcal/mol”, “-1038 kilo cal per mol”.

Methods

__init__(*args) Constructor.
kcal_per_mol() Return the energy in kcal per mol.
kj_per_mol() Return the energy in kJ per mol.
kt() Return the energy in KT.
magnitude() Return the magnitude.
unit() Return the unit.
kcal_per_mol()

Return the energy in kcal per mol.

Returns:energy – The energy in kcal per mol.
Return type:Energy
kj_per_mol()

Return the energy in kJ per mol.

Returns:energy – The energy in kJ per mol.
Return type:Energy
kt()

Return the energy in KT.

Returns:energy – The energy in KT.
Return type:Energy
magnitude()

Return the magnitude.

Returns:magnitude – The magnitude of the type.
Return type:float
unit()

Return the unit.

Returns:unit – The unit of the type.
Return type:str