Re: restraining the COM of a group of atoms

From: Joshua Adelman (
Date: Fri Oct 09 2009 - 19:43:04 CDT

Hi Bin,

This is pretty trivial to code up using the GlobalMasters routines (at
least in v2.6). You'll have to write your own GlobalMaster code and
recompile namd, but otherwise it's simple. Take a look at the
GlobalMasterMisc.C and .h files in the src/ directory. This code will
only run on the head node, but in my experience, unless you are doing
something really complicated, you won't see any slowdown.

If you want to see example code, let me know.

Also, I haven't used the collective variable features in NAMD 2.7, but
doesn't the "distance" collective variable basically allow you to do

Another alternative is to try PLUMED (which I have not):


On Oct 9, 2009, at 8:19 PM, BIN ZHANG wrote:

> Hi, All:
> Browsing through the mailing list, I saw quite a few people
> interested in restraining the center of mass (COM) of a group of
> atoms during their simulation. However, to my understanding, NAMD
> does not have an elegant way to do this (correct?). Though tclforces
> script could do the job, it would be a pain while the number of
> atoms is big.
> So my question is why does NAMD not offering this ability? It cannot
> be a coding issue. Actually, I think it's rather trivial to
> implement this, given that it already has SMD implemented. It should
> be basically the same as SMD, except here we have zero velocity, and
> also the moving direction is updated on the fly as r - r0.
> Am I missing something here? Is NAMD 2.7b1 already able to do this?
> If not, I would like to try to do it myself.
> Thanks for any comments.
> Best,
> Bin

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:53:21 CST