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
Determination of potential energies after simulation
- Marten Beeg
- Posts: 2
- Joined: Tue Sep 11, 2012 6:09 am
- Yutong Zhao
- Posts: 6
- Joined: Wed Apr 18, 2012 11:40 am
Re: Determination of potential energies after simulation
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
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
- Peter Eastman
- Posts: 2611
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Determination of potential energies after simulation
More precisely, before you create your Context/Simulation, call setForceGroup() on each Force in the System. Something like this:
Then to query the energy of group i, call
Peter
Code: Select all
for i in range(system.getNumForces()):
system.getForce(i).setForceGroup(i)
Code: Select all
context.getState(getEnergy=True, groups=1<<i).getPotentialEnergy()