OEConfRMSD

class OEConfRMSD

The OEConfRMSD class provides fast RMSD calculation of conformers of the same molecule. During the RMSD calculation the automorphisms of the molecule graph is taken into consideration. Automorphisms are the symmetry related transformations of a molecule which can result in anomalously high RMSDs if not properly treated. For instance, t-butyl-benzene has a three-fold automorphism around the t-butyl group and a two-fold automorphism around the benzene ring.

Constructors

OEConfRMSD(const OEMolBase& mol,
           const OEConfRMSDOptions &opts=OEConfRMSDOptions())

Constructs an OEConfRMSD object using a OEMolBase and an optional OEConfRMSDOptions.

See also

CalculateRMSD

double CalculateRMSD(const OEConfBase *refconf, const OEConfBase *fitconf) const
double CalculateRMSD(const double* refcoords, const double* fitcoords) const

Calculates the RMSD between the two conformations. The inputs can be either the OEConfRMSD objects or their coordinates.

For the second overload, the length of the arrays should be 3*MaxAtomIdx and should contain the Cartesian coordinates of the two conformers being assessed.

GetOptions

OEConfRMSDOptions GetOptions() const

Returns the options used to set up the OEConfRMSD object.

See also

IsValid

bool IsValid() const

Returns whether the OEConfRMSD object is valid.

MinimizeRMSD

double MinimizeRMSD(const OEConfBase *refconf, const OEConfBase *fitconf,
                    OETrans &trans) const
double MinimizeRMSD(const double* refcoords, const double* fitcoords,
                    OETrans& trans) const

The function returns the minimum RMSD between the two conformations and reports the translation and rotation, trans, required to give this minimum RMSD.

For the second overload, the length of the arrays should be 3*MaxAtomIdx and should contain the Cartesian coordinates of the two conformers being assessed.

NumAutomorphs

unsigned int NumAutomorphs() const

The function returns the number of automorphisms taken into account during the RMSD calculation.

Example:

The following example finds the two conformers of a molecule that have the smallest RMSD.

mol = oechem.OEMol()
oechem.OEReadMolecule(ifs, mol)
crmsd = oechem.OEConfRMSD(mol)

confiidx = 0
confjidx = 0
minRMSD = float("inf")
confs = list(mol.GetConfs())
for ci in range(len(confs)):
    for cj in range(ci + 1, len(confs)):
        trans = oechem.OETrans()
        dist = crmsd.MinimizeRMSD(confs[ci], confs[cj], trans)
        if dist < minRMSD:
            minRMSD = dist
            confiidx = ci
            confjidx = cj

print('The closest conformers are ', confiidx, ' and ', confjidx, end=" ")
print(' with RMSD = ', minRMSD)

See also