Commit df61f4f5 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5447 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 43596199
Loading
Loading
Loading
Loading
+27 −11
Original line number Diff line number Diff line
@@ -187,21 +187,12 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
      array[i][m] = 0.0;
  
  // nvalid = next step on which end_of_step does something
  // can be this timestep if multiple of peratom_freq and nrepeat = 1
  // else backup from next multiple of peratom_freq

  irepeat = 0;
  nvalid = (update->ntimestep/peratom_freq)*peratom_freq + peratom_freq;
  if (nvalid-peratom_freq == update->ntimestep && nrepeat == 1)
    nvalid = update->ntimestep;
  else
    nvalid -= (nrepeat-1)*nevery;
  if (nvalid < update->ntimestep) nvalid += peratom_freq;

  // add nvalid to all computes that store invocation times
  // since don't know a priori which are invoked by this fix
  // once in end_of_step() can set timestep for ones actually invoked

  irepeat = 0;
  nvalid = nextvalid();
  modify->addstep_compute_all(nvalid);
}

@@ -258,6 +249,14 @@ void FixAveAtom::init()

    } else value2index[m] = -1;
  }

  // need to reset nvalid if nvalid < ntimestep b/c minimize was performed

  if (nvalid < update->ntimestep) {
    irepeat = 0;
    nvalid = nextvalid();
    modify->addstep_compute_all(nvalid);
  }
}

/* ----------------------------------------------------------------------
@@ -429,3 +428,20 @@ int FixAveAtom::unpack_exchange(int nlocal, double *buf)
  for (int m = 0; m < nvalues; m++) array[nlocal][m] = buf[m];
  return nvalues;
}

/* ----------------------------------------------------------------------
   calculate nvalid = next step on which end_of_step does something
   can be this timestep if multiple of nfreq and nrepeat = 1
   else backup from next multiple of nfreq
------------------------------------------------------------------------- */

int FixAveAtom::nextvalid()
{
  int nvalid = (update->ntimestep/peratom_freq)*peratom_freq + peratom_freq;
  if (nvalid-peratom_freq == update->ntimestep && nrepeat == 1)
    nvalid = update->ntimestep;
  else
    nvalid -= (nrepeat-1)*nevery;
  if (nvalid < update->ntimestep) nvalid += peratom_freq;
  return nvalid;
}
+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ class FixAveAtom : public Fix {
  char **ids;

  double **array;

  int nextvalid();
};

}
+28 −11
Original line number Diff line number Diff line
@@ -280,10 +280,6 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
      save_corr[i][j] = corr[i][j] = 0.0;
  }

  lastindex = -1;
  firstindex = 0;
  nsample = 0;

  // this fix produces a global array

  array_flag = 1;
@@ -292,17 +288,14 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
  extarray = 0;

  // nvalid = next step on which end_of_step does something
  // this step if multiple of nevery, else next multiple
  // startstep is lower bound

  nvalid = update->ntimestep;
  if (startstep > nvalid) nvalid = startstep;
  if (nvalid % nevery) nvalid = (nvalid/nevery)*nevery + nevery;

  // add nvalid to all computes that store invocation times
  // since don't know a priori which are invoked by this fix
  // once in end_of_step() can set timestep for ones actually invoked

  lastindex = -1;
  firstindex = 0;
  nsample = 0;
  nvalid = nextvalid();
  modify->addstep_compute_all(nvalid);
}

@@ -360,6 +353,16 @@ void FixAveCorrelate::init()
      value2index[i] = ivariable;
    }
  }

  // need to reset nvalid if nvalid < ntimestep b/c minimize was performed

  if (nvalid < update->ntimestep) {
    lastindex = -1;
    firstindex = 0;
    nsample = 0;
    nvalid = nextvalid();
    modify->addstep_compute_all(nvalid);
  }
}

/* ----------------------------------------------------------------------
@@ -575,3 +578,17 @@ double FixAveCorrelate::compute_array(int i, int j)
  else if (save_count[i]) return save_corr[i][j-2];
  return 0.0;
}

/* ----------------------------------------------------------------------
   nvalid = next step on which end_of_step does something
   this step if multiple of nevery, else next multiple
   startstep is lower bound
------------------------------------------------------------------------- */

int FixAveCorrelate::nextvalid()
{
  int nvalid = update->ntimestep;
  if (startstep > nvalid) nvalid = startstep;
  if (nvalid % nevery) nvalid = (nvalid/nevery)*nevery + nevery;
  return nvalid;
}
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ class FixAveCorrelate : public Fix {
  double **save_corr;
    
  void accumulate();
  int nextvalid();
};

}
+26 −10
Original line number Diff line number Diff line
@@ -477,20 +477,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
  for (int i = 0; i < nbins; i++) bin_total[i] = 0.0;

  // nvalid = next step on which end_of_step does something
  // can be this timestep if multiple of nfreq and nrepeat = 1
  // else backup from next multiple of nfreq

  nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
  if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
    nvalid = update->ntimestep;
  else
    nvalid -= (nrepeat-1)*nevery;
  if (nvalid < update->ntimestep) nvalid += nfreq;

  // add nvalid to all computes that store invocation times
  // since don't know a priori which are invoked by this fix
  // once in end_of_step() can set timestep for ones actually invoked

  nvalid = nextvalid();
  modify->addstep_compute_all(nvalid);
}

@@ -550,6 +541,14 @@ void FixAveHisto::init()
      value2index[i] = ivariable;
    }
  }

  // need to reset nvalid if nvalid < ntimestep b/c minimize was performed

  if (nvalid < update->ntimestep) {
    irepeat = 0;
    nvalid = nextvalid();
    modify->addstep_compute_all(nvalid);
  }
}

/* ----------------------------------------------------------------------
@@ -983,3 +982,20 @@ void FixAveHisto::allocate_values(int n)
					 "ave/time:value2index");
  ids = (char **) memory->srealloc(ids,n*sizeof(char *),"ave/time:ids");
}

/* ----------------------------------------------------------------------
   calculate nvalid = next step on which end_of_step does something
   can be this timestep if multiple of nfreq and nrepeat = 1
   else backup from next multiple of nfreq
------------------------------------------------------------------------- */

int FixAveHisto::nextvalid()
{
  int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
  if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
    nvalid = update->ntimestep;
  else
    nvalid -= (nrepeat-1)*nevery;
  if (nvalid < update->ntimestep) nvalid += nfreq;
  return nvalid;
}
Loading