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")
mark_as_advanced(ENABLE_IWYU)
if(ENABLE_IWYU)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_program(IWYU_EXE NAMES include-what-you-use iwyu)
find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py)
if (IWYU_EXE AND IWYU_TOOL)
@ -730,7 +731,7 @@ get_target_property(DEFINES lammps COMPILE_DEFINITIONS)
include(FeatureSummary)
feature_summary(DESCRIPTION "The following tools and libraries have been found and configured:" WHAT PACKAGES_FOUND)
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}
Install path: ${CMAKE_INSTALL_PREFIX}
Generator: ${CMAKE_GENERATOR} using ${CMAKE_MAKE_PROGRAM}")

View File

@ -104,3 +104,13 @@ function(FetchPotentials pkgfolder potfolder)
endforeach()
endif()
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")
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_MD5 "95f29dd0c067577f11972ff90dfc7d12" CACHE STRING "MD5 checksum of 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 "4eac6a462ec84dfe0cec96c82421b8e8" CACHE STRING "MD5 checksum of PLUMED tarball")
mark_as_advanced(PLUMED_URL)
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_OPTIONS "${VALGRIND_DEFAULT_OPTIONS}" CACHE STRING "Memory Check Command Options")
# check if a faster linker is available.
# only verified with GNU and Clang compilers and new CMake
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
# we need to build and link a LOT of tester executables, so it is worth checking if
# a faster linker is available. requires GNU or Clang compiler, newer CMake.
# also only verified with Fedora Linux > 30 and Ubuntu <= 18.04 (Ubuntu 20.04 fails)
if((CMAKE_SYSTEM_NAME STREQUAL Linux) AND (CMAKE_VERSION VERSION_GREATER_EQUAL 3.13)
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)
set(CMAKE_CUSTOM_LINKER_DEFAULT default)
check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG)

View File

