add ArgInfo support to some dump styles
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
|
||||
#include "dump_custom.h"
|
||||
|
||||
#include "arg_info.h"
|
||||
#include "atom.h"
|
||||
#include "compute.h"
|
||||
#include "domain.h"
|
||||
@ -1252,327 +1253,302 @@ int DumpCustom::parse_fields(int narg, char **arg)
|
||||
{
|
||||
// customize by adding to if statement
|
||||
|
||||
int i;
|
||||
for (int iarg = 0; iarg < narg; iarg++) {
|
||||
i = iarg;
|
||||
|
||||
if (strcmp(arg[iarg],"id") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_id;
|
||||
if (sizeof(tagint) == sizeof(smallint)) vtype[i] = Dump::INT;
|
||||
else vtype[i] = Dump::BIGINT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_id;
|
||||
if (sizeof(tagint) == sizeof(smallint)) vtype[iarg] = Dump::INT;
|
||||
else vtype[iarg] = Dump::BIGINT;
|
||||
} else if (strcmp(arg[iarg],"mol") == 0) {
|
||||
if (!atom->molecule_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_molecule;
|
||||
if (sizeof(tagint) == sizeof(smallint)) vtype[i] = Dump::INT;
|
||||
else vtype[i] = Dump::BIGINT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_molecule;
|
||||
if (sizeof(tagint) == sizeof(smallint)) vtype[iarg] = Dump::INT;
|
||||
else vtype[iarg] = Dump::BIGINT;
|
||||
} else if (strcmp(arg[iarg],"proc") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_proc;
|
||||
vtype[i] = Dump::INT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_proc;
|
||||
vtype[iarg] = Dump::INT;
|
||||
} else if (strcmp(arg[iarg],"procp1") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_procp1;
|
||||
vtype[i] = Dump::INT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_procp1;
|
||||
vtype[iarg] = Dump::INT;
|
||||
} else if (strcmp(arg[iarg],"type") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_type;
|
||||
vtype[i] = Dump::INT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_type;
|
||||
vtype[iarg] = Dump::INT;
|
||||
} else if (strcmp(arg[iarg],"element") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_type;
|
||||
vtype[i] = Dump::STRING;
|
||||
pack_choice[iarg] = &DumpCustom::pack_type;
|
||||
vtype[iarg] = Dump::STRING;
|
||||
} else if (strcmp(arg[iarg],"mass") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_mass;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_mass;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
} else if (strcmp(arg[iarg],"x") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_x;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_x;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"y") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_y;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_y;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"z") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_z;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_z;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"xs") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_xs_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_xs;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_xs_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_xs;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"ys") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_ys_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_ys;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_ys_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_ys;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"zs") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_zs_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_zs;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_zs_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_zs;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"xu") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_xu_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_xu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_xu_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_xu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"yu") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_yu_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_yu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_yu_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_yu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"zu") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_zu_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_zu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_zu_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_zu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"xsu") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_xsu_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_xsu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_xsu_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_xsu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"ysu") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_ysu_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_ysu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_ysu_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_ysu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"zsu") == 0) {
|
||||
if (domain->triclinic) pack_choice[i] = &DumpCustom::pack_zsu_triclinic;
|
||||
else pack_choice[i] = &DumpCustom::pack_zsu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (domain->triclinic) pack_choice[iarg] = &DumpCustom::pack_zsu_triclinic;
|
||||
else pack_choice[iarg] = &DumpCustom::pack_zsu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"ix") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_ix;
|
||||
vtype[i] = Dump::INT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_ix;
|
||||
vtype[iarg] = Dump::INT;
|
||||
} else if (strcmp(arg[iarg],"iy") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_iy;
|
||||
vtype[i] = Dump::INT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_iy;
|
||||
vtype[iarg] = Dump::INT;
|
||||
} else if (strcmp(arg[iarg],"iz") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_iz;
|
||||
vtype[i] = Dump::INT;
|
||||
pack_choice[iarg] = &DumpCustom::pack_iz;
|
||||
vtype[iarg] = Dump::INT;
|
||||
|
||||
} else if (strcmp(arg[iarg],"vx") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_vx;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_vx;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"vy") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_vy;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_vy;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"vz") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_vz;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_vz;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"fx") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_fx;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_fx;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"fy") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_fy;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_fy;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"fz") == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_fz;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_fz;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
} else if (strcmp(arg[iarg],"q") == 0) {
|
||||
if (!atom->q_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_q;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_q;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"mux") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_mux;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_mux;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"muy") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_muy;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_muy;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"muz") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_muz;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_muz;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"mu") == 0) {
|
||||
if (!atom->mu_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_mu;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_mu;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
} else if (strcmp(arg[iarg],"radius") == 0) {
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_radius;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_radius;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"diameter") == 0) {
|
||||
if (!atom->radius_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_diameter;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_diameter;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"omegax") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_omegax;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_omegax;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"omegay") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_omegay;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_omegay;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"omegaz") == 0) {
|
||||
if (!atom->omega_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_omegaz;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_omegaz;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"angmomx") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_angmomx;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_angmomx;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"angmomy") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_angmomy;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_angmomy;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"angmomz") == 0) {
|
||||
if (!atom->angmom_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_angmomz;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_angmomz;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"tqx") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_tqx;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_tqx;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"tqy") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_tqy;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_tqy;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
} else if (strcmp(arg[iarg],"tqz") == 0) {
|
||||
if (!atom->torque_flag)
|
||||
error->all(FLERR,"Dumping an atom property that isn't allocated");
|
||||
pack_choice[i] = &DumpCustom::pack_tqz;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
pack_choice[iarg] = &DumpCustom::pack_tqz;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
// compute value = c_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is int between []
|
||||
} else {
|
||||
|
||||
} else if (strncmp(arg[iarg],"c_",2) == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_compute;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
int n,tmp;
|
||||
ArgInfo argi(arg[iarg],ArgInfo::COMPUTE|ArgInfo::FIX|ArgInfo::VARIABLE
|
||||
|ArgInfo::DNAME|ArgInfo::INAME);
|
||||
argindex[iarg] = argi.get_index1();
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][2]);
|
||||
switch (argi.get_type()) {
|
||||
|
||||
char *ptr = strchr(suffix,'[');
|
||||
if (ptr) {
|
||||
if (suffix[strlen(suffix)-1] != ']')
|
||||
error->all(FLERR,"Invalid attribute in dump custom command");
|
||||
argindex[i] = atoi(ptr+1);
|
||||
*ptr = '\0';
|
||||
} else argindex[i] = 0;
|
||||
case ArgInfo::UNKNOWN:
|
||||
error->all(FLERR,"Invalid attribute in dump custom command");
|
||||
break;
|
||||
|
||||
n = modify->find_compute(suffix);
|
||||
if (n < 0) error->all(FLERR,"Could not find dump custom compute ID");
|
||||
if (modify->compute[n]->peratom_flag == 0)
|
||||
error->all(FLERR,"Dump custom compute does not compute per-atom info");
|
||||
if (argindex[i] == 0 && modify->compute[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,
|
||||
"Dump custom compute does not calculate per-atom vector");
|
||||
if (argindex[i] > 0 && modify->compute[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Dump custom compute does not calculate per-atom array");
|
||||
if (argindex[i] > 0 &&
|
||||
argindex[i] > modify->compute[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump custom compute vector is accessed out-of-range");
|
||||
// compute value = c_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is int between []
|
||||
|
||||
field2index[i] = add_compute(suffix);
|
||||
delete [] suffix;
|
||||
case ArgInfo::COMPUTE:
|
||||
pack_choice[iarg] = &DumpCustom::pack_compute;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
// fix value = f_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is between []
|
||||
n = modify->find_compute(argi.get_name());
|
||||
if (n < 0) error->all(FLERR,"Could not find dump custom compute ID");
|
||||
if (modify->compute[n]->peratom_flag == 0)
|
||||
error->all(FLERR,"Dump custom compute does not compute per-atom info");
|
||||
if (argi.get_dim() == 0 && modify->compute[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,
|
||||
"Dump custom compute does not calculate per-atom vector");
|
||||
if (argi.get_index1() > 0 && modify->compute[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Dump custom compute does not calculate per-atom array");
|
||||
if (argi.get_index1() > 0 &&
|
||||
argi.get_index1() > modify->compute[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump custom compute vector is accessed out-of-range");
|
||||
|
||||
} else if (strncmp(arg[iarg],"f_",2) == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_fix;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
field2index[iarg] = add_compute(argi.get_name());
|
||||
break;
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][2]);
|
||||
// fix value = f_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is between []
|
||||
|
||||
char *ptr = strchr(suffix,'[');
|
||||
if (ptr) {
|
||||
if (suffix[strlen(suffix)-1] != ']')
|
||||
error->all(FLERR,"Invalid attribute in dump custom command");
|
||||
argindex[i] = atoi(ptr+1);
|
||||
*ptr = '\0';
|
||||
} else argindex[i] = 0;
|
||||
case ArgInfo::FIX:
|
||||
pack_choice[iarg] = &DumpCustom::pack_fix;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
n = modify->find_fix(suffix);
|
||||
if (n < 0) error->all(FLERR,"Could not find dump custom fix ID");
|
||||
if (modify->fix[n]->peratom_flag == 0)
|
||||
error->all(FLERR,"Dump custom fix does not compute per-atom info");
|
||||
if (argindex[i] == 0 && modify->fix[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,"Dump custom fix does not compute per-atom vector");
|
||||
if (argindex[i] > 0 && modify->fix[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,"Dump custom fix does not compute per-atom array");
|
||||
if (argindex[i] > 0 &&
|
||||
argindex[i] > modify->fix[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump custom fix vector is accessed out-of-range");
|
||||
n = modify->find_fix(argi.get_name());
|
||||
if (n < 0) error->all(FLERR,"Could not find dump custom fix ID");
|
||||
if (modify->fix[n]->peratom_flag == 0)
|
||||
error->all(FLERR,"Dump custom fix does not compute per-atom info");
|
||||
if (argi.get_dim() == 0 && modify->fix[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,"Dump custom fix does not compute per-atom vector");
|
||||
if (argi.get_index1() > 0 && modify->fix[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,"Dump custom fix does not compute per-atom array");
|
||||
if (argi.get_index1() > 0 &&
|
||||
argi.get_index1() > modify->fix[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump custom fix vector is accessed out-of-range");
|
||||
|
||||
field2index[i] = add_fix(suffix);
|
||||
delete [] suffix;
|
||||
field2index[iarg] = add_fix(argi.get_name());
|
||||
break;
|
||||
|
||||
// variable value = v_name
|
||||
// variable value = v_name
|
||||
|
||||
} else if (strncmp(arg[iarg],"v_",2) == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_variable;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
case ArgInfo::VARIABLE:
|
||||
pack_choice[iarg] = &DumpCustom::pack_variable;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][2]);
|
||||
n = input->variable->find(argi.get_name());
|
||||
if (n < 0) error->all(FLERR,"Could not find dump custom variable name");
|
||||
if (input->variable->atomstyle(n) == 0)
|
||||
error->all(FLERR,"Dump custom variable is not atom-style variable");
|
||||
|
||||
argindex[i] = 0;
|
||||
field2index[iarg] = add_variable(argi.get_name());
|
||||
break;
|
||||
|
||||
n = input->variable->find(suffix);
|
||||
if (n < 0) error->all(FLERR,"Could not find dump custom variable name");
|
||||
if (input->variable->atomstyle(n) == 0)
|
||||
error->all(FLERR,"Dump custom variable is not atom-style variable");
|
||||
// custom per-atom floating point value = d_ID
|
||||
|
||||
field2index[i] = add_variable(suffix);
|
||||
delete [] suffix;
|
||||
case ArgInfo::DNAME:
|
||||
pack_choice[iarg] = &DumpCustom::pack_custom;
|
||||
vtype[iarg] = Dump::DOUBLE;
|
||||
|
||||
// custom per-atom floating point value = d_ID
|
||||
tmp = -1;
|
||||
n = atom->find_custom(argi.get_name(),tmp);
|
||||
if (n < 0)
|
||||
error->all(FLERR,"Could not find custom per-atom property ID");
|
||||
|
||||
} else if (strncmp(arg[iarg],"d_",2) == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_custom;
|
||||
vtype[i] = Dump::DOUBLE;
|
||||
if (tmp != 1)
|
||||
error->all(FLERR,"Custom per-atom property ID is not floating point");
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][2]);
|
||||
argindex[i] = 0;
|
||||
field2index[iarg] = add_custom(argi.get_name(),1);
|
||||
break;
|
||||
|
||||
int tmp = -1;
|
||||
n = atom->find_custom(suffix,tmp);
|
||||
if (n < 0)
|
||||
error->all(FLERR,"Could not find custom per-atom property ID");
|
||||
// custom per-atom integer value = i_ID
|
||||
|
||||
if (tmp != 1)
|
||||
error->all(FLERR,"Custom per-atom property ID is not floating point");
|
||||
case ArgInfo::INAME:
|
||||
pack_choice[iarg] = &DumpCustom::pack_custom;
|
||||
vtype[iarg] = Dump::INT;
|
||||
|
||||
field2index[i] = add_custom(suffix,1);
|
||||
delete [] suffix;
|
||||
tmp = -1;
|
||||
n = atom->find_custom(argi.get_name(),tmp);
|
||||
if (n < 0)
|
||||
error->all(FLERR,"Could not find custom per-atom property ID");
|
||||
|
||||
// custom per-atom integer value = i_ID
|
||||
if (tmp != 0)
|
||||
error->all(FLERR,"Custom per-atom property ID is not integer");
|
||||
|
||||
} else if (strncmp(arg[iarg],"i_",2) == 0) {
|
||||
pack_choice[i] = &DumpCustom::pack_custom;
|
||||
vtype[i] = Dump::INT;
|
||||
field2index[iarg] = add_custom(argi.get_name(),0);
|
||||
break;
|
||||
|
||||
int n = strlen(arg[iarg]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[iarg][2]);
|
||||
argindex[i] = 0;
|
||||
|
||||
int tmp = -1;
|
||||
n = atom->find_custom(suffix,tmp);
|
||||
if (n < 0)
|
||||
error->all(FLERR,"Could not find custom per-atom property ID");
|
||||
|
||||
if (tmp != 0)
|
||||
error->all(FLERR,"Custom per-atom property ID is not integer");
|
||||
|
||||
field2index[i] = add_custom(suffix,0);
|
||||
delete [] suffix;
|
||||
|
||||
} else return iarg;
|
||||
default:
|
||||
return iarg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return narg;
|
||||
@ -1897,149 +1873,113 @@ 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;
|
||||
|
||||
// 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
|
||||
else {
|
||||
|
||||
// must grow field2index and argindex arrays, since access is beyond nfield
|
||||
|
||||
else if (strncmp(arg[1],"c_",2) == 0) {
|
||||
thresh_array[nthresh] = COMPUTE;
|
||||
memory->grow(field2index,nfield+nthresh+1,"dump:field2index");
|
||||
memory->grow(argindex,nfield+nthresh+1,"dump:argindex");
|
||||
int n = strlen(arg[1]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[1][2]);
|
||||
|
||||
char *ptr = strchr(suffix,'[');
|
||||
if (ptr) {
|
||||
if (suffix[strlen(suffix)-1] != ']')
|
||||
error->all(FLERR,"Invalid attribute in dump modify command");
|
||||
argindex[nfield+nthresh] = atoi(ptr+1);
|
||||
*ptr = '\0';
|
||||
} else argindex[nfield+nthresh] = 0;
|
||||
int n,tmp;
|
||||
ArgInfo argi(arg[1],ArgInfo::COMPUTE|ArgInfo::FIX|ArgInfo::VARIABLE
|
||||
|ArgInfo::DNAME|ArgInfo::INAME);
|
||||
argindex[nfield+nthresh] = argi.get_index1();
|
||||
|
||||
n = modify->find_compute(suffix);
|
||||
if (n < 0) error->all(FLERR,"Could not find dump modify compute ID");
|
||||
switch (argi.get_type()) {
|
||||
|
||||
if (modify->compute[n]->peratom_flag == 0)
|
||||
error->all(FLERR,
|
||||
"Dump modify compute ID does not compute per-atom info");
|
||||
if (argindex[nfield+nthresh] == 0 &&
|
||||
modify->compute[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,
|
||||
"Dump modify compute ID does not compute per-atom vector");
|
||||
if (argindex[nfield+nthresh] > 0 &&
|
||||
modify->compute[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Dump modify compute ID does not compute per-atom array");
|
||||
if (argindex[nfield+nthresh] > 0 &&
|
||||
argindex[nfield+nthresh] > modify->compute[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump modify compute ID vector is not large enough");
|
||||
case ArgInfo::UNKNOWN:
|
||||
error->all(FLERR,"Invalid attribute in dump modify command");
|
||||
break;
|
||||
|
||||
field2index[nfield+nthresh] = add_compute(suffix);
|
||||
delete [] suffix;
|
||||
// compute value = c_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is between []
|
||||
|
||||
// fix value = f_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
|
||||
case ArgInfo::COMPUTE:
|
||||
thresh_array[nthresh] = COMPUTE;
|
||||
n = modify->find_compute(argi.get_name());
|
||||
if (n < 0) error->all(FLERR,"Could not find dump modify compute ID");
|
||||
|
||||
} else if (strncmp(arg[1],"f_",2) == 0) {
|
||||
thresh_array[nthresh] = FIX;
|
||||
memory->grow(field2index,nfield+nthresh+1,"dump:field2index");
|
||||
memory->grow(argindex,nfield+nthresh+1,"dump:argindex");
|
||||
int n = strlen(arg[1]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[1][2]);
|
||||
if (modify->compute[n]->peratom_flag == 0)
|
||||
error->all(FLERR,
|
||||
"Dump modify compute ID does not compute per-atom info");
|
||||
if (argi.get_dim() == 0 && modify->compute[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,
|
||||
"Dump modify compute ID does not compute per-atom vector");
|
||||
if (argi.get_index1() > 0 && modify->compute[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Dump modify compute ID does not compute per-atom array");
|
||||
if (argi.get_index1() > 0 &&
|
||||
argi.get_index1() > modify->compute[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump modify compute ID vector is not large enough");
|
||||
|
||||
char *ptr = strchr(suffix,'[');
|
||||
if (ptr) {
|
||||
if (suffix[strlen(suffix)-1] != ']')
|
||||
error->all(FLERR,"Invalid attribute in dump modify command");
|
||||
argindex[nfield+nthresh] = atoi(ptr+1);
|
||||
*ptr = '\0';
|
||||
} else argindex[nfield+nthresh] = 0;
|
||||
field2index[nfield+nthresh] = add_compute(argi.get_name());
|
||||
break;
|
||||
|
||||
n = modify->find_fix(suffix);
|
||||
if (n < 0) error->all(FLERR,"Could not find dump modify fix ID");
|
||||
// fix value = f_ID
|
||||
// if no trailing [], then arg is set to 0, else arg is between []
|
||||
|
||||
if (modify->fix[n]->peratom_flag == 0)
|
||||
error->all(FLERR,"Dump modify fix ID does not compute per-atom info");
|
||||
if (argindex[nfield+nthresh] == 0 &&
|
||||
modify->fix[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,"Dump modify fix ID does not compute per-atom vector");
|
||||
if (argindex[nfield+nthresh] > 0 &&
|
||||
modify->fix[n]->size_peratom_cols == 0)
|
||||
case ArgInfo::FIX:
|
||||
thresh_array[nthresh] = FIX;
|
||||
n = modify->find_fix(argi.get_name());
|
||||
if (n < 0) error->all(FLERR,"Could not find dump modify fix ID");
|
||||
|
||||
if (modify->fix[n]->peratom_flag == 0)
|
||||
error->all(FLERR,"Dump modify fix ID does not compute per-atom info");
|
||||
if (argi.get_dim() == 0 && modify->fix[n]->size_peratom_cols > 0)
|
||||
error->all(FLERR,"Dump modify fix ID does not compute per-atom vector");
|
||||
if (argi.get_index1() > 0 && modify->fix[n]->size_peratom_cols == 0)
|
||||
error->all(FLERR,"Dump modify fix ID does not compute per-atom array");
|
||||
if (argindex[nfield+nthresh] > 0 &&
|
||||
argindex[nfield+nthresh] > modify->fix[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump modify fix ID vector is not large enough");
|
||||
if (argi.get_index1() > 0 &&
|
||||
argi.get_index1() > modify->fix[n]->size_peratom_cols)
|
||||
error->all(FLERR,"Dump modify fix ID vector is not large enough");
|
||||
|
||||
field2index[nfield+nthresh] = add_fix(suffix);
|
||||
delete [] suffix;
|
||||
field2index[nfield+nthresh] = add_fix(argi.get_name());
|
||||
break;
|
||||
|
||||
// variable value = v_ID
|
||||
// must grow field2index and argindex arrays, since access is beyond nfield
|
||||
// variable value = v_ID
|
||||
// must grow field2index and argindex arrays, since access is beyond nfield
|
||||
|
||||
} else if (strncmp(arg[1],"v_",2) == 0) {
|
||||
thresh_array[nthresh] = VARIABLE;
|
||||
memory->grow(field2index,nfield+nthresh+1,"dump:field2index");
|
||||
memory->grow(argindex,nfield+nthresh+1,"dump:argindex");
|
||||
int n = strlen(arg[1]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[1][2]);
|
||||
case ArgInfo::VARIABLE:
|
||||
thresh_array[nthresh] = VARIABLE;
|
||||
n = input->variable->find(argi.get_name());
|
||||
if (n < 0) error->all(FLERR,"Could not find dump modify variable name");
|
||||
if (input->variable->atomstyle(n) == 0)
|
||||
error->all(FLERR,"Dump modify variable is not atom-style variable");
|
||||
|
||||
argindex[nfield+nthresh] = 0;
|
||||
field2index[nfield+nthresh] = add_variable(argi.get_name());
|
||||
break;
|
||||
|
||||
n = input->variable->find(suffix);
|
||||
if (n < 0) error->all(FLERR,"Could not find dump modify variable name");
|
||||
if (input->variable->atomstyle(n) == 0)
|
||||
error->all(FLERR,"Dump modify variable is not atom-style variable");
|
||||
// custom per atom floating point value = d_ID
|
||||
|
||||
field2index[nfield+nthresh] = add_variable(suffix);
|
||||
delete [] suffix;
|
||||
case ArgInfo::DNAME:
|
||||
thresh_array[nthresh] = DNAME;
|
||||
tmp = -1;
|
||||
n = atom->find_custom(argi.get_name(),tmp);
|
||||
if ((n < 0) || (tmp != 1))
|
||||
error->all(FLERR,"Could not find dump modify "
|
||||
"custom atom floating point property ID");
|
||||
|
||||
// custom per atom floating point value = d_ID
|
||||
// must grow field2index and argindex arrays, since access is beyond nfield
|
||||
field2index[nfield+nthresh] = add_custom(argi.get_name(),1);
|
||||
break;
|
||||
|
||||
} else if (strncmp(arg[1],"d_",2) == 0) {
|
||||
thresh_array[nthresh] = DNAME;
|
||||
memory->grow(field2index,nfield+nthresh+1,"dump:field2index");
|
||||
memory->grow(argindex,nfield+nthresh+1,"dump:argindex");
|
||||
int n = strlen(arg[1]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[1][2]);
|
||||
argindex[nfield+nthresh] = 0;
|
||||
// custom per atom integer value = i_ID
|
||||
|
||||
int tmp = -1;
|
||||
n = atom->find_custom(suffix,tmp);
|
||||
if ((n < 0) || (tmp != 1))
|
||||
error->all(FLERR,"Could not find dump modify "
|
||||
"custom atom floating point property ID");
|
||||
case ArgInfo::INAME:
|
||||
thresh_array[nthresh] = INAME;
|
||||
tmp = -1;
|
||||
n = atom->find_custom(argi.get_name(),tmp);
|
||||
if ((n < 0) || (tmp != 0))
|
||||
error->all(FLERR,"Could not find dump modify "
|
||||
"custom atom integer property ID");
|
||||
|
||||
field2index[nfield+nthresh] = add_custom(suffix,1);
|
||||
delete [] suffix;
|
||||
field2index[nfield+nthresh] = add_custom(argi.get_name(),0);
|
||||
break;
|
||||
|
||||
// custom per atom integer value = i_ID
|
||||
// must grow field2index and argindex arrays, since access is beyond nfield
|
||||
|
||||
} else if (strncmp(arg[1],"i_",2) == 0) {
|
||||
thresh_array[nthresh] = INAME;
|
||||
memory->grow(field2index,nfield+nthresh+1,"dump:field2index");
|
||||
memory->grow(argindex,nfield+nthresh+1,"dump:argindex");
|
||||
int n = strlen(arg[1]);
|
||||
char *suffix = new char[n];
|
||||
strcpy(suffix,&arg[1][2]);
|
||||
argindex[nfield+nthresh] = 0;
|
||||
|
||||
int tmp = -1;
|
||||
n = atom->find_custom(suffix,tmp);
|
||||
if ((n < 0) || (tmp != 0))
|
||||
error->all(FLERR,"Could not find dump modify "
|
||||
"custom atom integer property ID");
|
||||
|
||||
field2index[nfield+nthresh] = add_custom(suffix,0);
|
||||
delete [] suffix;
|
||||
|
||||
} else error->all(FLERR,"Invalid dump_modify thresh attribute");
|
||||
default:
|
||||
error->all(FLERR,"Invalid dump_modify thresh attribute");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set operation type of threshold
|
||||
|
||||
|
||||
Reference in New Issue
Block a user