Page 1 of 1

How to fix atms....

Posted: Sun Jan 30, 2011 12:58 am
by kasra
Hello

How I can fix the position of atoms so that they do not move?
By now I have tried to set the boundary atoms position just by context->setPositions function.

regards,
Kasra.

RE: How to fix atms....

Posted: Mon Jan 31, 2011 1:10 pm
by peastman
You can use a CustomExternalForce to apply a harmonic force to those atoms to keep them at the desired position. In fact, if you look at the API documentation for CustomExternalForce, you'll find sample code for exactly this case.

Peter

RE: How to fix atms....

Posted: Mon Jan 31, 2011 1:16 pm
by jchodera
Hi Peter,

From the original message, it sounds like Kasra wants to *fix* the atoms in space, which would imply constraining the positions to a fixed point in space. The CustomExternalForce allows one to *restrain* the positions to be *near* a specified position, but this is, formally and practically, different.

Kasra: It might be useful to add a feature request for integrators that support fixing some atoms in space so that they do not move, rather than imposing harmonic restraints, is necessary.

RE: How to fix atms....

Posted: Mon Jan 31, 2011 5:40 pm
by kasra
What I am doing now is setting the velocity of atoms that I want to fix to zero after each integration step. However it reduces the efficiency of the simulations.

regards,
Kasra.

RE: How to fix atms....

Posted: Mon Jan 31, 2011 9:01 pm
by kasra
Dear Peter

In my case I am pooling atoms by changing their velocities. Therefore, I do not know exactly the force that should be applied to the atoms to prevent them from moving. So I am not sure if I can the CustomExternalForce.

regards,
Kasra.

RE: How to fix atms....

Posted: Wed Feb 02, 2011 1:57 pm
by peastman
As John pointed out, CustomExternalForce implements a restraint rather than a constraint. It doesn't keep the atoms absolutely fixed, but prevents them from moving very far from the specified point.

To do this with a true constraint would require adding a new feature to OpenMM.

Peter