git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8226 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
68
src/min.cpp
68
src/min.cpp
@ -5,7 +5,7 @@
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
@ -167,11 +167,11 @@ void Min::init()
|
||||
neigh_every = neighbor->every;
|
||||
neigh_delay = neighbor->delay;
|
||||
neigh_dist_check = neighbor->dist_check;
|
||||
|
||||
|
||||
if (neigh_every != 1 || neigh_delay != 0 || neigh_dist_check != 1) {
|
||||
if (comm->me == 0)
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR,
|
||||
"Resetting reneighboring criteria during minimization");
|
||||
"Resetting reneighboring criteria during minimization");
|
||||
}
|
||||
|
||||
neighbor->every = 1;
|
||||
@ -238,10 +238,10 @@ void Min::setup()
|
||||
|
||||
if (nextra_global && searchflag == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot use a damped dynamics min style with fix box/relax");
|
||||
"Cannot use a damped dynamics min style with fix box/relax");
|
||||
if (nextra_atom && searchflag == 0)
|
||||
error->all(FLERR,
|
||||
"Cannot use a damped dynamics min style with per-atom DOF");
|
||||
"Cannot use a damped dynamics min style with per-atom DOF");
|
||||
|
||||
// atoms may have migrated in comm->exchange()
|
||||
|
||||
@ -285,7 +285,7 @@ void Min::setup()
|
||||
ecurrent = pe_compute->compute_scalar();
|
||||
if (nextra_global) ecurrent += modify->min_energy(fextra);
|
||||
if (output->thermo->normflag) ecurrent /= atom->natoms;
|
||||
|
||||
|
||||
einitial = ecurrent;
|
||||
fnorm2_init = sqrt(fnorm_sqr());
|
||||
fnorminf_init = fnorm_inf();
|
||||
@ -357,7 +357,7 @@ void Min::setup_minimal(int flag)
|
||||
ecurrent = pe_compute->compute_scalar();
|
||||
if (nextra_global) ecurrent += modify->min_energy(fextra);
|
||||
if (output->thermo->normflag) ecurrent /= atom->natoms;
|
||||
|
||||
|
||||
einitial = ecurrent;
|
||||
fnorm2_init = sqrt(fnorm_sqr());
|
||||
fnorminf_init = fnorm_inf();
|
||||
@ -387,14 +387,14 @@ void Min::run(int n)
|
||||
|
||||
if (update->restrict_output == 0) {
|
||||
for (int idump = 0; idump < output->ndump; idump++)
|
||||
output->next_dump[idump] = update->ntimestep;
|
||||
output->next_dump[idump] = update->ntimestep;
|
||||
output->next_dump_any = update->ntimestep;
|
||||
if (output->restart_flag) {
|
||||
output->next_restart = update->ntimestep;
|
||||
if (output->restart_every_single)
|
||||
output->next_restart_single = update->ntimestep;
|
||||
if (output->restart_every_double)
|
||||
output->next_restart_double = update->ntimestep;
|
||||
output->next_restart = update->ntimestep;
|
||||
if (output->restart_every_single)
|
||||
output->next_restart_single = update->ntimestep;
|
||||
if (output->restart_every_double)
|
||||
output->next_restart_double = update->ntimestep;
|
||||
}
|
||||
}
|
||||
output->next_thermo = update->ntimestep;
|
||||
@ -410,7 +410,7 @@ void Min::run(int n)
|
||||
void Min::cleanup()
|
||||
{
|
||||
// stats for Finish to print
|
||||
|
||||
|
||||
efinal = ecurrent;
|
||||
fnorm2_final = sqrt(fnorm_sqr());
|
||||
fnorminf_final = fnorm_inf();
|
||||
@ -456,8 +456,8 @@ double Min::energy_force(int resetflag)
|
||||
}
|
||||
timer->stamp();
|
||||
comm->exchange();
|
||||
if (atom->sortfreq > 0 &&
|
||||
update->ntimestep >= atom->nextsort) atom->sort();
|
||||
if (atom->sortfreq > 0 &&
|
||||
update->ntimestep >= atom->nextsort) atom->sort();
|
||||
comm->borders();
|
||||
if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost);
|
||||
timer->stamp(TIME_COMM);
|
||||
@ -565,14 +565,14 @@ int Min::request(Pair *pair, int peratom, double maxvalue)
|
||||
{
|
||||
int n = nextra_atom + 1;
|
||||
xextra_atom = (double **) memory->srealloc(xextra_atom,n*sizeof(double *),
|
||||
"min:xextra_atom");
|
||||
"min:xextra_atom");
|
||||
fextra_atom = (double **) memory->srealloc(fextra_atom,n*sizeof(double *),
|
||||
"min:fextra_atom");
|
||||
"min:fextra_atom");
|
||||
memory->grow(extra_peratom,n,"min:extra_peratom");
|
||||
memory->grow(extra_nlen,n,"min:extra_nlen");
|
||||
memory->grow(extra_max,n,"min:extra_max");
|
||||
requestor = (Pair **) memory->srealloc(requestor,n*sizeof(Pair *),
|
||||
"min:requestor");
|
||||
"min:requestor");
|
||||
|
||||
requestor[nextra_atom] = pair;
|
||||
extra_peratom[nextra_atom] = peratom;
|
||||
@ -712,7 +712,7 @@ double Min::fnorm_sqr()
|
||||
fatom = fextra_atom[m];
|
||||
n = extra_nlen[m];
|
||||
for (i = 0; i < n; i++)
|
||||
local_norm2_sqr += fatom[i]*fatom[i];
|
||||
local_norm2_sqr += fatom[i]*fatom[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -720,9 +720,9 @@ double Min::fnorm_sqr()
|
||||
MPI_Allreduce(&local_norm2_sqr,&norm2_sqr,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
if (nextra_global)
|
||||
for (i = 0; i < nextra_global; i++)
|
||||
for (i = 0; i < nextra_global; i++)
|
||||
norm2_sqr += fextra[i]*fextra[i];
|
||||
|
||||
|
||||
return norm2_sqr;
|
||||
}
|
||||
|
||||
@ -743,7 +743,7 @@ double Min::fnorm_inf()
|
||||
fatom = fextra_atom[m];
|
||||
n = extra_nlen[m];
|
||||
for (i = 0; i < n; i++)
|
||||
local_norm_inf = MAX(fabs(fatom[i]),local_norm_inf);
|
||||
local_norm_inf = MAX(fabs(fatom[i]),local_norm_inf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@ double Min::fnorm_inf()
|
||||
MPI_Allreduce(&local_norm_inf,&norm_inf,1,MPI_DOUBLE,MPI_MAX,world);
|
||||
|
||||
if (nextra_global)
|
||||
for (i = 0; i < nextra_global; i++)
|
||||
for (i = 0; i < nextra_global; i++)
|
||||
norm_inf = MAX(fabs(fextra[i]),norm_inf);
|
||||
|
||||
return norm_inf;
|
||||
@ -764,14 +764,14 @@ double Min::fnorm_inf()
|
||||
char *Min::stopstrings(int n)
|
||||
{
|
||||
const char *strings[] = {"max iterations",
|
||||
"max force evaluations",
|
||||
"energy tolerance",
|
||||
"force tolerance",
|
||||
"search direction is not downhill",
|
||||
"linesearch alpha is zero",
|
||||
"forces are zero",
|
||||
"quadratic factors are zero",
|
||||
"trust region too small",
|
||||
"HFTN minimizer error"};
|
||||
"max force evaluations",
|
||||
"energy tolerance",
|
||||
"force tolerance",
|
||||
"search direction is not downhill",
|
||||
"linesearch alpha is zero",
|
||||
"forces are zero",
|
||||
"quadratic factors are zero",
|
||||
"trust region too small",
|
||||
"HFTN minimizer error"};
|
||||
return (char *) strings[n];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user