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

Collected small changes and fixes
This commit is contained in:
Axel Kohlmeyer
2021-04-16 17:07:39 -04:00
committed by GitHub
87 changed files with 386 additions and 411 deletions

View File

@ -269,6 +269,7 @@ endif()
set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool") set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool")
mark_as_advanced(ENABLE_IWYU) mark_as_advanced(ENABLE_IWYU)
if(ENABLE_IWYU) if(ENABLE_IWYU)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_program(IWYU_EXE NAMES include-what-you-use iwyu) find_program(IWYU_EXE NAMES include-what-you-use iwyu)
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py) find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
if (IWYU_EXE AND IWYU_TOOL) if (IWYU_EXE AND IWYU_TOOL)
@ -730,7 +731,7 @@ get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
include(FeatureSummary) include(FeatureSummary)
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND) feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
message(STATUS "<<< Build configuration >>> message(STATUS "<<< Build configuration >>>
Operating System: ${CMAKE_SYSTEM_NAME} Operating System: ${CMAKE_SYSTEM_NAME} ${CMAKE_LINUX_DISTRO} ${CMAKE_DISTRO_VERSION}
Build type: ${CMAKE_BUILD_TYPE} Build type: ${CMAKE_BUILD_TYPE}
Install path: ${CMAKE_INSTALL_PREFIX} Install path: ${CMAKE_INSTALL_PREFIX}
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}") Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")

View File

@ -104,3 +104,13 @@ function(FetchPotentials pkgfolder potfolder)
endforeach() endforeach()
endif() endif()
endfunction(FetchPotentials) endfunction(FetchPotentials)
# set CMAKE_LINUX_DISTRO and CMAKE_DISTRO_VERSION on Linux
if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (EXISTS /etc/os-release))
file(STRINGS /etc/os-release distro REGEX "^NAME=")
string(REGEX REPLACE "NAME=\"?([^\"]*)\"?" "\\1" distro "${distro}")
file(STRINGS /etc/os-release disversion REGEX "^VERSION_ID=")
string(REGEX REPLACE "VERSION_ID=\"?([^\"]*)\"?" "\\1" disversion "${disversion}")
set(CMAKE_LINUX_DISTRO ${distro})
set(CMAKE_DISTRO_VERSION ${disversion})
endif()

View File

@ -54,8 +54,9 @@ if(DOWNLOAD_PLUMED)
set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a") set(PLUMED_BUILD_BYPRODUCTS "<INSTALL_DIR>/lib/libplumedWrapper.a")
endif() endif()
set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.0/plumed-src-2.7.0.tgz" CACHE STRING "URL for PLUMED tarball") set(PLUMED_URL "https://github.com/plumed/plumed2/releases/download/v2.7.1/plumed-src-2.7.1.tgz" CACHE STRING "URL for PLUMED tarball")
set(PLUMED_MD5 "95f29dd0c067577f11972ff90dfc7d12" CACHE STRING "MD5 checksum of PLUMED tarball") set(PLUMED_MD5 "4eac6a462ec84dfe0cec96c82421b8e8" CACHE STRING "MD5 checksum of PLUMED tarball")
mark_as_advanced(PLUMED_URL) mark_as_advanced(PLUMED_URL)
mark_as_advanced(PLUMED_MD5) mark_as_advanced(PLUMED_MD5)

View File

@ -16,11 +16,14 @@ if(ENABLE_TESTING)
set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command") set(MEMORYCHECK_COMMAND "${VALGRIND_BINARY}" CACHE FILEPATH "Memory Check Command")
set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options") set(MEMORYCHECK_COMMAND_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options")
# check if a faster linker is available. # we need to build and link a LOT of tester executables, so it is worth checking if
# only verified with GNU and Clang compilers and new CMake # a faster linker is available. requires GNU or Clang compiler, newer CMake.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13) # also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")) AND ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")))
if (((CMAKE_LINUX_DISTRO STREQUAL Ubuntu) AND (CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04))
OR ((CMAKE_LINUX_DISTRO STREQUAL Fedora) AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30)))
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
set(CMAKE_CUSTOM_LINKER_DEFAULT default) set(CMAKE_CUSTOM_LINKER_DEFAULT default)
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG) check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)

View File

