The OEUniMolecularRxn
class is designed to apply a set of
transformations defined by a reaction to exactly one reactant
molecule. All possible transformations are applied to the initial set
of atoms and bonds of an input molecule. For example, a reaction that
affects a particular type of functional group will be automatically be
applied twice a to bi-functional molecule. The number of
transformations applied by the OEUniMolecularRxn
class is
limited in order to prevent infinite loops. Consider a hypothetical
reaction that methylates a methyl group. If a methyl group added in a
reaction were allowed to react again, the methyl groups of a molecule
would be methylated ad infinitum. The first protection against
infinite loops provided by OEUniMolecularRxn
is that only
original atoms and bonds of the input molecule are allowed to react.
Atoms and bonds created by a reaction are excluded from involvement in
further reactions. A more subtle source of potential infinite loops
are reactions where products atoms still match the reactant pattern
after they have been involved in a chemical transformation. The
OEUniMolecularRxn
class allows a set of atom that match a
reactant pattern to react only a single time.
The following code demonstrates the use of the
OEUniMolecularRxn
class. The OEUniMolecularRxn
in this
case is initialized using a SMIRKS pattern. The example reaction
protonates and charges an amine nitrogen. When the OEUniMolecularRxn
class is applied to 1,2-ethanediamine both nitrogens are charged and
protonated to yield 1,2-ethanediaminium. The example reaction was
intentionally written to demonstrate the protection mechanisms in place
to prevent underspecified reactions from causing infinite loops. The
product 1,2-ethanediaminium still matches the reactant pattern,
however, subsequent reactions terminate when no unreacted atoms are
identified.
#include "oechem.h" #include <iostream> using namespace OEChem; using namespace std; int main() { OEUniMolecularRxn umr("[N:1]>>[Nh3+:1]"); OEGraphMol mol; OEParseSmiles(mol,"NCCN"); umr(mol); std::string smi; OECreateSmiString(smi,mol); cout << "smiles = " << smi << endl; return 0; }