# OEUniMolecularRxn¶

class OEUniMolecularRxn


This class represents OEUniMolecularRxn.

The OEUniMolecularRxn class is designed to apply a chemical transformation to a molecule. The primary purpose of the class is to provide an efficient means of applying normalization reactions, although there are few restrictions on the types of chemical transformations that can be applied. The reaction used to initialize the class must contain only a single reactant. The provided transformation is applied iteratively until no further reactant patterns are matched. Caution must be used in defining the transformation as it is possible to provide a reaction that will cause a OEUniMolecularRxn object to iterate until memory is exhausted. For example, a reaction for which the reactant pattern matches the transformed product molecule will reapply the transformation indefinitely and must be avoided. Note, however, that atoms and bonds created by a transformation are excluded from involvement in iterative applications of the transformation.

OEUniMolecularRxn

Example of amine nitrogen protonation using ‘OEUniMolecularRxn’. Transformations are applied to the starting material recursively

## Constructors¶

OEUniMolecularRxn()


Default constructor.

OEUniMolecularRxn(const OEUniMolecularRxn &)


Copy constructor.

OEUniMolecularRxn(const char * smirks, bool strictSmirks=true)


Creates a OEUniMolecularRxn object with a ‘smirks’ (SMIRKS) pattern. Attempts to initialize an OEUniMolecularRxn object with a reaction that has more than one reactant will result in an initialization failure. Success of initialization can be tested using the operator OEUniMolecularRxn::operator bool method. The second argument to the constructor is used to specify the interpretation of the SMIRKS semantics. By default, the ‘smirks string is interpreted using strict semantics.

Passing a value of false to the second method argument will relax the strict SMIRKS restrictions. A mapped reactant atom that does not have a corresponding mapped product atom is valid, and will be destroyed as part of the reaction. Unmapped reactant atoms will be used to match the reactant pattern, but are not destroyed when the reaction is applied. The resulting SMIRKS like reactions may therefore be more easily readable by humans as fewer atoms may be required to be mapped.

• SMIRKS definition describing the strict SMIRKS semantics in the Glossary chapter.

## operator=¶

OEUniMolecularRxn &operator=(const OEUniMolecularRxn &rhs)


## operator()¶

bool operator()(OEMolBase &mol) const


Applies the set of transformations with which the OEUniMolecularRxn object has been initialized on the passed OEMolBase object. Return true if the reactant pattern matches at least one time in the passed molecule.

If the OEUniMolecularRxn fails to apply any transformations because the reactant pattern failed to match the molecule, the method will return false.

## operator bool¶

operator bool() const


Returns true, if the OEUniMolecularRxn object was initialized with no failures using either the constructors or one of the OEUniMolecularRxn::Init methods.

The method will return false when the OEUniMolecularRxn object has not been properly initialized as it will be unable to apply transform operations to molecules.

## GetValidateKekule¶

bool GetValidateKekule() const


Returns whether the transformation validates the Kekulé form of the returned products.

## Init¶

bool Init(const char *smirks, bool strictSmirks=true)


This method initializes an OEUniMolecularRxn object the ‘smirks’ pattern. By default, the SMIRKS string is interpreted using strict semantics.

Passing a value of false to the second method argument will relax the strict SMIRKS restrictions. A mapped reactant atom that does not have a corresponding mapped product atom is valid, and will be destroyed as part of the reaction. Unmapped reactant atoms will be used to match the reactant pattern, but are not destroyed when the reaction is applied. The resulting SMIRKS like reactions may therefore be more easily readable by humans as fewer atoms may be required to be mapped.

bool Init(const OEQMolBase &, bool strictSmirks=true)


Initializes an OEUniMolecularRxn object with a query molecule (OEQMolBase). If query molecule is created using the OEParseSmirks function, and if the reaction is desired to be interpreted using strict SMIRKS semantics, then the default true value for the second argument to the method should be used.

Passing a value of false to the second argument will relax the restrictions imposed by strict SMIRKS semantics.

bool SetValidateKekule(bool validate)
`