OEGetXLogPΒΆ

bool OEGetXLogP(const OEChem::OEMolBase &mol, float &xlogp, float *atomxlogps=0)

Returns the XLogP for a given molecule as described in the LogP section. The returned value will be equal to the sum on the individual atom contributions plus the linear regression constant -0.127.

The C++ version of this function uses a pointer-to-argument to indicate the success or failure of the computation. This idiom doesn’t map directly to the wrapped languages, so the wrapped versions of OEGetXLogP use exceptions to signal failure. This is not optimal. Hence, for the wrapped languages, the preferred method for computing XLogP is OEGetXLogPResult. It does not use exceptions and is much cleaner to use in the wrapped languages.

The atomxlogps parameter can be used to retrieve the contribution of each atom to the total XLogP as shown in Listing 2. See example in Figure: Example of depicting the atom contributions of the XLogP.

Listing 2: Example of retrieving individual atom contributions to XLogP

  // declare an array for atom values
  float * atomXLogP = new float[mol.GetMaxAtomIdx()];
  float xlogp;
  bool rc = OEGetXLogP(mol, xlogp, atomXLogP);

  if (!rc)
    std::cout << "XLogP failed for molecule" << std::endl;
  else
  {
    std::cout << "XLogP = " << xlogp << std::endl;
    for (OEIter<OEAtomBase> atom=mol.GetAtoms();atom;++atom)
    {
      unsigned int idx = atom->GetIdx();
      std::cout << idx << " " << atomXLogP[idx] << std::endl;
    }
  }

  // clean up
  delete [] atomXLogP;
../../_images/OEGetXLogP.png

Example of depicting the atom contributions of the XLogP

See also

LogP section