Shifting of origin

My simulation involves application of centrifugal force to a polymer
melt, on a surface. My definition of centrifugal force is like f=K*r
(similar to m*omega^2*r) applied to each atom, resolving this f into
fx and fy (with cos(theta) and sin(theta) ).
Problem is, that LAMMPS is not calculating X and Y distances of each
atom, from the COM of the polymer melt. It's origin is elsewhere,
(based on xlo and xhi).

How can I shift the origin of the simulation, to COM of the melt, so
that centrifugal forces may be appropriately calculated?

Regards
Brahm Prakash Mishra

You don’t say what LAMMPS command you are using
to apply centrifugal force. If you are using fix addforce
with a per-atom variable that calculates f = K*r, then
you define the variable. So if you want it to
subtract off the COM, it’s up to you to define it
that way. See the variable doc page, there are
COM functions defined that can be included
in a variable definition.

If you want to setup a different simulation box,
you can do that in your data file, but the origin of
the simulation box won’t adjust on the fly to the
COM of some atoms in your simulation. You can
also look at the fix com command.

Steve

You don't say what LAMMPS command you are using
to apply centrifugal force. If you are using fix addforce
with a per-atom variable that calculates f = K*r, then
you define the variable. So if you want it to
subtract off the COM, it's up to you to define it
that way. See the variable doc page, there are
COM functions defined that can be included
in a variable definition.

I am using fix addforce command only. The per-atom variable has been
defined. To subtract off the COM, I am first getting {x y z}
coordinate of each atom of my group 'polymer' as an array (with
property/atom xu yu zu). With compute com I am calculating COM of the
group polymer, getting x_com, y_com, z_com.
Then I am defining a variable new_x_coord by subtracting x_com from
the x coordinate array. Relevant section of my input script is

#X and Z axis are the (horizontal) plane where centrifugal force is
acting. Y axis is vertical, with no force acting

compute array polymer property/atom xu yu zu #For getting unwrapped x
y z coordinates as arrays
compute mass_center polymer com #For getting
coordinates of COM of group polymer

variable x_com equal c_mass_center[1] #storing obtained X
Y Z coordinates of COM of group polymer
variable y_com equal c_mass_center[2]
variable z_com equal c_mass_center[3]

variable x_coord atom c_array[1]-v_x_com #For shifting the
entire group of polymer atoms to origin
variable y_coord atom c_array[2]-v_y_com
variable z_coord atom c_array[3]-v_z_com

variable sqx atom v_x_coord*v_x_coord #For calculating
distance of each atom from origin (now the

           #COM)
variable sqy atom v_y_coord*v_y_coord
variable sqz atom v_z_coord*v_z_coord

variable radius atom sqrt(v_sqx+v_sqy+v_sqz) #Finding distance with
distance of a point from origin formula
variable theta atom atan2(c_array[3],c_array[1]) #Finding angle an
atom's position vector makes with origin

variable f atom 0.5*v_radius*cos(v_theta) #Resolving Fx and Fz
variable g atom 0
#0 Force along Y axis (Vertical Axis)
variable h atom 0.5*v_radius*sin(v_theta)

timestep 1
velocity polymer create 340 2300
velocity substrate create 0 7 #My substrate
has 0 velocity, and no velocity, so it's fixed in space

fix 1 polymer nve/limit 0.05 #This is my
Dynamic Defitions, I am using Langevin ensemble
fix 2 polymer langevin 340.0 340.0 10.0 904297
fix 3 polymer addforce v_f v_g v_f
#fix 3 polymer drag 0 0 0 20 1
thermo_style custom step time temp etotal
thermo 1000

If you want to setup a different simulation box,
you can do that in your data file, but the origin of
the simulation box won't adjust on the fly to the
COM of some atoms in your simulation. You can
also look at the fix com command.

I see, so how does one fix it on the fly to the COM? (Even if not on
the fly, say, once every few steps)

Regards
Brahm

You defined a long sequence of variables that you
say is not computing what you expect wrt the COM.
So you need to debug your script, and figure out
why it is computing something different. No one
else is likely to do that for you. You can print out
values of the various per-atom variables to a dump file.
You can also use xcm() in a variable definition to
calculate the COM w/out using a compute.

Steve