@ -1253,8 +1253,8 @@ be built for the most part with all major versions of the C++ language.
USER-PACE package USER-PACE package
----------------------------- -----------------------------
This package requires a library that can be downloaded and built This package requires a library that can be downloaded and built
in lib/pace or somewhere else, which must be done before building in lib/pace or somewhere else, which must be done before building
LAMMPS with this package. The code for the library can be found LAMMPS with this package. The code for the library can be found
at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps-user-pace/>`_ at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps-user-pace/>`_
@ -1276,8 +1276,8 @@ at: `https://github.com/ICAMS/lammps-user-pace/ <https://github.com/ICAMS/lammps
.. tab:: Traditional make .. tab:: Traditional make
You can download and build the USER-PACE library You can download and build the USER-PACE library
in one step from the ``lammps/src`` dir, using these commands, in one step from the ``lammps/src`` dir, using these commands,
which invoke the ``lib/pace/Install.py`` script. which invoke the ``lib/pace/Install.py`` script.
.. code-block:: bash .. code-block:: bash

View File

@ -56,27 +56,28 @@ Examples
Description Description
""""""""""" """""""""""
Perform the charge equilibration (QEq) method as described in :ref:`(Rappe and Goddard) <Rappe1>` and formulated in :ref:`(Nakano) <Nakano1>` (also known Perform the charge equilibration (QEq) method as described in
as the matrix inversion method) and in :ref:`(Rick and Stuart) <Rick1>` (also :ref:`(Rappe and Goddard) <Rappe1>` and formulated in :ref:`(Nakano)
known as the extended Lagrangian method) based on the <Nakano1>` (also known as the matrix inversion method) and in
electronegativity equilization principle. :ref:`(Rick and Stuart) <Rick1>` (also known as the extended Lagrangian
method) based on the electronegativity equilization principle.
These fixes can be used with any :doc:`pair style <pair_style>` in These fixes can be used with any :doc:`pair style <pair_style>` in
LAMMPS, so long as per-atom charges are defined. The most typical LAMMPS, so long as per-atom charges are defined. The most typical
use-case is in conjunction with a :doc:`pair style <pair_style>` that use-case is in conjunction with a :doc:`pair style <pair_style>` that
performs charge equilibration periodically (e.g. every timestep), such performs charge equilibration periodically (e.g. every timestep), such
as the ReaxFF or Streitz-Mintmire potential. as the ReaxFF or Streitz-Mintmire potential. But these fixes can also
But these fixes can also be used with be used with potentials that normally assume per-atom charges are fixed,
potentials that normally assume per-atom charges are fixed, e.g. a e.g. a :doc:`Buckingham <pair_buck>` or :doc:`LJ/Coulombic <pair_lj>`
:doc:`Buckingham <pair_buck>` or :doc:`LJ/Coulombic <pair_lj>` potential. potential.
Because the charge equilibration calculation is effectively Because the charge equilibration calculation is effectively independent
independent of the pair style, these fixes can also be used to perform of the pair style, these fixes can also be used to perform a one-time
a one-time assignment of charges to atoms. For example, you could assignment of charges to atoms. For example, you could define the QEq
define the QEq fix, perform a zero-timestep run via the :doc:`run <run>` fix, perform a zero-timestep run via the :doc:`run <run>` command
command without any pair style defined which would set per-atom without any pair style defined which would set per-atom charges (based
charges (based on the current atom configuration), then remove the fix on the current atom configuration), then remove the fix via the
via the :doc:`unfix <unfix>` command before performing further dynamics. :doc:`unfix <unfix>` command before performing further dynamics.
.. note:: .. note::
@ -87,11 +88,14 @@ via the :doc:`unfix <unfix>` command before performing further dynamics.
.. note:: .. note::
The :doc:`fix qeq/comb <fix_qeq_comb>` command must still be used The :doc:`fix qeq/comb <fix_qeq_comb>` command must still be used to
to perform charge equilibration with the :doc:`COMB potential <pair_comb>`. The :doc:`fix qeq/reax <fix_qeq_reax>` perform charge equilibration with the :doc:`COMB potential
command can be used to perform charge equilibration with the :doc:`ReaxFF force field <pair_reaxc>`, although fix qeq/shielded yields the <pair_comb>`. The :doc:`fix qeq/reax <fix_qeq_reax>` command can be
same results as fix qeq/reax if *Nevery*\ , *cutoff*\ , and *tolerance* used to perform charge equilibration with the :doc:`ReaxFF force
are the same. Eventually the fix qeq/reax command will be deprecated. field <pair_reaxc>`, although fix qeq/shielded yields the same
results as fix qeq/reax if *Nevery*\ , *cutoff*\ , and *tolerance*
are the same. Eventually the fix qeq/reax command will be
deprecated.
The QEq method minimizes the electrostatic energy of the system (or The QEq method minimizes the electrostatic energy of the system (or
equalizes the derivative of energy with respect to charge of all the equalizes the derivative of energy with respect to charge of all the
@ -134,55 +138,57 @@ usually a good number.
The *qeq/shielded* style describes partial charges on atoms also as The *qeq/shielded* style describes partial charges on atoms also as
point charges, but uses a shielded Coulomb potential to describe the point charges, but uses a shielded Coulomb potential to describe the
interaction between a pair of charged particles. Interaction through interaction between a pair of charged particles. Interaction through
the shielded Coulomb is given by equation (13) of the :ref:`ReaxFF force field <vanDuin>` paper. The shielding accounts for charge overlap the shielded Coulomb is given by equation (13) of the :ref:`ReaxFF force
field <vanDuin>` paper. The shielding accounts for charge overlap
between charged particles at small separation. This style is the same between charged particles at small separation. This style is the same
as :doc:`fix qeq/reax <fix_qeq_reax>`, and can be used with :doc:`pair_style reax/c <pair_reaxc>`. Only the *chi*\ , *eta*\ , and *gamma* as :doc:`fix qeq/reax <fix_qeq_reax>`, and can be used with
parameters from the *qfile* file are used. When using the string :doc:`pair_style reax/c <pair_reaxc>`. Only the *chi*\ , *eta*\ , and
*reax/c* as filename, these parameters are extracted directly from *gamma* parameters from the *qfile* file are used. When using the string
an active *reax/c* pair style. This style solves partial *reax/c* as filename, these parameters are extracted directly from an
charges on atoms via the matrix inversion method. A tolerance of active *reax/c* pair style. This style solves partial charges on atoms
1.0e-6 is usually a good number. via the matrix inversion method. A tolerance of 1.0e-6 is usually a
good number.
The *qeq/slater* style describes partial charges on atoms as spherical The *qeq/slater* style describes partial charges on atoms as spherical
charge densities centered around atoms via the Slater 1\ *s* orbital, so charge densities centered around atoms via the Slater 1\ *s* orbital, so
that the interaction between a pair of charged particles is the that the interaction between a pair of charged particles is the product
product of two Slater 1\ *s* orbitals. The expression for the Slater of two Slater 1\ *s* orbitals. The expression for the Slater 1\ *s*
1\ *s* orbital is given under equation (6) of the orbital is given under equation (6) of the :ref:`Streitz-Mintmire
:ref:`Streitz-Mintmire <Streitz1>` paper. Only the *chi*\ , *eta*\ , *zeta*\ , and <Streitz1>` paper. Only the *chi*\ , *eta*\ , *zeta*\ , and *qcore*
*qcore* parameters from the *qfile* file are used. When using the string parameters from the *qfile* file are used. When using the string
*coul/streitz* as filename, these parameters are extracted directly from *coul/streitz* as filename, these parameters are extracted directly from
an active *coul/streitz* pair style. This style solves an active *coul/streitz* pair style. This style solves partial charges
partial charges on atoms via the matrix inversion method. A tolerance on atoms via the matrix inversion method. A tolerance of 1.0e-6 is
of 1.0e-6 is usually a good number. Keyword *alpha* can be used to usually a good number. Keyword *alpha* can be used to change the Slater
change the Slater type orbital exponent. type orbital exponent.
The *qeq/dynamic* style describes partial charges on atoms as point The *qeq/dynamic* style describes partial charges on atoms as point
charges that interact through 1/r, but the extended Lagrangian method charges that interact through 1/r, but the extended Lagrangian method is
is used to solve partial charges on atoms. Only the *chi* and *eta* used to solve partial charges on atoms. Only the *chi* and *eta*
parameters from the *qfile* file are used. Note that Coulomb parameters from the *qfile* file are used. Note that Coulomb
catastrophe can occur if repulsion between the pair of charged catastrophe can occur if repulsion between the pair of charged particles
particles is too weak. A tolerance of 1.0e-3 is usually a good is too weak. A tolerance of 1.0e-3 is usually a good number. Keyword
number. Keyword *qdamp* can be used to change the damping factor, while *qdamp* can be used to change the damping factor, while keyword *qstep*
keyword *qstep* can be used to change the time step size. can be used to change the time step size.
The :ref:`\ *qeq/fire*\ <Shan>` style describes the same charge model and charge The :ref:`\ *qeq/fire*\ <Shan>` style describes the same charge model
solver as the *qeq/dynamic* style, but employs a FIRE minimization and charge solver as the *qeq/dynamic* style, but employs a FIRE
algorithm to solve for equilibrium charges. minimization algorithm to solve for equilibrium charges. Keyword
Keyword *qdamp* can be used to change the damping factor, while *qdamp* can be used to change the damping factor, while keyword *qstep*
keyword *qstep* can be used to change the time step size. can be used to change the time step size.
Note that *qeq/point*\ , *qeq/shielded*\ , and *qeq/slater* describe Note that *qeq/point*\ , *qeq/shielded*\ , and *qeq/slater* describe
different charge models, whereas the matrix inversion method and the different charge models, whereas the matrix inversion method and the
extended Lagrangian method (\ *qeq/dynamic* and *qeq/fire*\ ) are extended Lagrangian method (\ *qeq/dynamic* and *qeq/fire*\ ) are
different solvers. different solvers.
Note that *qeq/point*\ , *qeq/dynamic* and *qeq/fire* styles all describe Note that *qeq/point*\ , *qeq/dynamic* and *qeq/fire* styles all
charges as point charges that interact through 1/r relationship, but describe charges as point charges that interact through 1/r
solve partial charges on atoms using different solvers. These three relationship, but solve partial charges on atoms using different
styles should yield comparable results if solvers. These three styles should yield comparable results if the QEq
the QEq parameters and *Nevery*\ , *cutoff*\ , and *tolerance* are the parameters and *Nevery*\ , *cutoff*\ , and *tolerance* are the same.
same. Style *qeq/point* is typically faster, *qeq/dynamic* scales Style *qeq/point* is typically faster, *qeq/dynamic* scales better on
better on larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ . larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
.. note:: .. note::
@ -200,9 +206,11 @@ better on larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
Restart, fix_modify, output, run start/stop, minimize info Restart, fix_modify, output, run start/stop, minimize info
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
No information about these fixes is written to :doc:`binary restart files <restart>`. No global scalar or vector or per-atom No information about these fixes is written to :doc:`binary restart
quantities are stored by these fixes for access by various :doc:`output commands <Howto_output>`. No parameter of these fixes can be used files <restart>`. No global scalar or vector or per-atom quantities are
with the *start/stop* keywords of the :doc:`run <run>` command. stored by these fixes for access by various :doc:`output commands
<Howto_output>`. No parameter of these fixes can be used with the
*start/stop* keywords of the :doc:`run <run>` command.
Thexe fixes are invoked during :doc:`energy minimization <minimize>`. Thexe fixes are invoked during :doc:`energy minimization <minimize>`.
@ -210,7 +218,8 @@ Restrictions
"""""""""""" """"""""""""
These fixes are part of the QEQ package. They are only enabled if These fixes are part of the QEQ package. They are only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` doc page for more info. LAMMPS was built with that package. See the :doc:`Build package
<Build_package>` doc page for more info.
Related commands Related commands
"""""""""""""""" """"""""""""""""

