Restraints with reference position changing based on system dimension

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

Restraints with reference position changing based on system dimension

Post by Jumin Lee » Sat Feb 09, 2019 2:18 pm

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

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

Re: Restraints with reference position changing based on system dimension

Post by Peter Eastman » Sat Feb 09, 2019 4:46 pm

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.

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

Re: Restraints with reference position changing based on system dimension

Post by Jumin Lee » Mon Feb 11, 2019 8:04 am

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?

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

Re: Restraints with reference position changing based on system dimension

Post by Jumin Lee » Mon Feb 11, 2019 8:14 am

Oh... The position of dummy atom may not be affected because mass is zero?

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

Re: Restraints with reference position changing based on system dimension

Post by Peter Eastman » Mon Feb 11, 2019 9:41 am

Right. You can use CustomBondForce, or just HarmonicBondForce if you want the restraints to be harmonic.

User avatar
Istvan Kolossvary
Posts: 34
Joined: Fri Jul 20, 2018 1:48 pm

Re: Restraints with reference position changing based on system dimension

Post by Istvan Kolossvary » Thu Feb 14, 2019 2:28 pm

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

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

Re: Restraints with reference position changing based on system dimension

Post by Peter Eastman » Thu Feb 14, 2019 3:51 pm

Where are you getting lost? You add the bond just like any other bond. For example,

Code: Select all

force.addBond(atomIndex, dummyAtomIndex, 0, k)
where force is a HarmonicBondForce. If the dummy atoms have their masses set to 0, the bond force won't cause them to move.

User avatar
Istvan Kolossvary
Posts: 34
Joined: Fri Jul 20, 2018 1:48 pm

Re: Restraints with reference position changing based on system dimension

Post by Istvan Kolossvary » Fri Feb 15, 2019 8:31 am

Sorry, I am embarrassed to say but I don't know how to add a dummy atom.

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

Re: Restraints with reference position changing based on system dimension

Post by Peter Eastman » Fri Feb 15, 2019 10:03 am

Just call

Code: Select all

system.addParticle(0)
And then on the NonbondedForce, call

Code: Select all

nb.addParticle(0, 1, 0)

User avatar
Istvan Kolossvary
Posts: 34
Joined: Fri Jul 20, 2018 1:48 pm

Re: Restraints with reference position changing based on system dimension

Post by Istvan Kolossvary » Fri Feb 15, 2019 10:39 am

Thanks, Peter! I really appreciate your time, these small things are so difficult to figure out for mortals. :)

POST REPLY