Positional Restraints info

The functionality of OpenMM will (eventually) include everything that one would need to run modern molecular simulation.
POST REPLY
User avatar
Gaetano Calabro'
Posts: 24
Joined: Fri Feb 24, 2012 11:48 am

Positional Restraints info

Post by Gaetano Calabro' » Wed May 17, 2017 1:13 pm

Hi there,

In my system, I’m using positional restraints by adding a Custom External Force like the following:

Code: Select all

openmm.CustomExternalForce('k_restr*( (x-x0)^2 + (y-y0)^2 + (z-z0)^2 )')
where the per particle parameters x0, y0 and z0 are taken from my starting structure positions. I’m performing a NVT simulation and my system crashes soon after started. I was able to track down the error which seems related to the fact that the whole system is translated during the NVT simulation while the x0, y0, and z0 per particle parameters are not. If I translate my original system to be centered at xc=box_x/2, yc=box_y/2, zc=box_z/2 (where box_x, box_y and box_z are my box size dimensions) prior to run the simulation, I do not have any crashes. I wonder if I’m making some mistakes or I must follow another procedure to apply positional restraints.

Thanks a lot

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

Re: Positional Restraints info

Post by Peter Eastman » Wed May 17, 2017 1:57 pm

Change your force to this:

Code: Select all

openmm.CustomExternalForce('k_restr*periodicdistance(x, y, z, x0, y0, z0)^2')
That way it will apply periodic boundary conditions when computing the distance.

Peter

User avatar
Gaetano Calabro'
Posts: 24
Joined: Fri Feb 24, 2012 11:48 am

Re: Positional Restraints info

Post by Gaetano Calabro' » Wed May 17, 2017 3:16 pm

Hi Peter,

This is a new OpenMM magic that I was not aware of!

Thank you so much for your help and support.

Gaetano

User avatar
Aron Broom
Posts: 54
Joined: Tue Mar 13, 2012 11:33 am

Re: Positional Restraints info

Post by Aron Broom » Wed Sep 27, 2017 8:34 am

Oh nice, I was having exactly the same problem and my current workout was to pre-translate all my starting structures. I'll test this out.

One thing to note, the internal translation that OpenMM applies only seems to occur DURING the simulation. If you ask for the particle positions after simulating, they are back to being like those of the input structure, whereas any output made using Reporters have the translation applied.

Anyway, thanks for posting this solution.

POST REPLY