Reporting subsets of the potential energy (i.e. dihedrals)

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
lewis martin
Posts: 63
Joined: Tue Mar 06, 2018 8:56 pm

Reporting subsets of the potential energy (i.e. dihedrals)

Post by lewis martin » Tue Jun 19, 2018 6:12 pm

Hi all,
Is it possible to report or access the value of a subset of the potential energy function, dihedrals for example?
I tried a couple of things - The PeriodicTorsionForce or CustomTorsionForce dont have a getPE (?) method, and the reporter functions only have total potentialEnergy.

This value is useful for calculating the boost energy used in dual accelerated MD.
Thanks

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

Re: Reporting subsets of the potential energy (i.e. dihedrals)

Post by Peter Eastman » Tue Jun 19, 2018 6:24 pm

You can do this by putting each force into its own force group. For example,

Code: Select all

torsions.setForceGroup(1)
Then when you call getState() on the Context, you can specify to include just that force group:

Code: Select all

print(context.getState(getEnergy=True, groups={1}).getPotentialEnergy()

User avatar
lewis martin
Posts: 63
Joined: Tue Mar 06, 2018 8:56 pm

Re: Reporting subsets of the potential energy (i.e. dihedrals)

Post by lewis martin » Tue Jun 19, 2018 9:19 pm

easy - cheers

POST REPLY