OEGetRadiusOfGyrationΒΆ

bool OEGetRadiusOfGyration(double* radiusOfGyration, const double* pmi, const OEMolBase& mol)

Calculates the radius of gyration of the given molecule, using the given PMI that has already been calculated. Units of the radius are the same as those used to set the radius of the molecule, which need to be the same radius units used to calculte the PMI.

Returns true if calculation is successful, false otherwise.

radiusOfGyration

This double array will be populated by the radius of gyration in each dimension, X, Y, and Z.

pmi

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

mol

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.

using System;
using OpenEye.OEChem;

public class CalcPMI
{
    public static int Main(string[] args)
    {
        foreach (string inp_filename in args)
        {
            OEGraphMol mol = new OEGraphMol(); 
            oemolistream ifs = new oemolistream(inp_filename);
            double[] pmi = new double[3];    
            double[] rGyr = new double[3];
            while (OEChem.OEReadMolecule(ifs, mol))
            {
                OEChem.OECalcPMI(pmi, mol);
                Console.WriteLine("PMI");
                foreach (double val in pmi)
                {                        
                    Console.Write(val + " ");
                } 
                Console.WriteLine();
                OEChem.OEGetRadiusOfGyration(rGyr, pmi, mol);
                Console.WriteLine("Radius of Gyration");
                foreach (double val in rGyr)
                {                        
                    Console.Write(val + " ");
                } 
                Console.WriteLine();
            }
        }
        return 0;
    }
}