diff --git a/doc/src/fix_electron_stopping.rst b/doc/src/fix_electron_stopping.rst index 4a61afbc09..4533e0bbe9 100644 --- a/doc/src/fix_electron_stopping.rst +++ b/doc/src/fix_electron_stopping.rst @@ -148,13 +148,13 @@ to derive the stopping power. Style *electron/stopping/fit* calculates the electronic stopping power and cumulative energy lost to the electron gas via a quadratic functional -and applies a drag force to the classical equations-of-motion for all +and applies a drag force to the classical equations-of-motion for all atoms moving above some minimum cutoff velocity (i.e., kinetic energy). These coefficients can be determined by fitting a quadratic polynomial to electronic stopping data predicted by, for example, SRIM or TD-DFT. Multiple 'Ecut c1 c2' values can be provided for multi-species simulations in the order -of the atom types. There is an examples/USER/misc/electron_stopping/ directory, -which illustrates uses of this command. Details of this implementation are +of the atom types. There is an examples/USER/misc/electron_stopping/ directory, +which illustrates uses of this command. Details of this implementation are further described in :ref:`Stewart2018 ` and :ref:`Lee2020 `. Restart, fix_modify, output, run start/stop, minimize info diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 5da513d972..36df368016 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -92,7 +92,7 @@ void KimInit::command(int narg, char **arg) strcpy(user_units,arg[1]); if (narg == 3) { if (strcmp(arg[2],"unit_conversion_mode")==0) unit_conversion_mode = true; - else { + else { error->all(FLERR,fmt::format("Illegal kim_init command.\nThe argument " "followed by unit_style {} is an optional " "argument and when is used must " @@ -161,7 +161,7 @@ void get_kim_unit_names( strcmp(system,"micro") ==0 || strcmp(system,"nano")==0) { error->all(FLERR,fmt::format("LAMMPS unit_style {} not supported " - "by KIM models", system)); + "by KIM models", system)); } else { error->all(FLERR,"Unknown unit_style"); } @@ -183,7 +183,7 @@ void KimInit::determine_model_type_and_units(char * model_name, KIM_CollectionItemType itemType; int kim_error = KIM_Collections_Create(&collections); - if (kim_error) + if (kim_error) error->all(FLERR,"Unable to access KIM Collections to find Model"); auto logID = fmt::format("{}_Collections", comm->me); @@ -508,7 +508,7 @@ void KimInit::write_log_cite(char *model_name) int availableAsString; char const * fileString; err = KIM_Collections_GetItemMetadataFile( - collections, i, &fileName, nullptr, nullptr, + collections, i, &fileName, nullptr, nullptr, &availableAsString, &fileString); if (err) continue; diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 713f91b56c..5eb01d7ced 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -103,7 +103,7 @@ void KimInteractions::do_setup(int narg, char **arg) error->all(FLERR,fmt::format("Illegal kim_interactions command.\nThe " "LAMMPS simulation has {} atom type(s), but " "{} chemical species passed to the " - "kim_interactions command", + "kim_interactions command", atom->ntypes, narg)); } else { fixed_types = false; @@ -128,10 +128,10 @@ void KimInteractions::do_setup(int narg, char **arg) if (simulatorModel) { if (!fixed_types) { - std::string atom_type_sym_list = + std::string atom_type_sym_list = fmt::format("{}", fmt::join(arg, arg + narg, " ")); - - std::string atom_type_num_list = + + std::string atom_type_num_list = fmt::format("{}", species_to_atomic_no(arg[0])); for (int i = 1; i < narg; ++i) @@ -192,11 +192,11 @@ void KimInteractions::do_setup(int narg, char **arg) if (strcmp(sim_field,"model-defn") == 0) { if (domain->periodicity[0]&& domain->periodicity[1]&& - domain->periodicity[2]) + domain->periodicity[2]) input->one("variable kim_periodic equal 1"); else if (domain->periodicity[0]&& domain->periodicity[1]&& - !domain->periodicity[2]) + !domain->periodicity[2]) input->one("variable kim_periodic equal 2"); else input->one("variable kim_periodic equal 0"); @@ -242,7 +242,7 @@ void KimInteractions::do_setup(int narg, char **arg) // as that will reset the argument vector. auto cmd1 = fmt::format("pair_style kim {}", model_name); - auto cmd2 = + auto cmd2 = fmt::format("pair_coeff * * {}", fmt::join(arg, arg + narg, " ")); input->one(cmd1); diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 0927a467bf..1628bb56d9 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -321,7 +321,7 @@ void KimParam::command(int narg, char **arg) if (nubound < 1 || nubound > extent || nlbound < 1 || nlbound > nubound) { auto msg = fmt::format("Illegal index_range '{}-{}' for '{}' " - "parameter with the extent of '{}'", + "parameter with the extent of '{}'", nlbound, nubound, paramname, extent); error->all(FLERR, msg); } @@ -378,14 +378,14 @@ void KimParam::command(int narg, char **arg) if (strcmp(arg[i], "explicit") == 0) ++i; } } else { - auto msg = + auto msg = fmt::format("Wrong number of arguments in 'kim_param get' " "command.\nThe LAMMPS '{}' variable names or " "'{} split' is mandatory", nvars, varname); error->all(FLERR, msg); } } else { - auto msg = + auto msg = fmt::format("Wrong number of arguments in 'kim_param get' " "command.\nThe LAMMPS '{}' variable names or " "'{} split/list' is mandatory", nvars, varname); @@ -399,7 +399,7 @@ void KimParam::command(int narg, char **arg) ++i; } else { if ((strcmp(arg[i], "list") == 0) || - (strcmp(arg[i], "explicit") == 0)) + (strcmp(arg[i], "explicit") == 0)) ++i; varsname[0] = varname; diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index e7b308625b..564f063668 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -128,14 +128,14 @@ void KimQuery::command(int narg, char **arg) if (strcmp("list",arg[1]) == 0) { if (narg == 2) error->all(FLERR,"Illegal kim_query command.\nThe 'list' " "keyword must be followed by ('split' " - "and) the name of the query function"); + "and) the name of the query function"); arg++; narg--; } char *function = arg[1]; for (int i = 2; i < narg; ++i) { - if (strncmp("model=",arg[i],6) == 0) + if (strncmp("model=",arg[i],6) == 0) error->all(FLERR,"Illegal 'model' key in kim_query command"); if (!strchr(arg[i], '=') || !strchr(arg[i], '[') || !strchr(arg[i], ']')) @@ -202,7 +202,7 @@ size_t write_callback(void *data, size_t size, size_t nmemb, void *userp) // copy chunks into the buffer for as long as there is space left if (buf->sizeleft) { const size_t buffer_size = size * nmemb; - const size_t copy_this_much = + const size_t copy_this_much = buf->sizeleft > buffer_size ? buffer_size : buf->sizeleft; memcpy(buf->dataptr, data, copy_this_much); @@ -242,9 +242,9 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, std::string val = values.next_string(); std::string::size_type n = val.find(","); if (n == std::string::npos) { - if (utils::is_integer(val) || + if (utils::is_integer(val) || utils::is_double(val) || - (val.front() == '"' && + (val.front() == '"' && val.back() == '"')) { query += fmt::format("&{}", arg[i]); } else { @@ -254,9 +254,9 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, query += fmt::format("&{}=[", key); while (n != std::string::npos){ std::string sval = val.substr(0, n); - if (utils::is_integer(sval) || + if (utils::is_integer(sval) || utils::is_double(sval) || - (val.front() == '"' && + (val.front() == '"' && val.back() == '"')) { query += fmt::format("{},", sval); } else { @@ -292,9 +292,9 @@ char *do_query(char *qfunction, char * model_name, int narg, char **arg, } } - std::string user_agent = fmt::format("kim_query--LAMMPS/{} ({})", + std::string user_agent = fmt::format("kim_query--LAMMPS/{} ({})", LAMMPS_VERSION, Info::get_os_info()); - + curl_easy_setopt(handle, CURLOPT_USERAGENT, user_agent.c_str()); curl_easy_setopt(handle, CURLOPT_URL, url.c_str()); curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L); diff --git a/src/USER-MISC/fix_electron_stopping_fit.cpp b/src/USER-MISC/fix_electron_stopping_fit.cpp index c58bffe83b..e6fa0f2b9b 100644 --- a/src/USER-MISC/fix_electron_stopping_fit.cpp +++ b/src/USER-MISC/fix_electron_stopping_fit.cpp @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. @@ -62,36 +62,36 @@ static const char cite_fix_electron_stopping_fit_c[] = // --------------------------------------------------------------------- FixElectronStoppingFit::FixElectronStoppingFit(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp,narg,arg), energy_coh_in(nullptr), drag_fac_in_1(nullptr), - drag_fac_in_2(nullptr), drag_fac_1(nullptr), drag_fac_2(nullptr), + Fix(lmp,narg,arg), energy_coh_in(nullptr), drag_fac_in_1(nullptr), + drag_fac_in_2(nullptr), drag_fac_1(nullptr), drag_fac_2(nullptr), v_min_sq(nullptr), v_max_sq(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_electron_stopping_fit_c); - + if (narg < 3 + 3*atom->ntypes) { error->all(FLERR,"Incorrect number of fix electron/stopping/fit arguments"); } - + scalar_flag = 1; global_freq = 1; - + energy_coh_in = new double[atom->ntypes+1]; - + drag_fac_in_1 = new double[atom->ntypes+1]; drag_fac_in_2 = new double[atom->ntypes+1]; - + for (int i = 1; i <= atom->ntypes; i++) { energy_coh_in[i] = utils::numeric(FLERR,arg[3*i],false,lmp); drag_fac_in_1[i] = utils::numeric(FLERR,arg[3*i+1],false,lmp); drag_fac_in_2[i] = utils::numeric(FLERR,arg[3*i+2],false,lmp); }; - + v_min_sq = new double[atom->ntypes+1]; v_max_sq = new double[atom->ntypes+1]; - + drag_fac_1 = new double[atom->ntypes+1]; drag_fac_2 = new double[atom->ntypes+1]; - + for (int i = 1; i <= atom->ntypes; i++) { double mvv; mvv = 2.0*energy_coh_in[i]/force->mvv2e; @@ -157,7 +157,7 @@ void FixElectronStoppingFit::post_force(int vflag) double **f = atom->f; int *type = atom->type; int nlocal = atom->nlocal; - + f_dot_v_current = 0.0; for (int i = 0; i < nlocal; i++) { double vv = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; @@ -179,8 +179,8 @@ void FixElectronStoppingFit::post_force(int vflag) f[i][0] -= gamma_x*v[i][0]; f[i][1] -= gamma_y*v[i][1]; f[i][2] -= gamma_z*v[i][2]; - f_dot_v_current += v_mag*sqrt( MathSpecial::square(gamma_x*v[i][0]) - + MathSpecial::square(gamma_y*v[i][1]) + f_dot_v_current += v_mag*sqrt( MathSpecial::square(gamma_x*v[i][0]) + + MathSpecial::square(gamma_y*v[i][1]) + MathSpecial::square(gamma_z*v[i][2]) ); }; }; diff --git a/src/USER-MISC/fix_electron_stopping_fit.h b/src/USER-MISC/fix_electron_stopping_fit.h index 3237e93f99..b40d6a3293 100644 --- a/src/USER-MISC/fix_electron_stopping_fit.h +++ b/src/USER-MISC/fix_electron_stopping_fit.h @@ -5,7 +5,7 @@ Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under + certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. diff --git a/src/balance.cpp b/src/balance.cpp index 3784b9a363..c47412cc9e 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -795,7 +795,7 @@ int Balance::shift() // loop over dimensions in balance string double *prd = domain->prd; - + int niter = 0; for (int idim = 0; idim < ndim; idim++) { @@ -917,7 +917,7 @@ int Balance::shift() // adjust adjacent splits that are too close (within neigh skin) // do this with minimal adjustment to splits - + double close = (1.0+EPSNEIGH) * neighbor->skin / boxsize; double delta,midpt,start,stop,lbound,ubound,spacing; @@ -930,7 +930,7 @@ int Balance::shift() // if can expand set and not become too close to splits I-1 or J+1, do it // else add split I-1 or J+1 to set and try again // delta = size of expanded split set that will satisy criterion - + while (1) { delta = (j-i) * close; midpt = 0.5 * (split[i]+split[j]); @@ -943,12 +943,12 @@ int Balance::shift() else ubound = 1.0; // start/stop are within bounds, reset the splits - + if (start >= lbound && stop <= ubound) break; // try a shift to either bound, reset the splits if delta fits // these tests change start/stop - + if (start < lbound) { start = lbound; stop = start + delta; @@ -963,7 +963,7 @@ int Balance::shift() // exit if can't expand set, else expand set // if can expand in either direction, // pick new split closest to current midpt of set - + if (i == 0 && j == np) { start = 0.0; stop = 1.0; break; @@ -980,13 +980,13 @@ int Balance::shift() for (m = i; m <= j; m++) split[m] = start + (m-i)*spacing; if (j == np) split[np] = 1.0; - + // continue testing beyond the J split - + i = j+1; } else i++; } - + // sanity check on bad duplicate or inverted splits // zero or negative width sub-domains will break Comm class // should never happen if recursive multisection algorithm is correct