Merge pull request #4477 from akohlmey/collected-small-changes

Collected small changes and bug fixes
This commit is contained in:
Axel Kohlmeyer
2025-02-25 17:32:14 -05:00
committed by GitHub
22 changed files with 204 additions and 173 deletions

View File

@ -87,7 +87,7 @@ values in the vector. The *sumsq* option sums the square of the
values in the vector into a global total. The *avesq* setting does
the same as *sumsq*, then divides the sum of squares by the number of
values. The last two options can be useful for calculating the
variance of some quantity (e.g., variance = sumsq :math:`-` ave\
variance of some quantity (e.g., variance = *avesq* :math:`-` *ave*\
:math:`^2`). The *sumabs* option sums the absolute values in the
vector into a global total. The *aveabs* setting does the same as
*sumabs*, then divides the sum of absolute values by the number of

View File

@ -74,6 +74,10 @@ void PairDPD::compute(int eflag, int vflag)
evdwl = 0.0;
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -266,10 +270,6 @@ void PairDPD::init_style()
error->warning(FLERR, "Pair dpd needs newton pair on for momentum conservation");
neighbor->add_request(this);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
}
/* ----------------------------------------------------------------------

View File

@ -90,6 +90,10 @@ void PairDPDCoulSlaterLong::compute(int eflag, int vflag)
evdwl = ecoul = 0.0;
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -334,11 +338,6 @@ void PairDPDCoulSlaterLong::init_style()
neighbor->add_request(this);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
// ensure use of KSpace long-range solver, set g_ewald
if (force->kspace == nullptr)

View File

@ -81,6 +81,10 @@ void PairDPDExt::compute(int eflag, int vflag)
evdwl = 0.0;
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
double **x = atom->x;
double **v = atom->v;
double **f = atom->f;
@ -325,10 +329,6 @@ void PairDPDExt::init_style()
error->warning(FLERR, "Pair dpd needs newton pair on for momentum conservation");
neighbor->add_request(this);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
}
/* ----------------------------------------------------------------------

View File

@ -54,6 +54,10 @@ void PairDPDExtTstat::compute(int eflag, int vflag)
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
// adjust sigma if target T is changing
if (t_start != t_stop) {

View File

@ -48,6 +48,10 @@ void PairDPDTstat::compute(int eflag, int vflag)
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
// adjust sigma if target T is changing
if (t_start != t_stop) {

View File

@ -89,8 +89,6 @@ void AngleCosineDelta::compute(int eflag, int vflag)
s = sqrt(1.0 - c*c);
if (s < SMALL) s = SMALL;
s = 1.0/s;
cot = c/s;
// force & energy

View File

@ -16,15 +16,16 @@
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "angle_cosine_delta_omp.h"
#include <cmath>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neighbor.h"
#include <cmath>
#include "omp_compat.h"
#include "suffix.h"
using namespace LAMMPS_NS;
@ -128,8 +129,6 @@ void AngleCosineDeltaOMP::eval(int nfrom, int nto, ThrData * const thr)
s = sqrt(1.0 - c*c);
if (s < SMALL) s = SMALL;
s = 1.0/s;
cot = c/s;
// force & energy

View File

@ -229,7 +229,7 @@ void FixRigidSmallOMP::compute_forces_and_torques()
#if defined(_OPENMP)
#pragma omp parallel for LMP_DEFAULT_NONE schedule(static)
#endif
for (int ibody = 0; ibody < nbody; ibody++) {
for (int ibody = 0; ibody < nlocal_body; ibody++) {
double * _noalias const fcm = body[ibody].fcm;
const double mass = body[ibody].mass;
fcm[0] += gvec[0]*mass;

View File

@ -60,6 +60,10 @@ void PairDPDExtOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -60,6 +60,10 @@ void PairDPDExtTstatOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -59,6 +59,10 @@ void PairDPDOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -60,6 +60,10 @@ void PairDPDTstatOMP::compute(int eflag, int vflag)
{
ev_init(eflag,vflag);
// precompute random force scaling factors
for (int i = 0; i < 4; ++i) special_sqrt[i] = sqrt(force->special_lj[i]);
const int nall = atom->nlocal + atom->nghost;
const int inum = list->inum;

View File

@ -57,8 +57,8 @@ namespace ReaxFF {
class control_parser_error : public std::exception {
std::string message;
public:
explicit control_parser_error(const std::string &msg) {
message = msg;
explicit control_parser_error(const std::string &format, const std::string &keyword) {
message = fmt::format(fmt::runtime(format), keyword);
}
const char *what() const noexcept override { return message.c_str(); }
};
@ -92,11 +92,11 @@ namespace ReaxFF {
auto keyword = values.next_string();
if (!values.has_next())
throw control_parser_error(
fmt::format("No value(s) for control parameter: {}\n", keyword));
throw control_parser_error("No value(s) for control parameter: {}\n", keyword);
if (inactive_keywords.find(keyword) != inactive_keywords.end()) {
error->warning(FLERR,fmt::format("Ignoring inactive control parameter: {}", keyword));
error->warning(FLERR, fmt::format(fmt::runtime("Ignoring inactive control parameter: {}"),
keyword));
} else if (keyword == "nbrhood_cutoff") {
control->bond_cut = values.next_double();
} else if (keyword == "bond_graph_cutoff") {
@ -114,7 +114,7 @@ namespace ReaxFF {
error->warning(FLERR,"Support for writing native trajectories has "
"been removed after LAMMPS version 8 April 2021");
} else {
throw control_parser_error(fmt::format("Unknown parameter {} in control file", keyword));
throw control_parser_error("Unknown parameter {} in control file", keyword);
}
}
} catch (LAMMPS_NS::EOFException &) {

View File

@ -42,8 +42,8 @@ using namespace MathExtra;
/* ---------------------------------------------------------------------- */
ComputeRHEOVShift::ComputeRHEOVShift(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg), vshift(nullptr), ct(nullptr), wsame(nullptr), cgradt(nullptr),
fix_rheo(nullptr), rho0(nullptr), list(nullptr), compute_interface(nullptr),
Compute(lmp, narg, arg), vshift(nullptr), fix_rheo(nullptr), rho0(nullptr), wsame(nullptr),
ct(nullptr), cgradt(nullptr), shift_type(nullptr), list(nullptr), compute_interface(nullptr),
compute_kernel(nullptr), compute_surface(nullptr)
{
if (narg != 3) error->all(FLERR, "Illegal compute RHEO/VShift command");
@ -316,8 +316,7 @@ void ComputeRHEOVShift::correct_type_interface()
{
int i, j, a, ii, jj, jnum, itype, jtype;
int fluidi, fluidj;
double xtmp, ytmp, ztmp, rsq, r, rinv;
double w, wp, dr, w0, prefactor;
double xtmp, ytmp, ztmp, rsq, r, w;
double imass, jmass, voli, volj, rhoi, rhoj;
double dx[3];
int dim = domain->dimension;
@ -327,14 +326,12 @@ void ComputeRHEOVShift::correct_type_interface()
int *type = atom->type;
int *status = atom->rheo_status;
int *mask = atom->mask;
double **x = atom->x;
double *rho = atom->rho;
double *mass = atom->mass;
double *rmass = atom->rmass;
int nlocal = atom->nlocal;
int nall = nlocal + atom->nghost;
int newton_pair = force->newton_pair;
inum = list->inum;

View File

@ -1,3 +1,4 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@ -51,8 +52,6 @@ enum { XYZ, SHIFT, BISECTION };
enum { NONE, UNIFORM, USER };
enum { X, Y, Z };
// clang-format off
/* ---------------------------------------------------------------------- */
Balance::Balance(LAMMPS *lmp) : Command(lmp)
@ -114,13 +113,13 @@ Balance::~Balance()
void Balance::command(int narg, char **arg)
{
if (domain->box_exist == 0)
error->all(FLERR,"Balance command before simulation box is defined");
error->all(FLERR, -1, "Balance command before simulation box is defined");
if (comm->me == 0) utils::logmesg(lmp,"Balancing ...\n");
// parse required arguments
if (narg < 2) error->all(FLERR,"Illegal balance command");
if (narg < 2) utils::missing_cmd_args(FLERR,"balance", error);
thresh = utils::numeric(FLERR,arg[0],false,lmp);
@ -132,16 +131,15 @@ void Balance::command(int narg, char **arg)
int iarg = 1;
while (iarg < narg) {
if (strcmp(arg[iarg],"x") == 0) {
if (style != -1 && style != XYZ)
error->all(FLERR,"Illegal balance command");
if ((style != -1) && (style != XYZ))
error->all(FLERR, iarg, "Must not combine multiple balancing styles");
style = XYZ;
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"balance x", error);
if (strcmp(arg[iarg+1],"uniform") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal balance command");
xflag = UNIFORM;
iarg += 2;
} else {
if (1 + procgrid[0]-1 > narg)
error->all(FLERR,"Illegal balance command");
if (iarg + procgrid[0]-1 > narg) utils::missing_cmd_args(FLERR,"balance x", error);
xflag = USER;
delete[] user_xsplit;
user_xsplit = new double[procgrid[0]+1];
@ -152,16 +150,15 @@ void Balance::command(int narg, char **arg)
user_xsplit[procgrid[0]] = 1.0;
}
} else if (strcmp(arg[iarg],"y") == 0) {
if (style != -1 && style != XYZ)
error->all(FLERR,"Illegal balance command");
if ((style != -1) && (style != XYZ))
error->all(FLERR, iarg, "Must not combine multiple balancing styles");
style = XYZ;
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"balance y", error);
if (strcmp(arg[iarg+1],"uniform") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal balance command");
yflag = UNIFORM;
iarg += 2;
} else {
if (1 + procgrid[1]-1 > narg)
error->all(FLERR,"Illegal balance command");
if (iarg + procgrid[1]-1 > narg) utils::missing_cmd_args(FLERR,"balance y", error);
yflag = USER;
delete[] user_ysplit;
user_ysplit = new double[procgrid[1]+1];
@ -172,16 +169,15 @@ void Balance::command(int narg, char **arg)
user_ysplit[procgrid[1]] = 1.0;
}
} else if (strcmp(arg[iarg],"z") == 0) {
if (style != -1 && style != XYZ)
error->all(FLERR,"Illegal balance command");
if ((style != -1) && (style != XYZ))
error->all(FLERR, iarg, "Must not combine multiple balancing styles");
style = XYZ;
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"balance z", error);
if (strcmp(arg[iarg+1],"uniform") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal balance command");
zflag = UNIFORM;
iarg += 2;
} else {
if (1 + procgrid[2]-1 > narg)
error->all(FLERR,"Illegal balance command");
if (iarg + procgrid[2]-1 > narg) utils::missing_cmd_args(FLERR,"balance z", error);
zflag = USER;
delete[] user_zsplit;
user_zsplit = new double[procgrid[2]+1];
@ -193,19 +189,21 @@ void Balance::command(int narg, char **arg)
}
} else if (strcmp(arg[iarg],"shift") == 0) {
if (style != -1) error->all(FLERR,"Illegal balance command");
if (style != -1) error->all(FLERR, iarg, "Must not combine multiple balancing styles");
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "balance shift", error);
style = SHIFT;
bstr = arg[iarg+1];
if (bstr.size() > BSTR_SIZE) error->all(FLERR,"Illegal balance shift command");
if (bstr.size() > BSTR_SIZE) error->all(FLERR, iarg + 1, "Illegal balance shift command");
nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (nitermax <= 0) error->all(FLERR,"Illegal balance command");
if (nitermax <= 0)
error->all(FLERR,iarg+2,"Illegal balance shift value {}", arg[iarg+2]);
stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (stopthresh < 1.0) error->all(FLERR,"Illegal balance command");
if (stopthresh < 1.0)
error->all(FLERR,iarg+3,"Illegal balance stop threshold value {}", arg[iarg+3]);
iarg += 4;
} else if (strcmp(arg[iarg],"rcb") == 0) {
if (style != -1) error->all(FLERR,"Illegal balance command");
if (style != -1) error->all(FLERR,"Must not combine multiple balancing styles");
style = BISECTION;
iarg++;
@ -221,32 +219,32 @@ void Balance::command(int narg, char **arg)
if (xflag == USER)
for (int i = 1; i <= procgrid[0]; i++)
if (user_xsplit[i-1] >= user_xsplit[i])
error->all(FLERR,"Illegal balance command");
error->all(FLERR,"Slices for balance x command must be in ascending order");
if (yflag == USER)
for (int i = 1; i <= procgrid[1]; i++)
if (user_ysplit[i-1] >= user_ysplit[i])
error->all(FLERR,"Illegal balance command");
error->all(FLERR,"Slices for balance y command must be in ascending order");
if (zflag == USER)
for (int i = 1; i <= procgrid[2]; i++)
if (user_zsplit[i-1] >= user_zsplit[i])
error->all(FLERR,"Illegal balance command");
error->all(FLERR,"Slices for balance z command must be in ascending order");
}
if (style == SHIFT) {
const int blen = bstr.size();
for (int i = 0; i < blen; i++) {
if (bstr[i] != 'x' && bstr[i] != 'y' && bstr[i] != 'z')
error->all(FLERR,"Balance shift string is invalid");
error->all(FLERR,"Balance shift string {} is invalid", bstr);
if (bstr[i] == 'z' && dimension == 2)
error->all(FLERR,"Balance shift string is invalid");
error->all(FLERR,"Balance shift string {} is invalid", bstr);
for (int j = i+1; j < blen; j++)
if (bstr[i] == bstr[j])
error->all(FLERR,"Balance shift string is invalid");
error->all(FLERR,"Balance shift string {} is invalid", bstr);
}
}
if (style == BISECTION && comm->style == Comm::BRICK)
error->all(FLERR,"Balance rcb cannot be used with comm_style brick");
error->all(FLERR, Error::ARGZERO, "Balance rcb cannot be used with comm_style brick");
// process remaining optional args
@ -467,16 +465,16 @@ void Balance::options(int iarg, int narg, char **arg, int sortflag_default)
nopt = imb->options(narg-iarg,arg+iarg+2);
imbalances[nimbalance++] = imb;
} else {
error->all(FLERR,"Unknown (fix) balance weight method: {}", arg[iarg+1]);
error->all(FLERR, iarg + 1, "Unknown (fix) balance weight method: {}", arg[iarg+1]);
}
iarg += 2+nopt;
} else if (strcmp(arg[iarg],"sort") == 0) {
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "balance sort", error);
if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "(fix) balance sort", error);
sortflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"out") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal (fix) balance command");
if (iarg+2 > narg) utils::missing_cmd_args(FLERR,"(fix) balance out", error);
outflag = 1;
outarg = iarg+1;
iarg += 2;
@ -485,7 +483,7 @@ void Balance::options(int iarg, int narg, char **arg, int sortflag_default)
oldrcb = 1;
iarg++;
} else error->all(FLERR,"Illegal (fix) balance command");
} else error->all(FLERR, iarg, "Unknown (fix) balance keyword {}", arg[iarg]);
}
// output file
@ -493,8 +491,8 @@ void Balance::options(int iarg, int narg, char **arg, int sortflag_default)
if (outflag && comm->me == 0) {
fp = fopen(arg[outarg],"w");
if (fp == nullptr)
error->one(FLERR,"Cannot open (fix) balance output file {}: {}",
arg[outarg], utils::getsyserror());
error->one(FLERR, outarg, "Cannot open (fix) balance output file {}: {}",
arg[outarg], utils::getsyserror());
}
}

