diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index cf10e8b544..38431e3bb5 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -1078,12 +1078,15 @@ if(BUILD_TOOLS)
message(STATUS "<<< Building Tools >>>")
endif()
if(BUILD_LAMMPS_GUI)
- message(STATUS "<<< Building LAMMPS GUI >>>")
+ message(STATUS "<<< Building LAMMPS-GUI >>>")
if(LAMMPS_GUI_USE_PLUGIN)
message(STATUS "Loading LAMMPS library as plugin at run time")
else()
message(STATUS "Linking LAMMPS library at compile time")
endif()
+ if(BUILD_WHAM)
+ message(STATUS "<<< Building WHAM >>>")
+ endif()
endif()
if(ENABLE_TESTING)
message(STATUS "<<< Building Unit Tests >>>")
diff --git a/cmake/Modules/Packages/VTK.cmake b/cmake/Modules/Packages/VTK.cmake
index a0de1e0ff4..48b1cdba11 100644
--- a/cmake/Modules/Packages/VTK.cmake
+++ b/cmake/Modules/Packages/VTK.cmake
@@ -1,3 +1,5 @@
+# FindVTK requires that C support is enabled when looking for MPI support
+enable_language(C)
find_package(VTK REQUIRED NO_MODULE)
target_compile_definitions(lammps PRIVATE -DLAMMPS_VTK)
if (VTK_MAJOR_VERSION VERSION_LESS 9.0)
diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst
index e82832cf57..7014762cdc 100644
--- a/doc/src/Build_basics.rst
+++ b/doc/src/Build_basics.rst
@@ -160,7 +160,7 @@ with the OpenMP 3.1 semantics used in LAMMPS for maximal compatibility
with compiler versions in use. If compilation with OpenMP enabled fails
because of your compiler requiring strict OpenMP 4.0 semantics, you can
change the behavior by adding ``-D LAMMPS_OMP_COMPAT=4`` to the
-``LMP_INC`` variable in your makefile, or add it to the command line
+``LMP_INC`` variable in your makefile, or add it to the command-line flags
while configuring with CMake. LAMMPS will auto-detect a suitable setting
for most GNU, Clang, and Intel compilers.
@@ -502,6 +502,8 @@ using CMake or Make.
# chain.x, micelle2d.x, msi2lmp, phana,
# stl_bin2txt
-D BUILD_LAMMPS_GUI=value # yes or no (default). Build LAMMPS-GUI
+ -D BUILD_WHAM=value # yes (default). Download and build WHAM;
+ # only available for BUILD_LAMMPS_GUI=yes
The generated binaries will also become part of the LAMMPS installation
(see below).
diff --git a/doc/src/Build_cmake.rst b/doc/src/Build_cmake.rst
index 1b2bef936e..c8c74c5182 100644
--- a/doc/src/Build_cmake.rst
+++ b/doc/src/Build_cmake.rst
@@ -8,7 +8,7 @@ packages. Links to those pages on the :doc:`Build overview `
page.
The following text assumes some familiarity with CMake and focuses on
-using the command line tool ``cmake`` and what settings are supported
+using the command-line tool ``cmake`` and what settings are supported
for building LAMMPS. A more detailed tutorial on how to use CMake
itself, the text mode or graphical user interface, to change the
generated output files for different build tools and development
@@ -42,9 +42,9 @@ that want to modify or extend LAMMPS.
and adapt the LAMMPS default build configuration accordingly.
- CMake can generate files for different build tools and integrated
development environments (IDE).
-- CMake supports customization of settings with a command line, text
+- CMake supports customization of settings with a command-line, text
mode, or graphical user interface. No manual editing of files,
- knowledge of file formats or complex command line syntax is required.
+ knowledge of file formats or complex command-line syntax is required.
- All enabled components are compiled in a single build operation.
- Automated dependency tracking for all files and configuration options.
- Support for true out-of-source compilation. Multiple configurations
@@ -68,7 +68,7 @@ that purpose you can use either the command-line utility ``cmake`` (or
graphical utility ``cmake-gui``, or use them interchangeably. The
second step is then the compilation and linking of all objects,
libraries, and executables using the selected build tool. Here is a
-minimal example using the command line version of CMake to build LAMMPS
+minimal example using the command-line version of CMake to build LAMMPS
with no add-on packages enabled and no customization:
.. code-block:: bash
@@ -131,7 +131,7 @@ file called ``CMakeLists.txt`` (for LAMMPS it is located in the
configuration step. The cache file contains all current CMake settings.
To modify settings, enable or disable features, you need to set
-*variables* with either the ``-D`` command line flag (``-D
+*variables* with either the ``-D`` command-line flag (``-D
VARIABLE1_NAME=value``) or change them in the text mode of the graphical
user interface. The ``-D`` flag can be used several times in one command.
@@ -141,11 +141,11 @@ a different compiler tool chain. Those are loaded with the ``-C`` flag
(``-C ../cmake/presets/basic.cmake``). This step would only be needed
once, as the settings from the preset files are stored in the
``CMakeCache.txt`` file. It is also possible to customize the build
-by adding one or more ``-D`` flags to the CMake command line.
+by adding one or more ``-D`` flags to the CMake command.
Generating files for alternate build tools (e.g. Ninja) and project files
for IDEs like Eclipse, CodeBlocks, or Kate can be selected using the ``-G``
-command line flag. A list of available generator settings for your
+command-line flag. A list of available generator settings for your
specific CMake version is given when running ``cmake --help``.
.. _cmake_multiconfig:
diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst
index 3adec76abb..5c6475c7fa 100644
--- a/doc/src/Build_development.rst
+++ b/doc/src/Build_development.rst
@@ -263,9 +263,9 @@ will be skipped if prerequisite features are not available in LAMMPS.
time. Preference is given to parts of the code base that are easy to
test or commonly used.
-Tests as shown by the ``ctest`` program are command lines defined in the
+Tests as shown by the ``ctest`` program are commands defined in the
``CMakeLists.txt`` files in the ``unittest`` directory tree. A few
-tests simply execute LAMMPS with specific command line flags and check
+tests simply execute LAMMPS with specific command-line flags and check
the output to the screen for expected content. A large number of unit
tests are special tests programs using the `GoogleTest framework
`_ and linked to the LAMMPS
@@ -420,7 +420,7 @@ during MD timestepping and manipulate per-atom properties like
positions, velocities, and forces. For those fix styles, testing can be
done in a very similar fashion as for force fields and thus there is a
test program `test_fix_timestep` that shares a lot of code, properties,
-and command line flags with the force field style testers described in
+and command-line flags with the force field style testers described in
the previous section.
This tester will set up a small molecular system run with verlet run
@@ -642,10 +642,10 @@ The following target are available for both, GNU make and CMake:
.. _gh-cli:
-GitHub command line interface
+GitHub command-line interface
-----------------------------
-GitHub has developed a `command line tool `_
+GitHub has developed a `command-line tool `_
to interact with the GitHub website via a command called ``gh``.
This is extremely convenient when working with a Git repository hosted
on GitHub (like LAMMPS). It is thus highly recommended to install it
diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst
index 0d37b019e7..1f13525f98 100644
--- a/doc/src/Build_extras.rst
+++ b/doc/src/Build_extras.rst
@@ -209,7 +209,7 @@ necessary for ``hipcc`` and the linker to work correctly.
Using the CHIP-SPV implementation of HIP is supported. It allows one to
run HIP code on Intel GPUs via the OpenCL or Level Zero back ends. To use
CHIP-SPV, you must set ``-DHIP_USE_DEVICE_SORT=OFF`` in your CMake
-command line as CHIP-SPV does not yet support hipCUB. As of Summer 2022,
+command-line as CHIP-SPV does not yet support hipCUB. As of Summer 2022,
the use of HIP for Intel GPUs is experimental. You should only use this
option in preparations to run on Aurora system at Argonne.
@@ -232,7 +232,7 @@ option in preparations to run on Aurora system at Argonne.
.. code:: bash
- # CUDA target (not recommended, use GPU_ARCH=cuda)
+ # CUDA target (not recommended, use GPU_API=cuda)
# !!! DO NOT set CMAKE_CXX_COMPILER !!!
export HIP_PLATFORM=nvcc
export HIP_PATH=/path/to/HIP/install
@@ -421,9 +421,10 @@ minutes to hours) to build. Of course you only need to do that once.)
cmake build system. The ``lib/kim/Install.py`` script supports a
``CMAKE`` environment variable if the cmake executable is named other
than ``cmake`` on your system. Additional environment variables may be
- provided on the command line for use by cmake. For example, to use the
- ``cmake3`` executable and tell it to use the gnu version 11 compilers
- to build KIM, one could use the following command line.
+ set with the ``make`` command for use by cmake. For example, to use the
+ ``cmake3`` executable and tell it to use the GNU version 11 compilers
+ called ``g++-11``, ``gcc-11`` and ``gfortran-11`` to build KIM, one
+ could use the following command.
.. code-block:: bash
@@ -2203,7 +2204,7 @@ verified to work in February 2020 with Quantum Espresso versions 6.3 to
from the sources in the *lib* folder (including the essential
libqmmm.a) are not included in the static LAMMPS library and
(currently) not installed, while their code is included in the
- shared LAMMPS library. Thus a typical command line to configure
+ shared LAMMPS library. Thus a typical command to configure
building LAMMPS for QMMM would be:
.. code-block:: bash
diff --git a/doc/src/Build_windows.rst b/doc/src/Build_windows.rst
index d1748825eb..27562db480 100644
--- a/doc/src/Build_windows.rst
+++ b/doc/src/Build_windows.rst
@@ -100,9 +100,9 @@ procedure.
It is possible to use both the integrated CMake support of the Visual
Studio IDE or use an external CMake installation (e.g. downloaded from
-cmake.org) to create build files and compile LAMMPS from the command line.
+cmake.org) to create build files and compile LAMMPS from the command-line.
-Compilation via command line and unit tests are checked automatically
+Compilation via command-line and unit tests are checked automatically
for the LAMMPS development branch through
`GitHub Actions `_.
@@ -115,7 +115,7 @@ for the LAMMPS development branch through
Please note, that for either approach CMake will create a so-called
:ref:`"multi-configuration" build environment `, and
-the command lines for building and testing LAMMPS must be adjusted
+the commands for building and testing LAMMPS must be adjusted
accordingly.
The LAMMPS cmake folder contains a ``CMakeSettings.json`` file with
diff --git a/doc/src/Classes_lammps.rst b/doc/src/Classes_lammps.rst
index dd6798d9a1..167a619fae 100644
--- a/doc/src/Classes_lammps.rst
+++ b/doc/src/Classes_lammps.rst
@@ -4,7 +4,7 @@ LAMMPS Class
The LAMMPS class is encapsulating an MD simulation state and thus it is
the class that needs to be created when starting a new simulation system
state. The LAMMPS executable essentially creates one instance of this
-class and passes the command line flags and tells it to process the
+class and passes the command-line flags and tells it to process the
provided input (a file or ``stdin``). It shuts the class down when
control is returned to it and then exits. When using LAMMPS as a
library from another code it is required to create an instance of this
diff --git a/doc/src/Commands_input.rst b/doc/src/Commands_input.rst
index dc0fb72dd9..0f6e8f94a2 100644
--- a/doc/src/Commands_input.rst
+++ b/doc/src/Commands_input.rst
@@ -69,7 +69,7 @@ WARNING message is printed. The :doc:`Errors ` page gives
more information on what errors mean. The documentation for each
command lists restrictions on how the command can be used.
-You can use the :ref:`-skiprun ` command line flag
+You can use the :ref:`-skiprun ` command-line flag
to have LAMMPS skip the execution of any ``run``, ``minimize``, or similar
commands to check the entire input for correct syntax to avoid crashes
on typos or syntax errors in long runs.
diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst
index ea8b3d4b03..777be3bf16 100644
--- a/doc/src/Commands_removed.rst
+++ b/doc/src/Commands_removed.rst
@@ -18,7 +18,7 @@ LAMMPS executable directly instead of having a separate tool. A
combination of the commands :doc:`read_restart ` and
:doc:`write_data ` can be used to the same effect. For
added convenience this conversion can also be triggered by
-:doc:`command line flags `
+:doc:`command-line flags `
Fix ave/spatial and fix ave/spatial/sphere
------------------------------------------
diff --git a/doc/src/Developer_org.rst b/doc/src/Developer_org.rst
index f1804655ae..93632ae03f 100644
--- a/doc/src/Developer_org.rst
+++ b/doc/src/Developer_org.rst
@@ -94,12 +94,12 @@ represents what is generally referred to as an "instance of LAMMPS". It
is a composite holding pointers to instances of other core classes
providing the core functionality of the MD engine in LAMMPS and through
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
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
associated memory. Thus code for the standalone LAMMPS executable in
``main.cpp`` simply initializes MPI, instantiates a single instance of
-LAMMPS while passing 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
and shuts down the MPI environment before it exits the executable.
diff --git a/doc/src/Developer_unittest.rst b/doc/src/Developer_unittest.rst
index 07ffb0e2d8..86526b19de 100644
--- a/doc/src/Developer_unittest.rst
+++ b/doc/src/Developer_unittest.rst
@@ -476,7 +476,7 @@ the tabulated coulomb, to test both code paths. The reference results in the YA
files then should be compared manually, if they agree well enough within the limits
of those two approximations.
-The ``test_pair_style`` and equivalent programs have special command line options
+The ``test_pair_style`` and equivalent programs have special command-line options
to update the YAML files. Running a command like
.. code-block:: bash
@@ -609,7 +609,7 @@ and run the test with verbose output. For example,
env TEST_ARGS=-v ctest -R ^MolPairStyle:lj_cut_coul_long -V
-``ctest`` with the ``-V`` flag also shows the exact command line
+``ctest`` with the ``-V`` flag also shows the exact command
of the test. One can then use ``gdb --args`` to further debug and
catch exceptions with the test command, for example,
diff --git a/doc/src/Developer_write_pair.rst b/doc/src/Developer_write_pair.rst
index 5d5e081042..90b716d9c4 100644
--- a/doc/src/Developer_write_pair.rst
+++ b/doc/src/Developer_write_pair.rst
@@ -310,7 +310,7 @@ the constructor and the destructor.
Pair styles are different from most classes in LAMMPS that define a
"style", as their constructor only uses the LAMMPS class instance
-pointer as an argument, but **not** the command line arguments of the
+pointer as an argument, but **not** the arguments of the
:doc:`pair_style command `. Instead, those arguments are
processed in the ``Pair::settings()`` function (or rather the version in
the derived class). The constructor is the place where global defaults
@@ -891,7 +891,7 @@ originally created from mixing or not).
These data file output functions are only useful for true pair-wise
additive potentials, where the potential parameters can be entered
through *multiple* :doc:`pair_coeff commands `. Pair styles
-that require a single "pair_coeff \* \*" command line are not compatible
+that require a single "pair_coeff \* \*" command are not compatible
with reading their parameters from data files. For pair styles like
*born/gauss* that do support writing to data files, the potential
parameters will be read from the data file, if present, and
@@ -1122,7 +1122,7 @@ once. Thus, the ``coeff()`` function has to do three tasks, each of
which is delegated to a function in the ``PairTersoff`` class:
#. map elements to atom types. Those follow the potential file name in the
- command line arguments and are processed by the ``map_element2type()`` function.
+ command arguments and are processed by the ``map_element2type()`` function.
#. read and parse the potential parameter file in the ``read_file()`` function.
#. Build data structures where the original and derived parameters are
indexed by all possible triples of atom types and thus can be looked
@@ -1356,8 +1356,8 @@ either 0 or 1.
The ``morseflag`` variable defaults to 0 and is set to 1 in the
``PairAIREBOMorse::settings()`` function which is called by the
-:doc:`pair_style ` command. This function delegates
-all command line processing and setting of other parameters to the
+:doc:`pair_style ` command. This function delegates all
+command argument processing and setting of other parameters to the
``PairAIREBO::settings()`` function of the base class.
.. code-block:: c++
diff --git a/doc/src/Errors_debug.rst b/doc/src/Errors_debug.rst
index b3f618dbf7..cc28273aa3 100644
--- a/doc/src/Errors_debug.rst
+++ b/doc/src/Errors_debug.rst
@@ -83,7 +83,7 @@ Run LAMMPS from within the debugger
Running LAMMPS under the control of the debugger as shown below only
works for a single MPI rank (for debugging a program running in parallel
you usually need a parallel debugger program). A simple way to launch
-GDB is to prefix the LAMMPS command line with ``gdb --args`` and then
+GDB is to prefix the LAMMPS command-line with ``gdb --args`` and then
type the command "run" at the GDB prompt. This will launch the
debugger, load the LAMMPS executable and its debug info, and then run
it. When it reaches the code causing the segmentation fault, it will
@@ -180,7 +180,7 @@ inspect the behavior of a compiled program by essentially emulating a
CPU and instrumenting the program while running. This slows down
execution quite significantly, but can also report issues that are not
resulting in a crash. The default valgrind tool is a memory checker and
-you can use it by prefixing the normal command line with ``valgrind``.
+you can use it by prefixing the normal command-line with ``valgrind``.
Unlike GDB, this will also work for parallel execution, but it is
recommended to redirect the valgrind output to a file (e.g. with
``--log-file=crash-%p.txt``, the %p will be substituted with the
diff --git a/doc/src/Errors_messages.rst b/doc/src/Errors_messages.rst
index 2468b3c628..bfc395067a 100644
--- a/doc/src/Errors_messages.rst
+++ b/doc/src/Errors_messages.rst
@@ -7774,7 +7774,7 @@ Doc page with :doc:`WARNING messages `
*Too few values in body section of molecule file*
Self-explanatory.
-*Too many -pk arguments in command line*
+*Too many -pk arguments in command-line*
The string formed by concatenating the arguments is too long. Use a
package command in the input script instead.
diff --git a/doc/src/Fortran.rst b/doc/src/Fortran.rst
index a1ea9a72df..d50c7bdcf3 100644
--- a/doc/src/Fortran.rst
+++ b/doc/src/Fortran.rst
@@ -16,7 +16,7 @@ compiled alongside the code using it from the source code in
``fortran/lammps.f90`` *and* with the same compiler used to build the
rest of the Fortran code that interfaces to LAMMPS. When linking, you
also need to :doc:`link to the LAMMPS library `. A typical
-command line for a simple program using the Fortran interface would be:
+command for a simple program using the Fortran interface would be:
.. code-block:: bash
@@ -91,12 +91,12 @@ function and triggered with the optional logical argument set to
CALL lmp%close(.TRUE.)
END PROGRAM testlib
-It is also possible to pass command line flags from Fortran to C/C++ and
+It is also possible to pass command-line flags from Fortran to C/C++ and
thus make the resulting executable behave similarly to the standalone
executable (it will ignore the `-in/-i` flag, though). This allows
-using the command line to configure accelerator and suffix settings,
+using the command-line to configure accelerator and suffix settings,
configure screen and logfile output, or to set index style variables
-from the command line and more. Here is a correspondingly adapted
+from the command-line and more. Here is a correspondingly adapted
version of the previous example:
.. code-block:: fortran
@@ -108,7 +108,7 @@ version of the previous example:
CHARACTER(LEN=128), ALLOCATABLE :: command_args(:)
INTEGER :: i, argc
- ! copy command line flags to `command_args()`
+ ! copy command-line flags to `command_args()`
argc = COMMAND_ARGUMENT_COUNT()
ALLOCATE(command_args(0:argc))
DO i=0, argc
@@ -448,7 +448,7 @@ of the contents of the :f:mod:`LIBLAMMPS` Fortran interface to LAMMPS.
compiled with MPI support, it will also initialize MPI, if it has
not already been initialized before.
- The *args* argument with the list of command line parameters is
+ The *args* argument with the list of command-line parameters is
optional and so it the *comm* argument with the MPI communicator.
If *comm* is not provided, ``MPI_COMM_WORLD`` is assumed. For
more details please see the documentation of :cpp:func:`lammps_open`.
diff --git a/doc/src/Howto_cmake.rst b/doc/src/Howto_cmake.rst
index 43aa519293..6b8fc82bad 100644
--- a/doc/src/Howto_cmake.rst
+++ b/doc/src/Howto_cmake.rst
@@ -56,7 +56,7 @@ using a shell like Bash or Zsh.
Visual Studio IDE with the bundled CMake or from the Windows command prompt using
a separately installed CMake package, both using the native Microsoft Visual C++
compilers and (optionally) the Microsoft MPI SDK. This tutorial, however, only
- covers unix-like command line interfaces.
+ covers unix-like command-line interfaces.
We also assume that you have downloaded and unpacked a recent LAMMPS source code package
or used Git to create a clone of the LAMMPS sources on your compilation machine.
@@ -277,7 +277,7 @@ Setting options
---------------
Options that enable, disable or modify settings are modified by setting
-the value of CMake variables. This is done on the command line with the
+the value of CMake variables. This is done on the command-line with the
*-D* flag in the format ``-D VARIABLE=value``, e.g. ``-D
CMAKE_BUILD_TYPE=Release`` or ``-D BUILD_MPI=on``. There is one quirk:
when used before the CMake directory, there may be a space between the
@@ -376,7 +376,7 @@ Using presets
-------------
Since LAMMPS has a lot of optional features and packages, specifying
-them all on the command line can be tedious. Or when selecting a
+them all on the command-line can be tedious. Or when selecting a
different compiler toolchain, multiple options have to be changed
consistently and that is rather error prone. Or when enabling certain
packages, they require consistent settings to be operated in a
@@ -384,7 +384,7 @@ particular mode. For this purpose, we are providing a selection of
"preset files" for CMake in the folder ``cmake/presets``. They
represent a way to pre-load or override the CMake configuration cache by
setting or changing CMake variables. Preset files are loaded using the
-*-C* command line flag. You can combine loading multiple preset files or
+*-C* command-line flag. You can combine loading multiple preset files or
change some variables later with additional *-D* flags. A few examples:
.. code-block:: bash
diff --git a/doc/src/Howto_github.rst b/doc/src/Howto_github.rst
index b81716c09d..78a05f113c 100644
--- a/doc/src/Howto_github.rst
+++ b/doc/src/Howto_github.rst
@@ -163,7 +163,7 @@ After everything is done, add the files to the branch and commit them:
*git rm*, *git mv* for adding, removing, renaming individual files,
respectively, and then *git commit* to finalize the commit.
Carefully check all pending changes with *git status* before
- committing them. If you find doing this on the command line too
+ committing them. If you find doing this on the command-line too
tedious, consider using a GUI, for example the one included in git
distributions written in Tk, i.e. use *git gui* (on some Linux
distributions it may be required to install an additional package to
diff --git a/doc/src/Howto_lammps_gui.rst b/doc/src/Howto_lammps_gui.rst
index 21e6a31ccc..08be9fb00c 100644
--- a/doc/src/Howto_lammps_gui.rst
+++ b/doc/src/Howto_lammps_gui.rst
@@ -20,8 +20,11 @@ to the online LAMMPS documentation for known LAMMPS commands and styles.
(Ubuntu 20.04LTS or later and compatible), macOS (version 11 aka Big
Sur or later), and Windows (version 10 or later) :ref:`are available
` for download. Non-MPI LAMMPS executables (as
- ``lmp``) for running LAMMPS from the command line and :doc:`some
+ ``lmp``) for running LAMMPS from the command-line and :doc:`some
LAMMPS tools ` compiled executables are also included.
+ Also, the pre-compiled LAMMPS-GUI packages include the WHAM executables
+ from http://membrane.urmc.rochester.edu/content/wham/ for use with
+ LAMMPS tutorials.
The source code for LAMMPS-GUI is included in the LAMMPS source code
distribution and can be found in the ``tools/lammps-gui`` folder. It
@@ -29,16 +32,16 @@ to the online LAMMPS documentation for known LAMMPS commands and styles.
`.
LAMMPS-GUI tries to provide an experience similar to what people
-traditionally would have running LAMMPS using a command line window and
+traditionally would have running LAMMPS using a command-line window and
the console LAMMPS executable but just rolled into a single executable:
- writing & editing LAMMPS input files with a text editor
-- run LAMMPS on those input file with selected command line flags
+- run LAMMPS on those input file with selected command-line flags
- extract data from the created files and visualize it with and
external software
That procedure is quite effective for people proficient in using the
-command line, as that allows them to use tools for the individual steps
+command-line, as that allows them to use tools for the individual steps
that they are most comfortable with. In fact, it is often *required* to
adopt this workflow when running LAMMPS simulations on high-performance
computing facilities.
@@ -100,10 +103,11 @@ MacOS 11 and later
^^^^^^^^^^^^^^^^^^
After downloading the ``LAMMPS-macOS-multiarch-GUI-.dmg``
-installer package, you need to double-click it and then, in the window
-that opens, drag the app bundle as indicated into the "Applications"
-folder. The follow the instructions in the "README.txt" file to
-get access to the other included executables.
+application bundle disk image, you need to double-click it and then, in
+the window that opens, drag the app bundle as indicated into the
+"Applications" folder. Afterwards, the disk image can be unmounted.
+Then follow the instructions in the "README.txt" file to get access to
+the other included command-line executables.
Linux on x86\_64
^^^^^^^^^^^^^^^^
@@ -117,15 +121,25 @@ into the "LAMMPS_GUI" folder and execute "./lammps-gui" directly.
The second variant uses `flatpak `_ and
requires the flatpak management and runtime software to be installed.
-After downloading the ``LAMMPS-GUI-Linux-x86_64-GUI-.tar.gz``
+After downloading the ``LAMMPS-GUI-Linux-x86_64-GUI-.flatpak``
flatpak bundle, you can install it with ``flatpak install --user
-LAMMPS-GUI-Linux-x86_64-GUI-.tar.gz``. After installation,
+LAMMPS-GUI-Linux-x86_64-GUI-.flatpak``. After installation,
LAMMPS-GUI should be integrated into your desktop environment under
"Applications > Science" but also can be launched from the console with
``flatpak run org.lammps.lammps-gui``. The flatpak bundle also includes
the console LAMMPS executable ``lmp`` which can be launched to run
-simulations with, for example: ``flatpak run --command=lmp
-org.lammps.lammps-gui -in in.melt``.
+simulations with, for example with:
+
+.. code-block:: sh
+
+ flatpak run --command=lmp org.lammps.lammps-gui -in in.melt
+
+Other bundled command-line executables are run the same way and can be
+listed with:
+
+.. code-block:: sh
+
+ ls $(flatpak info --show-location org.lammps.lammps-gui )/files/bin
Compiling from Source
@@ -165,9 +179,9 @@ window is stored when exiting and restored when starting again.
Opening Files
^^^^^^^^^^^^^
-The LAMMPS-GUI application can be launched without command line arguments
+The LAMMPS-GUI application can be launched without command-line arguments
and then starts with an empty buffer in the *Editor* window. If arguments
-are given LAMMPS will use first command line argument as the file name for
+are given LAMMPS will use first command-line argument as the file name for
the *Editor* buffer and reads its contents into the buffer, if the file
exists. All further arguments are ignored. Files can also be opened via
the *File* menu, the `Ctrl-O` (`Command-O` on macOS) keyboard shortcut
@@ -261,14 +275,21 @@ Output Window
By default, when starting a run, an *Output* window opens that displays
the screen output of the running LAMMPS calculation, as shown below.
-This text would normally be seen in the command line window.
+This text would normally be seen in the command-line window.
.. image:: JPG/lammps-gui-log.png
:align: center
:scale: 50%
LAMMPS-GUI captures the screen output from LAMMPS as it is generated and
-updates the *Output* window regularly during a run.
+updates the *Output* window regularly during a run. If there are any
+warnings or errors in the LAMMPS output, they are highlighted by using
+bold text colored in red. There is a small panel at the bottom center
+of the *Output* window showing how many warnings and errors were
+detected and how many lines the entire output has. By clicking on the
+button on the right with the warning symbol or by using the keyboard
+shortcut `Ctrl-N` (`Command-N` on macOS), you can jump to the next
+line with a warning or error.
By default, the *Output* window is replaced each time a run is started.
The runs are counted and the run number for the current run is displayed
@@ -398,7 +419,7 @@ below.
Like for the *Output* and *Charts* windows, its content is continuously
updated during a run. It will show "(none)" if there are no variables
defined. Note that it is also possible to *set* :doc:`index style
-variables `, that would normally be set via command line
+variables `, that would normally be set via command-line
flags, via the "Set Variables..." dialog from the *Run* menu.
LAMMPS-GUI automatically defines the variable "gui_run" to the current
value of the run counter. That way it is possible to automatically
@@ -775,11 +796,11 @@ General Settings:
- *Echo input to log:* when checked, all input commands, including
variable expansions, are echoed to the *Output* window. This is
- equivalent to using `-echo screen` at the command line. There is no
+ equivalent to using `-echo screen` at the command-line. There is no
log *file* produced by default, since LAMMPS-GUI uses `-log none`.
- *Include citation details:* when checked full citation info will be
included to the log window. This is equivalent to using `-cite
- screen` on the command line.
+ screen` on the command-line.
- *Show log window by default:* when checked, the screen output of a
LAMMPS run will be collected in a log window during the run
- *Show chart window by default:* when checked, the thermodynamic
@@ -828,7 +849,7 @@ Accelerators:
This tab enables selection of an accelerator package for LAMMPS to use
and is equivalent to using the `-suffix` and `-package` flags on the
-command line. Only settings supported by the LAMMPS library and local
+command-line. Only settings supported by the LAMMPS library and local
hardware are available. The `Number of threads` field allows setting
the maximum number of threads for the accelerator packages that use
threads.
diff --git a/doc/src/Howto_peri.rst b/doc/src/Howto_peri.rst
index 8a2aa4cab6..29eb685c81 100644
--- a/doc/src/Howto_peri.rst
+++ b/doc/src/Howto_peri.rst
@@ -738,8 +738,8 @@ command.
This can be done, for example, by using the built-in visualizer of the
:doc:`dump image or dump movie ` command to create snapshot
-images or a movie. Below are example command lines for using dump image
-with the :ref:`example listed below ` and a set of images
+images or a movie. Below are example command for using dump image with
+the :ref:`example listed below ` and a set of images
created for steps 300, 600, and 2000 this way.
.. code-block:: LAMMPS
diff --git a/doc/src/Howto_wsl.rst b/doc/src/Howto_wsl.rst
index fbb75d9cfd..30e4835e4c 100644
--- a/doc/src/Howto_wsl.rst
+++ b/doc/src/Howto_wsl.rst
@@ -260,7 +260,7 @@ Switch into the :code:`examples/melt` folder:
cd ../examples/melt
-To run this example in serial, use the following command line:
+To run this example in serial, use the following command:
.. code-block::
diff --git a/doc/src/Install_git.rst b/doc/src/Install_git.rst
index 35b6429f0c..5108009a73 100644
--- a/doc/src/Install_git.rst
+++ b/doc/src/Install_git.rst
@@ -60,7 +60,7 @@ between them at any time using "git checkout ".)
files (mostly by accident). If you do not need access to the entire
commit history (most people don't), you can speed up the "cloning"
process and reduce local disk space requirements by using the
- ``--depth`` git command line flag. That will create a "shallow clone"
+ ``--depth`` git command-line flag. That will create a "shallow clone"
of the repository, which contains only a subset of the git history.
Using a depth of 1000 is usually sufficient to include the head
commits of the *develop*, the *release*, and the *maintenance*
diff --git a/doc/src/JPG/lammps-gui-log.png b/doc/src/JPG/lammps-gui-log.png
index 894af371f0..61ab2e0601 100644
Binary files a/doc/src/JPG/lammps-gui-log.png and b/doc/src/JPG/lammps-gui-log.png differ
diff --git a/doc/src/Modify_style.rst b/doc/src/Modify_style.rst
index 496415237c..69b7cc9350 100644
--- a/doc/src/Modify_style.rst
+++ b/doc/src/Modify_style.rst
@@ -46,7 +46,7 @@ Include files (varied)
but instead should be initialized either in the initializer list of
the constructor or explicitly assigned in the body of the constructor.
If the member variable is relevant to the functionality of a class
- (for example when it stores a value from a command line argument), the
+ (for example when it stores a value from a command-line argument), the
member variable declaration is followed by a brief comment explaining
its purpose and what its values can be. Class members that are
pointers should always be initialized to ``nullptr`` in the
diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst
index 9afd0d1b98..894c299299 100644
--- a/doc/src/Packages_details.rst
+++ b/doc/src/Packages_details.rst
@@ -2171,8 +2171,8 @@ the :doc:`Build extras ` page.
* ``src/OPENMP/README``
* :doc:`Accelerator packages `
* :doc:`OPENMP package `
-* :doc:`Command line option -suffix/-sf omp `
-* :doc:`Command line option -package/-pk omp `
+* :doc:`Command-line option -suffix/-sf omp `
+* :doc:`Command-line option -package/-pk omp `
* :doc:`package omp `
* Search the :doc:`commands ` pages (:doc:`fix `, :doc:`compute `,
:doc:`pair `, :doc:`bond, angle, dihedral, improper `,
diff --git a/doc/src/Run_basics.rst b/doc/src/Run_basics.rst
index 22cec5858b..f18eaff75a 100644
--- a/doc/src/Run_basics.rst
+++ b/doc/src/Run_basics.rst
@@ -1,8 +1,8 @@
Basics of running LAMMPS
========================
-LAMMPS is run from the command line, reading commands from a file via
-the ``-in`` command line flag, or from standard input. Using the ``-in
+LAMMPS is run from the command-line, reading commands from a file via
+the ``-in`` command-line flag, or from standard input. Using the ``-in
in.file`` variant is recommended (see note below). The name of the
LAMMPS executable is either ``lmp`` or ``lmp_`` with
`` being the machine string used when compiling LAMMPS. This
@@ -25,7 +25,7 @@ build LAMMPS:
You normally run the LAMMPS command in the directory where your input
script is located. That is also where output files are produced by
default, unless you provide specific other paths in your input script or
-on the command line. As in some of the examples above, the LAMMPS
+on the command-line. As in some of the examples above, the LAMMPS
executable itself can be placed elsewhere.
.. note::
diff --git a/doc/src/Run_options.rst b/doc/src/Run_options.rst
index 4f7021cd53..546658a644 100644
--- a/doc/src/Run_options.rst
+++ b/doc/src/Run_options.rst
@@ -632,7 +632,7 @@ the ``-package omp`` command-line switch or the :doc:`package omp ` com
The :doc:`suffix ` command can also be used within an input
script to set a suffix, or to turn off or back on any suffix setting
-made via the command line.
+made via the command-line.
----------
diff --git a/doc/src/Run_windows.rst b/doc/src/Run_windows.rst
index 8c2eac2bc6..a03f27c013 100644
--- a/doc/src/Run_windows.rst
+++ b/doc/src/Run_windows.rst
@@ -20,7 +20,7 @@ To run with 4 threads, you can type this:
lmp -in in.lj.lmp -k on t 4 -sf kk
Alternately, you can also install a package with LAMMPS-GUI included and
-open the LAMMPS-GUI app (the package includes the command line version
+open the LAMMPS-GUI app (the package includes the command-line version
of LAMMPS as well) and open the input file in the GUI and run it from
there. For details on LAMMPS-GUI, see :doc:`Howto_lammps_gui`.
diff --git a/doc/src/Speed_gpu.rst b/doc/src/Speed_gpu.rst
index 42bd8bf059..c90e3fcc5e 100644
--- a/doc/src/Speed_gpu.rst
+++ b/doc/src/Speed_gpu.rst
@@ -31,7 +31,8 @@ Coulombics. It has the following general features:
(for Nvidia GPUs, AMD GPUs, Intel GPUs, and multicore CPUs).
so that the same functionality is supported on a variety of hardware.
-**Required hardware/software:**
+Required hardware/software
+""""""""""""""""""""""""""
To compile and use this package in CUDA mode, you currently need
to have an NVIDIA GPU and install the corresponding NVIDIA CUDA
@@ -69,12 +70,14 @@ To compile and use this package in HIP mode, you have to have the AMD ROCm
software installed. Versions of ROCm older than 3.5 are currently deprecated
by AMD.
-**Building LAMMPS with the GPU package:**
+Building LAMMPS with the GPU package
+""""""""""""""""""""""""""""""""""""
See the :ref:`Build extras ` page for
instructions.
-**Run with the GPU package from the command line:**
+Run with the GPU package from the command-line
+""""""""""""""""""""""""""""""""""""""""""""""
The ``mpirun`` or ``mpiexec`` command sets the total number of MPI tasks
used by LAMMPS (one or multiple per compute node) and the number of MPI
@@ -133,7 +136,8 @@ affect the setting for bonded interactions (LAMMPS default is "on").
The "off" setting for pairwise interaction is currently required for
GPU package pair styles.
-**Or run with the GPU package by editing an input script:**
+Run with the GPU package by editing an input script
+"""""""""""""""""""""""""""""""""""""""""""""""""""
The discussion above for the ``mpirun`` or ``mpiexec`` command, MPI
tasks/node, and use of multiple MPI tasks/GPU is the same.
@@ -149,7 +153,8 @@ You must also use the :doc:`package gpu ` command to enable the
GPU package, unless the ``-sf gpu`` or ``-pk gpu`` :doc:`command-line switches ` were used. It specifies the number of
GPUs/node to use, as well as other options.
-**Speed-ups to expect:**
+Speed-up to expect
+""""""""""""""""""
The performance of a GPU versus a multicore CPU is a function of your
hardware, which pair style is used, the number of atoms/GPU, and the
@@ -176,10 +181,13 @@ better with multiple OMP threads because the inter-process communication
is higher for these styles with the GPU package in order to allow
deterministic results.
-**Guidelines for best performance:**
+Guidelines for best performance
+"""""""""""""""""""""""""""""""
-* Using multiple MPI tasks per GPU will often give the best performance,
- as allowed my most multicore CPU/GPU configurations.
+* Using multiple MPI tasks (2-10) per GPU will often give the best
+ performance, as allowed my most multicore CPU/GPU configurations.
+ Using too many MPI tasks will result in worse performance due to
+ growing overhead with the growing number of MPI tasks.
* If the number of particles per MPI task is small (e.g. 100s of
particles), it can be more efficient to run with fewer MPI tasks per
GPU, even if you do not use all the cores on the compute node.
@@ -199,12 +207,13 @@ deterministic results.
:doc:`angle `, :doc:`dihedral `,
:doc:`improper `, and :doc:`long-range `
calculations will not be included in the "Pair" time.
-* Since only part of the pppm kspace style is GPU accelerated, it
- may be faster to only use GPU acceleration for Pair styles with
- long-range electrostatics. See the "pair/only" keyword of the
- package command for a shortcut to do that. The work between kspace
- on the CPU and non-bonded interactions on the GPU can be balanced
- through adjusting the coulomb cutoff without loss of accuracy.
+* Since only part of the pppm kspace style is GPU accelerated, it may be
+ faster to only use GPU acceleration for Pair styles with long-range
+ electrostatics. See the "pair/only" keyword of the :doc:`package
+ command ` for a shortcut to do that. The distribution of
+ work between kspace on the CPU and non-bonded interactions on the GPU
+ can be balanced through adjusting the coulomb cutoff without loss of
+ accuracy.
* When the *mode* setting for the package gpu command is force/neigh,
the time for neighbor list calculations on the GPU will be added into
the "Pair" time, not the "Neigh" time. An additional breakdown of the
@@ -220,4 +229,6 @@ deterministic results.
Restrictions
""""""""""""
-None.
+When using :doc:`hybrid pair styles `, the neighbor list
+must be generated on the host instead of the GPU and thus the potential
+GPU acceleration is reduced.
diff --git a/doc/src/Speed_intel.rst b/doc/src/Speed_intel.rst
index dd6c27b4e7..78a88f4407 100644
--- a/doc/src/Speed_intel.rst
+++ b/doc/src/Speed_intel.rst
@@ -1,5 +1,5 @@
INTEL package
-==================
+=============
The INTEL package is maintained by Mike Brown at Intel
Corporation. It provides two methods for accelerating simulations,
@@ -13,18 +13,18 @@ twice, once on the CPU and once with an offload flag. This allows
LAMMPS to run on the CPU cores and co-processor cores simultaneously.
Currently Available INTEL Styles
-"""""""""""""""""""""""""""""""""""""
+""""""""""""""""""""""""""""""""
* Angle Styles: charmm, harmonic
-* Bond Styles: fene, fourier, harmonic
+* Bond Styles: fene, harmonic
* Dihedral Styles: charmm, fourier, harmonic, opls
-* Fixes: nve, npt, nvt, nvt/sllod, nve/asphere
+* Fixes: nve, npt, nvt, nvt/sllod, nve/asphere, electrode/conp, electrode/conq, electrode/thermo
* Improper Styles: cvff, harmonic
* Pair Styles: airebo, airebo/morse, buck/coul/cut, buck/coul/long,
buck, dpd, eam, eam/alloy, eam/fs, gayberne, lj/charmm/coul/charmm,
lj/charmm/coul/long, lj/cut, lj/cut/coul/long, lj/long/coul/long,
- rebo, sw, tersoff
-* K-Space Styles: pppm, pppm/disp
+ rebo, snap, sw, tersoff
+* K-Space Styles: pppm, pppm/disp, pppm/electrode
.. warning::
@@ -33,7 +33,7 @@ Currently Available INTEL Styles
input requires it, LAMMPS will abort with an error message.
Speed-up to expect
-"""""""""""""""""""
+""""""""""""""""""
The speedup will depend on your simulation, the hardware, which
styles are used, the number of atoms, and the floating-point
@@ -312,21 +312,21 @@ almost all cases.
recommended, especially when running on a machine with Intel
Hyper-Threading technology disabled.
-Run with the INTEL package from the command line
-"""""""""""""""""""""""""""""""""""""""""""""""""""""
+Run with the INTEL package from the command-line
+""""""""""""""""""""""""""""""""""""""""""""""""
-To enable INTEL optimizations for all available styles used in
-the input script, the ``-sf intel`` :doc:`command-line switch ` can be used without any requirement for
-editing the input script. This switch will automatically append
-"intel" to styles that support it. It also invokes a default command:
-:doc:`package intel 1 `. This package command is used to set
-options for the INTEL package. The default package command will
-specify that INTEL calculations are performed in mixed precision,
-that the number of OpenMP threads is specified by the OMP_NUM_THREADS
-environment variable, and that if co-processors are present and the
-binary was built with offload support, that 1 co-processor per node
-will be used with automatic balancing of work between the CPU and the
-co-processor.
+To enable INTEL optimizations for all available styles used in the input
+script, the ``-sf intel`` :doc:`command-line switch ` can
+be used without any requirement for editing the input script. This
+switch will automatically append "intel" to styles that support it. It
+also invokes a default command: :doc:`package intel 1 `. This
+package command is used to set options for the INTEL package. The
+default package command will specify that INTEL calculations are
+performed in mixed precision, that the number of OpenMP threads is
+specified by the OMP_NUM_THREADS environment variable, and that if
+co-processors are present and the binary was built with offload support,
+that 1 co-processor per node will be used with automatic balancing of
+work between the CPU and the co-processor.
You can specify different options for the INTEL package by using
the ``-pk intel Nphi`` :doc:`command-line switch ` with
diff --git a/doc/src/Speed_kokkos.rst b/doc/src/Speed_kokkos.rst
index 40e748c9fe..9f8dcf8340 100644
--- a/doc/src/Speed_kokkos.rst
+++ b/doc/src/Speed_kokkos.rst
@@ -77,7 +77,7 @@ version 23 November 2023 and Kokkos version 4.2.
rank. When running with multiple MPI ranks, you may see segmentation
faults without GPU-aware MPI support. These can be avoided by adding
the flags :doc:`-pk kokkos gpu/aware off ` to the
- LAMMPS command line or by using the command :doc:`package kokkos
+ LAMMPS command-line or by using the command :doc:`package kokkos
gpu/aware off ` in the input file.
.. admonition:: Intel Data Center GPU support
@@ -423,7 +423,7 @@ in the ``kokkos-cuda.cmake`` CMake preset file.
cmake -DKokkos_ENABLE_CUDA=yes -DKokkos_ENABLE_OPENMP=yes ../cmake
The suffix "/kk" is equivalent to "/kk/device", and for Kokkos CUDA,
-using the ``-sf kk`` in the command line gives the default CUDA version
+using the ``-sf kk`` in the command-line gives the default CUDA version
everywhere. However, if the "/kk/host" suffix is added to a specific
style in the input script, the Kokkos OpenMP (CPU) version of that
specific style will be used instead. Set the number of OpenMP threads
@@ -439,7 +439,7 @@ For example, the command to run with 1 GPU and 8 OpenMP threads is then:
mpiexec -np 1 lmp_kokkos_cuda_openmpi -in in.lj -k on g 1 t 8 -sf kk
-Conversely, if the ``-sf kk/host`` is used in the command line and then
+Conversely, if the ``-sf kk/host`` is used in the command-line and then
the "/kk" or "/kk/device" suffix is added to a specific style in your
input script, then only that specific style will run on the GPU while
everything else will run on the CPU in OpenMP mode. Note that the
@@ -451,7 +451,7 @@ on the host CPU can overlap with a pair style running on the
GPU. First compile with ``--default-stream per-thread`` added to ``CCFLAGS``
in the Kokkos CUDA Makefile. Then explicitly use the "/kk/host"
suffix for kspace and bonds, angles, etc. in the input file and the
-"kk" suffix (equal to "kk/device") on the command line. Also make
+"kk" suffix (equal to "kk/device") on the command-line. Also make
sure the environment variable ``CUDA_LAUNCH_BLOCKING`` is not set to "1"
so CPU/GPU overlap can occur.
diff --git a/doc/src/Speed_omp.rst b/doc/src/Speed_omp.rst
index bf0744f0f4..906acf3ce8 100644
--- a/doc/src/Speed_omp.rst
+++ b/doc/src/Speed_omp.rst
@@ -21,7 +21,7 @@ Building LAMMPS with the OPENMP package
See the :ref:`Build extras ` page for
instructions.
-Run with the OPENMP package from the command line
+Run with the OPENMP package from the command-line
"""""""""""""""""""""""""""""""""""""""""""""""""""
These examples assume one or more 16-core nodes.
diff --git a/doc/src/Speed_opt.rst b/doc/src/Speed_opt.rst
index e115393017..15e18dad8e 100644
--- a/doc/src/Speed_opt.rst
+++ b/doc/src/Speed_opt.rst
@@ -17,7 +17,7 @@ Building LAMMPS with the OPT package
See the :ref:`Build extras ` page for instructions.
-Run with the OPT package from the command line
+Run with the OPT package from the command-line
""""""""""""""""""""""""""""""""""""""""""""""
.. code-block:: bash
diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst
index ba7cb2035a..d13a6d384f 100644
--- a/doc/src/Tools.rst
+++ b/doc/src/Tools.rst
@@ -501,7 +501,7 @@ Here are a few highlights of LAMMPS-GUI
- Indicator for line that caused an error
- Visualization of current state in Image Viewer (via calling :doc:`write_dump image `)
- Capture of images created via :doc:`dump image ` in Slide show window
-- Dialog to set variables, similar to the LAMMPS command line flag '-v' / '-var'
+- Dialog to set variables, similar to the LAMMPS command-line flag '-v' / '-var'
- Support for GPU, INTEL, KOKKOS/OpenMP, OPENMAP, and OPT and accelerator packages
Parallelization
@@ -550,7 +550,7 @@ will be found automatically. 2) you can download the `Flatpak file
*flatpak* command: ``flatpak install --user
LAMMPS-Linux-x86_64-GUI-.flatpak`` and run it with ``flatpak
run org.lammps.lammps-gui``. The flatpak bundle also includes the
-command line version of LAMMPS and some LAMMPS tools like msi2lmp. The
+command-line version of LAMMPS and some LAMMPS tools like msi2lmp. The
can be launched by using the ``--command`` flag. For example to run
LAMMPS directly on the ``in.lj`` benchmark input you would type in the
``bench`` folder: ``flatpak run --command=lmp -in in.lj`` The flatpak
@@ -608,10 +608,10 @@ would be the ``examples/COUPLE/plugin`` folder of the LAMMPS
distribution.
When compiling LAMMPS-GUI with plugin support, there is an additional
-command line flag (``-p `` or ``--pluginpath ``) which
+command-line flag (``-p `` or ``--pluginpath ``) which
allows to override the path to LAMMPS shared library used by the GUI.
This is usually auto-detected on the first run and can be changed in the
-LAMMPS-GUI *Preferences* dialog. The command line flag allows to reset
+LAMMPS-GUI *Preferences* dialog. The command-line flag allows to reset
this path to a valid value in case the original setting has become
invalid. An empty path ("") as argument restores the default setting.
@@ -656,7 +656,7 @@ it will create a compressed ``LAMMPS-Win10-amd64.zip`` zip file with the
executables and required dependent .dll files. This zip file can be
uncompressed and ``lammps-gui.exe`` run directly from there. The
uncompressed folder can be added to the ``PATH`` environment and LAMMPS
-and LAMMPS-GUI can be launched from anywhere from the command line.
+and LAMMPS-GUI can be launched from anywhere from the command-line.
**MinGW64 Cross-compiler**
@@ -876,7 +876,7 @@ the same ``LAMMPS_CACHING_DIR``. This script does the following:
#. Start a simple local HTTP server using Python to host files for CMake
Afterwards, it will print out instruction on how to modify the CMake
-command line to make sure it uses the local HTTP server.
+commands to make sure it uses the local HTTP server.
To undo the environment changes and shutdown the local HTTP server,
run the ``deactivate_caches`` command.
@@ -1025,7 +1025,7 @@ with those in the provided log file with the same number of processors
in the same subdirectory. If the differences between the actual and
reference values are within specified tolerances, the test is considered
passed. For each test batch, that is, a set of example input scripts,
-the mpirun command, the LAMMPS command line arguments, and the
+the mpirun command, the LAMMPS command-line arguments, and the
tolerances for individual thermo quantities can be specified in a
configuration file in YAML format.
diff --git a/doc/src/dump_image.rst b/doc/src/dump_image.rst
index 2336a5889a..8313d3cccb 100644
--- a/doc/src/dump_image.rst
+++ b/doc/src/dump_image.rst
@@ -681,7 +681,7 @@ MPEG or other movie file you can use:
* c) Use FFmpeg
- FFmpeg is a command line tool that is available on many platforms and
+ FFmpeg is a command-line tool that is available on many platforms and
allows extremely flexible encoding and decoding of movies.
.. code-block:: bash
diff --git a/doc/src/fix_imd.rst b/doc/src/fix_imd.rst
index 520af505a1..2974262c81 100644
--- a/doc/src/fix_imd.rst
+++ b/doc/src/fix_imd.rst
@@ -97,7 +97,7 @@ adjustments.
To connect VMD to a listening LAMMPS simulation on the same machine
with fix imd enabled, one needs to start VMD and load a coordinate or
topology file that matches the fix group. When the VMD command
-prompts appears, one types the command line:
+prompts appears, one types the command:
.. parsed-literal::
diff --git a/doc/src/fix_precession_spin.rst b/doc/src/fix_precession_spin.rst
index 7440989d7a..88325ba491 100644
--- a/doc/src/fix_precession_spin.rst
+++ b/doc/src/fix_precession_spin.rst
@@ -135,7 +135,7 @@ directions for the forces. Only the direction of the vector is
important; its length is ignored (the entered vectors are
normalized).
-Those styles can be combined within one single command line.
+Those styles can be combined within one single command.
.. note::
diff --git a/doc/src/kim_commands.rst b/doc/src/kim_commands.rst
index ab9b4486a2..20728dee06 100644
--- a/doc/src/kim_commands.rst
+++ b/doc/src/kim_commands.rst
@@ -1084,10 +1084,11 @@ the form of *key_name_key*-*key_name_value* pairs). For example,
kim property modify 1 key mass source-value 26.98154
kim property modify 1 key mass source-unit amu
-where the special keyword "key" is followed by a *key_name* ("species" or
-"mass" in the above) and one or more key-value pairs. These key-value pairs
-may continue until either another "key" keyword is given or the end of the
-command line is reached. Thus, the above could equivalently be written as
+where the special keyword "key" is followed by a *key_name* ("species"
+or "mass" in the above) and one or more key-value pairs. These
+key-value pairs may continue until either another "key" keyword is given
+or the end of the line is reached. Thus, the above could equivalently
+be written as
.. code-block:: LAMMPS
diff --git a/doc/src/label.rst b/doc/src/label.rst
index bf232431d7..cae1386e90 100644
--- a/doc/src/label.rst
+++ b/doc/src/label.rst
@@ -24,12 +24,12 @@ Description
"""""""""""
Label this line of the input script with the chosen ID. Unless a jump
-command was used previously, this does nothing. But if a
-:doc:`jump ` command was used with a label argument to begin
-invoking this script file, then all command lines in the script prior
-to this line will be ignored. I.e. execution of the script will begin
-at this line. This is useful for looping over a section of the input
-script as discussed in the :doc:`jump ` command.
+command was used previously, this does nothing. But if a :doc:`jump
+` command was used with a label argument to begin invoking this
+script file, then all commands in the script prior to this line will be
+ignored. I.e. execution of the script will begin at this line. This is
+useful for looping over a section of the input script as discussed in
+the :doc:`jump ` command.
Restrictions
""""""""""""
diff --git a/doc/src/package.rst b/doc/src/package.rst
index 8be6639e72..ddb3656027 100644
--- a/doc/src/package.rst
+++ b/doc/src/package.rst
@@ -504,7 +504,7 @@ as it is for non-accelerated pair styles
The *binsize* keyword sets the size of bins used to bin atoms during
neighbor list builds. The same value can be set by the
:doc:`neigh_modify binsize ` command. Making it an option
-in the package kokkos command allows it to be set from the command line.
+in the package kokkos command allows it to be set from the command-line.
The default value for CPUs is 0.0, which means the LAMMPS default will be
used, which is bins = 1/2 the size of the pairwise cutoff + neighbor skin
distance. This is fine when neighbor lists are built on the CPU. For GPU
@@ -664,7 +664,7 @@ too.
Also note that if the :doc:`-sf hybrid intel omp command-line switch ` is used, it invokes a "package intel" command, followed by a
"package omp" command, both with a setting of *Nthreads* = 0. Likewise
for a hybrid suffix for gpu and omp. Note that KOKKOS also supports
- setting the number of OpenMP threads from the command line using the
+ setting the number of OpenMP threads from the command-line using the
"-k on" :doc:`command-line switch `. The default for
KOKKOS is 1 thread per MPI task, so any other number of threads should
be explicitly set using the "-k on" command-line switch (and this
diff --git a/doc/src/pair_mgpt.rst b/doc/src/pair_mgpt.rst
index 6ef9f52fac..92bf9cd738 100644
--- a/doc/src/pair_mgpt.rst
+++ b/doc/src/pair_mgpt.rst
@@ -111,8 +111,8 @@ routines. For x-86 machines, there is a provided Makefile.mgptfast
which enables the fast algebra routines, i.e. build LAMMPS with "make
mgptfast". The user will be informed in the output files of the
matrix kernels in use. To further improve speed, on x86 the option
-precision single can be added to the :doc:`pair_coeff `
-command line, which improves speed (up to a factor of two) at the cost
+*precision single* can be added to the :doc:`pair_coeff `
+command, which improves speed (up to a factor of two) at the cost
of doing matrix calculations with 7 digit precision instead of the
default 16. For consistency the default option can be specified
explicitly by the option precision double.
diff --git a/doc/src/pair_thole.rst b/doc/src/pair_thole.rst
index a4e8bbb96e..5b0d5653ff 100644
--- a/doc/src/pair_thole.rst
+++ b/doc/src/pair_thole.rst
@@ -131,7 +131,7 @@ command.
* LJ cutoff (distance units)
The last two coefficients are optional and default to the global values from
-the *pair_style* command line.
+the *pair_style* command.
----------
diff --git a/doc/src/read_restart.rst b/doc/src/read_restart.rst
index 6a875550a4..eb7f577e4d 100644
--- a/doc/src/read_restart.rst
+++ b/doc/src/read_restart.rst
@@ -48,9 +48,9 @@ meaning that the trajectories of a restarted run will precisely match
those produced by the original run had it continued on.
Some information about a restart file can be gathered directly from the
-command line when using LAMMPS with the :ref:`-restart2info
-` command line flag. On Unix-like operating systems (like
-Linux or macOS), one can also :ref:`configure the "file" command line
+command-line when using LAMMPS with the :ref:`-restart2info
+` command-line flag. On Unix-like operating systems (like
+Linux or macOS), one can also :ref:`configure the "file" command-line
program ` to display basic information about a restart file
The binary restart file format was not designed with backward, forward,
@@ -60,9 +60,9 @@ Changes to the architecture, compilation settings, or LAMMPS version can
render a restart file unreadable or it may read the data incorrectly.
If you want a more portable format, you can use the data file format as
created by the :doc:`write_data ` command. Binary restart
-files can also be converted into a data file from the command line by
+files can also be converted into a data file from the command-line by
the LAMMPS executable that wrote them using the :ref:`-restart2data
-` command line flag.
+` command-line flag.
Several things can prevent exact restarts due to round-off effects, in
which case the trajectories in the 2 runs will slowly diverge. These
diff --git a/doc/src/suffix.rst b/doc/src/suffix.rst
index 6c723657a5..98bb43a02d 100644
--- a/doc/src/suffix.rst
+++ b/doc/src/suffix.rst
@@ -30,7 +30,7 @@ Description
This command allows you to use variants of various styles if they
exist. In that respect it operates the same as the :doc:`-suffix command-line switch `. It also has options to turn
-off or back on any suffix setting made via the command line.
+off or back on any suffix setting made via the command-line.
The specified style can be *gpu*, *intel*, *kk*, *omp*, *opt* or
*hybrid*\ . These refer to optional packages that LAMMPS can be built
diff --git a/src/ASPHERE/fix_nh_asphere.cpp b/src/ASPHERE/fix_nh_asphere.cpp
index 45bf011e04..35d0e404be 100644
--- a/src/ASPHERE/fix_nh_asphere.cpp
+++ b/src/ASPHERE/fix_nh_asphere.cpp
@@ -27,19 +27,14 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNHAsphere::FixNHAsphere(LAMMPS *lmp, int narg, char **arg) :
- FixNH(lmp, narg, arg)
-{
-}
+FixNHAsphere::FixNHAsphere(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg) {}
/* ---------------------------------------------------------------------- */
void FixNHAsphere::init()
{
avec = dynamic_cast(atom->style_match("ellipsoid"));
- if (!avec)
- error->all(FLERR,
- "Compute nvt/nph/npt asphere requires atom style ellipsoid");
+ if (!avec) error->all(FLERR, "Fix {} requires atom style ellipsoid", style);
// check that all particles are finite-size
// no point particles allowed, spherical is OK
@@ -51,7 +46,7 @@ void FixNHAsphere::init()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
if (ellipsoid[i] < 0)
- error->one(FLERR,"Fix nvt/nph/npt asphere requires extended particles");
+ error->one(FLERR,"Fix {} requires all extended particles", style);
FixNH::init();
}
diff --git a/src/ASPHERE/fix_nph_asphere.cpp b/src/ASPHERE/fix_nph_asphere.cpp
index 6c25277d6a..6240e82407 100644
--- a/src/ASPHERE/fix_nph_asphere.cpp
+++ b/src/ASPHERE/fix_nph_asphere.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,14 +21,13 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) :
- FixNHAsphere(lmp, narg, arg)
+FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) : FixNHAsphere(lmp, narg, arg)
{
if (tstat_flag)
- error->all(FLERR,"Temperature control can not be used "
+ error->all(FLERR,
+ "Temperature control can not be used "
"with fix nph/asphere");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix nph/asphere");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/asphere");
// create a new compute temp style
// id = fix-ID + temp
@@ -37,7 +35,7 @@ FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/asphere",id_temp));
+ modify->add_compute(fmt::format("{} all temp/asphere", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -45,6 +43,6 @@ FixNPHAsphere::FixNPHAsphere(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/ASPHERE/fix_npt_asphere.cpp b/src/ASPHERE/fix_npt_asphere.cpp
index 9d240a1b9a..72d8f4bd91 100644
--- a/src/ASPHERE/fix_npt_asphere.cpp
+++ b/src/ASPHERE/fix_npt_asphere.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
- FixNHAsphere(lmp, narg, arg)
+FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) : FixNHAsphere(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/asphere");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/asphere");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/asphere");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/asphere");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/asphere",id_temp));
+ modify->add_compute(fmt::format("{} all temp/asphere", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPTAsphere::FixNPTAsphere(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/ASPHERE/fix_nvt_asphere.cpp b/src/ASPHERE/fix_nvt_asphere.cpp
index 16b7c65b38..26cb75c9c8 100644
--- a/src/ASPHERE/fix_nvt_asphere.cpp
+++ b/src/ASPHERE/fix_nvt_asphere.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,19 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTAsphere::FixNVTAsphere(LAMMPS *lmp, int narg, char **arg) :
- FixNHAsphere(lmp, narg, arg)
+FixNVTAsphere::FixNVTAsphere(LAMMPS *lmp, int narg, char **arg) : FixNHAsphere(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/asphere");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/asphere");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/asphere");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/asphere");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp/asphere",
- id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp/asphere", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/BOCS/fix_bocs.cpp b/src/BOCS/fix_bocs.cpp
index 25471d04a4..0c4d6a41ad 100644
--- a/src/BOCS/fix_bocs.cpp
+++ b/src/BOCS/fix_bocs.cpp
@@ -466,37 +466,33 @@ void FixBocs::init()
// set temperature and pressure ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature compute ID {} for fix bocs does not exist", id_temp);
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
if (pstat_flag) {
pressure = modify->get_compute_by_id(id_press);
if (!pressure)
- error->all(FLERR,"Pressure compute ID {} for fix bocs does not exist", id_press);
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
}
-
- if (pstat_flag)
- {
- if (p_match_flag) // MRD NJD
- {
+ if (pstat_flag) {
+ if (p_match_flag) { // MRD NJD
auto pressure_bocs = dynamic_cast(pressure);
- if (pressure_bocs)
- {
- if (p_basis_type == BASIS_ANALYTIC)
- {
+ if (pressure_bocs) {
+ if (p_basis_type == BASIS_ANALYTIC) {
pressure_bocs->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg);
- }
- else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE)
- {
+ } else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE) {
pressure_bocs->send_cg_info(p_basis_type, splines, spline_length);
}
- }
- else
- {
+ } else {
error->all(FLERR,"Unable to find compatible pressure compute");
}
}
@@ -656,8 +652,7 @@ int FixBocs::read_F_table( char *filename, int p_basis_type )
if (numBadVolumeIntervals > 0 && comm->me == 0) {
error->message(FLERR, "INFO: total number bad volume intervals = {}", numBadVolumeIntervals);
}
- }
- else {
+ } else {
error->all(FLERR,"ERROR: Unable to open file: {}", filename);
}
@@ -955,8 +950,9 @@ void FixBocs::final_integrate()
tdof = temperature->dof;
if (pstat_flag) {
- if (pstyle == ISO) pressure->compute_scalar();
- else {
+ if (pstyle == ISO) {
+ pressure->compute_scalar();
+ } else {
temperature->compute_vector();
pressure->compute_vector();
}
diff --git a/src/BODY/fix_nh_body.cpp b/src/BODY/fix_nh_body.cpp
index 5e56c29312..49c25f63d6 100644
--- a/src/BODY/fix_nh_body.cpp
+++ b/src/BODY/fix_nh_body.cpp
@@ -39,8 +39,7 @@ void FixNHBody::init()
{
avec = dynamic_cast(atom->style_match("body"));
if (!avec)
- error->all(FLERR,
- "Compute nvt/nph/npt body requires atom style body");
+ error->all(FLERR, "Compute nvt/nph/npt body requires atom style body");
// check that all particles are finite-size
// no point particles allowed, spherical is OK
diff --git a/src/BODY/fix_nph_body.cpp b/src/BODY/fix_nph_body.cpp
index 14dea9d36b..93f0f31e8a 100644
--- a/src/BODY/fix_nph_body.cpp
+++ b/src/BODY/fix_nph_body.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -26,13 +25,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) :
- FixNHBody(lmp, narg, arg)
+FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) : FixNHBody(lmp, narg, arg)
{
- if (tstat_flag)
- error->all(FLERR,"Temperature control can not be used with fix nph/body");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix nph/body");
+ if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph/body");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/body");
// create a new compute temp style
// id = fix-ID + temp
@@ -40,7 +36,7 @@ FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/body",id_temp));
+ modify->add_compute(fmt::format("{} all temp/body", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -48,6 +44,6 @@ FixNPHBody::FixNPHBody(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/BODY/fix_npt_body.cpp b/src/BODY/fix_npt_body.cpp
index b6c774223f..ffcf1867f4 100644
--- a/src/BODY/fix_npt_body.cpp
+++ b/src/BODY/fix_npt_body.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -26,13 +25,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) :
- FixNHBody(lmp, narg, arg)
+FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) : FixNHBody(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/body");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/body");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/body");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/body");
// create a new compute temp style
// id = fix-ID + temp
@@ -40,7 +36,7 @@ FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/body",id_temp));
+ modify->add_compute(fmt::format("{} all temp/body", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -48,6 +44,6 @@ FixNPTBody::FixNPTBody(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/BODY/fix_nvt_body.cpp b/src/BODY/fix_nvt_body.cpp
index aec808d1ea..7417ab7a5e 100644
--- a/src/BODY/fix_nvt_body.cpp
+++ b/src/BODY/fix_nvt_body.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -27,19 +26,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTBody::FixNVTBody(LAMMPS *lmp, int narg, char **arg) :
- FixNHBody(lmp, narg, arg)
+FixNVTBody::FixNVTBody(LAMMPS *lmp, int narg, char **arg) : FixNHBody(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/body");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/body");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/body");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/body");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp/body",
- id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp/body", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/COLVARS/fix_colvars.cpp b/src/COLVARS/fix_colvars.cpp
index ecfec3e46c..d5a8806eed 100644
--- a/src/COLVARS/fix_colvars.cpp
+++ b/src/COLVARS/fix_colvars.cpp
@@ -129,7 +129,7 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) :
if (comm->me == 0) {
#ifdef LAMMPS_BIGBIG
- utils::logmesg(lmp, "colvars: Warning: cannot handle atom ids > 2147483647\n");
+ error->warning(FLERR, "colvars: cannot handle atom ids > 2147483647\n");
#endif
proxy = new colvarproxy_lammps(lmp);
proxy->init();
diff --git a/src/DRUDE/fix_langevin_drude.cpp b/src/DRUDE/fix_langevin_drude.cpp
index 1b165c029a..c67c729c7c 100644
--- a/src/DRUDE/fix_langevin_drude.cpp
+++ b/src/DRUDE/fix_langevin_drude.cpp
@@ -108,9 +108,9 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) :
FixLangevinDrude::~FixLangevinDrude()
{
delete random_core;
- delete [] tstr_core;
+ delete[] tstr_core;
delete random_drude;
- delete [] tstr_drude;
+ delete[] tstr_drude;
}
/* ---------------------------------------------------------------------- */
@@ -144,22 +144,22 @@ void FixLangevinDrude::init()
else error->all(FLERR,"Variable for fix langevin/drude is invalid style");
}
- int ifix;
- for (ifix = 0; ifix < modify->nfix; ifix++)
- if (strcmp(modify->fix[ifix]->style,"drude") == 0) break;
- if (ifix == modify->nfix) error->all(FLERR, "fix langevin/drude requires fix drude");
- fix_drude = dynamic_cast(modify->fix[ifix]);
+ auto fdrude = modify->get_fix_by_style("^drude$");
+ if (fdrude.size() < 1) error->all(FLERR, "Fix {} requires fix drude", style);
+ if (fdrude.size() > 1) error->all(FLERR, "There must be only one fix drude");
+ fix_drude = dynamic_cast(fdrude[0]);
+ if (!fix_drude) error->all(FLERR, "Fix {} requires fix drude", style);
+
+ if (!utils::strmatch(update->integrate_style,"^verlet"))
+ error->all(FLERR,"Run style respa is not compatible with fix langevin/drude");
+ if (!comm->ghost_velocity)
+ error->all(FLERR,"fix langevin/drude requires ghost velocities. Use comm_modify vel yes");
}
/* ---------------------------------------------------------------------- */
void FixLangevinDrude::setup(int /*vflag*/)
{
- if (!utils::strmatch(update->integrate_style,"^verlet"))
- error->all(FLERR,"RESPA style not compatible with fix langevin/drude");
- if (!comm->ghost_velocity)
- error->all(FLERR,"fix langevin/drude requires ghost velocities. Use comm_modify vel yes");
-
if (zero) {
int *mask = atom->mask;
int nlocal = atom->nlocal;
diff --git a/src/DRUDE/fix_tgnh_drude.cpp b/src/DRUDE/fix_tgnh_drude.cpp
index e15e865ce8..503cac604a 100644
--- a/src/DRUDE/fix_tgnh_drude.cpp
+++ b/src/DRUDE/fix_tgnh_drude.cpp
@@ -600,14 +600,23 @@ void FixTGNHDrude::init()
// set temperature and pressure ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature) error->all(FLERR,"Temperature ID for fix {} does not exist", style);
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
if (pstat_flag) {
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR,"Pressure ID for fix {} does not exist", id_press);
+ if (!pressure) {
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
}
// set timesteps and frequencies
diff --git a/src/DRUDE/fix_tgnpt_drude.cpp b/src/DRUDE/fix_tgnpt_drude.cpp
index 52da72708c..f62975b64e 100644
--- a/src/DRUDE/fix_tgnpt_drude.cpp
+++ b/src/DRUDE/fix_tgnpt_drude.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixTGNPTDrude::FixTGNPTDrude(LAMMPS *lmp, int narg, char **arg) :
- FixTGNHDrude(lmp, narg, arg)
+FixTGNPTDrude::FixTGNPTDrude(LAMMPS *lmp, int narg, char **arg) : FixTGNHDrude(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixTGNPTDrude::FixTGNPTDrude(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp",id_temp));
+ modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixTGNPTDrude::FixTGNPTDrude(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/DRUDE/fix_tgnvt_drude.cpp b/src/DRUDE/fix_tgnvt_drude.cpp
index 8c7354a7b8..91956eb658 100644
--- a/src/DRUDE/fix_tgnvt_drude.cpp
+++ b/src/DRUDE/fix_tgnvt_drude.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,18 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixTGNVTDrude::FixTGNVTDrude(LAMMPS *lmp, int narg, char **arg) :
- FixTGNHDrude(lmp, narg, arg)
+FixTGNVTDrude::FixTGNVTDrude(LAMMPS *lmp, int narg, char **arg) : FixTGNHDrude(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix {}", style);
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix {}", style);
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/EFF/fix_nph_eff.cpp b/src/EFF/fix_nph_eff.cpp
index e5a3807d30..b34c711786 100644
--- a/src/EFF/fix_nph_eff.cpp
+++ b/src/EFF/fix_nph_eff.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) :
- FixNHEff(lmp, narg, arg)
+FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) : FixNHEff(lmp, narg, arg)
{
- if (tstat_flag)
- error->all(FLERR,"Temperature control can not be used with fix nph/eff");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix nph/eff");
+ if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph/eff");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/eff");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/eff",id_temp));
+ modify->add_compute(fmt::format("{} all temp/eff", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPHEff::FixNPHEff(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/EFF/fix_npt_eff.cpp b/src/EFF/fix_npt_eff.cpp
index 0d97166abf..45cc00b496 100644
--- a/src/EFF/fix_npt_eff.cpp
+++ b/src/EFF/fix_npt_eff.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) :
- FixNHEff(lmp, narg, arg)
+FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) : FixNHEff(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/eff");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/eff");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/eff");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/eff");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/eff",id_temp));
+ modify->add_compute(fmt::format("{} all temp/eff", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPTEff::FixNPTEff(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/EFF/fix_nvt_eff.cpp b/src/EFF/fix_nvt_eff.cpp
index 02be397c52..db4f4a2ab8 100644
--- a/src/EFF/fix_nvt_eff.cpp
+++ b/src/EFF/fix_nvt_eff.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,19 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTEff::FixNVTEff(LAMMPS *lmp, int narg, char **arg) :
- FixNHEff(lmp, narg, arg)
+FixNVTEff::FixNVTEff(LAMMPS *lmp, int narg, char **arg) : FixNHEff(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/eff");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/eff");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/eff");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/eff");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp/eff",
- id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp/eff", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/EFF/fix_nvt_sllod_eff.cpp b/src/EFF/fix_nvt_sllod_eff.cpp
index f67684b528..de284f8f50 100644
--- a/src/EFF/fix_nvt_sllod_eff.cpp
+++ b/src/EFF/fix_nvt_sllod_eff.cpp
@@ -81,16 +81,14 @@ void FixNVTSllodEff::init()
// check fix deform remap settings
- int i;
- for (i = 0; i < modify->nfix; i++)
- if (strncmp(modify->fix[i]->style,"deform",6) == 0) {
- if ((dynamic_cast(modify->fix[i]))->remapflag != Domain::V_REMAP)
- error->all(FLERR,"Using fix nvt/sllod/eff with inconsistent fix deform "
- "remap option");
- break;
- }
- if (i == modify->nfix)
- error->all(FLERR,"Using fix nvt/sllod/eff with no fix deform defined");
+ auto deform = modify->get_fix_by_style("^deform");
+ if (deform.size() < 1) error->all(FLERR,"Using fix {} with no fix deform defined", style);
+
+ for (auto &ifix : deform) {
+ auto f = dynamic_cast(ifix);
+ if (f && (f->remapflag != Domain::V_REMAP))
+ error->all(FLERR,"Using fix {} with inconsistent fix deform remap option", style);
+ }
}
diff --git a/src/EFF/fix_temp_rescale_eff.cpp b/src/EFF/fix_temp_rescale_eff.cpp
index 5970c6cba7..0ca9c3e6e5 100644
--- a/src/EFF/fix_temp_rescale_eff.cpp
+++ b/src/EFF/fix_temp_rescale_eff.cpp
@@ -89,13 +89,15 @@ int FixTempRescaleEff::setmask()
void FixTempRescaleEff::init()
{
- int icompute = modify->find_compute(id_temp);
- if (icompute < 0)
- error->all(FLERR,"Temperature ID for fix temp/rescale/eff does not exist");
- temperature = modify->compute[icompute];
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ temperature = modify->get_compute_by_id(id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
}
/* ---------------------------------------------------------------------- */
diff --git a/src/EXTRA-FIX/fix_deform_pressure.cpp b/src/EXTRA-FIX/fix_deform_pressure.cpp
index a5b7b1fcb1..bb15611f97 100644
--- a/src/EXTRA-FIX/fix_deform_pressure.cpp
+++ b/src/EXTRA-FIX/fix_deform_pressure.cpp
@@ -432,12 +432,18 @@ void FixDeformPressure::init()
if (pressure_flag) {
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR, "Temperature ID {} for fix deform/pressure does not exist", id_temp);
+ if (!temperature) {
+ error->all(FLERR, "Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ }
pressure = modify->get_compute_by_id(id_press);
if (!pressure)
- error->all(FLERR, "Pressure ID {} for fix deform/pressure does not exist", id_press);
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
}
// if yz [3] changes and will cause box flip, then xy [5] cannot be changing
diff --git a/src/EXTRA-FIX/fix_npt_cauchy.cpp b/src/EXTRA-FIX/fix_npt_cauchy.cpp
index 8eb6a80b6d..e94177233f 100644
--- a/src/EXTRA-FIX/fix_npt_cauchy.cpp
+++ b/src/EXTRA-FIX/fix_npt_cauchy.cpp
@@ -640,28 +640,38 @@ void FixNPTCauchy::init()
// ensure no conflict with fix deform
if (pstat_flag)
- for (int i = 0; i < modify->nfix; i++)
- if (strcmp(modify->fix[i]->style,"deform") == 0) {
- int *dimflag = (dynamic_cast(modify->fix[i]))->dimflag;
+ for (auto &ifix : modify->get_fix_by_style("^deform")) {
+ auto deform = dynamic_cast(ifix);
+ if (deform) {
+ int *dimflag = deform->dimflag;
if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) ||
(p_flag[2] && dimflag[2]) || (p_flag[3] && dimflag[3]) ||
(p_flag[4] && dimflag[4]) || (p_flag[5] && dimflag[5]))
- error->all(FLERR,"Cannot use fix npt/cauchy and fix deform "
- "on same component of stress tensor");
+ error->all(FLERR,"Cannot use fix {} and fix deform on "
+ "same component of stress tensor", style);
}
+ }
// set temperature and pressure ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature ID {} for fix npt/cauchy does not exist", id_temp);
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
if (pstat_flag) {
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR,"Pressure ID {} for fix npt/cauchy does not exist", id_press);
+ if (!pressure) {
+ error->all(FLERR,"Pressure ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
}
// set timesteps and frequencies
diff --git a/src/EXTRA-FIX/fix_numdiff.cpp b/src/EXTRA-FIX/fix_numdiff.cpp
index dd9361f0ae..87bd456181 100644
--- a/src/EXTRA-FIX/fix_numdiff.cpp
+++ b/src/EXTRA-FIX/fix_numdiff.cpp
@@ -111,7 +111,12 @@ void FixNumDiff::init()
// check for PE compute
pe = modify->get_compute_by_id(id_pe);
- if (!pe) error->all(FLERR, "PE compute ID for fix numdiff does not exist");
+ if (!pe) {
+ error->all(FLERR, "Potential energy compute ID {} for fix {} does not exist", id_pe, style);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute potential energy", id_pe, style);
+ }
if (force->pair && force->pair->compute_flag)
pair_compute_flag = 1;
diff --git a/src/EXTRA-FIX/fix_numdiff_virial.cpp b/src/EXTRA-FIX/fix_numdiff_virial.cpp
index 7336be81dc..895c10b581 100644
--- a/src/EXTRA-FIX/fix_numdiff_virial.cpp
+++ b/src/EXTRA-FIX/fix_numdiff_virial.cpp
@@ -120,7 +120,12 @@ void FixNumDiffVirial::init()
// check for PE compute
pe = modify->get_compute_by_id(id_pe);
- if (!pe) error->all(FLERR, "PE compute ID for fix numdiff/virial does not exist");
+ if (!pe) {
+ error->all(FLERR, "Potential energy compute ID {} for fix {} does not exist", id_pe, style);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute potential energy", id_pe, style);
+ }
if (force->pair && force->pair->compute_flag)
pair_compute_flag = 1;
diff --git a/src/EXTRA-FIX/fix_temp_csld.cpp b/src/EXTRA-FIX/fix_temp_csld.cpp
index 13ead5b393..f60835ff39 100644
--- a/src/EXTRA-FIX/fix_temp_csld.cpp
+++ b/src/EXTRA-FIX/fix_temp_csld.cpp
@@ -138,20 +138,23 @@ void FixTempCSLD::init()
if (tstr) {
tvar = input->variable->find(tstr);
if (tvar < 0)
- error->all(FLERR,"Variable name {} for fix temp/csld does not exist", tstr);
+ error->all(FLERR,"Variable name {} for fix {} does not exist", tstr, style);
if (input->variable->equalstyle(tvar)) tstyle = EQUAL;
- else error->all(FLERR,"Variable {} for fix temp/csld is invalid style", tstr);
+ else error->all(FLERR,"Variable {} for fix {} is invalid style", tstr, style);
}
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature ID {} for fix temp/csld does not exist", id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
- if (modify->check_rigid_group_overlap(groupbit))
- error->warning(FLERR,"Cannot thermostat atoms in rigid bodies");
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if ((modify->check_rigid_group_overlap(groupbit)) && (comm->me == 0))
+ error->warning(FLERR,"Cannot thermostat atoms in rigid bodies with fix {}", style);
}
/* ---------------------------------------------------------------------- */
@@ -170,7 +173,7 @@ void FixTempCSLD::end_of_step()
modify->clearstep_compute();
t_target = input->variable->compute_equal(tvar);
if (t_target < 0.0)
- error->one(FLERR, "Fix temp/csld variable returned negative temperature");
+ error->one(FLERR, "Fix {} variable returned negative temperature", style);
modify->addstep_compute(update->ntimestep + nevery);
}
diff --git a/src/EXTRA-FIX/fix_temp_csvr.cpp b/src/EXTRA-FIX/fix_temp_csvr.cpp
index 6b46629a99..9aeb51cfd8 100644
--- a/src/EXTRA-FIX/fix_temp_csvr.cpp
+++ b/src/EXTRA-FIX/fix_temp_csvr.cpp
@@ -47,7 +47,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg),
tstr(nullptr), id_temp(nullptr), random(nullptr)
{
- if (narg != 7) error->all(FLERR,"Illegal fix temp/csvr command");
+ if (narg != 7) error->all(FLERR,"Incorrect number of arguments for fix {} command", style);
// CSVR thermostat should be applied every step
@@ -75,8 +75,8 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
// error checks
- if (t_period <= 0.0) error->all(FLERR,"Illegal fix temp/csvr command");
- if (seed <= 0) error->all(FLERR,"Illegal fix temp/csvr command");
+ if (t_period <= 0.0) error->all(FLERR,"Illegal fix {} command period value", style);
+ if (seed <= 0) error->all(FLERR,"Illegal fix {} command seed value", style);
random = new RanMars(lmp,seed + comm->me);
@@ -84,7 +84,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
// id = fix-ID + temp, compute group = fix group
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp", id_temp, group->names[igroup]));
tflag = 1;
nmax = -1;
@@ -124,17 +124,23 @@ void FixTempCSVR::init()
if (tstr) {
tvar = input->variable->find(tstr);
if (tvar < 0)
- error->all(FLERR,"Variable name {} for fix temp/csvr does not exist", tstr);
+ error->all(FLERR,"Variable name {} for fix {} does not exist", tstr, style);
if (input->variable->equalstyle(tvar)) tstyle = EQUAL;
- else error->all(FLERR,"Variable {} for fix temp/csvr is invalid style", tstr);
+ else error->all(FLERR,"Variable {} for fix {} is invalid style", tstr, style);
}
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature ID {} for fix temp/csvr does not exist", id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if ((modify->check_rigid_group_overlap(groupbit)) && (comm->me == 0))
+ error->warning(FLERR,"Cannot thermostat atoms in rigid bodies with fix {}", style);
}
/* ---------------------------------------------------------------------- */
@@ -153,7 +159,8 @@ void FixTempCSVR::end_of_step()
modify->clearstep_compute();
t_target = input->variable->compute_equal(tvar);
if (t_target < 0.0)
- error->one(FLERR, "Fix temp/csvr variable returned negative temperature");
+ error->one(FLERR, "Fix {} variable {} returned negative temperature",
+ style, input->variable->names[tvar]);
modify->addstep_compute(update->ntimestep + nevery);
}
diff --git a/src/GPU/fix_npt_gpu.cpp b/src/GPU/fix_npt_gpu.cpp
index 8f2d04d5ed..4587650064 100644
--- a/src/GPU/fix_npt_gpu.cpp
+++ b/src/GPU/fix_npt_gpu.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,28 +21,25 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTGPU::FixNPTGPU(LAMMPS *lmp, int narg, char **arg) :
- FixNHGPU(lmp, narg, arg)
+FixNPTGPU::FixNPTGPU(LAMMPS *lmp, int narg, char **arg) : FixNHGPU(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/gpu");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/gpu");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/gpu");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/gpu");
// create a new compute temp style
// id = fix-ID + temp
// compute group = all since pressure is always global (group all)
// and thus its KE/temperature contribution should use group all
- id_temp = utils::strdup(std::string(id)+"_temp");
- modify->add_compute(fmt::format("{} all temp",id_temp));
+ id_temp = utils::strdup(std::string(id) + "_temp");
+ modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
// id = fix-ID + press, compute group = all
// pass id_temp as 4th arg to pressure constructor
- id_press = utils::strdup(std::string(id)+"_press");
- modify->add_compute(std::string(id_press)+" all pressure "+id_temp);
+ id_press = utils::strdup(std::string(id) + "_press");
+ modify->add_compute(std::string(id_press) + " all pressure " + id_temp);
pcomputeflag = 1;
}
diff --git a/src/GPU/fix_nvt_gpu.cpp b/src/GPU/fix_nvt_gpu.cpp
index 6b1254e8da..5f4e6b99e6 100644
--- a/src/GPU/fix_nvt_gpu.cpp
+++ b/src/GPU/fix_nvt_gpu.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,18 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTGPU::FixNVTGPU(LAMMPS *lmp, int narg, char **arg) :
- FixNHGPU(lmp, narg, arg)
+FixNVTGPU::FixNVTGPU(LAMMPS *lmp, int narg, char **arg) : FixNHGPU(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/gpu");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/gpu");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/gpu");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/gpu");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/INTEL/fix_npt_intel.cpp b/src/INTEL/fix_npt_intel.cpp
index d1cf5a1fd8..bfdd2f3de1 100644
--- a/src/INTEL/fix_npt_intel.cpp
+++ b/src/INTEL/fix_npt_intel.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) :
- FixNHIntel(lmp, narg, arg)
+FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) : FixNHIntel(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/intel");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/intl");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/intel");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/intl");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp",id_temp));
+ modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPTIntel::FixNPTIntel(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/INTEL/fix_nvt_intel.cpp b/src/INTEL/fix_nvt_intel.cpp
index c9e87499de..d2fb36dbc2 100644
--- a/src/INTEL/fix_nvt_intel.cpp
+++ b/src/INTEL/fix_nvt_intel.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,19 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTIntel::FixNVTIntel(LAMMPS *lmp, int narg, char **arg) :
- FixNHIntel(lmp, narg, arg)
+FixNVTIntel::FixNVTIntel(LAMMPS *lmp, int narg, char **arg) : FixNHIntel(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/intel");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/intel");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/intel");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/intel");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
-
diff --git a/src/MACHDYN/atom_vec_smd.cpp b/src/MACHDYN/atom_vec_smd.cpp
index 820527503c..e4fd7268b3 100644
--- a/src/MACHDYN/atom_vec_smd.cpp
+++ b/src/MACHDYN/atom_vec_smd.cpp
@@ -201,7 +201,7 @@ void AtomVecSMD::write_data_restricted_to_general()
int nlocal = atom->nlocal;
memory->create(x0_hold,nlocal,3,"atomvec:x0_hold");
- if (nlocal) memcpy(&x0_hold[0][0],&x0[0][0],3*nlocal*sizeof(double));
+ if (nlocal) memcpy(&x0_hold[0][0],&x0[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_coords(x0[i]);
@@ -221,7 +221,7 @@ void AtomVecSMD::write_data_restore_restricted()
if (!x0_hold) return;
int nlocal = atom->nlocal;
- memcpy(&x0[0][0],&x0_hold[0][0],3*nlocal*sizeof(double));
+ memcpy(&x0[0][0],&x0_hold[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
memory->destroy(x0_hold);
x0_hold = nullptr;
}
diff --git a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp
index d8b91fdda1..c73438a7ef 100644
--- a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp
+++ b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp
@@ -187,15 +187,15 @@ void FixNVTManifoldRattle::init()
// Makes sure the manifold params are set initially.
update_var_params();
- int icompute = modify->find_compute(id_temp);
- if (icompute < 0) {
- error->all(FLERR,"Temperature ID for fix nvt/manifold/rattle "
- "does not exist");
+ temperature = modify->get_compute_by_id(id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
}
- temperature = modify->compute[icompute];
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
-
}
void FixNVTManifoldRattle::setup(int /*vflag*/)
diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp
index cc67a07ed2..ff90b81695 100644
--- a/src/MC/fix_bond_swap.cpp
+++ b/src/MC/fix_bond_swap.cpp
@@ -136,13 +136,15 @@ void FixBondSwap::init()
// require an atom style with molecule IDs
if (atom->molecule == nullptr)
- error->all(FLERR,
- "Must use atom style with molecule IDs with fix bond/swap");
+ error->all(FLERR, "Must use atom style with molecule IDs with fix bond/swap");
- int icompute = modify->find_compute(id_temp);
- if (icompute < 0)
- error->all(FLERR,"Temperature ID for fix bond/swap does not exist");
- temperature = modify->compute[icompute];
+ temperature = modify->get_compute_by_id(id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ }
// pair and bonds must be defined
// no dihedral or improper potentials allowed
@@ -159,7 +161,7 @@ void FixBondSwap::init()
"topology because no angle_style is defined");
if (force->dihedral || force->improper)
- error->all(FLERR,"Fix bond/swap cannot use dihedral or improper styles");
+ error->all(FLERR,"Fix bond/swap cannot be used with dihedral or improper styles");
if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 ||
force->special_lj[3] != 1.0)
diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp
index 68b552e9c1..fc1adc2e52 100644
--- a/src/MISC/fix_ipi.cpp
+++ b/src/MISC/fix_ipi.cpp
@@ -259,8 +259,12 @@ void FixIPI::init()
socketflag = 1;
// asks for evaluation of PE at first step
- modify->compute[modify->find_compute("thermo_pe")]->invoked_scalar = -1;
- modify->addstep_compute_all(update->ntimestep + 1);
+ auto c_pe = modify->get_compute_by_id("thermo_pe");
+ if (c_pe) {
+ c_pe->invoked_scalar = -1;
+ modify->addstep_compute_all(update->ntimestep + 1);
+ }
+
kspace_flag = (force->kspace) ? 1 : 0;
@@ -444,8 +448,12 @@ void FixIPI::final_integrate()
pressconv=1/force->nktv2p*potconv*posconv3;
// compute for potential energy
- pot=modify->compute[modify->find_compute("thermo_pe")]->compute_scalar();
- pot*=potconv;
+
+ auto *c_pe = modify->get_compute_by_id("thermo_pe");
+ if (c_pe) {
+ pot = c_pe->compute_scalar();
+ pot*=potconv;
+ }
// probably useless check
if (!hasdata)
@@ -469,18 +477,19 @@ void FixIPI::final_integrate()
for (int i = 0; i < 9; ++i) vir[i]=0.0;
- int press_id = modify->find_compute("IPI_PRESS");
- Compute* comp_p = modify->compute[press_id];
- comp_p->compute_vector();
- double myvol = domain->xprd*domain->yprd*domain->zprd/posconv3;
+ const double myvol = domain->xprd*domain->yprd*domain->zprd/posconv3;
+ Compute* comp_p = modify->get_compute_by_id("IPI_PRESS");
+ if (comp_p) {
+ comp_p->compute_vector();
- vir[0] = comp_p->vector[0]*pressconv*myvol;
- vir[4] = comp_p->vector[1]*pressconv*myvol;
- vir[8] = comp_p->vector[2]*pressconv*myvol;
- vir[1] = comp_p->vector[3]*pressconv*myvol;
- vir[2] = comp_p->vector[4]*pressconv*myvol;
- vir[5] = comp_p->vector[5]*pressconv*myvol;
- retstr[0]=0;
+ vir[0] = comp_p->vector[0]*pressconv*myvol;
+ vir[4] = comp_p->vector[1]*pressconv*myvol;
+ vir[8] = comp_p->vector[2]*pressconv*myvol;
+ vir[1] = comp_p->vector[3]*pressconv*myvol;
+ vir[2] = comp_p->vector[4]*pressconv*myvol;
+ vir[5] = comp_p->vector[5]*pressconv*myvol;
+ retstr[0]=0;
+ }
if (master) {
// check for new messages
diff --git a/src/OPENMP/fix_nph_asphere_omp.cpp b/src/OPENMP/fix_nph_asphere_omp.cpp
index 8785f16416..f66083ddb8 100644
--- a/src/OPENMP/fix_nph_asphere_omp.cpp
+++ b/src/OPENMP/fix_nph_asphere_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,12 +22,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixNPHAsphereOMP::FixNPHAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHAsphereOMP(lmp, narg, arg)
+ FixNHAsphereOMP(lmp, narg, arg)
{
- if (tstat_flag)
- error->all(FLERR,"Temperature control can not be used with fix nph/asphere/tmp");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix nph/asphere/omp");
+ if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph/asphere/tmp");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/asphere/omp");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +33,7 @@ FixNPHAsphereOMP::FixNPHAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/asphere",id_temp));
+ modify->add_compute(fmt::format("{} all temp/asphere", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +41,6 @@ FixNPHAsphereOMP::FixNPHAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_nph_omp.cpp b/src/OPENMP/fix_nph_omp.cpp
index 8fea8341d4..5d739f5948 100644
--- a/src/OPENMP/fix_nph_omp.cpp
+++ b/src/OPENMP/fix_nph_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHOMP(lmp, narg, arg)
+FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) : FixNHOMP(lmp, narg, arg)
{
- if (tstat_flag)
- error->all(FLERR,"Temperature control can not be used with fix nph/omp");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix nph/omp");
+ if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph/omp");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/omp");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp",id_temp));
+ modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPHOMP::FixNPHOMP(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_nph_sphere_omp.cpp b/src/OPENMP/fix_nph_sphere_omp.cpp
index dd0d7555aa..26deab256b 100644
--- a/src/OPENMP/fix_nph_sphere_omp.cpp
+++ b/src/OPENMP/fix_nph_sphere_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHSphereOMP(lmp, narg, arg)
+FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) : FixNHSphereOMP(lmp, narg, arg)
{
- if (tstat_flag)
- error->all(FLERR,"Temperature control can not be used with fix nph/sphere/omp");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix nph/sphere/omp");
+ if (tstat_flag) error->all(FLERR, "Temperature control can not be used with fix nph/sphere/omp");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix nph/sphere/omp");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/sphere",id_temp));
+ modify->add_compute(fmt::format("{} all temp/sphere", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPHSphereOMP::FixNPHSphereOMP(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_npt_asphere_omp.cpp b/src/OPENMP/fix_npt_asphere_omp.cpp
index 319738daf9..ed7f92b2e8 100644
--- a/src/OPENMP/fix_npt_asphere_omp.cpp
+++ b/src/OPENMP/fix_npt_asphere_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,12 +22,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixNPTAsphereOMP::FixNPTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHAsphereOMP(lmp, narg, arg)
+ FixNHAsphereOMP(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/asphere/omp");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/asphere/omp");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/asphere/omp");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/asphere/omp");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +33,7 @@ FixNPTAsphereOMP::FixNPTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/asphere",id_temp));
+ modify->add_compute(fmt::format("{} all temp/asphere", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +41,6 @@ FixNPTAsphereOMP::FixNPTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_npt_omp.cpp b/src/OPENMP/fix_npt_omp.cpp
index ab9b8b0139..055a68f928 100644
--- a/src/OPENMP/fix_npt_omp.cpp
+++ b/src/OPENMP/fix_npt_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHOMP(lmp, narg, arg)
+FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) : FixNHOMP(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/omp");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/omp");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/omp");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/omp");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp",id_temp));
+ modify->add_compute(fmt::format("{} all temp", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPTOMP::FixNPTOMP(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_npt_sphere_omp.cpp b/src/OPENMP/fix_npt_sphere_omp.cpp
index f6770a7174..b83bcc84b6 100644
--- a/src/OPENMP/fix_npt_sphere_omp.cpp
+++ b/src/OPENMP/fix_npt_sphere_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -22,13 +21,10 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHSphereOMP(lmp, narg, arg)
+FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) : FixNHSphereOMP(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix npt/sphere/omp");
- if (!pstat_flag)
- error->all(FLERR,"Pressure control must be used with fix npt/sphere/omp");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix npt/sphere/omp");
+ if (!pstat_flag) error->all(FLERR, "Pressure control must be used with fix npt/sphere/omp");
// create a new compute temp style
// id = fix-ID + temp
@@ -36,7 +32,7 @@ FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
// and thus its KE/temperature contribution should use group all
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} all temp/sphere",id_temp));
+ modify->add_compute(fmt::format("{} all temp/sphere", id_temp));
tcomputeflag = 1;
// create a new compute pressure style
@@ -44,6 +40,6 @@ FixNPTSphereOMP::FixNPTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
// pass id_temp as 4th arg to pressure constructor
id_press = utils::strdup(std::string(id) + "_press");
- modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
+ modify->add_compute(fmt::format("{} all pressure {}", id_press, id_temp));
pcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_nvt_asphere_omp.cpp b/src/OPENMP/fix_nvt_asphere_omp.cpp
index 35c73840ec..42f9249d57 100644
--- a/src/OPENMP/fix_nvt_asphere_omp.cpp
+++ b/src/OPENMP/fix_nvt_asphere_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -24,18 +23,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
FixNVTAsphereOMP::FixNVTAsphereOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHAsphereOMP(lmp, narg, arg)
+ FixNHAsphereOMP(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/asphere/omp");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/asphere/omp");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/asphere/omp");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/asphere/omp");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp/asphere",
- id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp/asphere", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_nvt_omp.cpp b/src/OPENMP/fix_nvt_omp.cpp
index 2ad5bf0183..11e43cad58 100644
--- a/src/OPENMP/fix_nvt_omp.cpp
+++ b/src/OPENMP/fix_nvt_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,18 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTOMP::FixNVTOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHOMP(lmp, narg, arg)
+FixNVTOMP::FixNVTOMP(LAMMPS *lmp, int narg, char **arg) : FixNHOMP(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/omp");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/omp");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/omp");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/omp");
// create a new compute temp style
// id = fix-ID + temp
- id_temp = utils::strdup(std::string(id)+"_temp");
- modify->add_compute(fmt::format("{} {} temp",id_temp,group->names[igroup]));
+ id_temp = utils::strdup(std::string(id) + "_temp");
+ modify->add_compute(fmt::format("{} {} temp", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/OPENMP/fix_nvt_sphere_omp.cpp b/src/OPENMP/fix_nvt_sphere_omp.cpp
index 20d729a972..46a149c5b8 100644
--- a/src/OPENMP/fix_nvt_sphere_omp.cpp
+++ b/src/OPENMP/fix_nvt_sphere_omp.cpp
@@ -1,4 +1,3 @@
-// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
@@ -23,19 +22,15 @@ using namespace FixConst;
/* ---------------------------------------------------------------------- */
-FixNVTSphereOMP::FixNVTSphereOMP(LAMMPS *lmp, int narg, char **arg) :
- FixNHSphereOMP(lmp, narg, arg)
+FixNVTSphereOMP::FixNVTSphereOMP(LAMMPS *lmp, int narg, char **arg) : FixNHSphereOMP(lmp, narg, arg)
{
- if (!tstat_flag)
- error->all(FLERR,"Temperature control must be used with fix nvt/sphere/omp");
- if (pstat_flag)
- error->all(FLERR,"Pressure control can not be used with fix nvt/sphere/omp");
+ if (!tstat_flag) error->all(FLERR, "Temperature control must be used with fix nvt/sphere/omp");
+ if (pstat_flag) error->all(FLERR, "Pressure control can not be used with fix nvt/sphere/omp");
// create a new compute temp style
// id = fix-ID + temp
id_temp = utils::strdup(std::string(id) + "_temp");
- modify->add_compute(fmt::format("{} {} temp/sphere",
- id_temp,group->names[igroup]));
+ modify->add_compute(fmt::format("{} {} temp/sphere", id_temp, group->names[igroup]));
tcomputeflag = 1;
}
diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp
index 477898a305..74670ebde5 100644
--- a/src/PHONON/fix_phonon.cpp
+++ b/src/PHONON/fix_phonon.cpp
@@ -88,15 +88,15 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
int iarg = 8;
nasr = 20;
- // other command line options
+ // other command-line options
while (iarg < narg) {
if (strcmp(arg[iarg],"sysdim") == 0) {
- if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options.");
+ if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command-line options.");
sdim = utils::inumeric(FLERR, arg[iarg],false,lmp);
if (sdim < 1) error->all(FLERR,"Illegal fix phonon command: sysdim should not be less than 1.");
} else if (strcmp(arg[iarg],"nasr") == 0) {
- if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options.");
+ if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command-line options.");
nasr = utils::inumeric(FLERR, arg[iarg],false,lmp);
} else {
diff --git a/src/PLUMED/fix_plumed.cpp b/src/PLUMED/fix_plumed.cpp
index ec23e42ddb..3459c21279 100644
--- a/src/PLUMED/fix_plumed.cpp
+++ b/src/PLUMED/fix_plumed.cpp
@@ -227,17 +227,24 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(check_style, "plumed") == 0)
error->all(FLERR, "There must be only one instance of fix plumed");
+ // PLUMED knows nothing about path integrals
+
+ if (utils::strmatch(check_style, "^pimd") || utils::strmatch(check_style, "^ipi"))
+ error->all(FLERR, "Fix plumed is incompatible with path-integrals");
+
// Avoid conflict with fixes that define internal pressure computes.
// See comment in the setup method
- if (utils::strmatch(check_style, "^nph") || utils::strmatch(check_style, "^npt") ||
- utils::strmatch(check_style, "^rigid/nph") || utils::strmatch(check_style, "^rigid/npt") ||
- utils::strmatch(check_style, "^msst") || utils::strmatch(check_style, "^nphug") ||
- utils::strmatch(check_style, "^ipi") || utils::strmatch(check_style, "^press/berendsen") ||
- utils::strmatch(check_style, "^qbmsst"))
+ if (utils::strmatch(check_style, "^nph") || utils::strmatch(check_style, "^press/berendsen") ||
+ utils::strmatch(check_style, "^npt") || utils::strmatch(check_style, "^deform/pressure") ||
+ utils::strmatch(check_style, "^msst") || utils::strmatch(check_style, "^press/langevin") ||
+ utils::strmatch(check_style, "^nphug") || utils::strmatch(check_style, "^tgnpt/drude") ||
+ utils::strmatch(check_style, "^qbmsst") || utils::strmatch(check_style, "^rigid/nph") ||
+ utils::strmatch(check_style, "^rigid/npt") || utils::strmatch(check_style, "^box/relax"))
error->all(FLERR,
- "Fix plumed must be defined before any other fixes, "
- "that compute pressure internally");
+ "Fix plumed must be defined before any other fixes like fix {} that compute "
+ "pressure internally",
+ check_style);
}
}
@@ -272,6 +279,22 @@ void FixPlumed::init()
// in a setup method
for (int i = 0; i < 6; i++) virial[i] = 0.;
+
+ c_pe = modify->get_compute_by_id(id_pe);
+ if (!c_pe) {
+ error->all(FLERR, "Potential energy compute ID {} for fix plumed does not exist", id_pe);
+ } else {
+ if (c_pe->peflag == 0)
+ error->all(FLERR, "Compute ID {} does not compute potential energy", id_pe);
+ }
+
+ c_press = modify->get_compute_by_id(id_press);
+ if (!c_press) {
+ error->all(FLERR, "Pressure compute ID {} for fix plumed does not exist", id_press);
+ } else {
+ if (c_press->pressflag == 0)
+ error->all(FLERR, "Compute ID {} does not compute pressure", id_press);
+ }
}
void FixPlumed::setup(int vflag)
diff --git a/src/PTM/ptm_voronoi_config.h b/src/PTM/ptm_voronoi_config.h
index a57697c4f0..32ff0c360f 100644
--- a/src/PTM/ptm_voronoi_config.h
+++ b/src/PTM/ptm_voronoi_config.h
@@ -162,8 +162,8 @@ constexpr double optimal_particles = 5.6;
* contacted. */
#define VOROPP_INTERNAL_ERROR 3
-/** Voro++ returns this status code if it could not interpret the command line
- * arguments passed to the command line utility. */
+/** Voro++ returns this status code if it could not interpret the command-line
+ * arguments passed to the command-line utility. */
#define VOROPP_CMD_LINE_ERROR 4
} // namespace ptm_voro
diff --git a/src/QTB/fix_qbmsst.cpp b/src/QTB/fix_qbmsst.cpp
index 56d67093fe..7dd7547efd 100644
--- a/src/QTB/fix_qbmsst.cpp
+++ b/src/QTB/fix_qbmsst.cpp
@@ -316,18 +316,28 @@ void FixQBMSST::init()
// set compute ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
+ if (!temperature) {
error->all(FLERR, "Could not find fix qbmsst temperature compute ID {}", id_temp);
- if (temperature->tempflag == 0)
- error->all(FLERR, "Fix qbmsst compute ID {} does not compute temperature", id_temp);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Fix qbmsst compute ID {} does not compute a temperature", id_temp);
+ }
+
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR, "Could not find fix qbmsst pressure compute ID {}", id_press);
- if (pressure->pressflag == 0)
- error->all(FLERR, "Fix qbmsst compute ID {} does not compute pressure", id_press);
+ if (!pressure) {
+ error->all(FLERR, "Could not find fix qbmsst pressure compute ID {}", id_press);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR, "Fix qbmsst compute ID {} does not compute pressure", id_press);
+ }
+
pe = modify->get_compute_by_id(id_pe);
- if (!pe) error->all(FLERR, "Could not find fix qbmsst pe compute ID {}", id_pe);
- if (pe->peflag == 0)
- error->all(FLERR, "Fix qbmsst compute ID {} does not compute potential energy", id_pe);
+ if (!pe) {
+ error->all(FLERR, "Could not find fix qbmsst pe compute ID {}", id_pe);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR, "Fix qbmsst compute ID {} does not compute potential energy", id_pe);
+ }
// initiate the counter l and \mu
counter_l=0;
diff --git a/src/REPLICA/fix_alchemy.cpp b/src/REPLICA/fix_alchemy.cpp
index b14c6bc22d..f3b79d0956 100644
--- a/src/REPLICA/fix_alchemy.cpp
+++ b/src/REPLICA/fix_alchemy.cpp
@@ -178,10 +178,10 @@ void FixAlchemy::init()
error->universe_all(FLERR, "Fix alchemy is not compatible with load balancing");
if (modify->get_fix_by_style("^alchemy").size() > 1)
- error->universe_all(FLERR, "There may only one fix alchemy at a time");
+ error->universe_all(FLERR, "There may only be one fix alchemy at a time");
if (utils::strmatch(update->integrate_style, "^respa"))
- error->universe_all(FLERR, "Must not use run style respa with fix alchemy");
+ error->universe_all(FLERR, "Must not use run_style respa with fix alchemy");
ivar = input->variable->find(id_lambda.c_str());
if (ivar < 0)
@@ -190,6 +190,42 @@ void FixAlchemy::init()
error->universe_one(FLERR, fmt::format("Fix alchemy variable {} is invalid style", id_lambda));
lambda = input->variable->compute_equal(ivar);
+ // update and check pointers to internal compute styles
+
+ pe = modify->get_compute_by_id(id_pe);
+ if (!pe) {
+ error->universe_all(
+ FLERR,
+ fmt::format("Potential energy compute ID {} for fix {} does not exist", id_pe, style));
+ } else {
+ if (pe->peflag == 0)
+ error->universe_all(
+ FLERR,
+ fmt::format("Compute ID {} for fix {} does not compute potential energy", id_pe, style));
+ }
+
+ temp = modify->get_compute_by_id(id_temp);
+ if (!temp) {
+ error->universe_all(
+ FLERR, fmt::format("Temperature compute ID {} for fix {} does not exist", id_temp, style));
+ } else {
+ if (temp->tempflag == 0)
+ error->universe_all(
+ FLERR,
+ fmt::format("Compute ID {} for fix {} does not compute a temperature", id_temp, style));
+ }
+
+ press = modify->get_compute_by_id(id_press);
+ if (!press) {
+ error->universe_all(
+ FLERR, fmt::format("Pressure compute ID {} for fix {} does not exist", id_press, style));
+ } else {
+ if (press->pressflag == 0)
+ error->universe_all(
+ FLERR,
+ fmt::format("Compute ID {} for fix {} does not compute pressure", id_press, style));
+ }
+
// synchronize box dimensions, determine if resync during run will be needed.
synchronize_box(domain, samerank);
diff --git a/src/REPLICA/fix_grem.cpp b/src/REPLICA/fix_grem.cpp
index 4571afdcba..4ec5b37cad 100644
--- a/src/REPLICA/fix_grem.cpp
+++ b/src/REPLICA/fix_grem.cpp
@@ -29,6 +29,7 @@
#include "compute.h"
#include "domain.h"
#include "error.h"
+#include "fix_nh.h"
#include "force.h"
#include "modify.h"
#include "update.h"
@@ -117,11 +118,11 @@ FixGrem::~FixGrem()
modify->delete_compute(id_press);
modify->delete_compute(id_ke);
modify->delete_compute(id_pe);
- delete [] id_temp;
- delete [] id_press;
- delete [] id_ke;
- delete [] id_pe;
- delete [] id_nh;
+ delete[] id_temp;
+ delete[] id_press;
+ delete[] id_ke;
+ delete[] id_pe;
+ delete[] id_nh;
}
/* ---------------------------------------------------------------------- */
@@ -141,55 +142,70 @@ void FixGrem::init()
if (domain->triclinic)
error->all(FLERR,"Triclinic cells are not supported");
- // set temperature and pressure ptrs
+ // set temperature and other pointers to compute instances
- int icompute = modify->find_compute(id_temp);
- if (icompute < 0)
- error->all(FLERR,"Temperature compute ID for fix grem does not exist");
- temperature = modify->compute[icompute];
+ temperature = modify->get_compute_by_id(id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ }
- icompute = modify->find_compute(id_ke);
- if (icompute < 0)
- error->all(FLERR,"KE compute ID for fix grem does not exist");
- ke = modify->compute[icompute];
+ ke = modify->get_compute_by_id(id_ke);
+ if (!ke) {
+ error->all(FLERR,"Kinetic energy compute ID {} for fix {} does not exist", id_ke, style);
+ } else {
+ if (strcmp(ke->style, "ke") != 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute kinetic energy", id_ke, style);
+ }
- icompute = modify->find_compute(id_pe);
- if (icompute < 0)
- error->all(FLERR,"PE compute ID for fix grem does not exist");
- pe = modify->compute[icompute];
+ pe = modify->get_compute_by_id(id_pe);
+ if (!pe) {
+ error->all(FLERR,"Potential energy compute ID {} for fix {} does not exist", id_pe, style);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute potential energy", id_pe, style);
+ }
- int ifix = modify->find_fix(id_nh);
- if (ifix < 0)
+ auto *ifix = modify->get_fix_by_id(id_nh);
+ if (!ifix) {
error->all(FLERR,"Fix id for nvt or npt fix does not exist");
- Fix *nh = modify->fix[ifix];
-
- auto t_start = (double *)nh->extract("t_start",ifix);
- auto t_stop = (double *)nh->extract("t_stop",ifix);
- if ((t_start != nullptr) && (t_stop != nullptr) && (ifix == 0)) {
- tbath = *t_start;
- if (*t_start != *t_stop)
- error->all(FLERR,"Thermostat temperature ramp not allowed");
- } else
- error->all(FLERR,"Problem extracting target temperature from fix nvt or npt");
-
- pressref = 0.0;
- if (pressflag) {
- int *p_flag = (int *)nh->extract("p_flag",ifix);
- auto p_start = (double *) nh->extract("p_start",ifix);
- auto p_stop = (double *) nh->extract("p_stop",ifix);
- if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr)
- && (ifix == 1)) {
- ifix = 0;
- pressref = p_start[0];
- if ((p_start[0] != p_stop[0]) || (p_flag[0] != 1)) ++ ifix;
- if ((p_start[1] != p_stop[1]) || (p_flag[0] != 1)) ++ ifix;
- if ((p_start[2] != p_stop[2]) || (p_flag[0] != 1)) ++ ifix;
- if ((p_start[0] != p_start[1]) || (p_start[1] != p_start[2])) ++ifix;
- if ((p_flag[3] != 0) || (p_flag[4] != 0) || (p_flag[5] != 0)) ++ifix;
- if (ifix > 0)
- error->all(FLERR,"Unsupported pressure settings in fix npt");
- } else
- error->all(FLERR,"Problem extracting target pressure from fix npt");
+ } else { // check for correct fix style
+ FixNH *nh = dynamic_cast(ifix);
+ if (!nh) {
+ error->all(FLERR, "Fix ID {} is not a compatible Nose-Hoover fix for fix {}", id_nh, style);
+ } else {
+ int dummy;
+ auto t_start = (double *)nh->extract("t_start",dummy);
+ auto t_stop = (double *)nh->extract("t_stop",dummy);
+ if ((t_start != nullptr) && (t_stop != nullptr)) {
+ tbath = *t_start;
+ if (*t_start != *t_stop)
+ error->all(FLERR,"Temperature ramp in fix {} ID {} not allowed", nh->style, id_nh);
+ } else {
+ error->all(FLERR,"Problem extracting target temperature from fix {}", nh->style);
+ }
+ pressref = 0.0;
+ if (pressflag) {
+ int *p_flag = (int *)nh->extract("p_flag",dummy);
+ auto p_start = (double *) nh->extract("p_start",dummy);
+ auto p_stop = (double *) nh->extract("p_stop",dummy);
+ if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr)) {
+ int ifix = 0;
+ pressref = p_start[0];
+ if ((p_start[0] != p_stop[0]) || (p_flag[0] != 1)) ++ ifix;
+ if ((p_start[1] != p_stop[1]) || (p_flag[0] != 1)) ++ ifix;
+ if ((p_start[2] != p_stop[2]) || (p_flag[0] != 1)) ++ ifix;
+ if ((p_start[0] != p_start[1]) || (p_start[1] != p_start[2])) ++ifix;
+ if ((p_flag[3] != 0) || (p_flag[4] != 0) || (p_flag[5] != 0)) ++ifix;
+ if (ifix > 0)
+ error->all(FLERR,"Unsupported pressure settings in fix {} ID {}", nh->style, id_nh);
+ } else {
+ error->all(FLERR,"Problem extracting target pressure from fix {}", nh->style);
+ }
+ }
+ }
}
}
diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp
index 9c920f26dc..409c108628 100644
--- a/src/REPLICA/fix_neb.cpp
+++ b/src/REPLICA/fix_neb.cpp
@@ -223,9 +223,13 @@ int FixNEB::setmask()
void FixNEB::init()
{
- int icompute = modify->find_compute(id_pe);
- if (icompute < 0) error->all(FLERR, "Potential energy ID for fix neb does not exist");
- pe = modify->compute[icompute];
+ pe = modify->get_compute_by_id(id_pe);
+ if (!pe) {
+ error->all(FLERR,"Potential energy compute ID {} for fix {} does not exist", id_pe, style);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute potential energy", id_pe, style);
+ }
// turn off climbing mode, NEB command turns it on after init()
diff --git a/src/REPLICA/fix_pimd_langevin.cpp b/src/REPLICA/fix_pimd_langevin.cpp
index 04dbcb8a90..4e530bd97e 100644
--- a/src/REPLICA/fix_pimd_langevin.cpp
+++ b/src/REPLICA/fix_pimd_langevin.cpp
@@ -479,14 +479,27 @@ void FixPIMDLangevin::init()
langevin_init();
c_pe = modify->get_compute_by_id(id_pe);
- if (!c_pe)
+ if (!c_pe) {
error->universe_all(
- FLERR, fmt::format("Could not find fix {} potential energy compute ID {}", style, id_pe));
+ FLERR,
+ fmt::format("Potential energy compute ID {} for fix {} does not exist", id_pe, style));
+ } else {
+ if (c_pe->peflag == 0)
+ error->universe_all(
+ FLERR,
+ fmt::format("Compute ID {} for fix {} does not compute potential energy", id_pe, style));
+ }
c_press = modify->get_compute_by_id(id_press);
- if (!c_press)
+ if (!c_press) {
error->universe_all(
FLERR, fmt::format("Could not find fix {} pressure compute ID {}", style, id_press));
+ } else {
+ if (c_press->pressflag == 0)
+ error->universe_all(
+ FLERR,
+ fmt::format("Compute ID {} for fix {} does not compute pressure", id_press, style));
+ }
t_prim = t_vir = t_cv = p_prim = p_vir = p_cv = p_md = 0.0;
}
diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp
index 7a662c1714..252f74a4e3 100644
--- a/src/REPLICA/prd.cpp
+++ b/src/REPLICA/prd.cpp
@@ -770,9 +770,9 @@ void PRD::replicate(int ireplica)
int nlocal = atom->nlocal;
if (universe->iworld == ireplica) {
- memcpy(tagall,tag,nlocal*sizeof(tagint));
- memcpy(xall[0],x[0],3*nlocal*sizeof(double));
- memcpy(imageall,image,nlocal*sizeof(imageint));
+ memcpy(tagall,tag,(nlocal*sizeof(tagint))&MEMCPYMASK);
+ memcpy(xall[0],x[0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
+ memcpy(imageall,image,(nlocal*sizeof(imageint))&MEMCPYMASK);
}
MPI_Bcast(tagall,natoms,MPI_LMP_TAGINT,ireplica,comm_replica);
diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp
index f628b639ab..a7d8e967f6 100644
--- a/src/RIGID/fix_rigid_nh.cpp
+++ b/src/RIGID/fix_rigid_nh.cpp
@@ -246,8 +246,12 @@ void FixRigidNH::init()
if (tcomputeflag) {
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature ID {} for fix {} does not exist", id_temp, style);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ }
}
if (pstat_flag) {
@@ -260,9 +264,9 @@ void FixRigidNH::init()
auto deform = dynamic_cast(ifix);
if (deform) {
int *dimflag = deform->dimflag;
- if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) ||
- (p_flag[2] && dimflag[2]))
- error->all(FLERR,"Cannot use fix {} and fix deform on same component of stress tensor", style);
+ if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2]))
+ error->all(FLERR,"Cannot use fix {} and fix deform on same component of stress tensor",
+ style);
}
}
@@ -284,7 +288,12 @@ void FixRigidNH::init()
// set pressure compute ptr
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR,"Pressure ID {} for fix {} does not exist", id_press, style);
+ if (!pressure) {
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
// detect if any rigid fixes exist so rigid bodies move on remap
// this will include self
diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp
index 3ee11e28d2..560c068a18 100644
--- a/src/RIGID/fix_rigid_nh_small.cpp
+++ b/src/RIGID/fix_rigid_nh_small.cpp
@@ -221,8 +221,12 @@ void FixRigidNHSmall::init()
if (tcomputeflag) {
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature ID {} for fix {} does not exist", id_temp, style);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ }
}
if (pstat_flag) {
@@ -237,7 +241,8 @@ void FixRigidNHSmall::init()
int *dimflag = deform->dimflag;
if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) ||
(p_flag[2] && dimflag[2]))
- error->all(FLERR,"Cannot use fix {} and fix deform on same component of stress tensor", style);
+ error->all(FLERR,"Cannot use fix {} and fix deform on same component of stress tensor",
+ style);
}
}
@@ -259,7 +264,12 @@ void FixRigidNHSmall::init()
// set pressure compute ptr
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR,"Pressure ID {} for fix {} does not exist", id_press, style);
+ if (!pressure) {
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
// detect if any rigid fixes exist so rigid bodies move on remap
// this will include self
diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp
index b3a55ff663..5483fbb67b 100644
--- a/src/SHOCK/fix_msst.cpp
+++ b/src/SHOCK/fix_msst.cpp
@@ -248,18 +248,28 @@ void FixMSST::init()
// set compute ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
+ if (!temperature) {
error->all(FLERR, "Could not find fix msst temperature compute ID {}", id_temp);
- if (temperature->tempflag == 0)
- error->all(FLERR, "Fix msst compute ID {} does not compute temperature", id_temp);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Fix msst compute ID {} does not compute a temperature", id_temp);
+ }
+
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR, "Could not find fix msst pressure compute ID {}", id_press);
- if (pressure->pressflag == 0)
- error->all(FLERR, "Fix msst compute ID {} does not compute pressure", id_press);
+ if (!pressure) {
+ error->all(FLERR, "Could not find fix msst pressure compute ID {}", id_press);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR, "Fix msst compute ID {} does not compute pressure", id_press);
+ }
+
pe = modify->get_compute_by_id(id_pe);
- if (!pe) error->all(FLERR, "Could not find fix msst pe compute ID {}", id_pe);
- if (pe->peflag == 0)
- error->all(FLERR, "Fix msst compute ID {} does not compute potential energy", id_pe);
+ if (!pe) {
+ error->all(FLERR, "Could not find fix msst pe compute ID {}", id_pe);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR, "Fix msst compute ID {} does not compute potential energy", id_pe);
+ }
dtv = update->dt;
dtf = 0.5 * update->dt * force->ftm2v;
diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp
index b4b4a866b6..dcf014afb5 100644
--- a/src/SHOCK/fix_nphug.cpp
+++ b/src/SHOCK/fix_nphug.cpp
@@ -162,8 +162,12 @@ void FixNPHug::init()
// set pe ptr
pe = modify->get_compute_by_id(id_pe);
- if (!pe)
+ if (!pe) {
error->all(FLERR, "Potential energy compute ID {} for fix {} does not exist", id_pe, style);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute potential energy", id_pe, style);
+ }
}
diff --git a/src/SPIN/fix_neb_spin.cpp b/src/SPIN/fix_neb_spin.cpp
index f3fd347242..2517938b9f 100644
--- a/src/SPIN/fix_neb_spin.cpp
+++ b/src/SPIN/fix_neb_spin.cpp
@@ -193,10 +193,13 @@ int FixNEBSpin::setmask()
void FixNEBSpin::init()
{
- int icompute = modify->find_compute(id_pe);
- if (icompute < 0)
- error->all(FLERR,"Potential energy ID for fix neb does not exist");
- pe = modify->compute[icompute];
+ pe = modify->get_compute_by_id(id_pe);
+ if (!pe) {
+ error->all(FLERR,"Potential energy compute ID {} for fix {} does not exist", id_pe, style);
+ } else {
+ if (pe->peflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute potential energy", id_pe, style);
+ }
// turn off climbing mode, NEB command turns it on after init()
diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp
index a824966d34..3173ebfc6e 100644
--- a/src/UEF/fix_nh_uef.cpp
+++ b/src/UEF/fix_nh_uef.cpp
@@ -239,13 +239,17 @@ void FixNHUef::init()
if (!pstat_flag)
if (pcomputeflag) {
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR,"Pressure ID {} for {} doesn't exist", id_press, style);
- if (strcmp(pressure->style,"pressure/uef") != 0)
- error->all(FLERR,"Using fix {} without a compute pressure/uef", style);
+ if (!pressure) {
+ error->all(FLERR,"Pressure ID {} for {} doesn't exist", id_press, style);
+ } else {
+ if (strcmp(pressure->style,"pressure/uef") != 0)
+ error->all(FLERR,"Compute ID {} for fix {} must be compute pressure/uef",
+ id_press, style);
+ }
}
if (strcmp(temperature->style,"temp/uef") != 0)
- error->all(FLERR,"Using fix {} without a compute temp/uef", style);
+ error->all(FLERR,"Compute ID {} for fix {} must be compute temp/uef", id_temp, style);
}
/* ----------------------------------------------------------------------
diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp
index b9d94b1dd2..0529d5cb54 100644
--- a/src/atom_vec.cpp
+++ b/src/atom_vec.cpp
@@ -2269,7 +2269,7 @@ void AtomVec::write_data_restricted_to_general()
int nlocal = atom->nlocal;
memory->create(x_hold,nlocal,3,"atomvec:x_hold");
- if (nlocal) memcpy(&x_hold[0][0],&x[0][0],3*nlocal*sizeof(double));
+ if (nlocal) memcpy(&x_hold[0][0],&x[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_coords(x[i]);
@@ -2290,17 +2290,17 @@ void AtomVec::write_data_restricted_to_general()
if (array == v) {
memory->create(v_hold,nlocal,3,"atomvec:v_hold");
- if (nlocal) memcpy(&v_hold[0][0],&v[0][0],3*nlocal*sizeof(double));
+ if (nlocal) memcpy(&v_hold[0][0],&v[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_vector(v[i]);
} else if (array == omega) {
memory->create(omega_hold,nlocal,3,"atomvec:omega_hold");
- if (nlocal) memcpy(&omega_hold[0][0],&omega[0][0],3*nlocal*sizeof(double));
+ if (nlocal) memcpy(&omega_hold[0][0],&omega[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_vector(omega[i]);
} else if (array == angmom) {
memory->create(angmom_hold,nlocal,3,"atomvec:angmom_hold");
- if (nlocal) memcpy(&angmom_hold[0][0],&angmom[0][0],3*nlocal*sizeof(double));
+ if (nlocal) memcpy(&angmom_hold[0][0],&angmom[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
for (int i = 0; i < nlocal; i++)
domain->restricted_to_general_vector(angmom[i]);
}
@@ -2321,7 +2321,7 @@ void AtomVec::write_data_restore_restricted()
int nlocal = atom->nlocal;
if (x_hold) {
- memcpy(&x[0][0],&x_hold[0][0],3*nlocal*sizeof(double));
+ memcpy(&x[0][0],&x_hold[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
memory->destroy(x_hold);
x_hold = nullptr;
}
@@ -2330,19 +2330,19 @@ void AtomVec::write_data_restore_restricted()
// no other write_data Velocities fields are Nx3 double arrays
if (v_hold) {
- memcpy(&v[0][0],&v_hold[0][0],3*nlocal*sizeof(double));
+ memcpy(&v[0][0],&v_hold[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
memory->destroy(v_hold);
v_hold = nullptr;
}
if (omega_hold) {
- memcpy(&atom->omega[0][0],&omega_hold[0][0],3*nlocal*sizeof(double));
+ memcpy(&atom->omega[0][0],&omega_hold[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
memory->destroy(omega_hold);
omega_hold = nullptr;
}
if (angmom_hold) {
- memcpy(&atom->angmom[0][0],&angmom_hold[0][0],3*nlocal*sizeof(double));
+ memcpy(&atom->angmom[0][0],&angmom_hold[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
memory->destroy(angmom_hold);
angmom_hold = nullptr;
}
diff --git a/src/dump.cpp b/src/dump.cpp
index 7773be5ef2..3425b6d441 100644
--- a/src/dump.cpp
+++ b/src/dump.cpp
@@ -409,9 +409,9 @@ void Dump::write()
int nlocal = atom->nlocal;
if (nlocal > maxpbc) pbc_allocate();
if (nlocal) {
- memcpy(&xpbc[0][0],&atom->x[0][0],3*nlocal*sizeof(double));
- memcpy(&vpbc[0][0],&atom->v[0][0],3*nlocal*sizeof(double));
- memcpy(imagepbc,atom->image,nlocal*sizeof(imageint));
+ memcpy(&xpbc[0][0],&atom->x[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
+ memcpy(&vpbc[0][0],&atom->v[0][0],(sizeof(double)*3*nlocal)&MEMCPYMASK);
+ memcpy(imagepbc,atom->image,(nlocal*sizeof(imageint))&MEMCPYMASK);
}
xhold = atom->x;
vhold = atom->v;
diff --git a/src/error.cpp b/src/error.cpp
index 4aaa93aa31..e591091b35 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -69,7 +69,7 @@ void Error::universe_all(const std::string &file, int line, const std::string &s
if (universe->ulogfile) fclose(universe->ulogfile);
// allow commands if an exception was caught in a run
- // update may be a null pointer when catching command line errors
+ // update may be a null pointer when catching command-line errors
if (update) update->whichflag = 0;
throw LAMMPSException(mesg);
@@ -87,7 +87,7 @@ void Error::universe_one(const std::string &file, int line, const std::string &s
if (universe->uscreen) fputs(mesg.c_str(),universe->uscreen);
// allow commands if an exception was caught in a run
- // update may be a null pointer when catching command line errors
+ // update may be a null pointer when catching command-line errors
if (update) update->whichflag = 0;
throw LAMMPSAbortException(mesg, universe->uworld);
@@ -135,7 +135,7 @@ void Error::all(const std::string &file, int line, const std::string &str)
}
// allow commands if an exception was caught in a run
- // update may be a null pointer when catching command line errors
+ // update may be a null pointer when catching command-line errors
if (update) update->whichflag = 0;
@@ -170,7 +170,7 @@ void Error::one(const std::string &file, int line, const std::string &str)
fputs(mesg.c_str(),universe->uscreen);
// allow commands if an exception was caught in a run
- // update may be a null pointer when catching command line errors
+ // update may be a null pointer when catching command-line errors
if (update) update->whichflag = 0;
throw LAMMPSAbortException(mesg, world);
diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp
index cf8df7cd02..1362095a28 100644
--- a/src/fix_box_relax.cpp
+++ b/src/fix_box_relax.cpp
@@ -348,12 +348,20 @@ void FixBoxRelax::init()
// set temperature and pressure ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature compute ID {} for fix box/relax does not exist", id_temp);
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ }
pressure = modify->get_compute_by_id(id_press);
- if (!pressure)
- error->all(FLERR,"Pressure compute ID {} for fix box/relax does not exist", id_press);
+ if (!pressure) {
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
pv2e = 1.0 / force->nktv2p;
diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp
index 7339ddada1..4258e3359f 100644
--- a/src/fix_langevin.cpp
+++ b/src/fix_langevin.cpp
@@ -223,6 +223,16 @@ int FixLangevin::setmask()
void FixLangevin::init()
{
+ if (id_temp) {
+ temperature = modify->get_compute_by_id(id_temp);
+ if (!temperature) {
+ error->all(FLERR, "Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute temperature", id_temp, style);
+ }
+ }
+
if (gjfflag) {
if (t_period * 2 == update->dt)
error->all(FLERR, "Fix langevin gjf cannot have t_period equal to dt/2");
diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp
index f2ad246611..b56033d6d6 100644
--- a/src/fix_nh.cpp
+++ b/src/fix_nh.cpp
@@ -654,14 +654,21 @@ void FixNH::init()
// set temperature and pressure ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature) error->all(FLERR,"Temperature ID {} for fix {} does not exist", id_temp, style);
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
if (pstat_flag) {
pressure = modify->get_compute_by_id(id_press);
- if (!pressure) error->all(FLERR,"Pressure ID {} for fix {} does not exist", id_press, style);
+ if (!pressure)
+ error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
}
// set timesteps and frequencies
diff --git a/src/fix_nh_sphere.cpp b/src/fix_nh_sphere.cpp
index 1835181606..e46d11efcc 100644
--- a/src/fix_nh_sphere.cpp
+++ b/src/fix_nh_sphere.cpp
@@ -70,7 +70,7 @@ void FixNHSphere::init()
for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit)
if (radius[i] == 0.0)
- error->one(FLERR,"Fix nvt/npt/nph/sphere require extended particles");
+ error->one(FLERR,"Fix {} requires extended particles", style);
FixNH::init();
}
diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp
index 40dcdeeb10..99f7ac8475 100644
--- a/src/fix_press_berendsen.cpp
+++ b/src/fix_press_berendsen.cpp
@@ -259,24 +259,30 @@ void FixPressBerendsen::init()
if (!dimflag) continue;
if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2]))
error->all(FLERR,
- "Cannot use fix press/berendsen and "
- "fix deform on same component of stress tensor");
+ "Cannot use fix press/berendsen and fix deform on same component of stress tensor");
}
// set temperature and pressure ptrs
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR, "Temperature compute ID {} for fix press/berendsen does not exist", id_temp);
-
- if (temperature->tempbias)
- which = BIAS;
- else
- which = NOBIAS;
+ if (!temperature) {
+ error->all(FLERR, "Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias)
+ which = BIAS;
+ else
+ which = NOBIAS;
+ }
pressure = modify->get_compute_by_id(id_press);
- if (!pressure)
- error->all(FLERR, "Pressure compute ID {} for fix press/berendsen does not exist", id_press);
+ if (!pressure) {
+ error->all(FLERR, "Pressure compute ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
// Kspace setting
diff --git a/src/fix_press_langevin.cpp b/src/fix_press_langevin.cpp
index 8116d66c0a..47a6d71f43 100644
--- a/src/fix_press_langevin.cpp
+++ b/src/fix_press_langevin.cpp
@@ -421,8 +421,12 @@ void FixPressLangevin::init()
// set pressure ptr
pressure = modify->get_compute_by_id(id_press);
- if (!pressure)
- error->all(FLERR, "Pressure compute ID {} for fix press/langevin does not exist", id_press);
+ if (!pressure) {
+ error->all(FLERR, "Pressure compute ID {} for fix {} does not exist", id_press, style);
+ } else {
+ if (pressure->pressflag == 0)
+ error->all(FLERR,"Compute ID {} for fix {} does not compute pressure", id_press, style);
+ }
// Kspace setting
diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp
index ea2ffeb2c0..eb9d4fd545 100644
--- a/src/fix_temp_berendsen.cpp
+++ b/src/fix_temp_berendsen.cpp
@@ -117,14 +117,17 @@ void FixTempBerendsen::init()
}
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
+ if (!temperature) {
error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
- if (modify->check_rigid_group_overlap(groupbit))
+ if ((modify->check_rigid_group_overlap(groupbit)) && (comm->me == 0))
error->warning(FLERR,"Cannot thermostat atoms in rigid bodies with fix {}", style);
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
}
/* ---------------------------------------------------------------------- */
diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp
index 1a8993675a..6578463a94 100644
--- a/src/fix_temp_rescale.cpp
+++ b/src/fix_temp_rescale.cpp
@@ -110,17 +110,20 @@ void FixTempRescale::init()
if (tstr) {
tvar = input->variable->find(tstr);
if (tvar < 0)
- error->all(FLERR,"Variable name {} for fix temp/rescale does not exist", tstr);
+ error->all(FLERR,"Variable name {} for fix {} does not exist", tstr, style);
if (input->variable->equalstyle(tvar)) tstyle = EQUAL;
- else error->all(FLERR,"Variable {} for fix temp/rescale is invalid style", tstr);
+ else error->all(FLERR,"Variable {} for fix {} is invalid style", tstr, style);
}
temperature = modify->get_compute_by_id(id_temp);
- if (!temperature)
- error->all(FLERR,"Temperature ID {} for fix temp/rescale does not exist", id_temp);
-
- if (temperature->tempbias) which = BIAS;
- else which = NOBIAS;
+ if (!temperature) {
+ error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style);
+ } else {
+ if (temperature->tempflag == 0)
+ error->all(FLERR, "Compute ID {} for fix {} does not compute a temperature", id_temp, style);
+ if (temperature->tempbias) which = BIAS;
+ else which = NOBIAS;
+ }
}
/* ---------------------------------------------------------------------- */
diff --git a/src/input.cpp b/src/input.cpp
index 25211ba848..814f900fbd 100644
--- a/src/input.cpp
+++ b/src/input.cpp
@@ -89,7 +89,7 @@ Variable class which performs computations and text substitutions.
\verbatim embed:rst
This sets up the input processing, processes the *-var* and *-echo*
-command line flags, holds the factory of commands and creates and
+command-line flags, holds the factory of commands and creates and
initializes an instance of the Variable class.
To execute a command, a specific class instance, derived from
@@ -188,7 +188,7 @@ Input::~Input()
This will read lines from *infile*, parse and execute them until the end
of the file is reached. The *infile* pointer will usually point to
-``stdin`` or the input file given with the ``-in`` command line flag.
+``stdin`` or the input file given with the ``-in`` command-line flag.
\endverbatim */
@@ -423,7 +423,7 @@ void Input::write_echo(const std::string &txt)
}
/* ----------------------------------------------------------------------
- parse copy of command line by inserting string terminators
+ parse copy of command-line by inserting string terminators
strip comment = all chars from # on
replace all $ via variable substitution except within quotes
command = first word
@@ -1151,7 +1151,7 @@ void Input::partition()
char *cmd = strstr(line,arg[2]);
- // execute the remaining command line on requested partitions
+ // execute the remaining command-line on requested partitions
if (yesflag) {
if (universe->iworld+1 >= ilo && universe->iworld+1 <= ihi) one(cmd);
diff --git a/src/lammps.cpp b/src/lammps.cpp
index 47540cc66c..1f6a13d8cd 100644
--- a/src/lammps.cpp
+++ b/src/lammps.cpp
@@ -105,7 +105,7 @@ using namespace LAMMPS_NS;
*
* The LAMMPS class manages the components of an MD simulation by creating,
* deleting, and initializing instances of the classes it is composed of,
- * processing command line flags, and providing access to some global properties.
+ * processing command-line flags, and providing access to some global properties.
* The specifics of setting up and running a simulation are handled by the
* individual component class instances. */
@@ -1222,7 +1222,7 @@ const char *LAMMPS::non_pair_suffix() const
}
/* ----------------------------------------------------------------------
- help message for command line options and styles present in executable
+ help message for command-line options and styles present in executable
------------------------------------------------------------------------- */
void _noopt LAMMPS::help()
@@ -1233,7 +1233,7 @@ void _noopt LAMMPS::help()
// if output is a console, use a pipe to a pager for paged output.
// this will avoid the most important help text to rush past the
// user. scrollback buffers are often not large enough. this is most
- // beneficial to windows users, who are not used to command line.
+ // beneficial to windows users, who are not used to command-line.
int use_pager = platform::is_console(fp);
@@ -1255,7 +1255,7 @@ void _noopt LAMMPS::help()
}
}
- // general help message about command line and flags
+ // general help message about command-line and flags
if (has_git_info()) {
fprintf(fp,"\nLarge-scale Atomic/Molecular Massively Parallel Simulator - "
@@ -1266,7 +1266,7 @@ void _noopt LAMMPS::help()
}
fprintf(fp,
"Usage example: %s -var t 300 -echo screen -in in.alloy\n\n"
- "List of command line options supported by this LAMMPS executable:\n\n"
+ "List of command-line options supported by this LAMMPS executable:\n\n"
"-echo none/screen/log/both : echoing of input script (-e)\n"
"-help : print this help message (-h)\n"
"-in none/filename : read input from file or stdin (default) (-i)\n"
diff --git a/src/lammps.h b/src/lammps.h
index 989adb2849..f155099ac2 100644
--- a/src/lammps.h
+++ b/src/lammps.h
@@ -73,7 +73,7 @@ class LAMMPS {
MPI_Comm external_comm; // MPI comm encompassing external programs
// when multiple programs launched by mpirun
- // set by -mpicolor command line arg
+ // set by -mpicolor command-line arg
void *mdicomm; // for use with MDI code coupling library
diff --git a/src/library.cpp b/src/library.cpp
index 2f915f1baf..cee1304db6 100644
--- a/src/library.cpp
+++ b/src/library.cpp
@@ -129,7 +129,7 @@ The :cpp:func:`lammps_open` function creates a new :cpp:class:`LAMMPS
as if they were :doc:`command-line arguments ` for the
LAMMPS executable, and an MPI communicator for LAMMPS to run under.
Since the list of arguments is **exactly** as when called from the
-command line, the first argument would be the name of the executable and
+command-line, the first argument would be the name of the executable and
thus is otherwise ignored. However ``argc`` may be set to 0 and then
``argv`` may be ``NULL``. If MPI is not yet initialized, ``MPI_Init()``
will be called during creation of the LAMMPS class instance.
@@ -163,8 +163,8 @@ fails a null pointer is returned.
\endverbatim
*
- * \param argc number of command line arguments
- * \param argv list of command line argument strings
+ * \param argc number of command-line arguments
+ * \param argv list of command-line argument strings
* \param comm MPI communicator for this LAMMPS instance
* \param ptr pointer to a void pointer variable which serves
* as a handle; may be ``NULL``
@@ -230,8 +230,8 @@ fails a null pointer is returned.
\endverbatim
*
- * \param argc number of command line arguments
- * \param argv list of command line argument strings
+ * \param argc number of command-line arguments
+ * \param argv list of command-line argument strings
* \param ptr pointer to a void pointer variable
* which serves as a handle; may be ``NULL``
* \return pointer to new LAMMPS instance cast to ``void *`` */
@@ -264,8 +264,8 @@ fails a null pointer is returned.
\endverbatim
*
- * \param argc number of command line arguments
- * \param argv list of command line argument strings
+ * \param argc number of command-line arguments
+ * \param argv list of command-line argument strings
* \param f_comm Fortran style MPI communicator for this LAMMPS instance
* \return pointer to new LAMMPS instance cast to ``void *`` */
@@ -592,7 +592,7 @@ This function tells LAMMPS to execute the single command in the string
(final) newline character. Newline characters in the body of the
string, however, will be treated as part of the command and will **not**
start a second command. The function :cpp:func:`lammps_commands_string`
-processes a string with multiple command lines.
+processes a string with multiple command-lines.
The function returns the name of the command on success or ``NULL`` when
passing a string without a command.
diff --git a/src/lmptype.h b/src/lmptype.h
index ab3c97d5ad..26796c6ded 100644
--- a/src/lmptype.h
+++ b/src/lmptype.h
@@ -64,6 +64,13 @@ namespace LAMMPS_NS {
#define HISTMASK 0xDFFFFFFF
#define SPECIALMASK 0x3FFFFFFF
+// mask to curb data sizes when calling memcpy() to avoid bogus compiler warnings
+#if UINTPTR_MAX > (1UL<<63)
+static constexpr uint64_t MEMCPYMASK = (static_cast(1) << 63) - 1U;
+#else
+static constexpr uint32_t MEMCPYMASK = (static_cast(1) << 31) - 1U;
+#endif
+
// default to 32-bit smallint and other ints, 64-bit bigint
#if !defined(LAMMPS_SMALLSMALL) && !defined(LAMMPS_BIGBIG) && !defined(LAMMPS_SMALLBIG)
diff --git a/src/update.cpp b/src/update.cpp
index 08f9147b5d..4140a31731 100644
--- a/src/update.cpp
+++ b/src/update.cpp
@@ -308,7 +308,7 @@ void Update::set_units(const char *style)
neighbor->skin = 0.1;
} else
- error->all(FLERR, "Illegal units command");
+ error->all(FLERR, "Unknown units style {}", style);
delete[] unit_style;
unit_style = utils::strdup(style);
@@ -325,7 +325,7 @@ void Update::set_units(const char *style)
void Update::create_integrate(int narg, char **arg, int trysuffix)
{
- if (narg < 1) error->all(FLERR, "Illegal run_style command");
+ if (narg < 1) utils::missing_cmd_args(FLERR, "run_style", error);
delete[] integrate_style;
delete integrate;
@@ -390,14 +390,14 @@ void Update::new_integrate(char *style, int narg, char **arg, int trysuffix, int
return;
}
- error->all(FLERR, "Illegal integrate style");
+ error->all(FLERR, "Unknown integrate style {}", style);
}
/* ---------------------------------------------------------------------- */
void Update::create_minimize(int narg, char **arg, int trysuffix)
{
- if (narg < 1) error->all(FLERR, "Illegal minimize_style command");
+ if (narg < 1) utils::missing_cmd_args(FLERR, "minimize_style", error);
delete[] minimize_style;
delete minimize;
@@ -457,7 +457,7 @@ void Update::new_minimize(char *style, int /* narg */, char ** /* arg */, int tr
return;
}
- error->all(FLERR, "Illegal minimize style");
+ error->all(FLERR, "Unknown minimize style {}", style);
}
/* ----------------------------------------------------------------------
diff --git a/src/utils.h b/src/utils.h
index 200963ff28..1ed514cca4 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -509,7 +509,7 @@ This functions adds the following case to :cpp:func:`utils::bounds() `
-or the *-suffix/-sf* command line flag and return correspondingly modified string.
+or the *-suffix/-sf* command-line flag and return correspondingly modified string.
\endverbatim
*
@@ -609,7 +609,7 @@ or the *-suffix/-sf* command line flag and return correspondingly modified strin
* This can handle strings with single and double quotes, escaped quotes,
* and escaped codes within quotes, but due to using an STL container and
* STL strings is rather slow because of making copies. Designed for
- * parsing command lines and similar text and not for time critical
+ * parsing command-lines and similar text and not for time critical
* processing. Use a tokenizer class if performance matters.
*
\verbatim embed:rst
diff --git a/src/variable.cpp b/src/variable.cpp
index b0667b9941..135882fde9 100644
--- a/src/variable.cpp
+++ b/src/variable.cpp
@@ -4739,7 +4739,7 @@ int Variable::special_function(const std::string &word, char *contents, Tree **t
double *result;
memory->create(result,atom->nlocal,"variable:result");
- memcpy(result,reader[ivar]->fixstore->vstore,atom->nlocal*sizeof(double));
+ memcpy(result,reader[ivar]->fixstore->vstore,(atom->nlocal*sizeof(double))&MEMCPYMASK);
int done = reader[ivar]->read_peratom();
if (done) remove(ivar);
diff --git a/src/write_dump.cpp b/src/write_dump.cpp
index 1932f08186..71d955dc1f 100644
--- a/src/write_dump.cpp
+++ b/src/write_dump.cpp
@@ -43,7 +43,7 @@ void WriteDump::command(int narg, char **arg)
if (strcmp(arg[modindex], "modify") == 0) break;
// create the Dump instance
- // create dump command line with extra required args
+ // create dump command-line with extra required args
// work around "fix not computed at compatible times" errors.
diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt
index 5ac23daac7..aee806c81a 100644
--- a/tools/lammps-gui/CMakeLists.txt
+++ b/tools/lammps-gui/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
-project(lammps-gui VERSION 1.6.11 LANGUAGES CXX)
+project(lammps-gui VERSION 1.6.12 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
@@ -92,6 +92,49 @@ else()
endif()
endif()
+option(BUILD_WHAM "Download and compile WHAM executable from Grossfield Lab" YES)
+if(BUILD_WHAM)
+ set(WHAM_URL "http://membrane.urmc.rochester.edu/sites/default/files/wham/wham-release-2.0.11.tgz" CACHE STRING "URL for WHAM tarball")
+ set(WHAM_MD5 "f56751ac71a8d1c485b9ebd4ccff8dbe" CACHE STRING "MD5 checksum of WHAM tarball")
+ mark_as_advanced(WHAM_URL)
+ mark_as_advanced(WHAM_MD5)
+
+ get_filename_component(archive ${WHAM_URL} NAME)
+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
+ if(EXISTS ${CMAKE_BINARY_DIR}/_deps/${archive})
+ file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
+ endif()
+ if(NOT "${DL_MD5}" STREQUAL "${WHAM_MD5}")
+ message(STATUS "Downloading ${WHAM_URL}")
+ file(DOWNLOAD ${WHAM_URL} ${CMAKE_BINARY_DIR}/_deps/${archive} STATUS DL_STATUS SHOW_PROGRESS)
+ file(MD5 ${CMAKE_BINARY_DIR}/_deps/${archive} DL_MD5)
+ if((NOT DL_STATUS EQUAL 0) OR (NOT "${DL_MD5}" STREQUAL "${WHAM_MD5}"))
+ message(ERROR "Download of WHAM sources from ${WHAM_URL} failed")
+ endif()
+ else()
+ message(STATUS "Using already downloaded archive ${CMAKE_BINARY_DIR}/_deps/${archive}")
+ endif()
+ message(STATUS "Unpacking and configuring ${archive}")
+
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf ${CMAKE_BINARY_DIR}/_deps/${archive}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src)
+ find_package(Patch)
+ if(PATCH_FOUND)
+ message(STATUS "Apply patch to customize WHAM using ${Patch_EXECUTABLE}")
+ execute_process(
+ COMMAND ${Patch_EXECUTABLE} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/update-wham-2.0.11.patch
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/_deps/src/wham/
+ )
+ endif()
+ file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/_deps/wham-src)
+ file(RENAME "${CMAKE_BINARY_DIR}/_deps/src/wham" ${CMAKE_BINARY_DIR}/_deps/wham-src)
+ file(COPY CMakeLists.wham DESTINATION ${CMAKE_BINARY_DIR}/_deps/wham-src/)
+ file(RENAME "${CMAKE_BINARY_DIR}/_deps/wham-src/CMakeLists.wham"
+ "${CMAKE_BINARY_DIR}/_deps/wham-src/CMakeLists.txt")
+ add_subdirectory("${CMAKE_BINARY_DIR}/_deps/wham-src" "${CMAKE_BINARY_DIR}/_deps/wham-build")
+ set(WHAM_EXE wham wham-2d)
+endif()
+
set(LAMMPS_PLUGINLIB_DIR ${LAMMPS_DIR}/examples/COUPLE/plugin)
if(LAMMPS_GUI_USE_PLUGIN)
if(APPLE)
@@ -130,6 +173,8 @@ set(PROJECT_SOURCES
codeeditor.h
findandreplace.cpp
findandreplace.h
+ flagwarnings.cpp
+ flagwarnings.h
helpers.cpp
highlighter.cpp
highlighter.h
@@ -267,6 +312,15 @@ if(APPLE)
else()
message(FATAL_ERROR "Must use -D BUILD_TOOLS=yes for building app bundle")
endif()
+ if(BUILD_WHAM)
+ add_custom_target(copy-wham
+ ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/wham ${APP_CONTENTS}/bin/
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/wham-2d ${APP_CONTENTS}/bin/
+ DEPENDS complete-bundle wham wham-2d
+ COMMENT "Copying WHAM executables into macOS app bundle tree"
+ )
+ set(WHAM_TARGET copy-wham)
+ endif()
if(FFMPEG_EXECUTABLE)
add_custom_target(copy-ffmpeg
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FFMPEG_EXECUTABLE} ${APP_CONTENTS}/bin/
@@ -277,7 +331,7 @@ if(APPLE)
endif()
add_custom_target(dmg
COMMAND ${LAMMPS_DIR}/cmake/packaging/build_macos_dmg.sh ${LAMMPS_RELEASE}
- DEPENDS complete-bundle ${FFMPEG_TARGET}
+ DEPENDS complete-bundle ${WHAM_TARGET} ${FFMPEG_TARGET}
COMMENT "Create Drag-n-Drop installer disk image from app bundle"
BYPRODUCT LAMMPS-macOS-multiarch-${LAMMPS_VERSION}.dmg
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
@@ -312,7 +366,7 @@ elseif((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING)
install(FILES $ TYPE BIN)
add_custom_target(zip
COMMAND sh -vx ${LAMMPS_DIR}/cmake/packaging/build_windows_cross_zip.sh ${CMAKE_INSTALL_PREFIX} ${LAMMPS_RELEASE}
- DEPENDS lmp lammps-gui
+ DEPENDS lmp lammps-gui ${WHAM_EXE}
COMMENT "Create zip file with windows binaries"
BYPRODUCT LAMMPS-Win10-amd64-${LAMMPS_VERSION}.zip
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
@@ -349,7 +403,7 @@ elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND NOT LAMMPS_GUI_USE_PLUGIN)
add_custom_target(tgz
COMMAND ${LAMMPS_DIR}/cmake/packaging/build_linux_tgz.sh ${LAMMPS_RELEASE}
- DEPENDS lammps-gui
+ DEPENDS lammps-gui ${WHAM_EXE}
COMMENT "Create compressed tar file of LAMMPS-GUI with dependent libraries and wrapper"
BYPRODUCT LAMMPS-Linux-amd64-${LAMMPS_RELEASE}.tar.gz
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
diff --git a/tools/lammps-gui/CMakeLists.wham b/tools/lammps-gui/CMakeLists.wham
new file mode 100644
index 0000000000..ff2ab3349d
--- /dev/null
+++ b/tools/lammps-gui/CMakeLists.wham
@@ -0,0 +1,37 @@
+# Custom minimal -*- CMake -*- file for libyaml
+
+cmake_minimum_required(VERSION 3.16)
+project(wham VERSION 2.0.11
+ DESCRIPTION "WHAM: a fast, memory efficient implementation of the Weighted Histogram Analysis Method"
+ LANGUAGES C
+ HOMEPAGE_URL http://membrane.urmc.rochester.edu/content/wham/)
+
+set(CMAKE_AUTOUIC OFF)
+set(CMAKE_AUTOMOC OFF)
+set(CMAKE_AUTORCC OFF)
+
+include(GNUInstallDirs)
+
+add_executable(wham
+ nr/ran2.c
+ nr/locate.c
+ wham/wham.c
+ wham/file_read.c
+ wham/histogram.c
+ wham/bootstrap.c
+)
+target_include_directories(wham PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/wham)
+target_link_libraries(wham PRIVATE m)
+install(TARGETS wham DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+add_executable(wham-2d
+ nr/ran2.c
+ nr/locate.c
+ wham-2d/wham-2d.c
+ wham-2d/file_read.c
+ wham-2d/histogram.c
+ wham/bootstrap.c
+)
+target_include_directories(wham-2d PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/wham)
+target_link_libraries(wham-2d PRIVATE m)
+install(TARGETS wham-2d DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/tools/lammps-gui/TODO.md b/tools/lammps-gui/TODO.md
index b36f0a4ce8..17fa4c04ee 100644
--- a/tools/lammps-gui/TODO.md
+++ b/tools/lammps-gui/TODO.md
@@ -2,6 +2,7 @@ LAMMPS-GUI TODO list:
# Short term goals (v1.x)
+- add a preferences option to override light/dark theme setting and add choice for theme
- implement a timed "Auto-Save" feature that saves after some idle time. set timeout in Editor preferences.
- add a "Filter data" checkbox to the "Charts" window to select whether data should be dropped.
- add a "Charts tab" to the preferences with the following (default) settings:
@@ -9,7 +10,7 @@ LAMMPS-GUI TODO list:
- default smooth parameters
- default plot colors
- enable "raw" or "smooth" or "both"
-- add QLineEdit field to enter plot title
+- add QLineEdit fields to enter plot title, axis labels and units
- add a "Colors" menu to the image viewer to adjust color settings for the
current image (unlike the defaults in the perferences) including assigning
colors to individual atom types.
diff --git a/tools/lammps-gui/flagwarnings.cpp b/tools/lammps-gui/flagwarnings.cpp
new file mode 100644
index 0000000000..e91547288f
--- /dev/null
+++ b/tools/lammps-gui/flagwarnings.cpp
@@ -0,0 +1,59 @@
+/* ----------------------------------------------------------------------
+ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
+ https://www.lammps.org/, Sandia National Laboratories
+ LAMMPS development team: developers@lammps.org
+
+ Copyright (2003) Sandia Corporation. Under the terms of Contract
+ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
+ certain rights in this software. This software is distributed under
+ the GNU General Public License.
+
+ See the README file in the top-level LAMMPS directory.
+------------------------------------------------------------------------- */
+
+#include "flagwarnings.h"
+
+#include "helpers.h"
+
+#include
+#include
+#include
+#include
+
+// workaround for Qt-5.12
+#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
+namespace QColorConstants {
+const QColor Red = QColor::fromRgb(0xff, 0x00, 0x00);
+} // namespace QColorConstants
+#endif
+
+FlagWarnings::FlagWarnings(QLabel *label, QTextDocument *parent) :
+ QSyntaxHighlighter(parent), isWarning(QStringLiteral("^(ERROR|WARNING).*$")), summary(label),
+ document(parent)
+{
+ nwarnings = nlines = 0;
+
+ formatWarning.setForeground(QColorConstants::Red);
+ formatWarning.setFontWeight(QFont::Bold);
+}
+
+void FlagWarnings::highlightBlock(const QString &text)
+{
+ // nothing to do for empty lines
+ if (text.isEmpty()) return;
+
+ auto match = isWarning.match(text);
+ if (match.hasMatch()) {
+ ++nwarnings;
+ setFormat(match.capturedStart(0), match.capturedLength(0), formatWarning);
+ }
+ if (document && summary) {
+ summary->setText(
+ QString("%1 Warnings / Errors - %2 Lines").arg(nwarnings).arg(document->lineCount()));
+ summary->repaint();
+ }
+}
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/tools/lammps-gui/flagwarnings.h b/tools/lammps-gui/flagwarnings.h
new file mode 100644
index 0000000000..ad82942d62
--- /dev/null
+++ b/tools/lammps-gui/flagwarnings.h
@@ -0,0 +1,44 @@
+/* -*- c++ -*- ----------------------------------------------------------
+ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
+ https://www.lammps.org/, Sandia National Laboratories
+ LAMMPS development team: developers@lammps.org
+
+ Copyright (2003) Sandia Corporation. Under the terms of Contract
+ DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
+ certain rights in this software. This software is distributed under
+ the GNU General Public License.
+
+ See the README file in the top-level LAMMPS directory.
+------------------------------------------------------------------------- */
+
+#ifndef FLAGWARNINGS_H
+#define FLAGWARNINGS_H
+
+#include
+#include
+#include
+
+class QLabel;
+class QTextDocument;
+
+class FlagWarnings : public QSyntaxHighlighter {
+ Q_OBJECT
+
+public:
+ FlagWarnings(QLabel *label = 0, QTextDocument *parent = 0);
+ int get_nwarnings() const { return nwarnings; }
+
+protected:
+ void highlightBlock(const QString &text) override;
+
+private:
+ QRegularExpression isWarning;
+ QTextCharFormat formatWarning;
+ QLabel *summary;
+ QTextDocument *document;
+ int nwarnings, nlines;
+};
+#endif
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/tools/lammps-gui/icons/tutorial1-logo.png b/tools/lammps-gui/icons/tutorial1-logo.png
index d54cda9113..912c1189af 100644
Binary files a/tools/lammps-gui/icons/tutorial1-logo.png and b/tools/lammps-gui/icons/tutorial1-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial2-logo.png b/tools/lammps-gui/icons/tutorial2-logo.png
index dc661decb3..19d749756c 100644
Binary files a/tools/lammps-gui/icons/tutorial2-logo.png and b/tools/lammps-gui/icons/tutorial2-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial3-logo.png b/tools/lammps-gui/icons/tutorial3-logo.png
new file mode 100644
index 0000000000..caa0fa7b22
Binary files /dev/null and b/tools/lammps-gui/icons/tutorial3-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial4-logo.png b/tools/lammps-gui/icons/tutorial4-logo.png
new file mode 100644
index 0000000000..2466f32c79
Binary files /dev/null and b/tools/lammps-gui/icons/tutorial4-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial5-logo.png b/tools/lammps-gui/icons/tutorial5-logo.png
new file mode 100644
index 0000000000..6dacf3d4d2
Binary files /dev/null and b/tools/lammps-gui/icons/tutorial5-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial6-logo.png b/tools/lammps-gui/icons/tutorial6-logo.png
new file mode 100644
index 0000000000..1ed94e6511
Binary files /dev/null and b/tools/lammps-gui/icons/tutorial6-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial7-logo.png b/tools/lammps-gui/icons/tutorial7-logo.png
new file mode 100644
index 0000000000..c4217e4b67
Binary files /dev/null and b/tools/lammps-gui/icons/tutorial7-logo.png differ
diff --git a/tools/lammps-gui/icons/tutorial8-logo.png b/tools/lammps-gui/icons/tutorial8-logo.png
new file mode 100644
index 0000000000..17469c4e17
Binary files /dev/null and b/tools/lammps-gui/icons/tutorial8-logo.png differ
diff --git a/tools/lammps-gui/icons/warning.png b/tools/lammps-gui/icons/warning.png
new file mode 100644
index 0000000000..72dae39766
Binary files /dev/null and b/tools/lammps-gui/icons/warning.png differ
diff --git a/tools/lammps-gui/imageviewer.cpp b/tools/lammps-gui/imageviewer.cpp
index 0b3c58abd3..94405e04ff 100644
--- a/tools/lammps-gui/imageviewer.cpp
+++ b/tools/lammps-gui/imageviewer.cpp
@@ -494,7 +494,7 @@ void ImageViewer::do_recenter()
"variable LAMMPSGUI_CX equal (xcm(%1,x)-xlo)/lx\n"
"variable LAMMPSGUI_CY equal (xcm(%1,y)-ylo)/ly\n"
"variable LAMMPSGUI_CZ equal (xcm(%1,z)-zlo)/lz\n").arg(group);
- lammps->commands_string(commands.toLocal8Bit());
+ lammps->commands_string(commands);
xcenter = lammps->extract_variable("LAMMPSGUI_CX");
ycenter = lammps->extract_variable("LAMMPSGUI_CZ");
zcenter = lammps->extract_variable("LAMMPSGUI_CZ");
@@ -667,7 +667,7 @@ void ImageViewer::createImage()
settings.endGroup();
last_dump_cmd = dumpcmd;
- lammps->command(dumpcmd.toLocal8Bit());
+ lammps->command(dumpcmd);
QImageReader reader(dumpfile.fileName());
reader.setAutoTransform(true);
diff --git a/tools/lammps-gui/lammps-gui.appdata.xml b/tools/lammps-gui/lammps-gui.appdata.xml
index 1f74fc479c..abf0a4bf45 100644
--- a/tools/lammps-gui/lammps-gui.appdata.xml
+++ b/tools/lammps-gui/lammps-gui.appdata.xml
@@ -46,6 +46,7 @@
Physics
Editor
N-body
+ Simulation
@@ -54,11 +55,19 @@
+
+
+ Update Tutorial menu entries to cover all 8 tutorials
+ Highlight warnings and error messages in Output window
+ Make Tutorial wizards more compact
+ Include download and compilation of WHAM software from Alan Grossfield
+
+
- move cursor to end of log buffer before inserting new text
- remove empirical filter to remove outliers from corrupted data
- change tutorial download URL to tutorial website
+ Move cursor to end of log buffer before inserting new text
+ Remove empirical filter to remove outliers from corrupted data
+ Change tutorial download URL to tutorial website
diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp
index fb38b6fc92..8749e24821 100644
--- a/tools/lammps-gui/lammpsgui.cpp
+++ b/tools/lammps-gui/lammpsgui.cpp
@@ -217,6 +217,12 @@ LammpsGui::LammpsGui(QWidget *parent, const QString &filename) :
connect(ui->actionLAMMPS_Tutorial, &QAction::triggered, this, &LammpsGui::tutorial_web);
connect(ui->actionTutorial1, &QAction::triggered, this, &LammpsGui::start_tutorial1);
connect(ui->actionTutorial2, &QAction::triggered, this, &LammpsGui::start_tutorial2);
+ connect(ui->actionTutorial3, &QAction::triggered, this, &LammpsGui::start_tutorial3);
+ connect(ui->actionTutorial4, &QAction::triggered, this, &LammpsGui::start_tutorial4);
+ connect(ui->actionTutorial5, &QAction::triggered, this, &LammpsGui::start_tutorial5);
+ connect(ui->actionTutorial6, &QAction::triggered, this, &LammpsGui::start_tutorial6);
+ connect(ui->actionTutorial7, &QAction::triggered, this, &LammpsGui::start_tutorial7);
+ connect(ui->actionTutorial8, &QAction::triggered, this, &LammpsGui::start_tutorial8);
connect(ui->actionAbout_LAMMPS_GUI, &QAction::triggered, this, &LammpsGui::about);
connect(ui->action_Help, &QAction::triggered, this, &LammpsGui::help);
connect(ui->actionLAMMPS_GUI_Howto, &QAction::triggered, this, &LammpsGui::howto);
@@ -438,9 +444,7 @@ void LammpsGui::open_recent()
void LammpsGui::get_directory()
{
if (wizard) {
- // figure out which wizard we are following
- auto *line = wizard->findChild("t1_directory");
- if (!line) line = wizard->findChild("t2_directory");
+ auto *line = wizard->findChild("t_directory");
if (line) {
auto curdir = line->text();
QFileDialog dialog(this, "Choose Directory for Tutorial Files", curdir);
@@ -489,14 +493,14 @@ void LammpsGui::start_exe()
vmdfile.write(".psf}\n");
vmdfile.close();
args << "-e" << vmdfile.fileName();
- lammps.command(datacmd.toLocal8Bit());
+ lammps.command(datacmd);
auto *vmd = new QProcess(this);
vmd->start(exe, args);
}
if (exe == "ovito") {
QStringList args;
args << datafile.fileName();
- lammps.command(datacmd.toLocal8Bit());
+ lammps.command(datacmd);
auto *ovito = new QProcess(this);
ovito->start(exe, args);
}
@@ -796,7 +800,7 @@ void LammpsGui::inspect_file(const QString &fileName)
start_lammps();
lammps.command("clear");
- lammps.command(QString("read_restart %1").arg(fileName).toLocal8Bit());
+ lammps.command(QString("read_restart %1").arg(fileName));
capturer->BeginCapture();
lammps.command("info system group compute fix");
capturer->EndCapture();
@@ -812,7 +816,7 @@ void LammpsGui::inspect_file(const QString &fileName)
infoviewer->show();
ilist->info = infoviewer;
dumpinfo.remove();
- lammps.command(QString("write_data %1 pair ij noinit").arg(infodata).toLocal8Bit());
+ lammps.command(QString("write_data %1 pair ij noinit").arg(infodata));
auto *dataviewer =
new FileViewer(infodata, QString("LAMMPS-GUI: data file for %1").arg(shortName));
dataviewer->show();
@@ -1219,7 +1223,7 @@ void LammpsGui::do_run(bool use_buffer)
// define "gui_run" variable set to run_counter value
lammps.command("variable gui_run delete");
- lammps.command(std::string("variable gui_run index " + std::to_string(run_counter)).c_str());
+ lammps.command(std::string("variable gui_run index " + std::to_string(run_counter)));
if (use_buffer) {
// always add final newline since the text edit widget does not do it
char *input = mystrdup(ui->textEdit->toPlainText() + "\n");
@@ -1240,7 +1244,7 @@ void LammpsGui::do_run(bool use_buffer)
logwindow->setCenterOnScroll(true);
logwindow->moveCursor(QTextCursor::End);
logwindow->setWindowTitle(
- QString("LAMMPS-GUI - Output - %2 - Run %3").arg(current_file).arg(run_counter));
+ QString("LAMMPS-GUI - Output - %1 - Run %2").arg(current_file).arg(run_counter));
logwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
QFont text_font;
text_font.fromString(settings.value("textfont", text_font.toString()).toString());
@@ -1307,7 +1311,7 @@ void LammpsGui::render_image()
selection += "\nrun 0 pre yes post no";
ui->textEdit->setTextCursor(saved);
lammps.command("clear");
- lammps.commands_string(selection.toStdString().c_str());
+ lammps.commands_string(selection);
// clear any possible error status
lammps.get_last_error_message(nullptr, 0);
}
@@ -1560,287 +1564,255 @@ void LammpsGui::tutorial_web()
QDesktopServices::openUrl(QUrl("https://lammpstutorials.github.io/"));
}
+QWizardPage *LammpsGui::tutorial_intro(const int ntutorial, const QString &infotext)
+{
+ auto *page = new QWizardPage;
+ page->setTitle(QString("Getting Started With Tutorial %1").arg(ntutorial));
+ page->setPixmap(QWizard::WatermarkPixmap,
+ QPixmap(QString(":/icons/tutorial%1-logo.png").arg(ntutorial)));
+
+ // XXX TODO: update URL to published tutorial DOI
+ auto *label = new QLabel(
+ QString("This dialog will help you to select and populate a folder with materials "
+ "required to work through tutorial ") +
+ QString::number(ntutorial) +
+ QString(" from the LAMMPS tutorials article by Simon Gravelle, Jake Gissinger, and Axel "
+ "Kohlmeyer.
The materials for this tutorial are downloaded from:
https://"
+ "github.com/lammpstutorials/lammpstutorials-article
") +
+ infotext);
+ label->setWordWrap(true);
+
+ auto *layout = new QVBoxLayout;
+ layout->addWidget(label);
+ page->setLayout(layout);
+ return page;
+}
+
+QWizardPage *LammpsGui::tutorial_directory(const int ntutorial)
+{
+ auto *page = new QWizardPage;
+ page->setTitle(QString("Select Directory for Tutorial %1").arg(ntutorial));
+ page->setPixmap(QWizard::WatermarkPixmap,
+ QPixmap(QString(":/icons/tutorial%1-logo.png").arg(ntutorial)));
+
+ auto *frame = new QFrame;
+ auto *label = new QLabel(
+ QString("Select a directory to store the files for tutorial %1. The directory will be "
+ "created if necessary and LAMMPS-GUI will download the files required for the "
+ "tutorial. If selected, an existing directory may be cleared from old "
+ "files.
\nAvailable files of the tutorial solution may be downloaded to a "
+ "sub-folder \"solution\", if requested.
\n")
+ .arg(ntutorial));
+ label->setWordWrap(true);
+
+ auto *dirlayout = new QHBoxLayout;
+ auto *directory = new QLineEdit;
+
+ // if we are already in a tutorial folder, stay there or pick folder in same parent dir
+ bool haveDir = false;
+ for (int i = 1; i < 99; ++i) {
+ if (current_dir.endsWith(QString("tutorial%1").arg(i))) {
+ if (i > 9) { // We assume there are no more than 99 tutorials
+ current_dir.chop(2);
+ } else {
+ current_dir.chop(1);
+ }
+ current_dir.append(QString::number(ntutorial));
+ haveDir = true;
+ }
+ }
+
+ // if current dir is home, or application folder, switch to desktop path
+ if ((current_dir == QDir::homePath()) || current_dir.contains("AppData") ||
+ current_dir.contains("Program Files")) {
+ current_dir = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
+ }
+ if (!haveDir) current_dir.append(QString("/tutorial%1").arg(ntutorial));
+ directory->setText(current_dir);
+
+ auto *dirbutton = new QPushButton("&Choose");
+ dirlayout->addWidget(directory);
+ dirlayout->addWidget(dirbutton);
+ directory->setObjectName("t_directory");
+ connect(dirbutton, &QPushButton::released, this, &LammpsGui::get_directory);
+
+ auto *grid = new QGridLayout;
+ auto *purgeval = new QCheckBox;
+ auto *solval = new QCheckBox;
+ auto *purgelabel = new QLabel("Remove existing files from directory");
+ auto *sollabel = new QLabel("Download solutions");
+ purgeval->setCheckState(Qt::Unchecked);
+ purgeval->setObjectName("t_dirpurge");
+ solval->setCheckState(Qt::Unchecked);
+ solval->setObjectName("t_getsolution");
+ grid->addWidget(purgeval, 0, 0, Qt::AlignVCenter);
+ grid->addWidget(purgelabel, 0, 1, Qt::AlignVCenter);
+ grid->addWidget(solval, 1, 0, Qt::AlignVCenter);
+ grid->addWidget(sollabel, 1, 1, Qt::AlignVCenter);
+ grid->setColumnStretch(0, 0);
+ grid->setColumnStretch(1, 100);
+
+ auto *label2 = new QLabel(
+ QString("
\nClick on "
+ "the \"Finish\" button to complete the setup and start the download.
"));
+ label->setWordWrap(true);
+
+ auto *layout = new QVBoxLayout(frame);
+ layout->addWidget(label);
+ layout->addLayout(dirlayout);
+ layout->addLayout(grid);
+ layout->addWidget(label2);
+
+ page->setLayout(layout);
+ return page;
+}
+
void LammpsGui::start_tutorial1()
{
if (wizard) delete wizard;
- wizard = new Tutorial1Wizard;
+ wizard = new TutorialWizard(1);
+ const auto infotext =
+ QString("In tutorial 1 you will learn about LAMMPS input files, their syntax and "
+ "structure, how to create and set up models and their interactions, how to run a "
+ "minimization and a molecular dynamics trajectory, how to plot thermodynamic data "
+ "and how to create visualizations of your system
\nClick on the \"Next\" button to select a folder.
");
wizard->setFont(font());
- wizard->addPage(tutorial1_intro());
- wizard->addPage(tutorial1_info());
- wizard->addPage(tutorial1_directory());
- wizard->addPage(tutorial1_finish());
+ wizard->addPage(tutorial_intro(1, infotext));
+ wizard->addPage(tutorial_directory(1));
wizard->setWindowTitle("Tutorial 1 Setup Wizard");
wizard->setWizardStyle(QWizard::ModernStyle);
wizard->show();
}
-QWizardPage *LammpsGui::tutorial1_intro()
-{
- auto *page = new QWizardPage;
- page->setTitle("Getting Started With Tutorial 1");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial1-logo.png"));
-
- // XXX TODO: update URL to published tutorial DOI
- auto *label =
- new QLabel("This wizard will help you to select and populate a folder with "
- "materials required to work through tutorial 1 from a fourthcoming "
- "LAMMPS tutorial using LAMMPS-GUI by Simon Gravelle, Jake Gissinger, "
- "and Axel Kohlmeyer.
\n"
- "The work-in-progress materials for this tutorial are available at: "
- "github.com/lammpstutorials/lammpstutorials-article
\n"
- "
\n"
- "Click on the \"Next\" button to begin.
");
- label->setWordWrap(true);
-
- auto *layout = new QVBoxLayout;
- layout->addWidget(label);
- page->setLayout(layout);
- return page;
-}
-
-QWizardPage *LammpsGui::tutorial1_info()
-{
- auto *page = new QWizardPage;
- page->setTitle("Contents of Tutorial 1");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial1-logo.png"));
-
- auto *label =
- new QLabel("In tutorial 1 you will learn about LAMMPS input files, their syntax and "
- " structure, how to create and set up models and their interactions, how to "
- "run a minimization and a molecular dynamics trajectory, how to plot "
- "thermodynamic data and how to create visualizations of your system
"
- "
\n"
- "Click on the \"Next\" button to select a folder.
");
- label->setWordWrap(true);
-
- auto *layout = new QVBoxLayout;
- layout->addWidget(label);
- page->setLayout(layout);
- return page;
-}
-
-QWizardPage *LammpsGui::tutorial1_directory()
-{
- auto *page = new QWizardPage;
- page->setTitle("Select Directory for Tutorial 1");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial1-logo.png"));
-
- auto *frame = new QFrame;
- auto *label = new QLabel(
- "Select a directory to store the files for tutorial 1. The directory will be "
- "created if necessary and LAMMPS-GUI will download the files required for the "
- "tutorial.
\n"
- "If selected, an existing directory may be cleared.
\n"
- "Also, available files of the tutorial solution may be downloaded to a "
- "folder \"solution\", if requested.
\n"
- "
\n");
- label->setWordWrap(true);
-
- auto *dirlayout = new QHBoxLayout;
- auto *directory = new QLineEdit;
- // if we are already in the tutorial folder, stay there
- if (!current_dir.endsWith("tutorial1")) {
- // if current dir is home, or application folder, switch to desktop path
- if ((current_dir == QDir::homePath()) || current_dir.contains("AppData") ||
- current_dir.contains("Program Files")) {
- current_dir = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
- }
- current_dir += "/tutorial1";
- }
- directory->setText(current_dir);
-
- auto *dirbutton = new QPushButton("&Choose");
- dirlayout->addWidget(directory);
- dirlayout->addWidget(dirbutton);
- directory->setObjectName("t1_directory");
- connect(dirbutton, &QPushButton::released, this, &LammpsGui::get_directory);
-
- auto *grid = new QGridLayout;
- auto *purgeval = new QCheckBox;
- auto *solval = new QCheckBox;
- auto *purgelabel = new QLabel("Remove existing files from directory");
- auto *sollabel = new QLabel("Download solutions");
- purgeval->setCheckState(Qt::Unchecked);
- purgeval->setObjectName("t1_dirpurge");
- solval->setCheckState(Qt::Unchecked);
- solval->setObjectName("t1_getsolution");
- grid->addWidget(purgeval, 0, 0, Qt::AlignVCenter);
- grid->addWidget(purgelabel, 0, 1, Qt::AlignVCenter);
- grid->addWidget(solval, 1, 0, Qt::AlignVCenter);
- grid->addWidget(sollabel, 1, 1, Qt::AlignVCenter);
- grid->setColumnStretch(0, 0);
- grid->setColumnStretch(1, 100);
-
- auto *layout = new QVBoxLayout(frame);
- layout->addWidget(label);
- layout->addLayout(dirlayout);
- layout->addLayout(grid);
-
- page->setLayout(layout);
- return page;
-}
-
-QWizardPage *LammpsGui::tutorial1_finish()
-{
- auto *page = new QWizardPage;
- page->setTitle("Start Tutorial 1");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial1-logo.png"));
-
- auto *label = new QLabel("You are now ready to start tutorial 1.
\n"
- "
\n"
- "Click on the \"Finish\" button to "
- "complete the setup.
");
- label->setWordWrap(true);
-
- auto *layout = new QVBoxLayout;
- layout->addWidget(label);
- layout->setStretch(0, 100);
-
- page->setLayout(layout);
- return page;
-}
-
void LammpsGui::start_tutorial2()
{
if (wizard) delete wizard;
- wizard = new Tutorial2Wizard;
- wizard->addPage(tutorial2_intro());
- wizard->addPage(tutorial2_info());
- wizard->addPage(tutorial2_directory());
- wizard->addPage(tutorial2_finish());
+ wizard = new TutorialWizard(2);
+ const auto infotext =
+ QString("In tutorial 2 you will learn about setting up a simulation for a molecular "
+ "system with bonds. The target is to simulate a carbon nanotube with a "
+ "conventional molecular force field under growing strain and observe the response "
+ "to it. Since bonds are represented by a harmonic potential, they cannot break. "
+ "This is then compared to simulating the same system with a reactive force field "
+ "(AIREBO) where bonds may be broken and formed.
\nClick on the \"Next\" button to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(2, infotext));
+ wizard->addPage(tutorial_directory(2));
wizard->setWindowTitle("Tutorial 2 Setup Wizard");
wizard->setWizardStyle(QWizard::ModernStyle);
wizard->show();
}
-QWizardPage *LammpsGui::tutorial2_intro()
+void LammpsGui::start_tutorial3()
{
- auto *page = new QWizardPage;
- page->setTitle("Getting Started With Tutorial 2");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png"));
-
- // XXX TODO: update URL to published tutorial DOI
- auto *label =
- new QLabel("This wizard will help you to select and populate a folder with "
- "materials required to work through tutorial 2 from a fourthcoming "
- "LAMMPS tutorial using LAMMPS-GUI by Simon Gravelle, Jake Gissinger, "
- "and Axel Kohlmeyer.
\n"
- "The work-in-progress materials for this tutorial are available at: "
- "github.com/lammpstutorials/lammpstutorials-article
\n"
- "
\n"
- "Click on the \"Next\" button to begin.
");
- label->setWordWrap(true);
-
- auto *layout = new QVBoxLayout;
- layout->addWidget(label);
- page->setLayout(layout);
- return page;
+ if (wizard) delete wizard;
+ wizard = new TutorialWizard(3);
+ const auto infotext = QString(
+ "In tutorial 3 you will learn setting up a multi-component, a polymer molecule embedded "
+ "in liquid water. The model employs a long-range Coulomb solver and a stretching force is "
+ "applied to the polymer. This is used to demonstrate how to use the type label facility in "
+ "LAMMPS to make components more generic.
\nClick on the \"Next\" button to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(3, infotext));
+ wizard->addPage(tutorial_directory(3));
+ wizard->setWindowTitle("Tutorial 3 Setup Wizard");
+ wizard->setWizardStyle(QWizard::ModernStyle);
+ wizard->show();
}
-QWizardPage *LammpsGui::tutorial2_info()
+void LammpsGui::start_tutorial4()
{
- auto *page = new QWizardPage;
- page->setTitle("Contents of Tutorial 2");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png"));
-
- auto *label =
- new QLabel("In tutorial 2 you will learn about setting up a simulation for a molecular "
- "system with bonds. The target is to simulate a carbon nanotube with a "
- "conventional molecular force field under growing strain and observe the "
- "response to it. Since bonds are represented by a harmonic potential, they "
- "cannot break. This is then compared to simulating the same system with a "
- "reactive force field (AIREBO) where bonds may be broken and formed.
"
- "
\n"
- "Click on the \"Next\" button to select a folder.
");
- label->setWordWrap(true);
-
- auto *layout = new QVBoxLayout;
- layout->addWidget(label);
- page->setLayout(layout);
- return page;
+ if (wizard) delete wizard;
+ wizard = new TutorialWizard(4);
+ const auto infotext =
+ QString("In tutorial 4 an electrolyte is simulated while confined between two walls and "
+ "thus illustrating the specifics of simulating systems with fluid-solid "
+ "interfaces. The water model is more complex than in tutorial 3 and also a "
+ "non-equilibrium MD simulation is performed by imposing shearing forces on the "
+ "electrolyte through moving the walls.
\nClick on the \"Next\" button to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(4, infotext));
+ wizard->addPage(tutorial_directory(4));
+ wizard->setWindowTitle("Tutorial 4 Setup Wizard");
+ wizard->setWizardStyle(QWizard::ModernStyle);
+ wizard->show();
}
-QWizardPage *LammpsGui::tutorial2_directory()
+void LammpsGui::start_tutorial5()
{
- auto *page = new QWizardPage;
- page->setTitle("Select Directory for Tutorial 2");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png"));
-
- auto *frame = new QFrame;
- auto *label = new QLabel(
- "Select a directory to store the files for tutorial 2. The directory will be "
- "created if necessary and LAMMPS-GUI will download the files required for the "
- "tutorial.
\n"
- "If selected, an existing directory may be cleared.
\n"
- "Also, available files of the tutorial solution may be downloaded to a "
- "folder \"solution\", if requested.
\n"
- "
\n");
- label->setWordWrap(true);
-
- auto *dirlayout = new QHBoxLayout;
- auto *directory = new QLineEdit;
- // if we are already in the tutorial folder, stay there
- if (!current_dir.endsWith("tutorial2")) {
- // if current dir is home, or application folder, switch to desktop path
- if ((current_dir == QDir::homePath()) || current_dir.contains("AppData") ||
- current_dir.contains("Program Files")) {
- current_dir = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
- }
- current_dir += "/tutorial2";
- }
- directory->setText(current_dir);
-
- auto *dirbutton = new QPushButton("&Choose");
- dirlayout->addWidget(directory);
- dirlayout->addWidget(dirbutton);
- directory->setObjectName("t2_directory");
- connect(dirbutton, &QPushButton::released, this, &LammpsGui::get_directory);
-
- auto *grid = new QGridLayout;
- auto *purgeval = new QCheckBox;
- auto *solval = new QCheckBox;
- auto *purgelabel = new QLabel("Remove existing files from directory");
- auto *sollabel = new QLabel("Download solutions");
- purgeval->setCheckState(Qt::Unchecked);
- purgeval->setObjectName("t2_dirpurge");
- solval->setCheckState(Qt::Unchecked);
- solval->setObjectName("t2_getsolution");
- grid->addWidget(purgeval, 0, 0, Qt::AlignVCenter);
- grid->addWidget(purgelabel, 0, 1, Qt::AlignVCenter);
- grid->addWidget(solval, 1, 0, Qt::AlignVCenter);
- grid->addWidget(sollabel, 1, 1, Qt::AlignVCenter);
- grid->setColumnStretch(0, 0);
- grid->setColumnStretch(1, 100);
-
- auto *layout = new QVBoxLayout(frame);
- layout->addWidget(label);
- layout->addLayout(dirlayout);
- layout->addLayout(grid);
-
- page->setLayout(layout);
- return page;
+ if (wizard) delete wizard;
+ wizard = new TutorialWizard(5);
+ const auto infotext =
+ QString("Tutorial 5 demonstrates the use of the ReaxFF reactive force field which "
+ "includes a dynamic bond topology based on determining the bond order. ReaxFF "
+ "includes charge equilibration (QEq) and thus the atoms can change their partial "
+ "charges according to the local environment.
\nClick on the \"Next\" button to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(5, infotext));
+ wizard->addPage(tutorial_directory(5));
+ wizard->setWindowTitle("Tutorial 5 Setup Wizard");
+ wizard->setWizardStyle(QWizard::ModernStyle);
+ wizard->show();
}
-QWizardPage *LammpsGui::tutorial2_finish()
+void LammpsGui::start_tutorial6()
{
- auto *page = new QWizardPage;
- page->setTitle("Start Tutorial 2");
- page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png"));
+ if (wizard) delete wizard;
+ wizard = new TutorialWizard(6);
+ const auto infotext = QString(
+ "In tutorial 6 an MD simulation is combined with Monte Carlo (MC) steps to implement "
+ "a Grand Canonical ensemble. This represents an open system where atoms or "
+ "molecules may be exchanged with a reservoir.
\nClick on the \"Next\" button to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(6, infotext));
+ wizard->addPage(tutorial_directory(6));
+ wizard->setWindowTitle("Tutorial 6 Setup Wizard");
+ wizard->setWizardStyle(QWizard::ModernStyle);
+ wizard->show();
+}
- auto *label = new QLabel("You are now ready to start tutorial 2.
\n"
- "
\n"
- "Click on the \"Finish\" button to "
- "complete the setup.
");
- label->setWordWrap(true);
+void LammpsGui::start_tutorial7()
+{
+ if (wizard) delete wizard;
+ wizard = new TutorialWizard(7);
+ const auto infotext =
+ QString("In tutorial 7 you will determine the height of a free energy barrier through "
+ "using umbrella sampling. This is one of many advanced methods using specific "
+ "reaction coordinates or so-called collective variables to map out relevant parts "
+ "of free energy landscapes, where unbiased MD or MC simulation may take too "
+ "long.
\nClick on the \"Next\" button "
+ "to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(7, infotext));
+ wizard->addPage(tutorial_directory(7));
+ wizard->setWindowTitle("Tutorial 7 Setup Wizard");
+ wizard->setWizardStyle(QWizard::ModernStyle);
+ wizard->show();
+}
- auto *layout = new QVBoxLayout;
- layout->addWidget(label);
- layout->setStretch(0, 100);
-
- page->setLayout(layout);
- return page;
+void LammpsGui::start_tutorial8()
+{
+ if (wizard) delete wizard;
+ wizard = new TutorialWizard(8);
+ const auto infotext =
+ QString("In tutorial 8 a CNT embedded in a Nylon-6,6 polymer melt is simulated. The "
+ "REACTER protocol is used to model the polymerization of Nylon without having to "
+ "employ far more computationally demanding models like ReaxFF. Also, the "
+ "formation of water molecules is tracked over time.
\nClick on the \"Next\" button to select a folder.
");
+ wizard->setFont(font());
+ wizard->addPage(tutorial_intro(8, infotext));
+ wizard->addPage(tutorial_directory(8));
+ wizard->setWindowTitle("Tutorial 8 Setup Wizard");
+ wizard->setWizardStyle(QWizard::ModernStyle);
+ wizard->show();
}
void LammpsGui::howto()
@@ -1983,12 +1955,12 @@ void LammpsGui::start_lammps()
lammps.open(narg, args);
lammpsstatus->show();
- // must have a version newer than the 2 August 2023 release of LAMMPS
+ // must have a version newer than the 29 August 2024 release of LAMMPS
// TODO: must update this check before next feature release
- if (lammps.version() <= 20230802) {
+ if (lammps.version() < 20240829) {
QMessageBox::critical(this, "Incompatible LAMMPS Version",
"LAMMPS-GUI version " LAMMPS_GUI_VERSION " requires\n"
- "a LAMMPS version more recent than 2 August 2023");
+ "a LAMMPS version of at least 29 August 2024");
exit(1);
}
@@ -2017,11 +1989,22 @@ bool LammpsGui::eventFilter(QObject *watched, QEvent *event)
}
// LAMMPS geturl command with current location of the input and solution files on the web
-static const QString geturl = "geturl https://raw.githubusercontent.com/lammpstutorials/"
+static const QString geturl =
+ "geturl https://raw.githubusercontent.com/lammpstutorials/"
"lammpstutorials-article/refs/heads/main/files/tutorial%1/%2 output %2 verify no";
void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, bool getsolution)
{
+ constexpr int BUFLEN = 1024;
+ char errorbuf[BUFLEN];
+
+ if (!lammps.config_has_curl_support()) {
+ QMessageBox::critical(this, "LAMMPS-GUI tutorial files download error",
+ "LAMMPS must be compiled with libcurl to support "
+ "downloading files
");
+ return;
+ }
+
QDir directory(dir);
directory.cd(dir);
@@ -2030,22 +2013,28 @@ void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, boo
start_lammps();
lammps.command("clear");
- lammps.command(QString("shell cd " + dir).toStdString().c_str());
+ lammps.command(QString("shell cd " + dir));
// download and process manifest for selected tutorial
// must check for error after download, e.g. when there is no network.
- lammps.command(geturl.arg(tutno).arg(".manifest").toStdString().c_str());
+ lammps.command(geturl.arg(tutno).arg(".manifest"));
if (lammps.has_error()) {
- constexpr int BUFLEN = 1024;
- char errorbuf[BUFLEN];
lammps.get_last_error_message(errorbuf, BUFLEN);
- QMessageBox::critical(this, "LAMMPS-GUI download error", QString(errorbuf));
+ QMessageBox::critical(this, "LAMMPS-GUI tutorial download error", QString(errorbuf));
return;
}
QFile manifest(".manifest");
QString line, first;
+ struct DownloadItem {
+ DownloadItem(int _n, const QString &_f) : ntutorial(_n), fname(_f) {}
+
+ int ntutorial;
+ QString fname;
+ };
+
+ QList downloads;
if (manifest.open(QIODevice::ReadOnly)) {
while (!manifest.atEnd()) {
line = (const char *)manifest.readLine();
@@ -2057,21 +2046,66 @@ void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, boo
// file in subfolder
if (line.contains('/')) {
if (getsolution && line.startsWith("solution")) {
- lammps.command(geturl.arg(tutno).arg(line).toStdString().c_str());
+ downloads.append(DownloadItem(tutno, line));
}
} else {
// first file is the initial template
if (first.isEmpty()) first = line;
- lammps.command(geturl.arg(tutno).arg(line).toStdString().c_str());
+ downloads.append(DownloadItem(tutno, line));
}
}
manifest.close();
manifest.remove();
}
+
+ int i = 0;
+ int num = downloads.size();
+ if (!num) num = 1;
+
+ progress->setValue(0);
+ progress->show();
+ dirstatus->hide();
+
+ for (const auto &item : downloads) {
+ ++i;
+ status->setText(QString("Downloading file %1 of %2").arg(i).arg(num));
+ progress->setValue((int)((double)i / ((double)num) * 1000.0));
+ status->repaint();
+ lammps.command(geturl.arg(item.ntutorial).arg(item.fname));
+
+ // download failed. abort, restore status line, and launch error dialog
+ if (lammps.has_error()) {
+ status->setText("Error.");
+ progress->hide();
+ dirstatus->show();
+ status->repaint();
+ lammps.get_last_error_message(errorbuf, BUFLEN);
+ QMessageBox::critical(this, "LAMMPS-GUI tutorial download error", QString(errorbuf));
+ return;
+ }
+
+ // check if download is a placeholder for a symbolic link and make a copy instead.
+ QFile dlfile(item.fname);
+ QFileInfo dlpath(item.fname);
+ if (dlfile.open(QIODevice::ReadOnly)) {
+ line = (const char *)dlfile.readLine();
+ line = line.trimmed();
+ dlfile.close();
+
+ if (line == QString("../") + dlpath.fileName())
+ lammps.command(QString("shell cp %1 %2").arg(dlpath.fileName()).arg(item.fname));
+ }
+ }
+ progress->setValue(1000);
+ status->setText("Ready.");
+ progress->hide();
+ dirstatus->show();
+ status->repaint();
if (!first.isEmpty()) open_file(first);
}
-Tutorial1Wizard::Tutorial1Wizard(QWidget *parent) : QWizard(parent)
+TutorialWizard::TutorialWizard(int ntutorial, QWidget *parent) :
+ QWizard(parent), _ntutorial(ntutorial)
{
setWindowIcon(QIcon(":/icons/tutorial-logo.png"));
}
@@ -2079,74 +2113,41 @@ Tutorial1Wizard::Tutorial1Wizard(QWidget *parent) : QWizard(parent)
// actions to perform when the wizard for tutorial 1 is complete
// and the user has clicked on "Finish"
-void Tutorial1Wizard::accept()
+void TutorialWizard::accept()
{
// get pointers to the widgets with the information we need
- auto *dirname = findChild("t1_directory");
- auto *dirpurge = findChild("t1_dirpurge");
- auto *getsol = findChild("t1_getsolution");
+ auto *dirname = findChild("t_directory");
+ auto *dirpurge = findChild("t_dirpurge");
+ auto *getsol = findChild("t_getsolution");
+ bool purgedir = false;
+ bool getsolution = false;
+ QString curdir;
// create and populate directory.
if (dirname) {
QDir directory;
- auto curdir = dirname->text().trimmed();
+ curdir = dirname->text().trimmed();
if (!directory.mkpath(curdir)) {
QMessageBox::warning(this, "Warning",
- "Cannot create tutorial 1 working directory " + curdir +
- ".\n\nGoing back to directory selection.");
+ "Cannot create tutorial " + QString::number(_ntutorial) +
+ " working directory '" + curdir +
+ "'.\n\nGoing back to directory selection.");
back();
return;
}
- bool purgedir = dirpurge && (dirpurge->checkState() == Qt::Checked);
- bool getsolution = getsol && (getsol->checkState() == Qt::Checked);
-
- // get hold of LAMMPS-GUI main widget
- LammpsGui *main = nullptr;
- for (QWidget *widget : QApplication::topLevelWidgets())
- if (widget->objectName() == "LammpsGui") main = dynamic_cast(widget);
- if (main) main->setup_tutorial(1, curdir, purgedir, getsolution);
+ purgedir = dirpurge && (dirpurge->checkState() == Qt::Checked);
+ getsolution = getsol && (getsol->checkState() == Qt::Checked);
}
QDialog::accept();
-}
-Tutorial2Wizard::Tutorial2Wizard(QWidget *parent) : QWizard(parent)
-{
- setWindowIcon(QIcon(":/icons/tutorial-logo.png"));
-}
-
-// actions to perform when the wizard for tutorial 2 is complete
-// and the user has clicked on "Finish"
-
-void Tutorial2Wizard::accept()
-{
- // get pointers to the widgets with the information we need
- auto *dirname = findChild("t2_directory");
- auto *dirpurge = findChild("t2_dirpurge");
- auto *getsol = findChild("t2_getsolution");
-
- // create and populate directory.
+ // get hold of LAMMPS-GUI main widget
if (dirname) {
- QDir directory;
- auto curdir = dirname->text().trimmed();
- if (!directory.mkpath(curdir)) {
- QMessageBox::warning(this, "Warning",
- "Cannot create tutorial 2 working directory " + curdir +
- ".\n\nGoing back to directory selection.");
- back();
- return;
- }
-
- bool purgedir = dirpurge && (dirpurge->checkState() == Qt::Checked);
- bool getsolution = getsol && (getsol->checkState() == Qt::Checked);
-
- // get hold of LAMMPS-GUI main widget
LammpsGui *main = nullptr;
for (QWidget *widget : QApplication::topLevelWidgets())
if (widget->objectName() == "LammpsGui") main = dynamic_cast(widget);
- if (main) main->setup_tutorial(2, curdir, purgedir, getsolution);
+ if (main) main->setup_tutorial(_ntutorial, curdir, purgedir, getsolution);
}
- QDialog::accept();
}
// Local Variables:
diff --git a/tools/lammps-gui/lammpsgui.h b/tools/lammps-gui/lammpsgui.h
index a269e1a384..cb61f368a5 100644
--- a/tools/lammps-gui/lammpsgui.h
+++ b/tools/lammps-gui/lammpsgui.h
@@ -64,8 +64,7 @@ class LammpsGui : public QMainWindow {
friend class CodeEditor;
friend class GeneralTab;
- friend class Tutorial1Wizard;
- friend class Tutorial2Wizard;
+ friend class TutorialWizard;
public:
LammpsGui(QWidget *parent = nullptr, const QString &filename = QString());
@@ -84,15 +83,9 @@ protected:
void setDocver();
void autoSave();
void setFont(const QFont &newfont);
- QWizardPage *tutorial1_intro();
- QWizardPage *tutorial1_info();
- QWizardPage *tutorial1_directory();
- QWizardPage *tutorial1_finish();
- QWizardPage *tutorial2_intro();
- QWizardPage *tutorial2_info();
- QWizardPage *tutorial2_directory();
- QWizardPage *tutorial2_finish();
- void setup_tutorial(int tutno, const QString &dir, bool purgedir, bool getsolution);
+ QWizardPage *tutorial_intro(const int ntutorial, const QString &infotext);
+ QWizardPage *tutorial_directory(const int ntutorial);
+ void setup_tutorial(int ntutorial, const QString &dir, bool purgedir, bool getsolution);
void purge_inspect_list();
bool eventFilter(QObject *watched, QEvent *event) override;
@@ -132,6 +125,12 @@ private slots:
void tutorial_web();
void start_tutorial1();
void start_tutorial2();
+ void start_tutorial3();
+ void start_tutorial4();
+ void start_tutorial5();
+ void start_tutorial6();
+ void start_tutorial7();
+ void start_tutorial8();
void howto();
void logupdate();
void modified();
@@ -178,20 +177,14 @@ private:
std::vector lammps_args;
};
-class Tutorial1Wizard : public QWizard {
+class TutorialWizard : public QWizard {
Q_OBJECT
public:
- Tutorial1Wizard(QWidget *parent = nullptr);
- void accept() override;
-};
-
-class Tutorial2Wizard : public QWizard {
- Q_OBJECT
-
-public:
- Tutorial2Wizard(QWidget *parent = nullptr);
+ TutorialWizard(int ntutorial, QWidget *parent = nullptr);
void accept() override;
+private:
+ int _ntutorial;
};
#endif // LAMMPSGUI_H
diff --git a/tools/lammps-gui/lammpsgui.qrc b/tools/lammps-gui/lammpsgui.qrc
index 8111edd44b..3f9697392b 100644
--- a/tools/lammps-gui/lammpsgui.qrc
+++ b/tools/lammps-gui/lammpsgui.qrc
@@ -4,6 +4,12 @@
icons/lammps-icon-128x128.png
icons/tutorial1-logo.png
icons/tutorial2-logo.png
+ icons/tutorial3-logo.png
+ icons/tutorial4-logo.png
+ icons/tutorial5-logo.png
+ icons/tutorial6-logo.png
+ icons/tutorial7-logo.png
+ icons/tutorial8-logo.png
help_index.table
lammps_internal_commands.txt
@@ -67,6 +73,7 @@
icons/utilities-terminal.png
icons/vdw-style.png
icons/vmd.png
+ icons/warning.png
icons/window-close.png
icons/x-office-drawing.png
icons/yaml-file-icon.png
diff --git a/tools/lammps-gui/lammpsgui.ui b/tools/lammps-gui/lammpsgui.ui
index 045e0f84a8..c6dbd6a507 100644
--- a/tools/lammps-gui/lammpsgui.ui
+++ b/tools/lammps-gui/lammpsgui.ui
@@ -87,6 +87,12 @@
+
+
+
+
+
+