View File

@ -17,7 +17,7 @@ parser = ArgumentParser(prog='Install.py',
# settings # settings
version = "2.7.0" version = "2.7.1"
mode = "static" mode = "static"
# help message # help message
@ -47,9 +47,12 @@ checksums = { \
'2.5.2' : 'bd2f18346c788eb54e1e52f4f6acf41a', \ '2.5.2' : 'bd2f18346c788eb54e1e52f4f6acf41a', \
'2.5.3' : 'de30d6e7c2dcc0973298e24a6da24286', \ '2.5.3' : 'de30d6e7c2dcc0973298e24a6da24286', \
'2.5.4' : 'f31b7d16a4be2e30aa7d5c19c3d37853', \ '2.5.4' : 'f31b7d16a4be2e30aa7d5c19c3d37853', \
'2.5.7' : '1ca36226fdb8110b1009aa61d615d4e5', \
'2.6.0' : '204d2edae58d9b10ba3ad460cad64191', \ '2.6.0' : '204d2edae58d9b10ba3ad460cad64191', \
'2.6.1' : '89a9a450fc6025299fe16af235957163', \ '2.6.1' : '89a9a450fc6025299fe16af235957163', \
'2.6.3' : 'a9f8028fd74528c2024781ea1fdefeee', \
'2.7.0' : '95f29dd0c067577f11972ff90dfc7d12', \ '2.7.0' : '95f29dd0c067577f11972ff90dfc7d12', \
'2.7.1' : '4eac6a462ec84dfe0cec96c82421b8e8', \
} }
# parse and process arguments # parse and process arguments

View File

@ -10,7 +10,7 @@ build target in the conventional and CMake based build systems
# copy LAMMPS shared library and lammps package to system dirs # copy LAMMPS shared library and lammps package to system dirs
from __future__ import print_function from __future__ import print_function
import sys,os,shutil import sys,os,shutil,time
from argparse import ArgumentParser from argparse import ArgumentParser
parser = ArgumentParser(prog='install.py', parser = ArgumentParser(prog='install.py',
@ -80,13 +80,15 @@ if args.dir:
sys.exit() sys.exit()
# extract version string from header # extract LAMMPS version string from header
# and convert to python packaging compatible version
def get_lammps_version(header): def get_lammps_version(header):
with open(header, 'r') as f: with open(header, 'r') as f:
line = f.readline() line = f.readline()
start_pos = line.find('"')+1 start_pos = line.find('"')+1
end_pos = line.find('"', start_pos) end_pos = line.find('"', start_pos)
return "".join(line[start_pos:end_pos].split()) t = time.strptime("".join(line[start_pos:end_pos].split()), "%d%b%Y")
return "{}.{}.{}".format(t.tm_year,t.tm_mon,t.tm_mday)
verstr = get_lammps_version(args.version) verstr = get_lammps_version(args.version)

View File

@ -13,10 +13,16 @@ from .core import *
from .data import * from .data import *
from .pylammps import * from .pylammps import *
# convert module string version to numeric version # convert installed module string version to numeric version
def get_version_number(): def get_version_number():
import time import time
from os.path import join
from sys import version_info from sys import version_info
# must report 0 when inside LAMMPS source tree
if __file__.find(join('python', 'lammps', '__init__.py')) > 0:
return 0
vstring = None vstring = None
if version_info.major == 3 and version_info.minor >= 8: if version_info.major == 3 and version_info.minor >= 8:
from importlib.metadata import version from importlib.metadata import version
@ -32,7 +38,7 @@ def get_version_number():
if not vstring: if not vstring:
return 0 return 0
t = time.strptime(vstring, "%d%b%Y") t = time.strptime(vstring, "%Y.%m.%d")
return t.tm_year*10000 + t.tm_mon*100 + t.tm_mday return t.tm_year*10000 + t.tm_mon*100 + t.tm_mday
__version__ = get_version_number() __version__ = get_version_number()

View File

@ -1,7 +1,8 @@
# this only installs the LAMMPS python package # this only installs the LAMMPS python package
# it assumes the LAMMPS shared library is already installed # it assumes the LAMMPS shared library is already installed
from distutils.core import setup from distutils.core import setup
import os from sys import version_info
import os,time
LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__)) LAMMPS_PYTHON_DIR = os.path.dirname(os.path.realpath(__file__))
LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR) LAMMPS_DIR = os.path.dirname(LAMMPS_PYTHON_DIR)
@ -12,7 +13,13 @@ def get_lammps_version():
line = f.readline() line = f.readline()
start_pos = line.find('"')+1 start_pos = line.find('"')+1
end_pos = line.find('"', start_pos) end_pos = line.find('"', start_pos)
return "".join(line[start_pos:end_pos].split()) t = time.strptime("".join(line[start_pos:end_pos].split()), "%d%b%Y")
return "{}.{}.{}".format(t.tm_year,t.tm_mon,t.tm_mday)
if version_info.major >= 3:
pkgs = ['lammps', 'lammps.mliap']
else:
pkgs = ['lammps']
setup( setup(
name = "lammps", name = "lammps",
@ -22,5 +29,5 @@ setup(
url = "https://lammps.sandia.gov", url = "https://lammps.sandia.gov",
description = "LAMMPS Molecular Dynamics Python package", description = "LAMMPS Molecular Dynamics Python package",
license = "GPL", license = "GPL",
packages=["lammps","lammps.mliap"], packages=pkgs,
) )

View File

@ -67,7 +67,7 @@ size_t GzFileWriter::write(const void * buffer, size_t length)
void GzFileWriter::flush() void GzFileWriter::flush()
{ {
if (!isopen()) return; if (!isopen()) return;
gzflush(gzFp, Z_SYNC_FLUSH); gzflush(gzFp, Z_SYNC_FLUSH);
} }

View File

@ -17,21 +17,21 @@
#include "fix_qeq_comb.h" #include "fix_qeq_comb.h"
#include <cmath>
#include <cstring>
#include "pair_comb.h"
#include "pair_comb3.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "error.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "memory.h"
#include "neigh_list.h"
#include "respa.h" #include "respa.h"
#include "update.h" #include "update.h"
#include "memory.h"
#include "error.h"
#include <cmath>
#include <cstring>
#include "pair_comb.h"
#include "pair_comb3.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -85,9 +85,6 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) qf[i] = 0.0; for (int i = 0; i < nlocal; i++) qf[i] = 0.0;
comb = nullptr;
comb3 = nullptr;
comm_forward = 1; comm_forward = 1;
} }
@ -119,8 +116,9 @@ void FixQEQComb::init()
if (!atom->q_flag) if (!atom->q_flag)
error->all(FLERR,"Fix qeq/comb requires atom attribute q"); error->all(FLERR,"Fix qeq/comb requires atom attribute q");
comb = (PairComb *) force->pair_match("^comb",0);
comb3 = (PairComb3 *) force->pair_match("^comb3",0); comb3 = (PairComb3 *) force->pair_match("^comb3",0);
if (!comb3) comb = (PairComb *) force->pair_match("^comb",0);
if (comb == nullptr && comb3 == nullptr) if (comb == nullptr && comb3 == nullptr)
error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb"); error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb");
@ -204,14 +202,17 @@ void FixQEQComb::post_force(int /*vflag*/)
double *q = atom->q; double *q = atom->q;
int *mask = atom->mask; int *mask = atom->mask;
if (comb) { if (comb) {
inum = comb->list->inum; inum = comb->list->inum;
ilist = comb->list->ilist; ilist = comb->list->ilist;
} } else if (comb3) {
if (comb3) {
inum = comb3->list->inum; inum = comb3->list->inum;
ilist = comb3->list->ilist; ilist = comb3->list->ilist;
} else {
inum = 0;
ilist = nullptr;
} }
for (ii = 0; ii < inum; ii++) { for (ii = 0; ii < inum; ii++) {
i = ilist[ii]; i = ilist[ii];
q1[i] = q2[i] = qf[i] = 0.0; q1[i] = q2[i] = qf[i] = 0.0;
@ -227,8 +228,9 @@ void FixQEQComb::post_force(int /*vflag*/)
} }
comm->forward_comm_fix(this); comm->forward_comm_fix(this);
enegtot = 0.0;
if (comb) enegtot = comb->yasu_char(qf,igroup); if (comb) enegtot = comb->yasu_char(qf,igroup);
if (comb3) enegtot = comb3->combqeq(qf,igroup); else if (comb3) enegtot = comb3->combqeq(qf,igroup);
enegtot /= ngroup; enegtot /= ngroup;
enegchk = enegmax = 0.0; enegchk = enegmax = 0.0;

