OEMolBase

class OEMolBase : public OESystem::OEBase

This class represents OEMolBase.

The OEMolBase class is the abstract interface for representing molecules within OEChem.

The following methods are publicly inherited from OEBase:

operator=

GetData

IsDataType

operator+=

GetDataIter

SetBaseData

AddBaseData

GetDataType

SetBoolData

AddData

GetDoubleData

SetData

Clear

GetFloatData

SetDoubleData

CreateCopy

GetIntData

SetFloatData

DeleteData

GetStringData

SetIntData

GetBoolData

HasData

SetStringData

The following classes derive from this class:

operator=

OEMolBase &operator=(const OEMolBase &m)

operator bool

operator bool() const

Determines whether the OEMolBase object contains any atoms. This method is equivalent to OEMolBase.NumAtoms() != 0.

Clear

void Clear()=0

Resets a molecule to its initial state. This method deletes all atoms (OEAtomBase) and bonds (OEBondBase) that are part of the molecule. Following an OEMolBase.Clear, the atom and bond indices assigned to new atoms and bonds may not be unique with those assigned prior to the OEMolBase.Clear.

ClearBase

void ClearBase()

Clear the generic data from the OEBase base class of this object. Equivalent to just calling OEBase.Clear without actually clearing away molecule data like atoms and bonds.

ClearCoords

bool ClearCoords() const =0

Clears the coordinates, resets stereo perception flags and sets the coordinate dimension to 0

Compress

bool Compress()

See also

Count

unsigned int Count(unsigned int) const =0

CreateCopy

OESystem::OEBase *CreateCopy() const

DeleteAtom

bool DeleteAtom(OEAtomBase *atom)=0

Deletes an atom from a molecule. All bonds connected to the specified atom are also automatically deleted. Following an atom deletion, the specified OEAtomBase pointer, and the OEBondBase pointers of any incident bonds, are no longer valid and should not be used. The atom index associated with the atom, and the bond indices of any incident bonds, are no longer recognized by the OEMolBase, but the indices of all other atoms and bonds remain stable, and are unaffected by this call.

Note

After deleting atoms or bonds, it may be necessary to call the OEFindRingAtomsAndBonds and OEAssignAromaticFlags functions to update the ‘in ring’ and ‘aromatic’ properties of the atoms and bonds in the modified molecule.

DeleteBond

bool DeleteBond(OEBondBase *bond)=0

Deletes a bond from a molecule. Following a bond deletion, the specified OEBondBase pointer is no longer valid and should not be used. The bond index associated with the bond is no longer recognized by the OEMolBase, but the indices of all other bonds remain stable, and are unaffected by this call.

Note

After deleting atoms or bonds, it may be necessary to call the OEFindRingAtomsAndBonds and OEAssignAromaticFlags functions to update the ‘in ring’ and ‘aromatic’ properties of the atoms and bonds in the modified molecule.

DeleteGroup

bool DeleteGroup(OEGroupBase *group)

Deletes a group from a molecule. Following a group deletion, the specified OEGroupBase pointer is no longer valid and should not be used.

GetAtom

OEAtomBase *
  GetAtom(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &) const =0

Retrieves the first atom of a molecule that matches the specified atom predicate (OEUnaryPredicate). If the molecule does not contain an atom that matches, a NULL pointer, (OEAtomBase*)0, is returned.

GetAtoms

OESystem::OEIterBase<OEAtomBase> *GetAtoms() const =0

Returns an iterator over all the atoms of a molecule. By default, this returns all the atoms of the molecule in the order they were created. The ordering of the atoms returned by OEMolBase.GetAtoms may be modified by OEMolBase.OrderAtoms.

OESystem::OEIterBase<OEAtomBase> *
  GetAtoms(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &) const =0

Returns an iterator over all of the atoms of a molecule that match the specified atom predicate (OEUnaryPredicate).

GetBond

OEBondBase *GetBond(const OEAtomBase *src, const OEAtomBase *dst) const

