git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8226 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
Copyright (2003) Sandia Corporation. Under the terms of Contract
|
||||
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
|
||||
certain rights in this software. This software is distributed under
|
||||
certain rights in this software. This software is distributed under
|
||||
the GNU General Public License.
|
||||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
@ -41,17 +41,17 @@ CreateAtoms::CreateAtoms(LAMMPS *lmp) : Pointers(lmp) {}
|
||||
|
||||
void CreateAtoms::command(int narg, char **arg)
|
||||
{
|
||||
if (domain->box_exist == 0)
|
||||
if (domain->box_exist == 0)
|
||||
error->all(FLERR,"Create_atoms command before simulation box is defined");
|
||||
if (modify->nfix_restart_peratom)
|
||||
if (modify->nfix_restart_peratom)
|
||||
error->all(FLERR,"Cannot create_atoms after "
|
||||
"reading restart file with per-atom info");
|
||||
"reading restart file with per-atom info");
|
||||
|
||||
// parse arguments
|
||||
|
||||
if (narg < 2) error->all(FLERR,"Illegal create_atoms command");
|
||||
itype = atoi(arg[0]);
|
||||
if (itype <= 0 || itype > atom->ntypes)
|
||||
if (itype <= 0 || itype > atom->ntypes)
|
||||
error->all(FLERR,"Invalid atom type in create_atoms command");
|
||||
|
||||
int iarg;
|
||||
@ -63,7 +63,7 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
if (narg < 3) error->all(FLERR,"Illegal create_atoms command");
|
||||
nregion = domain->find_region(arg[2]);
|
||||
if (nregion == -1) error->all(FLERR,
|
||||
"Create_atoms region ID does not exist");
|
||||
"Create_atoms region ID does not exist");
|
||||
iarg = 3;;
|
||||
} else if (strcmp(arg[1],"single") == 0) {
|
||||
style = SINGLE;
|
||||
@ -81,7 +81,7 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
else {
|
||||
nregion = domain->find_region(arg[4]);
|
||||
if (nregion == -1) error->all(FLERR,
|
||||
"Create_atoms region ID does not exist");
|
||||
"Create_atoms region ID does not exist");
|
||||
}
|
||||
iarg = 5;
|
||||
} else error->all(FLERR,"Illegal create_atoms command");
|
||||
@ -101,12 +101,12 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
if (strcmp(arg[iarg],"basis") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command");
|
||||
if (domain->lattice == NULL)
|
||||
error->all(FLERR,"Cannot create atoms with undefined lattice");
|
||||
error->all(FLERR,"Cannot create atoms with undefined lattice");
|
||||
int ibasis = atoi(arg[iarg+1]);
|
||||
itype = atoi(arg[iarg+2]);
|
||||
if (ibasis <= 0 || ibasis > nbasis ||
|
||||
itype <= 0 || itype > atom->ntypes)
|
||||
error->all(FLERR,"Illegal create_atoms command");
|
||||
if (ibasis <= 0 || ibasis > nbasis ||
|
||||
itype <= 0 || itype > atom->ntypes)
|
||||
error->all(FLERR,"Illegal create_atoms command");
|
||||
basistype[ibasis-1] = itype;
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg],"remap") == 0) {
|
||||
@ -209,7 +209,7 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
Fix *fix = modify->fix[m];
|
||||
if (fix->create_attribute)
|
||||
for (int i = nlocal_previous; i < nlocal; i++)
|
||||
fix->set_arrays(i);
|
||||
fix->set_arrays(i);
|
||||
}
|
||||
|
||||
// clean up
|
||||
@ -228,10 +228,10 @@ void CreateAtoms::command(int narg, char **arg)
|
||||
if (comm->me == 0) {
|
||||
if (screen)
|
||||
fprintf(screen,"Created " BIGINT_FORMAT " atoms\n",
|
||||
atom->natoms-natoms_previous);
|
||||
atom->natoms-natoms_previous);
|
||||
if (logfile)
|
||||
fprintf(logfile,"Created " BIGINT_FORMAT " atoms\n",
|
||||
atom->natoms-natoms_previous);
|
||||
atom->natoms-natoms_previous);
|
||||
}
|
||||
|
||||
// reset simulation now that more atoms are defined
|
||||
@ -345,15 +345,15 @@ void CreateAtoms::add_random()
|
||||
if (domain->dimension == 2) xone[2] = zmid;
|
||||
|
||||
valid = 1;
|
||||
if (nregion >= 0 &&
|
||||
domain->regions[nregion]->match(xone[0],xone[1],xone[2]) == 0)
|
||||
valid = 0;
|
||||
if (nregion >= 0 &&
|
||||
domain->regions[nregion]->match(xone[0],xone[1],xone[2]) == 0)
|
||||
valid = 0;
|
||||
if (triclinic) {
|
||||
domain->x2lamda(xone,lamda);
|
||||
coord = lamda;
|
||||
if (coord[0] < boxlo[0] || coord[0] >= boxhi[0] ||
|
||||
coord[1] < boxlo[1] || coord[1] >= boxhi[1] ||
|
||||
coord[2] < boxlo[2] || coord[2] >= boxhi[2]) valid = 0;
|
||||
domain->x2lamda(xone,lamda);
|
||||
coord = lamda;
|
||||
if (coord[0] < boxlo[0] || coord[0] >= boxhi[0] ||
|
||||
coord[1] < boxlo[1] || coord[1] >= boxhi[1] ||
|
||||
coord[2] < boxlo[2] || coord[2] >= boxhi[2]) valid = 0;
|
||||
} else coord = xone;
|
||||
|
||||
if (valid) break;
|
||||
@ -362,11 +362,11 @@ void CreateAtoms::add_random()
|
||||
// if triclinic, coord is now in lamda units
|
||||
|
||||
if (coord[0] >= sublo[0] && coord[0] < subhi[0] &&
|
||||
coord[1] >= sublo[1] && coord[1] < subhi[1] &&
|
||||
coord[2] >= sublo[2] && coord[2] < subhi[2])
|
||||
coord[1] >= sublo[1] && coord[1] < subhi[1] &&
|
||||
coord[2] >= sublo[2] && coord[2] < subhi[2])
|
||||
atom->avec->create_atom(itype,xone);
|
||||
}
|
||||
|
||||
|
||||
// clean-up
|
||||
|
||||
delete random;
|
||||
@ -396,21 +396,21 @@ void CreateAtoms::add_lattice()
|
||||
xmax = ymax = zmax = -BIG;
|
||||
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxlo[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxhi[2],
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
xmin,ymin,zmin,xmax,ymax,zmax);
|
||||
|
||||
// ilo:ihi,jlo:jhi,klo:khi = loop bounds for lattice overlap of my subbox
|
||||
// overlap = any part of a unit cell (face,edge,pt) in common with my subbox
|
||||
@ -436,7 +436,7 @@ void CreateAtoms::add_lattice()
|
||||
// iterate on 3d periodic lattice of unit cells using loop bounds
|
||||
// iterate on nbasis atoms in each unit cell
|
||||
// convert lattice coords to box coords
|
||||
// add atom if it meets all criteria
|
||||
// add atom if it meets all criteria
|
||||
|
||||
double **basis = domain->lattice->basis;
|
||||
double x[3],lamda[3];
|
||||
@ -446,34 +446,34 @@ void CreateAtoms::add_lattice()
|
||||
for (k = klo; k <= khi; k++)
|
||||
for (j = jlo; j <= jhi; j++)
|
||||
for (i = ilo; i <= ihi; i++)
|
||||
for (m = 0; m < nbasis; m++) {
|
||||
for (m = 0; m < nbasis; m++) {
|
||||
|
||||
x[0] = i + basis[m][0];
|
||||
x[1] = j + basis[m][1];
|
||||
x[2] = k + basis[m][2];
|
||||
x[0] = i + basis[m][0];
|
||||
x[1] = j + basis[m][1];
|
||||
x[2] = k + basis[m][2];
|
||||
|
||||
// convert from lattice coords to box coords
|
||||
// convert from lattice coords to box coords
|
||||
|
||||
domain->lattice->lattice2box(x[0],x[1],x[2]);
|
||||
domain->lattice->lattice2box(x[0],x[1],x[2]);
|
||||
|
||||
// if a region was specified, test if atom is in it
|
||||
// if a region was specified, test if atom is in it
|
||||
|
||||
if (style == REGION)
|
||||
if (!domain->regions[nregion]->match(x[0],x[1],x[2])) continue;
|
||||
if (style == REGION)
|
||||
if (!domain->regions[nregion]->match(x[0],x[1],x[2])) continue;
|
||||
|
||||
// test if atom is in my subbox
|
||||
// test if atom is in my subbox
|
||||
|
||||
if (triclinic) {
|
||||
domain->x2lamda(x,lamda);
|
||||
coord = lamda;
|
||||
} else coord = x;
|
||||
if (triclinic) {
|
||||
domain->x2lamda(x,lamda);
|
||||
coord = lamda;
|
||||
} else coord = x;
|
||||
|
||||
if (coord[0] < sublo[0] || coord[0] >= subhi[0] ||
|
||||
coord[1] < sublo[1] || coord[1] >= subhi[1] ||
|
||||
coord[2] < sublo[2] || coord[2] >= subhi[2]) continue;
|
||||
if (coord[0] < sublo[0] || coord[0] >= subhi[0] ||
|
||||
coord[1] < sublo[1] || coord[1] >= subhi[1] ||
|
||||
coord[2] < sublo[2] || coord[2] >= subhi[2]) continue;
|
||||
|
||||
// add the atom to my list of atoms
|
||||
// add the atom to my list of atoms
|
||||
|
||||
atom->avec->create_atom(basistype[m],x);
|
||||
}
|
||||
atom->avec->create_atom(basistype[m],x);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user