View File

@ -42,7 +42,7 @@ enum { SHIFT, BISECTION };
FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), balance(nullptr), irregular(nullptr)
{
if (narg < 6) error->all(FLERR,"Illegal fix balance command");
if (narg < 6) utils::missing_cmd_args(FLERR, "fix balance", error);
box_change = BOX_CHANGE_DOMAIN;
pre_exchange_migrate = 1;
@ -58,7 +58,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
int dimension = domain->dimension;
nevery = utils::inumeric(FLERR,arg[3],false,lmp);
if (nevery < 0) error->all(FLERR,"Illegal fix balance command");
if (nevery < 0) error->all(FLERR, 3, "Illegal fix balance nevery value {}", arg[3]);
thresh = utils::numeric(FLERR,arg[4],false,lmp);
reportonly = 0;
@ -69,7 +69,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[5],"report") == 0) {
lbstyle = SHIFT;
reportonly = 1;
} else error->all(FLERR,"Unknown fix balance style {}", arg[5]);
} else error->all(FLERR, 5, "Unknown fix balance style {}", arg[5]);
int iarg = 5;
if (lbstyle == SHIFT) {
@ -84,11 +84,14 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
} else {
if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "fix balance shift", error);
bstr = arg[iarg+1];
if (bstr.size() > Balance::BSTR_SIZE) error->all(FLERR,"Illegal fix balance shift command");
if (bstr.size() > Balance::BSTR_SIZE)
error->all(FLERR, iarg + 1, "Illegal fix balance shift argument {}", bstr);
nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (nitermax <= 0) error->all(FLERR,"Illegal fix balance command");
if (nitermax <= 0)
error->all(FLERR, iarg + 2, "Illegal fix balance shift niter argument {}", nitermax);
stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (stopthresh < 1.0) error->all(FLERR,"Illegal fix balance command");
if (stopthresh < 1.0)
error->all(FLERR, iarg + 3, "Illegal fix balance stop threshold argument {}", stopthresh);
iarg += 4;
}
@ -102,12 +105,12 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
const int blen = bstr.size();
for (int i = 0; i < blen; i++) {
if (bstr[i] != 'x' && bstr[i] != 'y' && bstr[i] != 'z')
error->all(FLERR,"Fix balance shift string is invalid");
error->all(FLERR,"Fix balance shift string {} is invalid", bstr);
if (bstr[i] == 'z' && dimension == 2)
error->all(FLERR,"Fix balance shift string is invalid");
error->all(FLERR,"Fix balance shift string {} is invalid", bstr);
for (int j = i+1; j < blen; j++)
if (bstr[i] == bstr[j])
error->all(FLERR,"Fix balance shift string is invalid");
error->all(FLERR,"Fix balance shift string {} is invalid", bstr);
}
}
@ -125,7 +128,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) :
sortflag = balance->sortflag;
if (balance->varflag && nevery == 0)
error->all(FLERR,"Fix balance nevery = 0 cannot be used with weight var");
error->all(FLERR, 3, "Fix balance nevery = 0 cannot be used with weight var");
// create instance of Irregular class

