Merge remote-tracking branch 'github/master' into arg-info-class

# Conflicts:
#	src/compute_chunk_atom.cpp
#	src/compute_chunk_spread_atom.cpp
#	src/compute_reduce.cpp
#	src/compute_reduce_region.cpp
#	src/compute_slice.cpp
#	src/fix_ave_atom.cpp
This commit is contained in:
Axel Kohlmeyer
2021-02-02 11:33:01 -05:00
52 changed files with 487 additions and 381 deletions

49
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,49 @@
# GitHub action to run static code analysis on C++ and Python code
name: "CodeQL Code Analysis"
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
analyze:
name: Analyze
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: ['cpp', 'python']
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Building LAMMPS via CMake
if: ${{ matrix.language == 'cpp' }}
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake
cmake --build . --parallel 2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

36
.github/workflows/unittest-macos.yml vendored Normal file
View File

@ -0,0 +1,36 @@
# GitHub action to build LAMMPS on MacOS and run unit tests
name: "Unittest for MacOS"
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
name: MacOS Unit Test
if: ${{ github.repository == 'lammps/lammps' }}
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Building LAMMPS via CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: |
cmake -C $GITHUB_WORKSPACE/cmake/presets/most.cmake $GITHUB_WORKSPACE/cmake \
-DENABLE_TESTING=ON -DBUILD_SHARED_LIBS=ON -DLAMMPS_EXCEPTIONS=ON
cmake --build . --parallel 2
- name: Run Tests
working-directory: ${{github.workspace}}/build
shell: bash
run: ctest -V

View File

