Commit 2477f004 authored by jrgissing's avatar jrgissing
Browse files

change keyword from 'insert' to 'randnpos'

parent f13d5db6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
randnpos"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c

:link(lws,http://lammps.sandia.gov)
:link(ld,Manual.html)
@@ -24,14 +24,14 @@ style = {box} or {region} or {single} or {random} :l
    seed = random # seed (positive integer)
    region-ID = create atoms within this region, use NULL for entire simulation box :pre
zero or more keyword/value pairs may be appended :l
keyword = {mol} or {basis} or {insert} or {remap} or {var} or {set} or {units} :l
keyword = {mol} or {basis} or {randnpos} or {remap} or {var} or {set} or {units} :l
  {mol} value = template-ID seed
    template-ID = ID of molecule template specified in a separate "molecule"_molecule.html command
    seed = random # seed (positive integer)
  {basis} values = M itype
    M = which basis atom
    itype = atom type (1-N) to assign to this basis atom
  {insert} value = number of particles to insert
  {randnpos} value = number of particles to add at lattice points
  {remap} value = {yes} or {no}
  {var} value = name = variable name to evaluate for test of atom creation
  {set} values = dim name
@@ -194,7 +194,7 @@ command for specifics on how basis atoms are defined for the unit cell
of the lattice.  By default, all created atoms are assigned the
argument {type} as their atom type.

The {insert} keyword can be used in conjuction with the {box} or
The {randnpos} keyword can be used in conjuction with the {box} or
{region} styles to limit the total number of particles inserted. The
specified number of particles are placed randomly on the available
lattice points.
+24 −26
Original line number Diff line number Diff line
@@ -109,11 +109,11 @@ void CreateAtoms::command(int narg, char **arg)
  remapflag = 0;
  mode = ATOM;
  int molseed;
  int insertseed;
  int randnseed;
  varflag = 0;
  vstr = xstr = ystr = zstr = NULL;
  quatone[0] = quatone[1] = quatone[2] = 0.0;
  nlattpts = ninsert = insertflag = 0;
  nlattpts = randnpos = randnflag = 0;
  Nmask = NULL;

  nbasis = domain->lattice->nbasis;
@@ -197,15 +197,15 @@ void CreateAtoms::command(int narg, char **arg)
      MathExtra::norm3(axisone);
      MathExtra::axisangle_to_quat(axisone,thetaone,quatone);
      iarg += 5;
    } else if (strcmp(arg[iarg],"insert") == 0) {
    } else if (strcmp(arg[iarg],"randnpos") == 0) {
      if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command");
      ninsert = force->inumeric(FLERR,arg[iarg+1]);
      insertseed = force->inumeric(FLERR,arg[iarg+2]);
      if (ninsert > 0) insertflag = 1;
      randnpos = force->inumeric(FLERR,arg[iarg+1]);
      randnseed = force->inumeric(FLERR,arg[iarg+2]);
      if (randnpos > 0) randnflag = 1;
      else {
        if (me == 0) error->warning(FLERR,"Specifying an 'insert' value of "
                                 "'0' is equivalent to no 'insert' keyword");
        insertflag = 0;
        if (me == 0) error->warning(FLERR,"Specifying an 'randnpos' value of "
                                 "'0' is equivalent to no 'randnpos' keyword");
        randnflag = 0;
      }
      iarg += 3;
    } else error->all(FLERR,"Illegal create_atoms command");
@@ -245,8 +245,8 @@ void CreateAtoms::command(int narg, char **arg)
    ranmol = new RanMars(lmp,molseed+me);
  }

  if (insertflag) {
    ranbox = new RanMars(lmp,insertseed+me);
  if (randnflag) {
    ranbox = new RanMars(lmp,randnseed+me);
  }

  // error check and further setup for variable test
@@ -769,12 +769,12 @@ void CreateAtoms::add_lattice()

  int i,j,k,m;

  // one pass for default mode, two passes for insert mode:
  // one pass for default mode, two passes for randnpos mode:
  // first pass: count how many particles will be inserted
  // second pass: filter to N number of particles (and insert)
  int maskcntr = 0;
  int npass = 1;
  if (insertflag) npass = 2;
  if (randnflag) npass = 2;
  for (int pass = 0; pass < npass; pass++) {
    if (pass == 1) lattice_mask();
    for (k = klo; k <= khi; k++)
@@ -811,9 +811,9 @@ void CreateAtoms::add_lattice()
                coord[2] < sublo[2] || coord[2] >= subhi[2]) continue;

            // add the atom or entire molecule to my list of atoms
            if (insertflag && pass == 0) nlattpts++;
            if (randnflag && pass == 0) nlattpts++;
            else {
              if (!insertflag || Nmask[maskcntr++] == 1)
              if (!randnflag || Nmask[maskcntr++] == 1)
                if (mode == ATOM) atom->avec->create_atom(basistype[m],x);
                else add_molecule(x);
            }
@@ -844,7 +844,7 @@ void CreateAtoms::lattice_mask()
        cumsum_lattpts[i] = total_lattpts;
      }

     if (ninsert > total_lattpts)
     if (randnpos > total_lattpts)
        error->one(FLERR,"Attempting to insert more particles than available lattice points");

      // using proc 0, let's insert N particles onto available lattice points by instead
@@ -852,7 +852,7 @@ void CreateAtoms::lattice_mask()
      int *allNmask = new int[total_lattpts];
      for (int i = 0; i < total_lattpts; i++)
        allNmask[i] = 1;
      int nholes = total_lattpts - ninsert;
      int nholes = total_lattpts - randnpos;
      int noptions = total_lattpts;
      for (int i = 0; i < nholes; i++) {
        int hindex = ceil(ranbox->uniform()*noptions);
@@ -889,13 +889,11 @@ void CreateAtoms::lattice_mask()
    delete [] allnboxmes;
    delete [] cumsum_lattpts;
  } else {
    if (ninsert > nlattpts)
    if (randnpos > nlattpts)
       error->one(FLERR,"Attempting to insert more particles than available lattice points");
    nboxme = ninsert;
    nboxme = randnpos;
  }



  // probably faster to have individual processors 're-choose' their random points
  // Nmask will be used to indicate which lattice points to insert
  Nmask = new int[nlattpts];
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class CreateAtoms : protected Pointers {
  void add_molecule(double *, double * = NULL);
  int nlattpts;                // number of eligible lattice points
  int *Nmask;                  // used to insert N number of particles on lattice
  int ninsert,insertflag;
  int randnpos,randnflag;
  int vartest(double *);       // evaluate a variable with new atom position
};

@@ -162,7 +162,7 @@ E: Attempting to insert more particles than available lattice points

Self-explanatory.

W: Specifying an 'insert' value of '0' is equivalent to no 'insert' keyword
W: Specifying an 'randnpos' value of '0' is equivalent to no 'randnpos' keyword

Self-explanatory.