View File

@ -147,7 +147,7 @@ int FixChargeRegulation::setmask() {
void FixChargeRegulation::init() { void FixChargeRegulation::init() {
triclinic = domain->triclinic; triclinic = domain->triclinic;
int ipe = modify->find_compute("thermo_pe"); int ipe = modify->find_compute("thermo_pe");
c_pe = modify->compute[ipe]; c_pe = modify->compute[ipe];
@ -187,14 +187,7 @@ void FixChargeRegulation::init() {
// neighbor list exclusion setup // neighbor list exclusion setup
// turn off interactions between group all and the exclusion group // turn off interactions between group all and the exclusion group
int narg = 4; neighbor->modify_params(fmt::format("exclude group {} all",group_id));
char **arg = new char*[narg];;
arg[0] = (char *) "exclude";
arg[1] = (char *) "group";
arg[2] = (char *) group_id.c_str();
arg[3] = (char *) "all";
neighbor->modify_params(narg,arg);
delete [] arg;
} }
// check that no deletable atoms are in atom->firstgroup // check that no deletable atoms are in atom->firstgroup
@ -356,7 +349,7 @@ void FixChargeRegulation::forward_acid() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor; double factor;
double *dummyp = nullptr; double dummyp[3];
double pos[3]; double pos[3];
pos[0] = 0; pos[0] = 0;
pos[1] = 0; pos[1] = 0;
@ -415,7 +408,7 @@ void FixChargeRegulation::backward_acid() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor; double factor;
int mask_tmp; int mask_tmp;
double *dummyp = nullptr; double dummyp[3];
double pos[3]; double pos[3];
pos[0] = 0; pos[0] = 0;
pos[1] = 0; pos[1] = 0;
@ -488,7 +481,7 @@ void FixChargeRegulation::forward_base() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor; double factor;
double *dummyp = nullptr; double dummyp[3];
double pos[3]; double pos[3];
pos[0] = 0; pos[0] = 0;
pos[1] = 0; pos[1] = 0;
@ -546,7 +539,7 @@ void FixChargeRegulation::backward_base() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor; double factor;
double *dummyp = nullptr; double dummyp[3];
int mask_tmp; int mask_tmp;
double pos[3]; double pos[3];
pos[0] = 0; pos[0] = 0;
@ -619,7 +612,7 @@ void FixChargeRegulation::forward_ions() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor; double factor;
double *dummyp = nullptr; double dummyp[3];
int m1 = -1, m2 = -1; int m1 = -1, m2 = -1;
factor = volume_rx * volume_rx * c10pI_plus * c10pI_minus / factor = volume_rx * volume_rx * c10pI_plus * c10pI_minus /
((1 + ncation) * (1 + nanion)); ((1 + ncation) * (1 + nanion));
@ -654,7 +647,7 @@ void FixChargeRegulation::backward_ions() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor; double factor;
int mask1_tmp = 0, mask2_tmp = 0; int mask1_tmp = 0, mask2_tmp = 0;
double *dummyp = nullptr; double dummyp[3];
int m1 = -1, m2 = -1; int m1 = -1, m2 = -1;
m1 = get_random_particle(cation_type, +1, 0, dummyp); m1 = get_random_particle(cation_type, +1, 0, dummyp);
@ -733,7 +726,7 @@ void FixChargeRegulation::forward_ions_multival() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor = 1; double factor = 1;
double *dummyp = nullptr; double dummyp[3];
int mm[salt_charge_ratio + 1];// particle ID array for all ions to be inserted int mm[salt_charge_ratio + 1];// particle ID array for all ions to be inserted
if (salt_charge[0] <= -salt_charge[1]) { if (salt_charge[0] <= -salt_charge[1]) {
@ -787,7 +780,7 @@ void FixChargeRegulation::backward_ions_multival() {
double energy_before = energy_stored; double energy_before = energy_stored;
double factor = 1; double factor = 1;
double *dummyp = nullptr; // dummy pointer double dummyp[3]; // dummy particle
int mm[salt_charge_ratio + 1]; // particle ID array for all deleted ions int mm[salt_charge_ratio + 1]; // particle ID array for all deleted ions
double qq[salt_charge_ratio + 1]; // charge array for all deleted ions double qq[salt_charge_ratio + 1]; // charge array for all deleted ions
int mask_tmp[salt_charge_ratio + 1]; // temporary mask array int mask_tmp[salt_charge_ratio + 1]; // temporary mask array

View File

@ -580,14 +580,7 @@ void FixGCMC::init()
// neighbor list exclusion setup // neighbor list exclusion setup
// turn off interactions between group all and the exclusion group // turn off interactions between group all and the exclusion group
int narg = 4; neighbor->modify_params(fmt::format("exclude group {} all",group_id));
char **arg = new char*[narg];;
arg[0] = (char *) "exclude";
arg[1] = (char *) "group";
arg[2] = (char *) group_id.c_str();
arg[3] = (char *) "all";
neighbor->modify_params(narg,arg);
delete [] arg;
} }
// create a new group for temporary use with selected molecules // create a new group for temporary use with selected molecules

View File

@ -342,14 +342,7 @@ void FixWidom::init()
// neighbor list exclusion setup // neighbor list exclusion setup
// turn off interactions between group all and the exclusion group // turn off interactions between group all and the exclusion group
int narg = 4; neighbor->modify_params(fmt::format("exclude group {} all",group_id));
char **arg = new char*[narg];;
arg[0] = (char *) "exclude";
arg[1] = (char *) "group";
arg[2] = (char *) group_id.c_str();
arg[3] = (char *) "all";
neighbor->modify_params(narg,arg);
delete [] arg;
} }
// create a new group for temporary use with selected molecules // create a new group for temporary use with selected molecules

View File

@ -93,7 +93,7 @@ void FixPythonInvoke::end_of_step()
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallFunction((PyObject*)pFunc, "O", (PyObject*)lmpPtr); PyObject * result = PyObject_CallFunction((PyObject*)pFunc, (char *)"O", (PyObject*)lmpPtr);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
@ -110,8 +110,9 @@ void FixPythonInvoke::post_force(int vflag)
if (update->ntimestep % nevery != 0) return; if (update->ntimestep % nevery != 0) return;
PyUtils::GIL lock; PyUtils::GIL lock;
char fmt[] = "Oi";
PyObject * result = PyObject_CallFunction((PyObject*)pFunc, "Oi", (PyObject*)lmpPtr, vflag); PyObject * result = PyObject_CallFunction((PyObject*)pFunc, fmt, (PyObject*)lmpPtr, vflag);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();

View File

@ -75,7 +75,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
} }
PyObject *ptr = PY_VOID_POINTER(lmp); PyObject *ptr = PY_VOID_POINTER(lmp);
PyObject *py_move_obj = PyObject_CallFunction(py_move_type, "O", ptr); PyObject *py_move_obj = PyObject_CallFunction(py_move_type, (char *)"O", ptr);
Py_CLEAR(ptr); Py_CLEAR(ptr);
if (!py_move_obj) { if (!py_move_obj) {
@ -112,7 +112,7 @@ int FixPythonMove::setmask()
void FixPythonMove::init() void FixPythonMove::init()
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject *)py_move, "init", nullptr); PyObject * result = PyObject_CallMethod((PyObject *)py_move, (char *)"init", nullptr);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
@ -126,7 +126,7 @@ void FixPythonMove::init()
void FixPythonMove::initial_integrate(int vflag) void FixPythonMove::initial_integrate(int vflag)
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject*)py_move, "initial_integrate", "i", vflag); PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"initial_integrate", (char *)"i", vflag);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
@ -140,7 +140,7 @@ void FixPythonMove::initial_integrate(int vflag)
void FixPythonMove::final_integrate() void FixPythonMove::final_integrate()
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject*)py_move, "final_integrate", nullptr); PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"final_integrate", nullptr);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
@ -154,7 +154,7 @@ void FixPythonMove::final_integrate()
void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop) void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop)
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject*)py_move, "initial_integrate_respa", "iii", vflag, ilevel, iloop); PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"initial_integrate_respa", (char *)"iii", vflag, ilevel, iloop);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
@ -168,7 +168,7 @@ void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop)
void FixPythonMove::final_integrate_respa(int ilevel, int iloop) void FixPythonMove::final_integrate_respa(int ilevel, int iloop)
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject*)py_move, "final_integrate_respa", "ii", ilevel, iloop); PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"final_integrate_respa", (char *)"ii", ilevel, iloop);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
@ -182,7 +182,7 @@ void FixPythonMove::final_integrate_respa(int ilevel, int iloop)
void FixPythonMove::reset_dt() void FixPythonMove::reset_dt()
{ {
PyUtils::GIL lock; PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject*)py_move, "reset_dt", nullptr); PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"reset_dt", nullptr);
if (!result) { if (!result) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();

View File

@ -288,7 +288,7 @@ void PairPython::coeff(int narg, char **arg)
py_potential = (void *) py_pair_instance; py_potential = (void *) py_pair_instance;
PyObject *py_value = PyObject_CallMethod(py_pair_instance, "check_units", "s", update->unit_style); PyObject *py_value = PyObject_CallMethod(py_pair_instance, (char *)"check_units", (char *)"s", update->unit_style);
if (!py_value) { if (!py_value) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
error->all(FLERR,"Calling 'check_units' function failed"); error->all(FLERR,"Calling 'check_units' function failed");
@ -306,7 +306,7 @@ void PairPython::coeff(int narg, char **arg)
} else skip_types[i] = 0; } else skip_types[i] = 0;
const int type = i; const int type = i;
const char * name = arg[2+i]; const char * name = arg[2+i];
py_value = PyObject_CallMethod(py_pair_instance, "map_coeff", "si", name, type); py_value = PyObject_CallMethod(py_pair_instance, (char *)"map_coeff", (char *)"si", name, type);
if (!py_value) { if (!py_value) {
PyUtils::Print_Errors(); PyUtils::Print_Errors();
error->all(FLERR,"Calling 'map_coeff' function failed"); error->all(FLERR,"Calling 'map_coeff' function failed");

View File

@ -18,16 +18,16 @@
#include "fix_qeq.h" #include "fix_qeq.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "neigh_list.h" #include "error.h"
#include "update.h"
#include "force.h" #include "force.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "neigh_list.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -386,13 +386,11 @@ int FixQEq::CG( double *b, double *x )
vector_sum( d, 1., p, beta, d, inum ); vector_sum( d, 1., p, beta, d, inum );
} }
if (loop >= maxiter && comm->me == 0) { if ((comm->me == 0) && (loop >= maxiter))
char str[128]; error->warning(FLERR,fmt::format("Fix qeq CG convergence failed ({}) "
sprintf(str,"Fix qeq CG convergence failed (%g) after %d iterations " "after {} iterations at step {}",
"at " BIGINT_FORMAT " step",sqrt(sig_new)/b_norm,loop,update->ntimestep); sqrt(sig_new)/b_norm,loop,
error->warning(FLERR,str); update->ntimestep));
}
return loop; return loop;
} }
@ -708,11 +706,9 @@ void FixQEq::read_file(char *file)
FILE *fp; FILE *fp;
if (comm->me == 0) { if (comm->me == 0) {
fp = utils::open_potential(file,lmp,nullptr); fp = utils::open_potential(file,lmp,nullptr);
if (fp == nullptr) { if (fp == nullptr)
char str[128]; error->one(FLERR,fmt::format("Cannot open fix qeq parameter file {}: {}",
snprintf(str,128,"Cannot open fix qeq parameter file %s",file); file,utils::getsyserror()));
error->one(FLERR,str);
}
} }
// read each line out of file, skipping blank lines or leading '#' // read each line out of file, skipping blank lines or leading '#'

