forked from lijiext/lammps
Added the boxinfo argument
This commit is contained in:
parent
65e281d661
commit
74414afdea
|
@ -483,51 +483,52 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip)
|
||||||
|
|
||||||
void ReadDump::header(int fieldinfo)
|
void ReadDump::header(int fieldinfo)
|
||||||
{
|
{
|
||||||
int triclinic_snap;
|
int boxinfo, triclinic_snap;
|
||||||
int fieldflag,xflag,yflag,zflag;
|
int fieldflag,xflag,yflag,zflag;
|
||||||
|
|
||||||
if (filereader) {
|
if (filereader) {
|
||||||
for (int i = 0; i < nreader; i++)
|
for (int i = 0; i < nreader; i++)
|
||||||
nsnapatoms[i] = readers[i]->read_header(box,triclinic_snap,fieldinfo,
|
nsnapatoms[i] = readers[i]->read_header(box,boxinfo,triclinic_snap,fieldinfo,
|
||||||
nfield,fieldtype,fieldlabel,
|
nfield,fieldtype,fieldlabel,
|
||||||
scaleflag,wrapflag,fieldflag,
|
scaleflag,wrapflag,fieldflag,
|
||||||
xflag,yflag,zflag);
|
xflag,yflag,zflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
MPI_Bcast(nsnapatoms,nreader,MPI_LMP_BIGINT,0,clustercomm);
|
MPI_Bcast(nsnapatoms,nreader,MPI_LMP_BIGINT,0,clustercomm);
|
||||||
|
MPI_Bcast(&boxinfo,1,MPI_INT,0,clustercomm);
|
||||||
MPI_Bcast(&triclinic_snap,1,MPI_INT,0,clustercomm);
|
MPI_Bcast(&triclinic_snap,1,MPI_INT,0,clustercomm);
|
||||||
MPI_Bcast(&box[0][0],9,MPI_DOUBLE,0,clustercomm);
|
MPI_Bcast(&box[0][0],9,MPI_DOUBLE,0,clustercomm);
|
||||||
|
|
||||||
// local copy of snapshot box parameters
|
// local copy of snapshot box parameters
|
||||||
// used in xfield,yfield,zfield when converting dump atom to absolute coords
|
// used in xfield,yfield,zfield when converting dump atom to absolute coords
|
||||||
|
|
||||||
xlo = box[0][0];
|
if (boxinfo) {
|
||||||
xhi = box[0][1];
|
xlo = box[0][0];
|
||||||
ylo = box[1][0];
|
xhi = box[0][1];
|
||||||
yhi = box[1][1];
|
ylo = box[1][0];
|
||||||
zlo = box[2][0];
|
yhi = box[1][1];
|
||||||
zhi = box[2][1];
|
zlo = box[2][0];
|
||||||
|
zhi = box[2][1];
|
||||||
// value of 1 indicates possible change in tilt factors
|
|
||||||
|
if (triclinic_snap) {
|
||||||
if (triclinic_snap == 1) {
|
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);
|
||||||
double xdelta = MIN(0.0,xy);
|
xdelta = MIN(xdelta,xz);
|
||||||
xdelta = MIN(xdelta,xz);
|
xdelta = MIN(xdelta,xy+xz);
|
||||||
xdelta = MIN(xdelta,xy+xz);
|
xlo = xlo - xdelta;
|
||||||
xlo = xlo - xdelta;
|
xdelta = MAX(0.0,xy);
|
||||||
xdelta = MAX(0.0,xy);
|
xdelta = MAX(xdelta,xz);
|
||||||
xdelta = MAX(xdelta,xz);
|
xdelta = MAX(xdelta,xy+xz);
|
||||||
xdelta = MAX(xdelta,xy+xz);
|
xhi = xhi - xdelta;
|
||||||
xhi = xhi - xdelta;
|
ylo = ylo - MIN(0.0,yz);
|
||||||
ylo = ylo - MIN(0.0,yz);
|
yhi = yhi - MAX(0.0,yz);
|
||||||
yhi = yhi - MAX(0.0,yz);
|
}
|
||||||
|
xprd = xhi - xlo;
|
||||||
|
yprd = yhi - ylo;
|
||||||
|
zprd = zhi - zlo;
|
||||||
}
|
}
|
||||||
xprd = xhi - xlo;
|
|
||||||
yprd = yhi - ylo;
|
|
||||||
zprd = zhi - zlo;
|
|
||||||
|
|
||||||
// done if not checking fields
|
// done if not checking fields
|
||||||
|
|
||||||
|
@ -539,13 +540,13 @@ void ReadDump::header(int fieldinfo)
|
||||||
MPI_Bcast(&zflag,1,MPI_INT,0,clustercomm);
|
MPI_Bcast(&zflag,1,MPI_INT,0,clustercomm);
|
||||||
|
|
||||||
// error check on current vs new box and fields
|
// error check on current vs new box and fields
|
||||||
// triclinic_snap < 0 means no box info in file
|
// boxinfo == 0 means no box info in file
|
||||||
|
|
||||||
if (triclinic_snap < 0 && boxflag > 0)
|
if (boxflag) {
|
||||||
error->all(FLERR,"No box information in dump, must use 'box no'");
|
if (!boxinfo)
|
||||||
if (triclinic_snap >= 0) {
|
error->all(FLERR,"No box information in dump, must use 'box no'");
|
||||||
if ((triclinic_snap && !triclinic) ||
|
else if ((triclinic_snap && !triclinic) ||
|
||||||
(!triclinic_snap && triclinic))
|
(!triclinic_snap && triclinic))
|
||||||
error->one(FLERR,"Read_dump triclinic status does not match simulation");
|
error->one(FLERR,"Read_dump triclinic status does not match simulation");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Reader : protected Pointers {
|
||||||
|
|
||||||
virtual int read_time(bigint &) = 0;
|
virtual int read_time(bigint &) = 0;
|
||||||
virtual void skip() = 0;
|
virtual void skip() = 0;
|
||||||
virtual bigint read_header(double [3][3], int &, int, int, int *, char **,
|
virtual bigint read_header(double [3][3], int &, int &, int, int, int *, char **,
|
||||||
int, int, int &, int &, int &, int &) = 0;
|
int, int, int &, int &, int &, int &) = 0;
|
||||||
virtual void read_atoms(int, int, double **) = 0;
|
virtual void read_atoms(int, int, double **) = 0;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ void ReaderNative::skip()
|
||||||
only called by proc 0
|
only called by proc 0
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
bigint ReaderNative::read_header(double box[3][3], int &triclinic,
|
bigint ReaderNative::read_header(double box[3][3], int &boxinfo, int &triclinic,
|
||||||
int fieldinfo, int nfield,
|
int fieldinfo, int nfield,
|
||||||
int *fieldtype, char **fieldlabel,
|
int *fieldtype, char **fieldlabel,
|
||||||
int scaleflag, int wrapflag, int &fieldflag,
|
int scaleflag, int wrapflag, int &fieldflag,
|
||||||
|
@ -113,6 +113,7 @@ bigint ReaderNative::read_header(double box[3][3], int &triclinic,
|
||||||
read_lines(2);
|
read_lines(2);
|
||||||
sscanf(line,BIGINT_FORMAT,&natoms);
|
sscanf(line,BIGINT_FORMAT,&natoms);
|
||||||
|
|
||||||
|
boxinfo = 1;
|
||||||
triclinic = 0;
|
triclinic = 0;
|
||||||
box[0][2] = box[1][2] = box[2][2] = 0.0;
|
box[0][2] = box[1][2] = box[2][2] = 0.0;
|
||||||
read_lines(1);
|
read_lines(1);
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ReaderNative : public Reader {
|
||||||
|
|
||||||
int read_time(bigint &);
|
int read_time(bigint &);
|
||||||
void skip();
|
void skip();
|
||||||
bigint read_header(double [3][3], int &, int, int, int *, char **,
|
bigint read_header(double [3][3], int &, int &, int, int, int *, char **,
|
||||||
int, int, int &, int &, int &, int &);
|
int, int, int &, int &, int &, int &);
|
||||||
void read_atoms(int, int, double **);
|
void read_atoms(int, int, double **);
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ void ReaderXYZ::skip()
|
||||||
only called by proc 0
|
only called by proc 0
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
bigint ReaderXYZ::read_header(double /*box*/[3][3], int &triclinic,
|
bigint ReaderXYZ::read_header(double /*box*/[3][3], int &boxinfo, int &/*triclinic*/,
|
||||||
int fieldinfo, int nfield,
|
int fieldinfo, int nfield,
|
||||||
int *fieldtype, char **/*fieldlabel*/,
|
int *fieldtype, char **/*fieldlabel*/,
|
||||||
int scaleflag, int wrapflag, int &fieldflag,
|
int scaleflag, int wrapflag, int &fieldflag,
|
||||||
|
@ -128,7 +128,7 @@ bigint ReaderXYZ::read_header(double /*box*/[3][3], int &triclinic,
|
||||||
|
|
||||||
// signal that we have no box info at all
|
// signal that we have no box info at all
|
||||||
|
|
||||||
triclinic = -1;
|
boxinfo = 0;
|
||||||
|
|
||||||
// if no field info requested, just return
|
// if no field info requested, just return
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class ReaderXYZ : public Reader {
|
||||||
|
|
||||||
int read_time(bigint &);
|
int read_time(bigint &);
|
||||||
void skip();
|
void skip();
|
||||||
bigint read_header(double [3][3], int &, int, int, int *, char **,
|
bigint read_header(double [3][3], int &, int &, int, int, int *, char **,
|
||||||
int, int, int &, int &, int &, int &);
|
int, int, int &, int &, int &, int &);
|
||||||
void read_atoms(int, int, double **);
|
void read_atoms(int, int, double **);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue