From 2f7d6672df040056b9727748ec89a5a8115a9a8d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 3 Feb 2021 16:19:05 -0500 Subject: [PATCH] more files with ArgInfo support added --- src/dump_custom.cpp | 7 +-- src/fix_ave_chunk.cpp | 119 +++++++++++++++++--------------------- src/fix_ave_correlate.cpp | 56 +++++++----------- src/fix_ave_histo.cpp | 100 ++++++++++++++------------------ src/fix_ave_time.cpp | 97 ++++++++++++++----------------- src/fix_controller.cpp | 58 ++++++------------- 6 files changed, 182 insertions(+), 255 deletions(-) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 09522c2f13..0f2e62408d 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -1748,14 +1748,13 @@ int DumpCustom::modify_param(int narg, char **arg) if (strcmp(arg[0],"refresh") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strncmp(arg[1],"c_",2) != 0) + ArgInfo argi(arg[1],ArgInfo::COMPUTE); + if ((argi.get_type() != ArgInfo::COMPUTE) || (argi.get_dim() != 0)) error->all(FLERR,"Illegal dump_modify command"); if (refreshflag) error->all(FLERR,"Dump modify can only have one refresh"); refreshflag = 1; - int n = strlen(arg[1]); - refresh = new char[n]; - strcpy(refresh,&arg[1][2]); + refresh = argi.copy_name(); return 2; } diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 21e56ee697..36fcb4af4f 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -13,27 +13,25 @@ #include "fix_ave_chunk.h" +#include "arg_info.h" +#include "atom.h" +#include "compute.h" +#include "compute_chunk_atom.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" #include #include -#include "atom.h" -#include "update.h" -#include "force.h" -#include "domain.h" -#include "modify.h" -#include "compute.h" -#include "compute_chunk_atom.h" -#include "input.h" -#include "variable.h" -#include "memory.h" -#include "error.h" - - using namespace LAMMPS_NS; using namespace FixConst; -enum{V,F,DENSITY_NUMBER,DENSITY_MASS,MASS,TEMPERATURE,COMPUTE,FIX,VARIABLE}; enum{SCALAR,VECTOR}; enum{SAMPLE,ALL}; enum{NOSCALE,ATOM}; @@ -90,67 +88,53 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : ids[nvalues] = nullptr; if (strcmp(arg[iarg],"vx") == 0) { - which[nvalues] = V; + which[nvalues] = ArgInfo::V; argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"vy") == 0) { - which[nvalues] = V; + which[nvalues] = ArgInfo::V; argindex[nvalues++] = 1; } else if (strcmp(arg[iarg],"vz") == 0) { - which[nvalues] = V; + which[nvalues] = ArgInfo::V; argindex[nvalues++] = 2; } else if (strcmp(arg[iarg],"fx") == 0) { - which[nvalues] = F; + which[nvalues] = ArgInfo::F; argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"fy") == 0) { - which[nvalues] = F; + which[nvalues] = ArgInfo::F; argindex[nvalues++] = 1; } else if (strcmp(arg[iarg],"fz") == 0) { - which[nvalues] = F; + which[nvalues] = ArgInfo::F; argindex[nvalues++] = 2; } else if (strcmp(arg[iarg],"density/number") == 0) { densityflag = 1; - which[nvalues] = DENSITY_NUMBER; + which[nvalues] = ArgInfo::DENSITY_NUMBER; argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"density/mass") == 0) { densityflag = 1; - which[nvalues] = DENSITY_MASS; + which[nvalues] = ArgInfo::DENSITY_MASS; argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"mass") == 0) { - which[nvalues] = MASS; + which[nvalues] = ArgInfo::MASS; argindex[nvalues++] = 0; } else if (strcmp(arg[iarg],"temp") == 0) { - which[nvalues] = TEMPERATURE; + which[nvalues] = ArgInfo::TEMPERATURE; argindex[nvalues++] = 0; - } else if (strncmp(arg[iarg],"c_",2) == 0 || - strncmp(arg[iarg],"f_",2) == 0 || - strncmp(arg[iarg],"v_",2) == 0) { - if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE; - else if (arg[iarg][0] == 'f') which[nvalues] = FIX; - else if (arg[iarg][0] == 'v') which[nvalues] = VARIABLE; + } else { + ArgInfo argi(arg[iarg]); - int n = strlen(arg[iarg]); - char *suffix = new char[n]; - strcpy(suffix,&arg[iarg][2]); + if (argi.get_type() == ArgInfo::NONE) break; + if ((argi.get_type() == ArgInfo::UNKNOWN) || (argi.get_dim() > 1)) + error->all(FLERR,"Invalid fix ave/chunk command"); - char *ptr = strchr(suffix,'['); - if (ptr) { - if (suffix[strlen(suffix)-1] != ']') - error->all(FLERR,"Illegal fix ave/chunk command"); - argindex[nvalues] = atoi(ptr+1); - *ptr = '\0'; - } else argindex[nvalues] = 0; + which[nvalues] = argi.get_type(); + argindex[nvalues] = argi.get_index1(); + ids[nvalues] = argi.copy_name(); - n = strlen(suffix) + 1; - ids[nvalues] = new char[n]; - strcpy(ids[nvalues],suffix); nvalues++; - delete [] suffix; - - } else break; - + } iarg++; } @@ -285,7 +269,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : } for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/chunk does not exist"); @@ -304,7 +288,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/chunk compute vector is accessed out-of-range"); - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/chunk does not exist"); @@ -319,7 +303,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : "Fix ave/chunk fix does not calculate a per-atom array"); if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols) error->all(FLERR,"Fix ave/chunk fix vector is accessed out-of-range"); - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/chunk does not exist"); @@ -514,13 +498,13 @@ void FixAveChunk::init() } for (int m = 0; m < nvalues; m++) { - if (which[m] == COMPUTE) { + if (which[m] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[m]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/chunk does not exist"); value2index[m] = icompute; - } else if (which[m] == FIX) { + } else if (which[m] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[m]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/chunk does not exist"); @@ -530,7 +514,7 @@ void FixAveChunk::init() error->all(FLERR, "Fix for fix ave/chunk not computed at compatible time"); - } else if (which[m] == VARIABLE) { + } else if (which[m] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[m]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/chunk does not exist"); @@ -656,9 +640,9 @@ void FixAveChunk::end_of_step() // V,F adds velocities,forces to values - if (which[m] == V || which[m] == F) { + if (which[m] == ArgInfo::V || which[m] == ArgInfo::F) { double **attribute; - if (which[m] == V) attribute = atom->v; + if (which[m] == ArgInfo::V) attribute = atom->v; else attribute = atom->f; for (i = 0; i < nlocal; i++) @@ -669,7 +653,7 @@ void FixAveChunk::end_of_step() // DENSITY_NUMBER adds 1 to values - } else if (which[m] == DENSITY_NUMBER) { + } else if (which[m] == ArgInfo::DENSITY_NUMBER) { for (i = 0; i < nlocal; i++) if (mask[i] & groupbit && ichunk[i] > 0) { @@ -679,7 +663,8 @@ void FixAveChunk::end_of_step() // DENSITY_MASS or MASS adds mass to values - } else if (which[m] == DENSITY_MASS || which[m] == MASS) { + } else if ((which[m] == ArgInfo::DENSITY_MASS) + || (which[m] == ArgInfo::MASS)) { int *type = atom->type; double *mass = atom->mass; double *rmass = atom->rmass; @@ -701,7 +686,7 @@ void FixAveChunk::end_of_step() // TEMPERATURE adds KE to values // subtract and restore velocity bias if requested - } else if (which[m] == TEMPERATURE) { + } else if (which[m] == ArgInfo::TEMPERATURE) { if (biasflag) { if (tbias->invoked_scalar != ntimestep) tbias->compute_scalar(); @@ -735,7 +720,7 @@ void FixAveChunk::end_of_step() // COMPUTE adds its scalar or vector component to values // invoke compute if not previously invoked - } else if (which[m] == COMPUTE) { + } else if (which[m] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[n]; if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) { compute->compute_peratom(); @@ -755,7 +740,7 @@ void FixAveChunk::end_of_step() // FIX adds its scalar or vector component to values // access fix fields, guaranteed to be ready - } else if (which[m] == FIX) { + } else if (which[m] == ArgInfo::FIX) { double *vector = modify->fix[n]->vector_atom; double **array = modify->fix[n]->array_atom; int jm1 = j - 1; @@ -770,7 +755,7 @@ void FixAveChunk::end_of_step() // VARIABLE adds its per-atom quantities to values // evaluate atom-style variable - } else if (which[m] == VARIABLE) { + } else if (which[m] == ArgInfo::VARIABLE) { if (atom->nmax > maxvar) { maxvar = atom->nmax; memory->destroy(varatom); @@ -824,14 +809,14 @@ void FixAveChunk::end_of_step() for (m = 0; m < nchunk; m++) { if (count_many[m] > 0.0) for (j = 0; j < nvalues; j++) { - if (which[j] == TEMPERATURE) { + if (which[j] == ArgInfo::TEMPERATURE) { values_many[m][j] += mvv2e*values_one[m][j] / ((cdof + adof*count_many[m]) * boltz); - } else if (which[j] == DENSITY_NUMBER) { + } else if (which[j] == ArgInfo::DENSITY_NUMBER) { if (volflag == SCALAR) values_one[m][j] /= chunk_volume_scalar; else values_one[m][j] /= chunk_volume_vec[m]; values_many[m][j] += values_one[m][j]; - } else if (which[j] == DENSITY_MASS) { + } else if (which[j] == ArgInfo::DENSITY_MASS) { if (volflag == SCALAR) values_one[m][j] /= chunk_volume_scalar; else values_one[m][j] /= chunk_volume_vec[m]; values_many[m][j] += mv2d*values_one[m][j]; @@ -894,13 +879,13 @@ void FixAveChunk::end_of_step() for (m = 0; m < nchunk; m++) { if (count_sum[m] > 0.0) for (j = 0; j < nvalues; j++) { - if (which[j] == TEMPERATURE) { + if (which[j] == ArgInfo::TEMPERATURE) { values_sum[m][j] *= mvv2e / ((cdof + adof*count_sum[m]) * boltz); - } else if (which[j] == DENSITY_NUMBER) { + } else if (which[j] == ArgInfo::DENSITY_NUMBER) { if (volflag == SCALAR) values_sum[m][j] /= chunk_volume_scalar; else values_sum[m][j] /= chunk_volume_vec[m]; values_sum[m][j] /= repeat; - } else if (which[j] == DENSITY_MASS) { + } else if (which[j] == ArgInfo::DENSITY_MASS) { if (volflag == SCALAR) values_sum[m][j] /= chunk_volume_scalar; else values_sum[m][j] /= chunk_volume_vec[m]; values_sum[m][j] *= mv2d/repeat; diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 1cda758e5f..de0cc0da6f 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -19,6 +19,7 @@ #include "fix_ave_correlate.h" +#include "arg_info.h" #include "compute.h" #include "error.h" #include "input.h" @@ -33,11 +34,9 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{COMPUTE,FIX,VARIABLE}; enum{ONE,RUNNING}; enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; - /* ---------------------------------------------------------------------- */ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): @@ -74,33 +73,18 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): int iarg = 0; while (iarg < nargnew) { - if (strncmp(arg[iarg],"c_",2) == 0 || - strncmp(arg[iarg],"f_",2) == 0 || - strncmp(arg[iarg],"v_",2) == 0) { - if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE; - else if (arg[iarg][0] == 'f') which[nvalues] = FIX; - else if (arg[iarg][0] == 'v') which[nvalues] = VARIABLE; + ArgInfo argi(arg[iarg]); + + if (argi.get_type() == ArgInfo::NONE) break; + if ((argi.get_type() == ArgInfo::UNKNOWN) || (argi.get_dim() > 1)) + error->all(FLERR,"Invalid fix ave/correlate command"); - int n = strlen(arg[iarg]); - char *suffix = new char[n]; - strcpy(suffix,&arg[iarg][2]); + which[nvalues] = argi.get_type(); + argindex[nvalues] = argi.get_index1(); + ids[nvalues] = argi.copy_name(); - char *ptr = strchr(suffix,'['); - if (ptr) { - if (suffix[strlen(suffix)-1] != ']') - error->all(FLERR,"Illegal fix ave/correlate command"); - argindex[nvalues] = atoi(ptr+1); - *ptr = '\0'; - } else argindex[nvalues] = 0; - - n = strlen(suffix) + 1; - ids[nvalues] = new char[n]; - strcpy(ids[nvalues],suffix); - delete [] suffix; - - nvalues++; - iarg++; - } else break; + nvalues++; + iarg++; } // optional args @@ -189,7 +173,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): error->all(FLERR,"Illegal fix ave/correlate command"); for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/correlate does not exist"); @@ -203,7 +187,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): error->all(FLERR,"Fix ave/correlate compute vector " "is accessed out-of-range"); - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/correlate does not exist"); @@ -218,7 +202,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): error->all(FLERR,"Fix for fix ave/correlate " "not computed at compatible time"); - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/correlate does not exist"); @@ -364,19 +348,19 @@ void FixAveCorrelate::init() // set current indices for all computes,fixes,variables for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/correlate does not exist"); value2index[i] = icompute; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/correlate does not exist"); value2index[i] = ifix; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/correlate does not exist"); @@ -435,7 +419,7 @@ void FixAveCorrelate::end_of_step() // invoke compute if not previously invoked - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[m]; if (argindex[i] == 0) { @@ -454,7 +438,7 @@ void FixAveCorrelate::end_of_step() // access fix fields, guaranteed to be ready - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { if (argindex[i] == 0) scalar = modify->fix[m]->compute_scalar(); else @@ -462,7 +446,7 @@ void FixAveCorrelate::end_of_step() // evaluate equal-style or vector-style variable - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { if (argindex[i] == 0) scalar = input->variable->compute_equal(m); else { diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 438cc5a0e7..cad509e165 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -13,6 +13,7 @@ #include "fix_ave_histo.h" +#include "arg_info.h" #include "atom.h" #include "compute.h" #include "error.h" @@ -28,7 +29,6 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{X,V,F,COMPUTE,FIX,VARIABLE}; enum{ONE,RUNNING}; enum{SCALAR,VECTOR,WINDOW}; enum{DEFAULT,GLOBAL,PERATOM,LOCAL}; @@ -113,67 +113,56 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvalues; i++) { if (strcmp(arg[i],"x") == 0) { - which[i] = X; + which[i] = ArgInfo::X; argindex[i] = 0; ids[i] = nullptr; } else if (strcmp(arg[i],"y") == 0) { - which[i] = X; + which[i] = ArgInfo::X; argindex[i] = 1; ids[i] = nullptr; } else if (strcmp(arg[i],"z") == 0) { - which[i] = X; + which[i] = ArgInfo::X; argindex[i] = 2; ids[i] = nullptr; } else if (strcmp(arg[i],"vx") == 0) { - which[i] = V; + which[i] = ArgInfo::V; argindex[i] = 0; ids[i] = nullptr; } else if (strcmp(arg[i],"vy") == 0) { - which[i] = V; + which[i] = ArgInfo::V; argindex[i] = 1; ids[i] = nullptr; } else if (strcmp(arg[i],"vz") == 0) { - which[i] = V; + which[i] = ArgInfo::V; argindex[i] = 2; ids[i] = nullptr; } else if (strcmp(arg[i],"fx") == 0) { - which[i] = F; + which[i] = ArgInfo::F; argindex[i] = 0; ids[i] = nullptr; } else if (strcmp(arg[i],"fy") == 0) { - which[i] = F; + which[i] = ArgInfo::F; argindex[i] = 1; ids[i] = nullptr; } else if (strcmp(arg[i],"fz") == 0) { - which[i] = F; + which[i] = ArgInfo::F; argindex[i] = 2; ids[i] = nullptr; - } else if ((strncmp(arg[i],"c_",2) == 0) || - (strncmp(arg[i],"f_",2) == 0) || - (strncmp(arg[i],"v_",2) == 0)) { - if (arg[i][0] == 'c') which[i] = COMPUTE; - else if (arg[i][0] == 'f') which[i] = FIX; - else if (arg[i][0] == 'v') which[i] = VARIABLE; + } else { + ArgInfo argi(arg[iarg]); - int n = strlen(arg[i]); - char *suffix = new char[n]; - strcpy(suffix,&arg[i][2]); + if (argi.get_type() == ArgInfo::NONE) break; + if ((argi.get_type() == ArgInfo::UNKNOWN) || (argi.get_dim() > 1)) + error->all(FLERR,"Invalid fix ave/histo command"); - char *ptr = strchr(suffix,'['); - if (ptr) { - if (suffix[strlen(suffix)-1] != ']') - error->all(FLERR,"Illegal fix ave/histo command"); - argindex[i] = atoi(ptr+1); - *ptr = '\0'; - } else argindex[i] = 0; + which[nvalues] = argi.get_type(); + argindex[nvalues] = argi.get_index1(); + ids[nvalues] = argi.copy_name(); - n = strlen(suffix) + 1; - ids[i] = new char[n]; - strcpy(ids[i],suffix); - delete [] suffix; + nvalues++; } } @@ -201,10 +190,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvalues; i++) { kindglobal = kindperatom = kindlocal = 0; - if (which[i] == X || which[i] == V || which[i] == F) { + if ((which[i] == ArgInfo::X) || (which[i] == ArgInfo::V) + || (which[i] == ArgInfo::F)) { kindperatom = 1; - } else if (which[i] == COMPUTE) { + } else if (which[i] == ArgInfo::COMPUTE) { int c_id = modify->find_compute(ids[i]); if (c_id < 0) error->all(FLERR,"Fix ave/histo input is invalid compute"); Compute *compute = modify->compute[c_id]; @@ -214,7 +204,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (compute->peratom_flag) kindperatom = 1; if (compute->local_flag) kindlocal = 1; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int f_id = modify->find_fix(ids[i]); if (f_id < 0) error->all(FLERR,"Fix ave/histo input is invalid fix"); Fix *fix = modify->fix[f_id]; @@ -224,7 +214,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (fix->peratom_flag) kindperatom = 1; if (fix->local_flag) kindlocal = 1; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Fix ave/histo input is invalid variable"); @@ -262,7 +252,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix ave/histo cannot input local values in scalar mode"); for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE && kind == GLOBAL && mode == SCALAR) { + if (which[i] == ArgInfo::COMPUTE && kind == GLOBAL && mode == SCALAR) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/histo does not exist"); @@ -276,7 +266,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/histo compute vector is accessed out-of-range"); - } else if (which[i] == COMPUTE && kind == GLOBAL && mode == VECTOR) { + } else if (which[i] == ArgInfo::COMPUTE && kind == GLOBAL && mode == VECTOR) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/histo does not exist"); @@ -291,7 +281,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/histo compute array is accessed out-of-range"); - } else if (which[i] == COMPUTE && kind == PERATOM) { + } else if (which[i] == ArgInfo::COMPUTE && kind == PERATOM) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/histo does not exist"); @@ -310,7 +300,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/histo compute array is accessed out-of-range"); - } else if (which[i] == COMPUTE && kind == LOCAL) { + } else if (which[i] == ArgInfo::COMPUTE && kind == LOCAL) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/histo does not exist"); @@ -329,7 +319,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix ave/histo compute array is accessed out-of-range"); - } else if (which[i] == FIX && kind == GLOBAL && mode == SCALAR) { + } else if (which[i] == ArgInfo::FIX && kind == GLOBAL && mode == SCALAR) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/histo does not exist"); @@ -345,7 +335,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix for fix ave/histo not computed at compatible time"); - } else if (which[i] == FIX && kind == GLOBAL && mode == VECTOR) { + } else if (which[i] == ArgInfo::FIX && kind == GLOBAL && mode == VECTOR) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/histo does not exist"); @@ -360,7 +350,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix for fix ave/histo not computed at compatible time"); - } else if (which[i] == FIX && kind == PERATOM) { + } else if (which[i] == ArgInfo::FIX && kind == PERATOM) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/histo does not exist"); @@ -381,7 +371,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix for fix ave/histo not computed at compatible time"); - } else if (which[i] == FIX && kind == LOCAL) { + } else if (which[i] == ArgInfo::FIX && kind == LOCAL) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/histo does not exist"); @@ -401,7 +391,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix for fix ave/histo not computed at compatible time"); - } else if (which[i] == VARIABLE && kind == GLOBAL && mode == SCALAR) { + } else if (which[i] == ArgInfo::VARIABLE && kind == GLOBAL && mode == SCALAR) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/histo does not exist"); @@ -410,7 +400,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (argindex[i] && input->variable->vectorstyle(ivariable) == 0) error->all(FLERR,"Fix ave/histo variable is not vector-style variable"); - } else if (which[i] == VARIABLE && kind == GLOBAL && mode == VECTOR) { + } else if (which[i] == ArgInfo::VARIABLE && kind == GLOBAL && mode == VECTOR) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/histo does not exist"); @@ -419,7 +409,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (argindex[i]) error->all(FLERR,"Fix ave/histo variable cannot be indexed"); - } else if (which[i] == VARIABLE && kind == PERATOM) { + } else if (which[i] == ArgInfo::VARIABLE && kind == PERATOM) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/histo does not exist"); @@ -546,19 +536,19 @@ void FixAveHisto::init() // set current indices for all computes,fixes,variables for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/histo does not exist"); value2index[i] = icompute; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/histo does not exist"); value2index[i] = ifix; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/histo does not exist"); @@ -619,16 +609,16 @@ void FixAveHisto::end_of_step() // atom attributes - if (which[i] == X) + if (which[i] == ArgInfo::X) bin_atoms(&atom->x[0][j],3); - else if (which[i] == V) + else if (which[i] == ArgInfo::V) bin_atoms(&atom->v[0][j],3); - else if (which[i] == F) + else if (which[i] == ArgInfo::F) bin_atoms(&atom->f[0][j],3); // invoke compute if not previously invoked - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[m]; if (kind == GLOBAL && mode == SCALAR) { @@ -686,7 +676,7 @@ void FixAveHisto::end_of_step() // access fix fields, guaranteed to be ready - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { Fix *fix = modify->fix[m]; @@ -717,7 +707,7 @@ void FixAveHisto::end_of_step() // evaluate equal-style or vector-style or atom-style variable - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { if (kind == GLOBAL && mode == SCALAR) { if (j == 0) bin_one(input->variable->compute_equal(m)); else { @@ -732,7 +722,7 @@ void FixAveHisto::end_of_step() int nvec = input->variable->compute_vector(m,&varvec); bin_vector(nvec,varvec,1); - } else if (which[i] == VARIABLE && kind == PERATOM) { + } else if (which[i] == ArgInfo::VARIABLE && kind == PERATOM) { if (atom->nmax > maxatom) { memory->destroy(vector); maxatom = atom->nmax; diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 5ee46b42f6..e51c86a5e1 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -17,6 +17,7 @@ #include "fix_ave_time.h" +#include "arg_info.h" #include "compute.h" #include "error.h" #include "input.h" @@ -31,11 +32,9 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{COMPUTE,FIX,VARIABLE}; enum{ONE,RUNNING,WINDOW}; enum{SCALAR,VECTOR}; - /* ---------------------------------------------------------------------- */ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : @@ -97,26 +96,16 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : ids = new char*[nvalues]; for (int i = 0; i < nvalues; i++) { - if (arg[i][0] == 'c') which[i] = COMPUTE; - else if (arg[i][0] == 'f') which[i] = FIX; - else if (arg[i][0] == 'v') which[i] = VARIABLE; + ArgInfo argi(arg[i]); - int n = strlen(arg[i]); - char *suffix = new char[n]; - strcpy(suffix,&arg[i][2]); + if ((argi.get_type() == ArgInfo::NONE) + || (argi.get_type() == ArgInfo::UNKNOWN) + || (argi.get_dim() > 1)) + error->all(FLERR,"Invalid fix ave/time command"); - char *ptr = strchr(suffix,'['); - if (ptr) { - if (suffix[strlen(suffix)-1] != ']') - error->all(FLERR,"Illegal fix ave/time command"); - argindex[i] = atoi(ptr+1); - *ptr = '\0'; - } else argindex[i] = 0; - - n = strlen(suffix) + 1; - ids[i] = new char[n]; - strcpy(ids[i],suffix); - delete [] suffix; + which[i] = argi.get_type(); + argindex[i] = argi.get_index1(); + ids[i] = argi.copy_name(); } // set off columns now that nvalues is finalized @@ -142,7 +131,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvalues; i++) { varlen[i] = 0; - if (which[i] == COMPUTE && mode == SCALAR) { + if (which[i] == ArgInfo::COMPUTE && mode == SCALAR) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/time does not exist"); @@ -157,7 +146,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : if (argindex[i] && modify->compute[icompute]->size_vector_variable) varlen[i] = 1; - } else if (which[i] == COMPUTE && mode == VECTOR) { + } else if (which[i] == ArgInfo::COMPUTE && mode == VECTOR) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/time does not exist"); @@ -173,7 +162,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : if (argindex[i] && modify->compute[icompute]->size_array_rows_variable) varlen[i] = 1; - } else if (which[i] == FIX && mode == SCALAR) { + } else if (which[i] == ArgInfo::FIX && mode == SCALAR) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/time does not exist"); @@ -189,7 +178,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix for fix ave/time not computed at compatible time"); - } else if (which[i] == FIX && mode == VECTOR) { + } else if (which[i] == ArgInfo::FIX && mode == VECTOR) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/time does not exist"); @@ -205,7 +194,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Fix for fix ave/time not computed at compatible time"); - } else if (which[i] == VARIABLE && mode == SCALAR) { + } else if (which[i] == ArgInfo::VARIABLE && mode == SCALAR) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/time does not exist"); @@ -214,7 +203,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : if (argindex[i] && input->variable->vectorstyle(ivariable) == 0) error->all(FLERR,"Fix ave/time variable is not vector-style variable"); - } else if (which[i] == VARIABLE && mode == VECTOR) { + } else if (which[i] == ArgInfo::VARIABLE && mode == VECTOR) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/time does not exist"); @@ -254,7 +243,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : if (any_variable_length && (nrepeat > 1 || ave == RUNNING || ave == WINDOW)) { for (int i = 0; i < nvalues; i++) - if (varlen[i] && which[i] == COMPUTE) { + if (varlen[i] && which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); modify->compute[icompute]->lock_enable(); } @@ -323,17 +312,17 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : if (mode == SCALAR) { if (nvalues == 1) { scalar_flag = 1; - if (which[0] == COMPUTE) { + if (which[0] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[modify->find_compute(ids[0])]; if (argindex[0] == 0) extscalar = compute->extscalar; else if (compute->extvector >= 0) extscalar = compute->extvector; else extscalar = compute->extlist[argindex[0]-1]; - } else if (which[0] == FIX) { + } else if (which[0] == ArgInfo::FIX) { Fix *fix = modify->fix[modify->find_fix(ids[0])]; if (argindex[0] == 0) extscalar = fix->extscalar; else if (fix->extvector >= 0) extscalar = fix->extvector; else extscalar = fix->extlist[argindex[0]-1]; - } else if (which[0] == VARIABLE) { + } else if (which[0] == ArgInfo::VARIABLE) { extscalar = 0; } @@ -343,17 +332,17 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : extvector = -1; extlist = new int[nvalues]; for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[modify->find_compute(ids[i])]; if (argindex[i] == 0) extlist[i] = compute->extscalar; else if (compute->extvector >= 0) extlist[i] = compute->extvector; else extlist[i] = compute->extlist[argindex[i]-1]; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { Fix *fix = modify->fix[modify->find_fix(ids[i])]; if (argindex[i] == 0) extlist[i] = fix->extscalar; else if (fix->extvector >= 0) extlist[i] = fix->extvector; else extlist[i] = fix->extlist[argindex[i]-1]; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { extlist[i] = 0; } } @@ -364,7 +353,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : vector_flag = 1; size_vector = nrows; if (all_variable_length) size_vector_variable = 1; - if (which[0] == COMPUTE) { + if (which[0] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[modify->find_compute(ids[0])]; if (argindex[0] == 0) { extvector = compute->extvector; @@ -373,7 +362,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nrows; i++) extlist[i] = compute->extlist[i]; } } else extvector = compute->extarray; - } else if (which[0] == FIX) { + } else if (which[0] == ArgInfo::FIX) { Fix *fix = modify->fix[modify->find_fix(ids[0])]; if (argindex[0] == 0) { extvector = fix->extvector; @@ -382,7 +371,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nrows; i++) extlist[i] = fix->extlist[i]; } } else extvector = fix->extarray; - } else if (which[0] == VARIABLE) { + } else if (which[0] == ArgInfo::VARIABLE) { extlist = new int[nrows]; for (int i = 0; i < nrows; i++) extlist[i] = 0; } @@ -394,15 +383,15 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : if (all_variable_length) size_array_rows_variable = 1; int value; for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[modify->find_compute(ids[i])]; if (argindex[i] == 0) value = compute->extvector; else value = compute->extarray; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { Fix *fix = modify->fix[modify->find_fix(ids[i])]; if (argindex[i] == 0) value = fix->extvector; else value = fix->extarray; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { value = 0; } if (value == -1) @@ -495,17 +484,17 @@ void FixAveTime::init() // set current indices for all computes,fixes,variables for (int i = 0; i < nvalues; i++) { - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); if (icompute < 0) error->all(FLERR,"Compute ID for fix ave/time does not exist"); value2index[i] = icompute; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[i]); if (ifix < 0) error->all(FLERR,"Fix ID for fix ave/time does not exist"); value2index[i] = ifix; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); if (ivariable < 0) error->all(FLERR,"Variable name for fix ave/time does not exist"); @@ -580,7 +569,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep) // invoke compute if not previously invoked // insure no out-of-range access to variable-length compute vector - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[m]; if (argindex[i] == 0) { @@ -600,7 +589,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep) // access fix fields, guaranteed to be ready - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { if (argindex[i] == 0) scalar = modify->fix[m]->compute_scalar(); else @@ -609,7 +598,7 @@ void FixAveTime::invoke_scalar(bigint ntimestep) // evaluate equal-style or vector-style variable // insure no out-of-range access to vector-style variable - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { if (argindex[i] == 0) scalar = input->variable->compute_equal(m); else { @@ -737,7 +726,7 @@ void FixAveTime::invoke_vector(bigint ntimestep) bigint ntimestep = update->ntimestep; int lockforever_flag = 0; for (i = 0; i < nvalues; i++) { - if (!varlen[i] || which[i] != COMPUTE) continue; + if (!varlen[i] || which[i] != ArgInfo::COMPUTE) continue; if (nrepeat > 1 && ave == ONE) { Compute *compute = modify->compute[value2index[i]]; compute->lock(this,ntimestep,ntimestep+static_cast(nrepeat-1)*nevery); @@ -764,7 +753,7 @@ void FixAveTime::invoke_vector(bigint ntimestep) // invoke compute if not previously invoked - if (which[j] == COMPUTE) { + if (which[j] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[m]; if (argindex[j] == 0) { @@ -789,7 +778,7 @@ void FixAveTime::invoke_vector(bigint ntimestep) // access fix fields, guaranteed to be ready - } else if (which[j] == FIX) { + } else if (which[j] == ArgInfo::FIX) { Fix *fix = modify->fix[m]; if (argindex[j] == 0) for (i = 0; i < nrows; i++) @@ -804,7 +793,7 @@ void FixAveTime::invoke_vector(bigint ntimestep) // insure nvec = nrows, else error // could be different on this timestep than when column_length(1) set nrows - } else if (which[j] == VARIABLE) { + } else if (which[j] == ArgInfo::VARIABLE) { double *varvec; int nvec = input->variable->compute_vector(m,&varvec); if (nvec != nrows) @@ -926,16 +915,16 @@ int FixAveTime::column_length(int dynamic) length = 0; for (int i = 0; i < nvalues; i++) { if (varlen[i]) continue; - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); if (argindex[i] == 0) lengthone = modify->compute[icompute]->size_vector; else lengthone = modify->compute[icompute]->size_array_rows; - } else if (which[i] == FIX) { + } else if (which[i] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[i]); if (argindex[i] == 0) lengthone = modify->fix[ifix]->size_vector; else lengthone = modify->fix[ifix]->size_array_rows; - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { // variables are always varlen = 1, so dynamic } if (length == 0) length = lengthone; @@ -954,10 +943,10 @@ int FixAveTime::column_length(int dynamic) for (int i = 0; i < nvalues; i++) { if (varlen[i] == 0) continue; m = value2index[i]; - if (which[i] == COMPUTE) { + if (which[i] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[m]; lengthone = compute->lock_length(); - } else if (which[i] == VARIABLE) { + } else if (which[i] == ArgInfo::VARIABLE) { double *varvec; lengthone = input->variable->compute_vector(m,&varvec); } diff --git a/src/fix_controller.cpp b/src/fix_controller.cpp index d9b927a39c..0e2530de41 100644 --- a/src/fix_controller.cpp +++ b/src/fix_controller.cpp @@ -13,6 +13,7 @@ #include "fix_controller.h" +#include "arg_info.h" #include "compute.h" #include "error.h" #include "input.h" @@ -25,9 +26,6 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{COMPUTE,FIX,VARIABLE}; - - /* ---------------------------------------------------------------------- */ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : @@ -51,37 +49,19 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : // process variable arg - int iarg = 8; - if (strncmp(arg[iarg],"c_",2) == 0 || - strncmp(arg[iarg],"f_",2) == 0 || - strncmp(arg[iarg],"v_",2) == 0) { - if (arg[iarg][0] == 'c') pvwhich = COMPUTE; - else if (arg[iarg][0] == 'f') pvwhich = FIX; - else if (arg[iarg][0] == 'v') pvwhich = VARIABLE; + ArgInfo argi(arg[8]); + if ((argi.get_type() == ArgInfo::UNKNOWN) + || (argi.get_type() == ArgInfo::NONE) + || (argi.get_dim() != 0)) + error->all(FLERR,"Illegal fix controller command"); - int n = strlen(arg[iarg]); - char *suffix = new char[n]; - strcpy(suffix,&arg[iarg][2]); - - char *ptr = strchr(suffix,'['); - if (ptr) { - if (suffix[strlen(suffix)-1] != ']') - error->all(FLERR,"Illegal fix controller command"); - pvindex = atoi(ptr+1); - *ptr = '\0'; - } else pvindex = 0; - - n = strlen(suffix) + 1; - pvID = new char[n]; - strcpy(pvID,suffix); - delete [] suffix; - - iarg++; - - } else error->all(FLERR,"Illegal fix controller command"); + pvwhich = argi.get_type(); + pvindex = argi.get_index1(); + pvID = argi.copy_name(); // setpoint arg + int iarg=9; setpoint = utils::numeric(FLERR,arg[iarg],false,lmp); iarg++; @@ -93,7 +73,7 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : // error check - if (pvwhich == COMPUTE) { + if (pvwhich == ArgInfo::COMPUTE) { int icompute = modify->find_compute(pvID); if (icompute < 0) error->all(FLERR,"Compute ID for fix controller does not exist"); @@ -106,7 +86,7 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : if (pvindex && pvindex > c->size_vector) error->all(FLERR,"Fix controller compute vector is " "accessed out-of-range"); - } else if (pvwhich == FIX) { + } else if (pvwhich == ArgInfo::FIX) { int ifix = modify->find_fix(pvID); if (ifix < 0) error->all(FLERR,"Fix ID for fix controller does not exist"); @@ -118,7 +98,7 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : "calculate a global scalar or vector"); if (pvindex && pvindex > f->size_vector) error->all(FLERR,"Fix controller fix vector is accessed out-of-range"); - } else if (pvwhich == VARIABLE) { + } else if (pvwhich == ArgInfo::VARIABLE) { int ivariable = input->variable->find(pvID); if (ivariable < 0) error->all(FLERR,"Variable name for fix controller does not exist"); @@ -157,18 +137,18 @@ int FixController::setmask() void FixController::init() { - if (pvwhich == COMPUTE) { + if (pvwhich == ArgInfo::COMPUTE) { int icompute = modify->find_compute(pvID); if (icompute < 0) error->all(FLERR,"Compute ID for fix controller does not exist"); pcompute = modify->compute[icompute]; - } else if (pvwhich == FIX) { + } else if (pvwhich == ArgInfo::FIX) { int ifix = modify->find_fix(pvID); if (ifix < 0) error->all(FLERR,"Fix ID for fix controller does not exist"); pfix = modify->fix[ifix]; - } else if (pvwhich == VARIABLE) { + } else if (pvwhich == ArgInfo::VARIABLE) { pvar = input->variable->find(pvID); if (pvar < 0) error->all(FLERR,"Variable name for fix controller does not exist"); @@ -196,7 +176,7 @@ void FixController::end_of_step() double current = 0.0; - if (pvwhich == COMPUTE) { + if (pvwhich == ArgInfo::COMPUTE) { if (pvindex == 0) { if (!(pcompute->invoked_flag & Compute::INVOKED_SCALAR)) { pcompute->compute_scalar(); @@ -213,13 +193,13 @@ void FixController::end_of_step() // access fix field, guaranteed to be ready - } else if (pvwhich == FIX) { + } else if (pvwhich == ArgInfo::FIX) { if (pvindex == 0) current = pfix->compute_scalar(); else current = pfix->compute_vector(pvindex-1); // evaluate equal-style variable - } else if (pvwhich == VARIABLE) { + } else if (pvwhich == ArgInfo::VARIABLE) { current = input->variable->compute_equal(pvar); }