COM restraints using CustomCentroidBondForce

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Jumin Lee
Posts: 14
Joined: Tue Dec 10, 2013 9:12 am

COM restraints using CustomCentroidBondForce

Post by Jumin Lee » Mon Jan 28, 2019 1:00 pm

Dear OpenMM developers,

Is it possible to apply multiple COM restraints using a single CustomCentroidBondForce?
For example, if I want to put two (or more) positional COM restraints at x=1 for group1 and x=10 for group2, do I need to construct two (or more) CustomCentroidBondForce for each?

Thanks,
Jumin

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

Re: COM restraints using CustomCentroidBondForce

Post by Peter Eastman » Mon Jan 28, 2019 1:09 pm

Define a per-bond parameter that gives the position you want to restrain it to. Then add a separate bond for each group.

User avatar
Jumin Lee
Posts: 14
Joined: Tue Dec 10, 2013 9:12 am

Re: COM restraints using CustomCentroidBondForce

Post by Jumin Lee » Tue Jan 29, 2019 8:15 am

Thank you!
So, something like this?

Code: Select all

force = CustomCentroidBondForce(2, "k(x1-x0)^2")
force.addPerBondParameter("k")
force.addPerBondParameter("x0")
force.addGroup(particles1)
force.addGroup(particles2)
force.addBond([0], [k, x0])
force.addBond([1], [k, x0])

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

Re: COM restraints using CustomCentroidBondForce

Post by Peter Eastman » Tue Jan 29, 2019 4:10 pm

Right. Except pass 1 as the first argument to the constructor, since each bond only depends on one group.

User avatar
Jumin Lee
Posts: 14
Joined: Tue Dec 10, 2013 9:12 am

Re: COM restraints using CustomCentroidBondForce

Post by Jumin Lee » Wed Jan 30, 2019 7:19 am

Thanks a lot!!

POST REPLY