diff --git a/src/min_cg.cpp b/src/min_cg.cpp index f73c9745be..29a12b6682 100644 --- a/src/min_cg.cpp +++ b/src/min_cg.cpp @@ -321,7 +321,8 @@ int MinCG::iterate(int n) if (dotall[0] < update->ftol * update->ftol) return FTOL; // update h from new f = -Grad(x) and old g - + // beta = dotall[0]/gg would be Fletcher-Reeves CG + beta = MAX(0.0,(dotall[0] - dotall[1])/gg); gg = dotall[0]; @@ -495,7 +496,7 @@ void MinCG::force_clear() ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - linemin: backtracking line search (Alg 3.1, p 41 in Nocedal and Wright) + linemin: backtracking line search (Proc 3.1, p 41 in Nocedal and Wright) uses no gradient info, but should be very robust start at maxdist, backtrack until energy decrease is sufficient ------------------------------------------------------------------------- */ @@ -507,7 +508,7 @@ int MinCG::linemin_backtrack(int n, double *x, double *dir, double eng, int i,ilist,m; double fdotdirme,fdotdirall,fme,fmax,eoriginal,alphamax; - // stopping criterion + // stopping criterion, must be scaled by normflag double *f = atom->f[0]; fdotdirme = 0.0; diff --git a/src/min_sd.cpp b/src/min_sd.cpp index 07975049dc..105162327a 100644 --- a/src/min_sd.cpp +++ b/src/min_sd.cpp @@ -21,7 +21,7 @@ using namespace LAMMPS_NS; -#define EPS 1.0e-8 +#define EPS_ENERGY 1.0e-8 enum{FAIL,MAXITER,MAXEVAL,ETOL,FTOL}; // same as in other min classes @@ -62,7 +62,7 @@ int MinSD::iterate(int n) // energy tolerance criterion if (fabs(ecurrent-eprevious) <= - update->etol * 0.5*(fabs(ecurrent) + fabs(eprevious) + EPS)) + update->etol * 0.5*(fabs(ecurrent) + fabs(eprevious) + EPS_ENERGY)) return ETOL; // force tolerance criterion