Retrieves the bond of a molecule between two specified atoms. If the two atoms, ‘src’ and ‘dst’ are not bonded together, then a NULL pointer, (OEBondBase*)0, is returned

OEBondBase *
  GetBond(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &) const =0

Retrieves the first bond of a molecule that matches the specified bond predicate. If the molecule does not contain a bond that matches the predicate, a NULL pointer, (OEBondBase*)0, is returned.

GetBonds

OESystem::OEIterBase<OEBondBase> *GetBonds() const =0

Returns an iterator over all the bonds of a molecule. By default, this returns all the bonds of the molecule in the order they were created. The ordering of the bonds returned by OEMolBase.GetBonds may be modified by OEMolBase.OrderBonds.

OESystem::OEIterBase<OEBondBase> *
  GetBonds(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &) const =0

Returns an iterator over all of the bonds of a molecule that match the specified bond predicate (OEUnaryPredicate).

GetCoords

bool GetCoords(OEPlatform::OEHalfFloat *) const =0
bool GetCoords(float *) const =0
bool GetCoords(double *) const =0
bool GetCoords(long double *) const =0

Fills the specified array of floating point values with the Cartesian coordinates of all of the atoms in the molecule. The array argument must point to an array of at least 3* OEMolBase.GetMaxAtomIdx() elements. The X, Y and Z coordinates for the atom with index ‘i’ will be placed at offsets 3*i, 3*i+1 and 3*i+2 respectively.

bool GetCoords(const OEAtomBase *, OEPlatform::OEHalfFloat *) const =0
bool GetCoords(const OEAtomBase *, float *) const =0
bool GetCoords(const OEAtomBase *, double *) const =0
bool GetCoords(const OEAtomBase *, long double *) const =0

Fills the specified array of floating point values with the Cartesian coordinates of the specified atom. This array must be large enough to hold at least three values, corresponding to the X, Y and Z values for the given atom.

GetDimension

unsigned int GetDimension() const =0

Returns the ‘dimensionality’ property of a molecule. The default value is zero, for unknown or no coordinates, 2 for 2-dimensional coordinates (such as depictions) and 3 for 3-dimensional coordinates. The ‘dimensionality’ property of a molecule may be set using the OEMolBase.SetDimension method.

This property is typically set by the appropriate molecular file format reader (0 for SMILES, 3 for MOL2 and 2 or 3 for MDL SD files etc…) or by calling the OESetDimensionFromCoords function.

GetEnergy

double GetEnergy() const =0

Returns the ‘energy’ property of a molecule. The default value is 0.0. The ‘energy’ property of a molecule may be set using the OEMolBase.SetEnergy method. Higher values indicate higher energies and therefore less-favorable or more-strained structures.

GetGroup

OEGroupBase *
  GetGroup(const OESystem::OEUnaryPredicate<OEChem::OEGroupBase> &pred) const

Retrieves the first group of a molecule that matches the specified group predicate (OEUnaryPredicate). If the molecule does not contain a group that matches, a NULL pointer, (OEGroupBase*)0, is returned.

See also

GetGroups

OESystem::OEIterBase<OEGroupBase> *GetGroups() const

Returns an iterator over all the groups of a molecule.

OESystem::OEIterBase<OEGroupBase> *
  GetGroups(const OESystem::OEUnaryPredicate<OEChem::OEGroupBase> &pred) const

Returns an iterator over all of the groups of a molecule that match the specified group predicate (OEUnaryPredicate).

See also

GetMaxAtomIdx

unsigned int GetMaxAtomIdx() const =0

Returns a lower bound on the maximum atom index. All atom indices returned by OEAtomBase.GetIdx on atoms belonging to this molecule are guaranteed to be less than this value. Obviously, the returned result is always greater than or equal to OEMolBase.NumAtoms.

GetMaxBondIdx

unsigned int GetMaxBondIdx() const =0

