diff --git a/src/AMOEBA/amoeba_convolution.h b/src/AMOEBA/amoeba_convolution.h index 60825bb8b6..c89d214cc5 100644 --- a/src/AMOEBA/amoeba_convolution.h +++ b/src/AMOEBA/amoeba_convolution.h @@ -14,8 +14,8 @@ #ifndef LMP_AMOEBA_CONVOLUTION_H #define LMP_AMOEBA_CONVOLUTION_H -#include "pointers.h" #include "lmpfftsettings.h" +#include "pointers.h" namespace LAMMPS_NS { @@ -27,7 +27,7 @@ class AmoebaConvolution : protected Pointers { int nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in; int nxlo_out, nxhi_out, nylo_out, nyhi_out, nzlo_out, nzhi_out; int nxlo_fft, nxhi_fft, nylo_fft, nyhi_fft, nzlo_fft, nzhi_fft; - bigint nfft_global; // nx * ny * nz + bigint nfft_global; // nx * ny * nz FFT_SCALAR *grid_brick_start; // lower left corner of (c)grid_brick data AmoebaConvolution(class LAMMPS *, class Pair *, int, int, int, int, int); @@ -40,11 +40,11 @@ class AmoebaConvolution : protected Pointers { double time_fft; protected: - int which; // caller name for convolution being performed - int flag3d; // 1 if using 3d grid_brick, 0 for 4d cgrid_brick - int nbrick_owned; // owned grid points in brick decomp - int nbrick_ghosts; // owned + ghost brick grid points - int ngrid_either; // max of nbrick_owned or nfft_owned + int which; // caller name for convolution being performed + int flag3d; // 1 if using 3d grid_brick, 0 for 4d cgrid_brick + int nbrick_owned; // owned grid points in brick decomp + int nbrick_ghosts; // owned + ghost brick grid points + int ngrid_either; // max of nbrick_owned or nfft_owned class Pair *amoeba; class FFT3d *fft1, *fft2; diff --git a/src/ELECTRODE/electrode_vector.cpp b/src/ELECTRODE/electrode_vector.cpp index fc2cca5e46..1ffd8c1317 100644 --- a/src/ELECTRODE/electrode_vector.cpp +++ b/src/ELECTRODE/electrode_vector.cpp @@ -37,8 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; ElectrodeVector::ElectrodeVector(LAMMPS *lmp, int sensor_group, int source_group, double eta, - bool invert_source) : - Pointers(lmp) + bool invert_source) : Pointers(lmp) { igroup = sensor_group; // group of all atoms at which we calculate potential this->source_group = source_group; // group of all atoms influencing potential diff --git a/src/ELECTRODE/fix_electrode_conp.cpp b/src/ELECTRODE/fix_electrode_conp.cpp index 5e92af7a82..565a750af5 100644 --- a/src/ELECTRODE/fix_electrode_conp.cpp +++ b/src/ELECTRODE/fix_electrode_conp.cpp @@ -931,7 +931,8 @@ void FixElectrodeConp::update_charges() dot_old = dot_new; } recompute_potential(std::move(b), q_local); - if ((delta > cg_threshold) && (comm->me == 0)) error->warning(FLERR, "CG threshold not reached"); + if ((delta > cg_threshold) && (comm->me == 0)) + error->warning(FLERR, "CG threshold not reached"); } else { error->all(FLERR, "This algorithm is not implemented, yet"); } diff --git a/src/neighbor.h b/src/neighbor.h index cec6ae45c1..5ac40635b5 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -212,7 +212,6 @@ class Neighbor : protected Pointers { int npair_perpetual; // # of perpetual NeighPair classes int *slist; // indices of them in neigh_stencil int *plist; // indices of them in neigh_pair - int npair_occasional; // # of occasional NeighPair classes int *olist; // indices of them in neigh_pair diff --git a/src/read_data.cpp b/src/read_data.cpp index d83456e985..29696bd62d 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -535,7 +535,7 @@ void ReadData::command(int narg, char **arg) if (domain->dimension == 2) { if (triclinic_general == 0) { if (boxlo[2] >= 0.0 || boxhi[2] <= 0.0) - error->all(FLERR,"Read_data zlo/zhi for 2d simulation must straddle 0.0"); + error->all(FLERR, "Read_data zlo/zhi for 2d simulation must straddle 0.0"); } else if (triclinic_general == 1) { if (cvec[0] != 0.0 || cvec[1] != 0.0 || cvec[2] != 1.0 || abc_origin[2] != -0.5) error->all(FLERR,"Read_data cvec and/or abc_origin is invalid for " @@ -594,12 +594,12 @@ void ReadData::command(int narg, char **arg) domain->yz = yz; } - // general triclinic box - // define_general_triclinic() converts - // ABC edge vectors + abc_origin to restricted triclinic + // general triclinic box + // define_general_triclinic() converts + // ABC edge vectors + abc_origin to restricted triclinic } else if (triclinic_general) { - domain->define_general_triclinic(avec,bvec,cvec,abc_origin); + domain->define_general_triclinic(avec, bvec, cvec, abc_origin); } } @@ -615,7 +615,7 @@ void ReadData::command(int narg, char **arg) if (triclinic_general) { if (!domain->triclinic_general) - error->all(FLERR,"Read_data subsequent file cannot switch to general triclinic"); + error->all(FLERR, "Read_data subsequent file cannot switch to general triclinic"); int errflag = 0; if (avec[0] != domain->avec[0] || avec[1] != domain->avec[1] || avec[2] != domain->avec[2]) errflag = 1; @@ -627,22 +627,22 @@ void ReadData::command(int narg, char **arg) abc_origin[2] != domain->boxlo[2]) errflag = 1; if (errflag) - error->all(FLERR,"Read_data subsequent file ABC vectors must be same as first file"); + error->all(FLERR, "Read_data subsequent file ABC vectors must be same as first file"); if (shift[0] != 0.0 || shift[1] != 0.0 || shift[2] != 0.0) - error->all(FLERR,"Read_data subsequent file with ABC vectors cannot define shift"); + error->all(FLERR, "Read_data subsequent file with ABC vectors cannot define shift"); - // restricted triclinic - // tilt factors must match first data file + // restricted triclinic + // tilt factors must match first data file } else if (triclinic) { if (!domain->triclinic || domain->triclinic_general) - error->all(FLERR,"Read_data subsequent file cannot switch to restricted triclinic"); + error->all(FLERR, "Read_data subsequent file cannot switch to restricted triclinic"); if (xy != domain->xy || xz != domain->xz || yz != domain->yz) - error->all(FLERR,"Read_data subsequent file tilt factors must be same as first file"); + error->all(FLERR, "Read_data subsequent file tilt factors must be same as first file"); } else { if (domain->triclinic) - error->all(FLERR,"Read_data subsequent file cannot switch to orthogonal"); + error->all(FLERR, "Read_data subsequent file cannot switch to orthogonal"); } double oldboxlo[3] = {domain->boxlo[0], domain->boxlo[1], domain->boxlo[2]}; @@ -1068,8 +1068,7 @@ void ReadData::command(int narg, char **arg) // if general triclinic, perform general to restricted rotation operation // on any quantities read from data file which require it - if (triclinic_general) - atom->avec->read_data_general_to_restricted(nlocal_previous, atom->nlocal); + if (triclinic_general) atom->avec->read_data_general_to_restricted(nlocal_previous, atom->nlocal); // init per-atom fix/compute/variable values for created atoms @@ -1371,7 +1370,7 @@ void ReadData::header(int firstpass) else if (firstpass) atom->nimpropers += nimpropers; - // Atom class type settings are only set by first data file + // Atom class type settings are only set by first data file } else if (utils::strmatch(line, "^\\s*\\d+\\s+atom\\s+types\\s")) { ntypes = utils::inumeric(FLERR, words[0], false, lmp); @@ -1393,10 +1392,10 @@ void ReadData::header(int firstpass) nimpropertypes = utils::inumeric(FLERR, words[0], false, lmp); if (addflag == NONE) atom->nimpropertypes = nimpropertypes + extra_improper_types; - // these settings only used by first data file - // NOTE: these are now obsolete, we parse them to maintain backward compatibility - // the recommended way is to set them via command keywords in the input script - // if these flags are set both ways, the larger of the two values is used + // these settings only used by first data file + // NOTE: these are now obsolete, we parse them to maintain backward compatibility + // the recommended way is to set them via command keywords in the input script + // if these flags are set both ways, the larger of the two values is used } else if (strstr(line, "extra bond per atom")) { if (addflag == NONE) extra_flag_value = utils::inumeric(FLERR, words[0], false, lmp); @@ -1414,8 +1413,8 @@ void ReadData::header(int firstpass) if (addflag == NONE) extra_flag_value = utils::inumeric(FLERR, words[0], false, lmp); force->special_extra = MAX(force->special_extra, extra_flag_value); - // local copy of box info - // so can treat differently for first vs subsequent data files + // local copy of box info + // so can treat differently for first vs subsequent data files } else if (utils::strmatch(line, "^\\s*\\f+\\s+\\f+\\s+xlo\\s+xhi\\s")) { xloxhi_flag = 1; @@ -1527,8 +1526,8 @@ void ReadData::atoms() if (eof) error->all(FLERR, "Unexpected end of data file"); if (tlabelflag && !lmap->is_complete(Atom::ATOM)) error->all(FLERR, "Label map is incomplete: all types must be assigned a unique type label"); - atom->data_atoms(nchunk, buffer, id_offset, mol_offset, toffset, - shiftflag, shift, tlabelflag, lmap->lmap2lmap.atom, triclinic_general); + atom->data_atoms(nchunk, buffer, id_offset, mol_offset, toffset, shiftflag, shift, tlabelflag, + lmap->lmap2lmap.atom, triclinic_general); nread += nchunk; } diff --git a/src/region_cone.cpp b/src/region_cone.cpp index c0cb2dbee6..dc37eeefe3 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -779,8 +779,7 @@ void RegCone::shape_update() if (lostyle == VARIABLE) lo = input->variable->compute_equal(lovar); if (histyle == VARIABLE) hi = input->variable->compute_equal(hivar); - if (radiuslo == 0.0 && radiushi == 0.0) - error->all(FLERR, "dtion in region gave bad value"); + if (radiuslo == 0.0 && radiushi == 0.0) error->all(FLERR, "dtion in region gave bad value"); if (axis == 'x') { if (c1style == VARIABLE) c1 *= yscale; diff --git a/src/thermo.cpp b/src/thermo.cpp index 892de240b2..b2e4f7f934 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -575,9 +575,9 @@ void Thermo::modify_params(int narg, char **arg) iarg += 2; - } else if (strcmp(arg[iarg],"triclinic/general") == 0) { - if (iarg + 2 > narg) error->all(FLERR,"Illegal thermo_modify command"); - triclinic_general = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "triclinic/general") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + triclinic_general = utils::logical(FLERR, arg[iarg + 1], false, lmp); if (triclinic_general && !domain->triclinic_general) error->all(FLERR,"Thermo_modify triclinic/general cannot be used " "if simulation box is not general triclinic"); @@ -987,31 +987,35 @@ void Thermo::parse_fields(const std::string &str) } else if (word == "pxx") { if (triclinic_general) addfield("Pxx", &Thermo::compute_pxx_triclinic_general, FLOAT); - else addfield("Pxx", &Thermo::compute_pxx, FLOAT); + else + addfield("Pxx", &Thermo::compute_pxx, FLOAT); index_press_vector = add_compute(id_press, VECTOR); } else if (word == "pyy") { if (triclinic_general) addfield("Pyy", &Thermo::compute_pyy_triclinic_general, FLOAT); - else addfield("Pyy", &Thermo::compute_pyy, FLOAT); + else + addfield("Pyy", &Thermo::compute_pyy, FLOAT); index_press_vector = add_compute(id_press, VECTOR); } else if (word == "pzz") { if (triclinic_general) addfield("Pzz", &Thermo::compute_pzz_triclinic_general, FLOAT); - else addfield("Pzz", &Thermo::compute_pzz, FLOAT); + else + addfield("Pzz", &Thermo::compute_pzz, FLOAT); index_press_vector = add_compute(id_press, VECTOR); } else if (word == "pxy") { if (triclinic_general) addfield("Pxy", &Thermo::compute_pxy_triclinic_general, FLOAT); - else addfield("Pxy", &Thermo::compute_pxy, FLOAT); + else + addfield("Pxy", &Thermo::compute_pxy, FLOAT); index_press_vector = add_compute(id_press, VECTOR); } else if (word == "pxz") { if (triclinic_general) addfield("Pxz", &Thermo::compute_pxz_triclinic_general, FLOAT); - else addfield("Pxz", &Thermo::compute_pxz, FLOAT); + else + addfield("Pxz", &Thermo::compute_pxz, FLOAT); index_press_vector = add_compute(id_press, VECTOR); } else if (word == "pyz") { - if (triclinic_general) - addfield("Pyz", &Thermo::compute_pyz_triclinic_general, FLOAT); + if (triclinic_general) addfield("Pyz", &Thermo::compute_pyz_triclinic_general, FLOAT); addfield("Pyz", &Thermo::compute_pyz, FLOAT); index_press_vector = add_compute(id_press, VECTOR); @@ -1486,33 +1490,45 @@ int Thermo::evaluate_keyword(const std::string &word, double *answer) else if (word == "pxx") { check_press_vector(word); - if (triclinic_general) compute_pxx_triclinic_general(); - else compute_pxx(); + if (triclinic_general) + compute_pxx_triclinic_general(); + else + compute_pxx(); } else if (word == "pyy") { check_press_vector(word); - if (triclinic_general) compute_pyy_triclinic_general(); - else compute_pyy(); + if (triclinic_general) + compute_pyy_triclinic_general(); + else + compute_pyy(); } else if (word == "pzz") { check_press_vector(word); - if (triclinic_general) compute_pzz_triclinic_general(); - else compute_pzz(); + if (triclinic_general) + compute_pzz_triclinic_general(); + else + compute_pzz(); } else if (word == "pxy") { check_press_vector(word); - if (triclinic_general) compute_pxy_triclinic_general(); - else compute_pxy(); + if (triclinic_general) + compute_pxy_triclinic_general(); + else + compute_pxy(); } else if (word == "pxz") { check_press_vector(word); - if (triclinic_general) compute_pxz_triclinic_general(); - else compute_pxz(); + if (triclinic_general) + compute_pxz_triclinic_general(); + else + compute_pxz(); } else if (word == "pyz") { check_press_vector(word); - if (triclinic_general) compute_pyz_triclinic_general(); - else compute_pyz(); + if (triclinic_general) + compute_pyz_triclinic_general(); + else + compute_pyz(); } else if (word == "bonds") { compute_bonds(); @@ -1603,8 +1619,10 @@ void Thermo::compute_fix() // if index exceeds variable vector length, use a zero value // this can be useful if vector length is not known a priori - if (fix->size_vector_variable && argindex1[ifield] > fix->size_vector) dvalue = 0.0; - else dvalue = fix->compute_vector(argindex1[ifield] - 1); + if (fix->size_vector_variable && argindex1[ifield] > fix->size_vector) + dvalue = 0.0; + else + dvalue = fix->compute_vector(argindex1[ifield] - 1); if (normflag) { if (fix->extvector == 0) return; @@ -1618,8 +1636,10 @@ void Thermo::compute_fix() // if index exceeds variable array rows, use a zero value // this can be useful if array size is not known a priori - if (fix->size_array_rows_variable && argindex1[ifield] > fix->size_array_rows) dvalue = 0.0; - else dvalue = fix->compute_array(argindex1[ifield] - 1, argindex2[ifield] - 1); + if (fix->size_array_rows_variable && argindex1[ifield] > fix->size_array_rows) + dvalue = 0.0; + else + dvalue = fix->compute_array(argindex1[ifield] - 1, argindex2[ifield] - 1); if (normflag && fix->extarray) dvalue /= natoms; } } @@ -1639,8 +1659,10 @@ void Thermo::compute_variable() else { double *varvec; int nvec = input->variable->compute_vector(variables[field2index[ifield]], &varvec); - if (iarg > nvec) dvalue = 0.0; - else dvalue = varvec[iarg - 1]; + if (iarg > nvec) + dvalue = 0.0; + else + dvalue = varvec[iarg - 1]; } } @@ -2087,79 +2109,106 @@ void Thermo::compute_yz() void Thermo::compute_avecx() { - if (!domain->triclinic) dvalue = domain->xprd; - else if (triclinic_general) dvalue = domain->avec[0]; - else dvalue = domain->xprd; + if (!domain->triclinic) + dvalue = domain->xprd; + else if (triclinic_general) + dvalue = domain->avec[0]; + else + dvalue = domain->xprd; } /* ---------------------------------------------------------------------- */ void Thermo::compute_avecy() { - if (!domain->triclinic) dvalue = 0.0; - else if (triclinic_general) dvalue = domain->avec[1]; - else dvalue = 0.0; + if (!domain->triclinic) + dvalue = 0.0; + else if (triclinic_general) + dvalue = domain->avec[1]; + else + dvalue = 0.0; } /* ---------------------------------------------------------------------- */ void Thermo::compute_avecz() { - if (!domain->triclinic) dvalue = 0.0; - else if (triclinic_general) dvalue = domain->avec[2]; - else dvalue = 0.0; + if (!domain->triclinic) + dvalue = 0.0; + else if (triclinic_general) + dvalue = domain->avec[2]; + else + dvalue = 0.0; } /* ---------------------------------------------------------------------- */ void Thermo::compute_bvecx() { - if (!domain->triclinic) dvalue = 0.0; - else if (triclinic_general) dvalue = domain->bvec[0]; - else dvalue = domain->xy; + if (!domain->triclinic) + dvalue = 0.0; + else if (triclinic_general) + dvalue = domain->bvec[0]; + else + dvalue = domain->xy; } /* ---------------------------------------------------------------------- */ void Thermo::compute_bvecy() { - if (!domain->triclinic) dvalue = domain->yprd; - else if (triclinic_general) dvalue = domain->bvec[1]; - else dvalue = domain->yprd; + if (!domain->triclinic) + dvalue = domain->yprd; + else if (triclinic_general) + dvalue = domain->bvec[1]; + else + dvalue = domain->yprd; } /* ---------------------------------------------------------------------- */ void Thermo::compute_bvecz() { - if (!domain->triclinic) dvalue = 0.0; - else if (triclinic_general) dvalue = domain->bvec[2]; - else dvalue = 0.0; + if (!domain->triclinic) + dvalue = 0.0; + else if (triclinic_general) + dvalue = domain->bvec[2]; + else + dvalue = 0.0; } /* ---------------------------------------------------------------------- */ void Thermo::compute_cvecx() { - if (!domain->triclinic) dvalue = 0.0; - else if (triclinic_general) dvalue = domain->cvec[0]; - else dvalue = domain->xz; + if (!domain->triclinic) + dvalue = 0.0; + else if (triclinic_general) + dvalue = domain->cvec[0]; + else + dvalue = domain->xz; } /* ---------------------------------------------------------------------- */ void Thermo::compute_cvecy() { - if (!domain->triclinic) dvalue = 0.0; - else if (triclinic_general) dvalue = domain->cvec[1]; - else dvalue = domain->yz; + if (!domain->triclinic) + dvalue = 0.0; + else if (triclinic_general) + dvalue = domain->cvec[1]; + else + dvalue = domain->yz; } /* ---------------------------------------------------------------------- */ void Thermo::compute_cvecz() { - if (!domain->triclinic) dvalue = domain->zprd; - else if (triclinic_general) dvalue = domain->cvec[2]; - else dvalue = domain->zprd; + if (!domain->triclinic) + dvalue = domain->zprd; + else if (triclinic_general) + dvalue = domain->cvec[2]; + else + dvalue = domain->zprd; } /* ---------------------------------------------------------------------- */ @@ -2309,9 +2358,9 @@ void Thermo::compute_pyz() void Thermo::compute_pxx_triclinic_general() { - double middle[3][3],final[3][3]; - MathExtra::times3(domain->rotate_r2g,press_tensor,middle); - MathExtra::times3(middle,domain->rotate_g2r,final); + double middle[3][3], final[3][3]; + MathExtra::times3(domain->rotate_r2g, press_tensor, middle); + MathExtra::times3(middle, domain->rotate_g2r, final); dvalue = final[0][0]; } @@ -2319,9 +2368,9 @@ void Thermo::compute_pxx_triclinic_general() void Thermo::compute_pyy_triclinic_general() { - double middle[3][3],final[3][3]; - MathExtra::times3(domain->rotate_r2g,press_tensor,middle); - MathExtra::times3(middle,domain->rotate_g2r,final); + double middle[3][3], final[3][3]; + MathExtra::times3(domain->rotate_r2g, press_tensor, middle); + MathExtra::times3(middle, domain->rotate_g2r, final); dvalue = final[1][1]; } @@ -2329,9 +2378,9 @@ void Thermo::compute_pyy_triclinic_general() void Thermo::compute_pzz_triclinic_general() { - double middle[3][3],final[3][3]; - MathExtra::times3(domain->rotate_r2g,press_tensor,middle); - MathExtra::times3(middle,domain->rotate_g2r,final); + double middle[3][3], final[3][3]; + MathExtra::times3(domain->rotate_r2g, press_tensor, middle); + MathExtra::times3(middle, domain->rotate_g2r, final); dvalue = final[2][2]; } @@ -2339,9 +2388,9 @@ void Thermo::compute_pzz_triclinic_general() void Thermo::compute_pxy_triclinic_general() { - double middle[3][3],final[3][3]; - MathExtra::times3(domain->rotate_r2g,press_tensor,middle); - MathExtra::times3(middle,domain->rotate_g2r,final); + double middle[3][3], final[3][3]; + MathExtra::times3(domain->rotate_r2g, press_tensor, middle); + MathExtra::times3(middle, domain->rotate_g2r, final); dvalue = final[0][1]; } @@ -2349,9 +2398,9 @@ void Thermo::compute_pxy_triclinic_general() void Thermo::compute_pxz_triclinic_general() { - double middle[3][3],final[3][3]; - MathExtra::times3(domain->rotate_r2g,press_tensor,middle); - MathExtra::times3(middle,domain->rotate_g2r,final); + double middle[3][3], final[3][3]; + MathExtra::times3(domain->rotate_r2g, press_tensor, middle); + MathExtra::times3(middle, domain->rotate_g2r, final); dvalue = final[0][2]; } @@ -2359,9 +2408,9 @@ void Thermo::compute_pxz_triclinic_general() void Thermo::compute_pyz_triclinic_general() { - double middle[3][3],final[3][3]; - MathExtra::times3(domain->rotate_r2g,press_tensor,middle); - MathExtra::times3(middle,domain->rotate_g2r,final); + double middle[3][3], final[3][3]; + MathExtra::times3(domain->rotate_r2g, press_tensor, middle); + MathExtra::times3(middle, domain->rotate_g2r, final); dvalue = final[1][2]; } diff --git a/src/update.cpp b/src/update.cpp index c9e57f9621..9494629221 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -404,7 +404,6 @@ void Update::create_minimize(int narg, char **arg, int trysuffix) minimize_style = utils::strdup(arg[0]); minimize = nullptr; - int sflag; new_minimize(arg[0], narg - 1, &arg[1], trysuffix, sflag);