Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions doc/src/Developer_unittest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,17 @@ are:
for this style. The fix rejects a timestep reset (its
``Fix::reset_dt()`` raises an error, e.g. :doc:`fix move
<fix_move>`), which would otherwise abort the test.
* - no_restart
- The ``fix_timestep`` tester skips the restarted-run comparisons
for this style. Part of the internal state of the fix (typically
the pRNG state of a stochastic fix like :doc:`fix langevin
<fix_langevin>`) is not stored in restart files, so a restarted
run cannot reproduce the reference trajectory.
* - no_t_target
- The ``fix_timestep`` tester does not compare the extracted
``t_target`` property against the input variable for this style,
because the fix computes its target temperature internally (e.g.
the :doc:`fix nphug <fix_nphug>` hugoniostat).
* - ellipsoid
- The test includes ellipsoids and thus requires :doc:`fix
nve/asphere <fix_nve_asphere>`.
Expand All @@ -795,8 +806,10 @@ are:
platforms, e.g. ARM64; Until a proper correction is found, tests
can be skipped with ``ctest -LE unstable``.
* - generated
- Indicates that a test input was regenerated. *Remove* after
confirming the correctness of the updated YAML file.
- Automatically added whenever reference data is generated or
regenerated; it marks data that has not been reviewed and
validated yet. *Remove* after confirming the correctness of the
updated YAML file.

Additional tests will check whether all listed extract keywords are
supported and have the correct dimensionality and the final set of tests
Expand Down
26 changes: 24 additions & 2 deletions src/BROWNIAN/fix_propel_self.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "domain.h"
#include "error.h"
#include "math_extra.h"
#include "respa.h"
#include "update.h"

#include <cmath>
#include <cstring>
Expand All @@ -40,7 +42,8 @@ static constexpr double SMALL = 1.0e-14;

/* ---------------------------------------------------------------------- */

FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), avec(nullptr)
FixPropelSelf::FixPropelSelf(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), ilevel_respa(0), avec(nullptr)
{

virial_global_flag = virial_peratom_flag = 1;
Expand Down Expand Up @@ -100,6 +103,12 @@ int FixPropelSelf::setmask()

void FixPropelSelf::init()
{
if (utils::strmatch(update->integrate_style, "^respa")) {
int max_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels - 1;
ilevel_respa = max_respa;
if (respa_level >= 0) ilevel_respa = MIN(respa_level, max_respa);
}

if (mode == DIPOLE && !atom->mu_flag)
error->all(FLERR, Error::NOLASTLINE,
"Fix propel/self with option dipole requires atom attribute mu");
Expand Down Expand Up @@ -129,7 +138,20 @@ void FixPropelSelf::init()

void FixPropelSelf::setup(int vflag)
{
post_force(vflag);
if (utils::strmatch(update->integrate_style, "^verlet"))
post_force(vflag);
else {
(dynamic_cast<Respa *>(update->integrate))->copy_flevel_f(ilevel_respa);
post_force_respa(vflag, ilevel_respa, 0);
(dynamic_cast<Respa *>(update->integrate))->copy_f_flevel(ilevel_respa);
}
}

/* ---------------------------------------------------------------------- */

void FixPropelSelf::post_force_respa(int vflag, int ilevel, int /*iloop*/)
{
if (ilevel == ilevel_respa) post_force(vflag);
}

/* ---------------------------------------------------------------------- */
Expand Down
2 changes: 2 additions & 0 deletions src/BROWNIAN/fix_propel_self.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ class FixPropelSelf : public Fix {

void init() override;
void post_force(int) override;
void post_force_respa(int, int, int) override;
void setup(int) override;
int setmask() override;

private:
double magnitude;
double sx, sy, sz;
int mode;
int ilevel_respa;

void post_force_dipole(int);
void post_force_velocity(int);
Expand Down
3 changes: 3 additions & 0 deletions src/EXTRA-FIX/fix_electron_stopping_fit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ void FixElectronStoppingFit::init()
f_dot_v_prior = 0.;
f_dot_v_current = 0.;
last_step = update->ntimestep;

if (utils::strmatch(update->integrate_style, "^respa"))
nlevels_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels;
};

// ---------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/EXTRA-FIX/fix_ffl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) :
restart_peratom = 1;
time_integrate = 1;
scalar_flag = 1;
extscalar = 1;

//gamma = 1 / time constant(tau)
gamma = utils::numeric(FLERR,arg[3],false,lmp);
Expand Down
5 changes: 5 additions & 0 deletions src/EXTRA-FIX/fix_wall_reflect_stochastic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) :
// random number generator

random = new RanMars(lmp,seedfix + comm->me);

// must re-create the dump image graphics objects: the base class
// constructor sized them before the walls were parsed here

allocate_image_objects();
}

/* ---------------------------------------------------------------------- */
Expand Down
14 changes: 14 additions & 0 deletions src/fix_wall_reflect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) :
if (wallstyle[m] == VARIABLE) varflag = 1;

// for rendering walls with dump image.
allocate_image_objects();
}

/* ----------------------------------------------------------------------
(re-)create the graphics objects for rendering walls with dump image.
must be (re-)done after parsing the walls, since derived classes
(e.g. fix wall/reflect/stochastic) parse their arguments themselves
and may arrive at a different wall count than the base class parser.
------------------------------------------------------------------------- */

