Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#156 Publicly access the values of the gradients

open
nobody
API (57)
5
2012-10-23
2010-09-22
Anonymous
No

I am considering to include OpenBabel force fields in on of my applications, studying conformational transitions of (macro)molecules.
To this end, I need the values of the molecular energy, gradients and (possibly) the second derivatives.

I managed to write a wrapper that gives me the energy of a configuration, but I could not find a way to access the values of the gradients (using the API's of openbabel-2.2.3).
As far as I understand, this is so because the routines that calculate the gradients are declared "private" in include/openbabel/forcefield.h, but I cannot see why this has to be so.

Therefore, I am suggesting to extend/modify the API to allow access of the force-field gradients to general programs making use of the library.

As a first step to this goal, I managed to patch the source code of openbabel, moving the declaration of GetGradients and friends in the public section of the relevant classes (see the attached file).
After recompiling the library, I am now able to access the forces, after calling the method Energy of OBForceField with the value "true".
This is probably not the most elegant hack around, but it "works for me" and might be useful to other people.

Finally, let me just thank all the developers of this impressive code for their valuable efforts.

Best regards.

Discussion

  • move GetGradient and friend in the public section

     
    Attachments