Determination of potential energies after simulation

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Marten Beeg
Posts: 2
Joined: Tue Sep 11, 2012 6:09 am

Determination of potential energies after simulation

Post by Marten Beeg » Tue Dec 03, 2013 8:46 am

Dear all,
How can I determine the potential energy of the different forces specified in the forcefield (torsion, harmonic bond...) for every frame in my trajectory after the simulation has finished?

Thanks in advanced for your help
All the best
Marten

User avatar
Yutong Zhao
Posts: 6
Joined: Wed Apr 18, 2012 11:40 am

Re: Determination of potential energies after simulation

Post by Yutong Zhao » Tue Dec 03, 2013 9:22 am

Hi,

You can use force groups to separate each force into a different group. When you call getState later on, you can query by the forceGroup. Take a look at the API in the docs, and if you have trouble understanding it let us know

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

Re: Determination of potential energies after simulation

Post by Peter Eastman » Tue Dec 03, 2013 11:27 am

More precisely, before you create your Context/Simulation, call setForceGroup() on each Force in the System. Something like this:

Code: Select all

for i in range(system.getNumForces()):
    system.getForce(i).setForceGroup(i)
Then to query the energy of group i, call

Code: Select all

context.getState(getEnergy=True, groups=1<<i).getPotentialEnergy()
Peter

POST REPLY