Molecule

class Molecule(atoms, bonds)[source]

Bases: object

A molecular graph.

Parameters:
  • atoms (tuple of Atom) – The atoms of the molecule.
  • bonds (iterable of Bond) – The bonds of the molecule.

Methods

get_atoms([atom_ids]) Yield the atoms of the molecule.
get_bonds([bond_ids]) Yield the bonds of the molecule.
get_num_atoms() Return the number of atoms in the molecule.
get_num_bonds() Return the number of bonds in the molecule.
get_atoms(atom_ids=None)[source]

Yield the atoms of the molecule.

Parameters:atom_ids (iterable of int) – The ids of the atoms which should be yielded. Can be an int, if only one atom should be yielded.
Yields:Atom – An atom of the molecule.
get_bonds(bond_ids=None)[source]

Yield the bonds of the molecule.

Parameters:bond_ids (iterable of int) – The ids of bonds which should be yielded. Can be an int, if only one bond should be yielded.
Yields:Bond – A bond of the molecule.
get_num_atoms()[source]

Return the number of atoms in the molecule.

Returns:The number of atoms in the molecule.
Return type:int
get_num_bonds()[source]

Return the number of bonds in the molecule.

Returns:The number of bonds in the molecule.
Return type:int