View File

@ -17,20 +17,20 @@
#include "fix_qeq_dynamic.h" #include "fix_qeq_dynamic.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "neighbor.h" #include "error.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "kspace.h" #include "kspace.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "respa.h" #include "respa.h"
#include "error.h" #include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -154,14 +154,9 @@ void FixQEqDynamic::pre_force(int /*vflag*/)
} }
} }
if (comm->me == 0) { if ((comm->me == 0) && (iloop >= maxiter))
if (iloop == maxiter) { error->warning(FLERR,fmt::format("Charges did not converge at step "
char str[128]; "{}: {}",update->ntimestep,enegchk));
sprintf(str,"Charges did not converge at step " BIGINT_FORMAT
": %lg",update->ntimestep,enegchk);
error->warning(FLERR,str);
}
}
if (force->kspace) force->kspace->qsum_qsq(); if (force->kspace) force->kspace->qsum_qsq();
} }

View File

@ -17,22 +17,22 @@
#include "fix_qeq_fire.h" #include "fix_qeq_fire.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "neighbor.h" #include "error.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "kspace.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair_comb.h" #include "pair_comb.h"
#include "pair_comb3.h" #include "pair_comb3.h"
#include "kspace.h"
#include "respa.h" #include "respa.h"
#include "error.h" #include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
@ -47,7 +47,7 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) :
FixQEq(lmp, narg, arg) FixQEq(lmp, narg, arg), comb(nullptr), comb3(nullptr)
{ {
qdamp = 0.20; qdamp = 0.20;
qstep = 0.20; qstep = 0.20;
@ -65,9 +65,6 @@ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) :
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix qeq/fire command"); } else error->all(FLERR,"Illegal fix qeq/fire command");
} }
comb = nullptr;
comb3 = nullptr;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -94,9 +91,8 @@ void FixQEqFire::init()
if (utils::strmatch(update->integrate_style,"^respa")) if (utils::strmatch(update->integrate_style,"^respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels; nlevels_respa = ((Respa *) update->integrate)->nlevels;
comb = (PairComb *) force->pair_match("comb",1); comb3 = (PairComb3 *) force->pair_match("^comb3",0);
comb3 = (PairComb3 *) force->pair_match("comb3",1); if (!comb3) comb = (PairComb *) force->pair_match("^comb",0);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -218,14 +214,9 @@ void FixQEqFire::pre_force(int /*vflag*/)
if (enegchk < tolerance) break; if (enegchk < tolerance) break;
} }
if (comm->me == 0) { if ((comm->me == 0) && (iloop >= maxiter))
if (iloop == maxiter) { error->warning(FLERR,fmt::format("Charges did not converge at step "
char str[128]; "{}: {}",update->ntimestep,enegchk));
sprintf(str,"Charges did not converge at step " BIGINT_FORMAT
": %lg",update->ntimestep,enegchk);
error->warning(FLERR,str);
}
}
if (force->kspace) force->kspace->qsum_qsq(); if (force->kspace) force->kspace->qsum_qsq();
} }

