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.
How to fix atms....
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
RE: How to fix atms....
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
Peter
- John Chodera
- Posts: 53
- Joined: Wed Dec 13, 2006 6:22 pm
RE: How to fix atms....
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.
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.
- Kasra Momeni
- Posts: 23
- Joined: Sat Nov 14, 2009 12:06 pm
RE: How to fix atms....
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.
regards,
Kasra.
- Kasra Momeni
- Posts: 23
- Joined: Sat Nov 14, 2009 12:06 pm
RE: How to fix atms....
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.
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.
- Peter Eastman
- Posts: 2593
- Joined: Thu Aug 09, 2007 1:25 pm
RE: How to fix atms....
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
To do this with a true constraint would require adding a new feature to OpenMM.
Peter