Hi, I'm new to OpenMM. Could someone help on adding distance constrain between the mass centers of two molecules? e.g.
f= k(r-ro)^a, r>r0
f=0,r<=r0
r is the distance between the centers of two molecules.
How should define the external force in openmm?
Thank you very much!
adding distance constrain between the centers of two molecules
- Emilio Galllicchio
- Posts: 14
- Joined: Fri Feb 24, 2012 11:49 am
Re: adding distance constrain between the centers of two molecules
See:
https://github.com/Gallicchio-Lab/openm ... ils.py#L78
as an example. It uses CustomCentroidBondForce.
https://github.com/Gallicchio-Lab/openm ... ils.py#L78
as an example. It uses CustomCentroidBondForce.
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
Re: adding distance constrain between the centers of two molecules
The API documentation on CustomCentroidBondForce may also be helpful. For your case an expression like this should work:
k, r0, and a can all be either global or per-bond parameters, whatever works for you. Or if they just have a single fixed value that never changes, you can just hardcode them in the expression:
Remember that energies are in kJ/mol and distances are in nm.
Code: Select all
force = CustomCentroidBondForce("k*max(0, r-r0)^a")
Code: Select all
force = CustomCentroidBondForce("100*max(0, r-1.5)^2")