@ -94,7 +94,7 @@ $(SPHINXCONFIG)/conf.py: $(SPHINXCONFIG)/conf.py.in
-e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \ -e 's,@LAMMPS_PYTHON_DIR@,$(BUILDDIR)/../python,g' \
-e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@ -e 's,@LAMMPS_DOC_DIR@,$(BUILDDIR),g' $< > $@
html: xmlgen $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
@$(MAKE) $(MFLAGS) -C graphviz all @$(MAKE) $(MFLAGS) -C graphviz all
@(\ @(\
@ -118,7 +118,7 @@ html: xmlgen $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX)
@rm -rf html/PDF/.[sg]* @rm -rf html/PDF/.[sg]*
@echo "Build finished. The HTML pages are in doc/html." @echo "Build finished. The HTML pages are in doc/html."
spelling: xmlgen $(VENV) $(SPHINXCONFIG)/false_positives.txt spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt
@if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi
@(\ @(\
. $(VENV)/bin/activate ; env PYTHONWARNINGS= \ . $(VENV)/bin/activate ; env PYTHONWARNINGS= \

View File

@ -1,68 +1,75 @@
Source files Source files
------------ ------------
The source files of the LAMMPS code are found in two The source files of the LAMMPS code are found in two directories of the
directories of the distribution: ``src`` and ``lib``. distribution: ``src`` and ``lib``. Most of the code is written in C++
Most of the code is C++ but there are small numbers of files but there are small a number of files in several other languages like C,
in several other languages. Fortran, Shell script, or Python.
The core of the code is located in the The core of the code is located in the ``src`` folder and its
``src`` folder and its sub-directories. sub-directories. A sizable number of these files are in the ``src``
A sizable number of these files are in the ``src`` directory directory itself, but there are plenty of :doc:`packages <Packages>`,
itself, but there are plenty of :doc:`packages <Packages>`, which can be which can be included or excluded when LAMMPS is built. See the
included or excluded when LAMMPS is built. See the :doc:`Include :doc:`Include packages in build <Build_package>` section of the manual
packages in build <Build_package>` section of the manual for more for more information about that part of the build process. LAMMPS
information about that part of the build process. LAMMPS currently currently supports building with :doc:`conventional makefiles
supports building with :doc:`conventional makefiles <Build_make>` and <Build_make>` and through :doc:`CMake <Build_cmake>`. Those procedures
through :doc:`CMake <Build_cmake>` which differ in how packages are differ in how packages are enabled or disabled for inclusion into a
enabled or disabled for a LAMMPS binary. The source files for each LAMMPS binary so they cannot be mixed. The source files for each
package are in all-uppercase sub-directories of the ``src`` folder, for package are in all-uppercase sub-directories of the ``src`` folder, for
example ``src/MOLECULE`` or ``src/USER-MISC``. The ``src/STUBS`` example ``src/MOLECULE`` or ``src/USER-MISC``. The ``src/STUBS``
sub-directory is not a package but contains a dummy MPI library, that is sub-directory is not a package but contains a dummy MPI library, that is
used when building a serial version of the code. The ``src/MAKE`` used when building a serial version of the code. The ``src/MAKE``
directory contains makefiles with settings and flags for a variety of directory and its sub-directories contain makefiles with settings and
configuration and machines for the build process with traditional flags for a variety of configuration and machines for the build process
makefiles. with traditional makefiles.
The ``lib`` directory contains the source code for several supporting The ``lib`` directory contains the source code for several supporting
libraries or files with configuration settings to use globally installed libraries or files with configuration settings to use globally installed
libraries, that are required by some of the optional packages. libraries, that are required by some of the optional packages. They may
Each sub-directory, like ``lib/poems`` or ``lib/gpu``, contains the include python scripts that can transparently download additional source
source files, some of which are in different languages such as Fortran code on request. Each sub-directory, like ``lib/poems`` or ``lib/gpu``,
or CUDA. These libraries are linked to during a LAMMPS build, if the contains the source files, some of which are in different languages such
corresponding package is installed. as Fortran or CUDA. These libraries included in the LAMMPS build,
if the corresponding package is installed.
LAMMPS C++ source files almost always come in pairs, such as LAMMPS C++ source files almost always come in pairs, such as
``src/run.cpp`` (implementation file) and ``src/run.h`` (header file). ``src/run.cpp`` (implementation file) and ``src/run.h`` (header file).
Each pair of files defines a C++ Each pair of files defines a C++ class, for example the
class, for example the :cpp:class:`LAMMPS_NS::Run` class which contains :cpp:class:`LAMMPS_NS::Run` class which contains the code invoked by the
the code invoked by the :doc:`run <run>` command in a LAMMPS input script. :doc:`run <run>` command in a LAMMPS input script. As this example
As this example illustrates, source file and class names often have a illustrates, source file and class names often have a one-to-one
one-to-one correspondence with a command used in a LAMMPS input script. correspondence with a command used in a LAMMPS input script. Some
Some source files and classes do not have a corresponding input script source files and classes do not have a corresponding input script
command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force` command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force`
class. They are discussed in the next section. class. They are discussed in the next section.
A small number of C++ classes and utility functions are implemented with The names of all source files are in lower case and may use the
only a ``.h`` file. Examples are the Pointer class or the MathVec functions. underscore character '_' to separate words. Outside of bundled libraries
which may have different conventions, all C and C++ header files have a
``.h`` extension, all C++ files have a ``.cpp`` extension, and C files a
``.c`` extension. A small number of C++ classes and utility functions
are implemented with only a ``.h`` file. Examples are the Pointer class
or the MathVec functions.
Class topology Class topology
-------------- --------------
Though LAMMPS has a lot of source files and classes, its class topology Though LAMMPS has a lot of source files and classes, its class topology
is relative flat, as outlined in the :ref:`class-topology` figure. Each is not very deep, which can be seen from the :ref:`class-topology`
name refers to a class and has a pair of associated source files in the figure. In that figure, each name refers to a class and has a pair of
``src`` folder, for example the class :cpp:class:`LAMMPS_NS::Memory` associated source files in the ``src`` folder, for example the class
corresponds to the files ``memory.cpp`` and ``memory.h``, or the class :cpp:class:`LAMMPS_NS::Memory` corresponds to the files ``memory.cpp``
:cpp:class:`LAMMPS_NS::AtomVec` corresponds to the files and ``memory.h``, or the class :cpp:class:`LAMMPS_NS::AtomVec`
``atom_vec.cpp`` and ``atom_vec.h``. Full lines in the figure represent corresponds to the files ``atom_vec.cpp`` and ``atom_vec.h``. Full
compositing: that is the class to the left holds a pointer to an lines in the figure represent compositing: that is the class at the base
instance of the class to the right. Dashed lines instead represent of the arrow holds a pointer to an instance of the class at the tip.
inheritance: the class to the right is derived from the class on the Dashed lines instead represent inheritance: the class to the tip of the
left. Classes with a red boundary are not instantiated directly, but arrow is derived from the class at the base. Classes with a red boundary
they represent the base classes for "styles". Those "styles" make up are not instantiated directly, but they represent the base classes for
the bulk of the LAMMPS code and only a few typical examples are included "styles". Those "styles" make up the bulk of the LAMMPS code and only
in the figure for demonstration purposes. a few representative examples are included in the figure so it remains
readable.
.. _class-topology: .. _class-topology:
.. figure:: JPG/lammps-classes.png .. figure:: JPG/lammps-classes.png
@ -82,8 +89,8 @@ in the figure for demonstration purposes.
derived classes, which may also hold instances of other classes. derived classes, which may also hold instances of other classes.
The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and
represents what is referred to an "instance" of LAMMPS. It is a represents what is generally referred to an "instance" of LAMMPS. It is
composite holding references to instances of other core classes a composite holding pointers to instances of other core classes
providing the core functionality of the MD engine in LAMMPS and through providing the core functionality of the MD engine in LAMMPS and through
them abstractions of the required operations. The constructor of the them abstractions of the required operations. The constructor of the
LAMMPS class will instantiate those instances, process the command line LAMMPS class will instantiate those instances, process the command line
@ -91,60 +98,67 @@ flags, initialize MPI (if not already done) and set up file pointers for
input and output. The destructor will shut everything down and free all input and output. The destructor will shut everything down and free all
associated memory. Thus code for the standalone LAMMPS executable in associated memory. Thus code for the standalone LAMMPS executable in
``main.cpp`` simply initializes MPI, instantiates a single instance of ``main.cpp`` simply initializes MPI, instantiates a single instance of
LAMMPS, and passes it the command line flags and input script. It LAMMPS while passing it the command line flags and input script. It
deletes the LAMMPS instance after the method reading the input returns deletes the LAMMPS instance after the method reading the input returns
and shuts down the MPI environment before it exits the executable. and shuts down the MPI environment before it exits the executable.
The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the
:ref:`class-topology` figure, it holds references to members of the :ref:`class-topology` figure for clarity. It holds references to many
`LAMMPS_NS::LAMMPS`, so that all classes derived from of the members of the `LAMMPS_NS::LAMMPS`, so that all classes derived
:cpp:class:`LAMMPS_NS::Pointers` have direct access to those reference. from :cpp:class:`LAMMPS_NS::Pointers` have direct access to those
From the class topology all classes with blue boundary are referenced in reference. From the class topology all classes with blue boundary are
this class and all classes in the second and third columns, that are not referenced in the Pointers class and all classes in the second and third
listed as derived classes are instead derived from columns, that are not listed as derived classes are instead derived from
:cpp:class:`LAMMPS_NS::Pointers`. :cpp:class:`LAMMPS_NS::Pointers`. To initialize the pointer references
in Pointers, a pointer to the LAMMPS class instance needs to be passed
to the constructor and thus all constructors for classes derived from it
must do so and pass this pointer to the constructor for Pointers.
Since all storage is encapsulated, the LAMMPS class can also be Since all storage is supposed to be encapsulated (there are a few
instantiated multiple times by a calling code, and that can be either exceptions), the LAMMPS class can also be instantiated multiple times by
simultaneously or consecutively. When running in parallel with MPI, a calling code. Outside of the aforementioned exceptions, those LAMMPS
care has to be taken, that suitable communicators are used to not instances can be used alternately. As of the time of this writing
create conflicts between different instances. (early 2021) LAMMPS is not yet sufficiently thread-safe for concurrent
execution. When running in parallel with MPI, care has to be taken,
that suitable copies of communicators are used to not create conflicts
between different instances.
The LAMMPS class currently holds instances of 19 classes representing The LAMMPS class currently (early 2021) holds instances of 19 classes
different core functionalities There are a handful of virtual parent representing the core functionality. There are a handful of virtual
classes in LAMMPS that define what LAMMPS calls ``styles``. They are parent classes in LAMMPS that define what LAMMPS calls ``styles``. They
shaded red in the :ref:`class-topology` figure. Each of these are are shaded red in the :ref:`class-topology` figure. Each of these are
parents of a number of child classes that implement the interface parents of a number of child classes that implement the interface
defined by the parent class. There are two main categories of these defined by the parent class. There are two main categories of these
``styles``: some may only have one instance active at a time (e.g. atom, ``styles``: some may only have one instance active at a time (e.g. atom,
pair, bond, angle, dihedral, improper, kspace, comm) and there is a pair, bond, angle, dihedral, improper, kspace, comm) and there is a
dedicated pointer variable in the composite class that manages them. dedicated pointer variable for each of them in the composite class.
Setups that require a mix of different such styles have to use a Setups that require a mix of different such styles have to use a
*hybrid* class that manages and forwards calls to the corresponding *hybrid* class that takes the place of the one allowed instance and then
sub-styles for the designated subset of atoms or data. or the composite manages and forwards calls to the corresponding sub-styles for the
class may have lists of class instances, e.g. Modify handles lists of designated subset of atoms or data. The composite class may also have
compute and fix styles, while Output handles dumps class instances. lists of class instances, e.g. Modify handles lists of compute and fix
styles, while Output handles a list of dump class instances.
The exception to this scheme are the ``command`` style classes. These The exception to this scheme are the ``command`` style classes. These
implement specific commands that can be invoked before, after, or between implement specific commands that can be invoked before, after, or in
runs or are commands which launch a simulation. For these an instance between runs. For these an instance of the class is created, its
of the class is created, its command() method called and then, after command() method called and then, after completion, the class instance
completion, the class instance deleted. Examples for this are the deleted. Examples for this are the create_box, create_atoms, minimize,
create_box, create_atoms, minimize, run, or velocity command styles. run, or velocity command styles.
For all those ``styles`` certain naming conventions are employed: for For all those ``styles`` certain naming conventions are employed: for
the fix nve command the class is called FixNVE and the files are the fix nve command the class is called FixNVE and the source files are
``fix_nve.h`` and ``fix_nve.cpp``. Similarly for fix ave/time we have ``fix_nve.h`` and ``fix_nve.cpp``. Similarly for fix ave/time we have
FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names
are lower case and without spaces or special characters. A suffix or are lower case and without spaces or special characters. A suffix or
multiple appended with a forward slash '/' denotes a variant of the words are appended with a forward slash '/' which denotes a variant of
corresponding class without the suffix. To connect the style name and the corresponding class without the suffix. To connect the style name
the class name, LAMMPS uses macros like the following ATOM\_CLASS, and the class name, LAMMPS uses macros like: ``AtomStyle()``,
PAIR\_CLASS, BOND\_CLASS, REGION\_CLASS, FIX\_CLASS, COMPUTE\_CLASS, ``PairStyle()``, ``BondStyle()``, ``RegionStyle()``, and so on in the
or DUMP\_CLASS in the corresponding header file. During compilation corresponding header file. During configuration or compilation files
files with the pattern ``style_name.h`` are created that contain include with the pattern ``style_<name>.h`` are created that consist of a list
statements including all headers of all styles of a given type that of include statements including all headers of all styles of a given
are currently active (or "installed). type that are currently active (or "installed).
More details on individual classes in the :ref:`class-topology` are as More details on individual classes in the :ref:`class-topology` are as
@ -152,11 +166,11 @@ follows:
- The Memory class handles allocation of all large vectors and arrays. - The Memory class handles allocation of all large vectors and arrays.
- The Error class prints all error and warning messages. - The Error class prints all (terminal) error and warning messages.
- The Universe class sets up partitions of processors so that multiple - The Universe class sets up one or more partitions of processors so
simulations can be run, each on a subset of the processors allocated that one or multiple simulations can be run, on the processors
for a run, e.g. by the mpirun command. allocated for a run, e.g. by the mpirun command.
- The Input class reads and processes input input strings and files, - The Input class reads and processes input input strings and files,
stores variables, and invokes :doc:`commands <Commands_all>`. stores variables, and invokes :doc:`commands <Commands_all>`.
@ -241,7 +255,8 @@ follows:
.. TODO section on "Spatial decomposition and parallel operations" .. TODO section on "Spatial decomposition and parallel operations"
.. diagram of 3d processor grid, brick vs. tiled. local vs. ghost .. diagram of 3d processor grid, brick vs. tiled. local vs. ghost
.. atoms, 6-way communication with pack/unpack functions, .. atoms, 6-way communication with pack/unpack functions,
.. PBC as part of the communication .. PBC as part of the communication, forward and reverse communication
.. rendezvous communication, ring communication.
.. TODO section on "Fixes, Computes, and Variables" .. TODO section on "Fixes, Computes, and Variables"
.. how and when data is computed and provided and how it is .. how and when data is computed and provided and how it is

View File

@ -69,7 +69,7 @@ this.
cd build cd build
# configure LAMMPS compilation # configure LAMMPS compilation
cmake -C cmake/presets/minimal.cmake -D BUILD_SHARED_LIBS=on \ cmake -C ../cmake/presets/minimal.cmake -D BUILD_SHARED_LIBS=on \
-D LAMMPS_EXCEPTIONS=on -D PKG_PYTHON=on ../cmake -D LAMMPS_EXCEPTIONS=on -D PKG_PYTHON=on ../cmake
# compile LAMMPS # compile LAMMPS
@ -97,10 +97,12 @@ this.
For a system-wide installation you need to set For a system-wide installation you need to set
``CMAKE_INSTALL_PREFIX`` to a system folder like ``/usr`` (or ``CMAKE_INSTALL_PREFIX`` to a system folder like ``/usr`` (or
``/usr/local``). The installation step (**not** the ``/usr/local``); the default is ``${HOME}/.local``. The
installation step for a system folder installation (**not** the
configuration/compilation) needs to be done with superuser configuration/compilation) needs to be done with superuser
privilege, e.g. by using ``sudo cmake --install .``. The privilege, e.g. by using ``sudo cmake --install .``. The
installation folders will then by changed to: installation folders will then be changed to (assuming ``/usr`` as
prefix):
+------------------------+---------------------------------------------------------+-------------------------------------------------------------+ +------------------------+---------------------------------------------------------+-------------------------------------------------------------+
| File | Location | Notes | | File | Location | Notes |

View File

@ -99,6 +99,7 @@ class lammps(object):
# so that LD_LIBRARY_PATH does not need to be set for regular install # so that LD_LIBRARY_PATH does not need to be set for regular install
# fall back to loading with a relative path, # fall back to loading with a relative path,
# typically requires LD_LIBRARY_PATH to be set appropriately # typically requires LD_LIBRARY_PATH to be set appropriately
# guess shared library extension based on OS, if not inferred from actual file
if any([f.startswith('liblammps') and f.endswith('.dylib') if any([f.startswith('liblammps') and f.endswith('.dylib')
for f in os.listdir(modpath)]): for f in os.listdir(modpath)]):
@ -110,6 +111,12 @@ class lammps(object):
for f in os.listdir(winpath)]): for f in os.listdir(winpath)]):
lib_ext = ".dll" lib_ext = ".dll"
modpath = winpath modpath = winpath
else:
import platform
if platform.system() == "Darwin":
lib_ext = ".dylib"
elif platform.system() == "Windows":
lib_ext = ".dll"
else: else:
lib_ext = ".so" lib_ext = ".so"