Returns a lower bond on the maximum bond index. All bond indices returned by OEBondBase.GetIdx on bonds belonging to this molecule are guaranteed to be less than this value. Obviously, the returned result is always greater than or equal to OEMolBase.NumBonds.

GetTitle

const char *GetTitle() const

Returns the ‘title’ property of a molecule. The default value is the empty string. The title of a molecule may be set using the OEMolBase.SetTitle method.

See also

HasPerceived

bool HasPerceived(unsigned int prop) const = 0

Returns whether a property is perceived for the given molecule.

property

This value has to be from the OEPerceived namespace.

IsDataType

bool IsDataType(const void *) const

IsDeleted

bool IsDeleted(OEBondBase *) const =0
bool IsDeleted(OEAtomBase *) const =0

IsRxn

bool IsRxn() const

Determines whether the molecule represents a reaction/transform. A true returned value indicates that the molecule represents a reaction, while false indicates the molecule is a simple connection table. The default value is false. The reaction property of a molecule may be set using the OEMolBase.SetRxn method.

NewAtom

OEAtomBase *NewAtom(unsigned int)=0

Creates a new atom in the molecule by specifying the element number from the OEElemNo namespace. This method does not create any bonds, and the returned created atom is always disconnected.

OEAtomBase *NewAtom(const OEAtomBase &)=0

Creates a new atom in the molecule and copies the atomic properties of the specified atom (atomic number, formal charge, implicit hydrogen count, etc…) This method does not create any bonds, and the returned created atom is always disconnected.

NewBond

OEBondBase *NewBond(OEAtomBase *src, OEAtomBase *dst, unsigned int order=0)=0

Creates a new bond in the molecule. The ‘src’, ‘dst’ and ‘order’ arguments are used to specify the begin atom, the end atom and the bond order of the new bond. This method returns a pointer to the newly created OEBondBase object. The atoms specified as ‘src’ and ‘dst’ atoms must belong to the current molecule. Additionally, a NULL pointer, (OEAtomBase*)0, may be passed as either the begin or end atom (but not both), allowing that atom to be specified later using OEBondBase.SetBgn or OEBondBase.SetEnd respectively. This helps when creating molecules for applications in which the ordering of atoms and/or bonds is significant.

Note

After creating new bonds, it may be necessary to call the OEFindRingAtomsAndBonds and OEAssignAromaticFlags functions to update the ‘in ring’ and ‘aromatic’ properties of the atoms and bonds in the modified molecule.

NewGroup

OEGroupBase *NewGroup(unsigned int type, const std::vector<OEAtomBase *> &atoms)

OEGroupBase *NewGroup(unsigned int type, const std::vector<OEBondBase *> &bonds)

OEGroupBase *NewGroup(unsigned int type, const std::vector<OEAtomBase *> &atoms,
                                         const std::vector<OEBondBase *> &bonds)

OEGroupBase* NewGroup(unsigned int type, const OEAtomBondSet &abset)

Creates a new group in the molecule with the given atoms or/and bonds.

type

The type associated with the created OEGroupBase object.

atoms

The pointer of the OEAtomBase objects that the group will hold.

bonds

The pointer of the OEBondBase objects that the group will hold.

abset

The OEAtomBondSet container that holds atom and bond pointers.

Note

An empty group can not be created. If there is no valid atom or/and bond pointers given, then the OEMolBase.NewGroup will return a NULL pointer.

See also

NumAtoms

unsigned int NumAtoms() const =0

Returns the number of atoms in the molecule.

NumBonds

unsigned int NumBonds() const =0

Returns the number of bonds in the molecule.

NumGroups

unsigned int NumGroups() const

Returns the number of groups in the molecule.

OrderAtoms

bool OrderAtoms(const std::vector<OEAtomBase *> &)=0

Reorders the atoms of the molecule. This method modifies the order in which the atoms are visited by the iterator returned by OEMolBase.GetAtoms. This method does not affect the atom indices of any of the atoms of the molecule. This method does not affect the ordering of any other iterator, including bonds over a molecule (OEMolBase.GetBonds) , bonds over an atom (OEAtomBase.GetBonds) or neighboring atoms over an atom (OEAtomBase.GetAtoms).

