get unwrapped atomic coordinates in angle style

Dear lammps users,

I’m computing unwrapped atomic coordinates of angles in my own angle sytle, but I get garbled somewhat upon applying periodic boundary conditions.
The compute method of my angle style cpp is as follows, is there something wrong?

void AngleXXX::compute(int eflag, int vflag)
{

double x1unwrap[3],x2unwrap[3],x3unwrap[3];
double **x = atom->x;
int **anglelist = neighbor->anglelist;
int nanglelist = neighbor->nanglelist;
imageint *image = atom->image;

for (n = 0; n < nanglelist; n++) {
i1 = anglelist[n][0];
i2 = anglelist[n][1];
i3 = anglelist[n][2];

domain->unmap(x[i1],image[i1],x1unwrap); // x1unwrap, x2unwrap and x3unwrap are not what I want
domain->unmap(x[i2],image[i2],x2unwrap); //
domain->unmap(x[i3],image[i3],x3unwrap); //

cx = (x1unwrap[0] + x2unwrap[0] + x3unwrap[0])/3.0;
cy = (x1unwrap[1] + x2unwrap[1] + x3unwrap[1])/3.0;
cz = (x1unwrap[2] + x2unwrap[2] + x3unwrap[2])/3.0;

}

}

Best Regards
Zhou

Dear lammps users,

I’m computing unwrapped atomic coordinates of angles in my own angle sytle, but I get garbled somewhat upon applying periodic boundary conditions.
The compute method of my angle style cpp is as follows, is there something wrong?

Yes, there should be no need to unwrap coordinates. LAMMPS will use the nearest copy of an atom for any bonded interactions automatically.

>
> Dear lammps users,
>
> I’m computing unwrapped atomic coordinates of angles in my own angle sytle, but I get garbled somewhat upon applying periodic boundary conditions.
> The compute method of my angle style cpp is as follows, is there something wrong?

Yes, there should be no need to unwrap coordinates. LAMMPS will use the nearest copy of an atom for any bonded interactions automatically.

Thanks to Axel. Actually, I use triangular mesh to build a close surface. The triangle is present by angle. I want compute the centre of the surface, so if I use wrap coordinates, I will get erroneous results when the surface through periodic boundary.

Dear lammps users,

I’m computing unwrapped atomic coordinates of angles in my own angle
sytle, but I get garbled somewhat upon applying periodic boundary
conditions.
The compute method of my angle style cpp is as follows, is there something
wrong?

Yes, there should be no need to unwrap coordinates. LAMMPS will use the
nearest copy of an atom for any bonded interactions automatically.

Thanks to Axel. Actually, I use triangular mesh to build a close surface.
The triangle is present by angle. I want compute the centre of the surface,
so if I use wrap coordinates, I will get erroneous results when the surface
through periodic boundary.

you do not get wrapped coordinates. that is part of how LAMMPS does
domain decomposition. please familiarize yourself better with how
LAMMPS works internally and provide conclusive proof, that my
statement is incorrect. if you don't get the correct result, it is
most likely due to other mistakes, e.g. inconsistent input data or
incorrect code.

apart from that, your triangulated surface is probably better
implemented as a fix style. please check out the LIGGGHTS code that
provides such a feature for granular media.

axel.