Merge branch 'master' into adaptglok
This commit is contained in:
52
src/min.cpp
52
src/min.cpp
@ -71,7 +71,7 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp)
|
||||
max_vdotf_negatif = 2000;
|
||||
|
||||
elist_global = elist_atom = NULL;
|
||||
vlist_global = vlist_atom = NULL;
|
||||
vlist_global = vlist_atom = cvlist_atom = NULL;
|
||||
|
||||
nextra_global = 0;
|
||||
fextra = NULL;
|
||||
@ -95,6 +95,7 @@ Min::~Min()
|
||||
delete [] elist_atom;
|
||||
delete [] vlist_global;
|
||||
delete [] vlist_atom;
|
||||
delete [] cvlist_atom;
|
||||
|
||||
delete [] fextra;
|
||||
|
||||
@ -763,25 +764,28 @@ void Min::ev_setup()
|
||||
delete [] elist_atom;
|
||||
delete [] vlist_global;
|
||||
delete [] vlist_atom;
|
||||
delete [] cvlist_atom;
|
||||
elist_global = elist_atom = NULL;
|
||||
vlist_global = vlist_atom = NULL;
|
||||
vlist_global = vlist_atom = cvlist_atom = NULL;
|
||||
|
||||
nelist_global = nelist_atom = 0;
|
||||
nvlist_global = nvlist_atom = 0;
|
||||
nvlist_global = nvlist_atom = ncvlist_atom = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++) {
|
||||
if (modify->compute[i]->peflag) nelist_global++;
|
||||
if (modify->compute[i]->peatomflag) nelist_atom++;
|
||||
if (modify->compute[i]->pressflag) nvlist_global++;
|
||||
if (modify->compute[i]->pressatomflag) nvlist_atom++;
|
||||
if (modify->compute[i]->pressatomflag & 1) nvlist_atom++;
|
||||
if (modify->compute[i]->pressatomflag & 2) ncvlist_atom++;
|
||||
}
|
||||
|
||||
if (nelist_global) elist_global = new Compute*[nelist_global];
|
||||
if (nelist_atom) elist_atom = new Compute*[nelist_atom];
|
||||
if (nvlist_global) vlist_global = new Compute*[nvlist_global];
|
||||
if (nvlist_atom) vlist_atom = new Compute*[nvlist_atom];
|
||||
if (ncvlist_atom) cvlist_atom = new Compute*[ncvlist_atom];
|
||||
|
||||
nelist_global = nelist_atom = 0;
|
||||
nvlist_global = nvlist_atom = 0;
|
||||
nvlist_global = nvlist_atom = ncvlist_atom = 0;
|
||||
for (int i = 0; i < modify->ncompute; i++) {
|
||||
if (modify->compute[i]->peflag)
|
||||
elist_global[nelist_global++] = modify->compute[i];
|
||||
@ -789,8 +793,10 @@ void Min::ev_setup()
|
||||
elist_atom[nelist_atom++] = modify->compute[i];
|
||||
if (modify->compute[i]->pressflag)
|
||||
vlist_global[nvlist_global++] = modify->compute[i];
|
||||
if (modify->compute[i]->pressatomflag)
|
||||
if (modify->compute[i]->pressatomflag & 1)
|
||||
vlist_atom[nvlist_atom++] = modify->compute[i];
|
||||
if (modify->compute[i]->pressatomflag & 2)
|
||||
cvlist_atom[ncvlist_atom++] = modify->compute[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -808,6 +814,10 @@ void Min::ev_setup()
|
||||
vflag = 2 = global virial with pair portion via F dot r including ghosts
|
||||
vflag = 4 = per-atom virial only
|
||||
vflag = 5 or 6 = both global and per-atom virial
|
||||
vflag = 8 = per-atom centroid virial only
|
||||
vflag = 9 or 10 = both global and per-atom centroid virial
|
||||
vflag = 12 = both per-atom virial and per-atom centroid virial
|
||||
vflag = 13 or 15 = global, per-atom virial and per-atom centroid virial
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Min::ev_set(bigint ntimestep)
|
||||
@ -840,9 +850,15 @@ void Min::ev_set(bigint ntimestep)
|
||||
if (vlist_atom[i]->matchstep(ntimestep)) flag = 1;
|
||||
if (flag) vflag_atom = 4;
|
||||
|
||||
flag = 0;
|
||||
int cvflag_atom = 0;
|
||||
for (i = 0; i < ncvlist_atom; i++)
|
||||
if (cvlist_atom[i]->matchstep(ntimestep)) flag = 1;
|
||||
if (flag) cvflag_atom = 8;
|
||||
|
||||
if (vflag_global) update->vflag_global = update->ntimestep;
|
||||
if (vflag_atom) update->vflag_atom = update->ntimestep;
|
||||
vflag = vflag_global + vflag_atom;
|
||||
if (vflag_atom || cvflag_atom) update->vflag_atom = update->ntimestep;
|
||||
vflag = vflag_global + vflag_atom + cvflag_atom;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -924,20 +940,22 @@ double Min::fnorm_max()
|
||||
for (int m = 0; m < nextra_atom; m++) {
|
||||
fatom = fextra_atom[m];
|
||||
n = extra_nlen[m];
|
||||
for (i = 0; i < n; i+=3)
|
||||
fdotf = fvec[i]*fvec[i]+fvec[i+1]*fvec[i+1]+fvec[i+2]*fvec[i+2];
|
||||
for (i = 0; i < n; i+=3) {
|
||||
fdotf = fatom[i]*fatom[i]+fatom[i+1]*fatom[i+1]+fatom[i+2]*fatom[i+2];
|
||||
local_norm_max = MAX(fdotf,local_norm_max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double norm_max = 0.0;
|
||||
MPI_Allreduce(&local_norm_max,&norm_max,1,MPI_DOUBLE,MPI_MAX,world);
|
||||
|
||||
if (nextra_global)
|
||||
for (i = 0; i < n; i+=3)
|
||||
fdotf = fvec[i]*fvec[i]+fvec[i+1]*fvec[i+1]+fvec[i+2]*fvec[i+2];
|
||||
if (nextra_global) {
|
||||
for (i = 0; i < nextra_global; i+=3) {
|
||||
fdotf = fextra[i]*fextra[i];
|
||||
norm_max = MAX(fdotf,norm_max);
|
||||
|
||||
}
|
||||
}
|
||||
return norm_max;
|
||||
}
|
||||
|
||||
@ -968,7 +986,7 @@ double Min::total_torque()
|
||||
MPI_Allreduce(&ftotsqone,&ftotsqall,1,MPI_DOUBLE,MPI_SUM,world);
|
||||
|
||||
// multiply it by hbar so that units are in eV
|
||||
|
||||
|
||||
return sqrt(ftotsqall) * hbar;
|
||||
}
|
||||
|
||||
@ -978,14 +996,14 @@ double Min::total_torque()
|
||||
|
||||
double Min::inf_torque()
|
||||
{
|
||||
double fmsq,fmaxsqone,fmaxsqall;
|
||||
double fmaxsqone,fmaxsqall;
|
||||
int nlocal = atom->nlocal;
|
||||
double hbar = force->hplanck/MY_2PI;
|
||||
double tx,ty,tz;
|
||||
double **sp = atom->sp;
|
||||
double **fm = atom->fm;
|
||||
|
||||
fmsq = fmaxsqone = fmaxsqall = 0.0;
|
||||
fmaxsqone = fmaxsqall = 0.0;
|
||||
for (int i = 0; i < nlocal; i++) {
|
||||
tx = fm[i][1]*sp[i][2] - fm[i][2]*sp[i][1];
|
||||
ty = fm[i][2]*sp[i][0] - fm[i][0]*sp[i][2];
|
||||
|
||||
Reference in New Issue
Block a user