@ -56,27 +56,28 @@ Examples
Description
"""""""""""
Perform the charge equilibration (QEq) method as described in :ref:`(Rappe and Goddard) <Rappe1>` and formulated in :ref:`(Nakano) <Nakano1>` (also known
as the matrix inversion method) and in :ref:`(Rick and Stuart) <Rick1>` (also
known as the extended Lagrangian method) based on the
electronegativity equilization principle.
Perform the charge equilibration (QEq) method as described in
:ref:`(Rappe and Goddard) <Rappe1>` and formulated in :ref:`(Nakano)
<Nakano1>` (also known as the matrix inversion method) and in
: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
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
performs charge equilibration periodically (e.g. every timestep), such
as the ReaxFF or Streitz-Mintmire potential.
But these fixes can also be used with
potentials that normally assume per-atom charges are fixed, e.g. a
:doc:`Buckingham <pair_buck>` or :doc:`LJ/Coulombic <pair_lj>` potential.
as the ReaxFF or Streitz-Mintmire potential. But these fixes can also
be used with potentials that normally assume per-atom charges are fixed,
e.g. a :doc:`Buckingham <pair_buck>` or :doc:`LJ/Coulombic <pair_lj>`
potential.
Because the charge equilibration calculation is effectively
independent of the pair style, these fixes can also be used to perform
a one-time assignment of charges to atoms. For example, you could
define the QEq fix, perform a zero-timestep run via the :doc:`run <run>`
command without any pair style defined which would set per-atom
charges (based on the current atom configuration), then remove the fix
via the :doc:`unfix <unfix>` command before performing further dynamics.
Because the charge equilibration calculation is effectively independent
of the pair style, these fixes can also be used to perform a one-time
assignment of charges to atoms. For example, you could define the QEq
fix, perform a zero-timestep run via the :doc:`run <run>` command
without any pair style defined which would set per-atom charges (based
on the current atom configuration), then remove the fix via the
:doc:`unfix <unfix>` command before performing further dynamics.
.. note::
@ -87,11 +88,14 @@ via the :doc:`unfix <unfix>` command before performing further dynamics.
.. note::
The :doc:`fix qeq/comb <fix_qeq_comb>` command must still be used
to perform charge equilibration with the :doc:`COMB potential <pair_comb>`. The :doc:`fix qeq/reax <fix_qeq_reax>`
command can be used to perform charge equilibration with the :doc:`ReaxFF force 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 :doc:`fix qeq/comb <fix_qeq_comb>` command must still be used to
perform charge equilibration with the :doc:`COMB potential
<pair_comb>`. The :doc:`fix qeq/reax <fix_qeq_reax>` command can be
used to perform charge equilibration with the :doc:`ReaxFF force
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
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
point charges, but uses a shielded Coulomb potential to describe the
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
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*
parameters from the *qfile* file are used. When using the string
*reax/c* as filename, these parameters are extracted directly from
an active *reax/c* pair style. This style solves partial
charges on atoms via the matrix inversion method. A tolerance of
1.0e-6 is usually a good number.
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* parameters from the *qfile* file are used. When using the string
*reax/c* as filename, these parameters are extracted directly from an
active *reax/c* pair style. This style solves partial charges on atoms
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
charge densities centered around atoms via the Slater 1\ *s* orbital, so
that the interaction between a pair of charged particles is the
product of two Slater 1\ *s* orbitals. The expression for the Slater
1\ *s* orbital is given under equation (6) of the
:ref:`Streitz-Mintmire <Streitz1>` paper. Only the *chi*\ , *eta*\ , *zeta*\ , and
*qcore* parameters from the *qfile* file are used. When using the string
that the interaction between a pair of charged particles is the product
of two Slater 1\ *s* orbitals. The expression for the Slater 1\ *s*
orbital is given under equation (6) of the :ref:`Streitz-Mintmire
<Streitz1>` paper. Only the *chi*\ , *eta*\ , *zeta*\ , and *qcore*
parameters from the *qfile* file are used. When using the string
*coul/streitz* as filename, these parameters are extracted directly from
an active *coul/streitz* pair style. This style solves
partial charges on atoms via the matrix inversion method. A tolerance
of 1.0e-6 is usually a good number. Keyword *alpha* can be used to
change the Slater type orbital exponent.
an active *coul/streitz* pair style. This style solves partial charges
on atoms via the matrix inversion method. A tolerance of 1.0e-6 is
usually a good number. Keyword *alpha* can be used to change the Slater
type orbital exponent.
The *qeq/dynamic* style describes partial charges on atoms as point
charges that interact through 1/r, but the extended Lagrangian method
is used to solve partial charges on atoms. Only the *chi* and *eta*
charges that interact through 1/r, but the extended Lagrangian method is
used to solve partial charges on atoms. Only the *chi* and *eta*
parameters from the *qfile* file are used. Note that Coulomb
catastrophe can occur if repulsion between the pair of charged
particles is too weak. A tolerance of 1.0e-3 is usually a good
number. Keyword *qdamp* can be used to change the damping factor, while
keyword *qstep* can be used to change the time step size.
catastrophe can occur if repulsion between the pair of charged particles
is too weak. A tolerance of 1.0e-3 is usually a good number. Keyword
*qdamp* can be used to change the damping factor, while keyword *qstep*
can be used to change the time step size.
The :ref:`\ *qeq/fire*\ <Shan>` style describes the same charge model and charge
solver as the *qeq/dynamic* style, but employs a FIRE minimization
algorithm to solve for equilibrium charges.
Keyword *qdamp* can be used to change the damping factor, while
keyword *qstep* can be used to change the time step size.
The :ref:`\ *qeq/fire*\ <Shan>` style describes the same charge model
and charge solver as the *qeq/dynamic* style, but employs a FIRE
minimization algorithm to solve for equilibrium charges. Keyword
*qdamp* can be used to change the damping factor, while keyword *qstep*
can be used to change the time step size.
Note that *qeq/point*\ , *qeq/shielded*\ , and *qeq/slater* describe
different charge models, whereas the matrix inversion method and the
extended Lagrangian method (\ *qeq/dynamic* and *qeq/fire*\ ) are
different solvers.
Note that *qeq/point*\ , *qeq/dynamic* and *qeq/fire* styles all describe
charges as point charges that interact through 1/r relationship, but
solve partial charges on atoms using different solvers. These three
styles should yield comparable results if
the QEq parameters and *Nevery*\ , *cutoff*\ , and *tolerance* are the
same. Style *qeq/point* is typically faster, *qeq/dynamic* scales
better on larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
Note that *qeq/point*\ , *qeq/dynamic* and *qeq/fire* styles all
describe charges as point charges that interact through 1/r
relationship, but solve partial charges on atoms using different
solvers. These three styles should yield comparable results if the QEq
parameters and *Nevery*\ , *cutoff*\ , and *tolerance* are the same.
Style *qeq/point* is typically faster, *qeq/dynamic* scales better on
larger sizes, and *qeq/fire* is faster than *qeq/dynamic*\ .
.. 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
No information about these fixes is written to :doc:`binary restart files <restart>`. No global scalar or vector or per-atom
quantities are 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.
No information about these fixes is written to :doc:`binary restart
files <restart>`. No global scalar or vector or per-atom quantities are
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>`.
@ -210,7 +218,8 @@ Restrictions
""""""""""""
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
""""""""""""""""

