Commit eaf3d1ea authored by David Nicholson's avatar David Nicholson
Browse files

added an image flag update a la domain->image_flip() to FixNHUef::pre_exchange()

parent c3bf7d09
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -536,10 +536,26 @@ void FixNHUef::pre_exchange()
    rotate_x(rot);
    rotate_f(rot);

    // put all atoms in the new box
    double **x = atom->x;
    // this is a generalization of what is done in domain->image_flip(...)
    int ri[3][3];
    uefbox->get_inverse_cob(ri);
    imageint *image = atom->image;
    int nlocal = atom->nlocal;
    for (int i=0; i<nlocal; i++) {
      int iold[3],inew[3];
      iold[0] = (image[i] & IMGMASK) - IMGMAX;
      iold[1] = (image[i] >> IMGBITS & IMGMASK) - IMGMAX;
      iold[2] = (image[i] >> IMG2BITS) - IMGMAX;
      inew[0] = ri[0][0]*iold[0] + ri[0][1]*iold[1] + ri[0][2]*iold[2];
      inew[1] = ri[1][0]*iold[0] + ri[1][1]*iold[1] + ri[1][2]*iold[2];
      inew[2] = ri[2][0]*iold[0] + ri[2][1]*iold[1] + ri[2][2]*iold[2];
      image[i] = ((imageint) (inew[0] + IMGMAX) & IMGMASK) |
        (((imageint) (inew[1] + IMGMAX) & IMGMASK) << IMGBITS) |
        (((imageint) (inew[2] + IMGMAX) & IMGMASK) << IMG2BITS);
    }

    // put all atoms in the new box
    double **x = atom->x;
    for (int i=0; i<nlocal; i++) domain->remap(x[i],image[i]);

    // move atoms to the right processors
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ void UEFBox::get_rot(double x[3][3])
}

// get inverse change of basis matrix
void UEFBox::get_inverse_cob(double x[3][3])
void UEFBox::get_inverse_cob(int x[3][3])
{
  for (int k=0;k<3;k++)
    for (int j=0;j<3;j++)
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class UEFBox
    bool reduce();
    void get_box(double[3][3], double);
    void get_rot(double[3][3]);
    void get_inverse_cob(double[3][3]);
    void get_inverse_cob(int[3][3]);
  private:
    double l0[3][3]; // initial basis
    double w1[3],w2[3],winv[3][3];//omega1 and omega2 (spectra of automorphisms)