4.1.2. Chem

class mod.AtomId

Representation of the chemical element of an atom.

__init__(id=AtomIds.Invalid)

Construct an atom ID from an integer.

Parameters:

id (int) – the atomic number to construct from, or AtomIds.Invalid to explicitly signal an invalid atom. Must be at most the same value as AtomIds.Max.

symbol

(Read-only) The symbol represented by the atom id.

Type:

str

Raises:

LogicError if the id is invalid.

__int__()

Implicit conversion to an integer type.

class mod.Isotope

Representation of the isotope of an atom.

__init__()
__init__(i)

Construct a representation of an isotope. If an isotope number is given, that specific one is constructed, otherwise the most abundant one is implicitly constructed.

Note

There is a difference between constructing the most abundant isotope implicitly and explicitly.

Parameters:

i (int) – An isotope number for explicit construction. Passing -1 is equivalent to default-construction. The number must be either -1 or at least 1.

__int__()

Implicit conversion to an integer type.

class mod.Charge

Representation of the charge of an atom.

__init__(c=0)

Construct a charge.

Parameters:

c (int) – The charge to construct. Must be in the range \([-9, 9]\).

__int__()

Implicit conversion to an integer type.

class mod.AtomData

Representation of basic data of an atom.

__init__(atomId=AtomIds.Invalid, isotope=Isotope(), charge=Charge(), radical=False)

Construct an atom data object.

atomId

(Read-only) The atom id.

Type:

AtomId

isotope

(Read-only) The isotope.

Type:

Isotope

charge

(Read-only) The charge.

Type:

Charge

class mod.BondType

Representation of a bond type.

Invalid
Single
Aromatic
Double
Triple
__str__()
Returns:

A string representation of the bond type adhering to the string encoding of bonds (see Molecule Encoding).

Raises:

LogicError if the bond type is Invalid.

class mod.AtomIds

This class contains constants for each chemical element, both as their abbreviations and their full names. Two additional constants are provided for convenience.

Invalid

Constant for the invalid atom id.

Type:

AtomId

Max

An atom id equal to the atom id with the maximum valid id.

Type:

AtomId