git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8992 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2012-10-23 15:51:01 +00:00
parent 68415eae0e
commit 6394161a7c
5 changed files with 32 additions and 12 deletions

View File

@ -237,7 +237,6 @@ Atom::~Atom()
// delete mapping data structures // delete mapping data structures
memory->destroy(sametag);
map_delete(); map_delete();
} }

View File

@ -116,6 +116,7 @@ class Atom : protected Pointers {
int map_style; // default or user-specified style of map int map_style; // default or user-specified style of map
// 0 = none, 1 = array, 2 = hash // 0 = none, 1 = array, 2 = hash
int map_tag_max; // max atom ID that map() is setup for
// spatial sorting of atoms // spatial sorting of atoms
@ -198,8 +199,7 @@ class Atom : protected Pointers {
// global to local ID mapping // global to local ID mapping
int map_tag_max; // size of map_array int *map_array; // direct map of length map_tag_max + 1
int *map_array; // direct map of length max atom ID + 1
int smax; // max size of sametag int smax; // max size of sametag
struct HashElem { struct HashElem {

View File

@ -244,12 +244,18 @@ void Atom::map_one(int global, int local)
void Atom::map_delete() void Atom::map_delete()
{ {
memory->destroy(sametag);
sametag = NULL;
if (map_style == 1) { if (map_style == 1) {
if (map_tag_max) memory->destroy(map_array); memory->destroy(map_array);
map_array = NULL;
} else { } else {
if (map_nhash) { if (map_nhash) {
delete [] map_bucket; delete [] map_bucket;
delete [] map_hash; delete [] map_hash;
map_bucket = NULL;
map_hash = NULL;
} }
map_nhash = 0; map_nhash = 0;
} }

View File

@ -86,6 +86,9 @@ ReadDump::~ReadDump()
void ReadDump::command(int narg, char **arg) void ReadDump::command(int narg, char **arg)
{ {
if (domain->box_exist == 0)
error->all(FLERR,"Read_dump command before simulation box is defined");
if (narg < 2) error->all(FLERR,"Illegal read_dump command"); if (narg < 2) error->all(FLERR,"Illegal read_dump command");
store_files(1,&arg[0]); store_files(1,&arg[0]);
@ -321,14 +324,24 @@ void ReadDump::header(int fieldinfo)
yhi = box[1][1]; yhi = box[1][1];
zlo = box[2][0]; zlo = box[2][0];
zhi = box[2][1]; zhi = box[2][1];
xprd = xhi - xlo;
yprd = yhi - ylo;
zprd = zhi - zlo;
if (triclinic_snap) { if (triclinic_snap) {
xy = box[0][2]; xy = box[0][2];
xz = box[1][2]; xz = box[1][2];
yz = box[2][2]; yz = box[2][2];
double xdelta = MIN(0.0,xy);
xdelta = MIN(xdelta,xz);
xdelta = MIN(xdelta,xy+xz);
xlo = xlo - xdelta;
xdelta = MAX(0.0,xy);
xdelta = MAX(xdelta,xz);
xdelta = MAX(xdelta,xy+xz);
xhi = xhi - xdelta;
ylo = ylo - MIN(0.0,yz);
yhi = yhi - MAX(0.0,yz);
} }
xprd = xhi - xlo;
yprd = yhi - ylo;
zprd = zhi - zlo;
// done if not checking fields // done if not checking fields
@ -662,21 +675,23 @@ int ReadDump::fields_and_keywords(int narg, char **arg)
void ReadDump::process_atoms(int n) void ReadDump::process_atoms(int n)
{ {
int i,m,ifield,itype; int i,m,ifield,itype,itag;;
int xbox,ybox,zbox; int xbox,ybox,zbox;
double **x = atom->x; double **x = atom->x;
double **v = atom->v; double **v = atom->v;
tagint *image = atom->image; tagint *image = atom->image;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
int map_tag_max = atom->map_tag_max;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
ucflag[i] = 0; ucflag[i] = 0;
// map() call is invalid if purged all atoms // check if new atom matches one I own
// setting m = -1 forces new atom not to match // setting m = -1 forces new atom not to match
if (!purgeflag) m = atom->map(static_cast<int> (fields[i][0])); itag = static_cast<int> (fields[i][0]);
if (itag <= map_tag_max) m = atom->map(static_cast<int> (fields[i][0]));
else m = -1; else m = -1;
if (m < 0 || m >= nlocal) continue; if (m < 0 || m >= nlocal) continue;

View File

@ -35,11 +35,11 @@ Rerun::Rerun(LAMMPS *lmp) : Pointers(lmp) {}
void Rerun::command(int narg, char **arg) void Rerun::command(int narg, char **arg)
{ {
if (narg < 2) error->all(FLERR,"Illegal rerun command");
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all(FLERR,"Rerun command before simulation box is defined"); error->all(FLERR,"Rerun command before simulation box is defined");
if (narg < 2) error->all(FLERR,"Illegal rerun command");
// list of dump files = args until a keyword // list of dump files = args until a keyword
int iarg = 0; int iarg = 0;