chemcalculator.helper

Module Contents

Functions

__chemical_elements(chemical)

Decomposes a chemical to it's elements.

__check_chemical_format(chemical)

Check that the chemical formula has correct format

chemcalculator.helper.__chemical_elements(chemical)[source]

Decomposes a chemical to it’s elements.

Parameters

chemical (string) – The molecular formula of the given chemical compound given as a string.

Returns

Dictionary of the chemicals elemental components and their counts.

Return type

dict

chemcalculator.helper.__check_chemical_format(chemical)[source]

Check that the chemical formula has correct format

Parameters

chemical (string) – chemical formula to check

Raises
  • TypeError – Entered value is not a string.

  • ValueError – String contains characters that are not allowed.

  • ValueError – String or subcomponent starts with a lowercase letter.