Commit 0d9cd317 authored by jguenole's avatar jguenole
Browse files

relax_box: add nb build check, add zeroing v

parent b0004bfd
Loading
Loading
Loading
Loading
+21 −4
Changes for src/min_adaptglok.cpp: 21 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ void MinAdaptGlok::init()

    int icompute = modify->find_compute("thermo_press");
    pressure = modify->compute[icompute];

    pflag = 1;
  }
}

@@ -143,10 +145,11 @@ void MinAdaptGlok::save_box_state()
void MinAdaptGlok::relax_box()
{
  // rescale simulation box and scale atom coords for all atoms
  // based on change_box.cpp
  // inspired by change_box.cpp

  int i,n;
  double **x = atom->x;
  double **v = atom->v;
  double epsilon,disp;
  int nlocal = atom->nlocal;

@@ -155,12 +158,19 @@ void MinAdaptGlok::relax_box()
  neighbor->setup_bins();
  comm->exchange();
  comm->borders();
  if (neighbor->check_distance()) neighbor->build(1);
  if (neighbor->decide()) neighbor->build(1);

  // ensure the virial is tallied, update the flag

  pressure->addstep(update->ntimestep);
  update->vflag_global = update->ntimestep;

  // Only when the presure is not yet free:
  // - compute and apply box re-scaling
  // - freez atoms

  if (pflag != 1){

    // compute pressure and change simulation box

    pressure->compute_scalar();
@@ -198,6 +208,12 @@ void MinAdaptGlok::relax_box()
    for (i = 0; i < nlocal; i++) domain->remap(x[i],image[i]);
    domain->reset_box();

    // freez atoms velocities when the box is rescaled
    // prevent atoms getting unintended extra velocity

    for (int i = 0; i < nlocal; i++)
      v[i][0] = v[i][1] = v[i][2] = 0.0;
  }
}

/* ---------------------------------------------------------------------- */
@@ -350,10 +366,11 @@ int MinAdaptGlok::iterate(int maxiter)
        }
      }

      // stopping criterion while stuck in a local bassin
      // stopping criterion while stuck in a local bassin of the PES
      // only checked when the box dimesions are not modified bu relax_box()

      vdotf_negatif++;
      if (max_vdotf_negatif > 0 && vdotf_negatif > max_vdotf_negatif)
      if (pflag == 1 && max_vdotf_negatif > 0 && vdotf_negatif > max_vdotf_negatif)
        return MAXVDOTF;

      // inertia correction