Molecule(atoms=None, bonds=None, smiles=None, graph=None, plams_mol=None, active_atoms=None, active_bonds=None)¶
The main class for inputing/using reactants and products.
There are four possible ways of initializing the molecule:
by explicitly specifying
using a SMILES string
using a networkx graph
using a PLAMS molecule
- Keyword Arguments
list(str)) – a list of atomic symbols. The order in the list corresponds to the index and will be used with the
list(tuple)) – a list of pairs (e1,e2) where e1 and e2 correspond to atom indices (integers) between which there is a bond
str) – a SMILES string for inputting molecular structure(s)
networkx.graph) – a networkx graph representing the molecular structure(s)
scm.plams.Molecule) – a PLAMS molecule. If bonds are not specified in the plams molecule, they will be automatically guessed.
list(int)) – a subset of the atom indices which are allowed to be mapped to an atom with a different index. Atoms outside this set will automatically be mapped using the identity function on the indices (e.g., if atom 5 is not in the active set, atom 5 in the reactants will be mapped to atom 5 in the products).
list(int)) – a subset of the bonds that are allowed to be broken (reactant) or formed (product) in a reaction. Bonds outside this set will be preserved but not necessarily mapped to atoms with the same indices.
Let’s input acetone first using the
import scm.reactmap as rm reactant = rm.Molecule(atoms=['C','C','C','O','H','H','H','H','H','H'],bonds=[(0,1),(1,2),(1,3),(0,4),(0,5),(0,6),(3,7),(3,8),(3,9)])
And now as a SMILES sting using the
reactant = rm.Molecule(smiles="CC(=O)C")
The number of H2 molecules in this
A list of the indices of the active atoms for the
A list of the active bonds for the
Atoms which can be assigned to a different (non-identity) index.
True if the
Moleculeobject can be used with the
implicitHdescription of the system; Otherwise, False (e.g., if there are hypervalent Hydrogens).
A list of lists containing neighbor atom indices.
A list of lists containing neighbor atom types
This function returns the number of implicit Hydrogens for the atom with index a. If implicit Hydrogens are not being used, this function returns 0.
int) – the index of the atom
the number of implicit Hydrogens bonded to atom a
- Return type
get_graph(implicitH: Optional[bool] = None)¶
The networkx graph representation of the chemical structure(s).
The graph instance will only be calculated a single time as it is assumed that the reactant/product molecules will not change after input. This prevents redundant computations if the graph is needed in multiple places.
- Keyword Arguments
bool) – whether or not to return the graph with implicit Hydrogens
a networkx.graph instance