Commit 7d1a76f6 authored by Julien Guénolé's avatar Julien Guénolé
Browse files

more cleanup, var name, remove screen output

parent 690d93f7
Loading
Loading
Loading
Loading
+11 −1
Changes for .vscode/settings.json: 11 added lines, 1 removed line.
Original line number Diff line number Diff line
{
    "files.associations": {
        "cmath": "cpp",
        "complex": "cpp"
        "complex": "cpp",
        "fm_exp.c": "cpp",
        "al_zhou.c": "cpp",
        "cu_zhou.c": "cpp",
        "w_zhou.c": "cpp",
        "mpi.c": "cpp",
        "chrono": "cpp",
        "limits": "cpp",
        "lmp2radii.c": "cpp",
        "sockets.c": "cpp",
        "*.tcc": "cpp"
    }
}
 No newline at end of file
+14 −30
Changes for src/min.cpp: 14 added lines, 30 removed lines.
Original line number Diff line number Diff line
@@ -55,13 +55,13 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp)
  searchflag = 0;
  linestyle = 1;

  DELAYSTEP = 20;
  DT_GROW = 1.1;
  DT_SHRINK = 0.5;
  ALPHA0 = 0.25;
  ALPHA_SHRINK = 0.99;
  TMAX = 2.0;
  TMIN = 0.02;
  delaystep = 20;
  dt_grow = 1.1;
  dt_shrink = 0.5;
  alpha0 = 0.25;
  alpha_shrink = 0.99;
  tmax = 2.0;
  tmin = 0.02;

  elist_global = elist_atom = NULL;
  vlist_global = vlist_atom = NULL;
@@ -651,49 +651,33 @@ void Min::modify_params(int narg, char **arg)
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      dmax = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    /* Wolfram
       Hack: define some new parameters
       DELAYSTEP 5
       DT_GROW 1.1
       DT_SHRINK 0.5
       ALPHA0 0.1
       ALPHA_SHRINK 0.99
       TMAX 10.0
    */
    } else if (strcmp(arg[iarg],"fire_delaystep") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      DELAYSTEP = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)     fprintf(screen,"DELAYSTEP: %d \n", DELAYSTEP);
      delaystep = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"fire_dt_grow") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      DT_GROW = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)          fprintf(screen,"DT_GROW:   %.8f \n", DT_GROW);
      dt_grow = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"fire_dt_shrink") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      DT_SHRINK = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)          fprintf(screen,"DT_SHRINK: %.8f \n", DT_SHRINK);
      dt_shrink = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"fire_alpha0") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      ALPHA0 = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)          fprintf(screen,"ALPHA0:    %.8f \n", ALPHA0);
      alpha0 = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"fire_alpha_shrink") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      ALPHA_SHRINK = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)          fprintf(screen,"ALPHA_SHRINK: %.8f \n", ALPHA_SHRINK);
      alpha_shrink = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"fire_tmax") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      TMAX = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)          fprintf(screen,"TMAX: %.8f \n", TMAX);
      tmax = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"fire_tmin") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      TMAX = force->numeric(FLERR,arg[iarg+1]);
      if (comm->me == 0 && screen)          fprintf(screen,"TMIN: %.8f \n", TMAX);
      tmin = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;       
    } else if (strcmp(arg[iarg],"line") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
+4 −5
Changes for src/min.h: 4 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -58,11 +58,10 @@ class Min : protected Pointers {
  double dmax;                // max dist to move any atom in one step
  int linestyle;              // 0 = backtrack, 1 = quadratic, 2 = forcezero

/* Wolframs include of FIRE parameters */
  int DELAYSTEP;               // FIRE parameters
  double DT_GROW,DT_SHRINK;
  double ALPHA0,ALPHA_SHRINK;
  double TMAX,TMIN;
  int delaystep;              // minium steps of dynamics (adaptglok)
  double dt_grow,dt_shrink;   // timestep increase, decrease (adaptglok)
  double alpha0,alpha_shrink; // mixing velocities+forces coefficient (adaptglok)
  double tmax,tmin;           // timestep max, min (adaptglok)

  int nelist_global,nelist_atom;    // # of PE,virial computes to check
  int nvlist_global,nvlist_atom;
+13 −13
Changes for src/min_adaptglok.cpp: 13 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ void MinAdaptGlok::init()
  Min::init();

  dt = dtinit = update->dt;
  dtmax = TMAX * dt;
  dtmin = TMIN * dt;
  alpha = ALPHA0;
  dtmax = tmax * dt;
  dtmin = tmin * dt;
  alpha = alpha0;
  last_negative = ntimestep_fire = update->ntimestep;
}

@@ -117,7 +117,7 @@ int MinAdaptGlok::iterate(int maxiter)
    // v = (1-alpha) v + alpha |v| Fhat
    // |v| = length of v, Fhat = unit f
    // The modificatin of v is made wihtin the Verlet integration, after v update
    // if more than DELAYSTEP since v dot f was negative:
    // if more than delaystep since v dot f was negative:
    // increase timestep and decrease alpha

    if (vdotfall > 0.0) {
@@ -151,14 +151,14 @@ int MinAdaptGlok::iterate(int maxiter)
      if (fdotfall <= 1e-20) scale2 = 0.0;
      else scale2 = alpha * sqrt(vdotvall/fdotfall);

      if (ntimestep - last_negative > DELAYSTEP) {
        dt = MIN(dt*DT_GROW,dtmax);
      if (ntimestep - last_negative > delaystep) {
        dt = MIN(dt*dt_grow,dtmax);
        update->dt = dt;
        alpha *= ALPHA_SHRINK;
        alpha *= alpha_shrink;
      }

    // else (v dot f) <= 0
    // if more than DELAYSTEP since starting the relaxation:
    // if more than delaystep since starting the relaxation:
    // reset alpha
    //    if dt > dtmin:
    //    decrease timestep
@@ -168,10 +168,10 @@ int MinAdaptGlok::iterate(int maxiter)
    } else {
      last_negative = ntimestep;
      // Limit decrease of timestep
      if (ntimestep - ntimestep_fire > DELAYSTEP) {
        alpha = ALPHA0;
      if (ntimestep - ntimestep_fire > delaystep) {
        alpha = alpha0;
        if (dt > dtmin) {
          dt *= DT_SHRINK;
          dt *= dt_shrink;
          update->dt = dt;
        }
      }
@@ -265,10 +265,10 @@ int MinAdaptGlok::iterate(int maxiter)
    neval++;

    // energy tolerance criterion
    // only check after DELAYSTEP elapsed since velocties reset to 0
    // only check after delaystep elapsed since velocties reset to 0
    // sync across replicas if running multi-replica minimization

    if (update->etol > 0.0 && ntimestep-last_negative > DELAYSTEP) {
    if (update->etol > 0.0 && ntimestep-last_negative > delaystep) {
      if (update->multireplica == 0) {
        if (fabs(ecurrent-eprevious) <
            update->etol * 0.5*(fabs(ecurrent) + fabs(eprevious) + EPS_ENERGY)) {

test/lmp_mpi

deleted100755 → 0
−22.2 MiB

File deleted.

Loading