Restraints with reference position changing based on system dimension
Restraints with reference position changing based on system dimension
Dear OpenMM developers,
Is there a way to construct a positional restraint with the reference position changing based on the system dimensions (in NPT ensemble)?
For example, if I want to apply a restraint that maintains an atom at the center of a system, how should I construct the CustomExternalForce?
Thanks,
Jumin
Is there a way to construct a positional restraint with the reference position changing based on the system dimensions (in NPT ensemble)?
For example, if I want to apply a restraint that maintains an atom at the center of a system, how should I construct the CustomExternalForce?
Thanks,
Jumin
- Peter Eastman
- Posts: 2563
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Restraints with reference position changing based on system dimension
How about this. Put a dummy atom at the reference position. Set its mass to 0 and its charge and epsilon to 0. That way nothing should affect it except the barostat, which should scale its position with the box. Then you can add a bond between the real atom and the dummy atom.
Re: Restraints with reference position changing based on system dimension
Thank you for the suggestion.
So, are you suggesting to use CustomBondForce?
However, if I apply a bond restraint between dummy and real atom, the position of dummy can be affected by the restraint force?
So, are you suggesting to use CustomBondForce?
However, if I apply a bond restraint between dummy and real atom, the position of dummy can be affected by the restraint force?
Re: Restraints with reference position changing based on system dimension
Oh... The position of dummy atom may not be affected because mass is zero?
- Peter Eastman
- Posts: 2563
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Restraints with reference position changing based on system dimension
Right. You can use CustomBondForce, or just HarmonicBondForce if you want the restraints to be harmonic.
- Istvan Kolossvary
- Posts: 34
- Joined: Fri Jul 20, 2018 1:48 pm
Re: Restraints with reference position changing based on system dimension
Peter, it all sounds straightforward, but when I tried to define dummy atoms and adding the bonds I got lost. Could you show an example how to do what you are suggesting? I have about 100 CA atoms that I'd like to restrain, though, not just one.
Many thanks,
Istvan
Many thanks,
Istvan
- Peter Eastman
- Posts: 2563
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Restraints with reference position changing based on system dimension
Where are you getting lost? You add the bond just like any other bond. For example,
where force is a HarmonicBondForce. If the dummy atoms have their masses set to 0, the bond force won't cause them to move.
Code: Select all
force.addBond(atomIndex, dummyAtomIndex, 0, k)
- Istvan Kolossvary
- Posts: 34
- Joined: Fri Jul 20, 2018 1:48 pm
Re: Restraints with reference position changing based on system dimension
Sorry, I am embarrassed to say but I don't know how to add a dummy atom.
- Peter Eastman
- Posts: 2563
- Joined: Thu Aug 09, 2007 1:25 pm
Re: Restraints with reference position changing based on system dimension
Just call
And then on the NonbondedForce, call
Code: Select all
system.addParticle(0)
Code: Select all
nb.addParticle(0, 1, 0)
- Istvan Kolossvary
- Posts: 34
- Joined: Fri Jul 20, 2018 1:48 pm
Re: Restraints with reference position changing based on system dimension
Thanks, Peter! I really appreciate your time, these small things are so difficult to figure out for mortals. ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)