Compound#

class pymeasurement.util.chem.compound.Compound(string)[source]#

A class to represent a chemical compound.

Parameters:

string (str) – The string to parse.

__eq__(other)[source]#

Check if the compound is equal to another compound.

Parameters:

other (Compound) – The other compound to check.

Returns:

Whether the compounds are equal.

Return type:

bool

__hash__ = None#
__init__(string)[source]#

Compound Constructor

__ne__(other)[source]#

Check if the compound is not equal to another compound.

Parameters:

other (Compound) – The other compound to check.

Returns:

Whether the compounds are not equal.

Return type:

bool

__str__(textOverride=False)[source]#

Get the string representation of the compound.

Parameters:

textOverride (bool) – Whether to override the latex print setting.

Returns:

The string representation of the compound.

Return type:

str

checks(i, char)[source]#

Check the character.

Parameters:
  • i (int) – The index of the character.

  • char (str) – The character to check.

massPercentComposition()[source]#

Get the mass percent composition of the compound.

Returns:

The mass percent composition of the compound.

Return type:

list

molePercentComposition()[source]#

Get the mole percent composition of the compound.

Returns:

The mole percent composition of the compound.

Return type:

list

save()[source]#

Save the element or subcompound to the composition.

saveElement(element, number, multiple=1)[source]#

Save the element to the composition.

Parameters:
  • element (str) – The element to save.

  • number (str) – The number of the element.

  • multiple (int) – The multiple of the element.

saveSubcompound()[source]#

Save subcompound to the composition.

setLatexPrint()[source]#

Set whether to print the compound in latex format.

Parameters:

value (bool) – Whether to print the compound in latex format.

split(string)[source]#

Split the string into a compound string and a state string.

Parameters:

string (str) – The string to split.