LAMMPS WWW Site - LAMMPS Documentation - LAMMPS Mailing List Archives
Re: [lammps-users] Accessing periodic image of atoms in my own fix
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lammps-users] Accessing periodic image of atoms in my own fix


From: Axel Kohlmeyer <akohlmey@...24...>
Date: Thu, 14 Sep 2017 08:40:48 -0400



On Thu, Sep 14, 2017 at 8:25 AM, Frank Zack via lammps-users <lammps-users@lists.sourceforge.net> wrote:
I've written a fix for  pressure-absorbing boundary conditions for fcc-lattices which I'm using for my shockwave simulations.
It uses a monochromatic wave-solution approach for integrating the equations of motion for the atoms which represent the boundary group.
One input parameter is the distance between the current atomic positions of the boundary atoms and the equilibrium position of these atoms at the very first timestep.

Actually it works surprisingly well.
However, if the simulations runs for a while, it might happen that some of my the atoms travel across the periodic boundaries and a simple distance-calculation according to "pos_new- pos_old" is obiously wrong. I have to take into account the periodic images.

so this is what I'm doing (pseudocode):

loop "i" over all atoms:
  if atom is part of the boundary-group:
    imageint *imgflag = atom->image;
   
    flag_x=static_cast<int>(((imgflag[i] & IMGMASK)-IMGMAX);
    flag_y=static_cast<int>((imgflag[i] >> IMGBITS & IMGMASK) - IMGMAX);
    flag_z=static_cast<int>((imgflag[i] >> IMG2BITS) - IMGMAX);
   
    //get the "true" positions
    x_pos=x[i][0]+flag_x*Ly;
    y_pos=x[i][1]+flag_y*Ly;
    z_pos=x[i][2]+flag_y*Ly;

this chunk seems to have a cut and paste error.
why don't you save yourself some grief and use one of the domain->unmap() methods instead?

​axel.
    ...
this seems to work for most of my atoms. However, its no working for those atoms at the edges and corners of the simulation box.
Reason: From the very beginning the imgflag[i] - values seem to be uncorrect. They should all be "0". Instead, for the atoms at the edges and corners these are "-512"

Why is that? 
I've taken a look into the pack_scale_image function of dump_atom.cpp and the image flags are determined the very same way.
Where's my mistake?


Best regards,
frank.

------------------------------------------------------------------------------
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@...6297....sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lammps-users




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