View File

@ -16,20 +16,22 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_qeq_point.h" #include "fix_qeq_point.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "neighbor.h" #include "error.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "kspace.h" #include "kspace.h"
#include "respa.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "respa.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -158,13 +160,9 @@ void FixQEqPoint::compute_H()
} }
} }
if (m_fill >= H.m) { if (m_fill >= H.m)
char str[128]; error->all(FLERR,fmt::format("Fix qeq/point has insufficient H matrix "
sprintf(str,"H matrix size has been exceeded: m_fill=%d H.m=%d\n", "size: m_fill={} H.m={}\n",m_fill, H.m));
m_fill, H.m );
error->warning(FLERR,str);
error->all(FLERR,"Fix qeq/point has insufficient QEq matrix size");
}
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -16,21 +16,23 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_qeq_shielded.h" #include "fix_qeq_shielded.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "neighbor.h" #include "error.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "pair.h"
#include "kspace.h" #include "kspace.h"
#include "respa.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair.h"
#include "respa.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -223,13 +225,9 @@ void FixQEqShielded::compute_H()
} }
} }
if (m_fill >= H.m) { if (m_fill >= H.m)
char str[128]; error->all(FLERR,fmt::format("Fix qeq/shielded has insufficient H matrix "
sprintf(str,"H matrix size has been exceeded: m_fill=%d H.m=%d\n", "size: m_fill={} H.m={}\n",m_fill,H.m));
m_fill, H.m );
error->warning(FLERR,str);
error->all(FLERR,"Fix qeq/shielded has insufficient QEq matrix size");
}
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -247,7 +245,7 @@ double FixQEqShielded::calculate_H( double r, double gamma )
Taper = Taper * r + Tap[0]; Taper = Taper * r + Tap[0];
denom = r * r * r + gamma; denom = r * r * r + gamma;
denom = pow(denom,0.3333333333333); denom = pow(denom,1.0/3.0);
return Taper * EV_TO_KCAL_PER_MOL / denom; return Taper * EV_TO_KCAL_PER_MOL / denom;
} }

View File

@ -16,22 +16,23 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_qeq_slater.h" #include "fix_qeq_slater.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "neighbor.h" #include "error.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "force.h" #include "force.h"
#include "group.h" #include "group.h"
#include "pair.h"
#include "kspace.h" #include "kspace.h"
#include "respa.h"
#include "math_const.h" #include "math_const.h"
#include "error.h" #include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "pair.h"
#include "respa.h"
#include "update.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;
@ -207,14 +208,9 @@ void FixQEqSlater::compute_H()
chizj[i] = zjtmp; chizj[i] = zjtmp;
} }
if (m_fill >= H.m) { if (m_fill >= H.m)
char str[128]; error->all(FLERR,fmt::format(FLERR,"Fix qeq/slater has insufficient H "
sprintf(str,"H matrix size has been exceeded: m_fill=%d H.m=%d\n", "matrix size:m_fill={} H.m={}\n",m_fill,H.m));
m_fill, H.m );
error->warning(FLERR,str);
error->all(FLERR,"Fix qeq/slater has insufficient QEq matrix size");
}
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -31,6 +31,7 @@ class Ndx2Group : public Command {
public: public:
Ndx2Group(class LAMMPS *lmp) : Command(lmp) {}; Ndx2Group(class LAMMPS *lmp) : Command(lmp) {};
void command(int, char **); void command(int, char **);
private:
void create(const std::string &, const std::vector<tagint> &); void create(const std::string &, const std::vector<tagint> &);
}; };

View File

@ -128,20 +128,10 @@ void FixSRP::init()
// bond particles do not interact with other types // bond particles do not interact with other types
// type bptype only interacts with itself // type bptype only interacts with itself
char* arg1[4];
arg1[0] = (char *) "exclude";
arg1[1] = (char *) "type";
char c0[20];
char c1[20];
for (int z = 1; z < atom->ntypes; z++) { for (int z = 1; z < atom->ntypes; z++) {
if (z == bptype) if (z == bptype)
continue; continue;
sprintf(c0, "%d", z); neighbor->modify_params(fmt::format("exclude type {} {}",z,bptype));
arg1[2] = c0;
sprintf(c1, "%d", bptype);
arg1[3] = c1;
neighbor->modify_params(4, arg1);
} }
} }

View File

