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

This commit is contained in:
sjplimp 2008-09-09 14:45:36 +00:00
parent 2e221952de
commit 655daa0695
2 changed files with 41 additions and 1 deletions

View File

@ -32,7 +32,7 @@ using namespace LAMMPS_NS;
// customize by adding keyword to 1st enum
enum{TAG,MOL,TYPE,X,Y,Z,XS,YS,ZS,XU,YU,ZU,IX,IY,IZ,
enum{TAG,MOL,TYPE,MASS,X,Y,Z,XS,YS,ZS,XU,YU,ZU,IX,IY,IZ,
VX,VY,VZ,FX,FY,FZ,
Q,MUX,MUY,MUZ,RADIUS,OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ,
QUATW,QUATI,QUATJ,QUATK,TQX,TQY,TQZ,
@ -339,6 +339,17 @@ int DumpCustom::count()
for (i = 0; i < nlocal; i++) dchoose[i] = type[i];
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == MASS) {
if (atom->mass) {
double *mass = atom->mass;
int *type = atom->type;
for (i = 0; i < nlocal; i++) dchoose[i] = mass[type[i]];
ptr = dchoose;
nstride = 1;
} else {
ptr = atom->rmass;
nstride = 1;
}
} else if (thresh_array[ithresh] == X) {
ptr = &atom->x[0][0];
nstride = 3;
@ -658,6 +669,9 @@ void DumpCustom::parse_fields(int narg, char **arg)
} else if (strcmp(arg[iarg],"type") == 0) {
pack_choice[i] = &DumpCustom::pack_type;
vtype[i] = INT;
} else if (strcmp(arg[iarg],"mass") == 0) {
pack_choice[i] = &DumpCustom::pack_mass;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"x") == 0) {
pack_choice[i] = &DumpCustom::pack_x;
@ -1040,6 +1054,7 @@ int DumpCustom::modify_param(int narg, char **arg)
if (strcmp(arg[1],"tag") == 0) thresh_array[nthresh] = TAG;
else if (strcmp(arg[1],"mol") == 0) thresh_array[nthresh] = MOL;
else if (strcmp(arg[1],"type") == 0) thresh_array[nthresh] = TYPE;
else if (strcmp(arg[1],"mass") == 0) thresh_array[nthresh] = MASS;
else if (strcmp(arg[1],"x") == 0) thresh_array[nthresh] = X;
else if (strcmp(arg[1],"y") == 0) thresh_array[nthresh] = Y;
else if (strcmp(arg[1],"z") == 0) thresh_array[nthresh] = Z;
@ -1341,6 +1356,30 @@ void DumpCustom::pack_type(int n)
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_mass(int n)
{
int *type = atom->type;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
if (mass) {
for (int i = 0; i < nlocal; i++)
if (choose[i]) {
buf[n] = mass[type[i]];
n += size_one;
}
} else {
for (int i = 0; i < nlocal; i++)
if (choose[i]) {
buf[n] = rmass[i];
n += size_one;
}
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_x(int n)
{
double **x = atom->x;

View File

@ -91,6 +91,7 @@ class DumpCustom : public Dump {
void pack_tag(int);
void pack_molecule(int);
void pack_type(int);
void pack_mass(int);
void pack_x(int);
void pack_y(int);
void pack_z(int);