bool OECalcPMI(double* pmi, OEMolBase &mol)

Calculates the PMI (principal moment of inertia) of the given molecule. Units of the PMI calculated are mass_unit, where mass_unit and length_unit are those used to set the radius.

Returns true if calculation is successful, false otherwise. The function returns false if the values for the PMI are all 0.0.


This pointer is populated by the PMI of the given molecule in each dimension, X, Y, and Z.


This is the molecule for which the PMI is calculated. It must have a set radius and set mass for the calculation to be valid.

The following code snippet demonstrates how to calculate the PMI and radius of gyration for a molecule.

package openeye.docexamples.oechem;

import openeye.oechem.*;

public class CalcPMI {
    public static void main(String argv[]) {

        int i, j, k;
        for (i = 0; i < argv.length; i++) {
            String inp_filename = argv[i]; 
            OEGraphMol omol = new OEGraphMol(); 
            oemolistream ifs = new oemolistream(inp_filename);
            OEDoubleArray pmi = new OEDoubleArray(3); 
            OEDoubleArray rGyr = new OEDoubleArray(3); 
            while (oechem.OEReadMolecule(ifs, omol)) {
                oechem.OECalcPMI(pmi, omol);
                for (j = 0; j < 3; j++)
                    System.out.print(pmi.getItem(j) + " ");
                oechem.OEGetRadiusOfGyration(rGyr, pmi, omol);
                System.out.print("Radius of Gyration");
                for (k = 0; k < 3; k++)
                    System.out.print(rGyr.getItem(k) + " ");