@ -1,23 +1,23 @@
The USER-PACE package provides the pace pair style, The USER-PACE package provides the pace pair style,
an efficient implementation of the Atomic Cluster Expansion an efficient implementation of the Atomic Cluster Expansion
potential (ACE). potential (ACE).
ACE is a methodology for deriving a highly accurate classical ACE is a methodology for deriving a highly accurate classical
potential fit to a large archive of quantum mechanical (DFT) data. potential fit to a large archive of quantum mechanical (DFT) data.
This package was written by Yury Lysogorskiy and others This package was written by Yury Lysogorskiy and others
at ICAMS, the Interdisciplinary Centre for Advanced Materials Simulation, at ICAMS, the Interdisciplinary Centre for Advanced Materials Simulation,
Ruhr University Bochum, Germany (http://www.icams.de). Ruhr University Bochum, Germany (http://www.icams.de).
This package requires a library that can be downloaded and built This package requires a library that can be downloaded and built
in lib/pace or somewhere else, which must be done before building in lib/pace or somewhere else, which must be done before building
LAMMPS with this package. Details of the download, build, and LAMMPS with this package. Details of the download, build, and
install process for this package using traditional make (not CMake) install process for this package using traditional make (not CMake)
are given in the lib/pace/README file, and scripts are are given in the lib/pace/README file, and scripts are
provided to help automate the process. Also see the LAMMPS manual for provided to help automate the process. Also see the LAMMPS manual for
general information on building LAMMPS with external libraries general information on building LAMMPS with external libraries
using either traditional make or CMake. using either traditional make or CMake.
More information about the USER-PACE implementation of ACE More information about the USER-PACE implementation of ACE
is available here: is available here:
https://github.com/ICAMS/lammps-user-pace https://github.com/ICAMS/lammps-user-pace

View File

@ -12,7 +12,6 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "body.h" #include "body.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -22,7 +22,6 @@
#include "modify.h" #include "modify.h"
#include <cstring> #include <cstring>
#include <cctype>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -23,6 +23,8 @@
#include "modify.h" #include "modify.h"
#include "update.h" #include "update.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -25,6 +25,8 @@
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define BIG 1.0e20 #define BIG 1.0e20

View File

@ -13,15 +13,14 @@
#include "compute_temp_region.h" #include "compute_temp_region.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "force.h"
#include "domain.h" #include "domain.h"
#include "region.h" #include "error.h"
#include "force.h"
#include "group.h" #include "group.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "region.h"
#include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -21,7 +21,6 @@
#include "memory.h" #include "memory.h"
#include <cstring> #include <cstring>
#include <cctype>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -21,8 +21,6 @@
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -12,14 +12,13 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_enforce2d.h" #include "fix_enforce2d.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "domain.h" #include "domain.h"
#include "error.h"
#include "modify.h" #include "modify.h"
#include "respa.h" #include "respa.h"
#include "error.h" #include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -19,7 +19,6 @@
#include "update.h" #include "update.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -16,8 +16,6 @@
#include "error.h" #include "error.h"
#include "modify.h" #include "modify.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -16,8 +16,6 @@
#include "error.h" #include "error.h"
#include "modify.h" #include "modify.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -13,16 +13,15 @@
#include "fix_nve_limit.h" #include "fix_nve_limit.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "force.h"
#include "update.h"
#include "respa.h"
#include "modify.h"
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "modify.h"
#include "respa.h"
#include "update.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_nve_noforce.h" #include "fix_nve_noforce.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "respa.h"
#include "error.h" #include "error.h"
#include "respa.h"
#include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -19,7 +19,6 @@
#include "update.h" #include "update.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -12,12 +12,12 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "fix_store_force.h" #include "fix_store_force.h"
#include <cstring>
#include "atom.h" #include "atom.h"
#include "update.h"
#include "respa.h"
#include "memory.h"
#include "error.h" #include "error.h"
#include "memory.h"
#include "respa.h"
#include "update.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -22,8 +22,6 @@
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;

View File

@ -35,7 +35,6 @@
#include <cstring> #include <cstring>
#include <map> #include <map>
#include <utility> #include <utility>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -16,8 +16,6 @@
#include "atom.h" #include "atom.h"
#include "error.h" #include "error.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -20,8 +20,6 @@
#include "memory.h" #include "memory.h"
#include "variable.h" #include "variable.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */

View File

@ -39,7 +39,6 @@
#include "pair.h" #include "pair.h"
#include "pair_hybrid.h" #include "pair_hybrid.h"
#include "region.h" #include "region.h"
#include "universe.h"
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"

View File

@ -31,7 +31,6 @@
#include "group.h" #include "group.h"
#include "info.h" #include "info.h"
#include "input.h" #include "input.h"
#include "integrate.h"
#include "memory.h" #include "memory.h"
#include "modify.h" #include "modify.h"
#include "molecule.h" #include "molecule.h"

View File

@ -18,7 +18,9 @@
#include "math_eigen.h" #include "math_eigen.h"
#include "math_eigen_impl.h" #include "math_eigen_impl.h"
#include<array> #include <array>
#include <utility>
#include <vector>
using std::vector; using std::vector;
using std::array; using std::array;

View File

@ -4,8 +4,6 @@
#include <cstdint> // IWYU pragma: keep #include <cstdint> // IWYU pragma: keep
#include <limits> #include <limits>
#include "error.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
static constexpr int nmaxfactorial = 167; static constexpr int nmaxfactorial = 167;

View File

@ -14,7 +14,6 @@
#include "my_pool_chunk.h" #include "my_pool_chunk.h"
#include <cstdlib> #include <cstdlib>
#include <cstdio>
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) #if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#define LAMMPS_MEMALIGN 64 #define LAMMPS_MEMALIGN 64

View File