void FixWallReflect::allocate_image_objects()
{
memory->destroy(imgobjs);
memory->destroy(imgparms);
if (domain->dimension == 2) {
// one cylinder object per wall to draw in 2d
memory->create(imgobjs, nwall, "fix_wall_reflect:imgobjs");
Expand Down
1 change: 1 addition & 0 deletions src/fix_wall_reflect.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class FixWallReflect : public Fix {
int *imgobjs;
double **imgparms;

void allocate_image_objects();
virtual void wall_particle(int m, int which, double coord);
};

Expand Down
15 changes: 8 additions & 7 deletions unittest/force-styles/test_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ class TestConfig {

[[nodiscard]] std::string tags_line() const
{
if (tags.size() > 0) {
std::string line = tags[0];
for (std::size_t i = 1; i < tags.size(); i++)
line += " " + tags[i];
return line;
}
return "generated";
// the "generated" tag is ALWAYS added when reference data is
// (re-)generated: it marks data that has not been reviewed and
// validated yet and is removed manually as the last step after
// validation. all other tags are passed through.
std::string line;
for (const auto &tag : tags)
if (tag != "generated") line += tag + " ";
return line + "generated";
}

// check whether a given keyword is present in the "tags:" list. used by the
Expand Down
21 changes: 16 additions & 5 deletions unittest/force-styles/test_fix_timestep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ LAMMPS *init_lammps(LAMMPS::argv &args, const TestConfig &cfg, const bool use_re

void restart_lammps(LAMMPS *lmp, const TestConfig &cfg, bool use_rmass, bool use_respa)
{
// styles tagged "no_restart" cannot reproduce the reference trajectory
// from a restart because part of their internal state (typically the RNG
// state of a stochastic fix) is not stored in restart files. skip the
// restarted run; the comparisons that follow then re-examine the still
// loaded final state of the normal run and pass trivially.
if (test_config.has_tag("no_restart")) return;

// utility lambda to improve readability
auto command = [&](const std::string &line) {
lmp->input->one(line);
Expand Down Expand Up @@ -358,11 +365,13 @@ TEST(FixTimestep, plain)
epsilon);
}

// check t_target for thermostats
// check t_target for thermostats. styles tagged "no_t_target"
// compute their target temperature internally (e.g. a hugoniostat),
// so it cannot be compared to the input variable.

int dim = -1;
auto *ptr = (double *)ifix->extract("t_target", dim);
if ((ptr != nullptr) && (dim == 0)) {
if ((ptr != nullptr) && (dim == 0) && !test_config.has_tag("no_t_target")) {
int ivar = lmp->input->variable->find("t_target");
if (ivar >= 0) {
double t_ref = atof(lmp->input->variable->retrieve("t_target"));
Expand Down Expand Up @@ -677,11 +686,13 @@ TEST(FixTimestep, omp)
epsilon);
}

// check t_target for thermostats
// check t_target for thermostats. styles tagged "no_t_target"
// compute their target temperature internally (e.g. a hugoniostat),
// so it cannot be compared to the input variable.

int dim = -1;
auto *ptr = (double *)ifix->extract("t_target", dim);
if ((ptr != nullptr) && (dim == 0)) {
if ((ptr != nullptr) && (dim == 0) && !test_config.has_tag("no_t_target")) {
int ivar = lmp->input->variable->find("t_target");
if (ivar >= 0) {
double t_ref = atof(lmp->input->variable->retrieve("t_target"));
Expand Down Expand Up @@ -1002,7 +1013,7 @@ static void run_kokkos_test(LAMMPS::argv &args)

int dim = -1;
double *ptr = (double *)ifix->extract("t_target", dim);
if ((ptr != nullptr) && (dim == 0)) {
if ((ptr != nullptr) && (dim == 0) && !test_config.has_tag("no_t_target")) {
int ivar = lmp->input->variable->find("t_target");
if (ivar >= 0) {
double t_ref = atof(lmp->input->variable->retrieve("t_target"));
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-ackland_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:32 2026
epsilon: 1e-08
timestep: 0.001
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-adf.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:37:03 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-aggregate_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:17 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-angle_local.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:47 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-angmom_chunk.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:33:56 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-basal_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:33 2026
epsilon: 1e-08
timestep: 0.001
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-bond_local.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:46 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-centro_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:49 2026
epsilon: 1e-08
timestep: 0.001
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-chunk_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:33:55 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-chunk_spread_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:03 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-cluster_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:16 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-cna_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:48 2026
epsilon: 1e-08
timestep: 0.001
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-com.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:37 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-com_chunk.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:42 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-coord_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:43 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-dihedral_local.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:21 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-dipole.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:38 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-dipole_chunk.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:00 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-displace_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:21:44 2026
epsilon: 1e-08
timestep: 0.25
Expand Down
2 changes: 1 addition & 1 deletion unittest/force-styles/tests/compute-entropy_atom.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
lammps_version: 4 Jul 2026
tags: generated
tags:
date_generated: Thu Jul 9 16:34:34 2026
epsilon: 1e-08
timestep: 0.001
Expand Down
Loading