View File

@ -17,7 +17,7 @@ parser = ArgumentParser(prog='Install.py',
# settings
version = "2.7.0"
version = "2.7.1"
mode = "static"
# help message
@ -47,9 +47,12 @@ checksums = { \
'2.5.2' : 'bd2f18346c788eb54e1e52f4f6acf41a', \
'2.5.3' : 'de30d6e7c2dcc0973298e24a6da24286', \
'2.5.4' : 'f31b7d16a4be2e30aa7d5c19c3d37853', \
'2.5.7' : '1ca36226fdb8110b1009aa61d615d4e5', \
'2.6.0' : '204d2edae58d9b10ba3ad460cad64191', \
'2.6.1' : '89a9a450fc6025299fe16af235957163', \
'2.6.3' : 'a9f8028fd74528c2024781ea1fdefeee', \
'2.7.0' : '95f29dd0c067577f11972ff90dfc7d12', \
'2.7.1' : '4eac6a462ec84dfe0cec96c82421b8e8', \
}
# 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
from __future__ import print_function
import sys,os,shutil
import sys,os,shutil,time
from argparse import ArgumentParser
parser = ArgumentParser(prog='install.py',
@ -80,13 +80,15 @@ if args.dir:
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):
with open(header, 'r') as f:
line = f.readline()
start_pos = line.find('"')+1
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)

View File

@ -13,10 +13,16 @@ from .core import *
from .data import *
from .pylammps import *
# convert module string version to numeric version
# convert installed module string version to numeric version
def get_version_number():
import time
from os.path import join
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
if version_info.major == 3 and version_info.minor >= 8:
from importlib.metadata import version
@ -32,7 +38,7 @@ def get_version_number():
if not vstring:
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
__version__ = get_version_number()

View File

@ -1,7 +1,8 @@
# this only installs the LAMMPS python package
# it assumes the LAMMPS shared library is already installed
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_DIR = os.path.dirname(LAMMPS_PYTHON_DIR)
@ -12,7 +13,13 @@ def get_lammps_version():
line = f.readline()
start_pos = line.find('"')+1
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(
name = "lammps",
@ -22,5 +29,5 @@ setup(
url = "https://lammps.sandia.gov",
description = "LAMMPS Molecular Dynamics Python package",
license = "GPL",
packages=["lammps","lammps.mliap"],
packages=pkgs,
)

View File

@ -17,21 +17,21 @@
#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 "comm.h"
#include "error.h"
#include "force.h"
#include "group.h"
#include "memory.h"
#include "neigh_list.h"
#include "respa.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 FixConst;
@ -85,9 +85,6 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg),
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) qf[i] = 0.0;
comb = nullptr;
comb3 = nullptr;
comm_forward = 1;
}
@ -119,8 +116,9 @@ void FixQEQComb::init()
if (!atom->q_flag)
error->all(FLERR,"Fix qeq/comb requires atom attribute q");
comb = (PairComb *) force->pair_match("^comb",0);
comb3 = (PairComb3 *) force->pair_match("^comb3",0);
if (!comb3) comb = (PairComb *) force->pair_match("^comb",0);
if (comb == nullptr && comb3 == nullptr)
error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb");
@ -207,11 +205,14 @@ void FixQEQComb::post_force(int /*vflag*/)
if (comb) {
inum = comb->list->inum;
ilist = comb->list->ilist;
}
if (comb3) {
} else if (comb3) {
inum = comb3->list->inum;
ilist = comb3->list->ilist;
} else {
inum = 0;
ilist = nullptr;
}
for (ii = 0; ii < inum; ii++) {
i = ilist[ii];
q1[i] = q2[i] = qf[i] = 0.0;
@ -227,8 +228,9 @@ void FixQEQComb::post_force(int /*vflag*/)
}
comm->forward_comm_fix(this);
enegtot = 0.0;
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;
enegchk = enegmax = 0.0;

View File

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

View File

