> I would like to calculate the energy of a molecule (using the mmff94 force 
> field).  I do *not* want to do minimization, just read off the energy value 
> programatically.
> 
> I see that there is an "energy" attribute in pybel -- but the documentation 
> at 
> http://openbabel.org/docs/dev/UseTheLibrary/Python_PybelAPI.html#pybel.Molecule.energy
>  does not tell me which forcefield is used to do this calculation.

The energy attribute is not directly from a forcefield. Some file formats yield 
an energy descriptor, so it's not exactly what you want.

> Basically I need programmatic access to what obenergy does.

In C++:
    OBForceField* pFF = OBForceField::FindForceField("MMFF94");
    if (!pFF->Setup(mol)) {
        // error
    }
    energy = pFF->Energy(false);

In Python (caution, spacing might get abused by e-mail program):
    ff = pybel._forcefields["mmff94"]
    success = ff.Setup(mol.OBMol)
    if not success:
            sys.exit("Cannot set up forcefield")
   energy = ff.Energy()

That's it! I thought that was in the C++ API docs, so I'll add it shortly.

Hope that helps,
-Geoff
------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to