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.

int main(int argc, char *argv[])
  if (argc < 2)
    OEThrow.Usage("%s <infile_1> [<infle2>...]", argv[0]);

  double pmi[3] = {0};
  double radiusOfGyration[3] = {0};

  for (int i = 1; i < argc; i++)
    oemolistream ifs;
    if (!ifs.open(argv[i]))
      OEThrow.Fatal("Unable to open %s for reading", argv[1]);

    OEMol mol;
    while (OEReadMolecule(ifs, mol))
      OECalcPMI(pmi, mol);
      std::cout << "PMI: ";
      for (int i = 0; i < 3; i++)
        std::cout << pmi[i] << " ";
      std::cout << std::endl;
      std::cout << "Radius Of Gyration: ";
      for (int j = 0; j < 3; j++)
        std::cout << radiusOfGyration[j] << " ";
      std::cout << std::endl;
  return 0;