Commit a40f4873 authored by Steve Plimpton's avatar Steve Plimpton
Browse files

comment out debug options and make some tallies bigints

parent 7e2f29bb
Loading
Loading
Loading
Loading
+30 −23
Original line number Diff line number Diff line
@@ -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,6 +1681,7 @@ double FixHyperLocal::compute_vector(int i)
    MPI_Allreduce(&overcount,&allovercount,1,MPI_INT,MPI_SUM,world);
    return (double) allovercount;
  }
  */
  
  return 0.0;
}
+7 −7
Original line number Diff line number Diff line
@@ -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