View File

@ -156,7 +156,7 @@ std::string utils::strcompress(const std::string &text)
}
// remove trailing blank
if (output.back() == ' ') output.erase(output.size() - 1, 1);
if (!output.empty() && output.back() == ' ') output.erase(output.size() - 1, 1);
return output;
}

View File

@ -415,19 +415,19 @@ TEST_F(SimpleCommandsTest, Plugin)
if (!bindir) GTEST_SKIP() << "LAMMPS_PLUGIN_DIR not set";
std::string loadfmt = "plugin load {}/{}plugin.so";
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "hello"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "hello"));
auto text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*\n.*Loading plugin: Hello world command.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "xxx"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "xxx"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*Open of file .*xxx.* failed.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "nve2"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "nve2"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*Loading plugin: NVE2 variant fix style.*"));
@ -438,7 +438,7 @@ TEST_F(SimpleCommandsTest, Plugin)
ASSERT_THAT(text, ContainsRegex(".*1: command style plugin hello\n.*2: fix style plugin nve2.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, bindir, "hello"));
lmp->input->one(fmt::format(fmt::runtime(loadfmt), bindir, "hello"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, ContainsRegex(".*Ignoring load of command style hello: "

View File

@ -1,6 +1,7 @@
---
lammps_version: 17 Feb 2022
date_generated: Fri Mar 18 22:17:51 2022
lammps_version: 4 Feb 2025
tags: generated
date_generated: Fri Feb 21 16:17:55 2025
epsilon: 5e-13
skip_tests: numdiff
prerequisites: ! |
@ -20,68 +21,68 @@ extract: ! ""
natoms: 29
init_energy: 20.65098133017812
init_stress: ! |2-
4.0957903125808471e+01 -2.2499632589286236e+01 -1.8458270536522217e+01 3.4849378298981264e+01 -4.9327943096381759e+00 -2.6124108916945294e+00
4.4473180621356008e+01 -4.3463840015691233e+01 -1.0093406056647736e+00 4.5637584879601796e+01 -1.3907393586961433e+01 -4.2824939510892590e-01
init_forces: ! |2
1 1.6023996455832325e+01 2.4226311046592137e+00 -1.8589204266697958e+01
2 -9.3711866901463381e-02 -7.5876216223294790e-01 -6.1013759002633705e-01
3 -6.0380408211033587e-01 2.6993032298913775e+01 2.7951913775716850e+01
4 -4.3564633502451269e+00 -1.0062417183984081e+01 2.1642186242701338e+00
5 -1.5386439746171822e+01 -2.3440313238754023e+01 -1.0067874149174445e+01
6 9.6873286040901903e+00 6.5740743013867231e-02 -2.6313308270088624e+00
7 -4.1923658452230708e+00 3.7873664481235689e+00 -9.2297211491112741e-01
8 -4.1328674241018124e+00 -1.3752082356191019e+01 9.4169257319147519e+00
9 -5.2849046978682424e+00 5.1551127779597277e+00 -6.0440022931290430e-02
10 8.5785584536205555e+00 1.9092658049053345e+01 -1.3500832217122007e+01
11 -8.2548956740792931e+00 -3.8384442674446007e+00 4.3703985032254611e+00
12 -2.2390516462227508e+00 -2.4339015686808576e+00 -5.7125783103934751e+00
13 7.0748633959583906e-01 1.7495942830019229e+00 8.1749690284178111e-01
14 5.0293855034635815e+00 -4.3347315249911471e+00 -2.2794877131015205e+00
15 4.2836129602031709e+00 -2.6803643297135835e+00 7.8342386854077670e+00
16 -1.6475295059196460e+00 4.5975354658004379e+00 4.3681254253354895e-01
17 1.8816655220378973e+00 -2.5626545385335930e+00 1.3828524454567255e+00
18 1.6064693296025290e-01 1.6787555240920624e+00 -6.8129331975320220e+00
19 -1.9670041679005905e+00 -2.4504879220906162e+00 2.9176882347102016e+00
20 1.8063572349403376e+00 7.7173239799855375e-01 3.8952449628218204e+00
21 2.3714039975200247e+00 2.9686059791249759e+00 -8.8717809550958702e+00
22 -4.2227815913112092e+00 -2.8790902397071427e+00 3.1362978814995639e+00
23 1.8513775937911845e+00 -8.9515739417833418e-02 5.7354830735963063e+00
24 -1.4568411370574479e+00 5.6628278324597936e+00 -3.3714304805753512e+00
25 -1.1685952378028448e+00 -3.9152363566022288e+00 6.4031275969729240e-01
26 2.6254363748602927e+00 -1.7475914758575648e+00 2.7311177208780588e+00
27 -6.3244441950917718e-01 5.1918732409438757e+00 -1.7685243510997146e+00
28 -1.3828773692511866e+00 -3.1042973063575481e+00 7.2112563744890223e-02
29 2.0153217887603638e+00 -2.0875759345863276e+00 1.6964117873548243e+00
run_energy: 20.572797398210106
1 2.3703974495881418e+01 3.8584484587903516e+00 -1.5929138796293980e+01
2 -5.5592010971213179e-01 -4.5011497307751007e+00 -3.6194749630118039e+00
3 -2.8457465117799385e+00 2.6325352833001663e+01 2.5623331548006441e+01
4 -7.9894054979056088e+00 -1.2258360452072225e+01 6.4168233111021600e+00
5 -2.2204738294831444e+01 -2.3698109015673438e+01 -1.1480776479805904e+01
6 2.3347569650102201e+01 -4.7137825565345990e+00 -1.6078168111448818e+01
7 -8.0686673030183851e+00 7.1975893900877121e+00 -1.7579980765823877e+00
8 -3.1824458002558198e+00 -1.2503128164663320e+01 4.0602708742130751e+01
9 -7.7323033517797342e+00 8.0399091320421157e+00 -2.0951400051039776e-01
10 4.9524658729988271e+00 2.0621211528107622e+01 -3.2638235652308239e+01
11 -1.0127717019112277e+01 -3.1783095109070576e+00 4.4288595135259623e+00
12 -5.4777124732518541e+00 -5.3066394246038655e+00 -4.8409352484994574e+00
13 1.4412505843466221e+00 3.6458164082141984e+00 -5.3031504624386550e-02
14 7.6148261062259106e+00 -4.7428356370992075e+00 -3.3084707170534466e+00
15 6.1963584357832016e+00 -3.1286786554578465e+00 9.2319462456089330e+00
16 1.9503516089515505e-01 5.3411834252929946e+00 3.0732566957386886e+00
17 7.3317605541385511e-01 -9.9851802775000564e-01 5.3881749402587964e-01
18 7.8915981928254553e-02 8.2466959163160869e-01 -3.3467760833494964e+00
19 -9.6626846530114285e-01 -1.2037743703637904e+00 1.4332812196273430e+00
20 8.8735248337288830e-01 3.7910477873218174e-01 1.9134948637221534e+00
21 1.7083446765076102e+00 2.1385652661420855e+00 -6.3911757682915322e+00
22 -3.0420655692218990e+00 -2.0740786847506296e+00 2.2593694686375940e+00
23 1.3337208927142887e+00 -6.4486581391455855e-02 4.1318062996539382e+00
24 -6.5262931439741845e-01 2.5368088200155672e+00 -1.5103186662621493e+00
25 -5.2350217841582225e-01 -1.7539304417736190e+00 2.8684450674231776e-01
26 1.1761314928132407e+00 -7.8287837824194817e-01 1.2234741595198315e+00
27 -1.4360109768190377e-01 1.1788525179864244e+00 -4.0155629532187376e-01
28 -3.1399234787785879e-01 -7.0485324397341742e-01 1.6373681213693980e-02
29 4.5759344555976256e-01 -4.7399927401300701e-01 3.8518261410817978e-01
run_energy: 20.563089678525095
run_stress: ! |2-
4.0414601145881797e+01 -2.2259720000355955e+01 -1.8154881145525852e+01 3.4356097430708779e+01 -5.1760682620031364e+00 -3.0219001073831251e+00
4.3757504913648717e+01 -4.3136475705003690e+01 -6.2102920864502398e-01 4.4978336549538170e+01 -1.4195605982625462e+01 -9.5958875069195426e-01
run_forces: ! |2
1 1.5854493147994468e+01 2.5625041903632799e+00 -1.8403707584219106e+01
2 -1.0778147157154638e-01 -8.7954374413252623e-01 -7.1033263283976922e-01
3 -3.5903740231368531e-01 2.6747382244473858e+01 2.7776094765308645e+01
4 -4.3667455132582980e+00 -9.9043336720965058e+00 2.2554137013679947e+00
5 -1.5435306686274892e+01 -2.3368620551346410e+01 -1.0071205010683158e+01
6 9.7004722937707939e+00 2.8185574443369887e-02 -2.6469111215932326e+00
7 -4.2051376166149819e+00 3.8059875922956321e+00 -9.2948254913796591e-01
8 -4.0811558306056437e+00 -1.3725195219352738e+01 9.4305267102762365e+00
9 -5.3018040121457650e+00 5.1712375236873847e+00 -5.5170438746634645e-02
10 8.5884631851414728e+00 1.8977169595422669e+01 -1.3503733846157115e+01
11 -8.2489793835708181e+00 -3.8307795657532537e+00 4.3670355271621792e+00
12 -2.2854196014066837e+00 -2.5730964210485521e+00 -5.5327026624884477e+00
13 6.8857552776933151e-01 1.7099649678302227e+00 8.4476951940005041e-01
14 5.0388676050555423e+00 -4.1380632752237698e+00 -2.2619786920581912e+00
15 4.2713089863647395e+00 -2.6164691252678471e+00 7.6327855841331855e+00
16 -1.6264161996020632e+00 4.5902884407035716e+00 4.2906258286847709e-01
17 1.8756029712680284e+00 -2.5566185549983906e+00 1.3795361474068475e+00
18 1.5949074618033343e-01 1.6020315457790089e+00 -6.4757984092122420e+00
19 -1.8652368265982364e+00 -2.3286173150011749e+00 2.7801057275919980e+00
20 1.7057460804179030e+00 7.2658576922216600e-01 3.6956926816202440e+00
21 2.3015994659382928e+00 2.8609989652412211e+00 -8.6002184142674114e+00
22 -4.0843967543541595e+00 -2.7748751066344699e+00 3.0465239349836377e+00
23 1.7827972884158667e+00 -8.6123858606751036e-02 5.5536944792837737e+00
24 -1.4105671680157181e+00 5.4757757163248080e+00 -3.2567653472769562e+00
25 -1.1213719131694626e+00 -3.7848791001392499e+00 6.1939772997237075e-01
26 2.5319390811851807e+00 -1.6908966161855581e+00 2.6373676173045855e+00
27 -6.3028932344593613e-01 5.1333019072249222e+00 -1.7384473964198608e+00
28 -1.3620336377103808e+00 -3.0692701554272155e+00 6.6735136389115879e-02
29 1.9923229611563169e+00 -2.0640317517977067e+00 1.6717122600307448e+00
1 2.3451032879726370e+01 4.0617257197173897e+00 -1.5621894955519736e+01
2 -5.7421401726330101e-01 -4.6835780748393674e+00 -3.7823299076024632e+00
3 -2.4306027199459486e+00 2.6072519970009257e+01 2.5364241217921947e+01
4 -8.0249953558852880e+00 -1.2074108242088608e+01 6.5482299702187063e+00
5 -2.2289140460440823e+01 -2.3631032649621293e+01 -1.1494387406884398e+01
6 2.3354057831390289e+01 -4.7586966738793901e+00 -1.6119827865958250e+01
7 -8.0844064733133774e+00 7.2149529473510370e+00 -1.7660273021312418e+00
8 -3.1478296151921232e+00 -1.2498537099228518e+01 4.0622223121616166e+01
9 -7.7511017876278920e+00 8.0605427659852786e+00 -2.0241485109620189e-01
10 4.9915744598623162e+00 2.0482598351331305e+01 -3.2624972375682837e+01
11 -1.0123311005215982e+01 -3.1688924167926276e+00 4.4252676678697700e+00
12 -5.5513668937759473e+00 -5.4355045396603447e+00 -4.6167965020560917e+00
13 1.4059367926919679e+00 3.5728783709008667e+00 2.5935291038754471e-03
14 7.6143970879681024e+00 -4.5037794326053131e+00 -3.2831360392059907e+00
15 6.2058701073495151e+00 -3.0406636127154227e+00 8.9669093364259496e+00
16 2.2902239968198557e-01 5.3178918884056445e+00 3.0490139755759853e+00
17 7.2507676999013526e-01 -9.8831727226989585e-01 5.3330838740480679e-01
18 7.1127024594080268e-02 7.1445956198119154e-01 -2.8880230496978854e+00
19 -8.3188306575710236e-01 -1.0385320257838888e+00 1.2398389619370178e+00
20 7.6075604116302209e-01 3.2407246380269727e-01 1.6481840877608676e+00
21 1.6140194966539338e+00 2.0063050011497334e+00 -6.0309928490009383e+00
22 -2.8643056040092603e+00 -1.9459468475255317e+00 2.1363729514270524e+00
23 1.2502861073553264e+00 -6.0358153624201771e-02 3.8946198975738859e+00
24 -5.8408404963238691e-01 2.2673919964618818e+00 -1.3485518584960339e+00
25 -4.6437462735412272e-01 -1.5672547533259689e+00 2.5645620543256875e-01
26 1.0484586769865096e+00 -7.0013724313591297e-01 1.0920956530634651e+00
27 -1.3425430939812166e-01 1.0934202317724093e+00 -3.7029815332428351e-01
28 -2.9014265041938359e-01 -6.5377692091134065e-01 1.4204173363709049e-02
29 4.2439695981750525e-01 -4.3964331086106867e-01 3.5609397996057446e-01
...

View File

@ -1,7 +1,7 @@
---
lammps_version: 17 Feb 2022
date_generated: Fri Mar 18 22:17:50 2022
epsilon: 4e-13
epsilon: 5e-13
skip_tests:
prerequisites: ! |
atom full

View File

@ -24,30 +24,30 @@ using ::testing::Eq;
TEST(FmtLib, insert_string)
{
const char val[] = "word";
auto text = fmt::format("word {}", val);
constexpr char val[] = "word";
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word word"));
}
TEST(FmtLib, insert_int)
{
const int val = 333;
auto text = fmt::format("word {}", val);
constexpr int val = 333;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word 333"));
}
TEST(FmtLib, insert_neg_int)
{
const int val = -333;
auto text = fmt::format("word {}", val);
constexpr int val = -333;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word -333"));
}
TEST(FmtLib, insert_bigint)
{
#if defined(LAMMPS_BIGBIG) || defined(LAMMPS_SMALLBIG)
const bigint val = 9945234592L;
auto text = fmt::format("word {}", val);
constexpr bigint val = 9945234592L;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word 9945234592"));
#else
GTEST_SKIP();
@ -57,8 +57,8 @@ TEST(FmtLib, insert_bigint)
TEST(FmtLib, insert_neg_bigint)
{
#if defined(LAMMPS_BIGBIG) || defined(LAMMPS_SMALLBIG)
const bigint val = -9945234592L;
auto text = fmt::format("word {}", val);
constexpr bigint val = -9945234592L;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word -9945234592"));
#else
GTEST_SKIP();
@ -68,8 +68,8 @@ TEST(FmtLib, insert_neg_bigint)
TEST(FmtLib, insert_tagint)
{
#if defined(LAMMPS_BIGBIG)
const tagint val = 9945234592L;
auto text = fmt::format("word {}", val);
constexpr tagint val = 9945234592L;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word 9945234592"));
#else
GTEST_SKIP();
@ -79,8 +79,8 @@ TEST(FmtLib, insert_tagint)
TEST(FmtLib, insert_neg_tagint)
{
#if defined(LAMMPS_BIGBIG)
const tagint val = -9945234592L;
auto text = fmt::format("word {}", val);
constexpr tagint val = -9945234592L;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word -9945234592"));
#else
GTEST_SKIP();
@ -90,8 +90,8 @@ TEST(FmtLib, insert_neg_tagint)
TEST(FmtLib, insert_imageint)
{
#if defined(LAMMPS_BIGBIG)
const imageint val = 9945234592L;
auto text = fmt::format("word {}", val);
constexpr imageint val = 9945234592L;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word 9945234592"));
#else
GTEST_SKIP();
@ -101,8 +101,8 @@ TEST(FmtLib, insert_imageint)
TEST(FmtLib, insert_neg_imageint)
{
#if defined(LAMMPS_BIGBIG)
const imageint val = -9945234592L;
auto text = fmt::format("word {}", val);
constexpr imageint val = -9945234592L;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word -9945234592"));
#else
GTEST_SKIP();
@ -111,26 +111,38 @@ TEST(FmtLib, insert_neg_imageint)
TEST(FmtLib, insert_double)
{
const double val = 1.5;
auto text = fmt::format("word {}", val);
constexpr double val = 1.5;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word 1.5"));
}
TEST(FmtLib, insert_neg_double)
{
const double val = -1.5;
auto text = fmt::format("word {}", val);
constexpr double val = -1.5;
auto text = fmt::format("word {}", val);
ASSERT_THAT(text, Eq("word -1.5"));
}
TEST(FmtLib, int_for_double)
{
const double val = -1.5;
ASSERT_THROW(auto text = fmt::format("word {:d}", val), std::exception);
ASSERT_THROW(auto text = fmt::format(fmt::runtime("word {:d}"), val), std::exception);
}
TEST(FmtLib, double_for_int)
{
const int val = 15;
ASSERT_THROW(auto text = fmt::format("word {:g}", val), std::exception);
ASSERT_THROW(auto text = fmt::format(fmt::runtime("word {:g}"), val), std::exception);
}
TEST(FmtLib, double_for_string)
{
ASSERT_THROW(auto text = fmt::format(fmt::runtime("word {:g}"), "I am not a number"),
std::exception);
}
TEST(FmtLib, int_for_string)
{
ASSERT_THROW(auto text = fmt::format(fmt::runtime("word {:d}"), "I am not a number"),
std::exception);
}