Commit 1dbad849 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3674 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 363e6c37
Loading
Loading
Loading
Loading
+18 −17
Original line number Diff line number Diff line
@@ -52,6 +52,10 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
  extra_bond_per_atom = 0;

  firstgroupname = NULL;
  sortfreq = 0;
  maxbin = maxnext = 0;
  binhead = NULL;
  next = permute = NULL;

  // initialize atom arrays
  // customize by adding new array
@@ -110,13 +114,6 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
  nextra_store = 0;
  extra = NULL;

  // sorting

  sortflag = 0;
  maxbin = maxnext = 0;
  binhead = NULL;
  next = permute = NULL;

  // default mapping values and hash table primes

  tag_enable = 1;
@@ -146,7 +143,11 @@ Atom::~Atom()
{
  delete [] atom_style;
  delete avec;

  delete [] firstgroupname;
  memory->sfree(binhead);
  memory->sfree(next);
  memory->sfree(permute);

  // delete atom arrays
  // customize by adding new array
@@ -211,12 +212,6 @@ Atom::~Atom()
  delete [] dipole;
  delete [] dipole_setflag;

  // delete sorting arrays

  memory->sfree(binhead);
  memory->sfree(next);
  memory->sfree(permute);

  // delete extra arrays

  memory->sfree(extra_grow);
@@ -315,7 +310,7 @@ void Atom::setup()
  // setup for sorting
  // binsize = user setting or 1/2 of neighbor cutoff

  if (sortflag) {
  if (sortfreq > 0) {
    double binsize;
    if (userbinsize > 0.0) binsize = userbinsize;
    else binsize = 0.5 * neighbor->cutneighmax;
@@ -341,6 +336,8 @@ int Atom::style_match(const char *style)

/* ----------------------------------------------------------------------
   modify parameters of the atom style
   some options can only be invoked before simulation box is defined
   first and sort options cannot be used together
------------------------------------------------------------------------- */

void Atom::modify_params(int narg, char **arg)
@@ -354,6 +351,8 @@ void Atom::modify_params(int narg, char **arg)
      if (strcmp(arg[iarg+1],"array") == 0) map_style = 1;
      else if (strcmp(arg[iarg+1],"hash") == 0) map_style = 2;
      else error->all("Illegal atom_modify command");
      if (domain->box_exist) 
	error->all("Atom_modify map command after simulation box is defined");
      iarg += 2;
    } else if (strcmp(arg[iarg],"first") == 0) {
      if (iarg+2 > narg) error->all("Illegal atom_modify command");
@@ -363,6 +362,7 @@ void Atom::modify_params(int narg, char **arg)
	firstgroupname = new char[n];
	strcpy(firstgroupname,arg[iarg+1]);
      }
      sortfreq = 0;
      iarg += 2;
    } else if (strcmp(arg[iarg],"sort") == 0) {
      if (iarg+3 > narg) error->all("Illegal atom_modify command");
@@ -370,8 +370,9 @@ void Atom::modify_params(int narg, char **arg)
      userbinsize = atof(arg[iarg+2]);
      if (sortfreq < 0 || userbinsize < 0.0)
	error->all("Illegal atom_modify command");
      if (sortfreq == 0) sortflag = 0;
      else sortflag = 1;
      if (sortfreq >= 0 && firstgroupname) 
	error->all("Atom_modify sort and first options "
		   "cannot be used together");
      iarg += 3;
    } else error->all("Illegal atom_modify command");
  }
@@ -1370,7 +1371,7 @@ void Atom::sort()
    permute = (int *) memory->smalloc(maxnext*sizeof(int),"atom:permute");
  }

  // insure one extra location at end of atom arrays
  // insure there is one extra atom location at end of arrays for swaps

  if (nlocal == nmax) avec->grow(0);

+1 −2
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ class Atom : protected Pointers {

  // spatial sorting of atoms

  int sortflag;             // 0 = off, 1 = on
  int sortfreq;             // sort atoms every this many steps, 0 = off
  int nextsort;             // next timestep to sort on

  // functions
@@ -203,7 +203,6 @@ class Atom : protected Pointers {
  int *permute;                   // permutation vector
  double userbinsize;             // sorting bin size
  double bininv;
  int sortfreq;

  int memlength;                  // allocated size of memstr
  char *memstr;                   // string of array names already counted
+2 −2
Original line number Diff line number Diff line
@@ -172,7 +172,7 @@ double ComputePressure::compute_scalar()

  double t;
  if (keflag) {
    if (temperature->invoked_scalar == update->ntimestep)
    if (temperature->invoked_scalar != update->ntimestep)
      t = temperature->compute_scalar();
    else t = temperature->scalar;
  }
@@ -209,7 +209,7 @@ void ComputePressure::compute_vector()
  if (update->vflag_global != invoked_vector)
    error->all("Virial was not tallied on needed timestep");

  // invoke temperature it it hasn't been already
  // invoke temperature if it hasn't been already

  double *ke_tensor;
  if (keflag) {
+0 −2
Original line number Diff line number Diff line
@@ -691,8 +691,6 @@ void Input::angle_style()

void Input::atom_modify()
{
  if (domain->box_exist) 
    error->all("Atom_modify command after simulation box is defined");
  atom->modify_params(narg,arg);
}

+9 −1
Original line number Diff line number Diff line
@@ -192,12 +192,20 @@ void Modify::init()
  list_init_compute();

  // init each compute
  // set invoked_scalar,vector,etc to -1 to force new run to re-compute them
  // add initial timestep to all computes that store invocation times
  //   since any of them may be invoked by initial thermo
  // do not clear out invocation times stored within a compute,
  //   b/c some may be holdovers from previous run, like for ave fixes

  for (i = 0; i < ncompute; i++) compute[i]->init();
  for (i = 0; i < ncompute; i++) {
    compute[i]->init();
    compute[i]->invoked_scalar = -1;
    compute[i]->invoked_vector = -1;
    compute[i]->invoked_array = -1;
    compute[i]->invoked_peratom = -1;
    compute[i]->invoked_local = -1;
  }
  addstep_compute_all(update->ntimestep);

  // warn if any particle is time integrated more than once
Loading