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

This commit is contained in:
sjplimp
2014-06-04 22:24:04 +00:00
parent 47b6b3bb41
commit 23a05b2ddd
4 changed files with 43 additions and 106 deletions

View File

@ -17,6 +17,7 @@
#include "float.h"
#include "stdlib.h"
#include "string.h"
#include "atom_vec_peri.h"
#include "atom.h"
#include "comm.h"
@ -894,6 +895,45 @@ int AtomVecPeri::write_data_hybrid(FILE *fp, double *buf)
return 2;
}
/* ----------------------------------------------------------------------
assign an index to named atom property and return index
return -1 if name is unknown to this atom style
------------------------------------------------------------------------- */
int AtomVecPeri::property_atom(char *name)
{
if (strcmp(name,"vfrac") == 0) return 0;
if (strcmp(name,"s0") == 0) return 1;
return -1;
}
/* ----------------------------------------------------------------------
pack per-atom data into buf for ComputePropertyAtom
index maps to data specific to this atom style
------------------------------------------------------------------------- */
void AtomVecPeri::pack_property_atom(int index, double *buf,
int nvalues, int groupbit)
{
int *mask = atom->mask;
int nlocal = atom->nlocal;
int n = 0;
if (index == 0) {
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = vfrac[i];
else buf[n] = 0.0;
n += nvalues;
}
} else if (index == 1) {
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = s0[i];
else buf[n] = 0.0;
n += nvalues;
}
}
}
/* ----------------------------------------------------------------------
return # of bytes of allocated memory
------------------------------------------------------------------------- */

View File

@ -56,6 +56,8 @@ class AtomVecPeri : public AtomVec {
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
int property_atom(char *);
void pack_property_atom(int, double *, int, int);
bigint memory_usage();
private:

View File

@ -41,7 +41,7 @@ enum{ID,MOL,TYPE,ELEMENT,MASS,
VX,VY,VZ,FX,FY,FZ,
Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,
OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ,
TQX,TQY,TQZ,SPIN,ERADIUS,ERVEL,ERFORCE,
TQX,TQY,TQZ,
COMPUTE,FIX,VARIABLE};
enum{LT,LE,GT,GE,EQ,NEQ};
enum{INT,DOUBLE,STRING,BIGINT}; // same as in DumpCFG
@ -804,33 +804,6 @@ int DumpCustom::count()
ptr = &atom->torque[0][2];
nstride = 3;
} else if (thresh_array[ithresh] == SPIN) {
if (!atom->spin_flag)
error->all(FLERR,
"Threshhold for an atom property that isn't allocated");
int *spin = atom->spin;
for (i = 0; i < nlocal; i++) dchoose[i] = spin[i];
ptr = dchoose;
nstride = 1;
} else if (thresh_array[ithresh] == ERADIUS) {
if (!atom->eradius_flag)
error->all(FLERR,
"Threshhold for an atom property that isn't allocated");
ptr = atom->eradius;
nstride = 1;
} else if (thresh_array[ithresh] == ERVEL) {
if (!atom->ervel_flag)
error->all(FLERR,
"Threshhold for an atom property that isn't allocated");
ptr = atom->ervel;
nstride = 1;
} else if (thresh_array[ithresh] == ERFORCE) {
if (!atom->erforce_flag)
error->all(FLERR,
"Threshhold for an atom property that isn't allocated");
ptr = atom->erforce;
nstride = 1;
} else if (thresh_array[ithresh] == COMPUTE) {
i = nfield + ithresh;
if (argindex[i] == 0) {
@ -1171,27 +1144,6 @@ int DumpCustom::parse_fields(int narg, char **arg)
pack_choice[i] = &DumpCustom::pack_tqz;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"spin") == 0) {
if (!atom->spin_flag)
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
pack_choice[i] = &DumpCustom::pack_spin;
vtype[i] = INT;
} else if (strcmp(arg[iarg],"eradius") == 0) {
if (!atom->eradius_flag)
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
pack_choice[i] = &DumpCustom::pack_eradius;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"ervel") == 0) {
if (!atom->ervel_flag)
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
pack_choice[i] = &DumpCustom::pack_ervel;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"erforce") == 0) {
if (!atom->erforce_flag)
error->all(FLERR,"Dumping an atom quantity that isn't allocated");
pack_choice[i] = &DumpCustom::pack_erforce;
vtype[i] = DOUBLE;
// compute value = c_ID
// if no trailing [], then arg is set to 0, else arg is int between []
@ -1506,11 +1458,6 @@ int DumpCustom::modify_param(int narg, char **arg)
else if (strcmp(arg[1],"tqy") == 0) thresh_array[nthresh] = TQY;
else if (strcmp(arg[1],"tqz") == 0) thresh_array[nthresh] = TQZ;
else if (strcmp(arg[1],"spin") == 0) thresh_array[nthresh] = SPIN;
else if (strcmp(arg[1],"eradius") == 0) thresh_array[nthresh] = ERADIUS;
else if (strcmp(arg[1],"ervel") == 0) thresh_array[nthresh] = ERVEL;
else if (strcmp(arg[1],"erforce") == 0) thresh_array[nthresh] = ERFORCE;
// compute value = c_ID
// if no trailing [], then arg is set to 0, else arg is between []
// must grow field2index and argindex arrays, since access is beyond nfield
@ -2418,51 +2365,3 @@ void DumpCustom::pack_tqz(int n)
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_spin(int n)
{
int *spin = atom->spin;
for (int i = 0; i < nchoose; i++) {
buf[n] = spin[clist[i]];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_eradius(int n)
{
double *eradius = atom->eradius;
for (int i = 0; i < nchoose; i++) {
buf[n] = eradius[clist[i]];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_ervel(int n)
{
double *ervel = atom->ervel;
for (int i = 0; i < nchoose; i++) {
buf[n] = ervel[clist[i]];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_erforce(int n)
{
double *erforce = atom->erforce;
for (int i = 0; i < nchoose; i++) {
buf[n] = erforce[clist[i]];
n += size_one;
}
}

View File

@ -168,10 +168,6 @@ class DumpCustom : public Dump {
void pack_tqx(int);
void pack_tqy(int);
void pack_tqz(int);
void pack_spin(int);
void pack_eradius(int);
void pack_ervel(int);
void pack_erforce(int);
};
}