comment out debug options and make some tallies bigints

This commit is contained in:
Steve Plimpton
2020-06-19 10:35:42 -06:00
parent 7e2f29bb65
commit a40f4873fb
2 changed files with 37 additions and 30 deletions

View File

@ -62,7 +62,8 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) :
hyperflag = 2;
scalar_flag = 1;
vector_flag = 1;
size_vector = 28;
size_vector = 26;
//size_vector = 28; // can add 2 for debugging
local_flag = 1;
size_local_rows = 0;
size_local_cols = 0;
@ -194,7 +195,9 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) :
bound_upper = 1.0 + boundfrac;
lastreset = update->ntimestep;
overcount = 0;
// two DEBUG quantities
// myboost = 0.0;
// overcount = 0;
}
/* ---------------------------------------------------------------------- */
@ -481,7 +484,8 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
double **x = atom->x;
overcount = 0;
// DEBUG quantity
// overcount = 0;
m = 0;
for (iold = 0; iold < nlocal_old; iold++) {
@ -499,8 +503,8 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
maxbondlen = MAX(r,maxbondlen);
r0 = blist[m].r0;
estrain = fabs(r-r0) / r0;
// DEBUG quantity - could remove this line and output option
if (estrain >= qfactor) overcount++;
// DEBUG quantity
// if (estrain >= qfactor) overcount++;
maxstrain[i] = MAX(maxstrain[i],estrain);
maxstrain[j] = MAX(maxstrain[j],estrain);
if (estrain > halfstrain) {
@ -679,8 +683,8 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
int negstrain = 0;
mybias = 0.0;
// DEBUG - one line
myboost = 0;
// DEBUG quantity
// myboost = 0;
for (int ibias = 0; ibias < nbias; ibias++) {
m = bias[ibias];
@ -688,8 +692,8 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
j = blist[m].j;
if (maxstrain[i] >= qfactor) {
// DEBUG - one line
myboost += 1.0;
// DEBUG quantity
// myboost += 1.0;
nobias++;
continue;
}
@ -714,8 +718,8 @@ void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */)
if (ebias < 0.0) negstrain++;
mybias += vbias;
// DEBUG - one line
myboost += exp(beta * biascoeff[m]*vbias);
// DEBUG quantity
// myboost += exp(beta * biascoeff[m]*vbias);
}
//time7 = MPI_Wtime();
@ -1467,7 +1471,8 @@ double FixHyperLocal::compute_scalar()
double FixHyperLocal::compute_vector(int i)
{
// 28 vector outputs returned for i = 0-27
// 26 vector outputs returned for i = 0-25
// can add 2 more for debugging
// i = 0 = average boost for all bonds on this step
// i = 1 = # of biased bonds on this step
@ -1502,7 +1507,7 @@ double FixHyperLocal::compute_vector(int i)
// i = 24 = cumulative # of atoms in events since fix created
// i = 25 = cumulative # of new bonds formed since fix created
// these 2 were added for debugging - could be removed at some point
// these 2 can be added for debugging
// i = 26 = average boost for biased bonds on this step
// i = 27 = current count of bonds with strain >= q
@ -1580,17 +1585,17 @@ double FixHyperLocal::compute_vector(int i)
}
if (i == 11) {
int allbias_running,allnobias_running;
MPI_Allreduce(&nbias_running,&allbias_running,1,MPI_INT,MPI_SUM,world);
MPI_Allreduce(&nobias_running,&allnobias_running,1,MPI_INT,MPI_SUM,world);
bigint allbias_running,allnobias_running;
MPI_Allreduce(&nbias_running,&allbias_running,1,MPI_LMP_BIGINT,MPI_SUM,world);
MPI_Allreduce(&nobias_running,&allnobias_running,1,MPI_LMP_BIGINT,MPI_SUM,world);
if (allbias_running) return 1.0*allnobias_running / allbias_running;
return 0.0;
}
if (i == 12) {
int allbias_running,allnegstrain_running;
MPI_Allreduce(&nbias_running,&allbias_running,1,MPI_INT,MPI_SUM,world);
MPI_Allreduce(&negstrain_running,&allnegstrain_running,1,MPI_INT,
bigint allbias_running,allnegstrain_running;
MPI_Allreduce(&nbias_running,&allbias_running,1,MPI_LMP_BIGINT,MPI_SUM,world);
MPI_Allreduce(&negstrain_running,&allnegstrain_running,1,MPI_LMP_BIGINT,
MPI_SUM,world);
if (allbias_running) return 1.0*allnegstrain_running / allbias_running;
return 0.0;
@ -1654,13 +1659,14 @@ double FixHyperLocal::compute_vector(int i)
if (i == 24) return (double) nevent_atom;
if (i == 25) {
int allnewbond;
MPI_Allreduce(&nnewbond,&allnewbond,1,MPI_INT,MPI_SUM,world);
bigint allnewbond;
MPI_Allreduce(&nnewbond,&allnewbond,1,MPI_LMP_BIGINT,MPI_SUM,world);
return (double) allnewbond;
}
// these two options were added for debugging
// these two options can be added for debugging
/*
if (i == 26) {
double allboost;
MPI_Allreduce(&myboost,&allboost,1,MPI_DOUBLE,MPI_SUM,world);
@ -1675,7 +1681,8 @@ double FixHyperLocal::compute_vector(int i)
MPI_Allreduce(&overcount,&allovercount,1,MPI_INT,MPI_SUM,world);
return (double) allovercount;
}
*/
return 0.0;
}