@ -580,14 +580,7 @@ void FixGCMC::init()
// neighbor list exclusion setup
// turn off interactions between group all and the exclusion group
int narg = 4;
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;
neighbor->modify_params(fmt::format("exclude group {} all",group_id));
}
// create a new group for temporary use with selected molecules

View File

@ -342,14 +342,7 @@ void FixWidom::init()
// neighbor list exclusion setup
// turn off interactions between group all and the exclusion group
int narg = 4;
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;
neighbor->modify_params(fmt::format("exclude group {} all",group_id));
}
// create a new group for temporary use with selected molecules

View File

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

View File

@ -75,7 +75,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
}
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);
if (!py_move_obj) {
@ -112,7 +112,7 @@ int FixPythonMove::setmask()
void FixPythonMove::init()
{
PyUtils::GIL lock;
PyObject * result = PyObject_CallMethod((PyObject *)py_move, "init", nullptr);
PyObject * result = PyObject_CallMethod((PyObject *)py_move, (char *)"init", nullptr);
if (!result) {
PyUtils::Print_Errors();
@ -126,7 +126,7 @@ void FixPythonMove::init()
void FixPythonMove::initial_integrate(int vflag)
{
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) {
PyUtils::Print_Errors();
@ -140,7 +140,7 @@ void FixPythonMove::initial_integrate(int vflag)
void FixPythonMove::final_integrate()
{
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) {
PyUtils::Print_Errors();
@ -154,7 +154,7 @@ void FixPythonMove::final_integrate()
void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop)
{
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) {
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)
{
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) {
PyUtils::Print_Errors();
@ -182,7 +182,7 @@ void FixPythonMove::final_integrate_respa(int ilevel, int iloop)
void FixPythonMove::reset_dt()
{
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) {
PyUtils::Print_Errors();

View File

@ -288,7 +288,7 @@ void PairPython::coeff(int narg, char **arg)
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) {
PyUtils::Print_Errors();
error->all(FLERR,"Calling 'check_units' function failed");
@ -306,7 +306,7 @@ void PairPython::coeff(int narg, char **arg)
} else skip_types[i] = 0;
const int type = 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) {
PyUtils::Print_Errors();
error->all(FLERR,"Calling 'map_coeff' function failed");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,6 +31,7 @@ class Ndx2Group : public Command {
public:
Ndx2Group(class LAMMPS *lmp) : Command(lmp) {};
void command(int, char **);
private:
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
// 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++) {
if (z == bptype)
continue;
sprintf(c0, "%d", z);
arg1[2] = c0;
sprintf(c1, "%d", bptype);
arg1[3] = c1;
neighbor->modify_params(4, arg1);
neighbor->modify_params(fmt::format("exclude type {} {}",z,bptype));
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,6 +19,8 @@
#include "math_eigen_impl.h"
#include <array>
#include <utility>
#include <vector>
using std::vector;
using std::array;

View File

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

View File

@ -14,7 +14,6 @@
#include "my_pool_chunk.h"
#include <cstdlib>
#include <cstdio>
#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32)
#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
------------------------------------------------------------------------- */

View File

@ -118,6 +118,7 @@ class Neighbor : protected Pointers {
void set(int, char **); // set neighbor style and skin distance
void reset_timestep(bigint); // reset of timestep counter
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
int exclude_setting(); // return exclude value to accelerator pkg

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -396,6 +396,9 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq,
double *vals = new double[nvars];
for (i = 0; i < nvars; ++i) {
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);
}
for (i = 0; i < nstyles; ++i) {
@ -457,8 +460,6 @@ void PairHybridScaled::coeff(int narg, char **arg)
if (multiple[m]) {
multflag = 1;
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);
if (index == multiple[m]) break;
else continue;

View File

@ -17,20 +17,19 @@
#include "pair_lj96_cut.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "error.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 "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 MathConst;

View File

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

View File

@ -62,7 +62,8 @@ PotentialFileReader::PotentialFileReader(LAMMPS *lmp,
try {
reader = open_potential(filename);
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) {
error->one(FLERR, e.what());

View File

@ -1195,7 +1195,7 @@ void ReadRestart::check_eof_magic()
if (me == 0) {
long curpos = ftell(fp);
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);
}

View File

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

View File

@ -19,7 +19,6 @@
#include "variable.h"
#include <cmath>
#include <cstring>
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");
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 "fmt/format.h"
#include <exception>
#include <utility>
using namespace LAMMPS_NS;

View File

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

View File

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

View File

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

View File

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

View File

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