Commit 1074884f authored by julient31's avatar julient31
Browse files

Commit JT 110419

- removed fmax uninitialized variable from min_cg.cpp
- removed tabs from comments
- initialized fdotf variables
parent 9159a43d
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ MinCG::MinCG(LAMMPS *lmp) : MinLineSearch(lmp) {}
int MinCG::iterate(int maxiter)
{
  int i,m,n,fail,ntimestep;
  double beta,gg,dot[2],dotall[2],fmax;
  double beta,gg,dot[2],dotall[2],fdotf;
  double *fatom,*gatom,*hatom;

  // nlimit = max # of CG iterations before restarting
@@ -100,7 +100,6 @@ int MinCG::iterate(int maxiter)
        for (i = 0; i < n; i++) {
          dot[0] += fatom[i]*fatom[i];
          dot[1] += fatom[i]*gatom[i];
	  fmax = MAX(fmax,fatom[i]*fatom[i]);
        }
      }
    MPI_Allreduce(dot,dotall,2,MPI_DOUBLE,MPI_SUM,world);
@@ -110,16 +109,14 @@ int MinCG::iterate(int maxiter)
        dotall[1] += fextra[i]*gextra[i];
      }

    fmax = 0.0;
    if (normstyle == MAX) {		// max force norm
      fmax = fnorm_max();
      if (fmax < update->ftol*update->ftol) return FTOL;
    } else if (normstyle == INF) {	// infinite force norm
      fmax = fnorm_inf();
      if (fmax < update->ftol*update->ftol) return FTOL;
    } else if (normstyle == TWO) {	// Euclidean force 2-norm
      if (dotall[0] < update->ftol*update->ftol) return FTOL;
    } else error->all(FLERR,"Illegal min_modify command"); 
    fdotf = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == MAX) fdotf = fnorm_max();        // max force norm
      else if (normstyle == INF) fdotf = fnorm_inf();   // infinite force norm
      else if (normstyle == TWO) fdotf = fnorm_sqr();   // Euclidean force 2-norm
      else error->all(FLERR,"Illegal min_modify command");
      if (fdotf < update->ftol*update->ftol) return FTOL;
    }

    // update new search direction h from new f = -Grad(x) and old g
    // this is Polak-Ribieri formulation
+4 −3
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ int MinFire::iterate(int maxiter)
    // force tolerance criterion
    // sync across replicas if running multi-replica minimization

    fdotf = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == MAX) fdotf = fnorm_max();        // max force norm
      else if (normstyle == INF) fdotf = fnorm_inf();   // inf force norm
+4 −3
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@ int MinQuickMin::iterate(int maxiter)
    // force tolerance criterion
    // sync across replicas if running multi-replica minimization

    fdotf = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == MAX) fdotf = fnorm_max();       // max force norm
      else if (normstyle == INF) fdotf = fnorm_inf();  // inf force norm
+8 −5
Original line number Diff line number Diff line
@@ -78,11 +78,14 @@ int MinSD::iterate(int maxiter)

    // force tolerance criterion

    fdotf = 0.0;
    if (update->ftol > 0.0) {
      if (normstyle == MAX) fdotf = fnorm_max();        // max force norm
      else if (normstyle == INF) fdotf = fnorm_inf();   // infinite force norm
      else if (normstyle == TWO) fdotf = fnorm_sqr();   // Euclidean force 2-norm
      else error->all(FLERR,"Illegal min_modify command");
      if (fdotf < update->ftol*update->ftol) return FTOL;
    }

    // set new search direction h to f = -Grad(x)

+3 −3

File changed.

Contains only whitespace changes.

+3 −3

File changed.

Contains only whitespace changes.

+3 −3

File changed.

Contains only whitespace changes.

Loading