minor optimization, avoiding double computation and extra communication

This commit is contained in:
Yaser Afshar
2020-03-06 09:01:28 -06:00
parent bc8fa088be
commit a3eee419a1

View File

@ -109,11 +109,10 @@ int MinCG::iterate(int maxiter)
dotall[1] += fextra[i]*gextra[i];
}
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 if (normstyle == TWO) fdotf = dotall[0]; // Euclidean force 2-norm
else error->all(FLERR,"Illegal min_modify command");
if (fdotf < update->ftol*update->ftol) return FTOL;
}