From a40f4873fbb275ae261e439acbade0e0bda0bd16 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Fri, 19 Jun 2020 10:35:42 -0600 Subject: [PATCH] comment out debug options and make some tallies bigints --- src/REPLICA/fix_hyper_local.cpp | 53 +++++++++++++++++++-------------- src/REPLICA/fix_hyper_local.h | 14 ++++----- 2 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index 9625eb158e..8e14affef8 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -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; } diff --git a/src/REPLICA/fix_hyper_local.h b/src/REPLICA/fix_hyper_local.h index 6e8fee61d9..4fb54d166c 100644 --- a/src/REPLICA/fix_hyper_local.h +++ b/src/REPLICA/fix_hyper_local.h @@ -72,9 +72,9 @@ class FixHyperLocal : public FixHyper { double cutbondsq,dcutsq; double beta,invvmax,invqfactorsq; - // DEBUG - 2 lines - int overcount; - double myboost; + // two DEBUG quantities + // double myboost; + // int overcount; // flags @@ -95,14 +95,14 @@ class FixHyperLocal : public FixHyper { double time_bondbuild; // CPU time for bond builds bigint allbonds; // current total # of bonds - int nnewbond; // running tally of # of new bonds created int maxbondperatom; // max # of bonds any atom ever has int nevent; // # of events that trigger bond rebuild int nevent_atom; // # of atoms that experienced an event - int nbias_running; // running count of biased bonds - int nobias_running; // ditto for bonds with bias = 0, b/c too long - int negstrain_running; // ditto for bonds with negative strain + bigint nnewbond; // running tally of # of new bonds created + bigint nbias_running; // running count of biased bonds + bigint nobias_running; // ditto for bonds with bias = 0, b/c too long + bigint negstrain_running; // ditto for bonds with negative strain double mybias; // sum of bias potentials for biased bonds double maxbondlen; // cummulative max length of any bond