From 6a189f3188ae4ae9b0a333cb75ef7778d7fe2ac7 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Wed, 18 Sep 2013 17:15:38 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10811 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/read_dump.cpp | 15 ++++++++++++++- src/reader_native.cpp | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/read_dump.cpp b/src/read_dump.cpp index c5bc964300..9d2e24603e 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; // also in reader_native.cpp -enum{ID,TYPE,X,Y,Z,VX,VY,VZ,IX,IY,IZ}; +enum{ID,TYPE,X,Y,Z,VX,VY,VZ,Q,IX,IY,IZ}; enum{UNSET,NOSCALE_NOWRAP,NOSCALE_WRAP,SCALE_NOWRAP,SCALE_WRAP}; /* ---------------------------------------------------------------------- */ @@ -589,6 +589,11 @@ int ReadDump::fields_and_keywords(int narg, char **arg) else if (strcmp(arg[iarg],"vx") == 0) fieldtype[nfield++] = VX; else if (strcmp(arg[iarg],"vy") == 0) fieldtype[nfield++] = VY; else if (strcmp(arg[iarg],"vz") == 0) fieldtype[nfield++] = VZ; + else if (strcmp(arg[iarg],"q") == 0) { + if (!atom->q_flag) + error->all(FLERR,"Read dump of atom property that isn't allocated"); + fieldtype[nfield++] = Q; + } else if (strcmp(arg[iarg],"ix") == 0) fieldtype[nfield++] = IX; else if (strcmp(arg[iarg],"iy") == 0) fieldtype[nfield++] = IY; else if (strcmp(arg[iarg],"iz") == 0) fieldtype[nfield++] = IZ; @@ -710,6 +715,7 @@ void ReadDump::process_atoms(int n) double **x = atom->x; double **v = atom->v; + double *q = atom->q; tagint *image = atom->image; int nlocal = atom->nlocal; int map_tag_max = atom->map_tag_max; @@ -754,6 +760,9 @@ void ReadDump::process_atoms(int n) case VX: v[m][0] = fields[i][ifield]; break; + case Q: + q[m] = fields[i][ifield]; + break; case VY: v[m][1] = fields[i][ifield]; break; @@ -831,6 +840,7 @@ void ReadDump::process_atoms(int n) nadd++; v = atom->v; + q = atom->q; image = atom->image; // set atom attributes from other dump file fields @@ -848,6 +858,9 @@ void ReadDump::process_atoms(int n) case VZ: v[m][2] = fields[i][ifield]; break; + case Q: + q[m] = fields[i][ifield]; + break; case IX: xbox = static_cast (fields[i][ifield]); break; diff --git a/src/reader_native.cpp b/src/reader_native.cpp index 167be4ebe7..b09060c843 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; // also in read_dump.cpp -enum{ID,TYPE,X,Y,Z,VX,VY,VZ,IX,IY,IZ}; +enum{ID,TYPE,X,Y,Z,VX,VY,VZ,Q,IX,IY,IZ}; enum{UNSET,NOSCALE_NOWRAP,NOSCALE_WRAP,SCALE_NOWRAP,SCALE_WRAP}; /* ---------------------------------------------------------------------- */ @@ -247,6 +247,10 @@ bigint ReaderNative::read_header(double box[3][3], int &triclinic, fieldindex[i] = find_label("vy",nwords,labels); else if (fieldtype[i] == VZ) fieldindex[i] = find_label("vz",nwords,labels); + + else if (fieldtype[i] == Q) + fieldindex[i] = find_label("q",nwords,labels); + else if (fieldtype[i] == IX) fieldindex[i] = find_label("ix",nwords,labels); else if (fieldtype[i] == IY)