BioSimSpace.Types.Charge

class BioSimSpace.Types.Charge(*args)

A charge type.

__init__(*args)

Constructor.

*args can be a value and unit, or a string representation of the charge, e.g. “0.2 e”.

Parameters
  • value (float) – The value.

  • unit (str) – The unit.

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

Examples

Create an object representing a charge of 27.8 electron charge print the charge in Coulomb.

>>> import BioSimSpace as BSS
>>> charge = BSS.Types.Charge(27.8, "e")
>>> print(charge.coulomb())

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

>>> import BioSimSpace as BSS
>>> charge = BSS.Types.Charge("3.1 atm")
>>> print(charge.coulomb())

The string matching is extremeley flexible, so all of the following would be valid arguments: “27.8 e”, “27.8 electron charge”, “2.78e1 e”.

Methods

__init__(*args)

Constructor.

angle()

Return the power in the ‘angle’ dimension.

charge()

Return the power in the ‘charge’ dimension.

coulomb()

Return the charge in Coulomb.

dimensions()

Return the dimensions of this type.

electron_charge()

Return the charge in electron charge.

length()

Return the power in the ‘length’ dimension.

mass()

Return the power in the ‘mass’ dimension.

quantity()

Return the power in the ‘quantity’ dimension.

temperature()

Return the power in the ‘temperature’ dimension.

time()

Return the power in the ‘time’ dimension.

unit()

Return the unit.

value()

Return the value.

classmethod angle()

Return the power in the ‘angle’ dimension.

Returns

angle – The power in the ‘angle’ dimension.

Return type

int

classmethod charge()

Return the power in the ‘charge’ dimension.

Returns

charge – The power in the ‘charge’ dimension.

Return type

int

coulomb()

Return the charge in Coulomb.

Returns

charge – The charge in Coulomb.

Return type

Charge

classmethod dimensions()

Return the dimensions of this type. This is a tuple containing the power in each dimension.

Returns(int, int, int, int, int, int)

The power in each dimension: ‘angle’, ‘charge’, ‘length’, ‘mass’, ‘quantity’, ‘temperature’, and ‘time’.

electron_charge()

Return the charge in electron charge.

Returns

charge – The charge in electron charge.

Return type

Charge

classmethod length()

Return the power in the ‘length’ dimension.

Returns

length – The power in the ‘length’ dimension.

Return type

int

classmethod mass()

Return the power in the ‘mass’ dimension.

Returns

mass – The power in the ‘mass’ dimension.

Return type

int

classmethod quantity()

Return the power in the ‘quantity’ dimension.

Returns

quantity – The power in the ‘quantity’ dimension.

Return type

int

classmethod temperature()

Return the power in the ‘temperature’ dimension.

Returns

temperature – The power in the ‘temperature’ dimension.

Return type

int

classmethod time()

Return the power in the ‘time’ dimension.

Returns

time – The power the ‘time’ dimension.

Return type

int

unit()

Return the unit.

Returns

unit – The unit of the type.

Return type

str

value()

Return the value.

Returns

value – The value of the type.

Return type

float