Page 1 of 1
per-bond energies
Posted: Thu Feb 28, 2013 10:17 am
by jlmaccal
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?
Re: per-bond energies
Posted: Thu Feb 28, 2013 11:11 am
by peastman
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
Re: per-bond energies
Posted: Thu Feb 28, 2013 11:57 am
by jlmaccal
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.
Re: per-bond energies
Posted: Thu Feb 28, 2013 6:09 pm
by peastman
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