per-bond energies

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Justin MacCallum
Posts: 16
Joined: Tue Dec 09, 2008 2:47 pm

per-bond energies

Post by Justin MacCallum » Thu Feb 28, 2013 10:17 am

Is there any way to get per-bond energies out of the kernels and into the State objects? For example, I might add a HarmonicBondForce to the system and then add many bonds. For our particular application, it is necessary to get the energies of the individual bonds. Is that possible using the existing classes? I suspect it is not, but in that case, can you see a way to allow a custom kernel to return a vector of energies?

User avatar
Peter Eastman
Posts: 2588
Joined: Thu Aug 09, 2007 1:25 pm

Re: per-bond energies

Post by Peter Eastman » Thu Feb 28, 2013 11:11 am

Hi Justin,

No, it doesn't break out the energy into individual bond terms. You could, of course, update the bond parameters so that only one bond has a nonzero k, evaluate the energy, and then repeat. But that's going to be really slow, since it takes N energy evaluations for N bonds.

If you only need this for harmonic bonds, you're probably better off just getting the positions and calculating the energies yourself, since the calculation to evaluate a single bond is trivial. If you need this for something more complicated, that might be less acceptable.

Peter

User avatar
Justin MacCallum
Posts: 16
Joined: Tue Dec 09, 2008 2:47 pm

Re: per-bond energies

Post by Justin MacCallum » Thu Feb 28, 2013 11:57 am

Hi Peter,

I assmed the existing kernels wouldn't break this up per bond. Is there anyway to squeeze that functionality into a new kernel that still sits in the rest of the openmm framework? We currently calculate all of these per bond energies on the CPU, but it's very slow because we have large numbers of them.

User avatar
Peter Eastman
Posts: 2588
Joined: Thu Aug 09, 2007 1:25 pm

Re: per-bond energies

Post by Peter Eastman » Thu Feb 28, 2013 6:09 pm

Sure, you could write a plugin to do this. It would take the place of the HarmonicBondForce, and compute the same interaction, but write out each energy to an array in global memory. You could start by copying the code from HarmonicBondForce and just making a few minor changes.

Peter

POST REPLY