From 5c11c5ead8de623f00d205bca549380df5b8f47f Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 28 Aug 2024 10:48:12 +0200 Subject: [PATCH 01/74] include variable definitions in region_plane.h --- src/region_plane.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/region_plane.h b/src/region_plane.h index 2025586a7c..0e4ecda6d4 100644 --- a/src/region_plane.h +++ b/src/region_plane.h @@ -28,13 +28,23 @@ class RegPlane : public Region { public: RegPlane(class LAMMPS *, int, char **); ~RegPlane() override; + void init() override; int inside(double, double, double) override; int surface_interior(double *, double) override; int surface_exterior(double *, double) override; + void shape_update() override; private: double xp, yp, zp; double normal[3]; + + int xstyle, xvar; + int ystyle, yvar; + int zstyle, zvar; + char *xstr, *ystr, *zstr; + + void variable_check(); + }; } // namespace LAMMPS_NS From 40cd70465cba86d7ea631cfe2c675c15fad90b39 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 28 Aug 2024 10:57:02 +0200 Subject: [PATCH 02/74] Code for variable point definition in region_plane.cpp --- src/region_plane.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 95 insertions(+), 4 deletions(-) diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 154b072633..d8c09fa3cb 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -14,20 +14,58 @@ #include "region_plane.h" #include "error.h" +#include "input.h" +#include "update.h" +#include "variable.h" #include using namespace LAMMPS_NS; +enum { CONSTANT, VARIABLE }; + /* ---------------------------------------------------------------------- */ -RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) +RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), + xstr(nullptr), ystr(nullptr), zstr(nullptr) { options(narg - 8, &arg[8]); - xp = xscale * utils::numeric(FLERR, arg[2], false, lmp); - yp = yscale * utils::numeric(FLERR, arg[3], false, lmp); - zp = zscale * utils::numeric(FLERR, arg[4], false, lmp); + if (utils::strmatch(arg[2], "^v_")) { + xstr = utils::strdup(arg[2] + 2); + xp = 0.0; + xstyle = VARIABLE; + varshape = 1; + } else { + xp = xscale * utils::numeric(FLERR, arg[2], false, lmp); + xstyle = CONSTANT; + } + + if (utils::strmatch(arg[3], "^v_")) { + ystr = utils::strdup(arg[3] + 2); + yp = 0.0; + ystyle = VARIABLE; + varshape = 1; + } else { + yp = yscale * utils::numeric(FLERR, arg[3], false, lmp); + ystyle = CONSTANT; + } + + if (utils::strmatch(arg[4], "^v_")) { + zstr = utils::strdup(arg[4] + 2); + zp = 0.0; + zstyle = VARIABLE; + varshape = 1; + } else { + zp = zscale * utils::numeric(FLERR, arg[4], false, lmp); + zstyle = CONSTANT; + } + + if (varshape) { + variable_check(); + RegPlane::shape_update(); + } + normal[0] = xscale * utils::numeric(FLERR, arg[5], false, lmp); normal[1] = yscale * utils::numeric(FLERR, arg[6], false, lmp); normal[2] = zscale * utils::numeric(FLERR, arg[7], false, lmp); @@ -54,9 +92,20 @@ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) RegPlane::~RegPlane() { + delete[] xstr; + delete[] ystr; + delete[] zstr; delete[] contact; } +/* ---------------------------------------------------------------------- */ + +void RegPlane::init() +{ + Region::init(); + if (varshape) variable_check(); +} + /* ---------------------------------------------------------------------- inside = 1 if x,y,z is on normal side of plane or on plane inside = 0 if x,y,z is on non-normal side of plane and not on plane @@ -113,3 +162,45 @@ int RegPlane::surface_exterior(double *x, double cutoff) } return 0; } + +/* ---------------------------------------------------------------------- + change region shape via variable evaluation +------------------------------------------------------------------------- */ + +void RegPlane::shape_update() +{ + if (xstyle == VARIABLE) xp = xscale * input->variable->compute_equal(xvar); + + if (ystyle == VARIABLE) yp = yscale * input->variable->compute_equal(yvar); + + if (zstyle == VARIABLE) zp = zscale * input->variable->compute_equal(zvar); +} + +/* ---------------------------------------------------------------------- + error check on existence of variable +------------------------------------------------------------------------- */ + +void RegPlane::variable_check() +{ + if (xstyle == VARIABLE) { + xvar = input->variable->find(xstr); + if (xvar < 0) error->all(FLERR, "Variable {} for region plane does not exist", xstr); + if (!input->variable->equalstyle(xvar)) + error->all(FLERR, "Variable {} for region plane is invalid style", xstr); + } + + if (ystyle == VARIABLE) { + yvar = input->variable->find(ystr); + if (yvar < 0) error->all(FLERR, "Variable {} for region plane does not exist", ystr); + if (!input->variable->equalstyle(yvar)) + error->all(FLERR, "Variable {} for region plane is invalid style", ystr); + } + + if (zstyle == VARIABLE) { + zvar = input->variable->find(zstr); + if (zvar < 0) error->all(FLERR, "Variable {} for region plane does not exist", zstr); + if (!input->variable->equalstyle(zvar)) + error->all(FLERR, "Variable {} for region plane is invalid style", zstr); + } +} + From 709ab8fbe92a1815382db0491c9965c16512b4dd Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 28 Aug 2024 11:04:47 +0200 Subject: [PATCH 03/74] Update region.rst --- doc/src/region.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/src/region.rst b/doc/src/region.rst index 9d2af01de1..7e3c95362c 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -34,10 +34,11 @@ Syntax *ellipsoid* args = x y z a b c x,y,z = center of ellipsoid (distance units) a,b,c = half the length of the principal axes of the ellipsoid (distance units) - x,y,z,a,b and c can be a variable (see below) + x,y,z,a,b and c can be a variable (see below) *plane* args = px py pz nx ny nz px,py,pz = point on the plane (distance units) nx,ny,nz = direction normal to plane (distance units) + px,py,pz can be a variable *prism* args = xlo xhi ylo yhi zlo zhi xy xz yz xlo,xhi,ylo,yhi,zlo,zhi = bounds of untilted prism (distance units) xy = distance to tilt y in x direction (distance units) @@ -46,7 +47,7 @@ Syntax *sphere* args = x y z radius x,y,z = center of sphere (distance units) radius = radius of sphere (distance units) - x,y,z, and radius can be a variable (see below) + x,y,z, and radius can be a variable (see below) *union* args = N reg-ID1 reg-ID2 ... N = # of regions to follow, must be 2 or greater reg-ID1,reg-ID2, ... = IDs of regions to join together @@ -203,12 +204,13 @@ and with radius as its radius. The *radius* value for styles *sphere* and *cylinder*, and the parameters a,b,c for style *ellipsoid*, can each be specified as an -equal-style :doc:`variable `. Likewise, for style *sphere* +equal-style :doc:`variable `. Likewise, for style *sphere* and *ellipsoid* the x-, y-, and z- coordinates of the center of the -sphere/ellipsoid can be specified as an equal-style variable. And for +sphere/ellipsoid can be specified as an equal-style variable. And for style *cylinder* the two center positions c1 and c2 for the location of the cylinder axes can be specified as a equal-style variable. For style *cone* -all properties can be defined via equal-style variables. +all properties can be defined via equal-style variables. For style *plane* +the point can be defined via equal-style variables. If the value is a variable, it should be specified as v_name, where name is the variable name. In this case, the variable will be From e3119155e138c3d7d4b3da070b7134b484de4d5e Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Wed, 28 Aug 2024 18:20:18 +0200 Subject: [PATCH 04/74] Update doc/src/region.rst Co-authored-by: Axel Kohlmeyer --- doc/src/region.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/region.rst b/doc/src/region.rst index 7e3c95362c..a6a9469381 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -38,7 +38,7 @@ Syntax *plane* args = px py pz nx ny nz px,py,pz = point on the plane (distance units) nx,ny,nz = direction normal to plane (distance units) - px,py,pz can be a variable + px,py,pz can be a variable *prism* args = xlo xhi ylo yhi zlo zhi xy xz yz xlo,xhi,ylo,yhi,zlo,zhi = bounds of untilted prism (distance units) xy = distance to tilt y in x direction (distance units) From 59fdfaf884ab6f8627968af67b981537692d280f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 31 Aug 2024 01:50:58 -0400 Subject: [PATCH 05/74] consistent indentation --- doc/src/region.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/region.rst b/doc/src/region.rst index a6a9469381..92fc2ec460 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -18,13 +18,13 @@ Syntax *delete* = no args *block* args = xlo xhi ylo yhi zlo zhi xlo,xhi,ylo,yhi,zlo,zhi = bounds of block in all dimensions (distance units) - xlo,xhi,ylo,yhi,zlo,zhi can be a variable + xlo,xhi,ylo,yhi,zlo,zhi can be a variable *cone* args = dim c1 c2 radlo radhi lo hi dim = *x* or *y* or *z* = axis of cone c1,c2 = coords of cone axis in other 2 dimensions (distance units) radlo,radhi = cone radii at lo and hi end (distance units) lo,hi = bounds of cone in dim (distance units) - c1,c2,radlo,radhi,lo,hi can be a variable (see below) + c1,c2,radlo,radhi,lo,hi can be a variable (see below) *cylinder* args = dim c1 c2 radius lo hi dim = *x* or *y* or *z* = axis of cylinder c1,c2 = coords of cylinder axis in other 2 dimensions (distance units) @@ -34,7 +34,7 @@ Syntax *ellipsoid* args = x y z a b c x,y,z = center of ellipsoid (distance units) a,b,c = half the length of the principal axes of the ellipsoid (distance units) - x,y,z,a,b and c can be a variable (see below) + x,y,z,a,b and c can be a variable (see below) *plane* args = px py pz nx ny nz px,py,pz = point on the plane (distance units) nx,ny,nz = direction normal to plane (distance units) @@ -47,7 +47,7 @@ Syntax *sphere* args = x y z radius x,y,z = center of sphere (distance units) radius = radius of sphere (distance units) - x,y,z, and radius can be a variable (see below) + x,y,z, and radius can be a variable (see below) *union* args = N reg-ID1 reg-ID2 ... N = # of regions to follow, must be 2 or greater reg-ID1,reg-ID2, ... = IDs of regions to join together @@ -209,7 +209,7 @@ and *ellipsoid* the x-, y-, and z- coordinates of the center of the sphere/ellipsoid can be specified as an equal-style variable. And for style *cylinder* the two center positions c1 and c2 for the location of the cylinder axes can be specified as a equal-style variable. For style *cone* -all properties can be defined via equal-style variables. For style *plane* +all properties can be defined via equal-style variables. For style *plane* the point can be defined via equal-style variables. If the value is a variable, it should be specified as v_name, where From b2ce4051aa27b4092df03e817bf1adf73d7a2717 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 31 Aug 2024 01:53:54 -0400 Subject: [PATCH 06/74] Consistent spacing after full stops. --- doc/src/region.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/src/region.rst b/doc/src/region.rst index 92fc2ec460..7ceef94b04 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -167,7 +167,7 @@ extending in the y-direction from -5.0 to the upper box boundary. .. versionadded:: 4May2022 -For style *ellipsoid*, an axis-aligned ellipsoid is defined. The +For style *ellipsoid*, an axis-aligned ellipsoid is defined. The ellipsoid has its center at (x,y,z) and is defined by 3 axis-aligned vectors given by A = (a,0,0); B = (0,b,0); C = (0,0,c). Note that although the ellipsoid is specified as axis-aligned it can be rotated @@ -204,13 +204,13 @@ and with radius as its radius. The *radius* value for styles *sphere* and *cylinder*, and the parameters a,b,c for style *ellipsoid*, can each be specified as an -equal-style :doc:`variable `. Likewise, for style *sphere* +equal-style :doc:`variable `. Likewise, for style *sphere* and *ellipsoid* the x-, y-, and z- coordinates of the center of the -sphere/ellipsoid can be specified as an equal-style variable. And for -style *cylinder* the two center positions c1 and c2 for the location -of the cylinder axes can be specified as a equal-style variable. For style *cone* -all properties can be defined via equal-style variables. For style *plane* -the point can be defined via equal-style variables. +sphere/ellipsoid can be specified as an equal-style variable. And for +style *cylinder* the two center positions c1 and c2 for the location of +the cylinder axes can be specified as a equal-style variable. For style +*cone* all properties can be defined via equal-style variables. For +style *plane* the point can be defined via equal-style variables. If the value is a variable, it should be specified as v_name, where name is the variable name. In this case, the variable will be From a7649309983650785d70f203cff4bea414e3b720 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 31 Aug 2024 02:00:30 -0400 Subject: [PATCH 07/74] consolidate replicated enum to base class header and inside the class definition --- src/region.h | 2 ++ src/region_block.cpp | 2 -- src/region_cone.cpp | 2 -- src/region_cylinder.cpp | 2 -- src/region_ellipsoid.cpp | 2 -- src/region_plane.cpp | 2 -- src/region_sphere.cpp | 2 -- 7 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/region.h b/src/region.h index f273485dce..19fdec31c7 100644 --- a/src/region.h +++ b/src/region.h @@ -20,6 +20,8 @@ namespace LAMMPS_NS { class Region : protected Pointers { public: + enum { CONSTANT, VARIABLE }; + char *id, *style; Region **reglist; int interior; // 1 for interior, 0 for exterior diff --git a/src/region_block.cpp b/src/region_block.cpp index efa3d8ca6a..9376016843 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -23,8 +23,6 @@ using namespace LAMMPS_NS; -enum { CONSTANT, VARIABLE }; - static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/region_cone.cpp b/src/region_cone.cpp index dc37eeefe3..401ed53735 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -27,8 +27,6 @@ using namespace LAMMPS_NS; -enum { CONSTANT, VARIABLE }; - static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index 11783dc125..2ad0ba82f5 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -26,8 +26,6 @@ using namespace LAMMPS_NS; static constexpr double BIG = 1.0e20; -enum { CONSTANT, VARIABLE }; - /* ---------------------------------------------------------------------- */ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : diff --git a/src/region_ellipsoid.cpp b/src/region_ellipsoid.cpp index daabd621c8..a0b4b9e544 100644 --- a/src/region_ellipsoid.cpp +++ b/src/region_ellipsoid.cpp @@ -23,8 +23,6 @@ using namespace LAMMPS_NS; -enum { CONSTANT, VARIABLE }; - static double GetRoot2D(double r0, double z0, double z1, double g); static double GetRoot3D(double r0, double r1, double z0, double z1, double z2, double g); diff --git a/src/region_plane.cpp b/src/region_plane.cpp index d8c09fa3cb..5917efc11b 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -22,8 +22,6 @@ using namespace LAMMPS_NS; -enum { CONSTANT, VARIABLE }; - /* ---------------------------------------------------------------------- */ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index cd20a697d4..f449978938 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -22,8 +22,6 @@ using namespace LAMMPS_NS; -enum { CONSTANT, VARIABLE }; - /* ---------------------------------------------------------------------- */ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : From 0ebd4f5ddb5f2efa909237df9e3b508d3ada1bc3 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Wed, 11 Sep 2024 21:33:07 -0600 Subject: [PATCH 08/74] Make CMake Doc build docenv optional --- cmake/Modules/Documentation.cmake | 48 +++++++++++++++++++------------ cmake/Modules/FindSphinx.cmake | 29 +++++++++++++++++++ 2 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 cmake/Modules/FindSphinx.cmake diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 400109067f..7b8f4a5ba0 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -4,6 +4,8 @@ option(BUILD_DOC "Build LAMMPS HTML documentation" OFF) if(BUILD_DOC) + option(BUILD_DOC_VENV "Build LAMMPS documentation virtual environment" ON) + mark_as_advanced(BUILD_DOC_VENV) # Current Sphinx versions require at least Python 3.8 # use default (or custom) Python executable, if version is sufficient if(Python_VERSION VERSION_GREATER_EQUAL 3.8) @@ -18,14 +20,6 @@ if(BUILD_DOC) find_package(Doxygen 1.8.10 REQUIRED) file(GLOB DOC_SOURCES CONFIGURE_DEPENDS ${LAMMPS_DOC_DIR}/src/[^.]*.rst) - add_custom_command( - OUTPUT docenv - COMMAND ${VIRTUALENV} docenv - ) - - set(DOCENV_BINARY_DIR ${CMAKE_BINARY_DIR}/docenv/bin) - set(DOCENV_REQUIREMENTS_FILE ${LAMMPS_DOC_DIR}/utils/requirements.txt) - set(SPHINX_CONFIG_DIR ${LAMMPS_DOC_DIR}/utils/sphinx-config) set(SPHINX_CONFIG_FILE_TEMPLATE ${SPHINX_CONFIG_DIR}/conf.py.in) set(SPHINX_STATIC_DIR ${SPHINX_CONFIG_DIR}/_static) @@ -44,14 +38,32 @@ if(BUILD_DOC) # configure paths in conf.py, since relative paths change when file is copied configure_file(${SPHINX_CONFIG_FILE_TEMPLATE} ${DOC_BUILD_CONFIG_FILE}) - add_custom_command( - OUTPUT ${DOC_BUILD_DIR}/requirements.txt - DEPENDS docenv ${DOCENV_REQUIREMENTS_FILE} - COMMAND ${CMAKE_COMMAND} -E copy ${DOCENV_REQUIREMENTS_FILE} ${DOC_BUILD_DIR}/requirements.txt - COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install --upgrade pip - COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install --upgrade ${LAMMPS_DOC_DIR}/utils/converters - COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade - ) + if(BUILD_DOC_VENV) + add_custom_command( + OUTPUT docenv + COMMAND ${VIRTUALENV} docenv + ) + + set(DOCENV_BINARY_DIR ${CMAKE_BINARY_DIR}/docenv/bin) + set(DOCENV_REQUIREMENTS_FILE ${LAMMPS_DOC_DIR}/utils/requirements.txt) + + add_custom_command( + OUTPUT ${DOC_BUILD_DIR}/requirements.txt + DEPENDS docenv ${DOCENV_REQUIREMENTS_FILE} + COMMAND ${CMAKE_COMMAND} -E copy ${DOCENV_REQUIREMENTS_FILE} ${DOC_BUILD_DIR}/requirements.txt + COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install --upgrade pip + COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install --upgrade ${LAMMPS_DOC_DIR}/utils/converters + COMMAND ${DOCENV_BINARY_DIR}/pip $ENV{PIP_OPTIONS} install -r ${DOC_BUILD_DIR}/requirements.txt --upgrade + ) + + set(DOCENV_DEPS docenv ${DOC_BUILD_DIR}/requirements.txt) + if(NOT TARGET Sphinx::sphinx-build) + add_executable(Sphinx::sphinx-build IMPORTED GLOBAL) + set_target_properties(Sphinx::sphinx-build PROPERTIES IMPORTED_LOCATION "${DOCENV_BINARY_DIR}/sphinx-build") + endif() + else() + find_package(Sphinx) + endif() set(MATHJAX_URL "https://github.com/mathjax/MathJax/archive/3.1.3.tar.gz" CACHE STRING "URL for MathJax tarball") set(MATHJAX_MD5 "b81661c6e6ba06278e6ae37b30b0c492" CACHE STRING "MD5 checksum of MathJax tarball") @@ -97,8 +109,8 @@ if(BUILD_DOC) endif() add_custom_command( OUTPUT html - DEPENDS ${DOC_SOURCES} docenv ${DOC_BUILD_DIR}/requirements.txt ${DOXYGEN_XML_DIR}/index.xml ${BUILD_DOC_CONFIG_FILE} - COMMAND ${DOCENV_BINARY_DIR}/sphinx-build ${SPHINX_EXTRA_OPTS} -b html -c ${DOC_BUILD_DIR} -d ${DOC_BUILD_DIR}/doctrees ${LAMMPS_DOC_DIR}/src ${DOC_BUILD_DIR}/html + DEPENDS ${DOC_SOURCES} ${DOCENV_DEPS} ${DOXYGEN_XML_DIR}/index.xml ${BUILD_DOC_CONFIG_FILE} + COMMAND Sphinx::sphinx-build ${SPHINX_EXTRA_OPTS} -b html -c ${DOC_BUILD_DIR} -d ${DOC_BUILD_DIR}/doctrees ${LAMMPS_DOC_DIR}/src ${DOC_BUILD_DIR}/html COMMAND ${CMAKE_COMMAND} -E create_symlink Manual.html ${DOC_BUILD_DIR}/html/index.html COMMAND ${CMAKE_COMMAND} -E copy_directory ${LAMMPS_DOC_DIR}/src/PDF ${DOC_BUILD_DIR}/html/PDF COMMAND ${CMAKE_COMMAND} -E remove -f ${DOXYGEN_XML_DIR}/run.stamp diff --git a/cmake/Modules/FindSphinx.cmake b/cmake/Modules/FindSphinx.cmake new file mode 100644 index 0000000000..3718ecc543 --- /dev/null +++ b/cmake/Modules/FindSphinx.cmake @@ -0,0 +1,29 @@ +# Find sphinx-build +find_program(Sphinx_EXECUTABLE NAMES sphinx-build + PATH_SUFFIXES bin + DOC "Sphinx documenation build executable") +mark_as_advanced(Sphinx_EXECUTABLE) + +if(Sphinx_EXECUTABLE) + execute_process(COMMAND ${Sphinx_EXECUTABLE} --version + OUTPUT_VARIABLE sphinx_version + OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE _sphinx_version_result) + + if(_sphinx_version_result) + message(WARNING "Unable to determine sphinx-build verison: ${_sphinx_version_result}") + else() + string(REGEX REPLACE "sphinx-build ([0-9.]+).*" + "\\1" + Sphinx_VERSION + "${sphinx_version}") + endif() + + if(NOT TARGET Sphinx::sphinx-build) + add_executable(Sphinx::sphinx-build IMPORTED GLOBAL) + set_target_properties(Sphinx::sphinx-build PROPERTIES IMPORTED_LOCATION "${Sphinx_EXECUTABLE}") + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sphinx REQUIRED_VARS Sphinx_EXECUTABLE VERSION_VAR Sphinx_VERSION) From 18f1d32f8e5f97c6f6e6694fcde021795a311d5f Mon Sep 17 00:00:00 2001 From: jmgoff <34103038+jmgoff@users.noreply.github.com> Date: Thu, 12 Sep 2024 09:00:55 -0600 Subject: [PATCH 09/74] Apply suggestions from code review Co-authored-by: Axel Kohlmeyer --- doc/src/region.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/region.rst b/doc/src/region.rst index 7ceef94b04..3a27c4b5ff 100644 --- a/doc/src/region.rst +++ b/doc/src/region.rst @@ -18,7 +18,7 @@ Syntax *delete* = no args *block* args = xlo xhi ylo yhi zlo zhi xlo,xhi,ylo,yhi,zlo,zhi = bounds of block in all dimensions (distance units) - xlo,xhi,ylo,yhi,zlo,zhi can be a variable + xlo,xhi,ylo,yhi,zlo,zhi can be a variable (see below) *cone* args = dim c1 c2 radlo radhi lo hi dim = *x* or *y* or *z* = axis of cone c1,c2 = coords of cone axis in other 2 dimensions (distance units) @@ -38,7 +38,7 @@ Syntax *plane* args = px py pz nx ny nz px,py,pz = point on the plane (distance units) nx,ny,nz = direction normal to plane (distance units) - px,py,pz can be a variable + px,py,pz can be a variable (see below) *prism* args = xlo xhi ylo yhi zlo zhi xy xz yz xlo,xhi,ylo,yhi,zlo,zhi = bounds of untilted prism (distance units) xy = distance to tilt y in x direction (distance units) From 1adaab80aae703bdee10704510caab5d00becee2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 13 Sep 2024 00:11:13 -0400 Subject: [PATCH 10/74] make certain values for LAMMPS variables are initialized --- src/region_plane.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 5917efc11b..6dc162eead 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -27,6 +27,8 @@ using namespace LAMMPS_NS; RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr) { + xvar = yvar = zvar = 0.0; + options(narg - 8, &arg[8]); if (utils::strmatch(arg[2], "^v_")) { From 92bd9fc16105d272c874edf69b9e4990b48cf0c4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 13 Sep 2024 02:18:48 -0400 Subject: [PATCH 11/74] fix linking a URL and fix spelling --- doc/src/Build_settings.rst | 3 +-- doc/utils/sphinx-config/false_positives.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 2787560be5..e4a53ddee7 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -229,8 +229,7 @@ can be used with the Intel or GNU compiler (see the ``FFT_LIB`` setting above). The NVIDIA Performance Libraries (NVPL) FFT library is optimized for NVIDIA -Grace Armv9.0 architecture. You can download it from -`https://docs.nvidia.com/nvpl/`_. +Grace Armv9.0 architecture. You can download it from https://docs.nvidia.com/nvpl/ The cuFFT and hipFFT FFT libraries are packaged with NVIDIA's CUDA and AMD's HIP installations, respectively. These FFT libraries require the diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 3a714ffdd6..70d6b4e323 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -141,6 +141,7 @@ arg arge args argv +Armv arrhenius Arun arXiv From fe8611bfc85010e57b9466d8c39273be8f3f1831 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 13 Sep 2024 22:55:05 -0400 Subject: [PATCH 12/74] sync author info with LAMMPS home page --- doc/src/Intro_authors.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/Intro_authors.rst b/doc/src/Intro_authors.rst index 78c8506421..84470ba3a0 100644 --- a/doc/src/Intro_authors.rst +++ b/doc/src/Intro_authors.rst @@ -56,7 +56,7 @@ lammps.org". General questions about LAMMPS should be posted in the - SNL - jmgoff at sandia.gov - machine learned potentials, QEq solvers, Python - * - Megan McCarthy + * - Meg McCarthy - SNL - megmcca at sandia.gov - alloys, micro-structure, machine learned potentials @@ -67,7 +67,7 @@ lammps.org". General questions about LAMMPS should be posted in the * - `Trung Nguyen `_ - U Chicago - ndactrung at gmail.com - - soft matter, GPU package + - soft matter, GPU package, DIELECTRIC package, regression testing .. _rb: https://rbberger.github.io/ .. _gc: https://enthalpiste.fr/ From bdca275f1032aa56ce8d2b63dc76dc943f59b0fc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 14 Sep 2024 02:25:03 -0400 Subject: [PATCH 13/74] correct indexing when filling lmp_firstneigh array --- src/ML-IAP/mliap_data.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ML-IAP/mliap_data.cpp b/src/ML-IAP/mliap_data.cpp index 5d847ee25e..1ca57e2745 100644 --- a/src/ML-IAP/mliap_data.cpp +++ b/src/ML-IAP/mliap_data.cpp @@ -185,7 +185,6 @@ void MLIAPData::generate_neighdata(NeighList *list_in, int eflag_in, int vflag_i int jtype = type[j]; const int jelem = map[jtype]; - lmp_firstneigh[ii][jj] = firstneigh[i][jj]; if (rsq < descriptor->cutsq[ielem][jelem]) { pair_i[ij] = i; jatoms[ij] = j; @@ -193,6 +192,7 @@ void MLIAPData::generate_neighdata(NeighList *list_in, int eflag_in, int vflag_i rij[ij][0] = delx; rij[ij][1] = dely; rij[ij][2] = delz; + lmp_firstneigh[ii][ninside] = firstneigh[i][jj]; ij++; ninside++; } @@ -228,6 +228,7 @@ void MLIAPData::grow_neigharrays() memory->grow(ielems, natomneigh, "MLIAPData:ielems"); memory->grow(itypes, natomneigh, "MLIAPData:itypes"); memory->grow(numneighs, natomneigh, "MLIAPData:numneighs"); + memory->grow(lmp_firstneigh, natomneigh, nneigh_max, "MLIAPData:lmp_firstneigh"); natomneigh_max = natomneigh; } From 1587473ab58559d895d2811d6dd8fe845e8d0015 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 14 Sep 2024 05:02:18 -0400 Subject: [PATCH 14/74] fix comparison for missing arguments when using wildcards --- src/EXTRA-FIX/fix_ave_correlate_long.cpp | 4 ++-- src/fix_ave_chunk.cpp | 22 +++++++++++----------- src/fix_ave_grid.cpp | 14 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index 738ae3ae4c..abb1ad87de 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -166,12 +166,12 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS *lmp, int narg, char **arg) : overwrite = 1; iarg += 1; } else if (strcmp(arg[iarg], "title1") == 0) { - if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix ave/correlate/long title1", error); + if (iarg + 2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/correlate/long title1", error); delete[] title1; title1 = utils::strdup(arg[iarg + 1]); iarg += 2; } else if (strcmp(arg[iarg], "title2") == 0) { - if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix ave/correlate/long title2", error); + if (iarg + 2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/correlate/long title2", error); delete[] title2; title2 = utils::strdup(arg[iarg + 1]); iarg += 2; diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index d9723cec9f..6a3c2e2032 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -153,7 +153,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : while (iarg < nargnew) { if (strcmp(arg[iarg],"norm") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk norm", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk norm", error); if (strcmp(arg[iarg+1],"all") == 0) { normflag = ALL; scaleflag = ATOM; @@ -166,13 +166,13 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Unknown fix ave/chunk norm mode: {}", arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"ave") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk ave", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk ave", error); if (strcmp(arg[iarg+1],"one") == 0) ave = ONE; else if (strcmp(arg[iarg+1],"running") == 0) ave = RUNNING; else if (strcmp(arg[iarg+1],"window") == 0) ave = WINDOW; else error->all(FLERR,"Unknown fix ave/chunk ave mode: {}", arg[iarg+1]); if (ave == WINDOW) { - if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk ave window", error); + if (iarg+3 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk ave window", error); nwindow = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/chunk number of windows: {}", nwindow); } @@ -180,21 +180,21 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : if (ave == WINDOW) iarg++; } else if (strcmp(arg[iarg],"bias") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk bias", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk bias", error); biasflag = 1; id_bias = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"adof") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk adof", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk adof", error); adof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"cdof") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk cdof", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk cdof", error); cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if ((strcmp(arg[iarg],"file") == 0) || (strcmp(arg[iarg],"append") == 0)) { - if (iarg+2 > narg) + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, std::string("fix ave/chunk ")+arg[iarg], error); if (comm->me == 0) { if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); @@ -208,23 +208,23 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : overwrite = 1; iarg += 1; } else if (strcmp(arg[iarg],"format") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk format", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk format", error); delete[] format_user; format_user = utils::strdup(arg[iarg+1]); format = format_user; iarg += 2; } else if (strcmp(arg[iarg],"title1") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk title1", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk title1", error); delete[] title1; title1 = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"title2") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk title2", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk title2", error); delete[] title2; title2 = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"title3") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/chunk title3", error); + if (iarg+2 > nargnew) utils::missing_cmd_args(FLERR, "fix ave/chunk title3", error); delete[] title3; title3 = utils::strdup(arg[iarg+1]); iarg += 2; diff --git a/src/fix_ave_grid.cpp b/src/fix_ave_grid.cpp index ca89c918ba..1b69c5644c 100644 --- a/src/fix_ave_grid.cpp +++ b/src/fix_ave_grid.cpp @@ -199,14 +199,14 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : while (iarg < nargnew) { if (strcmp(arg[iarg],"discard") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/grid command"); + if (iarg+2 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); if (strcmp(arg[iarg+1],"yes") == 0) discardflag = DISCARD; else if (strcmp(arg[iarg+1],"no") == 0) discardflag = KEEP; else error->all(FLERR,"Illegal fix ave/grid command"); iarg += 2; } else if (strcmp(arg[iarg],"norm") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/grid command"); + if (iarg+2 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); if (strcmp(arg[iarg+1],"all") == 0) normflag = ALL; else if (strcmp(arg[iarg+1],"sample") == 0) normflag = SAMPLE; else if (strcmp(arg[iarg+1],"none") == 0) normflag = NONORM; @@ -214,13 +214,13 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"ave") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/grid command"); + if (iarg+2 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); if (strcmp(arg[iarg+1],"one") == 0) aveflag = ONE; else if (strcmp(arg[iarg+1],"running") == 0) aveflag = RUNNING; else if (strcmp(arg[iarg+1],"window") == 0) aveflag = WINDOW; else error->all(FLERR,"Illegal fix ave/grid command"); if (aveflag == WINDOW) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/grid command"); + if (iarg+3 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); nwindow = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/grid command"); iarg++; @@ -228,19 +228,19 @@ FixAveGrid::FixAveGrid(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"bias") == 0) { - if (iarg+2 > narg) + if (iarg+2 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); biasflag = 1; id_bias = utils::strdup(arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg],"adof") == 0) { - if (iarg+2 > narg) + if (iarg+2 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); adof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"cdof") == 0) { - if (iarg+2 > narg) + if (iarg+2 > nargnew) error->all(FLERR,"Illegal fix ave/grid command"); cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; From 79fbd46bd9900d1e13fb6ab02a1f18dda7d91a01 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 14 Sep 2024 06:04:35 -0400 Subject: [PATCH 15/74] try out concurrency group feature on quick regression as suggested by @junghans --- .github/workflows/quick-regression.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/quick-regression.yml b/.github/workflows/quick-regression.yml index 985177b2c1..6174d57ec2 100644 --- a/.github/workflows/quick-regression.yml +++ b/.github/workflows/quick-regression.yml @@ -8,6 +8,10 @@ on: workflow_dispatch: +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{github.event_name == 'pull_request'}} + jobs: build: name: Build LAMMPS From 8c4e67c10baab6f15af120befd6a5a412c6f444f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 14 Sep 2024 06:07:07 -0400 Subject: [PATCH 16/74] add concurrency group feature to unit test workflows, too. --- .github/workflows/compile-msvc.yml | 4 ++++ .github/workflows/unittest-linux.yml | 4 ++++ .github/workflows/unittest-macos.yml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/.github/workflows/compile-msvc.yml b/.github/workflows/compile-msvc.yml index 03af27788b..7560bc0549 100644 --- a/.github/workflows/compile-msvc.yml +++ b/.github/workflows/compile-msvc.yml @@ -11,6 +11,10 @@ on: workflow_dispatch: +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{github.event_name == 'pull_request'}} + jobs: build: name: Windows Compilation Test diff --git a/.github/workflows/unittest-linux.yml b/.github/workflows/unittest-linux.yml index 366db25a99..dcf495ccc0 100644 --- a/.github/workflows/unittest-linux.yml +++ b/.github/workflows/unittest-linux.yml @@ -11,6 +11,10 @@ on: workflow_dispatch: +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{github.event_name == 'pull_request'}} + jobs: build: name: Linux Unit Test diff --git a/.github/workflows/unittest-macos.yml b/.github/workflows/unittest-macos.yml index b0bc4b2727..0d478a9d6b 100644 --- a/.github/workflows/unittest-macos.yml +++ b/.github/workflows/unittest-macos.yml @@ -11,6 +11,10 @@ on: workflow_dispatch: +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{github.event_name == 'pull_request'}} + jobs: build: name: MacOS Unit Test From 44d86c378b8778ccef40ff30bb063ef29042034e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 00:34:28 -0400 Subject: [PATCH 17/74] relax epsilon or mark unstable based on test results on non-x86 architectures --- unittest/force-styles/tests/atomic-pair-meam_ms.yaml | 2 +- unittest/force-styles/tests/atomic-pair-pedone.yaml | 2 +- .../tests/dihedral-cosine_squared_restricted.yaml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unittest/force-styles/tests/atomic-pair-meam_ms.yaml b/unittest/force-styles/tests/atomic-pair-meam_ms.yaml index fff938d940..d8dcd7b1eb 100644 --- a/unittest/force-styles/tests/atomic-pair-meam_ms.yaml +++ b/unittest/force-styles/tests/atomic-pair-meam_ms.yaml @@ -2,7 +2,7 @@ lammps_version: 7 Feb 2024 tags: slow date_generated: Wed Feb 28 17:07:42 2024 -epsilon: 2.5e-12 +epsilon: 2.5e-11 skip_tests: prerequisites: ! | pair meam/ms diff --git a/unittest/force-styles/tests/atomic-pair-pedone.yaml b/unittest/force-styles/tests/atomic-pair-pedone.yaml index ea97d9ee8c..82c6405e65 100644 --- a/unittest/force-styles/tests/atomic-pair-pedone.yaml +++ b/unittest/force-styles/tests/atomic-pair-pedone.yaml @@ -1,6 +1,6 @@ --- lammps_version: 7 Feb 2024 -tags: +tags: unstable date_generated: Tue Apr 9 07:44:34 2024 epsilon: 7.5e-13 skip_tests: diff --git a/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml b/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml index f67a093017..3f4d217b9a 100644 --- a/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml +++ b/unittest/force-styles/tests/dihedral-cosine_squared_restricted.yaml @@ -1,8 +1,8 @@ --- lammps_version: 7 Feb 2024 -tags: +tags: date_generated: Sat Apr 13 11:41:16 2024 -epsilon: 2.5e-13 +epsilon: 1.0e-11 skip_tests: prerequisites: ! | atom full From f8eac8772458943b31618e36200b59b0af86306e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 00:56:09 -0400 Subject: [PATCH 18/74] make programming style check and doc info check a github action --- .github/workflows/style-check.yml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/style-check.yml diff --git a/.github/workflows/style-check.yml b/.github/workflows/style-check.yml new file mode 100644 index 0000000000..ce07215b11 --- /dev/null +++ b/.github/workflows/style-check.yml @@ -0,0 +1,38 @@ +# GitHub action to run checks from tools/coding_standard +name: "Check for Programming Style Conformance" + +on: + push: + branches: + - develop + pull_request: + branches: + - develop + + workflow_dispatch: + +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{github.event_name == 'pull_request'}} + +jobs: + build: + name: Programming Style Conformance + if: ${{ github.repository == 'lammps/lammps' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Tests + working-directory: src + shell: bash + run: | + make check-whitespace + make check-permissions + make check-homepage + make check-error-docs + make check-docs From 4a9b7b1ba71a5f90e07aaa813c333626d0ca110e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 00:59:43 -0400 Subject: [PATCH 19/74] fix typo --- .github/workflows/style-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/style-check.yml b/.github/workflows/style-check.yml index ce07215b11..7be468d230 100644 --- a/.github/workflows/style-check.yml +++ b/.github/workflows/style-check.yml @@ -34,5 +34,5 @@ jobs: make check-whitespace make check-permissions make check-homepage - make check-error-docs + make check-errordocs make check-docs From 80cd9ace577a906b6ce8b19943c91576648b819f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 01:07:38 -0400 Subject: [PATCH 20/74] remove documentation check (for now) --- .github/workflows/style-check.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/style-check.yml b/.github/workflows/style-check.yml index 7be468d230..7be2c4fc46 100644 --- a/.github/workflows/style-check.yml +++ b/.github/workflows/style-check.yml @@ -35,4 +35,3 @@ jobs: make check-permissions make check-homepage make check-errordocs - make check-docs From 804aa4ee85495aec62d39de755626703d6882d24 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 20:38:50 -0400 Subject: [PATCH 21/74] improve error message --- src/variable.cpp | 2 +- unittest/commands/test_variables.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/variable.cpp b/src/variable.cpp index b2f6c2882c..279c14d999 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -613,7 +613,7 @@ void Variable::set(int narg, char **arg) // unrecognized variable style - } else error->all(FLERR,"Unknown variable keyword: {}", arg[1]); + } else error->all(FLERR,"Unknown variable style: {}", arg[1]); // set name of variable, if not replacing one flagged with replaceflag // name must be all alphanumeric chars or underscores diff --git a/unittest/commands/test_variables.cpp b/unittest/commands/test_variables.cpp index 2390b1b675..c7686cbf12 100644 --- a/unittest/commands/test_variables.cpp +++ b/unittest/commands/test_variables.cpp @@ -206,7 +206,7 @@ TEST_F(VariableTest, CreateDelete) TEST_FAILURE(".*ERROR: Invalid variable loop argument: -1.*", command("variable dummy loop -1");); TEST_FAILURE(".*ERROR: Illegal variable loop command.*", command("variable dummy loop 10 1");); - TEST_FAILURE(".*ERROR: Unknown variable keyword: xxx.*", command("variable dummy xxxx");); + TEST_FAILURE(".*ERROR: Unknown variable style: xxx.*", command("variable dummy xxxx");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", command("variable two string xxx");); TEST_FAILURE(".*ERROR: Cannot redefine variable as a different style.*", From 11365e7b2e0c6e3920275a8b338b1fcd9444752c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 20:48:41 -0400 Subject: [PATCH 22/74] add extract method to bond style harmonic/shift --- src/EXTRA-MOLECULE/bond_harmonic_shift.cpp | 13 +++++++++++++ src/EXTRA-MOLECULE/bond_harmonic_shift.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/EXTRA-MOLECULE/bond_harmonic_shift.cpp b/src/EXTRA-MOLECULE/bond_harmonic_shift.cpp index bd106c8567..6c87d47f5e 100644 --- a/src/EXTRA-MOLECULE/bond_harmonic_shift.cpp +++ b/src/EXTRA-MOLECULE/bond_harmonic_shift.cpp @@ -228,3 +228,16 @@ void BondHarmonicShift::born_matrix(int type, double rsq, int /*i*/, int /*j*/, du2 = 2 * k[type]; if (r > 0.0) du = du2 * dr; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *BondHarmonicShift::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "r0") == 0) return (void *) r0; + if (strcmp(str, "r1") == 0) return (void *) r1; + return nullptr; +} diff --git a/src/EXTRA-MOLECULE/bond_harmonic_shift.h b/src/EXTRA-MOLECULE/bond_harmonic_shift.h index 922f1ba00d..68afc57bf7 100644 --- a/src/EXTRA-MOLECULE/bond_harmonic_shift.h +++ b/src/EXTRA-MOLECULE/bond_harmonic_shift.h @@ -36,6 +36,7 @@ class BondHarmonicShift : public Bond { void write_data(FILE *) override; double single(int, double, int, int, double &) override; void born_matrix(int, double, int, int, double &, double &) override; + void *extract(const char *, int &); protected: double *k, *r0, *r1; From 5d40a9640d47ed7ffb75a59988552d1eab3ef7df Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 20:49:44 -0400 Subject: [PATCH 23/74] add support for bond style hybrid to fix adapt --- src/bond_hybrid.cpp | 8 ++++++++ src/bond_hybrid.h | 2 ++ src/fix_adapt.cpp | 27 ++++++++++++++++++++------- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index 307cbd72fd..bd5badb54c 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -385,6 +385,14 @@ void BondHybrid::init_style() else map[0] = -1; } +/* ---------------------------------------------------------------------- */ + +int BondHybrid::check_itype(int itype, char *substyle) +{ + if (strcmp(keywords[map[itype]], substyle) == 0) return 1; + return 0; +} + /* ---------------------------------------------------------------------- return an equilbrium bond length ------------------------------------------------------------------------- */ diff --git a/src/bond_hybrid.h b/src/bond_hybrid.h index ba520b81b4..d93b5c7558 100644 --- a/src/bond_hybrid.h +++ b/src/bond_hybrid.h @@ -44,6 +44,8 @@ class BondHybrid : public Bond { double single(int, double, int, int, double &) override; double memory_usage() override; + int check_itype(int, char *); + protected: int *map; // which style each bond type points to int has_quartic; // which style, if any is a quartic bond style diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index cad157f2be..6bab704c22 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -17,6 +17,7 @@ #include "angle.h" #include "atom.h" #include "bond.h" +#include "bond_hybrid.h" #include "domain.h" #include "error.h" #include "fix_store_atom.h" @@ -386,11 +387,15 @@ void FixAdapt::init() if (utils::strmatch(force->pair_style,"^hybrid")) { auto pair = dynamic_cast(force->pair); - for (i = ad->ilo; i <= ad->ihi; i++) - for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) - if (!pair->check_ijtype(i,j,pstyle)) - error->all(FLERR,"Fix adapt type pair range is not valid " - "for pair hybrid sub-style {}", pstyle); + if (pair) { + for (i = ad->ilo; i <= ad->ihi; i++) { + for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) { + if (!pair->check_ijtype(i,j,pstyle)) + error->all(FLERR,"Fix adapt type pair range is not valid " + "for pair hybrid sub-style {}", pstyle); + } + } + } } delete[] pstyle; @@ -416,8 +421,16 @@ void FixAdapt::init() if (ad->bdim == 1) ad->vector = (double *) ptr; - if (utils::strmatch(force->bond_style,"^hybrid")) - error->all(FLERR,"Fix adapt does not support bond_style hybrid"); + if (utils::strmatch(force->bond_style,"^hybrid")) { + auto bond = dynamic_cast(force->bond); + if (bond) { + for (i = ad->ilo; i <= ad->ihi; i++) { + if (!bond->check_itype(i,bstyle)) + error->all(FLERR,"Fix adapt type bond range is not valid " + "for pair hybrid sub-style {}", bstyle); + } + } + } delete[] bstyle; From 516d988debec1aed9aceb386756bc93f00ffedfe Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 20:59:04 -0400 Subject: [PATCH 24/74] update fix adapt docs --- doc/src/fix_adapt.rst | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index 03aef12a6c..0aa0323309 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -319,25 +319,28 @@ all types from 1 to :math:`N`. A leading asterisk means all types from :math:`N` (inclusive). A middle asterisk means all types from m to n (inclusive). -Currently *bond* does not support bond_style hybrid nor bond_style -hybrid/overlay as bond styles. The bond styles that currently work -with fix_adapt are +If :doc:`bond_style hybrid ` is used, *bstyle* should be a +sub-style name. The bond styles that currently work with fix adapt are: -+------------------------------------+------------+------------+ -| :doc:`class2 ` | r0 | type bonds | -+------------------------------------+------------+------------+ -| :doc:`fene ` | k,r0 | type bonds | -+------------------------------------+------------+------------+ -| :doc:`fene/nm ` | k,r0 | type bonds | -+------------------------------------+------------+------------+ -| :doc:`gromos ` | k,r0 | type bonds | -+------------------------------------+------------+------------+ -| :doc:`harmonic ` | k,r0 | type bonds | -+------------------------------------+------------+------------+ -| :doc:`morse ` | r0 | type bonds | -+------------------------------------+------------+------------+ -| :doc:`nonlinear ` | epsilon,r0 | type bonds | -+------------------------------------+------------+------------+ ++---------------------------------------------------+------------+------------+ +| :doc:`class2 ` | r0 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`fene ` | k,r0 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`fene/nm ` | k,r0 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`gromos ` | k,r0 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`harmonic ` | k,r0 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`harmonic/shift ` | k,r0,r1 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`harmonic/restrain ` | k | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`morse ` | r0 | type bonds | ++---------------------------------------------------+------------+------------+ +| :doc:`nonlinear ` | epsilon,r0 | type bonds | ++---------------------------------------------------+------------+------------+ ---------- @@ -359,7 +362,7 @@ all types from 1 to :math:`N`. A leading asterisk means all types from Currently *angle* does not support angle_style hybrid nor angle_style hybrid/overlay as angle styles. The angle styles that currently work -with fix_adapt are +with fix adapt are +------------------------------------+----------+-------------+ | :doc:`harmonic ` | k,theta0 | type angles | From 47bb1a8748ee5729f0c45a3ab7098d99d2507cf7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 21:04:22 -0400 Subject: [PATCH 25/74] update unit test --- unittest/force-styles/tests/bond-harmonic_shift.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/bond-harmonic_shift.yaml b/unittest/force-styles/tests/bond-harmonic_shift.yaml index 7a41c2c3cd..61212a468b 100644 --- a/unittest/force-styles/tests/bond-harmonic_shift.yaml +++ b/unittest/force-styles/tests/bond-harmonic_shift.yaml @@ -17,7 +17,10 @@ bond_coeff: ! | 4 650.0 1.2 0.2 5 450.0 1.0 0.0 equilibrium: 5 1.5 1.1 1.3 1.2 1 -extract: ! "" +extract: ! | + k 1 + r0 1 + r1 1 natoms: 29 init_energy: -9395.519982389222 init_stress: ! |- From 6503f297d47a2a6f2ecbd227364cf89456969d3b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 16 Sep 2024 21:21:20 -0400 Subject: [PATCH 26/74] support angle style hybrid with fix adapt --- doc/src/fix_adapt.rst | 5 ++--- src/angle_hybrid.cpp | 8 ++++++++ src/angle_hybrid.h | 4 +++- src/fix_adapt.cpp | 13 +++++++++++-- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index 0aa0323309..1943798160 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -360,9 +360,8 @@ all types from 1 to :math:`N`. A leading asterisk means all types from :math:`N` (inclusive). A middle asterisk means all types from m to n (inclusive). -Currently *angle* does not support angle_style hybrid nor angle_style -hybrid/overlay as angle styles. The angle styles that currently work -with fix adapt are +If :doc:`angle_style hybrid ` is used, *astyle* should be a +sub-style name. The angle styles that currently work with fix adapt are: +------------------------------------+----------+-------------+ | :doc:`harmonic ` | k,theta0 | type angles | diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index a015882a15..1261a78176 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -320,6 +320,14 @@ void AngleHybrid::init_style() if (styles[m]) styles[m]->init_style(); } +/* ---------------------------------------------------------------------- */ + +int AngleHybrid::check_itype(int itype, char *substyle) +{ + if (strcmp(keywords[map[itype]], substyle) == 0) return 1; + return 0; +} + /* ---------------------------------------------------------------------- return an equilbrium angle length ------------------------------------------------------------------------- */ diff --git a/src/angle_hybrid.h b/src/angle_hybrid.h index a6da29245e..a84096b297 100644 --- a/src/angle_hybrid.h +++ b/src/angle_hybrid.h @@ -42,8 +42,10 @@ class AngleHybrid : public Angle { double single(int, int, int, int) override; double memory_usage() override; + int check_itype(int, char *); + protected: - int *map; // which style each angle type points to + int *map; // which style each angle type points to int *nanglelist; // # of angles in sub-style anglelists int *maxangle; // max # of angles sub-style lists can store int ***anglelist; // anglelist for each sub-style diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 6bab704c22..c725707b29 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -15,6 +15,7 @@ #include "fix_adapt.h" #include "angle.h" +#include "angle_hybrid.h" #include "atom.h" #include "bond.h" #include "bond_hybrid.h" @@ -455,8 +456,16 @@ void FixAdapt::init() if (ad->adim == 1) ad->vector = (double *) ptr; - if (utils::strmatch(force->angle_style,"^hybrid")) - error->all(FLERR,"Fix adapt does not support angle_style hybrid"); + if (utils::strmatch(force->angle_style,"^hybrid")) { + auto angle = dynamic_cast(force->angle); + if (angle) { + for (i = ad->ilo; i <= ad->ihi; i++) { + if (!angle->check_itype(i,astyle)) + error->all(FLERR,"Fix adapt type angle range is not valid " + "for pair hybrid sub-style {}", astyle); + } + } + } delete[] astyle; From 9f867b5f54476a984737de02e53caf100b6eabfa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 19:13:37 -0400 Subject: [PATCH 27/74] add LAPACK functions for matrix inversion via Cholesky decomposition --- lib/linalg/dlauu2.cpp | 77 ++++++++++++++++++++++++++++++++ lib/linalg/dlauum.cpp | 101 ++++++++++++++++++++++++++++++++++++++++++ lib/linalg/dpotri.cpp | 40 +++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 lib/linalg/dlauu2.cpp create mode 100644 lib/linalg/dlauum.cpp create mode 100644 lib/linalg/dpotri.cpp diff --git a/lib/linalg/dlauu2.cpp b/lib/linalg/dlauu2.cpp new file mode 100644 index 0000000000..d90a84798d --- /dev/null +++ b/lib/linalg/dlauu2.cpp @@ -0,0 +1,77 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include "lmp_f2c.h" +static doublereal c_b7 = 1.; +static integer c__1 = 1; +int dlauu2_(char *uplo, integer *n, doublereal *a, integer *lda, integer *info, ftnlen uplo_len) +{ + integer a_dim1, a_offset, i__1, i__2, i__3; + integer i__; + doublereal aii; + extern doublereal ddot_(integer *, doublereal *, integer *, doublereal *, integer *); + extern int dscal_(integer *, doublereal *, doublereal *, integer *); + extern logical lsame_(char *, char *, ftnlen, ftnlen); + extern int dgemv_(char *, integer *, integer *, doublereal *, doublereal *, integer *, + doublereal *, integer *, doublereal *, doublereal *, integer *, ftnlen); + logical upper; + extern int xerbla_(char *, integer *, ftnlen); + a_dim1 = *lda; + a_offset = 1 + a_dim1; + a -= a_offset; + *info = 0; + upper = lsame_(uplo, (char *)"U", (ftnlen)1, (ftnlen)1); + if (!upper && !lsame_(uplo, (char *)"L", (ftnlen)1, (ftnlen)1)) { + *info = -1; + } else if (*n < 0) { + *info = -2; + } else if (*lda < max(1, *n)) { + *info = -4; + } + if (*info != 0) { + i__1 = -(*info); + xerbla_((char *)"DLAUU2", &i__1, (ftnlen)6); + return 0; + } + if (*n == 0) { + return 0; + } + if (upper) { + i__1 = *n; + for (i__ = 1; i__ <= i__1; ++i__) { + aii = a[i__ + i__ * a_dim1]; + if (i__ < *n) { + i__2 = *n - i__ + 1; + a[i__ + i__ * a_dim1] = + ddot_(&i__2, &a[i__ + i__ * a_dim1], lda, &a[i__ + i__ * a_dim1], lda); + i__2 = i__ - 1; + i__3 = *n - i__; + dgemv_((char *)"No transpose", &i__2, &i__3, &c_b7, &a[(i__ + 1) * a_dim1 + 1], lda, + &a[i__ + (i__ + 1) * a_dim1], lda, &aii, &a[i__ * a_dim1 + 1], &c__1, + (ftnlen)12); + } else { + dscal_(&i__, &aii, &a[i__ * a_dim1 + 1], &c__1); + } + } + } else { + i__1 = *n; + for (i__ = 1; i__ <= i__1; ++i__) { + aii = a[i__ + i__ * a_dim1]; + if (i__ < *n) { + i__2 = *n - i__ + 1; + a[i__ + i__ * a_dim1] = + ddot_(&i__2, &a[i__ + i__ * a_dim1], &c__1, &a[i__ + i__ * a_dim1], &c__1); + i__2 = *n - i__; + i__3 = i__ - 1; + dgemv_((char *)"Transpose", &i__2, &i__3, &c_b7, &a[i__ + 1 + a_dim1], lda, + &a[i__ + 1 + i__ * a_dim1], &c__1, &aii, &a[i__ + a_dim1], lda, (ftnlen)9); + } else { + dscal_(&i__, &aii, &a[i__ + a_dim1], lda); + } + } + } + return 0; +} +#ifdef __cplusplus +} +#endif diff --git a/lib/linalg/dlauum.cpp b/lib/linalg/dlauum.cpp new file mode 100644 index 0000000000..632bd4ba85 --- /dev/null +++ b/lib/linalg/dlauum.cpp @@ -0,0 +1,101 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include "lmp_f2c.h" +static integer c__1 = 1; +static integer c_n1 = -1; +static doublereal c_b15 = 1.; +int dlauum_(char *uplo, integer *n, doublereal *a, integer *lda, integer *info, ftnlen uplo_len) +{ + integer a_dim1, a_offset, i__1, i__2, i__3, i__4; + integer i__, ib, nb; + extern int dgemm_(char *, char *, integer *, integer *, integer *, doublereal *, doublereal *, + integer *, doublereal *, integer *, doublereal *, doublereal *, integer *, + ftnlen, ftnlen); + extern logical lsame_(char *, char *, ftnlen, ftnlen); + extern int dtrmm_(char *, char *, char *, char *, integer *, integer *, doublereal *, + doublereal *, integer *, doublereal *, integer *, ftnlen, ftnlen, ftnlen, + ftnlen); + logical upper; + extern int dsyrk_(char *, char *, integer *, integer *, doublereal *, doublereal *, integer *, + doublereal *, doublereal *, integer *, ftnlen, ftnlen), + dlauu2_(char *, integer *, doublereal *, integer *, integer *, ftnlen), + xerbla_(char *, integer *, ftnlen); + extern integer ilaenv_(integer *, char *, char *, integer *, integer *, integer *, integer *, + ftnlen, ftnlen); + a_dim1 = *lda; + a_offset = 1 + a_dim1; + a -= a_offset; + *info = 0; + upper = lsame_(uplo, (char *)"U", (ftnlen)1, (ftnlen)1); + if (!upper && !lsame_(uplo, (char *)"L", (ftnlen)1, (ftnlen)1)) { + *info = -1; + } else if (*n < 0) { + *info = -2; + } else if (*lda < max(1, *n)) { + *info = -4; + } + if (*info != 0) { + i__1 = -(*info); + xerbla_((char *)"DLAUUM", &i__1, (ftnlen)6); + return 0; + } + if (*n == 0) { + return 0; + } + nb = ilaenv_(&c__1, (char *)"DLAUUM", uplo, n, &c_n1, &c_n1, &c_n1, (ftnlen)6, (ftnlen)1); + if (nb <= 1 || nb >= *n) { + dlauu2_(uplo, n, &a[a_offset], lda, info, (ftnlen)1); + } else { + if (upper) { + i__1 = *n; + i__2 = nb; + for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) { + i__3 = nb, i__4 = *n - i__ + 1; + ib = min(i__3, i__4); + i__3 = i__ - 1; + dtrmm_((char *)"Right", (char *)"Upper", (char *)"Transpose", (char *)"Non-unit", &i__3, &ib, &c_b15, + &a[i__ + i__ * a_dim1], lda, &a[i__ * a_dim1 + 1], lda, (ftnlen)5, (ftnlen)5, + (ftnlen)9, (ftnlen)8); + dlauu2_((char *)"Upper", &ib, &a[i__ + i__ * a_dim1], lda, info, (ftnlen)5); + if (i__ + ib <= *n) { + i__3 = i__ - 1; + i__4 = *n - i__ - ib + 1; + dgemm_((char *)"No transpose", (char *)"Transpose", &i__3, &ib, &i__4, &c_b15, + &a[(i__ + ib) * a_dim1 + 1], lda, &a[i__ + (i__ + ib) * a_dim1], lda, + &c_b15, &a[i__ * a_dim1 + 1], lda, (ftnlen)12, (ftnlen)9); + i__3 = *n - i__ - ib + 1; + dsyrk_((char *)"Upper", (char *)"No transpose", &ib, &i__3, &c_b15, + &a[i__ + (i__ + ib) * a_dim1], lda, &c_b15, &a[i__ + i__ * a_dim1], lda, + (ftnlen)5, (ftnlen)12); + } + } + } else { + i__2 = *n; + i__1 = nb; + for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) { + i__3 = nb, i__4 = *n - i__ + 1; + ib = min(i__3, i__4); + i__3 = i__ - 1; + dtrmm_((char *)"Left", (char *)"Lower", (char *)"Transpose", (char *)"Non-unit", &ib, &i__3, &c_b15, + &a[i__ + i__ * a_dim1], lda, &a[i__ + a_dim1], lda, (ftnlen)4, (ftnlen)5, + (ftnlen)9, (ftnlen)8); + dlauu2_((char *)"Lower", &ib, &a[i__ + i__ * a_dim1], lda, info, (ftnlen)5); + if (i__ + ib <= *n) { + i__3 = i__ - 1; + i__4 = *n - i__ - ib + 1; + dgemm_((char *)"Transpose", (char *)"No transpose", &ib, &i__3, &i__4, &c_b15, + &a[i__ + ib + i__ * a_dim1], lda, &a[i__ + ib + a_dim1], lda, &c_b15, + &a[i__ + a_dim1], lda, (ftnlen)9, (ftnlen)12); + i__3 = *n - i__ - ib + 1; + dsyrk_((char *)"Lower", (char *)"Transpose", &ib, &i__3, &c_b15, &a[i__ + ib + i__ * a_dim1], + lda, &c_b15, &a[i__ + i__ * a_dim1], lda, (ftnlen)5, (ftnlen)9); + } + } + } + } + return 0; +} +#ifdef __cplusplus +} +#endif diff --git a/lib/linalg/dpotri.cpp b/lib/linalg/dpotri.cpp new file mode 100644 index 0000000000..9c0a609e1b --- /dev/null +++ b/lib/linalg/dpotri.cpp @@ -0,0 +1,40 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include "lmp_f2c.h" +int dpotri_(char *uplo, integer *n, doublereal *a, integer *lda, integer *info, ftnlen uplo_len) +{ + integer a_dim1, a_offset, i__1; + extern logical lsame_(char *, char *, ftnlen, ftnlen); + extern int xerbla_(char *, integer *, ftnlen), + dlauum_(char *, integer *, doublereal *, integer *, integer *, ftnlen), + dtrtri_(char *, char *, integer *, doublereal *, integer *, integer *, ftnlen, ftnlen); + a_dim1 = *lda; + a_offset = 1 + a_dim1; + a -= a_offset; + *info = 0; + if (!lsame_(uplo, (char *)"U", (ftnlen)1, (ftnlen)1) && !lsame_(uplo, (char *)"L", (ftnlen)1, (ftnlen)1)) { + *info = -1; + } else if (*n < 0) { + *info = -2; + } else if (*lda < max(1, *n)) { + *info = -4; + } + if (*info != 0) { + i__1 = -(*info); + xerbla_((char *)"DPOTRI", &i__1, (ftnlen)6); + return 0; + } + if (*n == 0) { + return 0; + } + dtrtri_(uplo, (char *)"Non-unit", n, &a[a_offset], lda, info, (ftnlen)1, (ftnlen)8); + if (*info > 0) { + return 0; + } + dlauum_(uplo, n, &a[a_offset], lda, info, (ftnlen)1); + return 0; +} +#ifdef __cplusplus +} +#endif From b16b683cb4a0de14116cbc09525e2b701ef4ba51 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 19:26:00 -0400 Subject: [PATCH 28/74] replace calls to GSL with calls to LAPACK --- src/RHEO/compute_rheo_kernel.cpp | 74 +++++++++++++++++++------------- src/RHEO/compute_rheo_kernel.h | 4 +- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index dd05901b32..329e955a32 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -37,10 +37,6 @@ #include "utils.h" #include -#include -#include -#include -#include using namespace LAMMPS_NS; using namespace RHEO_NS; @@ -50,6 +46,13 @@ using namespace MathExtra; // max value of Mdim 1 + dim + dim * (dim + 1) / 2 with dim = 3 static constexpr int MAX_MDIM = 12; +// declare LAPACK functions + +extern "C" { + void dpotrf2_(const char *uplo, const int *n, double *a, const int *lda, int *info); + void dpotri_(const char *uplo, const int *n, double *a, const int *lda, int *info); +} + /* ---------------------------------------------------------------------- */ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : @@ -89,7 +92,7 @@ ComputeRHEOKernel::ComputeRHEOKernel(LAMMPS *lmp, int narg, char **arg) : comm_forward_save = comm_forward; corrections_calculated = 0; - gsl_error_flag = 0; + lapack_error_flag = 0; } /* ---------------------------------------------------------------------- */ @@ -156,9 +159,9 @@ void ComputeRHEOKernel::init_list(int /*id*/, NeighList *ptr) int ComputeRHEOKernel::check_corrections(int i) { - // Skip if there were gsl errors for this atom - if (gsl_error_flag) - if (gsl_error_tags.find(atom->tag[i]) != gsl_error_tags.end()) return 0; + // Skip if there were lapack errors for this atom + if (lapack_error_flag) + if (lapack_error_tags.find(atom->tag[i]) != lapack_error_tags.end()) return 0; // Skip if undercoordinated if (coordination[i] < zmin) return 0; @@ -558,19 +561,15 @@ void ComputeRHEOKernel::calc_dw_rk2(int i, double delx, double dely, double delz void ComputeRHEOKernel::compute_peratom() { - gsl_error_flag = 0; - gsl_error_tags.clear(); + lapack_error_flag = 0; + lapack_error_tags.clear(); if (kernel_style == QUINTIC) return; corrections_calculated = 1; - int i, j, ii, jj, inum, jnum, a, b, gsl_error; + int i, j, ii, jj, inum, jnum, a, b, lapack_error; double xtmp, ytmp, ztmp, r, rsq, w, vj, rhoj; double dx[3]; - gsl_matrix_view gM; - - // Turn off GSL error handler, revert RK to Quintic when insufficient neighbors - gsl_set_error_handler_off(); double **x = atom->x; int *type = atom->type; @@ -633,7 +632,7 @@ void ComputeRHEOKernel::compute_peratom() } } else if (correction_order > 0) { - // Moment matrix M and polynomial basis vector cut (1d for gsl compatibility) + // Moment matrix M and polynomial basis vector cut (1d for LAPACK compatibility) double H[MAX_MDIM], M[MAX_MDIM * MAX_MDIM]; for (ii = 0; ii < inum; ii++) { @@ -647,7 +646,9 @@ void ComputeRHEOKernel::compute_peratom() // Zero upper-triangle M and cut (will be symmetric): for (a = 0; a < Mdim; a++) { - for (b = a; b < Mdim; b++) { M[a * Mdim + b] = 0; } + for (b = a; b < Mdim; b++) { + M[a * Mdim + b] = 0; + } } for (jj = 0; jj < jnum; jj++) { @@ -700,37 +701,50 @@ void ComputeRHEOKernel::compute_peratom() // Populate the upper triangle for (a = 0; a < Mdim; a++) { - for (b = a; b < Mdim; b++) { M[a * Mdim + b] += H[a] * H[b] * w * vj; } + for (b = a; b < Mdim; b++) { + M[a * Mdim + b] += H[a] * H[b] * w * vj; + } } } } // Populate the lower triangle from the symmetric entries of M: for (a = 0; a < Mdim; a++) { - for (b = a; b < Mdim; b++) { M[b * Mdim + a] = M[a * Mdim + b]; } + for (b = a; b < Mdim; b++) { + M[b * Mdim + a] = M[a * Mdim + b]; + } } // Skip if undercoordinated if (coordination[i] < zmin) continue; - // Use gsl to get Minv, use Cholesky decomposition since the + // Use LAPACK to get Minv, use Cholesky decomposition since the // polynomials are independent, M is symmetrix & positive-definite - gM = gsl_matrix_view_array(M, Mdim, Mdim); - gsl_error = gsl_linalg_cholesky_decomp1(&gM.matrix); + const char uplo = 'U'; + dpotrf2_(&uplo, &Mdim, M, &Mdim, &lapack_error); - if (gsl_error) { - //Revert to uncorrected SPH for this particle - gsl_error_flag = 1; - gsl_error_tags.insert(tag[i]); + if (lapack_error) { + // Revert to uncorrected SPH for this particle + lapack_error_flag = 1; + lapack_error_tags.insert(tag[i]); - //check if not positive-definite - if (gsl_error != GSL_EDOM) - error->warning(FLERR, "Failed decomposition in rheo/kernel, gsl_error = {}", gsl_error); + // check if not positive-definite + if (lapack_error > 0) + error->warning(FLERR, "Failed DPOTRF2 decomposition in rheo/kernel, info = {}", + lapack_error); continue; } - gsl_linalg_cholesky_invert(&gM.matrix); //M is now M^-1 + // M is now M^-1 + dpotri_(&uplo, &Mdim, M, &Mdim, &lapack_error); + + // make result matrix symmetric + for (int i = 0; i < Mdim; ++i) { + for (int j = i+1; j < Mdim; ++j) { + M[i * Mdim + j] = M[j * Mdim + i]; + } + } // Correction coefficients are columns of M^-1 multiplied by an appropriate coefficient // Solve the linear system several times to get coefficientns diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 20516255be..8b70509e6a 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -53,8 +53,8 @@ class ComputeRHEOKernel : public Compute { private: int comm_stage, comm_forward_save; int interface_flag; - int gsl_error_flag; - std::unordered_set gsl_error_tags; + int lapack_error_flag; + std::unordered_set lapack_error_tags; int corrections_calculated; int kernel_style, zmin, dim, Mdim, ncor; From 1ac9f0801cf386a9433999a8c991e818cd868451 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 19:55:59 -0400 Subject: [PATCH 29/74] update build support for using LAPACK with RHEO instead of GSL --- cmake/CMakeLists.txt | 4 ++-- cmake/Modules/Packages/RHEO.cmake | 2 -- cmake/presets/mingw-cross.cmake | 1 + cmake/presets/most.cmake | 1 + cmake/presets/windows.cmake | 1 + lib/rheo/Makefile.lammps | 17 ++++------------- lib/rheo/Makefile.lammps.empty | 5 +++++ lib/rheo/Makefile.lammps.installed | 5 +++++ lib/rheo/Makefile.lammps.linalg | 5 +++++ lib/rheo/README | 12 +++++------- 10 files changed, 29 insertions(+), 24 deletions(-) delete mode 100644 cmake/Modules/Packages/RHEO.cmake create mode 100644 lib/rheo/Makefile.lammps.empty create mode 100644 lib/rheo/Makefile.lammps.installed create mode 100644 lib/rheo/Makefile.lammps.linalg diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c68a925324..1bd387b5b9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -497,7 +497,7 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUA PROPERTIES COMPILE_OPTIONS "-std=c++14") endif() -if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR BUILD_TOOLS) +if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR PKG_RHEO OR BUILD_TOOLS) enable_language(C) if (NOT USE_INTERNAL_LINALG) find_package(LAPACK) @@ -572,7 +572,7 @@ else() endif() foreach(PKG_WITH_INCL KSPACE PYTHON ML-IAP VORONOI COLVARS ML-HDNNP MDI MOLFILE NETCDF - PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON RHEO EXTRA-COMMAND) + PLUMED QMMM ML-QUIP SCAFACOS MACHDYN VTK KIM COMPRESS ML-PACE LEPTON EXTRA-COMMAND) if(PKG_${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL}) endif() diff --git a/cmake/Modules/Packages/RHEO.cmake b/cmake/Modules/Packages/RHEO.cmake deleted file mode 100644 index 7639acd8bc..0000000000 --- a/cmake/Modules/Packages/RHEO.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(GSL 2.6 REQUIRED) -target_link_libraries(lammps PRIVATE GSL::gsl) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 100ce13632..413744b078 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -67,6 +67,7 @@ set(WIN_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SHOCK SMTBQ diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index d01642f94d..05282eebdd 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -60,6 +60,7 @@ set(ALL_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SHOCK SPH diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index 403d40efa4..71241c559c 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -60,6 +60,7 @@ set(WIN_PACKAGES REACTION REAXFF REPLICA + RHEO RIGID SHOCK SMTBQ diff --git a/lib/rheo/Makefile.lammps b/lib/rheo/Makefile.lammps index ec58740370..5785f8978b 100644 --- a/lib/rheo/Makefile.lammps +++ b/lib/rheo/Makefile.lammps @@ -1,14 +1,5 @@ -# Settings that the LAMMPS build will import when this package is installed +# Settings that the LAMMPS build will import when this package library is used -ifeq ($(strip $(shell pkg-config --version)),) - # manual configuration w/o pkg-config/pkgconf - # change this to -I/path/to/your/lib/gsl/include/ - rheo_SYSINC = -I../../lib/rheo/gsl/include/ - - # change this to -L/path/to/your/lib/gsl/lib/ - rheo_SYSLIB = -L../../lib/rheo/gsl/lib/ -lgsl -lgslcblas -else - # autodetect GSL settings from pkg-config/pkgconf - rheo_SYSINC = $(shell pkg-config --cflags gsl) - rheo_SYSLIB = $(shell pkg-config --libs gsl) -endif +rheo_SYSINC = +rheo_SYSLIB = -llinalg +rheo_SYSPATH = -L../../lib/linalg$(LIBOBJDIR) diff --git a/lib/rheo/Makefile.lammps.empty b/lib/rheo/Makefile.lammps.empty new file mode 100644 index 0000000000..f71390299c --- /dev/null +++ b/lib/rheo/Makefile.lammps.empty @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +rheo_SYSINC = +rheo_SYSLIB = +rheo_SYSPATH = diff --git a/lib/rheo/Makefile.lammps.installed b/lib/rheo/Makefile.lammps.installed new file mode 100644 index 0000000000..8900470077 --- /dev/null +++ b/lib/rheo/Makefile.lammps.installed @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +rheo_SYSINC = +rheo_SYSLIB = -lblas -llapack +rheo_SYSPATH = diff --git a/lib/rheo/Makefile.lammps.linalg b/lib/rheo/Makefile.lammps.linalg new file mode 100644 index 0000000000..5785f8978b --- /dev/null +++ b/lib/rheo/Makefile.lammps.linalg @@ -0,0 +1,5 @@ +# Settings that the LAMMPS build will import when this package library is used + +rheo_SYSINC = +rheo_SYSLIB = -llinalg +rheo_SYSPATH = -L../../lib/linalg$(LIBOBJDIR) diff --git a/lib/rheo/README b/lib/rheo/README index ae421b6e80..fe082797f1 100644 --- a/lib/rheo/README +++ b/lib/rheo/README @@ -1,7 +1,5 @@ -This directory has a Makefile.lammps file with settings that allows LAMMPS to -dynamically link to the GSL library. This is required to use the RHEO package -in a LAMMPS input script. If you have the pkg-config command available, it -will automatically import the GSL settings. Otherwise they will have to be -added manually. - -See the header of Makefile.lammps for more info. +This directory has multiple Makefile.lammps variant files with settings that +allows LAMMPS to link with a BLAS/LAPACK or compatible library or the bundled +linalg library (which is subset of BLAS/LAPACK). Copy the suitable file +to Makefile.lammps and edit, if needed. +This is required to use the RHEO package in a LAMMPS input script. From d909b205c72115345f301fdbb22f489bd690379e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 20:14:43 -0400 Subject: [PATCH 30/74] update docs for building the RHEO package --- doc/src/Build_extras.rst | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index ac7edc7678..6ce917339b 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -2251,28 +2251,37 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to RHEO package ------------ -To build with this package you must have the `GNU Scientific Library -(GSL) ` installed in locations that -are accessible in your environment. The GSL library should be at least -version 2.7. +This package depends on the BPM package. .. tabs:: .. tab:: CMake build - If CMake cannot find the GSL library or include files, you can set: - .. code-block:: bash - -D GSL_ROOT_DIR=path # path to root of GSL installation + -D PKG_RHEO=yes # enable the package itself + -D PKG_BPM=yes # the RHEO package requires BPM + -D USE_INTERNAL_LINALG=value # + + Features in the RHEO package are dependent on code in the BPM + package so the latter one *must* be enabled. + + The RHEO package also requires LAPACK (and BLAS) and CMake + can identify their locations and pass that info to the RHEO + build script. But on some systems this may cause problems when + linking or the dependency is not desired. Try enabling + ``USE_INTERNAL_LINALG`` in those cases to use the bundled linear + algebra library and work around the limitations. .. tab:: Traditional make - LAMMPS will try to auto-detect the GSL compiler and linker flags - from the corresponding ``pkg-config`` file (``gsl.pc``), otherwise - you can edit the file ``lib/rheo/Makefile.lammps`` - to specify the paths and library names where indicated by comments. - This must be done **before** the package is installed. + The RHEO package also requires LAPACK (and BLAS) which can be + either a system provided library or the bundled "linalg" library + which is a subset of LAPACK. For that, one of the provided + ``Makefile.lammps.`` files needs to be copied to + ``Makefile.lammps`` and edited as needed. The default file + uses the bundled "linalg" library, which can be built with + ``make lib-linalg args='-m serial'``. ---------- From 42bcc43ece9a6bed656a3c7ce0ac0144f692fdf3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 20:22:17 -0400 Subject: [PATCH 31/74] add missing line in Install.sh file --- src/RHEO/Install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/RHEO/Install.sh b/src/RHEO/Install.sh index e34ca3a555..07a439f44b 100644 --- a/src/RHEO/Install.sh +++ b/src/RHEO/Install.sh @@ -47,6 +47,7 @@ if (test $1 = 1) then sed -i -e 's/[^ \t]*rheo[^ \t]* //' ../Makefile.package sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(rheo_SYSINC) |' ../Makefile.package sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(rheo_SYSLIB) |' ../Makefile.package + sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(rheo_SYSPATH) |' ../Makefile.package fi if (test -e ../Makefile.package.settings) then From 4eb1b1f60678f5fd93a201e30967824a02b3fc86 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 23:14:27 -0400 Subject: [PATCH 32/74] clarify docs --- doc/src/Build_extras.rst | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 6ce917339b..8465bea829 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -2261,27 +2261,28 @@ This package depends on the BPM package. -D PKG_RHEO=yes # enable the package itself -D PKG_BPM=yes # the RHEO package requires BPM - -D USE_INTERNAL_LINALG=value # + -D USE_INTERNAL_LINALG=value # prefer internal LAPACK if true - Features in the RHEO package are dependent on code in the BPM - package so the latter one *must* be enabled. + Some features in the RHEO package are dependent on code in the BPM + package so the latter one *must* be enabled as well. The RHEO package also requires LAPACK (and BLAS) and CMake can identify their locations and pass that info to the RHEO build script. But on some systems this may cause problems when - linking or the dependency is not desired. Try enabling - ``USE_INTERNAL_LINALG`` in those cases to use the bundled linear - algebra library and work around the limitations. + linking or the dependency is not desired. By using the setting + ``-D USE_INTERNAL_LINALG=yes`` when running the CMake + configuration, you will select compiling and linking the bundled + linear algebra library and work around the limitations. .. tab:: Traditional make - The RHEO package also requires LAPACK (and BLAS) which can be - either a system provided library or the bundled "linalg" library - which is a subset of LAPACK. For that, one of the provided - ``Makefile.lammps.`` files needs to be copied to - ``Makefile.lammps`` and edited as needed. The default file - uses the bundled "linalg" library, which can be built with - ``make lib-linalg args='-m serial'``. + The RHEO package requires LAPACK (and BLAS) which can be either + a system provided library or the bundled "linalg" library. This + is a subset of LAPACK translated to C++. For that, one of the + provided ``Makefile.lammps.`` files needs to be copied + to ``Makefile.lammps`` and edited as needed. The default file + uses the bundled "linalg" library, which can be built by + ``make lib-linalg args='-m serial'`` in the ``src`` folder. ---------- From d23b8aa17f9d4ca99432e6743ca506af25ec16a1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 18 Sep 2024 23:29:49 -0400 Subject: [PATCH 33/74] try to work around macOS issue --- src/RHEO/compute_rheo_kernel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 329e955a32..453f2b9028 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -49,7 +49,7 @@ static constexpr int MAX_MDIM = 12; // declare LAPACK functions extern "C" { - void dpotrf2_(const char *uplo, const int *n, double *a, const int *lda, int *info); + void dpotrf_(const char *uplo, const int *n, double *a, const int *lda, int *info); void dpotri_(const char *uplo, const int *n, double *a, const int *lda, int *info); } @@ -721,7 +721,7 @@ void ComputeRHEOKernel::compute_peratom() // Use LAPACK to get Minv, use Cholesky decomposition since the // polynomials are independent, M is symmetrix & positive-definite const char uplo = 'U'; - dpotrf2_(&uplo, &Mdim, M, &Mdim, &lapack_error); + dpotrf_(&uplo, &Mdim, M, &Mdim, &lapack_error); if (lapack_error) { // Revert to uncorrected SPH for this particle From 3d2a344dd5e69cf9b376704994fadcb1c0fdc86e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 19 Sep 2024 03:36:09 -0400 Subject: [PATCH 34/74] we no longer need to install GSL for workflows with RHEO --- .github/workflows/check-vla.yml | 2 +- .github/workflows/full-regression.yml | 3 ++- .github/workflows/quick-regression.yml | 3 ++- .github/workflows/unittest-linux.yml | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-vla.yml b/.github/workflows/check-vla.yml index 26f23cc33f..ab89018a3d 100644 --- a/.github/workflows/check-vla.yml +++ b/.github/workflows/check-vla.yml @@ -27,9 +27,9 @@ jobs: - name: Install extra packages run: | + sudo apt-get update sudo apt-get install -y ccache \ libeigen3-dev \ - libgsl-dev \ libcurl4-openssl-dev \ mold \ mpi-default-bin \ diff --git a/.github/workflows/full-regression.yml b/.github/workflows/full-regression.yml index 73e1803bb6..a6b5353b9b 100644 --- a/.github/workflows/full-regression.yml +++ b/.github/workflows/full-regression.yml @@ -30,8 +30,9 @@ jobs: - name: Install extra packages run: | + sudo apt-get update sudo apt-get install -y ccache ninja-build libeigen3-dev \ - libgsl-dev libcurl4-openssl-dev python3-dev \ + libcurl4-openssl-dev python3-dev \ mpi-default-bin mpi-default-dev - name: Create Build Environment diff --git a/.github/workflows/quick-regression.yml b/.github/workflows/quick-regression.yml index 6174d57ec2..88794bfa0a 100644 --- a/.github/workflows/quick-regression.yml +++ b/.github/workflows/quick-regression.yml @@ -34,8 +34,9 @@ jobs: - name: Install extra packages run: | + sudo apt-get update sudo apt-get install -y ccache ninja-build libeigen3-dev \ - libgsl-dev libcurl4-openssl-dev python3-dev \ + libcurl4-openssl-dev python3-dev \ mpi-default-bin mpi-default-dev - name: Create Build Environment diff --git a/.github/workflows/unittest-linux.yml b/.github/workflows/unittest-linux.yml index dcf495ccc0..ce98fcea35 100644 --- a/.github/workflows/unittest-linux.yml +++ b/.github/workflows/unittest-linux.yml @@ -31,9 +31,9 @@ jobs: - name: Install extra packages run: | + sudo apt-get update sudo apt-get install -y ccache \ libeigen3-dev \ - libgsl-dev \ libcurl4-openssl-dev \ mold \ ninja-build \ From cc24f3d2409f69024067c8ab3fd617e4580b1e02 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:16:55 +0200 Subject: [PATCH 35/74] add extract() function to angle_charmm.h --- src/MOLECULE/angle_charmm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MOLECULE/angle_charmm.h b/src/MOLECULE/angle_charmm.h index 2a77ac7864..cc4095e90f 100644 --- a/src/MOLECULE/angle_charmm.h +++ b/src/MOLECULE/angle_charmm.h @@ -35,6 +35,7 @@ class AngleCharmm : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *k, *theta0, *k_ub, *r_ub; From 438a8c9335bbe03fce572cf4a37ac4cac57432ba Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:19:47 +0200 Subject: [PATCH 36/74] add extract() function to angle_charmm.cpp --- src/MOLECULE/angle_charmm.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 1b66260c55..11b5abd699 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -309,3 +309,15 @@ double AngleCharmm::single(int type, int i1, int i2, int i3) return (tk * dtheta + rk * dr); } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleCharmm::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 9d1a0240d636f5fa010eb84e6af035a16a5cee38 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:21:32 +0200 Subject: [PATCH 37/74] add extract() function to angle_fourier_simple.h --- src/EXTRA-MOLECULE/angle_fourier_simple.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/angle_fourier_simple.h b/src/EXTRA-MOLECULE/angle_fourier_simple.h index 3296ba6067..d37b3a83a8 100644 --- a/src/EXTRA-MOLECULE/angle_fourier_simple.h +++ b/src/EXTRA-MOLECULE/angle_fourier_simple.h @@ -36,6 +36,7 @@ class AngleFourierSimple : public Angle { void write_data(FILE *) override; double single(int, int, int, int) override; void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *k, *C, *N; From 3b73f56d79ca2d3f23bd2b2e475f116b26579f85 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:22:29 +0200 Subject: [PATCH 38/74] add extract() function to angle_fourier_simple.cpp --- src/EXTRA-MOLECULE/angle_fourier_simple.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/EXTRA-MOLECULE/angle_fourier_simple.cpp b/src/EXTRA-MOLECULE/angle_fourier_simple.cpp index 6de7956ffa..143a008039 100644 --- a/src/EXTRA-MOLECULE/angle_fourier_simple.cpp +++ b/src/EXTRA-MOLECULE/angle_fourier_simple.cpp @@ -316,3 +316,16 @@ void AngleFourierSimple::born_matrix(int type, int i1, int i2, int i3, double &d du2 = k[type] * C[type] * N[type] * (cos(theta) * sin(N[type] * theta) - N[type] * sin(theta) * cos(N[type] * theta)) / pow(sin(theta),3); } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleFourierSimple::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "C") == 0) return (void *) C; + if (strcmp(str, "N") == 0) return (void *) N; + return nullptr; +} From df533d97cbe7997086ca1de24c30f77bf7499389 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:24:20 +0200 Subject: [PATCH 39/74] add extract() function to angle_quartic.h --- src/EXTRA-MOLECULE/angle_quartic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/angle_quartic.h b/src/EXTRA-MOLECULE/angle_quartic.h index 7de51b24d1..3ff7f6f3e4 100644 --- a/src/EXTRA-MOLECULE/angle_quartic.h +++ b/src/EXTRA-MOLECULE/angle_quartic.h @@ -36,6 +36,7 @@ class AngleQuartic : public Angle { void write_data(FILE *) override; double single(int, int, int, int) override; void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *k2, *k3, *k4, *theta0; From 1e00249b737afbd66373233596a61c82a79e80d0 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:25:04 +0200 Subject: [PATCH 40/74] add extract() function to angle_quartic.cpp --- src/EXTRA-MOLECULE/angle_quartic.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/EXTRA-MOLECULE/angle_quartic.cpp b/src/EXTRA-MOLECULE/angle_quartic.cpp index aade6b4534..616c81c749 100644 --- a/src/EXTRA-MOLECULE/angle_quartic.cpp +++ b/src/EXTRA-MOLECULE/angle_quartic.cpp @@ -325,3 +325,17 @@ void AngleQuartic::born_matrix(int type, int i1, int i2, int i3, double &du, dou du2 = (2.0 * k2[type] + 6.0 * k3[type] * dtheta + 12.0 * k4[type] * dtheta2) / (s*s) - (2.0 * k2[type] * dtheta + 3.0 * k3[type] * dtheta2 + 4.0 * k4[type] * dtheta3) * c / (s*s*s); } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleQuartic::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "k3") == 0) return (void *) k3; + if (strcmp(str, "k4") == 0) return (void *) k4; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From bf9cb26afb28e2a3edfe380ab8aaec3e8f72e400 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:25:49 +0200 Subject: [PATCH 41/74] add extract() function to angle_fourier.h --- src/EXTRA-MOLECULE/angle_fourier.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/angle_fourier.h b/src/EXTRA-MOLECULE/angle_fourier.h index 8fa5d14b26..c0e30c8e1a 100644 --- a/src/EXTRA-MOLECULE/angle_fourier.h +++ b/src/EXTRA-MOLECULE/angle_fourier.h @@ -36,6 +36,7 @@ class AngleFourier : public Angle { void write_data(FILE *) override; double single(int, int, int, int) override; void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *k, *C0, *C1, *C2; From 7b37f1ae1709616383365242bbc0568084d3bdd1 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:26:25 +0200 Subject: [PATCH 42/74] add extract() function to angle_fourier.cpp --- src/EXTRA-MOLECULE/angle_fourier.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/EXTRA-MOLECULE/angle_fourier.cpp b/src/EXTRA-MOLECULE/angle_fourier.cpp index da1667c06f..abcda6d036 100644 --- a/src/EXTRA-MOLECULE/angle_fourier.cpp +++ b/src/EXTRA-MOLECULE/angle_fourier.cpp @@ -309,3 +309,16 @@ void AngleFourier::born_matrix(int type, int i1, int i2, int i3, double &du, dou du = k[type] * (C1[type] + 4 * C2[type] * c); } +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleFourier::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "C0") == 0) return (void *) C0; + if (strcmp(str, "C1") == 0) return (void *) C1; + if (strcmp(str, "C2") == 0) return (void *) C2; + return nullptr; +} From 42f0940aeea06d770491664870f9dba16b6c7b65 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:27:18 +0200 Subject: [PATCH 43/74] add extract() function to angle_cosine_periodic.h --- src/EXTRA-MOLECULE/angle_cosine_periodic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/angle_cosine_periodic.h b/src/EXTRA-MOLECULE/angle_cosine_periodic.h index f04ed04784..f63029919e 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_periodic.h +++ b/src/EXTRA-MOLECULE/angle_cosine_periodic.h @@ -36,6 +36,7 @@ class AngleCosinePeriodic : public Angle { void write_data(FILE *) override; double single(int, int, int, int) override; void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *k; From f916a0cc63b2b029886c27169bf258e33f50034e Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:27:58 +0200 Subject: [PATCH 44/74] add extract() function to angle_cosine_periodic.cpp --- src/EXTRA-MOLECULE/angle_cosine_periodic.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp b/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp index 0b2a6d336d..6aae8d3ff4 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp @@ -336,3 +336,16 @@ void AngleCosinePeriodic::born_matrix(int type, int i1, int i2, int i3, double & du = prefactor * sin(m_angle) / s; du2 = prefactor * (c * sin(m_angle) - s * cos(m_angle) * multiplicity[type]) / (s * s * s); } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleCosinePeriodic::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "b") == 0) return (void *) b; + if (strcmp(str, "multiplicity") == 0) return (void *) multiplicity; + return nullptr; +} From 25f12bf8007614318217cc322c01f09d9a491229 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:28:56 +0200 Subject: [PATCH 45/74] add extract() function to angle_cosine_squared_restricted.h --- src/EXTRA-MOLECULE/angle_cosine_squared_restricted.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.h b/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.h index 674252b7d0..b38b6bc4bd 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.h +++ b/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.h @@ -36,6 +36,7 @@ class AngleCosineSquaredRestricted : public Angle { void write_data(FILE *) override; double single(int, int, int, int) override; void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *k, *theta0; From cc9f45af88ccafb91f7ed8f5c834b4aafc16f584 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:29:34 +0200 Subject: [PATCH 46/74] add extract() function to angle_cosine_squared_restricted.cpp --- .../angle_cosine_squared_restricted.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp b/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp index 2da31ef893..c6d78ea133 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp @@ -296,3 +296,15 @@ void AngleCosineSquaredRestricted::born_matrix(int type, int i1, int i2, int i3, du2 = 2 * k[type] * numerator / denominator; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleCosineSquaredRestricted::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From c65a6e8b59ff5d684bafea2d5bef6fe9e0c0de40 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:30:42 +0200 Subject: [PATCH 47/74] add extract() function to angle_mm3.h --- src/YAFF/angle_mm3.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/YAFF/angle_mm3.h b/src/YAFF/angle_mm3.h index 22f5bd746c..126b275e72 100644 --- a/src/YAFF/angle_mm3.h +++ b/src/YAFF/angle_mm3.h @@ -36,6 +36,7 @@ class AngleMM3 : public Angle { void write_data(FILE *) override; double single(int, int, int, int) override; void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *theta0, *k2; From 83b2e88b734bedf651796c62c57242de8ff220f5 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:31:20 +0200 Subject: [PATCH 48/74] add extract() function to angle_mm3.cpp --- src/YAFF/angle_mm3.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/YAFF/angle_mm3.cpp b/src/YAFF/angle_mm3.cpp index 3ff7df1653..920041f7e9 100644 --- a/src/YAFF/angle_mm3.cpp +++ b/src/YAFF/angle_mm3.cpp @@ -327,3 +327,15 @@ void AngleMM3::born_matrix(int type, int i1, int i2, int i3, double &du, double du = -k2[type] * df / s; du2 = k2[type] * (d2f - df * c / s) / (s * s) ; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleMM3::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 4272d4a39083f7f97d2e399ba143c0e2d7e6ad1c Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:32:05 +0200 Subject: [PATCH 49/74] add extract() function to bond_mm3.h --- src/YAFF/bond_mm3.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/YAFF/bond_mm3.h b/src/YAFF/bond_mm3.h index ea89ac826d..b9ebf464bb 100644 --- a/src/YAFF/bond_mm3.h +++ b/src/YAFF/bond_mm3.h @@ -36,6 +36,7 @@ class BondMM3 : public Bond { void write_data(FILE *) override; double single(int, double, int, int, double &) override; void born_matrix(int, double, int, int, double &, double &) override; + void *extract(const char *, int &) override; protected: double *r0, *k2; From 8a2564fff196224476745a07ff9ac5663fae71d1 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:32:41 +0200 Subject: [PATCH 50/74] add extract() function to bond_mm3.cpp --- src/YAFF/bond_mm3.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/YAFF/bond_mm3.cpp b/src/YAFF/bond_mm3.cpp index 31ce2dad3e..b3e69881e1 100644 --- a/src/YAFF/bond_mm3.cpp +++ b/src/YAFF/bond_mm3.cpp @@ -238,3 +238,15 @@ void BondMM3::born_matrix(int type, double rsq, int /*i*/, int /*j*/, double &du du = 2.0 * k2[type] * dr + 3.0 * K3 * dr2 + 4.0 * K4 * dr3; du2 = 2.0 * k2[type] + 6.0 * K3 * dr + 12.0 * K4 * dr2; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *BondMM3::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "r0") == 0) return (void *) r0; + return nullptr; +} From 8e071495932a30bcf6e293cd64b03b04c54eb0e0 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:33:41 +0200 Subject: [PATCH 51/74] add extract() function to angle_spica.h --- src/CG-SPICA/angle_spica.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CG-SPICA/angle_spica.h b/src/CG-SPICA/angle_spica.h index 539512c0e9..5e590ba7a0 100644 --- a/src/CG-SPICA/angle_spica.h +++ b/src/CG-SPICA/angle_spica.h @@ -37,6 +37,7 @@ class AngleSPICA : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *k, *theta0; From 3ce4c782d15cebdc827c417e208ea45d39f9ca7a Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:34:16 +0200 Subject: [PATCH 52/74] add extract() function to angle_spica.cpp --- src/CG-SPICA/angle_spica.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/CG-SPICA/angle_spica.cpp b/src/CG-SPICA/angle_spica.cpp index e315e20f13..55ef1beaed 100644 --- a/src/CG-SPICA/angle_spica.cpp +++ b/src/CG-SPICA/angle_spica.cpp @@ -522,3 +522,14 @@ double AngleSPICA::single(int type, int i1, int i2, int i3) double tk = k[type] * dtheta; return tk*dtheta + e13; } + + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleSPICA::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 873030982de35fdb593ecdf130d66086eca0e6a5 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:35:11 +0200 Subject: [PATCH 53/74] add extract() function to angle_dipole.h --- src/DIPOLE/angle_dipole.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/DIPOLE/angle_dipole.h b/src/DIPOLE/angle_dipole.h index 2e55722673..de0f958f98 100644 --- a/src/DIPOLE/angle_dipole.h +++ b/src/DIPOLE/angle_dipole.h @@ -36,6 +36,7 @@ class AngleDipole : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *k, *gamma0; From c5e62b4a47ef7cb6444386e84a8b9f61848be91e Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:35:46 +0200 Subject: [PATCH 54/74] add extract() function to angle_dipole.cpp --- src/DIPOLE/angle_dipole.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/DIPOLE/angle_dipole.cpp b/src/DIPOLE/angle_dipole.cpp index 6ad4a0fb4c..a66f3e1042 100644 --- a/src/DIPOLE/angle_dipole.cpp +++ b/src/DIPOLE/angle_dipole.cpp @@ -263,3 +263,15 @@ double AngleDipole::single(int type, int iRef, int iDip, int /*iDummy*/) return kdg * deltaGamma; // energy } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleDipole::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "gamma0") == 0) return (void *) gamma0; + return nullptr; +} From b49f3412df2c30e67bb93919ee02478c6552f9ed Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:36:35 +0200 Subject: [PATCH 55/74] add extract() function to angle_class2.h --- src/CLASS2/angle_class2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CLASS2/angle_class2.h b/src/CLASS2/angle_class2.h index f5fbd62b57..4ed6f344ae 100644 --- a/src/CLASS2/angle_class2.h +++ b/src/CLASS2/angle_class2.h @@ -35,6 +35,7 @@ class AngleClass2 : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *theta0, *k2, *k3, *k4; From 7f0ff96324a0c088cec01b8407e1fd69d18968a9 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:37:12 +0200 Subject: [PATCH 56/74] add extract() function to angle_class2.cpp --- src/CLASS2/angle_class2.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index 118179ad91..5000f9f629 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -467,3 +467,17 @@ double AngleClass2::single(int type, int i1, int i2, int i3) return energy; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleClass2::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k2") == 0) return (void *) k2; + if (strcmp(str, "k3") == 0) return (void *) k3; + if (strcmp(str, "k4") == 0) return (void *) k4; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} From 423b058820cd88f0a0a0fa20a32152d8f62dfe51 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:38:22 +0200 Subject: [PATCH 57/74] add extract() function to bond_fene_expand.h --- src/MOLECULE/bond_fene_expand.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MOLECULE/bond_fene_expand.h b/src/MOLECULE/bond_fene_expand.h index cdce710ea1..13524b0972 100644 --- a/src/MOLECULE/bond_fene_expand.h +++ b/src/MOLECULE/bond_fene_expand.h @@ -36,6 +36,7 @@ class BondFENEExpand : public Bond { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, double, int, int, double &) override; + void *extract(const char *, int &) override; protected: double *k, *r0, *epsilon, *sigma, *shift; From b2a2cefc021f7fabb5cfdeaf7dfa5ed904995372 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:38:58 +0200 Subject: [PATCH 58/74] add extract() function to bond_fene_expand.cpp --- src/MOLECULE/bond_fene_expand.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index c7821b1826..e115596eb1 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -273,3 +273,18 @@ double BondFENEExpand::single(int type, double rsq, int /*i*/, int /*j*/, double return eng; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *BondFENEExpand::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "r0") == 0) return (void *) r0; + if (strcmp(str, "epsilon") == 0) return (void *) epsilon; + if (strcmp(str, "sigma") == 0) return (void *) sigma; + if (strcmp(str, "shift") == 0) return (void *) shift; + return nullptr; +} From d8c0691684191011ee5c6e25b5e98b955cc48644 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 19:55:07 +0200 Subject: [PATCH 59/74] Update bond section of fix_adapt.rst --- doc/src/fix_adapt.rst | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index 1943798160..88fed772d8 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -322,25 +322,29 @@ all types from 1 to :math:`N`. A leading asterisk means all types from If :doc:`bond_style hybrid ` is used, *bstyle* should be a sub-style name. The bond styles that currently work with fix adapt are: -+---------------------------------------------------+------------+------------+ -| :doc:`class2 ` | r0 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`fene ` | k,r0 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`fene/nm ` | k,r0 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`gromos ` | k,r0 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`harmonic ` | k,r0 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`harmonic/shift ` | k,r0,r1 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`harmonic/restrain ` | k | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`morse ` | r0 | type bonds | -+---------------------------------------------------+------------+------------+ -| :doc:`nonlinear ` | epsilon,r0 | type bonds | -+---------------------------------------------------+------------+------------+ ++---------------------------------------------------+---------------------------+------------+ +| :doc:`class2 ` | r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`fene ` | k,r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`fene/expand ` | k,r0,epsilon,sigma,shift | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`fene/nm ` | k,r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`gromos ` | k,r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`harmonic ` | k,r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`harmonic/shift ` | k,r0,r1 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`harmonic/restrain ` | k | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`mm3 ` | k,r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`morse ` | r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ +| :doc:`nonlinear ` | epsilon,r0 | type bonds | ++---------------------------------------------------+---------------------------+------------+ ---------- From 68548cbb0ddfde1719bd330667c7482c36f0dfe5 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 20 Sep 2024 20:53:22 +0200 Subject: [PATCH 60/74] Update angle_spica.cpp --- src/CG-SPICA/angle_spica.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CG-SPICA/angle_spica.cpp b/src/CG-SPICA/angle_spica.cpp index 55ef1beaed..913428cd9b 100644 --- a/src/CG-SPICA/angle_spica.cpp +++ b/src/CG-SPICA/angle_spica.cpp @@ -523,6 +523,7 @@ double AngleSPICA::single(int type, int i1, int i2, int i3) return tk*dtheta + e13; } +/* ---------------------------------------------------------------------- return ptr to internal members upon request ------------------------------------------------------------------------ */ From 20f3b5a7dbeb6d6eb36fd1a87a32606674eba75b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 20 Sep 2024 21:44:52 -0400 Subject: [PATCH 61/74] update readme --- src/RHEO/README | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/RHEO/README b/src/RHEO/README index 4b6f2a162a..15b642442a 100644 --- a/src/RHEO/README +++ b/src/RHEO/README @@ -3,8 +3,9 @@ multiphase fluid systems. The authors include Joel Clemmer (Sandia), Thomas O'Connor (Carnegie Mellon), and Eric Palermo (Carnegie Mellon). Bond style rheo/shell, compute style rheo/property/atom, and fix style -rheo/temperature all depend on the BPM package. +rheo/temperature depend on the BPM package, so it is required to install +the BPM package with RHEO. -This package requires the GNU scientific library (GSL). We recommend version -2.7 or later. To build this package, one must first separately install GSL in -a location that can be found by your environment. +This package requires the BLAS/LAPACK. This can be either a seperate installation +or you can use the bundled "linalg" library. Please see the LAMMPS manual at +https://docs.lammps.org/Build_extras.html#rheo for details. From 8294bea7a77f87c827e27b6a293029b1e29eb007 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sat, 21 Sep 2024 10:02:06 +0200 Subject: [PATCH 62/74] Update angle section of fix_adapt.rst --- doc/src/fix_adapt.rst | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/doc/src/fix_adapt.rst b/doc/src/fix_adapt.rst index 88fed772d8..a44ce8e780 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -367,11 +367,31 @@ all types from 1 to :math:`N`. A leading asterisk means all types from If :doc:`angle_style hybrid ` is used, *astyle* should be a sub-style name. The angle styles that currently work with fix adapt are: -+------------------------------------+----------+-------------+ -| :doc:`harmonic ` | k,theta0 | type angles | -+------------------------------------+----------+-------------+ -| :doc:`cosine ` | k | type angles | -+------------------------------------+----------+-------------+ ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`harmonic ` | k,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`charmm ` | k,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`class2 ` | k2,k3,k4,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`cosine ` | k | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`cosine/periodic ` | k,b,n | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`cosine/squared/restricted ` | k,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`dipole ` | k,gamma0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`fourier ` | k,c0,c1,c2 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`fourier/simple ` | k,c,n | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`mm3 ` | k,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`quartic ` | k2,k3,k4,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ +| :doc:`spica ` | k,theta0 | type angles | ++--------------------------------------------------------------------+-----------------+-------------+ Note that internally, theta0 is stored in radians, so the variable this fix uses to reset theta0 needs to generate values in radians. From 0d6abcb86a693eeff6aef717c7d3de102628ea06 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 15:31:01 +0200 Subject: [PATCH 63/74] unit test for extract() in bond-mm3.yaml --- unittest/force-styles/tests/bond-mm3.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/bond-mm3.yaml b/unittest/force-styles/tests/bond-mm3.yaml index eb7443f1c2..f5ba5c237c 100644 --- a/unittest/force-styles/tests/bond-mm3.yaml +++ b/unittest/force-styles/tests/bond-mm3.yaml @@ -17,7 +17,9 @@ bond_coeff: ! | 4 650.0 1.2 5 450.0 1.0 equilibrium: 5 1.5 1.1 1.3 1.2 1 -extract: ! "" +extract: ! | + k2 1 + r0 1 natoms: 29 init_energy: 4.247265008273143 init_stress: ! |- From 96d99e3dd63b99adcada4016feffab4018d42d1d Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 15:33:46 +0200 Subject: [PATCH 64/74] unit test for extract() in bond-fene_expand.yaml --- unittest/force-styles/tests/bond-fene_expand.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/bond-fene_expand.yaml b/unittest/force-styles/tests/bond-fene_expand.yaml index fc859d477c..250f89af15 100644 --- a/unittest/force-styles/tests/bond-fene_expand.yaml +++ b/unittest/force-styles/tests/bond-fene_expand.yaml @@ -17,7 +17,12 @@ bond_coeff: ! | 4 650 2.4 0.015 1.2 0.15 5 450 2 0.018 1 0.09 equilibrium: 5 1.5550000000000002 1.117 1.321 1.3139999999999998 1.06 -extract: ! "" +extract: ! | + k 1 + r0 1 + epsilon 1 + sigma 1 + shift 1 natoms: 29 init_energy: 5926.020859124294 init_stress: ! |- From 25c9f5a6ffcc54efc4a05f3ea2fcb2ca9556ff28 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:01:52 +0200 Subject: [PATCH 65/74] unit test for extract() in angle-mm3.yaml --- unittest/force-styles/tests/angle-mm3.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-mm3.yaml b/unittest/force-styles/tests/angle-mm3.yaml index 9fb9460183..381f43187e 100644 --- a/unittest/force-styles/tests/angle-mm3.yaml +++ b/unittest/force-styles/tests/angle-mm3.yaml @@ -16,7 +16,9 @@ angle_coeff: ! | 3 50.0 120.0 4 100.0 108.5 equilibrium: 4 1.9216075064457565 1.9373154697137058 2.0943951023931953 1.8936822384138474 -extract: ! "" +extract: ! | + k2 1 + theta0 1 natoms: 29 init_energy: 44.72461548562619 init_stress: ! |2- From cd4bada16f2d3a3369942fc61044233d1fdd65af Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:03:33 +0200 Subject: [PATCH 66/74] unit test for extract() in angle-charmm.yaml --- unittest/force-styles/tests/angle-charmm.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-charmm.yaml b/unittest/force-styles/tests/angle-charmm.yaml index 52e78abaf6..8ff5118390 100644 --- a/unittest/force-styles/tests/angle-charmm.yaml +++ b/unittest/force-styles/tests/angle-charmm.yaml @@ -15,7 +15,9 @@ angle_coeff: ! | 3 40.0 120.0 35.0 2.410 4 33.0 108.5 30.0 2.163 equilibrium: 4 1.9216075064457567 1.9425514574696887 2.0943951023931953 1.8936822384138476 -extract: ! "" +extract: ! | + k 1 + theta0 1 natoms: 29 init_energy: 85.42486388459771 init_stress: ! |2- From 1287977beeb14e7c1ae8dc99067e952196852d1a Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:04:32 +0200 Subject: [PATCH 67/74] unit test for extract() in angle-spica.yaml --- unittest/force-styles/tests/angle-spica.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-spica.yaml b/unittest/force-styles/tests/angle-spica.yaml index 7f88553c70..46e8238349 100644 --- a/unittest/force-styles/tests/angle-spica.yaml +++ b/unittest/force-styles/tests/angle-spica.yaml @@ -20,7 +20,9 @@ angle_coeff: ! | 3 40.0 120.0 4 33.0 108.5 equilibrium: 4 1.9216075064457565 1.9425514574696887 2.0943951023931953 1.8936822384138474 -extract: ! "" +extract: ! | + k 1 + theta0 1 natoms: 29 init_energy: 38.36438529349082 init_stress: ! |2- From d6d63b87d16403eb890a1090fe98d743d65d9b5c Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:05:32 +0200 Subject: [PATCH 68/74] unit test for extract() in angle-class2.yaml --- unittest/force-styles/tests/angle-class2.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-class2.yaml b/unittest/force-styles/tests/angle-class2.yaml index ae2e3ff5ee..8901157d17 100644 --- a/unittest/force-styles/tests/angle-class2.yaml +++ b/unittest/force-styles/tests/angle-class2.yaml @@ -23,7 +23,11 @@ angle_coeff: ! | 3 ba 10.0 10.0 1.5 1.5 4 ba 0.0 20.0 1.5 1.5 equilibrium: 4 1.9216075064457565 1.9373154697137058 2.0943951023931953 1.8936822384138474 -extract: ! "" +extract: ! | + k2 1 + k3 1 + k4 1 + theta0 1 natoms: 29 init_energy: 46.44089683774903 init_stress: ! |2- From 517b4f43426a68dcf44d796180e348c8264af3ec Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:06:17 +0200 Subject: [PATCH 69/74] unit test for extract() in angle-dipole.yaml --- unittest/force-styles/tests/angle-dipole.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-dipole.yaml b/unittest/force-styles/tests/angle-dipole.yaml index 877ffa19c7..3914973f0d 100644 --- a/unittest/force-styles/tests/angle-dipole.yaml +++ b/unittest/force-styles/tests/angle-dipole.yaml @@ -20,7 +20,9 @@ angle_coeff: ! | 3 50.0 120.0 4 100.0 108.5 equilibrium: 4 1.9216075064457565 1.9373154697137058 2.0943951023931953 1.8936822384138474 -extract: ! "" +extract: ! | + k 1 + gamma0 1 natoms: 29 init_energy: 1003.6681304854917 init_stress: ! |2- From 662ea3a191ff1e7829b14e63f6a57828921bc96c Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:08:52 +0200 Subject: [PATCH 70/74] unit test for extract() in angle-quartic.yaml --- unittest/force-styles/tests/angle-quartic.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-quartic.yaml b/unittest/force-styles/tests/angle-quartic.yaml index 6ded709e84..15ec06d82a 100644 --- a/unittest/force-styles/tests/angle-quartic.yaml +++ b/unittest/force-styles/tests/angle-quartic.yaml @@ -16,7 +16,11 @@ angle_coeff: ! | 3 120.0 50.0 -9.5 -1.5 4 108.5 100.0 5.0 -2.0 equilibrium: 4 1.9216075064457565 1.9373154697137058 2.0943951023931953 1.8936822384138474 -extract: ! "" +extract: ! | + k2 1 + k3 1 + k4 1 + theta0 1 natoms: 29 init_energy: 41.0458477552901 init_stress: ! |2- From 8355d3796a05974308057d35be6da192c2578e05 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:09:37 +0200 Subject: [PATCH 71/74] unit test for extract() in angle-cosine_squared_restricted.yaml --- .../force-styles/tests/angle-cosine_squared_restricted.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-cosine_squared_restricted.yaml b/unittest/force-styles/tests/angle-cosine_squared_restricted.yaml index 400babb3c0..341ccb3919 100644 --- a/unittest/force-styles/tests/angle-cosine_squared_restricted.yaml +++ b/unittest/force-styles/tests/angle-cosine_squared_restricted.yaml @@ -17,7 +17,9 @@ angle_coeff: ! | 3 50.0 120.0 4 100.0 108.5 equilibrium: 4 1.9216075064457567 1.9373154697137058 2.0943951023931953 1.8936822384138476 -extract: ! "" +extract: ! | + k 1 + theta0 1 natoms: 29 init_energy: 43.16721849625078 init_stress: ! |2- From 950bcba5922b9e7f28b922cf7aa2fc7005bb84f0 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:22:43 +0200 Subject: [PATCH 72/74] unit test for extract() in angle-fourier.yaml --- unittest/force-styles/tests/angle-fourier.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-fourier.yaml b/unittest/force-styles/tests/angle-fourier.yaml index 61165c5a92..275d62beca 100644 --- a/unittest/force-styles/tests/angle-fourier.yaml +++ b/unittest/force-styles/tests/angle-fourier.yaml @@ -16,7 +16,11 @@ angle_coeff: ! | 3 50.0 0.0 0.0 1.0 4 100.0 0.3 0.3 0.3 equilibrium: 4 3.141592653589793 1.5707963267948966 1.5707963267948966 1.8234765819369754 -extract: ! "" +extract: ! | + k 1 + C0 1 + C1 1 + C2 1 natoms: 29 init_energy: 400.84036632010225 init_stress: ! |- From 11aa128951b2a3bbd7b89012c3e47bdfbd9c193b Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:23:32 +0200 Subject: [PATCH 73/74] unit test for extract() in angle-fourier_simple.yaml --- unittest/force-styles/tests/angle-fourier_simple.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-fourier_simple.yaml b/unittest/force-styles/tests/angle-fourier_simple.yaml index e1a394ee3a..bd72e67912 100644 --- a/unittest/force-styles/tests/angle-fourier_simple.yaml +++ b/unittest/force-styles/tests/angle-fourier_simple.yaml @@ -16,7 +16,10 @@ angle_coeff: ! | 3 50.0 1.0 3.0 4 100.0 -0.5 1.5 equilibrium: 4 3.141592653589793 1.5707963267948966 1.0471975511965976 2.0943951023931953 -extract: ! "" +extract: ! | + k 1 + C 1 + N 1 natoms: 29 init_energy: 2474.0748013590646 init_stress: ! |- From 6f6e365682f2b68a63dead1bb4e8d65c9796db92 Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Sun, 22 Sep 2024 20:24:26 +0200 Subject: [PATCH 74/74] unit test for extract() in angle-cosine_periodic.yaml --- unittest/force-styles/tests/angle-cosine_periodic.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/force-styles/tests/angle-cosine_periodic.yaml b/unittest/force-styles/tests/angle-cosine_periodic.yaml index 5c8227fcbd..ee3e5c1469 100644 --- a/unittest/force-styles/tests/angle-cosine_periodic.yaml +++ b/unittest/force-styles/tests/angle-cosine_periodic.yaml @@ -15,7 +15,10 @@ angle_coeff: ! | 3 50.0 -1 3 4 100.0 -1 4 equilibrium: 4 3.141592653589793 3.141592653589793 2.0943951023931957 2.356194490192345 -extract: ! "" +extract: ! | + k 1 + b 1 + multiplicity 1 natoms: 29 init_energy: 1178.5476942873006 init_stress: ! |2-