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 bool

IsValid() -> bool

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

Clear

Clear() -> None

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

ClearBase() -> None

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

ClearCoords() -> None

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

Compress

Compress() -> bool

See also

Count

Count(arg2: int) -> int

CreateCopy

CreateCopy() -> OEBase

DeleteAtom

DeleteAtom(arg2: OEAtomBase) -> bool

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

DeleteBond(arg2: OEBondBase) -> bool

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

DeleteGroup(group: OEGroupBase) -> bool

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

GetAtom

GetAtom(arg2: OEUnaryAtomPred) -> OEAtomBase

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

GetAtoms() -> OEAtomIter

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.

GetAtoms(arg2: OEUnaryAtomPred) -> OEAtomIter

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

GetBond

GetBond(arg2: OEAtomBase, arg3: OEAtomBase) -> OEBondBase

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

GetBond(arg2: OEUnaryBondPred) -> OEBondBase

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

GetBonds() -> OEBondIter

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.

GetBonds(arg2: OEUnaryBondPred) -> OEBondIter

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

GetCoords

GetCoords() -> {idx : (x_0, y_0, z_0), ... }

Returns a Python dictionary of the coordinates of this molecule. The dictionary is keyed off the index of the OEAtomBase as returned by OEAtomBase.GetIdx. The values will always be a 3-element tuple of floating point values. Note, the dictionary will not contain entries for deleted atoms, making it significantly easier to use than the following OEFloatArray overloads. This also means the keys of the dictionary are not always guaranteed to be contiguous integers.

Note

The overload that returns a dictionary is for convenience over performance as it is significantly more pythonic. However, if the floating point values are not needed in Python and just being passed to another OpenEye toolkit function, using the following overloads with OEFloatArray objects will be significantly faster.

GetCoords(arg2: OEAtomBase) -> bool
GetCoords(crds: OEHalfFloat) -> bool
GetCoords(arg2: OEFloatArray) -> bool
GetCoords(arg2: OEDoubleArray) -> bool

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.

GetCoords(atom: OEAtomBase, crds: OEHalfFloat) -> bool
GetCoords(arg2: OEAtomBase, arg3: OEFloatArray) -> bool
GetCoords(arg2: OEAtomBase, arg3: OEDoubleArray) -> bool

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

GetDimension() -> int

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

GetEnergy() -> float

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

GetGroup(pred: OEUnaryGroupPred) -> OEGroupBase

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

GetGroups() -> Iterable[OEGroupBase]

Returns an iterator over all the groups of a molecule.

GetGroups(pred: OEUnaryGroupPred) -> Iterable[OEGroupBase]

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

See also

GetMaxAtomIdx

GetMaxAtomIdx() -> int

For performance reasons, atom indices are not guaranteed to be contiguous. OEMolBase.GetMaxAtomIdx returns a lower bound for the maximum atom index i.e. all indices returned by OEAtomBase.GetIdx of the molecule will be less than this value. The value returned by OEMolBase.GetMaxAtomIdx is always at least as large as OEMolBase.NumAtoms.

This method is useful for allocating temporary external data structures that need to be indexed by atom index, as returned by OEAtomBase.GetIdx.

GetMaxBondIdx

GetMaxBondIdx() -> int

For performance reasons, bond indices are not guaranteed to be contiguous. OEMolBase.GetMaxBondIdx returns a lower bound for the maximum bond index i.e. all indices returned by OEBondBase.GetIdx of the molecule will be less than this value. The value returned by OEMolBase.GetMaxBondIdx is always at least as large as OEMolBase.NumBonds.

This method is useful for allocating temporary external data structures that need to be indexed by bond index, as returned by OEBondBase.GetIdx.

GetTitle

GetTitle() -> str

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

HasPerceived(arg2: int) -> bool

Returns whether a property is perceived for the given molecule.

property

This value has to be from the OEPerceived namespace.

IsDataType

IsDataType(arg2: void) -> bool

IsDeleted

IsDeleted(arg2: OEBondBase) -> bool
IsDeleted(arg2: OEAtomBase) -> bool

IsRxn

IsRxn() -> bool

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

NewAtom(arg2: int) -> OEAtomBase

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.

NewAtom(arg2: OEAtomBase) -> OEAtomBase

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

NewBond(arg2: OEAtomBase, arg3: OEAtomBase, order: int = 0) -> OEBondBase

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

NumAtoms() -> int

Returns the number of atoms in the molecule.

NumBonds

NumBonds() -> int

Returns the number of bonds in the molecule.

NumGroups

NumGroups() -> int

Returns the number of groups in the molecule.

OrderAtoms

OrderAtoms(arg2: OEAtomVector) -> bool

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

OrderBonds(arg2: OEBondVector) -> bool

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

ResetPerceived() -> None

Invalidates all previously perceived properties specified in the OEPerceived namespace.

SetCoords

SetCoords(arg2: OEAtomBase) -> bool
SetCoords(crds: OEHalfFloat) -> bool
SetCoords(arg2: OEFloatArray) -> bool
SetCoords(arg2: OEDoubleArray) -> bool

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.

SetCoords(atom: OEAtomBase, crds: OEHalfFloat) -> bool
SetCoords(arg2: OEAtomBase, arg3: OEFloatArray) -> bool
SetCoords(arg2: OEAtomBase, arg3: OEDoubleArray) -> bool

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

SetDimension(arg2: int) -> bool

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

SetEnergy(arg2: float) -> bool

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

SetPerceived(arg2: int, arg3: bool) -> bool

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

SetRxn(arg2: bool) -> bool

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

SetTitle

SetTitle(arg2: str) -> bool

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

Sweep() -> bool

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

UnCompress() -> bool

See also