# How to track the centre of a spherical region that is moving with a particle?

Dear LAMMPS users and developers,

I set up a simulation where I want a spherical region to move with a particle (radius is constant). My input script seems to do what I want it to do, but I am not entirely sure, whether the actual centre of the spherical region coincides with the coordinates of the particle. Therefore, I would like to ask you, whether there is a command in LAMMPS that would allow me to track the motion of the geometrical centre (not centre of mass) of a spherical region as a function of time. Then I could compare this to the trajectory of the particle to be sure that everything works as expected.

Any suggestions would be appreciated.

Thanks,
Peter

Relevant code sections:

Dear LAMMPS users and developers,

I set up a simulation where I want a spherical region to move with a
particle (radius is constant). My input script seems to do what I want it
to do, but I am not entirely sure, whether the actual centre of the
spherical region coincides with the coordinates of the particle. Therefore,
I would like to ask you, whether there is a command in LAMMPS that would
allow me to track the motion of the geometrical centre (not centre of mass)
of a spherical region as a function of time. Then I could compare this to
the trajectory of the particle to be sure that everything works as expected.

Any suggestions would be appreciated.

​you feed the center of the sphere as input data through a variable. how
should it *not* be​ the center of that region?

axel.

Dear Axel

Thanks for your reply! The confusion arises, because I have to feed two vectors into the region command and I don’t really see why this is necessary. To me it seems that one vector defining the time dependent centre of the sphere should suffice. I am pretty sure there are technical reasons for that which I am not aware of. However, I wanted to double-check. Therefore, my question still remains open and I would appreciate, if you could please tell me whether I interpret the example below correctly or otherwise tell me what is wrong.

If I use the command in the following way (pseudo-code):

region r sphere x(0) y(0) z(0) 1 move dx(t) dy(t) dz(t)

the centre of the region with radius 1 will be ( x(t), y(t), z(t) ) = ( x(0), y(0), z(0) ) + ( dx(t), dy(t), dz(t) ) at time t. Is that correct?

Thank you and best wishes,
Peter

Dear Axel

Thanks for your reply! The confusion arises, because I have to feed two
vectors into the region command and I don't really see why this is
necessary. To me it seems that one vector defining the time dependent
centre of the sphere should suffice.

​yes, but for that you'd have to change the source code.​

I am pretty sure there are technical reasons for that which I am not aware
of.

​not really. making LAMMPS features​ "variable-aware" is dependent on
people asking for it and/or people having time or the desire to implement
it.

However, I wanted to double-check. Therefore, my question still remains
open and I would appreciate, if you could please tell me whether I
interpret the example below correctly or otherwise tell me what is wrong.

​the only definite answer is an experiment.

take a simple input (e.g. the melt example), pick a reference particle and
move it with fix move on a known trajectory and then ​apply your code and
output the C.O.M of that region and compare it to that reference.

axel.

Hi Axel

The example you suggested was also what I had in mind. As long as the point particle is contained in the region and it is the only one, the particle position and the com will be the same by definition, even though the centre of the sphere might still be somewhere close by. However, if I make the radius of the sphere arbitrarily small and it still gives the same answer, there will be no doubt any more.