@ -2356,6 +2356,22 @@ void Neighbor::modify_params(int narg, char **arg)
} }
} }
/* ----------------------------------------------------------------------
convenience function to allow modifying parameters from a single string
------------------------------------------------------------------------- */
void Neighbor::modify_params(const std::string &modcmd)
{
auto args = utils::split_words(modcmd);
char **newarg = new char*[args.size()];
int i=0;
for (const auto &arg : args) {
newarg[i++] = (char *)arg.c_str();
}
modify_params(args.size(),newarg);
delete[] newarg;
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
remove the first group-group exclusion matching group1, group2 remove the first group-group exclusion matching group1, group2
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -118,6 +118,7 @@ class Neighbor : protected Pointers {
void set(int, char **); // set neighbor style and skin distance void set(int, char **); // set neighbor style and skin distance
void reset_timestep(bigint); // reset of timestep counter void reset_timestep(bigint); // reset of timestep counter
void modify_params(int, char**); // modify params that control builds void modify_params(int, char**); // modify params that control builds
void modify_params(const std::string &); // convenience overload
void exclusion_group_group_delete(int, int); // rm a group-group exclusion void exclusion_group_group_delete(int, int); // rm a group-group exclusion
int exclude_setting(); // return exclude value to accelerator pkg int exclude_setting(); // return exclude value to accelerator pkg

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_full_bin_atomonly.h" #include "npair_full_bin_atomonly.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_bin_atomonly_newton.h" #include "npair_half_bin_atomonly_newton.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_bin_newtoff.h" #include "npair_half_size_bin_newtoff.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_bin_newton.h" #include "npair_half_size_bin_newton.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_bin_newton_tri.h" #include "npair_half_size_bin_newton_tri.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_multi_newtoff.h" #include "npair_half_size_multi_newtoff.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_multi_newton.h" #include "npair_half_size_multi_newton.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_multi_newton_tri.h" #include "npair_half_size_multi_newton_tri.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,12 +12,12 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_nsq_newtoff.h" #include "npair_half_size_nsq_newtoff.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "error.h"
#include "group.h" #include "group.h"
#include "my_page.h" #include "my_page.h"
#include "error.h" #include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,12 +12,12 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_half_size_nsq_newton.h" #include "npair_half_size_nsq_newton.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "error.h"
#include "group.h" #include "group.h"
#include "my_page.h" #include "my_page.h"
#include "error.h" #include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,10 +12,10 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_halffull_newtoff.h" #include "npair_halffull_newtoff.h"
#include "neigh_list.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_halffull_newton.h" #include "npair_halffull_newton.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_skip.h" #include "npair_skip.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_skip_respa.h" #include "npair_skip_respa.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_skip_size.h" #include "npair_skip_size.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,11 +12,11 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_skip_size_off2on.h" #include "npair_skip_size_off2on.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -12,12 +12,12 @@
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
#include "npair_skip_size_off2on_oneside.h" #include "npair_skip_size_off2on_oneside.h"
#include "neigh_list.h"
#include "atom.h" #include "atom.h"
#include "atom_vec.h"
#include "domain.h" #include "domain.h"
#include "my_page.h"
#include "error.h" #include "error.h"
#include "my_page.h"
#include "neigh_list.h"
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -14,18 +14,15 @@
#include "output.h" #include "output.h"
#include "style_dump.h" // IWYU pragma: keep #include "style_dump.h" // IWYU pragma: keep
#include "atom.h"
#include "comm.h" #include "comm.h"
#include "domain.h" #include "domain.h"
#include "dump.h" #include "dump.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "group.h" #include "group.h"
#include "info.h" #include "info.h"
#include "input.h" #include "input.h"
#include "memory.h" #include "memory.h"
#include "modify.h" #include "modify.h"
#include "neighbor.h"
#include "thermo.h" #include "thermo.h"
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"

View File

@ -260,7 +260,7 @@ void PairCoulCut::read_restart(FILE *fp)
MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
if (setflag[i][j]) { if (setflag[i][j]) {
if (me == 0) if (me == 0)
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world);
} }

View File

@ -396,6 +396,9 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
double *vals = new double[nvars]; double *vals = new double[nvars];
for (i = 0; i < nvars; ++i) { for (i = 0; i < nvars; ++i) {
j = input->variable->find(scalevars[i].c_str()); j = input->variable->find(scalevars[i].c_str());
if (j < 0)
error->all(FLERR,fmt::format("Variable '{}' not found when updating "
"scale factors",scalevars[i]));
vals[i] = input->variable->compute_equal(j); vals[i] = input->variable->compute_equal(j);
} }
for (i = 0; i < nstyles; ++i) { for (i = 0; i < nstyles; ++i) {
@ -457,8 +460,6 @@ void PairHybridScaled::coeff(int narg, char **arg)
if (multiple[m]) { if (multiple[m]) {
multflag = 1; multflag = 1;
if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients");
if (!isdigit(arg[3][0]))
error->all(FLERR,"Incorrect args for pair coefficients");
int index = utils::inumeric(FLERR,arg[3],false,lmp); int index = utils::inumeric(FLERR,arg[3],false,lmp);
if (index == multiple[m]) break; if (index == multiple[m]) break;
else continue; else continue;

View File

@ -17,20 +17,19 @@
#include "pair_lj96_cut.h" #include "pair_lj96_cut.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "error.h"
#include "force.h" #include "force.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "update.h"
#include "respa.h"
#include "math_const.h" #include "math_const.h"
#include "memory.h" #include "memory.h"
#include "error.h" #include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "respa.h"
#include "update.h"
#include <cmath>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -26,7 +26,6 @@
#include "memory.h" #include "memory.h"
#include <cmath> #include <cmath>
#include <cstdlib>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
@ -608,18 +607,18 @@ void PairLJRelRes::read_restart(FILE *fp)
int me = comm->me; int me = comm->me;
for (i = 1; i <= atom->ntypes; i++) for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) { for (j = i; j <= atom->ntypes; j++) {
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error);
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
if (setflag[i][j]) { if (setflag[i][j]) {
if (me == 0) { if (me == 0) {
fread(&epsilonf[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&epsilonf[i][j],sizeof(double),1,fp,nullptr,error);
fread(&sigmaf[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&sigmaf[i][j],sizeof(double),1,fp,nullptr,error);
fread(&epsilon[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error);
fread(&sigma[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error);
fread(&cutf_inner[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&cutf_inner[i][j],sizeof(double),1,fp,nullptr,error);
fread(&cutf[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&cutf[i][j],sizeof(double),1,fp,nullptr,error);
fread(&cut_inner[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error);
fread(&cut[i][j],sizeof(double),1,fp); utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error);
} }
MPI_Bcast(&epsilonf[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&epsilonf[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&sigmaf[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigmaf[i][j],1,MPI_DOUBLE,0,world);
@ -655,12 +654,12 @@ void PairLJRelRes::read_restart_settings(FILE *fp)
{ {
int me = comm->me; int me = comm->me;
if (me == 0) { if (me == 0) {
fread(&cutf_inner_global,sizeof(double),1,fp); utils::sfread(FLERR,&cutf_inner_global,sizeof(double),1,fp,nullptr,error);
fread(&cutf_global,sizeof(double),1,fp); utils::sfread(FLERR,&cutf_global,sizeof(double),1,fp,nullptr,error);
fread(&cut_inner_global,sizeof(double),1,fp); utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error);
fread(&cut_global,sizeof(double),1,fp); utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error);
fread(&offset_flag,sizeof(int),1,fp); utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error);
fread(&mix_flag,sizeof(int),1,fp); utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error);
} }
MPI_Bcast(&cutf_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cutf_inner_global,1,MPI_DOUBLE,0,world);
MPI_Bcast(&cutf_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cutf_global,1,MPI_DOUBLE,0,world);

View File

@ -13,14 +13,15 @@
#include "pair_morse.h" #include "pair_morse.h"
#include <cmath>
#include <cstring>
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "force.h"
#include "neigh_list.h"
#include "memory.h"
#include "error.h" #include "error.h"
#include "force.h"
#include "memory.h"
#include "neigh_list.h"
#include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -62,7 +62,8 @@ PotentialFileReader::PotentialFileReader(LAMMPS *lmp,
try { try {
reader = open_potential(filename); reader = open_potential(filename);
if (!reader) { if (!reader) {
error->one(FLERR, fmt::format("cannot open {} potential file {}", potential_name, filename)); error->one(FLERR, fmt::format("cannot open {} potential file {}: {}",
potential_name, filename, utils::getsyserror()));
} }
} catch (FileReaderException &e) { } catch (FileReaderException &e) {
error->one(FLERR, e.what()); error->one(FLERR, e.what());

View File

@ -1195,7 +1195,7 @@ void ReadRestart::check_eof_magic()
if (me == 0) { if (me == 0) {
long curpos = ftell(fp); long curpos = ftell(fp);
fseek(fp,(long)-n,SEEK_END); fseek(fp,(long)-n,SEEK_END);
fread(str,sizeof(char),n,fp); utils::sfread(FLERR,str,sizeof(char),n,fp,nullptr,error);
fseek(fp,curpos,SEEK_SET); fseek(fp,curpos,SEEK_SET);
} }

View File

@ -15,8 +15,6 @@
#include "error.h" #include "error.h"
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
// only proc 0 calls methods of this class, except for constructor/destructor // only proc 0 calls methods of this class, except for constructor/destructor

View File

@ -19,7 +19,6 @@
#include "variable.h" #include "variable.h"
#include <cmath> #include <cmath>
#include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -46,7 +46,8 @@ TextFileReader::TextFileReader(const std::string &filename, const std::string &f
fp = fopen(filename.c_str(), "r"); fp = fopen(filename.c_str(), "r");
if (fp == nullptr) { if (fp == nullptr) {
throw FileReaderException(fmt::format("cannot open {} file {}", filetype, filename)); throw FileReaderException(fmt::format("cannot open {} file {}: {}",
filetype, filename, utils::getsyserror()));
} }
} }

View File

@ -19,7 +19,6 @@
#include "utils.h" #include "utils.h"
#include "fmt/format.h" #include "fmt/format.h"
#include <exception>
#include <utility> #include <utility>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -15,9 +15,7 @@
#include "error.h" #include "error.h"
#include "memory.h" #include "memory.h"
#include "version.h"
#include <cctype>
#include <cstring> #include <cstring>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;

View File

@ -40,7 +40,6 @@
#include <cstring> #include <cstring>
#include <unistd.h> #include <unistd.h>
#include <unordered_map> #include <unordered_map>
#include <vector>
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace MathConst; using namespace MathConst;

View File

@ -22,7 +22,6 @@
#include "force.h" #include "force.h"
#include "improper.h" #include "improper.h"
#include "pair.h" #include "pair.h"
#include "universe.h"
#include <cctype> #include <cctype>
#include <cstring> #include <cstring>

View File

@ -29,7 +29,6 @@
#include "output.h" #include "output.h"
#include "pair.h" #include "pair.h"
#include "thermo.h" #include "thermo.h"
#include "universe.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>

View File

@ -32,7 +32,6 @@
#include "output.h" #include "output.h"
#include "pair.h" #include "pair.h"
#include "thermo.h" #include "thermo.h"
#include "universe.h"
#include "update.h" #include "update.h"
#include <cstring> #include <cstring>