View File

@ -784,7 +784,7 @@ struct AtomVecDPDKokkos_PackBorder {
_uCond(uCond), _uCond(uCond),
_uMech(uMech), _uMech(uMech),
_uChem(uChem), _uChem(uChem),
_uCG(uCGnew), _uCG(uCG),
_uCGnew(uCGnew), _uCGnew(uCGnew),
_dx(dx),_dy(dy),_dz(dz) {} _dx(dx),_dy(dy),_dz(dz) {}

View File

@ -27,7 +27,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -113,9 +112,9 @@ void ComputeCoordAtomKokkos<DeviceType>::compute_peratom()
} }
if (cstyle == ORIENT) { if (cstyle == ORIENT) {
if (!(c_orientorder->invoked_flag & INVOKED_PERATOM)) { if (!(c_orientorder->invoked_flag & Compute::INVOKED_PERATOM)) {
c_orientorder->compute_peratom(); c_orientorder->compute_peratom();
c_orientorder->invoked_flag |= INVOKED_PERATOM; c_orientorder->invoked_flag |= Compute::INVOKED_PERATOM;
} }
nqlist = c_orientorder->nqlist; nqlist = c_orientorder->nqlist;
normv = c_orientorder->array_atom; normv = c_orientorder->array_atom;

View File

@ -49,7 +49,6 @@ extern "C" {
// difficult to debug crashes or memory corruption. // difficult to debug crashes or memory corruption.
#define LATTE_ABIVERSION 20180622 #define LATTE_ABIVERSION 20180622
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -248,9 +247,9 @@ void FixLatte::post_force(int vflag)
if (coulomb) { if (coulomb) {
modify->clearstep_compute(); modify->clearstep_compute();
if (!(c_pe->invoked_flag & INVOKED_PERATOM)) { if (!(c_pe->invoked_flag & Compute::INVOKED_PERATOM)) {
c_pe->compute_peratom(); c_pe->compute_peratom();
c_pe->invoked_flag |= INVOKED_PERATOM; c_pe->invoked_flag |= Compute::INVOKED_PERATOM;
} }
modify->addstep_compute(update->ntimestep+1); modify->addstep_compute(update->ntimestep+1);

View File

@ -20,6 +20,7 @@
#include "comm.h" #include "comm.h"
#include "error.h" #include "error.h"
#include "memory.h" #include "memory.h"
#include "tokenizer.h"
#include <cstring> #include <cstring>
@ -30,7 +31,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename) : Pointers(lmp) MLIAPModel::MLIAPModel(LAMMPS *lmp, char *) : Pointers(lmp)
{ {
nparams = 0; nparams = 0;
nelements = 0; nelements = 0;
@ -44,7 +45,6 @@ MLIAPModel::~MLIAPModel()
{ {
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
placeholder placeholder
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
@ -87,6 +87,7 @@ MLIAPModelSimple::~MLIAPModelSimple()
memory->destroy(coeffelem); memory->destroy(coeffelem);
} }
/* ---------------------------------------------------------------------- */
void MLIAPModelSimple::read_coeffs(char *coefffilename) void MLIAPModelSimple::read_coeffs(char *coefffilename)
{ {
@ -130,14 +131,14 @@ void MLIAPModelSimple::read_coeffs(char *coefffilename)
// words = ptrs to all words in line // words = ptrs to all words in line
// strip single and double quotes from words // strip single and double quotes from words
char* words[MAXWORD]; try {
int iword = 0; ValueTokenizer coeffs(line);
words[iword] = strtok(line,"' \t\n\r\f"); nelements = coeffs.next_int();
iword = 1; nparams = coeffs.next_int();
words[iword] = strtok(nullptr,"' \t\n\r\f"); } catch (TokenizerException &e) {
error->all(FLERR,fmt::format("Incorrect format in MLIAPModel coefficient "
nelements = atoi(words[0]); "file: {}",e.what()));
nparams = atoi(words[1]); }
// set up coeff lists // set up coeff lists
@ -157,19 +158,19 @@ void MLIAPModelSimple::read_coeffs(char *coefffilename)
MPI_Bcast(&eof,1,MPI_INT,0,world); MPI_Bcast(&eof,1,MPI_INT,0,world);
if (eof) if (eof)
error->all(FLERR,"Incorrect format in coefficient file"); error->all(FLERR,"Incorrect format in MLIAPModel coefficient file");
MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(&n,1,MPI_INT,0,world);
MPI_Bcast(line,n,MPI_CHAR,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world);
nwords = utils::trim_and_count_words(line); try {
if (nwords != 1) ValueTokenizer coeffs(utils::trim_comment(line));
error->all(FLERR,"Incorrect format in coefficient file"); if (coeffs.count() != 1)
throw TokenizerException("Wrong number of items","");
iword = 0; coeffelem[ielem][icoeff] = coeffs.next_double();
words[iword] = strtok(line,"' \t\n\r\f"); } catch (TokenizerException &e) {
error->all(FLERR,fmt::format("Incorrect format in MLIAPModel "
coeffelem[ielem][icoeff] = atof(words[0]); "coefficient file: {}",e.what()));
}
} }
} }

View File

@ -167,7 +167,7 @@ void MLIAPModelPython::compute_gradients(MLIAPData* data)
egradient is derivative of energy w.r.t. parameters egradient is derivative of energy w.r.t. parameters
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void MLIAPModelPython::compute_gradgrads(class MLIAPData* data) void MLIAPModelPython::compute_gradgrads(class MLIAPData *)
{ {
error->all(FLERR,"compute_gradgrads not implemented"); error->all(FLERR,"compute_gradgrads not implemented");
} }
@ -177,7 +177,7 @@ void MLIAPModelPython::compute_gradgrads(class MLIAPData* data)
egradient is derivative of energy w.r.t. parameters egradient is derivative of energy w.r.t. parameters
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void MLIAPModelPython::compute_force_gradients(class MLIAPData* data) void MLIAPModelPython::compute_force_gradients(class MLIAPData *)
{ {
error->all(FLERR,"compute_force_gradients not implemented"); error->all(FLERR,"compute_force_gradients not implemented");
} }
@ -186,7 +186,7 @@ void MLIAPModelPython::compute_force_gradients(class MLIAPData* data)
count the number of non-zero entries in gamma matrix count the number of non-zero entries in gamma matrix
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int MLIAPModelPython::get_gamma_nnz(class MLIAPData* data) int MLIAPModelPython::get_gamma_nnz(class MLIAPData *)
{ {
// todo: get_gamma_nnz // todo: get_gamma_nnz
return 0; return 0;

View File

@ -28,7 +28,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_SCALAR 1
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -474,7 +474,7 @@ double PairSpinExchangeBiquadratic::compute_energy(int i, int j, double rsq,
int *type = atom->type; int *type = atom->type;
int itype,jtype; int itype,jtype;
double Jex,Kex,ra,sdots; double Jex,Kex,ra,sdots;
double rj,rk,r2j,r2k,ir3j,ir3k; double rj,rk,r2j,r2k;
double energy = 0.0; double energy = 0.0;
itype = type[i]; itype = type[i];
jtype = type[j]; jtype = type[j];
@ -482,10 +482,8 @@ double PairSpinExchangeBiquadratic::compute_energy(int i, int j, double rsq,
ra = sqrt(rsq); ra = sqrt(rsq);
rj = ra/J3[itype][jtype]; rj = ra/J3[itype][jtype];
r2j = rsq/J3[itype][jtype]/J3[itype][jtype]; r2j = rsq/J3[itype][jtype]/J3[itype][jtype];
ir3j = 1.0/(rj*rj*rj);
rk = ra/K3[itype][jtype]; rk = ra/K3[itype][jtype];
r2k = rsq/K3[itype][jtype]/K3[itype][jtype]; r2k = rsq/K3[itype][jtype]/K3[itype][jtype];
ir3k = 1.0/(rk*rk*rk);
Jex = 4.0*J1_mech[itype][jtype]*r2j; Jex = 4.0*J1_mech[itype][jtype]*r2j;
Jex *= (1.0-J2[itype][jtype]*r2j); Jex *= (1.0-J2[itype][jtype]*r2j);

View File

@ -36,7 +36,6 @@ using namespace FixConst;
enum{ONE,RUNNING,WINDOW}; enum{ONE,RUNNING,WINDOW};
enum{FIRST,MULTI}; enum{FIRST,MULTI};
#define INVOKED_VECTOR 2
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -326,9 +325,9 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep)
Compute *compute = modify->compute[icompute]; Compute *compute = modify->compute[icompute];
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
double *vector = compute->vector; double *vector = compute->vector;

View File

@ -42,9 +42,6 @@ using namespace FixConst;
enum{COMPUTE,FIX,VARIABLE}; enum{COMPUTE,FIX,VARIABLE};
enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
static const char cite_fix_ave_correlate_long[] = static const char cite_fix_ave_correlate_long[] =
"fix ave/correlate/long command:\n\n" "fix ave/correlate/long command:\n\n"
@ -448,15 +445,15 @@ void FixAveCorrelateLong::end_of_step()
Compute *compute = modify->compute[m]; Compute *compute = modify->compute[m];
if (argindex[i] == 0) { if (argindex[i] == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
scalar = compute->scalar; scalar = compute->scalar;
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
scalar = compute->vector[argindex[i]-1]; scalar = compute->vector[argindex[i]-1];
} }

View File

@ -42,8 +42,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define MAXLINE 512 #define MAXLINE 512
enum{FORWARD=-1,BACKWARD=1}; enum{FORWARD=-1,BACKWARD=1};
@ -338,7 +336,7 @@ void FixPhonon::end_of_step()
double xcur[3]; double xcur[3];
// to get the current temperature // to get the current temperature
if (!(temperature->invoked_flag & INVOKED_VECTOR)) temperature->compute_vector(); if (!(temperature->invoked_flag & Compute::INVOKED_VECTOR)) temperature->compute_vector();
for (idim = 0; idim < sysdim; ++idim) TempSum[idim] += temperature->vector[idim]; for (idim = 0; idim < sysdim; ++idim) TempSum[idim] += temperature->vector[idim];
// evaluate R(r) on local proc // evaluate R(r) on local proc

View File

@ -49,7 +49,6 @@ static char plumed_default_kernel[] = "PLUMED_KERNEL=" PLUMED_QUOTE(__PLUMED_DEF
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
#define INVOKED_SCALAR 1
FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), Fix(lmp, narg, arg),

View File

@ -861,6 +861,14 @@ struct cubic_spline_coef
LAMMPS_INLINE LAMMPS_INLINE
cubic_spline_coef() {} cubic_spline_coef() {}
LAMMPS_INLINE
cubic_spline_coef(const cubic_spline_coef &_c) {
a = _c.a;
b = _c.b;
c = _c.c;
d = _c.d;
}
LAMMPS_INLINE LAMMPS_INLINE
void operator=(const cubic_spline_coef &rhs) { void operator=(const cubic_spline_coef &rhs) {
a = rhs.a; a = rhs.a;
@ -868,6 +876,7 @@ struct cubic_spline_coef
c = rhs.c; c = rhs.c;
d = rhs.d; d = rhs.d;
} }
LAMMPS_INLINE LAMMPS_INLINE
void operator=(const cubic_spline_coef &rhs) volatile { void operator=(const cubic_spline_coef &rhs) volatile {
a = rhs.a; a = rhs.a;

View File

@ -89,7 +89,6 @@ enum{X,Y,Z, // required for vtk, must come first
enum{LT,LE,GT,GE,EQ,NEQ}; enum{LT,LE,GT,GE,EQ,NEQ};
enum{VTK,VTP,VTU,PVTP,PVTU}; // file formats enum{VTK,VTP,VTU,PVTP,PVTU}; // file formats
#define INVOKED_PERATOM 8
#define ONEFIELD 32 #define ONEFIELD 32
#define DELTA 1048576 #define DELTA 1048576
@ -302,9 +301,9 @@ int DumpVTK::count()
error->all(FLERR,"Compute used in dump between runs is not current"); error->all(FLERR,"Compute used in dump between runs is not current");
} else { } else {
for (i = 0; i < ncompute; i++) { for (i = 0; i < ncompute; i++) {
if (!(compute[i]->invoked_flag & INVOKED_PERATOM)) { if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) {
compute[i]->compute_peratom(); compute[i]->compute_peratom();
compute[i]->invoked_flag |= INVOKED_PERATOM; compute[i]->invoked_flag |= Compute::INVOKED_PERATOM;
} }
} }
} }

View File

@ -84,7 +84,7 @@ Compute::Compute(LAMMPS *lmp, int narg, char **arg) :
invoked_scalar = invoked_vector = invoked_array = -1; invoked_scalar = invoked_vector = invoked_array = -1;
invoked_peratom = invoked_local = -1; invoked_peratom = invoked_local = -1;
invoked_flag = 0; invoked_flag = INVOKED_NONE;
// set modify defaults // set modify defaults

View File

@ -20,6 +20,14 @@ namespace LAMMPS_NS {
class Compute : protected Pointers { class Compute : protected Pointers {
public: public:
enum {
INVOKED_NONE = 0,
INVOKED_SCALAR = 1<<0,
INVOKED_VECTOR = 1<<1,
INVOKED_ARRAY = 1<<2,
INVOKED_PERATOM = 1<<3,
INVOKED_LOCAL = 1<<4,
};
static int instance_total; // # of Compute classes ever instantiated static int instance_total; // # of Compute classes ever instantiated
char *id,*style; char *id,*style;

View File

@ -47,7 +47,6 @@ enum{ONCE,NFREQ,EVERY}; // used in several files
enum{LIMITMAX,LIMITEXACT}; enum{LIMITMAX,LIMITEXACT};
#define IDMAX 1024*1024 #define IDMAX 1024*1024
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -943,9 +942,9 @@ void ComputeChunkAtom::assign_chunk_ids()
} }
} else if (which == ArgInfo::COMPUTE) { } else if (which == ArgInfo::COMPUTE) {
if (!(cchunk->invoked_flag & INVOKED_PERATOM)) { if (!(cchunk->invoked_flag & Compute::INVOKED_PERATOM)) {
cchunk->compute_peratom(); cchunk->compute_peratom();
cchunk->invoked_flag |= INVOKED_PERATOM; cchunk->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (argindex == 0) { if (argindex == 0) {

View File

@ -25,10 +25,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeChunkSpreadAtom:: ComputeChunkSpreadAtom::
@ -256,9 +252,9 @@ void ComputeChunkSpreadAtom::compute_peratom()
Compute *compute = modify->compute[n]; Compute *compute = modify->compute[n];
if (argindex[m] == 0) { if (argindex[m] == 0) {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
double *cvector = compute->vector; double *cvector = compute->vector;
for (i = 0; i < nlocal; i++, ptr += nstride) { for (i = 0; i < nlocal; i++, ptr += nstride) {
@ -270,9 +266,9 @@ void ComputeChunkSpreadAtom::compute_peratom()
} }
} else { } else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
int icol = argindex[m]-1; int icol = argindex[m]-1;
double **carray = compute->array; double **carray = compute->array;

View File

@ -32,7 +32,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -198,9 +197,9 @@ void ComputeCoordAtom::compute_peratom()
} }
if (cstyle == ORIENT) { if (cstyle == ORIENT) {
if (!(c_orientorder->invoked_flag & INVOKED_PERATOM)) { if (!(c_orientorder->invoked_flag & Compute::INVOKED_PERATOM)) {
c_orientorder->compute_peratom(); c_orientorder->compute_peratom();
c_orientorder->invoked_flag |= INVOKED_PERATOM; c_orientorder->invoked_flag |= Compute::INVOKED_PERATOM;
} }
nqlist = c_orientorder->nqlist; nqlist = c_orientorder->nqlist;
normv = c_orientorder->array_atom; normv = c_orientorder->array_atom;

View File

@ -27,9 +27,6 @@ using namespace LAMMPS_NS;
enum{VECTOR,ARRAY}; enum{VECTOR,ARRAY};
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define BIG 1.0e20 #define BIG 1.0e20
@ -303,9 +300,9 @@ void ComputeGlobalAtom::compute_peratom()
if (whichref == ArgInfo::COMPUTE) { if (whichref == ArgInfo::COMPUTE) {
Compute *compute = modify->compute[ref2index]; Compute *compute = modify->compute[ref2index];
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (indexref == 0) { if (indexref == 0) {
@ -360,9 +357,9 @@ void ComputeGlobalAtom::compute_peratom()
if (which[m] == ArgInfo::COMPUTE) { if (which[m] == ArgInfo::COMPUTE) {
Compute *compute = modify->compute[value2index[m]]; Compute *compute = modify->compute[value2index[m]];
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
source = compute->vector; source = compute->vector;
@ -418,9 +415,9 @@ void ComputeGlobalAtom::compute_peratom()
if (which[m] == ArgInfo::COMPUTE) { if (which[m] == ArgInfo::COMPUTE) {
Compute *compute = modify->compute[value2index[m]]; Compute *compute = modify->compute[value2index[m]];
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
double **compute_array = compute->array; double **compute_array = compute->array;

View File

@ -27,7 +27,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -108,17 +107,17 @@ void ComputeHeatFlux::compute_vector()
// invoke 3 computes if they haven't been already // invoke 3 computes if they haven't been already
if (!(c_ke->invoked_flag & INVOKED_PERATOM)) { if (!(c_ke->invoked_flag & Compute::INVOKED_PERATOM)) {
c_ke->compute_peratom(); c_ke->compute_peratom();
c_ke->invoked_flag |= INVOKED_PERATOM; c_ke->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (!(c_pe->invoked_flag & INVOKED_PERATOM)) { if (!(c_pe->invoked_flag & Compute::INVOKED_PERATOM)) {
c_pe->compute_peratom(); c_pe->compute_peratom();
c_pe->invoked_flag |= INVOKED_PERATOM; c_pe->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (!(c_stress->invoked_flag & INVOKED_PERATOM)) { if (!(c_stress->invoked_flag & Compute::INVOKED_PERATOM)) {
c_stress->compute_peratom(); c_stress->compute_peratom();
c_stress->invoked_flag |= INVOKED_PERATOM; c_stress->invoked_flag |= Compute::INVOKED_PERATOM;
} }
// heat flux vector = jc[3] + jv[3] // heat flux vector = jc[3] + jv[3]

View File

@ -27,11 +27,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define INVOKED_LOCAL 16
#define BIG 1.0e20 #define BIG 1.0e20
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -495,9 +490,9 @@ double ComputeReduce::compute_one(int m, int flag)
Compute *compute = modify->compute[vidx]; Compute *compute = modify->compute[vidx];
if (flavor[m] == PERATOM) { if (flavor[m] == PERATOM) {
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (aidx == 0) { if (aidx == 0) {
@ -518,9 +513,9 @@ double ComputeReduce::compute_one(int m, int flag)
} }
} else if (flavor[m] == LOCAL) { } else if (flavor[m] == LOCAL) {
if (!(compute->invoked_flag & INVOKED_LOCAL)) { if (!(compute->invoked_flag & Compute::INVOKED_LOCAL)) {
compute->compute_local(); compute->compute_local();
compute->invoked_flag |= INVOKED_LOCAL; compute->invoked_flag |= Compute::INVOKED_LOCAL;
} }
if (aidx == 0) { if (aidx == 0) {

View File

@ -31,7 +31,6 @@ using namespace LAMMPS_NS;
enum{SUM,MINN,MAXX}; enum{SUM,MINN,MAXX};
#define INVOKED_PERATOM 8
#define BIG 1.0e20 #define BIG 1.0e20
@ -353,9 +352,9 @@ void ComputeReduceChunk::compute_one(int m, double *vchunk, int nstride)
if (which[m] == ArgInfo::COMPUTE) { if (which[m] == ArgInfo::COMPUTE) {
Compute *compute = modify->compute[vidx]; Compute *compute = modify->compute[vidx];
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (argindex[m] == 0) { if (argindex[m] == 0) {

View File

@ -28,11 +28,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define INVOKED_LOCAL 16
#define BIG 1.0e20 #define BIG 1.0e20
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -107,9 +102,9 @@ double ComputeReduceRegion::compute_one(int m, int flag)
Compute *compute = modify->compute[n]; Compute *compute = modify->compute[n];
if (flavor[m] == PERATOM) { if (flavor[m] == PERATOM) {
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (j == 0) { if (j == 0) {
@ -132,9 +127,9 @@ double ComputeReduceRegion::compute_one(int m, int flag)
} }
} else if (flavor[m] == LOCAL) { } else if (flavor[m] == LOCAL) {
if (!(compute->invoked_flag & INVOKED_LOCAL)) { if (!(compute->invoked_flag & Compute::INVOKED_LOCAL)) {
compute->compute_local(); compute->compute_local();
compute->invoked_flag |= INVOKED_LOCAL; compute->invoked_flag |= Compute::INVOKED_LOCAL;
} }
if (j == 0) { if (j == 0) {

View File

@ -24,9 +24,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) : ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) :
@ -272,9 +269,9 @@ void ComputeSlice::extract_one(int m, double *vec, int stride)
Compute *compute = modify->compute[value2index[m]]; Compute *compute = modify->compute[value2index[m]];
if (argindex[m] == 0) { if (argindex[m] == 0) {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
double *cvector = compute->vector; double *cvector = compute->vector;
j = 0; j = 0;
@ -284,9 +281,9 @@ void ComputeSlice::extract_one(int m, double *vec, int stride)
} }
} else { } else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
double **carray = compute->array; double **carray = compute->array;
int icol = argindex[m]-1; int icol = argindex[m]-1;

View File

@ -46,7 +46,6 @@ enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS,
COMPUTE,FIX,VARIABLE,INAME,DNAME}; COMPUTE,FIX,VARIABLE,INAME,DNAME};
enum{LT,LE,GT,GE,EQ,NEQ,XOR}; enum{LT,LE,GT,GE,EQ,NEQ,XOR};
#define INVOKED_PERATOM 8
#define ONEFIELD 32 #define ONEFIELD 32
#define DELTA 1048576 #define DELTA 1048576
@ -585,9 +584,9 @@ int DumpCustom::count()
error->all(FLERR,"Compute used in dump between runs is not current"); error->all(FLERR,"Compute used in dump between runs is not current");
} else { } else {
for (i = 0; i < ncompute; i++) { for (i = 0; i < ncompute; i++) {
if (!(compute[i]->invoked_flag & INVOKED_PERATOM)) { if (!(compute[i]->invoked_flag & Compute::INVOKED_PERATOM)) {
compute[i]->compute_peratom(); compute[i]->compute_peratom();
compute[i]->invoked_flag |= INVOKED_PERATOM; compute[i]->invoked_flag |= Compute::INVOKED_PERATOM;
} }
} }
} }

View File

@ -28,7 +28,6 @@ using namespace LAMMPS_NS;
enum{INT,DOUBLE}; enum{INT,DOUBLE};
#define INVOKED_LOCAL 16
#define ONEFIELD 32 #define ONEFIELD 32
#define DELTA 1048576 #define DELTA 1048576
@ -298,9 +297,9 @@ int DumpLocal::count()
error->all(FLERR,"Compute used in dump between runs is not current"); error->all(FLERR,"Compute used in dump between runs is not current");
} else { } else {
for (i = 0; i < ncompute; i++) { for (i = 0; i < ncompute; i++) {
if (!(compute[i]->invoked_flag & INVOKED_LOCAL)) { if (!(compute[i]->invoked_flag & Compute::INVOKED_LOCAL)) {
compute[i]->compute_local(); compute[i]->compute_local();
compute[i]->invoked_flag |= INVOKED_LOCAL; compute[i]->invoked_flag |= Compute::INVOKED_LOCAL;
} }
} }
} }

View File

@ -28,8 +28,6 @@
using namespace LAMMPS_NS; using namespace LAMMPS_NS;
using namespace FixConst; using namespace FixConst;
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
@ -326,9 +324,9 @@ void FixAveAtom::end_of_step()
} else if (which[m] == ArgInfo::COMPUTE) { } else if (which[m] == ArgInfo::COMPUTE) {
Compute *compute = modify->compute[n]; Compute *compute = modify->compute[n];
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (j == 0) { if (j == 0) {

View File

@ -39,7 +39,6 @@ enum{SAMPLE,ALL};
enum{NOSCALE,ATOM}; enum{NOSCALE,ATOM};
enum{ONE,RUNNING,WINDOW}; enum{ONE,RUNNING,WINDOW};
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -738,9 +737,9 @@ void FixAveChunk::end_of_step()
} else if (which[m] == COMPUTE) { } else if (which[m] == COMPUTE) {
Compute *compute = modify->compute[n]; Compute *compute = modify->compute[n];
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
double *vector = compute->vector_atom; double *vector = compute->vector_atom;
double **array = compute->array_atom; double **array = compute->array_atom;

View File

@ -37,9 +37,6 @@ enum{COMPUTE,FIX,VARIABLE};
enum{ONE,RUNNING}; enum{ONE,RUNNING};
enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -442,15 +439,15 @@ void FixAveCorrelate::end_of_step()
Compute *compute = modify->compute[m]; Compute *compute = modify->compute[m];
if (argindex[i] == 0) { if (argindex[i] == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
scalar = compute->scalar; scalar = compute->scalar;
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
scalar = compute->vector[argindex[i]-1]; scalar = compute->vector[argindex[i]-1];
} }

View File

@ -34,11 +34,6 @@ enum{SCALAR,VECTOR,WINDOW};
enum{DEFAULT,GLOBAL,PERATOM,LOCAL}; enum{DEFAULT,GLOBAL,PERATOM,LOCAL};
enum{IGNORE,END,EXTRA}; enum{IGNORE,END,EXTRA};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define INVOKED_LOCAL 16
#define BIG 1.0e20 #define BIG 1.0e20
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -638,29 +633,29 @@ void FixAveHisto::end_of_step()
if (kind == GLOBAL && mode == SCALAR) { if (kind == GLOBAL && mode == SCALAR) {
if (j == 0) { if (j == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
bin_one(compute->scalar); bin_one(compute->scalar);
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
bin_one(compute->vector[j-1]); bin_one(compute->vector[j-1]);
} }
} else if (kind == GLOBAL && mode == VECTOR) { } else if (kind == GLOBAL && mode == VECTOR) {
if (j == 0) { if (j == 0) {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
bin_vector(compute->size_vector,compute->vector,1); bin_vector(compute->size_vector,compute->vector,1);
} else { } else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
if (compute->array) if (compute->array)
bin_vector(compute->size_array_rows,&compute->array[0][j-1], bin_vector(compute->size_array_rows,&compute->array[0][j-1],
@ -668,9 +663,9 @@ void FixAveHisto::end_of_step()
} }
} else if (kind == PERATOM) { } else if (kind == PERATOM) {
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (j == 0) if (j == 0)
bin_atoms(compute->vector_atom,1); bin_atoms(compute->vector_atom,1);
@ -678,9 +673,9 @@ void FixAveHisto::end_of_step()
bin_atoms(&compute->array_atom[0][j-1],compute->size_peratom_cols); bin_atoms(&compute->array_atom[0][j-1],compute->size_peratom_cols);
} else if (kind == LOCAL) { } else if (kind == LOCAL) {
if (!(compute->invoked_flag & INVOKED_LOCAL)) { if (!(compute->invoked_flag & Compute::INVOKED_LOCAL)) {
compute->compute_local(); compute->compute_local();
compute->invoked_flag |= INVOKED_LOCAL; compute->invoked_flag |= Compute::INVOKED_LOCAL;
} }
if (j == 0) if (j == 0)
bin_vector(compute->size_local_rows,compute->vector_local,1); bin_vector(compute->size_local_rows,compute->vector_local,1);

View File

@ -37,11 +37,6 @@ enum{DEFAULT,GLOBAL,PERATOM,LOCAL};
enum{IGNORE,END,EXTRA}; enum{IGNORE,END,EXTRA};
enum{SINGLE,VALUE}; enum{SINGLE,VALUE};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define INVOKED_LOCAL 16
#define BIG 1.0e20 #define BIG 1.0e20
@ -155,38 +150,38 @@ void FixAveHistoWeight::end_of_step()
if (kind == GLOBAL && mode == SCALAR) { if (kind == GLOBAL && mode == SCALAR) {
if (j == 0) { if (j == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
weight = compute->scalar; weight = compute->scalar;
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
weight = compute->vector[j-1]; weight = compute->vector[j-1];
} }
} else if (kind == GLOBAL && mode == VECTOR) { } else if (kind == GLOBAL && mode == VECTOR) {
if (j == 0) { if (j == 0) {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
weights = compute->vector; weights = compute->vector;
stride = 1; stride = 1;
} else { } else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
if (compute->array) weights = &compute->array[0][j-1]; if (compute->array) weights = &compute->array[0][j-1];
stride = compute->size_array_cols; stride = compute->size_array_cols;
} }
} else if (kind == PERATOM) { } else if (kind == PERATOM) {
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (j == 0) { if (j == 0) {
weights = compute->vector_atom; weights = compute->vector_atom;
@ -196,9 +191,9 @@ void FixAveHistoWeight::end_of_step()
stride = compute->size_peratom_cols; stride = compute->size_peratom_cols;
} }
} else if (kind == LOCAL) { } else if (kind == LOCAL) {
if (!(compute->invoked_flag & INVOKED_LOCAL)) { if (!(compute->invoked_flag & Compute::INVOKED_LOCAL)) {
compute->compute_local(); compute->compute_local();
compute->invoked_flag |= INVOKED_LOCAL; compute->invoked_flag |= Compute::INVOKED_LOCAL;
} }
if (j == 0) { if (j == 0) {
weights = compute->vector_local; weights = compute->vector_local;
@ -283,30 +278,30 @@ void FixAveHistoWeight::end_of_step()
Compute *compute = modify->compute[m]; Compute *compute = modify->compute[m];
if (kind == GLOBAL && mode == SCALAR) { if (kind == GLOBAL && mode == SCALAR) {
if (j == 0) { if (j == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
bin_one_weights(compute->scalar,weight); bin_one_weights(compute->scalar,weight);
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
bin_one_weights(compute->vector[j-1],weight); bin_one_weights(compute->vector[j-1],weight);
} }
} else if (kind == GLOBAL && mode == VECTOR) { } else if (kind == GLOBAL && mode == VECTOR) {
if (j == 0) { if (j == 0) {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
bin_vector_weights(compute->size_vector,compute->vector,1, bin_vector_weights(compute->size_vector,compute->vector,1,
weights,stride); weights,stride);
} else { } else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
if (compute->array) if (compute->array)
bin_vector_weights(compute->size_array_rows,&compute->array[0][j-1], bin_vector_weights(compute->size_array_rows,&compute->array[0][j-1],
@ -314,9 +309,9 @@ void FixAveHistoWeight::end_of_step()
} }
} else if (kind == PERATOM) { } else if (kind == PERATOM) {
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (j == 0) if (j == 0)
bin_atoms_weights(compute->vector_atom,1,weights, stride); bin_atoms_weights(compute->vector_atom,1,weights, stride);
@ -325,9 +320,9 @@ void FixAveHistoWeight::end_of_step()
compute->size_peratom_cols,weights,stride); compute->size_peratom_cols,weights,stride);
} else if (kind == LOCAL) { } else if (kind == LOCAL) {
if (!(compute->invoked_flag & INVOKED_LOCAL)) { if (!(compute->invoked_flag & Compute::INVOKED_LOCAL)) {
compute->compute_local(); compute->compute_local();
compute->invoked_flag |= INVOKED_LOCAL; compute->invoked_flag |= Compute::INVOKED_LOCAL;
} }
if (j == 0) if (j == 0)
bin_vector_weights(compute->size_local_rows, bin_vector_weights(compute->size_local_rows,

View File

@ -35,9 +35,6 @@ enum{COMPUTE,FIX,VARIABLE};
enum{ONE,RUNNING,WINDOW}; enum{ONE,RUNNING,WINDOW};
enum{SCALAR,VECTOR}; enum{SCALAR,VECTOR};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -587,15 +584,15 @@ void FixAveTime::invoke_scalar(bigint ntimestep)
Compute *compute = modify->compute[m]; Compute *compute = modify->compute[m];
if (argindex[i] == 0) { if (argindex[i] == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
scalar = compute->scalar; scalar = compute->scalar;
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
if (varlen[i] && compute->size_vector < argindex[i]) scalar = 0.0; if (varlen[i] && compute->size_vector < argindex[i]) scalar = 0.0;
else scalar = compute->vector[argindex[i]-1]; else scalar = compute->vector[argindex[i]-1];
@ -771,18 +768,18 @@ void FixAveTime::invoke_vector(bigint ntimestep)
Compute *compute = modify->compute[m]; Compute *compute = modify->compute[m];
if (argindex[j] == 0) { if (argindex[j] == 0) {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
double *cvector = compute->vector; double *cvector = compute->vector;
for (i = 0; i < nrows; i++) for (i = 0; i < nrows; i++)
column[i] = cvector[i]; column[i] = cvector[i];
} else { } else {
if (!(compute->invoked_flag & INVOKED_ARRAY)) { if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
double **carray = compute->array; double **carray = compute->array;
int icol = argindex[j]-1; int icol = argindex[j]-1;

View File

@ -27,8 +27,6 @@ using namespace FixConst;
enum{COMPUTE,FIX,VARIABLE}; enum{COMPUTE,FIX,VARIABLE};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -200,15 +198,15 @@ void FixController::end_of_step()
if (pvwhich == COMPUTE) { if (pvwhich == COMPUTE) {
if (pvindex == 0) { if (pvindex == 0) {
if (!(pcompute->invoked_flag & INVOKED_SCALAR)) { if (!(pcompute->invoked_flag & Compute::INVOKED_SCALAR)) {
pcompute->compute_scalar(); pcompute->compute_scalar();
pcompute->invoked_flag |= INVOKED_SCALAR; pcompute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
current = pcompute->scalar; current = pcompute->scalar;
} else { } else {
if (!(pcompute->invoked_flag & INVOKED_VECTOR)) { if (!(pcompute->invoked_flag & Compute::INVOKED_VECTOR)) {
pcompute->compute_vector(); pcompute->compute_vector();
pcompute->invoked_flag |= INVOKED_VECTOR; pcompute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
current = pcompute->vector[pvindex-1]; current = pcompute->vector[pvindex-1];
} }

View File

@ -32,7 +32,6 @@ using namespace FixConst;
enum{KEYWORD,COMPUTE,FIX,VARIABLE,DNAME,INAME}; enum{KEYWORD,COMPUTE,FIX,VARIABLE,DNAME,INAME};
#define INVOKED_PERATOM 8
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -495,9 +494,9 @@ void FixStoreState::end_of_step()
if (which[m] == COMPUTE) { if (which[m] == COMPUTE) {
Compute *compute = modify->compute[n]; Compute *compute = modify->compute[n];
if (!(compute->invoked_flag & INVOKED_PERATOM)) { if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (j == 0) { if (j == 0) {

View File

@ -30,9 +30,6 @@ enum{COMPUTE,FIX,VARIABLE};
enum{ONE,RUNNING,WINDOW}; enum{ONE,RUNNING,WINDOW};
enum{SCALAR,VECTOR}; enum{SCALAR,VECTOR};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -272,15 +269,15 @@ void FixVector::end_of_step()
Compute *compute = modify->compute[m]; Compute *compute = modify->compute[m];
if (argindex[i] == 0) { if (argindex[i] == 0) {
if (!(compute->invoked_flag & INVOKED_SCALAR)) { if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
result[i] = compute->scalar; result[i] = compute->scalar;
} else { } else {
if (!(compute->invoked_flag & INVOKED_VECTOR)) { if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
result[i] = compute->vector[argindex[i]-1]; result[i] = compute->vector[argindex[i]-1];
} }

View File

@ -1345,7 +1345,7 @@ int Modify::find_compute(const std::string &id)
void Modify::clearstep_compute() void Modify::clearstep_compute()
{ {
for (int icompute = 0; icompute < ncompute; icompute++) for (int icompute = 0; icompute < ncompute; icompute++)
compute[icompute]->invoked_flag = 0; compute[icompute]->invoked_flag = Compute::INVOKED_NONE;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -73,9 +73,6 @@ enum{ONELINE,MULTILINE};
enum{INT,FLOAT,BIGINT}; enum{INT,FLOAT,BIGINT};
enum{SCALAR,VECTOR,ARRAY}; enum{SCALAR,VECTOR,ARRAY};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define DELTA 8 #define DELTA 8
@ -339,19 +336,19 @@ void Thermo::compute(int flag)
for (i = 0; i < ncompute; i++) for (i = 0; i < ncompute; i++)
if (compute_which[i] == SCALAR) { if (compute_which[i] == SCALAR) {
if (!(computes[i]->invoked_flag & INVOKED_SCALAR)) { if (!(computes[i]->invoked_flag & Compute::INVOKED_SCALAR)) {
computes[i]->compute_scalar(); computes[i]->compute_scalar();
computes[i]->invoked_flag |= INVOKED_SCALAR; computes[i]->invoked_flag |= Compute::INVOKED_SCALAR;
} }
} else if (compute_which[i] == VECTOR) { } else if (compute_which[i] == VECTOR) {
if (!(computes[i]->invoked_flag & INVOKED_VECTOR)) { if (!(computes[i]->invoked_flag & Compute::INVOKED_VECTOR)) {
computes[i]->compute_vector(); computes[i]->compute_vector();
computes[i]->invoked_flag |= INVOKED_VECTOR; computes[i]->invoked_flag |= Compute::INVOKED_VECTOR;
} }
} else if (compute_which[i] == ARRAY) { } else if (compute_which[i] == ARRAY) {
if (!(computes[i]->invoked_flag & INVOKED_ARRAY)) { if (!(computes[i]->invoked_flag & Compute::INVOKED_ARRAY)) {
computes[i]->compute_array(); computes[i]->compute_array();
computes[i]->invoked_flag |= INVOKED_ARRAY; computes[i]->invoked_flag |= Compute::INVOKED_ARRAY;
} }
} }
@ -381,6 +378,7 @@ void Thermo::compute(int flag)
if (me == 0) { if (me == 0) {
utils::logmesg(lmp,line); utils::logmesg(lmp,line);
if (screen && flushflag) fflush(screen);
if (logfile && flushflag) fflush(logfile); if (logfile && flushflag) fflush(logfile);
} }
@ -1161,9 +1159,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (temperature->invoked_scalar != update->ntimestep) if (temperature->invoked_scalar != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) { } else if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) {
temperature->compute_scalar(); temperature->compute_scalar();
temperature->invoked_flag |= INVOKED_SCALAR; temperature->invoked_flag |= Compute::INVOKED_SCALAR;
} }
compute_temp(); compute_temp();
@ -1175,9 +1173,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_scalar != update->ntimestep) if (pressure->invoked_scalar != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_SCALAR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) {
pressure->compute_scalar(); pressure->compute_scalar();
pressure->invoked_flag |= INVOKED_SCALAR; pressure->invoked_flag |= Compute::INVOKED_SCALAR;
} }
compute_press(); compute_press();
@ -1191,7 +1189,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
"is not current"); "is not current");
} else { } else {
pe->compute_scalar(); pe->compute_scalar();
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
} }
compute_pe(); compute_pe();
@ -1203,9 +1201,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (temperature->invoked_scalar != update->ntimestep) if (temperature->invoked_scalar != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) { } else if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) {
temperature->compute_scalar(); temperature->compute_scalar();
temperature->invoked_flag |= INVOKED_SCALAR; temperature->invoked_flag |= Compute::INVOKED_SCALAR;
} }
compute_ke(); compute_ke();
@ -1219,7 +1217,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
"is not current"); "is not current");
} else { } else {
pe->compute_scalar(); pe->compute_scalar();
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
} }
if (!temperature) if (!temperature)
error->all(FLERR,"Thermo keyword in variable requires " error->all(FLERR,"Thermo keyword in variable requires "
@ -1228,9 +1226,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (temperature->invoked_scalar != update->ntimestep) if (temperature->invoked_scalar != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) { } else if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) {
temperature->compute_scalar(); temperature->compute_scalar();
temperature->invoked_flag |= INVOKED_SCALAR; temperature->invoked_flag |= Compute::INVOKED_SCALAR;
} }
compute_etotal(); compute_etotal();
@ -1244,7 +1242,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
"is not current"); "is not current");
} else { } else {
pe->compute_scalar(); pe->compute_scalar();
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
} }
if (!temperature) if (!temperature)
error->all(FLERR,"Thermo keyword in variable requires " error->all(FLERR,"Thermo keyword in variable requires "
@ -1253,9 +1251,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (temperature->invoked_scalar != update->ntimestep) if (temperature->invoked_scalar != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(temperature->invoked_flag & INVOKED_SCALAR)) { } else if (!(temperature->invoked_flag & Compute::INVOKED_SCALAR)) {
temperature->compute_scalar(); temperature->compute_scalar();
temperature->invoked_flag |= INVOKED_SCALAR; temperature->invoked_flag |= Compute::INVOKED_SCALAR;
} }
if (!pressure) if (!pressure)
error->all(FLERR,"Thermo keyword in variable requires " error->all(FLERR,"Thermo keyword in variable requires "
@ -1264,9 +1262,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_scalar != update->ntimestep) if (pressure->invoked_scalar != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_SCALAR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_SCALAR)) {
pressure->compute_scalar(); pressure->compute_scalar();
pressure->invoked_flag |= INVOKED_SCALAR; pressure->invoked_flag |= Compute::INVOKED_SCALAR;
} }
compute_enthalpy(); compute_enthalpy();
@ -1276,7 +1274,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_evdwl(); compute_evdwl();
} else if (strcmp(word,"ecoul") == 0) { } else if (strcmp(word,"ecoul") == 0) {
@ -1285,7 +1283,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_ecoul(); compute_ecoul();
} else if (strcmp(word,"epair") == 0) { } else if (strcmp(word,"epair") == 0) {
@ -1294,7 +1292,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_epair(); compute_epair();
} else if (strcmp(word,"ebond") == 0) { } else if (strcmp(word,"ebond") == 0) {
@ -1303,7 +1301,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_ebond(); compute_ebond();
} else if (strcmp(word,"eangle") == 0) { } else if (strcmp(word,"eangle") == 0) {
@ -1312,7 +1310,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_eangle(); compute_eangle();
} else if (strcmp(word,"edihed") == 0) { } else if (strcmp(word,"edihed") == 0) {
@ -1321,7 +1319,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_edihed(); compute_edihed();
} else if (strcmp(word,"eimp") == 0) { } else if (strcmp(word,"eimp") == 0) {
@ -1330,7 +1328,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_eimp(); compute_eimp();
} else if (strcmp(word,"emol") == 0) { } else if (strcmp(word,"emol") == 0) {
@ -1339,7 +1337,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_emol(); compute_emol();
} else if (strcmp(word,"elong") == 0) { } else if (strcmp(word,"elong") == 0) {
@ -1348,7 +1346,7 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (!pe) if (!pe)
error->all(FLERR, error->all(FLERR,
"Thermo keyword in variable requires thermo to use/init pe"); "Thermo keyword in variable requires thermo to use/init pe");
pe->invoked_flag |= INVOKED_SCALAR; pe->invoked_flag |= Compute::INVOKED_SCALAR;
compute_elong(); compute_elong();
} else if (strcmp(word,"etail") == 0) { } else if (strcmp(word,"etail") == 0) {
@ -1385,9 +1383,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_vector != update->ntimestep) if (pressure->invoked_vector != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) {
pressure->compute_vector(); pressure->compute_vector();
pressure->invoked_flag |= INVOKED_VECTOR; pressure->invoked_flag |= Compute::INVOKED_VECTOR;
} }
compute_pxx(); compute_pxx();
@ -1399,9 +1397,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_vector != update->ntimestep) if (pressure->invoked_vector != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) {
pressure->compute_vector(); pressure->compute_vector();
pressure->invoked_flag |= INVOKED_VECTOR; pressure->invoked_flag |= Compute::INVOKED_VECTOR;
} }
compute_pyy(); compute_pyy();
@ -1413,9 +1411,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_vector != update->ntimestep) if (pressure->invoked_vector != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) {
pressure->compute_vector(); pressure->compute_vector();
pressure->invoked_flag |= INVOKED_VECTOR; pressure->invoked_flag |= Compute::INVOKED_VECTOR;
} }
compute_pzz(); compute_pzz();
@ -1427,9 +1425,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_vector != update->ntimestep) if (pressure->invoked_vector != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) {
pressure->compute_vector(); pressure->compute_vector();
pressure->invoked_flag |= INVOKED_VECTOR; pressure->invoked_flag |= Compute::INVOKED_VECTOR;
} }
compute_pxy(); compute_pxy();
@ -1441,9 +1439,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_vector != update->ntimestep) if (pressure->invoked_vector != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) {
pressure->compute_vector(); pressure->compute_vector();
pressure->invoked_flag |= INVOKED_VECTOR; pressure->invoked_flag |= Compute::INVOKED_VECTOR;
} }
compute_pxz(); compute_pxz();
@ -1455,9 +1453,9 @@ int Thermo::evaluate_keyword(const char *word, double *answer)
if (pressure->invoked_vector != update->ntimestep) if (pressure->invoked_vector != update->ntimestep)
error->all(FLERR,"Compute used in variable thermo keyword between runs " error->all(FLERR,"Compute used in variable thermo keyword between runs "
"is not current"); "is not current");
} else if (!(pressure->invoked_flag & INVOKED_VECTOR)) { } else if (!(pressure->invoked_flag & Compute::INVOKED_VECTOR)) {
pressure->compute_vector(); pressure->compute_vector();
pressure->invoked_flag |= INVOKED_VECTOR; pressure->invoked_flag |= Compute::INVOKED_VECTOR;
} }
compute_pyz(); compute_pyz();
} }

View File

@ -588,6 +588,9 @@ std::string utils::utf8_subst(const std::string &line)
// UTF-8 2-byte character // UTF-8 2-byte character
if ((in[i] & 0xe0U) == 0xc0U) { if ((in[i] & 0xe0U) == 0xc0U) {
if ((i+1) < len) { if ((i+1) < len) {
// NON-BREAKING SPACE (U+00A0)
if ((in[i] == 0xc2U) && (in[i+1] == 0xa0U))
out += ' ', ++i;
// MODIFIER LETTER PLUS SIGN (U+02D6) // MODIFIER LETTER PLUS SIGN (U+02D6)
if ((in[i] == 0xcbU) && (in[i+1] == 0x96U)) if ((in[i] == 0xcbU) && (in[i+1] == 0x96U))
out += '+', ++i; out += '+', ++i;
@ -598,6 +601,48 @@ std::string utils::utf8_subst(const std::string &line)
// UTF-8 3-byte character // UTF-8 3-byte character
} else if ((in[i] & 0xf0U) == 0xe0U) { } else if ((in[i] & 0xf0U) == 0xe0U) {
if ((i+2) < len) { if ((i+2) < len) {
// EN QUAD (U+2000)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x80U))
out += ' ', i += 2;
// EM QUAD (U+2001)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x81U))
out += ' ', i += 2;
// EN SPACE (U+2002)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x82U))
out += ' ', i += 2;
// EM SPACE (U+2003)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x83U))
out += ' ', i += 2;
// THREE-PER-EM SPACE (U+2004)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x84U))
out += ' ', i += 2;
// FOUR-PER-EM SPACE (U+2005)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x85U))
out += ' ', i += 2;
// SIX-PER-EM SPACE (U+2006)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x86U))
out += ' ', i += 2;
// FIGURE SPACE (U+2007)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x87U))
out += ' ', i += 2;
// PUNCTUATION SPACE (U+2008)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x88U))
out += ' ', i += 2;
// THIN SPACE (U+2009)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x89U))
out += ' ', i += 2;
// HAIR SPACE (U+200A)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x8aU))
out += ' ', i += 2;
// ZERO WIDTH SPACE (U+200B)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0x8bU))
out += ' ', i += 2;
// NARROW NO-BREAK SPACE (U+202F)
if ((in[i] == 0xe2U) && (in[i+1] == 0x80U) && (in[i+2] == 0xafU))
out += ' ', i += 2;
// WORD JOINER (U+2060)
if ((in[i] == 0xe2U) && (in[i+1] == 0x81U) && (in[i+2] == 0xa0U))
out += ' ', i += 2;
// INVISIBLE SEPARATOR (U+2063) // INVISIBLE SEPARATOR (U+2063)
if ((in[i] == 0xe2U) && (in[i+1] == 0x81U) && (in[i+2] == 0xa3U)) if ((in[i] == 0xe2U) && (in[i+1] == 0x81U) && (in[i+2] == 0xa3U))
out += ' ', i += 2; out += ' ', i += 2;
@ -607,6 +652,9 @@ std::string utils::utf8_subst(const std::string &line)
// MINUS SIGN (U+2212) // MINUS SIGN (U+2212)
if ((in[i] == 0xe2U) && (in[i+1] == 0x88U) && (in[i+2] == 0x92U)) if ((in[i] == 0xe2U) && (in[i+1] == 0x88U) && (in[i+2] == 0x92U))
out += '-', i += 2; out += '-', i += 2;
// ZERO WIDTH NO-BREAK SPACE (U+FEFF)
if ((in[i] == 0xefU) && (in[i+1] == 0xbbU) && (in[i+2] == 0xbfU))
out += ' ', i += 2;
} }
// UTF-8 4-byte character // UTF-8 4-byte character
} else if ((in[i] & 0xe8U) == 0xf0U) { } else if ((in[i] & 0xe8U) == 0xf0U) {

View File

@ -72,10 +72,6 @@ enum{DONE,ADD,SUBTRACT,MULTIPLY,DIVIDE,CARAT,MODULO,UNARY,
enum{SUM,XMIN,XMAX,AVE,TRAP,SLOPE}; enum{SUM,XMIN,XMAX,AVE,TRAP,SLOPE};
#define INVOKED_SCALAR 1
#define INVOKED_VECTOR 2
#define INVOKED_ARRAY 4
#define INVOKED_PERATOM 8
#define BIG 1.0e20 #define BIG 1.0e20
@ -1380,9 +1376,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_scalar != update->ntimestep) if (compute->invoked_scalar != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between " print_var_error(FLERR,"Compute used in variable between "
"runs is not current",ivar); "runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_SCALAR)) { } else if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) {
compute->compute_scalar(); compute->compute_scalar();
compute->invoked_flag |= INVOKED_SCALAR; compute->invoked_flag |= Compute::INVOKED_SCALAR;
} }
value1 = compute->scalar; value1 = compute->scalar;
@ -1407,9 +1403,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_vector != update->ntimestep) if (compute->invoked_vector != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between runs " print_var_error(FLERR,"Compute used in variable between runs "
"is not current",ivar); "is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_VECTOR)) { } else if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
if (compute->size_vector_variable && if (compute->size_vector_variable &&
@ -1439,9 +1435,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_array != update->ntimestep) if (compute->invoked_array != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between runs " print_var_error(FLERR,"Compute used in variable between runs "
"is not current",ivar); "is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_ARRAY)) { } else if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
if (compute->size_array_rows_variable && if (compute->size_array_rows_variable &&
@ -1473,9 +1469,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_vector != update->ntimestep) if (compute->invoked_vector != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between " print_var_error(FLERR,"Compute used in variable between "
"runs is not current",ivar); "runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_VECTOR)) { } else if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
Tree *newtree = new Tree(); Tree *newtree = new Tree();
@ -1505,9 +1501,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_array != update->ntimestep) if (compute->invoked_array != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between " print_var_error(FLERR,"Compute used in variable between "
"runs is not current",ivar); "runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_ARRAY)) { } else if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
Tree *newtree = new Tree(); Tree *newtree = new Tree();
@ -1529,9 +1525,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_peratom != update->ntimestep) if (compute->invoked_peratom != update->ntimestep)
print_var_error(FLERR,"Compute used in variable " print_var_error(FLERR,"Compute used in variable "
"between runs is not current",ivar); "between runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) { } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
peratom2global(1,nullptr,compute->vector_atom,1,index1, peratom2global(1,nullptr,compute->vector_atom,1,index1,
@ -1549,9 +1545,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_peratom != update->ntimestep) if (compute->invoked_peratom != update->ntimestep)
print_var_error(FLERR,"Compute used in variable " print_var_error(FLERR,"Compute used in variable "
"between runs is not current",ivar); "between runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) { } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
if (compute->array_atom) if (compute->array_atom)
@ -1578,9 +1574,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_peratom != update->ntimestep) if (compute->invoked_peratom != update->ntimestep)
print_var_error(FLERR,"Compute used in variable " print_var_error(FLERR,"Compute used in variable "
"between runs is not current",ivar); "between runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) { } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
Tree *newtree = new Tree(); Tree *newtree = new Tree();
@ -1610,9 +1606,9 @@ double Variable::evaluate(char *str, Tree **tree, int ivar)
if (compute->invoked_peratom != update->ntimestep) if (compute->invoked_peratom != update->ntimestep)
print_var_error(FLERR,"Compute used in variable " print_var_error(FLERR,"Compute used in variable "
"between runs is not current",ivar); "between runs is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_PERATOM)) { } else if (!(compute->invoked_flag & Compute::INVOKED_PERATOM)) {
compute->compute_peratom(); compute->compute_peratom();
compute->invoked_flag |= INVOKED_PERATOM; compute->invoked_flag |= Compute::INVOKED_PERATOM;
} }
Tree *newtree = new Tree(); Tree *newtree = new Tree();
@ -4137,9 +4133,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
if (compute->invoked_vector != update->ntimestep) if (compute->invoked_vector != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between runs " print_var_error(FLERR,"Compute used in variable between runs "
"is not current",ivar); "is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_VECTOR)) { } else if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) {
compute->compute_vector(); compute->compute_vector();
compute->invoked_flag |= INVOKED_VECTOR; compute->invoked_flag |= Compute::INVOKED_VECTOR;
} }
nvec = compute->size_vector; nvec = compute->size_vector;
nstride = 1; nstride = 1;
@ -4151,9 +4147,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree,
if (compute->invoked_array != update->ntimestep) if (compute->invoked_array != update->ntimestep)
print_var_error(FLERR,"Compute used in variable between runs " print_var_error(FLERR,"Compute used in variable between runs "
"is not current",ivar); "is not current",ivar);
} else if (!(compute->invoked_flag & INVOKED_ARRAY)) { } else if (!(compute->invoked_flag & Compute::INVOKED_ARRAY)) {
compute->compute_array(); compute->compute_array();
compute->invoked_flag |= INVOKED_ARRAY; compute->invoked_flag |= Compute::INVOKED_ARRAY;
} }
nvec = compute->size_array_rows; nvec = compute->size_array_rows;
nstride = compute->size_array_cols; nstride = compute->size_array_cols;

View File

@ -1,7 +1,7 @@
--- ---
lammps_version: 24 Aug 2020 lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:35 202 date_generated: Tue Sep 15 09:44:35 202
epsilon: 2.5e-13 epsilon: 4e-13
prerequisites: ! | prerequisites: ! |
atom full atom full
angle quartic angle quartic

View File

@ -1,7 +1,7 @@
--- ---
lammps_version: 24 Aug 2020 lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:25 202 date_generated: Tue Sep 15 09:44:25 202
epsilon: 1e-10 epsilon: 2e-10
prerequisites: ! | prerequisites: ! |
pair reax/c pair reax/c
fix qeq/reax fix qeq/reax

View File

@ -1,7 +1,7 @@
--- ---
lammps_version: 24 Aug 2020 lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:40 202 date_generated: Tue Sep 15 09:44:40 202
epsilon: 4e-14 epsilon: 5e-14
prerequisites: ! | prerequisites: ! |
atom full atom full
fix momentum fix momentum

View File

@ -1,7 +1,7 @@
--- ---
lammps_version: 24 Aug 2020 lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:43 202 date_generated: Tue Sep 15 09:44:43 202
epsilon: 2e-14 epsilon: 3e-14
prerequisites: ! | prerequisites: ! |
atom full atom full
fix temp/csvr fix temp/csvr

View File

@ -1,7 +1,7 @@
--- ---
lammps_version: 24 Aug 2020 lammps_version: 24 Aug 2020
date_generated: Tue Sep 15 09:44:20 202 date_generated: Tue Sep 15 09:44:20 202
epsilon: 1e-13 epsilon: 2.5e-13
prerequisites: ! | prerequisites: ! |
atom full atom full
pair tip4p/long pair tip4p/long

View File

@ -4,6 +4,7 @@ from lammps import lammps
has_mpi=False has_mpi=False
has_mpi4py=False has_mpi4py=False
has_exceptions=False
try: try:
from mpi4py import __version__ as mpi4py_version from mpi4py import __version__ as mpi4py_version
# tested to work with mpi4py versions 2 and 3 # tested to work with mpi4py versions 2 and 3