Holding the COM of group at a fixed point

Sent with Mailtrack

Dear all

I want to hold the center of mass (COM) of a group of atoms at a fixed
point while the individual atoms are free to move.

With “fix setforce” it is possible to set the force on each atom equal
zero. In this way, all the atoms are motionless and consequently the COM of
the group will be fixed. However, I want atoms to have their motion which
is not possible with this command.

“fix freeze” treats the group as a granular particle which is not desired
in my problem.

As “fix recenter” and “fix displace/atom” change the COM of the group
artificially, in my problem, both the commands give unphysical results.

http://lammps.sandia.gov/doc/fix_spring.html

I think the best way is to calculate the total force on the group then
impose an equal force in the opposite direction on that group to set the
total force equal zero (just like attaching the group to a smart spring
which, at each time-step, inserts exactly the required force on the group).
Unfortunately, I don’t know how to add this force. As both “fix addforce”
and “fix aveforce” accept only constant numbers, I cannot add the computed
force which is changing every time-step. For example, the following lines:

#-----------------------------------------------------------
------------------------------

compute f_ave Cu reduce ave fx

fix f_impose Cu aveforce -c_f_ave 0.0 0.0

#-----------------------------------------------------------
------------------------------

results in the following error:

Expected floating point parameter in input script or data file
(../fix_aveforce.cpp:58).

I would be grateful if anyone could help me.

​this doesn't work the way you think it would. fix spring is the correct
solution.

axel.​

I tried “fix spring” but it did not working too!!

By attaching the group to a spring, sometimes the displacement of COM is even higher than the system with no springs! If a spring with k=1e+8 is used, the displacement of COM is reduced by only 6%. For higher k’s, I get this error:

Step Temp E_pair E_mol TotEng Press Volume

0 200 -122392.6 0 -119542.35 -2582.2177 335436.73

100 nan nan 0 nan nan nan

Why do you think that the proposed solution does not work? Even if I write a new fix.cpp for it?

Sent with Mailtrack

I tried "fix spring" but it did not working too!!

By attaching the group to a spring, sometimes the displacement of COM is
even higher than the system with no springs! If a spring with k=1e+8 is
used, the displacement of COM is reduced by only 6%. For higher k's, I get
this error:

Step Temp E_pair E_mol TotEng Press Volume

       0 200 -122392.6 0 -119542.35 -2582.2177
   335436.73

     100 nan nan 0 nan nan
         nan

Why do you think that the proposed solution does not work? Even if I write
a new fix.cpp for it?

it is very difficult to make an assessment with such limited information.
in my past tests, fix spring always worked very well and it does *exactly*
what you are asking for. if you get bad behavior of NaN, it usually means,
that there is something wrong in your simulation or you have a bad choice
of force field parameters or your time step is wrong or your spring
constant.
in short, it can be pretty much anything. keep in mind that MD follows the
GI-GO principle (i.e. garbage in, garbage out), so *any* bad choice, even
an unrelated one can cause trouble.
however, in my personal experience, the cause for such problems that you
describe is more often a more fundamental one, i.e. a bad design of the
simulation (e.g. trying to enforce or model behavior that is unrealistic on
the atomic scale).

axel.