OrderBonds

bool OrderBonds(const std::vector<OEBondBase *> &)=0

Reorders the bonds of a molecule. This method modifies the order in which the bonds are visited by the iterator returned by OEMolBase.GetBonds. This method does not affect the bond indices of any of the bonds of the molecule. This method does not affect the ordering of any other iterator, including atoms over a molecule (OEMolBase.GetAtoms), bonds over an atom (OEAtomBase.GetBond) or neighboring atoms over atom (OEAtomBase.GetAtoms).

ResetPerceived

void ResetPerceived() = 0

Invalidates all previously perceived properties specified in the OEPerceived namespace.

SetCoords

bool SetCoords(const OEPlatform::OEHalfFloat *coords)=0
bool SetCoords(const float *coords)=0
bool SetCoords(const double *coords)=0
bool SetCoords(const long double *coords)=0

Sets the Cartesian coordinates for all of the atoms in a molecule. The array argument must point to an array of at least 3* OEMolBase.GetMaxAtomIdx() elements. The X, Y and Z coordinates for the atom with index ‘i’, should be placed at offsets 3*i, 3*i+1 and 3*i+2 respectively.

bool SetCoords(const OEAtomBase *, const OEPlatform::OEHalfFloat *)=0
bool SetCoords(const OEAtomBase *, const float *)=0
bool SetCoords(const OEAtomBase *, const double *)=0
bool SetCoords(const OEAtomBase *, const long double *)=0

Sets the Cartesian coordinates of the specified atom to the values specified by the floating point array. The array argument must point to array of at least three values, representing the X, Y and Z Cartesian coordinates of the atom, respectively.

SetDimension

bool SetDimension(unsigned int)=0

Sets the ‘dimensionality’ property of a molecule. The default value is zero. The ‘dimensionality’ property of a molecule may be retrieved using the OEMolBase.GetDimension method. This property is typically set by the appropriate molecular file format reader, or by calling the OESetDimensionFromCoords function.

The ‘dimensionality’ property represents the dimensionality of the coordinates. This has the default value zero, for unknown or no coordinates, 2 for 2-dimensional coordinates (such as depictions) and 3 for 3-dimensional coordinates. This property is typically set by the file format reader indicating the dimensionality of the input file (0 for SMILES, 3 for MOL2 and 2 or 3 for MDL SD files etc…)

SetEnergy

bool SetEnergy(float)=0
bool SetEnergy(double)=0

Sets the ‘energy’ property of a molecule. The default value is 0.0. The energy of a molecule may be retrieved using the OEMolBase.GetEnergy method.

SetPerceived

bool SetPerceived(unsigned int property, bool perceived) = 0

Sets whether a property is considered to be perceived for the given molecule.

property

This value has to be from the OEPerceived namespace.

perceived

A boolean value that determines whether the given property is perceived.

Warning

The perception flags are used for performance in order to avoid perceiving properties that have already been calculated. It should be set to be ‘true’ only by the function that calculates the given property.

SetRxn

bool SetRxn(bool)

Sets the ‘reaction’ property of a molecule. The ‘reaction’ property of a molecule may be retrieved using the OEMolBase.IsRxn method.

SetTitle

bool SetTitle(const char *)=0
bool SetTitle(const std::string &)=0

Sets the ‘title’ property of a molecule. The default value is the empty string. The ‘title’ property of a molecule may be retrieved using the OEMolBase.GetTitle method.

See also

Sweep

bool Sweep()=0

Renumbers the atom and bond indices sequentially. This method invalidates the atom and bond indices of all atoms in a molecule.

Note

This method doesn’t guarantee that all atom and bond indices are sequential upon completion (some molecule implementations may treat OEMolBase.Sweep as a no-op).

UnCompress

bool UnCompress()

See also