Commit f62e5ab1 authored by jrgissing's avatar jrgissing
Browse files

logic fix, memory cleanup, add comments

parent f3cfb9c8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -809,6 +809,7 @@ void CreateAtoms::add_lattice()
void CreateAtoms::lattice_mask()
{

  // Nmask will be used to choose which lattice points to insert
  Nmask = new int[nlattpts];
  for (int i = 0; i < nlattpts; i++) 
    Nmask[i] = 1;
@@ -833,6 +834,10 @@ void CreateAtoms::lattice_mask()
      
      nboxme = round(nbox*nlattpts/total_lattpts);
      
      // limit nboxme to available lattice points on this processor
      
      if (nboxme > nlattpts) nboxme = nlattpts;
      
      // readjust so that all nboxme's add to exactly nbox
      
      int sum_nboxme;
@@ -867,7 +872,7 @@ void CreateAtoms::lattice_mask()
        // should have guaranteed success at this point
        if (failed_all == nprocs) error->warning(FLERR,"This is an uncaught error. Ask developer");
      }
      
      delete [] allnlattpts;
    } else nboxme = nbox;
    
    // let's insert N particles onto available lattice points by instead