LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Issue with keeping track of a pair distance, mismatched compute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] Issue with keeping track of a pair distance, mismatched compute


From: Vũ Hoàng Nguyễn <nguyenhoangvu3010@...24...>
Date: Tue, 20 Jun 2017 15:25:05 -0600

Hi all,

Thanks to Alex's suggestion, the job is on the run for now, I'll keep you posted with the result. I have side question on equal-style varibale, why cannot a local property, for example, a pair/local distance be assigned as a variable in case it's a single value?

Best,

Vu H. Nguyen

Vu H. Nguyen


On Tue, Jun 20, 2017 at 1:25 PM, Axel Kohlmeyer <akohlmey@...24...> wrote:


On Tue, Jun 20, 2017 at 3:14 PM, Vũ Hoàng Nguyễn <nguyenhoangvu3010@...24...> wrote:
Hi all,

My purpose is to first, calculate (or to keep track) the distance between atom ID #9 and #19 and then, assign the distance as a variable to use as a condition in a following if command.

What I did was:

variable        9_19   equal sqrt((x[9]-x[19])^2+(y[9]-y[19])^2+(z[9]-z[19])^2)

run             1000000 every 100 "if '${9_19} < 1.0' then 'print ${Nstep}=0=1 append record.dat'"


This works until I notice that LAMMPS reports the 9_19 pair distance regardless of the Nearest Image Covention. So the distance sometimes get bigger than [(box_side)*sqrt(3)]/2, which is not expected.

My other thought is that,

group           test_pair id 9 19

compute         distance test_pair pair/local dist

variable        9_19 equal c_distance

run             1000000 every 100 "if '${9_19} < 1.0' then 'print ${Nstep}=0=1 append record.dat'"

The latter solution results in an error of "ERROR: Mismatched compute in variable formula (../variable.cpp:1548)".

I have found that local properties cannot be assigned to equal-style variables. 

So is there any way to go about this issue or, how to extract a pair distance and use it internally as a variable in an 'if command' condition?

​i think what you need is are unwrapped coordinates. x[] and y[] and z[] are wrapped coordinates, so if one of them has a "jump" because the atom is passing through a periodic boundary, you have the jumps in your distance. now unwrapped coordinates are not available (yet) in variable expressions, but if this concerns only two specific atoms there might be a workaround: you can define a group for each of them, and then use the xcm() function to get the center of mass (which is computed using unwrapped coordinates and with only one atom in the group is equivalent to the position) and then use that for computing your distance.

axel.

 

I am looking forward to hearing from you. Thanks in advance.

Vu H. Nguyen


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
lammps-users mailing list
lammps-users@...655....net
https://lists.sourceforge.net/lists/listinfo/lammps-users




--
Dr. Axel Kohlmeyer  akohlmey@...24...  http://goo.gl/1wk0
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.