BioSimSpace.Types.Volume

class BioSimSpace.Types.Volume(*args)

A volume type.

__init__(*args)

Constructor.

*args can be a magnitude and unit, or a string representation of the volume, e.g. “100 pm^3”.

Parameters
  • magnitude (float) – The magnitude.

  • unit (str) – The unit.

  • string (str) – A string representation of the volume.

Examples

Create an object representing a volume of 100 cube nanometers then print the volume in cube Angstrom.

>>> import BioSimSpace as BSS
>>> volume = BSS.Types.Volume(100, "nm^3")
>>> print(volume.angstroms3())

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

>>> import BioSimSpace as BSS
>>> volume = BSS.Types.Volume("100 nm^3")
>>> print(volume.angstroms3())

The string matching is extremeley flexible, so all of the following would be valid arguments: “100 nm^3”, “100 cube nanometers”, “100 nanometers cubed”.

Methods

__init__(*args)

Constructor.

angstroms3()

Return the volume in cubic Angstrom.

magnitude()

Return the magnitude.

meters3()

Return the volume in cubic meters.

nanometers3()

Return the volume in cubic nanometers.

picometers3()

Return the volume in cubic picometers.

unit()

Return the unit.

angstroms3()

Return the volume in cubic Angstrom.

Returns

volume – The volume in cubic Angstrom.

Return type

Volume

magnitude()

Return the magnitude.

Returns

magnitude – The magnitude of the type.

Return type

float

meters3()

Return the volume in cubic meters.

Returns

volume – The volume in cubic meters.

Return type

Volume

nanometers3()

Return the volume in cubic nanometers.

Returns

volume – The volume in cubic nanometers.

Return type

Volume

picometers3()

Return the volume in cubic picometers.

Returns

volume – The volume in cubic picometers.

Return type

Volume

unit()

Return the unit.

Returns

unit – The unit of the type.

Return type

str