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
COM restraints using CustomCentroidBondForce
- Peter Eastman
- Posts: 2573
- Joined: Thu Aug 09, 2007 1:25 pm
Re: COM restraints using CustomCentroidBondForce
Define a per-bond parameter that gives the position you want to restrain it to. Then add a separate bond for each group.
Re: COM restraints using CustomCentroidBondForce
Thank you!
So, something like this?
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])
- Peter Eastman
- Posts: 2573
- Joined: Thu Aug 09, 2007 1:25 pm
Re: COM restraints using CustomCentroidBondForce
Right. Except pass 1 as the first argument to the constructor, since each bond only depends on one group.
Re: COM restraints using CustomCentroidBondForce
Thanks a lot!!