Merge branch 'master' into HEAD
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user