oxmol.spec module

Atom and bond specifications, used to construct Molecule

These are thin wrappers around the PyO3 classes: they call their base class’ __new__ constructor and return an instance of the base class.

At present, it doesn’t seem to be possible to actually subclass PyO3 classes from Python, so this is all we are able to do on the Python end.

In the case of these classes, we tweak the constructors a bit to allow for some limited duck typing (this is harder to do in the PyO3 base classes).

class oxmol.spec.AtomSpec

Bases: oxmol.oxmol.PyAtomSpec

An atom specification, used to create a Molecule instance.

Parameters:
  • element – an Element, int (atomic number), or str (element symbol).
  • hydrogens – an int, the number of implicit hydrogen atoms.
  • ion – an optional int, the formal charge on the atom.
  • isotope – an optional int, the isotope of the atom.
  • parity – an optional Parity or bool, the chirality.

Attributes See Parameters.

class oxmol.spec.BondSpec

Bases: oxmol.oxmol.PyBondSpec

A bond specification, used to create a molecule instance.

Parameters:
  • sid – an int, the atom ID of the first atom in the bond.
  • tid – an int, the atom ID of the last atom in the bond.
  • order – a BondOrder or an int, the order of the bond.
  • parity – an optional Parity or bool, the stereochemistry of the bond (only valid for double bonds).

Attributes See Parameters.