diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index cc4c1cc905..9e0d748140 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -218,10 +218,9 @@ if(BUILD_OMP) message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support") endif() - if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.99.9)) OR - ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.99.9)) OR - ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.99.9)) - ) + if (((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0)) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. # Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe. target_compile_definitions(lammps PRIVATE -DLAMMPS_OMP_COMPAT=4) @@ -249,6 +248,26 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") endif() endif() +####################################### +# add custom target for IWYU analysis +####################################### +set(ENABLE_IWYU OFF CACHE BOOL "Add 'iwyu' build target to call the include-what-you-use tool") +mark_as_advanced(ENABLE_IWYU) +if(ENABLE_IWYU) + find_program(IWYU_EXE NAMES include-what-you-use iwyu) + find_program(IWYU_TOOL NAMES iwyu_tool iwyu-tool iwyu_tool.py) + if (IWYU_EXE AND IWYU_TOOL) + add_custom_target( + iwyu + ${IWYU_TOOL} -o clang -p ${CMAKE_CURRENT_BINARY_DIR} -- -Xiwyu --mapping_file=${CMAKE_CURRENT_SOURCE_DIR}/iwyu/iwyu-extra-map.imp + COMMENT "Running IWYU") + add_dependencies(iwyu lammps) + else() + message(FATAL_ERROR "To use IWYU you need the include-what-you-use/iwyu executable" + "and the iwyu-tool/iwyu_tool script installed in your PATH") + endif() +endif() + set(ENABLE_SANITIZER "none" CACHE STRING "Select a code sanitizer option (none (default), address, leak, thread, undefined)") mark_as_advanced(ENABLE_SANITIZER) set(ENABLE_SANITIZER_VALUES none address leak thread undefined) @@ -293,14 +312,13 @@ if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE) endif() endif() - find_package(JPEG QUIET) option(WITH_JPEG "Enable JPEG support" ${JPEG_FOUND}) if(WITH_JPEG) find_package(JPEG REQUIRED) target_compile_definitions(lammps PRIVATE -DLAMMPS_JPEG) if(CMAKE_VERSION VERSION_LESS 3.12) - target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIR}) + target_include_directories(lammps PRIVATE ${JPEG_INCLUDE_DIRS}) target_link_libraries(lammps PRIVATE ${JPEG_LIBRARIES}) else() target_link_libraries(lammps PRIVATE JPEG::JPEG) diff --git a/cmake/Modules/Packages/COMPRESS.cmake b/cmake/Modules/Packages/COMPRESS.cmake index 801a38a215..887dfb88a6 100644 --- a/cmake/Modules/Packages/COMPRESS.cmake +++ b/cmake/Modules/Packages/COMPRESS.cmake @@ -1,2 +1,10 @@ find_package(ZLIB REQUIRED) target_link_libraries(lammps PRIVATE ZLIB::ZLIB) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(Zstd IMPORTED_TARGET libzstd>=1.4) + +if(Zstd_FOUND) + target_compile_definitions(lammps PRIVATE -DLAMMPS_ZSTD) + target_link_libraries(lammps PRIVATE PkgConfig::Zstd) +endif() diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 04c320226a..ac2c975da3 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -75,7 +75,7 @@ if(GPU_API STREQUAL "CUDA") endif() # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11 if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_35,code=[sm_35,compute_35]") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_35,code=[sm_35,compute_35]") endif() # Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later if(CUDA_VERSION VERSION_GREATER_EQUAL "6.0") diff --git a/cmake/Modules/Packages/KSPACE.cmake b/cmake/Modules/Packages/KSPACE.cmake index 5e79813ac0..de7e7e5b20 100644 --- a/cmake/Modules/Packages/KSPACE.cmake +++ b/cmake/Modules/Packages/KSPACE.cmake @@ -19,16 +19,16 @@ if(FFT STREQUAL "FFTW3") find_package(${FFTW} REQUIRED) target_compile_definitions(lammps PRIVATE -DFFT_FFTW3) target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW}) - if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY) + if(FFTW3_OMP_LIBRARIES OR FFTW3F_OMP_LIBRARIES) option(FFT_FFTW_THREADS "Use threaded FFTW library" ON) else() option(FFT_FFTW_THREADS "Use threaded FFT library" OFF) endif() if(FFT_FFTW_THREADS) - if(FFTW3_OMP_LIBRARY OR FFTW3F_OMP_LIBRARY) - target_compile_definitions(lammps PRIVATE -DFFT_FFTW_THREADS) - target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW}_OMP) + if(FFTW3_OMP_LIBRARIES OR FFTW3F_OMP_LIBRARIES) + target_compile_definitions(lammps PRIVATE -DFFT_FFTW_THREADS) + target_link_libraries(lammps PRIVATE ${FFTW}::${FFTW}_OMP) else() message(FATAL_ERROR "Need OpenMP enabled FFTW3 library for FFT_THREADS") endif() diff --git a/cmake/Modules/Packages/MSCG.cmake b/cmake/Modules/Packages/MSCG.cmake index 55f71588fe..6cb389fb13 100644 --- a/cmake/Modules/Packages/MSCG.cmake +++ b/cmake/Modules/Packages/MSCG.cmake @@ -38,7 +38,7 @@ if(DOWNLOAD_MSCG) else() find_package(MSCG) if(NOT MSCG_FOUND) - message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIRS, or set DOWNLOAD_MSCG=ON to download it") + message(FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIR, or set DOWNLOAD_MSCG=ON to download it") endif() target_link_libraries(lammps PRIVATE MSCG::MSCG) endif() diff --git a/cmake/Modules/Packages/PYTHON.cmake b/cmake/Modules/Packages/PYTHON.cmake index a577f824fe..7be25a6b05 100644 --- a/cmake/Modules/Packages/PYTHON.cmake +++ b/cmake/Modules/Packages/PYTHON.cmake @@ -1,7 +1,7 @@ if(CMAKE_VERSION VERSION_LESS 3.12) find_package(PythonLibs REQUIRED) # Deprecated since version 3.12 - target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIR}) - target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARY}) + target_include_directories(lammps PRIVATE ${PYTHON_INCLUDE_DIRS}) + target_link_libraries(lammps PRIVATE ${PYTHON_LIBRARIES}) else() find_package(Python REQUIRED COMPONENTS Development) target_link_libraries(lammps PRIVATE Python::Python) diff --git a/cmake/Modules/Packages/USER-MOLFILE.cmake b/cmake/Modules/Packages/USER-MOLFILE.cmake index 1a2df2202b..4d414acead 100644 --- a/cmake/Modules/Packages/USER-MOLFILE.cmake +++ b/cmake/Modules/Packages/USER-MOLFILE.cmake @@ -1,4 +1,5 @@ -set(MOLFILE_INCLUDE_DIRS "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers") +set(MOLFILE_INCLUDE_DIR "${LAMMPS_LIB_SOURCE_DIR}/molfile" CACHE STRING "Path to VMD molfile plugin headers") +set(MOLFILE_INCLUDE_DIRS "${MOLFILE_INCLUDE_DIR}") add_library(molfile INTERFACE) target_include_directories(molfile INTERFACE ${MOLFILE_INCLUDE_DIRS}) # no need to link with -ldl on windows diff --git a/cmake/Modules/Packages/USER-PLUMED.cmake b/cmake/Modules/Packages/USER-PLUMED.cmake index 39148bdf3d..74add65cdc 100644 --- a/cmake/Modules/Packages/USER-PLUMED.cmake +++ b/cmake/Modules/Packages/USER-PLUMED.cmake @@ -55,8 +55,8 @@ if(DOWNLOAD_PLUMED) endif() include(ExternalProject) ExternalProject_Add(plumed_build - URL https://github.com/plumed/plumed2/releases/download/v2.6.0/plumed-src-2.6.0.tgz - URL_MD5 204d2edae58d9b10ba3ad460cad64191 + URL https://github.com/plumed/plumed2/releases/download/v2.6.1/plumed-src-2.6.1.tgz + URL_MD5 89a9a450fc6025299fe16af235957163 BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure --prefix= ${CONFIGURE_REQUEST_PIC} diff --git a/cmake/iwyu/iwyu-extra-map.imp b/cmake/iwyu/iwyu-extra-map.imp new file mode 100644 index 0000000000..4fadea73fb --- /dev/null +++ b/cmake/iwyu/iwyu-extra-map.imp @@ -0,0 +1,7 @@ +[ + { include: [ "", private, "", public ] }, + { include: [ "", public, "", public ] }, + { include: [ "@", private, "", public ] }, + { include: [ "@", private, "\"gtest/gtest.h\"", public ] }, + { include: [ "@", private, "\"gmock/gmock.h\"", public ] }, +] diff --git a/doc/Makefile b/doc/Makefile index 49ad98775d..d96b523915 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -54,7 +54,7 @@ DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+ help: @echo "Please use \`make ' where is one of" @echo " html create HTML doc pages in html dir" - @echo " pdf create Developer.pdf and Manual.pdf in this dir" + @echo " pdf create Manual.pdf in this dir" @echo " fetch fetch HTML and PDF files from LAMMPS web site" @echo " epub create ePUB format manual for e-book readers" @echo " mobi convert ePUB to MOBI format manual for e-book readers (e.g. Kindle)" @@ -69,7 +69,7 @@ help: # ------------------------------------------ clean-all: clean - rm -rf $(BUILDDIR)/docenv $(MATHJAX) $(BUILDDIR)/LAMMPS.mobi $(BUILDDIR)/LAMMPS.epub $(BUILDDIR)/Manual.pdf $(BUILDDIR)/Developer.pdf + rm -rf $(BUILDDIR)/docenv $(MATHJAX) $(BUILDDIR)/LAMMPS.mobi $(BUILDDIR)/LAMMPS.epub $(BUILDDIR)/Manual.pdf clean: clean-spelling rm -rf $(BUILDDIR)/html $(BUILDDIR)/epub $(BUILDDIR)/latex $(BUILDDIR)/doctrees $(BUILDDIR)/doxygen/xml $(BUILDDIR)/doxygen-warn.log $(BUILDDIR)/doxygen/Doxyfile $(SPHINXCONFIG)/conf.py @@ -139,13 +139,6 @@ mobi: epub pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) @$(MAKE) $(MFLAGS) -C graphviz all @if [ "$(HAS_PDFLATEX)" == "NO" ] ; then echo "PDFLaTeX was not found! Please check README.md for further instructions" 1>&2; exit 1; fi - @(\ - cd src/Developer; \ - pdflatex developer; \ - pdflatex developer; \ - mv developer.pdf ../../Developer.pdf; \ - cd ../../; \ - ) @(\ . $(VENV)/bin/activate ; env PYTHONWARNINGS= \ sphinx-build $(SPHINXEXTRA) -b latex -c $(SPHINXCONFIG) -d $(BUILDDIR)/doctrees $(RSTDIR) latex ;\ @@ -175,12 +168,11 @@ pdf: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) @rm -rf latex/USER @cp -r src/PDF latex/PDF @rm -rf latex/PDF/.[sg]* - @echo "Build finished. Manual.pdf and Developer.pdf are in this directory." + @echo "Build finished. Manual.pdf is in this directory." fetch: - @rm -rf html_www Manual_www.pdf Developer_www.pdf + @rm -rf html_www Manual_www.pdf @curl -s -o Manual_www.pdf http://lammps.sandia.gov/doc/Manual.pdf - @curl -s -o Developer_www.pdf http://lammps.sandia.gov/doc/Developer.pdf @curl -s -o lammps-doc.tar.gz http://lammps.sandia.gov/tars/lammps-doc.tar.gz @tar xzf lammps-doc.tar.gz @rm -f lammps-doc.tar.gz diff --git a/doc/doxygen/Doxyfile.in b/doc/doxygen/Doxyfile.in index 78ac614ca3..f0bf127ee1 100644 --- a/doc/doxygen/Doxyfile.in +++ b/doc/doxygen/Doxyfile.in @@ -410,18 +410,27 @@ WARN_LOGFILE = "../doxygen-warn.log" # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \ - @LAMMPS_SOURCE_DIR@/utils.h \ - @LAMMPS_SOURCE_DIR@/library.cpp \ - @LAMMPS_SOURCE_DIR@/library.h \ - @LAMMPS_SOURCE_DIR@/lammps.cpp \ - @LAMMPS_SOURCE_DIR@/lammps.h \ - @LAMMPS_SOURCE_DIR@/lmptype.h \ - @LAMMPS_SOURCE_DIR@/pointers.h \ - @LAMMPS_SOURCE_DIR@/atom.cpp \ - @LAMMPS_SOURCE_DIR@/atom.h \ - @LAMMPS_SOURCE_DIR@/input.cpp \ - @LAMMPS_SOURCE_DIR@/input.h \ +INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \ + @LAMMPS_SOURCE_DIR@/utils.h \ + @LAMMPS_SOURCE_DIR@/library.cpp \ + @LAMMPS_SOURCE_DIR@/library.h \ + @LAMMPS_SOURCE_DIR@/lammps.cpp \ + @LAMMPS_SOURCE_DIR@/lammps.h \ + @LAMMPS_SOURCE_DIR@/lmptype.h \ + @LAMMPS_SOURCE_DIR@/atom.cpp \ + @LAMMPS_SOURCE_DIR@/atom.h \ + @LAMMPS_SOURCE_DIR@/input.cpp \ + @LAMMPS_SOURCE_DIR@/input.h \ + @LAMMPS_SOURCE_DIR@/tokenizer.cpp \ + @LAMMPS_SOURCE_DIR@/tokenizer.h \ + @LAMMPS_SOURCE_DIR@/text_file_reader.cpp \ + @LAMMPS_SOURCE_DIR@/text_file_reader.h \ + @LAMMPS_SOURCE_DIR@/potential_file_reader.cpp \ + @LAMMPS_SOURCE_DIR@/potential_file_reader.h \ + @LAMMPS_SOURCE_DIR@/my_page.cpp \ + @LAMMPS_SOURCE_DIR@/my_page.h \ + @LAMMPS_SOURCE_DIR@/my_pool_chunk.cpp \ + @LAMMPS_SOURCE_DIR@/my_pool_chunk.h \ # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/doc/include-file-conventions.md b/doc/include-file-conventions.md index 51f67afbbb..87b9eba8df 100644 --- a/doc/include-file-conventions.md +++ b/doc/include-file-conventions.md @@ -3,7 +3,7 @@ This purpose of this document is to provide a point of reference for LAMMPS developers and contributors as to what include files and definitions to put where into LAMMPS source. -Last change 2019-07-05 +Last change 2020-08-31 ## Table of Contents @@ -91,29 +91,31 @@ statements should follow the "include what you use" principle. Include files should be included in this order: * the header matching the implementation (`some_class.h` for file `some_class.cpp`) -* mpi.h -* system and library headers (anything that is using angular brackets; C-library headers first, then C++) +* mpi.h (only if needed) * LAMMPS local headers (preferably in alphabetical order) +* system and library headers (anything that is using angular brackets; preferably in alphabetical order) +* conditional include statements (i.e. anything bracketed with ifdefs) ### Special Cases and Exceptions #### pointers.h -The `pointer.h` header file also includes `cstdio` and `lmptype.h` -(and through it `stdint.h`, `intttypes.h`, cstdlib, and `climits`). +The `pointer.h` header file also includes (in this order) `lmptype.h`, +`mpi.h`, `cstddef`, `cstdio`, `string`, `utils.h`, and `fmt/format.h` +and through `lmptype.h` indirectly also `climits`, `cstdlib`, `cinttypes`. This means any header including `pointers.h` can assume that `FILE`, -`NULL`, `INT_MAX` are defined. +`NULL`, `INT_MAX` are defined, and the may freely use the std::string +for arguments. Corresponding implementation files do not need to include +those headers. ## Tools The [Include What You Use tool](https://include-what-you-use.org/) can be used to provide supporting information about compliance with -the rules listed here. There are some limitations and the IWYU tool -may give incorrect advice. The tools is activated by setting the -CMake variable `CMAKE_CXX_INCLUDE_WHAT_YOU_USE` variable to the -path of the `include-what-you-use` command. When activated, the -tool will be run after each compilation and provide suggestions for -which include files should be added or removed. +the rules listed here. Through setting `-DENABLE_IWYU=on` when running +CMake, a custom build target is added that will enable recording +the compilation commands and then run the `iwyu_tool` using the +recorded compilation commands information when typing `make iwyu`. ## Legacy Code diff --git a/doc/src/Build_basics.rst b/doc/src/Build_basics.rst index 0ddf65ab46..3b20209e5c 100644 --- a/doc/src/Build_basics.rst +++ b/doc/src/Build_basics.rst @@ -32,74 +32,80 @@ LAMMPS are also written with support for shared memory parallelization using the `OpenMP `_ threading standard. A more detailed discussion of that is below. -**CMake build**\ : +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D BUILD_MPI=value # yes or no, default is yes if CMake finds MPI, else no - -D BUILD_OMP=value # yes or no, default is yes if a compatible compiler is detected - -D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc - # no default value + .. code-block:: bash -The executable created by CMake (after running make) is named ``lmp`` unless -the ``LAMMPS_MACHINE`` option is set. When setting ``LAMMPS_MACHINE=name`` -the executable will be called ``lmp_name``. Using ``BUILD_MPI=no`` will -enforce building a serial executable using the MPI STUBS library. + -D BUILD_MPI=value # yes or no, default is yes if CMake finds MPI, else no + -D BUILD_OMP=value # yes or no, default is yes if a compatible compiler is detected + -D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc + # no default value -**Traditional make**\ : + The executable created by CMake (after running make) is named + ``lmp`` unless the ``LAMMPS_MACHINE`` option is set. When setting + ``LAMMPS_MACHINE=name`` the executable will be called + ``lmp_name``. Using ``BUILD_MPI=no`` will enforce building a + serial executable using the MPI STUBS library. -The build with traditional makefiles has to be done inside the source folder ``src``. + .. tab:: Traditional make -.. code-block:: bash + The build with traditional makefiles has to be done inside the source folder ``src``. - make mpi # parallel build, produces lmp_mpi using Makefile.mpi - make serial # serial build, produces lmp_serial using Makefile/serial - make mybox # uses Makefile.mybox to produce lmp_mybox + .. code-block:: bash -Any ``make machine`` command will look up the make settings from a file -``Makefile.machine`` in the folder ``src/MAKE`` or one of its -sub-directories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a folder -``Obj_machine`` with all objects and generated files and an executable -called ``lmp_machine``\ . The standard parallel build with ``make mpi`` -assumes a standard MPI installation with MPI compiler wrappers where all -necessary compiler and linker flags to get access and link with the -suitable MPI headers and libraries are set by the wrapper programs. For -other cases or the serial build, you have to adjust the make file -variables ``MPI_INC``, ``MPI_PATH``, ``MPI_LIB`` as well as ``CC`` and -``LINK``\ . To enable OpenMP threading usually a compiler specific flag -needs to be added to the compile and link commands. For the GNU -compilers, this is ``-fopenmp``\ , which can be added to the ``CC`` and -``LINK`` makefile variables. + make mpi # parallel build, produces lmp_mpi using Makefile.mpi + make serial # serial build, produces lmp_serial using Makefile/serial + make mybox # uses Makefile.mybox to produce lmp_mybox -For the serial build the following make variables are set (see src/MAKE/Makefile.serial): + Any ``make machine`` command will look up the make settings from a + file ``Makefile.machine`` in the folder ``src/MAKE`` or one of its + sub-directories ``MINE``, ``MACHINES``, or ``OPTIONS``, create a + folder ``Obj_machine`` with all objects and generated files and an + executable called ``lmp_machine``\ . The standard parallel build + with ``make mpi`` assumes a standard MPI installation with MPI + compiler wrappers where all necessary compiler and linker flags to + get access and link with the suitable MPI headers and libraries + are set by the wrapper programs. For other cases or the serial + build, you have to adjust the make file variables ``MPI_INC``, + ``MPI_PATH``, ``MPI_LIB`` as well as ``CC`` and ``LINK``\ . To + enable OpenMP threading usually a compiler specific flag needs to + be added to the compile and link commands. For the GNU compilers, + this is ``-fopenmp``\ , which can be added to the ``CC`` and + ``LINK`` makefile variables. -.. code-block:: make + For the serial build the following make variables are set (see src/MAKE/Makefile.serial): - CC = g++ - LINK = g++ - MPI_INC = -I../STUBS - MPI_PATH = -L../STUBS - MPI_LIB = -lmpi_stubs + .. code-block:: make -You also need to build the STUBS library for your platform before making -LAMMPS itself. A ``make serial`` build does this for you automatically, -otherwise, type ``make mpi-stubs`` from the src directory, or ``make`` -from the ``src/STUBS`` dir. If the build fails, you may need to edit -the ``STUBS/Makefile`` for your platform. The stubs library does not -provide MPI/IO functions required by some LAMMPS packages, -e.g. ``MPIIO`` or ``USER-LB``, and thus is not compatible with those -packages. + CC = g++ + LINK = g++ + MPI_INC = -I../STUBS + MPI_PATH = -L../STUBS + MPI_LIB = -lmpi_stubs -.. note:: + You also need to build the STUBS library for your platform before + making LAMMPS itself. A ``make serial`` build does this for you + automatically, otherwise, type ``make mpi-stubs`` from the src + directory, or ``make`` from the ``src/STUBS`` dir. If the build + fails, you may need to edit the ``STUBS/Makefile`` for your + platform. The stubs library does not provide MPI/IO functions + required by some LAMMPS packages, e.g. ``MPIIO`` or ``USER-LB``, + and thus is not compatible with those packages. - The file ``src/STUBS/mpi.c`` provides a CPU timer function called - ``MPI_Wtime()`` that calls ``gettimeofday()``. If your operating system - does not support ``gettimeofday()``, you will need to insert code to - call another timer. Note that the ANSI-standard function ``clock()`` - rolls over after an hour or so, and is therefore insufficient for - timing long LAMMPS simulations. + .. note:: -**MPI and OpenMP support info**\ : + The file ``src/STUBS/mpi.c`` provides a CPU timer function + called ``MPI_Wtime()`` that calls ``gettimeofday()``. If your + operating system does not support ``gettimeofday()``, you will + need to insert code to call another timer. Note that the + ANSI-standard function ``clock()`` rolls over after an hour or + so, and is therefore insufficient for timing long LAMMPS + simulations. + +MPI and OpenMP support in LAMMPS +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you are installing MPI yourself to build a parallel LAMMPS executable, we recommend either MPICH or OpenMPI which are regularly @@ -115,12 +121,12 @@ self-installed MPICH or OpenMPI, so you should study the provided documentation to find out how to build and link with it. The majority of OpenMP (threading) support in LAMMPS is provided by the -``USER-OMP`` package; see the :doc:`Speed omp ` doc page for -details. The ``USER-INTEL`` package also includes OpenMP threading (it -is compatible with ``USER-OMP`` and will usually fall back on styles -from that package, if a ``USER-INTEL`` does not exist) and adds -vectorization support when compiled with compatible compilers, in -particular the Intel compilers on top of OpenMP. Also, the ``KOKKOS`` +``USER-OMP`` package; see the :doc:`Speed_omp` +page for details. The ``USER-INTEL`` package also includes OpenMP +threading (it is compatible with ``USER-OMP`` and will usually fall +back on styles from that package, if a ``USER-INTEL`` does not exist) +and adds vectorization support when compiled with compatible compilers, +in particular the Intel compilers on top of OpenMP. Also, the ``KOKKOS`` package can be compiled to include OpenMP threading. In addition, there are a few commands in LAMMPS that have native OpenMP @@ -145,18 +151,19 @@ please refer to its documentation. .. _default-none-issues: -**OpenMP Compiler compatibility info**\ : +OpenMP Compiler compatibility +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Some compilers do not fully support the ``default(none)`` directive -and others (e.g. GCC version 9 and beyond, Clang version 10 and later) -may implement strict OpenMP 4.0 and later semantics, which are incompatible +Some compilers do not fully support the ``default(none)`` directive and +others (e.g. GCC version 9 and beyond, Clang version 10 and later) may +implement strict OpenMP 4.0 and later semantics, which are incompatible 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 semantic, 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 while configuring -with CMake. CMake will detect the suitable setting for the GNU, Clang, -and Intel compilers. +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 +while configuring with CMake. CMake will detect the suitable setting for +the GNU, Clang, and Intel compilers. ---------- @@ -185,131 +192,139 @@ for their compile/link environments, you can often access different compilers by simply loading the appropriate module before building LAMMPS. -**CMake build**\ : +.. tabs:: -By default CMake will use a compiler it finds according to internal -preferences and it will add optimization flags appropriate to that -compiler and any :doc:`accelerator packages ` you have -included in the build. + .. tab:: CMake build -You can tell CMake to look for a specific compiler with setting CMake -variables (listed below) during configuration. For a few common -choices, there are also presets in the ``cmake/presets`` folder. For -convenience, there is a ``CMAKE_TUNE_FLAGS`` variable that can be set to -apply global compiler options (applied to compilation only), to be used -for adding compiler or host specific optimization flags in addition to -the "flags" variables listed below. You may also specify the -corresponding ``CMAKE_*_FLAGS`` variables individually, if you want to -experiment with alternate optimization flags. You should specify all 3 -compilers, so that the (few) LAMMPS source files written in C or Fortran -are built with a compiler consistent with the one used for the C++ -files: + By default CMake will use the compiler it finds according to + internal preferences and it will add optimization flags + appropriate to that compiler and any :doc:`accelerator packages + ` you have included in the build. CMake will + check if the detected or selected compiler is compatible with the + C++ support requirements of LAMMPS and stop with an error, if this + is not the case. -.. code-block:: bash + You can tell CMake to look for a specific compiler with setting + CMake variables (listed below) during configuration. For a few + common choices, there are also presets in the ``cmake/presets`` + folder. For convenience, there is a ``CMAKE_TUNE_FLAGS`` variable + that can be set to apply global compiler options (applied to + compilation only), to be used for adding compiler or host specific + optimization flags in addition to the "flags" variables listed + below. You may also specify the corresponding ``CMAKE_*_FLAGS`` + variables individually, if you want to experiment with alternate + optimization flags. You should specify all 3 compilers, so that + the (few) LAMMPS source files written in C or Fortran are built + with a compiler consistent with the one used for the C++ files: - -D CMAKE_CXX_COMPILER=name # name of C++ compiler - -D CMAKE_C_COMPILER=name # name of C compiler - -D CMAKE_Fortran_COMPILER=name # name of Fortran compiler + .. code-block:: bash - -D CMAKE_CXX_FLAGS=string # flags to use with C++ compiler - -D CMAKE_C_FLAGS=string # flags to use with C compiler - -D CMAKE_Fortran_FLAGS=string # flags to use with Fortran compiler + -D CMAKE_CXX_COMPILER=name # name of C++ compiler + -D CMAKE_C_COMPILER=name # name of C compiler + -D CMAKE_Fortran_COMPILER=name # name of Fortran compiler -A few example command lines are: + -D CMAKE_CXX_FLAGS=string # flags to use with C++ compiler + -D CMAKE_C_FLAGS=string # flags to use with C compiler + -D CMAKE_Fortran_FLAGS=string # flags to use with Fortran compiler -.. code-block:: bash + A few example command lines are: - # Building with GNU Compilers: - cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran - # Building with Intel Compilers: - cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort - # Building with LLVM/Clang Compilers: - cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang + .. code-block:: bash -For compiling with the Clang/LLVM compilers a CMake preset is provided that -can be loaded with `-C ../cmake/presets/clang.cmake`. Similarly, -`-C ../cmake/presets/intel.cmake` should switch the + # Building with GNU Compilers: + cmake ../cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_Fortran_COMPILER=gfortran + # Building with Intel Compilers: + cmake ../cmake -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc -DCMAKE_Fortran_COMPILER=ifort + # Building with LLVM/Clang Compilers: + cmake ../cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_Fortran_COMPILER=flang -In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add -compiler flags to tune for optimal performance on given hosts. By -default this variable is empty. + For compiling with the Clang/LLVM compilers a CMake preset is + provided that can be loaded with + `-C ../cmake/presets/clang.cmake`. Similarly, + `-C ../cmake/presets/intel.cmake` should switch the compiler + toolchain to the Intel compilers. -.. note:: + In addition you can set ``CMAKE_TUNE_FLAGS`` to specifically add + compiler flags to tune for optimal performance on given hosts. By + default this variable is empty. - When the cmake command completes, it prints a summary to the screen - which compilers it is using and what flags and settings will be used - for the compilation. Note that if the top-level compiler is mpicxx, - it is simply a wrapper on a real compiler. The underlying compiler - info is what CMake will try to determine and report. You should check - to confirm you are using the compiler and optimization flags you want. + .. note:: -**Makefile.machine settings for traditional make**\ : + When the cmake command completes, it prints a summary to the + screen which compilers it is using and what flags and settings + will be used for the compilation. Note that if the top-level + compiler is mpicxx, it is simply a wrapper on a real compiler. + The underlying compiler info is what CMake will try to + determine and report. You should check to confirm you are + using the compiler and optimization flags you want. -The "compiler/linker settings" section of a Makefile.machine lists -compiler and linker settings for your C++ compiler, including -optimization flags. For a parallel build it is recommended to use -``mpicxx`` or ``mpiCC``, since these compiler wrappers will include a -variety of settings appropriate for your MPI installation and thus -avoiding the guesswork of finding the right flags. + .. tab:: Makefile.machine settings for traditional make -Parallel build (see ``src/MAKE/Makefile.mpi``): + The "compiler/linker settings" section of a Makefile.machine lists + compiler and linker settings for your C++ compiler, including + optimization flags. For a parallel build it is recommended to use + ``mpicxx`` or ``mpiCC``, since these compiler wrappers will + include a variety of settings appropriate for your MPI + installation and thus avoiding the guesswork of finding the right + flags. -.. code-block:: bash + Parallel build (see ``src/MAKE/Makefile.mpi``): - CC = mpicxx - CCFLAGS = -g -O3 - LINK = mpicxx - LINKFLAGS = -g -O + .. code-block:: bash -Serial build with GNU gcc (see ``src/MAKE/Makefile.serial``): + CC = mpicxx + CCFLAGS = -g -O3 + LINK = mpicxx + LINKFLAGS = -g -O -.. code-block:: make + Serial build with GNU gcc (see ``src/MAKE/Makefile.serial``): - CC = g++ - CCFLAGS = -g -O3 - LINK = g++ - LINKFLAGS = -g -O + .. code-block:: make + CC = g++ + CCFLAGS = -g -O3 + LINK = g++ + LINKFLAGS = -g -O -.. note:: + .. note:: - If compilation stops with a message like the following: + If compilation stops with a message like the following: - .. code-block:: + .. code-block:: - g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp - In file included from ../pointers.h:24:0, - from ../input.h:17, - from ../main.cpp:16: - ../lmptype.h:34:2: error: #error LAMMPS requires a C++11 (or later) compliant compiler. Enable C++11 compatibility or upgrade the compiler. + g++ -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I../STUBS -c ../main.cpp + In file included from ../pointers.h:24:0, + from ../input.h:17, + from ../main.cpp:16: + ../lmptype.h:34:2: error: #error LAMMPS requires a C++11 (or later) compliant compiler. Enable C++11 compatibility or upgrade the compiler. - then you have either an unsupported (old) compiler or you have to - turn on C++11 mode. The latter applies to GCC 4.8.x shipped with - RHEL 7.x and CentOS 7.x. For those compilers, you need to add the - ``-std=c++11`` flag. Otherwise, you would have to install a newer - compiler that supports C++11; either as a binary package or through - compiling from source. + then you have either an unsupported (old) compiler or you have + to turn on C++11 mode. The latter applies to GCC 4.8.x shipped + with RHEL 7.x and CentOS 7.x. For those compilers, you need to + add the ``-std=c++11`` flag. Otherwise, you would have to + install a newer compiler that supports C++11; either as a + binary package or through compiling from source. -If you build LAMMPS with any :doc:`accelerator packages -` included, there may be specific optimization flags -that are either required or recommended to enable required features and -to achieve optimal performance. You need to include these in the -CCFLAGS and LINKFLAGS settings above. For details, see the individual -package doc pages listed on the :doc:`Speed packages ` -doc page. Or examine these files in the src/MAKE/OPTIONS directory. -They correspond to each of the 5 accelerator packages and their hardware -variants: + If you build LAMMPS with any :doc:`Speed_packages` included, + there may be specific compiler or linker flags that are either + required or recommended to enable required features and to + achieve optimal performance. You need to include these in the + CCFLAGS and LINKFLAGS settings above. For details, see the + individual package doc pages listed on the + :doc:`Speed_packages` page. Or examine these files in the + src/MAKE/OPTIONS directory. They correspond to each of the 5 + accelerator packages and their hardware variants: -.. code-block:: bash + .. code-block:: bash - Makefile.opt # OPT package - Makefile.omp # USER-OMP package - Makefile.intel_cpu # USER-INTEL package for CPUs - Makefile.intel_coprocessor # USER-INTEL package for KNLs - Makefile.gpu # GPU package - Makefile.kokkos_cuda_mpi # KOKKOS package for GPUs - Makefile.kokkos_omp # KOKKOS package for CPUs (OpenMP) - Makefile.kokkos_phi # KOKKOS package for KNLs (OpenMP) + Makefile.opt # OPT package + Makefile.omp # USER-OMP package + Makefile.intel_cpu # USER-INTEL package for CPUs + Makefile.intel_coprocessor # USER-INTEL package for KNLs + Makefile.gpu # GPU package + Makefile.kokkos_cuda_mpi # KOKKOS package for GPUs + Makefile.kokkos_omp # KOKKOS package for CPUs (OpenMP) + Makefile.kokkos_phi # KOKKOS package for KNLs (OpenMP) ---------- @@ -328,51 +343,56 @@ page for more info on coupling LAMMPS to other codes. See the :doc:`Python ` doc page for more info on wrapping and running LAMMPS from Python via its library interface. -**CMake build**\ : +.. tabs:: -For CMake builds, you can select through setting CMake variables between -building a shared or a static LAMMPS library and what kind of suffix is -added to them (in case you want to concurrently install multiple variants -of binaries with different settings). If none are set, defaults are applied. + .. tab:: CMake build -.. code-block:: bash + For CMake builds, you can select through setting CMake variables + between building a shared or a static LAMMPS library and what kind + of suffix is added to them (in case you want to concurrently + install multiple variants of binaries with different settings). If + none are set, defaults are applied. - -D BUILD_SHARED_LIBS=value # yes or no (default) - -D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc - # no default value + .. code-block:: bash -The compilation will always produce a LAMMPS library and an executable -linked to it. By default this will be a static library named -``liblammps.a`` and an executable named ``lmp`` Setting -``BUILD_SHARED_LIBS=yes`` will instead produce a shared library called -``liblammps.so`` (or ``liblammps.dylib`` or ``liblammps.dll`` depending -on the platform) If ``LAMMPS_MACHINE=name`` is set in addition, the name -of the generated libraries will be changed to either -``liblammps_name.a`` or ``liblammps_name.so``\ , respectively and the -executable will be called ``lmp_name``. + -D BUILD_SHARED_LIBS=value # yes or no (default) + -D LAMMPS_MACHINE=name # name = mpi, serial, mybox, titan, laptop, etc + # no default value -**Traditional make**\ : + The compilation will always produce a LAMMPS library and an + executable linked to it. By default this will be a static library + named ``liblammps.a`` and an executable named ``lmp`` Setting + ``BUILD_SHARED_LIBS=yes`` will instead produce a shared library + called ``liblammps.so`` (or ``liblammps.dylib`` or + ``liblammps.dll`` depending on the platform) If + ``LAMMPS_MACHINE=name`` is set in addition, the name of the + generated libraries will be changed to either ``liblammps_name.a`` + or ``liblammps_name.so``\ , respectively and the executable will + be called ``lmp_name``. -With the traditional makefile based build process, the choice of -the generated executable or library depends on the "mode" setting. -Several options are available and ``mode=static`` is the default. + .. tab:: Traditional make -.. code-block:: bash + With the traditional makefile based build process, the choice of + the generated executable or library depends on the "mode" setting. + Several options are available and ``mode=static`` is the default. - make machine # build LAMMPS executable lmp_machine - make mode=static machine # same as "make machine" - make mode=shared machine # build LAMMPS shared lib liblammps_machine.so instead + .. code-block:: bash -The "static" build will generate a static library called -``liblammps_machine.a`` and an executable named ``lmp_machine``\ , while -the "shared" build will generate a shared library -``liblammps_machine.so`` instead and ``lmp_machine`` will be linked to -it. The build step will also create generic soft links, named -``liblammps.a`` and ``liblammps.so``\ , which point to the specific -``liblammps_machine.a/so`` files. + make machine # build LAMMPS executable lmp_machine + make mode=static machine # same as "make machine" + make mode=shared machine # build LAMMPS shared lib liblammps_machine.so instead -CMake and make info -^^^^^^^^^^^^^^^^^^^ + The "static" build will generate a static library called + ``liblammps_machine.a`` and an executable named ``lmp_machine``\ , + while the "shared" build will generate a shared library + ``liblammps_machine.so`` instead and ``lmp_machine`` will be + linked to it. The build step will also create generic soft links, + named ``liblammps.a`` and ``liblammps.so``\ , which point to the + specific ``liblammps_machine.a/so`` files. + + +Additional information +^^^^^^^^^^^^^^^^^^^^^^ Note that for creating a shared library, all the libraries it depends on must be compiled to be compatible with shared libraries. This should be @@ -418,7 +438,7 @@ recommended to ensure the integrity of the system software installation. .. _debug: -Excluding or removing debug support +Including or removing debug support ----------------------------------- By default the compilation settings will include the *-g* flag which @@ -460,10 +480,10 @@ python packages are installed into that virtual environment via the pip tool. The actual translation is then done via make commands. .. _rst: https://docutils.readthedocs.io/en/sphinx-docs/user/rst/quickstart.html -.. _sphinx: https://sphinx-doc.org +.. _sphinx: https://www.sphinx-doc.org -Documentation make option -^^^^^^^^^^^^^^^^^^^^^^^^^ +Documentation makefile options +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The following make commands can be issued in the doc folder of the LAMMPS source distribution. @@ -471,7 +491,7 @@ LAMMPS source distribution. .. code-block:: bash make html # create HTML doc pages in html directory - make pdf # create Developer.pdf and Manual.pdf in this directory + make pdf # create Manual.pdf in this directory make fetch # fetch HTML and PDF files from LAMMPS web site make clean # remove all intermediate files make clean-all # reset the entire doc build environment @@ -490,15 +510,16 @@ your system. current LAMMPS version (HTML and PDF files), from the website `download page `_. -CMake build option -^^^^^^^^^^^^^^^^^^ +CMake build options +^^^^^^^^^^^^^^^^^^^ -It is also possible to create the HTML version of the manual within -the :doc:`CMake build directory `. The reason for this -option is to include the installation of the HTML manual pages into -the "install" step when installing LAMMPS after the CMake build via -``make install``. The documentation build is included in the default -build target, but can also be requested independently with ``make doc``. +It is also possible to create the HTML version (and only the HTML +version) of the manual within the :doc:`CMake build directory +`. The reason for this option is to include the +installation of the HTML manual pages into the "install" step when +installing LAMMPS after the CMake build via ``make install``. The +documentation build is included in the default build target, but can +also be requested independently with ``make doc``. .. code-block:: bash @@ -514,27 +535,27 @@ Build LAMMPS tools Some tools described in :doc:`Auxiliary tools ` can be built directly using CMake or Make. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D BUILD_TOOLS=value # yes or no (default) + .. code-block:: bash -The generated binaries will also become part of the LAMMPS installation -(see below). + -D BUILD_TOOLS=value # yes or no (default) -Traditional make -^^^^^^^^^^^^^^^^ + The generated binaries will also become part of the LAMMPS installation + (see below). -.. code-block:: bash + .. tab:: Traditional make - cd lammps/tools - make all # build all binaries of tools - make binary2txt # build only binary2txt tool - make chain # build only chain tool - make micelle2d # build only micelle2d tool - make thermo_extract # build only thermo_extract tool + .. code-block:: bash + + cd lammps/tools + make all # build all binaries of tools + make binary2txt # build only binary2txt tool + make chain # build only chain tool + make micelle2d # build only micelle2d tool + make thermo_extract # build only thermo_extract tool ---------- @@ -549,18 +570,19 @@ a globally visible place on your system, for others to access. Note that you may need super-user privileges (e.g. sudo) if the directory you want to copy files to is protected. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - cmake -D CMAKE_INSTALL_PREFIX=path [options ...] ../cmake - make # perform make after CMake command - make install # perform the installation into prefix + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + cmake -D CMAKE_INSTALL_PREFIX=path [options ...] ../cmake + make # perform make after CMake command + make install # perform the installation into prefix -There is no "install" option in the ``src/Makefile`` for LAMMPS. If -you wish to do this you will need to first build LAMMPS, then manually -copy the desired LAMMPS files to the appropriate system directories. + .. tab:: Traditional make + + There is no "install" option in the ``src/Makefile`` for LAMMPS. + If you wish to do this you will need to first build LAMMPS, then + manually copy the desired LAMMPS files to the appropriate system + directories. diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index cd432dddcb..cf3e2fb750 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -28,6 +28,40 @@ variable VERBOSE set to 1: ---------- +.. _iwyu_processing: + +Report missing and unneeded '#include' statements +------------------------------------------------- + +The conventions for how and when to use and order include statements in +LAMMPS are `documented in a separate file `_ +(also included in the source code distribution). To assist with following +these conventions one can use the `Include What You Use tool `_. +This is still under development and for large and complex projects like LAMMPS +there are some false positives, so suggested changes need to be verified manually. +It is recommended to use at least version 0.14, which has much fewer incorrect +reports than earlier versions. + +The necessary steps to generate the report can be enabled via a +CMake variable: + +.. code-block:: bash + + -D ENABLE_IWYU=value # value = no (default) or yes + +This will check if the required binary (include-what-you-use or iwyu) +and python script script (iwyu-tool or iwyu_tool or iwyu_tool.py) can +be found in the path. The analysis can then be started with: + +.. code-block:: bash + + make iwyu + +This may first run some compilation, as the analysis is dependent +on recording all commands required to do the compilation. + +---------- + .. _sanitizer: Address, Undefined Behavior, and Thread Sanitizer Support @@ -37,14 +71,14 @@ Compilers such as GCC and Clang support generating instrumented binaries which use different sanitizer libraries to detect problems in the code during run-time. They can detect issues like: - - `memory leaks `_ + - `memory leaks `_ - `undefined behavior `_ - `data races `_ Please note that this kind of instrumentation usually comes with a performance hit (but much less than using tools like `Valgrind -`_ with a more low level approach). The to enable -these features additional compiler flags need to be added to the +`_ with a more low level approach). To enable +these features, additional compiler flags need to be added to the compilation and linking stages. This is done through setting the ``ENABLE_SANITIZER`` variable during configuration. Examples: @@ -77,7 +111,7 @@ error margin). The status of this automated testing can be viewed on The unit testing facility is integrated into the CMake build process of the LAMMPS source code distribution itself. It can be enabled by setting ``-D ENABLE_TESTING=on`` during the CMake configuration step. -It requires the `YAML `_ library and development +It requires the `PyYAML `_ library and development headers to compile and will download and compile a recent version of the `Googletest `_ C++ test framework for implementing the tests. diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index b72dd95046..79e38ab2b4 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -2,17 +2,21 @@ Packages with extra build options ================================= When building with some packages, additional steps may be required, -in addition to: +in addition to -.. code-block:: bash +.. list-table:: + :align: center + :header-rows: 1 - $ cmake -D PKG_NAME=yes + * - CMake build + - Traditional make + * - .. code-block:: bash -or + $ cmake -D PKG_NAME=yes -.. code-block:: bash + - .. code-block:: bash - $ make yes-name + $ make yes-name as described on the :doc:`Build_package ` doc page. @@ -62,25 +66,39 @@ This is the list of packages that may require additional steps. COMPRESS package ---------------- -To build with this package you must have the zlib compression library -available on your system. +To build with this package you must have the `zlib compression library +`_ available on your system to build dump styles with +a '/gz' suffix. There are also styles using the +`Zstandard `_ library which have a +'/zstd' suffix. -CMake build -^^^^^^^^^^^ +.. tabs:: -If CMake cannot find the library, you can set these variables: + .. tab:: CMake build -.. code-block:: bash + If CMake cannot find the zlib library or include files, you can set + these variables: - -D ZLIB_INCLUDE_DIR=path # path to zlib.h header file - -D ZLIB_LIBRARIES=path # path to libz.a (.so) file + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D ZLIB_INCLUDE_DIR=path # path to zlib.h header file + -D ZLIB_LIBRARY=path # path to libz.a (.so) file -If make cannot find the library, you can edit the file -``lib/compress/Makefile.lammps`` to specify the paths and library -name. + Support for Zstandard compression is auto-detected and for that + CMake depends on the `pkg-config + `_ tool to + identify the necessary flags to compile with this library, so the + corresponding ``libzstandard.pc`` file must be in a folder where + pkg-config can find it, which may require adding it to the + ``PKG_CONFIG_PATH`` environment variable. + + .. tab:: Traditional make + + To include support for Zstandard compression, ``-DLAMMPS_ZSTD`` + must be added to the compiler flags. If make cannot find the + libraries, you can edit the file ``lib/compress/Makefile.lammps`` + to specify the paths and library names. This must be done + **before** the package is installed. ---------- @@ -121,17 +139,19 @@ CMake build * sm_12 or sm_13 for GT200 (supported by CUDA 3.2 until CUDA 6.5) * sm_20 or sm_21 for Fermi (supported by CUDA 3.2 until CUDA 7.5) -* sm_30 or sm_35 or sm_37 for Kepler (supported since CUDA 5) +* sm_30 for Kepler (supported since CUDA 5 and until CUDA 10.x) +* sm_35 or sm_37 for Kepler (supported since CUDA 5 and until CUDA 11.x) * sm_50 or sm_52 for Maxwell (supported since CUDA 6) * sm_60 or sm_61 for Pascal (supported since CUDA 8) * sm_70 for Volta (supported since CUDA 9) * sm_75 for Turing (supported since CUDA 10) +* sm_80 for Ampere (supported since CUDA 11) A more detailed list can be found, for example, at `Wikipedia's CUDA article `_ -CMake can detect which version of the CUDA toolkit is used and thus can -include support for **all** major GPU architectures supported by this toolkit. +CMake can detect which version of the CUDA toolkit is used and thus will try +to include support for **all** major GPU architectures supported by this toolkit. Thus the GPU_ARCH setting is merely an optimization, to have code for the preferred GPU architecture directly included rather than having to wait for the JIT compiler of the CUDA driver to translate it. @@ -155,7 +175,7 @@ and the linker to work correctly. .. code:: bash - # CUDA target + # CUDA target (not recommended, use GPU_ARCH=cuda) # !!! DO NOT set CMAKE_CXX_COMPILER !!! export HIP_PLATFORM=nvcc export CUDA_PATH=/usr/local/cuda @@ -234,11 +254,10 @@ command, you also need to have libcurl installed with the matching development headers and the curl-config tool. If you would like to use the :doc:`kim_property ` -command, you need to build LAMMPS with the Python 3.6 or later package -installed. See the :doc:`Python ` doc page for more info on building -LAMMPS with the version of Python on your system. -After successfully building LAMMPS with Python, you need to -install the kim-property Python package, which can be easily done using +command, you need to build LAMMPS with the PYTHON package installed +and linked to Python 3.6 or later. See the :ref:`PYTHON package build info ` +for more details on this. After successfully building LAMMPS with Python, you +also need to install the kim-property Python package, which can be easily done using *pip* as ``pip install kim-property``, or from the *conda-forge* channel as ``conda install kim-property`` if LAMMPS is built in Conda. More detailed information is available at: @@ -254,64 +273,70 @@ See the list of all KIM models here: https://openkim.org/browse/models the KIM API library with all its models, may take a long time (tens of minutes to hours) to build. Of course you only need to do that once.) -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes - -D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on - -D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer, value = no (default) or yes + .. code-block:: bash -If ``DOWNLOAD_KIM`` is set, the KIM library will be downloaded and built -inside the CMake build directory. If the KIM library is already on -your system (in a location CMake cannot find it), set the ``PKG_CONFIG_PATH`` -environment variable so that libkim-api can be found. + -D DOWNLOAD_KIM=value # download OpenKIM API v2 for build, value = no (default) or yes + -D LMP_DEBUG_CURL=value # set libcurl verbose mode on/off, value = off (default) or on + -D LMP_NO_SSL_CHECK=value # tell libcurl to not verify the peer, value = no (default) or yes -*For using OpenKIM web queries in LAMMPS*\ : + If ``DOWNLOAD_KIM`` is set to *yes* (or *on*), the KIM API library + will be downloaded and built inside the CMake build directory. If + the KIM library is already installed on your system (in a location + where CMake cannot find it), you may need to set the + ``PKG_CONFIG_PATH`` environment variable so that libkim-api can be + found, or run the command ``source kim-api-activate``. -If the ``LMP_DEBUG_CURL`` environment variable is set, the libcurl verbose -mode will be on, and any libcurl calls within the KIM web query display a -lot of information about libcurl operations. You hardly ever want this -set in production use, you will almost always want this when you debug or + .. tab:: Traditional make + + You can download and build the KIM library manually if you prefer; + follow the instructions in ``lib/kim/README``. You can also do + this in one step from the lammps/src dir, using a command like + these, which simply invoke the ``lib/kim/Install.py`` script with + the specified args. + + .. code-block:: bash + + $ make lib-kim # print help message + $ make lib-kim args="-b " # (re-)install KIM API lib with only example models + $ make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model + $ make lib-kim args="-b -a everything" # install KIM API lib with all models + $ make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver + $ make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location + $ make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver + + Settings for debugging OpenKIM web queries discussed below need to + be applied by adding them to the ``LMP_INC`` variable through + editing the ``Makefile.machine`` you are using. For example: + + .. code-block:: make + + LMP_INC = -DLMP_NO_SSL_CHECK + +Debugging OpenKIM web queries in LAMMPS +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If ``LMP_DEBUG_CURL`` is set, the libcurl verbose mode will be turned +on, and any libcurl calls within the KIM web query display a lot of +information about libcurl operations. You hardly ever want this set in +production use, you will almost always want this when you debug or report problems. -The libcurl performs peer SSL certificate verification by default. This -verification is done using a CA certificate store that the SSL library can -use to make sure the peer's server certificate is valid. If SSL reports an -error ("certificate verify failed") during the handshake and thus refuses -further communication with that server, you can set ``LMP_NO_SSL_CHECK``\ . -If ``LMP_NO_SSL_CHECK`` is set, libcurl does not verify the peer and connection -succeeds regardless of the names in the certificate. This option is insecure. -As an alternative, you can specify your own CA cert path by setting the -environment variable ``CURL_CA_BUNDLE`` to the path of your choice. A call -to the KIM web query would get this value from the environmental variable. - -Traditional make -^^^^^^^^^^^^^^^^ - -You can download and build the KIM library manually if you prefer; -follow the instructions in ``lib/kim/README``\ . You can also do it in one -step from the lammps/src dir, using a command like these, which simply -invoke the ``lib/kim/Install.py`` script with the specified args. - -.. code-block:: bash - - $ make lib-kim # print help message - $ make lib-kim args="-b " # (re-)install KIM API lib with only example models - $ make lib-kim args="-b -a Glue_Ercolessi_Adams_Al__MO_324507536345_001" # ditto plus one model - $ make lib-kim args="-b -a everything" # install KIM API lib with all models - $ make lib-kim args="-n -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # add one model or model driver - $ make lib-kim args="-p /usr/local" # use an existing KIM API installation at the provided location - $ make lib-kim args="-p /usr/local -a EAM_Dynamo_Ackland_W__MO_141627196590_002" # ditto but add one model or driver - -Settings for OpenKIM web queries discussed above need to be applied by adding -them to the ``LMP_INC`` variable through editing the ``Makefile.machine`` you are -using. For example: - -.. code-block:: make - - LMP_INC = -DLMP_NO_SSL_CHECK +The libcurl library performs peer SSL certificate verification by +default. This verification is done using a CA certificate store that +the SSL library can use to make sure the peer's server certificate is +valid. If SSL reports an error ("certificate verify failed") during the +handshake and thus refuses further communicate with that server, you can +set ``LMP_NO_SSL_CHECK`` to override that behavior. When LAMMPS is +compiled with ``LMP_NO_SSL_CHECK`` set, libcurl does not verify the peer +and connection attempts will succeed regardless of the names in the +certificate. This option is insecure. As an alternative, you can +specify your own CA cert path by setting the environment variable +``CURL_CA_BUNDLE`` to the path of your choice. A call to the KIM web +query would get this value from the environment variable. ---------- @@ -348,8 +373,8 @@ More information on Kokkos can be found on the Available Architecture settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -These are the possible choices for the Kokkos architecture ID. They must -be specified in uppercase. +These are the possible choices for the Kokkos architecture ID as of +version 3.2 of the Kokkos library. They must be specified in uppercase. .. list-table:: :header-rows: 0 @@ -461,111 +486,115 @@ be specified in uppercase. - GPU - Intel GPUs Gen9+ -Basic CMake build settings: -^^^^^^^^^^^^^^^^^^^^^^^^^^^ -For multicore CPUs using OpenMP, set these 2 variables. +.. tabs:: -.. code-block:: bash + .. tab:: Basic CMake build settings: - -D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above - -D Kokkos_ENABLE_OPENMP=yes - -D BUILD_OMP=yes + For multicore CPUs using OpenMP, set these 2 variables. -Please note that enabling OpenMP for KOKKOS requires that OpenMP is -also :ref:`enabled for the rest of LAMMPS `. + .. code-block:: bash -For Intel KNLs using OpenMP, set these variables: + -D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above + -D Kokkos_ENABLE_OPENMP=yes + -D BUILD_OMP=yes -.. code-block:: bash + Please note that enabling OpenMP for KOKKOS requires that OpenMP is + also :ref:`enabled for the rest of LAMMPS `. - -D Kokkos_ARCH_KNL=yes - -D Kokkos_ENABLE_OPENMP=yes + For Intel KNLs using OpenMP, set these variables: -For NVIDIA GPUs using CUDA, set these variables: + .. code-block:: bash -.. code-block:: bash + -D Kokkos_ARCH_KNL=yes + -D Kokkos_ENABLE_OPENMP=yes - -D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above - -D Kokkos_ARCH_GPUARCH=yes # GPUARCH = GPU from list above - -D Kokkos_ENABLE_CUDA=yes - -D Kokkos_ENABLE_OPENMP=yes - -D CMAKE_CXX_COMPILER=wrapper # wrapper = full path to Cuda nvcc wrapper + For NVIDIA GPUs using CUDA, set these variables: -This will also enable executing FFTs on the GPU, either via the internal -KISSFFT library, or - by preference - with the cuFFT library bundled -with the CUDA toolkit, depending on whether CMake can identify its -location. The *wrapper* value for ``CMAKE_CXX_COMPILER`` variable is -the path to the CUDA nvcc compiler wrapper provided in the Kokkos -library: ``lib/kokkos/bin/nvcc_wrapper``\ . The setting should include -the full path name to the wrapper, e.g. + .. code-block:: bash -.. code-block:: bash + -D Kokkos_ARCH_HOSTARCH=yes # HOSTARCH = HOST from list above + -D Kokkos_ARCH_GPUARCH=yes # GPUARCH = GPU from list above + -D Kokkos_ENABLE_CUDA=yes + -D Kokkos_ENABLE_OPENMP=yes + -D CMAKE_CXX_COMPILER=wrapper # wrapper = full path to Cuda nvcc wrapper - -D CMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper + This will also enable executing FFTs on the GPU, either via the + internal KISSFFT library, or - by preference - with the cuFFT + library bundled with the CUDA toolkit, depending on whether CMake + can identify its location. The *wrapper* value for + ``CMAKE_CXX_COMPILER`` variable is the path to the CUDA nvcc + compiler wrapper provided in the Kokkos library: + ``lib/kokkos/bin/nvcc_wrapper``\ . The setting should include the + full path name to the wrapper, e.g. -To simplify the compilation, three preset files are included in the -``cmake/presets`` folder, ``kokkos-serial.cmake``, ``kokkos-openmp.cmake``, -and ``kokkos-cuda.cmake``. They will enable the KOKKOS package and -enable some hardware choice. So to compile with OpenMP host parallelization, -CUDA device parallelization (for GPUs with CC 5.0 and up) with some -common packages enabled, you can do the following: + .. code-block:: bash -.. code-block:: bash + -D CMAKE_CXX_COMPILER=${HOME}/lammps/lib/kokkos/bin/nvcc_wrapper - mkdir build-kokkos-cuda - cd build-kokkos-cuda - cmake -C ../cmake/presets/minimal.cmake -C ../cmake/presets/kokkos-cuda.cmake ../cmake - cmake --build . + To simplify compilation, three preset files are included in the + ``cmake/presets`` folder, ``kokkos-serial.cmake``, + ``kokkos-openmp.cmake``, and ``kokkos-cuda.cmake``. They will + enable the KOKKOS package and enable some hardware choice. So to + compile with OpenMP host parallelization, CUDA device + parallelization (for GPUs with CC 5.0 and up) with some common + packages enabled, you can do the following: -Basic traditional make settings: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. code-block:: bash -Choose which hardware to support in ``Makefile.machine`` via -``KOKKOS_DEVICES`` and ``KOKKOS_ARCH`` settings. See the -``src/MAKE/OPTIONS/Makefile.kokkos*`` files for examples. + mkdir build-kokkos-cuda + cd build-kokkos-cuda + cmake -C ../cmake/presets/minimal.cmake -C ../cmake/presets/kokkos-cuda.cmake ../cmake + cmake --build . -For multicore CPUs using OpenMP: + .. tab:: Basic traditional make settings: -.. code-block:: make + Choose which hardware to support in ``Makefile.machine`` via + ``KOKKOS_DEVICES`` and ``KOKKOS_ARCH`` settings. See the + ``src/MAKE/OPTIONS/Makefile.kokkos*`` files for examples. - KOKKOS_DEVICES = OpenMP - KOKKOS_ARCH = HOSTARCH # HOSTARCH = HOST from list above + For multicore CPUs using OpenMP: -For Intel KNLs using OpenMP: + .. code-block:: make -.. code-block:: make + KOKKOS_DEVICES = OpenMP + KOKKOS_ARCH = HOSTARCH # HOSTARCH = HOST from list above - KOKKOS_DEVICES = OpenMP - KOKKOS_ARCH = KNL + For Intel KNLs using OpenMP: -For NVIDIA GPUs using CUDA: + .. code-block:: make -.. code-block:: make + KOKKOS_DEVICES = OpenMP + KOKKOS_ARCH = KNL - KOKKOS_DEVICES = Cuda - KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU - KOKKOS_CUDA_OPTIONS = "enable_lambda" - # GPUARCH = GPU from list above - FFT_INC = -DFFT_CUFFT # enable use of cuFFT (optional) - FFT_LIB = -lcufft # link to cuFFT library + For NVIDIA GPUs using CUDA: -For GPUs, you also need the following lines in your ``Makefile.machine`` -before the CC line is defined. They tell ``mpicxx`` to use an ``nvcc`` -compiler wrapper, which will use ``nvcc`` for compiling CUDA files and a -C++ compiler for non-Kokkos, non-CUDA files. + .. code-block:: make -.. code-block:: make + KOKKOS_DEVICES = Cuda + KOKKOS_ARCH = HOSTARCH,GPUARCH # HOSTARCH = HOST from list above that is hosting the GPU + KOKKOS_CUDA_OPTIONS = "enable_lambda" + # GPUARCH = GPU from list above + FFT_INC = -DFFT_CUFFT # enable use of cuFFT (optional) + FFT_LIB = -lcufft # link to cuFFT library - # For OpenMPI - KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) - export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper - CC = mpicxx + For GPUs, you also need the following lines in your + ``Makefile.machine`` before the CC line is defined. They tell + ``mpicxx`` to use an ``nvcc`` compiler wrapper, which will use + ``nvcc`` for compiling CUDA files and a C++ compiler for + non-Kokkos, non-CUDA files. -.. code-block:: make + .. code-block:: make - # For MPICH and derivatives - KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) - CC = mpicxx -cxx=$(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper + # For OpenMPI + KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) + export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper + CC = mpicxx + + .. code-block:: make + + # For MPICH and derivatives + KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) + CC = mpicxx -cxx=$(KOKKOS_ABSOLUTE_PATH)/config/nvcc_wrapper Advanced KOKKOS compilation settings @@ -620,43 +649,43 @@ LATTE package To build with this package, you must download and build the LATTE library. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D DOWNLOAD_LATTE=value # download LATTE for build, value = no (default) or yes - -D LATTE_LIBRARY=path # LATTE library file (only needed if a custom location) + .. code-block:: bash -If ``DOWNLOAD_LATTE`` is set, the LATTE library will be downloaded and -built inside the CMake build directory. If the LATTE library is -already on your system (in a location CMake cannot find it), -``LATTE_LIBRARY`` is the filename (plus path) of the LATTE library file, -not the directory the library file is in. + -D DOWNLOAD_LATTE=value # download LATTE for build, value = no (default) or yes + -D LATTE_LIBRARY=path # LATTE library file (only needed if a custom location) -Traditional make -^^^^^^^^^^^^^^^^ + If ``DOWNLOAD_LATTE`` is set, the LATTE library will be downloaded + and built inside the CMake build directory. If the LATTE library + is already on your system (in a location CMake cannot find it), + ``LATTE_LIBRARY`` is the filename (plus path) of the LATTE library + file, not the directory the library file is in. -You can download and build the LATTE library manually if you prefer; -follow the instructions in ``lib/latte/README``\ . You can also do it in -one step from the ``lammps/src`` dir, using a command like these, which -simply invokes the ``lib/latte/Install.py`` script with the specified -args: + .. tab:: Traditional make -.. code-block:: bash + You can download and build the LATTE library manually if you + prefer; follow the instructions in ``lib/latte/README``\ . You + can also do it in one step from the ``lammps/src`` dir, using a + command like these, which simply invokes the + ``lib/latte/Install.py`` script with the specified args: - $ make lib-latte # print help message - $ make lib-latte args="-b" # download and build in lib/latte/LATTE-master - $ make lib-latte args="-p $HOME/latte" # use existing LATTE installation in $HOME/latte - $ make lib-latte args="-b -m gfortran" # download and build in lib/latte and - # copy Makefile.lammps.gfortran to Makefile.lammps + .. code-block:: bash -Note that 3 symbolic (soft) links, ``includelink`` and ``liblink`` and -``filelink.o``, are created in ``lib/latte`` to point to required -folders and files in the LATTE home directory. When LAMMPS itself is -built it will use these links. You should also check that the -``Makefile.lammps`` file you create is appropriate for the compiler you -use on your system to build LATTE. + $ make lib-latte # print help message + $ make lib-latte args="-b" # download and build in lib/latte/LATTE-master + $ make lib-latte args="-p $HOME/latte" # use existing LATTE installation in $HOME/latte + $ make lib-latte args="-b -m gfortran" # download and build in lib/latte and + # copy Makefile.lammps.gfortran to Makefile.lammps + + Note that 3 symbolic (soft) links, ``includelink`` and ``liblink`` + and ``filelink.o``, are created in ``lib/latte`` to point to + required folders and files in the LATTE home directory. When + LAMMPS itself is built it will use these links. You should also + check that the ``Makefile.lammps`` file you create is appropriate + for the compiler you use on your system to build LATTE. ---------- @@ -669,34 +698,35 @@ This package can optionally include support for messaging via sockets, using the open-source `ZeroMQ library `_, which must be installed on your system. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D MESSAGE_ZMQ=value # build with ZeroMQ support, value = no (default) or yes - -D ZMQ_LIBRARY=path # ZMQ library file (only needed if a custom location) - -D ZMQ_INCLUDE_DIR=path # ZMQ include directory (only needed if a custom location) + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D MESSAGE_ZMQ=value # build with ZeroMQ support, value = no (default) or yes + -D ZMQ_LIBRARY=path # ZMQ library file (only needed if a custom location) + -D ZMQ_INCLUDE_DIR=path # ZMQ include directory (only needed if a custom location) -Before building LAMMPS, you must build the CSlib library in -``lib/message``\ . You can build the CSlib library manually if you prefer; -follow the instructions in ``lib/message/README``\ . You can also do it in -one step from the ``lammps/src`` dir, using a command like these, which -simply invoke the ``lib/message/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the CSlib library in + ``lib/message``\ . You can build the CSlib library manually if + you prefer; follow the instructions in ``lib/message/README``\ . + You can also do it in one step from the ``lammps/src`` dir, using + a command like these, which simply invoke the + ``lib/message/Install.py`` script with the specified args: - $ make lib-message # print help message - $ make lib-message args="-m -z" # build with MPI and socket (ZMQ) support - $ make lib-message args="-s" # build as serial lib with no ZMQ support + .. code-block:: bash -The build should produce two files: ``lib/message/cslib/src/libmessage.a`` -and ``lib/message/Makefile.lammps``. The latter is copied from an -existing ``Makefile.lammps.*`` and has settings to link with the ZeroMQ -library if requested in the build. + $ make lib-message # print help message + $ make lib-message args="-m -z" # build with MPI and socket (ZMQ) support + $ make lib-message args="-s" # build as serial lib with no ZMQ support + + The build should produce two files: ``lib/message/cslib/src/libmessage.a`` + and ``lib/message/Makefile.lammps``. The latter is copied from an + existing ``Makefile.lammps.*`` and has settings to link with the ZeroMQ + library if requested in the build. ---------- @@ -711,43 +741,45 @@ library. Building the MS-CG library requires that the GSL machine. See the ``lib/mscg/README`` and ``MSCG/Install`` files for more details. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D DOWNLOAD_MSCG=value # download MSCG for build, value = no (default) or yes - -D MSCG_LIBRARY=path # MSCG library file (only needed if a custom location) - -D MSCG_INCLUDE_DIR=path # MSCG include directory (only needed if a custom location) + .. code-block:: bash -If ``DOWNLOAD_MSCG`` is set, the MSCG library will be downloaded and built -inside the CMake build directory. If the MSCG library is already on -your system (in a location CMake cannot find it), ``MSCG_LIBRARY`` is the -filename (plus path) of the MSCG library file, not the directory the -library file is in. ``MSCG_INCLUDE_DIR`` is the directory the MSCG -include file is in. + -D DOWNLOAD_MSCG=value # download MSCG for build, value = no (default) or yes + -D MSCG_LIBRARY=path # MSCG library file (only needed if a custom location) + -D MSCG_INCLUDE_DIR=path # MSCG include directory (only needed if a custom location) -Traditional make -^^^^^^^^^^^^^^^^ + If ``DOWNLOAD_MSCG`` is set, the MSCG library will be downloaded + and built inside the CMake build directory. If the MSCG library + is already on your system (in a location CMake cannot find it), + ``MSCG_LIBRARY`` is the filename (plus path) of the MSCG library + file, not the directory the library file is in. + ``MSCG_INCLUDE_DIR`` is the directory the MSCG include file is in. -You can download and build the MS-CG library manually if you prefer; -follow the instructions in ``lib/mscg/README``\ . You can also do it in one -step from the ``lammps/src`` dir, using a command like these, which simply -invoke the ``lib/mscg/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + You can download and build the MS-CG library manually if you + prefer; follow the instructions in ``lib/mscg/README``\ . You can + also do it in one step from the ``lammps/src`` dir, using a + command like these, which simply invoke the + ``lib/mscg/Install.py`` script with the specified args: - $ make lib-mscg # print help message - $ make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master - # with the settings compatible with "make serial" - $ make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master - # with the settings compatible with "make mpi" - $ make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release + .. code-block:: bash -Note that 2 symbolic (soft) links, "includelink" and "liblink", will -be created in ``lib/mscg`` to point to the MS-CG ``src/installation`` -dir. When LAMMPS is built in src it will use these links. You should -not need to edit the ``lib/mscg/Makefile.lammps`` file. + $ make lib-mscg # print help message + $ make lib-mscg args="-b -m serial" # download and build in lib/mscg/MSCG-release-master + # with the settings compatible with "make serial" + $ make lib-mscg args="-b -m mpi" # download and build in lib/mscg/MSCG-release-master + # with the settings compatible with "make mpi" + $ make lib-mscg args="-p /usr/local/mscg-release" # use the existing MS-CG installation in /usr/local/mscg-release + + Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``, + will be created in ``lib/mscg`` to point to the MS-CG + ``src/installation`` dir. When LAMMPS is built in src it will use + these links. You should not need to edit the + ``lib/mscg/Makefile.lammps`` file. ---------- @@ -756,18 +788,18 @@ not need to edit the ``lib/mscg/Makefile.lammps`` file. OPT package --------------------- -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides ``-D PKG_OPT=yes`` + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + No additional settings are needed besides ``-D PKG_OPT=yes`` -The compile flag ``-restrict`` must be used to build LAMMPS with the OPT -package when using Intel compilers. It should be added to the CCFLAGS -line of your ``Makefile.machine``. See -``src/MAKE/OPTIONS/Makefile.opt`` for an example. + .. tab:: Traditional make + + The compiler flag ``-restrict`` must be used to build LAMMPS with + the OPT package when using Intel compilers. It should be added to + the :code:`CCFLAGS` line of your ``Makefile.machine``. See + ``src/MAKE/OPTIONS/Makefile.opt`` for an example. ---------- @@ -776,34 +808,36 @@ line of your ``Makefile.machine``. See POEMS package ------------------------- -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides ``-D PKG_OPT=yes`` + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + No additional settings are needed besides ``-D PKG_OPT=yes`` -Before building LAMMPS, you must build the POEMS library in ``lib/poems``\ . -You can do this manually if you prefer; follow the instructions in -``lib/poems/README``\ . You can also do it in one step from the ``lammps/src`` -dir, using a command like these, which simply invoke the -``lib/poems/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the POEMS library in + ``lib/poems``\ . You can do this manually if you prefer; follow + the instructions in ``lib/poems/README``\ . You can also do it in + one step from the ``lammps/src`` dir, using a command like these, + which simply invoke the ``lib/poems/Install.py`` script with the + specified args: - $ make lib-poems # print help message - $ make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - $ make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") - $ make lib-poems args="-m icc" # build with Intel icc compiler + .. code-block:: bash -The build should produce two files: ``lib/poems/libpoems.a`` and -``lib/poems/Makefile.lammps``. The latter is copied from an existing -``Makefile.lammps.*`` and has settings needed to build LAMMPS with the -POEMS library (though typically the settings are just blank). If -necessary, you can edit/create a new ``lib/poems/Makefile.machine`` file -for your system, which should define an ``EXTRAMAKE`` variable to specify -a corresponding ``Makefile.lammps.machine`` file. + $ make lib-poems # print help message + $ make lib-poems args="-m serial" # build with GNU g++ compiler (settings as with "make serial") + $ make lib-poems args="-m mpi" # build with default MPI C++ compiler (settings as with "make mpi") + $ make lib-poems args="-m icc" # build with Intel icc compiler + + The build should produce two files: ``lib/poems/libpoems.a`` and + ``lib/poems/Makefile.lammps``. The latter is copied from an + existing ``Makefile.lammps.*`` and has settings needed to build + LAMMPS with the POEMS library (though typically the settings are + just blank). If necessary, you can edit/create a new + ``lib/poems/Makefile.machine`` file for your system, which should + define an ``EXTRAMAKE`` variable to specify a corresponding + ``Makefile.lammps.machine`` file. ---------- @@ -812,32 +846,34 @@ a corresponding ``Makefile.lammps.machine`` file. PYTHON package --------------------------- -Building with the PYTHON package requires you have a Python shared -library available on your system, which needs to be a Python 2.7 -version or a Python 3.x version. See ``lib/python/README`` for more -details. +Building with the PYTHON package requires you have a the Python development +headers and library available on your system, which needs to be a Python 2.7 +version or a Python 3.x version. Since support for Python 2.x has ended, +using Python 3.x is strongly recommended. See ``lib/python/README`` for +additional details. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D PYTHON_EXECUTABLE=path # path to Python executable to use + .. code-block:: bash -Without this setting, CMake will guess the default Python on your -system. To use a different Python version, you can either create a -virtualenv, activate it and then run cmake. Or you can set the -PYTHON_EXECUTABLE variable to specify which Python interpreter should -be used. Note note that you will also need to have the development -headers installed for this version, e.g. python2-devel. + -D PYTHON_EXECUTABLE=path # path to Python executable to use -Traditional make -^^^^^^^^^^^^^^^^ + Without this setting, CMake will guess the default Python version + on your system. To use a different Python version, you can either + create a virtualenv, activate it and then run cmake. Or you can + set the PYTHON_EXECUTABLE variable to specify which Python + interpreter should be used. Note note that you will also need to + have the development headers installed for this version, + e.g. python2-devel. -The build uses the ``lib/python/Makefile.lammps`` file in the compile/link -process to find Python. You should only need to create a new -``Makefile.lammps.*`` file (and copy it to ``Makefile.lammps``) if -the LAMMPS build fails. + .. tab:: Traditional make + + The build uses the ``lib/python/Makefile.lammps`` file in the + compile/link process to find Python. You should only need to + create a new ``Makefile.lammps.*`` file (and copy it to + ``Makefile.lammps``) if the LAMMPS build fails. ---------- @@ -846,46 +882,48 @@ the LAMMPS build fails. VORONOI package ----------------------------- -To build with this package, you must download and build the `Voro++ library `_. +To build with this package, you must download and build the +`Voro++ library `_ or install a +binary package provided by your operating system. -.. _voro-home: http://math.lbl.gov/voro++ +.. tabs:: -CMake build -^^^^^^^^^^^ + .. tab:: CMake build -.. code-block:: bash + .. code-block:: bash - -D DOWNLOAD_VORO=value # download Voro++ for build, value = no (default) or yes - -D VORO_LIBRARY=path # Voro++ library file (only needed if at custom location) - -D VORO_INCLUDE_DIR=path # Voro++ include directory (only needed if at custom location) + -D DOWNLOAD_VORO=value # download Voro++ for build, value = no (default) or yes + -D VORO_LIBRARY=path # Voro++ library file (only needed if at custom location) + -D VORO_INCLUDE_DIR=path # Voro++ include directory (only needed if at custom location) -If ``DOWNLOAD_VORO`` is set, the Voro++ library will be downloaded and -built inside the CMake build directory. If the Voro++ library is -already on your system (in a location CMake cannot find it), -``VORO_LIBRARY`` is the filename (plus path) of the Voro++ library file, -not the directory the library file is in. ``VORO_INCLUDE_DIR`` is the -directory the Voro++ include file is in. + If ``DOWNLOAD_VORO`` is set, the Voro++ library will be downloaded + and built inside the CMake build directory. If the Voro++ library + is already on your system (in a location CMake cannot find it), + ``VORO_LIBRARY`` is the filename (plus path) of the Voro++ library + file, not the directory the library file is in. + ``VORO_INCLUDE_DIR`` is the directory the Voro++ include file is + in. -Traditional make -^^^^^^^^^^^^^^^^ + .. tab:: Traditional make -You can download and build the Voro++ library manually if you prefer; -follow the instructions in ``lib/voronoi/README``. You can also do it in -one step from the ``lammps/src`` dir, using a command like these, which -simply invoke the ``lib/voronoi/Install.py`` script with the specified -args: + You can download and build the Voro++ library manually if you + prefer; follow the instructions in ``lib/voronoi/README``. You + can also do it in one step from the ``lammps/src`` dir, using a + command like these, which simply invoke the + ``lib/voronoi/Install.py`` script with the specified args: -.. code-block:: bash + .. code-block:: bash - $ make lib-voronoi # print help message - $ make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++- - $ make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++ - $ make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 + $ make lib-voronoi # print help message + $ make lib-voronoi args="-b" # download and build the default version in lib/voronoi/voro++- + $ make lib-voronoi args="-p $HOME/voro++" # use existing Voro++ installation in $HOME/voro++ + $ make lib-voronoi args="-b -v voro++0.4.6" # download and build the 0.4.6 version in lib/voronoi/voro++-0.4.6 -Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``, are -created in lib/voronoi to point to the Voro++ source dir. When LAMMPS -builds in ``src`` it will use these links. You should not need to edit -the ``lib/voronoi/Makefile.lammps`` file. + Note that 2 symbolic (soft) links, ``includelink`` and + ``liblink``, are created in lib/voronoi to point to the Voro++ + source dir. When LAMMPS builds in ``src`` it will use these + links. You should not need to edit the + ``lib/voronoi/Makefile.lammps`` file. ---------- @@ -903,29 +941,30 @@ environment variables have been updated for the local ADIOS installation and the instructions below are followed for the respective build systems. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D ADIOS2_DIR=path # path is where ADIOS 2.x is installed - -D PKG_USER-ADIOS=yes + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D ADIOS2_DIR=path # path is where ADIOS 2.x is installed + -D PKG_USER-ADIOS=yes -Turn on the USER-ADIOS package before building LAMMPS. If the ADIOS 2.x -software is installed in PATH, there is nothing else to do: + .. tab:: Traditional make -.. code-block:: bash + Turn on the USER-ADIOS package before building LAMMPS. If the + ADIOS 2.x software is installed in PATH, there is nothing else to + do: - $ make yes-user-adios + .. code-block:: bash -otherwise, set ADIOS2_DIR environment variable when turning on the package: + $ make yes-user-adios -.. code-block:: bash + otherwise, set ADIOS2_DIR environment variable when turning on the package: - $ ADIOS2_DIR=path make yes-user-adios # path is where ADIOS 2.x is installed + .. code-block:: bash + + $ ADIOS2_DIR=path make yes-user-adios # path is where ADIOS 2.x is installed ---------- @@ -936,48 +975,50 @@ USER-ATC package The USER-ATC package requires the MANYBODY package also be installed. -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides "-D PKG_USER-ATC=yes" -and "-D PKG_MANYBODY=yes". + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + No additional settings are needed besides ``-D PKG_USER-ATC=yes`` + and ``-D PKG_MANYBODY=yes``. -Before building LAMMPS, you must build the ATC library in ``lib/atc``. -You can do this manually if you prefer; follow the instructions in -``lib/atc/README``. You can also do it in one step from the -``lammps/src`` dir, using a command like these, which simply invoke the -``lib/atc/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the ATC library in + ``lib/atc``. You can do this manually if you prefer; follow the + instructions in ``lib/atc/README``. You can also do it in one + step from the ``lammps/src`` dir, using a command like these, + which simply invoke the ``lib/atc/Install.py`` script with the + specified args: - $ make lib-atc # print help message - $ make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - $ make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - $ make lib-atc args="-m icc" # build with Intel icc compiler + .. code-block:: bash -The build should produce two files: ``lib/atc/libatc.a`` and -``lib/atc/Makefile.lammps``. The latter is copied from an existing -``Makefile.lammps.*`` and has settings needed to build LAMMPS with the -ATC library. If necessary, you can edit/create a new -``lib/atc/Makefile.machine`` file for your system, which should define -an ``EXTRAMAKE`` variable to specify a corresponding -``Makefile.lammps.`` file. + $ make lib-atc # print help message + $ make lib-atc args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + $ make lib-atc args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + $ make lib-atc args="-m icc" # build with Intel icc compiler -Note that the Makefile.lammps file has settings for the BLAS and -LAPACK linear algebra libraries. As explained in ``lib/atc/README`` these -can either exist on your system, or you can use the files provided in -``lib/linalg``. In the latter case you also need to build the library in -``lib/linalg`` with a command like these: + The build should produce two files: ``lib/atc/libatc.a`` and + ``lib/atc/Makefile.lammps``. The latter is copied from an + existing ``Makefile.lammps.*`` and has settings needed to build + LAMMPS with the ATC library. If necessary, you can edit/create a + new ``lib/atc/Makefile.machine`` file for your system, which + should define an ``EXTRAMAKE`` variable to specify a corresponding + ``Makefile.lammps.`` file. -.. code-block:: bash + Note that the Makefile.lammps file has settings for the BLAS and + LAPACK linear algebra libraries. As explained in + ``lib/atc/README`` these can either exist on your system, or you + can use the files provided in ``lib/linalg``. In the latter case + you also need to build the library in ``lib/linalg`` with a + command like these: - $ make lib-linalg # print help message - $ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") - $ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") - $ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler + .. code-block:: bash + + $ make lib-linalg # print help message + $ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") + $ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") + $ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler ---------- @@ -986,47 +1027,49 @@ can either exist on your system, or you can use the files provided in USER-AWPMD package ------------------ -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides ``-D PKG_USER-AQPMD=yes``. + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + No additional settings are needed besides ``-D PKG_USER-AQPMD=yes``. -Before building LAMMPS, you must build the AWPMD library in ``lib/awpmd``. -You can do this manually if you prefer; follow the instructions in -``lib/awpmd/README``. You can also do it in one step from the ``lammps/src`` -dir, using a command like these, which simply invoke the -``lib/awpmd/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the AWPMD library in + ``lib/awpmd``. You can do this manually if you prefer; follow the + instructions in ``lib/awpmd/README``. You can also do it in one + step from the ``lammps/src`` dir, using a command like these, + which simply invoke the ``lib/awpmd/Install.py`` script with the + specified args: - $ make lib-awpmd # print help message - $ make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") - $ make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - $ make lib-awpmd args="-m icc" # build with Intel icc compiler + .. code-block:: bash -The build should produce two files: ``lib/awpmd/libawpmd.a`` and -``lib/awpmd/Makefile.lammps``. The latter is copied from an existing -``Makefile.lammps.*`` and has settings needed to build LAMMPS with the -AWPMD library. If necessary, you can edit/create a new -``lib/awpmd/Makefile.machine`` file for your system, which should define -an ``EXTRAMAKE`` variable to specify a corresponding -``Makefile.lammps.`` file. + $ make lib-awpmd # print help message + $ make lib-awpmd args="-m serial" # build with GNU g++ compiler and MPI STUBS (settings as with "make serial") + $ make lib-awpmd args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + $ make lib-awpmd args="-m icc" # build with Intel icc compiler -Note that the ``Makefile.lammps`` file has settings for the BLAS and -LAPACK linear algebra libraries. As explained in ``lib/awpmd/README`` -these can either exist on your system, or you can use the files -provided in ``lib/linalg``. In the latter case you also need to build the -library in ``lib/linalg`` with a command like these: + The build should produce two files: ``lib/awpmd/libawpmd.a`` and + ``lib/awpmd/Makefile.lammps``. The latter is copied from an + existing ``Makefile.lammps.*`` and has settings needed to build + LAMMPS with the AWPMD library. If necessary, you can edit/create + a new ``lib/awpmd/Makefile.machine`` file for your system, which + should define an ``EXTRAMAKE`` variable to specify a corresponding + ``Makefile.lammps.`` file. -.. code-block:: bash + Note that the ``Makefile.lammps`` file has settings for the BLAS + and LAPACK linear algebra libraries. As explained in + ``lib/awpmd/README`` these can either exist on your system, or you + can use the files provided in ``lib/linalg``. In the latter case + you also need to build the library in ``lib/linalg`` with a + command like these: - $ make lib-linalg # print help message - $ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") - $ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") - $ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler + .. code-block:: bash + + $ make lib-linalg # print help message + $ make lib-linalg args="-m serial" # build with GNU Fortran compiler (settings as with "make serial") + $ make lib-linalg args="-m mpi" # build with default MPI Fortran compiler (settings as with "make mpi") + $ make lib-linalg args="-m gfortran" # build with GNU Fortran compiler ---------- @@ -1035,54 +1078,57 @@ library in ``lib/linalg`` with a command like these: USER-COLVARS package --------------------------------------- -This package includes into the LAMMPS distribution the Colvars library, which -can be built for the most part with all major versions of the C++ language. +This package includes the `Colvars library +`_ into the LAMMPS distribution, which can +be built for the most part with all major versions of the C++ language. -CMake build -^^^^^^^^^^^ +.. tabs:: -This is the recommended build recipe: no additional settings are normally -needed besides ``-D PKG_USER-COLVARS=yes``. + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + This is the recommended build procedure for using Colvars in + LAMMPS. No additional settings are normally needed besides + ``-D PKG_USER-COLVARS=yes``. -Before building LAMMPS, one must build the Colvars library in lib/colvars. + .. tab:: Traditional make -This can be done manually in the same folder by using or adapting one of -the provided Makefiles: for example, ``Makefile.g++`` for the GNU C++ -compiler. C++11 compatibility may need to be enabled for some older -compilers (as is done in the example makefile). + Before building LAMMPS, one must build the Colvars library in lib/colvars. -In general, it is safer to use build setting consistent with the rest of -LAMMPS. This is best carried out from the LAMMPS src directory using a -command like these, which simply invoke the ``lib/colvars/Install.py`` script with -the specified args: + This can be done manually in the same folder by using or adapting + one of the provided Makefiles: for example, ``Makefile.g++`` for + the GNU C++ compiler. C++11 compatibility may need to be enabled + for some older compilers (as is done in the example makefile). -.. code-block:: bash + In general, it is safer to use build setting consistent with the + rest of LAMMPS. This is best carried out from the LAMMPS src + directory using a command like these, which simply invoke the + ``lib/colvars/Install.py`` script with the specified args: - $ make lib-colvars # print help message - $ make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial") - $ make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi") - $ make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled + .. code-block:: bash -The "machine" argument of the "-m" flag is used to find a Makefile.machine to -use as build recipe. If it does not already exist in ``lib/colvars``, it will be -auto-generated by using compiler flags consistent with those parsed from the -core LAMMPS makefiles. + $ make lib-colvars # print help message + $ make lib-colvars args="-m serial" # build with GNU g++ compiler (settings as with "make serial") + $ make lib-colvars args="-m mpi" # build with default MPI compiler (settings as with "make mpi") + $ make lib-colvars args="-m g++-debug" # build with GNU g++ compiler and colvars debugging enabled -Optional flags may be specified as environment variables: + The "machine" argument of the "-m" flag is used to find a + Makefile.machine to use as build recipe. If it does not already + exist in ``lib/colvars``, it will be auto-generated by using + compiler flags consistent with those parsed from the core LAMMPS + makefiles. -.. code-block:: bash + Optional flags may be specified as environment variables: - $ COLVARS_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower) - $ COLVARS_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise) + .. code-block:: bash -The build should produce two files: the library ``lib/colvars/libcolvars.a`` -(which also includes Lepton objects if enabled) and the specification file -``lib/colvars/Makefile.lammps``. The latter is auto-generated, and normally does -not need to be edited. + $ COLVARS_DEBUG=yes make lib-colvars args="-m machine" # Build with debug code (much slower) + $ COLVARS_LEPTON=no make lib-colvars args="-m machine" # Build without Lepton (included otherwise) + + The build should produce two files: the library ``lib/colvars/libcolvars.a`` + (which also includes Lepton objects if enabled) and the specification file + ``lib/colvars/Makefile.lammps``. The latter is auto-generated, and normally does + not need to be edited. ---------- @@ -1095,7 +1141,7 @@ USER-PLUMED package Before building LAMMPS with this package, you must first build PLUMED. PLUMED can be built as part of the LAMMPS build or installed separately -from LAMMPS using the generic `plumed installation instructions `_. +from LAMMPS using the generic `PLUMED installation instructions `_. The USER-PLUMED package has been tested to work with Plumed versions 2.4.x, 2.5.x, and 2.6.x and will error out, when trying to run calculations with a different version of the Plumed kernel. @@ -1128,84 +1174,91 @@ try a different one, switch to a different build system, consider a global PLUMED installation or consider downloading PLUMED during the LAMMPS build. -CMake build -^^^^^^^^^^^ +.. tabs:: -When the ``-D PKG_USER-PLUMED=yes`` flag is included in the cmake -command you must ensure that GSL is installed in locations that are -specified in your environment. There are then two additional variables -that control the manner in which PLUMED is obtained and linked into -LAMMPS. + .. tab:: CMake build -.. code-block:: bash + When the ``-D PKG_USER-PLUMED=yes`` flag is included in the cmake + command you must ensure that GSL is installed in locations that + are specified in your environment. There are then two additional + variables that control the manner in which PLUMED is obtained and + linked into LAMMPS. - -D DOWNLOAD_PLUMED=value # download PLUMED for build, value = no (default) or yes - -D PLUMED_MODE=value # Linkage mode for PLUMED, value = static (default), shared, or runtime + .. code-block:: bash -If DOWNLOAD_PLUMED is set to "yes", the PLUMED library will be -downloaded (the version of PLUMED that will be downloaded is hard-coded -to a vetted version of PLUMED, usually a recent stable release version) -and built inside the CMake build directory. If ``DOWNLOAD_PLUMED`` is -set to "no" (the default), CMake will try to detect and link to an -installed version of PLUMED. For this to work, the PLUMED library has -to be installed into a location where the ``pkg-config`` tool can find -it or the PKG_CONFIG_PATH environment variable has to be set up -accordingly. PLUMED should be installed in such a location if you -compile it using the default make; make install commands. + -D DOWNLOAD_PLUMED=value # download PLUMED for build, value = no (default) or yes + -D PLUMED_MODE=value # Linkage mode for PLUMED, value = static (default), shared, or runtime -The ``PLUMED_MODE`` setting determines the linkage mode for the PLUMED -library. The allowed values for this flag are "static" (default), -"shared", or "runtime". For a discussion of PLUMED linkage modes, -please see above. When ``DOWNLOAD_PLUMED`` is enabled the static -linkage mode is recommended. + If DOWNLOAD_PLUMED is set to "yes", the PLUMED library will be + downloaded (the version of PLUMED that will be downloaded is + hard-coded to a vetted version of PLUMED, usually a recent stable + release version) and built inside the CMake build directory. If + ``DOWNLOAD_PLUMED`` is set to "no" (the default), CMake will try + to detect and link to an installed version of PLUMED. For this to + work, the PLUMED library has to be installed into a location where + the ``pkg-config`` tool can find it or the PKG_CONFIG_PATH + environment variable has to be set up accordingly. PLUMED should + be installed in such a location if you compile it using the + default make; make install commands. -Traditional make -^^^^^^^^^^^^^^^^ + The ``PLUMED_MODE`` setting determines the linkage mode for the + PLUMED library. The allowed values for this flag are "static" + (default), "shared", or "runtime". If you want to switch the + linkage mode, just re-run CMake with a different setting. For a + discussion of PLUMED linkage modes, please see above. When + ``DOWNLOAD_PLUMED`` is enabled the static linkage mode is + recommended. -PLUMED needs to be installed before the USER-PLUMED package is installed -so that LAMMPS can find the right settings when compiling and linking -the LAMMPS executable. You can either download and build PLUMED inside -the LAMMPS plumed library folder or use a previously installed PLUMED -library and point LAMMPS to its location. You also have to choose the -linkage mode: "static" (default), "shared" or "runtime". For a -discussion of PLUMED linkage modes, please see above. + .. tab:: Traditional make -Download/compilation/configuration of the plumed library can be done -from the src folder through the following make args: + PLUMED needs to be installed before the USER-PLUMED package is + installed so that LAMMPS can find the right settings when + compiling and linking the LAMMPS executable. You can either + download and build PLUMED inside the LAMMPS plumed library folder + or use a previously installed PLUMED library and point LAMMPS to + its location. You also have to choose the linkage mode: "static" + (default), "shared" or "runtime". For a discussion of PLUMED + linkage modes, please see above. -.. code-block:: bash + Download/compilation/configuration of the plumed library can be done + from the src folder through the following make args: - $ make lib-plumed # print help message - $ make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2 - $ make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local - $ make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in - # /usr/local and use shared linkage mode + .. code-block:: bash -Note that 2 symbolic (soft) links, ``includelink`` and ``liblink`` are -created in lib/plumed that point to the location of the PLUMED build to -use. A new file ``lib/plumed/Makefile.lammps`` is also created with settings -suitable for LAMMPS to compile and link PLUMED using the desired linkage -mode. After this step is completed, you can install the USER-PLUMED -package and compile LAMMPS in the usual manner: + $ make lib-plumed # print help message + $ make lib-plumed args="-b" # download and build PLUMED in lib/plumed/plumed2 + $ make lib-plumed args="-p $HOME/.local" # use existing PLUMED installation in $HOME/.local + $ make lib-plumed args="-p /usr/local -m shared" # use existing PLUMED installation in + # /usr/local and use shared linkage mode -.. code-block:: bash + Note that 2 symbolic (soft) links, ``includelink`` and ``liblink`` + are created in lib/plumed that point to the location of the PLUMED + build to use. A new file ``lib/plumed/Makefile.lammps`` is also + created with settings suitable for LAMMPS to compile and link + PLUMED using the desired linkage mode. After this step is + completed, you can install the USER-PLUMED package and compile + LAMMPS in the usual manner: - $ make yes-user-plumed - $ make machine + .. code-block:: bash -Once this compilation completes you should be able to run LAMMPS in the -usual way. For shared linkage mode, libplumed.so must be found by the -LAMMPS executable, which on many operating systems means, you have to -set the LD_LIBRARY_PATH environment variable accordingly. + $ make yes-user-plumed + $ make machine -Support for the different linkage modes in LAMMPS varies for different -operating systems, using the static linkage is expected to be the most -portable, and thus set to be the default. + Once this compilation completes you should be able to run LAMMPS + in the usual way. For shared linkage mode, libplumed.so must be + found by the LAMMPS executable, which on many operating systems + means, you have to set the LD_LIBRARY_PATH environment variable + accordingly. -If you want to change the linkage mode, you have to re-run "make -lib-plumed" with the desired settings **and** do a re-install if the -USER-PLUMED package with "make yes-user-plumed" to update the required -makefile settings with the changes in the lib/plumed folder. + Support for the different linkage modes in LAMMPS varies for + different operating systems, using the static linkage is expected + to be the most portable, and thus set to be the default. + + If you want to change the linkage mode, you have to re-run "make + lib-plumed" with the desired settings **and** do a re-install if + the USER-PLUMED package with "make yes-user-plumed" to update the + required makefile settings with the changes in the lib/plumed + folder. ---------- @@ -1218,38 +1271,39 @@ To build with this package you must have the HDF5 software package installed on your system, which should include the h5cc compiler and the HDF5 library. -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides ``-D PKG_USER-H5MD=yes``. + .. tab:: CMake build -This should auto-detect the H5MD library on your system. Several -advanced CMake H5MD options exist if you need to specify where it is -installed. Use the ccmake (terminal window) or cmake-gui (graphical) -tools to see these options and set them interactively from their user -interfaces. + No additional settings are needed besides ``-D PKG_USER-H5MD=yes``. -Traditional make -^^^^^^^^^^^^^^^^ + This should auto-detect the H5MD library on your system. Several + advanced CMake H5MD options exist if you need to specify where it + is installed. Use the ccmake (terminal window) or cmake-gui + (graphical) tools to see these options and set them interactively + from their user interfaces. -Before building LAMMPS, you must build the CH5MD library in -``lib/h5md``. You can do this manually if you prefer; follow the -instructions in ``lib/h5md/README``. You can also do it in one step -from the ``lammps/src`` dir, using a command like these, which simply -invoke the ``lib/h5md/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the CH5MD library in + ``lib/h5md``. You can do this manually if you prefer; follow the + instructions in ``lib/h5md/README``. You can also do it in one + step from the ``lammps/src`` dir, using a command like these, + which simply invoke the ``lib/h5md/Install.py`` script with the + specified args: - $ make lib-h5md # print help message - $ make lib-h5md args="-m h5cc" # build with h5cc compiler + .. code-block:: bash -The build should produce two files: ``lib/h5md/libch5md.a`` and -``lib/h5md/Makefile.lammps``. The latter is copied from an existing -``Makefile.lammps.*`` and has settings needed to build LAMMPS with the -system HDF5 library. If necessary, you can edit/create a new -``lib/h5md/Makefile.machine`` file for your system, which should define -an EXTRAMAKE variable to specify a corresponding -``Makefile.lammps.`` file. + $ make lib-h5md # print help message + $ make lib-h5md args="-m h5cc" # build with h5cc compiler + + The build should produce two files: ``lib/h5md/libch5md.a`` and + ``lib/h5md/Makefile.lammps``. The latter is copied from an + existing ``Makefile.lammps.*`` and has settings needed to build + LAMMPS with the system HDF5 library. If necessary, you can + edit/create a new ``lib/h5md/Makefile.machine`` file for your + system, which should define an EXTRAMAKE variable to specify a + corresponding ``Makefile.lammps.`` file. ---------- @@ -1262,7 +1316,7 @@ To build with this package, you must choose which hardware you want to build for, either x86 CPUs or Intel KNLs in offload mode. You should also typically :ref:`install the USER-OMP package `, as it can be used in tandem with the USER-INTEL package to good effect, as explained -on the :doc:`Speed intel ` doc page. +on the :doc:`Speed_intel` page. When using Intel compilers version 16.0 or later is required. You can also use the GNU or Clang compilers and they will provide performance @@ -1273,51 +1327,53 @@ incorrectly and thus can cause segmentation faults in otherwise correct code when using features from the USER-INTEL package. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D INTEL_ARCH=value # value = cpu (default) or knl - -D INTEL_LRT_MODE=value # value = threads, none, or c++11 + .. code-block:: bash + + -D INTEL_ARCH=value # value = cpu (default) or knl + -D INTEL_LRT_MODE=value # value = threads, none, or c++11 + + .. tab:: Traditional make + + Choose which hardware to compile for in Makefile.machine via the + following settings. See ``src/MAKE/OPTIONS/Makefile.intel_cpu*`` + and ``Makefile.knl`` files for examples. and + ``src/USER-INTEL/README`` for additional information. + + For CPUs: + + .. code-block:: make + + OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high + CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload -fno-alias -ansi-alias -restrict $(OPTFLAGS) + LINKFLAGS = -g -qopenmp $(OPTFLAGS) + LIB = -ltbbmalloc + + For KNLs: + + .. code-block:: make + + OPTFLAGS = -xMIC-AVX512 -O2 -fp-model fast=2 -no-prec-div -qoverride-limits + CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload -fno-alias -ansi-alias -restrict $(OPTFLAGS) + LINKFLAGS = -g -qopenmp $(OPTFLAGS) + LIB = -ltbbmalloc In Long-range thread mode (LRT) a modified verlet style is used, that operates the Kspace calculation in a separate thread concurrently to -other calculations. This has to be enabled in the :doc:`package intel ` -command at runtime. With the setting "threads" it used the pthreads -library, while c++11 will use the built-in thread support of C++11 -compilers. The option "none" skips compilation of this feature. The -default is to use "threads" if pthreads is available and otherwise "none". +other calculations. This has to be enabled in the :doc:`package intel +` command at runtime. With the setting "threads" it used the +pthreads library, while "c++11" will use the built-in thread support +of C++11 compilers. The option "none" skips compilation of this +feature. The default is to use "threads" if pthreads is available and +otherwise "none". -Best performance is achieved with Intel hardware, Intel compilers, as well as -the Intel TBB and MKL libraries. However, the code also compiles, links, and -runs with other compilers and without TBB and MKL. - -Traditional make -^^^^^^^^^^^^^^^^ - -Choose which hardware to compile for in Makefile.machine via the -following settings. See ``src/MAKE/OPTIONS/Makefile.intel_cpu*`` and -``Makefile.knl`` files for examples. and ``src/USER-INTEL/README`` for -additional information. - -For CPUs: - -.. code-block:: make - - OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits -qopt-zmm-usage=high - CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload -fno-alias -ansi-alias -restrict $(OPTFLAGS) - LINKFLAGS = -g -qopenmp $(OPTFLAGS) - LIB = -ltbbmalloc - -For KNLs: - -.. code-block:: make - - OPTFLAGS = -xMIC-AVX512 -O2 -fp-model fast=2 -no-prec-div -qoverride-limits - CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload -fno-alias -ansi-alias -restrict $(OPTFLAGS) - LINKFLAGS = -g -qopenmp $(OPTFLAGS) - LIB = -ltbbmalloc +Best performance is achieved with Intel hardware, Intel compilers, as +well as the Intel TBB and MKL libraries. However, the code also +compiles, links, and runs with other compilers / hardware and without +TBB and MKL. ---------- @@ -1332,31 +1388,34 @@ compile it. Also, the files with the force field data for running the bundled examples are not included in the source distribution. Instead they will be downloaded the first time this package is installed. -**CMake build**\ : +.. tabs:: -No additional settings are needed besides ``-D PKG_USER-MESONT=yes`` + .. tab:: CMake build -**Traditional make**\ : + No additional settings are needed besides ``-D PKG_USER-MESONT=yes`` -Before building LAMMPS, you must build the *mesont* library in ``lib/mesont``\ . -You can also do it in one step from the ``lammps/src`` dir, using a command like -these, which simply invoke the ``lib/mesont/Install.py`` script with the specified -args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the *mesont* library in + ``lib/mesont``\ . You can also do it in one step from the + ``lammps/src`` dir, using a command like these, which simply + invoke the ``lib/mesont/Install.py`` script with the specified + args: - $ make lib-mesont # print help message - $ make lib-mesont args="-m gfortran" # build with GNU g++ compiler (settings as with "make serial") - $ make lib-mesont args="-m ifort" # build with Intel icc compiler + .. code-block:: bash -The build should produce two files: ``lib/mesont/libmesont.a`` and -``lib/mesont/Makefile.lammps``\ . The latter is copied from an existing -``Makefile.lammps.\*`` and has settings needed to build LAMMPS with the -*mesont* library (though typically the settings contain only the Fortran -runtime library). If necessary, you can edit/create a new -``lib/mesont/Makefile.machine`` file for your system, which should -define an ``EXTRAMAKE`` variable to specify a corresponding -``Makefile.lammps.machine`` file. + $ make lib-mesont # print help message + $ make lib-mesont args="-m gfortran" # build with GNU g++ compiler (settings as with "make serial") + $ make lib-mesont args="-m ifort" # build with Intel icc compiler + + The build should produce two files: ``lib/mesont/libmesont.a`` and + ``lib/mesont/Makefile.lammps``\ . The latter is copied from an + existing ``Makefile.lammps.\*`` and has settings needed to build + LAMMPS with the *mesont* library (though typically the settings + contain only the Fortran runtime library). If necessary, you can + edit/create a new ``lib/mesont/Makefile.machine`` file for your + system, which should define an ``EXTRAMAKE`` variable to specify a + corresponding ``Makefile.lammps.machine`` file. ---------- @@ -1365,35 +1424,36 @@ define an ``EXTRAMAKE`` variable to specify a corresponding USER-MOLFILE package --------------------------------------- -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D MOLFILE_INCLUDE_DIRS=path # (optional) path where VMD molfile plugin headers are installed - -D PKG_USER-MOLFILE=yes + .. code-block:: bash -Using "-D PKG_USER-MOLFILE=yes" enables the package, and setting -"-D MOLFILE_INCLUDE DIRS" allows to provide a custom location for -the molfile plugin header files. These should match the ABI of the -plugin files used, and thus one typically sets them to include -folder of the local VMD installation in use. LAMMPS ships with a -couple of default header files that correspond to a popular VMD -version, usually the latest release. + -D MOLFILE_INCLUDE_DIR=path # (optional) path where VMD molfile plugin headers are installed + -D PKG_USER-MOLFILE=yes -Traditional make -^^^^^^^^^^^^^^^^ + Using ``-D PKG_USER-MOLFILE=yes`` enables the package, and setting + ``-D MOLFILE_INCLUDE_DIR`` allows to provide a custom location for + the molfile plugin header files. These should match the ABI of the + plugin files used, and thus one typically sets them to include + folder of the local VMD installation in use. LAMMPS ships with a + couple of default header files that correspond to a popular VMD + version, usually the latest release. -The ``lib/molfile/Makefile.lammps`` file has a setting for a dynamic -loading library libdl.a that is typically present on all systems. It -is required for LAMMPS to link with this package. If the setting is -not valid for your system, you will need to edit the Makefile.lammps -file. See ``lib/molfile/README`` and ``lib/molfile/Makefile.lammps`` for -details. It is also possible to configure a different folder with -the VMD molfile plugin header files. LAMMPS ships with a couple of -default headers, but these are not compatible with all VMD versions, -so it is often best to change this setting to the location of the -same include files of the local VMD installation in use. + .. tab:: Traditional make + + The ``lib/molfile/Makefile.lammps`` file has a setting for a + dynamic loading library libdl.a that is typically present on all + systems. It is required for LAMMPS to link with this package. If + the setting is not valid for your system, you will need to edit + the Makefile.lammps file. See ``lib/molfile/README`` and + ``lib/molfile/Makefile.lammps`` for details. It is also possible + to configure a different folder with the VMD molfile plugin header + files. LAMMPS ships with a couple of default headers, but these + are not compatible with all VMD versions, so it is often best to + change this setting to the location of the same include files of + the local VMD installation in use. ---------- @@ -1405,24 +1465,26 @@ USER-NETCDF package To build with this package you must have the NetCDF library installed on your system. -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides ``-D PKG_USER-NETCDF=yes``. + .. tab:: CMake build -This should auto-detect the NETCDF library if it is installed on your -system at standard locations. Several advanced CMake NETCDF options -exist if you need to specify where it was installed. Use the ``ccmake`` -(terminal window) or ``cmake-gui`` (graphical) tools to see these -options and set them interactively from their user interfaces. + No additional settings are needed besides ``-D PKG_USER-NETCDF=yes``. -Traditional make -^^^^^^^^^^^^^^^^ + This should auto-detect the NETCDF library if it is installed on + your system at standard locations. Several advanced CMake NETCDF + options exist if you need to specify where it was installed. Use + the ``ccmake`` (terminal window) or ``cmake-gui`` (graphical) + tools to see these options and set them interactively from their + user interfaces. -The ``lib/netcdf/Makefile.lammps`` file has settings for NetCDF include -and library files which LAMMPS needs to build with this package. If -the settings are not valid for your system, you will need to edit the -``Makefile.lammps`` file. See ``lib/netcdf/README`` for details. + .. tab:: Traditional make + + The ``lib/netcdf/Makefile.lammps`` file has settings for NetCDF + include and library files which LAMMPS needs to build with this + package. If the settings are not valid for your system, you will + need to edit the ``Makefile.lammps`` file. See + ``lib/netcdf/README`` for details. ---------- @@ -1431,30 +1493,31 @@ the settings are not valid for your system, you will need to edit the USER-OMP package ------------------------------- -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are required besides ``-D PKG_USER-OMP=yes``. If -CMake detects OpenMP support, the USER-OMP code will be compiled with -multi-threading support enabled, otherwise as optimized serial code. + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + No additional settings are required besides ``-D + PKG_USER-OMP=yes``. If CMake detects OpenMP compiler support, the + USER-OMP code will be compiled with multi-threading support + enabled, otherwise as optimized serial code. -To enable multi-threading support in the USER-OMP package (and other -styles supporting OpenMP) the following compile and link flags must be -added to your Makefile.machine file. See -``src/MAKE/OPTIONS/Makefile.omp`` for an example. + .. tab:: Traditional make -.. parsed-literal:: + To enable multi-threading support in the USER-OMP package (and + other styles supporting OpenMP) the following compile and link + flags must be added to your Makefile.machine file. See + ``src/MAKE/OPTIONS/Makefile.omp`` for an example. - CCFLAGS: -fopenmp # for GNU and Clang Compilers - CCFLAGS: -qopenmp -restrict # for Intel compilers on Linux - LINKFLAGS: -fopenmp # for GNU and Clang Compilers - LINKFLAGS: -qopenmp # for Intel compilers on Linux + .. parsed-literal:: -For other platforms and compilers, please consult the documentation -about OpenMP support for your compiler. + CCFLAGS: -fopenmp # for GNU and Clang Compilers + CCFLAGS: -qopenmp -restrict # for Intel compilers on Linux + LINKFLAGS: -fopenmp # for GNU and Clang Compilers + LINKFLAGS: -qopenmp # for Intel compilers on Linux + + For other platforms and compilers, please consult the + documentation about OpenMP support for your compiler. ---------- @@ -1476,58 +1539,60 @@ and LAMMPS versions. The current interface and makefiles have last been verified to work in February 2020 with Quantum Espresso versions 6.3 to 6.5. -CMake build -^^^^^^^^^^^ +.. tabs:: -When using CMake, building a LAMMPS library is required and it is -recommended to build a shared library, since any libraries built 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 building LAMMPS for USER-QMMM -would be: + .. tab:: CMake build -.. code-block:: bash + When using CMake, building a LAMMPS library is required and it is + recommended to build a shared library, since any libraries built + 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 + building LAMMPS for USER-QMMM would be: - cmake -C ../cmake/presets/minimal.cmake -D PKG_USER-QMMM=yes \ - -D BUILD_LIB=yes -DBUILD_SHARED_LIBS=yes ../cmake + .. code-block:: bash -After completing the LAMMPS build and also configuring and compiling -Quantum ESPRESSO with external library support (via "make couple"), -go back to the ``lib/qmmm` folder and follow the instructions on the -README file to build the combined LAMMPS/QE QM/MM executable -(pwqmmm.x) in the ``lib/qmmm`` folder. You need to make certain, that + cmake -C ../cmake/presets/minimal.cmake -D PKG_USER-QMMM=yes \ + -D BUILD_LIB=yes -DBUILD_SHARED_LIBS=yes ../cmake -Traditional make -^^^^^^^^^^^^^^^^ + After completing the LAMMPS build and also configuring and + compiling Quantum ESPRESSO with external library support (via + "make couple"), go back to the ``lib/qmmm`` folder and follow the + instructions on the README file to build the combined LAMMPS/QE + QM/MM executable (pwqmmm.x) in the ``lib/qmmm`` folder. -Before building LAMMPS, you must build the QMMM library in ``lib/qmmm``. -You can do this manually if you prefer; follow the first two steps -explained in ``lib/qmmm/README``. You can also do it in one step from -the ``lammps/src`` dir, using a command like these, which simply invoke -the ``lib/qmmm/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + Before building LAMMPS, you must build the QMMM library in + ``lib/qmmm``. You can do this manually if you prefer; follow the + first two steps explained in ``lib/qmmm/README``. You can also do + it in one step from the ``lammps/src`` dir, using a command like + these, which simply invoke the ``lib/qmmm/Install.py`` script with + the specified args: - $ make lib-qmmm # print help message - $ make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial") - $ make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi") - $ make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler + .. code-block:: bash -The build should produce two files: ``lib/qmmm/libqmmm.a`` and -``lib/qmmm/Makefile.lammps``. The latter is copied from an existing -``Makefile.lammps.*`` and has settings needed to build LAMMPS with the -QMMM library (though typically the settings are just blank). If -necessary, you can edit/create a new ``lib/qmmm/Makefile.`` file -for your system, which should define an ``EXTRAMAKE`` variable to -specify a corresponding ``Makefile.lammps.`` file. + $ make lib-qmmm # print help message + $ make lib-qmmm args="-m serial" # build with GNU Fortran compiler (settings as in "make serial") + $ make lib-qmmm args="-m mpi" # build with default MPI compiler (settings as in "make mpi") + $ make lib-qmmm args="-m gfortran" # build with GNU Fortran compiler -You can then install QMMM package and build LAMMPS in the usual -manner. After completing the LAMMPS build and compiling Quantum -ESPRESSO with external library support (via "make couple"), go back to -the ``lib/qmmm`` folder and follow the instructions in the README file to -build the combined LAMMPS/QE QM/MM executable (pwqmmm.x) in the -lib/qmmm folder. + The build should produce two files: ``lib/qmmm/libqmmm.a`` and + ``lib/qmmm/Makefile.lammps``. The latter is copied from an + existing ``Makefile.lammps.*`` and has settings needed to build + LAMMPS with the QMMM library (though typically the settings are + just blank). If necessary, you can edit/create a new + ``lib/qmmm/Makefile.`` file for your system, which should + define an ``EXTRAMAKE`` variable to specify a corresponding + ``Makefile.lammps.`` file. + + You can then install QMMM package and build LAMMPS in the usual + manner. After completing the LAMMPS build and compiling Quantum + ESPRESSO with external library support (via "make couple"), go + back to the ``lib/qmmm`` folder and follow the instructions in the + README file to build the combined LAMMPS/QE QM/MM executable + (pwqmmm.x) in the lib/qmmm folder. ---------- @@ -1542,27 +1607,27 @@ potentials, additional files with specific licensing conditions need to be downloaded and configured. See step 1 and step 1.1 in the ``lib/quip/README`` file for details on how to do this. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location) + .. code-block:: bash -CMake will not download and build the QUIP library. But once you have -done that, a CMake build of LAMMPS with ``-D PKG_USER-QUIP=yes`` should -work. Set QUIP_LIBRARY if CMake cannot find the QUIP library. + -D QUIP_LIBRARY=path # path to libquip.a (only needed if a custom location) -Traditional make -^^^^^^^^^^^^^^^^ + CMake will **not** download and build the QUIP library. But once you have + done that, a CMake build of LAMMPS with ``-D PKG_USER-QUIP=yes`` should + work. Set the ``QUIP_LIBRARY`` variable if CMake cannot find the QUIP library. -The download/build procedure for the QUIP library, described in -``lib/quip/README`` file requires setting two environment variables, -QUIP_ROOT and QUIP_ARCH. These are accessed by the -lib/quip/Makefile.lammps file which is used when you compile and link -LAMMPS with this package. You should only need to edit -``Makefile.lammps`` if the LAMMPS build can not use its settings to -successfully build on your system. + .. tab:: Traditional make + + The download/build procedure for the QUIP library, described in + ``lib/quip/README`` file requires setting two environment + variables, ``QUIP_ROOT`` and ``QUIP_ARCH``. These are accessed by + the ``lib/quip/Makefile.lammps`` file which is used when you + compile and link LAMMPS with this package. You should only need + to edit ``Makefile.lammps`` if the LAMMPS build can not use its + settings to successfully build on your system. ---------- @@ -1571,44 +1636,45 @@ successfully build on your system. USER-SCAFACOS package ----------------------------------------- -To build with this package, you must download and build the `ScaFaCoS -Coulomb solver library `_ +To build with this package, you must download and build the +`ScaFaCoS Coulomb solver library `_ -.. _scafacos-home: http://www.scafacos.de +.. tabs:: -CMake build -^^^^^^^^^^^ + .. tab:: CMake build -.. code-block:: bash + .. code-block:: bash - -D DOWNLOAD_SCAFACOS=value # download ScaFaCoS for build, value = no (default) or yes - -D SCAFACOS_LIBRARY=path # ScaFaCos library file (only needed if at custom location) - -D SCAFACOS_INCLUDE_DIR=path # ScaFaCoS include directory (only needed if at custom location) + -D DOWNLOAD_SCAFACOS=value # download ScaFaCoS for build, value = no (default) or yes + -D SCAFACOS_LIBRARY=path # ScaFaCos library file (only needed if at custom location) + -D SCAFACOS_INCLUDE_DIR=path # ScaFaCoS include directory (only needed if at custom location) -If DOWNLOAD_SCAFACOS is set, the ScaFaCoS library will be downloaded -and built inside the CMake build directory. If the ScaFaCoS library -is already on your system (in a location CMake cannot find it), -SCAFACOS_LIBRARY is the filename (plus path) of the ScaFaCoS library -file, not the directory the library file is in. SCAFACOS_INCLUDE_DIR -is the directory the ScaFaCoS include file is in. + If ``DOWNLOAD_SCAFACOS`` is set, the ScaFaCoS library will be + downloaded and built inside the CMake build directory. If the + ScaFaCoS library is already on your system (in a location CMake + cannot find it), ``SCAFACOS_LIBRARY`` is the filename (plus path) of + the ScaFaCoS library file, not the directory the library file is + in. ``SCAFACOS_INCLUDE_DIR`` is the directory the ScaFaCoS include + file is in. -Traditional make -^^^^^^^^^^^^^^^^ + .. tab:: Traditional make -You can download and build the ScaFaCoS library manually if you -prefer; follow the instructions in ``lib/scafacos/README``. You can also -do it in one step from the ``lammps/src`` dir, using a command like these, -which simply invoke the ``lib/scafacos/Install.py`` script with the -specified args: + You can download and build the ScaFaCoS library manually if you + prefer; follow the instructions in ``lib/scafacos/README``. You + can also do it in one step from the ``lammps/src`` dir, using a + command like these, which simply invoke the + ``lib/scafacos/Install.py`` script with the specified args: -make lib-scafacos # print help message -make lib-scafacos args="-b" # download and build in lib/scafacos/scafacos- -make lib-scafacos args="-p $HOME/scafacos # use existing ScaFaCoS installation in $HOME/scafacos + .. code-block:: bash -Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``, are -created in ``lib/scafacos`` to point to the ScaFaCoS src dir. When LAMMPS -builds in src it will use these links. You should not need to edit -the ``lib/scafacos/Makefile.lammps`` file. + make lib-scafacos # print help message + make lib-scafacos args="-b" # download and build in lib/scafacos/scafacos- + make lib-scafacos args="-p $HOME/scafacos # use existing ScaFaCoS installation in $HOME/scafacos + + Note that 2 symbolic (soft) links, ``includelink`` and ``liblink``, are + created in ``lib/scafacos`` to point to the ScaFaCoS src dir. When LAMMPS + builds in src it will use these links. You should not need to edit + the ``lib/scafacos/Makefile.lammps`` file. ---------- @@ -1620,37 +1686,39 @@ USER-SMD package To build with this package, you must download the Eigen3 library. Eigen3 is a template library, so you do not need to build it. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D DOWNLOAD_EIGEN3 # download Eigen3, value = no (default) or yes - -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a custom location) + .. code-block:: bash -If ``DOWNLOAD_EIGEN3`` is set, the Eigen3 library will be downloaded and -inside the CMake build directory. If the Eigen3 library is already on -your system (in a location CMake cannot find it), ``EIGEN3_INCLUDE_DIR`` -is the directory the Eigen3++ include file is in. + -D DOWNLOAD_EIGEN3 # download Eigen3, value = no (default) or yes + -D EIGEN3_INCLUDE_DIR=path # path to Eigen library (only needed if a custom location) -Traditional make -^^^^^^^^^^^^^^^^ + If ``DOWNLOAD_EIGEN3`` is set, the Eigen3 library will be + downloaded and inside the CMake build directory. If the Eigen3 + library is already on your system (in a location where CMake + cannot find it), set ``EIGEN3_INCLUDE_DIR`` to the directory the + ``Eigen3`` include file is in. -You can download the Eigen3 library manually if you prefer; follow the -instructions in ``lib/smd/README``. You can also do it in one step from -the ``lammps/src`` dir, using a command like these, which simply invoke -the ``lib/smd/Install.py`` script with the specified args: + .. tab:: Traditional make -.. code-block:: bash + You can download the Eigen3 library manually if you prefer; follow + the instructions in ``lib/smd/README``. You can also do it in one + step from the ``lammps/src`` dir, using a command like these, + which simply invoke the ``lib/smd/Install.py`` script with the + specified args: - $ make lib-smd # print help message - $ make lib-smd args="-b" # download to lib/smd/eigen3 - $ make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 + .. code-block:: bash -Note that a symbolic (soft) link named ``includelink`` is created in -``lib/smd`` to point to the Eigen dir. When LAMMPS builds it will use -this link. You should not need to edit the ``lib/smd/Makefile.lammps`` -file. + $ make lib-smd # print help message + $ make lib-smd args="-b" # download to lib/smd/eigen3 + $ make lib-smd args="-p /usr/include/eigen3" # use existing Eigen installation in /usr/include/eigen3 + + Note that a symbolic (soft) link named ``includelink`` is created + in ``lib/smd`` to point to the Eigen dir. When LAMMPS builds it + will use this link. You should not need to edit the + ``lib/smd/Makefile.lammps`` file. ---------- @@ -1662,23 +1730,24 @@ USER-VTK package To build with this package you must have the VTK library installed on your system. -CMake build -^^^^^^^^^^^ +.. tabs:: -No additional settings are needed besides ``-D PKG_USER-VTK=yes``. + .. tab:: CMake build -This should auto-detect the VTK library if it is installed on your -system at standard locations. Several advanced VTK options exist if -you need to specify where it was installed. Use the ``ccmake`` (terminal -window) or ``cmake-gui`` (graphical) tools to see these options and set -them interactively from their user interfaces. + No additional settings are needed besides ``-D PKG_USER-VTK=yes``. -Traditional make -^^^^^^^^^^^^^^^^ + This should auto-detect the VTK library if it is installed on your + system at standard locations. Several advanced VTK options exist + if you need to specify where it was installed. Use the ``ccmake`` + (terminal window) or ``cmake-gui`` (graphical) tools to see these + options and set them interactively from their user interfaces. -The ``lib/vtk/Makefile.lammps`` file has settings for accessing VTK files -and its library, which LAMMPS needs to build with this package. If -the settings are not valid for your system, check if one of the other -``lib/vtk/Makefile.lammps.*`` files is compatible and copy it to -Makefile.lammps. If none of the provided files work, you will need to -edit the ``Makefile.lammps`` file. See ``lib/vtk/README`` for details. + .. tab:: Traditional make + + The ``lib/vtk/Makefile.lammps`` file has settings for accessing + VTK files and its library, which LAMMPS needs to build with this + package. If the settings are not valid for your system, check if + one of the other ``lib/vtk/Makefile.lammps.*`` files is compatible + and copy it to Makefile.lammps. If none of the provided files + work, you will need to edit the ``Makefile.lammps`` file. See + ``lib/vtk/README`` for details. diff --git a/doc/src/Build_link.rst b/doc/src/Build_link.rst index 914142b3ce..3d66371304 100644 --- a/doc/src/Build_link.rst +++ b/doc/src/Build_link.rst @@ -4,11 +4,11 @@ Link LAMMPS as a library to another code LAMMPS is designed as a library of C++ objects that can be integrated into other applications including Python scripts. The files ``src/library.cpp`` and ``src/library.h`` define a -C-style API for using LAMMPS as a library. See the :doc:`Howto -library ` page for a description of the interface -and how to use it for your needs. +C-style API for using LAMMPS as a library. See the +:doc:`Howto_library` page +for a description of the interface and how to use it for your needs. -The :doc:`Build basics ` doc page explains how to build +The :doc:`Build_basics` page explains how to build LAMMPS as either a shared or static library. This results in a file in the compilation folder called ``liblammps.a`` or ``liblammps_.a`` in case of building a static library. In case of a shared library @@ -41,42 +41,45 @@ The benefit of linking to a static library is, that the resulting executable is independent of that library since all required executable code from the library is copied into the calling executable. -CMake build -^^^^^^^^^^^ +.. tabs:: -This assumes that LAMMPS has been configured without setting a -``LAMMPS_MACHINE`` name, installed with "make install", and the -``PKG_CONFIG_PATH`` environment variable has been updated to include the -``liblammps.pc`` file installed into the configured destination folder. -The commands to compile and link a coupled executable are then: + .. tab:: CMake build -.. code-block:: bash + This assumes that LAMMPS has been configured without setting a + ``LAMMPS_MACHINE`` name, installed with "make install", and the + ``PKG_CONFIG_PATH`` environment variable has been updated to + include the ``liblammps.pc`` file installed into the configured + destination folder. The commands to compile and link a coupled + executable are then: - mpicc -c -O $(pkgconf liblammps --cflags) caller.c - mpicxx -o caller caller.o -$(pkgconf liblammps --libs) + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + mpicc -c -O $(pkgconf liblammps --cflags) caller.c + mpicxx -o caller caller.o -$(pkgconf liblammps --libs) -This assumes that LAMMPS has been compiled in the folder -``${HOME}/lammps/src`` with "make mpi". The commands to compile and link -a coupled executable are then: + .. tab:: Traditional make -.. code-block:: bash + This assumes that LAMMPS has been compiled in the folder + ``${HOME}/lammps/src`` with "make mpi". The commands to compile + and link a coupled executable are then: - mpicc -c -O -I${HOME}/lammps/src caller.c - mpicxx -o caller caller.o -L${HOME}/lammps/src -llammps_mpi + .. code-block:: bash -The *-I* argument is the path to the location of the ``library.h`` -header file containing the interface to the LAMMPS C-style library -interface. The *-L* argument is the path to where the ``liblammps_mpi.a`` -file is located. The *-llammps_mpi* argument is shorthand for telling the -compiler to link the file ``liblammps_mpi.a``. If LAMMPS has been -built as a shared library, then the linker will use ``liblammps_mpi.so`` -instead. If both files are available, the linker will usually prefer -the shared library. In case of a shared library, you may need to update -the ``LD_LIBRARY_PATH`` environment variable or running the ``caller`` -executable will fail since it cannot find the shared library at runtime. + mpicc -c -O -I${HOME}/lammps/src caller.c + mpicxx -o caller caller.o -L${HOME}/lammps/src -llammps_mpi + + The *-I* argument is the path to the location of the ``library.h`` + header file containing the interface to the LAMMPS C-style library + interface. The *-L* argument is the path to where the + ``liblammps_mpi.a`` file is located. The *-llammps_mpi* argument + is shorthand for telling the compiler to link the file + ``liblammps_mpi.a``. If LAMMPS has been built as a shared + library, then the linker will use ``liblammps_mpi.so`` instead. + If both files are available, the linker will usually prefer the + shared library. In case of a shared library, you may need to + update the ``LD_LIBRARY_PATH`` environment variable or running the + ``caller`` executable will fail since it cannot find the shared + library at runtime. However, it is only as simple as shown above for the case of a plain LAMMPS library without any optional packages that depend on libraries @@ -84,61 +87,62 @@ LAMMPS library without any optional packages that depend on libraries need to include all flags, libraries, and paths for the coupled executable, that are also required to link the LAMMPS executable. -CMake build -^^^^^^^^^^^ +.. tabs:: -When using CMake, additional libraries with sources in the lib folder -are built, but not included in ``liblammps.a`` and (currently) not -installed with ``make install`` and not included in the ``pkgconfig`` -configuration file. They can be found in the top level build folder, -but you have to determine the necessary link flags manually. It is -therefore recommended to either use the traditional make procedure to -build and link with a static library or build and link with a shared -library instead. + .. tab:: CMake build -Traditional make -^^^^^^^^^^^^^^^^ + When using CMake, additional libraries with sources in the lib + folder are built, but not included in ``liblammps.a`` and + (currently) not installed with ``make install`` and not included + in the ``pkgconfig`` configuration file. They can be found in the + top level build folder, but you have to determine the necessary + link flags manually. It is therefore recommended to either use + the traditional make procedure to build and link with a static + library or build and link with a shared library instead. -After you have compiled a static LAMMPS library using the conventional -build system for example with "make mode=static serial". And you also -have installed the ``POEMS`` package after building its bundled library -in ``lib/poems``. Then the commands to build and link the coupled executable -change to: + .. tab:: Traditional make -.. code-block:: bash + After you have compiled a static LAMMPS library using the + conventional build system for example with "make mode=static + serial". And you also have installed the ``POEMS`` package after + building its bundled library in ``lib/poems``. Then the commands + to build and link the coupled executable change to: - gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c - g++ -o caller caller.o -L${HOME}/lammps/lib/poems \ - -L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src -llammps_serial -lpoems -lmpi_stubs + .. code-block:: bash -Note, that you need to link with ``g++`` instead of ``gcc`` even if you have -written your code in C, since LAMMPS itself is C++ code. You can display the -currently applied settings for building LAMMPS for the "serial" machine target -by using the command: + gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c + g++ -o caller caller.o -L${HOME}/lammps/lib/poems \ + -L${HOME}/lammps/src/STUBS -L${HOME}/lammps/src \ + -llammps_serial -lpoems -lmpi_stubs -.. code-block:: bash + Note, that you need to link with ``g++`` instead of ``gcc`` even + if you have written your code in C, since LAMMPS itself is C++ + code. You can display the currently applied settings for building + LAMMPS for the "serial" machine target by using the command: - make mode=print serial + .. code-block:: bash -Which should output something like: + make mode=print serial -.. code-block:: bash + Which should output something like: - # Compiler: - CXX=g++ - # Linker: - LD=g++ - # Compilation: - CXXFLAGS=-g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I${HOME}/compile/lammps/lib/poems -I${HOME}/compile/lammps/src/STUBS - # Linking: - LDFLAGS=-g -O - # Libraries: - LDLIBS=-L${HOME}/compile/lammps/src -llammps_serial -L${HOME}/compile/lammps/lib/poems -L${HOME}/compile/lammps/src/STUBS -lpoems -lmpi_stubs + .. code-block:: bash -From this you can gather the necessary paths and flags. With -makefiles for other *machine* configurations you need to do the -equivalent and replace "serial" with the corresponding "machine" name -of the makefile. + # Compiler: + CXX=g++ + # Linker: + LD=g++ + # Compilation: + CXXFLAGS=-g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -I${HOME}/compile/lammps/lib/poems -I${HOME}/compile/lammps/src/STUBS + # Linking: + LDFLAGS=-g -O + # Libraries: + LDLIBS=-L${HOME}/compile/lammps/src -llammps_serial -L${HOME}/compile/lammps/lib/poems -L${HOME}/compile/lammps/src/STUBS -lpoems -lmpi_stubs + + From this you can gather the necessary paths and flags. With + makefiles for other *machine* configurations you need to do the + equivalent and replace "serial" with the corresponding "machine" + name of the makefile. Link with LAMMPS as a shared library ------------------------------------ @@ -151,35 +155,36 @@ linking the calling executable. Only the *-I* flags are needed. So the example case from above of the serial version static LAMMPS library with the POEMS package installed becomes: -CMake build -^^^^^^^^^^^ +.. tabs:: -The commands with a shared LAMMPS library compiled with the CMake -build process are the same as for the static library. + .. tab:: CMake build -.. code-block:: bash + The commands with a shared LAMMPS library compiled with the CMake + build process are the same as for the static library. - mpicc -c -O $(pkgconf liblammps --cflags) caller.c - mpicxx -o caller caller.o -$(pkgconf --libs) + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + mpicc -c -O $(pkgconf liblammps --cflags) caller.c + mpicxx -o caller caller.o -$(pkgconf --libs) -The commands with a shared LAMMPS library compiled with the -traditional make build using ``make mode=shared serial`` becomes: + .. tab:: Traditional make -.. code-block:: bash + The commands with a shared LAMMPS library compiled with the + traditional make build using ``make mode=shared serial`` becomes: - gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c - g++ -o caller caller.o -L${HOME}/lammps/src -llammps_serial + .. code-block:: bash -*Locating liblammps.so at runtime*\ : + gcc -c -O -I${HOME}/lammps/src/STUBS -I${HOME}/lammps/src -caller.c + g++ -o caller caller.o -L${HOME}/lammps/src -llammps_serial -However, now the ``liblammps.so`` file is required at runtime and needs -to be in a folder, where the shared linker program of the operating -system can find it. This would be either a folder like ``/usr/local/lib64`` -or ``${HOME}/.local/lib64`` or a folder pointed to by the ``LD_LIBRARY_PATH`` -environment variable. You can type +Locating liblammps.so at runtime +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Unlike with a static link, now the ``liblammps.so`` file is required at +runtime and needs to be in a folder, where the shared linker program of +the operating system can find it. This would be either a folder like +``/usr/local/lib64`` or ``${HOME}/.local/lib64`` or a folder pointed to +by the ``LD_LIBRARY_PATH`` environment variable. You can type .. code-block:: bash @@ -187,9 +192,10 @@ environment variable. You can type to see what directories are in that list. -Or you can add the LAMMPS src directory (or the directory you performed -a CMake style build in) to your ``LD_LIBRARY_PATH``, so that the current -version of the shared library is always available to programs that use it. +Or you can add the LAMMPS src directory or the directory you performed a +CMake style build in to your ``LD_LIBRARY_PATH`` environment variable, +so that the current version of the shared library is always available to +programs that use it. For the Bourne or Korn shells (/bin/sh, /bin/ksh, /bin/bash etc.), you would add something like this to your ``${HOME}/.profile`` file: diff --git a/doc/src/Build_make.rst b/doc/src/Build_make.rst index af5e319121..cd71fd46e6 100644 --- a/doc/src/Build_make.rst +++ b/doc/src/Build_make.rst @@ -37,7 +37,7 @@ enable (or "install") them first, as discussed on the :doc:`Build package ` doc page. If a packages requires (provided or external) libraries, you must configure and build those libraries **before** building LAMMPS itself and especially **before** enabling -such a package with ``make yes-``. Building :doc:`LAMMPS with +such a package with ``make yes-``. :doc:`Building LAMMPS with CMake ` can automate much of this for many types of machines, especially workstations, desktops, and laptops, so we suggest you try it first when building LAMMPS in those cases. diff --git a/doc/src/Build_package.rst b/doc/src/Build_package.rst index 32b72c544a..72f7ba74f3 100644 --- a/doc/src/Build_package.rst +++ b/doc/src/Build_package.rst @@ -45,91 +45,92 @@ packages: The mechanism for including packages is simple but different for CMake versus make. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: csh + .. tab:: CMake build - -D PKG_NAME=value # yes or no (default) + .. code-block:: csh -Examples: + -D PKG_NAME=value # yes or no (default) -.. code-block:: csh + Examples: - -D PKG_MANYBODY=yes - -D PKG_USER-INTEL=yes + .. code-block:: csh -All standard and user packages are included the same way. Note that -USER packages have a hyphen between USER and the rest of the package -name, not an underscore. + -D PKG_MANYBODY=yes + -D PKG_USER-INTEL=yes -See the shortcut section below for how to install many packages at -once with CMake. + All standard and user packages are included the same way. Note + that USER packages have a hyphen between USER and the rest of the + package name, not an underscore. + + See the shortcut section below for how to install many packages at + once with CMake. + + .. note:: + + If you switch between building with CMake and make builds, no + packages in the src directory can be installed when you invoke + ``cmake``. CMake will give an error if that is not the case, + indicating how you can un-install all packages in the src dir. + + .. tab:: Traditional make + + .. code-block:: bash + + cd lammps/src + make ps # check which packages are currently installed + make yes-name # install a package with name + make no-name # un-install a package with name + make mpi # build LAMMPS with whatever packages are now installed + + Examples: + + .. code-block:: bash + + make no-rigid + make yes-user-intel + + All standard and user packages are included the same way. + + See the shortcut section below for how to install many packages at + once with make. + + .. note:: + + You must always re-build LAMMPS (via make) after installing or + un-installing a package, for the action to take effect. The + included dependency tracking will make certain only files that + are required to be rebuilt are recompiled. + + .. note:: + + You cannot install or un-install packages and build LAMMPS in a + single make command with multiple targets, e.g. ``make + yes-colloid mpi``. This is because the make procedure creates + a list of source files that will be out-of-date for the build + if the package configuration changes within the same command. + You can include or exclude multiple packages in a single make + command, e.g. ``make yes-colloid no-manybody``. + + +Information for both build systems +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Almost all packages can be included or excluded in a LAMMPS build, +independent of the other packages. However, some packages include files +derived from files in other packages. LAMMPS checks for this and does +the right thing. Individual files are only included if their +dependencies are already included. Likewise, if a package is excluded, +other files dependent on that package are also excluded. .. note:: - If you toggle back and forth between building with CMake vs - make, no packages in the src directory can be installed when you - invoke cmake. CMake will give an error if that is not the case, - indicating how you can un-install all packages in the src dir. - -Traditional make -^^^^^^^^^^^^^^^^ - -.. code-block:: bash - - cd lammps/src - make ps # check which packages are currently installed - make yes-name # install a package with name - make no-name # un-install a package with name - make mpi # build LAMMPS with whatever packages are now installed - -Examples: - -.. code-block:: bash - - make no-rigid - make yes-user-intel - -All standard and user packages are included the same way. - -See the shortcut section below for how to install many packages at -once with make. - -.. note:: - - You must always re-build LAMMPS (via make) after installing or - un-installing a package, for the action to take effect. - -.. note:: - - You cannot install or un-install packages and build LAMMPS in a - single make command with multiple targets, e.g. make yes-colloid mpi. - This is because the make procedure creates a list of source files that - will be out-of-date for the build if the package configuration changes - within the same command. You can include or exclude multiple packages - in a single make command, e.g. make yes-colloid no-manybody. - -CMake and make info -^^^^^^^^^^^^^^^^^^^ - -Any package can be included or excluded in a LAMMPS build, independent -of all other packages. However, some packages include files derived -from files in other packages. LAMMPS checks for this and does the -right thing. Individual files are only included if their dependencies -are already included. Likewise, if a package is excluded, other files -dependent on that package are also excluded. - -When you download a LAMMPS tarball or download LAMMPS source files -from the git repository, no packages are pre-installed in the -src directory. - -.. note:: - - Prior to Aug 2018, if you downloaded a tarball, 3 packages - (KSPACE, MANYBODY, MOLECULE) were pre-installed in the src directory. - That is no longer the case, so that CMake will build as-is without the - need to un-install those packages. + By default no package is installed. Prior to August 2018, however, + if you downloaded a tarball, 3 packages (KSPACE, MANYBODY, MOLECULE) + were pre-installed via the traditional make procedure in the ``src`` + directory. That is no longer the case, so that CMake will build + as-is without needing to un-install those packages. ---------- diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index 859bec9889..d8ac39a0c1 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -6,7 +6,7 @@ explain how to do this for building both with CMake and make. * :ref:`C++11 standard compliance ` when building all of LAMMPS * :ref:`FFT library ` for use with the :doc:`kspace_style pppm ` command -* :ref:`Size of LAMMPS data types ` +* :ref:`Size of LAMMPS integer types ` * :ref:`Read or write compressed files ` * :ref:`Output of JPG and PNG files ` via the :doc:`dump image ` command * :ref:`Output of movie files ` via the :doc:`dump_movie ` command @@ -44,74 +44,71 @@ require use of an FFT library to compute 1d FFTs. The KISS FFT library is included with LAMMPS but other libraries can be faster. LAMMPS can use them if they are available on your system. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D FFT=value # FFTW3 or MKL or KISS, default is FFTW3 if found, else KISS - -D FFT_SINGLE=value # yes or no (default), no = double precision - -D FFT_PACK=value # array (default) or pointer or memcpy + .. code-block:: bash -.. note:: + -D FFT=value # FFTW3 or MKL or KISS, default is FFTW3 if found, else KISS + -D FFT_SINGLE=value # yes or no (default), no = double precision + -D FFT_PACK=value # array (default) or pointer or memcpy - The values for the FFT variable must be in upper-case. This is - an exception to the rule that all CMake variables can be specified - with lower-case values. + .. note:: -Usually these settings are all that is needed. If FFTW3 is selected, -then CMake will try to detect, if threaded FFTW libraries are available -and enable them by default. This setting is independent of whether -OpenMP threads are enabled and a packages like KOKKOS or USER-OMP is -used. If CMake cannot detect the FFT library, you can set these variables -to assist: + The values for the FFT variable must be in upper-case. This is + an exception to the rule that all CMake variables can be specified + with lower-case values. -.. code-block:: bash + Usually these settings are all that is needed. If FFTW3 is + selected, then CMake will try to detect, if threaded FFTW + libraries are available and enable them by default. This setting + is independent of whether OpenMP threads are enabled and a + packages like KOKKOS or USER-OMP is used. If CMake cannot detect + the FFT library, you can set these variables to assist: - -D FFTW3_INCLUDE_DIRS=path # path to FFTW3 include files - -D FFTW3_LIBRARIES=path # path to FFTW3 libraries - -D FFT_FFTW_THREADS=on # enable using threaded FFTW3 libraries - -D MKL_INCLUDE_DIRS=path # ditto for Intel MKL library - -D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries - -D MKL_LIBRARIES=path + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D FFTW3_INCLUDE_DIR=path # path to FFTW3 include files + -D FFTW3_LIBRARY=path # path to FFTW3 libraries + -D FFT_FFTW_THREADS=on # enable using threaded FFTW3 libraries + -D MKL_INCLUDE_DIR=path # ditto for Intel MKL library + -D FFT_MKL_THREADS=on # enable using threaded FFTs with MKL libraries + -D MKL_LIBRARY=path # path to MKL libraries -To change the FFT library to be used and its options, you have to edit -your machine Makefile. Below are examples how the makefile variables -could be changed. + .. tab:: Traditional make -.. code-block:: make + To change the FFT library to be used and its options, you have to edit + your machine Makefile. Below are examples how the makefile variables + could be changed. - FFT_INC = -DFFT_FFTW3 # -DFFT_FFTW3, -DFFT_FFTW (same as -DFFT_FFTW3), -DFFT_MKL, or -DFFT_KISS - # default is KISS if not specified - FFT_INC = -DFFT_SINGLE # do not specify for double precision - FFT_INC = -DFFT_FFTW_THREADS # enable using threaded FFTW3 libraries - FFT_INC = -DFFT_MKL_THREADS # enable using threaded FFTs with MKL libraries - FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY + .. code-block:: make -# default is FFT_PACK_ARRAY if not specified + FFT_INC = -DFFT_FFTW3 # -DFFT_FFTW3, -DFFT_FFTW (same as -DFFT_FFTW3), -DFFT_MKL, or -DFFT_KISS + # default is KISS if not specified + FFT_INC = -DFFT_SINGLE # do not specify for double precision + FFT_INC = -DFFT_FFTW_THREADS # enable using threaded FFTW3 libraries + FFT_INC = -DFFT_MKL_THREADS # enable using threaded FFTs with MKL libraries + FFT_INC = -DFFT_PACK_ARRAY # or -DFFT_PACK_POINTER or -DFFT_PACK_MEMCPY + # default is FFT_PACK_ARRAY if not specified -.. code-block:: make + .. code-block:: make - FFT_INC = -I/usr/local/include - FFT_PATH = -L/usr/local/lib - FFT_LIB = -lfftw3 # FFTW3 double precision - FFT_LIB = -lfftw3 -lfftw3_omp # FFTW3 double precision with threads (needs -DFFT_FFTW_THREADS) - FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision - FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler, serial interface - FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compiler, serial interface - FFT_LIB = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core # MKL with Intel compiler, threaded interface - FFT_LIB = -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core # MKL with GNU compiler, threaded interface - FFT_LIB = -lmkl_rt # MKL with automatic runtime selection of interface libs + FFT_INC = -I/usr/local/include + FFT_PATH = -L/usr/local/lib + FFT_LIB = -lfftw3 # FFTW3 double precision + FFT_LIB = -lfftw3 -lfftw3_omp # FFTW3 double precision with threads (needs -DFFT_FFTW_THREADS) + FFT_LIB = -lfftw3 -lfftw3f # FFTW3 single precision + FFT_LIB = -lmkl_intel_lp64 -lmkl_sequential -lmkl_core # MKL with Intel compiler, serial interface + FFT_LIB = -lmkl_gf_lp64 -lmkl_sequential -lmkl_core # MKL with GNU compiler, serial interface + FFT_LIB = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core # MKL with Intel compiler, threaded interface + FFT_LIB = -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core # MKL with GNU compiler, threaded interface + FFT_LIB = -lmkl_rt # MKL with automatic runtime selection of interface libs -As with CMake, you do not need to set paths in ``FFT_INC`` or ``FFT_PATH``, if -the compiler can find the FFT header and library files in its default search path. -You must specify ``FFT_LIB`` with the appropriate FFT libraries to include in the link. - -CMake build -^^^^^^^^^^^ + As with CMake, you do not need to set paths in ``FFT_INC`` or + ``FFT_PATH``, if the compiler can find the FFT header and library + files in its default search path. You must specify ``FFT_LIB`` + with the appropriate FFT libraries to include in the link. The `KISS FFT library `_ is included in the LAMMPS distribution. It is portable across all platforms. Depending on the size @@ -123,7 +120,8 @@ per-timestep CPU cost, FFTs are only a portion of long-range Coulombics, and 1d FFTs are only a portion of the FFT cost (parallel communication can be costly). A breakdown of these timings is printed to the screen at the end of a run when using the -:doc:`kspace_style pppm ` command. The :doc:`Run output ` +:doc:`kspace_style pppm ` command. The +:doc:`Screen and logfile output ` doc page gives more details. A more detailed (and time consuming) report of the FFT performance is generated with the :doc:`kspace_modify fftbench yes ` command. @@ -176,76 +174,104 @@ ARRAY mode. .. _size: -Size of LAMMPS integer types ------------------------------------- +Size of LAMMPS integer types and size limits +-------------------------------------------- LAMMPS has a few integer data types which can be defined as either 4-byte (= 32-bit) or 8-byte (= 64-bit) integers at compile time. +This has an impact on the size of a system that can be simulated +or how large counters can become before "rolling over". The default setting of "smallbig" is almost always adequate. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D LAMMPS_SIZES=value # smallbig (default) or bigbig or smallsmall + With CMake the choice of integer types is made via setting a + variable during configuration. -Traditional build -^^^^^^^^^^^^^^^^^ + .. code-block:: bash -If you want a setting different from the default, you need to edit your -machine Makefile. + -D LAMMPS_SIZES=value # smallbig (default) or bigbig or smallsmall -.. code-block:: make + If the variable is not set explicitly, "smallbig" is used. - LMP_INC = -DLAMMPS_SMALLBIG # or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL + .. tab:: Traditional build -The default setting is ``-DLAMMPS_SMALLBIG`` if nothing is specified + If you want a setting different from the default, you need to edit the + ``LMP_INC`` variable setting your machine Makefile. -CMake and make info -^^^^^^^^^^^^^^^^^^^ + .. code-block:: make -The default "smallbig" setting allows for simulations with: + LMP_INC = -DLAMMPS_SMALLBIG # or -DLAMMPS_BIGBIG or -DLAMMPS_SMALLSMALL -* total atom count = 2\^63 atoms (about 9e18) -* total timesteps = 2\^63 (about 9e18) -* atom IDs = 2\^31 (about 2 billion) -* image flags = roll over at 512 + The default setting is ``-DLAMMPS_SMALLBIG`` if nothing is specified -The "bigbig" setting increases the latter two limits. It allows for: +LAMMPS system size restrictions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -* total atom count = 2\^63 atoms (about 9e18) -* total timesteps = 2\^63 (about 9e18) -* atom IDs = 2\^63 (about 9e18) -* image flags = roll over at about 1 million (2\^20) +.. list-table:: + :header-rows: 1 + :widths: auto + :align: center -The "smallsmall" setting is only needed if your machine does not -support 8-byte integers. It allows for: + * - + - smallbig + - bigbig + - smallsmall + * - Total atom count + - :math:`2^{63}` atoms (= :math:`9.223 \cdot 10^{18}`) + - :math:`2^{63}` atoms (= :math:`9.223 \cdot 10^{18}`) + - :math:`2^{31}` atoms (= :math:`2.147 \cdot 10^9`) + * - Total timesteps + - :math:`2^{63}` steps (= :math:`9.223 \cdot 10^{18}`) + - :math:`2^{63}` steps (= :math:`9.223 \cdot 10^{18}`) + - :math:`2^{31}` steps (= :math:`2.147 \cdot 10^9`) + * - Atom ID values + - :math:`1 \le i \le 2^{31} (= 2.147 \dot 10^9)` + - :math:`1 \le i \le 2^{63} (= 9.223 \cdot 10^{18})` + - :math:`1 \le i \le 2^{31} (= 2.147 \dot 10^9)` + * - Image flag values + - :math:`-512 \le i \le 511` + - :math:`- 1\,048\,576 \le i \le 1\,048\,575` + - :math:`-512 \le i \le 511` -* total atom count = 2\^31 atoms (about 2 billion) -* total timesteps = 2\^31 (about 2 billion) -* atom IDs = 2\^31 (about 2 billion) -* image flags = roll over at 512 (2\^9) +The "bigbig" setting increases the size of image flags and atom IDs over +"smallbig" and the "smallsmall" setting is only needed if your machine +does not support 64-bit integers or incurs performance penalties when +using them. + +These are limits for the core of the LAMMPS code, specific features or +some styles may impose additional limits. The :ref:`USER-ATC +` package cannot be compiled with the "bigbig" setting. +Also, there are limitations when using the library interface where some +functions with known issues have been replaced by dummy calls printing a +corresponding error message rather than crashing randomly or corrupting +data. Atom IDs are not required for atomic systems which do not store bond topology information, though IDs are enabled by default. The :doc:`atom_modify id no ` command will turn them off. Atom IDs are required for molecular systems with bond topology (bonds, -angles, dihedrals, etc). Thus if you model a molecular system with -more than 2 billion atoms, you need the "bigbig" setting. +angles, dihedrals, etc). Similarly, some force or compute or fix styles +require atom IDs. Thus if you model a molecular system or use one of +those styles with more than 2 billion atoms, you need the "bigbig" +setting. -Image flags store 3 values per atom which count the number of times an -atom has moved through the periodic box in each dimension. See the -:doc:`dump ` doc page for a discussion. If an atom moves through -the periodic box more than this limit, the value will "roll over", -e.g. from 511 to -512, which can cause diagnostics like the -mean-squared displacement, as calculated by the :doc:`compute msd ` command, to be faulty. +Regardless of the total system size limits, the maximum number of atoms +per MPI rank (local + ghost atoms) is limited to 2 billion for atomic +systems and 500 million for systems with bonds (the additional +restriction is due to using the 2 upper bits of the local atom index +in neighbor lists for storing special bonds info). + +Image flags store 3 values per atom in a single integer which count the +number of times an atom has moved through the periodic box in each +dimension. See the :doc:`dump ` doc page for a discussion. If an +atom moves through the periodic box more than this limit, the value will +"roll over", e.g. from 511 to -512, which can cause diagnostics like the +mean-squared displacement, as calculated by the :doc:`compute msd +` command, to be faulty. -Note that the USER-ATC package and the USER-INTEL package are currently -not compatible with the "bigbig" setting. Also, there are limitations -when using the library interface. Some functions with known issues -have been replaced by dummy calls printing a corresponding error rather -than crashing randomly or corrupting data. Also note that the GPU package requires its lib/gpu library to be compiled with the same size setting, or the link will fail. A CMake @@ -264,54 +290,51 @@ PNG image files. Likewise the :doc:`dump movie ` command outputs movie files in MPEG format. Using these options requires the following settings: -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D WITH_JPEG=value # yes or no - # default = yes if CMake finds JPEG files, else no - -D WITH_PNG=value # yes or no - # default = yes if CMake finds PNG and ZLIB files, else no - -D WITH_FFMPEG=value # yes or no - # default = yes if CMake can find ffmpeg, else no + .. code-block:: bash -Usually these settings are all that is needed. If CMake cannot find -the graphics header, library, executable files, you can set these -variables: + -D WITH_JPEG=value # yes or no + # default = yes if CMake finds JPEG files, else no + -D WITH_PNG=value # yes or no + # default = yes if CMake finds PNG and ZLIB files, else no + -D WITH_FFMPEG=value # yes or no + # default = yes if CMake can find ffmpeg, else no -.. code-block:: bash + Usually these settings are all that is needed. If CMake cannot + find the graphics header, library, executable files, you can set + these variables: - -D JPEG_INCLUDE_DIR=path # path to jpeglib.h header file - -D JPEG_LIBRARIES=path # path to libjpeg.a (.so) file - -D PNG_INCLUDE_DIR=path # path to png.h header file - -D PNG_LIBRARIES=path # path to libpng.a (.so) file - -D ZLIB_INCLUDE_DIR=path # path to zlib.h header file - -D ZLIB_LIBRARIES=path # path to libz.a (.so) file - -D FFMPEG_EXECUTABLE=path # path to ffmpeg executable + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D JPEG_INCLUDE_DIR=path # path to jpeglib.h header file + -D JPEG_LIBRARY=path # path to libjpeg.a (.so) file + -D PNG_INCLUDE_DIR=path # path to png.h header file + -D PNG_LIBRARY=path # path to libpng.a (.so) file + -D ZLIB_INCLUDE_DIR=path # path to zlib.h header file + -D ZLIB_LIBRARY=path # path to libz.a (.so) file + -D FFMPEG_EXECUTABLE=path # path to ffmpeg executable -.. code-block:: make + .. tab:: Traditional make - LMP_INC = -DLAMMPS_JPEG - LMP_INC = -DLAMMPS_PNG - LMP_INC = -DLAMMPS_FFMPEG + .. code-block:: make - JPG_INC = -I/usr/local/include # path to jpeglib.h, png.h, zlib.h header files if make cannot find them - JPG_PATH = -L/usr/lib # paths to libjpeg.a, libpng.a, libz.a (.so) files if make cannot find them - JPG_LIB = -ljpeg -lpng -lz # library names + LMP_INC = -DLAMMPS_JPEG + LMP_INC = -DLAMMPS_PNG + LMP_INC = -DLAMMPS_FFMPEG -As with CMake, you do not need to set ``JPG_INC`` or ``JPG_PATH``, -if make can find the graphics header and library files. You must -specify ``JPG_LIB`` -with a list of graphics libraries to include in the link. You must -insure ffmpeg is in a directory where LAMMPS can find it at runtime, -that is a directory in your PATH environment variable. + JPG_INC = -I/usr/local/include # path to jpeglib.h, png.h, zlib.h header files if make cannot find them + JPG_PATH = -L/usr/lib # paths to libjpeg.a, libpng.a, libz.a (.so) files if make cannot find them + JPG_LIB = -ljpeg -lpng -lz # library names -CMake and make info -^^^^^^^^^^^^^^^^^^^ + As with CMake, you do not need to set ``JPG_INC`` or ``JPG_PATH``, + if make can find the graphics header and library files. You must + specify ``JPG_LIB`` with a list of graphics libraries to include + in the link. You must insure ffmpeg is in a directory where + LAMMPS can find it at runtime, that is a directory in your PATH + environment variable. Using ``ffmpeg`` to output movie files requires that your machine supports the "popen" function in the standard runtime library. @@ -334,37 +357,34 @@ If this option is enabled, large files can be read or written with gzip compression by several LAMMPS commands, including :doc:`read_data `, :doc:`rerun `, and :doc:`dump `. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D WITH_GZIP=value # yes or no - # default is yes if CMake can find gzip, else no - -D GZIP_EXECUTABLE=path # path to gzip executable if CMake cannot find it + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D WITH_GZIP=value # yes or no + # default is yes if CMake can find gzip, else no + -D GZIP_EXECUTABLE=path # path to gzip executable if CMake cannot find it -.. code-block:: make + .. tab:: Traditional make - LMP_INC = -DLAMMPS_GZIP + .. code-block:: make -CMake and make info -^^^^^^^^^^^^^^^^^^^ + LMP_INC = -DLAMMPS_GZIP -This option requires that your machine supports the "popen()" function -in the standard runtime library and that a gzip executable can be +This option requires that your operating system fully supports the "popen()" +function in the standard runtime library and that a ``gzip`` executable can be found by LAMMPS during a run. .. note:: - On some clusters with high-speed networks, using the fork() - library call (required by popen()) can interfere with the fast - communication library and lead to simulations using compressed output - or input to hang or crash. For selected operations, compressed file - I/O is also available using a compression library instead, which is - what the :ref:`COMPRESS package ` enables. + On some clusters with high-speed networks, using the "fork()" library + call (required by "popen()") can interfere with the fast communication + library and lead to simulations using compressed output or input to + hang or crash. For selected operations, compressed file I/O is also + available using a compression library instead, which is what the + :ref:`COMPRESS package ` enables. ---------- @@ -373,65 +393,66 @@ found by LAMMPS during a run. Memory allocation alignment --------------------------------------- -This setting enables the use of the posix_memalign() call instead of -malloc() when LAMMPS allocates large chunks or memory. This can make -vector instructions on CPUs more efficient, if dynamically allocated -memory is aligned on larger-than-default byte boundaries. -On most current systems, the malloc() implementation returns +This setting enables the use of the "posix_memalign()" call instead of +"malloc()" when LAMMPS allocates large chunks or memory. Vector +instructions on CPUs may become more efficient, if dynamically allocated +memory is aligned on larger-than-default byte boundaries. On most +current operating systems, the "malloc()" implementation returns pointers that are aligned to 16-byte boundaries. Using SSE vector -instructions efficiently, however, requires memory blocks being -aligned on 64-byte boundaries. +instructions efficiently, however, requires memory blocks being aligned +on 64-byte boundaries. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D LAMMPS_MEMALIGN=value # 0, 8, 16, 32, 64 (default) + .. code-block:: bash -Use a ``LAMMPS_MEMALIGN`` value of 0 to disable using posix_memalign() -and revert to using the malloc() C-library function instead. When -compiling LAMMPS for Windows systems, malloc() will always be used -and this setting ignored. + -D LAMMPS_MEMALIGN=value # 0, 8, 16, 32, 64 (default) -Traditional make -^^^^^^^^^^^^^^^^ + Use a ``LAMMPS_MEMALIGN`` value of 0 to disable using + "posix_memalign()" and revert to using the "malloc()" C-library + function instead. When compiling LAMMPS for Windows systems, + "malloc()" will always be used and this setting is ignored. -.. code-block:: make + .. tab:: Traditional make - LMP_INC = -DLAMMPS_MEMALIGN=value # 8, 16, 32, 64 + .. code-block:: make -Do not set ``-DLAMMPS_MEMALIGN``, if you want to have memory allocated -with the malloc() function call instead. ``-DLAMMPS_MEMALIGN`` **cannot** -be used on Windows, as it does use different function calls for -allocating aligned memory, that are not compatible with how LAMMPS -manages its dynamical memory. + LMP_INC = -DLAMMPS_MEMALIGN=value # 8, 16, 32, 64 + + Do not set ``-DLAMMPS_MEMALIGN``, if you want to have memory + allocated with the "malloc()" function call + instead. ``-DLAMMPS_MEMALIGN`` **cannot** be used on Windows, as + Windows different function calls with different semantics for + allocating aligned memory, that are not compatible with how LAMMPS + manages its dynamical memory. ---------- .. _longlong: Workaround for long long integers ------------------------------------------------- +--------------------------------- If your system or MPI version does not recognize "long long" data types, the following setting will be needed. It converts "long long" to a "long" data type, which should be the desired 8-byte integer on those systems: -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D LAMMPS_LONGLONG_TO_LONG=value # yes or no (default) + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D LAMMPS_LONGLONG_TO_LONG=value # yes or no (default) -.. code-block:: make + .. tab:: Traditional make - LMP_INC = -DLAMMPS_LONGLONG_TO_LONG + .. code-block:: make + + LMP_INC = -DLAMMPS_LONGLONG_TO_LONG ---------- @@ -446,19 +467,19 @@ Instead, the call stack is unwound and control returns to the caller, e.g. to Python. Of course, the calling code has to be set up to *catch* exceptions thrown from within LAMMPS. -CMake build -^^^^^^^^^^^ +.. tabs:: -.. code-block:: bash + .. tab:: CMake build - -D LAMMPS_EXCEPTIONS=value # yes or no (default) + .. code-block:: bash -Traditional make -^^^^^^^^^^^^^^^^ + -D LAMMPS_EXCEPTIONS=value # yes or no (default) -.. code-block:: make + .. tab:: Traditional make - LMP_INC = -DLAMMPS_EXCEPTIONS + .. code-block:: make + + LMP_INC = -DLAMMPS_EXCEPTIONS .. note:: diff --git a/doc/src/Build_windows.rst b/doc/src/Build_windows.rst index 4aacea9dfa..2df3fdd24e 100644 --- a/doc/src/Build_windows.rst +++ b/doc/src/Build_windows.rst @@ -38,7 +38,7 @@ optional Windows feature allows you to run the bash shell from Ubuntu from within Windows and from there on, you can pretty much use that shell like you are running on an Ubuntu Linux machine (e.g. installing software via apt-get and more). For more details on that, please -see :doc:`this tutorial ` +see :doc:`this tutorial `. .. _gnu: diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 4b5894cd2e..9a3c5df9cd 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -150,6 +150,7 @@ OPT. * :doc:`orient/bcc ` * :doc:`orient/fcc ` * :doc:`orient/eco ` + * :doc:`pafi ` * :doc:`phonon ` * :doc:`pimd ` * :doc:`planeforce ` diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index e137e39a08..1f6da57945 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -17,6 +17,11 @@ ways through the :doc:`compute chunk/atom ` command and then averaging is done using :doc:`fix ave/chunk `. Please refer to the :doc:`chunk HOWTO ` section for an overview. +Reset_ids command +----------------- + +The reset_ids command has been renamed to :doc:`reset_atom_ids `. + MEAM package ------------ @@ -27,7 +32,7 @@ which removes several restrictions (e.g. there can be multiple instances in hybrid pair styles) and allows for some optimizations leading to better performance. The new pair style :doc:`meam/c ` has the exact same syntax as the old "meam" pair style and thus pair style -:doc:`meam ` is an alias to the new style and backward +meam is an alias to the new style and backward compatibility of old inputs is preserved. REAX package diff --git a/doc/src/Developer/.gitignore b/doc/src/Developer/.gitignore deleted file mode 100644 index 38f7323f7b..0000000000 --- a/doc/src/Developer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/developer.aux -/developer.log -/developer.toc diff --git a/doc/src/Developer/classes.fig b/doc/src/Developer/classes.fig deleted file mode 100644 index a2d9b6d6f1..0000000000 --- a/doc/src/Developer/classes.fig +++ /dev/null @@ -1,198 +0,0 @@ -#FIG 3.2 Produced by xfig version 3.2.5a -Portrait -Center -Inches -Letter -100.00 -Single --2 -1200 2 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2232 1170 3540 1170 3540 1505 2232 1505 2232 1170 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2220 1830 3015 1830 3015 2219 2220 2219 2220 1830 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2226 3285 3300 3285 3300 3665 2226 3665 2226 3285 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2223 5190 3225 5190 3225 5525 2223 5525 2223 5190 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2232 7125 3090 7125 3090 7478 2232 7478 2232 7125 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2226 10230 3300 10230 3300 10565 2226 10565 2226 10230 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4026 10305 4980 10305 4980 10592 4026 10592 4026 10305 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4029 9900 5205 9900 5205 10250 4029 10250 4029 9900 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4038 9315 5370 9315 5370 9659 4038 9659 4038 9315 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4023 8955 4530 8955 4530 9278 4023 9278 4023 8955 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4029 8475 5190 8475 5190 8762 4029 8762 4029 8475 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4008 8115 5430 8115 5430 8408 4008 8408 4008 8115 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4026 7425 4995 7425 4995 7712 4026 7712 4026 7425 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4035 6720 4650 6720 4650 7025 4035 7025 4035 6720 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4044 7080 4830 7080 4830 7358 4044 7358 4044 7080 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4032 6105 5205 6105 5205 6419 4032 6419 4032 6105 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4026 5715 5115 5715 5115 6062 4026 6062 4026 5715 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4023 3585 4605 3585 4605 3872 4023 3872 4023 3585 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 3954 1680 5175 1680 5175 1997 3954 1997 3954 1680 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 1620 5235 2100 615 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 1605 5445 2070 10695 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3120 1935 3855 1800 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3150 2115 3765 2250 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3135 7230 3945 6840 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3150 7335 3945 8610 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 5265 8610 6195 8400 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 5280 8655 6180 8820 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3345 10290 3930 10020 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3360 10395 3930 10425 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3360 10455 3930 10755 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2193 360 3435 360 3435 647 2193 647 2193 360 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3398 3472 3923 3307 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3413 3601 3923 3721 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3285 2806 3870 2802 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3315 5372 3900 5368 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 6354 2280 7470 2280 7470 2585 6354 2585 6354 2280 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 6348 1875 7320 1875 7320 2222 6348 2222 6348 1875 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 3954 2070 5505 2070 5505 2372 3954 2372 3954 2070 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 5634 2137 6230 2045 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 5670 2310 6265 2418 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 3900 2640 5400 2640 5400 2975 3900 2975 3900 2640 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4038 3165 5385 3165 5385 3497 4038 3497 4038 3165 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4245 4110 5730 4110 5730 4499 4245 4499 4245 4110 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4233 4545 6390 4545 6390 4862 4233 4862 4233 4545 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4026 5190 5385 5190 5385 5525 4026 5525 4026 5190 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4038 7755 5310 7755 5310 8075 4038 8075 4038 7755 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 6270 8250 7365 8250 7365 8610 6270 8610 6270 8250 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 6273 8655 7380 8655 7380 8978 6273 8978 6273 8655 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 4041 10620 5985 10620 5985 10943 4041 10943 4041 10620 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2217 10830 3135 10830 3135 11156 2217 11156 2217 10830 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2229 9780 3240 9780 3240 10118 2229 10118 2229 9780 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2214 9015 3285 9015 3285 9362 2214 9362 2214 9015 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2208 5850 3420 5850 3420 6209 2208 6209 2208 5850 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2217 4275 3615 4275 3615 4634 2217 4634 2217 4275 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2235 2655 3150 2655 3150 3000 2235 3000 2235 2655 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 60 5115 1500 5115 1500 5610 60 5610 60 5115 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3486 6018 4011 5853 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3486 6129 3996 6249 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3361 9291 3991 9531 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3345 9129 4005 9099 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3691 4412 4216 4277 -2 1 0 2 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 - 1 1 2.00 120.00 240.00 - 3695 4561 4175 4711 -2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 - 2220 735 3129 735 3129 1043 2220 1043 2220 735 -4 0 1 50 -1 18 18 0.0000 4 225 1275 2265 1455 Universe\001 -4 0 1 50 -1 18 18 0.0000 4 285 735 2265 2175 Input\001 -4 0 1 50 -1 18 18 0.0000 4 225 780 2265 2925 Atom\001 -4 0 1 50 -1 18 18 0.0000 4 285 1020 2265 3600 Update\001 -4 0 1 50 -1 18 18 0.0000 4 285 1320 2265 4575 Neighbor\001 -4 0 1 50 -1 18 18 0.0000 4 225 945 2265 5475 Comm\001 -4 0 1 50 -1 18 18 0.0000 4 225 1110 2265 6150 Domain\001 -4 0 1 50 -1 18 18 0.0000 4 225 810 2265 7425 Force\001 -4 0 1 50 -1 18 18 0.0000 4 285 975 2265 9300 Modify\001 -4 0 1 50 -1 18 18 0.0000 4 285 900 2265 10050 Group\001 -4 0 1 50 -1 18 18 0.0000 4 285 990 2265 10500 Output\001 -4 0 1 50 -1 18 18 0.0000 4 225 825 2265 11100 Timer\001 -4 0 0 50 -1 18 18 0.0000 4 225 1170 3990 1950 Variable\001 -4 0 4 50 -1 18 18 0.0000 4 225 1470 3990 2325 Command\001 -4 0 4 50 -1 18 18 0.0000 4 285 1275 4065 3450 Integrate\001 -4 0 4 50 -1 18 18 0.0000 4 225 525 4065 3825 Min\001 -4 0 0 50 -1 18 18 0.0000 4 285 1230 4065 5475 Irregular\001 -4 0 4 50 -1 18 18 0.0000 4 285 1020 4065 6000 Region\001 -4 0 0 50 -1 18 18 0.0000 4 225 975 4065 6375 Lattice\001 -4 0 4 50 -1 18 18 0.0000 4 225 435 4065 9225 Fix\001 -4 0 4 50 -1 18 18 0.0000 4 285 1305 4065 9600 Compute\001 -4 0 4 50 -1 18 18 0.0000 4 225 570 4065 6975 Pair\001 -4 0 4 50 -1 18 18 0.0000 4 285 840 4065 7665 Angle\001 -4 0 4 50 -1 18 18 0.0000 4 225 1215 4065 8010 Dihedral\001 -4 0 4 50 -1 18 18 0.0000 4 285 1305 4065 8355 Improper\001 -4 0 4 50 -1 18 18 0.0000 4 285 1095 4065 8700 KSpace\001 -4 0 4 50 -1 18 18 0.0000 4 285 855 4065 10545 Dump\001 -4 0 0 50 -1 18 18 0.0000 4 225 1815 4065 10890 WriteRestart\001 -4 0 0 50 -1 18 18 0.0000 4 225 930 6315 8550 FFT3D\001 -4 0 0 50 -1 18 18 0.0000 4 285 1005 6315 8925 Remap\001 -4 0 0 50 -1 18 18 0.0000 4 225 885 6390 2175 Finish\001 -4 0 0 50 -1 18 18 0.0000 4 285 1050 6390 2550 Special\001 -4 0 4 50 -1 18 18 0.0000 4 225 1305 3990 2925 AtomVec\001 -4 0 4 50 -1 18 18 0.0000 4 225 765 4065 7320 Bond\001 -4 0 0 50 -1 18 18 0.0000 4 225 1095 4065 10200 Thermo\001 -4 0 0 50 -1 18 18 0.0000 4 285 1380 4305 4425 NeighList\001 -4 0 0 50 -1 18 18 0.0000 4 285 2025 4305 4800 NeighRequest\001 -4 0 1 50 -1 18 18 0.0000 4 285 1155 2250 600 Memory\001 -4 0 0 50 -1 18 18 0.0000 4 225 1305 120 5475 LAMMPS\001 -4 0 1 50 -1 18 18 0.0000 4 225 735 2265 1005 Error\001 diff --git a/doc/src/Developer/classes.pdf b/doc/src/Developer/classes.pdf deleted file mode 100644 index 566089ac9e..0000000000 Binary files a/doc/src/Developer/classes.pdf and /dev/null differ diff --git a/doc/src/Developer/developer.tex b/doc/src/Developer/developer.tex deleted file mode 100644 index c7f619c84f..0000000000 --- a/doc/src/Developer/developer.tex +++ /dev/null @@ -1,699 +0,0 @@ -\documentclass{article} -\usepackage{graphicx} - -\begin{document} - -\centerline{\Large \bf LAMMPS Developer Guide} -\centerline{\bf 23 Aug 2011} - -\vspace{0.5in} - -This document is a developer guide to the LAMMPS molecular dynamics -package, whose WWW site is at lammps.sandia.gov. It describes the -internal structure and algorithms of the code. Sections will be added -as we have time, and in response to requests from developers and -users. - -\tableofcontents - -\pagebreak -\section{LAMMPS source files} - -LAMMPS source files are in two directories of the distribution -tarball. The src directory has the majority of them, all of which are -C++ files (*.cpp and *.h). Many of these files are in the src -directory itself. There are also dozens of ``packages'', which can be -included or excluded when LAMMPS is built. See the -doc/Section\_build.html section of the manual for more information -about packages, or type ``make'' from within the src directory, which -lists package-related commands, such as ``make package-status''. The -source files for each package are in an all-uppercase sub-directory of -src, like src/MOLECULE or src/USER-CUDA. If the package is currently -installed, copies of the package source files will also exist in the -src directory itself. The src/STUBS sub-directory is not a package -but contains a dummy version of the MPI library, used when building a -serial version of the code. - -The lib directory also contains source code for external libraries, -used by a few of the packages. Each sub-directory, like meam or gpu, -contains the source files, some of which are in different languages -such as Fortran. The files are compiled into libraries from within -each sub-directory, e.g. performing a ``make'' in the lib/meam directory -creates a libmeam.a file. These libraries are linked to during a -LAMMPS build, if the corresponding package is installed. - -LAMMPS C++ source files almost always come in pairs, such as run.cpp -and run.h. The pair of files defines a C++ class, the Run class in -this case, which contains the code invoked by the ``run'' command in a -LAMMPS input script. As this example illustrates, source file and -class names often have a one-to-one correspondence with a command used -in a LAMMPS input script. Some source files and classes do not have a -corresponding input script command, e.g. ``force.cpp'' and the Force -class. They are discussed in the next section. - -\pagebreak -\section{Class hierarchy of LAMMPS} - -Though LAMMPS has a lot of source files and classes, its class -hierarchy is quite simple, as outlined in Fig \ref{fig:classes}. Each -boxed name refers to a class and has a pair of associated source files -in lammps/src, e.g. ``memory.cpp'' and ``memory.h''. More details on the -class and its methods and data structures can be found by examining -its *.h file. - -LAMMPS (lammps.cpp/h) is the top-level class for the entire code. It -holds an ``instance'' of LAMMPS and can be instantiated one or more -times by a calling code. For example, the file src/main.cpp simply -instantiates one instance of LAMMPS and passes it the input script. - -The file src/library.cpp contains a C-style library interface to the -LAMMPS class. See the lammps/couple and lammps/python directories for -examples of simple programs that use LAMMPS through its library -interface. A driver program can instantiate the LAMMPS class multiple -times, e.g. to embed several atomistic simulation regions within a -mesoscale or continuum simulation domain. - -There are a dozen or so top-level classes within the LAMMPS class that -are visible everywhere in the code. They are shaded blue in Fig -\ref{fig:classes}. Thus any class can refer to the y-coordinate of -local atom $I$ as atom$\rightarrow$x[i][1]. This visibility is -enabled by a bit of cleverness in the Pointers class (see -src/pointers.h) which every class inherits from. - -There are a handful of virtual parent classes in LAMMPS that define -what LAMMPS calls ``styles''. They are shaded red in Fig -\ref{fig:classes}. Each of these are parents of a number of child -classes that implement the interface defined by the parent class. For -example, the fix style has around 100 child classes. They are the -possible fixes that can be specified by the fix command in an input -script, e.g. fix nve, fix shake, fix ave/time, etc. The corresponding -classes are Fix (for the parent class), FixNVE, FixShake, FixAveTime, -etc. The source files for these classes are easy to identify in the -src directory, since they begin with the word ``fix'', e,g, -fix\_nve.cpp, fix\_shake,cpp, fix\_ave\_time.cpp, etc. - -The one exception is child class files for the ``command'' style. These -implement specific commands in the input script that can be invoked -before/after/between runs or which launch a simulation. Examples are -the create\_box, minimize, run, and velocity commands which encode the -CreateBox, Minimize, Run, and Velocity classes. The corresponding -files are create\_box,cpp, minimize.cpp, run.cpp, and velocity.cpp. -The list of command style files can be found by typing ``grep -COMMAND\_CLASS *.h'' from within the src directory, since that word in -the header file identifies the class as an input script command. -Similar words can be grepped to list files for the other LAMMPS -styles. E.g. ATOM\_CLASS, PAIR\_CLASS, BOND\_CLASS, REGION\_CLASS, -FIX\_CLASS, COMPUTE\_CLASS, DUMP\_CLASS, etc. - -\begin{figure}[htb] - \begin{center} - \includegraphics[height=4in]{classes.pdf} - \end{center} - \caption{Class hierarchy within LAMMPS source code.} -\label{fig:classes} -\end{figure} - -More details on individual classes in Fig \ref{fig:classes} are as -follows: - -\begin{itemize} - -\item The Memory class handles allocation of all large vectors and - arrays. - -\item The Error class prints all error and warning messages. - -\item The Universe class sets up partitions of processors so that - multiple simulations can be run, each on a subset of the processors - allocated for a run, e.g. by the mpirun command. - -\item The Input class reads an input script, stores variables, and - invokes stand-alone commands that are child classes of the Command - class. - -\item As discussed above, the Command class is a parent class for - certain input script commands that perform a one-time operation - before/after/between simulations or which invoke a simulation. They - are instantiated from within the Input class, invoked, then - immediately destructed. - -\item The Finish class is instantiated to print statistics to the - screen after a simulation is performed, by commands like run and - minimize. - -\item The Special class walks the bond topology of a molecular system - to find first, second, third neighbors of each atom. It is invoked by - several commands, like read\_data, read\_restart, and replicate. - -\item The Atom class stores all per-atom arrays. More precisely, they - are allocated and stored by the AtomVec class, and the Atom class - simply stores a pointer to them. The AtomVec class is a parent - class for atom styles, defined by the atom\_style command. - -\item The Update class holds an integrator and a minimizer. The - Integrate class is a parent style for the Verlet and rRESPA time - integrators, as defined by the run\_style input command. The Min - class is a parent style for various energy minimizers. - -\item The Neighbor class builds and stores neighbor lists. The - NeighList class stores a single list (for all atoms). The - NeighRequest class is called by pair, fix, or compute styles when - they need a particular kind of neighbor list. - -\item The Comm class performs interprocessor communication, typically - of ghost atom information. This usually involves MPI message - exchanges with 6 neighboring processors in the 3d logical grid of - processors mapped to the simulation box. Sometimes the Irregular - class is used, when atoms may migrate to arbitrary processors. - -\item The Domain class stores the simulation box geometry, as well as - geometric Regions and any user definition of a Lattice. The latter - are defined by region and lattice commands in an input script. - -\item The Force class computes various forces between atoms. The Pair - parent class is for non-bonded or pair-wise forces, which in LAMMPS - lingo includes many-body forces such as the Tersoff 3-body - potential. The Bond, Angle, Dihedral, Improper parent classes are - styles for bonded interactions within a static molecular topology. - The KSpace parent class is for computing long-range Coulombic - interactions. One of its child classes, PPPM, uses the FFT3D and - Remap classes to communicate grid-based information with neighboring - processors. - -\item The Modify class stores lists of Fix and Compute classes, both - of which are parent styles. - -\item The Group class manipulates groups that atoms are assigned to - via the group command. It also computes various attributes of - groups of atoms. - -\item The Output class is used to generate 3 kinds of output from a - LAMMPS simulation: thermodynamic information printed to the screen - and log file, dump file snapshots, and restart files. These - correspond to the Thermo, Dump, and WriteRestart classes - respectively. The Dump class is a parent style. - -\item The Timer class logs MPI timing information, output at the end - of a run. - -\end{itemize} - -%%\pagebreak -%%\section{Spatial decomposition and parallel operations} -%%distributed memory -%%Ref to JCP paper -%%diagram of 3d grid of procs and spatial decomp -%%6-way comm -%%ghost atoms, PBC added when comm (in atom class) - -%%\pagebreak -%%\section{Fixes, computes, variables} -%%fixes intercolate in timestep, store per-atom info -%%computes based on current snapshot -%%equal- and atom-style variables -%%output they produce - see write-up in HowTo - -\pagebreak -\section{How a timestep works} - -The first and most fundamental operation within LAMMPS to understand -is how a timestep is structured. Timestepping is performed by the -Integrate class within the Update class. Since Integrate is a parent -class, corresponding to the run\_style input script command, it has -child classes. In this section, the timestep implemented by the -Verlet child class is described. A similar timestep is implemented by -the Respa child class, for the rRESPA hierarchical timestepping -method. The Min parent class performs energy minimization, so does -not perform a literal timestep. But it has logic similar to what is -described here, to compute forces and invoke fixes at each iteration -of a minimization. Differences between time integration and -minimization are highlighted at the end of this section. - -The Verlet class is encoded in the src/verlet.cpp and verlet.h files. -It implements the velocity-Verlet timestepping algorithm. The -workhorse method is Verlet::run(), but first we highlight several -other methods in the class. - -\begin{itemize} - -\item The init() method is called at the beginning of each dynamics - run. It simply sets some internal flags, based on user settings in - other parts of the code. - -\item The setup() or setup\_minimal() methods are also called before - each run. The velocity-Verlet method requires current forces be - calculated before the first timestep, so these routines compute - forces due to all atomic interactions, using the same logic that - appears in the timestepping described next. A few fixes are also - invoked, using the mechanism described in the next section. Various - counters are also initialized before the run begins. The - setup\_minimal() method is a variant that has a flag for performing - less setup. This is used when runs are continued and information - from the previous run is still valid. For example, if repeated - short LAMMPS runs are being invoked, interleaved by other commands, - via the ``pre no'' and ``every'' options of the run command, the - setup\_minimal() method is used. - -\item The force\_clear() method initializes force and other arrays to - zero before each timestep, so that forces (torques, etc) can be - accumulated. - -\end{itemize} - -Now for the Verlet::run() method. Its structure in hi-level pseudo -code is shown in Fig \ref{fig:verlet}. In the actual code in -src/verlet.cpp some of these operations are conditionally invoked. - -\begin{figure}[htb] - \begin{center} - \begin{verbatim} -loop over N timesteps: - ev_set() - - fix->initial_integrate() - fix->post_integrate() - - nflag = neighbor->decide() - if nflag: - fix->pre_exchange() - domain->pbc() - domain->reset_box() - comm->setup() - neighbor->setup_bins() - comm->exchange() - comm->borders() - fix->pre_neighbor() - neighbor->build() - else - comm->forward_comm() - - force_clear() - fix->pre_force() - - pair->compute() - bond->compute() - angle->compute() - dihedral->compute() - improper->compute() - kspace->compute() - - comm->reverse_comm() - - fix->post_force() - fix->final_integrate() - fix->end_of_step() - - if any output on this step: output->write() - \end{verbatim} - \end{center} - \caption{Pseudo-code for the Verlet::run() method.} -\label{fig:verlet} -\end{figure} - -The ev\_set() method (in the parent Integrate class), sets two flags -({\em eflag} and {\em vflag}) for energy and virial computation. Each -flag encodes whether global and/or per-atom energy and virial should -be calculated on this timestep, because some fix or variable or output -will need it. These flags are passed to the various methods that -compute particle interactions, so that they can skip the extra -calculations if the energy and virial are not needed. See the -comments with the Integrate::ev\_set() method which document the flag -values. - -At various points of the timestep, fixes are invoked, -e.g. fix$\rightarrow$initial\_integrate(). In the code, this is -actually done via the Modify class which stores all the Fix objects -and lists of which should be invoked at what point in the timestep. -Fixes are the LAMMPS mechanism for tailoring the operations of a -timestep for a particular simulation. As described elsewhere -(unwritten section), each fix has one or more methods, each of which -is invoked at a specific stage of the timestep, as in Fig -\ref{fig:verlet}. All the fixes defined in an input script with an -initial\_integrate() method are invoked at the beginning of each -timestep. Fix nve, nvt, npt are examples, since they perform the -start-of-timestep velocity-Verlet integration to update velocities by -a half-step, and coordinates by a full step. The post\_integrate() -method is next. Only a few fixes use this, e.g. to reflect particles -off box boundaries in the FixWallReflect class. - -The decide() method in the Neighbor class determines whether neighbor -lists need to be rebuilt on the current timestep. If not, coordinates -of ghost atoms are acquired by each processor via the forward\_comm() -method of the Comm class. If neighbor lists need to be built, several -operations within the inner if clause of Fig \ref{fig:verlet} are -first invoked. The pre\_exchange() method of any defined fixes is -invoked first. Typically this inserts or deletes particles from the -system. - -Periodic boundary conditions are then applied by the Domain class via -its pbc() method to remap particles that have moved outside the -simulation box back into the box. Note that this is not done every -timestep. but only when neighbor lists are rebuilt. This is so that -each processor's sub-domain will have consistent (nearby) atom -coordinates for its owned and ghost atoms. It is also why dumped atom -coordinates can be slightly outside the simulation box. - -The box boundaries are then reset (if needed) via the reset\_box() -method of the Domain class, e.g. if box boundaries are shrink-wrapped -to current particle coordinates. A change in the box size or shape -requires internal information for communicating ghost atoms (Comm -class) and neighbor list bins (Neighbor class) be updated. The -setup() method of the Comm class and setup\_bins() method of the -Neighbor class perform the update. - -The code is now ready to migrate atoms that have left a processor's -geometric sub-domain to new processors. The exchange() method of the -Comm class performs this operation. The borders() method of the Comm -class then identifies ghost atoms surrounding each processor's -sub-domain and communicates ghost atom information to neighboring -processors. It does this by looping over all the atoms owned by a -processor to make lists of those to send to each neighbor processor. -On subsequent timesteps, the lists are used by the -Comm::forward\_comm() method. - -Fixes with a pre\_neighbor() method are then called. These typically -re-build some data structure stored by the fix that depends on the -current atoms owned by each processor. - -Now that each processor has a current list of its owned and ghost -atoms, LAMMPS is ready to rebuild neighbor lists via the build() -method of the Neighbor class. This is typically done by binning all -owned and ghost atoms, and scanning a stencil of bins around each -owned atom's bin to make a Verlet list of neighboring atoms within the -force cutoff plus neighbor skin distance. - -In the next portion of the timestep, all interaction forces between -particles are computed, after zeroing the per-atom force vector via -the force\_clear() method. If the newton flag is set to ``on'' by the -newton command, forces on both owned and ghost atoms are calculated. - -Pairwise forces are calculated first, which enables the global virial -(if requested) to be calculated cheaply (at the end of the -Pair::compute() method), by a dot product of atom coordinates and -forces. By including owned and ghost atoms in the dot product, the -effect of periodic boundary conditions is correctly accounted for. -Molecular topology interactions (bonds, angles, dihedrals, impropers) -are calculated next. The final contribution is from long-range -Coulombic interactions, invoked by the KSpace class. - -If the newton flag is on, forces on ghost atoms are communicated and -summed back to their corresponding owned atoms. The reverse\_comm() -method of the Comm class performs this operation, which is essentially -the inverse operation of sending copies of owned atom coordinates to -other processor's ghost atoms. - -At this point in the timestep, the total force on each atom is known. -Additional force constraints (external forces, SHAKE, etc) are applied -by Fixes that have a post\_force() method. The second half of the -velocity-Verlet integration is then performed (another half-step -update of the velocities) via fixes like nve, nvt, npt. - -At the end of the timestep, fixes that define an end\_of\_step() -method are invoked. These typically perform a diagnostic calculation, -e.g. the ave/time and ave/spatial fixes. The final operation of the -timestep is to perform any requested output, via the write() method of -the Output class. There are 3 kinds of LAMMPS output: thermodynamic -output to the screen and log file, snapshots of atom data to a dump -file, and restart files. See the thermo\_style, dump, and restart -commands for more details. - -The iteration performed by an energy minimization is similar to the -dynamics timestep of Fig \ref{fig:verlet}. Forces are computed, -neighbor lists are built as needed, atoms migrate to new processors, -and atom coordinates and forces are communicated to neighboring -processors. The only difference is what Fix class operations are -invoked when. Only a subset of LAMMPS fixes are useful during energy -minimization, as explained in their individual doc pages. The -relevant Fix class methods are min\_pre\_exchange(), -min\_pre\_force(), and min\_post\_force(). Each is invoked at the -appropriate place within the minimization iteration. For example, the -min\_post\_force() method is analogous to the post\_force() method for -dynamics; it is used to alter or constrain forces on each atom, which -affects the minimization procedure. - -\pagebreak -\section{Extending LAMMPS} - -The Section\_modify.html file in the doc directory of -the LAMMPS distribution gives an overview of how LAMMPS can -be extended by writing new classes that derive from existing -parent classes in LAMMPS. Here, some specific coding -details are provided for writing a new fix. - -\subsection{New fixes} - -(this section provided by Kirill Lykov) -\vspace{0.25cm} - -Writing fixes is a flexible way of extending LAMMPS. Users can -implement many things using fixes: - -\begin{itemize} -\item changing particles attributes (positions, velocities, forces, etc.). -Example: FixFreeze. -\item reading/writing data. Example: FixRestart. -\item implementing boundary conditions. Example: FixWall. -\item saving information about particles for future use (previous positions, -for instance). Example: FixStoreState. -\end{itemize} - -All fixes are derived from class Fix and must have constructor with the -signature: FixMine(class LAMMPS *, int, char **). - -Every fix must be registered in LAMMPS by writing the following lines -of code in the header before include guards: - - \begin{center} - \begin{verbatim} -#ifdef FIX_CLASS -FixStyle(your/fix/name,FixMine) -#else - \end{verbatim} - \end{center} - -Where ``your/fix/name'' is a name of your fix in the script and FixMine -is the name of the class. This code allows LAMMPS to find your fix -when it parses input script. In addition, your fix header must be -included in the file ``style\_fix.h''. In case if you use LAMMPS make, -this file is generated automatically - all files starting with prefix -fix\_ are included, so call your header the same way. Otherwise, don't -forget to add your include into ``style\_fix.h''. - -Let's write a simple fix which will print average velocity at the end -of each timestep. First of all, implement a constructor: - - \begin{center} - \begin{verbatim} -FixPrintVel::FixPrintVel(LAMMPS *lmp, int narg, char **arg) -: Fix(lmp, narg, arg) -{ - if (narg < 4) - error->all(FLERR,"Illegal fix print command"); - - nevery = atoi(arg[3]); - if (nevery <= 0) - error->all(FLERR,"Illegal fix print command"); -} - \end{verbatim} - \end{center} - -In the constructor you should parse your fix arguments which are -specified in the script. All fixes have pretty the same syntax: fix -[fix\_identifier] [group\_name] [fix\_name] [fix\_arguments]. The -first 3 parameters are parsed by Fix class constructor, while -[fix\_arguments] should be parsed by you. In our case, we need to -specify how often we want to print an average velocity. For instance, -once in 50 timesteps: fix 1 print/vel 50. There is a special variable -in Fix class called nevery which specifies how often method -end\_of\_step() is called. Thus all we need to do is just set it up. - -The next method we need to implement is setmask(): -\begin{center} -\begin{verbatim} -int FixPrintVel::setmask() -{ - int mask = 0; - mask |= FixConst::END_OF_STEP; - return mask; -} -\end{verbatim} -\end{center} - -Here user specifies which methods of your fix should be called during -the execution. For instance, END\_OF\_STEP corresponds to the -end\_of\_step() method. Overall, there are 8 most important methods, -methods are called in predefined order during the execution of the -verlet algorithm as was mentioned in the Section 3: - -\begin{itemize} -\item initial\_integrate() -\item post\_integrate() -\item pre\_exchange() -\item pre\_neighbor() -\item pre\_force() -\item post\_force() -\item final\_integrate() -\item end\_of\_step() -\end{itemize} - -Fix developer must understand when he wants to execute his code. In -case if we want to write FixPrintVel, we need only end\_of\_step(): - -\begin{center} -\begin{verbatim} -void FixPrintVel::end_of_step() -{ - // for add3, scale3 - using namespace MathExtra; - - double** v = atom->v; - int nlocal = atom->nlocal; - double localAvgVel[4]; // 4th element for particles count - memset(localAvgVel, 0, 4 * sizeof(double)); - for (int particleInd = 0; particleInd < nlocal; ++particleInd) { - add3(localAvgVel, v[particleInd], localAvgVel); - } - localAvgVel[3] = nlocal; - double globalAvgVel[4]; - memset(globalAvgVel, 0, 4 * sizeof(double)); - MPI_Allreduce(localAvgVel, globalAvgVel, 4, MPI_DOUBLE, MPI_SUM, world); - scale3(1.0 / globalAvgVel[3], globalAvgVel); - if (comm->me == 0) { - printf("\%e, \%e, \%e\n", - globalAvgVel[0], globalAvgVel[1], globalAvgVel[2]); - } -} -\end{verbatim} -\end{center} - -In the code above, we use MathExtra routines defined in -``math\_extra.h''. There are bunch of math functions to work with -arrays of doubles as with math vectors. - -In this code we use an instance of Atom class. This object is stored -in the Pointers class (see ``pointers.h''). This object contains all -global information about the simulation system. Data from Pointers -class available to all classes inherited from it using protected -inheritance. Hence when you write you own class, which is going to use -LAMMPS data, don't forget to inherit from Pointers. When writing -fixes we inherit from class Fix which is inherited from Pointers so -there is no need to inherit from it directly. - -The code above computes average velocity for all particles in the -simulation. Yet you have one unused parameter in fix call from the -script - [group\_name]. This parameter specifies the group of atoms -used in the fix. So we should compute average for all particles in the -simulation if group\_name == all, but it can be any group. The group -information is specified by groupbit which is defined in class Fix: - -\begin{center} -\begin{verbatim} -for (int particleInd = 0; particleInd < nlocal; ++particleInd) { - if (atom->mask[particleInd] & groupbit) { - //Do all job here - } -} -\end{verbatim} -\end{center} - -Class Atom encapsulates atoms positions, velocities, forces, etc. User -can access them using particle index. Note, that particle indexes are -usually changed every timestep because of sorting. - -Lets consider another Fix example. We want to have a fix which stores -atoms position from previous time step in your fix. The local atoms -indexes will not be valid on the next iteration. In order to handle -this situation there are several methods which should be implemented: - -\begin{itemize} -\item \verb|double memory_usage| - return how much memory fix uses -\item \verb|void grow_arrays(int)| - do reallocation of the per particle arrays - in your fix -\item \verb|void copy_arrays(int i, int j, int delflag)| - copy i-th per-particle - information to j-th. Used when atoms sorting is performed. if delflag is set - and atom j owns a body, move the body information to atom i. -\item \verb|void set_arrays(int i)| - sets i-th particle related information to zero -\end{itemize} - -Note, that if your class implements these methods, it must call add calls of -add\_callback and delete\_callback to constructor and destructor: - -\begin{center} -\begin{verbatim} -FixSavePos::FixSavePos(LAMMPS *lmp, int narg, char **arg) { - //... - atom->add_callback(0); -} - -FixSavePos::~FixSavePos() { - atom->delete_callback(id, 0); -} -\end{verbatim} -\end{center} - -Since we want to store positions of atoms from previous timestep, we -need to add double** x to the header file. Than add allocation code to -constructor: - -\verb|memory->create(this->x, atom->nmax, 3, "FixSavePos:x");|. Free memory -at destructor: \verb|memory->destroy(x);| - -Finally, implement mentioned methods: - -\begin{center} -\begin{verbatim} -double FixSavePos::memory_usage() -{ - int nmax = atom->nmax; - double bytes = 0.0; - bytes += nmax * 3 * sizeof(double); - return bytes; -} - -void FixSavePos::grow_arrays(int nmax) -{ - memory->grow(this->x, nmax, 3, "FixSavePos:x"); -} - -void FixSavePos::copy_arrays(int i, int j, int delflag) -{ - memcpy(this->x[j], this->x[i], sizeof(double) * 3); -} - -void FixSavePos::set_arrays(int i) -{ - memset(this->x[i], 0, sizeof(double) * 3); -} - -int FixSavePos::pack_exchange(int i, double *buf) -{ - int m = 0; - buf[m++] = x[i][0]; - buf[m++] = x[i][1]; - buf[m++] = x[i][2]; - - return m; -} - -int FixSavePos::unpack_exchange(int nlocal, double *buf) -{ - int m = 0; - x[nlocal][0] = buf[m++]; - x[nlocal][1] = buf[m++]; - x[nlocal][2] = buf[m++]; - - return m; -} -\end{verbatim} -\end{center} - -Now, a little bit about memory allocation. We used Memory class which -is just a bunch of template functions for allocating 1D and 2D -arrays. So you need to add include ``memory.h'' to have access to them. - -Finally, if you need to write/read some global information used in -your fix to the restart file, you might do it by setting flag -restart\_global = 1 in the constructor and implementing methods void -write\_restart(FILE *fp) and void restart(char *buf). - -\end{document} diff --git a/doc/src/Errors_bugs.rst b/doc/src/Errors_bugs.rst index ff0b155795..d2714c86b1 100644 --- a/doc/src/Errors_bugs.rst +++ b/doc/src/Errors_bugs.rst @@ -6,23 +6,25 @@ the steps outlined below: * Check the `New features and bug fixes `_ section of the `LAMMPS WWW site - `_ to see if the bug has already been addressed in a patch. + `_ or the + `GitHub Releases page `_ to + see if the bug has already been addressed in a patch release. * Check that your issue can be reproduced with the latest development version of LAMMPS. * Check the manual carefully to verify that the unexpected behavior you are observing is indeed in conflict with the documentation - * Check the `GitHub Issue page `_ + * Check the `GitHub Issue page `_ if your issue has already been reported and if it is still open. - * Check the `GitHub Pull Requests page `_ - if there is already a fix for your bug pending. + * Check the `GitHub Pull Requests page `_ + to see if there is already a fix for your bug pending. * Check the `mailing list archives `_ to see if the issue has been discussed before. If none of these steps yields any useful information, please file a new -bug report on the `GitHub Issue page `_. The website will offer -you to select a suitable template with explanations and then you should -replace those explanations with the information that you can provide to -reproduce your issue. +bug report on the `GitHub Issue page `_. +The website will offer you to select a suitable template with explanations +and then you should replace those explanations with the information that +you can provide to reproduce your issue. The most useful thing you can do to help us verify and fix a bug is to isolate the problem. Run it on the smallest number of atoms and fewest @@ -33,7 +35,7 @@ Please avoid using binary restart files unless the issue requires it. In the latter case you should also include an input deck to quickly generate this restart from a data file or a simple additional input. This input deck can be used with tools like a debugger or `valgrind -`_ to further :doc:`debug the crash `. +`_ to further :doc:`debug the crash `. You may also send an email to the LAMMPS mailing list at "lammps-users at lists.sourceforge.net" describing the problem with the @@ -44,6 +46,3 @@ is overlooked and then forgotten. Issues on GitHub have to be explicitly closed, so that will *guarantee* that at least one LAMMPS developer will have looked at it. -.. _lws: https://lammps.sandia.gov -.. _gip: https://github.com/lammps/issues -.. _valgrind: https://valgrind.org diff --git a/doc/src/Errors_common.rst b/doc/src/Errors_common.rst index 34567db385..4d4483efec 100644 --- a/doc/src/Errors_common.rst +++ b/doc/src/Errors_common.rst @@ -48,8 +48,10 @@ to see it on the screen. If you get an error like "Invalid ... style", with ... being fix, compute, pair, etc, it means that you mistyped the style name or that the command is part of an optional package which was not compiled into your executable. The list of -available styles in your executable can be listed by using :doc:`the -h command-line swith `. The installation and -compilation of optional packages is explained on the :doc:`Build packages ` doc page. +available styles in your executable can be listed by using +:doc:`the -h command-line switch `. The installation and +compilation of optional packages is explained on the +:doc:`Build packages ` doc page. For a given command, LAMMPS expects certain arguments in a specified order. If you mess this up, LAMMPS will often flag the error, but it diff --git a/doc/src/Errors_messages.rst b/doc/src/Errors_messages.rst index 6a694217f8..6bf2e1092c 100644 --- a/doc/src/Errors_messages.rst +++ b/doc/src/Errors_messages.rst @@ -1903,6 +1903,12 @@ Doc page with :doc:`WARNING messages ` *Compute %s does not allow use of dynamic group* Dynamic groups have not yet been enabled for this compute. +*Compute for fix pafi does not calculate a local array* + Self-explanatory. + +*Compute for fix pafi must have 9 fields per atom* + Self-explanatory. + *Compute ID for compute chunk /atom does not exist* Self-explanatory. diff --git a/doc/src/Examples.rst b/doc/src/Examples.rst index dc122f2c78..8a76dca66e 100644 --- a/doc/src/Examples.rst +++ b/doc/src/Examples.rst @@ -27,7 +27,7 @@ be quickly post-processed into a movie using commands described on the :doc:`dump image ` doc page. Animations of many of the examples can be viewed on the Movies section -of the `LAMMPS web site `_. +of the `LAMMPS web site `_. There are two kinds of sub-directories in the examples folder. Lower case named directories contain one or a few simple, quick-to-run @@ -223,4 +223,3 @@ instructions. See the :doc:`Packages_details ` doc page for more info on specific USER packages. .. _openkim: https://openkim.org -.. _lws: https://lammps.sandia.gov diff --git a/doc/src/Howto.rst b/doc/src/Howto.rst index 89c0ce9ffe..6d8f6e9054 100644 --- a/doc/src/Howto.rst +++ b/doc/src/Howto.rst @@ -3,7 +3,7 @@ Howto discussions These doc pages describe how to perform various tasks with LAMMPS, both for users and developers. The -`glossary `_ website page also lists MD +`glossary `_ website page also lists MD terminology with links to corresponding LAMMPS manual pages. The example input scripts included in the examples directory of the LAMMPS distribution and highlighted on the :doc:`Examples ` doc page diff --git a/doc/src/Howto_2d.rst b/doc/src/Howto_2d.rst index 1b4be32106..9cf76ac3b0 100644 --- a/doc/src/Howto_2d.rst +++ b/doc/src/Howto_2d.rst @@ -6,14 +6,14 @@ Use the :doc:`dimension ` command to specify a 2d simulation. Make the simulation box periodic in z via the :doc:`boundary ` command. This is the default. -If using the :doc:`create box ` command to define a +If using the :doc:`create_box ` command to define a simulation box, set the z dimensions narrow, but finite, so that the -create_atoms command will tile the 3d simulation box with a single z -plane of atoms - e.g. +:doc:`create_atoms ` command will fill the 3d simulation +box with a single z plane of atoms - e.g. .. code-block:: LAMMPS - :doc:`create box ` 1 -10 10 -10 10 -0.25 0.25 + create box 1 -10 10 -10 10 -0.25 0.25 If using the :doc:`read data ` command to read in a file of atom coordinates, set the "zlo zhi" values to be finite but narrow, diff --git a/doc/src/Howto_body.rst b/doc/src/Howto_body.rst index 36e40a88bd..0c0a930221 100644 --- a/doc/src/Howto_body.rst +++ b/doc/src/Howto_body.rst @@ -32,9 +32,9 @@ thus how they can be used to compute pairwise body/body or bond/non-body (point particle) interactions. More details of each style are described below. -More styles may be added in the future. See the :doc:`Modify body -` doc page for details on how to add a new body style to -the code. +More styles may be added in the future. See the +:doc:`page on creating new body styles ` for details on +how to add a new body style to the code. ---------- diff --git a/doc/src/Howto_chunk.rst b/doc/src/Howto_chunk.rst index 75fb30815b..c0a7792448 100644 --- a/doc/src/Howto_chunk.rst +++ b/doc/src/Howto_chunk.rst @@ -198,7 +198,8 @@ explained on the :doc:`compute chunk/spread/atom ` co (7) An example for using one set of per-chunk values for molecule chunks, to create a second set of micelle-scale chunks (clustered -molecules, due to hydrophobicity), is explained on the :doc:`compute chunk/reduce ` command doc page. +molecules, due to hydrophobicity), is explained on the +:doc:`compute reduce/chunk ` command doc page. (8) An example for using one set of per-chunk values (dipole moment vectors) for molecule chunks, spreading the values to each atom in diff --git a/doc/src/Howto_couple.rst b/doc/src/Howto_couple.rst index c652d4f599..2eadbb522e 100644 --- a/doc/src/Howto_couple.rst +++ b/doc/src/Howto_couple.rst @@ -12,96 +12,52 @@ LAMMPS can be coupled to other codes in at least 4 ways. Each has advantages and disadvantages, which you will have to think about in the context of your application. ----------- +1. Define a new :doc:`fix ` command that calls the other code. In + this scenario, LAMMPS is the driver code. During timestepping, + the fix is invoked, and can make library calls to the other code, + which has been linked to LAMMPS as a library. This is the way how the + :ref:`LATTE ` package, which performs density-functional + tight-binding calculations using the `LATTE software `_ + to compute forces, is hooked to LAMMPS. + See the :doc:`fix latte ` command for more details. + Also see the :doc:`Modify ` doc pages for info on how to + add a new fix to LAMMPS. -(1) Define a new :doc:`fix ` command that calls the other code. In -this scenario, LAMMPS is the driver code. During its timestepping, -the fix is invoked, and can make library calls to the other code, -which has been linked to LAMMPS as a library. This is the way the -`POEMS `_ package that performs constrained rigid-body motion on -groups of atoms is hooked to LAMMPS. See the :doc:`fix poems ` command for more details. See the -:doc:`Modify ` doc pages for info on how to add a new fix to -LAMMPS. +.. spacer -.. _poems: http://www.rpi.edu/~anderk5/lab +2. Define a new LAMMPS command that calls the other code. This is + conceptually similar to method (1), but in this case LAMMPS and the + other code are on a more equal footing. Note that now the other code + is not called during the timestepping of a LAMMPS run, but between + runs. The LAMMPS input script can be used to alternate LAMMPS runs + with calls to the other code, invoked via the new command. The + :doc:`run ` command facilitates this with its *every* option, + which makes it easy to run a few steps, invoke the command, run a few + steps, invoke the command, etc. ----------- + In this scenario, the other code can be called as a library, as in + 1., or it could be a stand-alone code, invoked by a system() call + made by the command (assuming your parallel machine allows one or + more processors to start up another program). In the latter case the + stand-alone code could communicate with LAMMPS through files that the + command writes and reads. -(2) Define a new LAMMPS command that calls the other code. This is -conceptually similar to method (1), but in this case LAMMPS and the -other code are on a more equal footing. Note that now the other code -is not called during the timestepping of a LAMMPS run, but between -runs. The LAMMPS input script can be used to alternate LAMMPS runs -with calls to the other code, invoked via the new command. The -:doc:`run ` command facilitates this with its *every* option, which -makes it easy to run a few steps, invoke the command, run a few steps, -invoke the command, etc. + See the :doc:`Modify command ` doc page for info on how + to add a new command to LAMMPS. -In this scenario, the other code can be called as a library, as in -(1), or it could be a stand-alone code, invoked by a system() call -made by the command (assuming your parallel machine allows one or more -processors to start up another program). In the latter case the -stand-alone code could communicate with LAMMPS through files that the -command writes and reads. +.. spacer -See the :doc:`Modify command ` doc page for info on how -to add a new command to LAMMPS. +3. Use LAMMPS as a library called by another code. In this case the + other code is the driver and calls LAMMPS as needed. Or a wrapper + code could link and call both LAMMPS and another code as libraries. + Again, the :doc:`run ` command has options that allow it to be + invoked with minimal overhead (no setup or clean-up) if you wish to + do multiple short runs, driven by another program. Details about + using the library interface are given in the :doc:`library API + ` documentation. ----------- +.. spacer -(3) Use LAMMPS as a library called by another code. In this case the -other code is the driver and calls LAMMPS as needed. Or a wrapper -code could link and call both LAMMPS and another code as libraries. -Again, the :doc:`run ` command has options that allow it to be -invoked with minimal overhead (no setup or clean-up) if you wish to do -multiple short runs, driven by another program. - -Examples of driver codes that call LAMMPS as a library are included in -the examples/COUPLE directory of the LAMMPS distribution; see -examples/COUPLE/README for more details: - -* simple: simple driver programs in C++ and C which invoke LAMMPS as a - library -* plugin: simple driver program in C which invokes LAMMPS as a plugin - from a shared library. -* lammps_quest: coupling of LAMMPS and `Quest `_, to run classical - MD with quantum forces calculated by a density functional code -* lammps_spparks: coupling of LAMMPS and `SPPARKS `_, to couple - a kinetic Monte Carlo model for grain growth using MD to calculate - strain induced across grain boundaries - -.. _quest: http://dft.sandia.gov/Quest - -.. _spparks: http://www.sandia.gov/~sjplimp/spparks.html - -The :doc:`Build basics ` doc page describes how to build -LAMMPS as a library. Once this is done, you can interface with LAMMPS -either via C++, C, Fortran, or Python (or any other language that -supports a vanilla C-like interface). For example, from C++ you could -create one (or more) "instances" of LAMMPS, pass it an input script to -process, or execute individual commands, all by invoking the correct -class methods in LAMMPS. From C or Fortran you can make function -calls to do the same things. See the :doc:`Python ` doc -pages for a description of the Python wrapper provided with LAMMPS -that operates through the LAMMPS library interface. - -The files src/library.cpp and library.h contain the C-style interface -to LAMMPS. See the :doc:`Howto library ` doc page for a -description of the interface and how to extend it for your needs. - -Note that the lammps_open() function that creates an instance of -LAMMPS takes an MPI communicator as an argument. This means that -instance of LAMMPS will run on the set of processors in the -communicator. Thus the calling code can run LAMMPS on all or a subset -of processors. For example, a wrapper script might decide to -alternate between LAMMPS and another code, allowing them both to run -on all the processors. Or it might allocate half the processors to -LAMMPS and half to the other code and run both codes simultaneously -before syncing them up periodically. Or it might instantiate multiple -instances of LAMMPS to perform different calculations. - ----------- - -(4) Couple LAMMPS with another code in a client/server mode. This is -described on the :doc:`Howto client/server ` doc -page. +4. Couple LAMMPS with another code in a client/server mode. This is + described on the :doc:`Howto client/server ` doc + page. diff --git a/doc/src/Howto_drude.rst b/doc/src/Howto_drude.rst index 62659711c4..c866340e77 100644 --- a/doc/src/Howto_drude.rst +++ b/doc/src/Howto_drude.rst @@ -29,7 +29,7 @@ molecular systems (:ref:`Lamoureux and Roux `): to the total charge of the core atom). A detailed tutorial covering the usage of Drude induced dipoles in -LAMMPS is on the :doc:`Howto drude2e ` doc page. +LAMMPS is on the :doc:`here `. As with the core-shell model, the cores and Drude particles should appear in the data file as standard atoms. The same holds for the diff --git a/doc/src/Howto_drude2.rst b/doc/src/Howto_drude2.rst index cbdbc2d250..3dacf99dec 100644 --- a/doc/src/Howto_drude2.rst +++ b/doc/src/Howto_drude2.rst @@ -377,7 +377,7 @@ For our phenol example, the groups would be defined as Note that with the fixes *drude/transform*\ , it is not required to specify *comm_modify vel yes* because the fixes do it anyway (several times and for the forces also). To avoid the flying ice cube artifact -:ref:`(Lamoureux) `, where the atoms progressively freeze and the +:ref:`(Lamoureux and Roux) `, where the atoms progressively freeze and the center of mass of the whole system drifts faster and faster, the *fix momentum* can be used. For instance: @@ -456,7 +456,7 @@ NPT ensemble using Nose-Hoover thermostat: .. _Lamoureux2: -**(Lamoureux)** Lamoureux and Roux, J Chem Phys, 119, 3025-3039 (2003) +**(Lamoureux and Roux)** Lamoureux and Roux, J Chem Phys, 119, 3025-3039 (2003) .. _Schroeder: diff --git a/doc/src/Howto_github.rst b/doc/src/Howto_github.rst index 795af96e0a..63cb8945e8 100644 --- a/doc/src/Howto_github.rst +++ b/doc/src/Howto_github.rst @@ -20,7 +20,7 @@ work required by the LAMMPS developers. Consequently, creating a pull request will increase your chances to have your contribution included and will reduce the time until the integration is complete. For more information on the requirements to have your code included into LAMMPS -please see the :doc:`Modify contribute ` doc page. +please see :doc:`this page `. ---------- diff --git a/doc/src/Howto_library.rst b/doc/src/Howto_library.rst index 774d9838c1..afa8dde941 100644 --- a/doc/src/Howto_library.rst +++ b/doc/src/Howto_library.rst @@ -2,241 +2,36 @@ Library interface to LAMMPS =========================== As described on the :doc:`Build basics ` doc page, LAMMPS -can be built as a library, so that it can be called by another code, -used in a :doc:`coupled manner ` with other codes, or -driven through a :doc:`Python interface `. +can be built as a static or shared library, so that it can be called by +another code, used in a :doc:`coupled manner ` with other +codes, or driven through a :doc:`Python interface `. -All of these methodologies use a C-style interface to LAMMPS that is -provided in the files src/library.cpp and src/library.h. The -functions therein have a C-style argument list, but contain C++ code -you could write yourself in a C++ application that was invoking LAMMPS -directly. The C++ code in the functions illustrates how to invoke -internal LAMMPS operations. Note that LAMMPS classes are defined -within a LAMMPS namespace (LAMMPS_NS) if you use them from another C++ -application. +At the core of LAMMPS is the ``LAMMPS`` class which encapsulates the +state of the simulation program through the state of the various class +instances that it is composed of. So a calculation using LAMMPS +requires to create an instance of the ``LAMMPS`` class and then send it +(text) commands, either individually or from a file, or perform other +operations that modify the state stored inside that instance or drive +simulations. This is essentially what the ``src/main.cpp`` file does +as well for the standalone LAMMPS executable with reading commands +either from an input file or stdin. -The examples/COUPLE and python/examples directories have example C++ -and C and Python codes which show how a driver code can link to LAMMPS -as a library, run LAMMPS on a subset of processors, grab data from -LAMMPS, change it, and put it back into LAMMPS. +Creating a LAMMPS instance can be done by using C++ code directly or +through a C-style interface library to LAMMPS that is provided in the +files ``src/library.cpp`` and ``library.h``. This +:ref:`C language API `, can be used from C and C++, +and is also the basis for the :doc:`Python ` and +:doc:`Fortran ` interfaces or wrappers included in the +LAMMPS source code. -Thread-safety -------------- +The ``examples/COUPLE`` and ``python/examples`` directories contain some +example programs written in C++, C, Fortran, and Python, which show how +a driver code can link to LAMMPS as a library, run LAMMPS on a subset of +processors (so the others are available to run some other code +concurrently), grab data from LAMMPS, change it, and send it back into +LAMMPS. -LAMMPS has not initially been conceived as a thread-safe program, but -over the years changes have been applied to replace operations that -collide with creating multiple LAMMPS instances from multiple-threads -of the same process with thread-safe alternatives. This primarily -applies to the core LAMMPS code and less so on add-on packages, especially -when those packages require additional code in the *lib* folder, -interface LAMMPS to Fortran libraries, or the code uses static variables -(like the USER-COLVARS package. +A detailed documentation of the available APIs and examples of how to +use them can be found in the :doc:`Programmer Documentation +` section of this manual. -Another major issue to deal with is to correctly handle MPI. Creating -a LAMMPS instance requires passing an MPI communicator, or it assumes -the MPI_COMM_WORLD communicator, which spans all MPI processor ranks. -When creating multiple LAMMPS object instances from different threads, -this communicator has to be different for each thread or else collisions -can happen, or it has to be guaranteed, that only one thread at a time -is active. MPI communicators, however, are not a problem, if LAMMPS is -compiled with the MPI STUBS library, which implies that there is no MPI -communication and only 1 MPI rank. - -Provided APIs -------------- - -The file src/library.cpp contains the following functions for creating -and destroying an instance of LAMMPS and sending it commands to -execute. See the documentation in the src/library.cpp file for -details. - -.. note:: - - You can write code for additional functions as needed to define - how your code talks to LAMMPS and add them to src/library.cpp and - src/library.h, as well as to the :doc:`Python interface `. - The added functions can access or change any internal LAMMPS data you - wish. - -.. code-block:: c - - void lammps_open(int, char **, MPI_Comm, void **) - void lammps_open_no_mpi(int, char **, void **) - void lammps_close(void *) - int lammps_version(void *) - void lammps_file(void *, char *) - char *lammps_command(void *, char *) - void lammps_commands_list(void *, int, char **) - void lammps_commands_string(void *, char *) - void lammps_free(void *) - -The lammps_open() function is used to initialize LAMMPS, passing in a -list of strings as if they were :doc:`command-line arguments ` when LAMMPS is run in stand-alone mode -from the command line, and a MPI communicator for LAMMPS to run under. -It returns a ptr to the LAMMPS object that is created, and which is -used in subsequent library calls. The lammps_open() function can be -called multiple times, to create multiple instances of LAMMPS. - -LAMMPS will run on the set of processors in the communicator. This -means the calling code can run LAMMPS on all or a subset of -processors. For example, a wrapper script might decide to alternate -between LAMMPS and another code, allowing them both to run on all the -processors. Or it might allocate half the processors to LAMMPS and -half to the other code and run both codes simultaneously before -syncing them up periodically. Or it might instantiate multiple -instances of LAMMPS to perform different calculations. - -The lammps_open_no_mpi() function is similar except that no MPI -communicator is passed from the caller. Instead, MPI_COMM_WORLD is -used to instantiate LAMMPS, and MPI is initialized if necessary. - -The lammps_close() function is used to shut down an instance of LAMMPS -and free all its memory. - -The lammps_version() function can be used to determined the specific -version of the underlying LAMMPS code. This is particularly useful -when loading LAMMPS as a shared library via dlopen(). The code using -the library interface can than use this information to adapt to -changes to the LAMMPS command syntax between versions. The returned -LAMMPS version code is an integer (e.g. 2 Sep 2015 results in -20150902) that grows with every new LAMMPS version. - -The lammps_file(), lammps_command(), lammps_commands_list(), and -lammps_commands_string() functions are used to pass one or more -commands to LAMMPS to execute, the same as if they were coming from an -input script. - -Via these functions, the calling code can read or generate a series of -LAMMPS commands one or multiple at a time and pass it through the library -interface to setup a problem and then run it in stages. The caller -can interleave the command function calls with operations it performs, -calls to extract information from or set information within LAMMPS, or -calls to another code's library. - -The lammps_file() function passes the filename of an input script. -The lammps_command() function passes a single command as a string. -The lammps_commands_list() function passes multiple commands in a -char\*\* list. In both lammps_command() and lammps_commands_list(), -individual commands may or may not have a trailing newline. The -lammps_commands_string() function passes multiple commands -concatenated into one long string, separated by newline characters. -In both lammps_commands_list() and lammps_commands_string(), a single -command can be spread across multiple lines, if the last printable -character of all but the last line is "&", the same as if the lines -appeared in an input script. - -The lammps_free() function is a clean-up function to free memory that -the library allocated previously via other function calls. See -comments in src/library.cpp file for which other functions need this -clean-up. - -The file src/library.cpp also contains these functions for extracting -information from LAMMPS and setting value within LAMMPS. Again, see -the documentation in the src/library.cpp file for details, including -which quantities can be queried by name: - -.. code-block:: c - - int lammps_extract_setting(void *, char *) - void *lammps_extract_global(void *, char *) - void lammps_extract_box(void *, double *, double *, - double *, double *, double *, int *, int *) - void *lammps_extract_atom(void *, char *) - void *lammps_extract_compute(void *, char *, int, int) - void *lammps_extract_fix(void *, char *, int, int, int, int) - void *lammps_extract_variable(void *, char *, char *) - -The extract_setting() function returns info on the size -of data types (e.g. 32-bit or 64-bit atom IDs) used -by the LAMMPS executable (a compile-time choice). - -The other extract functions return a pointer to various global or -per-atom quantities stored in LAMMPS or to values calculated by a -compute, fix, or variable. The pointer returned by the -extract_global() function can be used as a permanent reference to a -value which may change. For the extract_atom() method, see the -extract() method in the src/atom.cpp file for a list of valid per-atom -properties. New names could easily be added if the property you want -is not listed. For the other extract functions, the underlying -storage may be reallocated as LAMMPS runs, so you need to re-call the -function to assure a current pointer or returned value(s). - -.. code-block:: c - - double lammps_get_thermo(void *, char *) - int lammps_get_natoms(void *) - - int lammps_set_variable(void *, char *, char *) - void lammps_reset_box(void *, double *, double *, double, double, double) - -The lammps_get_thermo() function returns the current value of a thermo -keyword as a double precision value. - -The lammps_get_natoms() function returns the total number of atoms in -the system and can be used by the caller to allocate memory for the -lammps_gather_atoms() and lammps_scatter_atoms() functions. - -The lammps_set_variable() function can set an existing string-style -variable to a new string value, so that subsequent LAMMPS commands can -access the variable. - -The lammps_reset_box() function resets the size and shape of the -simulation box, e.g. as part of restoring a previously extracted and -saved state of a simulation. - -.. code-block:: c - - void lammps_gather_atoms(void *, char *, int, int, void *) - void lammps_gather_atoms_concat(void *, char *, int, int, void *) - void lammps_gather_atoms_subset(void *, char *, int, int, int, int *, void *) - void lammps_scatter_atoms(void *, char *, int, int, void *) - void lammps_scatter_atoms_subset(void *, char *, int, int, int, int *, void *) - -The gather functions collect peratom info of the requested type (atom -coords, atom types, forces, etc) from all processors, and returns the -same vector of values to each calling processor. The scatter -functions do the inverse. They distribute a vector of peratom values, -passed by all calling processors, to individual atoms, which may be -owned by different processors. - -.. warning:: - - These functions are not compatible with the - -DLAMMPS_BIGBIG setting when compiling LAMMPS. Dummy functions - that result in an error message and abort will be substituted - instead of resulting in random crashes and memory corruption. - -The lammps_gather_atoms() function does this for all N atoms in the -system, ordered by atom ID, from 1 to N. The -lammps_gather_atoms_concat() function does it for all N atoms, but -simply concatenates the subset of atoms owned by each processor. The -resulting vector is not ordered by atom ID. Atom IDs can be requested -by the same function if the caller needs to know the ordering. The -lammps_gather_subset() function allows the caller to request values -for only a subset of atoms (identified by ID). -For all 3 gather function, per-atom image flags can be retrieved in 2 ways. -If the count is specified as 1, they are returned -in a packed format with all three image flags stored in a single integer. -If the count is specified as 3, the values are unpacked into xyz flags -by the library before returning them. - -The lammps_scatter_atoms() function takes a list of values for all N -atoms in the system, ordered by atom ID, from 1 to N, and assigns -those values to each atom in the system. The -lammps_scatter_atoms_subset() function takes a subset of IDs as an -argument and only scatters those values to the owning atoms. - -.. code-block:: c - - void lammps_create_atoms(void *, int, tagint *, int *, double *, double *, - imageint *, int) - -The lammps_create_atoms() function takes a list of N atoms as input -with atom types and coords (required), an optionally atom IDs and -velocities and image flags. It uses the coords of each atom to assign -it as a new atom to the processor that owns it. This function is -useful to add atoms to a simulation or (in tandem with -lammps_reset_box()) to restore a previously extracted and saved state -of a simulation. Additional properties for the new atoms can then be -assigned via the lammps_scatter_atoms() or lammps_extract_atom() -functions. diff --git a/doc/src/Howto_spherical.rst b/doc/src/Howto_spherical.rst index 7ca8a1b060..aa17e6ce21 100644 --- a/doc/src/Howto_spherical.rst +++ b/doc/src/Howto_spherical.rst @@ -114,7 +114,7 @@ will only rotate and experience torque if the force field computes such interactions. These are the various :doc:`pair styles ` that generate torque: * :doc:`pair_style gran/history ` -* :doc:`pair_style gran/hertzian ` +* :doc:`pair_style gran/hertz ` * :doc:`pair_style gran/no_history ` * :doc:`pair_style dipole/cut ` * :doc:`pair_style gayberne ` diff --git a/doc/src/Howto_thermostat.rst b/doc/src/Howto_thermostat.rst index 77745efa57..7bddb1c89d 100644 --- a/doc/src/Howto_thermostat.rst +++ b/doc/src/Howto_thermostat.rst @@ -42,12 +42,12 @@ particles. DPD thermostatting alters pairwise interactions in a manner analogous to the per-particle thermostatting of :doc:`fix langevin `. -Any of the thermostatting fixes can use :doc:`temperature computes ` that remove bias which has two -effects. First, the current calculated temperature, which is compared -to the requested target temperature, is calculated with the velocity -bias removed. Second, the thermostat adjusts only the thermal -temperature component of the particle's velocities, which are the -velocities with the bias removed. The removed bias is then added back +Any of the thermostatting fixes can be instructed to use custom temperature +computes that remove bias which has two effects: first, the current +calculated temperature, which is compared to the requested target temperature, +is calculated with the velocity bias removed; second, the thermostat adjusts +only the thermal temperature component of the particle's velocities, which are +the velocities with the bias removed. The removed bias is then added back to the adjusted velocities. See the doc pages for the individual fixes and for the :doc:`fix_modify ` command for instructions on how to assign a temperature compute to a @@ -55,7 +55,24 @@ thermostatting fix. For example, you can apply a thermostat to only the x and z components of velocity by using it in conjunction with :doc:`compute temp/partial `. Of you could thermostat only the thermal temperature of a streaming flow of -particles without affecting the streaming velocity, by using :doc:`compute temp/profile `. +particles without affecting the streaming velocity, by using +:doc:`compute temp/profile `. + +Below is a list of some custom temperature computes that can be used like that: + +* :doc:`compute_temp_asphere` +* :doc:`compute_temp_body` +* :doc:`compute_temp_chunk` +* :doc:`compute_temp_com` +* :doc:`compute_temp_deform` +* :doc:`compute_temp_partial` +* :doc:`compute_temp_profile` +* :doc:`compute_temp_ramp` +* :doc:`compute_temp_region` +* :doc:`compute_temp_rotate` +* :doc:`compute_temp_sphere` + + .. note:: diff --git a/doc/src/Howto_viscosity.rst b/doc/src/Howto_viscosity.rst index 8c7eb91b12..cfe9497665 100644 --- a/doc/src/Howto_viscosity.rst +++ b/doc/src/Howto_viscosity.rst @@ -5,8 +5,8 @@ The shear viscosity eta of a fluid can be measured in at least 6 ways using various options in LAMMPS. See the examples/VISCOSITY directory for scripts that implement the 5 methods discussed here for a simple Lennard-Jones fluid model and 1 method for SPC/E water model. -Also, see the :doc:`Howto kappa ` doc page for an analogous discussion for -thermal conductivity. +Also, see the :doc:`page on calculating thermal conductivity ` +for an analogous discussion for thermal conductivity. Eta is a measure of the propensity of a fluid to transmit momentum in a direction perpendicular to the direction of velocity or momentum diff --git a/doc/src/Install_git.rst b/doc/src/Install_git.rst index 2f6e8096dc..868f679dbc 100644 --- a/doc/src/Install_git.rst +++ b/doc/src/Install_git.rst @@ -46,20 +46,19 @@ between them at any time using "git checkout ".) Once the command completes, your directory will contain the same files as if you unpacked a current LAMMPS tarball, with the exception, that the HTML documentation files are not included. They can be fetched -from the LAMMPS website by typing "make fetch" in the doc directory. +from the LAMMPS website by typing ``make fetch`` in the doc directory. Or they can be generated from the content provided in doc/src by -typing "make html" from the doc directory. +typing ``make html`` from the doc directory. After initial cloning, as bug fixes and new features are added to -LAMMPS, as listed on :doc:`this page `, you can stay -up-to-date by typing the following git commands from within the -"mylammps" directory: +LAMMPS you can stay up-to-date by typing the following git commands +from within the "mylammps" directory: .. code-block:: bash $ git checkout unstable # not needed if you always stay in this branch - $ git checkout stable # use one of the 3 checkout commands - $ git checkout master + $ git checkout stable # use one of these 3 checkout commands + $ git checkout master # to choose the branch to follow $ git pull Doing a "pull" will not change any files you have added to the LAMMPS @@ -70,8 +69,8 @@ repository file with your version of the file and tell you if there are any conflicts. See the git documentation for details. If you want to access a particular previous release version of LAMMPS, -you can instead "checkout" any version with a published tag. See the -output of "git tag -l" for the list of tags. The git command to do +you can instead "check out" any version with a published tag. See the +output of ``git tag -l`` for the list of tags. The git command to do this is as follows. .. code-block:: bash @@ -79,14 +78,14 @@ this is as follows. $ git checkout tagID Stable versions and what tagID to use for a particular stable version -are discussed on :doc:`this page `. Note that this command -will print some warnings, because in order to get back to the latest -revision and to be able to update with "git pull" again, you first -will need to first type "git checkout unstable" (or check out any -other desired branch). +are discussed on `this page `_. +Note that this command will print some warnings, because in order to get +back to the latest revision and to be able to update with ``git pull`` +again, you will need to do ``git checkout unstable`` (or +check out any other desired branch) first. -Once you have updated your local files with a "git pull" (or "git -checkout"), you still need to re-build LAMMPS if any source files have +Once you have updated your local files with a ``git pull`` (or ``git +checkout``), you still need to re-build LAMMPS if any source files have changed. To do this, you should cd to the src directory and type: .. code-block:: bash @@ -95,7 +94,7 @@ changed. To do this, you should cd to the src directory and type: $ make package-update # sync package files with src files $ make foo # re-build for your machine (mpi, serial, etc) -just as described on the :doc:`Install patch ` doc page, +just as described on the :doc:`Apply patch ` doc page, after a patch has been installed. .. warning:: diff --git a/doc/src/Install_linux.rst b/doc/src/Install_linux.rst index bb67f1aa84..121869187a 100644 --- a/doc/src/Install_linux.rst +++ b/doc/src/Install_linux.rst @@ -79,13 +79,13 @@ To get a copy of the current potentials files: which will download the potentials files to ``/usr/share/lammps-stable/potentials``. The ``lmp_stable`` binary is hard-coded to look for potential files in this directory (it does not -use the `LAMMPS_POTENTIALS` environment variable, as described +use the ``LAMMPS_POTENTIALS`` environment variable, as described in :doc:`pair_coeff ` command). The ``lmp_stable`` binary is built with the :ref:`KIM package ` which -results in the above command also installing the `kim-api` binaries when LAMMPS +results in the above command also installing the ``kim-api`` binaries when LAMMPS is installed. In order to use potentials from `openkim.org `_, you -can install the `openkim-models` package +can install the ``openkim-models`` package .. code-block:: bash diff --git a/doc/src/Install_patch.rst b/doc/src/Install_patch.rst index 3acd72753f..0bbd7bbf00 100644 --- a/doc/src/Install_patch.rst +++ b/doc/src/Install_patch.rst @@ -6,9 +6,12 @@ if you use git to track the LAMMPS development. Instructions for how to stay current are on the :doc:`Download the LAMMPS source with git ` page. -If you prefer to download a tarball, as described on the :doc:`Install git ` doc page, you can stay current by +If you prefer to download a tarball, as described on the +:doc:`tarball download ` page, you can stay current by downloading "patch files" when new patch releases are made. A link to -a patch file is posted on the `bug and feature page `_ of the LAMMPS website, along +a patch file is posted on the +`bugf fixes and new feature page `_ +of the LAMMPS website, along with a list of changed files and details about what is in the new patch release. This page explains how to apply the patch file to your local LAMMPS directory. diff --git a/doc/src/Intro_features.rst b/doc/src/Intro_features.rst index cff198da70..acf27455cf 100644 --- a/doc/src/Intro_features.rst +++ b/doc/src/Intro_features.rst @@ -181,7 +181,7 @@ Pre- and post-processing * A handful of pre- and post-processing tools are packaged with LAMMPS, some of which can convert input and output files to/from formats used - by other codes; see the :doc:`Toos ` doc page. + by other codes; see the :doc:`Tools ` doc page. * Our group has also written and released a separate toolkit called `Pizza.py `_ which provides tools for doing setup, analysis, plotting, and visualization for LAMMPS simulations. Pizza.py is @@ -197,7 +197,7 @@ Specialized features ---------------------------------- LAMMPS can be built with optional packages which implement a variety -of additional capabilities. See the :doc:`Packages ` doc +of additional capabilities. See the :doc:`Optional Packages ` page for details. These are LAMMPS capabilities which you may not think of as typical @@ -214,7 +214,7 @@ classical MD options: * Monte Carlo via :doc:`GCMC ` and :doc:`tfMC ` and :doc:`atom swapping ` * :doc:`path-integral molecular dynamics (PIMD) ` and :doc:`this as well ` * :doc:`Direct Simulation Monte Carlo ` for low-density fluids -* :doc:`Peridynamics mesoscale modeling ` +* :doc:`Peridynamics modeling ` * :doc:`Lattice Boltzmann fluid ` * :doc:`targeted ` and :doc:`steered ` molecular dynamics * :doc:`two-temperature electron model ` diff --git a/doc/src/Intro_nonfeatures.rst b/doc/src/Intro_nonfeatures.rst index fb41b9a054..a22a726bdc 100644 --- a/doc/src/Intro_nonfeatures.rst +++ b/doc/src/Intro_nonfeatures.rst @@ -66,8 +66,10 @@ Here are suggestions on how to perform these tasks: on-the-fly via its :doc:`dump image ` command and pass them to an external program, `FFmpeg `_ to generate movies from them. For high-quality, interactive visualization there are - many excellent and free tools available. See the `Other Codes page `_ page of the LAMMPS website for - visualization packages that can use LAMMPS output data. + many excellent and free tools available. See the + `Visualization Tools `_ page of the + LAMMPS website for + visualization packages that can process LAMMPS output data. * **Plotting:** See the next bullet about Pizza.py as well as the :doc:`Python ` doc page for examples of plotting LAMMPS output. Scripts provided with the *python* tool in the tools diff --git a/doc/src/Intro_overview.rst b/doc/src/Intro_overview.rst index 776002354a..df6bfad33d 100644 --- a/doc/src/Intro_overview.rst +++ b/doc/src/Intro_overview.rst @@ -15,7 +15,7 @@ that supports the `MPI `_ message-passing library. This includes shared-memory boxes and distributed-memory clusters and supercomputers. -.. _mpi: http://www-unix.mcs.anl.gov/mpi +.. _mpi: https://en.wikipedia.org/wiki/Message_Passing_Interface .. _lws: https://lammps.sandia.gov LAMMPS is written in C++. Earlier versions were written in F77 and diff --git a/doc/src/Intro_website.rst b/doc/src/Intro_website.rst index 0999e90907..7abc78e7e4 100644 --- a/doc/src/Intro_website.rst +++ b/doc/src/Intro_website.rst @@ -2,28 +2,27 @@ Additional website links ======================== The `LAMMPS website `_ has a variety of additional info about -LAMMPS, beyond what is in this manual. Some of the other pages in -this Intr are included in this list. +LAMMPS, beyond what is in this manual. Some other useful resources +available online are listed below. .. _lws: https://lammps.sandia.gov * `Brief intro and recently added significant features `_ -* `List of features `_ -* `List of non-features `_ +* `List of features `_ +* `List of non-features `_ * `Recent bug fixes and new features `_ * `Download info `_ * `GitHub site `_ * `SourceForge site `_ -* `LAMMPS open-source license `_ +* `LAMMPS open-source license `_ -* `Glossary of MD terms relevant to LAMMPS `_ +* `Glossary of terms relevant to LAMMPS `_ * `LAMMPS highlights with images `_ * `LAMMPS highlights with movies `_ * `Mail list `_ * `Workshops `_ * `Tutorials `_ -* `Developer guide `_ * `Pre- and post-processing tools for LAMMPS `_ * `Other software usable with LAMMPS `_ diff --git a/doc/src/Manual.rst b/doc/src/Manual.rst index 29852093d0..7c715239df 100644 --- a/doc/src/Manual.rst +++ b/doc/src/Manual.rst @@ -27,8 +27,10 @@ all LAMMPS development is coordinated. The content for this manual is part of the LAMMPS distribution. You can build a local copy of the Manual as HTML pages or a PDF file, by following the steps on the :doc:`Manual build ` doc page. -There is also a `Developer.pdf `_ document which gives -a brief description of the basic code structure of LAMMPS. +The manual is organized in two parts: +1) A :ref:`User documentation ` for how to install +and use LAMMPS and 2) a :ref:`Programmer documentation ` +for how to write programs using the LAMMPS library or how to modify LAMMPS. ---------- @@ -55,7 +57,6 @@ every LAMMPS command. Howto Examples Tools - Modify Python_head Errors Manual_build @@ -68,10 +69,9 @@ every LAMMPS command. :name: progdoc :includehidden: + pg_library + Modify pg_developer -.. pg_library -.. pg_modify -.. pg_base .. toctree:: :caption: Index diff --git a/doc/src/Manual_build.rst b/doc/src/Manual_build.rst index 972f38bf2e..a8e3f1a1c6 100644 --- a/doc/src/Manual_build.rst +++ b/doc/src/Manual_build.rst @@ -14,7 +14,6 @@ files. Here is a list with descriptions: lammps.1 # man page for the lammps command msi2lmp.1 # man page for the msi2lmp command Manual.pdf # large PDF version of entire manual - Developer.pdf # small PDF with info about how LAMMPS is structured LAMMPS.epub # Manual in ePUB e-book format LAMMPS.mobi # Manual in MOBI e-book format docenv # virtualenv folder for processing the manual sources @@ -35,7 +34,7 @@ of two ways: a. You can "fetch" the current HTML and PDF files from the LAMMPS web site. Just type ``make fetch``. This should download a html_www - directory and Manual_www.pdf/Developer_www.pdf files. Note that if + directory and a Manual_www.pdf file. Note that if new LAMMPS features have been added more recently than the date of your LAMMPS version, the fetched documentation will include those changes (but your source code will not, unless you update your local @@ -49,6 +48,11 @@ b. You can build the HTML or PDF files yourself, by typing ``make html`` only once, unless you type ``make clean-all``. After that, viewing and processing of the documentation can be done without internet access. +A current version of the manual (latest patch release, aka unstable branch) +is is available online at: `https://lammps.sandia.gov/doc/Manual.html `_ +A version of the manual corresponding to the ongoing development +(aka master branch) is available online at: `https://docs.lammps.org/ `_ + ---------- The generation of all documentation is managed by the Makefile in the @@ -58,10 +62,9 @@ available: .. code-block:: bash make html # generate HTML in html dir using Sphinx - make pdf # generate 2 PDF files (Manual.pdf,Developer.pdf) - # in doc dir via htmldoc and pdflatex - make fetch # fetch HTML doc pages and 2 PDF files from web site - # as a tarball and unpack into html dir and 2 PDFs + make pdf # generate PDF as Manual.pdf using Sphinx and pdflatex + make fetch # fetch HTML doc pages and PDF file from web site + # as a tarball and unpack into html dir and PDF make epub # generate LAMMPS.epub in ePUB format using Sphinx make mobi # generate LAMMPS.mobi in MOBI format using ebook-convert diff --git a/doc/src/Modify.rst b/doc/src/Modify.rst index 531fb6b1f3..2a727dfd0f 100644 --- a/doc/src/Modify.rst +++ b/doc/src/Modify.rst @@ -1,5 +1,5 @@ -Modify & extend LAMMPS -********************** +Modifying & extending LAMMPS +**************************** LAMMPS is designed in a modular fashion so as to be easy to modify and extend with new functionality. In fact, about 95% of its source code @@ -8,7 +8,8 @@ this. If you add a new feature to LAMMPS and think it will be of interest to general users, we encourage you to submit it for inclusion in LAMMPS -as a pull request on our `GitHub site `_, after reading the :doc:`Modify contribute ` doc page. +as a pull request on our `GitHub site `_, +after reading :doc:`this page `. .. toctree:: :maxdepth: 1 diff --git a/doc/src/Modify_atom.rst b/doc/src/Modify_atom.rst index 34a529020a..5c3a96789e 100644 --- a/doc/src/Modify_atom.rst +++ b/doc/src/Modify_atom.rst @@ -47,13 +47,13 @@ other strings. * - fields_comm - list of properties communicated to ghost atoms every step * - fields_comm_vel - - additional properties communicated if :doc:`comm_modify vel ` is used + - additional properties communicated if :doc:`comm_modify vel ` is used * - fields_reverse - list of properties summed from ghost atoms every step * - fields_border - list of properties communicated with ghost atoms every reneighboring step * - fields_border_vel - - additional properties communicated if :doc:`comm_modify vel ` is used + - additional properties communicated if :doc:`comm_modify vel ` is used * - fields_exchange - list of properties communicated when an atom migrates to another processor * - fields_restart diff --git a/doc/src/Modify_contribute.rst b/doc/src/Modify_contribute.rst index 8bc320a9b0..27de36f30c 100644 --- a/doc/src/Modify_contribute.rst +++ b/doc/src/Modify_contribute.rst @@ -31,14 +31,14 @@ send an e-mail to ``slack@lammps.org`` explaining what part of LAMMPS you are working on. Only discussions related to LAMMPS development are tolerated, so this is **NOT** for people that look for help with compiling, installing, or using LAMMPS. Please contact the `lammps-users mailing -list `_ for those purposes instead. +list `_ for those purposes instead. How quickly your contribution will be integrated depends largely on how much effort it will cause to integrate and test it, how much it requires changes to the core codebase, and of how much interest it is to the larger LAMMPS community. Please see below for a checklist of typical -requirements. Once you have prepared everything, see the :doc:`Using -GitHub with LAMMPS Howto ` doc page for instructions on +requirements. Once you have prepared everything, see the :doc:`LAMMPS GitHub +Tutorial ` page for instructions on how to submit your changes or new files through a GitHub pull request. If you prefer to submit patches or full files, you should first make certain, that your code works correctly with the latest patch-level @@ -58,8 +58,8 @@ are listed and described on the :doc:`Packages details ` doc p Note that by providing us files to release, you are agreeing to make them open-source, i.e. we can release them under the terms of the GPL, -used as a license for the rest of LAMMPS. See the `Open source `_ page on the LAMMPS -website for details. +used as a license for the rest of LAMMPS. See the :doc:`LAMMPS license +` doc page for details. With user packages and files, all we are really providing (aside from the fame and fortune that accompanies having your name in the source diff --git a/doc/src/Modify_thermo.rst b/doc/src/Modify_thermo.rst index 564df9ec7a..ea09e30c1d 100644 --- a/doc/src/Modify_thermo.rst +++ b/doc/src/Modify_thermo.rst @@ -20,7 +20,7 @@ for output. Search for the word "customize" with references to "keyword" in thermo.cpp to see the several locations where code will need to be added. -Note that the :doc:`thermo_style custom ` command already allows +Note that the :doc:`thermo_style custom ` command already allows for thermo output of quantities calculated by :doc:`fixes `, :doc:`computes `, and :doc:`variables `. Thus, it may be simpler to compute what you wish via one of those constructs, than diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index 3d21232a8f..1beeeff5b4 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -299,7 +299,8 @@ Dozens of pair styles and a version of the PPPM long-range Coulombic solver optimized for GPUs. All such styles have a "gpu" as a suffix in their style name. The GPU code can be compiled with either CUDA or OpenCL, however the OpenCL variants are no longer actively maintained -and only the CUDA versions are regularly tested. The :doc:`Speed gpu ` doc page gives details of what hardware and GPU +and only the CUDA versions are regularly tested. The +:doc:`Speed_gpu` page gives details of what hardware and GPU software is required on your system, and details on how to build and use this package. Its styles can be invoked at run time via the "-sf gpu" or "-suffix gpu" :doc:`command-line switches `. See @@ -318,8 +319,8 @@ This package has :ref:`specific installation instructions ` on the :doc:`Bu * src/GPU: filenames -> commands * src/GPU/README * lib/gpu/README -* :doc:`Speed packages ` -* :doc:`Speed gpu ` +* :doc:`Accelerator packages ` +* :doc:`GPU package ` * :doc:`Section 2.6 -sf gpu ` * :doc:`Section 2.6 -pk gpu ` * :doc:`package gpu ` @@ -433,7 +434,7 @@ Dozens of atom, pair, bond, angle, dihedral, improper, fix, compute styles adapted to compile using the Kokkos library which can convert them to OpenMP or CUDA code so that they run efficiently on multicore CPUs, KNLs, or GPUs. All the styles have a "kk" as a suffix in their -style name. The :doc:`Speed kokkos ` doc page gives +style name. The :doc:`KOKKOS package ` doc page gives details of what hardware and software is required on your system, and how to build and use this package. Its styles can be invoked at run time via the "-sf kk" or "-suffix kk" :doc:`command-line switches `. Also see the :ref:`GPU `, :ref:`OPT `, @@ -463,8 +464,8 @@ This package has :ref:`specific installation instructions ` on the :doc: * src/KOKKOS: filenames -> commands * src/KOKKOS/README * lib/kokkos/README -* :doc:`Speed packages ` -* :doc:`Speed kokkos ` +* :doc:`Accelerator packages ` +* :doc:`KOKKOS package ` * :doc:`Section 2.6 -k on ... ` * :doc:`Section 2.6 -sf kk ` * :doc:`Section 2.6 -pk kokkos ` @@ -665,7 +666,7 @@ A general interface for machine-learning interatomic potentials. **Install:** -To use this package, also the :ref:`SNAP package` needs to be installed. +To use this package, also the :ref:`SNAP package ` needs to be installed. **Author:** Aidan Thompson (Sandia). @@ -773,7 +774,7 @@ OPT package A handful of pair styles which are optimized for improved CPU performance on single or multiple cores. These include EAM, LJ, CHARMM, and Morse potentials. The styles have an "opt" suffix in -their style name. The :doc:`Speed opt ` doc page gives +their style name. The :doc:`OPT package ` doc page gives details of how to build and use this package. Its styles can be invoked at run time via the "-sf opt" or "-suffix opt" :doc:`command-line switches `. See also the :ref:`KOKKOS `, :ref:`USER-INTEL `, and :ref:`USER-OMP ` packages, which @@ -789,8 +790,8 @@ This package has :ref:`specific installation instructions ` on the :doc:`Bu **Supporting info:** * src/OPT: filenames -> commands -* :doc:`Speed packages ` -* :doc:`Speed opt ` +* :doc:`Accelerator packages ` +* :doc:`OPT package ` * :doc:`Section 2.6 -sf opt ` * Search the :doc:`pair style ` page for styles followed by (t) * `Benchmarks page `_ of web site @@ -1541,7 +1542,8 @@ USER-INTEL package Dozens of pair, fix, bond, angle, dihedral, improper, and kspace styles which are optimized for Intel CPUs and KNLs (Knights Landing). -All of them have an "intel" in their style name. The :doc:`Speed intel ` doc page gives details of what hardware and +All of them have an "intel" in their style name. The +:doc:`USER-INTEL package ` page gives details of what hardware and compilers are required on your system, and how to build and use this package. Its styles can be invoked at run time via the "-sf intel" or "-suffix intel" :doc:`command-line switches `. Also see @@ -1567,8 +1569,8 @@ This package has :ref:`specific installation instructions ` on the : * src/USER-INTEL: filenames -> commands * src/USER-INTEL/README -* :doc:`Speed packages ` -* :doc:`Speed intel ` +* :doc:`Accelerator packages ` +* :doc:`USER-INTEL package ` * :doc:`Section 2.6 -sf intel ` * :doc:`Section 2.6 -pk intel ` * :doc:`package intel ` @@ -1915,7 +1917,7 @@ USER-OMP package Hundreds of pair, fix, compute, bond, angle, dihedral, improper, and kspace styles which are altered to enable threading on many-core CPUs via OpenMP directives. All of them have an "omp" in their style name. -The :doc:`Speed omp ` doc page gives details of what hardware +The :doc:`USER-OMP package ` page gives details of what hardware and compilers are required on your system, and how to build and use this package. Its styles can be invoked at run time via the "-sf omp" or "-suffix omp" :doc:`command-line switches `. Also see @@ -1947,8 +1949,8 @@ This package has :ref:`specific installation instructions ` on the :do * src/USER-OMP: filenames -> commands * src/USER-OMP/README -* :doc:`Speed packages ` -* :doc:`Speed omp ` +* :doc:`Accelerator packages ` +* :doc:`USER-OMP package ` * :doc:`Section 2.6 -sf omp ` * :doc:`Section 2.6 -pk omp ` * :doc:`package omp ` diff --git a/doc/src/Packages_standard.rst b/doc/src/Packages_standard.rst index ca22515590..ab9be69ab3 100644 --- a/doc/src/Packages_standard.rst +++ b/doc/src/Packages_standard.rst @@ -37,7 +37,7 @@ package: +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`CORESHELL ` | adiabatic core/shell model | :doc:`Howto coreshell ` | coreshell | no | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ -| :ref:`DIPOLE ` | point dipole particles | :doc:`pair_style dipole/cut ` | dipole | no | +| :ref:`DIPOLE ` | point dipole particles | :doc:`pair_style lj/.../dipole ` | dipole | no | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ | :ref:`GPU ` | GPU-enabled styles | :doc:`Section gpu ` | `Benchmarks `_ | int | +----------------------------------+--------------------------------------+----------------------------------------------------+------------------------------------------------------+---------+ diff --git a/doc/src/Run_basics.rst b/doc/src/Run_basics.rst index d02873a8be..35d5f829a0 100644 --- a/doc/src/Run_basics.rst +++ b/doc/src/Run_basics.rst @@ -27,11 +27,11 @@ executable itself can be placed elsewhere. As LAMMPS runs it prints info to the screen and a logfile named *log.lammps*\ . More info about output is given on the -:doc:`Run output ` doc page. +:doc:`screen and logfile output ` page. If LAMMPS encounters errors in the input script or while running a simulation it will print an ERROR message and stop or a WARNING -message and continue. See the :doc:`Errors ` doc page for a +message and continue. See the :doc:`Common Problems ` page for a discussion of the various kinds of errors LAMMPS can or can't detect, a list of all ERROR and WARNING messages, and what to do about them. diff --git a/doc/src/Run_options.rst b/doc/src/Run_options.rst index 054ed66d57..f5435ec3a9 100644 --- a/doc/src/Run_options.rst +++ b/doc/src/Run_options.rst @@ -80,7 +80,7 @@ stdin. Explicitly enable or disable KOKKOS support, as provided by the KOKKOS package. Even if LAMMPS is built with this package, as described -in :doc:`Speed kokkos `, this switch must be set to enable +in the :doc:`the KOKKOS package page `, this switch must be set to enable running with KOKKOS-enabled styles the package provides. If the switch is not set (the default), LAMMPS will operate as if the KOKKOS package were not installed; i.e. you can run standard LAMMPS or with @@ -98,7 +98,8 @@ Either the full word or an abbreviation can be used for the keywords. Note that the keywords do not use a leading minus sign. I.e. the keyword is "t", not "-t". Also note that each of the keywords has a default setting. Examples of when to use these options and what -settings to use on different platforms is given on the :doc:`Speed kokkos ` doc page. +settings to use on different platforms is given on the :doc:`KOKKOS package ` +doc page. * d or device * g or gpus @@ -268,7 +269,7 @@ machine (e.g. your desktop), you can run on more (virtual) processors than you have physical processors. To run multiple independent simulations from one input script, using -multiple partitions, see the :doc:`Howto multiple ` doc +multiple partitions, see the :doc:`Howto multiple ` page. World- and universe-style :doc:`variables ` are useful in this context. @@ -326,7 +327,7 @@ cores within each node are ranked in a desired order. Or when using the :doc:`run_style verlet/split ` command with 2 partitions to insure that a specific Kspace processor (in the second partition) is matched up with a specific set of processors in the first partition. -See the :doc:`Speed tips ` doc page for more details. +See the :doc:`General tips ` page for more details. If the keyword *nth* is used with a setting *N*\ , then it means every Nth processor will be moved to the end of the ranking. This is useful @@ -385,7 +386,7 @@ implementations, either by environment variables that specify how to order physical processors, or by config files that specify what physical processors to assign to each MPI rank. The -reorder switch simply gives you a portable way to do this without relying on MPI -itself. See the :doc:`processors out ` command for how +itself. See the :doc:`processors file ` command for how to output info on the final assignment of physical processors to the LAMMPS simulation domain. @@ -523,10 +524,10 @@ lj/cut/intel, lj/cut/kk, lj/cut/omp, and lj/cut/opt. A variant style can be specified explicitly in your input script, e.g. pair_style lj/cut/gpu. If the -suffix switch is used the specified suffix (gpu,intel,kk,omp,opt) is automatically appended whenever your input -script command creates a new :doc:`atom `, -:doc:`pair `, :doc:`fix `, :doc:`compute `, or -:doc:`run ` style. If the variant version does not exist, -the standard version is created. +script command creates a new :doc:`atom style `, +:doc:`pair style `, :doc:`fix `, +:doc:`compute `, or :doc:`run style `. If the +variant version does not exist, the standard version is created. For the GPU package, using this command-line switch also invokes the default GPU settings, as if the command "package gpu 1" were used at @@ -579,8 +580,8 @@ index variable in the input script, since index variables cannot be re-defined. See the :doc:`variable ` command for more info on defining -index and other kinds of variables and the :doc:`Commands parse ` page for more info on using variables in -input scripts. +index and other kinds of variables and the :doc:`Parsing rules ` +page for more info on using variables in input scripts. .. note:: diff --git a/doc/src/Speed_bench.rst b/doc/src/Speed_bench.rst index 45b5b21d8a..66db03e360 100644 --- a/doc/src/Speed_bench.rst +++ b/doc/src/Speed_bench.rst @@ -38,7 +38,7 @@ of these 5 problems on 1 or 4 cores of Linux desktop. The bench/FERMI and bench/KEPLER directories have input files and scripts and instructions for running the same (or similar) problems using OpenMP or GPU or Xeon Phi acceleration options. See the README files in those directories and the -:doc:`Speed packages ` doc pages for instructions on how +:doc:`Accelerator packages ` pages for instructions on how to build LAMMPS and run on that kind of hardware. The bench/POTENTIALS directory has input files which correspond to the diff --git a/doc/src/Speed_kokkos.rst b/doc/src/Speed_kokkos.rst index 3269564d21..5df53ec2cd 100644 --- a/doc/src/Speed_kokkos.rst +++ b/doc/src/Speed_kokkos.rst @@ -9,7 +9,7 @@ different back end languages such as CUDA, OpenMP, or Pthreads. The Kokkos library also provides data abstractions to adjust (at compile time) the memory layout of data structures like 2d and 3d arrays to optimize performance on different hardware. For more information on -Kokkos, see `GitHub `_. +Kokkos, see `the Kokkos GitHub page `_. The LAMMPS KOKKOS package contains versions of pair, fix, and atom styles that use data structures and macros provided by the Kokkos @@ -20,20 +20,20 @@ including Sikandar Mashayak (UIUC), Ray Shan (Sandia), and Dan Ibanez (Sandia). For more information on developing using Kokkos abstractions see the Kokkos `Wiki `_. -Kokkos currently provides support for 3 modes of execution (per MPI +Kokkos currently provides support for 4 modes of execution (per MPI task). These are Serial (MPI-only for CPUs and Intel Phi), OpenMP -(threading for many-core CPUs and Intel Phi), and CUDA (for NVIDIA -GPUs). You choose the mode at build time to produce an executable -compatible with specific hardware. +(threading for many-core CPUs and Intel Phi), CUDA (for NVIDIA +GPUs) and HIP (for AMD GPUs). You choose the mode at build time to +produce an executable compatible with a specific hardware. -.. note:: +.. admonition:: NVIDIA CUDA support To build with Kokkos support for NVIDIA GPUs, the NVIDIA CUDA toolkit software version 9.0 or later must be installed on your system. See the discussion for the :doc:`GPU package ` for details of how to check and do this. -.. note:: +.. admonition:: CUDA and MPI library compatibility Kokkos with CUDA currently implicitly assumes that the MPI library is CUDA-aware. This is not always the case, especially when using @@ -45,6 +45,13 @@ compatible with specific hardware. LAMMPS command line or by using the command :doc:`package kokkos cuda/aware off ` in the input file. +.. admonition:: AMD GPU support + + To build with Kokkos the HIPCC compiler from the AMD ROCm software + version 3.5 or later is required. Supporting this Kokkos mode in + LAMMPS is still work in progress. Please contact the LAMMPS developers + if you run into problems. + Building LAMMPS with the KOKKOS package """"""""""""""""""""""""""""""""""""""" diff --git a/doc/src/Speed_measure.rst b/doc/src/Speed_measure.rst index 686fdb6adc..1daf49f4c4 100644 --- a/doc/src/Speed_measure.rst +++ b/doc/src/Speed_measure.rst @@ -14,7 +14,7 @@ timings; you can simply extrapolate from short runs. For the set of runs, look at the timing data printed to the screen and log file at the end of each LAMMPS run. The -:doc:`Run_output ` doc page gives an overview. +:doc:`screen and logfile output ` page gives an overview. Running on one (or a few processors) should give a good estimate of the serial performance and what portions of the timestep are taking diff --git a/doc/src/Speed_omp.rst b/doc/src/Speed_omp.rst index 3d3cb4daf1..f29e3743b4 100644 --- a/doc/src/Speed_omp.rst +++ b/doc/src/Speed_omp.rst @@ -86,7 +86,8 @@ USER-OMP style (in serial or parallel) with a single thread per MPI task, versus running standard LAMMPS with its standard un-accelerated styles (in serial or all-MPI parallelization with 1 task/core). This is because many of the USER-OMP styles contain similar optimizations -to those used in the OPT package, described in :doc:`Section 5.3.5 `. +to those used in the OPT package, described in +:doc:`the OPT package ` doc page. With multiple threads/task, the optimal choice of number of MPI tasks/node and OpenMP threads/task can vary a lot and should always be @@ -95,7 +96,8 @@ specific machine, paying attention to guidelines discussed in the next sub-section. A description of the multi-threading strategy used in the USER-OMP -package and some performance examples are `presented here `_ +package and some performance examples are +`presented here `_. Guidelines for best performance """"""""""""""""""""""""""""""" diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index 8feb2afefa..3600d6c661 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -89,7 +89,6 @@ Miscellaneous tools :columns: 6 * :ref:`CMake ` - * :ref:`doxygen ` * :ref:`emacs ` * :ref:`i-pi ` * :ref:`kate ` @@ -254,21 +253,6 @@ The tool is authored by Xiaowang Zhou (Sandia), xzhou at sandia.gov. ---------- -.. _doxygen: - -doxygen tool --------------------------- - -The tools/doxygen directory contains a shell script called -doxygen.sh which can generate a call graph and API lists using -the `Doxygen software `_. - -See the included README file for details. - -The tool is authored by Nandor Tamaskovics, numericalfreedom at googlemail.com. - ----------- - .. _drude: drude tool diff --git a/doc/src/_ext/tab_or_note.py b/doc/src/_ext/tab_or_note.py new file mode 100644 index 0000000000..40a27deca5 --- /dev/null +++ b/doc/src/_ext/tab_or_note.py @@ -0,0 +1,15 @@ + +def replace_tabs_handler(app, docname, source): + """ When builder is not 'html', remove 'tabs' directive + and replace any 'tab' directive with 'admonition'""" + if app.builder.name != 'html': + for i in range(len(source)): + source[i] = source[i].replace('.. tabs::','').replace('.. tab::','.. admonition::') + +def setup(app): + app.connect('source-read', replace_tabs_handler) + return { + 'version': '0.1', + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } diff --git a/doc/src/angle_charmm.rst b/doc/src/angle_charmm.rst index 8410f0f8c0..e557648d9f 100644 --- a/doc/src/angle_charmm.rst +++ b/doc/src/angle_charmm.rst @@ -1,16 +1,12 @@ .. index:: angle_style charmm +.. index:: angle_style charmm/intel +.. index:: angle_style charmm/kk +.. index:: angle_style charmm/omp angle_style charmm command ========================== -angle_style charmm/intel command -================================ - -angle_style charmm/kk command -============================= - -angle_style charmm/omp command -============================== +Accelerator Variants: *charmm/intel*, *charmm/kk*, *charmm/omp* Syntax """""" diff --git a/doc/src/angle_class2.rst b/doc/src/angle_class2.rst index 7d2fdd5d66..bf0305055a 100644 --- a/doc/src/angle_class2.rst +++ b/doc/src/angle_class2.rst @@ -1,13 +1,12 @@ .. index:: angle_style class2 +.. index:: angle_style class2/kk +.. index:: angle_style class2/omp +.. index:: angle_style class2/p6 angle_style class2 command ========================== -angle_style class2/kk command -============================= - -angle_style class2/omp command -============================== +Accelerator Variants: *class2/kk*, *class2/omp* angle_style class2/p6 command ============================= diff --git a/doc/src/angle_cosine.rst b/doc/src/angle_cosine.rst index e39e68b2e1..aea144f7be 100644 --- a/doc/src/angle_cosine.rst +++ b/doc/src/angle_cosine.rst @@ -1,13 +1,11 @@ .. index:: angle_style cosine +.. index:: angle_style cosine/omp +.. index:: angle_style cosine/kk angle_style cosine command ========================== -angle_style cosine/omp command -============================== - -angle_style cosine/kk command -============================= +Accelerator Variants: *cosine/omp*, *cosine/kk* Syntax """""" diff --git a/doc/src/angle_cosine_delta.rst b/doc/src/angle_cosine_delta.rst index 017b64f8b0..280e6ea2c4 100644 --- a/doc/src/angle_cosine_delta.rst +++ b/doc/src/angle_cosine_delta.rst @@ -1,10 +1,10 @@ .. index:: angle_style cosine/delta +.. index:: angle_style cosine/delta/omp angle_style cosine/delta command ================================ -angle_style cosine/delta/omp command -==================================== +Accelerator Variants: *cosine/delta/omp* Syntax """""" diff --git a/doc/src/angle_cosine_periodic.rst b/doc/src/angle_cosine_periodic.rst index aff4ba2322..71c2caa3f0 100644 --- a/doc/src/angle_cosine_periodic.rst +++ b/doc/src/angle_cosine_periodic.rst @@ -1,10 +1,10 @@ .. index:: angle_style cosine/periodic +.. index:: angle_style cosine/periodic/omp angle_style cosine/periodic command =================================== -angle_style cosine/periodic/omp command -======================================= +Accelerator Variants: *cosine/periodic/omp* Syntax """""" diff --git a/doc/src/angle_cosine_shift.rst b/doc/src/angle_cosine_shift.rst index 26603e48be..71bda194c7 100644 --- a/doc/src/angle_cosine_shift.rst +++ b/doc/src/angle_cosine_shift.rst @@ -1,10 +1,10 @@ .. index:: angle_style cosine/shift +.. index:: angle_style cosine/shift/omp angle_style cosine/shift command -================================= +================================ -angle_style cosine/shift/omp command -==================================== +Accelerator Variants: *cosine/shift/omp* Syntax """""" diff --git a/doc/src/angle_cosine_shift_exp.rst b/doc/src/angle_cosine_shift_exp.rst index fbdb76aa45..4ae4928751 100644 --- a/doc/src/angle_cosine_shift_exp.rst +++ b/doc/src/angle_cosine_shift_exp.rst @@ -1,10 +1,10 @@ .. index:: angle_style cosine/shift/exp +.. index:: angle_style cosine/shift/exp/omp angle_style cosine/shift/exp command ==================================== -angle_style cosine/shift/exp/omp command -======================================== +Accelerator Variants: *cosine/shift/exp/omp* Syntax """""" diff --git a/doc/src/angle_cosine_squared.rst b/doc/src/angle_cosine_squared.rst index 49ddf59741..4a6a1debe9 100644 --- a/doc/src/angle_cosine_squared.rst +++ b/doc/src/angle_cosine_squared.rst @@ -1,10 +1,10 @@ .. index:: angle_style cosine/squared +.. index:: angle_style cosine/squared/omp angle_style cosine/squared command ================================== -angle_style cosine/squared/omp command -====================================== +Accelerator Variants: *cosine/squared/omp* Syntax """""" diff --git a/doc/src/angle_cross.rst b/doc/src/angle_cross.rst index 5769e756c3..3cd1884be0 100644 --- a/doc/src/angle_cross.rst +++ b/doc/src/angle_cross.rst @@ -1,7 +1,7 @@ .. index:: angle_style cross angle_style cross command -========================== +========================= Syntax """""" diff --git a/doc/src/angle_dipole.rst b/doc/src/angle_dipole.rst index 3b4e4f5304..4dd8aadfb8 100644 --- a/doc/src/angle_dipole.rst +++ b/doc/src/angle_dipole.rst @@ -1,10 +1,10 @@ .. index:: angle_style dipole +.. index:: angle_style dipole/omp angle_style dipole command ========================== -angle_style dipole/omp command -============================== +Accelerator Variants: *dipole/omp* Syntax """""" diff --git a/doc/src/angle_fourier.rst b/doc/src/angle_fourier.rst index cbe6544271..231f45e808 100644 --- a/doc/src/angle_fourier.rst +++ b/doc/src/angle_fourier.rst @@ -1,10 +1,10 @@ .. index:: angle_style fourier +.. index:: angle_style fourier/omp angle_style fourier command =========================== -angle_style fourier/omp command -=============================== +Accelerator Variants: *fourier/omp* Syntax """""" diff --git a/doc/src/angle_fourier_simple.rst b/doc/src/angle_fourier_simple.rst index b36f69cbec..14b4bbcfe9 100644 --- a/doc/src/angle_fourier_simple.rst +++ b/doc/src/angle_fourier_simple.rst @@ -1,10 +1,10 @@ .. index:: angle_style fourier/simple +.. index:: angle_style fourier/simple/omp angle_style fourier/simple command ================================== -angle_style fourier/simple/omp command -====================================== +Accelerator Variants: *fourier/simple/omp* Syntax """""" diff --git a/doc/src/angle_harmonic.rst b/doc/src/angle_harmonic.rst index c6ad93c3ec..06cf1d460b 100644 --- a/doc/src/angle_harmonic.rst +++ b/doc/src/angle_harmonic.rst @@ -1,16 +1,12 @@ .. index:: angle_style harmonic +.. index:: angle_style harmonic/intel +.. index:: angle_style harmonic/kk +.. index:: angle_style harmonic/omp angle_style harmonic command ============================ -angle_style harmonic/intel command -================================== - -angle_style harmonic/kk command -=============================== - -angle_style harmonic/omp command -================================ +Accelerator Variants: *harmonic/intel*, *harmonic/kk*, *harmonic/omp* Syntax """""" diff --git a/doc/src/angle_quartic.rst b/doc/src/angle_quartic.rst index 71297e60a0..7dfb4b2896 100644 --- a/doc/src/angle_quartic.rst +++ b/doc/src/angle_quartic.rst @@ -1,10 +1,10 @@ .. index:: angle_style quartic +.. index:: angle_style quartic/omp angle_style quartic command =========================== -angle_style quartic/omp command -=============================== +Accelerator Variants: *quartic/omp* Syntax """""" diff --git a/doc/src/angle_sdk.rst b/doc/src/angle_sdk.rst index f5583d5013..340a3e4de7 100644 --- a/doc/src/angle_sdk.rst +++ b/doc/src/angle_sdk.rst @@ -1,10 +1,10 @@ .. index:: angle_style sdk +.. index:: angle_style sdk/omp angle_style sdk command ======================= -angle_style sdk/omp command -=========================== +Accelerator Variants: *sdk/omp* Syntax """""" diff --git a/doc/src/angle_table.rst b/doc/src/angle_table.rst index d8d9476620..cad9f5a82f 100644 --- a/doc/src/angle_table.rst +++ b/doc/src/angle_table.rst @@ -1,10 +1,10 @@ .. index:: angle_style table +.. index:: angle_style table/omp angle_style table command ========================= -angle_style table/omp command -============================= +Accelerator Variants: *table/omp* Syntax """""" diff --git a/doc/src/bond_class2.rst b/doc/src/bond_class2.rst index 41eb2b4e50..aea503738f 100644 --- a/doc/src/bond_class2.rst +++ b/doc/src/bond_class2.rst @@ -1,13 +1,11 @@ .. index:: bond_style class2 +.. index:: bond_style class2/omp +.. index:: bond_style class2/kk bond_style class2 command ========================= -bond_style class2/omp command -============================= - -bond_style class2/kk command -============================ +Accelerator Variants: *class2/omp*, *class2/kk* Syntax """""" diff --git a/doc/src/bond_fene.rst b/doc/src/bond_fene.rst index 8ec117bf24..0c6a37ca62 100644 --- a/doc/src/bond_fene.rst +++ b/doc/src/bond_fene.rst @@ -1,16 +1,12 @@ .. index:: bond_style fene +.. index:: bond_style fene/intel +.. index:: bond_style fene/kk +.. index:: bond_style fene/omp bond_style fene command ======================= -bond_style fene/intel command -============================= - -bond_style fene/kk command -========================== - -bond_style fene/omp command -=========================== +Accelerator Variants: *fene/intel*, *fene/kk*, *fene/omp* Syntax """""" diff --git a/doc/src/bond_fene_expand.rst b/doc/src/bond_fene_expand.rst index 5bcb409238..1be06561e9 100644 --- a/doc/src/bond_fene_expand.rst +++ b/doc/src/bond_fene_expand.rst @@ -1,10 +1,10 @@ .. index:: bond_style fene/expand +.. index:: bond_style fene/expand/omp bond_style fene/expand command ============================== -bond_style fene/expand/omp command -================================== +Accelerator Variants: *fene/expand/omp* Syntax """""" diff --git a/doc/src/bond_gromos.rst b/doc/src/bond_gromos.rst index f09e5761fe..d4eb958ebe 100644 --- a/doc/src/bond_gromos.rst +++ b/doc/src/bond_gromos.rst @@ -1,10 +1,10 @@ .. index:: bond_style gromos +.. index:: bond_style gromos/omp bond_style gromos command ========================= -bond_style gromos/omp command -============================= +Accelerator Variants: *gromos/omp* Syntax """""" diff --git a/doc/src/bond_harmonic.rst b/doc/src/bond_harmonic.rst index eaa1ee7986..e3320f2e19 100644 --- a/doc/src/bond_harmonic.rst +++ b/doc/src/bond_harmonic.rst @@ -1,16 +1,12 @@ .. index:: bond_style harmonic +.. index:: bond_style harmonic/intel +.. index:: bond_style harmonic/kk +.. index:: bond_style harmonic/omp bond_style harmonic command =========================== -bond_style harmonic/intel command -================================= - -bond_style harmonic/kk command -============================== - -bond_style harmonic/omp command -=============================== +Accelerator Variants: *harmonic/intel*, *harmonic/kk*, *harmonic/omp* Syntax """""" diff --git a/doc/src/bond_harmonic_shift.rst b/doc/src/bond_harmonic_shift.rst index c124bacf0f..469c370969 100644 --- a/doc/src/bond_harmonic_shift.rst +++ b/doc/src/bond_harmonic_shift.rst @@ -1,10 +1,10 @@ .. index:: bond_style harmonic/shift +.. index:: bond_style harmonic/shift/omp bond_style harmonic/shift command ================================= -bond_style harmonic/shift/omp command -===================================== +Accelerator Variants: *harmonic/shift/omp* Syntax """""" diff --git a/doc/src/bond_harmonic_shift_cut.rst b/doc/src/bond_harmonic_shift_cut.rst index e1b7e990d4..d0f44740b3 100644 --- a/doc/src/bond_harmonic_shift_cut.rst +++ b/doc/src/bond_harmonic_shift_cut.rst @@ -1,10 +1,10 @@ .. index:: bond_style harmonic/shift/cut +.. index:: bond_style harmonic/shift/cut/omp bond_style harmonic/shift/cut command ===================================== -bond_style harmonic/shift/cut/omp command -========================================= +Accelerator Variants: *harmonic/shift/cut/omp* Syntax """""" diff --git a/doc/src/bond_morse.rst b/doc/src/bond_morse.rst index 64fc61298a..f096624ba0 100644 --- a/doc/src/bond_morse.rst +++ b/doc/src/bond_morse.rst @@ -1,10 +1,10 @@ .. index:: bond_style morse +.. index:: bond_style morse/omp bond_style morse command ======================== -bond_style morse/omp command -============================ +Accelerator Variants: *morse/omp* Syntax """""" diff --git a/doc/src/bond_nonlinear.rst b/doc/src/bond_nonlinear.rst index 75ab4ad347..77271502ea 100644 --- a/doc/src/bond_nonlinear.rst +++ b/doc/src/bond_nonlinear.rst @@ -1,10 +1,10 @@ .. index:: bond_style nonlinear +.. index:: bond_style nonlinear/omp bond_style nonlinear command ============================ -bond_style nonlinear/omp command -================================ +Accelerator Variants: *nonlinear/omp* Syntax """""" diff --git a/doc/src/bond_oxdna.rst b/doc/src/bond_oxdna.rst index ada2f0e1ed..3f52424d49 100644 --- a/doc/src/bond_oxdna.rst +++ b/doc/src/bond_oxdna.rst @@ -1,4 +1,6 @@ .. index:: bond_style oxdna/fene +.. index:: bond_style oxdna2/fene +.. index:: bond_style oxrna2/fene bond_style oxdna/fene command ============================= diff --git a/doc/src/bond_quartic.rst b/doc/src/bond_quartic.rst index d54c19bbd4..8c5b363e54 100644 --- a/doc/src/bond_quartic.rst +++ b/doc/src/bond_quartic.rst @@ -1,10 +1,10 @@ .. index:: bond_style quartic +.. index:: bond_style quartic/omp bond_style quartic command ========================== -bond_style quartic/omp command -============================== +Accelerator Variants: *quartic/omp* Syntax """""" diff --git a/doc/src/bond_special.rst b/doc/src/bond_special.rst index bd93bb644c..d2423c9e23 100644 --- a/doc/src/bond_special.rst +++ b/doc/src/bond_special.rst @@ -1,7 +1,7 @@ .. index:: bond_style special bond_style special command -================================= +========================== Syntax """""" diff --git a/doc/src/bond_table.rst b/doc/src/bond_table.rst index 9f8ebacef0..fedb50355d 100644 --- a/doc/src/bond_table.rst +++ b/doc/src/bond_table.rst @@ -1,10 +1,10 @@ .. index:: bond_style table +.. index:: bond_style table/omp bond_style table command ======================== -bond_style table/omp command -============================ +Accelerator Variants: *table/omp* Syntax """""" diff --git a/doc/src/compute_cluster_atom.rst b/doc/src/compute_cluster_atom.rst index 77149306dc..ab47aed9b3 100644 --- a/doc/src/compute_cluster_atom.rst +++ b/doc/src/compute_cluster_atom.rst @@ -1,4 +1,6 @@ .. index:: compute cluster/atom +.. index:: compute fragment/atom +.. index:: compute aggregate/atom compute cluster/atom command ============================ diff --git a/doc/src/compute_coord_atom.rst b/doc/src/compute_coord_atom.rst index cbf879b8bd..f3c6f818af 100644 --- a/doc/src/compute_coord_atom.rst +++ b/doc/src/compute_coord_atom.rst @@ -1,10 +1,10 @@ .. index:: compute coord/atom +.. index:: compute coord/atom/kk compute coord/atom command ========================== -compute coord/atom/kk command -=================================== +Accelerator Variants: *coord/atom/kk* Syntax """""" diff --git a/doc/src/compute_mesont.rst b/doc/src/compute_mesont.rst index bf0ade16c1..44d6054e22 100644 --- a/doc/src/compute_mesont.rst +++ b/doc/src/compute_mesont.rst @@ -1,7 +1,7 @@ .. index:: compute mesont compute mesont command -========================== +====================== Syntax """""" diff --git a/doc/src/compute_orientorder_atom.rst b/doc/src/compute_orientorder_atom.rst index c8ab4d7b9b..2a36fb4cc0 100644 --- a/doc/src/compute_orientorder_atom.rst +++ b/doc/src/compute_orientorder_atom.rst @@ -1,10 +1,10 @@ .. index:: compute orientorder/atom +.. index:: compute orientorder/atom/kk compute orientorder/atom command ================================ -compute orientorder/atom/kk command -=================================== +Accelerator Variants: *orientorder/atom/kk* Syntax """""" diff --git a/doc/src/compute_reduce.rst b/doc/src/compute_reduce.rst index bf7d0dc28c..c7815305c0 100644 --- a/doc/src/compute_reduce.rst +++ b/doc/src/compute_reduce.rst @@ -1,4 +1,5 @@ .. index:: compute reduce +.. index:: compute reduce/region compute reduce command ====================== diff --git a/doc/src/compute_smd_ulsph_effm.rst b/doc/src/compute_smd_ulsph_effm.rst index e6d6b772a0..ff12f9cdac 100644 --- a/doc/src/compute_smd_ulsph_effm.rst +++ b/doc/src/compute_smd_ulsph_effm.rst @@ -1,7 +1,7 @@ .. index:: compute smd/ulsph/effm compute smd/ulsph/effm command -================================ +============================== Syntax """""" diff --git a/doc/src/compute_sna_atom.rst b/doc/src/compute_sna_atom.rst index 7e74a1bd61..08b06a32ec 100644 --- a/doc/src/compute_sna_atom.rst +++ b/doc/src/compute_sna_atom.rst @@ -1,4 +1,7 @@ .. index:: compute sna/atom +.. index:: compute snad/atom +.. index:: compute snav/atom +.. index:: compute snap compute sna/atom command ======================== diff --git a/doc/src/compute_sph_e_atom.rst b/doc/src/compute_sph_e_atom.rst index 08378c7c99..17591257f2 100644 --- a/doc/src/compute_sph_e_atom.rst +++ b/doc/src/compute_sph_e_atom.rst @@ -1,7 +1,7 @@ .. index:: compute sph/e/atom compute sph/e/atom command -=========================== +========================== Syntax """""" diff --git a/doc/src/compute_sph_rho_atom.rst b/doc/src/compute_sph_rho_atom.rst index 975ebf996d..c422a5ecbb 100644 --- a/doc/src/compute_sph_rho_atom.rst +++ b/doc/src/compute_sph_rho_atom.rst @@ -1,7 +1,7 @@ .. index:: compute sph/rho/atom compute sph/rho/atom command -============================= +============================ Syntax """""" diff --git a/doc/src/compute_sph_t_atom.rst b/doc/src/compute_sph_t_atom.rst index 2f8ad12f45..922adfff58 100644 --- a/doc/src/compute_sph_t_atom.rst +++ b/doc/src/compute_sph_t_atom.rst @@ -1,7 +1,7 @@ .. index:: compute sph/t/atom compute sph/t/atom command -=========================== +========================== Syntax """""" diff --git a/doc/src/compute_stress_atom.rst b/doc/src/compute_stress_atom.rst index 2bdab03bda..16afd49548 100644 --- a/doc/src/compute_stress_atom.rst +++ b/doc/src/compute_stress_atom.rst @@ -1,4 +1,5 @@ .. index:: compute stress/atom +.. index:: compute centroid/stress/atom compute stress/atom command =========================== diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index 4d0d21cb87..f164a33c26 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -1,4 +1,5 @@ .. index:: compute stress/mop +.. index:: compute stress/mop/profile compute stress/mop command ========================== diff --git a/doc/src/compute_tally.rst b/doc/src/compute_tally.rst index 281425763a..6487618516 100644 --- a/doc/src/compute_tally.rst +++ b/doc/src/compute_tally.rst @@ -1,4 +1,8 @@ .. index:: compute force/tally +.. index:: compute heat/flux/tally +.. index:: compute pe/tally +.. index:: compute pe/mol/tally +.. index:: compute stress/tally compute force/tally command =========================== diff --git a/doc/src/compute_temp.rst b/doc/src/compute_temp.rst index ac11aa155c..a82046367e 100644 --- a/doc/src/compute_temp.rst +++ b/doc/src/compute_temp.rst @@ -1,10 +1,10 @@ .. index:: compute temp +.. index:: compute temp/kk compute temp command ==================== -compute temp/kk command -======================= +Accelerator Variants: *temp/kk* Syntax """""" diff --git a/doc/src/dihedral_charmm.rst b/doc/src/dihedral_charmm.rst index bbaaaf2dd4..9588cf8272 100644 --- a/doc/src/dihedral_charmm.rst +++ b/doc/src/dihedral_charmm.rst @@ -1,16 +1,13 @@ .. index:: dihedral_style charmm +.. index:: dihedral_style charmm/intel +.. index:: dihedral_style charmm/kk +.. index:: dihedral_style charmm/omp +.. index:: dihedral_style charmmfsw dihedral_style charmm command ============================= -dihedral_style charmm/intel command -=================================== - -dihedral_style charmm/kk command -================================ - -dihedral_style charmm/omp command -================================= +Accelerator Variants: *charmm/intel*, *charmm/kk*, *charmm/omp* dihedral_style charmmfsw command ================================ diff --git a/doc/src/dihedral_class2.rst b/doc/src/dihedral_class2.rst index 907102a4f6..a98cf6b041 100644 --- a/doc/src/dihedral_class2.rst +++ b/doc/src/dihedral_class2.rst @@ -1,13 +1,11 @@ .. index:: dihedral_style class2 +.. index:: dihedral_style class2/omp +.. index:: dihedral_style class2/kk dihedral_style class2 command ============================= -dihedral_style class2/omp command -================================= - -dihedral_style class2/kk command -================================ +Accelerator Variants: *class2/omp*, *class2/kk* Syntax """""" diff --git a/doc/src/dihedral_cosine_shift_exp.rst b/doc/src/dihedral_cosine_shift_exp.rst index 9648bc5387..1f0195df83 100644 --- a/doc/src/dihedral_cosine_shift_exp.rst +++ b/doc/src/dihedral_cosine_shift_exp.rst @@ -1,10 +1,10 @@ .. index:: dihedral_style cosine/shift/exp +.. index:: dihedral_style cosine/shift/exp/omp dihedral_style cosine/shift/exp command ======================================= -dihedral_style cosine/shift/exp/omp command -=========================================== +Accelerator Variants: *cosine/shift/exp/omp* Syntax """""" diff --git a/doc/src/dihedral_fourier.rst b/doc/src/dihedral_fourier.rst index d795488107..f55011c902 100644 --- a/doc/src/dihedral_fourier.rst +++ b/doc/src/dihedral_fourier.rst @@ -1,13 +1,11 @@ .. index:: dihedral_style fourier +.. index:: dihedral_style fourier/intel +.. index:: dihedral_style fourier/omp dihedral_style fourier command ============================== -dihedral_style fourier/intel command -==================================== - -dihedral_style fourier/omp command -================================== +Accelerator Variants: *fourier/intel*, *fourier/omp* Syntax """""" diff --git a/doc/src/dihedral_harmonic.rst b/doc/src/dihedral_harmonic.rst index f6e9794d3e..0ee6339ea0 100644 --- a/doc/src/dihedral_harmonic.rst +++ b/doc/src/dihedral_harmonic.rst @@ -1,16 +1,12 @@ .. index:: dihedral_style harmonic +.. index:: dihedral_style harmonic/intel +.. index:: dihedral_style harmonic/kk +.. index:: dihedral_style harmonic/omp dihedral_style harmonic command =============================== -dihedral_style harmonic/intel command -===================================== - -dihedral_style harmonic/kk command -================================== - -dihedral_style harmonic/omp command -=================================== +Accelerator Variants: *harmonic/intel*, *harmonic/kk*, *harmonic/omp* Syntax """""" diff --git a/doc/src/dihedral_helix.rst b/doc/src/dihedral_helix.rst index 58738dd7a7..89258cff35 100644 --- a/doc/src/dihedral_helix.rst +++ b/doc/src/dihedral_helix.rst @@ -1,10 +1,10 @@ .. index:: dihedral_style helix +.. index:: dihedral_style helix/omp dihedral_style helix command ============================ -dihedral_style helix/omp command -================================ +Accelerator Variants: *helix/omp* Syntax """""" diff --git a/doc/src/dihedral_multi_harmonic.rst b/doc/src/dihedral_multi_harmonic.rst index c13d45863f..176d3815dc 100644 --- a/doc/src/dihedral_multi_harmonic.rst +++ b/doc/src/dihedral_multi_harmonic.rst @@ -1,10 +1,10 @@ .. index:: dihedral_style multi/harmonic +.. index:: dihedral_style multi/harmonic/omp dihedral_style multi/harmonic command ===================================== -dihedral_style multi/harmonic/omp command -========================================= +Accelerator Variants: *multi/harmonic/omp* Syntax """""" diff --git a/doc/src/dihedral_nharmonic.rst b/doc/src/dihedral_nharmonic.rst index e2223382e2..2411903126 100644 --- a/doc/src/dihedral_nharmonic.rst +++ b/doc/src/dihedral_nharmonic.rst @@ -1,10 +1,10 @@ .. index:: dihedral_style nharmonic +.. index:: dihedral_style nharmonic/omp dihedral_style nharmonic command -================================= +================================ -dihedral_style nharmonic/omp command -===================================== +Accelerator Variants: *nharmonic/omp* Syntax """""" diff --git a/doc/src/dihedral_opls.rst b/doc/src/dihedral_opls.rst index a2be0b5b2d..36b1897fce 100644 --- a/doc/src/dihedral_opls.rst +++ b/doc/src/dihedral_opls.rst @@ -1,16 +1,12 @@ .. index:: dihedral_style opls +.. index:: dihedral_style opls/intel +.. index:: dihedral_style opls/kk +.. index:: dihedral_style opls/omp dihedral_style opls command =========================== -dihedral_style opls/intel command -================================= - -dihedral_style opls/kk command -============================== - -dihedral_style opls/omp command -=============================== +Accelerator Variants: *opls/intel*, *opls/kk*, *opls/omp* Syntax """""" diff --git a/doc/src/dihedral_quadratic.rst b/doc/src/dihedral_quadratic.rst index 9c4a707562..dbe680fc82 100644 --- a/doc/src/dihedral_quadratic.rst +++ b/doc/src/dihedral_quadratic.rst @@ -1,10 +1,10 @@ .. index:: dihedral_style quadratic +.. index:: dihedral_style quadratic/omp dihedral_style quadratic command ================================ -dihedral_style quadratic/omp command -==================================== +Accelerator Variants: *quadratic/omp* Syntax """""" diff --git a/doc/src/dihedral_table.rst b/doc/src/dihedral_table.rst index 9ed7249572..ff3e61baee 100644 --- a/doc/src/dihedral_table.rst +++ b/doc/src/dihedral_table.rst @@ -1,10 +1,10 @@ .. index:: dihedral_style table +.. index:: dihedral_style table/omp dihedral_style table command ============================ -dihedral_style table/omp command -================================ +Accelerator Variants: *table/omp* Syntax """""" diff --git a/doc/src/dihedral_zero.rst b/doc/src/dihedral_zero.rst index 3df68edfd5..0f481f917d 100644 --- a/doc/src/dihedral_zero.rst +++ b/doc/src/dihedral_zero.rst @@ -1,7 +1,7 @@ .. index:: dihedral_style zero dihedral_style zero command -============================ +=========================== Syntax """""" diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 36a20defb6..3f6a8812c3 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -46,17 +46,19 @@ Syntax *atom* args = none *atom/gz* args = none + *atom/zstd* args = none *atom/mpiio* args = none *atom/adios* args = none, discussed on :doc:`dump atom/adios ` doc page *cfg* args = same as *custom* args, see below *cfg/gz* args = same as *custom* args, see below + *cfg/zstd* args = same as *custom* args, see below *cfg/mpiio* args = same as *custom* args, see below - *custom*\ , *custom/gz*\ , *custom/mpiio* args = see below + *custom*\ , *custom/gz*\ , *custom/zstd* , *custom/mpiio* args = see below *custom/adios* args = same as *custom* args, discussed on :doc:`dump custom/adios ` doc page *dcd* args = none *h5md* args = discussed on :doc:`dump h5md ` doc page *image* args = discussed on :doc:`dump image ` doc page - *local* args = see below + *local*, *local/gz*, *local/zstd* args = see below *molfile* args = discussed on :doc:`dump molfile ` doc page *movie* args = discussed on :doc:`dump image ` doc page *netcdf* args = discussed on :doc:`dump netcdf ` doc page @@ -65,9 +67,10 @@ Syntax *xtc* args = none *xyz* args = none *xyz/gz* args = none + *xyz/zstd* args = none *xyz/mpiio* args = none -* *custom* or *custom/gz* or *custom/mpiio* or *netcdf* or *netcdf/mpiio* args = list of atom attributes +* *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *netcdf* or *netcdf/mpiio* args = list of atom attributes .. parsed-literal:: @@ -111,7 +114,7 @@ Syntax d_name = per-atom floating point vector with name, managed by fix property/atom i_name = per-atom integer vector with name, managed by fix property/atom -* *local* args = list of local attributes +* *local* or *local/gz* or *local/zstd* args = list of local attributes .. parsed-literal:: @@ -130,6 +133,7 @@ Examples dump myDump all atom 100 dump.atom dump myDump all atom/mpiio 100 dump.atom.mpiio dump myDump all atom/gz 100 dump.atom.gz + dump myDump all atom/zstd 100 dump.atom.zst dump 2 subgroup atom 50 dump.run.bin dump 2 subgroup atom 50 dump.run.mpiio.bin dump 4a all custom 100 dump.myforce.* id type x y vx fx @@ -187,7 +191,7 @@ default. For the *dcd*\ , *xtc*\ , *xyz*\ , and *molfile* styles, sorting by atom ID is on by default. See the :doc:`dump_modify ` doc page for details. -The *atom/gz*\ , *cfg/gz*\ , *custom/gz*\ , and *xyz/gz* styles are identical +The *atom/gz*\ , *cfg/gz*\ , *custom/gz*\ , *local/gz*, and *xyz/gz* styles are identical in command syntax to the corresponding styles without "gz", however, they generate compressed files using the zlib library. Thus the filename suffix ".gz" is mandatory. This is an alternative approach to writing @@ -198,6 +202,11 @@ For the remainder of this doc page, you should thus consider the *atom* and *atom/gz* styles (etc) to be inter-changeable, with the exception of the required filename suffix. +Similarly, the *atom/zstd*\ , *cfg/zstd*\ , *custom/zstd*\ , *local/zstd*, +and *xyz/zstd* styles are identical to the gz styles, but use the Zstd +compression library instead. See the :doc:`dump_modify ` doc +page for details on how to control the compression level in both variants. + As explained below, the *atom/mpiio*\ , *cfg/mpiio*\ , *custom/mpiio*\ , and *xyz/mpiio* styles are identical in command syntax and in the format of the dump files they create, to the corresponding styles without diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index 6c7d4eb0f5..753cce703c 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -114,6 +114,21 @@ Syntax *framerate* arg = fps fps = frames per second for movie +* these keywords apply only to the */gz* and */zstd* dump styles +* keyword = *compression_level* + + .. parsed-literal:: + + *compression_level* args = level + level = integer specifying the compression level that should be used (see below for supported levels) + +* these keywords apply only to the */zstd* dump styles +* keyword = *compression_level* + + .. parsed-literal:: + + *checksum* args = *yes* or *no* (add checksum at end of zst file) + Examples """""""" @@ -962,6 +977,28 @@ images less frequently. ---------- +The COMPRESS package offers both GZ and Zstd compression variants of styles +atom, custom, local, cfg, and xyz. When using these styles the compression +level can be controlled by the :code:`compression_level` parameter. File names +with these styles have to end in either :code:`.gz` or :code:`.zst`. + +GZ supports compression levels from -1 (default), 0 (no compression), and 1 to +9. 9 being the best compression. The COMPRESS :code:`/gz` styles use 9 as +default compression level. + +Zstd offers a wider range of compression levels, including negative +levels that sacrifice compression for performance. 0 is the +default, positive levels are 1 to 22, with 22 being the most expensive +compression. Zstd promises higher compression/decompression speeds for +similar compression ratios. For more details see +`http://facebook.github.io/zstd/`. + +In addition, Zstd compressed files can have a checksum of the entire +contents. The Zstd enabled dump styles enable this feature by default and it +can be disabled with the :code:`checksum` parameter. + +---------- + Restrictions """""""""""" none @@ -1010,6 +1047,10 @@ The option defaults are * color = 140 color names are pre-defined as listed below * framerate = 24 +* compression_level = 9 (gz variants) +* compression_level = 0 (zstd variants) +* checksum = yes (zstd variants) + ---------- These are the standard 109 element names that LAMMPS pre-defines for diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 95ec059b6c..4d026f462f 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -293,6 +293,7 @@ accelerated styles exist. * :doc:`orient/bcc ` - add grain boundary migration force for BCC * :doc:`orient/fcc ` - add grain boundary migration force for FCC * :doc:`orient/eco ` - add generalized grain boundary migration force +* :doc:`pafi ` - constrained force averages on hyper-planes to compute free energies (PAFI) * :doc:`phonon ` - calculate dynamical matrix from MD simulations * :doc:`pimd ` - Feynman path integral molecular dynamics * :doc:`planeforce ` - constrain atoms to move in a plane diff --git a/doc/src/fix_ave_histo.rst b/doc/src/fix_ave_histo.rst index 7c4ef88fd6..d50112ac48 100644 --- a/doc/src/fix_ave_histo.rst +++ b/doc/src/fix_ave_histo.rst @@ -1,4 +1,5 @@ .. index:: fix ave/histo +.. index:: fix ave/histo/weight fix ave/histo command ===================== diff --git a/doc/src/fix_bond_create.rst b/doc/src/fix_bond_create.rst index d0c7fb985c..34f0d19f8d 100644 --- a/doc/src/fix_bond_create.rst +++ b/doc/src/fix_bond_create.rst @@ -1,4 +1,5 @@ .. index:: fix bond/create +.. index:: fix bond/create/angle fix bond/create command ======================= diff --git a/doc/src/fix_bond_react.rst b/doc/src/fix_bond_react.rst index 2bbe53328a..8d54ce755b 100644 --- a/doc/src/fix_bond_react.rst +++ b/doc/src/fix_bond_react.rst @@ -311,8 +311,8 @@ either 'none' or 'charges.' Further details are provided in the discussion of the 'update_edges' keyword. The fifth optional section begins with the keyword 'Constraints' and lists additional criteria that must be satisfied in order for the reaction to occur. Currently, -there are four types of constraints available, as discussed below: -'distance', 'angle', 'dihedral', and 'arrhenius'. +there are five types of constraints available, as discussed below: +'distance', 'angle', 'dihedral', 'arrhenius', and 'rmsd'. A sample map file is given below: @@ -432,6 +432,25 @@ temperature calculations. A uniform random number between 0 and 1 is generated using *seed*\ ; if this number is less than the result of the Arrhenius equation above, the reaction is permitted to occur. +The constraint of type 'rmsd' has the following syntax: + +.. parsed-literal:: + + rmsd *RMSDmax* *molfragment* + +where 'rmsd' is the required keyword, and *RMSDmax* is the maximum +root-mean-square deviation between atom positions of the pre-reaction +template and the local reaction site (distance units), after optimal +translation and rotation of the pre-reaction template. Optionally, the +name of a molecule fragment (of the pre-reaction template) can be +specified by *molfragment*\ . If a molecule fragment is specified, +only atoms that are part of this molecule fragment are used to +determine the RMSD. A molecule fragment must have been defined in the +:doc:`molecule ` command for the pre-reaction template. For +example, the molecule fragment could consist of only the backbone +atoms of a polymer chain. This constraint can be used to enforce a +specific relative position and orientation between reacting molecules. + Once a reaction site has been successfully identified, data structures within LAMMPS that store bond topology are updated to reflect the post-reacted molecule template. All force fields with fixed bonds, diff --git a/doc/src/fix_deform.rst b/doc/src/fix_deform.rst index 70b15f0d79..999a88c4e7 100644 --- a/doc/src/fix_deform.rst +++ b/doc/src/fix_deform.rst @@ -1,10 +1,10 @@ .. index:: fix deform +.. index:: fix deform/kk fix deform command ================== -fix deform/kk command -===================== +Accelerator Variants: *deform/kk* Syntax """""" diff --git a/doc/src/fix_dpd_energy.rst b/doc/src/fix_dpd_energy.rst index 6d510f1825..732f99b516 100644 --- a/doc/src/fix_dpd_energy.rst +++ b/doc/src/fix_dpd_energy.rst @@ -1,10 +1,10 @@ .. index:: fix dpd/energy +.. index:: fix dpd/energy/kk fix dpd/energy command ====================== -fix dpd/energy/kk command -========================= +Accelerator Variants: *dpd/energy/kk* Syntax """""" diff --git a/doc/src/fix_dpd_source.rst b/doc/src/fix_dpd_source.rst index 4373645c84..29bbc92f78 100644 --- a/doc/src/fix_dpd_source.rst +++ b/doc/src/fix_dpd_source.rst @@ -1,4 +1,5 @@ .. index:: fix edpd/source +.. index:: fix tdpd/source fix edpd/source command ======================= diff --git a/doc/src/fix_drude_transform.rst b/doc/src/fix_drude_transform.rst index bda2d25b1f..792b041576 100644 --- a/doc/src/fix_drude_transform.rst +++ b/doc/src/fix_drude_transform.rst @@ -1,4 +1,5 @@ .. index:: fix drude/transform/direct +.. index:: fix drude/transform/inverse fix drude/transform/direct command ================================== diff --git a/doc/src/fix_enforce2d.rst b/doc/src/fix_enforce2d.rst index e92011cb11..7c6ef75089 100644 --- a/doc/src/fix_enforce2d.rst +++ b/doc/src/fix_enforce2d.rst @@ -1,10 +1,10 @@ .. index:: fix enforce2d +.. index:: fix enforce2d/kk fix enforce2d command ===================== -fix enforce2d/kk command -======================== +Accelerator Variants: *enforce2d/kk* Syntax """""" diff --git a/doc/src/fix_eos_table_rx.rst b/doc/src/fix_eos_table_rx.rst index bd13398e0a..56bde44d98 100644 --- a/doc/src/fix_eos_table_rx.rst +++ b/doc/src/fix_eos_table_rx.rst @@ -1,10 +1,10 @@ .. index:: fix eos/table/rx +.. index:: fix eos/table/rx/kk fix eos/table/rx command ======================== -fix eos/table/rx/kk command -=========================== +Accelerator Variants: *eos/table/rx/kk* Syntax """""" diff --git a/doc/src/fix_freeze.rst b/doc/src/fix_freeze.rst index f81954ff5d..a7370c7f44 100644 --- a/doc/src/fix_freeze.rst +++ b/doc/src/fix_freeze.rst @@ -1,10 +1,10 @@ .. index:: fix freeze +.. index:: fix freeze/kk fix freeze command ================== -fix freeze/kk command -===================== +Accelerator Variants: *freeze/kk* Syntax """""" diff --git a/doc/src/fix_gravity.rst b/doc/src/fix_gravity.rst index 5f06f6d22a..a163eb4ab2 100644 --- a/doc/src/fix_gravity.rst +++ b/doc/src/fix_gravity.rst @@ -1,13 +1,11 @@ .. index:: fix gravity +.. index:: fix gravity/omp +.. index:: fix gravity/kk fix gravity command =================== -fix gravity/omp command -======================= - -fix gravity/kk command -====================== +Accelerator Variants: *gravity/omp*, *gravity/kk* Syntax """""" diff --git a/doc/src/fix_langevin.rst b/doc/src/fix_langevin.rst index 80f4964242..e31434247f 100644 --- a/doc/src/fix_langevin.rst +++ b/doc/src/fix_langevin.rst @@ -1,10 +1,10 @@ .. index:: fix langevin +.. index:: fix langevin/kk fix langevin command ==================== -fix langevin/kk command -======================= +Accelerator Variants: *langevin/kk* Syntax """""" diff --git a/doc/src/fix_momentum.rst b/doc/src/fix_momentum.rst index ca6e19005e..393a6a16cd 100644 --- a/doc/src/fix_momentum.rst +++ b/doc/src/fix_momentum.rst @@ -1,10 +1,11 @@ .. index:: fix momentum +.. index:: fix momentum/kk +.. index:: fix momentum/chunk fix momentum command ==================== -fix momentum/kk command -======================= +Accelerator Variants: *momentum/kk* fix momentum/chunk command ========================== diff --git a/doc/src/fix_mvv_dpd.rst b/doc/src/fix_mvv_dpd.rst index c7e9b64c96..d0df1bd0f9 100644 --- a/doc/src/fix_mvv_dpd.rst +++ b/doc/src/fix_mvv_dpd.rst @@ -1,4 +1,6 @@ .. index:: fix mvv/dpd +.. index:: fix mvv/edpd +.. index:: fix mvv/tdpd fix mvv/dpd command =================== diff --git a/doc/src/fix_nh.rst b/doc/src/fix_nh.rst index 64a3c3b061..84b497dc3f 100644 --- a/doc/src/fix_nh.rst +++ b/doc/src/fix_nh.rst @@ -1,37 +1,29 @@ .. index:: fix nvt +.. index:: fix nvt/intel +.. index:: fix nvt/kk +.. index:: fix nvt/omp +.. index:: fix npt +.. index:: fix npt/intel +.. index:: fix npt/kk +.. index:: fix npt/omp +.. index:: fix nph +.. index:: fix nph/kk +.. index:: fix nph/omp fix nvt command =============== -fix nvt/intel command -===================== - -fix nvt/kk command -================== - -fix nvt/omp command -=================== +Accelerator Variants: *nvt/intel*, *nvt/kk*, *nvt/omp* fix npt command =============== -fix npt/intel command -===================== - -fix npt/kk command -================== - -fix npt/omp command -=================== +Accelerator Variants: *npt/intel*, *npt/kk*, *npt/omp* fix nph command =============== -fix nph/kk command -================== - -fix nph/omp command -=================== +Accelerator Variants: *nph/kk*, *nph/omp* Syntax """""" diff --git a/doc/src/fix_nh_eff.rst b/doc/src/fix_nh_eff.rst index 4d4d536ac2..3e54ed9765 100644 --- a/doc/src/fix_nh_eff.rst +++ b/doc/src/fix_nh_eff.rst @@ -1,4 +1,6 @@ .. index:: fix nvt/eff +.. index:: fix npt/eff +.. index:: fix nph/eff fix nvt/eff command =================== diff --git a/doc/src/fix_nh_uef.rst b/doc/src/fix_nh_uef.rst index 272f84d520..1c1e7a11d2 100644 --- a/doc/src/fix_nh_uef.rst +++ b/doc/src/fix_nh_uef.rst @@ -1,4 +1,5 @@ .. index:: fix nvt/uef +.. index:: fix npt/uef fix nvt/uef command =================== diff --git a/doc/src/fix_nph_asphere.rst b/doc/src/fix_nph_asphere.rst index 2e5dd16c8f..da0510492e 100644 --- a/doc/src/fix_nph_asphere.rst +++ b/doc/src/fix_nph_asphere.rst @@ -1,10 +1,10 @@ .. index:: fix nph/asphere +.. index:: fix nph/asphere/omp fix nph/asphere command ======================= -fix nph/asphere/omp command -=========================== +Accelerator Variants: *nph/asphere/omp* Syntax """""" diff --git a/doc/src/fix_nph_sphere.rst b/doc/src/fix_nph_sphere.rst index efa6ca38b5..4b76f7252f 100644 --- a/doc/src/fix_nph_sphere.rst +++ b/doc/src/fix_nph_sphere.rst @@ -1,10 +1,10 @@ .. index:: fix nph/sphere +.. index:: fix nph/sphere/omp fix nph/sphere command ====================== -fix nph/sphere/omp command -========================== +Accelerator Variants: *nph/sphere/omp* Syntax """""" diff --git a/doc/src/fix_nphug.rst b/doc/src/fix_nphug.rst index c46e98fe3e..d55f435d43 100644 --- a/doc/src/fix_nphug.rst +++ b/doc/src/fix_nphug.rst @@ -1,10 +1,10 @@ .. index:: fix nphug +.. index:: fix nphug/omp fix nphug command ================= -fix nphug/omp command -===================== +Accelerator Variants: *nphug/omp* Syntax """""" diff --git a/doc/src/fix_npt_asphere.rst b/doc/src/fix_npt_asphere.rst index 5537365359..de2289a068 100644 --- a/doc/src/fix_npt_asphere.rst +++ b/doc/src/fix_npt_asphere.rst @@ -1,10 +1,10 @@ .. index:: fix npt/asphere +.. index:: fix npt/asphere/omp fix npt/asphere command ======================= -fix npt/asphere/omp command -=========================== +Accelerator Variants: *npt/asphere/omp* Syntax """""" diff --git a/doc/src/fix_npt_sphere.rst b/doc/src/fix_npt_sphere.rst index 4e8188ac0c..7363375ff3 100644 --- a/doc/src/fix_npt_sphere.rst +++ b/doc/src/fix_npt_sphere.rst @@ -1,10 +1,10 @@ .. index:: fix npt/sphere +.. index:: fix npt/sphere/omp fix npt/sphere command ====================== -fix npt/sphere/omp command -========================== +Accelerator Variants: *npt/sphere/omp* Syntax """""" diff --git a/doc/src/fix_numdiff.rst b/doc/src/fix_numdiff.rst index 0c4f731ea0..22c1c59748 100644 --- a/doc/src/fix_numdiff.rst +++ b/doc/src/fix_numdiff.rst @@ -1,7 +1,7 @@ .. index:: fix numdiff fix numdiff command -==================== +=================== Syntax """""" diff --git a/doc/src/fix_nve.rst b/doc/src/fix_nve.rst index 0026d38e8c..71f8ec300f 100644 --- a/doc/src/fix_nve.rst +++ b/doc/src/fix_nve.rst @@ -1,16 +1,12 @@ .. index:: fix nve +.. index:: fix nve/intel +.. index:: fix nve/kk +.. index:: fix nve/omp fix nve command =============== -fix nve/intel command -===================== - -fix nve/kk command -================== - -fix nve/omp command -=================== +Accelerator Variants: *nve/intel*, *nve/kk*, *nve/omp* Syntax """""" diff --git a/doc/src/fix_nve_asphere.rst b/doc/src/fix_nve_asphere.rst index f1441fdd3c..af80460b32 100644 --- a/doc/src/fix_nve_asphere.rst +++ b/doc/src/fix_nve_asphere.rst @@ -1,10 +1,10 @@ .. index:: fix nve/asphere +.. index:: fix nve/asphere/intel fix nve/asphere command ======================= -fix nve/asphere/intel command -============================= +Accelerator Variants: *nve/asphere/intel* Syntax """""" diff --git a/doc/src/fix_nve_sphere.rst b/doc/src/fix_nve_sphere.rst index 59d951782a..0230255b42 100644 --- a/doc/src/fix_nve_sphere.rst +++ b/doc/src/fix_nve_sphere.rst @@ -1,13 +1,11 @@ .. index:: fix nve/sphere +.. index:: fix nve/sphere/omp +.. index:: fix nve/sphere/kk fix nve/sphere command ====================== -fix nve/sphere/omp command -========================== - -fix nve/sphere/kk command -========================= +Accelerator Variants: *nve/sphere/omp*, *nve/sphere/kk* Syntax """""" diff --git a/doc/src/fix_nvt_asphere.rst b/doc/src/fix_nvt_asphere.rst index a08dae765c..bb4139d95f 100644 --- a/doc/src/fix_nvt_asphere.rst +++ b/doc/src/fix_nvt_asphere.rst @@ -1,10 +1,10 @@ .. index:: fix nvt/asphere +.. index:: fix nvt/asphere/omp fix nvt/asphere command ======================= -fix nvt/asphere/omp command -=========================== +Accelerator Variants: *nvt/asphere/omp* Syntax """""" diff --git a/doc/src/fix_nvt_sllod.rst b/doc/src/fix_nvt_sllod.rst index b5051b8692..ff9a4f0d12 100644 --- a/doc/src/fix_nvt_sllod.rst +++ b/doc/src/fix_nvt_sllod.rst @@ -1,13 +1,11 @@ .. index:: fix nvt/sllod +.. index:: fix nvt/sllod/intel +.. index:: fix nvt/sllod/omp fix nvt/sllod command ===================== -fix nvt/sllod/intel command -=========================== - -fix nvt/sllod/omp command -========================= +Accelerator Variants: *nvt/sllod/intel*, *nvt/sllod/omp* Syntax """""" diff --git a/doc/src/fix_nvt_sphere.rst b/doc/src/fix_nvt_sphere.rst index dd4cf9cb3f..8226328cea 100644 --- a/doc/src/fix_nvt_sphere.rst +++ b/doc/src/fix_nvt_sphere.rst @@ -1,10 +1,10 @@ .. index:: fix nvt/sphere +.. index:: fix nvt/sphere/omp fix nvt/sphere command ====================== -fix nvt/sphere/omp command -========================== +Accelerator Variants: *nvt/sphere/omp* Syntax """""" diff --git a/doc/src/fix_orient.rst b/doc/src/fix_orient.rst index 51edbd48ad..31aa6074d1 100644 --- a/doc/src/fix_orient.rst +++ b/doc/src/fix_orient.rst @@ -1,4 +1,5 @@ .. index:: fix orient/fcc +.. index:: fix orient/bcc fix orient/fcc command ====================== diff --git a/doc/src/fix_orient_eco.rst b/doc/src/fix_orient_eco.rst index bdfab21c9d..58ff38268f 100644 --- a/doc/src/fix_orient_eco.rst +++ b/doc/src/fix_orient_eco.rst @@ -1,4 +1,4 @@ -.. index:: fix orient/eco +.. index:: fix orient/eco fix orient/eco command ====================== diff --git a/doc/src/fix_pafi.rst b/doc/src/fix_pafi.rst new file mode 100644 index 0000000000..8f1d02ac49 --- /dev/null +++ b/doc/src/fix_pafi.rst @@ -0,0 +1,99 @@ +.. index:: fix pafi + +fix pafi command +================ + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID pafi compute-ID Temp Tdamp seed keyword values... + +* ID, group-ID are documented in :doc:`fix ` command +* pafi = style name of this fix command +* compute-ID = ID of a :doc:`compute property/atom ` that holds data used by this fix +* Temp = desired temperature (temperature units) +* Tdamp = damping parameter (time units) +* seed = random number seed to use for white noise (positive integer) +* keyword = *overdamped* or *com* + + .. parsed-literal:: + *overdamped* value = *yes* or *no* or 1 or 0 + *yes* or 1 = Brownian (overdamped) integration in hyperplane + *no* or 0 = Langevin integration in hyperplane + *com* value = *yes* or *no* or 1 or 0 + *yes* or 1 = zero linear momentum, fixing center or mass (recommended) + *no* or 0 = do not zero linear momentum, allowing center of mass drift + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz + run 0 post no + fix hp all pafi pa 500.0 0.01 434 overdamped yes + +Description +""""""""""" + +Perform Brownian or Langevin integration whilst constraining the system to lie +in some hyperplane, which is expected to be the tangent plane to some reference +pathway in a solid state system. The instantaneous value of a modified force +projection is also calculated, whose time integral can be shown to be equal to +the true free energy gradient along the minimum free energy path local to the reference pathway. +A detailed discussion of the projection technique can be found in :ref:`(Swinburne) `. + +This fix can be used with LAMMPS as demonstrated in examples/USER/misc/pafi, +though it is primarily intended to be coupled with the PAFI C++ code, developed +at `https://github.com/tomswinburne/pafi `_, +which distributes multiple LAMMPS workers in parallel to compute and collate +hyperplane-constrained averages, allowing the calculation of free energy barriers and pathways. + +A :doc:`compute property/atom ` must be provided with 9 fields per atom coordinate, +which in order are the x,y,z coordinates of a configuration on the reference path, +the x,y,z coordinates of the path tangent (derivative of path position with path coordinate) +and the x,y,z coordinates of the change in tangent (derivative of path tangent with path coordinate). + +A 4-element vector is also calculated by this fix. The 4 components are the +modified projected force, its square, the expected projection of the minimum +free energy path tangent on the reference path tangent and the minimum image +distance between the current configuration and the reference configuration, +projected along the path tangent. This latter value should be essentially zero. + +.. note:: + When com=yes/1, which is recommended, the provided tangent vector must also + have zero center of mass. This can be achieved by subtracting from each + coordinate of the path tangent the average x,y,z value. The PAFI C++ code + (see above) can generate these paths for use in LAMMPS. + +.. note:: + When overdamped=yes/1, the Tdamp parameter should be around 5-10 times smaller + than that used in typical Langevin integration. + See :doc:`fix langevin ` for typical values. + + +Restart, fix_modify, output, run start/stop, minimize info +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +No information about this fix is written to :doc:`binary restart files `. +None of the :doc:`fix_modify ` options are relevant to this fix. + +This fix produces a global vector each timestep which can be accessed by various :doc:`output commands `. + +Restrictions +"""""""""""" + +This fix is part of the USER-MISC package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package ` doc page for more info. + + +Default +""""""" +The option defaults are com = *yes*, overdamped = *no* + +---------- + +.. _Swinburne: + +**(Swinburne)** Swinburne and Marinica, Physical Review Letters, 120, 1 (2018) diff --git a/doc/src/fix_property_atom.rst b/doc/src/fix_property_atom.rst index eaf246c1a3..dbea88c5a9 100644 --- a/doc/src/fix_property_atom.rst +++ b/doc/src/fix_property_atom.rst @@ -1,10 +1,10 @@ .. index:: fix property/atom +.. index:: fix property/atom/kk fix property/atom command ========================= -fix property/atom/kk command -============================ +Accelerator Variants: *property/atom/kk* Syntax """""" @@ -105,7 +105,7 @@ keyword with a value of *yes*\ . This will invoke extra communication when ghost atoms are created (at every re-neighboring) to insure the new properties are also defined for the ghost atoms. -.. note:: +.. admonition:: Properties on ghost atoms If you use this command with the *mol*\ , *q* or *rmass* vectors, then you most likely want to set *ghost* yes, since these properties @@ -115,7 +115,7 @@ new properties are also defined for the ghost atoms. atoms to have these values. LAMMPS will issue a warning it you define those vectors but do not set *ghost* yes. -.. note:: +.. admonition:: Limitations on ghost atom properties The properties for ghost atoms are not updated every timestep, but only once every few steps when neighbor lists are re-built. Thus @@ -126,12 +126,6 @@ new properties are also defined for the ghost atoms. that can be invoked from within a :doc:`pair style ` or :doc:`fix ` or :doc:`compute ` that you write. -.. note:: - - If this fix is defined **after** the simulation box is created, - a 'run 0' command should be issued to properly initialize the storage - created by this fix. - ---------- This fix is one of a small number that can be defined in an input @@ -139,6 +133,12 @@ script before the simulation box is created or atoms are defined. This is so it can be used with the :doc:`read_data ` command as described below. +.. note:: + + If this fix is defined **after** the simulation box is created, + a 'run 0' command may be needed to properly initialize the storage + created by this fix. + Per-atom properties that are defined by the :doc:`atom style ` are initialized when atoms are created, e.g. by the :doc:`read_data ` or :doc:`create_atoms ` commands. The per-atom properties defined by this fix are not. So @@ -271,11 +271,21 @@ example to heavy water: Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -This fix writes the per-atom values it stores to :doc:`binary restart files `, so that the values can be restored when a -simulation is restarted. See the :doc:`read_restart ` -command for info on how to re-specify a fix in an input script that -reads a restart file, so that the operation of the fix continues in an -uninterrupted fashion. +This fix writes the per-atom values it stores to :doc:`binary restart +files `, so that the values can be restored when a simulation +is restarted. See the :doc:`read_restart ` command for +info on how to re-specify a fix in an input script that reads a restart +file, so that the operation of the fix continues in an uninterrupted +fashion. + +.. warning:: + + When reading data from a restart, the fix command has to be specified + **exactly** the same way as before. LAMMPS will only check whether a + fix is of the same style and has the same fix ID and in case of a match + will then try to initialize the fix with the data stored in the binary + restart file. If the fix property/atom command does not match exactly, + data can be corrupted or LAMMPS may crash. None of the :doc:`fix_modify ` options are relevant to this fix. No global or per-atom quantities are stored by this fix for diff --git a/doc/src/fix_qeq.rst b/doc/src/fix_qeq.rst index f656049e73..56fde059e8 100644 --- a/doc/src/fix_qeq.rst +++ b/doc/src/fix_qeq.rst @@ -1,4 +1,8 @@ .. index:: fix qeq/point +.. index:: fix qeq/shielded +.. index:: fix qeq/slater +.. index:: fix qeq/dynamic +.. index:: fix qeq/fire fix qeq/point command ===================== diff --git a/doc/src/fix_qeq_comb.rst b/doc/src/fix_qeq_comb.rst index f70ecb1dd5..74a97720dc 100644 --- a/doc/src/fix_qeq_comb.rst +++ b/doc/src/fix_qeq_comb.rst @@ -1,10 +1,10 @@ .. index:: fix qeq/comb +.. index:: fix qeq/comb/omp fix qeq/comb command ==================== -fix qeq/comb/omp command -======================== +Accelerator Variants: *qeq/comb/omp* Syntax """""" diff --git a/doc/src/fix_qeq_reax.rst b/doc/src/fix_qeq_reax.rst index 0fd5e78578..47dca86401 100644 --- a/doc/src/fix_qeq_reax.rst +++ b/doc/src/fix_qeq_reax.rst @@ -1,13 +1,11 @@ .. index:: fix qeq/reax +.. index:: fix qeq/reax/kk +.. index:: fix qeq/reax/omp fix qeq/reax command ==================== -fix qeq/reax/kk command -======================= - -fix qeq/reax/omp command -======================== +Accelerator Variants: *qeq/reax/kk*, *qeq/reax/omp* Syntax """""" diff --git a/doc/src/fix_reaxc_bonds.rst b/doc/src/fix_reaxc_bonds.rst index 52f0581929..2d0d2d18db 100644 --- a/doc/src/fix_reaxc_bonds.rst +++ b/doc/src/fix_reaxc_bonds.rst @@ -1,10 +1,10 @@ .. index:: fix reax/c/bonds +.. index:: fix reax/c/bonds/kk fix reax/c/bonds command ======================== -fix reax/c/bonds/kk command -=========================== +Accelerator Variants: *reax/c/bonds/kk* Syntax """""" diff --git a/doc/src/fix_reaxc_species.rst b/doc/src/fix_reaxc_species.rst index 275086b52b..9935ecaa3a 100644 --- a/doc/src/fix_reaxc_species.rst +++ b/doc/src/fix_reaxc_species.rst @@ -1,10 +1,10 @@ .. index:: fix reax/c/species +.. index:: fix reax/c/species/kk fix reax/c/species command ========================== -fix reax/c/species/kk command -============================= +Accelerator Variants: *reax/c/species/kk* Syntax """""" diff --git a/doc/src/fix_rigid.rst b/doc/src/fix_rigid.rst index a143817303..efadc5dd13 100644 --- a/doc/src/fix_rigid.rst +++ b/doc/src/fix_rigid.rst @@ -1,40 +1,49 @@ .. index:: fix rigid +.. index:: fix rigid/omp +.. index:: fix rigid/nve +.. index:: fix rigid/nve/omp +.. index:: fix rigid/nvt +.. index:: fix rigid/nvt/omp +.. index:: fix rigid/npt +.. index:: fix rigid/npt/omp +.. index:: fix rigid/nph +.. index:: fix rigid/nph/omp +.. index:: fix rigid/small +.. index:: fix rigid/small/omp +.. index:: fix rigid/nve/small +.. index:: fix rigid/nvt/small +.. index:: fix rigid/npt/small +.. index:: fix rigid/nph/small fix rigid command ================= -fix rigid/omp command -===================== +Accelerator Variants: *rigid/omp* fix rigid/nve command ===================== -fix rigid/nve/omp command -========================= +Accelerator Variants: *rigid/nve/omp* fix rigid/nvt command ===================== -fix rigid/nvt/omp command -========================= +Accelerator Variants: *rigid/nvt/omp* fix rigid/npt command ===================== -fix rigid/npt/omp command -========================= +Accelerator Variants: *rigid/npt/omp* fix rigid/nph command ===================== -fix rigid/nph/omp command -========================= +Accelerator Variants: *rigid/nph/omp* fix rigid/small command ======================= -fix rigid/small/omp command -=========================== +Accelerator Variants: *rigid/small/omp* fix rigid/nve/small command =========================== diff --git a/doc/src/fix_rx.rst b/doc/src/fix_rx.rst index 7a3a95f069..c1a1d0950c 100644 --- a/doc/src/fix_rx.rst +++ b/doc/src/fix_rx.rst @@ -1,10 +1,10 @@ .. index:: fix rx +.. index:: fix rx/kk fix rx command ============== -fix rx/kk command -================= +Accelerator Variants: *rx/kk* Syntax """""" diff --git a/doc/src/fix_setforce.rst b/doc/src/fix_setforce.rst index b417b369e5..406826e5b9 100644 --- a/doc/src/fix_setforce.rst +++ b/doc/src/fix_setforce.rst @@ -1,10 +1,11 @@ .. index:: fix setforce +.. index:: fix setforce/kk +.. index:: fix setforce/spin fix setforce command ==================== -fix setforce/kk command -======================= +Accelerator Variants: *setforce/kk* fix setforce/spin command ========================= diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index 5f720d86ea..eb7add7035 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -1,4 +1,5 @@ .. index:: fix shake +.. index:: fix rattle fix shake command ================= diff --git a/doc/src/fix_shardlow.rst b/doc/src/fix_shardlow.rst index 3c046dae74..f928044db7 100644 --- a/doc/src/fix_shardlow.rst +++ b/doc/src/fix_shardlow.rst @@ -1,10 +1,10 @@ .. index:: fix shardlow +.. index:: fix shardlow/kk fix shardlow command ==================== -fix shardlow/kk command -======================= +Accelerator Variants: *shardlow/kk* Syntax """""" diff --git a/doc/src/fix_smd_integrate_ulsph.rst b/doc/src/fix_smd_integrate_ulsph.rst index f7ba223965..5b4c117452 100644 --- a/doc/src/fix_smd_integrate_ulsph.rst +++ b/doc/src/fix_smd_integrate_ulsph.rst @@ -1,7 +1,7 @@ .. index:: fix smd/integrate_ulsph fix smd/integrate_ulsph command -================================ +=============================== Syntax """""" diff --git a/doc/src/fix_sph.rst b/doc/src/fix_sph.rst index 1b482e0252..5ba752debb 100644 --- a/doc/src/fix_sph.rst +++ b/doc/src/fix_sph.rst @@ -1,7 +1,7 @@ .. index:: fix sph fix sph command -================ +=============== Syntax """""" diff --git a/doc/src/fix_sph_stationary.rst b/doc/src/fix_sph_stationary.rst index 5fa3f1d04d..c86a30b542 100644 --- a/doc/src/fix_sph_stationary.rst +++ b/doc/src/fix_sph_stationary.rst @@ -1,7 +1,7 @@ .. index:: fix sph/stationary fix sph/stationary command -=========================== +========================== Syntax """""" diff --git a/doc/src/fix_store_state.rst b/doc/src/fix_store_state.rst index 5f42e3ef5d..3841ef6359 100644 --- a/doc/src/fix_store_state.rst +++ b/doc/src/fix_store_state.rst @@ -111,6 +111,15 @@ command for info on how to re-specify a fix in an input script that reads a restart file, so that the operation of the fix continues in an uninterrupted fashion. +.. warning:: + + When reading data from a restart, the fix command has to be specified + **exactly** the same way as before. LAMMPS will only check whether a + fix is of the same style and has the same fix ID and in case of a match + will then try to initialize the fix with the data stored in the binary + restart file. If the fix store/state command does not match exactly, + data can be corrupted or LAMMPS may crash. + None of the :doc:`fix_modify ` options are relevant to this fix. diff --git a/doc/src/fix_temp_csvr.rst b/doc/src/fix_temp_csvr.rst index 10c92dc2f2..8faa6035cf 100644 --- a/doc/src/fix_temp_csvr.rst +++ b/doc/src/fix_temp_csvr.rst @@ -1,4 +1,5 @@ .. index:: fix temp/csvr +.. index:: fix temp/csld fix temp/csvr command ===================== diff --git a/doc/src/fix_ttm.rst b/doc/src/fix_ttm.rst index 97cb0cd05b..24bc6f297f 100644 --- a/doc/src/fix_ttm.rst +++ b/doc/src/fix_ttm.rst @@ -1,4 +1,5 @@ .. index:: fix ttm +.. index:: fix ttm/mod fix ttm command =============== diff --git a/doc/src/fix_wall.rst b/doc/src/fix_wall.rst index d4120ca625..39ff879138 100644 --- a/doc/src/fix_wall.rst +++ b/doc/src/fix_wall.rst @@ -1,10 +1,15 @@ .. index:: fix wall/lj93 +.. index:: fix wall/lj93/kk +.. index:: fix wall/lj126 +.. index:: fix wall/lj1043 +.. index:: fix wall/colloid +.. index:: fix wall/harmonic +.. index:: fix wall/morse fix wall/lj93 command ===================== -fix wall/lj93/kk command -======================== +Accelerator Variants: *wall/lj93/kk* fix wall/lj126 command ====================== diff --git a/doc/src/fix_wall_ees.rst b/doc/src/fix_wall_ees.rst index 79f96765f8..2bab8c6056 100644 --- a/doc/src/fix_wall_ees.rst +++ b/doc/src/fix_wall_ees.rst @@ -1,4 +1,5 @@ .. index:: fix wall/ees +.. index:: fix wall/region/ees fix wall/ees command ==================== diff --git a/doc/src/fix_wall_reflect.rst b/doc/src/fix_wall_reflect.rst index 44cde8f3d5..4f014cc628 100644 --- a/doc/src/fix_wall_reflect.rst +++ b/doc/src/fix_wall_reflect.rst @@ -1,10 +1,10 @@ .. index:: fix wall/reflect +.. index:: fix wall/reflect/kk fix wall/reflect command ======================== -fix wall/reflect/kk command -=========================== +Accelerator Variants: *wall/reflect/kk* Syntax """""" diff --git a/doc/src/improper_class2.rst b/doc/src/improper_class2.rst index eb6b8eab2c..a84e92b090 100644 --- a/doc/src/improper_class2.rst +++ b/doc/src/improper_class2.rst @@ -1,13 +1,11 @@ .. index:: improper_style class2 +.. index:: improper_style class2/omp +.. index:: improper_style class2/kk improper_style class2 command ============================= -improper_style class2/omp command -================================= - -improper_style class2/kk command -================================ +Accelerator Variants: *class2/omp*, *class2/kk* Syntax """""" diff --git a/doc/src/improper_cossq.rst b/doc/src/improper_cossq.rst index 70885acc28..a6281bc260 100644 --- a/doc/src/improper_cossq.rst +++ b/doc/src/improper_cossq.rst @@ -1,10 +1,10 @@ .. index:: improper_style cossq +.. index:: improper_style cossq/omp improper_style cossq command ============================ -improper_style cossq/omp command -================================ +Accelerator Variants: *cossq/omp* Syntax """""" diff --git a/doc/src/improper_cvff.rst b/doc/src/improper_cvff.rst index bde510c3f7..5bd7fdf911 100644 --- a/doc/src/improper_cvff.rst +++ b/doc/src/improper_cvff.rst @@ -1,13 +1,11 @@ .. index:: improper_style cvff +.. index:: improper_style cvff/intel +.. index:: improper_style cvff/omp improper_style cvff command =========================== -improper_style cvff/intel command -================================= - -improper_style cvff/omp command -=============================== +Accelerator Variants: *cvff/intel*, *cvff/omp* Syntax """""" diff --git a/doc/src/improper_fourier.rst b/doc/src/improper_fourier.rst index 04ce9ba994..84ea97509d 100644 --- a/doc/src/improper_fourier.rst +++ b/doc/src/improper_fourier.rst @@ -1,10 +1,10 @@ .. index:: improper_style fourier +.. index:: improper_style fourier/omp improper_style fourier command ============================== -improper_style fourier/omp command -================================== +Accelerator Variants: *fourier/omp* Syntax """""" diff --git a/doc/src/improper_harmonic.rst b/doc/src/improper_harmonic.rst index e1b78d21db..4f21e48fa9 100644 --- a/doc/src/improper_harmonic.rst +++ b/doc/src/improper_harmonic.rst @@ -1,16 +1,12 @@ .. index:: improper_style harmonic +.. index:: improper_style harmonic/intel +.. index:: improper_style harmonic/kk +.. index:: improper_style harmonic/omp improper_style harmonic command =============================== -improper_style harmonic/intel command -===================================== - -improper_style harmonic/kk command -================================== - -improper_style harmonic/omp command -=================================== +Accelerator Variants: *harmonic/intel*, *harmonic/kk*, *harmonic/omp* Syntax """""" diff --git a/doc/src/improper_ring.rst b/doc/src/improper_ring.rst index df319396e2..d67c999714 100644 --- a/doc/src/improper_ring.rst +++ b/doc/src/improper_ring.rst @@ -1,10 +1,10 @@ .. index:: improper_style ring +.. index:: improper_style ring/omp improper_style ring command =========================== -improper_style ring/omp command -=============================== +Accelerator Variants: *ring/omp* Syntax """""" diff --git a/doc/src/improper_umbrella.rst b/doc/src/improper_umbrella.rst index 10981248d9..5d4aa571e1 100644 --- a/doc/src/improper_umbrella.rst +++ b/doc/src/improper_umbrella.rst @@ -1,10 +1,10 @@ .. index:: improper_style umbrella +.. index:: improper_style umbrella/omp improper_style umbrella command =============================== -improper_style umbrella/omp command -=================================== +Accelerator Variants: *umbrella/omp* Syntax """""" diff --git a/doc/src/kspace_style.rst b/doc/src/kspace_style.rst index 5b45b00353..59f5b7f27c 100644 --- a/doc/src/kspace_style.rst +++ b/doc/src/kspace_style.rst @@ -1,4 +1,30 @@ -.. index:: kspace_style +.. index:: kspace_style ewald +.. index:: kspace_style ewald/dipole +.. index:: kspace_style ewald/dipole/spin +.. index:: kspace_style ewald/disp +.. index:: kspace_style ewald/omp +.. index:: kspace_style pppm +.. index:: kspace_style pppm/kk +.. index:: kspace_style pppm/omp +.. index:: kspace_style pppm/gpu +.. index:: kspace_style pppm/intel +.. index:: kspace_style pppm/cg +.. index:: kspace_style pppm/dipole +.. index:: kspace_style pppm/dipole/spin +.. index:: kspace_style pppm/disp +.. index:: kspace_style pppm/disp/omp +.. index:: kspace_style pppm/disp/tip4p +.. index:: kspace_style pppm/disp/tip4p/omp +.. index:: kspace_style pppm/disp/intel +.. index:: kspace_style pppm/cg/omp +.. index:: kspace_style pppm/stagger +.. index:: kspace_style pppm/tip4p +.. index:: kspace_style pppm/tip4p/omp +.. index:: kspace_style msm +.. index:: kspace_style msm/omp +.. index:: kspace_style msm/cg +.. index:: kspace_style msm/cg/omp +.. index:: kspace_style scafacos kspace_style command ==================== diff --git a/doc/src/pair_adp.rst b/doc/src/pair_adp.rst index 7017549925..5eec0004bf 100644 --- a/doc/src/pair_adp.rst +++ b/doc/src/pair_adp.rst @@ -1,10 +1,10 @@ .. index:: pair_style adp +.. index:: pair_style adp/omp pair_style adp command ====================== -pair_style adp/omp command -========================== +Accelerator Variants: *adp/omp* Syntax """""" diff --git a/doc/src/pair_agni.rst b/doc/src/pair_agni.rst index ee69f40d80..087c39e8f9 100644 --- a/doc/src/pair_agni.rst +++ b/doc/src/pair_agni.rst @@ -1,10 +1,10 @@ .. index:: pair_style agni +.. index:: pair_style agni/omp pair_style agni command -======================== +======================= -pair_style agni/omp command -============================ +Accelerator Variants: *agni/omp* Syntax """""" diff --git a/doc/src/pair_airebo.rst b/doc/src/pair_airebo.rst index f3be0e85de..d631d0a3d0 100644 --- a/doc/src/pair_airebo.rst +++ b/doc/src/pair_airebo.rst @@ -1,31 +1,27 @@ .. index:: pair_style airebo +.. index:: pair_style airebo/intel +.. index:: pair_style airebo/omp +.. index:: pair_style airebo/morse +.. index:: pair_style airebo/morse/intel +.. index:: pair_style airebo/morse/omp +.. index:: pair_style rebo +.. index:: pair_style rebo/intel +.. index:: pair_style rebo/omp pair_style airebo command ========================= -pair_style airebo/intel command -=============================== - -pair_style airebo/omp command -============================= +Accelerator Variants: *airebo/intel*, *airebo/omp* pair_style airebo/morse command =============================== -pair_style airebo/morse/intel command -===================================== - -pair_style airebo/morse/omp command -=================================== +Accelerator Variants: *airebo/morse/intel*, *airebo/morse/omp* pair_style rebo command ======================= -pair_style rebo/intel command -============================= - -pair_style rebo/omp command -=========================== +Accelerator Variants: *rebo/intel*, *rebo/omp* Syntax """""" diff --git a/doc/src/pair_beck.rst b/doc/src/pair_beck.rst index 0e63fe77ba..44bc317138 100644 --- a/doc/src/pair_beck.rst +++ b/doc/src/pair_beck.rst @@ -1,13 +1,11 @@ .. index:: pair_style beck +.. index:: pair_style beck/gpu +.. index:: pair_style beck/omp pair_style beck command ======================= -pair_style beck/gpu command -=========================== - -pair_style beck/omp command -=========================== +Accelerator Variants: *beck/gpu*, *beck/omp* Syntax """""" diff --git a/doc/src/pair_born.rst b/doc/src/pair_born.rst index 761b40b812..65be948f82 100644 --- a/doc/src/pair_born.rst +++ b/doc/src/pair_born.rst @@ -1,37 +1,35 @@ .. index:: pair_style born +.. index:: pair_style born/omp +.. index:: pair_style born/gpu +.. index:: pair_style born/coul/long +.. index:: pair_style born/coul/long/gpu +.. index:: pair_style born/coul/long/omp +.. index:: pair_style born/coul/msm +.. index:: pair_style born/coul/msm/omp +.. index:: pair_style born/coul/wolf +.. index:: pair_style born/coul/wolf/gpu +.. index:: pair_style born/coul/wolf/omp +.. index:: pair_style born/coul/dsf pair_style born command ======================= -pair_style born/omp command -=========================== - -pair_style born/gpu command -=========================== +Accelerator Variants: *born/omp*, *born/gpu* pair_style born/coul/long command ================================= -pair_style born/coul/long/gpu command -===================================== - -pair_style born/coul/long/omp command -===================================== +Accelerator Variants: *born/coul/long/gpu*, *born/coul/long/omp* pair_style born/coul/msm command ================================ -pair_style born/coul/msm/omp command -==================================== +Accelerator Variants: *born/coul/msm/omp* pair_style born/coul/wolf command ================================= -pair_style born/coul/wolf/gpu command -===================================== - -pair_style born/coul/wolf/omp command -===================================== +Accelerator Variants: *born/coul/wolf/gpu*, *born/coul/wolf/omp* pair_style born/coul/dsf command ================================ diff --git a/doc/src/pair_brownian.rst b/doc/src/pair_brownian.rst index ea311d603e..43c17c9087 100644 --- a/doc/src/pair_brownian.rst +++ b/doc/src/pair_brownian.rst @@ -1,16 +1,17 @@ .. index:: pair_style brownian +.. index:: pair_style brownian/omp +.. index:: pair_style brownian/poly +.. index:: pair_style brownian/poly/omp pair_style brownian command =========================== -pair_style brownian/omp command -================================ +Accelerator Variants: *brownian/omp* pair_style brownian/poly command ================================ -pair_style brownian/poly/omp command -==================================== +Accelerator Variants: *brownian/poly/omp* Syntax """""" diff --git a/doc/src/pair_buck.rst b/doc/src/pair_buck.rst index e8a1475ccb..5f255ece39 100644 --- a/doc/src/pair_buck.rst +++ b/doc/src/pair_buck.rst @@ -1,55 +1,40 @@ .. index:: pair_style buck +.. index:: pair_style buck/gpu +.. index:: pair_style buck/intel +.. index:: pair_style buck/kk +.. index:: pair_style buck/omp +.. index:: pair_style buck/coul/cut +.. index:: pair_style buck/coul/cut/gpu +.. index:: pair_style buck/coul/cut/intel +.. index:: pair_style buck/coul/cut/kk +.. index:: pair_style buck/coul/cut/omp +.. index:: pair_style buck/coul/long +.. index:: pair_style buck/coul/long/gpu +.. index:: pair_style buck/coul/long/intel +.. index:: pair_style buck/coul/long/kk +.. index:: pair_style buck/coul/long/omp +.. index:: pair_style buck/coul/msm +.. index:: pair_style buck/coul/msm/omp pair_style buck command -======================== +======================= -pair_style buck/gpu command -============================ - -pair_style buck/intel command -============================== - -pair_style buck/kk command -=========================== - -pair_style buck/omp command -============================ +Accelerator Variants: *buck/gpu*, *buck/intel*, *buck/kk*, *buck/omp* pair_style buck/coul/cut command -================================= +================================ -pair_style buck/coul/cut/gpu command -===================================== - -pair_style buck/coul/cut/intel command -======================================= - -pair_style buck/coul/cut/kk command -==================================== - -pair_style buck/coul/cut/omp command -===================================== +Accelerator Variants: *buck/coul/cut/gpu*, *buck/coul/cut/intel*, *buck/coul/cut/kk*, *buck/coul/cut/omp* pair_style buck/coul/long command -================================== - -pair_style buck/coul/long/gpu command -====================================== - -pair_style buck/coul/long/intel command -======================================== - -pair_style buck/coul/long/kk command -===================================== - -pair_style buck/coul/long/omp command -====================================== - -pair_style buck/coul/msm command ================================= -pair_style buck/coul/msm/omp command -===================================== +Accelerator Variants: *buck/coul/long/gpu*, *buck/coul/long/intel*, *buck/coul/long/kk*, *buck/coul/long/omp* + +pair_style buck/coul/msm command +================================ + +Accelerator Variants: *buck/coul/msm/omp* Syntax """""" diff --git a/doc/src/pair_buck6d_coul_gauss.rst b/doc/src/pair_buck6d_coul_gauss.rst index 7d3e5b9a22..5f96a93fee 100644 --- a/doc/src/pair_buck6d_coul_gauss.rst +++ b/doc/src/pair_buck6d_coul_gauss.rst @@ -1,4 +1,5 @@ .. index:: pair_style buck6d/coul/gauss/dsf +.. index:: pair_style buck6d/coul/gauss/long pair_style buck6d/coul/gauss/dsf command ======================================== diff --git a/doc/src/pair_buck_long.rst b/doc/src/pair_buck_long.rst index c0dd81d78f..1883cee637 100644 --- a/doc/src/pair_buck_long.rst +++ b/doc/src/pair_buck_long.rst @@ -1,10 +1,10 @@ .. index:: pair_style buck/long/coul/long +.. index:: pair_style buck/long/coul/long/omp pair_style buck/long/coul/long command -======================================= +====================================== -pair_style buck/long/coul/long/omp command -=========================================== +Accelerator Variants: *buck/long/coul/long/omp* Syntax """""" diff --git a/doc/src/pair_charmm.rst b/doc/src/pair_charmm.rst index 183311e34d..6d81266a35 100644 --- a/doc/src/pair_charmm.rst +++ b/doc/src/pair_charmm.rst @@ -1,55 +1,46 @@ .. index:: pair_style lj/charmm/coul/charmm +.. index:: pair_style lj/charmm/coul/charmm/intel +.. index:: pair_style lj/charmm/coul/charmm/kk +.. index:: pair_style lj/charmm/coul/charmm/omp +.. index:: pair_style lj/charmm/coul/charmm/implicit +.. index:: pair_style lj/charmm/coul/charmm/implicit/kk +.. index:: pair_style lj/charmm/coul/charmm/implicit/omp +.. index:: pair_style lj/charmm/coul/long +.. index:: pair_style lj/charmm/coul/long/gpu +.. index:: pair_style lj/charmm/coul/long/intel +.. index:: pair_style lj/charmm/coul/long/kk +.. index:: pair_style lj/charmm/coul/long/opt +.. index:: pair_style lj/charmm/coul/long/omp +.. index:: pair_style lj/charmm/coul/msm +.. index:: pair_style lj/charmm/coul/msm/omp +.. index:: pair_style lj/charmmfsw/coul/charmmfsh +.. index:: pair_style lj/charmmfsw/coul/long pair_style lj/charmm/coul/charmm command -========================================= +======================================== -pair_style lj/charmm/coul/charmm/intel command -=============================================== - -pair_style lj/charmm/coul/charmm/kk command -============================================ - -pair_style lj/charmm/coul/charmm/omp command -============================================= +Accelerator Variants: *lj/charmm/coul/charmm/intel*, *lj/charmm/coul/charmm/kk*, *lj/charmm/coul/charmm/omp* pair_style lj/charmm/coul/charmm/implicit command -================================================== +================================================= -pair_style lj/charmm/coul/charmm/implicit/kk command -===================================================== - -pair_style lj/charmm/coul/charmm/implicit/omp command -====================================================== +Accelerator Variants: *lj/charmm/coul/charmm/implicit/kk*, *lj/charmm/coul/charmm/implicit/omp* pair_style lj/charmm/coul/long command -======================================= - -pair_style lj/charmm/coul/long/gpu command -=========================================== - -pair_style lj/charmm/coul/long/intel command -============================================= - -pair_style lj/charmm/coul/long/kk command -========================================== - -pair_style lj/charmm/coul/long/opt command -=========================================== - -pair_style lj/charmm/coul/long/omp command -=========================================== - -pair_style lj/charmm/coul/msm command ====================================== -pair_style lj/charmm/coul/msm/omp command -========================================== +Accelerator Variants: *lj/charmm/coul/long/gpu*, *lj/charmm/coul/long/intel*, *lj/charmm/coul/long/kk*, *lj/charmm/coul/long/opt*, *lj/charmm/coul/long/omp* + +pair_style lj/charmm/coul/msm command +===================================== + +Accelerator Variants: *lj/charmm/coul/msm/omp* pair_style lj/charmmfsw/coul/charmmfsh command -=============================================== +============================================== pair_style lj/charmmfsw/coul/long command -========================================== +========================================= Syntax """""" diff --git a/doc/src/pair_class2.rst b/doc/src/pair_class2.rst index 66a696938f..cfa085cc28 100644 --- a/doc/src/pair_class2.rst +++ b/doc/src/pair_class2.rst @@ -1,37 +1,29 @@ .. index:: pair_style lj/class2 +.. index:: pair_style lj/class2/gpu +.. index:: pair_style lj/class2/kk +.. index:: pair_style lj/class2/omp +.. index:: pair_style lj/class2/coul/cut +.. index:: pair_style lj/class2/coul/cut/kk +.. index:: pair_style lj/class2/coul/cut/omp +.. index:: pair_style lj/class2/coul/long +.. index:: pair_style lj/class2/coul/long/gpu +.. index:: pair_style lj/class2/coul/long/kk +.. index:: pair_style lj/class2/coul/long/omp pair_style lj/class2 command ============================ -pair_style lj/class2/gpu command -================================ - -pair_style lj/class2/kk command -=============================== - -pair_style lj/class2/omp command -================================ +Accelerator Variants: *lj/class2/gpu*, *lj/class2/kk*, *lj/class2/omp* pair_style lj/class2/coul/cut command ===================================== -pair_style lj/class2/coul/cut/kk command -======================================== - -pair_style lj/class2/coul/cut/omp command -========================================= +Accelerator Variants: *lj/class2/coul/cut/kk*, *lj/class2/coul/cut/omp* pair_style lj/class2/coul/long command ====================================== -pair_style lj/class2/coul/long/gpu command -========================================== - -pair_style lj/class2/coul/long/kk command -========================================= - -pair_style lj/class2/coul/long/omp command -========================================== +Accelerator Variants: *lj/class2/coul/long/gpu*, *lj/class2/coul/long/kk*, *lj/class2/coul/long/omp* Syntax """""" diff --git a/doc/src/pair_coeff.rst b/doc/src/pair_coeff.rst index 311163c354..ea62d839ab 100644 --- a/doc/src/pair_coeff.rst +++ b/doc/src/pair_coeff.rst @@ -110,8 +110,8 @@ location specified. E.g. if the file is specified as "niu3.eam", it is looked for in the current working directory. If it is specified as "../potentials/niu3.eam", then it is looked for in the potentials directory, assuming it is a sister directory of the current working -directory. If the file is not found, it is then looked for in the -directory specified by the LAMMPS_POTENTIALS environment variable. +directory. If the file is not found, it is then looked for in one of +the directories specified by the ``LAMMPS_POTENTIALS`` environment variable. Thus if this is set to the potentials directory in the LAMMPS distribution, then you can use those files from anywhere on your system, without copying them into your working directory. Environment variables are @@ -136,6 +136,11 @@ Windows: % set LAMMPS_POTENTIALS="C:\\Path to LAMMPS\\Potentials" +The ``LAMMPS_POTENTIALS`` environment variable may contain paths +to multiple folders, if they are separated by ";" on Windows and +":" on all other operating systems, just like the ``PATH`` and +similar environment variables. + ---------- The alphabetic list of pair styles defined in LAMMPS is given on the diff --git a/doc/src/pair_colloid.rst b/doc/src/pair_colloid.rst index 4bb82e9615..040bea2487 100644 --- a/doc/src/pair_colloid.rst +++ b/doc/src/pair_colloid.rst @@ -1,13 +1,11 @@ .. index:: pair_style colloid +.. index:: pair_style colloid/gpu +.. index:: pair_style colloid/omp pair_style colloid command ========================== -pair_style colloid/gpu command -============================== - -pair_style colloid/omp command -============================== +Accelerator Variants: *colloid/gpu*, *colloid/omp* Syntax """""" diff --git a/doc/src/pair_comb.rst b/doc/src/pair_comb.rst index 7c733e62da..2e164d46fc 100644 --- a/doc/src/pair_comb.rst +++ b/doc/src/pair_comb.rst @@ -1,10 +1,11 @@ .. index:: pair_style comb +.. index:: pair_style comb/omp +.. index:: pair_style comb3 pair_style comb command ======================= -pair_style comb/omp command -=========================== +Accelerator Variants: *comb/omp* pair_style comb3 command ======================== @@ -129,10 +130,10 @@ For style *comb3*\ , in addition to ffield.comb3, a special parameter file, *lib.comb3*\ , that is exclusively used for C/O/H systems, will be automatically loaded if carbon atom is detected in LAMMPS input structure. This file must be in your working directory or in the -directory pointed to by the environment variable LAMMPS_POTENTIALS, as +directories listed in the environment variable ``LAMMPS_POTENTIALS``, as described on the :doc:`pair_coeff ` command doc page. -Keyword *polar* indicates whether the force field includes +The keyword *polar* indicates whether the force field includes the atomic polarization. Since the equilibration of the polarization has not yet been implemented, it can only set polar_off at present. diff --git a/doc/src/pair_coul.rst b/doc/src/pair_coul.rst index 4874bf044e..4def43647f 100644 --- a/doc/src/pair_coul.rst +++ b/doc/src/pair_coul.rst @@ -1,58 +1,54 @@ .. index:: pair_style coul/cut +.. index:: pair_style coul/cut/gpu +.. index:: pair_style coul/cut/kk +.. index:: pair_style coul/cut/omp +.. index:: pair_style coul/debye +.. index:: pair_style coul/debye/gpu +.. index:: pair_style coul/debye/kk +.. index:: pair_style coul/debye/omp +.. index:: pair_style coul/dsf +.. index:: pair_style coul/dsf/gpu +.. index:: pair_style coul/dsf/kk +.. index:: pair_style coul/dsf/omp +.. index:: pair_style coul/long +.. index:: pair_style coul/long/omp +.. index:: pair_style coul/long/kk +.. index:: pair_style coul/long/gpu +.. index:: pair_style coul/msm +.. index:: pair_style coul/msm/omp +.. index:: pair_style coul/streitz +.. index:: pair_style coul/wolf +.. index:: pair_style coul/wolf/kk +.. index:: pair_style coul/wolf/omp +.. index:: pair_style tip4p/cut +.. index:: pair_style tip4p/cut/omp +.. index:: pair_style tip4p/long +.. index:: pair_style tip4p/long/omp pair_style coul/cut command =========================== -pair_style coul/cut/gpu command -=============================== - -pair_style coul/cut/kk command -============================== - -pair_style coul/cut/omp command -=============================== +Accelerator Variants: *coul/cut/gpu*, *coul/cut/kk*, *coul/cut/omp* pair_style coul/debye command ============================= -pair_style coul/debye/gpu command -================================= - -pair_style coul/debye/kk command -================================ - -pair_style coul/debye/omp command -================================= +Accelerator Variants: *coul/debye/gpu*, *coul/debye/kk*, *coul/debye/omp* pair_style coul/dsf command =========================== -pair_style coul/dsf/gpu command -=============================== - -pair_style coul/dsf/kk command -============================== - -pair_style coul/dsf/omp command -=============================== +Accelerator Variants: *coul/dsf/gpu*, *coul/dsf/kk*, *coul/dsf/omp* pair_style coul/long command ============================ -pair_style coul/long/omp command -================================ - -pair_style coul/long/gpu command -================================ - -pair_style coul/long/kk command -=============================== +Accelerator Variants: *coul/long/omp*, *coul/long/kk*, *coul/long/gpu* pair_style coul/msm command =========================== -pair_style coul/msm/omp command -=============================== +Accelerator Variants: *coul/msm/omp* pair_style coul/streitz command =============================== @@ -60,23 +56,17 @@ pair_style coul/streitz command pair_style coul/wolf command ============================ -pair_style coul/wolf/kk command -=============================== - -pair_style coul/wolf/omp command -================================ +Accelerator Variants: *coul/wolf/kk*, *coul/wolf/omp* pair_style tip4p/cut command ============================ +Accelerator Variants: *tip4p/cut/omp* + pair_style tip4p/long command ============================= -pair_style tip4p/cut/omp command -================================ - -pair_style tip4p/long/omp command -================================= +Accelerator Variants: *tip4p/long/omp* Syntax """""" diff --git a/doc/src/pair_coul_diel.rst b/doc/src/pair_coul_diel.rst index e979ceef31..bcf0c48e4d 100644 --- a/doc/src/pair_coul_diel.rst +++ b/doc/src/pair_coul_diel.rst @@ -1,10 +1,10 @@ .. index:: pair_style coul/diel +.. index:: pair_style coul/diel/omp pair_style coul/diel command ============================ -pair_style coul/diel/omp command -================================ +Accelerator Variants: *coul/diel/omp* Syntax """""" diff --git a/doc/src/pair_coul_slater.rst b/doc/src/pair_coul_slater.rst index cc8e6f243c..a4d8b253b1 100644 --- a/doc/src/pair_coul_slater.rst +++ b/doc/src/pair_coul_slater.rst @@ -1,4 +1,9 @@ .. index:: pair_style coul/slater +.. index:: pair_style coul/slater/cut +.. index:: pair_style coul/slater/long + +pair_style coul/slater command +============================== pair_style coul/slater/cut command ================================== diff --git a/doc/src/pair_cs.rst b/doc/src/pair_cs.rst index 8efd49197d..f41d840216 100644 --- a/doc/src/pair_cs.rst +++ b/doc/src/pair_cs.rst @@ -1,37 +1,44 @@ .. index:: pair_style born/coul/dsf/cs +.. index:: pair_style born/coul/long/cs +.. index:: pair_style born/coul/long/cs/gpu +.. index:: pair_style born/coul/wolf/cs +.. index:: pair_style born/coul/wolf/cs/gpu +.. index:: pair_style buck/coul/long/cs +.. index:: pair_style coul/long/cs +.. index:: pair_style coul/long/cs/gpu +.. index:: pair_style coul/wolf/cs +.. index:: pair_style lj/cut/coul/long/cs +.. index:: pair_style lj/class2/coul/long/cs pair_style born/coul/dsf/cs command -==================================== +=================================== pair_style born/coul/long/cs command -===================================== - -pair_style born/coul/long/cs/gpu command -========================================= - -pair_style born/coul/wolf/cs command -===================================== - -pair_style born/coul/wolf/cs/gpu command -========================================= - -pair_style buck/coul/long/cs command -===================================== - -pair_style coul/long/cs command -================================ - -pair_style coul/long/cs/gpu command ==================================== +Accelerator Variants: *born/coul/long/cs/gpu* + +pair_style born/coul/wolf/cs command +==================================== + +Accelerator Variants: *born/coul/wolf/cs/gpu* + +pair_style buck/coul/long/cs command +==================================== + +pair_style coul/long/cs command +=============================== + +Accelerator Variants: *coul/long/cs/gpu* + pair_style coul/wolf/cs command -================================ +=============================== pair_style lj/cut/coul/long/cs command -======================================= +====================================== pair_style lj/class2/coul/long/cs command -========================================== +========================================= Syntax """""" diff --git a/doc/src/pair_dipole.rst b/doc/src/pair_dipole.rst index 21548be4f0..602c374d9f 100644 --- a/doc/src/pair_dipole.rst +++ b/doc/src/pair_dipole.rst @@ -1,28 +1,27 @@ .. index:: pair_style lj/cut/dipole/cut +.. index:: pair_style lj/cut/dipole/cut/gpu +.. index:: pair_style lj/cut/dipole/cut/omp +.. index:: pair_style lj/sf/dipole/sf +.. index:: pair_style lj/sf/dipole/sf/gpu +.. index:: pair_style lj/sf/dipole/sf/omp +.. index:: pair_style lj/cut/dipole/long +.. index:: pair_style lj/cut/dipole/long/gpu +.. index:: pair_style lj/long/dipole/long pair_style lj/cut/dipole/cut command ==================================== -pair_style lj/cut/dipole/cut/gpu command -======================================== - -pair_style lj/cut/dipole/cut/omp command -======================================== +Accelerator Variants: *lj/cut/dipole/cut/gpu*, *lj/cut/dipole/cut/omp* pair_style lj/sf/dipole/sf command ================================== -pair_style lj/sf/dipole/sf/gpu command -====================================== - -pair_style lj/sf/dipole/sf/omp command -====================================== +Accelerator Variants: *lj/sf/dipole/sf/gpu*, *lj/sf/dipole/sf/omp* pair_style lj/cut/dipole/long command ===================================== -pair_style lj/cut/dipole/long/gpu command -========================================= +Accelerator Variants: *lj/cut/dipole/long/gpu* pair_style lj/long/dipole/long command ====================================== diff --git a/doc/src/pair_dpd.rst b/doc/src/pair_dpd.rst index 94c9fa9bea..d1d84407c4 100644 --- a/doc/src/pair_dpd.rst +++ b/doc/src/pair_dpd.rst @@ -1,25 +1,20 @@ .. index:: pair_style dpd +.. index:: pair_style dpd/gpu +.. index:: pair_style dpd/intel +.. index:: pair_style dpd/omp +.. index:: pair_style dpd/tstat +.. index:: pair_style dpd/tstat/gpu +.. index:: pair_style dpd/tstat/omp pair_style dpd command ====================== -pair_style dpd/gpu command -========================== - -pair_style dpd/intel command -============================ - -pair_style dpd/omp command -========================== +Accelerator Variants: *dpd/gpu*, *dpd/intel*, *dpd/omp* pair_style dpd/tstat command ============================ -pair_style dpd/tstat/gpu command -================================ - -pair_style dpd/tstat/omp command -================================ +Accelerator Variants: *dpd/tstat/gpu*, *dpd/tstat/omp* Syntax """""" diff --git a/doc/src/pair_dpd_fdt.rst b/doc/src/pair_dpd_fdt.rst index e0659a7b78..bb810b0fe6 100644 --- a/doc/src/pair_dpd_fdt.rst +++ b/doc/src/pair_dpd_fdt.rst @@ -1,4 +1,6 @@ .. index:: pair_style dpd/fdt +.. index:: pair_style dpd/fdt/energy +.. index:: pair_style dpd/fdt/energy/kk pair_style dpd/fdt command ========================== @@ -6,8 +8,7 @@ pair_style dpd/fdt command pair_style dpd/fdt/energy command ================================= -pair_style dpd/fdt/energy/kk command -==================================== +Accelerator Variants: *dpd/fdt/energy/kk* Syntax """""" diff --git a/doc/src/pair_eam.rst b/doc/src/pair_eam.rst index c5f9b26435..690b387bad 100644 --- a/doc/src/pair_eam.rst +++ b/doc/src/pair_eam.rst @@ -1,40 +1,33 @@ .. index:: pair_style eam +.. index:: pair_style eam/gpu +.. index:: pair_style eam/intel +.. index:: pair_style eam/kk +.. index:: pair_style eam/omp +.. index:: pair_style eam/opt +.. index:: pair_style eam/alloy +.. index:: pair_style eam/alloy/gpu +.. index:: pair_style eam/alloy/intel +.. index:: pair_style eam/alloy/kk +.. index:: pair_style eam/alloy/omp +.. index:: pair_style eam/alloy/opt +.. index:: pair_style eam/cd +.. index:: pair_style eam/cd/old +.. index:: pair_style eam/fs +.. index:: pair_style eam/fs/gpu +.. index:: pair_style eam/fs/intel +.. index:: pair_style eam/fs/kk +.. index:: pair_style eam/fs/omp +.. index:: pair_style eam/fs/opt pair_style eam command ====================== -pair_style eam/gpu command -========================== - -pair_style eam/intel command -============================ - -pair_style eam/kk command -========================= - -pair_style eam/omp command -========================== - -pair_style eam/opt command -========================== +Accelerator Variants: *eam/gpu*, *eam/intel*, *eam/kk*, *eam/omp*, *eam/opt* pair_style eam/alloy command ============================ -pair_style eam/alloy/gpu command -================================ - -pair_style eam/alloy/intel command -================================== - -pair_style eam/alloy/kk command -=============================== - -pair_style eam/alloy/omp command -================================ - -pair_style eam/alloy/opt command -================================ +Accelerator Variants: *eam/alloy/gpu*, *eam/alloy/intel*, *eam/alloy/kk*, *eam/alloy/omp*, *eam/alloy/opt* pair_style eam/cd command ========================= @@ -45,20 +38,7 @@ pair_style eam/cd/old command pair_style eam/fs command ========================= -pair_style eam/fs/gpu command -============================= - -pair_style eam/fs/intel command -=============================== - -pair_style eam/fs/kk command -============================ - -pair_style eam/fs/omp command -============================= - -pair_style eam/fs/opt command -============================= +Accelerator Variants: *eam/fs/gpu*, *eam/fs/intel*, *eam/fs/kk*, *eam/fs/omp*, *eam/fs/opt* Syntax """""" diff --git a/doc/src/pair_edip.rst b/doc/src/pair_edip.rst index d8e747ddf4..8f8d70f2f6 100644 --- a/doc/src/pair_edip.rst +++ b/doc/src/pair_edip.rst @@ -1,10 +1,11 @@ .. index:: pair_style edip +.. index:: pair_style edip/omp +.. index:: pair_style edip/multi pair_style edip command ======================= -pair_style edip/omp command -=========================== +Accelerator Variants: *edip/omp* pair_style edip/multi command ============================= diff --git a/doc/src/pair_eim.rst b/doc/src/pair_eim.rst index aef7dba3a4..8360dbab64 100644 --- a/doc/src/pair_eim.rst +++ b/doc/src/pair_eim.rst @@ -1,10 +1,10 @@ .. index:: pair_style eim +.. index:: pair_style eim/omp pair_style eim command ====================== -pair_style eim/omp command -========================== +Accelerator Variants: *eim/omp* Syntax """""" diff --git a/doc/src/pair_exp6_rx.rst b/doc/src/pair_exp6_rx.rst index d6fe4850ce..49a4c5436f 100644 --- a/doc/src/pair_exp6_rx.rst +++ b/doc/src/pair_exp6_rx.rst @@ -1,10 +1,10 @@ .. index:: pair_style exp6/rx +.. index:: pair_style exp6/rx/kk pair_style exp6/rx command ========================== -pair_style exp6/rx/kk command -============================= +Accelerator Variants: *exp6/rx/kk* Syntax """""" diff --git a/doc/src/pair_fep_soft.rst b/doc/src/pair_fep_soft.rst index bd38fe1ec9..109ddfdf21 100644 --- a/doc/src/pair_fep_soft.rst +++ b/doc/src/pair_fep_soft.rst @@ -1,64 +1,75 @@ .. index:: pair_style lj/cut/soft +.. index:: pair_style lj/cut/soft/omp +.. index:: pair_style lj/cut/coul/cut/soft +.. index:: pair_style lj/cut/coul/cut/soft/omp +.. index:: pair_style lj/cut/coul/long/soft +.. index:: pair_style lj/cut/coul/long/soft/omp +.. index:: pair_style lj/cut/tip4p/long/soft +.. index:: pair_style lj/cut/tip4p/long/soft/omp +.. index:: pair_style lj/charmm/coul/long/soft +.. index:: pair_style lj/charmm/coul/long/soft/omp +.. index:: pair_style lj/class2/soft +.. index:: pair_style lj/class2/coul/cut/soft +.. index:: pair_style lj/class2/coul/long/soft +.. index:: pair_style coul/cut/soft +.. index:: pair_style coul/cut/soft/omp +.. index:: pair_style coul/long/soft +.. index:: pair_style coul/long/soft/omp +.. index:: pair_style tip4p/long/soft +.. index:: pair_style tip4p/long/soft/omp +.. index:: pair_style morse/soft pair_style lj/cut/soft command ============================== -pair_style lj/cut/soft/omp command -================================== +Accelerator Variants: *lj/cut/soft/omp* pair_style lj/cut/coul/cut/soft command ======================================= -pair_style lj/cut/coul/cut/soft/omp command -=========================================== +Accelerator Variants: *lj/cut/coul/cut/soft/omp* pair_style lj/cut/coul/long/soft command ======================================== -pair_style lj/cut/coul/long/soft/omp command -============================================ +Accelerator Variants: *lj/cut/coul/long/soft/omp* pair_style lj/cut/tip4p/long/soft command -========================================== +========================================= -pair_style lj/cut/tip4p/long/soft/omp command -============================================== +Accelerator Variants: *lj/cut/tip4p/long/soft/omp* pair_style lj/charmm/coul/long/soft command -============================================ - -pair_style lj/charmm/coul/long/soft/omp command -================================================ - -pair_style lj/class2/soft command -================================== - -pair_style lj/class2/coul/cut/soft command =========================================== -pair_style lj/class2/coul/long/soft command -============================================ +Accelerator Variants: *lj/charmm/coul/long/soft/omp* -pair_style coul/cut/soft command +pair_style lj/class2/soft command ================================= -pair_style coul/cut/soft/omp command -===================================== +pair_style lj/class2/coul/cut/soft command +========================================== + +pair_style lj/class2/coul/long/soft command +=========================================== + +pair_style coul/cut/soft command +================================ + +Accelerator Variants: *coul/cut/soft/omp* pair_style coul/long/soft command -================================== +================================= -pair_style coul/long/soft/omp command -====================================== +Accelerator Variants: *coul/long/soft/omp* pair_style tip4p/long/soft command -=================================== +================================== -pair_style tip4p/long/soft/omp command -======================================= +Accelerator Variants: *tip4p/long/soft/omp* pair_style morse/soft command -============================== +============================= Syntax """""" diff --git a/doc/src/pair_gauss.rst b/doc/src/pair_gauss.rst index 8c7ce74174..9b516cce7b 100644 --- a/doc/src/pair_gauss.rst +++ b/doc/src/pair_gauss.rst @@ -1,19 +1,18 @@ .. index:: pair_style gauss +.. index:: pair_style gauss/gpu +.. index:: pair_style gauss/omp +.. index:: pair_style gauss/cut +.. index:: pair_style gauss/cut/omp pair_style gauss command ======================== -pair_style gauss/gpu command -============================ - -pair_style gauss/omp command -============================ +Accelerator Variants: *gauss/gpu*, *gauss/omp* pair_style gauss/cut command ============================ -pair_style gauss/cut/omp command -================================ +Accelerator Variants: *gauss/cut/omp* Syntax """""" diff --git a/doc/src/pair_gayberne.rst b/doc/src/pair_gayberne.rst index 1e8094feef..309e949f97 100644 --- a/doc/src/pair_gayberne.rst +++ b/doc/src/pair_gayberne.rst @@ -1,16 +1,12 @@ .. index:: pair_style gayberne +.. index:: pair_style gayberne/gpu +.. index:: pair_style gayberne/intel +.. index:: pair_style gayberne/omp pair_style gayberne command =========================== -pair_style gayberne/gpu command -=============================== - -pair_style gayberne/intel command -================================= - -pair_style gayberne/omp command -=============================== +Accelerator Variants: *gayberne/gpu*, *gayberne/intel*, *gayberne/omp* Syntax """""" diff --git a/doc/src/pair_gran.rst b/doc/src/pair_gran.rst index 9aacfdfa31..d3f87839e8 100644 --- a/doc/src/pair_gran.rst +++ b/doc/src/pair_gran.rst @@ -1,25 +1,25 @@ .. index:: pair_style gran/hooke +.. index:: pair_style gran/hooke/omp +.. index:: pair_style gran/hooke/history +.. index:: pair_style gran/hooke/history/omp +.. index:: pair_style gran/hooke/history/kk +.. index:: pair_style gran/hertz/history +.. index:: pair_style gran/hertz/history/omp pair_style gran/hooke command ============================= -pair_style gran/hooke/omp command -================================= +Accelerator Variants: *gran/hooke/omp* pair_style gran/hooke/history command ===================================== -pair_style gran/hooke/history/omp command -========================================= - -pair_style gran/hooke/history/kk command -======================================== +Accelerator Variants: *gran/hooke/history/omp*, *gran/hooke/history/kk* pair_style gran/hertz/history command ===================================== -pair_style gran/hertz/history/omp command -========================================= +Accelerator Variants: *gran/hertz/history/omp* Syntax """""" diff --git a/doc/src/pair_gromacs.rst b/doc/src/pair_gromacs.rst index a4c065e24d..88cb4ce880 100644 --- a/doc/src/pair_gromacs.rst +++ b/doc/src/pair_gromacs.rst @@ -1,25 +1,20 @@ .. index:: pair_style lj/gromacs +.. index:: pair_style lj/gromacs/gpu +.. index:: pair_style lj/gromacs/kk +.. index:: pair_style lj/gromacs/omp +.. index:: pair_style lj/gromacs/coul/gromacs +.. index:: pair_style lj/gromacs/coul/gromacs/kk +.. index:: pair_style lj/gromacs/coul/gromacs/omp pair_style lj/gromacs command ============================= -pair_style lj/gromacs/gpu command -================================= - -pair_style lj/gromacs/kk command -================================ - -pair_style lj/gromacs/omp command -================================= +Accelerator Variants: *lj/gromacs/gpu*, *lj/gromacs/kk*, *lj/gromacs/omp* pair_style lj/gromacs/coul/gromacs command ========================================== -pair_style lj/gromacs/coul/gromacs/kk command -============================================= - -pair_style lj/gromacs/coul/gromacs/omp command -============================================== +Accelerator Variants: *lj/gromacs/coul/gromacs/kk*, *lj/gromacs/coul/gromacs/omp* Syntax """""" diff --git a/doc/src/pair_gw.rst b/doc/src/pair_gw.rst index 544d13df9b..d0a7e69b00 100644 --- a/doc/src/pair_gw.rst +++ b/doc/src/pair_gw.rst @@ -1,4 +1,5 @@ .. index:: pair_style gw +.. index:: pair_style gw/zbl pair_style gw command ===================== diff --git a/doc/src/pair_hbond_dreiding.rst b/doc/src/pair_hbond_dreiding.rst index 0d821fa946..5e7183a348 100644 --- a/doc/src/pair_hbond_dreiding.rst +++ b/doc/src/pair_hbond_dreiding.rst @@ -1,16 +1,17 @@ .. index:: pair_style hbond/dreiding/lj +.. index:: pair_style hbond/dreiding/lj/omp +.. index:: pair_style hbond/dreiding/morse +.. index:: pair_style hbond/dreiding/morse/omp pair_style hbond/dreiding/lj command ==================================== -pair_style hbond/dreiding/lj/omp command -======================================== +Accelerator Variants: *hbond/dreiding/lj/omp* pair_style hbond/dreiding/morse command ======================================= -pair_style hbond/dreiding/morse/omp command -=========================================== +Accelerator Variants: *hbond/dreiding/morse/omp* Syntax """""" diff --git a/doc/src/pair_hybrid.rst b/doc/src/pair_hybrid.rst index 924e19a8b3..558c326175 100644 --- a/doc/src/pair_hybrid.rst +++ b/doc/src/pair_hybrid.rst @@ -1,16 +1,17 @@ .. index:: pair_style hybrid +.. index:: pair_style hybrid/kk +.. index:: pair_style hybrid/overlay +.. index:: pair_style hybrid/overlay/kk pair_style hybrid command ========================= -pair_style hybrid/kk command -============================ +Accelerator Variants: *hybrid/kk* pair_style hybrid/overlay command ================================= -pair_style hybrid/overlay/kk command -==================================== +Accelerator Variants: *hybrid/overlay/kk* Syntax """""" diff --git a/doc/src/pair_lj.rst b/doc/src/pair_lj.rst index b8c5be3940..22f0d0dd37 100644 --- a/doc/src/pair_lj.rst +++ b/doc/src/pair_lj.rst @@ -5,7 +5,6 @@ .. index:: pair_style lj/cut/opt .. index:: pair_style lj/cut/omp - pair_style lj/cut command ========================= diff --git a/doc/src/pair_lj96.rst b/doc/src/pair_lj96.rst index 7ea3c2c9c1..3f1172618b 100644 --- a/doc/src/pair_lj96.rst +++ b/doc/src/pair_lj96.rst @@ -1,13 +1,11 @@ .. index:: pair_style lj96/cut +.. index:: pair_style lj96/cut/gpu +.. index:: pair_style lj96/cut/omp pair_style lj96/cut command =========================== -pair_style lj96/cut/gpu command -=============================== - -pair_style lj96/cut/omp command -=============================== +Accelerator Variants: *lj96/cut/gpu*, *lj96/cut/omp* Syntax """""" diff --git a/doc/src/pair_lj_cubic.rst b/doc/src/pair_lj_cubic.rst index 800de20e6f..e220e6e67c 100644 --- a/doc/src/pair_lj_cubic.rst +++ b/doc/src/pair_lj_cubic.rst @@ -1,13 +1,11 @@ .. index:: pair_style lj/cubic +.. index:: pair_style lj/cubic/gpu +.. index:: pair_style lj/cubic/omp pair_style lj/cubic command =========================== -pair_style lj/cubic/gpu command -=============================== - -pair_style lj/cubic/omp command -=============================== +Accelerator Variants: *lj/cubic/gpu*, *lj/cubic/omp* Syntax """""" diff --git a/doc/src/pair_lj_cut_coul.rst b/doc/src/pair_lj_cut_coul.rst index ec34777d8d..f729c2016e 100644 --- a/doc/src/pair_lj_cut_coul.rst +++ b/doc/src/pair_lj_cut_coul.rst @@ -30,7 +30,7 @@ Accelerator Variants: *lj/cut/coul/cut/gpu*, *lj/cut/coul/cut/kk*, *lj/cut/coul/ pair_style lj/cut/coul/debye command ==================================== -Accelerator Variants: *lj/cut/coul/debye/gpu*, lj/cut/coul/debye/kk, *lj/cut/coul/debye/omp* +Accelerator Variants: *lj/cut/coul/debye/gpu*, *lj/cut/coul/debye/kk*, *lj/cut/coul/debye/omp* pair_style lj/cut/coul/dsf command ================================== diff --git a/doc/src/pair_lj_cut_tip4p.rst b/doc/src/pair_lj_cut_tip4p.rst index 14e970a59e..4f55f3b14e 100644 --- a/doc/src/pair_lj_cut_tip4p.rst +++ b/doc/src/pair_lj_cut_tip4p.rst @@ -5,7 +5,6 @@ .. index:: pair_style lj/cut/tip4p/long/omp .. index:: pair_style lj/cut/tip4p/long/opt - pair_style lj/cut/tip4p/cut command =================================== diff --git a/doc/src/pair_lj_expand.rst b/doc/src/pair_lj_expand.rst index 8defbc3635..4d619a67e2 100644 --- a/doc/src/pair_lj_expand.rst +++ b/doc/src/pair_lj_expand.rst @@ -1,22 +1,19 @@ .. index:: pair_style lj/expand +.. index:: pair_style lj/expand/gpu +.. index:: pair_style lj/expand/kk +.. index:: pair_style lj/expand/omp +.. index:: pair_style lj/expand/coul/long +.. index:: pair_style lj/expand/coul/long/gpu pair_style lj/expand command ============================ -pair_style lj/expand/gpu command -================================ - -pair_style lj/expand/kk command -=============================== - -pair_style lj/expand/omp command -================================ +Accelerator Variants: *lj/expand/gpu*, *lj/expand/kk*, *lj/expand/omp* pair_style lj/expand/coul/long command ====================================== -pair_style lj/expand/coul/long/gpu command -========================================== +Accelerator Variants: *lj/expand/coul/long/gpu* Syntax """""" diff --git a/doc/src/pair_lj_long.rst b/doc/src/pair_lj_long.rst index ff6d834ad6..3609d093d9 100644 --- a/doc/src/pair_lj_long.rst +++ b/doc/src/pair_lj_long.rst @@ -1,22 +1,19 @@ .. index:: pair_style lj/long/coul/long +.. index:: pair_style lj/long/coul/long/intel +.. index:: pair_style lj/long/coul/long/omp +.. index:: pair_style lj/long/coul/long/opt +.. index:: pair_style lj/long/tip4p/long +.. index:: pair_style lj/long/tip4p/long/omp pair_style lj/long/coul/long command ==================================== -pair_style lj/long/coul/long/intel command -========================================== - -pair_style lj/long/coul/long/omp command -======================================== - -pair_style lj/long/coul/long/opt command -======================================== +Accelerator Variants: *lj/long/coul/long/intel*, *lj/long/coul/long/omp*, *lj/long/coul/long/opt* pair_style lj/long/tip4p/long command ===================================== -pair_style lj/long/tip4p/long/omp command -========================================= +Accelerator Variants: *lj/long/tip4p/long/omp* Syntax """""" diff --git a/doc/src/pair_lj_smooth.rst b/doc/src/pair_lj_smooth.rst index 3137a17f73..7ba12c89ba 100644 --- a/doc/src/pair_lj_smooth.rst +++ b/doc/src/pair_lj_smooth.rst @@ -1,10 +1,10 @@ .. index:: pair_style lj/smooth +.. index:: pair_style lj/smooth/omp pair_style lj/smooth command ============================ -pair_style lj/smooth/omp command -================================ +Accelerator Variants: *lj/smooth/omp* Syntax """""" diff --git a/doc/src/pair_lj_smooth_linear.rst b/doc/src/pair_lj_smooth_linear.rst index 833a4f035d..b105fc4911 100644 --- a/doc/src/pair_lj_smooth_linear.rst +++ b/doc/src/pair_lj_smooth_linear.rst @@ -1,10 +1,10 @@ .. index:: pair_style lj/smooth/linear +.. index:: pair_style lj/smooth/linear/omp pair_style lj/smooth/linear command =================================== -pair_style lj/smooth/linear/omp command -======================================= +Accelerator Variants: *lj/smooth/linear/omp* Syntax """""" diff --git a/doc/src/pair_lubricate.rst b/doc/src/pair_lubricate.rst index 711f2576b3..e83a16c80b 100644 --- a/doc/src/pair_lubricate.rst +++ b/doc/src/pair_lubricate.rst @@ -1,16 +1,17 @@ .. index:: pair_style lubricate +.. index:: pair_style lubricate/omp +.. index:: pair_style lubricate/poly +.. index:: pair_style lubricate/poly/omp pair_style lubricate command ============================ -pair_style lubricate/omp command -================================ +Accelerator Variants: *lubricate/omp* pair_style lubricate/poly command ================================= -pair_style lubricate/poly/omp command -===================================== +Accelerator Variants: *lubricate/poly/omp* Syntax """""" diff --git a/doc/src/pair_lubricateU.rst b/doc/src/pair_lubricateU.rst index f4224ede47..a9382556c5 100644 --- a/doc/src/pair_lubricateU.rst +++ b/doc/src/pair_lubricateU.rst @@ -1,4 +1,5 @@ .. index:: pair_style lubricateU +.. index:: pair_style lubricateU/poly pair_style lubricateU command ============================= diff --git a/doc/src/pair_mdf.rst b/doc/src/pair_mdf.rst index 1b46c51220..84d312e47c 100644 --- a/doc/src/pair_mdf.rst +++ b/doc/src/pair_mdf.rst @@ -1,4 +1,6 @@ .. index:: pair_style lj/mdf +.. index:: pair_style buck/mdf +.. index:: pair_style lennard/mdf pair_style lj/mdf command ========================= diff --git a/doc/src/pair_meam_spline.rst b/doc/src/pair_meam_spline.rst index bbba66c2b5..b5c94385fa 100644 --- a/doc/src/pair_meam_spline.rst +++ b/doc/src/pair_meam_spline.rst @@ -1,10 +1,10 @@ .. index:: pair_style meam/spline +.. index:: pair_style meam/spline/omp pair_style meam/spline command ============================== -pair_style meam/spline/omp command -================================== +Accelerator Variants: *meam/spline/omp* Syntax """""" diff --git a/doc/src/pair_mesodpd.rst b/doc/src/pair_mesodpd.rst index 093eb707ad..1efdfa8b45 100644 --- a/doc/src/pair_mesodpd.rst +++ b/doc/src/pair_mesodpd.rst @@ -1,4 +1,7 @@ .. index:: pair_style edpd +.. index:: pair_style mdpd +.. index:: pair_style mdpd/rhosum +.. index:: pair_style tdpd pair_style edpd command ======================= diff --git a/doc/src/pair_mesont_tpm.rst b/doc/src/pair_mesont_tpm.rst index f5b5789315..e26f16fba3 100644 --- a/doc/src/pair_mesont_tpm.rst +++ b/doc/src/pair_mesont_tpm.rst @@ -1,7 +1,7 @@ .. index:: pair_style mesont/tpm pair_style mesont/tpm command -============================== +============================= Syntax """""" diff --git a/doc/src/pair_mie.rst b/doc/src/pair_mie.rst index 469817ee5e..e1a34893c9 100644 --- a/doc/src/pair_mie.rst +++ b/doc/src/pair_mie.rst @@ -1,10 +1,10 @@ .. index:: pair_style mie/cut +.. index:: pair_style mie/cut/gpu pair_style mie/cut command ========================== -pair_style mie/cut/gpu command -============================== +Accelerator Variants: *mie/cut/gpu* Syntax """""" diff --git a/doc/src/pair_mm3_switch3_coulgauss_long.rst b/doc/src/pair_mm3_switch3_coulgauss_long.rst index 2b7e9cb903..798df0bf7a 100644 --- a/doc/src/pair_mm3_switch3_coulgauss_long.rst +++ b/doc/src/pair_mm3_switch3_coulgauss_long.rst @@ -1,7 +1,7 @@ .. index:: pair_style mm3/switch3/coulgauss/long pair_style mm3/switch3/coulgauss/long command -============================================== +============================================= Syntax """""" diff --git a/doc/src/pair_morse.rst b/doc/src/pair_morse.rst index 1c8e731bc1..5ede37a916 100644 --- a/doc/src/pair_morse.rst +++ b/doc/src/pair_morse.rst @@ -1,25 +1,20 @@ .. index:: pair_style morse +.. index:: pair_style morse/gpu +.. index:: pair_style morse/omp +.. index:: pair_style morse/opt +.. index:: pair_style morse/smooth/linear +.. index:: pair_style morse/smooth/linear/omp +.. index:: pair_style morse/kk pair_style morse command ======================== -pair_style morse/gpu command -============================ - -pair_style morse/omp command -============================ - -pair_style morse/opt command -============================ +Accelerator Variants: *morse/gpu*, *morse/omp*, *morse/opt*, *morse/kk* pair_style morse/smooth/linear command ====================================== -pair_style morse/smooth/linear/omp command -========================================== - -pair_style morse/kk command -=========================== +Accelerator Variants: *morse/smooth/linear/omp* Syntax """""" diff --git a/doc/src/pair_multi_lucy_rx.rst b/doc/src/pair_multi_lucy_rx.rst index 42a2525195..f6e6652271 100644 --- a/doc/src/pair_multi_lucy_rx.rst +++ b/doc/src/pair_multi_lucy_rx.rst @@ -1,10 +1,10 @@ .. index:: pair_style multi/lucy/rx +.. index:: pair_style multi/lucy/rx/kk pair_style multi/lucy/rx command ================================ -pair_style multi/lucy/rx/kk command -=================================== +Accelerator Variants: *multi/lucy/rx/kk* Syntax """""" diff --git a/doc/src/pair_nm.rst b/doc/src/pair_nm.rst index 7d7648cdc9..d38e21fd15 100644 --- a/doc/src/pair_nm.rst +++ b/doc/src/pair_nm.rst @@ -1,22 +1,24 @@ .. index:: pair_style nm/cut +.. index:: pair_style nm/cut/coul/cut +.. index:: pair_style nm/cut/coul/long +.. index:: pair_style nm/cut/omp +.. index:: pair_style nm/cut/coul/cut/omp +.. index:: pair_style nm/cut/coul/long/omp pair_style nm/cut command ========================= +Accelerator Variants: *nm/cut/omp* + pair_style nm/cut/coul/cut command ================================== +Accelerator Variants: *nm/cut/coul/cut/omp* + pair_style nm/cut/coul/long command =================================== -pair_style nm/cut/omp command -============================= - -pair_style nm/cut/coul/cut/omp command -====================================== - -pair_style nm/cut/coul/long/omp command -======================================= +Accelerator Variants: *nm/cut/coul/long/omp* Syntax """""" diff --git a/doc/src/pair_oxdna.rst b/doc/src/pair_oxdna.rst index c16e872ccf..4cc57868b4 100644 --- a/doc/src/pair_oxdna.rst +++ b/doc/src/pair_oxdna.rst @@ -1,4 +1,8 @@ .. index:: pair_style oxdna/excv +.. index:: pair_style oxdna/stk +.. index:: pair_style oxdna/hbond +.. index:: pair_style oxdna/xstk +.. index:: pair_style oxdna/coaxstk pair_style oxdna/excv command ============================= diff --git a/doc/src/pair_oxdna2.rst b/doc/src/pair_oxdna2.rst index f63bec6a7f..ee01f2f488 100644 --- a/doc/src/pair_oxdna2.rst +++ b/doc/src/pair_oxdna2.rst @@ -1,4 +1,9 @@ .. index:: pair_style oxdna2/excv +.. index:: pair_style oxdna2/stk +.. index:: pair_style oxdna2/hbond +.. index:: pair_style oxdna2/xstk +.. index:: pair_style oxdna2/coaxstk +.. index:: pair_style oxdna2/dh pair_style oxdna2/excv command ============================== diff --git a/doc/src/pair_oxrna2.rst b/doc/src/pair_oxrna2.rst index 05fd27b4a0..831e4d9c4e 100644 --- a/doc/src/pair_oxrna2.rst +++ b/doc/src/pair_oxrna2.rst @@ -1,4 +1,9 @@ .. index:: pair_style oxrna2/excv +.. index:: pair_style oxrna2/stk +.. index:: pair_style oxrna2/hbond +.. index:: pair_style oxrna2/xstk +.. index:: pair_style oxrna2/coaxstk +.. index:: pair_style oxrna2/dh pair_style oxrna2/excv command ============================== diff --git a/doc/src/pair_peri.rst b/doc/src/pair_peri.rst index f66705d913..2a1c7f6aa5 100644 --- a/doc/src/pair_peri.rst +++ b/doc/src/pair_peri.rst @@ -1,16 +1,19 @@ .. index:: pair_style peri/pmb +.. index:: pair_style peri/pmb/omp +.. index:: pair_style peri/lps +.. index:: pair_style peri/lps/omp +.. index:: pair_style peri/ves +.. index:: pair_style peri/eps pair_style peri/pmb command =========================== -pair_style peri/pmb/omp command -=============================== +Accelerator Variants: *peri/pmb/omp* pair_style peri/lps command =========================== -pair_style peri/lps/omp command -=============================== +Accelerator Variants: *peri/lps/omp* pair_style peri/ves command =========================== @@ -128,7 +131,7 @@ viscoelastic relaxation parameter and time constant, respectively. m_lambdai varies within zero to one. For very small values of m_lambdai the viscoelastic model responds very similar to a linear elastic model. For details please see the description in -"(Mtchell2011)". +"(Mitchell2011)". For the *peri/eps* style: @@ -142,7 +145,7 @@ For the *peri/eps* style: K is the bulk modulus and G is the shear modulus. The horizon is a cutoff distance and s00 and :math:`\alpha` are used as a bond breaking criteria. m_yield_stress is the yield stress of the material. For -details please see the description in "(Mtchell2011a)". +details please see the description in "(Mitchell2011a)". ---------- diff --git a/doc/src/pair_python.rst b/doc/src/pair_python.rst index 9ec24b47fa..99b8ebd766 100644 --- a/doc/src/pair_python.rst +++ b/doc/src/pair_python.rst @@ -38,12 +38,12 @@ corresponding compiled code. This penalty can be significantly reduced through generating tabulations from the python code through the :doc:`pair_write ` command, which is supported by this style. -Only a single pair_coeff command is used with the *python* pair style -which specifies a python class inside a python module or file that -LAMMPS will look up in the current directory, the folder pointed to by -the LAMMPS_POTENTIALS environment variable or somewhere in your python -path. A single python module can hold multiple python pair class -definitions. The class definitions itself have to follow specific +Only a single :doc:`pair_coeff ` command is used with the +*python* pair style which specifies a python class inside a python module +or a file that LAMMPS will look up in the current directory, a folder +pointed to by the ``LAMMPS_POTENTIALS`` environment variable or somewhere +in your python path. A single python module can hold multiple python pair +class definitions. The class definitions itself have to follow specific rules that are explained below. Atom types in the python class are specified through symbolic diff --git a/doc/src/pair_reaxc.rst b/doc/src/pair_reaxc.rst index 4d4368729e..13ff16d4d3 100644 --- a/doc/src/pair_reaxc.rst +++ b/doc/src/pair_reaxc.rst @@ -1,13 +1,11 @@ .. index:: pair_style reax/c +.. index:: pair_style reax/c/kk +.. index:: pair_style reax/c/omp pair_style reax/c command ========================= -pair_style reax/c/kk command -============================ - -pair_style reax/c/omp command -============================= +Accelerator Variants: *reax/c/kk*, *reax/c/omp* Syntax """""" diff --git a/doc/src/pair_resquared.rst b/doc/src/pair_resquared.rst index 33b40f6776..448af410db 100644 --- a/doc/src/pair_resquared.rst +++ b/doc/src/pair_resquared.rst @@ -1,13 +1,11 @@ .. index:: pair_style resquared +.. index:: pair_style resquared/gpu +.. index:: pair_style resquared/omp pair_style resquared command ============================ -pair_style resquared/gpu command -================================ - -pair_style resquared/omp command -================================ +Accelerator Variants: *resquared/gpu*, *resquared/omp* Syntax """""" diff --git a/doc/src/pair_sdk.rst b/doc/src/pair_sdk.rst index 501ce6cd85..541c53d37e 100644 --- a/doc/src/pair_sdk.rst +++ b/doc/src/pair_sdk.rst @@ -1,31 +1,27 @@ .. index:: pair_style lj/sdk +.. index:: pair_style lj/sdk/gpu +.. index:: pair_style lj/sdk/kk +.. index:: pair_style lj/sdk/omp +.. index:: pair_style lj/sdk/coul/long +.. index:: pair_style lj/sdk/coul/long/gpu +.. index:: pair_style lj/sdk/coul/long/omp +.. index:: pair_style lj/sdk/coul/msm +.. index:: pair_style lj/sdk/coul/msm/omp pair_style lj/sdk command ========================= -pair_style lj/sdk/gpu command -============================= - -pair_style lj/sdk/kk command -============================ - -pair_style lj/sdk/omp command -============================= +Accelerator Variants: *lj/sdk/gpu*, *lj/sdk/kk*, *lj/sdk/omp* pair_style lj/sdk/coul/long command =================================== -pair_style lj/sdk/coul/long/gpu command -======================================= - -pair_style lj/sdk/coul/long/omp command -======================================= +Accelerator Variants: *lj/sdk/coul/long/gpu*, *lj/sdk/coul/long/omp* pair_style lj/sdk/coul/msm command ================================== -pair_style lj/sdk/coul/msm/omp command -====================================== +Accelerator Variants: *lj/sdk/coul/msm/omp* Syntax """""" diff --git a/doc/src/pair_smd_triangulated_surface.rst b/doc/src/pair_smd_triangulated_surface.rst index 9dbd66dcd8..1e33254865 100644 --- a/doc/src/pair_smd_triangulated_surface.rst +++ b/doc/src/pair_smd_triangulated_surface.rst @@ -1,7 +1,7 @@ .. index:: pair_style smd/tri_surface pair_style smd/tri_surface command -=================================== +================================== Syntax """""" diff --git a/doc/src/pair_smd_ulsph.rst b/doc/src/pair_smd_ulsph.rst index 6b3ee7f019..33946d4649 100644 --- a/doc/src/pair_smd_ulsph.rst +++ b/doc/src/pair_smd_ulsph.rst @@ -1,7 +1,7 @@ .. index:: pair_style smd/ulsph pair_style smd/ulsph command -============================= +============================ Syntax """""" diff --git a/doc/src/pair_snap.rst b/doc/src/pair_snap.rst index 2ba2a9dd58..8aa10f5986 100644 --- a/doc/src/pair_snap.rst +++ b/doc/src/pair_snap.rst @@ -1,10 +1,10 @@ .. index:: pair_style snap +.. index:: pair_style snap/kk pair_style snap command ======================= -pair_style snap/kk command -========================== +Accelerator Variants: *snap/kk* Syntax """""" diff --git a/doc/src/pair_soft.rst b/doc/src/pair_soft.rst index 294868f872..cc024cb6dd 100644 --- a/doc/src/pair_soft.rst +++ b/doc/src/pair_soft.rst @@ -1,13 +1,11 @@ .. index:: pair_style soft +.. index:: pair_style soft/gpu +.. index:: pair_style soft/omp pair_style soft command ======================= -pair_style soft/gpu command -=========================== - -pair_style soft/omp command -=========================== +Accelerator Variants: *soft/gpu*, *soft/omp* Syntax """""" diff --git a/doc/src/pair_spin_dipole.rst b/doc/src/pair_spin_dipole.rst index c86083f1e5..d1bbf3b699 100644 --- a/doc/src/pair_spin_dipole.rst +++ b/doc/src/pair_spin_dipole.rst @@ -1,4 +1,5 @@ .. index:: pair_style spin/dipole/cut +.. index:: pair_style spin/dipole/long pair_style spin/dipole/cut command ================================== diff --git a/doc/src/pair_spin_magelec.rst b/doc/src/pair_spin_magelec.rst index 5ef01ad10c..1860ed4677 100644 --- a/doc/src/pair_spin_magelec.rst +++ b/doc/src/pair_spin_magelec.rst @@ -1,7 +1,7 @@ .. index:: pair_style spin/magelec pair_style spin/magelec command -================================ +=============================== Syntax """""" diff --git a/doc/src/pair_sw.rst b/doc/src/pair_sw.rst index b673f652aa..bea417ed3d 100644 --- a/doc/src/pair_sw.rst +++ b/doc/src/pair_sw.rst @@ -1,19 +1,13 @@ .. index:: pair_style sw +.. index:: pair_style sw/gpu +.. index:: pair_style sw/intel +.. index:: pair_style sw/kk +.. index:: pair_style sw/omp pair_style sw command ===================== -pair_style sw/gpu command -========================= - -pair_style sw/intel command -=========================== - -pair_style sw/kk command -======================== - -pair_style sw/omp command -========================= +Accelerator Variants: *sw/gpu*, *sw/intel*, *sw/kk*, *sw/omp* Syntax """""" diff --git a/doc/src/pair_table.rst b/doc/src/pair_table.rst index 1a35cea7fd..39ed690551 100644 --- a/doc/src/pair_table.rst +++ b/doc/src/pair_table.rst @@ -1,16 +1,12 @@ .. index:: pair_style table +.. index:: pair_style table/gpu +.. index:: pair_style table/kk +.. index:: pair_style table/omp pair_style table command ======================== -pair_style table/gpu command -============================ - -pair_style table/kk command -=========================== - -pair_style table/omp command -============================ +Accelerator Variants: *table/gpu*, *table/kk*, *table/omp* Syntax """""" diff --git a/doc/src/pair_table_rx.rst b/doc/src/pair_table_rx.rst index 5545da22ef..9d23a479a3 100644 --- a/doc/src/pair_table_rx.rst +++ b/doc/src/pair_table_rx.rst @@ -1,10 +1,10 @@ .. index:: pair_style table/rx +.. index:: pair_style table/rx/kk pair_style table/rx command =========================== -pair_style table/rx/kk command -============================== +Accelerator Variants: *table/rx/kk* Syntax """""" diff --git a/doc/src/pair_tersoff.rst b/doc/src/pair_tersoff.rst index 251e12c87a..d9e5d60cd9 100644 --- a/doc/src/pair_tersoff.rst +++ b/doc/src/pair_tersoff.rst @@ -1,25 +1,20 @@ .. index:: pair_style tersoff +.. index:: pair_style tersoff/table +.. index:: pair_style tersoff/gpu +.. index:: pair_style tersoff/intel +.. index:: pair_style tersoff/kk +.. index:: pair_style tersoff/omp +.. index:: pair_style tersoff/table/omp pair_style tersoff command ========================== +Accelerator Variants: *tersoff/gpu*, *tersoff/intel*, *tersoff/kk*, *tersoff/omp* + pair_style tersoff/table command ================================ -pair_style tersoff/gpu command -============================== - -pair_style tersoff/intel command -================================ - -pair_style tersoff/kk command -============================= - -pair_style tersoff/omp command -============================== - -pair_style tersoff/table/omp command -==================================== +Accelerator Variants: *tersoff/table/omp* Syntax """""" diff --git a/doc/src/pair_tersoff_mod.rst b/doc/src/pair_tersoff_mod.rst index 0426e65f14..7457541c18 100644 --- a/doc/src/pair_tersoff_mod.rst +++ b/doc/src/pair_tersoff_mod.rst @@ -1,22 +1,19 @@ .. index:: pair_style tersoff/mod +.. index:: pair_style tersoff/mod/c +.. index:: pair_style tersoff/mod/gpu +.. index:: pair_style tersoff/mod/kk +.. index:: pair_style tersoff/mod/omp +.. index:: pair_style tersoff/mod/c/omp pair_style tersoff/mod command ============================== +Accelerator Variants: *tersoff/mod/gpu*, *tersoff/mod/kk*, *tersoff/mod/omp* + pair_style tersoff/mod/c command ================================ -pair_style tersoff/mod/gpu command -================================== - -pair_style tersoff/mod/kk command -================================= - -pair_style tersoff/mod/omp command -================================== - -pair_style tersoff/mod/c/omp command -==================================== +Accelerator Variants: *tersoff/mod/c/omp* Syntax """""" diff --git a/doc/src/pair_tersoff_zbl.rst b/doc/src/pair_tersoff_zbl.rst index eff394d9a0..19e77ce8eb 100644 --- a/doc/src/pair_tersoff_zbl.rst +++ b/doc/src/pair_tersoff_zbl.rst @@ -1,16 +1,12 @@ .. index:: pair_style tersoff/zbl +.. index:: pair_style tersoff/zbl/gpu +.. index:: pair_style tersoff/zbl/kk +.. index:: pair_style tersoff/zbl/omp pair_style tersoff/zbl command ============================== -pair_style tersoff/zbl/gpu command -================================== - -pair_style tersoff/zbl/kk command -================================= - -pair_style tersoff/zbl/omp command -================================== +Accelerator Variants: *tersoff/zbl/gpu*, *tersoff/zbl/kk*, *tersoff/zbl/omp* Syntax """""" diff --git a/doc/src/pair_thole.rst b/doc/src/pair_thole.rst index 9b05e06cee..a8cf8ee044 100644 --- a/doc/src/pair_thole.rst +++ b/doc/src/pair_thole.rst @@ -1,4 +1,6 @@ .. index:: pair_style thole +.. index:: pair_style lj/cut/thole/long +.. index:: pair_style lj/cut/thole/long/omp pair_style thole command ======================== @@ -6,8 +8,7 @@ pair_style thole command pair_style lj/cut/thole/long command ==================================== -pair_style lj/cut/thole/long/omp command -======================================== +Accelerator Variants: *lj/cut/thole/long/omp* Syntax """""" diff --git a/doc/src/pair_ufm.rst b/doc/src/pair_ufm.rst index d9b08aaea2..140bb75ee7 100644 --- a/doc/src/pair_ufm.rst +++ b/doc/src/pair_ufm.rst @@ -1,16 +1,12 @@ .. index:: pair_style ufm +.. index:: pair_style ufm/gpu +.. index:: pair_style ufm/omp +.. index:: pair_style ufm/opt pair_style ufm command ====================== -pair_style ufm/gpu command -========================== - -pair_style ufm/omp command -========================== - -pair_style ufm/opt command -========================== +Accelerator Variants: *ufm/gpu*, *ufm/omp*, *ufm/opt* Syntax """""" diff --git a/doc/src/pair_vashishta.rst b/doc/src/pair_vashishta.rst index 0ad6cc3521..aef401ec7c 100644 --- a/doc/src/pair_vashishta.rst +++ b/doc/src/pair_vashishta.rst @@ -1,22 +1,19 @@ .. index:: pair_style vashishta +.. index:: pair_style vashishta/gpu +.. index:: pair_style vashishta/omp +.. index:: pair_style vashishta/kk +.. index:: pair_style vashishta/table +.. index:: pair_style vashishta/table/omp pair_style vashishta command ============================ -pair_style vashishta/gpu command -================================ - -pair_style vashishta/omp command -================================ - -pair_style vashishta/kk command -=============================== +Accelerator Variants: *vashishta/gpu*, *vashishta/omp*, *vashishta/kk* pair_style vashishta/table command ================================== -pair_style vashishta/table/omp command -====================================== +Accelerator Variants: *vashishta/table/omp* Syntax """""" diff --git a/doc/src/pair_yukawa.rst b/doc/src/pair_yukawa.rst index 079c19c3fd..057adbd60f 100644 --- a/doc/src/pair_yukawa.rst +++ b/doc/src/pair_yukawa.rst @@ -1,16 +1,12 @@ .. index:: pair_style yukawa +.. index:: pair_style yukawa/gpu +.. index:: pair_style yukawa/omp +.. index:: pair_style yukawa/kk pair_style yukawa command ========================= -pair_style yukawa/gpu command -============================= - -pair_style yukawa/omp command -============================= - -pair_style yukawa/kk command -============================ +Accelerator Variants: *yukawa/gpu*, *yukawa/omp*, *yukawa/kk* Syntax """""" diff --git a/doc/src/pair_yukawa_colloid.rst b/doc/src/pair_yukawa_colloid.rst index 78977118a1..4d21d8e8c3 100644 --- a/doc/src/pair_yukawa_colloid.rst +++ b/doc/src/pair_yukawa_colloid.rst @@ -1,13 +1,11 @@ .. index:: pair_style yukawa/colloid +.. index:: pair_style yukawa/colloid/gpu +.. index:: pair_style yukawa/colloid/omp pair_style yukawa/colloid command ================================= -pair_style yukawa/colloid/gpu command -===================================== - -pair_style yukawa/colloid/omp command -===================================== +Accelerator Variants: *yukawa/colloid/gpu*, *yukawa/colloid/omp* Syntax """""" diff --git a/doc/src/pair_zbl.rst b/doc/src/pair_zbl.rst index 5c25697484..e01cbf45f2 100644 --- a/doc/src/pair_zbl.rst +++ b/doc/src/pair_zbl.rst @@ -1,16 +1,12 @@ .. index:: pair_style zbl +.. index:: pair_style zbl/gpu +.. index:: pair_style zbl/kk +.. index:: pair_style zbl/omp pair_style zbl command ====================== -pair_style zbl/gpu command -========================== - -pair_style zbl/kk command -========================= - -pair_style zbl/omp command -========================== +Accelerator Variants: *zbl/gpu*, *zbl/kk*, *zbl/omp* Syntax """""" diff --git a/doc/src/pg_atom.rst b/doc/src/pg_atom.rst new file mode 100644 index 0000000000..f9cbf63322 --- /dev/null +++ b/doc/src/pg_atom.rst @@ -0,0 +1,9 @@ +LAMMPS Atom and AtomVec Base Classes +************************************ + +.. doxygenclass:: LAMMPS_NS::Atom + :project: progguide + :members: + + + diff --git a/doc/src/pg_cplusplus.rst b/doc/src/pg_cplusplus.rst new file mode 100644 index 0000000000..2a7028b0f8 --- /dev/null +++ b/doc/src/pg_cplusplus.rst @@ -0,0 +1,91 @@ +Using the C++ API directly +************************** + +Using the C++ classes of the LAMMPS library is lacking some of the +convenience of the C library API, but it allows a more direct access to +simulation data and thus more low-level manipulations and tighter +integration of LAMMPS into another code. While for the complete C +library API is provided in the ``library.h`` header file, for using +the C++ API it is required to include the individual header files +defining the individual classes in use. Typically the name of the +class and the name of the header follow some simple rule. Examples +are given below. + + +Creating or deleting a LAMMPS object +************************************* + +When using the LAMMPS library interfaces, the core task is to create an +instance of the :cpp:class:`LAMMPS_NS::LAMMPS` class. In C++ this can +be done directly through the ``new`` operator. All further operations +are then initiated through calling member functions of some of the +components of the LAMMPS class or accessing their data members. The +destruction of the LAMMPS instance is correspondingly initiated by using +the ``delete`` operator. Here is a simple example: + +.. code-block:: c++ + + #include "lammps.h" + #include "universe.h" + + #include + #include + + int main(int argc, char **argv) + { + LAMMPS_NS::LAMMPS *lmp; + // custom argument vector for LAMMPS library + const char *lmpargv[] {"liblammps", "-log", "none"}; + int lmpargc = sizeof(lmpargv)/sizeof(const char *); + + // explicitly initialize MPI + MPI_Init(&argc, &argv); + + // create LAMMPS instance + lmp = new LAMMPS_NS::LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD); + // output numerical version string + std::cout << "LAMMPS version: " << lmp->universe->num_ver << std::endl; + // delete LAMMPS instance + delete lmp; + + // stop MPI environment + MPI_Finalize(); + return 0; + } + +Please note that this requires to include the ``lammps.h`` header for accessing +the members of the LAMMPS class and then the ``universe.h`` header for accessing the ``num_ver`` member of the :cpp:class:`Universe` class. + + +Executing LAMMPS commands +************************* + +Once a LAMMPS instance is created by your C++ code, you need to set up a +simulation and that is most conveniently done by "driving" it through +issuing commands like you would do when running a LAMMPS simulation from +an input script. Processing of input in LAMMPS is handled by the +:cpp:class:`Input ` class an instance of which is a +member of the :cpp:class:`LAMMPS ` class. You have +two options: reading commands from a file, or executing a single +command from a string. See below for a small example: + +.. code-block:: c++ + + #include "lammps.h" + #include "input.h" + #include + + using namespace LAMMPS_NS; + + int main(int argc, char **argv) + { + const char *lmpargv[] {"liblammps", "-log", "none"}; + int lmpargc = sizeof(lmpargv)/sizeof(const char *); + + MPI_Init(&argc, &argv); + LAMMPS *lmp = new LAMMPS(lmpargc, (char **)lmpargv, MPI_COMM_WORLD); + lmp->input->file("in.melt"); + lmp->input->one("run 100 post no"); + delete lmp; + return 0; + } diff --git a/doc/src/pg_dev_classes.rst b/doc/src/pg_dev_classes.rst new file mode 100644 index 0000000000..78e1dabcd1 --- /dev/null +++ b/doc/src/pg_dev_classes.rst @@ -0,0 +1,38 @@ +LAMMPS C++ base classes +======================= + +LAMMPS is designed to be used as a C++ class library where one can set +up and drive a simulation through creating a class instance and then +calling some abstract operations or commands on that class or its member +class instances. These are interfaced to the :doc:`C library API +`, which providing an additional level of abstraction +simplification for common operations. The C API is also the basis for +calling LAMMPS from Python or Fortran. + +When used from a C++ program, most of the symbols and functions in +LAMMPS are wrapped into the ``LAMMPS_NS`` namespace so they will not +collide with your own classes or other libraries. This, however, does +not extend to the additional libraries bundled with LAMMPS in the lib +folder and some of the low-level code of some packages. + +Behind the scenes this is implemented through inheritance and +polymorphism where base classes define the abstract interface and +derived classes provide the specialized implementation for specific +models or optimizations or ports to accelerator platforms. This +document will provide an outline of the fundamental class hierarchy and +some selected examples for derived classes of specific models. + +.. note:: + + Please see the :ref:`note about thread-safety ` + in the library Howto doc page. + +----------------------------------- + +.. toctree:: + :caption: Individual Base Classes + :name: lammpsbase + + pg_lammps + pg_atom + pg_input diff --git a/doc/src/pg_dev_flow.rst b/doc/src/pg_dev_flow.rst new file mode 100644 index 0000000000..729044206e --- /dev/null +++ b/doc/src/pg_dev_flow.rst @@ -0,0 +1,236 @@ +How a timestep works +==================== + +The first and most fundamental operation within LAMMPS to understand is +how a timestep is structured. Timestepping is performed by calling +methods of the Integrate class instance within the Update class. Since +Integrate is a base class, it will point to an instance of a derived +class corresponding to what is selected by the :doc:`run_style +` input script command. + +In this section, the timestep implemented by the Verlet class is +described. A similar timestep protocol is implemented by the Respa +class, for the r-RESPA hierarchical timestepping method. + +The Min base class performs energy minimization, so does not perform a +literal timestep. But it has logic similar to what is described here, +to compute forces and invoke fixes at each iteration of a minimization. +Differences between time integration and minimization are highlighted at +the end of this section. + +The Verlet class is encoded in the ``src/verlet.cpp`` and ``verlet.h`` +files. It implements the velocity-Verlet timestepping algorithm. The +workhorse method is ``Verlet::run()``, but first we highlight several +other methods in the class. + +- The ``init()`` method is called at the beginning of each dynamics + run. It simply sets some internal flags, based on user settings in + other parts of the code. + +- The ``setup()`` or ``setup_minimal()`` methods are also called before + each run. The velocity-Verlet method requires current forces be + calculated before the first timestep, so these routines compute + forces due to all atomic interactions, using the same logic that + appears in the timestepping described next. A few fixes are also + invoked, using the mechanism described in the next section. Various + counters are also initialized before the run begins. The + ``setup_minimal()`` method is a variant that has a flag for performing + less setup. This is used when runs are continued and information + from the previous run is still valid. For example, if repeated + short LAMMPS runs are being invoked, interleaved by other commands, + via the *pre no* and *every* options of the run command, the + ``setup_minimal()`` method is used. + +- The ``force_clear()`` method initializes force and other arrays to + zero before each timestep, so that forces (torques, etc) can be + accumulated. + +Now for the ``Verlet::run()`` method. Its basic structure in hi-level pseudo +code is shown below. In the actual code in ``src/verlet.cpp`` some of +these operations are conditionally invoked. + +.. code-block:: python + + loop over N timesteps: + if timeout condition: break + ev_set() + + fix->initial_integrate() + fix->post_integrate() + + nflag = neighbor->decide() + if nflag: + fix->pre_exchange() + domain->pbc() + domain->reset_box() + comm->setup() + neighbor->setup_bins() + comm->exchange() + comm->borders() + fix->pre_neighbor() + neighbor->build() + fix->post_neighbor() + else: + comm->forward_comm() + + force_clear() + fix->pre_force() + + pair->compute() + bond->compute() + angle->compute() + dihedral->compute() + improper->compute() + kspace->compute() + + fix->pre_reverse() + comm->reverse_comm() + + fix->post_force() + fix->final_integrate() + fix->end_of_step() + + if any output on this step: + output->write() + + # after loop + fix->post_run() + + +The ``ev_set()`` method (in the parent Integrate class), sets two flags +(*eflag* and *vflag*) for energy and virial computation. Each flag +encodes whether global and/or per-atom energy and virial should be +calculated on this timestep, because some fix or variable or output will +need it. These flags are passed to the various methods that compute +particle interactions, so that they either compute and tally the +corresponding data or can skip the extra calculations if the energy and +virial are not needed. See the comments for the ``Integrate::ev_set()`` +method which document the flag values. + +At various points of the timestep, fixes are invoked, +e.g. ``fix->initial_integrate()``. In the code, this is actually done +via the Modify class which stores all the Fix objects and lists of which +should be invoked at what point in the timestep. Fixes are the LAMMPS +mechanism for tailoring the operations of a timestep for a particular +simulation. As described elsewhere, each fix has one or more methods, +each of which is invoked at a specific stage of the timestep, as show in +the timestep pseudo-code. All the active fixes defined in an input +script, that are flagged to have an ``initial_integrate()`` method are +invoked at the beginning of each timestep. Examples are :doc:`fix nve +` or :doc:`fix nvt or fix npt ` which perform the +start-of-timestep velocity-Verlet integration operations to update +velocities by a half-step, and coordinates by a full step. The +``post_integrate()`` method is next for operations that need to happen +immediately after those updates. Only a few fixes use this, e.g. to +reflect particles off box boundaries in the :doc:`FixWallReflect class +`. + +The ``decide()`` method in the Neighbor class determines whether +neighbor lists need to be rebuilt on the current timestep (conditions +can be changed using the :doc:`neigh_modify every/delay/check +` command. If not, coordinates of ghost atoms are +acquired by each processor via the ``forward_comm()`` method of the Comm +class. If neighbor lists need to be built, several operations within +the inner if clause of the pseudo-code are first invoked. The +``pre_exchange()`` method of any defined fixes is invoked first. +Typically this inserts or deletes particles from the system. + +Periodic boundary conditions are then applied by the Domain class via +its ``pbc()`` method to remap particles that have moved outside the +simulation box back into the box. Note that this is not done every +timestep, but only when neighbor lists are rebuilt. This is so that +each processor's sub-domain will have consistent (nearby) atom +coordinates for its owned and ghost atoms. It is also why dumped atom +coordinates may be slightly outside the simulation box if not dumped +on a step where the neighbor lists are rebuilt. + +The box boundaries are then reset (if needed) via the ``reset_box()`` +method of the Domain class, e.g. if box boundaries are shrink-wrapped to +current particle coordinates. A change in the box size or shape +requires internal information for communicating ghost atoms (Comm class) +and neighbor list bins (Neighbor class) be updated. The ``setup()`` +method of the Comm class and ``setup_bins()`` method of the Neighbor +class perform the update. + +The code is now ready to migrate atoms that have left a processor's +geometric sub-domain to new processors. The ``exchange()`` method of +the Comm class performs this operation. The ``borders()`` method of the +Comm class then identifies ghost atoms surrounding each processor's +sub-domain and communicates ghost atom information to neighboring +processors. It does this by looping over all the atoms owned by a +processor to make lists of those to send to each neighbor processor. On +subsequent timesteps, the lists are used by the ``Comm::forward_comm()`` +method. + +Fixes with a ``pre_neighbor()`` method are then called. These typically +re-build some data structure stored by the fix that depends on the +current atoms owned by each processor. + +Now that each processor has a current list of its owned and ghost +atoms, LAMMPS is ready to rebuild neighbor lists via the ``build()`` +method of the Neighbor class. This is typically done by binning all +owned and ghost atoms, and scanning a stencil of bins around each +owned atom's bin to make a Verlet list of neighboring atoms within the +force cutoff plus neighbor skin distance. + +In the next portion of the timestep, all interaction forces between +particles are computed, after zeroing the per-atom force vector via the +``force_clear()`` method. If the newton flag is set to *on* by the +newton command, forces are added to both owned and ghost atoms, otherwise +only to owned (aka local) atoms. + +Pairwise forces are calculated first, which enables the global virial +(if requested) to be calculated cheaply (at O(N) cost instead of O(N**2) +at the end of the ``Pair::compute()`` method), by a dot product of atom +coordinates and forces. By including owned and ghost atoms in the dot +product, the effect of periodic boundary conditions is correctly +accounted for. Molecular topology interactions (bonds, angles, +dihedrals, impropers) are calculated next (if supported by the current +atom style). The final contribution is from long-range Coulombic +interactions, invoked by the KSpace class. + +The ``pre_reverse()`` method in fixes is used for operations that have to +be done *before* the upcoming reverse communication (e.g. to perform +additional data transfers or reductions for data computed during the +force computation and stored with ghost atoms). + +If the newton flag is on, forces on ghost atoms are communicated and +summed back to their corresponding owned atoms. The ``reverse_comm()`` +method of the Comm class performs this operation, which is essentially +the inverse operation of sending copies of owned atom coordinates to +other processor's ghost atoms. + +At this point in the timestep, the total force on each (local) atom is +known. Additional force constraints (external forces, SHAKE, etc) are +applied by Fixes that have a ``post_force()`` method. The second half +of the velocity-Verlet integration, ``final_integrate()`` is then +performed (another half-step update of the velocities) via fixes like +nve, nvt, npt. + +At the end of the timestep, fixes that contain an ``end_of_step()`` +method are invoked. These typically perform a diagnostic calculation, +e.g. the ave/time and ave/spatial fixes. The final operation of the +timestep is to perform any requested output, via the ``write()`` method +of the Output class. There are 3 kinds of LAMMPS output: thermodynamic +output to the screen and log file, snapshots of atom data to a dump +file, and restart files. See the :doc:`thermo_style `, +:doc:`dump `, and :doc:`restart ` commands for more +details. + +The the flow of control during energy minimization iterations is +similar to that of a molecular dynamics timestep. Forces are computed, +neighbor lists are built as needed, atoms migrate to new processors, and +atom coordinates and forces are communicated to neighboring processors. +The only difference is what Fix class operations are invoked when. Only +a subset of LAMMPS fixes are useful during energy minimization, as +explained in their individual doc pages. The relevant Fix class methods +are ``min_pre_exchange()``, ``min_pre_force()``, and ``min_post_force()``. +Each fix is invoked at the appropriate place within the minimization +iteration. For example, the ``min_post_force()`` method is analogous to +the ``post_force()`` method for dynamics; it is used to alter or constrain +forces on each atom, which affects the minimization procedure. + +After all iterations are completed there is a ``cleanup`` step which +calls the ``post_run()`` method of fixes to perform operations only required +at the end of a calculations (like freeing temporary storage or creating +final outputs). diff --git a/doc/src/pg_dev_org.rst b/doc/src/pg_dev_org.rst new file mode 100644 index 0000000000..84432f52cd --- /dev/null +++ b/doc/src/pg_dev_org.rst @@ -0,0 +1,250 @@ +LAMMPS source files +=================== + +The source files of the LAMMPS code are found in two +directories of the distribution: ``src`` and ``lib``. +Most of the code is C++ but there are small numbers of files +in several other languages. + +The core of the code is located in the +``src`` folder and its sub-directories. +A sizable number of these files are in the ``src`` directory +itself, but there are plenty of :doc:`packages `, which can be +included or excluded when LAMMPS is built. See the :doc:`Include +packages in build ` section of the manual for more +information about that part of the build process. LAMMPS currently +supports building with :doc:`conventional makefiles ` and +through :doc:`CMake ` which differ in how packages are +enabled or disabled for a LAMMPS binary. The source files for each +package are in all-uppercase sub-directories of the ``src`` folder, for +example ``src/MOLECULE`` or ``src/USER-MISC``. The ``src/STUBS`` +sub-directory is not a package but contains a dummy MPI library, that is +used when building a serial version of the code. The ``src/MAKE`` +directory contains makefiles with settings and flags for a variety of +configuration and machines for the build process with traditional +makefiles. + +The ``lib`` directory contains the source code for several supporting +libraries or files with configuration settings to use globally installed +libraries, that are required by some of the optional packages. +Each sub-directory, like ``lib/poems`` or ``lib/gpu``, contains the +source files, some of which are in different languages such as Fortran +or CUDA. These libraries are linked to during a LAMMPS build, if the +corresponding package is installed. + +LAMMPS C++ source files almost always come in pairs, such as +``src/run.cpp`` (implementation file) and ``src/run.h`` (header file). +Each pair of files defines a C++ +class, for example the :cpp:class:`LAMMPS_NS::Run` class which contains +the code invoked by the :doc:`run ` command in a LAMMPS input script. +As this example illustrates, source file and class names often have a +one-to-one correspondence with a command used in a LAMMPS input script. +Some source files and classes do not have a corresponding input script +command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force` +class. They are discussed in the next section. + +A small number of C++ classes and utility functions are implemented with +only a ``.h`` file. Examples are the Pointer class or the MathVec functions. + +LAMMPS class topology +===================== + +Though LAMMPS has a lot of source files and classes, its class topology +is relative flat, as outlined in the :ref:`class-topology` figure. Each +name refers to a class and has a pair of associated source files in the +``src`` folder, for example the class :cpp:class:`LAMMPS_NS::Memory` +corresponds to the files ``memory.cpp`` and ``memory.h``, or the class +:cpp:class:`LAMMPS_NS::AtomVec` corresponds to the files +``atom_vec.cpp`` and ``atom_vec.h``. Full lines in the figure represent +compositing: that is the class to the left holds a pointer to an +instance of the class to the right. Dashed lines instead represent +inheritance: the class to the right is derived from the class on the +left. Classes with a red boundary are not instantiated directly, but +they represent the base classes for "styles". Those "styles" make up +the bulk of the LAMMPS code and only a few typical examples are included +in the figure for demonstration purposes. + +.. _class-topology: +.. figure:: JPG/lammps-classes.png + + LAMMPS class topology + + This figure shows some of the relations of the base classes of the + LAMMPS simulation package. Full lines indicate that a class holds an + instance of the class it is pointing to; dashed lines point to + derived classes that are given as examples of what classes may be + instantiated during a LAMMPS run based on the input commands and + accessed through the API define by their respective base classes. At + the core is the :cpp:class:`LAMMPS ` class, which + holds pointers to class instances with specific purposes. Those may + hold instances of other classes, sometimes directly, or only + temporarily, sometimes as derived classes or derived classes or + derived classes, which may also hold instances of other classes. + +The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and +represents what is referred to an "instance" of LAMMPS. It is a +composite holding references 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 +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, and passes 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. + +The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the +:ref:`class-topology` figure, it holds references to members of the +`LAMMPS_NS::LAMMPS`, so that all classes derived from +:cpp:class:`LAMMPS_NS::Pointers` have direct access to those reference. +From the class topology all classes with blue boundary are referenced in +this class and all classes in the second and third columns, that are not +listed as derived classes are instead derived from +:cpp:class:`LAMMPS_NS::Pointers`. + +Since all storage is encapsulated, the LAMMPS class can also be +instantiated multiple times by a calling code, and that can be either +simultaneously or consecutively. When running in parallel with MPI, +care has to be taken, that suitable communicators are used to not +create conflicts between different instances. + +The LAMMPS class currently holds instances of 19 classes representing +different core functionalities There are a handful of virtual parent +classes in LAMMPS that define what LAMMPS calls ``styles``. They are +shaded red in the :ref:`class-topology` figure. Each of these are +parents of a number of child classes that implement the interface +defined by the parent class. There are two main categories of these +``styles``: some may only have one instance active at a time (e.g. atom, +pair, bond, angle, dihedral, improper, kspace, comm) and there is a +dedicated pointer variable in the composite class that manages them. +Setups that require a mix of different such styles have to use a +*hybrid* class that manages and forwards calls to the corresponding +sub-styles for the designated subset of atoms or data. or the composite +class may have lists of class instances, e.g. Modify handles lists of +compute and fix styles, while Output handles dumps class instances. + +The exception to this scheme are the ``command`` style classes. These +implement specific commands that can be invoked before, after, or between +runs or are commands which launch a simulation. For these an instance +of the class is created, its command() method called and then, after +completion, the class instance deleted. Examples for this are the +create_box, create_atoms, minimize, run, or velocity command styles. + +For all those ``styles`` certain naming conventions are employed: for +the fix nve command the class is called FixNVE and the files are +``fix_nve.h`` and ``fix_nve.cpp``. Similarly for fix ave/time we have +FixAveTime and ``fix_ave_time.h`` and ``fix_ave_time.cpp``. Style names +are lower case and without spaces or special characters. A suffix or +multiple appended with a forward slash '/' denotes a variant of the +corresponding class without the suffix. To connect the style name and +the class name, LAMMPS uses macros like the following ATOM\_CLASS, +PAIR\_CLASS, BOND\_CLASS, REGION\_CLASS, FIX\_CLASS, COMPUTE\_CLASS, +or DUMP\_CLASS in the corresponding header file. During compilation +files with the pattern ``style_name.h`` are created that contain include +statements including all headers of all styles of a given type that +are currently active (or "installed). + + +More details on individual classes in the :ref:`class-topology` are as +follows: + +- The Memory class handles allocation of all large vectors and arrays. + +- The Error class prints all error and warning messages. + +- The Universe class sets up partitions of processors so that multiple + simulations can be run, each on a subset of the processors allocated + for a run, e.g. by the mpirun command. + +- The Input class reads and processes input input strings and files, + stores variables, and invokes :doc:`commands `. + +- As discussed above, command style classes are directly derived from + the Pointers class. They provide input script commands that perform + one-time operations before/after/between simulations or which invoke a + simulation. They are instantiated from within the Input class, + invoked, then immediately destructed. + +- The Finish class is instantiated to print statistics to the screen + after a simulation is performed, by commands like run and minimize. + +- The Special class walks the bond topology of a molecular system to + find first, second, third neighbors of each atom. It is invoked by + several commands, like :doc:`read_data `, + :doc:`read_restart `, or :doc:`replicate `. + +- The Atom class stores per-atom properties associated with atom styles. + More precisely, they are allocated and managed by a class derived from + the AtomVec class, and the Atom class simply stores pointers to them. + The classes derived from AtomVec represent the different atom styles + and they are instantiated through the :doc:`atom_style ` + command. + +- The Update class holds instances of an integrator and a minimizer + class. The Integrate class is a parent style for the Verlet and + r-RESPA time integrators, as defined by the :doc:`run_style + ` command. The Min class is a parent style for various + energy minimizers. + +- The Neighbor class builds and stores neighbor lists. The NeighList + class stores a single list (for all atoms). A NeighRequest class + instance is created by pair, fix, or compute styles when they need a + particular kind of neighbor list and use the NeighRequest properties + to select the neighbor list settings for the given request. There can + be multiple instances of the NeighRequest class and the Neighbor class + will try to optimize how they are computed by creating copies or + sub-lists where possible. + +- The Comm class performs inter-processor communication, typically of + ghost atom information. This usually involves MPI message exchanges + with 6 neighboring processors in the 3d logical grid of processors + mapped to the simulation box. There are two :doc:`communication styles + ` enabling different ways to do the domain decomposition. + Sometimes the Irregular class is used, when atoms may migrate to + arbitrary processors. + +- The Domain class stores the simulation box geometry, as well as + geometric Regions and any user definition of a Lattice. The latter + are defined by the :doc:`region ` and :doc:`lattice ` + commands in an input script. + +- The Force class computes various forces between atoms. The Pair + parent class is for non-bonded or pair-wise forces, which in LAMMPS + also includes many-body forces such as the Tersoff 3-body potential if + those are computed by walking pairwise neighbor lists. The Bond, + Angle, Dihedral, Improper parent classes are styles for bonded + interactions within a static molecular topology. The KSpace parent + class is for computing long-range Coulombic interactions. One of its + child classes, PPPM, uses the FFT3D and Remap classes to redistribute + and communicate grid-based information across the parallel processors. + +- The Modify class stores lists of class instances derived from the + :doc:`Fix ` and :doc:`Compute ` base classes. + +- The Group class manipulates groups that atoms are assigned to via the + :doc:`group ` command. It also has functions to compute + various attributes of groups of atoms. + +- The Output class is used to generate 3 kinds of output from a LAMMPS + simulation: thermodynamic information printed to the screen and log + file, dump file snapshots, and restart files. These correspond to the + :doc:`Thermo `, :doc:`Dump `, and + :doc:`WriteRestart ` classes respectively. The Dump + class is a base class with several derived classes implementing + various dump style variants. + +- The Timer class logs timing information, output at the end + of a run. + +.. TODO section on "Spatial decomposition and parallel operations" +.. diagram of 3d processor grid, brick vs. tiled. local vs. ghost +.. atoms, 6-way communication with pack/unpack functions, +.. PBC as part of the communication + +.. TODO section on "Fixes, Computes, and Variables" +.. how and when data is computed and provided and how it is +.. referenced. flags in Fix/Compute/Variable classes tell +.. style and amount of available data. + diff --git a/doc/src/pg_dev_utils.rst b/doc/src/pg_dev_utils.rst new file mode 100644 index 0000000000..e34f8c806e --- /dev/null +++ b/doc/src/pg_dev_utils.rst @@ -0,0 +1,417 @@ + +LAMMPS utility functions +======================== + +The ``utils`` sub-namespace inside the ``LAMMPS_NS`` namespace provides +a collection of convenience functions and utilities that perform common +tasks that are required repeatedly throughout the LAMMPS code like +reading or writing to files with error checking or translation of +strings into specific types of numbers with checking for validity. This +reduces redundant implementations and encourages consistent behavior. + +I/O with status check +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +These are wrappers around the corresponding C library calls like +``fgets()`` or ``fread()``. They will check if there were errors +on reading or an unexpected end-of-file state was reached. In that +case, the functions will stop the calculation with an error message, +indicating the name of the problematic file, if possible. + +---------- + +.. doxygenfunction:: sfgets + :project: progguide + +.. doxygenfunction:: sfread + :project: progguide + +String to number conversions with validity check +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +These functions should be used to convert strings to numbers. They are +are strongly preferred over C library calls like ``atoi()`` or +``atof()`` since they check if the **entire** provided string is a valid +(floating-point or integer) number, and will error out instead of +silently returning the result of a partial conversion or zero in cases +where the string is not a valid number. This behavior allows to more +easily detect typos or issues when processing input files. + +The *do_abort* flag should be set to ``true`` in case this function +is called only on a single MPI rank, as that will then trigger the +a call to ``Error::one()`` for errors instead of ``Error::all()`` +and avoids a "hanging" calculation when run in parallel. + +Please also see :cpp:func:`is_integer` and :cpp:func:`is_double` for +testing strings for compliance without conversion. + +---------- + +.. doxygenfunction:: numeric + :project: progguide + +.. doxygenfunction:: inumeric + :project: progguide + +.. doxygenfunction:: bnumeric + :project: progguide + +.. doxygenfunction:: tnumeric + :project: progguide + + +String processing +^^^^^^^^^^^^^^^^^ + +The following are functions to help with processing strings +and parsing files or arguments. + +---------- + +.. doxygenfunction:: trim + :project: progguide + +.. doxygenfunction:: trim_comment + :project: progguide + +.. doxygenfunction:: count_words(const char *text) + :project: progguide + +.. doxygenfunction:: count_words(const std::string &text) + :project: progguide + +.. doxygenfunction:: count_words(const std::string &text, const std::string &separators) + :project: progguide + +.. doxygenfunction:: trim_and_count_words + :project: progguide + +.. doxygenfunction:: split_words + :project: progguide + +.. doxygenfunction:: strmatch + :project: progguide + +.. doxygenfunction:: is_integer + :project: progguide + +.. doxygenfunction:: is_double + :project: progguide + +File and path functions +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. doxygenfunction:: guesspath + :project: progguide + +.. doxygenfunction:: path_basename + :project: progguide + +.. doxygenfunction:: path_join + :project: progguide + +.. doxygenfunction:: file_is_readable + :project: progguide + +Potential file functions +^^^^^^^^^^^^^^^^^^^^^^^^ + +.. doxygenfunction:: get_potential_file_path + :project: progguide + +.. doxygenfunction:: get_potential_date + :project: progguide + +.. doxygenfunction:: get_potential_units + :project: progguide + +.. doxygenfunction:: get_supported_conversions + :project: progguide + +.. doxygenfunction:: get_conversion_factor + :project: progguide + +.. doxygenfunction:: open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert) + :project: progguide + +Argument processing +^^^^^^^^^^^^^^^^^^^ + +.. doxygenfunction:: bounds + :project: progguide + +.. doxygenfunction:: expand_args + :project: progguide + +Convenience functions +^^^^^^^^^^^^^^^^^^^^^ + +.. doxygenfunction:: logmesg + :project: progguide + +.. doxygenfunction:: getsyserror + :project: progguide + +.. doxygenfunction:: check_packages_for_style + :project: progguide + +.. doxygenfunction:: timespec2seconds + :project: progguide + +.. doxygenfunction:: date2num + :project: progguide + +Customized standard functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. doxygenfunction:: merge_sort + :project: progguide + +--------------------------- + +Tokenizer classes +================= + +The purpose of the tokenizer classes is to simplify the recurring task +of breaking lines of text down into words and/or numbers. +Traditionally, LAMMPS code would be using the ``strtok()`` function from +the C library for that purpose, but that function has two significant +disadvantages: 1) it cannot be used concurrently from different LAMMPS +instances since it stores its status in a global variable and 2) it +modifies the string that it is processing. These classes were +implemented to avoid both of these issues and also to reduce the amount +of code that needs to be written. + +The basic procedure is to create an instance of the tokenizer class with +the string to be processed as an argument and then do a loop until all +available tokens are read. The constructor has a default set of +separator characters, but that can be overridden. The default separators +are all "whitespace" characters, i.e. the space character, the tabulator +character, the carriage return character, the linefeed character, and +the form feed character. + +.. code-block:: C++ + :caption: Tokenizer class example listing entries of the PATH environment variable + + #include "tokenizer.h" + #include + #include + #include + + using namespace LAMMPS_NS; + + int main(int, char **) + { + const char *path = getenv("PATH"); + + if (path != nullptr) { + Tokenizer p(path,":"); + while (p.has_next()) + std::cout << "Entry: " << p.next() << "\n"; + } + return 0; + } + +Most tokenizer operations cannot fail except for +:cpp:func:`LAMMPS_NS::Tokenizer::next` (when used without first +checking with :cpp:func:`LAMMPS_NS::Tokenizer::has_next`) and +:cpp:func:`LAMMPS_NS::Tokenizer::skip`. In case of failure, the class +will throw an exception, so you may need to wrap the code using the +tokenizer into a ``try`` / ``catch`` block to handle errors. The +:cpp:class:`LAMMPS_NS::ValueTokenizer` class may also throw an exception +when a (type of) number is requested as next token that is not +compatible with the string representing the next word. + +.. code-block:: C++ + :caption: ValueTokenizer class example with exception handling + + #include "tokenizer.h" + #include + #include + #include + + using namespace LAMMPS_NS; + + int main(int, char **) + { + const char *text = "1 2 3 4 5 20.0 21 twentytwo 2.3"; + double num1(0),num2(0),num3(0),num4(0); + + ValueTokenizer t(text); + // read 4 doubles after skipping over 5 numbers + try { + t.skip(5); + num1 = t.next_double(); + num2 = t.next_double(); + num3 = t.next_double(); + num4 = t.next_double(); + } catch (TokenizerException &e) { + std::cout << "Reading numbers failed: " << e.what() << "\n"; + } + std::cout << "Values: " << num1 << " " << num2 << " " << num3 << " " << num4 << "\n"; + return 0; + } + +This code example should produce the following output: + +.. code-block:: + + Reading numbers failed: Not a valid floating-point number: 'twentytwo' + Values: 20 21 0 0 + +---------- + +.. doxygenclass:: LAMMPS_NS::Tokenizer + :project: progguide + :members: + +.. doxygenclass:: LAMMPS_NS::TokenizerException + :project: progguide + :members: + +.. doxygenclass:: LAMMPS_NS::ValueTokenizer + :project: progguide + :members: + +.. doxygenclass:: LAMMPS_NS::InvalidIntegerException + :project: progguide + :members: what + +.. doxygenclass:: LAMMPS_NS::InvalidFloatException + :project: progguide + :members: what + +File reader classes +==================== + +The purpose of the file reader classes is to simplify the recurring task +of reading and parsing files. They can use the +:cpp:class:`LAMMPS_NS::ValueTokenizer` class to process the read in +text. The :cpp:class:`LAMMPS_NS::TextFileReader` is a more general +version while :cpp:class:`LAMMPS_NS::PotentialFileReader` is specialized +to implement the behavior expected for looking up and reading/parsing +files with potential parameters in LAMMPS. The potential file reader +class requires a LAMMPS instance, requires to be run on MPI rank 0 only, +will use the :cpp:func:`LAMMPS_NS::utils::get_potential_file_path` +function to look up and open the file, and will call the +:cpp:class:`LAMMPS_NS::Error` class in case of failures to read or to +convert numbers, so that LAMMPS will be aborted. + +.. code-block:: C++ + :caption: Use of PotentialFileReader class in pair style coul/streitz + + PotentialFileReader reader(lmp, file, "coul/streitz"); + char * line; + + while((line = reader.next_line(NPARAMS_PER_LINE))) { + try { + ValueTokenizer values(line); + std::string iname = values.next_string(); + + int ielement; + for (ielement = 0; ielement < nelements; ielement++) + if (iname == elements[ielement]) break; + + if (nparams == maxparam) { + maxparam += DELTA; + params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), + "pair:params"); + } + + params[nparams].ielement = ielement; + params[nparams].chi = values.next_double(); + params[nparams].eta = values.next_double(); + params[nparams].gamma = values.next_double(); + params[nparams].zeta = values.next_double(); + params[nparams].zcore = values.next_double(); + + } catch (TokenizerException & e) { + error->one(FLERR, e.what()); + } + nparams++; + } + +A file that would be parsed by the reader code fragment looks like this: + + # DATE: 2015-02-19 UNITS: metal CONTRIBUTOR: Ray Shan CITATION: Streitz and Mintmire, Phys Rev B, 50, 11996-12003 (1994) + # + # X (eV) J (eV) gamma (1/\AA) zeta (1/\AA) Z (e) + + Al 0.000000 10.328655 0.000000 0.968438 0.763905 + O 5.484763 14.035715 0.000000 2.143957 0.000000 + + +---------- + +.. doxygenclass:: LAMMPS_NS::TextFileReader + :project: progguide + :members: + +.. doxygenclass:: LAMMPS_NS::PotentialFileReader + :project: progguide + :members: + + +---------- + +Memory pool classes +=================== + +The memory pool classes are used for cases where otherwise many +small memory allocations would be needed and where the data would +be either all used or all freed. One example for that is the +storage of neighbor lists. The memory management strategy is +based on the assumption that allocations will be in chunks of similar +sizes. The allocation is then not done per individual call for a +reserved chunk of memory, but for a "page" that can hold multiple +chunks of data. A parameter for the maximum chunk size must be +provided, as that is used to determine whether a new page of memory +must be used. + +The :cpp:class:`MyPage ` class offers two ways to +reserve a chunk: 1) with :cpp:func:`get() ` the +chunk size needs to be known in advance, 2) with :cpp:func:`vget() +` a pointer to the next chunk is returned, but +its size is registered later with :cpp:func:`vgot() +`. + +.. code-block:: C++ + :caption: Example of using :cpp:class:`MyPage ` + + #include "my_page.h" + using namespace LAMMPS_NS; + + MyPage *dpage = new MyPage; + // max size of chunk: 256, size of page: 10240 doubles (=81920 bytes) + dpage->init(256,10240); + + double **build_some_lists(int num) + { + dpage->reset(); + double **dlist = new double*[num]; + for (int i=0; i < num; ++i) { + double *dptr = dpage.vget(); + int jnum = 0; + for (int j=0; j < jmax; ++j) { + // compute some dvalue for eligible loop index j + dptr[j] = dvalue; + ++jnum; + } + if (dpage.status() != 0) { + // handle out of memory or jnum too large errors + } + dpage.vgot(jnum); + dlist[i] = dptr; + } + return dlist; + } + +---------- + +.. doxygenclass:: LAMMPS_NS::MyPage + :project: progguide + :members: + +.. doxygenclass:: LAMMPS_NS::MyPoolChunk + :project: progguide + :members: diff --git a/doc/src/pg_dev_write.rst b/doc/src/pg_dev_write.rst new file mode 100644 index 0000000000..7765ed1262 --- /dev/null +++ b/doc/src/pg_dev_write.rst @@ -0,0 +1,253 @@ +Writing LAMMPS styles +===================== + +The :doc:`Modify` section of the manual gives an overview of how LAMMPS can +be extended by writing new classes that derive from existing +parent classes in LAMMPS. Here, some specific coding +details are provided for writing code for LAMMPS. + +Writing a new fix style +^^^^^^^^^^^^^^^^^^^^^^^ + +Writing fixes is a flexible way of extending LAMMPS. Users can +implement many things using fixes: + +- changing particles attributes (positions, velocities, forces, etc.). Examples: FixNVE, FixFreeze. +- reading/writing data. Example: FixRestart. +- adding or modifying properties due to geometry. Example: FixWall. +- interacting with other subsystems or external code: Examples: FixTTM, FixExternal, FixLATTE +- saving information for analysis or future use (previous positions, + for instance). Examples: Fix AveTime, FixStoreState. + + +All fixes are derived from the Fix base class and must have a +constructor with the signature: ``FixPrintVel(class LAMMPS *, int, char **)``. + +Every fix must be registered in LAMMPS by writing the following lines +of code in the header before include guards: + +.. code-block:: c + + #ifdef FIX_CLASS + FixStyle(print/vel,FixPrintVel) + #else + /* the definition of the FixPrintVel class comes here */ + ... + #endif + +Where ``print/vel`` is the style name of your fix in the input script and +``FixPrintVel`` is the name of the class. The header file would be called +``fix_print_vel.h`` and the implementation file ``fix_print_vel.cpp``. +These conventions allow LAMMPS to automatically integrate it into the +executable when compiling and associate your new fix class with the designated +keyword when it parses the input script. + +Let's write a simple fix which will print the average velocity at the end +of each timestep. First of all, implement a constructor: + +.. code-block:: C++ + + FixPrintVel::FixPrintVel(LAMMPS *lmp, int narg, char **arg) + : Fix(lmp, narg, arg) + { + if (narg < 4) + error->all(FLERR,"Illegal fix print/vel command"); + + nevery = force->inumeric(FLERR,arg[3]); + if (nevery <= 0) + error->all(FLERR,"Illegal fix print/vel command"); + } + +In the constructor you should parse your fix arguments which are +specified in the script. All fixes have pretty the same syntax: +``fix ``. The +first 3 parameters are parsed by Fix base class constructor, while +```` should be parsed by you. In our case, we need to +specify how often we want to print an average velocity. For instance, +once in 50 timesteps: ``fix 1 print/vel 50``. There is a special variable +in the Fix class called ``nevery`` which specifies how often the method +``end_of_step()`` is called. Thus all we need to do is just set it up. + +The next method we need to implement is ``setmask()``: + +.. code-block:: C++ + + int FixPrintVel::setmask() + { + int mask = 0; + mask |= FixConst::END_OF_STEP; + return mask; + } + +Here the user specifies which methods of your fix should be called +during execution. The constant ``END_OF_STEP`` corresponds to the +``end_of_step()`` method. The most important available methods that +are called during a timestep and the order in which they are called +are shown in the previous section. + +.. code-block:: C++ + + void FixPrintVel::end_of_step() + { + // for add3, scale3 + using namespace MathExtra; + + double** v = atom->v; + int nlocal = atom->nlocal; + double localAvgVel[4]; // 4th element for particles count + memset(localAvgVel, 0, 4 * sizeof(double)); + for (int particleInd = 0; particleInd < nlocal; ++particleInd) { + add3(localAvgVel, v[particleInd], localAvgVel); + } + localAvgVel[3] = nlocal; + double globalAvgVel[4]; + memset(globalAvgVel, 0, 4 * sizeof(double)); + MPI_Allreduce(localAvgVel, globalAvgVel, 4, MPI_DOUBLE, MPI_SUM, world); + scale3(1.0 / globalAvgVel[3], globalAvgVel); + if ((comm->me == 0) && screen) { + fmt::print(screen,"{}, {}, {}\n", + globalAvgVel[0], globalAvgVel[1], globalAvgVel[2]); + } + } + +In the code above, we use MathExtra routines defined in +``math_extra.h``. There are bunch of math functions to work with +arrays of doubles as with math vectors. It is also important to note +that LAMMPS code should always assume to be run in parallel and that +atom data is thus distributed across the MPI ranks. Thus you can +only process data from local atoms directly and need to use MPI library +calls to combine or exchange data. For serial execution, LAMMPS +comes bundled with the MPI STUBS library that contains the MPI library +function calls in dummy versions that only work for a single MPI rank. + +In this code we use an instance of Atom class. This object is stored +in the Pointers class (see ``pointers.h``) which is the base class of +the Fix base class. This object contains references to various class +instances (the original instances are created and held by the LAMMPS +class) with all global information about the simulation system. +Data from the Pointers class is available to all classes inherited from +it using protected inheritance. Hence when you write you own class, +which is going to use LAMMPS data, don't forget to inherit from Pointers +or pass an Pointer to it to all functions that need access. When writing +fixes we inherit from class Fix which is inherited from Pointers so +there is no need to inherit from it directly. + +The code above computes average velocity for all particles in the +simulation. Yet you have one unused parameter in fix call from the +script: ``group_name``. This parameter specifies the group of atoms +used in the fix. So we should compute average for all particles in the +simulation only if ``group_name == "all"``, but it can be any group. +The group membership information of an atom is contained in the *mask* +property of and atom and the bit corresponding to a given group is +stored in the groupbit variable which is defined in Fix base class: + +.. code-block:: C++ + + for (int i = 0; i < nlocal; ++i) { + if (atom->mask[i] & groupbit) { + // Do all job here + } + } + +Class Atom encapsulates atoms positions, velocities, forces, etc. User +can access them using particle index. Note, that particle indexes are +usually changed every few timesteps because of neighbor list rebuilds +and spatial sorting (to improve cache efficiency). + +Let us consider another Fix example: We want to have a fix which stores +atoms position from previous time step in your fix. The local atoms +indexes may not be valid on the next iteration. In order to handle +this situation there are several methods which should be implemented: + +- ``double memory_usage()``: return how much memory the fix uses (optional) +- ``void grow_arrays(int)``: do reallocation of the per particle arrays in your fix +- ``void copy_arrays(int i, int j, int delflag)``: copy i-th per-particle + information to j-th. Used when atom sorting is performed. if delflag is set + and atom j owns a body, move the body information to atom i. +- ``void set_arrays(int i)``: sets i-th particle related information to zero + +Note, that if your class implements these methods, it must call add calls of +add_callback and delete_callback to constructor and destructor. Since we want +to store positions of atoms from previous timestep, we need to add +``double** xold`` to the header file. Than add allocation code +to the constructor: + +.. code-block:: C++ + + FixSavePos::FixSavePos(LAMMPS *lmp, int narg, char **arg), xold(nullptr) + { + //... + memory->create(xold, atom->nmax, 3, "FixSavePos:x"); + atom->add_callback(0); + } + + FixSavePos::~FixSavePos() { + atom->delete_callback(id, 0); + memory->destroy(xold); + } + +Implement the aforementioned methods: + +.. code-block:: C++ + + double FixSavePos::memory_usage() + { + int nmax = atom->nmax; + double bytes = 0.0; + bytes += nmax * 3 * sizeof(double); + return bytes; + } + + void FixSavePos::grow_arrays(int nmax) + { + memory->grow(xold, nmax, 3, "FixSavePos:xold"); + } + + void FixSavePos::copy_arrays(int i, int j, int delflag) + { + memcpy(xold[j], xold[i], sizeof(double) * 3); + } + + void FixSavePos::set_arrays(int i) + { + memset(xold[i], 0, sizeof(double) * 3); + } + + int FixSavePos::pack_exchange(int i, double *buf) + { + int m = 0; + buf[m++] = xold[i][0]; + buf[m++] = xold[i][1]; + buf[m++] = xold[i][2]; + + return m; + } + + int FixSavePos::unpack_exchange(int nlocal, double *buf) + { + int m = 0; + xold[nlocal][0] = buf[m++]; + xold[nlocal][1] = buf[m++]; + xold[nlocal][2] = buf[m++]; + + return m; + } + +Now, a little bit about memory allocation. We use the Memory class which +is just a bunch of template functions for allocating 1D and 2D +arrays. So you need to add include ``memory.h`` to have access to them. + +Finally, if you need to write/read some global information used in +your fix to the restart file, you might do it by setting flag +``restart_global = 1`` in the constructor and implementing methods void +``write_restart(FILE *fp)`` and ``void restart(char *buf)``. +If, in addition, you want to write the per-atom property to restart +files additional settings and functions are needed: + +- a fix flag indicating this needs to be set ``restart_peratom = 1;`` +- ``atom->add_callback()`` and ``atom->delete_callback()`` must be called + a second time with the final argument set to 1 instead of 0 (indicating + restart processing instead of per-atom data memory management). +- the functions ``void pack_restart(int i, double *buf)`` and + ``void unpack_restart(int nlocal, int nth)`` need to be implemented + diff --git a/doc/src/pg_developer.rst b/doc/src/pg_developer.rst index 7b46a4f90a..89282820ae 100644 --- a/doc/src/pg_developer.rst +++ b/doc/src/pg_developer.rst @@ -7,114 +7,11 @@ information will be added incrementally depending on availability of time and requests from the LAMMPS user community. -LAMMPS source files -=================== +.. toctree:: + :maxdepth: 1 -The source files of the LAMMPS code are distributed across two -directories of the distribution. The core of the code is located in the -``src`` folder and its sub-directories. Almost all of those are C++ files -(implementation files have a ``.cpp`` extension and and headers a -``.h``). A sizable number of these files are in the ``src`` directory -itself, but there are plenty of :doc:`packages `, which can be -included or excluded when LAMMPS is built. See the :doc:`Include -packages in build ` section of the manual for more -information about that part of the build process. LAMMPS currently -supports building with :doc:`conventional makefiles ` and -through :doc:`CMake ` which differ in how packages are -enabled or disabled for a LAMMPS binary. The source files for each -package are in all-uppercase sub-directories of the ``src`` folder, for -example ``src/MOLECULE`` or ``src/USER-MISC``. The ``src/STUBS`` -sub-directory is not a package but contains a dummy MPI library, that is -used when building a serial version of the code. the ``src/MAKE`` -directory contains makefiles with settings and flags for a variety of -configuration and machines for the build process with traditional -makefiles. - -The ``lib`` directory contains the source code for several supporting -libraries or files with configuration settings to use globally installed -libraries, that are required by some of the optional packages. -Each sub-directory, like ``lib/poems`` or ``lib/gpu``, contains the -source files, some of which are in different languages such as Fortran -or CUDA. These libraries are linked to during a LAMMPS build, if the -corresponding package is installed. - -LAMMPS C++ source files almost always come in pairs, such as -``src/run.cpp`` and ``src/run.h``. The pair of files defines a C++ -class, for example the :cpp:class:`LAMMPS_NS::Run` class which contains -the code invoked by the :doc:`run ` command in a LAMMPS input script. -As this example illustrates, source file and class names often have a -one-to-one correspondence with a command used in a LAMMPS input script. -Some source files and classes do not have a corresponding input script -command, e.g. ``src/force.cpp`` and the :cpp:class:`LAMMPS_NS::Force` -class. They are discussed in the next section. - -Overview of LAMMPS class topology -================================= - -Though LAMMPS has a lot of source files and classes, its class topology -is relative flat, as outlined in the :ref:`class-topology` figure. Each -name refers to a class and has a pair of associated source files in the -``src`` folder, for example the class :cpp:class:`LAMMPS_NS::Memory` -corresponds to the files ``memory.cpp`` and ``memory.h``, or the class -:cpp:class:`LAMMPS_NS::AtomVec` corresponds to the files -``atom_vec.cpp`` and ``atom_vec.h``. Full lines in the figure represent -compositing: that is the class to the left holds a pointer to an -instance of the class to the right. Dashed lines instead represent -inheritance: the class to the right is derived from the class on the -left. Classes with a red boundary are not instantiated directly, but -they represent the base classes for "styles". Those "styles" make up -the bulk of the LAMMPS code and only a few typical examples are included -in the figure for demonstration purposes. - -.. _class-topology: -.. figure:: JPG/lammps-classes.png - - LAMMPS class topology - - This figure shows some of the relations of the base classes of the - LAMMPS simulation package. Full lines indicate that a class holds an - instance of the class it is pointing to; dashed lines point to - derived classes that are given as examples of what classes may be - instantiated during a LAMMPS run based on the input commands and - accessed through the API define by their respective base classes. At - the core is the :cpp:class:`LAMMPS ` class, which - holds pointers to class instances with specific purposes. Those may - hold instances of other classes, sometimes directly, or only - temporarily, sometimes as derived classes or derived classes or - derived classes, which may also hold instances of other classes. - -The :cpp:class:`LAMMPS_NS::LAMMPS` class is the topmost class and -represents what is referred to an "instance" of LAMMPS. It is a -composite holding references 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 -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, and passes 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. - -The :cpp:class:`LAMMPS_NS::Pointers` is not shown in the -:ref:`class-topology` figure, it holds references to members of the -`LAMMPS_NS::LAMMPS`, so that all classes derived from -:cpp:class:`LAMMPS_NS::Pointers` have direct access to those reference. -From the class topology all classes with blue boundary are referenced in -this class and all classes in the second and third columns, that are not -listed as derived classes are instead derived from -:cpp:class:`LAMMPS_NS::Pointers`. - -Since all storage is encapsulated, the LAMMPS class can also be -instantiated multiple times by a calling code, and that can be either -simultaneously or consecutively. When running in parallel with MPI, -care has to be taken, that suitable communicators are used to not -create conflicts between different instances. - -The LAMMPS class currently holds instances of 19 classes representing -different core functionalities -There are a handful of virtual parent classes in LAMMPS that define -what LAMMPS calls ``styles``. They are shaded red in Fig -\ref{fig:classes}. Each of these are parents of a number of child -classes that implement the interface defined by the parent class. + pg_dev_org + pg_dev_flow + pg_dev_write + pg_dev_utils + pg_dev_classes diff --git a/doc/src/pg_fortran.rst b/doc/src/pg_fortran.rst new file mode 100644 index 0000000000..50738330d2 --- /dev/null +++ b/doc/src/pg_fortran.rst @@ -0,0 +1,202 @@ +The ``LIBLAMMPS`` Fortran Module +******************************** + +The ``LIBLAMMPS`` module provides an interface to call LAMMPS from a +Fortran code. It is based on the LAMMPS C-library interface and +requires a Fortran 2003 compatible compiler to be compiled. + +While C libraries have a defined binary interface (ABI) and can thus be +used from multiple compiler versions from different vendors for as long +as they are compatible with the hosting operating system, the same is +not true for Fortran codes. Thus the LAMMPS Fortran module needs to be +compiled alongside the code using it from the source code in +``fortran/lammps.f90``. 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: + +.. code-block:: bash + + mpifort -o testlib.x lammps.f90 testlib.f90 -L. -llammps + +Please note, that the MPI compiler wrapper is only required when the +calling the library from an MPI parallel code. Please also note the order +of the source files: the lammps.f90 file needs to be compiled first, +since it provides the ``LIBLAMMPS`` module that is imported by the +Fortran code using the interface. + +.. versionadded:: 30Sep2020 + +.. admonition:: Work in Progress + + This Fortran module is work in progress and only the documented + functionality is currently available. The final implementation should + cover the entire range of functionality available in the C and + Python library interfaces. + +---------- + +Creating or deleting a LAMMPS object +************************************ + +With the Fortran interface the creation of a :cpp:class:`LAMMPS +` instance is included in the constructor for +creating the :f:func:`lammps` derived type. To import the definition of +that type and its type bound procedures you need to add a ``USE +LIBLAMMPS`` statement. Internally it will call either +:cpp:func:`lammps_open_fortran` or :cpp:func:`lammps_open_no_mpi` from +the C library API to create the class instance. All arguments are +optional and :cpp:func:`lammps_mpi_init` will be called automatically, +if it is needed. Similarly, a possible call to :cpp:func:`lammps_finalize` +is integrated into the :f:func:`close` function and triggered with +the optional logical argument set to ``.true.``. Here is a simple example: + +.. code-block:: fortran + + PROGRAM testlib + USE LIBLAMMPS ! include the LAMMPS library interface + TYPE(lammps) :: lmp ! derived type to hold LAMMPS instance + CHARACTER(len=*), DIMENSION(*), PARAMETER :: args = & + [ CHARACTER(len=12) :: 'liblammps', '-log', 'none' ] + + ! create a LAMMPS instance (and initialize MPI) + lmp = lammps(args) + ! get and print numerical version code + PRINT*, 'LAMMPS Version: ', lmp%version() + ! delete LAMMPS instance (and shuts down MPI) + CALL lmp%close(.true.) + + END PROGRAM testlib + +-------------------- + +Executing LAMMPS commands +========================= + +Once a LAMMPS instance is created, it is possible to "drive" the LAMMPS +simulation by telling LAMMPS to read commands from a file, or pass +individual or multiple commands from strings or lists of strings. This +is done similar to how it is implemented in the `C-library +` interface. Before handing off the calls to the +C-library interface, the corresponding Fortran versions of the calls +(:f:func:`file`, :f:func:`command`, :f:func:`commands_list`, and +:f:func:`commands_string`) have to make a copy of the strings passed as +arguments so that they can be modified to be compatible with the +requirements of strings in C without affecting the original strings. +Those copies are automatically deleted after the functions return. +Below is a small demonstration of the uses of the different functions: + +.. code-block:: fortran + + PROGRAM testcmd + USE LIBLAMMPS + TYPE(lammps) :: lmp + CHARACTER(len=512) :: cmds + CHARACTER(len=40),ALLOCATABLE :: cmdlist(:) + CHARACTER(len=10) :: trimmed + INTEGER :: i + + lmp = lammps() + CALL lmp%file('in.melt') + CALL lmp%command('variable zpos index 1.0') + ! define 10 groups of 10 atoms each + ALLOCATE(cmdlist(10)) + DO i=1,10 + WRITE(trimmed,'(I10)') 10*i + WRITE(cmdlist(i),'(A,I1,A,I10,A,A)') & + 'group g',i-1,' id ',10*(i-1)+1,':',ADJUSTL(trimmed) + END DO + CALL lmp%commands_list(cmdlist) + ! run multiple commands from multi-line string + cmds = 'clear' // NEW_LINE('A') // & + 'region box block 0 2 0 2 0 2' // NEW_LINE('A') // & + 'create_box 1 box' // NEW_LINE('A') // & + 'create_atoms 1 single 1.0 1.0 ${zpos}' + CALL lmp%commands_string(cmds) + CALL lmp%close() + + END PROGRAM testcmd + +--------------- + +The ``LIBLAMMPS`` module API +**************************** + +Below are the detailed descriptions of definitions and interfaces +of the contents of the ``LIBLAMMPS`` Fortran interface to LAMMPS. + +.. f:type:: lammps + + Derived type that is the general class of the Fortran interface. + It holds a reference to the :cpp:class:`LAMMPS ` class instance + that any of the included calls are forwarded to. + + :f c_ptr handle: reference to the LAMMPS class + :f close: :f:func:`close` + :f version: :f:func:`version` + :f file: :f:func:`file` + :f command: :f:func:`command` + :f commands_list: :f:func:`commands_list` + :f commands_string: :f:func:`commands_string` + +.. f:function:: lammps(args[,comm]) + + This is the constructor for the Fortran class and will forward + the arguments to a call to either :cpp:func:`lammps_open_fortran` + or :cpp:func:`lammps_open_no_mpi`. If the LAMMPS library has been + 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 + 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`. + + :p character(len=*) args(*) [optional]: arguments as list of strings + :o integer comm [optional]: MPI communicator + :r lammps: an instance of the :f:type:`lammps` derived type + +.. f:subroutine:: close([finalize]) + + This method will close down the LAMMPS instance through calling + :cpp:func:`lammps_close`. If the *finalize* argument is present and + has a value of ``.true.``, then this subroutine also calls + :cpp:func:`lammps_mpi_finalize`. + + :o logical finalize [optional]: shut down the MPI environment of the LAMMPS library if true. + +.. f:function:: version() + + This method returns the numeric LAMMPS version like :cpp:func:`lammps_version` + + :r integer: LAMMPS version + +-------- + +.. f:subroutine:: file(filename) + + This method will call :cpp:func:`lammps_file` to have LAMMPS read + and process commands from a file. + + :p character(len=*) filename: name of file with LAMMPS commands + +.. f:subroutine:: command(cmd) + + This method will call :cpp:func:`lammps_command` to have LAMMPS + execute a single command. + + :p character(len=*) cmd: single LAMMPS command + +.. f:subroutine:: commands_list(cmds) + + This method will call :cpp:func:`lammps_commands_list` to have LAMMPS + execute a list of input lines. + + :p character(len=*) cmd(*): list of LAMMPS input lines + +.. f:subroutine:: commands_string(str) + + This method will call :cpp:func:`lammps_commands_string` to have LAMMPS + execute a block of commands from a string. + + :p character(len=*) str: LAMMPS input in string + diff --git a/doc/src/pg_input.rst b/doc/src/pg_input.rst new file mode 100644 index 0000000000..72fdd93578 --- /dev/null +++ b/doc/src/pg_input.rst @@ -0,0 +1,7 @@ +LAMMPS Input Base Class +************************ + +.. doxygenclass:: LAMMPS_NS::Input + :project: progguide + :members: + diff --git a/doc/src/pg_lammps.rst b/doc/src/pg_lammps.rst new file mode 100644 index 0000000000..efa282e33a --- /dev/null +++ b/doc/src/pg_lammps.rst @@ -0,0 +1,22 @@ +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 +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 +class, either directly from C++ with ``new LAMMPS()`` or through one +of the library interface functions like :cpp:func:`lammps_open` of the +C-library interface, or the :py:class:`lammps.lammps` class constructor +of the Python module, or the :f:func:`lammps` constructor of the Fortran +module. + +-------------------- + +.. doxygenclass:: LAMMPS_NS::LAMMPS + :project: progguide + :members: + diff --git a/doc/src/pg_lib_add.rst b/doc/src/pg_lib_add.rst new file mode 100644 index 0000000000..e58b6c2b73 --- /dev/null +++ b/doc/src/pg_lib_add.rst @@ -0,0 +1,33 @@ +Adding code to the Library interface +==================================== + +The functionality of the LAMMPS library interface has historically +always been motivated by the needs of its users and functions were +added or expanded as they were needed and used. Contributions to +the interface are always welcome. However with a refactoring of +the library interface and its documentation that started in 2020, +there are now a few requirements for inclusion of changes. + + - New functions should be orthogonal to existing ones and not + implement functionality that can already be achieved with the + existing APIs. + - All changes and additions should be documented with + `Doxygen `_ style comments and references + to those functions added to the corresponding files in the + ``doc/src`` folder. + - If possible, new unit tests to test those new features should + be added. + - The new feature should also be implemented and documented for + the Python and Fortran modules. + - All additions should work and be compatible with ``-DLAMMPS_BIGBIG``, + ``-DLAMMPS_SMALLBIG``, ``-DLAMMPS_SMALLSMALL`` and compiling + with and without MPI support. + - The ``library.h`` file should be kept compatible to C code at + a level similar to C89. Its interfaces may not reference any + custom data types (e.g. ``bigint``, ``tagint``, and so on) only + known inside of LAMMPS. + - only C style comments, not C++ style + +Please note, that these are *not* *strict* requirements, but the +LAMMPS developers appreciate if they are followed closely and will +assist with implementing what is missing. diff --git a/doc/src/pg_lib_config.rst b/doc/src/pg_lib_config.rst new file mode 100644 index 0000000000..9576e31dcd --- /dev/null +++ b/doc/src/pg_lib_config.rst @@ -0,0 +1,67 @@ +Retrieving LAMMPS configuration information +=========================================== + +The following library functions can be used to query the +LAMMPS library about compile time settings and included +packages and styles. + +----------------------- + +.. doxygenfunction:: lammps_config_has_mpi_support + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_has_gzip_support + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_has_png_support + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_has_jpeg_support + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_has_ffmpeg_support + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_has_exceptions + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_has_package + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_package_count + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_config_package_name + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_has_style + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_style_count + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_style_name + :project: progguide + diff --git a/doc/src/pg_lib_create.rst b/doc/src/pg_lib_create.rst new file mode 100644 index 0000000000..f8a8fb7829 --- /dev/null +++ b/doc/src/pg_lib_create.rst @@ -0,0 +1,104 @@ +Creating or deleting a LAMMPS object +==================================== + +The :cpp:func:`lammps_open` and :cpp:func:`lammps_open_no_mpi` +functions are used to create and initialize a +:cpp:func:`LAMMPS` instance. The calling program has to +provide a handle where a reference to this instance can be stored and +which has to be used in all subsequent function calls until that +instance is destroyed by calling :cpp:func:`lammps_close`. +Here is a simple example demonstrating its use: + +.. code-block:: C + + #include "library.h" + #include + + int main(int argc, char **argv) + { + void *handle; + int version; + const char *lmpargv[] = { "liblammps", "-log", "none"}; + int lmpargc = sizeof(lmpargv)/sizeof(const char *); + + /* create LAMMPS instance */ + handle = lammps_open_no_mpi(lmpargc, lmpargv, NULL); + if (handle == NULL) { + printf("LAMMPS initialization failed"); + lammps_mpi_finalize(); + return 1; + } + + /* get and print numerical version code */ + version = lammps_version(handle); + printf("LAMMPS Version: %d\n",version); + + /* delete LAMMPS instance and shut down MPI */ + lammps_close(handle); + lammps_mpi_finalize(); + return 0; + } + +The LAMMPS library will be using the MPI library it was compiled with +and will either run on all processors in the ``MPI_COMM_WORLD`` +communicator or on the set of processors in the communicator given in +the ``comm`` argument of :cpp:func:`lammps_open`. This means +the calling code can run LAMMPS on all or a subset of processors. For +example, a wrapper code might decide to alternate between LAMMPS and +another code, allowing them both to run on all the processors. Or it +might allocate part of the processors to LAMMPS and the rest to the +other code by creating a custom communicator with ``MPI_Comm_split()`` +and running both codes concurrently before syncing them up periodically. +Or it might instantiate multiple instances of LAMMPS to perform +different calculations and either alternate between them, run them +concurrently on split communicators, or run them one after the other. +The :cpp:func:`lammps_open` function may be called multiple +times for this latter purpose. + +The :cpp:func:`lammps_close` function is used to shut down +the :cpp:class:`LAMMPS ` class pointed to by the handle +passed as an argument and free all its memory. This has to be called for +every instance created with any of the :cpp:func:`lammps_open` functions. It will, however, **not** call +``MPI_Finalize()``, since that may only be called once. See +:cpp:func:`lammps_mpi_finalize` for an alternative to calling +``MPI_Finalize()`` explicitly in the calling program. + +The :cpp:func:`lammps_free` function is a clean-up +function to free memory that the library allocated previously +via other function calls. See below for notes in the descriptions +of the individual commands where such memory buffers were allocated. + +----------------------- + +.. doxygenfunction:: lammps_open + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_open_no_mpi + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_open_fortran + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_close + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_mpi_init + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_mpi_finalize + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_free + :project: progguide diff --git a/doc/src/pg_lib_execute.rst b/doc/src/pg_lib_execute.rst new file mode 100644 index 0000000000..3e79cb3cb4 --- /dev/null +++ b/doc/src/pg_lib_execute.rst @@ -0,0 +1,69 @@ +Executing LAMMPS commands +========================= + +Once a LAMMPS instance is created, there are multiple ways to "drive" a +simulation. In most cases it is easiest to process single or multiple +LAMMPS commands like in an input file. This can be done through reading +a file or passing single commands or lists of commands or blocks of +commands with the following functions. + +Via these functions, the calling code can have the LAMMPS instance act +on a series of :doc:`input file commands ` that are either +read from a file or passed as strings. This for, for example, allows to +setup a problem from a template file and then run it in stages while +performing other operations in between or concurrently. The caller can +interleave the LAMMPS function calls with operations it performs, calls +to extract information from or set information within LAMMPS, or calls +to another code's library. + +Also equivalent to regular :doc:`input script parsing ` +is the handling of comments and expansion of variables with ``${name}`` +or ``$(expression)`` syntax before the commands are parsed and +executed. Below is a short example using some of these functions. + +.. code-block:: C + + #include "library.h" + #include + #include + + int main(int argc, char **argv) + { + void *handle; + int i; + + MPI_Init(&argc, &argv); + handle = lammps_open(0, NULL, MPI_COMM_WORLD, NULL); + lammps_file(handle,"in.sysinit"); + lammps_command(handle,"run 1000 post no"); + + for (i=0; i < 100; ++i) { + lammps_commands_string(handle,"run 100 pre no post no\n" + "print 'PE = $(pe)'\n" + "print 'KE = $(ke)'\n"); + } + lammps_close(handle); + MPI_Finalize(); + return 0; + } + +----------------------- + +.. doxygenfunction:: lammps_file + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_command + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_commands_list + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_commands_string + :project: progguide + diff --git a/doc/src/pg_lib_neighbor.rst b/doc/src/pg_lib_neighbor.rst new file mode 100644 index 0000000000..b004e85d0e --- /dev/null +++ b/doc/src/pg_lib_neighbor.rst @@ -0,0 +1,30 @@ +Accessing LAMMPS Neighbor lists +=============================== + +The following functions allow to access neighbor lists +generated by LAMMPS or query their properties. + +----------------------- + +.. doxygenfunction:: lammps_find_compute_neighlist + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_find_fix_neighlist + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_find_pair_neighlist + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_neighlist_num_elements + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_neighlist_element_neighbors + :project: progguide diff --git a/doc/src/pg_lib_objects.rst b/doc/src/pg_lib_objects.rst new file mode 100644 index 0000000000..5da858db0c --- /dev/null +++ b/doc/src/pg_lib_objects.rst @@ -0,0 +1,31 @@ +Retrieving or setting properties of LAMMPS objects +================================================== + +This section documents accessing or modifying data from objects like +computes, fixes, or variables in LAMMPS. + +----------------------- + +.. doxygenfunction:: lammps_extract_compute + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_extract_fix + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_extract_variable + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_set_variable + :project: progguide + +----------------------- + +.. doxygenenum:: _LMP_STYLE_CONST + +.. doxygenenum:: _LMP_TYPE_CONST diff --git a/doc/src/pg_lib_properties.rst b/doc/src/pg_lib_properties.rst new file mode 100644 index 0000000000..789c7e2441 --- /dev/null +++ b/doc/src/pg_lib_properties.rst @@ -0,0 +1,62 @@ +Retrieving or setting LAMMPS system properties +============================================== + +The library interface allows to extract different kinds of information +about the active simulation instance and also to modify some of them. +This allows to combine MD simulation steps with other processing and +simulation methods computed in the calling code or another code that is +coupled to LAMMPS via the library interface. In some cases the data +returned is direct reference to the original data inside LAMMPS cast +to a void pointer. In that case the data needs to be cast to a suitable +pointer to be able to access it, and you need to know the correct dimensions +and lengths. When accessing per-atom data, please note that this data +is the per-processor **local** data and indexed accordingly. These arrays +can change sizes and order at every neighbor list rebuild and atom sort +event as atoms are migrating between sub-domains. + +----------------------- + +.. doxygenfunction:: lammps_version + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_get_natoms + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_get_thermo + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_extract_box + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_reset_box + :project: progguide + +------------------- + +.. doxygenfunction:: lammps_extract_setting + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_extract_global + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_extract_atom + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_create_atoms(void *handle, int n, int *id, int *type, double *x, double *v, int *image, int bexpand) + :project: progguide + + diff --git a/doc/src/pg_lib_scatter.rst b/doc/src/pg_lib_scatter.rst new file mode 100644 index 0000000000..5865d22349 --- /dev/null +++ b/doc/src/pg_lib_scatter.rst @@ -0,0 +1,29 @@ +Library functions for scatter/gather operations +================================================ + +.. TODO add description + +----------------------- + +.. doxygenfunction:: lammps_gather_atoms + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_gather_atoms_concat + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_gather_atoms_subset + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_scatter_atoms + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_scatter_atoms_subset + :project: progguide diff --git a/doc/src/pg_lib_utility.rst b/doc/src/pg_lib_utility.rst new file mode 100644 index 0000000000..8eda4e4988 --- /dev/null +++ b/doc/src/pg_lib_utility.rst @@ -0,0 +1,30 @@ +Library interface utility functions +=================================== + +To simplify some of the tasks, the library interface contains +some utility functions that are not directly calling LAMMPS. + +----------------------- + +.. doxygenfunction:: lammps_encode_image_flags + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_decode_image_flags(int image, int *flags) + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*) + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_has_error + :project: progguide + +----------------------- + +.. doxygenfunction:: lammps_get_last_error_message + :project: progguide diff --git a/doc/src/pg_library.rst b/doc/src/pg_library.rst new file mode 100644 index 0000000000..9193b56214 --- /dev/null +++ b/doc/src/pg_library.rst @@ -0,0 +1,158 @@ +LAMMPS Library Interfaces +************************* + +As described on the :doc:`library interface to LAMMPS ` +doc page, LAMMPS can be built as a library (static or shared), so that +it can be called by another code, used in a :doc:`coupled manner +` with other codes, or driven through a :doc:`Python +script `. Even the LAMMPS standalone executable is +essentially a thin wrapper on top of the LAMMPS library, creating a +LAMMPS instance, processing input and then existing. + +Several of these approaches are based on C language wrapper functions +in the files ``src/library.h`` and ``src/library.cpp``, but it is also +possible to use C++ directly. The basic procedure is always the same: +you create one or more instances of the +:cpp:class:`LAMMPS ` and then pass commands as +strings or from files to that LAMMPS instance to execute calculations, +or read, manipulate, and update data from the active class instances +inside the LAMMPS to do analysis or perform operations that are not +possible with existing commands. + +.. _thread-safety: + +.. admonition:: Thread-safety + :class: note + + LAMMPS was initially not conceived as a thread-safe program, but over + the years changes have been applied to replace operations that + collide with creating multiple LAMMPS instances from multiple-threads + of the same process with thread-safe alternatives. This primarily + applies to the core LAMMPS code and less so on add-on packages, + especially when those packages require additional code in the *lib* + folder, interface LAMMPS to Fortran libraries, or the code uses + static variables (like the USER-COLVARS package). + + Another major issue to deal with is to correctly handle MPI. + Creating a LAMMPS instance requires passing an MPI communicator, or + it assumes the ``MPI_COMM_WORLD`` communicator, which spans all MPI + processor ranks. When creating multiple LAMMPS object instances from + different threads, this communicator has to be different for each + thread or else collisions can happen. or it has to be guaranteed, + that only one thread at a time is active. MPI communicators, + however, are not a problem, if LAMMPS is compiled with the MPI STUBS + library, which implies that there is no MPI communication and only 1 + MPI rank. + +---------- + +.. _lammps_c_api: + +LAMMPS C Library API +==================== + +The C library interface is most commonly used path to manage LAMMPS +instances from a compiled code and it is the basis for the :doc:`Python +` and :doc:`Fortran ` modules. Almost all +functions of the C language API require an argument containing a +"handle" in the form of a ``void *`` type variable, which points to the +location of a LAMMPS class instance. + +The ``library.h`` header file by default includes the ``mpi.h`` header +for an MPI library, so it must be present when compiling code using the +library interface. This usually must be the header from the same MPI +library as the LAMMPS library was compiled with. The exception is when +LAMMPS was compiled in serial mode using the ``STUBS`` MPI library. In +that case the calling code may be compiled with a different MPI library +for as long as :cpp:func:`lammps_open_no_mpi` is called to create a +LAMMPS instance. Then you may set the define ``-DLAMMPS_LIB_NO_MPI`` +when compiling your code and the inclusion of ``mpi.h`` will be skipped +and consequently the function :cpp:func:`lammps_open` may not be used. + +.. admonition:: Errors versus exceptions + :class: note + + If any of the function calls in the LAMMPS library API will trigger + an error inside LAMMPS, this will result in an abort of the entire + program. This is not always desirable. Instead, LAMMPS can be + compiled to instead :ref:`throw a C++ exception `. + +.. warning:: + + No checks are made on the arguments of the function calls of the C + library interface. *All* function arguments must be non-NULL unless + *explicitly* allowed and point to consistent and valid data. Buffers + for storing returned data must be allocated to a suitable size. + Passing invalid or unsuitable information will likely cause crashes + or corrupt data. + +------------------------------ + +.. toctree:: + :maxdepth: 1 + + pg_lib_create + pg_lib_execute + pg_lib_properties + pg_lib_objects + pg_lib_scatter + pg_lib_neighbor + pg_lib_config + pg_lib_utility + pg_lib_add + +-------------------- + +.. _lammps_python_api: + +LAMMPS Python APIs +================== + +The LAMMPS Python module enables calling the LAMMPS C library API from +Python by dynamically loading functions in the LAMMPS shared library through +the `Python ctypes module `_. +Because of the dynamic loading, it is **required** that LAMMPS is compiled +in :ref:`"shared" mode `. The Python interface is object oriented, but +otherwise trying to be very similar to the C library API. Three different +Python classes to run LAMMPS are available and they build on each other. + +.. toctree:: + :maxdepth: 1 + + pg_python + +------------------- + +.. _lammps_fortran_api: + +LAMMPS Fortran API +================== + +The LAMMPS Fortran module is a wrapper around calling functions from the +LAMMPS C library API from Fortran through the ISO_C_BINDING feature in +Fortran 2003. The interface is object oriented but otherwise trying to +be very similar to the C library API and the basic Python module. + +.. toctree:: + :maxdepth: 1 + + pg_fortran + +------------------- + +.. _lammps_cplusplus_api: + +LAMMPS C++ API +============== + +It is also possible to invoke the LAMMPS C++ API directly in your code. +It is lacking some of the convenience of the C library API, but it allows +a more direct access to simulation data and thus more low-level manipulations. +The following links provide some examples and references to the C++ API. + +.. toctree:: + :maxdepth: 1 + + pg_cplusplus + + diff --git a/doc/src/pg_python.rst b/doc/src/pg_python.rst new file mode 100644 index 0000000000..80e83d4638 --- /dev/null +++ b/doc/src/pg_python.rst @@ -0,0 +1,188 @@ +The ``lammps`` Python module +**************************** + +.. py:module:: lammps + +The LAMMPS Python interface is implemented as a module called +:py:mod:`lammps` in the ``lammps.py`` file in the ``python`` folder of +the LAMMPS source code distribution. After compilation of LAMMPS, the +module can be installed into a Python system folder or a user folder +with ``make install-python``. Components of the module can then loaded +into a Python session with the ``import`` command. + +There are multiple Python interface classes in the :py:mod:`lammps` module: + +- the :py:class:`lammps ` class. This is a wrapper around + the C-library interface and its member functions try to replicate the + :ref:`C-library API ` closely. This is the most + feature-complete Python API. +- the :py:class:`PyLammps ` class. This is a more high-level + and more Python style class implemented on top of the + :py:class:`lammps ` class. +- the :py:class:`IPyLammps ` class is derived from + :py:class:`PyLammps ` and adds embedded graphics + features to conveniently include LAMMPS into `Jupyter + `_ notebooks. + +.. _mpi4py_url: https://mpi4py.readthedocs.io + +---------- + +Creating or deleting a LAMMPS object +************************************ + +With the Python interface the creation of a :cpp:class:`LAMMPS +` instance is included in the constructor for the +:py:func:`lammps ` class. Internally it will call either +:cpp:func:`lammps_open` or :cpp:func:`lammps_open_no_mpi` from the C +library API to create the class instance. + +All arguments are optional. The *name* argument is to allow loading a +LAMMPS shared library that is named ``liblammps_machine.so`` instead of +the default name of ``liblammps.so``. In most cases the latter will be +installed or used. The *ptr* argument is for use of the +:py:mod:`lammps` module from inside a LAMMPS instance, e.g. with the +:doc:`python ` command, where a pointer to the already existing +:cpp:class:`LAMMPS ` class instance can be passed +to the Python class and used instead of creating a new instance. The +*comm* argument may be used in combination with the `mpi4py `_ +module to pass an MPI communicator to LAMMPS and thus it is possible +to run the Python module like the library interface on a subset of the +MPI ranks after splitting the communicator. Here is a simple example: + +.. code-block:: python + + from lammps import lammps + + # NOTE: argv[0] is set by the Python module + args = ["-log", "none"] + # create LAMMPS instance + lmp = lammps(cmdargs=args) + # get and print numerical version code + print("LAMMPS Version: ", lmp.version()) + # explicitly close and delete LAMMPS instance (optional) + lmp.close() + +Same as with the :ref:`C library API ` this will use the +``MPI_COMM_WORLD`` communicator for the MPI library that LAMMPS was +compiled with. The :py:func:`lmp.close() ` call is +optional since the LAMMPS class instance will also be deleted +automatically during the :py:class:`lammps ` class +destructor. + +Executing LAMMPS commands +************************* + +Once an instance of the :py:class:`lammps ` class is +created, there are multiple ways to "feed" it commands. In a way that is +not very different from running a LAMMPS input script, except that +Python has many more facilities for structured programming than the +LAMMPS input script syntax. Furthermore it is possible to "compute" +what the next LAMMPS command should be. Same as in the equivalent `C +library functions `, commands can be read from a file, a +single string, a list of strings and a block of commands in a single +multi-line string. They are processed under the same boundary conditions +as the C library counterparts. The example below demonstrates the use +of :py:func:`lammps.file`, :py:func:`lammps.command`, +:py:func:`lammps.commands_list`, and :py:func:`lammps.commands_string`: + +.. code-block:: python + + from lammps import lammps + + lmp = lammps() + # read commands from file 'in.melt' + lmp.file('in.melt') + # issue a single command + lmp.command('variable zpos index 1.0') + # create 10 groups with 10 atoms each + cmds = ["group g{} id {}:{}".format(i,10*i+1,10*(i+1)) for i in range(10)] + lmp.commands_list(cmds) + # run commands from a multi-line string + block = """ + clear + region box block 0 2 0 2 0 2 + create_box 1 box + create_atoms 1 single 1.0 1.0 ${zpos} + """ + lmp.commands_string(block) + +---------- + +The ``lammps`` class API +************************ + +The :py:class:`lammps ` class is the core of the LAMMPS +Python interfaces. It is a wrapper around the :ref:`LAMMPS C library +API ` using the `Python ctypes module +`_ and a shared library +compiled from the LAMMPS sources code. The individual methods in this +class try to closely follow the corresponding C functions. The handle +argument that needs to be passed to the C functions is stored internally +in the class and automatically added when calling the C library +functions. Below is a detailed documentation of the API. + +.. autoclass:: lammps.lammps + :members: + +---------- + +The ``PyLammps`` class API +************************** + +.. autoclass:: lammps.PyLammps + :members: + +---------- + +The ``IPyLammps`` class API +*************************** + +.. autoclass:: lammps.IPyLammps + :members: + +---------- + +Additional components of the ``lammps`` module +********************************************** + +The :py:mod:`lammps` module additionally contains several constants +and the :py:class:`NeighList ` class: + +.. _py_data_constants: +.. py:data:: LAMMPS_INT, LAMMPS_DOUBLE, LAMMPS_BIGINT, LAMMPS_TAGINT, LAMMPS_STRING + :type: int + + Constants in the :py:mod:`lammps` module to indicate how to + cast data when the C library function returns a void pointer. + Used in :py:func:`lammps.extract_global`. + +.. _py_style_constants: +.. py:data:: LMP_STYLE_GLOBAL, LMP_STYLE_ATOM, LMP_STYLE_LOCAL + :type: int + + Constants in the :py:mod:`lammps` module to select what style of data + to request from computes or fixes. See :cpp:enum:`_LMP_STYLE_CONST` + for the equivalent constants in the C library interface. Used in + :py:func:`lammps.extract_compute` and :py:func:`lammps.extract_fix`. + +.. _py_type_constants: +.. py:data:: LMP_TYPE_SCALAR, LMP_TYLE_VECTOR, LMP_TYPE_ARRAY, LMP_SIZE_VECTOR, LMP_SIZE_ROWS, LMP_SIZE_COLS + :type: int + + Constants in the :py:mod:`lammps` module to select what type of data + to request from computes or fixes. See :cpp:enum:`_LMP_TYPE_CONST` + for the equivalent constants in the C library interface. Used in + :py:func:`lammps.extract_compute` and :py:func:`lammps.extract_fix`. + +.. _py_var_constants: +.. py:data:: LMP_VAR_EQUAL, LMP_VAR_ATOM + :type: int + + Constants in the :py:mod:`lammps` module to select what style of + variable to query when calling :py:func:`lammps.extract_variable`. + +.. autoclass:: lammps.NeighList + :members: + :no-undoc-members: + diff --git a/doc/src/write_data.rst b/doc/src/write_data.rst index 13a6476ac4..b353f4a16f 100644 --- a/doc/src/write_data.rst +++ b/doc/src/write_data.rst @@ -42,16 +42,24 @@ Similar to :doc:`dump ` files, the data filename can contain a "\*" wild-card character. The "\*" is replaced with the current timestep value. -.. note:: +.. admonition:: Data in Coeff sections - The write-data command is not yet fully implemented in two - respects. First, most pair styles do not yet write their coefficient - information into the data file. This means you will need to specify - that information in your input script that reads the data file, via - the :doc:`pair_coeff ` command. Second, a few of the :doc:`atom styles ` (body, ellipsoid, line, tri) that store - auxiliary "bonus" information about aspherical particles, do not yet - write the bonus info into the data file. Both these functionalities - will be added to the write_data command later. + The write_data command may not always write all coefficient settings + to the corresponding Coeff sections of the data file. This can have + one of multiple reasons. 1) A few styles may be missing the code that + would write those sections (if you come across one, please notify + the LAMMPS developers). 2) Some pair styles require a single pair_coeff + statement and those are not compatible with data files. 3) The + default for write_data is to write a PairCoeff section, which has + only entries for atom types i == j. The remaining coefficients would + be inferred through the currently selected mixing rule. If there has + been a pair_coeff command with i != j, this setting would be lost. + LAMMPS will detect this and print a warning message unless *pair ij* + is appended to the write_data command. This will request writing a + PairIJCoeff section which has information for all pairs of atom types. + In cases where the coefficient data in the data file is incomplete, + you will need to re-specify that information in your input script + that reads the data file. Because a data file is in text format, if you use a data file written out by this command to restart a simulation, the initial state of the diff --git a/doc/src/write_dump.rst b/doc/src/write_dump.rst index f0f57bd674..2e3831b40f 100644 --- a/doc/src/write_dump.rst +++ b/doc/src/write_dump.rst @@ -31,6 +31,11 @@ Examples write_dump all image snap*.jpg element element & bond atom 0.3 shiny 0.1 ssao yes 6345 0.2 size 1600 1600 & modify backcolor white element C C O H N C C C O H H S O H + write_dump all atom/gz dump.atom.gz modify compression_level 9 + write_dump flow custom/zstd dump.%.myforce.zst & + id type c_myF[3] v_ke & + modify sort id & + compression_level 15 Description """"""""""" diff --git a/doc/utils/check-styles.py b/doc/utils/check-styles.py index 603f312e9d..f9a7d3e39a 100755 --- a/doc/utils/check-styles.py +++ b/doc/utils/check-styles.py @@ -60,6 +60,7 @@ reader = {} region = {} total = 0 +index_pattern = re.compile(r"^.. index:: (compute|fix|pair_style|angle_style|bond_style|dihedral_style|improper_style|kspace_style)\s+([a-zA-Z0-9/_]+)$") style_pattern = re.compile(r"(.+)Style\((.+),(.+)\)") upper = re.compile("[A-Z]+") gpu = re.compile("(.+)/gpu$") @@ -70,6 +71,26 @@ omp = re.compile("(.+)/omp$") opt = re.compile("(.+)/opt$") removed = re.compile("(.*)Deprecated$") +def load_index_entries_in_file(path): + entries = [] + with open(path, 'r') as reader: + for line in reader: + m = index_pattern.match(line) + if m: + command_type = m.group(1) + style = m.group(2) + entries.append((command_type, style)) + return entries + +def load_index_entries(): + index = {'compute': set(), 'fix': set(), 'pair_style': set(), 'angle_style': set(), + 'bond_style': set(), 'dihedral_style': set(), 'improper_style': set(), 'kspace_style': set()} + rst_files = glob(os.path.join(doc_dir, '*.rst')) + for f in rst_files: + for command_type, style in load_index_entries_in_file(f): + index[command_type].add(style) + return index + def register_style(styles, name, info): if name in styles: for key, value in info.items(): @@ -112,6 +133,24 @@ def check_style(filename, dirname, pattern, styles, name, suffix=False, skip=set counter += 1 return counter +def check_style_index(name, styles, index, skip=[]): + counter = 0 + for style in styles: + if style not in index and not styles[style]['removed'] and style not in skip: + print(f"{name} index entry {style} is missing") + counter += 1 + + for suffix in styles[style]: + if suffix == 'removed': continue + if suffix == 'kokkos': + suffix_style = f"{style}/kk" + else: + suffix_style = f"{style}/{suffix}" + if styles[style][suffix] and suffix_style not in index and style not in skip: + print(f"{name} index entry {suffix_style} is missing") + counter += 1 + return counter + for header in headers: if verbose: print("Checking ", header) with open(header) as f: @@ -207,6 +246,13 @@ Total number of styles (including suffixes): %d""" \ len(fix), len(improper), len(integrate), len(kspace), \ len(minimize), len(pair), len(reader), len(region), total)) +index = load_index_entries() + +total_index = 0 +for command_type, entries in index.items(): + total_index += len(entries) + +print("Total number of style index entries:", total_index) counter = 0 @@ -244,5 +290,18 @@ counter += check_style('Commands_kspace.rst', doc_dir, ":doc:`(.+) 0: + # override original file + shutil.move(new_file, orig_file) + else: + os.remove(new_file) diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index b86522baf4..e025e23b09 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -1,5 +1,6 @@ Sphinx sphinxcontrib-spelling -sphinx-fortran +git+https://github.com/akohlmey/sphinx-fortran@parallel-read +sphinx_tabs breathe Pygments diff --git a/doc/utils/sphinx-config/_themes/lammps_theme/static/css/lammps.css b/doc/utils/sphinx-config/_themes/lammps_theme/static/css/lammps.css index b5637b389c..b9816c3f8c 100644 --- a/doc/utils/sphinx-config/_themes/lammps_theme/static/css/lammps.css +++ b/doc/utils/sphinx-config/_themes/lammps_theme/static/css/lammps.css @@ -3,3 +3,7 @@ display: block; margin-bottom: 0.809em; } + +.versionmodified { + font-weight: bold; +} diff --git a/doc/utils/sphinx-config/conf.py.in b/doc/utils/sphinx-config/conf.py.in index c6b161ee14..23168bf080 100644 --- a/doc/utils/sphinx-config/conf.py.in +++ b/doc/utils/sphinx-config/conf.py.in @@ -47,7 +47,9 @@ extensions = [ 'sphinx.ext.imgmath', 'sphinx.ext.autodoc', 'sphinxfortran.fortran_domain', + 'sphinx_tabs.tabs', 'table_from_list', + 'tab_or_note', 'breathe', ] # 2017-12-07: commented out, since this package is broken with Sphinx 16.x diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index c6db142634..e3cf7b78ce 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -115,6 +115,7 @@ Archlinux arcsin arg args +argv arrhenius Arun arXiv @@ -138,6 +139,8 @@ atc AtC ATC athermal +atime +atimestep athomps atm atomeye @@ -207,7 +210,6 @@ bcolor bdiam bdw Beckman -behaviour Belak Bellott benchmarking @@ -248,6 +250,7 @@ bispectrum Bispectrum bitbucket bitmapped +bitmask bitrate bitrates Bitzek @@ -266,6 +269,7 @@ bodystyle Bogaerts Bogusz Bohrs +boltz Boltzman BondAngle BondBond @@ -284,6 +288,14 @@ Botu Bouguet Bourne boxcolor +boxlo +boxhi +boxxlo +boxxhi +boxylo +boxyhi +boxzlo +boxzhi bp bpclermont bpls @@ -302,6 +314,7 @@ Bryantsev Btarget btype buckPlusAttr +buf builtin Bulatov Bureekaew @@ -370,6 +383,7 @@ charmm CHARMM charmmfsh charmmfsw +charptr Chaudhuri checkbox checkmark @@ -408,6 +422,7 @@ cmap Cmax cmd cmdlist +cmds Cmin cmm CMM @@ -586,6 +601,7 @@ del delaystep DeleteIDs deleteIDs +delflag Dellago delocalization delocalized @@ -671,6 +687,8 @@ Donadio dotc Doty doxygen +doxygenclass +doxygenfunction downarrow Doye dpd @@ -724,6 +742,7 @@ Eaat Eacn eam eangle +earg eatom Eb Eba @@ -844,6 +863,7 @@ Erhart erorate erose erotate +errno Ertas ervel Espanol @@ -902,6 +922,7 @@ Fc fcc fcm Fd +fd fdotr fdt Fehlberg @@ -926,6 +947,7 @@ ffplay fft fftbench fftw +fgets fhg Fi Fichthorn @@ -961,6 +983,7 @@ fmackay fmag fmass fmm +fmt fmx fmy fmz @@ -974,6 +997,7 @@ Fock Fogarty Foiles fopenmp +forceclear forestgreen formatarg formulae @@ -990,6 +1014,7 @@ Fraige framerate Frauenheim Fraunhofer +fread Freitas Frenkel Friedrichs @@ -997,6 +1022,7 @@ fs fsh fstyle fsw +ftm ftol fugacity Fumi @@ -1104,6 +1130,7 @@ gromos Gronbech Groot groupbig +groupbit grp Grueneisen gsmooth @@ -1166,6 +1193,7 @@ hexorder Heyes HfO hgrid +hhmrr Hibbs Higdon Hijazi @@ -1175,6 +1203,7 @@ histogrammed histogramming hma hmaktulga +hplanck hoc Hochbruck Hofling @@ -1212,11 +1241,13 @@ hydrostatically Hynninen Hyoungki hyperdynamics +hyperplane hyperradius hyperspherical hysteretic hz Ibanez +iatom ibar ibm icc @@ -1259,6 +1290,7 @@ indices inertiax inertiay inertiaz +infile infty inhomogeneities inhomogeneous @@ -1268,6 +1300,7 @@ initializations initio InP inregion +instantiation Institut integrators Integrators @@ -1299,6 +1332,7 @@ ipp Ippolito IPv IPython +ipython Isele isenthalpic ish @@ -1322,6 +1356,7 @@ iva Ivanov Ivector Iw +iwyu ixcm ixx Ixx @@ -1447,6 +1482,7 @@ Kloza kmax Kmax KMP +kmu Knizhnik knl Kofke @@ -1691,6 +1727,7 @@ Maras Marchetti Marchi Mariella +Marinica Marrink Marroquin Marsaglia @@ -1716,6 +1753,7 @@ Mattox Mattson maxangle maxbond +maxchunk maxelt maxeval maxfiles @@ -1933,11 +1971,13 @@ muz mv mV Mvapich +mvh mvv MxN myCompute myIndex mylammps +MyPool mysocket myTemp myVec @@ -1945,11 +1985,13 @@ na nabla Nagaosa Nakano +nall namespace namespaces nan NaN Nandor +nangles Nangletype nangletypes Nangletypes @@ -1978,6 +2020,7 @@ Nbin Nbins nbody Nbody +nbonds nbondtype Nbondtype nbondtypes @@ -1990,9 +2033,11 @@ Nc nchunk Nchunk ncoeff +ncol ncorr ncount nd +ndihedrals Ndihedraltype Ndirango ndof @@ -2034,10 +2079,12 @@ Ngyuen nh nharmonic nhc +nhi NiAlH Nicklas Niklasson Nikolskiy +nimpropers Nimpropertype Ninteger Nissila @@ -2046,9 +2093,11 @@ nitride nitrides niu Nk +nktv nl nlen Nlines +nlo nlocal Nlocal Nlog @@ -2056,7 +2105,9 @@ nlp nm Nm Nmax +nmax Nmin +nmin Nmols nn Nocedal @@ -2109,6 +2160,7 @@ Nrepeat nreset Nrho Nroff +nrow nrun Ns Nsample @@ -2127,6 +2179,7 @@ Nt Ntable ntheta nthreads +ntimestep Ntptask Ntriples Ntype @@ -2225,6 +2278,7 @@ oxRNA packings padua Padua +pafi palegoldenrod palegreen paleturquoise @@ -2254,6 +2308,8 @@ Particuology pastewka Pastewka pathangle +pathname +pathnames Patomtrans Pattnaik Pavese @@ -2354,6 +2410,7 @@ polydisperse polydispersity polyelectrolyte polyhedra +polymorphism popen Popov popstore @@ -2387,6 +2444,7 @@ proc Proc procs Prony +progguide ps Ps pscreen @@ -2433,7 +2491,9 @@ qbmsst qcore qdist qE +qe qeff +qelectron qeq QeQ QEq @@ -2451,6 +2511,8 @@ qmol qoffload qopenmp qoverride +qqr +qqrd qtb quadratically quadrupolar @@ -2506,6 +2568,7 @@ rebo recursing Ree refactored +refactoring reflectionstyle regoin Reinders @@ -2591,6 +2654,7 @@ Rkouter RkouterN rmask Rmask +rmass rmax Rmax rmdir @@ -2725,6 +2789,7 @@ shlib SHM shm shockvel +shrinkexceed Shugaev si SiC @@ -2853,11 +2918,16 @@ strcmp streitz Streitz Streiz +strerror strided strietz +strmatch +strncmp +strstr Stukowski Su subbox +Subclassed subcutoff subcycle subcycling @@ -2884,6 +2954,7 @@ sw Swegat swiggle Swiler +Swinburne Swol Swope Sx @@ -2997,6 +3068,7 @@ Tmin tmp tN Tobias +tokenizer tokyo tol toolchain @@ -3227,6 +3299,7 @@ vv vx Vx vxcm +vxmu vy Vy vycm @@ -3259,8 +3332,9 @@ Widom widom Wijk Wikipedia -wildcard Wildcard +wildcard +wildcards Wirnsberger wirtes witin @@ -3302,6 +3376,7 @@ Xmax xmgrace xMIC xmin +xml xmovie Xmovie xmu @@ -3316,6 +3391,7 @@ xsu xtc xu Xu +xxt xxxxx xy xyz @@ -3387,3 +3463,7 @@ zz Zm PowerShell filesystems +Zstandard +Zstd +zstd +checksum diff --git a/examples/USER/misc/pafi/.gitignore b/examples/USER/misc/pafi/.gitignore new file mode 100644 index 0000000000..65a28d0cec --- /dev/null +++ b/examples/USER/misc/pafi/.gitignore @@ -0,0 +1,2 @@ +*.dat +lmp* diff --git a/examples/USER/misc/pafi/README b/examples/USER/misc/pafi/README new file mode 100644 index 0000000000..c35dff313c --- /dev/null +++ b/examples/USER/misc/pafi/README @@ -0,0 +1,40 @@ +Run an example constrained sample for USER-PAFI calculation + +Author: +Thomas Swinburne, CNRS / CINaM, Marseille +swinburne@cinam.univ-mrs.fr +tomswinburne.github.io + + +PAFI performs constrained force averages on hyperplanes to a reference pathway in order to compute unbiased free energy barriers + + +Paper: +T. D. Swinburne and M. C. Marinica +Unsupervised calculation of free energy barriers in large crystalline systems +Physical Review Letters 276, 1 2018 + + +Also see https://github.com/tomswinburne/pafi/ for the PAFI code which distributes +multiple LAMMPS workers in parallel to compute and collate fix pafi averages, +allowing the calculation of free energy barriers and minimum free energy paths. + +To compile: + +make yes-user-misc # for PAFI +make yes-manybody # for EAM potential +make machine # for binary (machine= e.g. mpi) + +To run the example from this folder: +``` +mpirun -np NPROCS /path/to/lammps/src/lmp_machine -in in.pafi +``` + +This example executes a hyperplane constrained overdamped Langevin simulation +whilst recording the projected free energy gradient, then minimizes in-plane, +then removes the hyperplane constraint and minimizes the whole system. +If the temperature is too high the system will leave the local minima of +the constrained system; PAFI checks for this also. + + +To generate your own path, please see the LAMMPS documentation for more details diff --git a/examples/USER/misc/pafi/in.pafi b/examples/USER/misc/pafi/in.pafi new file mode 100644 index 0000000000..9e9efb156b --- /dev/null +++ b/examples/USER/misc/pafi/in.pafi @@ -0,0 +1,86 @@ +units metal +atom_style atomic +atom_modify map array sort 0 0.0 +neigh_modify every 2 delay 10 check yes page 1000000 one 100000 + +## read in path data using fix property/atom- here 4th image of a NEB +fix pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz +read_data pafipath.4.data fix pa NULL PafiPath + +## EAM potential +pair_style eam/fs +pair_coeff * * ../../../../potentials/Fe_mm.eam.fs Fe + +mass * 55.85 +thermo 100 +min_style fire + + +compute pe all pe +variable pe equal pe +run 0 +print "energy=${pe}" + +## compute property/atom to access relevant fields +compute pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz +run 0 + +## fix name group-id pafi compute-id temperature tdamp seed overdamped 0/1 com 0/1 +fix hp all pafi pa 500.0 0.01 434 overdamped no com yes + +run 0 +minimize 0 0 1000 1000 # best if using NEB path +compute dx all displace/atom +compute dmag all reduce max c_dx[4] +variable maxjump equal sqrt(c_dmag) + +thermo_style custom step pe temp v_maxjump + + +variable dn equal f_hp[4]*f_hp[4] # should be zero to float precision + + +fix af all ave/time 1 1000 1000 f_hp[1] f_hp[2] f_hp[3] v_dn + +variable adn equal sqrt(f_af[4]) # should be very small (approx. 1e-6 A) +variable apf equal f_af[1] + + +run 1000 +minimize 0 0 1000 1000 + +variable s_pe equal ${pe} +variable s_apf equal ${apf} +variable s_adn equal ${adn} +variable s_maxjump equal ${maxjump} + +unfix hp +unfix pa +unfix af +minimize 0 0 1000 1000 + + +print """ +---------- PAFI RESULTS -------- + +During run: + Average Distance From Hyperplane = ${s_adn}A (Should be very small, around 1e-5A), + Average Force Projection Along MFEP = ${s_apf} eV/A +""" +print """ +In-plane minimization post-run: +energy = ${s_pe} eV + +""" +if "${s_maxjump} > 0.1" then & +"print 'Max Atomic Displacement = ${s_maxjump}A > 0.1A'" & +"print ' => Possible shallow in-plane metastability: Reduce time in basin and/or decrease tdamp'" & +else & +"print 'Max Atomic Displacement = ${s_maxjump}A < 0.1A => No in-plane jumps'" +print """ + +Full minimization after removal of PAFI fixes: +energy = ${pe} eV + +----- END PAFI ---- +""" diff --git a/examples/USER/misc/pafi/log.15Apr20.pafi.g++.1 b/examples/USER/misc/pafi/log.15Apr20.pafi.g++.1 new file mode 100644 index 0000000000..513cbed512 --- /dev/null +++ b/examples/USER/misc/pafi/log.15Apr20.pafi.g++.1 @@ -0,0 +1,401 @@ +LAMMPS (24 Aug 2020) +units metal +atom_style atomic +atom_modify map array sort 0 0.0 +neigh_modify every 2 delay 10 check yes page 1000000 one 100000 + +## read in path data using fix property/atom- here 4th image of a NEB +fix pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz +read_data pafipath.4.data fix pa NULL PafiPath +Reading data file ... + orthogonal box = (0.0000000 0.0000000 0.0000000) to (19.987184 19.987184 19.987184) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 687 atoms + read_data CPU = 0.007 seconds + +## EAM potential +pair_style eam/fs +pair_coeff * * ../../../../potentials/Fe_mm.eam.fs Fe +Reading eam/fs potential file ../../../../potentials/Fe_mm.eam.fs with DATE: 2007-06-11 + +mass * 55.85 +thermo 100 +min_style fire + + +compute pe all pe +variable pe equal pe +run 0 +Neighbor list info ... + update every 2 steps, delay 10 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 7.3 + ghost atom cutoff = 7.3 + binsize = 3.65, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/fs, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.903 | 6.903 | 6.903 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 +Loop time of 6.88e-07 on 1 procs for 0 steps with 687 atoms + +290.7% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 6.88e-07 | | |100.00 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3239.00 ave 3239 max 3239 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46843.0 ave 46843 max 46843 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 +print "energy=${pe}" +energy=-2828.24917967199 + +## compute property/atom to access relevant fields +compute pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz +run 0 +Per MPI rank memory allocation (min/avg/max) = 6.903 | 6.903 | 6.903 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 +Loop time of 9.41e-07 on 1 procs for 0 steps with 687 atoms + +106.3% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 9.41e-07 | | |100.00 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3239.00 ave 3239 max 3239 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46843.0 ave 46843 max 46843 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 + +## fix name group-id pafi compute-id temperature tdamp seed overdamped 0/1 com 0/1 +fix hp all pafi pa 500.0 0.01 434 overdamped no com yes +fix pafi compute name,style: pa,property/atom + +run 0 +Per MPI rank memory allocation (min/avg/max) = 8.403 | 8.403 | 8.403 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 +Loop time of 5.53002e-07 on 1 procs for 0 steps with 687 atoms + +361.7% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 5.53e-07 | | |100.00 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3239.00 ave 3239 max 3239 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46843.0 ave 46843 max 46843 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 +minimize 0 0 1000 1000 # best if using NEB path +WARNING: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization (../min.cpp:186) + Parameters for fire: + dmax delaystep dtgrow dtshrink alpha0 alphashrink tmax tmin integrator halfstepback + 0.1 20 1.1 0.5 0.25 0.99 10 0.02 eulerimplicit yes +Per MPI rank memory allocation (min/avg/max) = 8.403 | 8.403 | 8.403 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 + 100 9.5973821e-06 -2828.3565 0 -2828.3565 3092.936 + 200 1.5010519e-13 -2828.3565 0 -2828.3565 3092.8883 + 300 5.4507205e-14 -2828.3565 0 -2828.3565 3092.8883 + 400 5.0283348e-14 -2828.3565 0 -2828.3565 3092.8883 + 500 4.9056964e-14 -2828.3565 0 -2828.3565 3092.8883 + 600 4.8645525e-14 -2828.3565 0 -2828.3565 3092.8883 + 700 4.8498912e-14 -2828.3565 0 -2828.3565 3092.8882 + 800 4.8444552e-14 -2828.3565 0 -2828.3565 3092.8882 + 900 4.8424643e-14 -2828.3565 0 -2828.3565 3092.8882 + 1000 4.84169e-14 -2828.3565 0 -2828.3565 3092.8882 +Loop time of 1.23105 on 1 procs for 1000 steps with 687 atoms + +100.0% CPU use with 1 MPI tasks x no OpenMP threads + +Minimization stats: + Stopping criterion = max iterations + Energy initial, next-to-last, final = + -2828.24917967199 -2828.35645843665 -2828.35645844395 + Force two-norm initial, final = 1.2831004431533395 7.468917431980592e-07 + Force max component initial, final = 0.3331705829071986 2.93217567864934e-07 + Final line search alpha, max atom move = 0.0 0.0 + Iterations, force evaluations = 1000 1007 + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.1849 | 1.1849 | 1.1849 | 0.0 | 96.25 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.010743 | 0.010743 | 0.010743 | 0.0 | 0.87 +Output | 0.00013686 | 0.00013686 | 0.00013686 | 0.0 | 0.01 +Modify | 0.02476 | 0.02476 | 0.02476 | 0.0 | 2.01 +Other | | 0.01055 | | | 0.86 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3239.00 ave 3239 max 3239 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46843.0 ave 46843 max 46843 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 +compute dx all displace/atom +compute dmag all reduce max c_dx[4] +variable maxjump equal sqrt(c_dmag) + +thermo_style custom step pe temp v_maxjump + + +variable dn equal f_hp[4]*f_hp[4] # should be zero to float precision + + +fix af all ave/time 1 1000 1000 f_hp[1] f_hp[2] f_hp[3] v_dn + +variable adn equal sqrt(f_af[4]) # should be very small (approx. 1e-6 A) +variable apf equal f_af[1] + + +run 1000 +Per MPI rank memory allocation (min/avg/max) = 8.778 | 8.778 | 8.778 Mbytes +Step PotEng Temp v_maxjump + 1000 -2828.3565 4.84169e-14 3.9400009e-08 + 1100 -2788.9297 505.16169 0.53846275 + 1200 -2784.1274 471.52773 0.5820714 + 1300 -2782.7071 503.23183 0.57990998 + 1400 -2780.7259 531.16141 0.61955057 + 1500 -2781.512 490.9404 0.58663715 + 1600 -2783.4961 513.37777 0.65062082 + 1700 -2780.0312 492.76259 0.5785296 + 1800 -2781.6555 512.32986 0.58277945 + 1900 -2782.1648 486.16736 0.58913114 + 2000 -2781.1942 493.15046 0.56962281 +Loop time of 1.3463 on 1 procs for 1000 steps with 687 atoms + +Performance: 64.176 ns/day, 0.374 hours/ns, 742.778 timesteps/s +100.0% CPU use with 1 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.2429 | 1.2429 | 1.2429 | 0.0 | 92.32 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.011341 | 0.011341 | 0.011341 | 0.0 | 0.84 +Output | 0.0001418 | 0.0001418 | 0.0001418 | 0.0 | 0.01 +Modify | 0.089655 | 0.089655 | 0.089655 | 0.0 | 6.66 +Other | | 0.002248 | | | 0.17 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3239.00 ave 3239 max 3239 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46844.0 ave 46844 max 46844 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46844 +Ave neighs/atom = 68.186317 +Neighbor list builds = 0 +Dangerous builds = 0 +minimize 0 0 1000 1000 +WARNING: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization (../min.cpp:186) + Parameters for fire: + dmax delaystep dtgrow dtshrink alpha0 alphashrink tmax tmin integrator halfstepback + 0.1 20 1.1 0.5 0.25 0.99 10 0.02 eulerimplicit yes +Per MPI rank memory allocation (min/avg/max) = 9.278 | 9.278 | 9.278 Mbytes +Step PotEng Temp v_maxjump + 2000 -2781.1942 0 0.56962281 + 2100 -2828.3564 2.3533517e-06 0.028829312 + 2200 -2828.3565 2.3166114e-09 0.0015098779 + 2300 -2828.3565 5.7159208e-14 0.0017926087 + 2400 -2828.3565 5.0928429e-14 0.0020264648 + 2500 -2828.3565 4.9253427e-14 0.0022344754 + 2600 -2828.3565 4.8706717e-14 0.0024243813 + 2700 -2828.3565 4.8513392e-14 0.0026003645 + 2800 -2828.3565 4.8442915e-14 0.0027651416 + 2900 -2828.3565 4.8417422e-14 0.0029206277 + 3000 -2828.3565 4.840734e-14 0.0030682417 +Loop time of 1.24896 on 1 procs for 1000 steps with 687 atoms + +100.0% CPU use with 1 MPI tasks x no OpenMP threads + +Minimization stats: + Stopping criterion = max iterations + Energy initial, next-to-last, final = + -2781.19422468903 -2828.35646618005 -2828.35646618733 + Force two-norm initial, final = 29.0662462838641 7.469228601686482e-07 + Force max component initial, final = 2.2910705425983147 2.932332034966123e-07 + Final line search alpha, max atom move = 0.0 0.0 + Iterations, force evaluations = 1000 1008 + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.2027 | 1.2027 | 1.2027 | 0.0 | 96.30 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.010706 | 0.010706 | 0.010706 | 0.0 | 0.86 +Output | 0.00016364 | 0.00016364 | 0.00016364 | 0.0 | 0.01 +Modify | 0.024873 | 0.024873 | 0.024873 | 0.0 | 1.99 +Other | | 0.01053 | | | 0.84 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3209.00 ave 3209 max 3209 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 48576.0 ave 48576 max 48576 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 48576 +Ave neighs/atom = 70.707424 +Neighbor list builds = 0 +Dangerous builds = 0 + +variable s_pe equal ${pe} +variable s_pe equal -2828.35646618733 +variable s_apf equal ${apf} +variable s_apf equal -0.117797263023891 +variable s_adn equal ${adn} +variable s_adn equal 1.36645874805011e-05 +variable s_maxjump equal ${maxjump} +variable s_maxjump equal 0.00306824174470598 + +unfix hp +unfix pa +unfix af +minimize 0 0 1000 1000 +WARNING: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization (../min.cpp:186) + Parameters for fire: + dmax delaystep dtgrow dtshrink alpha0 alphashrink tmax tmin integrator halfstepback + 0.1 20 1.1 0.5 0.25 0.99 10 0.02 eulerimplicit yes +Per MPI rank memory allocation (min/avg/max) = 8.778 | 8.778 | 8.778 Mbytes +Step PotEng Temp v_maxjump + 3000 -2828.3565 0 0.0030682417 + 3100 -2828.5793 0.00016081731 0.54349309 + 3200 -2828.5793 1.1620454e-14 0.54386121 + 3300 -2828.5793 4.4699993e-19 0.54386124 + 3400 -2828.5793 1.0681196e-23 0.54386124 + 3500 -2828.5793 2.046642e-25 0.54386124 + 3600 -2828.5793 1.4539039e-25 0.54386124 + 3700 -2828.5793 2.0152508e-25 0.54386124 + 3800 -2828.5793 1.3593174e-25 0.54386124 + 3900 -2828.5793 1.8155665e-25 0.54386124 + 4000 -2828.5793 1.2308872e-25 0.54386124 +Loop time of 1.20543 on 1 procs for 1000 steps with 687 atoms + +100.0% CPU use with 1 MPI tasks x no OpenMP threads + +Minimization stats: + Stopping criterion = max iterations + Energy initial, next-to-last, final = + -2828.35646618733 -2828.57925588226 -2828.57925588226 + Force two-norm initial, final = 0.5639141583763609 2.3523921777846766e-13 + Force max component initial, final = 0.22089321768110187 2.037953139577553e-14 + Final line search alpha, max atom move = 0.0 0.0 + Iterations, force evaluations = 1000 1017 + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.1843 | 1.1843 | 1.1843 | 0.0 | 98.25 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.010469 | 0.010469 | 0.010469 | 0.0 | 0.87 +Output | 0.00012213 | 0.00012213 | 0.00012213 | 0.0 | 0.01 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 0.01051 | | | 0.87 + +Nlocal: 687.000 ave 687 max 687 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3239.00 ave 3239 max 3239 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 46844.0 ave 46844 max 46844 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 46844 +Ave neighs/atom = 68.186317 +Neighbor list builds = 0 +Dangerous builds = 0 + + +print """ +---------- PAFI RESULTS -------- +During run: + Average Distance From Hyperplane = ${s_adn}A (Should be very small, around 1e-5A), + Average Force Projection Along MFEP = ${s_apf} eV/A +""" + +---------- PAFI RESULTS -------- +During run: + Average Distance From Hyperplane = 1.36645874805011e-05A (Should be very small, around 1e-5A), + Average Force Projection Along MFEP = -0.117797263023891 eV/A + +print """ +In-plane minimization post-run: +energy = ${s_pe} eV +""" + +In-plane minimization post-run: +energy = -2828.35646618733 eV + +if "${s_maxjump} > 0.1" then "print 'Max Atomic Displacement = ${s_maxjump}A > 0.1A'" "print ' => Possible shallow in-plane metastability: Reduce time in basin and/or decrease tdamp'" else "print 'Max Atomic Displacement = ${s_maxjump}A < 0.1A => No in-plane jumps'" +print 'Max Atomic Displacement = ${s_maxjump}A < 0.1A => No in-plane jumps' +Max Atomic Displacement = 0.00306824174470598A < 0.1A => No in-plane jumps +print """ +Full minimization after removal of PAFI fixes: +energy = ${pe} eV +----- END PAFI ---- +""" + +Full minimization after removal of PAFI fixes: +energy = -2828.57925588226 eV +----- END PAFI ---- + + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:00:05 diff --git a/examples/USER/misc/pafi/log.15Apr20.pafi.g++.4 b/examples/USER/misc/pafi/log.15Apr20.pafi.g++.4 new file mode 100644 index 0000000000..8cda2f91c3 --- /dev/null +++ b/examples/USER/misc/pafi/log.15Apr20.pafi.g++.4 @@ -0,0 +1,401 @@ +LAMMPS (24 Aug 2020) +units metal +atom_style atomic +atom_modify map array sort 0 0.0 +neigh_modify every 2 delay 10 check yes page 1000000 one 100000 + +## read in path data using fix property/atom- here 4th image of a NEB +fix pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz +read_data pafipath.4.data fix pa NULL PafiPath +Reading data file ... + orthogonal box = (0.0000000 0.0000000 0.0000000) to (19.987184 19.987184 19.987184) + 2 by 1 by 2 MPI processor grid + reading atoms ... + 687 atoms + read_data CPU = 0.007 seconds + +## EAM potential +pair_style eam/fs +pair_coeff * * ../../../../potentials/Fe_mm.eam.fs Fe +Reading eam/fs potential file ../../../../potentials/Fe_mm.eam.fs with DATE: 2007-06-11 + +mass * 55.85 +thermo 100 +min_style fire + + +compute pe all pe +variable pe equal pe +run 0 +Neighbor list info ... + update every 2 steps, delay 10 steps, check yes + max neighbors/atom: 100000, page size: 1000000 + master list distance cutoff = 7.3 + ghost atom cutoff = 7.3 + binsize = 3.65, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/fs, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d/newton + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.844 | 6.844 | 6.844 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 +Loop time of 2.82e-06 on 4 procs for 0 steps with 687 atoms + +97.5% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 2.82e-06 | | |100.00 + +Nlocal: 171.750 ave 187 max 163 min +Histogram: 1 1 1 0 0 0 0 0 0 1 +Nghost: 1854.25 ave 1863 max 1839 min +Histogram: 1 0 0 0 0 0 0 1 1 1 +Neighs: 11710.8 ave 12319 max 10647 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 +print "energy=${pe}" +energy=-2828.24917967201 + +## compute property/atom to access relevant fields +compute pa all property/atom d_nx d_ny d_nz d_dnx d_dny d_dnz d_ddnx d_ddny d_ddnz +run 0 +Per MPI rank memory allocation (min/avg/max) = 6.844 | 6.844 | 6.844 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 +Loop time of 2.667e-06 on 4 procs for 0 steps with 687 atoms + +37.5% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 2.667e-06 | | |100.00 + +Nlocal: 171.750 ave 187 max 163 min +Histogram: 1 1 1 0 0 0 0 0 0 1 +Nghost: 1854.25 ave 1863 max 1839 min +Histogram: 1 0 0 0 0 0 0 1 1 1 +Neighs: 11710.8 ave 12319 max 10647 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 + +## fix name group-id pafi compute-id temperature tdamp seed overdamped 0/1 com 0/1 +fix hp all pafi pa 500.0 0.01 434 overdamped no com yes +fix pafi compute name,style: pa,property/atom + +run 0 +Per MPI rank memory allocation (min/avg/max) = 8.344 | 8.344 | 8.344 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 +Loop time of 2.52725e-06 on 4 procs for 0 steps with 687 atoms + +108.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 2.527e-06 | | |100.00 + +Nlocal: 171.750 ave 187 max 163 min +Histogram: 1 1 1 0 0 0 0 0 0 1 +Nghost: 1854.25 ave 1863 max 1839 min +Histogram: 1 0 0 0 0 0 0 1 1 1 +Neighs: 11710.8 ave 12319 max 10647 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 +minimize 0 0 1000 1000 # best if using NEB path +WARNING: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization (../min.cpp:186) + Parameters for fire: + dmax delaystep dtgrow dtshrink alpha0 alphashrink tmax tmin integrator halfstepback + 0.1 20 1.1 0.5 0.25 0.99 10 0.02 eulerimplicit yes +Per MPI rank memory allocation (min/avg/max) = 8.344 | 8.344 | 8.344 Mbytes +Step Temp E_pair E_mol TotEng Press + 0 0 -2828.2492 0 -2828.2492 3015.2014 + 100 9.5973821e-06 -2828.3565 0 -2828.3565 3092.936 + 200 1.501052e-13 -2828.3565 0 -2828.3565 3092.8883 + 300 5.4507205e-14 -2828.3565 0 -2828.3565 3092.8883 + 400 5.0283344e-14 -2828.3565 0 -2828.3565 3092.8883 + 500 4.9056968e-14 -2828.3565 0 -2828.3565 3092.8883 + 600 4.8645528e-14 -2828.3565 0 -2828.3565 3092.8883 + 700 4.8498892e-14 -2828.3565 0 -2828.3565 3092.8882 + 800 4.8444568e-14 -2828.3565 0 -2828.3565 3092.8882 + 900 4.8424653e-14 -2828.3565 0 -2828.3565 3092.8882 + 1000 4.8416878e-14 -2828.3565 0 -2828.3565 3092.8882 +Loop time of 0.43333 on 4 procs for 1000 steps with 687 atoms + +95.4% CPU use with 4 MPI tasks x no OpenMP threads + +Minimization stats: + Stopping criterion = max iterations + Energy initial, next-to-last, final = + -2828.24917967201 -2828.35645843663 -2828.3564584439 + Force two-norm initial, final = 1.2831004431533406 7.468917439994878e-07 + Force max component initial, final = 0.33317058290719853 2.9321733663323357e-07 + Final line search alpha, max atom move = 0.0 0.0 + Iterations, force evaluations = 1000 1007 + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.3303 | 0.34246 | 0.35813 | 1.7 | 79.03 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.046971 | 0.062117 | 0.073961 | 3.9 | 14.33 +Output | 0.00013746 | 0.00014874 | 0.00016997 | 0.0 | 0.03 +Modify | 0.0099064 | 0.01077 | 0.011612 | 0.6 | 2.49 +Other | | 0.01784 | | | 4.12 + +Nlocal: 171.750 ave 187 max 163 min +Histogram: 1 1 1 0 0 0 0 0 0 1 +Nghost: 1854.25 ave 1863 max 1839 min +Histogram: 1 0 0 0 0 0 0 1 1 1 +Neighs: 11710.8 ave 12319 max 10647 min +Histogram: 1 0 0 0 0 0 0 1 1 1 + +Total # of neighbors = 46843 +Ave neighs/atom = 68.184862 +Neighbor list builds = 0 +Dangerous builds = 0 +compute dx all displace/atom +compute dmag all reduce max c_dx[4] +variable maxjump equal sqrt(c_dmag) + +thermo_style custom step pe temp v_maxjump + + +variable dn equal f_hp[4]*f_hp[4] # should be zero to float precision + + +fix af all ave/time 1 1000 1000 f_hp[1] f_hp[2] f_hp[3] v_dn + +variable adn equal sqrt(f_af[4]) # should be very small (approx. 1e-6 A) +variable apf equal f_af[1] + + +run 1000 +Per MPI rank memory allocation (min/avg/max) = 8.719 | 8.719 | 8.719 Mbytes +Step PotEng Temp v_maxjump + 1000 -2828.3565 4.8416878e-14 3.9625012e-08 + 1100 -2787.3877 503.1749 0.53858794 + 1200 -2783.8463 508.91879 0.57609619 + 1300 -2782.5288 533.03961 0.64090828 + 1400 -2782.4551 508.05688 0.61706248 + 1500 -2784.0499 538.34202 0.56379358 + 1600 -2786.4068 487.9633 0.57600511 + 1700 -2780.7727 489.2309 0.61048418 + 1800 -2780.4909 519.01911 0.60204913 + 1900 -2782.0825 512.3441 0.6071772 + 2000 -2779.5449 526.21838 0.58247597 +Loop time of 0.446418 on 4 procs for 1000 steps with 687 atoms + +Performance: 193.541 ns/day, 0.124 hours/ns, 2240.053 timesteps/s +95.8% CPU use with 4 MPI tasks x no OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.34383 | 0.35018 | 0.35655 | 0.9 | 78.44 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.049244 | 0.055398 | 0.061404 | 2.2 | 12.41 +Output | 0.00015376 | 0.00016326 | 0.00018954 | 0.0 | 0.04 +Modify | 0.034111 | 0.034443 | 0.03473 | 0.1 | 7.72 +Other | | 0.006229 | | | 1.40 + +Nlocal: 171.750 ave 183 max 165 min +Histogram: 1 1 0 1 0 0 0 0 0 1 +Nghost: 1854.25 ave 1861 max 1843 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Neighs: 11711.0 ave 12115 max 10983 min +Histogram: 1 0 0 0 0 0 1 0 1 1 + +Total # of neighbors = 46844 +Ave neighs/atom = 68.186317 +Neighbor list builds = 0 +Dangerous builds = 0 +minimize 0 0 1000 1000 +WARNING: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization (../min.cpp:186) + Parameters for fire: + dmax delaystep dtgrow dtshrink alpha0 alphashrink tmax tmin integrator halfstepback + 0.1 20 1.1 0.5 0.25 0.99 10 0.02 eulerimplicit yes +Per MPI rank memory allocation (min/avg/max) = 9.219 | 9.219 | 9.219 Mbytes +Step PotEng Temp v_maxjump + 2000 -2779.5449 0 0.58247597 + 2100 -2828.3564 5.5901288e-06 0.022258122 + 2200 -2828.3565 2.5724945e-11 0.0014462408 + 2300 -2828.3565 5.8980018e-14 0.0018217607 + 2400 -2828.3565 5.1597335e-14 0.0020531463 + 2500 -2828.3565 4.9451623e-14 0.0022588465 + 2600 -2828.3565 4.8775183e-14 0.0024468988 + 2700 -2828.3565 4.8538707e-14 0.0026213819 + 2800 -2828.3565 4.8450209e-14 0.0027849194 + 2900 -2828.3565 4.8421002e-14 0.0029393609 + 3000 -2828.3565 4.8409037e-14 0.0030860795 +Loop time of 0.432206 on 4 procs for 1000 steps with 687 atoms + +91.9% CPU use with 4 MPI tasks x no OpenMP threads + +Minimization stats: + Stopping criterion = max iterations + Energy initial, next-to-last, final = + -2779.54493572831 -2828.35646627033 -2828.3564662776 + Force two-norm initial, final = 29.30132707276523 7.469232246845132e-07 + Force max component initial, final = 2.0790292865239595 2.9323707292916446e-07 + Final line search alpha, max atom move = 0.0 0.0 + Iterations, force evaluations = 1000 1008 + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.33828 | 0.34752 | 0.35566 | 1.1 | 80.41 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.04768 | 0.056242 | 0.065447 | 2.8 | 13.01 +Output | 0.00016892 | 0.00018009 | 0.00020427 | 0.0 | 0.04 +Modify | 0.010016 | 0.010698 | 0.011316 | 0.4 | 2.48 +Other | | 0.01756 | | | 4.06 + +Nlocal: 171.750 ave 184 max 165 min +Histogram: 1 0 2 0 0 0 0 0 0 1 +Nghost: 1828.25 ave 1835 max 1815 min +Histogram: 1 0 0 0 0 0 0 1 0 2 +Neighs: 12157.5 ave 12578 max 11155 min +Histogram: 1 0 0 0 0 0 0 0 0 3 + +Total # of neighbors = 48630 +Ave neighs/atom = 70.786026 +Neighbor list builds = 0 +Dangerous builds = 0 + +variable s_pe equal ${pe} +variable s_pe equal -2828.3564662776 +variable s_apf equal ${apf} +variable s_apf equal -0.44222069537824 +variable s_adn equal ${adn} +variable s_adn equal 1.36645875188617e-05 +variable s_maxjump equal ${maxjump} +variable s_maxjump equal 0.00308607949485962 + +unfix hp +unfix pa +unfix af +minimize 0 0 1000 1000 +WARNING: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization (../min.cpp:186) + Parameters for fire: + dmax delaystep dtgrow dtshrink alpha0 alphashrink tmax tmin integrator halfstepback + 0.1 20 1.1 0.5 0.25 0.99 10 0.02 eulerimplicit yes +Per MPI rank memory allocation (min/avg/max) = 8.719 | 8.719 | 8.719 Mbytes +Step PotEng Temp v_maxjump + 3000 -2828.3565 0 0.0030860795 + 3100 -2828.5793 0.00016081696 0.5434931 + 3200 -2828.5793 1.1620338e-14 0.54386121 + 3300 -2828.5793 4.4708247e-19 0.54386124 + 3400 -2828.5793 1.0642423e-23 0.54386124 + 3500 -2828.5793 1.9858026e-25 0.54386124 + 3600 -2828.5793 1.395464e-25 0.54386124 + 3700 -2828.5793 2.0687121e-25 0.54386124 + 3800 -2828.5793 1.3586688e-25 0.54386124 + 3900 -2828.5793 2.0485828e-25 0.54386124 + 4000 -2828.5793 1.3803592e-25 0.54386124 +Loop time of 0.427843 on 4 procs for 1000 steps with 687 atoms + +96.5% CPU use with 4 MPI tasks x no OpenMP threads + +Minimization stats: + Stopping criterion = max iterations + Energy initial, next-to-last, final = + -2828.3564662776 -2828.57925588218 -2828.57925588218 + Force two-norm initial, final = 0.5639144322930092 2.34573110665124e-13 + Force max component initial, final = 0.22089332498188619 2.0969337377607644e-14 + Final line search alpha, max atom move = 0.0 0.0 + Iterations, force evaluations = 1000 1017 + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.34748 | 0.35476 | 0.3611 | 0.9 | 82.92 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.049149 | 0.054906 | 0.062132 | 2.2 | 12.83 +Output | 0.00015435 | 0.00016534 | 0.00018687 | 0.0 | 0.04 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 0.01801 | | | 4.21 + +Nlocal: 171.750 ave 183 max 165 min +Histogram: 1 1 0 1 0 0 0 0 0 1 +Nghost: 1854.25 ave 1861 max 1843 min +Histogram: 1 0 0 0 0 0 1 0 1 1 +Neighs: 11711.0 ave 12115 max 10983 min +Histogram: 1 0 0 0 0 0 1 0 1 1 + +Total # of neighbors = 46844 +Ave neighs/atom = 68.186317 +Neighbor list builds = 0 +Dangerous builds = 0 + + +print """ +---------- PAFI RESULTS -------- +During run: + Average Distance From Hyperplane = ${s_adn}A (Should be very small, around 1e-5A), + Average Force Projection Along MFEP = ${s_apf} eV/A +""" + +---------- PAFI RESULTS -------- +During run: + Average Distance From Hyperplane = 1.36645875188617e-05A (Should be very small, around 1e-5A), + Average Force Projection Along MFEP = -0.44222069537824 eV/A + +print """ +In-plane minimization post-run: +energy = ${s_pe} eV +""" + +In-plane minimization post-run: +energy = -2828.3564662776 eV + +if "${s_maxjump} > 0.1" then "print 'Max Atomic Displacement = ${s_maxjump}A > 0.1A'" "print ' => Possible shallow in-plane metastability: Reduce time in basin and/or decrease tdamp'" else "print 'Max Atomic Displacement = ${s_maxjump}A < 0.1A => No in-plane jumps'" +print 'Max Atomic Displacement = ${s_maxjump}A < 0.1A => No in-plane jumps' +Max Atomic Displacement = 0.00308607949485962A < 0.1A => No in-plane jumps +print """ +Full minimization after removal of PAFI fixes: +energy = ${pe} eV +----- END PAFI ---- +""" + +Full minimization after removal of PAFI fixes: +energy = -2828.57925588218 eV +----- END PAFI ---- + + +Please see the log.cite file for references relevant to this simulation + +Total wall time: 0:00:01 diff --git a/examples/USER/misc/pafi/pafipath.4.data b/examples/USER/misc/pafi/pafipath.4.data new file mode 100644 index 0000000000..58f2c5a660 --- /dev/null +++ b/examples/USER/misc/pafi/pafipath.4.data @@ -0,0 +1,1391 @@ +LAMMPS dump file + +687 atoms +1 atom types + +0. 19.987184 xlo xhi +0. 19.987184 ylo yhi +0. 19.987184 zlo zhi + +Masses + + 1 55.85 + Atoms + +1 1 0.00448604 0.00299371 1.25552e-05 +2 1 1.42757 1.42374 1.42237 +3 1 2.85768 -0.000111595 -0.00117603 +4 1 4.28206 1.42351 1.42428 +5 1 5.71045 0.000184061 0.000357624 +6 1 7.1368 1.42501 1.42562 +7 1 8.56373 0.00179453 0.00172992 +8 1 9.99168 1.42642 1.42598 +9 1 11.4187 0.00327202 0.00227737 +10 1 12.8474 1.42747 1.42572 +11 1 14.2756 0.0045707 0.00236301 +12 1 15.705 1.42755 1.42471 +13 1 17.1345 0.00506352 0.00188451 +14 1 18.5638 1.42578 1.4228 +15 1 0.000182033 2.85273 19.9829 +16 1 1.42429 4.27664 1.42129 +17 1 2.85404 2.85113 19.984 +18 1 4.27845 4.27627 1.42291 +19 1 5.70979 2.85265 19.9858 +20 1 7.13648 4.2798 1.42573 +21 1 8.56475 2.85452 19.9865 +22 1 9.99207 4.28151 1.426 +23 1 11.4195 2.85554 19.9864 +24 1 12.8476 4.28148 1.42552 +25 1 14.2753 2.8555 19.9858 +26 1 15.7066 4.27861 1.4226 +27 1 17.133 2.85398 19.9842 +28 1 18.5621 4.27835 1.42129 +29 1 -0.000538145 5.70632 19.9841 +30 1 1.42454 7.13442 1.42295 +31 1 2.85195 5.70592 19.9856 +32 1 4.27826 7.13446 1.42492 +33 1 5.7078 5.70701 19.9874 +34 1 7.13443 7.13513 1.42756 +35 1 8.56461 5.70993 19.9881 +36 1 9.99203 7.13802 1.42927 +37 1 11.4196 5.71081 19.9877 +38 1 12.8496 7.13615 1.42706 +39 1 14.2762 5.70905 19.9864 +40 1 15.7063 7.13567 1.42404 +41 1 17.1323 5.70823 19.9845 +42 1 18.5624 7.13482 1.4227 +43 1 0.000696865 8.56319 19.9865 +44 1 1.426 9.99355 1.42486 +45 1 2.85222 8.5637 19.9875 +46 1 4.27978 9.99352 1.4268 +47 1 5.70775 8.56419 19.989 +48 1 7.13672 9.99198 1.43004 +49 1 8.56417 8.56538 19.9886 +50 1 9.99289 9.99123 1.43118 +51 1 11.4205 8.56619 19.9884 +52 1 12.849 9.99338 1.42926 +53 1 14.2761 8.56576 19.9882 +54 1 15.7069 9.99395 1.42585 +55 1 17.1337 8.56386 19.9875 +56 1 18.5635 9.99327 1.42454 +57 1 0.00227377 11.4219 0.00147796 +58 1 1.42804 12.8521 1.42671 +59 1 2.85342 11.4223 0.00180127 +60 1 4.28227 12.8506 1.42863 +61 1 5.70881 11.4211 0.0031342 +62 1 7.13884 12.8475 1.43098 +63 1 8.56508 11.4205 0.00269639 +64 1 9.9936 12.8465 1.43168 +65 1 11.4213 11.4218 0.00260934 +66 1 12.849 12.8502 1.43019 +67 1 14.2779 11.4226 0.00247567 +68 1 15.7072 12.8522 1.42747 +69 1 17.1356 11.4219 0.0026081 +70 1 18.5645 12.8524 1.4262 +71 1 0.003965 14.281 0.00320774 +72 1 1.43042 15.7085 1.42837 +73 1 2.85515 14.2801 0.00315607 +74 1 4.28467 15.7055 1.4304 +75 1 5.71011 14.278 0.00441222 +76 1 7.13933 15.7032 1.43146 +77 1 8.56579 14.276 0.00441963 +78 1 9.99251 15.7041 1.43141 +79 1 11.4205 14.2783 0.00416102 +80 1 12.8478 15.7065 1.43075 +81 1 14.2794 14.2819 0.00500693 +82 1 15.707 15.7097 1.42924 +83 1 17.1371 14.2816 0.00478647 +84 1 18.565 15.7101 1.42787 +85 1 0.00533603 17.1383 0.0037217 +86 1 1.43181 18.5614 1.42781 +87 1 2.85722 17.1354 0.003011 +88 1 4.28514 18.5591 1.42893 +89 1 5.71156 17.1331 0.00356601 +90 1 7.13782 18.5594 1.43003 +91 1 8.56433 17.1339 0.00497866 +92 1 9.99142 18.5608 1.43029 +93 1 11.419 17.1359 0.00556187 +94 1 12.8471 18.5624 1.42976 +95 1 14.2772 17.1383 0.00595758 +96 1 15.7052 18.5641 1.42883 +97 1 17.1374 17.1402 0.00598099 +98 1 18.5641 18.564 1.42768 +99 1 0.00409482 19.9874 2.8511 +100 1 1.42553 1.42159 4.27937 +101 1 2.85637 19.9845 2.85345 +102 1 4.27927 1.42089 4.2793 +103 1 5.7104 19.9852 2.85508 +104 1 7.13674 1.42404 4.28191 +105 1 8.56417 19.9868 2.85544 +106 1 9.9921 1.42561 4.28228 +107 1 11.4191 19.9882 2.85485 +108 1 12.848 1.42652 4.28113 +109 1 14.2758 19.9893 2.8534 +110 1 15.7078 1.4249 4.27787 +111 1 17.1354 19.9892 2.85118 +112 1 18.5642 1.4239 4.27842 +113 1 0.000556869 2.85006 2.84979 +114 1 1.422 4.27452 4.2767 +115 1 2.84624 2.84313 2.84486 +116 1 4.25891 4.25785 4.26023 +117 1 5.70698 2.84634 2.84826 +118 1 7.13448 4.26762 4.26953 +119 1 8.56424 2.8485 2.84953 +120 1 9.99236 4.26985 4.2707 +121 1 11.4202 2.84976 2.84967 +122 1 12.8489 4.27123 4.2713 +123 1 14.2776 2.84977 2.84875 +124 1 15.724 4.2622 4.26211 +125 1 17.1403 2.84643 2.8452 +126 1 18.5635 4.27636 4.277 +127 1 0.000168547 5.70509 2.84936 +128 1 1.42307 7.13372 4.27749 +129 1 2.84455 5.70222 2.84457 +130 1 4.26008 7.1291 4.2629 +131 1 5.70156 5.70098 2.84905 +132 1 7.12123 7.12358 4.27232 +133 1 8.56382 5.70744 2.85401 +134 1 9.99114 7.13622 4.28612 +135 1 11.4197 5.70843 2.854 +136 1 12.8614 7.12515 4.2724 +137 1 14.2822 5.70267 2.84851 +138 1 15.723 7.12977 4.26312 +139 1 17.1403 5.70379 2.84469 +140 1 18.5648 7.1328 4.27583 +141 1 0.00127881 8.56337 2.85048 +142 1 1.42492 9.99366 4.27913 +143 1 2.84679 8.56494 2.84743 +144 1 4.26715 9.99868 4.26941 +145 1 5.70372 8.56357 2.8521 +146 1 7.13212 9.99082 4.28405 +147 1 8.56086 8.56115 2.85841 +148 1 9.99282 9.9837 4.28446 +149 1 11.4236 8.56168 2.85777 +150 1 12.8548 9.99207 4.28039 +151 1 14.2813 8.56402 2.85062 +152 1 15.7206 9.99759 4.26601 +153 1 17.1401 8.56434 2.84615 +154 1 18.5661 9.99212 4.27588 +155 1 0.00263103 11.4225 2.85174 +156 1 1.42712 12.8513 4.28122 +157 1 2.84991 11.425 2.85026 +158 1 4.27477 12.8561 4.27641 +159 1 5.70849 11.4219 2.85479 +160 1 7.13934 12.8475 4.28593 +161 1 8.56568 11.4173 2.86077 +162 1 9.99452 12.8438 4.28907 +163 1 11.4216 11.4186 2.86023 +164 1 12.8518 12.8526 4.281 +165 1 14.2798 11.4234 2.85279 +166 1 15.717 12.8583 4.27082 +167 1 17.1402 11.4249 2.84777 +168 1 18.567 12.8516 4.27683 +169 1 0.00416979 14.2803 2.85317 +170 1 1.43022 15.706 4.28307 +171 1 2.85403 14.2807 2.85369 +172 1 4.28508 15.7028 4.28565 +173 1 5.71207 14.2761 2.85758 +174 1 7.14016 15.7002 4.28729 +175 1 8.56721 14.2735 2.85944 +176 1 9.9925 15.7021 4.28568 +177 1 11.4199 14.2758 2.85856 +178 1 12.8481 15.7054 4.28299 +179 1 14.2787 14.2808 2.8543 +180 1 15.7102 15.7106 4.27758 +181 1 17.1392 14.283 2.85015 +182 1 18.5674 15.7094 4.27757 +183 1 0.00530324 17.1355 2.85385 +184 1 1.4302 18.5604 4.28139 +185 1 2.85834 17.1324 2.85671 +186 1 4.28438 18.558 4.28368 +187 1 5.71249 17.1302 2.85828 +188 1 7.13774 18.5592 4.28398 +189 1 8.56519 17.1308 2.85818 +190 1 9.99094 18.5614 4.28261 +191 1 11.4193 17.1328 2.85709 +192 1 12.8471 18.5634 4.28037 +193 1 14.2764 17.1353 2.85507 +194 1 15.7078 18.5659 4.27676 +195 1 17.1365 17.1373 2.85278 +196 1 18.567 18.5656 4.27646 +197 1 0.00243376 19.9863 5.70907 +198 1 1.42501 1.42238 7.13866 +199 1 2.85516 19.9839 5.71062 +200 1 4.27966 1.42202 7.13836 +201 1 5.70991 19.9844 5.71128 +202 1 7.13519 1.42474 7.13764 +203 1 8.56506 19.9865 5.71219 +204 1 9.99273 1.42779 7.13909 +205 1 11.4199 19.9879 5.71089 +206 1 12.8504 1.42703 7.13644 +207 1 14.2779 19.9886 5.70773 +208 1 15.7075 1.42546 7.13629 +209 1 17.1363 19.9887 5.70688 +210 1 18.5624 1.42428 7.13821 +211 1 -0.000551931 2.84997 5.70876 +212 1 1.42191 4.27626 7.13705 +213 1 2.8445 2.8424 5.70534 +214 1 4.25887 4.2595 7.13052 +215 1 5.70109 2.84577 5.70271 +216 1 7.11883 4.26758 7.12298 +217 1 8.56402 2.85194 5.70851 +218 1 9.99136 4.28423 7.13521 +219 1 11.4203 2.85333 5.70875 +220 1 12.8617 4.27314 7.12503 +221 1 14.2828 2.84917 5.70308 +222 1 15.7228 4.26472 7.13063 +223 1 17.1408 2.84589 5.70505 +224 1 18.5613 4.2784 7.13748 +225 1 -0.00104851 5.70514 5.70725 +226 1 1.42303 7.13324 7.13526 +227 1 2.8434 5.6983 5.7006 +228 1 4.25921 7.11924 7.12135 +229 1 5.65843 5.66088 5.66279 +230 1 7.02006 7.02903 7.03201 +231 1 8.57021 5.69111 5.69246 +232 1 9.98839 7.16674 7.16381 +233 1 11.4119 5.69495 5.69493 +234 1 12.9515 7.04195 7.03968 +235 1 14.3206 5.66722 5.66665 +236 1 15.7187 7.12691 7.12492 +237 1 17.1395 5.70196 5.70217 +238 1 18.561 7.13418 7.13552 +239 1 0.000217072 8.56346 5.70766 +240 1 1.42565 9.99273 7.13711 +241 1 2.84613 8.56345 5.70407 +242 1 4.27553 9.99386 7.12984 +243 1 5.6675 8.56382 5.67559 +244 1 7.09459 10.0252 7.09178 +245 1 8.5354 8.54154 5.70435 +246 1 9.99561 9.96856 7.06132 +247 1 11.4469 8.54336 5.70169 +248 1 12.8974 10.0223 7.08287 +249 1 14.3157 8.56335 5.67387 +250 1 15.7212 9.98736 7.11722 +251 1 17.1433 8.56006 5.69924 +252 1 18.5616 9.99246 7.13525 +253 1 0.0014156 11.4215 5.70849 +254 1 1.42693 12.8486 7.13934 +255 1 2.84964 11.4234 5.70789 +256 1 4.28037 12.847 7.14064 +257 1 5.68761 11.4352 5.69133 +258 1 7.14648 12.8334 7.15265 +259 1 8.56323 11.419 5.71594 +260 1 9.99608 12.8219 7.1582 +261 1 11.4282 11.4217 5.713 +262 1 12.8593 12.8497 7.12552 +263 1 14.3034 11.4362 5.68706 +264 1 15.7271 12.8522 7.11767 +265 1 17.145 11.4214 5.69882 +266 1 18.5632 12.8507 7.13557 +267 1 0.00306628 14.2786 5.70933 +268 1 1.4277 15.706 7.13795 +269 1 2.85459 14.2767 5.71193 +270 1 4.27814 15.7088 7.13409 +271 1 5.71344 14.2709 5.71597 +272 1 7.13953 15.7026 7.13829 +273 1 8.5693 14.2682 5.71799 +274 1 9.98891 15.709 7.13327 +275 1 11.419 14.2729 5.71687 +276 1 12.854 15.7234 7.11684 +277 1 14.2854 14.283 5.70535 +278 1 15.7343 15.7337 7.10897 +279 1 17.1453 14.2829 5.69922 +280 1 18.5656 15.7106 7.13384 +281 1 0.00406177 17.1354 5.70824 +282 1 1.42837 18.5598 7.1384 +283 1 2.85511 17.1337 5.70952 +284 1 4.28405 18.5579 7.13978 +285 1 5.71203 17.1306 5.71193 +286 1 7.1392 18.5577 7.14081 +287 1 8.56409 17.1329 5.71022 +288 1 9.99307 18.5592 7.14017 +289 1 11.4175 17.1372 5.70597 +290 1 12.8498 18.5617 7.13592 +291 1 14.2816 17.1433 5.69913 +292 1 15.7101 18.5652 7.13291 +293 1 17.1464 17.1464 5.69676 +294 1 18.5648 18.5638 7.13648 +295 1 0.00151496 19.9867 8.56686 +296 1 1.42508 1.42384 9.99627 +297 1 2.85497 19.9847 8.56753 +298 1 4.28088 1.42361 9.99603 +299 1 5.71114 19.9847 8.56813 +300 1 7.13827 1.42706 9.9941 +301 1 8.56629 19.9859 8.56778 +302 1 9.99375 1.4292 9.99167 +303 1 11.422 19.9867 8.5663 +304 1 12.8487 1.4287 9.99278 +305 1 14.2781 19.9879 8.5646 +306 1 15.7049 1.42646 9.995 +307 1 17.1341 19.9881 8.5661 +308 1 18.561 1.42562 9.9959 +309 1 -0.00154693 2.85178 8.56743 +310 1 1.42217 4.2785 9.99597 +311 1 2.84605 2.84521 8.56794 +312 1 4.26501 4.26584 10.0006 +313 1 5.70359 2.84893 8.56603 +314 1 7.13045 4.28031 9.99272 +315 1 8.56053 2.85598 8.56163 +316 1 9.99012 4.28274 9.9819 +317 1 11.4234 2.85756 8.56164 +318 1 12.8518 4.28351 9.99085 +319 1 14.2806 2.85211 8.56471 +320 1 15.7148 4.27206 10 +321 1 17.1373 2.84887 8.56767 +322 1 18.5592 4.28096 9.99591 +323 1 -0.00250389 5.70808 8.56673 +324 1 1.42384 7.13643 9.99442 +325 1 2.84473 5.70181 8.56541 +326 1 4.27238 7.12626 9.99578 +327 1 5.66379 5.67013 8.56343 +328 1 7.0835 7.07985 10.0252 +329 1 8.52987 5.69661 8.53691 +330 1 9.98155 7.05425 9.94841 +331 1 11.4459 5.7031 8.54093 +332 1 12.8977 7.0888 10.0145 +333 1 14.3154 5.67732 8.56157 +334 1 15.7037 7.13645 9.99678 +335 1 17.1352 5.70697 8.56632 +336 1 18.557 7.13856 9.99474 +337 1 -0.00212376 8.56479 8.5656 +338 1 1.4258 9.99322 9.99389 +339 1 2.84757 8.56127 8.56306 +340 1 4.28735 9.98746 9.99151 +341 1 5.65677 8.54528 8.54855 +342 1 7.16728 9.96312 9.97425 +343 1 8.21067 8.38648 8.39718 +344 1 9.96626 9.32695 9.30023 +345 1 11.7487 8.40368 8.40163 +346 1 12.7895 10.001 9.98895 +347 1 14.3143 8.56199 8.55455 +348 1 15.6978 9.99473 9.98831 +349 1 17.1348 8.56359 8.56309 +350 1 18.5556 9.99576 9.99342 +351 1 -0.00132574 11.4213 8.56631 +352 1 1.42629 12.8493 9.99431 +353 1 2.85404 11.4186 8.56775 +354 1 4.28053 12.8528 9.99302 +355 1 5.70507 11.4136 8.57147 +356 1 7.10701 12.8905 9.96761 +357 1 8.60294 11.3881 8.64515 +358 1 10.0138 12.9425 10.015 +359 1 11.4245 11.404 8.61006 +360 1 12.9666 12.9702 9.8333 +361 1 14.3105 11.4083 8.54241 +362 1 15.7128 12.8678 9.98055 +363 1 17.1335 11.4221 8.56269 +364 1 18.5577 12.8528 9.99246 +365 1 0.000285193 14.2785 8.56552 +366 1 1.42622 15.7054 9.99448 +367 1 2.85224 14.2779 8.56563 +368 1 4.27536 15.7111 9.9908 +369 1 5.69621 14.2898 8.55387 +370 1 7.14106 15.6996 9.99891 +371 1 8.56755 14.2758 8.56294 +372 1 9.99932 15.7052 10.0028 +373 1 11.4225 14.301 8.54252 +374 1 12.8699 15.7186 9.98128 +375 1 14.3381 14.336 8.50604 +376 1 15.7206 15.7211 9.9958 +377 1 17.139 14.2868 8.55783 +378 1 18.5618 15.7073 9.99448 +379 1 0.0016734 17.1338 8.56639 +380 1 1.42762 18.5602 9.99474 +381 1 2.85325 17.134 8.56538 +382 1 4.28357 18.5585 9.99498 +383 1 5.71258 17.13 8.5679 +384 1 7.14072 18.5564 9.99637 +385 1 8.56751 17.1279 8.56978 +386 1 9.99648 18.5561 9.99613 +387 1 11.4236 17.1302 8.56544 +388 1 12.8527 18.5593 9.99264 +389 1 14.2873 17.139 8.55677 +390 1 15.707 18.5632 9.99368 +391 1 17.1415 17.1418 8.56387 +392 1 18.5642 18.5644 9.99401 +393 1 0.00124759 0.000815388 11.4233 +394 1 1.42574 1.42555 12.8519 +395 1 2.85511 -0.00151506 11.4232 +396 1 4.28253 1.42523 12.8507 +397 1 5.71193 -0.00142742 11.4222 +398 1 7.14021 1.42786 12.8478 +399 1 8.56814 -0.00112058 11.4211 +400 1 9.9939 1.42956 12.8462 +401 1 11.4229 -0.000454533 11.4212 +402 1 12.847 1.42936 12.8487 +403 1 14.2764 0.000818757 11.4223 +404 1 15.7033 1.4281 12.8507 +405 1 17.1331 0.00193834 11.4229 +406 1 18.5603 1.42727 12.8517 +407 1 -0.00206847 2.85337 11.4239 +408 1 1.4227 4.28055 12.8513 +409 1 2.84791 2.84776 11.4263 +410 1 4.27116 4.27215 12.8575 +411 1 5.70805 2.85171 11.4237 +412 1 7.13742 4.28255 12.8501 +413 1 8.56567 2.85942 11.4182 +414 1 9.99111 4.28951 12.8447 +415 1 11.4195 2.8603 11.4178 +416 1 12.8463 4.28471 12.849 +417 1 14.2758 2.8548 11.4225 +418 1 15.7087 4.27812 12.855 +419 1 17.1347 2.85126 11.4255 +420 1 18.558 4.28306 12.8507 +421 1 -0.00326044 5.71039 11.4225 +422 1 1.42333 7.13894 12.8491 +423 1 2.84655 5.70541 11.4248 +424 1 4.27388 7.13547 12.8511 +425 1 5.68317 5.68606 11.4384 +426 1 7.13242 7.1412 12.8434 +427 1 8.56176 5.71643 11.4214 +428 1 9.98583 7.17053 12.8308 +429 1 11.4188 5.7151 11.4189 +430 1 12.851 7.14406 12.8449 +431 1 14.2924 5.69646 11.4352 +432 1 15.7003 7.14601 12.8478 +433 1 17.1318 5.71102 11.4241 +434 1 18.5564 7.14119 12.8481 +435 1 -0.00344302 8.56813 11.4212 +436 1 1.42473 9.99434 12.8504 +437 1 2.85196 8.56581 11.421 +438 1 4.27641 9.98921 12.8593 +439 1 5.69994 8.56447 11.4203 +440 1 7.0918 9.95812 12.9145 +441 1 8.5818 8.61273 11.4024 +442 1 9.98221 9.99539 13.0479 +443 1 11.4155 8.55204 11.3898 +444 1 12.8122 10.0024 12.8537 +445 1 14.2692 8.58987 11.4189 +446 1 15.7024 9.99643 12.8565 +447 1 17.1272 8.57126 11.4202 +448 1 18.5556 9.99699 12.8501 +449 1 -0.00297007 11.4235 11.4223 +450 1 1.42534 12.8505 12.8516 +451 1 2.85213 11.4204 11.4227 +452 1 4.27372 12.8556 12.8585 +453 1 5.6706 11.418 11.4264 +454 1 7.06123 12.9195 12.9257 +455 1 8.22958 11.5201 11.5302 +456 1 10.0104 12.8005 12.8223 +457 1 11.9793 11.8351 11.521 +458 1 13.0121 13.0222 13.0857 +459 1 14.3453 11.4428 11.4239 +460 1 15.7111 12.8695 12.871 +461 1 17.132 11.4285 11.4228 +462 1 18.5572 12.8538 12.8538 +463 1 -0.00147547 14.2777 11.4229 +464 1 1.42548 15.7067 12.851 +465 1 2.85097 14.2785 11.4229 +466 1 4.27137 15.7149 12.8542 +467 1 5.68303 14.2983 11.4231 +468 1 7.13303 15.7052 12.8575 +469 1 8.55795 14.268 11.4449 +470 1 9.9991 15.6977 12.8526 +471 1 11.4789 14.3259 11.4464 +472 1 12.8778 15.7268 12.8791 +473 1 14.2868 14.2833 11.4264 +474 1 15.7269 15.7286 12.852 +475 1 17.1318 14.2814 11.4247 +476 1 18.5621 15.7088 12.8521 +477 1 0.00112373 17.1342 11.4227 +478 1 1.42739 18.5615 12.8506 +479 1 2.85213 17.1349 11.422 +480 1 4.28318 18.5599 12.8502 +481 1 5.71036 17.1313 11.4231 +482 1 7.13958 18.5584 12.8494 +483 1 8.56845 17.1259 11.4261 +484 1 9.99636 18.557 12.8495 +485 1 11.4315 17.1315 11.4268 +486 1 12.8533 18.5613 12.8543 +487 1 14.2835 17.1351 11.4244 +488 1 15.7077 18.5651 12.8521 +489 1 17.1427 17.1439 11.4219 +490 1 18.5646 18.566 12.851 +491 1 0.00165724 0.00256297 14.279 +492 1 1.4273 1.4275 15.7056 +493 1 2.85576 0.000182233 14.2779 +494 1 4.28401 1.42715 15.7038 +495 1 5.71224 5.23408e-05 14.2762 +496 1 7.13964 1.42841 15.7026 +497 1 8.56732 0.00038323 14.2749 +498 1 9.99275 1.42959 15.7029 +499 1 11.4206 0.00128643 14.2768 +500 1 12.8463 1.43053 15.704 +501 1 14.2771 0.00335754 14.28 +502 1 15.7034 1.43046 15.7058 +503 1 17.1335 0.00395395 14.2793 +504 1 18.5602 1.42931 15.7058 +505 1 -0.00187122 2.85497 14.278 +506 1 1.42449 4.28183 15.704 +507 1 2.85086 2.8509 14.2801 +508 1 4.28002 4.28021 15.7045 +509 1 5.71087 2.85387 14.2768 +510 1 7.13755 4.28345 15.7032 +511 1 8.56686 2.8576 14.2746 +512 1 9.99226 4.28575 15.7025 +513 1 11.4183 2.85879 14.2742 +514 1 12.8456 4.28649 15.7014 +515 1 14.2742 2.85657 14.2769 +516 1 15.7028 4.28421 15.7034 +517 1 17.1324 2.85428 14.2792 +518 1 18.5572 4.28424 15.7032 +519 1 -0.0033298 5.71153 14.2761 +520 1 1.4229 7.13632 15.7058 +521 1 2.84911 5.70827 14.278 +522 1 4.2698 7.12716 15.7152 +523 1 5.70534 5.70803 14.2763 +524 1 7.12354 7.12356 15.7193 +525 1 8.56521 5.71626 14.2734 +526 1 9.99156 7.1327 15.7135 +527 1 11.4153 5.71868 14.2697 +528 1 12.8564 7.13141 15.7124 +529 1 14.2759 5.71267 14.2752 +530 1 15.7025 7.14049 15.7045 +531 1 17.1292 5.71389 14.2758 +532 1 18.5582 7.1383 15.7041 +533 1 -0.00294776 8.56709 14.2769 +534 1 1.42359 9.99346 15.7075 +535 1 2.84785 8.56315 14.2813 +536 1 4.2679 9.98856 15.7191 +537 1 5.68425 8.54536 14.3022 +538 1 7.12192 9.99337 15.7214 +539 1 8.53647 8.54005 14.3079 +540 1 9.99482 10.0051 15.7225 +541 1 11.4358 8.54309 14.2995 +542 1 12.8534 9.99823 15.7149 +543 1 14.2733 8.57289 14.2783 +544 1 15.7197 9.98391 15.7232 +545 1 17.1318 8.567 14.2779 +546 1 18.5602 9.99361 15.7072 +547 1 -0.00231752 11.4231 14.2789 +548 1 1.42453 12.8514 15.7088 +549 1 2.84871 11.4222 14.2821 +550 1 4.26705 12.8564 15.7207 +551 1 5.67453 11.4232 14.3092 +552 1 7.118 12.8661 15.7236 +553 1 8.52098 11.4529 14.3062 +554 1 9.99433 12.8562 15.7153 +555 1 11.4745 11.475 14.3054 +556 1 12.8769 12.8785 15.749 +557 1 14.3195 11.4086 14.3178 +558 1 15.7357 12.8547 15.7413 +559 1 17.133 11.4254 14.2834 +560 1 18.5628 12.8522 15.7114 +561 1 -0.000461417 14.2803 14.2809 +562 1 1.42576 15.7094 15.709 +563 1 2.84934 14.282 14.2826 +564 1 4.26941 15.7193 15.7192 +565 1 5.67794 14.3082 14.3098 +566 1 7.13934 15.7108 15.7131 +567 1 8.57731 14.2805 14.2871 +568 1 9.98396 15.7259 15.7285 +569 1 11.4045 14.3202 14.3195 +570 1 12.8528 15.7391 15.7427 +571 1 14.3593 14.3624 14.3694 +572 1 15.7444 15.7466 15.7483 +573 1 17.1398 14.2896 14.2912 +574 1 18.5655 15.7134 15.7131 +575 1 0.00150262 17.1362 14.2795 +576 1 1.42796 18.5636 15.7068 +577 1 2.85095 17.1377 14.2802 +578 1 4.28319 18.5621 15.7061 +579 1 5.70875 17.1346 14.2809 +580 1 7.13911 18.5613 15.7044 +581 1 8.56686 17.1315 14.2774 +582 1 9.99185 18.5635 15.7069 +583 1 11.4225 17.1348 14.2842 +584 1 12.8489 18.5662 15.7109 +585 1 14.2913 17.1461 14.2949 +586 1 15.7114 18.5698 15.7139 +587 1 17.1451 17.1474 14.283 +588 1 18.5659 18.5685 15.7091 +589 1 0.00288833 0.00420169 17.134 +590 1 1.42919 1.42791 18.5577 +591 1 2.85699 0.00158441 17.1321 +592 1 4.28406 1.42694 18.5578 +593 1 5.71197 0.00109634 17.1313 +594 1 7.13792 1.42825 18.5588 +595 1 8.56484 0.00268426 17.1325 +596 1 9.99179 1.42968 18.5594 +597 1 11.4189 0.00413895 17.134 +598 1 12.8468 1.43052 18.5597 +599 1 14.2759 0.00565493 17.1354 +600 1 15.7034 1.43088 18.5597 +601 1 17.1349 0.00660603 17.1362 +602 1 18.561 1.42995 18.5589 +603 1 -0.00091623 2.85567 17.1305 +604 1 1.42526 4.27929 18.5581 +605 1 2.85467 2.8538 17.1308 +606 1 4.27983 4.278 18.5606 +607 1 5.71077 2.85457 17.1307 +608 1 7.13708 4.28064 18.5609 +609 1 8.56543 2.85643 17.1307 +610 1 9.99257 4.28276 18.5603 +611 1 11.4194 2.85749 17.1307 +612 1 12.8475 4.28303 18.5597 +613 1 14.2741 2.85764 17.1307 +614 1 15.7042 4.28172 18.5591 +615 1 17.131 2.85673 17.1311 +616 1 18.5585 4.28185 18.557 +617 1 -0.00243093 5.70895 17.1311 +618 1 1.4245 7.13459 18.5603 +619 1 2.84914 5.70466 17.1353 +620 1 4.27797 7.13389 18.5632 +621 1 5.7036 5.70263 17.1387 +622 1 7.1357 7.1362 18.5621 +623 1 8.56392 5.70733 17.1359 +624 1 9.99202 7.13919 18.5608 +625 1 11.4209 5.70947 17.134 +626 1 12.8478 7.13809 18.5611 +627 1 14.2783 5.7081 17.1347 +628 1 15.7037 7.13715 18.5609 +629 1 17.1302 5.71087 17.131 +630 1 18.5607 7.13454 18.5606 +631 1 -0.00128372 8.56432 17.1334 +632 1 1.42538 9.9925 18.5623 +633 1 2.84785 8.5618 17.138 +634 1 4.27795 9.99245 18.5647 +635 1 5.70176 8.56119 17.1407 +636 1 7.1354 9.99316 18.5629 +637 1 8.56253 8.5661 17.1316 +638 1 9.99268 9.99559 18.5609 +639 1 11.4208 8.56677 17.1316 +640 1 12.8487 9.9958 18.5618 +641 1 14.277 8.56564 17.1369 +642 1 15.7071 9.99224 18.565 +643 1 17.1373 8.56038 17.1391 +644 1 18.5637 9.99074 18.5645 +645 1 0.000285278 11.4218 17.1358 +646 1 1.42657 12.8514 18.5638 +647 1 2.84833 11.422 17.1394 +648 1 4.27862 12.852 18.566 +649 1 5.70055 11.4239 17.1424 +650 1 7.13496 12.8509 18.5651 +651 1 8.55978 11.4258 17.1342 +652 1 9.99367 12.8501 18.5632 +653 1 11.426 11.4292 17.134 +654 1 12.853 12.8549 18.5672 +655 1 14.2857 11.4237 17.1408 +656 1 15.7109 12.8525 18.5689 +657 1 17.1435 11.418 17.146 +658 1 18.5662 12.8507 18.5674 +659 1 0.00198115 14.281 17.1376 +660 1 1.4282 15.7098 18.5645 +661 1 2.849 14.2826 17.1404 +662 1 4.28043 15.71 18.5661 +663 1 5.70173 14.2865 17.1435 +664 1 7.13745 15.7068 18.5657 +665 1 8.56376 14.2803 17.14 +666 1 9.99108 15.7088 18.5677 +667 1 11.4215 14.2873 17.1413 +668 1 12.8496 15.7127 18.5698 +669 1 14.2942 14.2965 17.1533 +670 1 15.7138 15.7167 18.5722 +671 1 17.1491 14.2862 17.1522 +672 1 18.5686 15.7126 18.5697 +673 1 0.00365743 17.139 17.1374 +674 1 1.42998 18.5645 18.5623 +675 1 2.85177 17.1397 17.1385 +676 1 4.2845 18.5618 18.5612 +677 1 5.71062 17.1364 17.1368 +678 1 7.13623 18.5637 18.5639 +679 1 8.56039 17.1418 17.1428 +680 1 9.98964 18.5663 18.5664 +681 1 11.4165 17.1471 17.148 +682 1 12.8472 18.5686 18.5679 +683 1 14.2835 17.1521 17.1526 +684 1 15.7084 18.571 18.5693 +685 1 17.1509 17.1539 17.153 +686 1 18.568 18.5704 18.568 +687 1 10.1985 10.7319 10.9228 + +PafiPath + +1 0.00448604 0.00299371 1.25552e-05 0.0012307 0.00125596 7.47824e-05 0.00648731 0.00449787 0.00203625 +2 1.42757 1.42374 1.42237 -0.000166277 0.00111511 0.000767572 0.00439707 0.0049179 0.00377177 +3 2.85768 -0.000111595 -0.00117603 -0.000775401 -0.000447735 -0.000700154 0.00166735 0.00394693 0.00232555 +4 4.28206 1.42351 1.42428 -0.00177722 -0.000147865 0.000411773 -0.000474597 0.00405872 0.00372894 +5 5.71045 0.000184061 0.000357624 -0.00176419 -8.35707e-05 -1.29782e-05 -0.00266437 0.00246441 0.00222151 +6 7.1368 1.42501 1.42562 -0.0013246 0.00020341 0.000422164 -0.00413402 0.00258638 0.00330152 +7 8.56373 0.00179453 0.00172992 -0.00136152 0.000624455 0.000455767 -0.00290836 0.00269823 0.00298117 +8 9.99168 1.42642 1.42598 -0.00021463 0.0008327 0.000622463 -0.00279898 0.00241782 0.00263082 +9 11.4187 0.00327202 0.00227737 -0.000401319 0.00105507 0.000634173 0.00150958 0.00434837 0.00384073 +10 12.8474 1.42747 1.42572 0.000624325 0.00126496 0.000670467 0.00268248 0.00346313 0.00243791 +11 14.2756 0.0045707 0.00236301 0.000663113 0.00141375 0.000662 0.00686146 0.00532528 0.00346045 +12 15.705 1.42755 1.42471 0.000632106 0.00195131 0.000927378 0.00788061 0.00421518 0.00220502 +13 17.1345 0.00506352 0.00188451 0.00143247 0.00185472 0.000664049 0.00878858 0.00472913 0.00203976 +14 18.5638 1.42578 1.4228 -0.000325513 0.00244529 0.00111507 0.00866897 0.00466572 0.00254539 +15 0.000182033 2.85273 19.9829 -0.00101812 0.00115432 -0.000231119 0.00659476 0.00481436 0.00232392 +16 1.42429 4.27664 1.42129 -0.000784591 -0.000106523 0.00100148 0.00328885 0.00553945 0.00382558 +17 2.85404 2.85113 19.984 -0.00204755 -0.000821179 0.000808953 0.00165412 0.00511082 0.000907537 +18 4.27845 4.27627 1.42291 -0.00108591 -0.000249517 0.00145626 -0.000771385 0.00343083 0.00281981 +19 5.70979 2.85265 19.9858 -0.00207858 -0.00158357 0.000956862 -0.00220026 0.00390417 0.00149033 +20 7.13648 4.2798 1.42573 -0.00138223 -0.00122812 0.000465257 -0.00215578 0.00243962 0.00339662 +21 8.56475 2.85452 19.9865 -0.000601073 -0.00113568 0.000865558 -0.00371209 0.00214036 0.00302214 +22 9.99207 4.28151 1.426 0.000107332 -0.00080203 0.000588424 -0.00239423 0.00125735 0.00324475 +23 11.4195 2.85554 19.9864 0.000620357 -0.000673936 0.000656707 -0.000698861 0.00211416 0.00402876 +24 12.8476 4.28148 1.42552 0.000677438 -7.50279e-05 0.000573318 0.00105521 0.00111736 0.00294505 +25 14.2753 2.8555 19.9858 0.00113643 5.60001e-06 0.000496055 0.00402497 0.00345359 0.00369947 +26 15.7066 4.27861 1.4226 -0.000852918 0.00168186 0.00131145 0.00616814 0.00180897 0.00221228 +27 17.133 2.85398 19.9842 9.13448e-05 0.00113615 0.000182325 0.00690665 0.00466631 0.00235392 +28 18.5621 4.27835 1.42129 -0.0020503 0.00157995 0.00118831 0.0067892 0.00436562 0.0031562 +29 -0.000538145 5.70632 19.9841 -0.000744433 0.000107246 4.52542e-05 0.00381664 0.00450259 0.00200331 +30 1.42454 7.13442 1.42295 -0.000314331 -0.000712245 0.000788048 0.00291295 0.00340428 0.00394074 +31 2.85195 5.70592 19.9856 -0.00212191 -0.000954414 0.0011276 0.00163962 0.00379831 0.00118817 +32 4.27826 7.13446 1.42492 -0.00109605 -0.000615356 0.00117838 0.000983896 0.00205517 0.00294814 +33 5.7078 5.70701 19.9874 -0.00227542 -0.00174772 0.00198003 -0.000207727 0.00245295 0.0015202 +34 7.13443 7.13513 1.42756 -0.000549259 -0.000492957 0.000830903 0.000223061 0.00134345 0.00337824 +35 8.56461 5.70993 19.9881 -0.000754587 -0.00179056 0.00111954 -0.000819791 0.0017794 0.00309445 +36 9.99203 7.13802 1.42927 -0.000349872 -0.000692776 -0.000116632 0.000604886 0.000870734 0.00375676 +37 11.4196 5.71081 19.9877 0.000675562 -0.00112408 0.000645118 0.000177049 0.000530353 0.0046633 +38 12.8496 7.13615 1.42706 -0.00102722 0.000668857 0.000580707 0.00230506 0.000458623 0.00306945 +39 14.2762 5.70905 19.9864 0.000111896 0.00039818 0.000256499 0.00261559 0.00115374 0.00402773 +40 15.7063 7.13567 1.42404 -0.00166096 0.000883715 0.00064806 0.00370327 0.00220464 0.00264978 +41 17.1323 5.70823 19.9845 -0.00139813 0.00130424 -0.000532118 0.00450993 0.0029182 0.00331034 +42 18.5624 7.13482 1.4227 -0.00152388 -0.00028583 0.000935633 0.00433463 0.00343899 0.00316994 +43 0.000696865 8.56319 19.9865 0.000133222 -0.000727777 0.000174859 0.00277403 0.0024152 0.00224224 +44 1.426 9.99355 1.42486 0.000170191 -0.000808215 0.000652723 0.00366083 0.000474426 0.00375362 +45 2.85222 8.5637 19.9875 -0.00149468 -0.000366268 0.000802317 0.00254151 0.00131667 0.00187083 +46 4.27978 9.99352 1.4268 -0.000816836 -0.000585707 0.000976855 0.00279516 0.000507979 0.00315451 +47 5.70775 8.56419 19.989 -0.00207207 -0.000984391 0.00161503 0.00216243 0.00101362 0.00237994 +48 7.13672 9.99198 1.43004 -0.000663405 -0.000536687 0.000343426 0.00198356 0.00189018 0.00300234 +49 8.56417 8.56538 19.9886 -0.00104148 -0.00136216 0.000630345 0.00246839 0.00247213 0.00450724 +50 9.99289 9.99123 1.43118 -0.000558816 0.000120021 -0.000506758 0.00288066 0.00274146 0.00346631 +51 11.4205 8.56619 19.9884 -0.000223897 -0.000583039 -0.000184375 0.00213751 0.00221894 0.0050539 +52 12.849 9.99338 1.42926 -0.000970805 0.000163618 -9.5726e-05 0.00301006 0.00360955 0.00307244 +53 14.2761 8.56576 19.9882 -0.00127923 0.000553607 -0.000582713 0.00226183 0.00290747 0.00395972 +54 15.7069 9.99395 1.42585 -0.00113967 -0.000943542 0.000598503 0.00408653 0.00326173 0.00274972 +55 17.1337 8.56386 19.9875 -0.000711377 -0.000474878 8.05055e-06 0.00304944 0.00293947 0.00320203 +56 18.5635 9.99327 1.42454 -0.000785684 -0.00141961 0.000718736 0.00454228 0.00215983 0.00270698 +57 0.00227377 11.4219 0.00147796 0.000695552 -0.00104732 0.000174834 0.0039761 0.000646927 0.00270091 +58 1.42804 12.8521 1.42671 0.00044846 -0.000700938 0.000439557 0.00456664 -0.000877265 0.00355036 +59 2.85342 11.4223 0.00180127 -0.0010199 -7.56669e-05 0.000539148 0.00339422 -0.000731584 0.00222488 +60 4.28227 12.8506 1.42863 -0.000624799 -0.000490247 0.000859955 0.00259559 -6.38987e-05 0.0029353 +61 5.70881 11.4211 0.0031342 -0.00158252 -0.000150429 0.00129701 0.00238686 0.00107857 0.00268797 +62 7.13884 12.8475 1.43098 -0.00103026 -8.82166e-05 8.97037e-05 0.0022583 0.00264978 0.00307743 +63 8.56508 11.4205 0.00269639 -0.000895119 -0.000208814 0.000273049 0.00298717 0.00335407 0.00484394 +64 9.9936 12.8465 1.43168 -0.000124834 0.000131001 -0.000249861 0.00280537 0.00530493 0.00290562 +65 11.4213 11.4218 0.00260934 -0.000614669 -0.000172955 -0.000722907 0.00389182 0.00556453 0.00428 +66 12.849 12.8502 1.43019 0.000246137 -0.000111971 -0.000114605 0.00410257 0.00674223 0.00254068 +67 14.2779 11.4226 0.00247567 -0.000461923 -0.000823769 -0.000703099 0.00439249 0.00571891 0.00586108 +68 15.7072 12.8522 1.42747 -0.000279099 -0.00135511 0.0002439 0.00714675 0.00597533 0.00210244 +69 17.1356 11.4219 0.0026081 4.09023e-05 -0.00143693 0.000243844 0.00407622 0.00391006 0.00317833 +70 18.5645 12.8524 1.4262 -0.000159845 -0.00138747 0.000299754 0.00655279 0.00211556 0.00286506 +71 0.003965 14.281 0.00320774 0.00119628 -0.000908847 -0.000127474 0.00577805 0.000796793 0.00303436 +72 1.43042 15.7085 1.42837 0.000661296 -0.00038427 9.12732e-05 0.00512547 0.000392853 0.00339026 +73 2.85515 14.2801 0.00315607 -0.000608345 -8.88896e-05 4.73856e-05 0.00319292 -0.00111074 0.00246578 +74 4.28467 15.7055 1.4304 -0.000763199 -0.000236336 0.000305858 0.000968364 0.000959543 0.00293613 +75 5.71011 14.278 0.00441222 -0.0013048 0.000195966 0.00078492 0.000979351 0.00158512 0.0027004 +76 7.13933 15.7032 1.43146 -0.000896832 -0.000171725 -1.39606e-05 0.000473446 0.00271404 0.00329304 +77 8.56579 14.276 0.00441963 -0.000515712 -0.000138941 0.000451055 0.0027467 0.00439133 0.00337149 +78 9.99251 15.7041 1.43141 -0.000488499 0.000172883 -5.80497e-05 0.00135205 0.007143 0.00259963 +79 11.4205 14.2783 0.00416102 -0.000297167 0.000332049 -9.80807e-05 0.00416355 0.0074962 0.00558544 +80 12.8478 15.7065 1.43075 0.000279173 0.000186471 -0.000215034 0.00513954 0.0091176 0.00224821 +81 14.2794 14.2819 0.00500693 0.000611836 -4.49756e-05 8.1196e-05 0.0055641 0.00700242 0.00483931 +82 15.707 15.7097 1.42924 0.000842695 -7.90111e-05 -0.000307597 0.00902665 0.00782206 0.00180669 +83 17.1371 14.2816 0.00478647 0.000513337 -0.000936302 3.88038e-05 0.00703339 0.0050268 0.00311217 +84 18.565 15.7101 1.42787 0.00079818 -0.000600997 -0.000250899 0.00878686 0.00391173 0.00272622 +85 0.00533603 17.1383 0.0037217 0.0017389 -0.000183469 -0.000357723 0.00665447 0.00260847 0.00264663 +86 1.43181 18.5614 1.42781 0.00042672 0.000632719 -0.000128541 0.00483557 0.0028788 0.00344931 +87 2.85722 17.1354 0.003011 -0.000472121 -0.00025979 -0.000680646 0.00224126 0.000987364 0.00254336 +88 4.28514 18.5591 1.42893 -0.00110541 -9.26333e-05 -0.000253388 0.000190094 0.00177613 0.00388249 +89 5.71156 17.1331 0.00356601 -0.00119363 -0.000203657 -0.000229598 -0.000521504 0.00121225 0.00270281 +90 7.13782 18.5594 1.43003 -0.00148383 0.000423857 -0.000306828 -0.00280324 0.00293167 0.00330838 +91 8.56433 17.1339 0.00497866 -0.00137551 0.000506059 0.000418744 -0.000384076 0.00412252 0.00322808 +92 9.99142 18.5608 1.43029 -0.000826713 0.000879709 -0.000347474 -0.000619307 0.00525292 0.002741 +93 11.419 17.1359 0.00556187 -0.000605466 0.000886169 0.000476445 0.00388613 0.00679325 0.00389171 +94 12.8471 18.5624 1.42976 0.000302608 0.00100254 -0.000413067 0.00488914 0.00706896 0.00283921 +95 14.2772 17.1383 0.00595758 0.000912171 0.000818862 0.000395919 0.00730507 0.00683073 0.00328764 +96 15.7052 18.5641 1.42883 0.00118537 0.00129445 -0.000412125 0.00905008 0.00661584 0.00279563 +97 17.1374 17.1402 0.00598099 0.00160462 0.000563882 0.000228178 0.00814453 0.00456451 0.00170835 +98 18.5641 18.564 1.42768 0.00140229 0.00118737 -0.000410916 0.00906024 0.00474027 0.00278757 +99 0.00409482 19.9874 2.8511 0.000975811 0.00202908 0.000143879 0.00644345 0.00418106 0.00490872 +100 1.42553 1.42159 4.27937 -0.000151595 0.000863472 0.00139875 0.00490958 0.00557103 0.00632357 +101 2.85637 19.9845 2.85345 -0.00055766 0.000300828 0.000746952 0.00238983 0.00364335 0.00481773 +102 4.27927 1.42089 4.2793 -0.000630141 0.00013578 0.00114796 0.000465505 0.00383246 0.00619505 +103 5.7104 19.9852 2.85508 -0.00191339 0.000341975 -0.000390171 -0.00121508 0.00245813 0.00516564 +104 7.13674 1.42404 4.28191 -0.00146502 -0.000423205 -0.000357024 -0.000951541 0.00294163 0.00525402 +105 8.56417 19.9868 2.85544 -0.00140703 0.00101777 -0.000848117 -0.00225223 0.00294117 0.00344603 +106 9.9921 1.42561 4.28228 -0.000221368 0.000293525 -0.000440146 -0.00136733 0.00304712 0.00248768 +107 11.4191 19.9882 2.85485 -0.000224913 0.00141684 -0.000974401 0.000965538 0.00455761 0.00210928 +108 12.848 1.42652 4.28113 0.00057005 0.000714925 3.99514e-05 0.00199758 0.00379691 0.000814991 +109 14.2758 19.9893 2.8534 0.000803839 0.00188201 -0.000835756 0.00608554 0.0054541 0.00231458 +110 15.7078 1.4249 4.27787 -0.000522588 0.00209584 0.00155617 0.00720031 0.00398046 0.00101809 +111 17.1354 19.9892 2.85118 0.00112838 0.00252931 -0.000419916 0.00891713 0.00489614 0.00339523 +112 18.5642 1.4239 4.27842 -0.00117465 0.00227583 0.00166566 0.00735283 0.00478112 0.00471074 +113 0.000556869 2.85006 2.84979 -0.00117217 0.00105131 0.00111209 0.0061502 0.00572698 0.00538897 +114 1.422 4.27452 4.2767 -0.0010058 -0.000210649 0.000731258 0.00423657 0.00651338 0.00810759 +115 2.84624 2.84313 2.84486 0.000169766 0.0010239 0.00198459 0.00214844 0.00563487 0.00600572 +116 4.25891 4.25785 4.26023 0.00223538 0.00242263 0.00319802 0.00276044 0.00595537 0.00908754 +117 5.70698 2.84634 2.84826 -0.00174333 -0.000314385 0.000494499 -0.00123043 0.00415362 0.00579263 +118 7.13448 4.26762 4.26953 -0.00337995 -0.0010162 -0.000479391 0.000924751 0.00487636 0.00772252 +119 8.56424 2.8485 2.84953 -0.000368659 0.00048266 0.000892641 -0.00343367 0.00215335 0.00346258 +120 9.99236 4.26985 4.2707 0.00103539 0.00161616 0.00185981 -0.0013387 0.0017389 0.00313418 +121 11.4202 2.84976 2.84967 0.000997561 0.00139206 0.00151628 -0.00158643 0.00121935 0.00122589 +122 12.8489 4.27123 4.2713 0.00174369 0.00403599 0.00422153 0.000874245 -0.00119521 -0.0014398 +123 14.2776 2.84977 2.84875 0.000286165 0.00252168 0.00237197 0.00437983 0.00148333 0.000361421 +124 15.724 4.2622 4.26211 -0.00881199 0.00883645 0.00895703 0.00720195 2.67714e-05 -0.000704746 +125 17.1403 2.84643 2.8452 -0.003226 0.00414135 0.00376561 0.0089863 0.00283909 0.00161475 +126 18.5635 4.27636 4.277 -0.00230552 0.0015694 0.0019087 0.00481142 0.00502796 0.00524463 +127 0.000168547 5.70509 2.84936 -0.000745174 -0.000460924 0.000420631 0.00359146 0.00513704 0.00593305 +128 1.42307 7.13372 4.27749 -0.000461934 -0.000485385 0.000351807 0.00323476 0.00336935 0.00705137 +129 2.84455 5.70222 2.84457 0.000304791 -8.59996e-05 0.00177454 0.0022834 0.00409423 0.00596565 +130 4.26008 7.1291 4.2629 0.00232923 -0.000178781 0.00282726 0.00355683 0.00138681 0.00718615 +131 5.70156 5.70098 2.84905 0.000789134 0.00126315 0.00132492 -0.00132635 0.000837337 0.00298379 +132 7.12123 7.12358 4.27232 0.00450871 0.00367897 0.00481495 -0.00138675 -0.00109498 0.00280236 +133 8.56382 5.70744 2.85401 -0.00119827 -0.00132826 -0.00157388 -0.000430537 0.00172544 0.00470662 +134 9.99114 7.13622 4.28612 -0.00194659 -0.0016235 -0.00112986 0.00291173 0.00118356 0.000328091 +135 11.4197 5.70843 2.854 0.000307615 -0.000181758 -0.00104043 0.000161854 0.00022862 0.00345201 +136 12.8614 7.12515 4.2724 -0.00925307 0.00631498 0.00894948 0.00920997 -0.00321997 -0.00558362 +137 14.2822 5.70267 2.84851 -0.00316479 0.0032007 0.00144363 0.00612528 -0.00175926 -0.000552665 +138 15.723 7.12977 4.26312 -0.00999378 0.00182741 0.00833272 0.00268872 0.00534784 0.00134229 +139 17.1403 5.70379 2.84469 -0.00443823 0.00204589 0.00371066 0.00565502 0.00346898 0.00246106 +140 18.5648 7.1328 4.27583 -0.000201722 -0.0014142 -0.000304373 0.00102146 0.00514196 0.00618946 +141 0.00127881 8.56337 2.85048 0.000120316 -0.00117999 -0.000212513 0.00308948 0.00249643 0.00535241 +142 1.42492 9.99366 4.27913 0.000145137 -0.000608333 0.000337839 0.003985 0.000126572 0.00574943 +143 2.84679 8.56494 2.84743 0.000542401 -0.000800337 0.00147126 0.00361055 0.00161256 0.00565675 +144 4.26715 9.99868 4.26941 0.00183156 -0.00148145 0.0022123 0.00512648 0.000893687 0.00616314 +145 5.70372 8.56357 2.8521 0.000348944 -0.000656639 0.000539007 0.000760799 0.000574558 0.00323825 +146 7.13212 9.99082 4.28405 0.00175953 -0.0019759 0.0020598 -0.000612318 0.00242175 -0.00707241 +147 8.56086 8.56115 2.85841 0.00043914 0.000287502 -0.000438222 0.00171152 0.00118292 0.00349797 +148 9.99282 9.9837 4.28446 -0.00145332 0.00440673 0.000463551 0.00692734 0.000525821 -0.00237852 +149 11.4236 8.56168 2.85777 -0.00217077 0.000862789 -0.000186004 0.00383409 0.00136598 0.00285671 +150 12.8548 9.99207 4.28039 -0.00485719 2.49853e-05 0.00362658 0.00721091 0.00831265 -0.00362137 +151 14.2813 8.56402 2.85062 -0.00345965 3.88409e-05 0.00136394 0.00404063 0.0029268 0.00236705 +152 15.7206 9.99759 4.26601 -0.00612034 -0.00424248 0.00471084 0.00140665 0.00335504 0.00290793 +153 17.1401 8.56434 2.84615 -0.00336187 -0.0015059 0.00251179 0.00406262 0.00363588 0.00244376 +154 18.5661 9.99212 4.27588 0.00123073 -0.00282529 -0.00153565 0.00153893 0.00254327 0.00498069 +155 0.00263103 11.4225 2.85174 0.000601799 -0.00114151 -0.000379486 0.00435515 0.000263279 0.00443302 +156 1.42712 12.8513 4.28122 0.000766508 -0.000733552 0.00068499 0.00434904 -0.000559544 0.00372151 +157 2.84991 11.425 2.85026 0.000636994 -0.000948551 0.00137146 0.00411146 -0.00068005 0.00452263 +158 4.27477 12.8561 4.27641 0.00208135 -0.00267351 0.00246955 0.00372795 0.000858611 0.00376287 +159 5.70849 11.4219 2.85479 4.63414e-05 -0.00136898 0.000717247 0.00190444 0.00216713 0.00318444 +160 7.13934 12.8475 4.28593 -0.00029142 -0.00255585 0.000787355 0.000337277 0.00924678 -0.00514569 +161 8.56568 11.4173 2.86077 -0.00100025 0.000475225 -0.00141244 0.00417549 0.00322394 0.00345583 +162 9.99452 12.8438 4.28907 7.80752e-05 -0.00096103 0.000529806 0.00545424 0.00582949 0.000592604 +163 11.4216 11.4186 2.86023 -0.000332118 0.000550075 -0.00097496 0.00323141 0.00528887 0.00214219 +164 12.8518 12.8526 4.281 -0.000467022 -0.00207802 0.000361714 0.00565194 0.00967713 -0.00540242 +165 14.2798 11.4234 2.85279 -0.00116012 -0.00175108 0.00134537 0.00581706 0.00667643 -0.000149502 +166 15.717 12.8583 4.27082 -0.00250954 -0.00461797 0.00150064 0.00873343 0.00733259 -0.00418437 +167 17.1402 11.4249 2.84777 -0.0017171 -0.00275526 0.00136122 0.00560796 0.00276851 0.00156855 +168 18.567 12.8516 4.27683 0.00188597 -0.0017023 -0.00215851 0.00517087 0.00327173 0.00234375 +169 0.00416979 14.2803 2.85317 0.00114902 -0.000648364 -0.000565706 0.00622094 0.00113297 0.00357857 +170 1.43022 15.706 4.28307 0.000775642 7.27373e-05 0.000297501 0.00462388 0.000710185 0.00346742 +171 2.85403 14.2807 2.85369 0.000678046 -0.00103429 0.00118871 0.00370061 -0.000562911 0.00374918 +172 4.28508 15.7028 4.28565 2.26517e-05 -0.000495813 0.000563803 0.001393 0.0024217 0.00266721 +173 5.71207 14.2761 2.85758 -0.000524226 -0.000935391 0.000511102 0.000816009 0.00361686 0.00160848 +174 7.14016 15.7002 4.28729 -0.00157931 0.000308264 -0.00142787 0.00716776 -0.000301293 0.00686285 +175 8.56721 14.2735 2.85944 -0.000755292 -0.000606053 -0.000326821 0.00382102 0.00489377 0.00290534 +176 9.9925 15.7021 4.28568 -0.00154731 0.00120667 -0.0024042 0.00272428 0.00598309 0.00166572 +177 11.4199 14.2758 2.85856 3.53058e-05 -5.12071e-05 2.44964e-05 0.0031184 0.00808299 0.000380604 +178 12.8481 15.7054 4.28299 0.000218592 0.00206443 -0.00313555 0.00181459 0.0077854 -0.000593638 +179 14.2787 14.2808 2.8543 0.000547911 -0.00053913 0.00018766 0.00688428 0.00938825 -0.0026112 +180 15.7102 15.7106 4.27758 0.00255316 0.00228139 -0.00269758 0.00843678 0.00877785 -0.00118047 +181 17.1392 14.283 2.85015 -0.000237489 -0.0015587 6.69101e-05 0.0086373 0.00595971 0.000885391 +182 18.5674 15.7094 4.27757 0.0035913 0.00178767 -0.00347051 0.00646713 0.00346384 0.00354002 +183 0.00530324 17.1355 2.85385 0.00166057 0.00097607 -0.00102235 0.0069204 0.00279248 0.00415587 +184 1.4302 18.5604 4.28139 0.00072677 -4.73457e-05 0.00126671 0.00491983 0.00377393 0.00415537 +185 2.85834 17.1324 2.85671 -8.7982e-05 -2.91489e-06 0.000391452 0.00279215 0.00144116 0.00401606 +186 4.28438 18.558 4.28368 -0.000732553 -0.000305299 0.000705559 0.00164138 0.00226356 0.00495635 +187 5.71249 17.1302 2.85828 -0.00120549 5.46819e-05 -0.000379786 0.001359 0.000926663 0.00509551 +188 7.13774 18.5592 4.28398 -0.00272511 0.00148694 -0.00164799 0.00181643 0.00136474 0.00522407 +189 8.56519 17.1308 2.85818 -0.0013889 0.000740579 -0.00115041 -0.000183908 0.0046179 0.00281771 +190 9.99094 18.5614 4.28261 -0.00217174 0.00262229 -0.0028331 0.00216769 0.00348083 0.00293404 +191 11.4193 17.1328 2.85709 -0.000486641 0.0012256 -0.00143661 0.00237557 0.00749925 0.0013436 +192 12.8471 18.5634 4.28037 9.04984e-06 0.00314738 -0.0032097 0.00408966 0.00506778 0.0018373 +193 14.2764 17.1353 2.85507 0.000971154 0.00133161 -0.001551 0.00666864 0.00769744 0.00168826 +194 15.7078 18.5659 4.27676 0.00238443 0.00399156 -0.00325557 0.00638438 0.00460769 0.00320468 +195 17.1365 17.1373 2.85278 0.00174285 0.00139054 -0.00154274 0.00962719 0.00637547 0.00218585 +196 18.567 18.5656 4.27646 0.00347389 0.00356844 -0.00228829 0.00575505 0.00278527 0.00558921 +197 0.00243376 19.9863 5.70907 0.000329792 0.000846248 0.00154352 0.00660247 0.00514458 0.00401604 +198 1.42501 1.42238 7.13866 -5.62877e-05 0.000454751 0.000956334 0.00446512 0.0049753 0.00658801 +199 2.85516 19.9839 5.71062 -5.11587e-05 -0.000501326 0.00146028 0.00319747 0.00385957 0.00600415 +200 4.27966 1.42202 7.13836 -0.000183891 -0.000274073 0.000879178 0.00269965 0.00354136 0.0069584 +201 5.70991 19.9844 5.71128 -0.000978989 -0.000325665 0.00063262 0.00132578 0.00242345 0.0052385 +202 7.13519 1.42474 7.13764 -0.000400973 -0.000719163 0.000377296 0.00197001 0.0027372 0.00506811 +203 8.56506 19.9865 5.71219 -0.00108848 2.14769e-05 -0.000444092 0.00182749 0.00200529 0.00391524 +204 9.99273 1.42779 7.13909 -0.000314919 -0.00107979 -0.000336095 0.00185594 0.00271235 0.00255378 +205 11.4199 19.9879 5.71089 -6.61001e-05 0.000512815 -0.000804843 0.00191257 0.00409249 0.000793611 +206 12.8504 1.42703 7.13644 -0.000891454 0.000256944 0.000939551 0.00273419 0.00341755 -0.000131328 +207 14.2779 19.9886 5.70773 0.000418176 0.000948278 6.17775e-05 0.00441497 0.00486356 0.000412319 +208 15.7075 1.42546 7.13629 -0.00112488 0.00115858 0.00127129 0.00385773 0.00381417 0.00153907 +209 17.1363 19.9887 5.70688 0.000414499 0.00138899 0.000721242 0.00524724 0.00429874 0.00322432 +210 18.5624 1.42428 7.13821 -0.00185503 0.00152796 0.00146219 0.00582601 0.00468037 0.00352947 +211 -0.000551931 2.84997 5.70876 -0.00141855 0.000946716 0.00147819 0.00529496 0.00579379 0.00623025 +212 1.42191 4.27626 7.13705 -0.000920523 0.000105053 0.000821114 0.00384544 0.00636768 0.00768047 +213 2.8445 2.8424 5.70534 0.000421995 0.000930463 0.00112776 0.0038771 0.00614574 0.00878223 +214 4.25887 4.2595 7.13052 0.00201196 0.00189075 3.36173e-05 0.00703611 0.00781061 0.0103955 +215 5.70109 2.84577 5.70271 0.000340693 -0.000194547 0.00148004 0.000596562 0.00283599 0.00658866 +216 7.11883 4.26758 7.12298 0.00264989 0.00238361 0.00197895 0.00267223 0.00476996 0.00739112 +217 8.56402 2.85194 5.70851 -0.00125284 -0.0025506 -0.0011804 0.000286701 0.00402724 0.00534507 +218 9.99136 4.28423 7.13521 -0.00185381 -0.00177623 -0.00299109 0.00260241 0.00188744 0.00534346 +219 11.4203 2.85333 5.70875 0.000515037 -0.00148761 -3.37986e-05 0.000233607 0.0036179 0.00143002 +220 12.8617 4.27314 7.12503 -0.00910155 0.00925556 0.00652497 0.00808479 -0.0037384 -0.00302292 +221 14.2828 2.84917 5.70308 -0.00294066 0.00159051 0.00364011 0.00609594 0.000659288 -0.00205613 +222 15.7228 4.26472 7.13063 -0.00981695 0.00914588 0.00265659 0.000413858 0.00359984 0.00572062 +223 17.1408 2.84589 5.70505 -0.00416292 0.00423022 0.00274364 0.00535589 0.00380311 0.00391891 +224 18.5613 4.2784 7.13748 -0.00285028 0.00196556 0.00190773 0.00318906 0.00429079 0.00376394 +225 -0.00104851 5.70514 5.70725 -0.0011246 -0.000179681 0.000801489 0.00264147 0.00608356 0.00724684 +226 1.42303 7.13324 7.13526 -0.00129845 -0.000749722 -8.64073e-05 0.00429239 0.0057404 0.00837426 +227 2.8434 5.6983 5.7006 -0.00162364 -0.000986522 -0.000318789 0.00512375 0.00664181 0.0107585 +228 4.25921 7.11924 7.12135 -0.00158003 -0.00314827 -0.00293018 0.0154117 0.00832654 0.0133908 +229 5.65843 5.66088 5.66279 0.00633137 0.00570138 0.00593316 0.00813089 0.00750962 0.0125599 +230 7.02006 7.02903 7.03201 0.0167901 0.0181654 0.0185088 0.0287216 0.022858 0.0254062 +231 8.57021 5.69111 5.69246 -0.00886135 -0.00807864 -0.00798729 0.00404082 0.00789799 0.0104644 +232 9.98839 7.16674 7.16381 -0.00645048 -0.0348745 -0.0402246 0.0235759 -0.00868561 -0.0077103 +233 11.4119 5.69495 5.69493 0.00664066 -0.000590943 -0.000561003 0.00505897 0.0048144 0.00514222 +234 12.9515 7.04195 7.03968 -0.055698 0.0515425 0.0504959 -0.0184694 0.0144645 0.0113567 +235 14.3206 5.66722 5.66665 -0.0205688 0.0186868 0.0186616 0.00401846 0.000200128 -0.000787848 +236 15.7187 7.12691 7.12492 -0.0132997 0.00686913 0.0064366 -0.0128542 0.00615724 0.00361005 +237 17.1395 5.70196 5.70217 -0.00305015 0.00327001 0.00359328 0.000927458 0.00387978 0.0034384 +238 18.561 7.13418 7.13552 -0.00122714 -5.25831e-05 0.00121301 -0.00198961 0.00547024 0.0039647 +239 0.000217072 8.56346 5.70766 -0.000303315 -0.000839847 0.000245497 0.00168856 0.0028319 0.00583879 +240 1.42565 9.99273 7.13711 -0.000486214 -0.000561279 0.000125103 0.00294183 0.00125638 0.00552879 +241 2.84613 8.56345 5.70407 -0.00030018 -0.000422489 -1.95726e-06 0.0040597 2.86589e-05 0.00695319 +242 4.27553 9.99386 7.12984 0.00318086 -0.00397353 0.00174378 -0.00647352 0.00173177 -0.000161503 +243 5.6675 8.56382 5.67559 0.00556806 -0.00129427 0.00205508 0.00408505 -0.00537023 0.00707928 +244 7.09459 10.0252 7.09178 0.0144396 -0.0172848 0.0168669 -0.0235853 -0.0176226 -0.0323251 +245 8.5354 8.54154 5.70435 0.0166555 0.00784359 0.00697515 -0.00691408 -0.00153326 -0.00555498 +246 9.99561 9.96856 7.06132 -0.00131089 0.0105194 0.0326958 0.0107312 -0.00874402 -0.0527475 +247 11.4469 8.54336 5.70169 -0.0251483 0.0101391 0.0075637 0.0228577 -0.00467938 -0.00503128 +248 12.8974 10.0223 7.08287 -0.0275056 -0.020961 0.0239938 0.00637568 0.0183183 0.000720603 +249 14.3157 8.56335 5.67387 -0.0192771 -0.0012969 0.0117611 -0.0116046 0.0044324 0.018087 +250 15.7212 9.98736 7.11722 0.00505532 -0.0150564 -0.00741972 0.00370221 0.0226134 0.00525911 +251 17.1433 8.56006 5.69924 0.00122331 -0.00488374 -0.00206741 -0.00494048 0.00613051 0.00647934 +252 18.5616 9.99246 7.13525 -0.000343311 -0.00121276 0.000463586 0.000635226 0.00391128 0.00166213 +253 0.0014156 11.4215 5.70849 0.000292242 -0.000872581 -0.000110635 0.00380882 0.000604779 0.00315787 +254 1.42693 12.8486 7.13934 0.000206059 4.35522e-05 -4.59091e-05 0.00352099 -0.000413879 0.0035957 +255 2.84964 11.4234 5.70789 0.0012432 -0.00134375 0.00136535 0.00327831 0.000421859 0.00311218 +256 4.28037 12.847 7.14064 0.00194037 -2.1285e-05 -0.00036756 -0.00684748 0.00643228 -0.00252806 +257 5.68761 11.4352 5.69133 0.00546558 -0.00680433 0.00510715 0.00835855 0.00655669 0.00688853 +258 7.14648 12.8334 7.15265 0.00235524 -0.00347585 -0.000670638 -0.0243346 0.0314943 -0.0206838 +259 8.56323 11.419 5.71594 -0.00141734 -0.0046737 0.00152466 -0.00147032 0.0140721 -0.00865765 +260 9.99608 12.8219 7.1582 -0.00265189 0.000813312 -0.014177 0.0148758 -0.0353675 0.066387 +261 11.4282 11.4217 5.713 -0.00278249 -0.00359776 0.0062043 0.00930136 0.0178369 0.000979344 +262 12.8593 12.8497 7.12552 0.00115268 0.00290809 -0.0264569 0.00688917 0.00926674 -0.00178123 +263 14.3034 11.4362 5.68706 -0.00858977 -0.00942018 0.0114753 0.00663794 0.0148827 -0.00177059 +264 15.7271 12.8522 7.11767 0.0188528 -0.00113905 -0.0242895 0.00463499 0.0114644 0.00110415 +265 17.145 11.4214 5.69882 0.00429823 -0.00625834 -0.0051376 0.00224912 0.0078601 0.000133193 +266 18.5632 12.8507 7.13557 0.000486384 8.14409e-05 -0.00160274 0.00571553 0.00142712 -0.000847753 +267 0.00306628 14.2786 5.70933 0.000763734 0.000375669 -0.00045407 0.00547017 0.00043761 0.00248471 +268 1.4277 15.706 7.13795 0.00142855 -0.00133129 0.00167504 0.0043951 0.00109321 0.00211408 +269 2.85459 14.2767 5.71193 0.001022 -0.000263244 0.000727594 0.00135816 0.00127745 0.00167853 +270 4.27814 15.7088 7.13409 0.00527575 -0.00562947 0.00537185 -0.00123609 0.00642308 -0.00168056 +271 5.71344 14.2709 5.71597 0.000769607 -0.000915813 2.71344e-05 -0.00170906 0.00993213 -0.00252007 +272 7.13953 15.7026 7.13829 -0.000926671 -0.00130405 0.000736457 0.00873922 0.00626496 0.00131232 +273 8.5693 14.2682 5.71799 -0.00284736 0.00095097 -0.00410802 0.0169682 -0.00830747 0.0155794 +274 9.98891 15.709 7.13327 -0.011034 0.0119612 -0.013644 0.0126961 -0.00435768 0.0112137 +275 11.419 14.2729 5.71687 -0.000329444 0.00404031 -0.00150054 -0.00213053 0.000706709 0.000431755 +276 12.854 15.7234 7.11684 -9.60462e-05 0.0195294 -0.022737 0.00184826 -0.00428166 0.00774908 +277 14.2854 14.283 5.70535 0.00423008 0.00473106 -0.00593716 0.00888887 0.0123921 -0.0222524 +278 15.7343 15.7337 7.10897 0.0188303 0.0185381 -0.0191992 -0.0108443 -0.00700575 0.0127214 +279 17.1453 14.2829 5.69922 0.00777179 0.00269832 -0.00901222 0.00373286 0.0062868 0.00186393 +280 18.5656 15.7106 7.13384 -2.51162e-06 0.000549913 8.34881e-05 0.00888233 0.00615417 -0.00346925 +281 0.00406177 17.1354 5.70824 0.00116733 0.000229995 0.000763543 0.00716025 0.00347941 0.00193804 +282 1.42837 18.5598 7.1384 0.00109064 -0.00154342 0.00212352 0.00453921 0.00364583 0.00349336 +283 2.85511 17.1337 5.70952 0.00175638 -0.00208636 0.00259274 0.00209711 0.00311239 0.00265305 +284 4.28405 18.5579 7.13978 0.000564665 -0.00184676 0.00192981 0.00258787 0.00250409 0.00370164 +285 5.71203 17.1306 5.71193 -0.000798408 -0.00078336 0.00077256 0.0036742 0.00263919 0.00297173 +286 7.1392 18.5577 7.14081 -0.00115096 -7.58402e-05 0.000445397 0.0043359 0.00187941 0.0031406 +287 8.56409 17.1329 5.71022 -0.00539905 0.0043759 -0.00464991 0.0085252 -0.000106944 0.00555443 +288 9.99307 18.5592 7.14017 -0.000365155 0.000553775 -0.00085965 0.00751465 0.00034577 0.00415648 +289 11.4175 17.1372 5.70597 -0.00347169 0.00696095 -0.00734873 0.0052957 0.00100514 0.00432038 +290 12.8498 18.5617 7.13592 0.000371504 0.000603594 -0.00119617 0.00288433 0.00402986 0.000357505 +291 14.2816 17.1433 5.69913 0.00357811 0.00837323 -0.008688 0.00293562 0.00232328 0.00378754 +292 15.7101 18.5652 7.13291 0.00127685 0.000141644 1.60884e-05 0.00016509 0.00204609 0.00282469 +293 17.1464 17.1464 5.69676 0.00823059 0.0080179 -0.00745967 0.000614861 0.000157205 0.00628972 +294 18.5648 18.5638 7.13648 0.00106585 0.000796796 0.00173381 0.0075984 0.00613661 -0.00104016 +295 0.00151496 19.9867 8.56686 0.000273626 0.000272868 0.00102374 0.00469268 0.00407909 0.00315584 +296 1.42508 1.42384 9.99627 -1.65638e-05 0.000298516 -7.52155e-06 0.00366937 0.00396842 0.00386419 +297 2.85497 19.9847 8.56753 0.000289798 -0.000965174 0.000951267 0.00367931 0.00255054 0.0050966 +298 4.28088 1.42361 9.99603 -1.85446e-05 -0.000355332 -6.91247e-05 0.00389319 0.00248694 0.00502951 +299 5.71114 19.9847 8.56813 -5.98489e-05 -0.00097786 0.000805218 0.00317078 0.00200058 0.00407961 +300 7.13827 1.42706 9.9941 1.01668e-05 -0.000910996 3.28783e-05 0.00356984 0.00188351 0.00489834 +301 8.56629 19.9859 8.56778 6.89853e-05 -0.000898314 0.000307983 0.0039382 0.00206645 0.00295343 +302 9.99375 1.4292 9.99167 -0.000192253 -0.00145595 0.000254012 0.00347297 0.00264324 0.00338512 +303 11.422 19.9867 8.5663 9.77871e-05 -0.00128148 0.000187383 0.00402715 0.00312167 0.00177867 +304 12.8487 1.4287 9.99278 -0.000966338 -0.00047933 -0.000108842 0.00303062 0.00229043 0.00274571 +305 14.2781 19.9879 8.5646 -0.000221771 -0.000703949 0.000171199 0.0024792 0.00491452 0.00113067 +306 15.7049 1.42646 9.995 -0.00198756 0.000641175 -0.000100228 0.00318304 0.00328412 0.00185496 +307 17.1341 19.9881 8.5661 -0.00118317 -0.000245848 0.00144377 0.00494254 0.00519934 2.71302e-05 +308 18.561 1.42562 9.9959 -0.00191422 0.00128271 -0.000104477 0.00367108 0.00365484 0.00260043 +309 -0.00154693 2.85178 8.56743 -0.00133784 0.000759441 0.000647238 0.00347103 0.00526525 0.0049604 +310 1.42217 4.2785 9.99597 -0.000789874 0.000329864 3.2615e-05 0.00299947 0.00628685 0.00443078 +311 2.84605 2.84521 8.56794 0.00038274 0.000659006 -0.00011424 0.00439037 0.00554022 0.00680772 +312 4.26501 4.26584 10.0006 0.00104077 0.000964405 -0.00179607 0.0066187 0.00642182 0.00542361 +313 5.70359 2.84893 8.56603 0.000584695 -0.000481049 4.00548e-05 0.00393846 0.00384007 0.00708141 +314 7.13045 4.28031 9.99272 0.0015817 0.00164266 -0.00173595 0.00563004 0.00305609 0.00854156 +315 8.56053 2.85598 8.56163 -7.54446e-06 -0.00209021 -0.000242789 0.00326393 0.0023853 0.00583947 +316 9.99012 4.28274 9.9819 -0.00389984 0.00133485 0.00148735 0.00818659 0.010009 0.00388801 +317 11.4234 2.85756 8.56164 -0.00254569 -0.000932368 0.000644489 0.0036097 0.0016139 0.00274319 +318 12.8518 4.28351 9.99085 -0.00708019 0.00549538 -0.001547 0.00642971 -0.00143423 0.00691256 +319 14.2806 2.85211 8.56471 -0.00359182 0.00191386 0.000512088 0.00275801 0.0030065 0.00195252 +320 15.7148 4.27206 10 -0.00877283 0.0079981 -0.0026265 0.00127181 0.00156489 -0.0010879 +321 17.1373 2.84887 8.56767 -0.00465385 0.00391196 0.000345773 0.00376631 0.00264653 0.00252995 +322 18.5592 4.28096 9.99591 -0.00279659 0.0019302 -0.000204822 0.00142902 0.00403303 0.00198944 +323 -0.00250389 5.70808 8.56673 -0.00157057 0.000557128 0.000867224 0.00125024 0.00583332 0.00442629 +324 1.42384 7.13643 9.99442 -0.000921574 0.000107118 -0.000107663 0.0023018 0.00524253 0.0047695 +325 2.84473 5.70181 8.56541 -0.000590472 -0.000352429 3.32148e-06 0.00564505 0.00672242 0.00710915 +326 4.27238 7.12626 9.99578 0.00243072 0.00142232 -0.00409258 0.00381393 0.00356307 0.0101449 +327 5.66379 5.67013 8.56343 0.00427398 0.000609389 -0.00212772 0.014975 0.0146593 0.0103343 +328 7.0835 7.07985 10.0252 0.0080691 0.0126475 -0.0167897 0.0161547 0.0106873 0.010852 +329 8.52987 5.69661 8.53691 0.0122722 0.000808532 0.00163692 0.00468351 0.000594188 0.00982411 +330 9.98155 7.05425 9.94841 -0.0189574 0.0444942 -0.0192556 0.0224789 0.0433221 0.00819601 +331 11.4459 5.7031 8.54093 -0.0273668 0.00762551 0.00906892 0.0200177 -0.00814391 -0.00185016 +332 12.8977 7.0888 10.0145 -0.0286028 0.0315026 -0.0282536 -0.0221706 0.0213147 0.0147435 +333 14.3154 5.67732 8.56157 -0.0187766 0.0135338 -0.0016061 -0.0169321 0.0229894 0.00646994 +334 15.7037 7.13645 9.99678 -0.0159685 0.0126112 -0.000125191 0.0166415 -0.00755156 0.00289601 +335 17.1352 5.70697 8.56632 -0.00603624 0.00488478 0.00210074 0.000613755 0.0021252 -0.0017517 +336 18.557 7.13856 9.99474 -0.0027408 0.00154999 0.000810557 -0.000220234 0.0037477 0.00174239 +337 -0.00212376 8.56479 8.5656 -0.00119637 -0.000187028 0.000421942 0.000848837 0.00419885 0.00420508 +338 1.4258 9.99322 9.99389 -0.000995609 -0.00058127 -0.000586461 0.00218967 0.00299511 0.00461539 +339 2.84757 8.56127 8.56306 -0.00111346 -0.00228603 -0.00216221 0.00818044 0.00506738 0.00937614 +340 4.28735 9.98746 9.99151 -0.00391015 -0.00594361 -0.00531667 -0.00216559 0.0120191 0.0126999 +341 5.65677 8.54528 8.54855 0.00916494 -0.0152824 -0.0155617 0.0119895 0.0116217 0.0118469 +342 7.16728 9.96312 9.97425 -0.0584925 -0.0495249 -0.0469838 -0.0492115 0.0300285 -0.00316273 +343 8.21067 8.38648 8.39718 0.123151 -0.0234659 -0.0136653 0.0674872 0.034394 0.0261682 +344 9.96626 9.32695 9.30023 -0.0892576 0.233838 0.143721 -0.0448785 0.245445 0.0491522 +345 11.7487 8.40368 8.40163 -0.201495 0.0245422 0.0272602 -0.0266792 0.0856877 0.0792402 +346 12.7895 10.001 9.98895 0.00129475 0.00820171 -0.00799408 0.0899892 0.0242569 0.00661116 +347 14.3143 8.56199 8.55455 -0.038955 0.00537333 0.000942862 0.0220394 0.00497995 0.00486552 +348 15.6978 9.99473 9.98831 5.895e-05 -0.00310296 -0.0035273 0.0120138 0.0175516 0.0160484 +349 17.1348 8.56359 8.56309 -0.00349064 -0.00161499 0.000262268 0.00108143 0.00675155 0.00173162 +350 18.5556 9.99576 9.99342 -0.00252126 0.000483238 -0.00022885 0.000686989 0.00455185 0.00215187 +351 -0.00132574 11.4213 8.56631 -0.000983572 -4.49747e-05 -0.000274864 0.00265699 0.00137552 0.00249317 +352 1.42629 12.8493 9.99431 0.000522513 -0.00157227 -0.000193923 0.00297646 0.00125986 0.00341882 +353 2.85404 11.4186 8.56775 -0.000257934 -0.000475716 -0.00144593 0.00247938 0.00215228 0.00506588 +354 4.28053 12.8528 9.99302 0.00925433 -0.00885366 0.000775605 -0.00678958 0.00874612 0.00410413 +355 5.70507 11.4136 8.57147 3.3866e-05 -0.000832131 -0.00835909 -0.0178692 0.0130043 -0.0092421 +356 7.10701 12.8905 9.96761 0.0409743 -0.0461276 0.01467 -0.0467913 0.0351348 -0.00413059 +357 8.60294 11.3881 8.64515 0.00571518 0.0097701 0.0174942 -0.12959 0.0209366 -0.17412 +358 10.0138 12.9425 10.015 0.0178469 -0.0640483 -0.0273004 -8.68168e-05 -0.184054 0.0142559 +359 11.4245 11.404 8.61006 0.00967999 0.0193984 0.0177716 0.00720077 -0.0185064 0.0299563 +360 12.9666 12.9702 9.8333 0.0841395 0.0739857 -0.224623 -0.0228073 -0.0351395 0.0493747 +361 14.3105 11.4083 8.54241 0.029317 -0.0226003 -0.0395936 -0.00288976 0.025456 0.0310882 +362 15.7128 12.8678 9.98055 -0.0151323 -0.00283499 -0.00714669 0.0469253 0.0214158 -0.00410787 +363 17.1335 11.4221 8.56269 -0.00251234 0.000943429 -0.00202031 0.00578277 0.00720505 -0.000524806 +364 18.5577 12.8528 9.99246 -0.00303367 -0.000442547 -0.00122512 0.00937188 0.00460488 0.00110861 +365 0.000285193 14.2785 8.56552 -0.000273516 -0.000667919 0.000230511 0.00604876 0.00203069 0.000623738 +366 1.42622 15.7054 9.99448 0.00163542 -0.00295488 0.00108284 0.00406791 0.000760476 0.00205394 +367 2.85224 14.2779 8.56563 0.00346116 -0.00323232 0.00242948 0.00247237 0.00259267 0.00221882 +368 4.27536 15.7111 9.9908 0.0101435 -0.0105358 0.00419533 -0.00164567 0.00663313 0.00307873 +369 5.69621 14.2898 8.55387 0.0151268 -0.0146956 0.0101349 -0.00819417 0.0166997 -0.00622918 +370 7.14106 15.6996 9.99891 0.00907435 -0.00827711 0.00238464 -0.00262213 0.0170903 -0.0018804 +371 8.56755 14.2758 8.56294 0.000944155 0.00163289 -0.00521624 0.00566545 0.0043441 0.011105 +372 9.99932 15.7052 10.0028 0.0013816 -0.0135979 -0.00368624 0.00374536 -0.0146077 0.00632618 +373 11.4225 14.301 8.54252 -0.0259035 0.031157 -0.0346275 -0.00732484 -0.0183863 0.0171478 +374 12.8699 15.7186 9.98128 0.00350726 -0.0151838 -0.0103013 -0.0180528 -0.0878994 0.0466637 +375 14.3381 14.336 8.50604 0.0443031 0.0430587 -0.0528386 -0.00308849 -0.0054873 0.0202043 +376 15.7206 15.7211 9.9958 -0.00344597 -0.00432228 0.0124922 0.0278351 0.0272464 -0.023389 +377 17.139 14.2868 8.55783 -0.00258596 -8.02687e-05 -0.00151239 0.0264936 0.0134701 -0.00999275 +378 18.5618 15.7073 9.99448 -0.00241748 -0.00300429 0.00136448 0.0100247 0.010328 -0.00241767 +379 0.0016734 17.1338 8.56639 0.000313136 -0.00164006 0.00168169 0.00661101 0.00378211 0.000143403 +380 1.42762 18.5602 9.99474 0.00142777 -0.00217636 0.000940593 0.00295861 0.00255243 0.0019616 +381 2.85325 17.134 8.56538 0.00357835 -0.00445773 0.00318297 0.0018326 0.00279316 0.00202008 +382 4.28357 18.5585 9.99498 0.00127246 -0.00232097 0.000849569 0.00342527 0.00100571 0.00283868 +383 5.71258 17.13 8.5679 0.00251368 -0.003482 0.00290416 0.00206194 0.00336897 -0.000186831 +384 7.14072 18.5564 9.99637 0.000796274 -0.00139034 0.000651283 0.00314808 0.00290735 0.00196827 +385 8.56751 17.1279 8.56978 -0.000307092 0.00177976 -0.000201079 0.00849308 0.00381289 0.0025712 +386 9.99648 18.5561 9.99613 0.0013868 -0.00292496 -0.000544731 0.00596592 0.0015459 0.00242138 +387 11.4236 17.1302 8.56544 0.00109886 -0.00185753 -0.000764565 0.0152679 -0.00458579 0.0115556 +388 12.8527 18.5593 9.99264 0.000781456 -0.00391874 -0.00112273 0.00301917 -0.000193671 0.00372558 +389 14.2873 17.139 8.55677 0.00165819 -0.00170091 -0.00203229 -0.0101645 0.00412463 0.0112499 +390 15.707 18.5632 9.99368 -0.00262134 -0.00329182 0.00185178 0.00625619 0.00612527 -0.00170559 +391 17.1415 17.1418 8.56387 0.00088757 0.000436728 0.00411845 0.011174 0.0120692 -0.010337 +392 18.5642 18.5644 9.99401 0.000743604 0.000226483 0.000921698 0.0054673 0.00475863 -7.88139e-07 +393 0.00124759 0.000815388 11.4233 0.000332227 8.02598e-05 -0.000350697 0.00356029 0.00305391 0.00134018 +394 1.42574 1.42555 12.8519 -0.000100762 9.40954e-05 -0.00108245 0.00294758 0.00344981 9.62385e-05 +395 2.85511 -0.00151506 11.4232 0.000435677 -0.00115725 -0.000283779 0.00337568 0.00141897 0.00223301 +396 4.28253 1.42523 12.8507 -2.83992e-05 -0.000471108 -0.00115229 0.00282159 0.00190506 0.0019797 +397 5.71193 -0.00142742 11.4222 0.000308112 -0.00100176 -0.000363235 0.00352525 0.000673896 0.00360506 +398 7.14021 1.42786 12.8478 -0.00016303 -0.000951605 -0.000678747 0.00353003 0.00183536 0.00377689 +399 8.56814 -0.00112058 11.4211 0.0010137 -0.00152652 -0.000337473 0.00372142 0.00226978 0.00345942 +400 9.9939 1.42956 12.8462 -0.000206099 -0.00110026 0.000191779 0.00315083 0.00163073 0.00519141 +401 11.4229 -0.000454533 11.4212 0.000513782 -0.00190989 -0.000103737 0.00399607 0.00306864 0.0032915 +402 12.847 1.42936 12.8487 -0.000329665 -0.000547926 -0.000580365 0.00259709 0.00239324 0.00524038 +403 14.2764 0.000818757 11.4223 -0.00156068 -0.00172998 -0.000295038 0.00432198 0.00464569 0.00237783 +404 15.7033 1.4281 12.8507 -0.00169434 0.000547123 -0.00184719 0.00370631 0.00257582 0.00409522 +405 17.1331 0.00193834 11.4229 -0.00141025 -0.000249861 -0.000421036 0.00418574 0.00421726 0.00173903 +406 18.5603 1.42727 12.8517 -0.00170501 0.000964848 -0.00156671 0.00357391 0.00343495 0.00124162 +407 -0.00206847 2.85337 11.4239 -0.0014198 0.000836658 -0.000529309 0.00234146 0.00471122 0.00170101 +408 1.4227 4.28055 12.8513 -0.000627154 0.000607547 -0.00120513 0.00204755 0.0050601 0.0011141 +409 2.84791 2.84776 11.4263 8.59973e-05 0.000422696 -0.00112416 0.00387171 0.00473802 0.00286298 +410 4.27116 4.27215 12.8575 0.000584855 0.000563692 -0.00345156 0.00444895 0.00450597 0.00349648 +411 5.70805 2.85171 11.4237 0.000376865 -0.00016989 -0.00130842 0.00440819 0.00297902 0.00568892 +412 7.13742 4.28255 12.8501 0.000823972 0.00143908 -0.00347509 0.00743946 0.00534421 0.00616445 +413 8.56567 2.85942 11.4182 -0.000728806 -0.00193903 3.5161e-05 0.00574171 0.00312331 0.00456024 +414 9.99111 4.28951 12.8447 -0.00326903 0.000197166 0.000442623 0.00636924 0.00180663 0.00756148 +415 11.4195 2.8603 11.4178 -0.00154383 -0.0013468 9.47356e-05 0.0029204 0.00165586 0.00439909 +416 12.8463 4.28471 12.849 -0.00316446 0.00328968 -0.00416799 0.00315557 0.000681783 0.00957138 +417 14.2758 2.8548 11.4225 -0.00301064 0.0019393 -0.00218986 0.00317987 0.000776882 0.00536089 +418 15.7087 4.27812 12.855 -0.0070104 0.0064288 -0.00638091 0.00333271 -0.00135025 0.00698416 +419 17.1347 2.85126 11.4255 -0.0040734 0.00327317 -0.00213422 0.00211353 0.00250301 0.00230112 +420 18.558 4.28306 12.8507 -0.00306152 0.00211201 -0.0018424 0.00240462 0.00243866 0.00199401 +421 -0.00326044 5.71039 11.4225 -0.00158353 0.000875521 -0.00033965 0.000642728 0.00517286 0.00221587 +422 1.42333 7.13894 12.8491 -0.000723538 3.69874e-05 -0.000372602 0.00167805 0.00506488 0.00130542 +423 2.84655 5.70541 11.4248 0.000356042 0.000791275 -0.00161526 0.00384567 0.00512191 0.00541445 +424 4.27388 7.13547 12.8511 1.52185e-05 -0.00191349 -0.000147469 0.0089517 0.00699653 0.00443401 +425 5.68317 5.68606 11.4384 0.00281777 0.00219074 -0.00750786 0.00755254 0.00493886 0.00634306 +426 7.13242 7.1412 12.8434 -0.00544051 -0.0074354 -0.00390422 0.0158535 0.0114603 -0.00559265 +427 8.56176 5.71643 11.4214 0.00206795 0.0053365 -0.00849781 0.0103721 0.00246458 0.00444479 +428 9.98583 7.17053 12.8308 -0.0188601 -0.0199855 0.0264158 0.0130308 -0.0149367 0.010893 +429 11.4188 5.7151 11.4189 -0.0127803 0.00200144 -0.00802172 0.0105845 -0.00620223 0.0105931 +430 12.851 7.14406 12.8449 0.00359525 -0.0103824 0.0046727 0.0183972 -0.0143502 0.0142005 +431 14.2924 5.69646 11.4352 -0.0163815 0.0139544 -0.0124032 0.00843796 -0.00492148 0.00202475 +432 15.7003 7.14601 12.8478 -0.0101437 0.00527728 -0.00582501 0.0186312 -0.0118035 0.00794291 +433 17.1318 5.71102 11.4241 -0.00575257 0.00418899 -0.00290004 0.00503829 -0.00267834 0.00324773 +434 18.5564 7.14119 12.8481 -0.00330788 0.00130594 -0.00131594 0.00102307 0.00349446 0.00296251 +435 -0.00344302 8.56813 11.4212 -0.00166206 0.000416179 -0.000217177 0.000237383 0.00394061 0.00210172 +436 1.42473 9.99434 12.8504 0.000134776 -8.78533e-05 -0.00144457 0.00177008 0.00236983 0.0027572 +437 2.85196 8.56581 11.421 -0.00053764 -0.00159586 -0.000283656 0.00412608 0.00444764 0.00518733 +438 4.27641 9.98921 12.8593 0.00707188 -0.000783227 -0.0059639 0.00333952 0.00350347 0.00576136 +439 5.69994 8.56447 11.4203 -0.000856534 -0.00955069 0.000187173 0.00434085 0.00770599 0.00748263 +440 7.0918 9.95812 12.9145 0.0200555 0.00499029 -0.0198722 0.0183235 0.00565955 -0.030547 +441 8.5818 8.61273 11.4024 0.00233986 0.00175679 0.0175683 0.0569648 0.0231599 -0.0298735 +442 9.98221 9.99539 13.0479 -0.0898391 -0.0976471 0.174071 -0.134608 -0.051649 0.0156257 +443 11.4155 8.55204 11.3898 -0.00704511 -0.100852 0.0109473 -0.00660651 0.0407909 0.0239107 +444 12.8122 10.0024 12.8537 -0.123743 0.061535 -0.09985 0.27976 -0.0736522 0.150786 +445 14.2692 8.58987 11.4189 -0.0372033 0.0212214 0.000294632 0.0283183 -0.0281746 0.00133495 +446 15.7024 9.99643 12.8565 -0.0131993 0.00256411 -0.0111224 0.0299135 0.00643729 0.0125926 +447 17.1272 8.57126 11.4202 -0.00650762 0.00141157 -0.000320237 0.00539407 0.00228544 0.00410404 +448 18.5556 9.99699 12.8501 -0.00350403 0.000852669 -0.00204753 0.00339582 0.00336331 0.00414562 +449 -0.00297007 11.4235 11.4223 -0.00148403 -0.000154001 -0.000868659 0.00235166 0.00213289 0.00274789 +450 1.42534 12.8505 12.8516 0.00141456 -0.002146 -0.00196427 0.00329164 0.00139432 0.00331222 +451 2.85213 11.4204 11.4227 0.00307181 -0.00252114 -0.00190772 0.00308733 0.00424019 0.00703877 +452 4.27372 12.8556 12.8585 0.0170089 -0.0104615 -0.00999947 0.00722173 0.00302617 0.00717312 +453 5.6706 11.418 11.4264 0.0218696 -0.0142414 -0.0106107 0.0105404 0.019058 0.0121794 +454 7.06123 12.9195 12.9257 0.0686133 -0.0700624 -0.0689988 -0.051952 0.0770171 0.0649432 +455 8.22958 11.5201 11.5302 0.158043 -0.145552 -0.136533 0.0705563 -0.0190742 -0.0403605 +456 10.0104 12.8005 12.8223 -0.00371821 -0.00688657 0.0238967 -0.0420465 0.0464171 -0.0113306 +457 11.9793 11.8351 11.521 0.206369 0.391714 -0.0973199 -0.166884 -0.262884 0.155892 +458 13.0121 13.0222 13.0857 0.0338485 0.0470795 0.174766 -0.0620389 -0.0949959 -0.121806 +459 14.3453 11.4428 11.4239 -0.00630605 0.000295587 -0.0133082 -0.0351906 0.00514225 0.00948196 +460 15.7111 12.8695 12.871 -0.0126062 3.15156e-06 0.00512865 0.0610617 0.0197977 0.015413 +461 17.132 11.4285 11.4228 -0.00618994 0.00217916 -0.00171905 0.00765107 0.00840437 0.00479248 +462 18.5572 12.8538 12.8538 -0.00290221 -0.00102435 -0.000365585 0.00953353 0.00513485 0.00394928 +463 -0.00147547 14.2777 11.4229 -0.000865872 -0.0023052 -0.000402837 0.00559846 0.00374866 0.0018712 +464 1.42548 15.7067 12.851 0.00198372 -0.00342312 -0.00193984 0.00336247 0.000517137 0.00293893 +465 2.85097 14.2785 11.4229 0.00529541 -0.00572844 -0.00097475 0.00478939 0.00182929 0.00539088 +466 4.27137 15.7149 12.8542 0.013506 -0.0136733 -0.00636482 -0.00623279 0.0110868 0.00387031 +467 5.68303 14.2983 11.4231 0.0295592 -0.0271282 -0.00390364 0.00721951 0.00476884 0.00758346 +468 7.13303 15.7052 12.8575 0.0137116 -0.0148088 -0.0130809 -0.00232368 0.0280404 0.0158127 +469 8.55795 14.268 11.4449 0.039076 -0.03837 -0.0180368 -0.0138542 0.0126945 -0.0104813 +470 9.9991 15.6977 12.8526 -0.00295188 -0.00706929 -0.00193027 -0.00566974 0.0265938 0.00750147 +471 11.4789 14.3259 11.4464 -0.00351251 0.0362861 -0.0141346 -0.0423803 -0.0471389 0.0045108 +472 12.8778 15.7268 12.8791 -0.00250931 -0.0253285 0.00293431 -0.00565292 -0.0243254 -0.0128009 +473 14.2868 14.2833 11.4264 -0.0563512 -0.058539 0.00263706 0.120301 0.0973938 0.00461791 +474 15.7269 15.7286 12.852 -0.00540328 -0.00640837 -0.0114294 0.0209031 0.023536 0.0246546 +475 17.1318 14.2814 11.4247 -0.00962278 -0.00755391 -0.0011926 0.0305735 0.0238345 0.00080558 +476 18.5621 15.7088 12.8521 -0.00261771 -0.00341148 -0.00222107 0.00857554 0.00942248 0.00594391 +477 0.00112373 17.1342 11.4227 0.000468947 -0.00211135 -0.000154857 0.00496945 0.00294621 0.00166371 +478 1.42739 18.5615 12.8506 0.00162362 -0.00259068 -0.00109273 0.0021929 0.00249621 0.000819594 +479 2.85213 17.1349 11.422 0.0046082 -0.00560593 0.000142559 -0.000578139 0.00369273 0.00131503 +480 4.28318 18.5599 12.8502 0.00174376 -0.00279252 -0.00168024 0.00248753 0.000572658 0.00275572 +481 5.71036 17.1313 11.4231 0.0042304 -0.00443416 -0.00100691 0.000915444 0.00245622 0.00339509 +482 7.13958 18.5584 12.8494 0.0016 -0.00236938 -0.00259976 0.00292475 0.00253273 0.00562229 +483 8.56845 17.1259 11.4261 0.00440054 -0.00324524 -0.00278946 0.00254175 0.0100241 0.00141545 +484 9.99636 18.557 12.8495 0.000791152 -0.00308665 -0.000501058 0.00485827 0.00565929 0.00454526 +485 11.4315 17.1315 11.4268 0.00263315 -0.00132003 -0.00125984 0.00776343 0.00101825 0.00139036 +486 12.8533 18.5613 12.8543 -0.000136291 -0.00491699 -5.51855e-05 0.004796 0.00494836 0.00403075 +487 14.2835 17.1351 11.4244 -0.00757968 -0.0109835 0.000355858 0.00571708 0.0126076 -0.00329959 +488 15.7077 18.5651 12.8521 -0.00277919 -0.00363478 -0.00222256 0.00559088 0.00542719 0.00416819 +489 17.1427 17.1439 11.4219 0.000982284 0.000331555 0.000380918 0.00964239 0.0111374 0.00172818 +490 18.5646 18.566 12.851 0.000688304 -5.54076e-05 -0.00106108 0.00557764 0.00479304 0.00256129 +491 0.00165724 0.00256297 14.279 0.000396184 -0.000289931 -0.00175543 0.00407675 0.00361814 0.000432025 +492 1.4273 1.4275 15.7056 -0.000244595 -0.000194266 -0.0019074 0.00302279 0.00388245 -0.00119338 +493 2.85576 0.000182233 14.2779 0.000551668 -0.00147942 -0.0017375 0.00196191 0.00189219 -0.000123148 +494 4.28401 1.42715 15.7038 -0.000474304 -0.000916097 -0.00167147 0.000822531 0.00277298 -0.00025638 +495 5.71224 5.23408e-05 14.2762 0.000276677 -0.00142549 -0.00180973 0.00145222 0.000995634 0.00258592 +496 7.13964 1.42841 15.7026 -0.00117954 -0.00122541 -0.000337178 0.000388891 0.00225945 0.00258997 +497 8.56732 0.00038323 14.2749 -0.000266595 -0.00120486 -0.000837497 0.0025488 0.0022859 0.00555257 +498 9.99275 1.42959 15.7029 -0.000168717 -0.000830952 -0.000454169 0.000732191 0.00222942 0.00630337 +499 11.4206 0.00128643 14.2768 0.000223049 -0.00141545 -0.000677136 0.00368945 0.00409619 0.00696187 +500 12.8463 1.43053 15.704 0.000262668 -0.000375268 -0.000801342 0.002855 0.00282428 0.00715495 +501 14.2771 0.00335754 14.28 -0.000219072 -0.000851645 -0.000903129 0.00458906 0.00487954 0.00562753 +502 15.7034 1.43046 15.7058 -0.000226953 0.000198474 -0.00168838 0.00511613 0.00353448 0.00509502 +503 17.1335 0.00395395 14.2793 -0.00126716 -0.000677973 -0.00214476 0.00560717 0.00445673 0.00378553 +504 18.5602 1.42931 15.7058 -0.00107565 0.000534798 -0.00243327 0.00563245 0.00398857 0.00156311 +505 -0.00187122 2.85497 14.278 -0.00133248 0.000810497 -0.00169312 0.00305944 0.0039622 -0.000278615 +506 1.42449 4.28183 15.704 -0.00118023 3.02691e-05 -0.00121764 0.00265181 0.00526106 -0.00173965 +507 2.85086 2.8509 14.2801 -0.000262752 9.45881e-05 -0.00192875 0.00232273 0.00398297 -0.000317875 +508 4.28002 4.28021 15.7045 -0.00253461 -0.00229238 -0.00035404 0.00358807 0.00565755 -0.00170964 +509 5.71087 2.85387 14.2768 -0.000294985 -0.000303714 -0.00183744 0.00299686 0.0030661 0.00215972 +510 7.13755 4.28345 15.7032 -0.00435494 -0.00441281 0.00350348 0.00576153 0.00717228 -0.000766317 +511 8.56686 2.8576 14.2746 -0.00160323 -0.00137413 0.000419479 0.00309514 0.00248759 0.0043399 +512 9.99226 4.28575 15.7025 -0.000480425 -0.00234736 0.00168173 0.00152308 0.003895 0.00376982 +513 11.4183 2.85879 14.2742 -0.000150176 -0.000245562 -0.000791741 0.00197524 0.00138131 0.00706311 +514 12.8456 4.28649 15.7014 0.000821481 -0.00128721 -7.63716e-05 2.4777e-05 0.00194977 0.00616368 +515 14.2742 2.85657 14.2769 -0.00095819 0.0013475 -0.00251066 0.0025899 0.000820913 0.00692925 +516 15.7028 4.28421 15.7034 -0.000608667 0.000833613 -0.00141231 0.00301494 0.000588729 0.00644793 +517 17.1324 2.85428 14.2792 -0.00302357 0.00245828 -0.00338386 0.00410562 0.00169954 0.00370913 +518 18.5572 4.28424 15.7032 -0.00213159 0.00139399 -0.00196999 0.00444122 0.0024886 0.00159078 +519 -0.0033298 5.71153 14.2761 -0.00168351 0.000708018 -0.00125094 0.00159189 0.00454383 0.000155559 +520 1.4229 7.13632 15.7058 -0.000198163 0.000902795 -0.00184771 0.00167611 0.00351056 -0.000125444 +521 2.84911 5.70827 14.278 -0.000696317 -0.000515701 -0.000838595 0.0038761 0.00606048 -0.00012165 +522 4.2698 7.12716 15.7152 0.00017895 0.000676944 -0.00191642 0.00842064 0.0063223 -0.00239996 +523 5.70534 5.70803 14.2763 -0.00425667 -0.00493144 -0.000634212 0.00865408 0.00776374 -0.000350709 +524 7.12354 7.12356 15.7193 -0.0221058 -0.0198442 0.0200263 0.0103443 0.00559002 0.00225017 +525 8.56521 5.71626 14.2734 -0.00887462 -0.00801137 0.00933377 0.011219 0.0150076 0.00154186 +526 9.99156 7.1327 15.7135 0.00283656 -0.0133616 0.014661 0.0212787 0.0174924 -0.00143625 +527 11.4153 5.71868 14.2697 -0.000545975 -0.00310698 0.00234401 0.0037299 0.0119605 0.00768432 +528 12.8564 7.13141 15.7124 0.00267815 -0.00288236 0.00189108 -0.0190312 0.0165616 -0.00341241 +529 14.2759 5.71267 14.2752 -6.55512e-05 0.000206646 6.89523e-05 0.00411818 0.000968891 0.0113406 +530 15.7025 7.14049 15.7045 -0.0108045 0.0104303 -0.0103689 0.0244053 -0.0207524 0.0309962 +531 17.1292 5.71389 14.2758 -0.00471 0.00306105 -0.00302256 0.00640288 -0.00217908 0.00597542 +532 18.5582 7.1383 15.7041 -0.00318405 0.00196883 -0.00350526 0.00347816 0.00166544 0.00487157 +533 -0.00294776 8.56709 14.2769 -0.00140854 0.000644072 -0.00197303 0.000644631 0.00310502 0.00206432 +534 1.42359 9.99346 15.7075 0.000871045 0.000523887 -0.00248084 0.0021129 0.000994035 0.00120289 +535 2.84785 8.56315 14.2813 0.00188459 0.0012155 -0.00225054 0.00369621 0.00239073 0.0018127 +536 4.2679 9.98856 15.7191 0.00551047 0.00353395 -0.006335 0.00616048 0.000210531 0.0010348 +537 5.68425 8.54536 14.3022 0.00541667 0.00238174 -0.00545037 0.0193195 0.0116277 -0.00164321 +538 7.12192 9.99337 15.7214 -0.0172219 -0.00298907 0.0204979 -0.000536269 0.00144538 0.0177974 +539 8.53647 8.54005 14.3079 -0.0533537 -0.0491305 0.0509742 -0.000632832 0.00312263 0.00917679 +540 9.99482 10.0051 15.7225 -0.0055739 -0.00823437 0.028156 0.00203633 0.00869988 0.0174598 +541 11.4358 8.54309 14.2995 0.0101888 -0.0084134 -0.0101401 0.0173634 0.10752 -0.100201 +542 12.8534 9.99823 15.7149 -0.012512 0.00300147 -0.00541313 -0.008848 0.0318834 -0.0194687 +543 14.2733 8.57289 14.2783 -0.0312078 0.026588 -0.0286511 0.0777946 -0.055141 0.0714177 +544 15.7197 9.98391 15.7232 0.00288548 -0.00562881 0.00333315 0.0100309 0.0158349 0.0151774 +545 17.1318 8.567 14.2779 -0.00827826 0.00291746 -0.00626759 0.00489755 0.00077416 0.0111398 +546 18.5602 9.99361 15.7072 -0.00158982 -0.000682801 -0.00278979 0.00360568 0.00259008 0.00661385 +547 -0.00231752 11.4231 14.2789 -0.000918741 -0.000521443 -0.00183555 0.00306906 0.00179985 0.00331339 +548 1.42453 12.8514 15.7088 0.0016412 -0.00139792 -0.00291675 0.00286887 1.03775e-06 0.00190806 +549 2.84871 11.4222 14.2821 0.004401 -0.000739473 -0.00462981 0.00558327 0.00101043 0.0030967 +550 4.26705 12.8564 15.7207 0.0103857 -0.00330369 -0.01116 -0.00100228 -0.00533643 0.00871693 +551 5.67453 11.4232 14.3092 0.0229413 -0.000895897 -0.0206181 0.0244181 -0.00466567 -0.00831423 +552 7.118 12.8661 15.7236 -0.00562592 0.00247615 0.0060675 -0.00114569 0.0147448 0.0292587 +553 8.52098 11.4529 14.3062 -0.0200872 0.00293364 0.0180065 -0.0297918 0.0154112 0.0132228 +554 9.99433 12.8562 15.7153 -0.00270196 -0.00208244 0.00604202 0.0205922 -0.0160934 -0.0224766 +555 11.4745 11.475 14.3054 -0.0176841 0.00414501 -0.0307683 -0.114566 -0.0964255 -0.254677 +556 12.8769 12.8785 15.749 -0.00465443 -0.00160857 0.021854 -0.0372359 -0.0337646 -0.0550239 +557 14.3195 11.4086 14.3178 -0.00447411 -0.0290348 -0.00326494 0.0265746 0.0444319 0.0167454 +558 15.7357 12.8547 15.7413 0.00889977 -0.00801245 0.0119293 -0.00255623 0.0196025 -0.000942507 +559 17.133 11.4254 14.2834 -0.00770926 -0.0017916 -0.00390351 0.0148231 0.00380476 0.0139324 +560 18.5628 12.8522 15.7114 -0.000844894 -0.00206292 -0.00136066 0.00476096 0.00464817 0.00582281 +561 -0.000461417 14.2803 14.2809 0.000139319 -0.00149223 -0.00144547 0.00492574 0.00198931 0.00302056 +562 1.42576 15.7094 15.709 0.00233513 -0.00273897 -0.00338917 0.00335341 -0.000105412 0.00198909 +563 2.84934 14.282 14.2826 0.00445811 -0.00531595 -0.00586248 0.00755859 -0.000474739 0.00361411 +564 4.26941 15.7193 15.7192 0.0106612 -0.0113032 -0.0125462 -0.011112 0.0127786 0.0159322 +565 5.67794 14.3082 14.3098 0.0260861 -0.0251396 -0.0267646 -0.0203944 0.0286301 0.0319441 +566 7.13934 15.7108 15.7131 -0.00100503 -0.00727226 -0.00677937 0.00493199 0.0154738 0.0187299 +567 8.57731 14.2805 14.2871 -0.00899872 -0.0134359 -0.00891032 0.00752692 0.0267375 0.0226775 +568 9.98396 15.7259 15.7285 -0.0132063 0.00564855 0.00619554 0.0231398 -0.00218837 -0.00125887 +569 11.4045 14.3202 14.3195 -0.020746 0.0272767 0.0273274 0.0126672 -0.0320461 -0.0337819 +570 12.8528 15.7391 15.7427 -0.000984703 0.0161233 0.0199272 0.00238335 -0.019537 -0.0210236 +571 14.3593 14.3624 14.3694 0.0358776 0.0362733 0.0450394 -0.000181477 -0.00367252 -0.0223704 +572 15.7444 15.7466 15.7483 0.0130564 0.0124607 0.0137366 -0.00374919 -0.00143649 -0.00168633 +573 17.1398 14.2896 14.2912 0.000382522 -0.00031981 0.00124191 0.0170589 0.01315 0.0110508 +574 18.5655 15.7134 15.7131 -0.000584094 -0.000413421 -0.000905357 0.0079773 0.00506654 0.00648607 +575 0.00150262 17.1362 14.2795 0.000378804 -0.00250025 -0.00222062 0.00553194 0.00350951 0.00313306 +576 1.42796 18.5636 15.7068 0.00179728 -0.00281188 -0.00316391 0.00218531 0.00365908 0.00139168 +577 2.85095 17.1377 14.2802 0.00536551 -0.00642412 -0.00454658 -0.00196109 0.00427517 0.00308198 +578 4.28319 18.5621 15.7061 0.00155012 -0.0031322 -0.00351525 -0.000317625 0.00215461 0.0025288 +579 5.70875 17.1346 14.2809 0.00488729 -0.00498738 -0.00638633 -0.00091859 0.000788953 0.00888073 +580 7.13911 18.5613 15.7044 -0.00106881 -0.00124297 -0.00166488 0.000604954 0.0033694 0.00621001 +581 8.56686 17.1315 14.2774 -0.00190263 -0.00122913 -0.00253316 0.00546963 0.00945823 0.0134327 +582 9.99185 18.5635 15.7069 -0.000915484 -0.0012821 -0.00119073 0.0052274 0.00498779 0.00829937 +583 11.4225 17.1348 14.2842 0.000697938 -0.00348932 -0.00136551 0.0082593 0.00922713 0.00496227 +584 12.8489 18.5662 15.7109 -0.000279288 -0.000528292 0.000201838 0.005744 0.00509521 0.00718448 +585 14.2913 17.1461 14.2949 -0.000929433 -0.00121449 -0.000264993 0.000190325 0.00727889 0.00148713 +586 15.7114 18.5698 15.7139 0.000405393 -0.00160558 -0.001235 0.0046589 0.00505392 0.00570374 +587 17.1451 17.1474 14.283 0.000117171 -0.000616404 -0.00440766 0.011035 0.0116859 0.0124598 +588 18.5659 18.5685 15.7091 0.000861411 -0.000176499 -0.00237811 0.00769171 0.00561471 0.00521276 +589 0.00288833 0.00420169 17.134 0.000691063 -0.000289482 -0.00222258 0.0057688 0.00481694 0.00156566 +590 1.42919 1.42791 18.5577 -0.000631336 -0.000212421 -0.00106602 0.00401106 0.00503994 0.000147838 +591 2.85699 0.00158441 17.1321 6.16401e-05 -0.00150412 -0.00228841 0.00121028 0.00335926 0.000143031 +592 4.28406 1.42694 18.5578 -0.00179415 -0.00130862 -0.000286706 -0.000495442 0.00427202 -1.6767e-06 +593 5.71197 0.00109634 17.1313 -0.00121445 -0.00118274 -0.00110136 -0.00137866 0.00266659 0.00199484 +594 7.13792 1.42825 18.5588 -0.00127675 -0.00100534 0.000114672 -0.00331178 0.00278131 0.00234961 +595 8.56484 0.00268426 17.1325 -0.000972248 -0.000582668 -0.000644016 -0.000659484 0.00270218 0.00520387 +596 9.99179 1.42968 18.5594 -0.000328019 -0.000540108 0.000176231 -0.00164919 0.00274157 0.00483149 +597 11.4189 0.00413895 17.134 -0.000409338 -0.000200034 -0.000307007 0.00288481 0.00436589 0.00731237 +598 12.8468 1.43052 18.5597 0.000572092 -0.000221725 -4.68669e-05 0.00299541 0.00409762 0.00563314 +599 14.2759 0.00565493 17.1354 0.000673861 2.46217e-05 -0.000503876 0.00579961 0.00537015 0.006417 +600 15.7034 1.43088 18.5597 0.000820521 0.000358158 -0.000370026 0.00677382 0.00509129 0.00405873 +601 17.1349 0.00660603 17.1362 0.000611474 0.000159187 -0.00131981 0.00720617 0.00495717 0.00376805 +602 18.561 1.42995 18.5589 0.000231741 0.000586892 -0.000935378 0.00747162 0.00505926 0.00194819 +603 -0.00091623 2.85567 17.1305 -0.00108094 0.000369512 -0.00151575 0.00481507 0.00471715 -0.000400105 +604 1.42526 4.27929 18.5581 -0.00143381 0.000245124 -0.000909586 0.00355025 0.00498308 -0.000380633 +605 2.85467 2.8538 17.1308 -0.00158367 -0.00103208 -0.000797823 0.00201608 0.00504769 -0.00196743 +606 4.27983 4.278 18.5606 -0.00438345 -0.00335488 0.00277672 0.00153346 0.00515032 -0.00166673 +607 5.71077 2.85457 17.1307 -0.00259853 -0.0024605 0.00100951 0.000769975 0.00468045 -0.00107056 +608 7.13708 4.28064 18.5609 -0.00238919 -0.00351084 0.00285487 -0.000102963 0.00393145 0.00033441 +609 8.56543 2.85643 17.1307 -0.000814384 -0.00180187 0.000832422 -0.00113055 0.00273469 0.00316254 +610 9.99257 4.28276 18.5603 0.000445727 -0.00255806 0.00196856 -0.00128992 0.0017261 0.0039936 +611 11.4194 2.85749 17.1307 0.000500453 -0.00125179 0.000284023 -3.05562e-05 0.00225929 0.00584272 +612 12.8475 4.28303 18.5597 0.00196552 -0.00175552 0.00124235 0.00029727 0.00206418 0.00476516 +613 14.2741 2.85764 17.1307 0.000755553 -0.00042336 -0.000545199 0.00275235 0.00315473 0.00536251 +614 15.7042 4.28172 18.5591 0.00061652 0.000321508 -0.000249362 0.00210975 0.00387487 0.0028671 +615 17.131 2.85673 17.1311 -0.000308488 0.000589652 -0.00133433 0.00566771 0.00341067 0.00318982 +616 18.5585 4.28185 18.557 -0.0015405 0.00171455 -0.00170953 0.00706746 0.00205374 0.00389021 +617 -0.00243093 5.70895 17.1311 -0.00144786 0.00113284 -0.00205977 0.00336116 0.00336531 0.000947761 +618 1.4245 7.13459 18.5603 -0.000408725 0.000375601 -0.00116081 0.002277 0.00281428 0.000679933 +619 2.84914 5.70466 17.1353 -0.0011934 -3.32022e-06 -0.00106111 0.00333534 0.00513373 -0.00223272 +620 4.27797 7.13389 18.5632 -0.00430711 -0.00185319 0.00283867 0.00218454 0.00192797 0.000476544 +621 5.7036 5.70263 17.1387 -0.00949112 -0.00831684 0.00780964 0.00505263 0.00540058 -0.00209542 +622 7.1357 7.1362 18.5621 -0.00373377 -0.00356841 0.00364216 0.00207344 0.00113864 0.00267632 +623 8.56392 5.70733 17.1359 -0.00251499 -0.00669862 0.00660375 0.00684464 0.00641532 0.00020374 +624 9.99202 7.13919 18.5608 4.35223e-05 -0.00229953 0.00217793 0.00395648 0.00219565 0.00557802 +625 11.4209 5.70947 17.134 0.00342896 -0.00495137 0.00420772 -2.99332e-05 0.00376916 0.00471413 +626 12.8478 7.13809 18.5611 0.000748397 -0.000401139 0.000529773 0.00197118 0.00226995 0.00607361 +627 14.2783 5.7081 17.1347 0.00148387 -0.00042427 0.000132907 -0.00557365 0.00544325 0.00258974 +628 15.7037 7.13715 18.5609 -0.00217139 0.00193156 -0.0020631 0.00103457 0.00290688 0.00408665 +629 17.1302 5.71087 17.131 -0.00384384 0.00392122 -0.00417691 0.00990979 -0.00486218 0.0112186 +630 18.5607 7.13454 18.5606 -0.000209045 -0.000364809 -0.000499022 0.00256875 0.00390678 0.00243414 +631 -0.00128372 8.56432 17.1334 -0.000274744 0.000125207 -0.00185181 0.00205636 0.00239477 0.00210406 +632 1.42538 9.9925 18.5623 0.000523988 0.000158593 -0.0014774 0.00205552 -4.41682e-05 0.00203436 +633 2.84785 8.5618 17.138 0.000953768 0.00157151 -0.00256391 0.00285991 0.000968812 0.000245831 +634 4.27795 9.99245 18.5647 -0.00293497 0.000308409 0.00197877 0.00308558 -1.47609e-05 0.00159375 +635 5.70176 8.56119 17.1407 -0.00857985 -0.00313603 0.0074698 0.00358596 0.000157697 0.00421686 +636 7.1354 9.99316 18.5629 -0.00257808 -0.00129504 0.0033112 0.00269852 0.0029685 0.00548302 +637 8.56253 8.5661 17.1316 -0.00569468 -0.00704541 0.00537651 0.00341716 2.97417e-05 0.0194954 +638 9.99268 9.99559 18.5609 -0.000830805 -0.00151973 0.00206795 0.00733086 0.00670199 0.005205 +639 11.4208 8.56677 17.1316 0.000314882 -0.00389627 -0.00135934 0.00993778 0.00736713 0.00456839 +640 12.8487 9.9958 18.5618 -0.00231691 0.000576832 -0.0013698 0.00226671 0.0063959 0.00550763 +641 14.277 8.56564 17.1369 -0.0048647 0.00317408 -0.00496256 -0.00376265 0.00934612 -0.00151389 +642 15.7071 9.99224 18.565 -0.00108723 -0.00115689 -0.000378491 0.00163504 0.0047977 0.00482213 +643 17.1373 8.56038 17.1391 0.000255293 -0.0019892 -5.99705e-05 0.00207871 0.00553416 0.00607641 +644 18.5637 9.99074 18.5645 0.00109153 -0.00178483 0.000448522 0.0017633 0.00403571 0.00240328 +645 0.000285278 11.4218 17.1358 0.000382379 -0.000857053 -0.00155577 0.00280365 0.00150207 0.00262162 +646 1.42657 12.8514 18.5638 0.00103517 -0.000457081 -0.00193572 0.00305929 -0.00123107 0.00291766 +647 2.84833 11.422 17.1394 0.0026043 0.000797002 -0.00388112 0.00120778 -0.00275271 0.00316752 +648 4.27862 12.852 18.566 -0.00213755 0.000817007 0.00119907 0.00317587 -0.000501367 0.00171753 +649 5.70055 11.4239 17.1424 -0.00530515 0.00221478 0.00516317 0.0032455 0.000715871 0.00296997 +650 7.13496 12.8509 18.5651 -0.00172843 0.00015463 0.00228305 0.00210022 0.00529369 0.00591542 +651 8.55978 11.4258 17.1342 -0.00449637 -0.00107982 0.00286541 0.00246532 0.00934517 0.0146592 +652 9.99367 12.8501 18.5632 -0.00023291 -0.000978824 0.000429135 0.00616452 0.004254 0.00494148 +653 11.426 11.4292 17.134 -0.00254151 -0.000162194 -0.00642743 0.00684003 0.00867003 -0.0137759 +654 12.853 12.8549 18.5672 -0.000774659 -0.000770444 0.00175648 0.00270437 0.00533668 0.00392771 +655 14.2857 11.4237 17.1408 -0.00175257 -0.00318273 -0.00429065 -0.0012573 0.0084251 0.00869801 +656 15.7109 12.8525 18.5689 0.000230314 -0.00220624 0.000404013 0.00258889 0.00748 0.00350008 +657 17.1435 11.418 17.146 0.00300103 -0.00416451 0.00259165 0.00129493 0.0106273 0.00492858 +658 18.5662 12.8507 18.5674 0.00182762 -0.00153667 0.000847986 0.00433267 0.00329787 0.00337348 +659 0.00198115 14.281 17.1376 0.000782615 -0.00113521 -0.00196162 0.00490392 0.000894822 0.00338407 +660 1.4282 15.7098 18.5645 0.00164881 -0.00147387 -0.00257482 0.00333424 0.000288907 0.00325287 +661 2.849 14.2826 17.1404 0.00397437 -0.00249101 -0.00550703 -1.85922e-05 -0.00140058 0.00455392 +662 4.28043 15.71 18.5661 -0.00117567 -3.78316e-05 -0.000475585 0.000926121 0.00019217 0.00237767 +663 5.70173 14.2865 17.1435 -0.00244712 0.000942481 0.0024961 0.000902736 0.00364441 0.00100959 +664 7.13745 15.7068 18.5657 -0.00139341 -2.50285e-06 0.000587038 0.00310535 0.00109188 0.00222816 +665 8.56376 14.2803 17.14 -0.00211884 -0.000226183 0.00312138 0.0149032 0.00109449 5.75592e-06 +666 9.99108 15.7088 18.5677 -0.00189055 0.00108061 0.0013321 0.0056045 0.00498985 0.0046457 +667 11.4215 14.2873 17.1413 -0.0024373 0.00315202 0.00217784 0.0048998 -0.00176777 0.00461472 +668 12.8496 15.7127 18.5698 -0.000255984 0.00161651 0.00196802 0.00550995 0.00421671 0.00250518 +669 14.2942 14.2965 17.1533 0.00300096 0.00224111 0.00731999 -0.0112404 -0.00696391 -0.00413059 +670 15.7138 15.7167 18.5722 0.00212597 0.000977099 0.000521883 0.00207091 0.00207069 0.000176549 +671 17.1491 14.2862 17.1522 0.00469341 -0.000691461 0.0042478 0.00334464 0.00591391 0.00379876 +672 18.5686 15.7126 18.5697 0.00270721 1.32379e-06 0.00103222 0.0062456 0.00294895 0.00261526 +673 0.00365743 17.139 17.1374 0.00138422 -0.000992627 -0.00194345 0.00618728 0.0025294 0.00287336 +674 1.42998 18.5645 18.5623 0.00139399 -0.001496 -0.00255591 0.00280289 0.00424403 0.0030254 +675 2.85177 17.1397 17.1385 0.00393204 -0.00474912 -0.00573864 -0.00317867 0.00525282 0.00618962 +676 4.2845 18.5618 18.5612 -0.00052827 -0.00151863 -0.00185191 -0.00102157 0.00299375 0.00289173 +677 5.71062 17.1364 17.1368 -0.000166332 -0.00325031 -0.003529 -0.000716494 0.00547771 0.00755723 +678 7.13623 18.5637 18.5639 -0.00251837 0.000400219 0.000208457 -9.02723e-05 0.00176854 0.00278256 +679 8.56039 17.1418 17.1428 -0.00556251 0.00169782 0.00155977 0.00957628 0.00191161 0.00452317 +680 9.98964 18.5663 18.5664 -0.00241042 0.00157145 0.00128238 0.0032428 0.00321973 0.00411087 +681 11.4165 17.1471 17.148 -0.00484832 0.00437362 0.00429968 0.0111996 0.000362933 0.00192385 +682 12.8472 18.5686 18.5679 -0.000617111 0.00216858 0.00184491 0.00595639 0.00469939 0.00442758 +683 14.2835 17.1521 17.1526 0.00277416 0.00673894 0.00696785 0.000926401 -0.00103412 -0.00110733 +684 15.7084 18.571 18.5693 0.00222237 0.0029274 0.00228672 0.00639032 0.00337845 0.00189706 +685 17.1509 17.1539 17.153 0.00630479 0.00543894 0.00489781 0.00350232 0.00136692 0.00142792 +686 18.568 18.5704 18.568 0.00316726 0.00214046 0.00112646 0.00689416 0.00307038 0.00131717 +687 10.1985 10.7319 10.9228 0.384537 -0.0571837 0.328595 0.0278179 -0.0413041 0.123219 diff --git a/fortran/README b/fortran/README new file mode 100644 index 0000000000..653b6a966e --- /dev/null +++ b/fortran/README @@ -0,0 +1,11 @@ +This directory contains Fortran code which interface LAMMPS as a library +and allows the LAMMPS library interface to be invoked from Fortran codes. +It requires a Fortran compiler that supports the Fortran 2003 standard. + +This interface is based on and supersedes the previous Fortran interfaces +in the examples/COUPLE/fortran* folders. But is fully supported by the +LAMMPS developers and included in the documentation and unit testing. + +Details on this Fortran interface and how to build programs using it +are in the manual in the doc/html/pg_fortran.html file. + diff --git a/fortran/lammps.f90 b/fortran/lammps.f90 new file mode 100644 index 0000000000..6511673c66 --- /dev/null +++ b/fortran/lammps.f90 @@ -0,0 +1,280 @@ +! ------------------------------------------------------------------------- +! LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator +! http://lammps.sandia.gov, Sandia National Laboratories +! Steve Plimpton, sjplimp@sandia.gov +! +! 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. +! ------------------------------------------------------------------------- +! +! Fortran interface to the LAMMPS library implemented as a Fortran 2003 +! style module that wraps the C-style library interface in library.cpp +! and library.h using the ISO_C_BINDING module of the Fortran compiler. +! +! Based on the LAMMPS Fortran 2003 module contributed by: +! Karl D. Hammond +! University of Tennessee, Knoxville (USA), 2012 +! +! The Fortran module tries to follow the API of the C-library interface +! closely, but like the Python wrapper it employs an object oriented +! approach. To accommodate the object oriented approach, all exported +! subroutine and functions have to be implemented in Fortran to then +! call the interfaced C style functions with adapted calling conventions +! as needed. The C-library interfaced functions retain their names +! starting with "lammps_" while the Fortran versions start with "lmp_". +! +MODULE LIBLAMMPS + + USE, INTRINSIC :: ISO_C_BINDING, ONLY: c_ptr, c_null_ptr, c_loc, & + c_int, c_char, c_null_char, c_double + + IMPLICIT NONE + PRIVATE + PUBLIC :: lammps + + TYPE lammps + TYPE(c_ptr) :: handle + CONTAINS + PROCEDURE :: close => lmp_close + PROCEDURE :: file => lmp_file + PROCEDURE :: command => lmp_command + PROCEDURE :: commands_list => lmp_commands_list + PROCEDURE :: commands_string => lmp_commands_string + PROCEDURE :: version => lmp_version + PROCEDURE :: get_natoms => lmp_get_natoms + END TYPE lammps + + INTERFACE lammps + MODULE PROCEDURE lmp_open + END INTERFACE lammps + + ! interface definitions for calling functions in library.cpp + INTERFACE + FUNCTION lammps_open(argc,argv,comm) & + BIND(C, name='lammps_open_fortran') + IMPORT :: c_ptr, c_int + INTEGER(c_int), VALUE, INTENT(in) :: argc, comm + TYPE(c_ptr), DIMENSION(*), INTENT(in) :: argv + TYPE(c_ptr) :: lammps_open + END FUNCTION lammps_open + + FUNCTION lammps_open_no_mpi(argc,argv,handle) & + BIND(C, name='lammps_open_no_mpi') + IMPORT :: c_ptr, c_int + INTEGER(c_int), VALUE, INTENT(in) :: argc + TYPE(c_ptr), DIMENSION(*), INTENT(in) :: argv + TYPE(c_ptr), INTENT(out) :: handle + TYPE(c_ptr) :: lammps_open_no_mpi + END FUNCTION lammps_open_no_mpi + + SUBROUTINE lammps_close(handle) BIND(C, name='lammps_close') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: handle + END SUBROUTINE lammps_close + + SUBROUTINE lammps_mpi_init(handle) BIND(C, name='lammps_mpi_init') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: handle + END SUBROUTINE lammps_mpi_init + + SUBROUTINE lammps_mpi_finalize(handle) & + BIND(C, name='lammps_mpi_finalize') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: handle + END SUBROUTINE lammps_mpi_finalize + + SUBROUTINE lammps_file(handle,filename) BIND(C, name='lammps_file') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: handle + TYPE(c_ptr), VALUE :: filename + END SUBROUTINE lammps_file + + SUBROUTINE lammps_command(handle,cmd) BIND(C, name='lammps_command') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: handle + TYPE(c_ptr), VALUE :: cmd + END SUBROUTINE lammps_command + + SUBROUTINE lammps_commands_list(handle,ncmd,cmds) & + BIND(C, name='lammps_commands_list') + IMPORT :: c_ptr, c_int + TYPE(c_ptr), VALUE :: handle + INTEGER(c_int), VALUE, INTENT(in) :: ncmd + TYPE(c_ptr), DIMENSION(*), INTENT(in) :: cmds + END SUBROUTINE lammps_commands_list + + SUBROUTINE lammps_commands_string(handle,str) & + BIND(C, name='lammps_commands_string') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: handle + TYPE(c_ptr), VALUE :: str + END SUBROUTINE lammps_commands_string + + SUBROUTINE lammps_free(ptr) BIND(C, name='lammps_free') + IMPORT :: c_ptr + TYPE(c_ptr), VALUE :: ptr + END SUBROUTINE lammps_free + + FUNCTION lammps_version(handle) BIND(C, name='lammps_version') + IMPORT :: c_ptr, c_int + TYPE(c_ptr), VALUE :: handle + INTEGER(c_int) :: lammps_version + END FUNCTION lammps_version + + FUNCTION lammps_get_natoms(handle) BIND(C, name='lammps_get_natoms') + IMPORT :: c_ptr, c_double + TYPE(c_ptr), VALUE :: handle + REAL(c_double) :: lammps_get_natoms + END FUNCTION lammps_get_natoms + END INTERFACE + +CONTAINS + + ! Fortran wrappers and helper functions. + + ! Constructor for the LAMMPS class. + ! Combined wrapper around lammps_open_fortran() and lammps_open_no_mpi() + TYPE(lammps) FUNCTION lmp_open(args,comm) + IMPLICIT NONE + INTEGER,INTENT(in), OPTIONAL :: comm + CHARACTER(len=*), INTENT(in), OPTIONAL :: args(:) + TYPE(c_ptr), ALLOCATABLE :: argv(:) + TYPE(c_ptr) :: dummy=c_null_ptr + INTEGER :: i,argc + + IF (PRESENT(args)) THEN + ! convert argument list to c style + argc = SIZE(args) + ALLOCATE(argv(argc)) + DO i=1,argc + argv(i) = f2c_string(args(i)) + END DO + ELSE + argc = 1 + ALLOCATE(argv(1)) + argv(1) = f2c_string("liblammps") + ENDIF + + IF (PRESENT(comm)) THEN + lmp_open%handle = lammps_open(argc,argv,comm) + ELSE + lmp_open%handle = lammps_open_no_mpi(argc,argv,dummy) + END IF + + ! Clean up allocated memory + DO i=1,argc + CALL lammps_free(argv(i)) + END DO + DEALLOCATE(argv) + END FUNCTION lmp_open + + ! Combined Fortran wrapper around lammps_close() and lammps_mpi_finalize() + SUBROUTINE lmp_close(self,finalize) + IMPLICIT NONE + CLASS(lammps) :: self + LOGICAL,INTENT(in),OPTIONAL :: finalize + + CALL lammps_close(self%handle) + + IF (PRESENT(finalize)) THEN + IF (finalize) THEN + CALL lammps_mpi_finalize(self%handle) + END IF + END IF + END SUBROUTINE lmp_close + + INTEGER FUNCTION lmp_version(self) + IMPLICIT NONE + CLASS(lammps) :: self + + lmp_version = lammps_version(self%handle) + END FUNCTION lmp_version + + DOUBLE PRECISION FUNCTION lmp_get_natoms(self) + IMPLICIT NONE + CLASS(lammps) :: self + + lmp_get_natoms = lammps_get_natoms(self%handle) + END FUNCTION lmp_get_natoms + + SUBROUTINE lmp_file(self,filename) + IMPLICIT NONE + CLASS(lammps) :: self + CHARACTER(len=*) :: filename + TYPE(c_ptr) :: str + + str = f2c_string(filename) + CALL lammps_file(self%handle,str) + CALL lammps_free(str) + END SUBROUTINE lmp_file + + ! equivalent function to lammps_command() + SUBROUTINE lmp_command(self,cmd) + IMPLICIT NONE + CLASS(lammps) :: self + CHARACTER(len=*) :: cmd + TYPE(c_ptr) :: str + + str = f2c_string(cmd) + CALL lammps_command(self%handle,str) + CALL lammps_free(str) + END SUBROUTINE lmp_command + + ! equivalent function to lammps_commands_list() + SUBROUTINE lmp_commands_list(self,cmds) + IMPLICIT NONE + CLASS(lammps) :: self + CHARACTER(len=*), INTENT(in), OPTIONAL :: cmds(:) + TYPE(c_ptr), ALLOCATABLE :: cmdv(:) + INTEGER :: i,ncmd + + ! convert command list to c style + ncmd = SIZE(cmds) + ALLOCATE(cmdv(ncmd)) + DO i=1,ncmd + cmdv(i) = f2c_string(cmds(i)) + END DO + + CALL lammps_commands_list(self%handle,ncmd,cmdv) + + ! Clean up allocated memory + DO i=1,ncmd + CALL lammps_free(cmdv(i)) + END DO + DEALLOCATE(cmdv) + END SUBROUTINE lmp_commands_list + + ! equivalent function to lammps_commands_string() + SUBROUTINE lmp_commands_string(self,str) + IMPLICIT NONE + CLASS(lammps) :: self + CHARACTER(len=*) :: str + TYPE(c_ptr) :: tmp + + tmp = f2c_string(str) + CALL lammps_commands_string(self%handle,tmp) + CALL lammps_free(tmp) + END SUBROUTINE lmp_commands_string + + ! ---------------------------------------------------------------------- + ! local helper functions + ! copy fortran string to zero terminated c string + FUNCTION f2c_string(f_string) RESULT(ptr) + CHARACTER (len=*), INTENT(in) :: f_string + CHARACTER (len=1, kind=c_char), POINTER :: c_string(:) + TYPE(c_ptr) :: ptr + INTEGER :: i, n + + n = LEN_TRIM(f_string) + ALLOCATE(c_string(n+1)) + DO i=1,n + c_string(i) = f_string(i:i) + END DO + c_string(n+1) = c_null_char + ptr = c_loc(c_string(1)) + END FUNCTION f2c_string +END MODULE LIBLAMMPS diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 80942f60bf..7bf6125bc6 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -273,7 +273,7 @@ public: }; /// format a string -const char *fmt(const char *format,...); +const char *logfmt(const char *format,...); /// macros with common usage #define LOGFATAL(code,text,lineinfo) ((lineinfo) ? ::message(vblFATAL,(code)," %s at %s:%d",(text),__FILE__,__LINE__) : \ diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index d29745fda1..7e82af0f65 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -16,7 +16,7 @@ message_logger &message_logger::global(){ message_logger *message_logger::glogp=NULL; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); -const char *fmt(const char *format,...){ +const char *logfmt(const char *format,...){ va_list args; va_start(args,format); static char buff[1024]; diff --git a/lib/awpmd/systems/interact/TCP/wpmd.cpp b/lib/awpmd/systems/interact/TCP/wpmd.cpp index 1e53f3141c..660d7c21d7 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd.cpp @@ -170,7 +170,7 @@ int AWPMD::set_pbc(const Vector_3P pcell, int pbc_){ int AWPMD::set_electrons(int s, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass, double *q) { if(s < 0 || s > 1) - return LOGERR(-1,fmt("AWPMD.set_electrons: invaid s setting (%d)!",s),LINFO); + return LOGERR(-1,logfmt("AWPMD.set_electrons: invaid s setting (%d)!",s),LINFO); norm_matrix_state[s] = NORM_UNDEFINED; nwp[s]=ne[s]=n; @@ -363,20 +363,20 @@ int AWPMD::interaction(int flag, Vector_3P fi, Vector_3P fe_x, //3. inverting the overlap matrix int info=0; if(nes){ - /*FILE *f1=fopen(fmt("matrO_%d.d",s),"wt"); + /*FILE *f1=fopen(logfmt("matrO_%d.d",s),"wt"); fileout(f1,Y[s],"%15g"); fclose(f1);8*/ - + ZPPTRF("L",&nes,Y[s].arr,&info); // analyze return code here if(info<0) - return LOGERR(info,fmt("AWPMD.interacton: call to ZPTRF failed (exitcode %d)!",info),LINFO); + return LOGERR(info,logfmt("AWPMD.interacton: call to ZPTRF failed (exitcode %d)!",info),LINFO); ZPPTRI("L",&nes,Y[s].arr,&info); if(info<0) - return LOGERR(info,fmt("AWPMD.interacton: call to ZPTRI failed (exitcode %d)!",info),LINFO); + return LOGERR(info,logfmt("AWPMD.interacton: call to ZPTRI failed (exitcode %d)!",info),LINFO); - - /*f1=fopen(fmt("matrY_%d.d",s),"wt"); + + /*f1=fopen(logfmt("matrY_%d.d",s),"wt"); fileout(f1,Y[s],"%15g"); fclose(f1);*/ } @@ -758,7 +758,7 @@ void AWPMD::norm_factorize(int s) { int nes8 = ne[s]*8, info; DGETRF(&nes8, &nes8, Norm[s].arr, &nes8, &ipiv[0], &info); if(info < 0) - LOGERR(info,fmt("AWPMD.norm_factorize: call to DGETRF failed (exitcode %d)!",info),LINFO); + LOGERR(info,logfmt("AWPMD.norm_factorize: call to DGETRF failed (exitcode %d)!",info),LINFO); norm_matrix_state[s] = NORM_FACTORIZED; } @@ -773,7 +773,7 @@ void AWPMD::norm_invert(int s) { DGETRI(&nes8, Norm[s].arr, &nes8, &ipiv[0], (double*)IDD.arr, &IDD_size, &info); // use IDD for work storage if(info < 0) - LOGERR(info,fmt("AWPMD.norm_invert: call to DGETRI failed (exitcode %d)!",info),LINFO); + LOGERR(info,logfmt("AWPMD.norm_invert: call to DGETRI failed (exitcode %d)!",info),LINFO); norm_matrix_state[s] = NORM_INVERTED; } @@ -829,7 +829,7 @@ int AWPMD::step(double dt){ //e gets current electronic coordinates int AWPMD::get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, double mass){ if(spin<0 || spin >1) - return -1; // invalid spin: return LOGERR(-1,fmt("AWPMD.get_electrons: invaid spin setting (%d)!",spin),LINFO); + return -1; // invalid spin: return LOGERR(-1,logfmt("AWPMD.get_electrons: invaid spin setting (%d)!",spin),LINFO); if(mass<0) mass=me; for(int i=0;i 1) - return LOGERR(-1,fmt("AWPMD_split.set_electrons: invaid spin setting (%d)!",s),LINFO); + return LOGERR(-1,logfmt("AWPMD_split.set_electrons: invaid spin setting (%d)!",s),LINFO); // calculating the total n nvar[s]=0; @@ -68,22 +68,22 @@ int AWPMD_split::set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* norm_matrix_state[s] = NORM_UNDEFINED; ne[s]=nel; wp[s].resize(n); - + split_c[s].resize(n); split_c[s].assign(c,c+n); - - + + nspl[s].resize(nel); nspl[s].assign(splits,splits+nel); partition1[s].clear(); for(int i=0;i0){ // width PBC, keeping the width are within [0,Lextra] w[i]=fmod(w[i],Lextra); @@ -107,7 +107,7 @@ int AWPMD_split::set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* else qe[s].assign(nwp[s],-1); - + return 1; } @@ -121,40 +121,40 @@ void AWPMD_split::eterm_deriv(int ic1,int s1,int c1, int j1,int ic2,int s2, int cdouble ck(split_c[s2][ic2+k2][0],split_c[s2][ic2+k2][1]); int indw1=8*ic1, indw2=8*ic2; int indn1=(nvar[s1]/10)*8+2*ic1, indn2=(nvar[s2]/10)*8+2*ic2; - cdouble part_jk=conj(cj)*ck; + cdouble part_jk=conj(cj)*ck; int M= 1; //(j1==k2 ? 1 : 2); // over a_k_re - E_der[s2][indw2+8*k2]+= M*real(pref*part_jk*(o.da2_re()*v+o.I0*dv_ak)); + E_der[s2][indw2+8*k2]+= M*real(pref*part_jk*(o.da2_re()*v+o.I0*dv_ak)); // over a_k_im - E_der[s2][indw2+8*k2+1]+= M*real(pref*part_jk*(o.da2_im()*v+i_unit*o.I0*dv_ak)); + E_der[s2][indw2+8*k2+1]+= M*real(pref*part_jk*(o.da2_im()*v+i_unit*o.I0*dv_ak)); // over a_j_re - E_der[s1][indw1+8*j1]+= M*real(pref*part_jk*(o.da1_re()*v+o.I0*dv_aj_conj)); + E_der[s1][indw1+8*j1]+= M*real(pref*part_jk*(o.da1_re()*v+o.I0*dv_aj_conj)); // over a_j_im - E_der[s1][indw1+8*j1+1]+= M*real(pref*part_jk*(o.da1_im()*v-i_unit*o.I0*dv_aj_conj)); + E_der[s1][indw1+8*j1+1]+= M*real(pref*part_jk*(o.da1_im()*v-i_unit*o.I0*dv_aj_conj)); for(int i=0;i<3;i++){ // over b_k_re - E_der[s2][indw2+8*k2+2+2*i]+= M*real(pref*part_jk*(o.db2_re(i)*v+o.I0*dv_bk[i])); + E_der[s2][indw2+8*k2+2+2*i]+= M*real(pref*part_jk*(o.db2_re(i)*v+o.I0*dv_bk[i])); // over b_k_im - E_der[s2][indw2+8*k2+2+2*i+1]+= M*real(pref*part_jk*(o.db2_im(i)*v+i_unit*o.I0*dv_bk[i])); + E_der[s2][indw2+8*k2+2+2*i+1]+= M*real(pref*part_jk*(o.db2_im(i)*v+i_unit*o.I0*dv_bk[i])); // over b_j_re - E_der[s1][indw1+8*j1+2+2*i]+= M*real(pref*part_jk*(o.db1_re(i)*v+o.I0*dv_bj_conj[i])); + E_der[s1][indw1+8*j1+2+2*i]+= M*real(pref*part_jk*(o.db1_re(i)*v+o.I0*dv_bj_conj[i])); // over b_j_im - E_der[s1][indw1+8*j1+2+2*i+1]+= M*real(pref*part_jk*(o.db1_im(i)*v-i_unit*o.I0*dv_bj_conj[i])); + E_der[s1][indw1+8*j1+2+2*i+1]+= M*real(pref*part_jk*(o.db1_im(i)*v-i_unit*o.I0*dv_bj_conj[i])); } // over ck_re - E_der[s2][indn2+2*k2]+=M*real(pref*conj(cj)*o.I0*v); + E_der[s2][indn2+2*k2]+=M*real(pref*conj(cj)*o.I0*v); // over ck_im E_der[s2][indn2+2*k2+1]+=M*real(pref*i_unit*conj(cj)*o.I0*v); // over cj_re - E_der[s1][indn1+2*j1]+=M*real(pref*ck*o.I0*v); + E_der[s1][indn1+2*j1]+=M*real(pref*ck*o.I0*v); // over cj_im - E_der[s1][indn1+2*j1+1]+=M*real(-pref*i_unit*ck*o.I0*v); - + E_der[s1][indn1+2*j1+1]+=M*real(-pref*i_unit*ck*o.I0*v); + double t= -M*real(pref*part_jk*o.I0*v); // nonlocal terms: TODO: make a separate global loop for summation of nonlocal terms for(int j=0;j -mu, v -> -v !!! } - - + + for(int k1=j1+1;k1(E_der[s1].begin()+indw1,(double *)&fe_x[iv1+k1],(double *)&fe_p[iv1+k1],&fe_w[iv1+k1],&fe_pw[iv1+k1], 1./one_h); @@ -341,14 +341,14 @@ void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, ic1+=nspl[s1][c1]; // incrementing block1 wp address iv1+=nspl[s1][c1]; // incrementing global variable address } - } + } } } //e same as interaction, but using Hartee factorization (no antisymmetrization) -int AWPMD_split::interaction_hartree(int flag, Vector_3P fi, Vector_3P fe_x, +int AWPMD_split::interaction_hartree(int flag, Vector_3P fi, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ - + // resize arrays if needed enum APPROX tmp=HARTREE; swap(tmp,approx); // do not need large matrices @@ -358,39 +358,39 @@ int AWPMD_split::interaction_hartree(int flag, Vector_3P fi, Vector_3P fe_x, // clearing forces clear_forces(flag,fi,fe_x,fe_p,fe_w,fe_pw,fe_c); // calculate block norms and (optionally) derivatives - calc_norms(flag); + calc_norms(flag); Eee = Ew = 0.; for(int s1=0;s1<2;s1++){ Ee[s1]=0.; Eei[s1]=0.; int ic1=0; // starting index of the wp for current electron - + for(int c1=0;c1 1) - return LOGERR(-1,fmt("AWPMD_split.add_electron: invaid spin setting (%d)!",s),LINFO); + return LOGERR(-1,logfmt("AWPMD_split.add_electron: invaid spin setting (%d)!",s),LINFO); s_add=s; spl_add=0; return ne[s_add]; diff --git a/lib/compress/Makefile.lammps b/lib/compress/Makefile.lammps index 2d06990d82..c0a42443ba 100644 --- a/lib/compress/Makefile.lammps +++ b/lib/compress/Makefile.lammps @@ -1,21 +1,24 @@ # This file contains the settings to build and link LAMMPS with # support for data compression libraries. -# +# # When you build LAMMPS with the COMPRESS package installed, it will # use the 3 settings in this file. They should be set as follows. -# -# The compress_SYSLIB setting is for linking the compression library. -# By default, the setting will point to zlib (-lz). -# -# The compress_SYSINC and compress_SYSPATH variables do not typically need -# to be set, as compression libraries are usually installed as packages -# in system locations. Otherwise, specify its directory via the -# compress_SYSPATH variable, e.g. -Ldir or compress_SYSINC variable( -Idir) +# +# The compress_SYSLIB setting is for linking the compression libraries. +# By default, the setting will point to zlib (-lz). For including +# Zstandard support add -DLAMMPS_ZSTD to compress_SYSINC and also +# add -lzstd to compress_SYSLIB to link to the library. +# +# The compress_SYSINC and compress_SYSPATH variables typically do not +# need any additional settings, as compression libraries are usually +# installed as packages in system locations. Otherwise, specify its +# library directory via the compress_SYSPATH variable, e.g. -Ldir or +# its include directory via the compress_SYSINC variable( -Idir) # ----------------------------------------------------------- # Settings that the LAMMPS build will import when this package is installed -compress_SYSINC = -compress_SYSLIB = -lz +compress_SYSINC = # -DLAMMPS_ZSTD +compress_SYSLIB = -lz # -lzstd compress_SYSPATH = diff --git a/lib/gpu/Makefile.linux b/lib/gpu/Makefile.linux index a26fbe114c..3fa1dcdce6 100644 --- a/lib/gpu/Makefile.linux +++ b/lib/gpu/Makefile.linux @@ -22,13 +22,13 @@ NVCC = nvcc #CUDA_ARCH = -arch=sm_21 # Kepler hardware -CUDA_ARCH = -arch=sm_30 +#CUDA_ARCH = -arch=sm_30 #CUDA_ARCH = -arch=sm_32 #CUDA_ARCH = -arch=sm_35 #CUDA_ARCH = -arch=sm_37 # Maxwell hardware -#CUDA_ARCH = -arch=sm_50 +CUDA_ARCH = -arch=sm_50 #CUDA_ARCH = -arch=sm_52 # Pascal hardware diff --git a/lib/gpu/Makefile.linux.double b/lib/gpu/Makefile.linux.double index 05f083697d..4693c86d57 100644 --- a/lib/gpu/Makefile.linux.double +++ b/lib/gpu/Makefile.linux.double @@ -7,18 +7,40 @@ EXTRAMAKE = Makefile.lammps.standard +ifeq ($(CUDA_HOME),) CUDA_HOME = /usr/local/cuda +endif + NVCC = nvcc -# Kepler CUDA -#CUDA_ARCH = -arch=sm_35 -# Tesla CUDA -CUDA_ARCH = -arch=sm_21 -# newer CUDA +# obsolete hardware. not supported by current drivers anymore. #CUDA_ARCH = -arch=sm_13 -# older CUDA #CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE +# Fermi hardware +#CUDA_ARCH = -arch=sm_20 +#CUDA_ARCH = -arch=sm_21 + +# Kepler hardware +#CUDA_ARCH = -arch=sm_30 +#CUDA_ARCH = -arch=sm_32 +#CUDA_ARCH = -arch=sm_35 +#CUDA_ARCH = -arch=sm_37 + +# Maxwell hardware +CUDA_ARCH = -arch=sm_50 +#CUDA_ARCH = -arch=sm_52 + +# Pascal hardware +#CUDA_ARCH = -arch=sm_60 +#CUDA_ARCH = -arch=sm_61 + +# Volta hardware +#CUDA_ARCH = -arch=sm_70 + +# Turing hardware +#CUDA_ARCH = -arch=sm_75 + # this setting should match LAMMPS Makefile # one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL @@ -33,7 +55,7 @@ CUDA_PRECISION = -D_DOUBLE_DOUBLE CUDA_INCLUDE = -I$(CUDA_HOME)/include CUDA_LIB = -L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib64/stubs -CUDA_OPTS = -DUNIX -O3 --use_fast_math +CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) -Xcompiler -fPIC CUDR_CPP = mpic++ -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK CUDR_OPTS = -O2 # -xHost -no-prec-div -ansi-alias diff --git a/lib/gpu/Makefile.linux.mixed b/lib/gpu/Makefile.linux.mixed index ca414f1fc1..03c776fad0 100644 --- a/lib/gpu/Makefile.linux.mixed +++ b/lib/gpu/Makefile.linux.mixed @@ -7,18 +7,41 @@ EXTRAMAKE = Makefile.lammps.standard +ifeq ($(CUDA_HOME),) CUDA_HOME = /usr/local/cuda +endif + NVCC = nvcc -# Kepler CUDA -#CUDA_ARCH = -arch=sm_35 -# Tesla CUDA -CUDA_ARCH = -arch=sm_21 -# newer CUDA +# obsolete hardware. not supported by current drivers anymore. #CUDA_ARCH = -arch=sm_13 # older CUDA #CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE +# Fermi hardware +#CUDA_ARCH = -arch=sm_20 +#CUDA_ARCH = -arch=sm_21 + +# Kepler hardware +#CUDA_ARCH = -arch=sm_30 +#CUDA_ARCH = -arch=sm_32 +#CUDA_ARCH = -arch=sm_35 +#CUDA_ARCH = -arch=sm_37 + +# Maxwell hardware +CUDA_ARCH = -arch=sm_50 +#CUDA_ARCH = -arch=sm_52 + +# Pascal hardware +#CUDA_ARCH = -arch=sm_60 +#CUDA_ARCH = -arch=sm_61 + +# Volta hardware +#CUDA_ARCH = -arch=sm_70 + +# Turing hardware +#CUDA_ARCH = -arch=sm_75 + # this setting should match LAMMPS Makefile # one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL @@ -33,7 +56,7 @@ CUDA_PRECISION = -D_SINGLE_DOUBLE CUDA_INCLUDE = -I$(CUDA_HOME)/include CUDA_LIB = -L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib64/stubs -CUDA_OPTS = -DUNIX -O3 --use_fast_math +CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) -Xcompiler -fPIC CUDR_CPP = mpic++ -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK CUDR_OPTS = -O2 # -xHost -no-prec-div -ansi-alias diff --git a/lib/gpu/Makefile.linux.single b/lib/gpu/Makefile.linux.single index 1b349faac2..0c3d525b4e 100644 --- a/lib/gpu/Makefile.linux.single +++ b/lib/gpu/Makefile.linux.single @@ -7,18 +7,40 @@ EXTRAMAKE = Makefile.lammps.standard +ifeq ($(CUDA_HOME),) CUDA_HOME = /usr/local/cuda +endif + NVCC = nvcc -# Kepler CUDA -#CUDA_ARCH = -arch=sm_35 -# Tesla CUDA -CUDA_ARCH = -arch=sm_21 -# newer CUDA +# obsolete hardware. not supported by current drivers anymore. #CUDA_ARCH = -arch=sm_13 -# older CUDA #CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE +# Fermi hardware +#CUDA_ARCH = -arch=sm_20 +#CUDA_ARCH = -arch=sm_21 + +# Kepler hardware +#CUDA_ARCH = -arch=sm_30 +#CUDA_ARCH = -arch=sm_32 +#CUDA_ARCH = -arch=sm_35 +#CUDA_ARCH = -arch=sm_37 + +# Maxwell hardware +CUDA_ARCH = -arch=sm_50 +#CUDA_ARCH = -arch=sm_52 + +# Pascal hardware +#CUDA_ARCH = -arch=sm_60 +#CUDA_ARCH = -arch=sm_61 + +# Volta hardware +#CUDA_ARCH = -arch=sm_70 + +# Turing hardware +#CUDA_ARCH = -arch=sm_75 + # this setting should match LAMMPS Makefile # one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL @@ -33,7 +55,7 @@ CUDA_PRECISION = -D_SINGLE_SINGLE CUDA_INCLUDE = -I$(CUDA_HOME)/include CUDA_LIB = -L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib64/stubs -CUDA_OPTS = -DUNIX -O3 --use_fast_math +CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) -Xcompiler -fPIC CUDR_CPP = mpic++ -DMPI_GERYON -DUCL_NO_EXIT -DMPICH_IGNORE_CXX_SEEK CUDR_OPTS = -O2 # -xHost -no-prec-div -ansi-alias diff --git a/lib/gpu/Makefile.linux_multi b/lib/gpu/Makefile.linux_multi index ba50170f39..d47f87e871 100644 --- a/lib/gpu/Makefile.linux_multi +++ b/lib/gpu/Makefile.linux_multi @@ -13,17 +13,27 @@ endif NVCC = nvcc -# Kepler CUDA -#CUDA_ARCH = -arch=sm_35 -# newer CUDA +# obsolete hardware. not supported by current drivers anymore. #CUDA_ARCH = -arch=sm_13 -# older CUDA #CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE -CUDA_ARCH = -arch=sm_30 -CUDA_CODE = -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61] \ - -gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_35,code=[sm_35,compute_35] \ - -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] +# Fermi hardware +#CUDA_ARCH = -arch=sm_20 +#CUDA_ARCH = -arch=sm_21 + +# Kepler hardware +#CUDA_ARCH = -arch=sm_30 +#CUDA_ARCH = -arch=sm_32 +#CUDA_ARCH = -arch=sm_35 +#CUDA_ARCH = -arch=sm_37 + +# Maxwell hardware +CUDA_ARCH = -arch=sm_50 +#CUDA_ARCH = -arch=sm_52 + +CUDA_CODE = -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] \ + -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61] \ + -gencode arch=compute_70,code=[sm_70,compute_70] -gencode arch=compute_75,code=[sm_75,compute_75] CUDA_ARCH += $(CUDA_CODE) diff --git a/lib/gpu/Makefile.serial b/lib/gpu/Makefile.serial index b0cfb3c86b..dfe732ee80 100644 --- a/lib/gpu/Makefile.serial +++ b/lib/gpu/Makefile.serial @@ -13,13 +13,33 @@ endif NVCC = nvcc -# Tesla CUDA -CUDA_ARCH = -arch=sm_21 -# newer CUDA +# obsolete hardware. not supported by current drivers anymore. #CUDA_ARCH = -arch=sm_13 -# older CUDA #CUDA_ARCH = -arch=sm_10 -DCUDA_PRE_THREE -CUDA_ARCH = -arch=sm_35 + +# Fermi hardware +#CUDA_ARCH = -arch=sm_20 +#CUDA_ARCH = -arch=sm_21 + +# Kepler hardware +#CUDA_ARCH = -arch=sm_30 +#CUDA_ARCH = -arch=sm_32 +#CUDA_ARCH = -arch=sm_35 +#CUDA_ARCH = -arch=sm_37 + +# Maxwell hardware +CUDA_ARCH = -arch=sm_50 +#CUDA_ARCH = -arch=sm_52 + +# Pascal hardware +#CUDA_ARCH = -arch=sm_60 +#CUDA_ARCH = -arch=sm_61 + +# Volta hardware +#CUDA_ARCH = -arch=sm_70 + +# Turing hardware +#CUDA_ARCH = -arch=sm_75 # this setting should match LAMMPS Makefile # one of LAMMPS_SMALLBIG (default), LAMMPS_BIGBIG and LAMMPS_SMALLSMALL @@ -35,7 +55,7 @@ CUDA_PRECISION = -D_SINGLE_DOUBLE CUDA_INCLUDE = -I$(CUDA_HOME)/include CUDA_LIB = -L$(CUDA_HOME)/lib64 -L$(CUDA_HOME)/lib64/stubs -L../../src/STUBS -lmpi_stubs -CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) +CUDA_OPTS = -DUNIX -O3 --use_fast_math $(LMP_INC) -Xcompiler -fPIC CUDR_CPP = g++ -DMPI_GERYON -DUCL_NO_EXIT -fPIC -I../../src/STUBS CUDR_OPTS = -O2 $(LMP_INC) # -xHost -no-prec-div -ansi-alias diff --git a/lib/plumed/Install.py b/lib/plumed/Install.py index b6b00d1511..33bb40c9d9 100644 --- a/lib/plumed/Install.py +++ b/lib/plumed/Install.py @@ -17,7 +17,7 @@ parser = ArgumentParser(prog='Install.py', # settings -version = "2.6.0" +version = "2.6.1" mode = "static" # help message @@ -48,6 +48,7 @@ checksums = { \ '2.5.3' : 'de30d6e7c2dcc0973298e24a6da24286', \ '2.5.4' : 'f31b7d16a4be2e30aa7d5c19c3d37853', \ '2.6.0' : '204d2edae58d9b10ba3ad460cad64191', \ + '2.6.1' : '89a9a450fc6025299fe16af235957163', \ } # parse and process arguments diff --git a/python/lammps.py b/python/lammps.py index 8bd1fc693b..b76608af7d 100644 --- a/python/lammps.py +++ b/python/lammps.py @@ -10,10 +10,9 @@ # # See the README file in the top-level LAMMPS directory. # ------------------------------------------------------------------------- +# Python wrappers for the LAMMPS library via ctypes -# Python wrappers on LAMMPS library via ctypes - -# for python3 compatibility +# for python2/3 compatibility from __future__ import print_function @@ -32,10 +31,32 @@ import select import re import sys +# various symbolic constants to be used +# in certain calls to select data formats LAMMPS_INT = 0 -LAMMPS_DOUBLE = 1 -LAMMPS_BIGINT = 2 -LAMMPS_TAGINT = 3 +LAMMPS_INT2D = 1 +LAMMPS_DOUBLE = 2 +LAMMPS_DOUBLE2D = 3 +LAMMPS_BIGINT = 4 +LAMMPS_TAGINT = 5 +LAMMPS_STRING = 6 + +# these must be kept in sync with the enums in library.h +LMP_STYLE_GLOBAL = 0 +LMP_STYLE_ATOM = 1 +LMP_STYLE_LOCAL = 2 + +LMP_TYPE_SCALAR = 0 +LMP_TYPE_VECTOR = 1 +LMP_TYPE_ARRAY = 2 +LMP_SIZE_VECTOR = 3 +LMP_SIZE_ROWS = 4 +LMP_SIZE_COLS = 5 + +LMP_VAR_EQUAL = 0 +LMP_VAR_ATOM = 1 + +# ------------------------------------------------------------------------- def get_ctypes_int(size): if size == 4: @@ -44,6 +65,8 @@ def get_ctypes_int(size): return c_int64 return c_int +# ------------------------------------------------------------------------- + class MPIAbortException(Exception): def __init__(self, message): self.message = message @@ -51,14 +74,16 @@ class MPIAbortException(Exception): def __str__(self): return repr(self.message) +# ------------------------------------------------------------------------- + class NeighList: - """This is a wrapper class that exposes the contents of a neighbor list + """This is a wrapper class that exposes the contents of a neighbor list. It can be used like a regular Python list. Internally it uses the lower-level LAMMPS C-library interface. - :param lmp: reference to instance of :class:`lammps` + :param lmp: reference to instance of :py:class:`lammps` :type lmp: lammps :param idx: neighbor list index :type idx: int @@ -102,32 +127,54 @@ class NeighList: for ii in range(inum): yield self.get(ii) +# ------------------------------------------------------------------------- +# ------------------------------------------------------------------------- + class lammps(object): + """Create an instance of the LAMMPS Python class. - # detect if Python is using version of mpi4py that can pass a communicator + .. _mpi4py_docs: https://mpi4py.readthedocs.io/ - has_mpi4py = False - try: - from mpi4py import MPI - from mpi4py import __version__ as mpi4py_version - if mpi4py_version.split('.')[0] in ['2','3']: has_mpi4py = True - except: - pass + This is a Python wrapper class that exposes the LAMMPS C-library + interface to Python. It either requires that LAMMPS has been compiled + as shared library which is then dynamically loaded via the ctypes + Python module or that this module called from a Python function that + is called from a Python interpreter embedded into a LAMMPS executable, + for example through the :doc:`python invoke ` command. + When the class is instantiated it calls the :cpp:func:`lammps_open` + function of the LAMMPS C-library interface, which in + turn will create an instance of the :cpp:class:`LAMMPS ` + C++ class. The handle to this C++ class is stored internally + and automatically passed to the calls to the C library interface. - # create instance of LAMMPS + :param name: "machine" name of the shared LAMMPS library ("mpi" loads ``liblammps_mpi.so``, "" loads ``liblammps.so``) + :type name: string + :param cmdargs: list of command line arguments to be passed to the :cpp:func:`lammps_open` function. The executable name is automatically added. + :type cmdargs: list + :param ptr: pointer to a LAMMPS C++ class instance when called from an embedded Python interpreter. None means load symbols from shared library. + :type ptr: pointer + :param comm: MPI communicator (as provided by `mpi4py `_). ``None`` means use ``MPI_COMM_WORLD`` implicitly. + :type comm: MPI_Comm + """ - def __init__(self,name="",cmdargs=None,ptr=None,comm=None): + # ------------------------------------------------------------------------- + # create an instance of LAMMPS + + def __init__(self,name='',cmdargs=None,ptr=None,comm=None): self.comm = comm self.opened = 0 - # determine module location + # determine module file location modpath = dirname(abspath(getsourcefile(lambda:0))) self.lib = None self.lmp = None - # if a pointer to a LAMMPS object is handed in, - # all symbols should already be available + # if a pointer to a LAMMPS object is handed in + # when being called from a Python interpreter + # embedded into a LAMMPS executable, all library + # symbols should already be available so we do not + # load a shared object. try: if ptr: self.lib = CDLL("",RTLD_GLOBAL) @@ -142,23 +189,57 @@ class lammps(object): # fall back to loading with a relative path, # typically requires LD_LIBRARY_PATH to be set appropriately - if any([f.startswith('liblammps') and f.endswith('.dylib') for f in os.listdir(modpath)]): + if any([f.startswith('liblammps') and f.endswith('.dylib') + for f in os.listdir(modpath)]): lib_ext = ".dylib" + elif any([f.startswith('liblammps') and f.endswith('.dll') + for f in os.listdir(modpath)]): + lib_ext = ".dll" else: lib_ext = ".so" if not self.lib: try: - if not name: self.lib = CDLL(join(modpath,"liblammps" + lib_ext),RTLD_GLOBAL) - else: self.lib = CDLL(join(modpath,"liblammps_%s" % name + lib_ext), - RTLD_GLOBAL) + if not name: + self.lib = CDLL(join(modpath,"liblammps" + lib_ext),RTLD_GLOBAL) + else: + self.lib = CDLL(join(modpath,"liblammps_%s" % name + lib_ext), + RTLD_GLOBAL) except: - if not name: self.lib = CDLL("liblammps" + lib_ext,RTLD_GLOBAL) - else: self.lib = CDLL("liblammps_%s" % name + lib_ext,RTLD_GLOBAL) + if not name: + self.lib = CDLL("liblammps" + lib_ext,RTLD_GLOBAL) + else: + self.lib = CDLL("liblammps_%s" % name + lib_ext,RTLD_GLOBAL) - # define ctypes API for each library method - # NOTE: should add one of these for each lib function + # declare all argument and return types for all library methods here. + # exceptions are where the arguments depend on certain conditions and + # then are defined where the functions are used. + self.lib.lammps_extract_setting.argtypes = [c_void_p, c_char_p] + self.lib.lammps_extract_setting.restype = c_int + + # set default types + # needed in later declarations + self.c_bigint = get_ctypes_int(self.extract_setting("bigint")) + self.c_tagint = get_ctypes_int(self.extract_setting("tagint")) + self.c_imageint = get_ctypes_int(self.extract_setting("imageint")) + + self.lib.lammps_open.restype = c_void_p + self.lib.lammps_open_no_mpi.restype = c_void_p + self.lib.lammps_close.argtypes = [c_void_p] + self.lib.lammps_free.argtypes = [c_void_p] + + self.lib.lammps_file.argtypes = [c_void_p, c_char_p] + self.lib.lammps_file.restype = None + + self.lib.lammps_command.argtypes = [c_void_p, c_char_p] + self.lib.lammps_command.restype = c_char_p + self.lib.lammps_commands_list.restype = None + self.lib.lammps_commands_string.argtypes = [c_void_p, c_char_p] + self.lib.lammps_commands_string.restype = None + + self.lib.lammps_get_natoms.argtypes = [c_void_p] + self.lib.lammps_get_natoms.restype = c_double self.lib.lammps_extract_box.argtypes = \ [c_void_p,POINTER(c_double),POINTER(c_double), POINTER(c_double),POINTER(c_double),POINTER(c_double), @@ -189,6 +270,27 @@ class lammps(object): [c_void_p,c_char_p,c_int,c_int,c_int,POINTER(c_int),c_void_p] self.lib.lammps_scatter_atoms_subset.restype = None + self.lib.lammps_gather.argtypes = \ + [c_void_p,c_char_p,c_int,c_int,c_void_p] + self.lib.lammps_gather.restype = None + + self.lib.lammps_gather_concat.argtypes = \ + [c_void_p,c_char_p,c_int,c_int,c_void_p] + self.lib.lammps_gather_concat.restype = None + + self.lib.lammps_gather_subset.argtypes = \ + [c_void_p,c_char_p,c_int,c_int,c_int,POINTER(c_int),c_void_p] + self.lib.lammps_gather_subset.restype = None + + self.lib.lammps_scatter.argtypes = \ + [c_void_p,c_char_p,c_int,c_int,c_void_p] + self.lib.lammps_scatter.restype = None + + self.lib.lammps_scatter_subset.argtypes = \ + [c_void_p,c_char_p,c_int,c_int,c_int,POINTER(c_int),c_void_p] + self.lib.lammps_scatter_subset.restype = None + + self.lib.lammps_find_pair_neighlist.argtypes = [c_void_p, c_char_p, c_int, c_int, c_int] self.lib.lammps_find_pair_neighlist.restype = c_int @@ -210,6 +312,48 @@ class lammps(object): self.lib.lammps_get_last_error_message.argtypes = [c_void_p, c_char_p, c_int] self.lib.lammps_get_last_error_message.restype = c_int + self.lib.lammps_extract_global.argtypes = [c_void_p, c_char_p] + self.lib.lammps_extract_compute.argtypes = [c_void_p, c_char_p, c_int, c_int] + + self.lib.lammps_get_thermo.argtypes = [c_void_p, c_char_p] + self.lib.lammps_get_thermo.restype = c_double + + self.lib.lammps_encode_image_flags.restype = self.c_imageint + + self.lib.lammps_config_package_name.argtypes = [c_int, c_char_p, c_int] + + self.lib.lammps_has_style.argtypes = [c_void_p, c_char_p, c_char_p] + + self.lib.lammps_set_variable.argtypes = [c_void_p, c_char_p, c_char_p] + + self.lib.lammps_style_count.argtypes = [c_void_p, c_char_p] + + self.lib.lammps_style_name.argtypes = [c_void_p, c_char_p, c_int, c_char_p, c_int] + + self.lib.lammps_version.argtypes = [c_void_p] + + self.lib.lammps_decode_image_flags.argtypes = [self.c_imageint, POINTER(c_int*3)] + + self.lib.lammps_extract_atom.argtypes = [c_void_p, c_char_p] + + self.lib.lammps_extract_fix.argtypes = [c_void_p, c_char_p, c_int, c_int, c_int, c_int] + + self.lib.lammps_extract_variable.argtypes = [c_void_p, c_char_p, c_char_p] + + # TODO: NOT IMPLEMENTED IN PYTHON WRAPPER + self.lib.lammps_fix_external_set_energy_global = [c_void_p, c_char_p, c_double] + self.lib.lammps_fix_external_set_virial_global = [c_void_p, c_char_p, POINTER(c_double)] + + # detect if Python is using version of mpi4py that can pass a communicator + + self.has_mpi4py = False + try: + from mpi4py import __version__ as mpi4py_version + # tested to work with mpi4py versions 2 and 3 + self.has_mpi4py = mpi4py_version.split('.')[0] in ['2','3'] + except: + pass + # if no ptr provided, create an instance of LAMMPS # don't know how to pass an MPI communicator from PyPar # but we can pass an MPI communicator from mpi4py v2.0.0 and later @@ -224,17 +368,22 @@ class lammps(object): # with mpi4py v2, can pass MPI communicator to LAMMPS # need to adjust for type of MPI communicator object # allow for int (like MPICH) or void* (like OpenMPI) + if self.has_mpi4py and self.has_mpi_support: + from mpi4py import MPI + self.MPI = MPI if comm: - if not lammps.has_mpi4py: + if not self.has_mpi4py: raise Exception('Python mpi4py version is not 2 or 3') - if lammps.MPI._sizeof(lammps.MPI.Comm) == sizeof(c_int): + if not self.has_mpi_support: + raise Exception('LAMMPS not compiled with real MPI library') + if self.MPI._sizeof(self.MPI.Comm) == sizeof(c_int): MPI_Comm = c_int else: MPI_Comm = c_void_p narg = 0 - cargs = 0 + cargs = None if cmdargs: cmdargs.insert(0,"lammps.py") narg = len(cmdargs) @@ -243,22 +392,19 @@ class lammps(object): cmdargs[i] = cmdargs[i].encode() cargs = (c_char_p*narg)(*cmdargs) self.lib.lammps_open.argtypes = [c_int, c_char_p*narg, \ - MPI_Comm, c_void_p()] + MPI_Comm, c_void_p] else: - self.lib.lammps_open.argtypes = [c_int, c_int, \ - MPI_Comm, c_void_p()] + self.lib.lammps_open.argtypes = [c_int, c_char_p, \ + MPI_Comm, c_void_p] - self.lib.lammps_open.restype = None self.opened = 1 - self.lmp = c_void_p() - comm_ptr = lammps.MPI._addressof(comm) + comm_ptr = self.MPI._addressof(comm) comm_val = MPI_Comm.from_address(comm_ptr) - self.lib.lammps_open(narg,cargs,comm_val,byref(self.lmp)) + self.lmp = c_void_p(self.lib.lammps_open(narg,cargs,comm_val,None)) else: - if lammps.has_mpi4py: - from mpi4py import MPI - self.comm = MPI.COMM_WORLD + if self.has_mpi4py and self.has_mpi_support: + self.comm = self.MPI.COMM_WORLD self.opened = 1 if cmdargs: cmdargs.insert(0,"lammps.py") @@ -267,13 +413,12 @@ class lammps(object): if type(cmdargs[i]) is str: cmdargs[i] = cmdargs[i].encode() cargs = (c_char_p*narg)(*cmdargs) - self.lmp = c_void_p() - self.lib.lammps_open_no_mpi(narg,cargs,byref(self.lmp)) + self.lib.lammps_open_no_mpi.argtypes = [c_int, c_char_p*narg, \ + c_void_p] + self.lmp = c_void_p(self.lib.lammps_open_no_mpi(narg,cargs,None)) else: - self.lmp = c_void_p() - self.lib.lammps_open_no_mpi(0,None,byref(self.lmp)) - # could use just this if LAMMPS lib interface supported it - # self.lmp = self.lib.lammps_open_no_mpi(0,None) + self.lib.lammps_open_no_mpi.argtypes = [c_int, c_char_p, c_void_p] + self.lmp = c_void_p(self.lib.lammps_open_no_mpi(0,None,None)) else: # magic to convert ptr to ctypes ptr @@ -291,10 +436,6 @@ class lammps(object): # optional numpy support (lazy loading) self._numpy = None - # set default types - self.c_bigint = get_ctypes_int(self.extract_setting("bigint")) - self.c_tagint = get_ctypes_int(self.extract_setting("tagint")) - self.c_imageint = get_ctypes_int(self.extract_setting("imageint")) self._installed_packages = None self._available_styles = None @@ -304,6 +445,7 @@ class lammps(object): self.lib.lammps_set_fix_external_callback.argtypes = [c_void_p, c_char_p, self.FIX_EXTERNAL_CALLBACK_FUNC, py_object] self.lib.lammps_set_fix_external_callback.restype = None + # ------------------------------------------------------------------------- # shut-down LAMMPS instance def __del__(self): @@ -311,114 +453,11 @@ class lammps(object): self.lib.lammps_close(self.lmp) self.opened = 0 - def close(self): - if self.opened: self.lib.lammps_close(self.lmp) - self.lmp = None - self.opened = 0 - - def version(self): - return self.lib.lammps_version(self.lmp) - - def file(self,file): - if file: file = file.encode() - self.lib.lammps_file(self.lmp,file) - - # send a single command - - def command(self,cmd): - if cmd: cmd = cmd.encode() - self.lib.lammps_command(self.lmp,cmd) - - if self.has_exceptions and self.lib.lammps_has_error(self.lmp): - sb = create_string_buffer(100) - error_type = self.lib.lammps_get_last_error_message(self.lmp, sb, 100) - error_msg = sb.value.decode().strip() - - if error_type == 2: - raise MPIAbortException(error_msg) - raise Exception(error_msg) - - # send a list of commands - - def commands_list(self,cmdlist): - cmds = [x.encode() for x in cmdlist if type(x) is str] - args = (c_char_p * len(cmdlist))(*cmds) - self.lib.lammps_commands_list(self.lmp,len(cmdlist),args) - - # send a string of commands - - def commands_string(self,multicmd): - if type(multicmd) is str: multicmd = multicmd.encode() - self.lib.lammps_commands_string(self.lmp,c_char_p(multicmd)) - - # extract lammps type byte sizes - - def extract_setting(self, name): - if name: name = name.encode() - self.lib.lammps_extract_setting.restype = c_int - return int(self.lib.lammps_extract_setting(self.lmp,name)) - - # extract global info - - def extract_global(self,name,type): - if name: name = name.encode() - if type == LAMMPS_INT: - self.lib.lammps_extract_global.restype = POINTER(c_int) - elif type == LAMMPS_DOUBLE: - self.lib.lammps_extract_global.restype = POINTER(c_double) - elif type == LAMMPS_BIGINT: - self.lib.lammps_extract_global.restype = POINTER(self.c_bigint) - elif type == LAMMPS_TAGINT: - self.lib.lammps_extract_global.restype = POINTER(self.c_tagint) - else: return None - ptr = self.lib.lammps_extract_global(self.lmp,name) - return ptr[0] - - # extract global info - - def extract_box(self): - boxlo = (3*c_double)() - boxhi = (3*c_double)() - xy = c_double() - yz = c_double() - xz = c_double() - periodicity = (3*c_int)() - box_change = c_int() - - self.lib.lammps_extract_box(self.lmp,boxlo,boxhi, - byref(xy),byref(yz),byref(xz), - periodicity,byref(box_change)) - - boxlo = boxlo[:3] - boxhi = boxhi[:3] - xy = xy.value - yz = yz.value - xz = xz.value - periodicity = periodicity[:3] - box_change = box_change.value - - return boxlo,boxhi,xy,yz,xz,periodicity,box_change - - # extract per-atom info - # NOTE: need to insure are converting to/from correct Python type - # e.g. for Python list or NumPy or ctypes - - def extract_atom(self,name,type): - if name: name = name.encode() - if type == 0: - self.lib.lammps_extract_atom.restype = POINTER(c_int) - elif type == 1: - self.lib.lammps_extract_atom.restype = POINTER(POINTER(c_int)) - elif type == 2: - self.lib.lammps_extract_atom.restype = POINTER(c_double) - elif type == 3: - self.lib.lammps_extract_atom.restype = POINTER(POINTER(c_double)) - else: return None - ptr = self.lib.lammps_extract_atom(self.lmp,name) - return ptr + # ------------------------------------------------------------------------- @property def numpy(self): + "Convert between ctypes arrays and numpy arrays" if not self._numpy: import numpy as np class LammpsNumpyWrapper: @@ -441,20 +480,67 @@ class lammps(object): c_int_type = c_int if dim == 1: - raw_ptr = self.lmp.extract_atom(name, 0) + raw_ptr = self.lmp.extract_atom(name, LAMMPS_INT) else: - raw_ptr = self.lmp.extract_atom(name, 1) + raw_ptr = self.lmp.extract_atom(name, LAMMPS_INT2D) return self.iarray(c_int_type, raw_ptr, nelem, dim) def extract_atom_darray(self, name, nelem, dim=1): if dim == 1: - raw_ptr = self.lmp.extract_atom(name, 2) + raw_ptr = self.lmp.extract_atom(name, LAMMPS_DOUBLE) else: - raw_ptr = self.lmp.extract_atom(name, 3) + raw_ptr = self.lmp.extract_atom(name, LAMMPS_DOUBLE2D) return self.darray(raw_ptr, nelem, dim) + def extract_compute(self, cid, style, datatype): + value = self.lmp.extract_compute(cid, style, datatype) + + if style in (LMP_STYLE_GLOBAL, LMP_STYLE_LOCAL): + if datatype == LMP_TYPE_VECTOR: + nrows = self.lmp.extract_compute(cid, style, LMP_SIZE_VECTOR) + return self.darray(value, nrows) + elif datatype == LMP_TYPE_ARRAY: + nrows = self.lmp.extract_compute(cid, style, LMP_SIZE_ROWS) + ncols = self.lmp.extract_compute(cid, style, LMP_SIZE_COLS) + return self.darray(value, nrows, ncols) + elif style == LMP_STYLE_ATOM: + if datatype == LMP_TYPE_VECTOR: + nlocal = self.lmp.extract_global("nlocal", LAMMPS_INT) + return self.darray(value, nlocal) + elif datatype == LMP_TYPE_ARRAY: + nlocal = self.lmp.extract_global("nlocal", LAMMPS_INT) + ncols = self.lmp.extract_compute(cid, style, LMP_SIZE_COLS) + return self.darray(value, nlocal, ncols) + return value + + def extract_fix(self, fid, style, datatype, nrow=0, ncol=0): + value = self.lmp.extract_fix(fid, style, datatype, nrow, ncol) + if style == LMP_STYLE_ATOM: + if datatype == LMP_TYPE_VECTOR: + nlocal = self.lmp.extract_global("nlocal", LAMMPS_INT) + return self.darray(value, nlocal) + elif datatype == LMP_TYPE_ARRAY: + nlocal = self.lmp.extract_global("nlocal", LAMMPS_INT) + ncols = self.lmp.extract_fix(fid, style, LMP_SIZE_COLS, 0, 0) + return self.darray(value, nlocal, ncols) + elif style == LMP_STYLE_LOCAL: + if datatype == LMP_TYPE_VECTOR: + nrows = self.lmp.extract_fix(fid, style, LMP_SIZE_ROWS, 0, 0) + return self.darray(value, nrows) + elif datatype == LMP_TYPE_ARRAY: + nrows = self.lmp.extract_fix(fid, style, LMP_SIZE_ROWS, 0, 0) + ncols = self.lmp.extract_fix(fid, style, LMP_SIZE_COLS, 0, 0) + return self.darray(value, nrows, ncols) + return value + + def extract_variable(self, name, group=None, datatype=LMP_VAR_EQUAL): + value = self.lmp.extract_variable(name, group, datatype) + if datatype == LMP_VAR_ATOM: + return np.ctypeslib.as_array(value) + return value + def iarray(self, c_int_type, raw_ptr, nelem, dim=1): np_int_type = self._ctype_to_numpy_int(c_int_type) @@ -480,74 +566,511 @@ class lammps(object): self._numpy = LammpsNumpyWrapper(self) return self._numpy - # extract compute info + # ------------------------------------------------------------------------- + + def close(self): + """Explicitly delete a LAMMPS instance through the C-library interface. + + This is a wrapper around the :cpp:func:`lammps_close` function of the C-library interface. + """ + if self.opened: self.lib.lammps_close(self.lmp) + self.lmp = None + self.opened = 0 + + # ------------------------------------------------------------------------- + + def finalize(self): + """Shut down the MPI communication through the library interface by calling :cpp:func:`lammps_finalize`. + """ + if self.opened: self.lib.lammps_close(self.lmp) + self.lmp = None + self.opened = 0 + self.lib.lammps_finalize() + + # ------------------------------------------------------------------------- + + def version(self): + """Return a numerical representation of the LAMMPS version in use. + + This is a wrapper around the :cpp:func:`lammps_close` function of the C-library interface. + + :return: version number + :rtype: int + """ + return self.lib.lammps_version(self.lmp) + + # ------------------------------------------------------------------------- + + def file(self, path): + """Read LAMMPS commands from a file. + + This is a wrapper around the :cpp:func:`lammps_file` function of the C-library interface. + It will open the file with the name/path `file` and process the LAMMPS commands line by line until + the end. The function will return when the end of the file is reached. + + :param path: Name of the file/path with LAMMPS commands + :type path: string + """ + if path: path = path.encode() + else: return + self.lib.lammps_file(self.lmp, path) + + # ------------------------------------------------------------------------- + + def command(self,cmd): + """Process a single LAMMPS input command from a string. + + This is a wrapper around the :cpp:func:`lammps_command` + function of the C-library interface. + + :param cmd: a single lammps command + :type cmd: string + """ + if cmd: cmd = cmd.encode() + else: return + self.lib.lammps_command(self.lmp,cmd) + + if self.has_exceptions and self.lib.lammps_has_error(self.lmp): + sb = create_string_buffer(100) + error_type = self.lib.lammps_get_last_error_message(self.lmp, sb, 100) + error_msg = sb.value.decode().strip() + + if error_type == 2: + raise MPIAbortException(error_msg) + raise Exception(error_msg) + + # ------------------------------------------------------------------------- + + def commands_list(self,cmdlist): + """Process multiple LAMMPS input commands from a list of strings. + + This is a wrapper around the + :cpp:func:`lammps_commands_list` function of + the C-library interface. + + :param cmdlist: a single lammps command + :type cmdlist: list of strings + """ + cmds = [x.encode() for x in cmdlist if type(x) is str] + narg = len(cmdlist) + args = (c_char_p * narg)(*cmds) + self.lib.lammps_commands_list.argtypes = [c_void_p, c_int, c_char_p * narg] + self.lib.lammps_commands_list(self.lmp,narg,args) + + # ------------------------------------------------------------------------- + + def commands_string(self,multicmd): + """Process a block of LAMMPS input commands from a string. + + This is a wrapper around the + :cpp:func:`lammps_commands_string` + function of the C-library interface. + + :param multicmd: text block of lammps commands + :type multicmd: string + """ + if type(multicmd) is str: multicmd = multicmd.encode() + self.lib.lammps_commands_string(self.lmp,c_char_p(multicmd)) + + # ------------------------------------------------------------------------- + + def get_natoms(self): + """Get the total number of atoms in the LAMMPS instance. + + Will be precise up to 53-bit signed integer due to the + underlying :cpp:func:`lammps_get_natoms` function returning a double. + + :return: number of atoms + :rtype: float + """ + return self.lib.lammps_get_natoms(self.lmp) + + # ------------------------------------------------------------------------- + + def extract_box(self): + """Extract simulation box parameters + + This is a wrapper around the :cpp:func:`lammps_extract_box` function + of the C-library interface. Unlike in the C function, the result is + returned as a list. + + :return: list of the extracted data: boxlo, boxhi, xy, yz, xz, periodicity, box_change + :rtype: [ 3*double, 3*double, double, double, 3*int, int] + """ + boxlo = (3*c_double)() + boxhi = (3*c_double)() + xy = c_double() + yz = c_double() + xz = c_double() + periodicity = (3*c_int)() + box_change = c_int() + + self.lib.lammps_extract_box(self.lmp,boxlo,boxhi, + byref(xy),byref(yz),byref(xz), + periodicity,byref(box_change)) + + boxlo = boxlo[:3] + boxhi = boxhi[:3] + xy = xy.value + yz = yz.value + xz = xz.value + periodicity = periodicity[:3] + box_change = box_change.value + + return boxlo,boxhi,xy,yz,xz,periodicity,box_change + + # ------------------------------------------------------------------------- + + def reset_box(self,boxlo,boxhi,xy,yz,xz): + """Reset simulation box parameters + + This is a wrapper around the :cpp:func:`lammps_reset_box` function + of the C-library interface. + + :param boxlo: new lower box boundaries + :type boxlo: list of 3 floating point numbers + :param boxhi: new upper box boundaries + :type boxhi: list of 3 floating point numbers + :param xy: xy tilt factor + :type xy: float + :param yz: yz tilt factor + :type yz: float + :param xz: xz tilt factor + :type xz: float + """ + cboxlo = (3*c_double)(*boxlo) + cboxhi = (3*c_double)(*boxhi) + self.lib.lammps_reset_box(self.lmp,cboxlo,cboxhi,xy,yz,xz) + + # ------------------------------------------------------------------------- + + def get_thermo(self,name): + """Get current value of a thermo keyword + + This is a wrapper around the :cpp:func:`lammps_get_thermo` + function of the C-library interface. + + :param name: name of thermo keyword + :type name: string + :return: value of thermo keyword + :rtype: double or None + """ + if name: name = name.encode() + else: return None + return self.lib.lammps_get_thermo(self.lmp,name) + + # ------------------------------------------------------------------------- + + def extract_setting(self, name): + """Query LAMMPS about global settings that can be expressed as an integer. + + This is a wrapper around the :cpp:func:`lammps_extract_setting` + function of the C-library interface. Its documentation includes + a list of the supported keywords. + + :param name: name of the setting + :type name: string + :return: value of the setting + :rtype: int + """ + if name: name = name.encode() + else: return None + return int(self.lib.lammps_extract_setting(self.lmp,name)) + + # ------------------------------------------------------------------------- + # extract global info + + def extract_global(self, name, type): + """Query LAMMPS about global settings of different types. + + This is a wrapper around the :cpp:func:`lammps_extract_global` + function of the C-library interface. Unlike the C function + this method returns the value and not a pointer and thus can + only return the first value for keywords representing a list + of values. The :cpp:func:`lammps_extract_global` documentation + includes a list of the supported keywords and their data types. + Since Python needs to know the data type to be able to interpret + the result, the type has to be provided as an argument. For + that purpose the :py:mod:`lammps` module contains the constants + ``LAMMPS_INT``, ``LAMMPS_DOUBLE``, ``LAMMPS_BIGINT``, + ``LAMMPS_TAGINT``, and ``LAMMPS_STRING``. + This function returns ``None`` if either the keyword is not + recognized, or an invalid data type constant is used. + + :param name: name of the setting + :type name: string + :param type: type of the returned data + :type type: int + :return: value of the setting + :rtype: integer or double or string or None + """ + if name: name = name.encode() + else: return None + if type == LAMMPS_INT: + self.lib.lammps_extract_global.restype = POINTER(c_int) + elif type == LAMMPS_DOUBLE: + self.lib.lammps_extract_global.restype = POINTER(c_double) + elif type == LAMMPS_BIGINT: + self.lib.lammps_extract_global.restype = POINTER(self.c_bigint) + elif type == LAMMPS_TAGINT: + self.lib.lammps_extract_global.restype = POINTER(self.c_tagint) + elif type == LAMMPS_STRING: + self.lib.lammps_extract_global.restype = c_char_p + ptr = self.lib.lammps_extract_global(self.lmp,name) + return str(ptr,'ascii') + else: return None + ptr = self.lib.lammps_extract_global(self.lmp,name) + if ptr: return ptr[0] + else: return None + + # ------------------------------------------------------------------------- + # extract per-atom info + # NOTE: need to insure are converting to/from correct Python type + # e.g. for Python list or NumPy or ctypes + + def extract_atom(self,name,type): + """Retrieve per-atom properties from LAMMPS + + This is a wrapper around the :cpp:func:`lammps_extract_atom` + function of the C-library interface. Its documentation includes a + list of the supported keywords and their data types. + Since Python needs to know the data type to be able to interpret + the result, the type has to be provided as an argument. For + that purpose the :py:mod:`lammps` module contains the constants + ``LAMMPS_INT``, ``LAMMPS_INT2D``, ``LAMMPS_DOUBLE``, + and ``LAMMPS_DOUBLE2D``. + This function returns ``None`` if either the keyword is not + recognized, or an invalid data type constant is used. + + .. note:: + + While the returned arrays of per-atom data are dimensioned + for the range [0:nmax] - as is the underlying storage - + the data is usually only valid for the range of [0:nlocal], + unless the property of interest is also updated for ghost + atoms. In some cases, this depends on a LAMMPS setting, see + for example :doc:`comm_modify vel yes `. + + :param name: name of the setting + :type name: string + :param type: type of the returned data + :type type: int + :return: requested data + :rtype: pointer to integer or double or None + """ + ntypes = int(self.extract_setting('ntypes')) + nmax = int(self.extract_setting('nmax')) + if name: name = name.encode() + else: return None + if type == LAMMPS_INT: + self.lib.lammps_extract_atom.restype = POINTER(c_int) + elif type == LAMMPS_INT2D: + self.lib.lammps_extract_atom.restype = POINTER(POINTER(c_int)) + elif type == LAMMPS_DOUBLE: + self.lib.lammps_extract_atom.restype = POINTER(c_double) + elif type == LAMMPS_DOUBLE2D: + self.lib.lammps_extract_atom.restype = POINTER(POINTER(c_double)) + else: return None + ptr = self.lib.lammps_extract_atom(self.lmp,name) + if ptr: return ptr + else: return None + + + # ------------------------------------------------------------------------- def extract_compute(self,id,style,type): + """Retrieve data from a LAMMPS compute + + This is a wrapper around the :cpp:func:`lammps_extract_compute` + function of the C-library interface. + This function returns ``None`` if either the compute id is not + recognized, or an invalid combination of :ref:`style ` + and :ref:`type ` constants is used. The + names and functionality of the constants are the same as for + the corresponding C-library function. For requests to return + a scalar or a size, the value is returned, otherwise a pointer. + + :param id: compute ID + :type id: string + :param style: style of the data retrieve (global, atom, or local) + :type style: int + :param type: type or size of the returned data (scalar, vector, or array) + :type type: int + :return: requested data + :rtype: integer or double or pointer to 1d or 2d double array or None + """ if id: id = id.encode() - if type == 0: - if style == 0: + else: return None + + if type == LMP_TYPE_SCALAR: + if style == LMP_STYLE_GLOBAL: self.lib.lammps_extract_compute.restype = POINTER(c_double) ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) return ptr[0] - elif style == 1: + elif style == LMP_STYLE_ATOM: return None - elif style == 2: + elif style == LMP_STYLE_LOCAL: self.lib.lammps_extract_compute.restype = POINTER(c_int) ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) return ptr[0] - if type == 1: + + if type == LMP_TYPE_VECTOR: self.lib.lammps_extract_compute.restype = POINTER(c_double) ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) return ptr - if type == 2: + + if type == LMP_TYPE_ARRAY: self.lib.lammps_extract_compute.restype = POINTER(POINTER(c_double)) ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) return ptr + + if type == LMP_SIZE_COLS: + if style == LMP_STYLE_GLOBAL \ + or style == LMP_STYLE_ATOM \ + or style == LMP_STYLE_LOCAL: + self.lib.lammps_extract_compute.restype = POINTER(c_int) + ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) + return ptr[0] + + if type == LMP_SIZE_VECTOR \ + or type == LMP_SIZE_ROWS: + if style == LMP_STYLE_GLOBAL \ + or style == LMP_STYLE_LOCAL: + self.lib.lammps_extract_compute.restype = POINTER(c_int) + ptr = self.lib.lammps_extract_compute(self.lmp,id,style,type) + return ptr[0] + return None + # ------------------------------------------------------------------------- # extract fix info - # in case of global datum, free memory for 1 double via lammps_free() + # in case of global data, free memory for 1 double via lammps_free() # double was allocated by library interface function - def extract_fix(self,id,style,type,i=0,j=0): + def extract_fix(self,id,style,type,nrow=0,ncol=0): + """Retrieve data from a LAMMPS fix + + This is a wrapper around the :cpp:func:`lammps_extract_fix` + function of the C-library interface. + This function returns ``None`` if either the fix id is not + recognized, or an invalid combination of :ref:`style ` + and :ref:`type ` constants is used. The + names and functionality of the constants are the same as for + the corresponding C-library function. For requests to return + a scalar or a size, the value is returned, also when accessing + global vectors or arrays, otherwise a pointer. + + :param id: fix ID + :type id: string + :param style: style of the data retrieve (global, atom, or local) + :type style: int + :param type: type or size of the returned data (scalar, vector, or array) + :type type: int + :param nrow: index of global vector element or row index of global array element + :type nrow: int + :param ncol: column index of global array element + :type ncol: int + :return: requested data + :rtype: integer or double value, pointer to 1d or 2d double array or None + + """ if id: id = id.encode() - if style == 0: - self.lib.lammps_extract_fix.restype = POINTER(c_double) - ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j) - result = ptr[0] - self.lib.lammps_free(ptr) - return result - elif (style == 2) and (type == 0): - self.lib.lammps_extract_fix.restype = POINTER(c_int) - ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j) - return ptr[0] - elif (style == 1) or (style == 2): - if type == 1: + else: return None + + if style == LMP_STYLE_GLOBAL: + if type == LMP_TYPE_SCALAR \ + or type == LMP_TYPE_VECTOR \ + or type == LMP_TYPE_ARRAY: self.lib.lammps_extract_fix.restype = POINTER(c_double) - elif type == 2: - self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double)) + ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,nrow,ncol) + result = ptr[0] + self.lib.lammps_free(ptr) + return result + elif type == LMP_SIZE_VECTOR \ + or type == LMP_SIZE_ROWS \ + or type == LMP_SIZE_COLS: + self.lib.lammps_extract_fix.restype = POINTER(c_int) + ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,nrow,ncol) + return ptr[0] else: return None - ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,i,j) - return ptr + + elif style == LMP_STYLE_ATOM: + if type == LMP_TYPE_VECTOR: + self.lib.lammps_extract_fix.restype = POINTER(c_double) + elif type == LMP_TYPE_ARRAY: + self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double)) + elif type == LMP_SIZE_COLS: + self.lib.lammps_extract_fix.restype = POINTER(c_int) + else: + return None + ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,nrow,ncol) + if type == LMP_SIZE_COLS: + return ptr[0] + else: + return ptr + + elif style == LMP_STYLE_LOCAL: + if type == LMP_TYPE_VECTOR: + self.lib.lammps_extract_fix.restype = POINTER(c_double) + elif type == LMP_TYPE_ARRAY: + self.lib.lammps_extract_fix.restype = POINTER(POINTER(c_double)) + elif type == LMP_TYPE_SCALAR \ + or type == LMP_SIZE_VECTOR \ + or type == LMP_SIZE_ROWS \ + or type == LMP_SIZE_COLS: + self.lib.lammps_extract_fix.restype = POINTER(c_int) + else: + return None + ptr = self.lib.lammps_extract_fix(self.lmp,id,style,type,nrow,ncol) + if type == LMP_TYPE_VECTOR or type == LMP_TYPE_ARRAY: + return ptr + else: + return ptr[0] else: return None + # ------------------------------------------------------------------------- # extract variable info # free memory for 1 double or 1 vector of doubles via lammps_free() # for vector, must copy nlocal returned values to local c_double vector # memory was allocated by library interface function - def extract_variable(self,name,group,type): + def extract_variable(self,name,group=None,type=LMP_VAR_EQUAL): + """ Evaluate a LAMMPS variable and return its data + + This function is a wrapper around the function + :cpp:func:`lammps_extract_variable` of the C-library interface, + evaluates variable name and returns a copy of the computed data. + The memory temporarily allocated by the C-interface is deleted + after the data is copied to a python variable or list. + The variable must be either an equal-style (or equivalent) + variable or an atom-style variable. The variable type has to + provided as type parameter which may be two constants: + ``LMP_VAR_EQUAL`` or ``LMP_VAR_STRING``; it defaults to + equal-style variables. + The group parameter is only used for atom-style variables and + defaults to the group "all" if set to ``None``, which is the default. + + :param name: name of the variable to execute + :type name: string + :param group: name of group for atom style variable + :type group: string + :param type: type of variable + :type type: int + :return: the requested data + :rtype: double, array of doubles, or None + """ if name: name = name.encode() + else: return None if group: group = group.encode() - if type == 0: + if type == LMP_VAR_EQUAL: self.lib.lammps_extract_variable.restype = POINTER(c_double) ptr = self.lib.lammps_extract_variable(self.lmp,name,group) result = ptr[0] self.lib.lammps_free(ptr) return result - if type == 1: + if type == LMP_VAR_ATOM: self.lib.lammps_extract_global.restype = POINTER(c_int) nlocalptr = self.lib.lammps_extract_global(self.lmp,"nlocal".encode()) nlocal = nlocalptr[0] @@ -559,33 +1082,28 @@ class lammps(object): return result return None - # return current value of thermo keyword - - def get_thermo(self,name): - if name: name = name.encode() - self.lib.lammps_get_thermo.restype = c_double - return self.lib.lammps_get_thermo(self.lmp,name) - - # return total number of atoms in system - - def get_natoms(self): - return self.lib.lammps_get_natoms(self.lmp) - - # set variable value - # value is converted to string - # returns 0 for success, -1 if failed + # ------------------------------------------------------------------------- def set_variable(self,name,value): + """Set a new value for a LAMMPS string style variable + + This is a wrapper around the :cpp:func:`lammps_set_variable` + function of the C-library interface. + + :param name: name of the variable + :type name: string + :param value: new variable value + :type value: any. will be converted to a string + :return: either 0 on success or -1 on failure + :rtype: int + """ if name: name = name.encode() + else: return -1 if value: value = str(value).encode() + else: return -1 return self.lib.lammps_set_variable(self.lmp,name,value) - # reset simulation box size - - def reset_box(self,boxlo,boxhi,xy,yz,xz): - cboxlo = (3*c_double)(*boxlo) - cboxhi = (3*c_double)(*boxhi) - self.lib.lammps_reset_box(self.lmp,cboxlo,cboxhi,xy,yz,xz) + # ------------------------------------------------------------------------- # return vector of atom properties gathered across procs # 3 variants to match src/library.cpp @@ -608,6 +1126,8 @@ class lammps(object): else: return None return data + # ------------------------------------------------------------------------- + def gather_atoms_concat(self,name,type,count): if name: name = name.encode() natoms = self.lib.lammps_get_natoms(self.lmp) @@ -631,6 +1151,8 @@ class lammps(object): else: return None return data + # ------------------------------------------------------------------------- + # scatter vector of atom properties across procs # 2 variants to match src/library.cpp # name = atom property recognized by LAMMPS in atom->extract() @@ -644,10 +1166,113 @@ class lammps(object): if name: name = name.encode() self.lib.lammps_scatter_atoms(self.lmp,name,type,count,data) + # ------------------------------------------------------------------------- + def scatter_atoms_subset(self,name,type,count,ndata,ids,data): if name: name = name.encode() self.lib.lammps_scatter_atoms_subset(self.lmp,name,type,count,ndata,ids,data) + # return vector of atom/compute/fix properties gathered across procs + # 3 variants to match src/library.cpp + # name = atom property recognized by LAMMPS in atom->extract() + # type = 0 for integer values, 1 for double values + # count = number of per-atom valus, 1 for type or charge, 3 for x or f + # returned data is a 1d vector - doc how it is ordered? + # NOTE: need to insure are converting to/from correct Python type + # e.g. for Python list or NumPy or ctypes + def gather(self,name,type,count): + if name: name = name.encode() + natoms = self.lib.lammps_get_natoms(self.lmp) + if type == 0: + data = ((count*natoms)*c_int)() + self.lib.lammps_gather(self.lmp,name,type,count,data) + elif type == 1: + data = ((count*natoms)*c_double)() + self.lib.lammps_gather(self.lmp,name,type,count,data) + else: return None + return data + + def gather_concat(self,name,type,count): + if name: name = name.encode() + natoms = self.lib.lammps_get_natoms(self.lmp) + if type == 0: + data = ((count*natoms)*c_int)() + self.lib.lammps_gather_concat(self.lmp,name,type,count,data) + elif type == 1: + data = ((count*natoms)*c_double)() + self.lib.lammps_gather_concat(self.lmp,name,type,count,data) + else: return None + return data + + def gather_subset(self,name,type,count,ndata,ids): + if name: name = name.encode() + if type == 0: + data = ((count*ndata)*c_int)() + self.lib.lammps_gather_subset(self.lmp,name,type,count,ndata,ids,data) + elif type == 1: + data = ((count*ndata)*c_double)() + self.lib.lammps_gather_subset(self.lmp,name,type,count,ndata,ids,data) + else: return None + return data + + # scatter vector of atom/compute/fix properties across procs + # 2 variants to match src/library.cpp + # name = atom property recognized by LAMMPS in atom->extract() + # type = 0 for integer values, 1 for double values + # count = number of per-atom valus, 1 for type or charge, 3 for x or f + # assume data is of correct type and length, as created by gather_atoms() + # NOTE: need to insure are converting to/from correct Python type + # e.g. for Python list or NumPy or ctypes + + def scatter(self,name,type,count,data): + if name: name = name.encode() + self.lib.lammps_scatter(self.lmp,name,type,count,data) + + def scatter_subset(self,name,type,count,ndata,ids,data): + if name: name = name.encode() + self.lib.lammps_scatter_subset(self.lmp,name,type,count,ndata,ids,data) + + # ------------------------------------------------------------------------- + + def encode_image_flags(self,ix,iy,iz): + """ convert 3 integers with image flags for x-, y-, and z-direction + into a single integer like it is used internally in LAMMPS + + This method is a wrapper around the :cpp:func:`lammps_encode_image_flags` + function of library interface. + + :param ix: x-direction image flag + :type ix: int + :param iy: y-direction image flag + :type iy: int + :param iz: z-direction image flag + :type iz: int + :return: encoded image flags + :rtype: lammps.c_imageint + """ + return self.lib.lammps_encode_image_flags(ix,iy,iz) + + # ------------------------------------------------------------------------- + + def decode_image_flags(self,image): + """ Convert encoded image flag integer into list of three regular integers. + + This method is a wrapper around the :cpp:func:`lammps_decode_image_flags` + function of library interface. + + :param image: encoded image flags + :type image: lammps.c_imageint + :return: list of three image flags in x-, y-, and z- direction + :rtype: list of 3 int + """ + + flags = (c_int*3)() + self.lib.lammps_decode_image_flags(image,byref(flags)) + + return [int(i) for i in flags] + + # ------------------------------------------------------------------------- + # create N atoms on all procs # N = global number of atoms # id = ID of each atom (optional, can be None) @@ -658,47 +1283,192 @@ class lammps(object): # e.g. for Python list or NumPy, etc # ditto for gather_atoms() above - def create_atoms(self,n,id,type,x,v,image=None,shrinkexceed=False): + def create_atoms(self,n,id,type,x,v=None,image=None,shrinkexceed=False): + """ + Create N atoms from list of coordinates and properties + + This function is a wrapper around the :cpp:func:`lammps_create_atoms` + function of the C-library interface, and the behavior is similar except + that the *v*, *image*, and *shrinkexceed* arguments are optional and + default to *None*, *None*, and *False*, respectively. With none being + equivalent to a ``NULL`` pointer in C. + + The lists of coordinates, types, atom IDs, velocities, image flags can + be provided in any format that may be converted into the required + internal data types. Also the list may contain more than *N* entries, + but not fewer. In the latter case, the function will return without + attempting to create atoms. You may use the :py:func:`encode_image_flags + ` method to properly combine three integers + with image flags into a single integer. + + :param n: number of atoms for which data is provided + :type n: int + :param id: list of atom IDs with at least n elements or None + :type id: list of lammps.tagint + :param type: list of atom types + :type type: list of int + :param x: list of coordinates for x-, y-, and z (flat list of 3n entries) + :type x: list of float + :param v: list of velocities for x-, y-, and z (flat list of 3n entries) or None (optional) + :type v: list of float + :param image: list of encoded image flags (optional) + :type image: list of lammps.imageint + :param shrinkexceed: whether to expand shrink-wrap boundaries if atoms are outside the box (optional) + :type shrinkexceed: bool + :return: number of atoms created. 0 if insufficient or invalid data + :rtype: int + """ if id: - id_lmp = (c_int * n)() - id_lmp[:] = id + id_lmp = (self.c_tagint*n)() + try: + id_lmp[:] = id[0:n] + except: + return 0 else: - id_lmp = id + id_lmp = None + + type_lmp = (c_int*n)() + try: + type_lmp[:] = type[0:n] + except: + return 0 + + three_n = 3*n + x_lmp = (c_double*three_n)() + try: + x_lmp[:] = x[0:three_n] + except: + return 0 + + if v: + v_lmp = (c_double*(three_n))() + try: + v_lmp[:] = v[0:three_n] + except: + return 0 + else: + v_lmp = None if image: - image_lmp = (c_int * n)() - image_lmp[:] = image + img_lmp = (self.c_imageint*n)() + try: + img_lmp[:] = image[0:n] + except: + return 0 else: - image_lmp = image + img_lmp = None - type_lmp = (c_int * n)() - type_lmp[:] = type - self.lib.lammps_create_atoms(self.lmp,n,id_lmp,type_lmp,x,v,image_lmp, - shrinkexceed) + if shrinkexceed: + se_lmp = 1 + else: + se_lmp = 0 + + self.lib.lammps_create_atoms.argtypes = [c_void_p, c_int, POINTER(self.c_tagint*n), + POINTER(c_int*n), POINTER(c_double*three_n), + POINTER(c_double*three_n), + POINTER(self.c_imageint*n), c_int] + return self.lib.lammps_create_atoms(self.lmp, n, id_lmp, type_lmp, x_lmp, v_lmp, img_lmp, se_lmp) + + # ------------------------------------------------------------------------- + + @property + def has_mpi_support(self): + """ Report whether the LAMMPS shared library was compiled with a + real MPI library or in serial. + + This is a wrapper around the :cpp:func:`lammps_config_has_mpi_support` + function of the library interface. + + :return: False when compiled with MPI STUBS, otherwise True + :rtype: bool + """ + return self.lib.lammps_config_has_mpi_support() != 0 + + # ------------------------------------------------------------------------- @property def has_exceptions(self): - """ Return whether the LAMMPS shared library was compiled with C++ exceptions handling enabled """ + """ Report whether the LAMMPS shared library was compiled with C++ + exceptions handling enabled + + This is a wrapper around the :cpp:func:`lammps_config_has_exceptions` + function of the library interface. + + :return: state of C++ exception support + :rtype: bool + """ return self.lib.lammps_config_has_exceptions() != 0 + # ------------------------------------------------------------------------- + @property def has_gzip_support(self): + """ Report whether the LAMMPS shared library was compiled with support + for reading and writing compressed files through ``gzip``. + + This is a wrapper around the :cpp:func:`lammps_config_has_gzip_support` + function of the library interface. + + :return: state of gzip support + :rtype: bool + """ return self.lib.lammps_config_has_gzip_support() != 0 + # ------------------------------------------------------------------------- + @property def has_png_support(self): + """ Report whether the LAMMPS shared library was compiled with support + for writing images in PNG format. + + This is a wrapper around the :cpp:func:`lammps_config_has_png_support` + function of the library interface. + + :return: state of PNG support + :rtype: bool + """ return self.lib.lammps_config_has_png_support() != 0 + # ------------------------------------------------------------------------- + @property def has_jpeg_support(self): + """ Report whether the LAMMPS shared library was compiled with support + for writing images in JPEG format. + + This is a wrapper around the :cpp:func:`lammps_config_has_jpeg_support` + function of the library interface. + + :return: state of JPEG support + :rtype: bool + """ return self.lib.lammps_config_has_jpeg_support() != 0 + # ------------------------------------------------------------------------- + @property def has_ffmpeg_support(self): + """ State of support for writing movies with ``ffmpeg`` in the LAMMPS shared library + + This is a wrapper around the :cpp:func:`lammps_config_has_ffmpeg_support` + function of the library interface. + + :return: state of ffmpeg support + :rtype: bool + """ return self.lib.lammps_config_has_ffmpeg_support() != 0 + # ------------------------------------------------------------------------- + @property def installed_packages(self): + """ List of the names of enabled packages in the LAMMPS shared library + + This is a wrapper around the functions :cpp:func:`lammps_config_package_count` + and :cpp:func`lammps_config_package_name` of the library interface. + + :return + """ if self._installed_packages is None: self._installed_packages = [] npackages = self.lib.lammps_config_package_count() @@ -708,23 +1478,35 @@ class lammps(object): self._installed_packages.append(sb.value.decode()) return self._installed_packages + # ------------------------------------------------------------------------- + def has_style(self, category, name): """Returns whether a given style name is available in a given category + This is a wrapper around the function :cpp:func:`lammps_has_style` + of the library interface. + :param category: name of category :type category: string :param name: name of the style :type name: string + :return: true if style is available in given category :rtype: bool """ return self.lib.lammps_has_style(self.lmp, category.encode(), name.encode()) != 0 + # ------------------------------------------------------------------------- + def available_styles(self, category): """Returns a list of styles available for a given category + This is a wrapper around the functions :cpp:func:`lammps_style_count` + and :cpp:func`lammps_style_name` of the library interface. + :param category: name of category :type category: string + :return: list of style names in given category :rtype: list """ @@ -740,8 +1522,11 @@ class lammps(object): self._available_styles[category].append(sb.value.decode()) return self._available_styles[category] + # ------------------------------------------------------------------------- + def set_fix_external_callback(self, fix_name, callback, caller=None): import numpy as np + def _ctype_to_numpy_int(ctype_int): if ctype_int == c_int32: return np.int32 @@ -759,9 +1544,10 @@ class lammps(object): cCaller = caller self.callback[fix_name] = { 'function': cFunc, 'caller': caller } - self.lib.lammps_set_fix_external_callback(self.lmp, fix_name.encode(), cFunc, cCaller) + # ------------------------------------------------------------------------- + def get_neighlist(self, idx): """Returns an instance of :class:`NeighList` which wraps access to the neighbor list with the given index @@ -774,6 +1560,8 @@ class lammps(object): return None return NeighList(self, idx) + # ------------------------------------------------------------------------- + def find_pair_neighlist(self, style, exact=True, nsub=0, request=0): """Find neighbor list index of pair style neighbor list @@ -802,6 +1590,8 @@ class lammps(object): idx = self.lib.lammps_find_pair_neighlist(self.lmp, style, exact, nsub, request) return self.get_neighlist(idx) + # ------------------------------------------------------------------------- + def find_fix_neighlist(self, fixid, request=0): """Find neighbor list index of fix neighbor list @@ -816,6 +1606,8 @@ class lammps(object): idx = self.lib.lammps_find_fix_neighlist(self.lmp, fixid, request) return self.get_neighlist(idx) + # ------------------------------------------------------------------------- + def find_compute_neighlist(self, computeid, request=0): """Find neighbor list index of compute neighbor list @@ -830,6 +1622,8 @@ class lammps(object): idx = self.lib.lammps_find_compute_neighlist(self.lmp, computeid, request) return self.get_neighlist(idx) + # ------------------------------------------------------------------------- + def get_neighlist_size(self, idx): """Return the number of elements in neighbor list with the given index @@ -840,6 +1634,8 @@ class lammps(object): """ return self.lib.lammps_neighlist_num_elements(self.lmp, idx) + # ------------------------------------------------------------------------- + def get_neighlist_element_neighbors(self, idx, element): """Return data of neighbor list entry @@ -900,6 +1696,7 @@ class OutputCapture(object): def output(self): return self.read_pipe(self.stdout_pipe_read) +# ------------------------------------------------------------------------- class Variable(object): def __init__(self, lammps_wrapper_instance, name, style, definition): @@ -919,6 +1716,7 @@ class Variable(object): except ValueError: return value +# ------------------------------------------------------------------------- class AtomList(object): def __init__(self, lammps_wrapper_instance): @@ -931,6 +1729,7 @@ class AtomList(object): return Atom2D(self.lmp, index + 1) return Atom(self.lmp, index + 1) +# ------------------------------------------------------------------------- class Atom(object): def __init__(self, lammps_wrapper_instance, index): @@ -987,6 +1786,7 @@ class Atom(object): def charge(self): return self.lmp.eval("q[%d]" % self.index) +# ------------------------------------------------------------------------- class Atom2D(Atom): def __init__(self, lammps_wrapper_instance, index): @@ -1017,6 +1817,7 @@ class Atom2D(Atom): return (self.lmp.eval("fx[%d]" % self.index), self.lmp.eval("fy[%d]" % self.index)) +# ------------------------------------------------------------------------- class variable_set: def __init__(self, name, variable_dict): @@ -1041,6 +1842,7 @@ class variable_set: def __repr__(self): return self.__str__() +# ------------------------------------------------------------------------- def get_thermo_data(output): """ traverse output of runs and extract thermo data columns """ @@ -1088,9 +1890,12 @@ def get_thermo_data(output): return runs +# ------------------------------------------------------------------------- +# ------------------------------------------------------------------------- + class PyLammps(object): """ - More Python-like wrapper for LAMMPS (e.g., for iPython) + More Python-like wrapper for LAMMPS (e.g., for IPython) See examples/ipython for usage """ @@ -1135,7 +1940,7 @@ class PyLammps(object): def run(self, *args, **kwargs): output = self.__getattr__('run')(*args, **kwargs) - if(lammps.has_mpi4py): + if(self.has_mpi4py): output = self.lmp.comm.bcast(output, root=0) self.runs += get_thermo_data(output) @@ -1350,7 +2155,7 @@ class PyLammps(object): class IPyLammps(PyLammps): """ - iPython wrapper for LAMMPS which adds embedded graphics capabilities + IPython wrapper for LAMMPS which adds embedded graphics capabilities """ def __init__(self,name="",cmdargs=None,ptr=None,comm=None): diff --git a/src/.gitignore b/src/.gitignore index 2fcbc5b80f..54b5edd8e3 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -32,6 +32,9 @@ /pair_kim.cpp /pair_kim.h +/superpose3d.h +/math_eigen.h + /kokkos.cpp /kokkos.h /kokkos_type.h @@ -49,6 +52,13 @@ /pair_meamc.cpp /pair_meamc.h +/compute_mliap.cpp +/compute_mliap.h +/mliap_*.cpp +/mliap_*.h +/pair_mliap.cpp +/pair_mliap.h + /ptm_*.cpp /ptm_*.h /compute_ptm.cpp @@ -60,6 +70,9 @@ /fix_*cauchy.cpp /fix_*cauchy.h +/fix_pafi*.cpp +/fix_pafi*.h + /compute_test_nbl.cpp /compute_test_nbl.h /pair_multi_lucy.cpp @@ -305,6 +318,8 @@ /bond_oxrna2_fene.h /bond_quartic.cpp /bond_quartic.h +/bond_special.cpp +/bond_special.h /bond_table.cpp /bond_table.h /cg_cmm_parms.cpp @@ -589,6 +604,8 @@ /fix_meso_move.h /fix_meso_stationary.cpp /fix_meso_stationary.h +/fix_momentum_chunk.cpp +/fix_momentum_chunk.h /fix_mscg.cpp /fix_mscg.h /fix_msst.cpp @@ -750,6 +767,8 @@ /fix_wall_piston.h /fix_wall_srd.cpp /fix_wall_srd.h +/fix_widom.cpp +/fix_widom.h /gpu_extra.h /gridcomm.cpp /gridcomm.h diff --git a/src/ASPHERE/compute_erotate_asphere.cpp b/src/ASPHERE/compute_erotate_asphere.cpp index 3cf23b87eb..945b91fbbd 100644 --- a/src/ASPHERE/compute_erotate_asphere.cpp +++ b/src/ASPHERE/compute_erotate_asphere.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_erotate_asphere.h" -#include + #include "math_extra.h" #include "atom.h" #include "atom_vec_ellipsoid.h" diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 4350678bbd..889563f617 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_asphere.h" -#include + #include #include "math_extra.h" #include "atom.h" diff --git a/src/ASPHERE/fix_nph_asphere.cpp b/src/ASPHERE/fix_nph_asphere.cpp index 0501ea1e8a..6d1727ce45 100644 --- a/src/ASPHERE/fix_nph_asphere.cpp +++ b/src/ASPHERE/fix_nph_asphere.cpp @@ -13,7 +13,7 @@ #include "fix_nph_asphere.h" #include -#include + #include "modify.h" #include "error.h" diff --git a/src/ASPHERE/fix_npt_asphere.cpp b/src/ASPHERE/fix_npt_asphere.cpp index f7f253f40b..064a20d55b 100644 --- a/src/ASPHERE/fix_npt_asphere.cpp +++ b/src/ASPHERE/fix_npt_asphere.cpp @@ -13,7 +13,7 @@ #include "fix_npt_asphere.h" #include -#include + #include "modify.h" #include "error.h" diff --git a/src/ASPHERE/fix_nvt_asphere.cpp b/src/ASPHERE/fix_nvt_asphere.cpp index e0275d4acf..d439d947bf 100644 --- a/src/ASPHERE/fix_nvt_asphere.cpp +++ b/src/ASPHERE/fix_nvt_asphere.cpp @@ -13,11 +13,11 @@ #include "fix_nvt_asphere.h" #include -#include + #include "group.h" #include "modify.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 51896aab85..89350dd00f 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_gayberne.h" -#include + #include #include "math_extra.h" #include "atom.h" @@ -28,7 +28,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -268,10 +268,10 @@ void PairGayBerne::settings(int narg, char **arg) { if (narg != 4) error->all(FLERR,"Illegal pair_style command"); - gamma = force->numeric(FLERR,arg[0]); - upsilon = force->numeric(FLERR,arg[1])/2.0; - mu = force->numeric(FLERR,arg[2]); - cut_global = force->numeric(FLERR,arg[3]); + gamma = utils::numeric(FLERR,arg[0],false,lmp); + upsilon = utils::numeric(FLERR,arg[1],false,lmp)/2.0; + mu = utils::numeric(FLERR,arg[2],false,lmp); + cut_global = utils::numeric(FLERR,arg[3],false,lmp); // reset cutoffs that have been explicitly set @@ -294,20 +294,20 @@ void PairGayBerne::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double eia_one = force->numeric(FLERR,arg[4]); - double eib_one = force->numeric(FLERR,arg[5]); - double eic_one = force->numeric(FLERR,arg[6]); - double eja_one = force->numeric(FLERR,arg[7]); - double ejb_one = force->numeric(FLERR,arg[8]); - double ejc_one = force->numeric(FLERR,arg[9]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double eia_one = utils::numeric(FLERR,arg[4],false,lmp); + double eib_one = utils::numeric(FLERR,arg[5],false,lmp); + double eic_one = utils::numeric(FLERR,arg[6],false,lmp); + double eja_one = utils::numeric(FLERR,arg[7],false,lmp); + double ejb_one = utils::numeric(FLERR,arg[8],false,lmp); + double ejc_one = utils::numeric(FLERR,arg[9],false,lmp); double cut_one = cut_global; - if (narg == 11) cut_one = force->numeric(FLERR,arg[10]); + if (narg == 11) cut_one = utils::numeric(FLERR,arg[10],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index fdeb09aac4..6397e77f5b 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -21,6 +21,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; #define DELTA 10000 @@ -344,7 +345,7 @@ void PairLineLJ::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -367,17 +368,17 @@ void PairLineLJ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double size_itype = force->numeric(FLERR,arg[2]); - double size_jtype = force->numeric(FLERR,arg[3]); - double epsilon_one = force->numeric(FLERR,arg[4]); - double sigma_one = force->numeric(FLERR,arg[5]); - double cutsub_one = force->numeric(FLERR,arg[6]); + double size_itype = utils::numeric(FLERR,arg[2],false,lmp); + double size_jtype = utils::numeric(FLERR,arg[3],false,lmp); + double epsilon_one = utils::numeric(FLERR,arg[4],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[5],false,lmp); + double cutsub_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_one = cut_global; - if (narg == 8) cut_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index dd4b11935e..81fb4d4b6c 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_resquared.h" -#include + #include #include "math_extra.h" #include "atom.h" @@ -27,7 +27,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -243,7 +243,7 @@ void PairRESquared::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -266,20 +266,20 @@ void PairRESquared::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double eia_one = force->numeric(FLERR,arg[4]); - double eib_one = force->numeric(FLERR,arg[5]); - double eic_one = force->numeric(FLERR,arg[6]); - double eja_one = force->numeric(FLERR,arg[7]); - double ejb_one = force->numeric(FLERR,arg[8]); - double ejc_one = force->numeric(FLERR,arg[9]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double eia_one = utils::numeric(FLERR,arg[4],false,lmp); + double eib_one = utils::numeric(FLERR,arg[5],false,lmp); + double eic_one = utils::numeric(FLERR,arg[6],false,lmp); + double eja_one = utils::numeric(FLERR,arg[7],false,lmp); + double ejb_one = utils::numeric(FLERR,arg[8],false,lmp); + double ejc_one = utils::numeric(FLERR,arg[9],false,lmp); double cut_one = cut_global; - if (narg == 11) cut_one = force->numeric(FLERR,arg[10]); + if (narg == 11) cut_one = utils::numeric(FLERR,arg[10],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index 0984b0a30c..cf89cf9d33 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -22,6 +22,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; #define DELTA 20 @@ -415,7 +416,7 @@ void PairTriLJ::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -438,14 +439,14 @@ void PairTriLJ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index 73a85386bd..e63d50f814 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -12,16 +12,15 @@ ------------------------------------------------------------------------- */ #include "body_nparticle.h" -#include -#include -#include "my_pool_chunk.h" -#include "math_extra.h" -#include "atom_vec_body.h" + #include "atom.h" -#include "force.h" -#include "memory.h" +#include "atom_vec_body.h" #include "error.h" -#include "fmt/format.h" +#include "math_extra.h" +#include "memory.h" +#include "my_pool_chunk.h" + +#include using namespace LAMMPS_NS; @@ -35,8 +34,8 @@ BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); - int nmin = force->inumeric(FLERR,arg[1]); - int nmax = force->inumeric(FLERR,arg[2]); + int nmin = utils::inumeric(FLERR,arg[1],false,lmp); + int nmax = utils::inumeric(FLERR,arg[2],false,lmp); if (nmin <= 0 || nmin > nmax) error->all(FLERR,"Invalid body nparticle command"); diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index d8ac81b2e6..c43484dca2 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -16,17 +16,17 @@ ------------------------------------------------------------------------- */ #include "body_rounded_polygon.h" -#include -#include -#include "my_pool_chunk.h" -#include "atom_vec_body.h" + #include "atom.h" -#include "force.h" +#include "atom_vec_body.h" #include "domain.h" +#include "error.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "fmt/format.h" +#include "my_pool_chunk.h" + +#include +#include using namespace LAMMPS_NS; @@ -46,8 +46,8 @@ BodyRoundedPolygon::BodyRoundedPolygon(LAMMPS *lmp, int narg, char **arg) : // nmin and nmax are minimum and maximum number of vertices - int nmin = force->inumeric(FLERR,arg[1]); - int nmax = force->inumeric(FLERR,arg[2]); + int nmin = utils::inumeric(FLERR,arg[1],false,lmp); + int nmax = utils::inumeric(FLERR,arg[2],false,lmp); if (nmin <= 0 || nmin > nmax) error->all(FLERR,"Invalid body rounded/polygon command"); diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index b6646cc116..18fd65c1dd 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "body_rounded_polyhedron.h" -#include -#include -#include -#include "my_pool_chunk.h" -#include "atom_vec_body.h" + #include "atom.h" -#include "force.h" +#include "atom_vec_body.h" +#include "error.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "fmt/format.h" +#include "my_pool_chunk.h" + +#include +#include using namespace LAMMPS_NS; @@ -44,8 +43,8 @@ BodyRoundedPolyhedron::BodyRoundedPolyhedron(LAMMPS *lmp, int narg, char **arg) // nmin and nmax are minimum and maximum number of vertices - int nmin = force->inumeric(FLERR,arg[1]); - int nmax = force->inumeric(FLERR,arg[2]); + int nmin = utils::inumeric(FLERR,arg[1],false,lmp); + int nmax = utils::inumeric(FLERR,arg[2],false,lmp); if (nmin <= 0 || nmin > nmax) error->all(FLERR,"Invalid body rounded/polyhedron command"); diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index c12502df42..cf570d71a3 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "compute_body_local.h" -#include -#include + #include "atom.h" #include "atom_vec_body.h" #include "body.h" -#include "update.h" -#include "force.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -47,7 +47,7 @@ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg],"type") == 0) which[nvalues++] = TYPE; else { which[nvalues] = INDEX; - index[nvalues] = force->inumeric(FLERR,arg[iarg]) - 1; + index[nvalues] = utils::inumeric(FLERR,arg[iarg],false,lmp) - 1; nvalues++; } } diff --git a/src/BODY/compute_temp_body.cpp b/src/BODY/compute_temp_body.cpp index 4cf9ac5009..18c301678a 100644 --- a/src/BODY/compute_temp_body.cpp +++ b/src/BODY/compute_temp_body.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_body.h" -#include + #include #include "math_extra.h" #include "atom.h" diff --git a/src/BODY/fix_nph_body.cpp b/src/BODY/fix_nph_body.cpp index 1e8cc88e7c..f198919ad8 100644 --- a/src/BODY/fix_nph_body.cpp +++ b/src/BODY/fix_nph_body.cpp @@ -17,11 +17,11 @@ #include "fix_nph_body.h" #include -#include + #include "group.h" #include "modify.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BODY/fix_npt_body.cpp b/src/BODY/fix_npt_body.cpp index 295777753f..23194bc8ca 100644 --- a/src/BODY/fix_npt_body.cpp +++ b/src/BODY/fix_npt_body.cpp @@ -17,11 +17,11 @@ #include "fix_npt_body.h" #include -#include + #include "group.h" #include "modify.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BODY/fix_nvt_body.cpp b/src/BODY/fix_nvt_body.cpp index 458ff1ab14..3cab4416b0 100644 --- a/src/BODY/fix_nvt_body.cpp +++ b/src/BODY/fix_nvt_body.cpp @@ -17,11 +17,11 @@ #include "fix_nvt_body.h" #include -#include + #include "group.h" #include "modify.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index e51476de60..ccfd37bbb2 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -62,11 +62,11 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : // wall/particle coefficients - kn = force->numeric(FLERR,arg[3]); + kn = utils::numeric(FLERR,arg[3],false,lmp); - c_n = force->numeric(FLERR,arg[4]); + c_n = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"NULL") == 0) c_t = 0.5 * c_n; - else c_t = force->numeric(FLERR,arg[5]); + else c_t = utils::numeric(FLERR,arg[5],false,lmp); if (kn < 0.0 || c_n < 0.0 || c_t < 0.0) error->all(FLERR,"Illegal fix wall/body/polygon command"); @@ -78,23 +78,23 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/body/polygon command"); wallstyle = XPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"yplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/body/polygon command"); wallstyle = YPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"zcylinder") == 0) { if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/body/polygon command"); wallstyle = ZCYLINDER; lo = hi = 0.0; - cylradius = force->numeric(FLERR,arg[iarg+1]); + cylradius = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } @@ -109,8 +109,8 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else error->all(FLERR,"Illegal fix wall/body/polygon command"); - amplitude = force->numeric(FLERR,arg[iarg+2]); - period = force->numeric(FLERR,arg[iarg+3]); + amplitude = utils::numeric(FLERR,arg[iarg+2],false,lmp); + period = utils::numeric(FLERR,arg[iarg+3],false,lmp); wiggle = 1; iarg += 4; } else error->all(FLERR,"Illegal fix wall/body/polygon command"); diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 42c62de436..161f8d6d6d 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -62,11 +62,11 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) // wall/particle coefficients - kn = force->numeric(FLERR,arg[3]); + kn = utils::numeric(FLERR,arg[3],false,lmp); - c_n = force->numeric(FLERR,arg[4]); + c_n = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"NULL") == 0) c_t = 0.5 * c_n; - else c_t = force->numeric(FLERR,arg[5]); + else c_t = utils::numeric(FLERR,arg[5],false,lmp); if (kn < 0.0 || c_n < 0.0 || c_t < 0.0) error->all(FLERR,"Illegal fix wall/body/polyhedron command"); @@ -78,25 +78,25 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/body/polyhedron command"); wallstyle = XPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"yplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/body/polyhedron command"); wallstyle = YPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"zplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/body/polyhedron command"); wallstyle = ZPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } @@ -111,8 +111,8 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else error->all(FLERR,"Illegal fix wall/body/polyhedron command"); - amplitude = force->numeric(FLERR,arg[iarg+2]); - period = force->numeric(FLERR,arg[iarg+3]); + amplitude = utils::numeric(FLERR,arg[iarg+2],false,lmp); + period = utils::numeric(FLERR,arg[iarg+3],false,lmp); wiggle = 1; iarg += 4; } else error->all(FLERR,"Illegal fix wall/body/polyhedron command"); diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index bd7aba5455..ece23d9522 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -24,6 +24,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; #define DELTA 10000 @@ -362,7 +363,7 @@ void PairBodyNparticle::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -385,14 +386,14 @@ void PairBodyNparticle::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index 22a6d82b44..fa5a8e57da 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -19,7 +19,7 @@ ------------------------------------------------------------------------- */ #include "pair_body_rounded_polygon.h" -#include + #include #include #include "math_extra.h" @@ -35,6 +35,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; #define DELTA 10000 @@ -365,11 +366,11 @@ void PairBodyRoundedPolygon::settings(int narg, char **arg) { if (narg < 5) error->all(FLERR,"Illegal pair_style command"); - c_n = force->numeric(FLERR,arg[0]); - c_t = force->numeric(FLERR,arg[1]); - mu = force->numeric(FLERR,arg[2]); - delta_ua = force->numeric(FLERR,arg[3]); - cut_inner = force->numeric(FLERR,arg[4]); + c_n = utils::numeric(FLERR,arg[0],false,lmp); + c_t = utils::numeric(FLERR,arg[1],false,lmp); + mu = utils::numeric(FLERR,arg[2],false,lmp); + delta_ua = utils::numeric(FLERR,arg[3],false,lmp); + cut_inner = utils::numeric(FLERR,arg[4],false,lmp); if (delta_ua < 0) delta_ua = 1; } @@ -385,11 +386,11 @@ void PairBodyRoundedPolygon::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double k_n_one = force->numeric(FLERR,arg[2]); - double k_na_one = force->numeric(FLERR,arg[3]); + double k_n_one = utils::numeric(FLERR,arg[2],false,lmp); + double k_na_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index ff7e7fc25e..d376ac759e 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -21,7 +21,7 @@ ------------------------------------------------------------------------- */ #include "pair_body_rounded_polyhedron.h" -#include + #include #include #include "atom.h" @@ -38,6 +38,7 @@ #include "math_extra.h" #include "math_const.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -343,11 +344,11 @@ void PairBodyRoundedPolyhedron::settings(int narg, char **arg) { if (narg < 5) error->all(FLERR,"Illegal pair_style command"); - c_n = force->numeric(FLERR,arg[0]); - c_t = force->numeric(FLERR,arg[1]); - mu = force->numeric(FLERR,arg[2]); - A_ua = force->numeric(FLERR,arg[3]); - cut_inner = force->numeric(FLERR,arg[4]); + c_n = utils::numeric(FLERR,arg[0],false,lmp); + c_t = utils::numeric(FLERR,arg[1],false,lmp); + mu = utils::numeric(FLERR,arg[2],false,lmp); + A_ua = utils::numeric(FLERR,arg[3],false,lmp); + cut_inner = utils::numeric(FLERR,arg[4],false,lmp); if (A_ua < 0) A_ua = 1; } @@ -363,11 +364,11 @@ void PairBodyRoundedPolyhedron::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double k_n_one = force->numeric(FLERR,arg[2]); - double k_na_one = force->numeric(FLERR,arg[3]); + double k_n_one = utils::numeric(FLERR,arg[2],false,lmp); + double k_na_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index fe567ead34..eea43480e1 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_class2.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -273,16 +273,16 @@ void AngleClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; if (strcmp(arg[1],"bb") == 0) { if (narg != 5) error->all(FLERR,"Incorrect args for angle coefficients"); - double bb_k_one = force->numeric(FLERR,arg[2]); - double bb_r1_one = force->numeric(FLERR,arg[3]); - double bb_r2_one = force->numeric(FLERR,arg[4]); + double bb_k_one = utils::numeric(FLERR,arg[2],false,lmp); + double bb_r1_one = utils::numeric(FLERR,arg[3],false,lmp); + double bb_r2_one = utils::numeric(FLERR,arg[4],false,lmp); for (int i = ilo; i <= ihi; i++) { bb_k[i] = bb_k_one; @@ -295,10 +295,10 @@ void AngleClass2::coeff(int narg, char **arg) } else if (strcmp(arg[1],"ba") == 0) { if (narg != 6) error->all(FLERR,"Incorrect args for angle coefficients"); - double ba_k1_one = force->numeric(FLERR,arg[2]); - double ba_k2_one = force->numeric(FLERR,arg[3]); - double ba_r1_one = force->numeric(FLERR,arg[4]); - double ba_r2_one = force->numeric(FLERR,arg[5]); + double ba_k1_one = utils::numeric(FLERR,arg[2],false,lmp); + double ba_k2_one = utils::numeric(FLERR,arg[3],false,lmp); + double ba_r1_one = utils::numeric(FLERR,arg[4],false,lmp); + double ba_r2_one = utils::numeric(FLERR,arg[5],false,lmp); for (int i = ilo; i <= ihi; i++) { ba_k1[i] = ba_k1_one; @@ -312,10 +312,10 @@ void AngleClass2::coeff(int narg, char **arg) } else { if (narg != 5) error->all(FLERR,"Incorrect args for angle coefficients"); - double theta0_one = force->numeric(FLERR,arg[1]); - double k2_one = force->numeric(FLERR,arg[2]); - double k3_one = force->numeric(FLERR,arg[3]); - double k4_one = force->numeric(FLERR,arg[4]); + double theta0_one = utils::numeric(FLERR,arg[1],false,lmp); + double k2_one = utils::numeric(FLERR,arg[2],false,lmp); + double k3_one = utils::numeric(FLERR,arg[3],false,lmp); + double k4_one = utils::numeric(FLERR,arg[4],false,lmp); // convert theta0 from degrees to radians diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index 7feec1a4b3..a97b06a3c7 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -17,7 +17,7 @@ #include #include "bond_class2.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -25,7 +25,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -134,12 +134,12 @@ void BondClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double r0_one = force->numeric(FLERR,arg[1]); - double k2_one = force->numeric(FLERR,arg[2]); - double k3_one = force->numeric(FLERR,arg[3]); - double k4_one = force->numeric(FLERR,arg[4]); + double r0_one = utils::numeric(FLERR,arg[1],false,lmp); + double k2_one = utils::numeric(FLERR,arg[2],false,lmp); + double k3_one = utils::numeric(FLERR,arg[3],false,lmp); + double k4_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 73b6a420e8..5be522f2c9 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_class2.h" -#include + #include #include #include "atom.h" @@ -27,8 +27,8 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace MathConst; @@ -639,17 +639,17 @@ void DihedralClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int count = 0; if (strcmp(arg[1],"mbt") == 0) { if (narg != 6) error->all(FLERR,"Incorrect args for dihedral coefficients"); - double f1_one = force->numeric(FLERR,arg[2]); - double f2_one = force->numeric(FLERR,arg[3]); - double f3_one = force->numeric(FLERR,arg[4]); - double r0_one = force->numeric(FLERR,arg[5]); + double f1_one = utils::numeric(FLERR,arg[2],false,lmp); + double f2_one = utils::numeric(FLERR,arg[3],false,lmp); + double f3_one = utils::numeric(FLERR,arg[4],false,lmp); + double r0_one = utils::numeric(FLERR,arg[5],false,lmp); for (int i = ilo; i <= ihi; i++) { mbt_f1[i] = f1_one; @@ -664,14 +664,14 @@ void DihedralClass2::coeff(int narg, char **arg) if (narg != 10) error->all(FLERR,"Incorrect args for dihedral coefficients"); - double f1_1_one = force->numeric(FLERR,arg[2]); - double f2_1_one = force->numeric(FLERR,arg[3]); - double f3_1_one = force->numeric(FLERR,arg[4]); - double f1_2_one = force->numeric(FLERR,arg[5]); - double f2_2_one = force->numeric(FLERR,arg[6]); - double f3_2_one = force->numeric(FLERR,arg[7]); - double r0_1_one = force->numeric(FLERR,arg[8]); - double r0_2_one = force->numeric(FLERR,arg[9]); + double f1_1_one = utils::numeric(FLERR,arg[2],false,lmp); + double f2_1_one = utils::numeric(FLERR,arg[3],false,lmp); + double f3_1_one = utils::numeric(FLERR,arg[4],false,lmp); + double f1_2_one = utils::numeric(FLERR,arg[5],false,lmp); + double f2_2_one = utils::numeric(FLERR,arg[6],false,lmp); + double f3_2_one = utils::numeric(FLERR,arg[7],false,lmp); + double r0_1_one = utils::numeric(FLERR,arg[8],false,lmp); + double r0_2_one = utils::numeric(FLERR,arg[9],false,lmp); for (int i = ilo; i <= ihi; i++) { ebt_f1_1[i] = f1_1_one; @@ -690,14 +690,14 @@ void DihedralClass2::coeff(int narg, char **arg) if (narg != 10) error->all(FLERR,"Incorrect args for dihedral coefficients"); - double f1_1_one = force->numeric(FLERR,arg[2]); - double f2_1_one = force->numeric(FLERR,arg[3]); - double f3_1_one = force->numeric(FLERR,arg[4]); - double f1_2_one = force->numeric(FLERR,arg[5]); - double f2_2_one = force->numeric(FLERR,arg[6]); - double f3_2_one = force->numeric(FLERR,arg[7]); - double theta0_1_one = force->numeric(FLERR,arg[8]); - double theta0_2_one = force->numeric(FLERR,arg[9]); + double f1_1_one = utils::numeric(FLERR,arg[2],false,lmp); + double f2_1_one = utils::numeric(FLERR,arg[3],false,lmp); + double f3_1_one = utils::numeric(FLERR,arg[4],false,lmp); + double f1_2_one = utils::numeric(FLERR,arg[5],false,lmp); + double f2_2_one = utils::numeric(FLERR,arg[6],false,lmp); + double f3_2_one = utils::numeric(FLERR,arg[7],false,lmp); + double theta0_1_one = utils::numeric(FLERR,arg[8],false,lmp); + double theta0_2_one = utils::numeric(FLERR,arg[9],false,lmp); // convert theta0's from degrees to radians @@ -717,9 +717,9 @@ void DihedralClass2::coeff(int narg, char **arg) } else if (strcmp(arg[1],"aat") == 0) { if (narg != 5) error->all(FLERR,"Incorrect args for dihedral coefficients"); - double k_one = force->numeric(FLERR,arg[2]); - double theta0_1_one = force->numeric(FLERR,arg[3]); - double theta0_2_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[2],false,lmp); + double theta0_1_one = utils::numeric(FLERR,arg[3],false,lmp); + double theta0_2_one = utils::numeric(FLERR,arg[4],false,lmp); // convert theta0's from degrees to radians @@ -734,9 +734,9 @@ void DihedralClass2::coeff(int narg, char **arg) } else if (strcmp(arg[1],"bb13") == 0) { if (narg != 5) error->all(FLERR,"Incorrect args for dihedral coefficients"); - double k_one = force->numeric(FLERR,arg[2]); - double r10_one = force->numeric(FLERR,arg[3]); - double r30_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[2],false,lmp); + double r10_one = utils::numeric(FLERR,arg[3],false,lmp); + double r30_one = utils::numeric(FLERR,arg[4],false,lmp); for (int i = ilo; i <= ihi; i++) { bb13t_k[i] = k_one; @@ -749,12 +749,12 @@ void DihedralClass2::coeff(int narg, char **arg) } else { if (narg != 7) error->all(FLERR,"Incorrect args for dihedral coefficients"); - double k1_one = force->numeric(FLERR,arg[1]); - double phi1_one = force->numeric(FLERR,arg[2]); - double k2_one = force->numeric(FLERR,arg[3]); - double phi2_one = force->numeric(FLERR,arg[4]); - double k3_one = force->numeric(FLERR,arg[5]); - double phi3_one = force->numeric(FLERR,arg[6]); + double k1_one = utils::numeric(FLERR,arg[1],false,lmp); + double phi1_one = utils::numeric(FLERR,arg[2],false,lmp); + double k2_one = utils::numeric(FLERR,arg[3],false,lmp); + double phi2_one = utils::numeric(FLERR,arg[4],false,lmp); + double k3_one = utils::numeric(FLERR,arg[5],false,lmp); + double phi3_one = utils::numeric(FLERR,arg[6],false,lmp); // convert phi's from degrees to radians diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 2d5918fdef..0b07a7d60c 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "improper_class2.h" -#include + #include #include #include "atom.h" @@ -27,8 +27,8 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace MathConst; @@ -523,19 +523,19 @@ void ImproperClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); int count = 0; if (strcmp(arg[1],"aa") == 0) { if (narg != 8) error->all(FLERR,"Incorrect args for improper coefficients"); - double k1_one = force->numeric(FLERR,arg[2]); - double k2_one = force->numeric(FLERR,arg[3]); - double k3_one = force->numeric(FLERR,arg[4]); - double theta0_1_one = force->numeric(FLERR,arg[5]); - double theta0_2_one = force->numeric(FLERR,arg[6]); - double theta0_3_one = force->numeric(FLERR,arg[7]); + double k1_one = utils::numeric(FLERR,arg[2],false,lmp); + double k2_one = utils::numeric(FLERR,arg[3],false,lmp); + double k3_one = utils::numeric(FLERR,arg[4],false,lmp); + double theta0_1_one = utils::numeric(FLERR,arg[5],false,lmp); + double theta0_2_one = utils::numeric(FLERR,arg[6],false,lmp); + double theta0_3_one = utils::numeric(FLERR,arg[7],false,lmp); // convert theta0's from degrees to radians @@ -553,8 +553,8 @@ void ImproperClass2::coeff(int narg, char **arg) } else { if (narg != 3) error->all(FLERR,"Incorrect args for improper coefficients"); - double k0_one = force->numeric(FLERR,arg[1]); - double chi0_one = force->numeric(FLERR,arg[2]); + double k0_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi0_one = utils::numeric(FLERR,arg[2],false,lmp); // convert chi0 from degrees to radians diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index 47b3185bbf..bb1dfe0ab3 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -10,7 +10,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2.h" -#include + #include #include #include "atom.h" @@ -24,7 +24,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -435,7 +435,7 @@ void PairLJClass2::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -457,14 +457,14 @@ void PairLJClass2::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 3635c21c8c..8375043ed8 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_coul_cut.h" -#include + #include #include #include "atom.h" @@ -23,7 +23,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -194,9 +194,9 @@ void PairLJClass2CoulCut::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[1]); + else cut_coul_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -223,16 +223,16 @@ void PairLJClass2CoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 5) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[4]); - if (narg == 6) cut_coul_one = force->numeric(FLERR,arg[5]); + if (narg >= 5) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); + if (narg == 6) cut_coul_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 0bb802579c..3b9ef8deaf 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_coul_long.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -607,9 +607,9 @@ void PairLJClass2CoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -633,14 +633,14 @@ void PairLJClass2CoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/COLLOID/fix_wall_colloid.cpp b/src/COLLOID/fix_wall_colloid.cpp index 58593a99b1..ef5bfb72e1 100644 --- a/src/COLLOID/fix_wall_colloid.cpp +++ b/src/COLLOID/fix_wall_colloid.cpp @@ -16,10 +16,9 @@ ------------------------------------------------------------------------- */ #include "fix_wall_colloid.h" -#include + #include #include "atom.h" -#include "atom_vec.h" #include "error.h" using namespace LAMMPS_NS; diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index d73789d890..786be66c70 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_brownian.h" -#include + #include #include #include "atom.h" @@ -36,7 +36,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -370,18 +370,18 @@ void PairBrownian::settings(int narg, char **arg) { if (narg != 7 && narg != 9) error->all(FLERR,"Illegal pair_style command"); - mu = force->numeric(FLERR,arg[0]); - flaglog = force->inumeric(FLERR,arg[1]); - flagfld = force->inumeric(FLERR,arg[2]); - cut_inner_global = force->numeric(FLERR,arg[3]); - cut_global = force->numeric(FLERR,arg[4]); - t_target = force->numeric(FLERR,arg[5]); - seed = force->inumeric(FLERR,arg[6]); + mu = utils::numeric(FLERR,arg[0],false,lmp); + flaglog = utils::inumeric(FLERR,arg[1],false,lmp); + flagfld = utils::inumeric(FLERR,arg[2],false,lmp); + cut_inner_global = utils::numeric(FLERR,arg[3],false,lmp); + cut_global = utils::numeric(FLERR,arg[4],false,lmp); + t_target = utils::numeric(FLERR,arg[5],false,lmp); + seed = utils::inumeric(FLERR,arg[6],false,lmp); flagHI = flagVF = 1; if (narg == 9) { - flagHI = force->inumeric(FLERR,arg[7]); - flagVF = force->inumeric(FLERR,arg[8]); + flagHI = utils::inumeric(FLERR,arg[7],false,lmp); + flagVF = utils::inumeric(FLERR,arg[8],false,lmp); } if (flaglog == 1 && flagHI == 0) { @@ -419,15 +419,15 @@ void PairBrownian::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 4) { - cut_inner_one = force->numeric(FLERR,arg[2]); - cut_one = force->numeric(FLERR,arg[3]); + cut_inner_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_one = utils::numeric(FLERR,arg[3],false,lmp); } int count = 0; diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index c3eb4f28a5..9c2593ffb1 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_brownian_poly.h" -#include + #include #include #include "atom.h" diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index d1c6e4594f..f95645c613 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_colloid.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathSpecial; @@ -246,7 +246,7 @@ void PairColloid::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -269,16 +269,16 @@ void PairColloid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a12_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double d1_one = force->numeric(FLERR,arg[4]); - double d2_one = force->numeric(FLERR,arg[5]); + double a12_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double d1_one = utils::numeric(FLERR,arg[4],false,lmp); + double d2_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_one = cut_global; - if (narg == 7) cut_one = force->numeric(FLERR,arg[6]); + if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); if (d1_one < 0.0 || d2_one < 0.0) error->all(FLERR,"Invalid d1 or d2 value for pair colloid coeff"); diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index a72eaef679..867bb91979 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lubricate.h" -#include + #include #include #include "atom.h" @@ -35,7 +35,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -459,16 +459,16 @@ void PairLubricate::settings(int narg, char **arg) { if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command"); - mu = force->numeric(FLERR,arg[0]); - flaglog = force->inumeric(FLERR,arg[1]); - flagfld = force->inumeric(FLERR,arg[2]); - cut_inner_global = force->numeric(FLERR,arg[3]); - cut_global = force->numeric(FLERR,arg[4]); + mu = utils::numeric(FLERR,arg[0],false,lmp); + flaglog = utils::inumeric(FLERR,arg[1],false,lmp); + flagfld = utils::inumeric(FLERR,arg[2],false,lmp); + cut_inner_global = utils::numeric(FLERR,arg[3],false,lmp); + cut_global = utils::numeric(FLERR,arg[4],false,lmp); flagHI = flagVF = 1; if (narg == 7) { - flagHI = force->inumeric(FLERR,arg[5]); - flagVF = force->inumeric(FLERR,arg[6]); + flagHI = utils::inumeric(FLERR,arg[5],false,lmp); + flagVF = utils::inumeric(FLERR,arg[6],false,lmp); } if (flaglog == 1 && flagHI == 0) { @@ -501,14 +501,14 @@ void PairLubricate::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 4) { - cut_inner_one = force->numeric(FLERR,arg[2]); - cut_one = force->numeric(FLERR,arg[3]); + cut_inner_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_one = utils::numeric(FLERR,arg[3],false,lmp); } int count = 0; diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index b0e21256ac..2df1ecaaa6 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lubricateU.h" -#include + #include #include #include "atom.h" @@ -34,7 +34,7 @@ #include "variable.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -1679,16 +1679,16 @@ void PairLubricateU::settings(int narg, char **arg) { if (narg != 5 && narg != 7) error->all(FLERR,"Illegal pair_style command"); - mu = force->numeric(FLERR,arg[0]); - flaglog = force->inumeric(FLERR,arg[1]); - cut_inner_global = force->numeric(FLERR,arg[2]); - cut_global = force->numeric(FLERR,arg[3]); - gdot = force->numeric(FLERR,arg[4]); + mu = utils::numeric(FLERR,arg[0],false,lmp); + flaglog = utils::inumeric(FLERR,arg[1],false,lmp); + cut_inner_global = utils::numeric(FLERR,arg[2],false,lmp); + cut_global = utils::numeric(FLERR,arg[3],false,lmp); + gdot = utils::numeric(FLERR,arg[4],false,lmp); flagHI = flagVF = 1; if (narg == 7) { - flagHI = force->inumeric(FLERR,arg[5]); - flagVF = force->inumeric(FLERR,arg[6]); + flagHI = utils::inumeric(FLERR,arg[5],false,lmp); + flagVF = utils::inumeric(FLERR,arg[6],false,lmp); } if (flaglog == 1 && flagHI == 0) { @@ -1734,14 +1734,14 @@ void PairLubricateU::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 4) { - cut_inner_one = force->numeric(FLERR,arg[2]); - cut_one = force->numeric(FLERR,arg[3]); + cut_inner_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_one = utils::numeric(FLERR,arg[3],false,lmp); } int count = 0; diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 6b6727172d..8483bb0f51 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_lubricateU_poly.h" -#include + #include #include #include "atom.h" @@ -1077,15 +1077,15 @@ void PairLubricateUPoly::settings(int narg, char **arg) { if (narg < 5 || narg > 7) error->all(FLERR,"Illegal pair_style command"); - mu = force->numeric(FLERR,arg[0]); - flaglog = force->inumeric(FLERR,arg[1]); - cut_inner_global = force->numeric(FLERR,arg[2]); - cut_global = force->numeric(FLERR,arg[3]); - gdot = force->numeric(FLERR,arg[4]); + mu = utils::numeric(FLERR,arg[0],false,lmp); + flaglog = utils::inumeric(FLERR,arg[1],false,lmp); + cut_inner_global = utils::numeric(FLERR,arg[2],false,lmp); + cut_global = utils::numeric(FLERR,arg[3],false,lmp); + gdot = utils::numeric(FLERR,arg[4],false,lmp); flagHI = flagVF = 1; - if (narg >= 6) flagHI = force->inumeric(FLERR,arg[5]); - if (narg == 7) flagVF = force->inumeric(FLERR,arg[6]); + if (narg >= 6) flagHI = utils::inumeric(FLERR,arg[5],false,lmp); + if (narg == 7) flagVF = utils::inumeric(FLERR,arg[6],false,lmp); if (flaglog == 1 && flagHI == 0) { error->warning(FLERR,"Cannot include log terms without 1/r terms; " diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index e347441cf4..351757e09b 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_lubricate_poly.h" -#include + #include #include #include "atom.h" diff --git a/src/COMPRESS/README b/src/COMPRESS/README index 1a31445d0b..617757c476 100644 --- a/src/COMPRESS/README +++ b/src/COMPRESS/README @@ -10,5 +10,9 @@ alternative for compressed file I/O on systems where using a pipe can cause problems, e.g. when using RDMA communication with pinned memory like clusters with Infiniband or Myrinet. +Update 08/2020: Added variants that use the Zstd compression library instead +of zlib. To enable, set -DLAMMPS_ZSTD. These provide a wider range of +compression levels. See http://facebook.github.io/zstd/ for more details. + Currently a few selected dump styles are supported for writing via this packaging. diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 9be8d17b06..484175762e 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -16,8 +16,10 @@ #include "error.h" #include "update.h" + #include + using namespace LAMMPS_NS; DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : @@ -25,6 +27,8 @@ DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : { gzFp = NULL; + compression_level = Z_BEST_COMPRESSION; + if (!compressed) error->all(FLERR,"Dump atom/gz only writes compressed files"); } @@ -89,12 +93,15 @@ void DumpAtomGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { + std::string mode; if (append_flag) { - gzFp = gzopen(filecurrent,"ab9"); + mode = fmt::format("ab{}", compression_level); } else { - gzFp = gzopen(filecurrent,"wb9"); + mode = fmt::format("wb{}", compression_level); } + gzFp = gzopen(filecurrent, mode.c_str()); + if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); } else gzFp = NULL; @@ -120,14 +127,14 @@ void DumpAtomGZ::write_header(bigint ndump) gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); if (domain->triclinic == 0) { gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); - gzprintf(gzFp,"%g %g\n",boxxlo,boxxhi); - gzprintf(gzFp,"%g %g\n",boxylo,boxyhi); - gzprintf(gzFp,"%g %g\n",boxzlo,boxzhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxylo,boxyhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); } else { gzprintf(gzFp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - gzprintf(gzFp,"%g %g %g\n",boxxlo,boxxhi,boxxy); - gzprintf(gzFp,"%g %g %g\n",boxylo,boxyhi,boxxz); - gzprintf(gzFp,"%g %g %g\n",boxzlo,boxzhi,boxyz); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); } gzprintf(gzFp,"ITEM: ATOMS %s\n",columns); } @@ -156,3 +163,21 @@ void DumpAtomGZ::write() } } +/* ---------------------------------------------------------------------- */ + +int DumpAtomGZ::modify_param(int narg, char **arg) +{ + int consumed = DumpAtom::modify_param(narg, arg); + if(consumed == 0) { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int min_level = Z_DEFAULT_COMPRESSION; + int max_level = Z_BEST_COMPRESSION; + compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + if (compression_level < min_level || compression_level > max_level) + error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); + return 2; + } + } + return consumed; +} diff --git a/src/COMPRESS/dump_atom_gz.h b/src/COMPRESS/dump_atom_gz.h index bd0ed792f8..0c0b95974f 100644 --- a/src/COMPRESS/dump_atom_gz.h +++ b/src/COMPRESS/dump_atom_gz.h @@ -31,12 +31,15 @@ class DumpAtomGZ : public DumpAtom { virtual ~DumpAtomGZ(); protected: + int compression_level; gzFile gzFp; // file pointer for the compressed output stream virtual void openfile(); virtual void write_header(bigint); virtual void write_data(int, double *); virtual void write(); + + virtual int modify_param(int, char **); }; } diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp new file mode 100644 index 0000000000..8fb08db3c8 --- /dev/null +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -0,0 +1,195 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#include "domain.h" +#include "dump_atom_zstd.h" +#include "error.h" +#include "file_writer.h" +#include "update.h" + +#include + + +using namespace LAMMPS_NS; + +DumpAtomZstd::DumpAtomZstd(LAMMPS *lmp, int narg, char **arg) : + DumpAtom(lmp, narg, arg) +{ + if (!compressed) + error->all(FLERR,"Dump atom/zstd only writes compressed files"); +} + +/* ---------------------------------------------------------------------- */ + +DumpAtomZstd::~DumpAtomZstd() +{ +} + +/* ---------------------------------------------------------------------- + generic opening of a dump file + ASCII or binary or zstdipped + some derived classes override this function +------------------------------------------------------------------------- */ + +void DumpAtomZstd::openfile() +{ + // single file, already opened, so just return + + if (singlefile_opened) return; + if (multifile == 0) singlefile_opened = 1; + + // if one file per timestep, replace '*' with current timestep + + char *filecurrent = filename; + if (multiproc) filecurrent = multiname; + + if (multifile) { + char *filestar = filecurrent; + filecurrent = new char[strlen(filestar) + 16]; + char *ptr = strchr(filestar,'*'); + *ptr = '\0'; + if (padflag == 0) + sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", + filestar,update->ntimestep,ptr+1); + else { + char bif[8],pad[16]; + strcpy(bif,BIGINT_FORMAT); + sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); + sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + } + *ptr = '*'; + if (maxfiles > 0) { + if (numfiles < maxfiles) { + nameslist[numfiles] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[numfiles],filecurrent); + ++numfiles; + } else { + remove(nameslist[fileidx]); + delete[] nameslist[fileidx]; + nameslist[fileidx] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[fileidx],filecurrent); + fileidx = (fileidx + 1) % maxfiles; + } + } + } + + // each proc with filewriter = 1 opens a file + + if (filewriter) { + if (append_flag) { + error->one(FLERR, "dump/zstd currently doesn't support append"); + } + + try { + writer.open(filecurrent); + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + + // delete string with timestep replaced + + if (multifile) delete [] filecurrent; +} + +/* ---------------------------------------------------------------------- */ + +void DumpAtomZstd::write_header(bigint ndump) +{ + std::string header; + + if ((multiproc) || (!multiproc && me == 0)) { + if (unit_flag && !unit_count) { + ++unit_count; + header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + } + + if (time_flag) { + header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); + } + + header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); + header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); + if (domain->triclinic == 0) { + header += fmt::format("ITEM: BOX BOUNDS {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxxlo, boxxhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxylo, boxyhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxzlo, boxzhi); + } else { + header += fmt::format("ITEM: BOX BOUNDS xy xz yz {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxxlo, boxxhi, boxxy); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxylo, boxyhi, boxxz); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxzlo, boxzhi, boxyz); + } + header += fmt::format("ITEM: ATOMS {}\n", columns); + + writer.write(header.c_str(), header.length()); + } +} + +/* ---------------------------------------------------------------------- */ + +void DumpAtomZstd::write_data(int n, double *mybuf) +{ + writer.write(mybuf, n); +} + +/* ---------------------------------------------------------------------- */ + +void DumpAtomZstd::write() +{ + DumpAtom::write(); + if (filewriter) { + if (multifile) { + writer.close(); + } else { + if (flush_flag && writer.isopen()) { + writer.flush(); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int DumpAtomZstd::modify_param(int narg, char **arg) +{ + int consumed = DumpAtom::modify_param(narg, arg); + if(consumed == 0) { + try { + if (strcmp(arg[0],"checksum") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); + else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); + else error->all(FLERR,"Illegal dump_modify command"); + return 2; + } else if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + return consumed; +} + +#endif diff --git a/src/COMPRESS/dump_atom_zstd.h b/src/COMPRESS/dump_atom_zstd.h new file mode 100644 index 0000000000..30108eeee9 --- /dev/null +++ b/src/COMPRESS/dump_atom_zstd.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#ifdef DUMP_CLASS + +DumpStyle(atom/zstd,DumpAtomZstd) + +#else + +#ifndef LMP_DUMP_ATOM_ZSTD_H +#define LMP_DUMP_ATOM_ZSTD_H + +#include "dump_atom.h" +#include "zstd_file_writer.h" + +namespace LAMMPS_NS { + +class DumpAtomZstd : public DumpAtom { + public: + DumpAtomZstd(class LAMMPS *, int, char **); + virtual ~DumpAtomZstd(); + + protected: + ZstdFileWriter writer; + + virtual void openfile(); + virtual void write_header(bigint); + virtual void write_data(int, double *); + virtual void write(); + + virtual int modify_param(int, char **); +}; + +} + +#endif +#endif +#endif + +/* ERROR/WARNING messages: + +E: Dump atom/zstd only writes compressed files + +The dump atom/zstd output file name must have a .zst suffix. + +E: Cannot open dump file + +Self-explanatory. + +*/ diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index aaeb878584..18f0fa56d7 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -17,8 +17,10 @@ #include "error.h" #include "update.h" + #include + using namespace LAMMPS_NS; #define UNWRAPEXPAND 10.0 @@ -27,6 +29,8 @@ DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : { gzFp = NULL; + compression_level = Z_BEST_COMPRESSION; + if (!compressed) error->all(FLERR,"Dump cfg/gz only writes compressed files"); } @@ -93,12 +97,15 @@ void DumpCFGGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { + std::string mode; if (append_flag) { - gzFp = gzopen(filecurrent,"ab9"); + mode = fmt::format("ab{}", compression_level); } else { - gzFp = gzopen(filecurrent,"wb9"); + mode = fmt::format("wb{}", compression_level); } + gzFp = gzopen(filecurrent, mode.c_str()); + if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); } else gzFp = NULL; @@ -164,3 +171,22 @@ void DumpCFGGZ::write() } } +/* ---------------------------------------------------------------------- */ + +int DumpCFGGZ::modify_param(int narg, char **arg) +{ + int consumed = DumpCFG::modify_param(narg, arg); + if(consumed == 0) { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int min_level = Z_DEFAULT_COMPRESSION; + int max_level = Z_BEST_COMPRESSION; + compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + if (compression_level < min_level || compression_level > max_level) + error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); + return 2; + } + } + return consumed; +} + diff --git a/src/COMPRESS/dump_cfg_gz.h b/src/COMPRESS/dump_cfg_gz.h index aefde431cf..0c6ed24f06 100644 --- a/src/COMPRESS/dump_cfg_gz.h +++ b/src/COMPRESS/dump_cfg_gz.h @@ -31,12 +31,15 @@ class DumpCFGGZ : public DumpCFG { virtual ~DumpCFGGZ(); protected: + int compression_level; gzFile gzFp; // file pointer for the compressed output stream virtual void openfile(); virtual void write_header(bigint); virtual void write_data(int, double *); virtual void write(); + + virtual int modify_param(int, char **); }; } diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp new file mode 100644 index 0000000000..5948a3f83e --- /dev/null +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -0,0 +1,196 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#include "atom.h" +#include "domain.h" +#include "dump_cfg_zstd.h" +#include "error.h" +#include "file_writer.h" +#include "update.h" + +#include + +using namespace LAMMPS_NS; +#define UNWRAPEXPAND 10.0 + +DumpCFGZstd::DumpCFGZstd(LAMMPS *lmp, int narg, char **arg) : + DumpCFG(lmp, narg, arg) +{ + if (!compressed) + error->all(FLERR,"Dump cfg/zstd only writes compressed files"); +} + + +/* ---------------------------------------------------------------------- */ + +DumpCFGZstd::~DumpCFGZstd() +{ +} + + +/* ---------------------------------------------------------------------- + generic opening of a dump file + ASCII or binary or zstdipped + some derived classes override this function +------------------------------------------------------------------------- */ + +void DumpCFGZstd::openfile() +{ + // single file, already opened, so just return + + if (singlefile_opened) return; + if (multifile == 0) singlefile_opened = 1; + + // if one file per timestep, replace '*' with current timestep + + char *filecurrent = filename; + if (multiproc) filecurrent = multiname; + + if (multifile) { + char *filestar = filecurrent; + filecurrent = new char[strlen(filestar) + 16]; + char *ptr = strchr(filestar,'*'); + *ptr = '\0'; + if (padflag == 0) + sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", + filestar,update->ntimestep,ptr+1); + else { + char bif[8],pad[16]; + strcpy(bif,BIGINT_FORMAT); + sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); + sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + } + *ptr = '*'; + if (maxfiles > 0) { + if (numfiles < maxfiles) { + nameslist[numfiles] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[numfiles],filecurrent); + ++numfiles; + } else { + remove(nameslist[fileidx]); + delete[] nameslist[fileidx]; + nameslist[fileidx] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[fileidx],filecurrent); + fileidx = (fileidx + 1) % maxfiles; + } + } + } + + // each proc with filewriter = 1 opens a file + + if (filewriter) { + if (append_flag) { + error->one(FLERR, "dump cfg/zstd currently doesn't support append"); + } + + try { + writer.open(filecurrent); + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + + // delete string with timestep replaced + + if (multifile) delete [] filecurrent; +} + +/* ---------------------------------------------------------------------- */ + +void DumpCFGZstd::write_header(bigint n) +{ + // set scale factor used by AtomEye for CFG viz + // default = 1.0 + // for peridynamics, set to pre-computed PD scale factor + // so PD particles mimic C atoms + // for unwrapped coords, set to UNWRAPEXPAND (10.0) + // so molecules are not split across periodic box boundaries + + double scale = 1.0; + if (atom->peri_flag) scale = atom->pdscale; + else if (unwrapflag == 1) scale = UNWRAPEXPAND; + + std::string header = fmt::format("Number of particles = {}\n", n); + header += fmt::format("A = {0:g} Angstrom (basic length-scale)\n", scale); + header += fmt::format("H0(1,1) = {0:g} A\n",domain->xprd); + header += fmt::format("H0(1,2) = 0 A \n"); + header += fmt::format("H0(1,3) = 0 A \n"); + header += fmt::format("H0(2,1) = {0:g} A \n",domain->xy); + header += fmt::format("H0(2,2) = {0:g} A\n",domain->yprd); + header += fmt::format("H0(2,3) = 0 A \n"); + header += fmt::format("H0(3,1) = {0:g} A \n",domain->xz); + header += fmt::format("H0(3,2) = {0:g} A \n",domain->yz); + header += fmt::format("H0(3,3) = {0:g} A\n",domain->zprd); + header += fmt::format(".NO_VELOCITY.\n"); + header += fmt::format("entry_count = {}\n",nfield-2); + for (int i = 0; i < nfield-5; i++) + header += fmt::format("auxiliary[{}] = {}\n",i,auxname[i]); + + writer.write(header.c_str(), header.length()); +} + +/* ---------------------------------------------------------------------- */ + +void DumpCFGZstd::write_data(int n, double *mybuf) +{ + writer.write(mybuf, n); +} + +/* ---------------------------------------------------------------------- */ + +void DumpCFGZstd::write() +{ + DumpCFG::write(); + if (filewriter) { + if (multifile) { + writer.close(); + } else { + if (flush_flag && writer.isopen()) { + writer.flush(); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int DumpCFGZstd::modify_param(int narg, char **arg) +{ + int consumed = DumpCFG::modify_param(narg, arg); + if(consumed == 0) { + try { + if (strcmp(arg[0],"checksum") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); + else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); + else error->all(FLERR,"Illegal dump_modify command"); + return 2; + } else if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + return consumed; +} +#endif diff --git a/src/COMPRESS/dump_cfg_zstd.h b/src/COMPRESS/dump_cfg_zstd.h new file mode 100644 index 0000000000..6f4fe8face --- /dev/null +++ b/src/COMPRESS/dump_cfg_zstd.h @@ -0,0 +1,65 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD +#ifdef DUMP_CLASS + +DumpStyle(cfg/zstd,DumpCFGZstd) + +#else + +#ifndef LMP_DUMP_CFG_ZSTD_H +#define LMP_DUMP_CFG_ZSTD_H + +#include "dump_cfg.h" +#include "zstd_file_writer.h" + +namespace LAMMPS_NS { + +class DumpCFGZstd : public DumpCFG { + public: + DumpCFGZstd(class LAMMPS *, int, char **); + virtual ~DumpCFGZstd(); + + protected: + ZstdFileWriter writer; + + virtual void openfile(); + virtual void write_header(bigint); + virtual void write_data(int, double *); + virtual void write(); + + virtual int modify_param(int, char **); +}; + +} + +#endif +#endif +#endif + +/* ERROR/WARNING messages: + +E: Dump cfg/zstd only writes compressed files + +The dump cfg/zstd output file name must have a .zstd suffix. + +E: Cannot open dump file + +Self-explanatory. + +*/ diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index 58ce98ad06..fb2b121f7f 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -16,8 +16,10 @@ #include "error.h" #include "update.h" + #include + using namespace LAMMPS_NS; DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : @@ -25,6 +27,8 @@ DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : { gzFp = NULL; + compression_level = Z_BEST_COMPRESSION; + if (!compressed) error->all(FLERR,"Dump custom/gz only writes compressed files"); } @@ -91,12 +95,15 @@ void DumpCustomGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { + std::string mode; if (append_flag) { - gzFp = gzopen(filecurrent,"ab9"); + mode = fmt::format("ab{}", compression_level); } else { - gzFp = gzopen(filecurrent,"wb9"); + mode = fmt::format("wb{}", compression_level); } + gzFp = gzopen(filecurrent, mode.c_str()); + if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); } else gzFp = NULL; @@ -120,14 +127,14 @@ void DumpCustomGZ::write_header(bigint ndump) gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); if (domain->triclinic == 0) { gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); - gzprintf(gzFp,"%-1.16g %-1.16g\n",boxxlo,boxxhi); - gzprintf(gzFp,"%-1.16g %-1.16g\n",boxylo,boxyhi); - gzprintf(gzFp,"%-1.16g %-1.16g\n",boxzlo,boxzhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxylo,boxyhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); } else { gzprintf(gzFp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - gzprintf(gzFp,"%-1.16g %-1.16g %-1.16g\n",boxxlo,boxxhi,boxxy); - gzprintf(gzFp,"%-1.16g %-1.16g %-1.16g\n",boxylo,boxyhi,boxxz); - gzprintf(gzFp,"%-1.16g %-1.16g %-1.16g\n",boxzlo,boxzhi,boxyz); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); } gzprintf(gzFp,"ITEM: ATOMS %s\n",columns); } @@ -156,3 +163,21 @@ void DumpCustomGZ::write() } } +/* ---------------------------------------------------------------------- */ + +int DumpCustomGZ::modify_param(int narg, char **arg) +{ + int consumed = DumpCustom::modify_param(narg, arg); + if(consumed == 0) { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int min_level = Z_DEFAULT_COMPRESSION; + int max_level = Z_BEST_COMPRESSION; + compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + if (compression_level < min_level || compression_level > max_level) + error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); + return 2; + } + } + return consumed; +} diff --git a/src/COMPRESS/dump_custom_gz.h b/src/COMPRESS/dump_custom_gz.h index 3a75673ab5..184f3563f1 100644 --- a/src/COMPRESS/dump_custom_gz.h +++ b/src/COMPRESS/dump_custom_gz.h @@ -31,12 +31,15 @@ class DumpCustomGZ : public DumpCustom { virtual ~DumpCustomGZ(); protected: + int compression_level; gzFile gzFp; // file pointer for the compressed output stream virtual void openfile(); virtual void write_header(bigint); virtual void write_data(int, double *); virtual void write(); + + virtual int modify_param(int, char **); }; } diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp new file mode 100644 index 0000000000..c7ede3b38c --- /dev/null +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -0,0 +1,195 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#include "domain.h" +#include "dump_custom_zstd.h" +#include "error.h" +#include "file_writer.h" +#include "update.h" + +#include + + +using namespace LAMMPS_NS; + +DumpCustomZstd::DumpCustomZstd(LAMMPS *lmp, int narg, char **arg) : + DumpCustom(lmp, narg, arg) +{ + if (!compressed) + error->all(FLERR,"Dump custom/zstd only writes compressed files"); +} + +/* ---------------------------------------------------------------------- */ + +DumpCustomZstd::~DumpCustomZstd() +{ +} + +/* ---------------------------------------------------------------------- + generic opening of a dump file + ASCII or binary or gzipped + some derived classes override this function +------------------------------------------------------------------------- */ + +void DumpCustomZstd::openfile() +{ + // single file, already opened, so just return + + if (singlefile_opened) return; + if (multifile == 0) singlefile_opened = 1; + + // if one file per timestep, replace '*' with current timestep + + char *filecurrent = filename; + if (multiproc) filecurrent = multiname; + + if (multifile) { + char *filestar = filecurrent; + filecurrent = new char[strlen(filestar) + 16]; + char *ptr = strchr(filestar,'*'); + *ptr = '\0'; + if (padflag == 0) + sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", + filestar,update->ntimestep,ptr+1); + else { + char bif[8],pad[16]; + strcpy(bif,BIGINT_FORMAT); + sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); + sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + } + *ptr = '*'; + if (maxfiles > 0) { + if (numfiles < maxfiles) { + nameslist[numfiles] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[numfiles],filecurrent); + ++numfiles; + } else { + remove(nameslist[fileidx]); + delete[] nameslist[fileidx]; + nameslist[fileidx] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[fileidx],filecurrent); + fileidx = (fileidx + 1) % maxfiles; + } + } + } + + // each proc with filewriter = 1 opens a file + + if (filewriter) { + if (append_flag) { + error->one(FLERR, "dump/zstd currently doesn't support append"); + } + + try { + writer.open(filecurrent); + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + + // delete string with timestep replaced + + if (multifile) delete [] filecurrent; +} + +/* ---------------------------------------------------------------------- */ + +void DumpCustomZstd::write_header(bigint ndump) +{ + std::string header; + + if ((multiproc) || (!multiproc && me == 0)) { + if (unit_flag && !unit_count) { + ++unit_count; + header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + } + + if (time_flag) { + header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); + } + + header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); + header += fmt::format("ITEM: NUMBER OF ATOMS\n{}\n", ndump); + if (domain->triclinic == 0) { + header += fmt::format("ITEM: BOX BOUNDS {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxxlo, boxxhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxylo, boxyhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxzlo, boxzhi); + } else { + header += fmt::format("ITEM: BOX BOUNDS xy xz yz {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxxlo, boxxhi, boxxy); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxylo, boxyhi, boxxz); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxzlo, boxzhi, boxyz); + } + header += fmt::format("ITEM: ATOMS {}\n", columns); + + writer.write(header.c_str(), header.length()); + } +} + +/* ---------------------------------------------------------------------- */ + +void DumpCustomZstd::write_data(int n, double *mybuf) +{ + writer.write(mybuf, n); +} + +/* ---------------------------------------------------------------------- */ + +void DumpCustomZstd::write() +{ + DumpCustom::write(); + if (filewriter) { + if (multifile) { + writer.close(); + } else { + if (flush_flag && writer.isopen()) { + writer.flush(); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int DumpCustomZstd::modify_param(int narg, char **arg) +{ + int consumed = DumpCustom::modify_param(narg, arg); + if(consumed == 0) { + try { + if (strcmp(arg[0],"checksum") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); + else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); + else error->all(FLERR,"Illegal dump_modify command"); + return 2; + } else if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + return consumed; +} + +#endif diff --git a/src/COMPRESS/dump_custom_zstd.h b/src/COMPRESS/dump_custom_zstd.h new file mode 100644 index 0000000000..ce3f1325c5 --- /dev/null +++ b/src/COMPRESS/dump_custom_zstd.h @@ -0,0 +1,67 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#ifdef DUMP_CLASS + +DumpStyle(custom/zstd,DumpCustomZstd) + +#else + +#ifndef LMP_DUMP_CUSTOM_ZSTD_H +#define LMP_DUMP_CUSTOM_ZSTD_H + +#include "dump_custom.h" +#include "zstd_file_writer.h" +#include + +namespace LAMMPS_NS { + +class DumpCustomZstd : public DumpCustom { + public: + DumpCustomZstd(class LAMMPS *, int, char **); + virtual ~DumpCustomZstd(); + + protected: + ZstdFileWriter writer; + + virtual void openfile(); + virtual void write_header(bigint); + virtual void write_data(int, double *); + virtual void write(); + + virtual int modify_param(int, char **); +}; + +} + +#endif +#endif +#endif + +/* ERROR/WARNING messages: + +E: Dump custom/zstd only writes compressed files + +The dump custom/zstd output file name must have a .zst suffix. + +E: Cannot open dump file + +Self-explanatory. + +*/ diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index c27c795f75..49a3c3bef2 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -16,8 +16,10 @@ #include "error.h" #include "update.h" + #include + using namespace LAMMPS_NS; DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : @@ -25,6 +27,8 @@ DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : { gzFp = NULL; + compression_level = Z_BEST_COMPRESSION; + if (!compressed) error->all(FLERR,"Dump local/gz only writes compressed files"); } @@ -91,12 +95,15 @@ void DumpLocalGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { + std::string mode; if (append_flag) { - gzFp = gzopen(filecurrent,"ab9"); + mode = fmt::format("ab{}", compression_level); } else { - gzFp = gzopen(filecurrent,"wb9"); + mode = fmt::format("wb{}", compression_level); } + gzFp = gzopen(filecurrent, mode.c_str()); + if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); } else gzFp = NULL; @@ -116,18 +123,18 @@ void DumpLocalGZ::write_header(bigint ndump) gzprintf(gzFp,"ITEM: TIMESTEP\n"); gzprintf(gzFp,BIGINT_FORMAT "\n",update->ntimestep); - gzprintf(gzFp,"ITEM: NUMBER OF ATOMS\n"); + gzprintf(gzFp,"ITEM: NUMBER OF %s\n",label); gzprintf(gzFp,BIGINT_FORMAT "\n",ndump); - if (domain->triclinic == 0) { - gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); - gzprintf(gzFp,"%-1.16g %-1.16g\n",boxxlo,boxxhi); - gzprintf(gzFp,"%-1.16g %-1.16g\n",boxylo,boxyhi); - gzprintf(gzFp,"%-1.16g %-1.16g\n",boxzlo,boxzhi); - } else { + if (domain->triclinic) { gzprintf(gzFp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - gzprintf(gzFp,"%-1.16g %-1.16g %-1.16g\n",boxxlo,boxxhi,boxxy); - gzprintf(gzFp,"%-1.16g %-1.16g %-1.16g\n",boxylo,boxyhi,boxxz); - gzprintf(gzFp,"%-1.16g %-1.16g %-1.16g\n",boxzlo,boxzhi,boxyz); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); + gzprintf(gzFp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); + } else { + gzprintf(gzFp,"ITEM: BOX BOUNDS %s\n",boundstr); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxylo,boxyhi); + gzprintf(gzFp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); } gzprintf(gzFp,"ITEM: %s %s\n",label,columns); } @@ -171,3 +178,21 @@ void DumpLocalGZ::write() } } +/* ---------------------------------------------------------------------- */ + +int DumpLocalGZ::modify_param(int narg, char **arg) +{ + int consumed = DumpLocal::modify_param(narg, arg); + if(consumed == 0) { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int min_level = Z_DEFAULT_COMPRESSION; + int max_level = Z_BEST_COMPRESSION; + compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + if (compression_level < min_level || compression_level > max_level) + error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); + return 2; + } + } + return consumed; +} diff --git a/src/COMPRESS/dump_local_gz.h b/src/COMPRESS/dump_local_gz.h index cc788863de..b3f7c7dcf8 100644 --- a/src/COMPRESS/dump_local_gz.h +++ b/src/COMPRESS/dump_local_gz.h @@ -31,12 +31,15 @@ class DumpLocalGZ : public DumpLocal { virtual ~DumpLocalGZ(); protected: + int compression_level; gzFile gzFp; // file pointer for the compressed output stream virtual void openfile(); virtual void write_header(bigint); virtual void write_data(int, double *); virtual void write(); + + virtual int modify_param(int, char **); }; } diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp new file mode 100644 index 0000000000..9393654dd6 --- /dev/null +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -0,0 +1,195 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#include "dump_local_zstd.h" +#include "domain.h" +#include "error.h" +#include "update.h" + + +#include + + +using namespace LAMMPS_NS; + +DumpLocalZstd::DumpLocalZstd(LAMMPS *lmp, int narg, char **arg) : + DumpLocal(lmp, narg, arg) +{ + if (!compressed) + error->all(FLERR,"Dump local/zstd only writes compressed files"); +} + + +/* ---------------------------------------------------------------------- */ + +DumpLocalZstd::~DumpLocalZstd() +{ +} + + +/* ---------------------------------------------------------------------- + generic opening of a dump file + ASCII or binary or gzipped + some derived classes override this function +------------------------------------------------------------------------- */ + +void DumpLocalZstd::openfile() +{ + // single file, already opened, so just return + + if (singlefile_opened) return; + if (multifile == 0) singlefile_opened = 1; + + // if one file per timestep, replace '*' with current timestep + + char *filecurrent = filename; + if (multiproc) filecurrent = multiname; + + if (multifile) { + char *filestar = filecurrent; + filecurrent = new char[strlen(filestar) + 16]; + char *ptr = strchr(filestar,'*'); + *ptr = '\0'; + if (padflag == 0) + sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", + filestar,update->ntimestep,ptr+1); + else { + char bif[8],pad[16]; + strcpy(bif,BIGINT_FORMAT); + sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); + sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + } + *ptr = '*'; + if (maxfiles > 0) { + if (numfiles < maxfiles) { + nameslist[numfiles] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[numfiles],filecurrent); + ++numfiles; + } else { + remove(nameslist[fileidx]); + delete[] nameslist[fileidx]; + nameslist[fileidx] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[fileidx],filecurrent); + fileidx = (fileidx + 1) % maxfiles; + } + } + } + + // each proc with filewriter = 1 opens a file + + if (filewriter) { + if (append_flag) { + error->one(FLERR, "dump cfg/zstd currently doesn't support append"); + } + + try { + writer.open(filecurrent); + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + + // delete string with timestep replaced + + if (multifile) delete [] filecurrent; +} + +void DumpLocalZstd::write_header(bigint ndump) +{ + std::string header; + + if ((multiproc) || (!multiproc && me == 0)) { + if (unit_flag && !unit_count) { + ++unit_count; + header = fmt::format("ITEM: UNITS\n{}\n",update->unit_style); + } + + if (time_flag) { + header += fmt::format("ITEM: TIME\n{0:.16g}\n", compute_time()); + } + + header += fmt::format("ITEM: TIMESTEP\n{}\n", update->ntimestep); + header += fmt::format("ITEM: NUMBER OF {}\n{}\n", label, ndump); + if (domain->triclinic == 0) { + header += fmt::format("ITEM: BOX BOUNDS {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxxlo, boxxhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxylo, boxyhi); + header += fmt::format("{0:-1.16e} {1:-1.16e}\n", boxzlo, boxzhi); + } else { + header += fmt::format("ITEM: BOX BOUNDS xy xz yz {}\n", boundstr); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxxlo, boxxhi, boxxy); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxylo, boxyhi, boxxz); + header += fmt::format("{0:-1.16e} {1:-1.16e} {2:-1.16e}\n", boxzlo, boxzhi, boxyz); + } + header += fmt::format("ITEM: {} {}\n", label, columns); + + writer.write(header.c_str(), header.length()); + } +} + +/* ---------------------------------------------------------------------- */ + +void DumpLocalZstd::write_data(int n, double *mybuf) +{ + writer.write(mybuf, sizeof(char)*n); +} + +/* ---------------------------------------------------------------------- */ + +void DumpLocalZstd::write() +{ + DumpLocal::write(); + if (filewriter) { + if (multifile) { + writer.close(); + } else { + if (flush_flag && writer.isopen()) { + writer.flush(); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int DumpLocalZstd::modify_param(int narg, char **arg) +{ + int consumed = DumpLocal::modify_param(narg, arg); + if(consumed == 0) { + try { + if (strcmp(arg[0],"checksum") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); + else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); + else error->all(FLERR,"Illegal dump_modify command"); + return 2; + } else if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + return consumed; +} + +#endif diff --git a/src/COMPRESS/dump_local_zstd.h b/src/COMPRESS/dump_local_zstd.h new file mode 100644 index 0000000000..398b1c3337 --- /dev/null +++ b/src/COMPRESS/dump_local_zstd.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#ifdef DUMP_CLASS + +DumpStyle(local/zstd,DumpLocalZstd) + +#else + +#ifndef LMP_DUMP_LOCAL_ZSTD_H +#define LMP_DUMP_LOCAL_ZSTD_H + +#include "dump_local.h" +#include "zstd_file_writer.h" + +namespace LAMMPS_NS { + +class DumpLocalZstd : public DumpLocal { + public: + DumpLocalZstd(class LAMMPS *, int, char **); + virtual ~DumpLocalZstd(); + + protected: + ZstdFileWriter writer; + + virtual void openfile(); + virtual void write_header(bigint); + virtual void write_data(int, double *); + virtual void write(); + + virtual int modify_param(int, char **); +}; + +} + +#endif +#endif +#endif + +/* ERROR/WARNING messages: + +E: Dump local/zstd only writes compressed files + +The dump local/zstd output file name must have a .zst suffix. + +E: Cannot open dump file + +Self-explanatory. + +*/ diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index c76b7afa17..cc07b1ce61 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -15,8 +15,10 @@ #include "error.h" #include "update.h" + #include + using namespace LAMMPS_NS; DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : @@ -24,6 +26,8 @@ DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : { gzFp = NULL; + compression_level = Z_BEST_COMPRESSION; + if (!compressed) error->all(FLERR,"Dump xyz/gz only writes compressed files"); } @@ -90,12 +94,15 @@ void DumpXYZGZ::openfile() // each proc with filewriter = 1 opens a file if (filewriter) { + std::string mode; if (append_flag) { - gzFp = gzopen(filecurrent,"ab9"); + mode = fmt::format("ab{}", compression_level); } else { - gzFp = gzopen(filecurrent,"wb9"); + mode = fmt::format("wb{}", compression_level); } + gzFp = gzopen(filecurrent, mode.c_str()); + if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); } else gzFp = NULL; @@ -134,3 +141,22 @@ void DumpXYZGZ::write() } } } + +/* ---------------------------------------------------------------------- */ + +int DumpXYZGZ::modify_param(int narg, char **arg) +{ + int consumed = DumpXYZ::modify_param(narg, arg); + if(consumed == 0) { + if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int min_level = Z_DEFAULT_COMPRESSION; + int max_level = Z_BEST_COMPRESSION; + compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + if (compression_level < min_level || compression_level > max_level) + error->all(FLERR, fmt::format("Illegal dump_modify command: compression level must in the range of [{}, {}]", min_level, max_level)); + return 2; + } + } + return consumed; +} diff --git a/src/COMPRESS/dump_xyz_gz.h b/src/COMPRESS/dump_xyz_gz.h index 45d5456ddb..834db488a5 100644 --- a/src/COMPRESS/dump_xyz_gz.h +++ b/src/COMPRESS/dump_xyz_gz.h @@ -31,12 +31,15 @@ class DumpXYZGZ : public DumpXYZ { virtual ~DumpXYZGZ(); protected: + int compression_level; gzFile gzFp; // file pointer for the compressed output stream virtual void openfile(); virtual void write_header(bigint); virtual void write_data(int, double *); virtual void write(); + + virtual int modify_param(int, char **); }; } diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp new file mode 100644 index 0000000000..eb0600f34b --- /dev/null +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -0,0 +1,169 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#include "dump_xyz_zstd.h" +#include "error.h" +#include "file_writer.h" +#include "update.h" + +#include + +using namespace LAMMPS_NS; + +DumpXYZZstd::DumpXYZZstd(LAMMPS *lmp, int narg, char **arg) : + DumpXYZ(lmp, narg, arg) +{ + if (!compressed) + error->all(FLERR,"Dump xyz/zstd only writes compressed files"); +} + + +/* ---------------------------------------------------------------------- */ + +DumpXYZZstd::~DumpXYZZstd() +{ +} + + +/* ---------------------------------------------------------------------- + generic opening of a dump file + ASCII or binary or gzipped + some derived classes override this function +------------------------------------------------------------------------- */ + +void DumpXYZZstd::openfile() +{ + // single file, already opened, so just return + + if (singlefile_opened) return; + if (multifile == 0) singlefile_opened = 1; + + // if one file per timestep, replace '*' with current timestep + + char *filecurrent = filename; + if (multiproc) filecurrent = multiname; + + if (multifile) { + char *filestar = filecurrent; + filecurrent = new char[strlen(filestar) + 16]; + char *ptr = strchr(filestar,'*'); + *ptr = '\0'; + if (padflag == 0) + sprintf(filecurrent,"%s" BIGINT_FORMAT "%s", + filestar,update->ntimestep,ptr+1); + else { + char bif[8],pad[16]; + strcpy(bif,BIGINT_FORMAT); + sprintf(pad,"%%s%%0%d%s%%s",padflag,&bif[1]); + sprintf(filecurrent,pad,filestar,update->ntimestep,ptr+1); + } + *ptr = '*'; + if (maxfiles > 0) { + if (numfiles < maxfiles) { + nameslist[numfiles] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[numfiles],filecurrent); + ++numfiles; + } else { + remove(nameslist[fileidx]); + delete[] nameslist[fileidx]; + nameslist[fileidx] = new char[strlen(filecurrent)+1]; + strcpy(nameslist[fileidx],filecurrent); + fileidx = (fileidx + 1) % maxfiles; + } + } + } + + // each proc with filewriter = 1 opens a file + + if (filewriter) { + if (append_flag) { + error->one(FLERR, "dump cfg/zstd currently doesn't support append"); + } + + try { + writer.open(filecurrent); + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + + // delete string with timestep replaced + + if (multifile) delete [] filecurrent; +} + +void DumpXYZZstd::write_header(bigint ndump) +{ + if (me == 0) { + std::string header = fmt::format("{}\n", ndump); + header += fmt::format("Atoms. Timestep: {}\n", update->ntimestep); + writer.write(header.c_str(), header.length()); + } +} + +/* ---------------------------------------------------------------------- */ + +void DumpXYZZstd::write_data(int n, double *mybuf) +{ + writer.write(mybuf, n); +} + +/* ---------------------------------------------------------------------- */ + +void DumpXYZZstd::write() +{ + DumpXYZ::write(); + if (filewriter) { + if (multifile) { + writer.close(); + } else { + if (flush_flag && writer.isopen()) { + writer.flush(); + } + } + } +} + +/* ---------------------------------------------------------------------- */ + +int DumpXYZZstd::modify_param(int narg, char **arg) +{ + int consumed = DumpXYZ::modify_param(narg, arg); + if(consumed == 0) { + try { + if (strcmp(arg[0],"checksum") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + if (strcmp(arg[1],"yes") == 0) writer.setChecksum(true); + else if (strcmp(arg[1],"no") == 0) writer.setChecksum(false); + else error->all(FLERR,"Illegal dump_modify command"); + return 2; + } else if (strcmp(arg[0],"compression_level") == 0) { + if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); + int compression_level = utils::inumeric(FLERR, arg[1], false, lmp); + writer.setCompressionLevel(compression_level); + return 2; + } + } catch (FileWriterException & e) { + error->one(FLERR, e.what()); + } + } + return consumed; +} + +#endif diff --git a/src/COMPRESS/dump_xyz_zstd.h b/src/COMPRESS/dump_xyz_zstd.h new file mode 100644 index 0000000000..2422341557 --- /dev/null +++ b/src/COMPRESS/dump_xyz_zstd.h @@ -0,0 +1,66 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#ifdef DUMP_CLASS + +DumpStyle(xyz/zstd,DumpXYZZstd) + +#else + +#ifndef LMP_DUMP_XYZ_ZSTD_H +#define LMP_DUMP_XYZ_ZSTD_H + +#include "dump_xyz.h" +#include "zstd_file_writer.h" + +namespace LAMMPS_NS { + +class DumpXYZZstd : public DumpXYZ { + public: + DumpXYZZstd(class LAMMPS *, int, char **); + virtual ~DumpXYZZstd(); + + protected: + ZstdFileWriter writer; + + virtual void openfile(); + virtual void write_header(bigint); + virtual void write_data(int, double *); + virtual void write(); + + virtual int modify_param(int, char **); +}; + +} + +#endif +#endif +#endif + +/* ERROR/WARNING messages: + +E: Dump xyz/zstd only writes compressed files + +The dump xyz/zstd output file name must have a .zst suffix. + +E: Cannot open dump file + +Self-explanatory. + +*/ diff --git a/src/COMPRESS/zstd_file_writer.cpp b/src/COMPRESS/zstd_file_writer.cpp new file mode 100644 index 0000000000..e764409c73 --- /dev/null +++ b/src/COMPRESS/zstd_file_writer.cpp @@ -0,0 +1,162 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#include "zstd_file_writer.h" +#include +#include "fmt/format.h" + +using namespace LAMMPS_NS; + +ZstdFileWriter::ZstdFileWriter() : FileWriter(), + compression_level(0), + checksum_flag(1), + cctx(nullptr), + fp(nullptr) +{ + out_buffer_size = ZSTD_CStreamOutSize(); + out_buffer = new char[out_buffer_size]; +} + +/* ---------------------------------------------------------------------- */ + +ZstdFileWriter::~ZstdFileWriter() +{ + close(); + + delete [] out_buffer; + out_buffer = nullptr; + out_buffer_size = 0; +} + +/* ---------------------------------------------------------------------- */ + +void ZstdFileWriter::open(const std::string & path) +{ + if(isopen()) return; + + fp = fopen(path.c_str(), "wb"); + + if (!fp) { + throw FileWriterException(fmt::format("Could not open file '{}'", path)); + } + + cctx = ZSTD_createCCtx(); + + if (!cctx) { + fclose(fp); + fp = nullptr; + throw FileWriterException("Could not create Zstd context"); + } + + ZSTD_CCtx_setParameter(cctx, ZSTD_c_compressionLevel, compression_level); + ZSTD_CCtx_setParameter(cctx, ZSTD_c_checksumFlag, checksum_flag); +} + +/* ---------------------------------------------------------------------- */ + +size_t ZstdFileWriter::write(const void * buffer, size_t length) +{ + if(!isopen()) return 0; + + ZSTD_inBuffer input = { buffer, length, 0 }; + ZSTD_EndDirective mode = ZSTD_e_continue; + + do { + ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 }; + size_t const remaining = ZSTD_compressStream2(cctx, &output, &input, mode); + fwrite(out_buffer, sizeof(char), output.pos, fp); + } while(input.pos < input.size); + + return length; +} + +/* ---------------------------------------------------------------------- */ + +void ZstdFileWriter::flush() +{ + if(!isopen()) return; + + size_t remaining; + ZSTD_inBuffer input = { nullptr, 0, 0 }; + ZSTD_EndDirective mode = ZSTD_e_flush; + + do { + ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 }; + remaining = ZSTD_compressStream2(cctx, &output, &input, mode); + fwrite(out_buffer, sizeof(char), output.pos, fp); + } while(remaining); + + fflush(fp); +} + +/* ---------------------------------------------------------------------- */ + +void ZstdFileWriter::close() +{ + if(!isopen()) return; + + size_t remaining; + ZSTD_inBuffer input = { nullptr, 0, 0 }; + ZSTD_EndDirective mode = ZSTD_e_end; + + do { + ZSTD_outBuffer output = { out_buffer, out_buffer_size, 0 }; + remaining = ZSTD_compressStream2(cctx, &output, &input, mode); + fwrite(out_buffer, sizeof(char), output.pos, fp); + } while(remaining); + + ZSTD_freeCCtx(cctx); + cctx = nullptr; + fclose(fp); + fp = nullptr; +} + +/* ---------------------------------------------------------------------- */ + +bool ZstdFileWriter::isopen() const +{ + return fp && cctx; +} + +/* ---------------------------------------------------------------------- */ + +void ZstdFileWriter::setCompressionLevel(int level) +{ + if (isopen()) + throw FileWriterException("Compression level can not be changed while file is open"); + + const int min_level = ZSTD_minCLevel(); + const int max_level = ZSTD_maxCLevel(); + + if(level < min_level || level > max_level) + throw FileWriterException(fmt::format("Compression level must in the range of [{}, {}]", min_level, max_level)); + + compression_level = level; +} + +/* ---------------------------------------------------------------------- */ + +void ZstdFileWriter::setChecksum(bool enabled) +{ + if (isopen()) + throw FileWriterException("Checksum flag can not be changed while file is open"); + checksum_flag = enabled ? 1 : 0; +} + +#endif diff --git a/src/COMPRESS/zstd_file_writer.h b/src/COMPRESS/zstd_file_writer.h new file mode 100644 index 0000000000..eec993bd4e --- /dev/null +++ b/src/COMPRESS/zstd_file_writer.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifdef LAMMPS_ZSTD + +#ifndef LMP_ZSTD_FILE_WRITER_H +#define LMP_ZSTD_FILE_WRITER_H + +#include "file_writer.h" +#include +#include +#include + +namespace LAMMPS_NS { + +class ZstdFileWriter : public FileWriter { + int compression_level; + int checksum_flag; + + ZSTD_CCtx * cctx; + FILE * fp; + char * out_buffer; + size_t out_buffer_size; +public: + ZstdFileWriter(); + virtual ~ZstdFileWriter(); + virtual void open(const std::string & path) override; + virtual void close() override; + virtual void flush() override; + virtual size_t write(const void * buffer, size_t length) override; + virtual bool isopen() const override; + + void setCompressionLevel(int level); + void setChecksum(bool enabled); +}; + + +} + +#endif +#endif diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index d8f952551d..1b7eb1e43f 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -17,9 +17,9 @@ ------------------------------------------------------------------------- */ #include "compute_temp_cs.h" -#include + #include -#include + #include "atom.h" #include "atom_vec.h" #include "domain.h" @@ -31,7 +31,7 @@ #include "comm.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index b6895be301..4193b5c6a8 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -12,15 +12,10 @@ ------------------------------------------------------------------------- */ #include "atom_vec_dipole.h" -#include + #include "atom.h" -#include "comm.h" -#include "domain.h" -#include "modify.h" -#include "fix.h" -#include "memory.h" -#include "error.h" -#include "utils.h" + +#include using namespace LAMMPS_NS; diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index 9f9e897357..25fed599db 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_dipole_cut.h" -#include + #include #include #include "atom.h" @@ -23,7 +23,7 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -298,9 +298,9 @@ void PairLJCutDipoleCut::settings(int narg, char **arg) if (strcmp(update->unit_style,"electron") == 0) error->all(FLERR,"Cannot (yet) use 'electron' units with dipoles"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[1]); + else cut_coul_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -326,16 +326,16 @@ void PairLJCutDipoleCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 5) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[4]); - if (narg == 6) cut_coul_one = force->numeric(FLERR,arg[5]); + if (narg >= 5) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); + if (narg == 6) cut_coul_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 7fc03005b5..67d2e0aa3c 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_dipole_long.h" -#include + #include #include #include "atom.h" @@ -25,7 +25,7 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -348,9 +348,9 @@ void PairLJCutDipoleLong::settings(int narg, char **arg) if (narg < 1 || narg > 2) error->all(FLERR,"Incorrect args in pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -373,14 +373,14 @@ void PairLJCutDipoleLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 7dc596eccb..86e143626d 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_long_dipole_long.h" -#include + #include #include #include "math_const.h" @@ -30,7 +30,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -90,10 +90,10 @@ void PairLJLongDipoleLong::settings(int narg, char **arg) if (!((ewald_order^ewald_off)&(1<<3))) error->all(FLERR, "Coulombic cut not supported in pair_style lj/long/dipole/long"); - cut_lj_global = force->numeric(FLERR,*(arg++)); + cut_lj_global = utils::numeric(FLERR,*(arg++),false,lmp); if (narg == 4 && (ewald_order==74)) error->all(FLERR,"Only one cut-off allowed when requesting all long"); - if (narg == 4) cut_coul = force->numeric(FLERR,*(arg++)); + if (narg == 4) cut_coul = utils::numeric(FLERR,*(arg++),false,lmp); else cut_coul = cut_lj_global; if (allocated) { // reset explicit cuts @@ -191,14 +191,14 @@ void PairLJLongDipoleLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index ecde8ea093..15bc42c37e 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -13,7 +13,7 @@ #include "fix_gpu.h" #include -#include + #include "atom.h" #include "force.h" #include "pair.h" @@ -30,7 +30,7 @@ #include "neighbor.h" #include "citeme.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -138,27 +138,27 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"binsize") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command"); - binsize = force->numeric(FLERR,arg[iarg+1]); + binsize = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (binsize <= 0.0) error->all(FLERR,"Illegal fix GPU command"); iarg += 2; } else if (strcmp(arg[iarg],"split") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command"); - _particle_split = force->numeric(FLERR,arg[iarg+1]); + _particle_split = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (_particle_split == 0.0 || _particle_split > 1.0) error->all(FLERR,"Illegal package GPU command"); iarg += 2; } else if (strcmp(arg[iarg],"gpuID") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal package gpu command"); - first_gpu = force->inumeric(FLERR,arg[iarg+1]); - last_gpu = force->inumeric(FLERR,arg[iarg+2]); + first_gpu = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + last_gpu = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"tpa") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command"); - threads_per_atom = force->inumeric(FLERR,arg[iarg+1]); + threads_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"nthreads") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command"); - nthreads = force->inumeric(FLERR,arg[iarg+1]); + nthreads = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nthreads < 1) error->all(FLERR,"Illegal fix GPU command"); iarg += 2; } else if (strcmp(arg[iarg],"device") == 0) { @@ -167,7 +167,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"blocksize") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package gpu command"); - block_pair = force->inumeric(FLERR,arg[iarg+1]); + block_pair = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR,"Illegal package gpu command"); } diff --git a/src/GPU/pair_beck_gpu.cpp b/src/GPU/pair_beck_gpu.cpp index 28386f5fd5..86467f49c0 100644 --- a/src/GPU/pair_beck_gpu.cpp +++ b/src/GPU/pair_beck_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_beck_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_born_coul_long_cs_gpu.cpp b/src/GPU/pair_born_coul_long_cs_gpu.cpp index 8bc99a3d49..c27c670f2a 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_long_cs_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_born_coul_long_cs_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_born_coul_long_gpu.cpp b/src/GPU/pair_born_coul_long_gpu.cpp index 5dd4c3421f..a2524909e5 100644 --- a/src/GPU/pair_born_coul_long_gpu.cpp +++ b/src/GPU/pair_born_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_born_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_born_coul_wolf_cs_gpu.cpp b/src/GPU/pair_born_coul_wolf_cs_gpu.cpp index 4ba28c25aa..cf54b72cf5 100644 --- a/src/GPU/pair_born_coul_wolf_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_wolf_cs_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_born_coul_wolf_cs_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_born_coul_wolf_gpu.cpp b/src/GPU/pair_born_coul_wolf_gpu.cpp index b5e0edea6d..e9aa951236 100644 --- a/src/GPU/pair_born_coul_wolf_gpu.cpp +++ b/src/GPU/pair_born_coul_wolf_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_born_coul_wolf_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_born_gpu.cpp b/src/GPU/pair_born_gpu.cpp index a5e94389b6..5a5a6d2a36 100644 --- a/src/GPU/pair_born_gpu.cpp +++ b/src/GPU/pair_born_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_born_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_buck_coul_cut_gpu.cpp b/src/GPU/pair_buck_coul_cut_gpu.cpp index 1a5479ea1d..de9f0d1eba 100644 --- a/src/GPU/pair_buck_coul_cut_gpu.cpp +++ b/src/GPU/pair_buck_coul_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_buck_coul_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_buck_coul_long_gpu.cpp b/src/GPU/pair_buck_coul_long_gpu.cpp index 221e178b57..41823fc27e 100644 --- a/src/GPU/pair_buck_coul_long_gpu.cpp +++ b/src/GPU/pair_buck_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_buck_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_buck_gpu.cpp b/src/GPU/pair_buck_gpu.cpp index 07107750e6..1f7abc06bc 100644 --- a/src/GPU/pair_buck_gpu.cpp +++ b/src/GPU/pair_buck_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_buck_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_colloid_gpu.cpp b/src/GPU/pair_colloid_gpu.cpp index a7cafbe75a..39737ab183 100644 --- a/src/GPU/pair_colloid_gpu.cpp +++ b/src/GPU/pair_colloid_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_colloid_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_coul_cut_gpu.cpp b/src/GPU/pair_coul_cut_gpu.cpp index bacbdbb1a0..34a76c1dff 100644 --- a/src/GPU/pair_coul_cut_gpu.cpp +++ b/src/GPU/pair_coul_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_coul_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_coul_debye_gpu.cpp b/src/GPU/pair_coul_debye_gpu.cpp index 96be67a1fa..40fb359484 100644 --- a/src/GPU/pair_coul_debye_gpu.cpp +++ b/src/GPU/pair_coul_debye_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_coul_debye_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_coul_dsf_gpu.cpp b/src/GPU/pair_coul_dsf_gpu.cpp index 244941c117..8c05d14aef 100644 --- a/src/GPU/pair_coul_dsf_gpu.cpp +++ b/src/GPU/pair_coul_dsf_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_coul_dsf_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_coul_long_cs_gpu.cpp b/src/GPU/pair_coul_long_cs_gpu.cpp index bcbf7216e2..da59873dd2 100644 --- a/src/GPU/pair_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_coul_long_cs_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_coul_long_cs_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_coul_long_gpu.cpp b/src/GPU/pair_coul_long_gpu.cpp index fcfb20f3ce..185d3a7f94 100644 --- a/src/GPU/pair_coul_long_gpu.cpp +++ b/src/GPU/pair_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_dpd_gpu.cpp b/src/GPU/pair_dpd_gpu.cpp index a2e20d016c..d41be6d8c2 100644 --- a/src/GPU/pair_dpd_gpu.cpp +++ b/src/GPU/pair_dpd_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_dpd_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_dpd_tstat_gpu.cpp b/src/GPU/pair_dpd_tstat_gpu.cpp index 991c6d900f..33d7178faa 100644 --- a/src/GPU/pair_dpd_tstat_gpu.cpp +++ b/src/GPU/pair_dpd_tstat_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_dpd_tstat_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 08ffaef978..4939537770 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -17,7 +17,7 @@ #include "pair_eam_alloy_gpu.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -29,7 +29,7 @@ #include "neigh_request.h" #include "gpu_extra.h" #include "domain.h" -#include "utils.h" + #include "suffix.h" #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index a82107749b..eb028bc778 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -17,7 +17,7 @@ #include "pair_eam_fs_gpu.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -30,7 +30,7 @@ #include "gpu_extra.h" #include "domain.h" #include "suffix.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 1aac379c35..3965f27c67 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_eam_gpu.h" #include #include -#include + #include #include "atom.h" #include "force.h" diff --git a/src/GPU/pair_gauss_gpu.cpp b/src/GPU/pair_gauss_gpu.cpp index eb83d5af44..51d4851dc5 100644 --- a/src/GPU/pair_gauss_gpu.cpp +++ b/src/GPU/pair_gauss_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_gauss_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 83b24f8774..451799027b 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_gayberne_gpu.h" #include #include -#include + #include #include "math_extra.h" #include "atom.h" diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 7b0d45a437..215998bc88 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj96_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp index b08ad5e232..09ed178200 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_charmm_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.cpp b/src/GPU/pair_lj_class2_coul_long_gpu.cpp index 46ecaea9b8..f6d671d95a 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_class2_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_class2_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_class2_gpu.cpp b/src/GPU/pair_lj_class2_gpu.cpp index a7ca661927..fbd6aea08c 100644 --- a/src/GPU/pair_lj_class2_gpu.cpp +++ b/src/GPU/pair_lj_class2_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_class2_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cubic_gpu.cpp b/src/GPU/pair_lj_cubic_gpu.cpp index 38f6e1f908..28e74d8f39 100644 --- a/src/GPU/pair_lj_cubic_gpu.cpp +++ b/src/GPU/pair_lj_cubic_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cubic_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp index 54f0e92bd5..48770d2713 100644 --- a/src/GPU/pair_lj_cut_coul_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_coul_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_coul_debye_gpu.cpp b/src/GPU/pair_lj_cut_coul_debye_gpu.cpp index e7b1ac5002..45c3cc82a0 100644 --- a/src/GPU/pair_lj_cut_coul_debye_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_debye_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_coul_debye_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp index 5d1f4f70be..784c0e379d 100644 --- a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_coul_dsf_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index dff2ba28d4..2a9d431a42 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp index 2f965d6476..f5987c0ddf 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_coul_msm_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp b/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp index 43c2a1e9b7..ac053037d8 100644 --- a/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_dipole_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp index 9416ede516..7de9ae2aa6 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_dipole_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 27924361f2..5656c2e18d 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp index 7c1bb74158..2bd7420e72 100644 --- a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp @@ -17,7 +17,7 @@ #include #include -#include + #include #include "pair_lj_cut_tip4p_long_gpu.h" #include "atom.h" diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.cpp b/src/GPU/pair_lj_expand_coul_long_gpu.cpp index 54eb4d47e6..f13eea51e7 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_expand_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_expand_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_expand_gpu.cpp b/src/GPU/pair_lj_expand_gpu.cpp index 32c35420a2..bdfa30b965 100644 --- a/src/GPU/pair_lj_expand_gpu.cpp +++ b/src/GPU/pair_lj_expand_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_expand_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_gromacs_gpu.cpp b/src/GPU/pair_lj_gromacs_gpu.cpp index d7122cb5f3..6d6abdb40d 100644 --- a/src/GPU/pair_lj_gromacs_gpu.cpp +++ b/src/GPU/pair_lj_gromacs_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_gromacs_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp index cd76bbd2e9..4054f08523 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_sdk_coul_long_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_sdk_gpu.cpp b/src/GPU/pair_lj_sdk_gpu.cpp index 5f07bdbb6c..2016d1db2c 100644 --- a/src/GPU/pair_lj_sdk_gpu.cpp +++ b/src/GPU/pair_lj_sdk_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_sdk_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp b/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp index a9ddf81bf0..e6834298f3 100644 --- a/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp +++ b/src/GPU/pair_lj_sf_dipole_sf_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_lj_sf_dipole_sf_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_mie_cut_gpu.cpp b/src/GPU/pair_mie_cut_gpu.cpp index 4db07ab79e..60e6e935e8 100644 --- a/src/GPU/pair_mie_cut_gpu.cpp +++ b/src/GPU/pair_mie_cut_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_mie_cut_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_morse_gpu.cpp b/src/GPU/pair_morse_gpu.cpp index fc966f6533..a256f500ce 100644 --- a/src/GPU/pair_morse_gpu.cpp +++ b/src/GPU/pair_morse_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_morse_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index 0bcabb451c..ca70e3c337 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_resquared_gpu.h" #include #include -#include + #include #include "math_extra.h" #include "atom.h" diff --git a/src/GPU/pair_soft_gpu.cpp b/src/GPU/pair_soft_gpu.cpp index 48a4f689ff..49c27f515d 100644 --- a/src/GPU/pair_soft_gpu.cpp +++ b/src/GPU/pair_soft_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_soft_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index 4c4502828d..d544534c9d 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_sw_gpu.h" #include #include -#include + #include #include "atom.h" #include "neighbor.h" diff --git a/src/GPU/pair_table_gpu.cpp b/src/GPU/pair_table_gpu.cpp index 858a2107dc..4ac674aa94 100644 --- a/src/GPU/pair_table_gpu.cpp +++ b/src/GPU/pair_table_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_table_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index d7b1ef5dd5..885dd73d9e 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_tersoff_gpu.h" #include #include -#include + #include #include "atom.h" #include "neighbor.h" diff --git a/src/GPU/pair_tersoff_mod_gpu.cpp b/src/GPU/pair_tersoff_mod_gpu.cpp index 1b35045902..35edd9ea22 100644 --- a/src/GPU/pair_tersoff_mod_gpu.cpp +++ b/src/GPU/pair_tersoff_mod_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_tersoff_mod_gpu.h" #include #include -#include + #include #include "atom.h" #include "neighbor.h" diff --git a/src/GPU/pair_tersoff_zbl_gpu.cpp b/src/GPU/pair_tersoff_zbl_gpu.cpp index ae50552f14..73251ee726 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.cpp +++ b/src/GPU/pair_tersoff_zbl_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_tersoff_zbl_gpu.h" #include #include -#include + #include #include "atom.h" #include "neighbor.h" diff --git a/src/GPU/pair_ufm_gpu.cpp b/src/GPU/pair_ufm_gpu.cpp index 2b4cc2269f..fe6adfef12 100644 --- a/src/GPU/pair_ufm_gpu.cpp +++ b/src/GPU/pair_ufm_gpu.cpp @@ -20,7 +20,7 @@ #include "pair_ufm_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index ccd2773130..868b8de0c0 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_vashishta_gpu.h" #include #include -#include + #include #include "atom.h" #include "neighbor.h" diff --git a/src/GPU/pair_yukawa_colloid_gpu.cpp b/src/GPU/pair_yukawa_colloid_gpu.cpp index c3439e3306..3c7b2f5ba7 100644 --- a/src/GPU/pair_yukawa_colloid_gpu.cpp +++ b/src/GPU/pair_yukawa_colloid_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_yukawa_colloid_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_yukawa_gpu.cpp b/src/GPU/pair_yukawa_gpu.cpp index b9b9d6e0a4..8147609f45 100644 --- a/src/GPU/pair_yukawa_gpu.cpp +++ b/src/GPU/pair_yukawa_gpu.cpp @@ -18,7 +18,7 @@ #include "pair_yukawa_gpu.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GPU/pair_zbl_gpu.cpp b/src/GPU/pair_zbl_gpu.cpp index d0cbfa1d7c..0472d9b7c1 100644 --- a/src/GPU/pair_zbl_gpu.cpp +++ b/src/GPU/pair_zbl_gpu.cpp @@ -19,7 +19,7 @@ #include "lmptype.h" #include #include -#include + #include #include "atom.h" #include "atom_vec.h" diff --git a/src/GRANULAR/fix_freeze.cpp b/src/GRANULAR/fix_freeze.cpp index 1df5c9d0a8..dd68aa032f 100644 --- a/src/GRANULAR/fix_freeze.cpp +++ b/src/GRANULAR/fix_freeze.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_freeze.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 73b42b9653..d449bb5614 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_pour.h" -#include + #include #include #include "atom.h" @@ -32,7 +32,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -65,9 +65,9 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : // required args - ninsert = force->inumeric(FLERR,arg[3]); - ntype = force->inumeric(FLERR,arg[4]); - seed = force->inumeric(FLERR,arg[5]); + ninsert = utils::inumeric(FLERR,arg[3],false,lmp); + ntype = utils::inumeric(FLERR,arg[4],false,lmp); + seed = utils::inumeric(FLERR,arg[5],false,lmp); if (seed <= 0) error->all(FLERR,"Illegal fix pour command"); @@ -930,9 +930,9 @@ void FixPour::options(int narg, char **arg) } else if (strcmp(arg[iarg],"molfrac") == 0) { if (mode != MOLECULE) error->all(FLERR,"Illegal fix pour command"); if (iarg+nmol+1 > narg) error->all(FLERR,"Illegal fix pour command"); - molfrac[0] = force->numeric(FLERR,arg[iarg+1]); + molfrac[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); for (int i = 1; i < nmol; i++) - molfrac[i] = molfrac[i-1] + force->numeric(FLERR,arg[iarg+i+1]); + molfrac[i] = molfrac[i-1] + utils::numeric(FLERR,arg[iarg+i+1],false,lmp); if (molfrac[nmol-1] < 1.0-EPSILON || molfrac[nmol-1] > 1.0+EPSILON) error->all(FLERR,"Illegal fix pour command"); molfrac[nmol-1] = 1.0; @@ -973,21 +973,21 @@ void FixPour::options(int narg, char **arg) if (strcmp(arg[iarg+1],"one") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); dstyle = ONE; - radius_one = 0.5 * force->numeric(FLERR,arg[iarg+2]); + radius_one = 0.5 * utils::numeric(FLERR,arg[iarg+2],false,lmp); radius_max = radius_one; iarg += 3; } else if (strcmp(arg[iarg+1],"range") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); dstyle = RANGE; - radius_lo = 0.5 * force->numeric(FLERR,arg[iarg+2]); - radius_hi = 0.5 * force->numeric(FLERR,arg[iarg+3]); + radius_lo = 0.5 * utils::numeric(FLERR,arg[iarg+2],false,lmp); + radius_hi = 0.5 * utils::numeric(FLERR,arg[iarg+3],false,lmp); if (radius_lo > radius_hi) error->all(FLERR,"Illegal fix pour command"); radius_max = radius_hi; iarg += 4; } else if (strcmp(arg[iarg+1],"poly") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); dstyle = POLY; - npoly = force->inumeric(FLERR,arg[iarg+2]); + npoly = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (npoly <= 0) error->all(FLERR,"Illegal fix pour command"); if (iarg+3 + 2*npoly > narg) error->all(FLERR,"Illegal fix pour command"); @@ -996,8 +996,8 @@ void FixPour::options(int narg, char **arg) iarg += 3; radius_max = 0.0; for (int i = 0; i < npoly; i++) { - radius_poly[i] = 0.5 * force->numeric(FLERR,arg[iarg++]); - frac_poly[i] = force->numeric(FLERR,arg[iarg++]); + radius_poly[i] = 0.5 * utils::numeric(FLERR,arg[iarg++],false,lmp); + frac_poly[i] = utils::numeric(FLERR,arg[iarg++],false,lmp); if (radius_poly[i] <= 0.0 || frac_poly[i] < 0.0) error->all(FLERR,"Illegal fix pour command"); radius_max = MAX(radius_max,radius_poly[i]); @@ -1010,35 +1010,35 @@ void FixPour::options(int narg, char **arg) } else if (strcmp(arg[iarg],"dens") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); - density_lo = force->numeric(FLERR,arg[iarg+1]); - density_hi = force->numeric(FLERR,arg[iarg+2]); + density_lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + density_hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (density_lo > density_hi) error->all(FLERR,"Illegal fix pour command"); iarg += 3; } else if (strcmp(arg[iarg],"vol") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); - volfrac = force->numeric(FLERR,arg[iarg+1]); - maxattempt = force->inumeric(FLERR,arg[iarg+2]); + volfrac = utils::numeric(FLERR,arg[iarg+1],false,lmp); + maxattempt = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"rate") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - rate = force->numeric(FLERR,arg[iarg+1]); + rate = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"vel") == 0) { if (domain->dimension == 3) { if (iarg+6 > narg) error->all(FLERR,"Illegal fix pour command"); - vxlo = force->numeric(FLERR,arg[iarg+1]); - vxhi = force->numeric(FLERR,arg[iarg+2]); - vylo = force->numeric(FLERR,arg[iarg+3]); - vyhi = force->numeric(FLERR,arg[iarg+4]); + vxlo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + vxhi = utils::numeric(FLERR,arg[iarg+2],false,lmp); + vylo = utils::numeric(FLERR,arg[iarg+3],false,lmp); + vyhi = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (vxlo > vxhi || vylo > vyhi) error->all(FLERR,"Illegal fix pour command"); - vz = force->numeric(FLERR,arg[iarg+5]); + vz = utils::numeric(FLERR,arg[iarg+5],false,lmp); iarg += 6; } else { if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); - vxlo = force->numeric(FLERR,arg[iarg+1]); - vxhi = force->numeric(FLERR,arg[iarg+2]); - vy = force->numeric(FLERR,arg[iarg+3]); + vxlo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + vxhi = utils::numeric(FLERR,arg[iarg+2],false,lmp); + vy = utils::numeric(FLERR,arg[iarg+3],false,lmp); vz = 0.0; if (vxlo > vxhi) error->all(FLERR,"Illegal fix pour command"); iarg += 4; diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index d7cbf0362a..9ec76b88f1 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -93,16 +93,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : size_history = 3; if (narg < 11) error->all(FLERR,"Illegal fix wall/gran command"); - kn = force->numeric(FLERR,arg[4]); + kn = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"NULL") == 0) kt = kn * 2.0/7.0; - else kt = force->numeric(FLERR,arg[5]); + else kt = utils::numeric(FLERR,arg[5],false,lmp); - gamman = force->numeric(FLERR,arg[6]); + gamman = utils::numeric(FLERR,arg[6],false,lmp); if (strcmp(arg[7],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = force->numeric(FLERR,arg[7]); + else gammat = utils::numeric(FLERR,arg[7],false,lmp); - xmu = force->numeric(FLERR,arg[8]); - int dampflag = force->inumeric(FLERR,arg[9]); + xmu = utils::numeric(FLERR,arg[8],false,lmp); + int dampflag = utils::inumeric(FLERR,arg[9],false,lmp); if (dampflag == 0) gammat = 0.0; if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || @@ -127,8 +127,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix wall/gran command, " "not enough parameters provided for Hooke option"); normal_model = NORMAL_HOOKE; - normal_coeffs[0] = force->numeric(FLERR,arg[iarg+1]); //kn - normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping + normal_coeffs[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); //kn + normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping iarg += 3; } else if (strcmp(arg[iarg], "hertz") == 0) { int num_coeffs = 2; @@ -136,8 +136,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix wall/gran command, " "not enough parameters provided for Hertz option"); normal_model = NORMAL_HERTZ; - normal_coeffs[0] = force->numeric(FLERR,arg[iarg+1]); //kn - normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping + normal_coeffs[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); //kn + normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping iarg += num_coeffs+1; } else if (strcmp(arg[iarg], "hertz/material") == 0) { int num_coeffs = 3; @@ -145,9 +145,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix wall/gran command, " "not enough parameters provided for Hertz option"); normal_model = HERTZ_MATERIAL; - Emod = force->numeric(FLERR,arg[iarg+1]); //E - normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping - poiss = force->numeric(FLERR,arg[iarg+3]); //Poisson's ratio + Emod = utils::numeric(FLERR,arg[iarg+1],false,lmp); //E + normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping + poiss = utils::numeric(FLERR,arg[iarg+3],false,lmp); //Poisson's ratio normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS; normal_coeffs[2] = poiss; iarg += num_coeffs+1; @@ -156,24 +156,24 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix wall/gran command, " "not enough parameters provided for Hertz option"); normal_model = DMT; - Emod = force->numeric(FLERR,arg[iarg+1]); //E - normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping - poiss = force->numeric(FLERR,arg[iarg+3]); //Poisson's ratio + Emod = utils::numeric(FLERR,arg[iarg+1],false,lmp); //E + normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping + poiss = utils::numeric(FLERR,arg[iarg+3],false,lmp); //Poisson's ratio normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS; normal_coeffs[2] = poiss; - normal_coeffs[3] = force->numeric(FLERR,arg[iarg+4]); //cohesion + normal_coeffs[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); //cohesion iarg += 5; } else if (strcmp(arg[iarg], "jkr") == 0) { if (iarg + 4 >= narg) error->all(FLERR,"Illegal wall/gran command, " "not enough parameters provided for JKR option"); normal_model = JKR; - Emod = force->numeric(FLERR,arg[iarg+1]); //E - normal_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); //damping - poiss = force->numeric(FLERR,arg[iarg+3]); //Poisson's ratio + Emod = utils::numeric(FLERR,arg[iarg+1],false,lmp); //E + normal_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //damping + poiss = utils::numeric(FLERR,arg[iarg+3],false,lmp); //Poisson's ratio normal_coeffs[0] = Emod/(2*(1-poiss))*FOURTHIRDS; normal_coeffs[2] = poiss; - normal_coeffs[3] = force->numeric(FLERR,arg[iarg+4]); //cohesion + normal_coeffs[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); //cohesion iarg += 5; } else if (strcmp(arg[iarg], "damping") == 0) { if (iarg+1 >= narg) @@ -205,8 +205,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : tangential_model = TANGENTIAL_NOHISTORY; tangential_coeffs[0] = 0; // gammat and friction coeff - tangential_coeffs[1] = force->numeric(FLERR,arg[iarg+2]); - tangential_coeffs[2] = force->numeric(FLERR,arg[iarg+3]); + tangential_coeffs[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + tangential_coeffs[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || (strcmp(arg[iarg+1], "mindlin") == 0) || @@ -230,12 +230,12 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : } tangential_coeffs[0] = Emod/4*(2-poiss)*(1+poiss); } else { - tangential_coeffs[0] = force->numeric(FLERR,arg[iarg+2]); //kt + tangential_coeffs[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //kt } tangential_history = 1; // gammat and friction coeff - tangential_coeffs[1] = force->numeric(FLERR,arg[iarg+3]); - tangential_coeffs[2] = force->numeric(FLERR,arg[iarg+4]); + tangential_coeffs[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + tangential_coeffs[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else { error->all(FLERR, "Illegal pair_coeff command, " @@ -254,9 +254,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : roll_model = ROLL_SDS; roll_history = 1; // kR, gammaR, rolling friction coeff - roll_coeffs[0] = force->numeric(FLERR,arg[iarg+2]); - roll_coeffs[1] = force->numeric(FLERR,arg[iarg+3]); - roll_coeffs[2] = force->numeric(FLERR,arg[iarg+4]); + roll_coeffs[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + roll_coeffs[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + roll_coeffs[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else { error->all(FLERR, "Illegal wall/gran command, " @@ -278,9 +278,9 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : "not enough parameters provided for twist model"); twist_model = TWIST_SDS; twist_history = 1; - twist_coeffs[0] = force->numeric(FLERR,arg[iarg+2]); //kt - twist_coeffs[1] = force->numeric(FLERR,arg[iarg+3]); //gammat - twist_coeffs[2] = force->numeric(FLERR,arg[iarg+4]); //friction coeff. + twist_coeffs[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); //kt + twist_coeffs[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); //gammat + twist_coeffs[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); //friction coeff. iarg += 5; } else { error->all(FLERR, "Illegal wall/gran command, " @@ -309,31 +309,31 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = XPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"yplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = YPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"zplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = ZPLANE; if (strcmp(arg[iarg+1],"NULL") == 0) lo = -BIG; - else lo = force->numeric(FLERR,arg[iarg+1]); + else lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"NULL") == 0) hi = BIG; - else hi = force->numeric(FLERR,arg[iarg+2]); + else hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"zcylinder") == 0) { if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); wallstyle = ZCYLINDER; lo = hi = 0.0; - cylradius = force->numeric(FLERR,arg[iarg+1]); + cylradius = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"region") == 0) { if (narg < iarg+2) error->all(FLERR,"Illegal fix wall/gran command"); @@ -357,8 +357,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else error->all(FLERR,"Illegal fix wall/gran command"); - amplitude = force->numeric(FLERR,arg[iarg+2]); - period = force->numeric(FLERR,arg[iarg+3]); + amplitude = utils::numeric(FLERR,arg[iarg+2],false,lmp); + period = utils::numeric(FLERR,arg[iarg+3],false,lmp); wiggle = 1; iarg += 4; } else if (strcmp(arg[iarg],"shear") == 0) { @@ -367,7 +367,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"y") == 0) axis = 1; else if (strcmp(arg[iarg+1],"z") == 0) axis = 2; else error->all(FLERR,"Illegal fix wall/gran command"); - vshear = force->numeric(FLERR,arg[iarg+2]); + vshear = utils::numeric(FLERR,arg[iarg+2],false,lmp); wshear = 1; iarg += 3; } else if (strcmp(arg[iarg],"contacts") == 0) { diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index 4a362c0928..89230f26bf 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -279,16 +279,16 @@ void PairGranHertzHistory::settings(int narg, char **arg) { if (narg != 6) error->all(FLERR,"Illegal pair_style command"); - kn = force->numeric(FLERR,arg[0]); + kn = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; - else kt = force->numeric(FLERR,arg[1]); + else kt = utils::numeric(FLERR,arg[1],false,lmp); - gamman = force->numeric(FLERR,arg[2]); + gamman = utils::numeric(FLERR,arg[2],false,lmp); if (strcmp(arg[3],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = force->numeric(FLERR,arg[3]); + else gammat = utils::numeric(FLERR,arg[3],false,lmp); - xmu = force->numeric(FLERR,arg[4]); - dampflag = force->inumeric(FLERR,arg[5]); + xmu = utils::numeric(FLERR,arg[4],false,lmp); + dampflag = utils::inumeric(FLERR,arg[5],false,lmp); if (dampflag == 0) gammat = 0.0; if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index af46d813ca..68a7803f4b 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -16,10 +16,10 @@ ------------------------------------------------------------------------- */ #include "pair_gran_hooke_history.h" -#include + #include #include -#include + #include "atom.h" #include "force.h" #include "update.h" @@ -33,7 +33,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -358,16 +358,16 @@ void PairGranHookeHistory::settings(int narg, char **arg) { if (narg != 6) error->all(FLERR,"Illegal pair_style command"); - kn = force->numeric(FLERR,arg[0]); + kn = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"NULL") == 0) kt = kn * 2.0/7.0; - else kt = force->numeric(FLERR,arg[1]); + else kt = utils::numeric(FLERR,arg[1],false,lmp); - gamman = force->numeric(FLERR,arg[2]); + gamman = utils::numeric(FLERR,arg[2],false,lmp); if (strcmp(arg[3],"NULL") == 0) gammat = 0.5 * gamman; - else gammat = force->numeric(FLERR,arg[3]); + else gammat = utils::numeric(FLERR,arg[3],false,lmp); - xmu = force->numeric(FLERR,arg[4]); - dampflag = force->inumeric(FLERR,arg[5]); + xmu = utils::numeric(FLERR,arg[4],false,lmp); + dampflag = utils::inumeric(FLERR,arg[5],false,lmp); if (dampflag == 0) gammat = 0.0; if (kn < 0.0 || kt < 0.0 || gamman < 0.0 || gammat < 0.0 || @@ -385,8 +385,8 @@ void PairGranHookeHistory::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index 8bf2d1bf17..ee0eb2ad77 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -18,10 +18,10 @@ ----------------------------------------------------------------------- */ #include "pair_granular.h" -#include + #include #include -#include + #include "atom.h" #include "force.h" #include "update.h" @@ -37,7 +37,7 @@ #include "error.h" #include "math_const.h" #include "math_special.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -753,7 +753,7 @@ void PairGranular::allocate() void PairGranular::settings(int narg, char **arg) { if (narg == 1) { - cutoff_global = force->numeric(FLERR,arg[0]); + cutoff_global = utils::numeric(FLERR,arg[0],false,lmp); } else { cutoff_global = -1; // will be set based on particle sizes, model choice } @@ -784,8 +784,8 @@ void PairGranular::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); //Defaults normal_model_one = tangential_model_one = -1; @@ -800,35 +800,35 @@ void PairGranular::coeff(int narg, char **arg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for Hooke option"); normal_model_one = HOOKE; - normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); // kn - normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); // damping + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping iarg += 3; } else if (strcmp(arg[iarg], "hertz") == 0) { if (iarg + 2 >= narg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for Hertz option"); normal_model_one = HERTZ; - normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); // kn - normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); // damping + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // kn + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping iarg += 3; } else if (strcmp(arg[iarg], "hertz/material") == 0) { if (iarg + 3 >= narg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for Hertz/material option"); normal_model_one = HERTZ_MATERIAL; - normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); // E - normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); // damping - normal_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); // Poisson's ratio + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio iarg += 4; } else if (strcmp(arg[iarg], "dmt") == 0) { if (iarg + 4 >= narg) error->all(FLERR,"Illegal pair_coeff command, " "not enough parameters provided for Hertz option"); normal_model_one = DMT; - normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); // E - normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); // damping - normal_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); // Poisson's ratio - normal_coeffs_one[3] = force->numeric(FLERR,arg[iarg+4]); // cohesion + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio + normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion iarg += 5; } else if (strcmp(arg[iarg], "jkr") == 0) { if (iarg + 4 >= narg) @@ -836,10 +836,10 @@ void PairGranular::coeff(int narg, char **arg) "not enough parameters provided for JKR option"); beyond_contact = 1; normal_model_one = JKR; - normal_coeffs_one[0] = force->numeric(FLERR,arg[iarg+1]); // E - normal_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); // damping - normal_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); // Poisson's ratio - normal_coeffs_one[3] = force->numeric(FLERR,arg[iarg+4]); // cohesion + normal_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); // E + normal_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // damping + normal_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); // Poisson's ratio + normal_coeffs_one[3] = utils::numeric(FLERR,arg[iarg+4],false,lmp); // cohesion iarg += 5; } else if (strcmp(arg[iarg], "damping") == 0) { if (iarg+1 >= narg) @@ -871,8 +871,8 @@ void PairGranular::coeff(int narg, char **arg) tangential_model_one = TANGENTIAL_NOHISTORY; tangential_coeffs_one[0] = 0; // gammat and friction coeff - tangential_coeffs_one[1] = force->numeric(FLERR,arg[iarg+2]); - tangential_coeffs_one[2] = force->numeric(FLERR,arg[iarg+3]); + tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if ((strcmp(arg[iarg+1], "linear_history") == 0) || (strcmp(arg[iarg+1], "mindlin") == 0) || @@ -905,11 +905,11 @@ void PairGranular::coeff(int narg, char **arg) } tangential_coeffs_one[0] = -1; } else { - tangential_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); // kt + tangential_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); // kt } // gammat and friction coeff - tangential_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); - tangential_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); + tangential_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + tangential_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else { error->all(FLERR, "Illegal pair_coeff command, " @@ -928,9 +928,9 @@ void PairGranular::coeff(int narg, char **arg) roll_model_one = ROLL_SDS; roll_history = 1; // kR and gammaR and rolling friction coeff - roll_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); - roll_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); - roll_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); + roll_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + roll_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + roll_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else { error->all(FLERR, "Illegal pair_coeff command, " @@ -953,9 +953,9 @@ void PairGranular::coeff(int narg, char **arg) twist_model_one = TWIST_SDS; twist_history = 1; // kt and gammat and friction coeff - twist_coeffs_one[0] = force->numeric(FLERR,arg[iarg+2]); - twist_coeffs_one[1] = force->numeric(FLERR,arg[iarg+3]); - twist_coeffs_one[2] = force->numeric(FLERR,arg[iarg+4]); + twist_coeffs_one[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + twist_coeffs_one[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + twist_coeffs_one[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else { error->all(FLERR, "Illegal pair_coeff command, " @@ -964,7 +964,7 @@ void PairGranular::coeff(int narg, char **arg) } else if (strcmp(arg[iarg], "cutoff") == 0) { if (iarg + 1 >= narg) error->all(FLERR, "Illegal pair_coeff command, not enough parameters"); - cutoff_one = force->numeric(FLERR,arg[iarg+1]); + cutoff_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR, "Illegal pair coeff command"); } diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 5e3bd934a9..684108be71 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -57,24 +57,19 @@ ------------------------------------------------------------------------- */ #include "kim_init.h" -#include "fix_store_kim.h" -#include "kim_units.h" -#include -#include -#include -#include -#include "error.h" -#include "atom.h" + +#include "citeme.h" #include "comm.h" #include "domain.h" -#include "modify.h" -#include "update.h" -#include "universe.h" +#include "error.h" +#include "fix_store_kim.h" #include "input.h" +#include "kim_units.h" +#include "modify.h" +#include "universe.h" #include "variable.h" -#include "citeme.h" -#include "utils.h" -#include "fmt/format.h" + +#include extern "C" { #include "KIM_SimulatorHeaders.h" diff --git a/src/KIM/kim_init.h b/src/KIM/kim_init.h index 3311d4e13d..8fa3247b22 100644 --- a/src/KIM/kim_init.h +++ b/src/KIM/kim_init.h @@ -66,7 +66,6 @@ CommandStyle(kim_init,KimInit) #define LMP_KIM_INIT_H #include "pointers.h" -#include // Forward declaration. typedef struct KIM_Model KIM_Model; diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index a91c615d09..5f45dd34dc 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -57,23 +57,18 @@ ------------------------------------------------------------------------- */ #include "kim_interactions.h" -#include -#include -#include -#include -#include -#include "error.h" + #include "atom.h" #include "comm.h" #include "domain.h" +#include "error.h" +#include "fix_store_kim.h" +#include "input.h" #include "modify.h" #include "update.h" -#include "universe.h" -#include "input.h" -#include "variable.h" -#include "utils.h" -#include "fix_store_kim.h" -#include "fmt/format.h" + +#include +#include extern "C" { #include "KIM_SimulatorHeaders.h" diff --git a/src/KIM/kim_interactions.h b/src/KIM/kim_interactions.h index 414c7b39d5..071e5b284f 100644 --- a/src/KIM/kim_interactions.h +++ b/src/KIM/kim_interactions.h @@ -66,7 +66,6 @@ CommandStyle(kim_interactions,KimInteractions) #define LMP_KIM_INTERACTIONS_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 6df8c075dc..6f4ac5cc21 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -56,19 +56,17 @@ ------------------------------------------------------------------------- */ #include "kim_param.h" -#include "fix_store_kim.h" -#include "pair_kim.h" -#include -#include -#include -#include -#include "comm.h" + #include "error.h" +#include "fix_store_kim.h" +#include "force.h" #include "input.h" #include "modify.h" +#include "pair_kim.h" #include "variable.h" -#include "force.h" -#include "fmt/format.h" + +#include +#include extern "C" { diff --git a/src/KIM/kim_param.h b/src/KIM/kim_param.h index a4e26451f2..e4fc5ce59a 100644 --- a/src/KIM/kim_param.h +++ b/src/KIM/kim_param.h @@ -65,7 +65,6 @@ CommandStyle(kim_param, KimParam) #define LMP_KIM_PARAM_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index 643e0da47b..95a1274859 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -53,21 +53,18 @@ Designed for use with the kim-api-2.1.0 (and newer) package ------------------------------------------------------------------------- */ -#if LMP_PYTHON -#define PY_SSIZE_T_CLEAN -#include -#endif - #include "kim_property.h" #include "comm.h" -#include "input.h" -#include "variable.h" -#include "utils.h" #include "error.h" +#include "input.h" #include "lmppython.h" +#include "variable.h" -#include +#if LMP_PYTHON +#define PY_SSIZE_T_CLEAN +#include // IWYU pragma: export +#endif using namespace LAMMPS_NS; diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index 4a1db9450d..ec13210665 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -56,24 +56,22 @@ ------------------------------------------------------------------------- */ #include "kim_query.h" -#include "fix_store_kim.h" -#include -#include -#include -#include + #include "comm.h" #include "error.h" +#include "fix_store_kim.h" +#include "info.h" #include "input.h" #include "modify.h" #include "variable.h" #include "version.h" -#include "info.h" -#include "fmt/format.h" + +#include +#include #if defined(LMP_KIM_CURL) #include #include -#include #endif using namespace LAMMPS_NS; diff --git a/src/KIM/kim_query.h b/src/KIM/kim_query.h index 6888f911f4..e1c49ed71d 100644 --- a/src/KIM/kim_query.h +++ b/src/KIM/kim_query.h @@ -64,7 +64,6 @@ CommandStyle(kim_query,KimQuery) #define LMP_KIM_QUERY_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/src/KIM/kim_units.cpp b/src/KIM/kim_units.cpp index c0c1aee07c..77dbad6f1d 100644 --- a/src/KIM/kim_units.cpp +++ b/src/KIM/kim_units.cpp @@ -57,6 +57,8 @@ #include #include #include +#include + using namespace std; namespace diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 7d2333aab1..7ed70972c5 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -55,21 +55,20 @@ Designed for use with the kim-api-2.0.2 (and newer) package ------------------------------------------------------------------------- */ #include "pair_kim.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" #include "update.h" -#include "memory.h" -#include "domain.h" -#include "utils.h" -#include "error.h" + +#include +#include using namespace LAMMPS_NS; @@ -343,8 +342,8 @@ void PairKIM::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom species to KIM elements // lmps_map_species_to_unique[i] = diff --git a/src/KIM/pair_kim.h b/src/KIM/pair_kim.h index 1f2c8c8599..0c2e8d2684 100644 --- a/src/KIM/pair_kim.h +++ b/src/KIM/pair_kim.h @@ -65,7 +65,6 @@ PairStyle(kim,PairKIM) // includes from KIM & LAMMPS class KIM_API_model; #include "pair.h" -#include extern "C" { #include "KIM_SimulatorHeaders.h" diff --git a/src/KOKKOS/angle_charmm_kokkos.cpp b/src/KOKKOS/angle_charmm_kokkos.cpp index 288e5a475b..59ccac92ce 100644 --- a/src/KOKKOS/angle_charmm_kokkos.cpp +++ b/src/KOKKOS/angle_charmm_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "angle_charmm_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "force.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/angle_class2_kokkos.cpp b/src/KOKKOS/angle_class2_kokkos.cpp index ebb016b31b..bfa0f81a1d 100644 --- a/src/KOKKOS/angle_class2_kokkos.cpp +++ b/src/KOKKOS/angle_class2_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "angle_class2_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "force.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/angle_cosine_kokkos.cpp b/src/KOKKOS/angle_cosine_kokkos.cpp index 960988b3b5..cf93bfbde5 100644 --- a/src/KOKKOS/angle_cosine_kokkos.cpp +++ b/src/KOKKOS/angle_cosine_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "angle_cosine_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "force.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/angle_harmonic_kokkos.cpp b/src/KOKKOS/angle_harmonic_kokkos.cpp index bc08ff4b65..3a8878d222 100644 --- a/src/KOKKOS/angle_harmonic_kokkos.cpp +++ b/src/KOKKOS/angle_harmonic_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "angle_harmonic_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "force.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/atom_kokkos.h b/src/KOKKOS/atom_kokkos.h index ce480f6f9d..6eebbad661 100644 --- a/src/KOKKOS/atom_kokkos.h +++ b/src/KOKKOS/atom_kokkos.h @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "atom.h" +#include "atom.h" // IWYU pragma: export #include "kokkos_type.h" #ifndef LMP_ATOM_KOKKOS_H diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index e9fee6d8f6..662f09fe5a 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "atom_vec_angle_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "modify.h" -#include "fix.h" -#include "atom_masks.h" -#include "memory_kokkos.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "memory_kokkos.h" +#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.cpp b/src/KOKKOS/atom_vec_atomic_kokkos.cpp index 7a66dc753a..995985b29d 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.cpp +++ b/src/KOKKOS/atom_vec_atomic_kokkos.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "atom_vec_atomic_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "modify.h" -#include "fix.h" -#include "atom_masks.h" -#include "memory_kokkos.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "memory_kokkos.h" +#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_bond_kokkos.cpp b/src/KOKKOS/atom_vec_bond_kokkos.cpp index 157f194125..db56d58dff 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.cpp +++ b/src/KOKKOS/atom_vec_bond_kokkos.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "atom_vec_bond_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "modify.h" -#include "fix.h" -#include "atom_masks.h" -#include "memory_kokkos.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "memory_kokkos.h" +#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_charge_kokkos.cpp b/src/KOKKOS/atom_vec_charge_kokkos.cpp index 8f468b8e46..9846d2f4f8 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.cpp +++ b/src/KOKKOS/atom_vec_charge_kokkos.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "atom_vec_charge_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "modify.h" -#include "fix.h" -#include "atom_masks.h" -#include "memory_kokkos.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "memory_kokkos.h" +#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.cpp b/src/KOKKOS/atom_vec_dpd_kokkos.cpp index 5319744c22..b112605859 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.cpp +++ b/src/KOKKOS/atom_vec_dpd_kokkos.cpp @@ -20,7 +20,7 @@ #include "atom_masks.h" #include "memory_kokkos.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_full_kokkos.cpp b/src/KOKKOS/atom_vec_full_kokkos.cpp index 5d5833af07..89275c7067 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.cpp +++ b/src/KOKKOS/atom_vec_full_kokkos.cpp @@ -20,7 +20,7 @@ #include "atom_masks.h" #include "memory_kokkos.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp index 0cc609f91c..7c7f3c9826 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "atom_vec_hybrid_kokkos.h" -#include + #include "atom_kokkos.h" +#include "atom_masks.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "utils.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; @@ -1177,7 +1178,7 @@ void AtomVecHybridKokkos::build_styles() allstyles[nallstyles] = new char[n]; \ strcpy(allstyles[nallstyles],#key); \ nallstyles++; -#include "style_atom.h" +#include "style_atom.h" // IWYU pragma: keep #undef AtomStyle #undef ATOM_CLASS } diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index b0fca4e316..9e39f53733 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -12,11 +12,11 @@ ------------------------------------------------------------------------- */ #include "atom_vec_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "atom_masks.h" -#include "utils.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_kokkos.h b/src/KOKKOS/atom_vec_kokkos.h index 7d8796b1ae..d414101966 100644 --- a/src/KOKKOS/atom_vec_kokkos.h +++ b/src/KOKKOS/atom_vec_kokkos.h @@ -14,7 +14,8 @@ #ifndef LMP_ATOM_VEC_KOKKOS_H #define LMP_ATOM_VEC_KOKKOS_H -#include "atom_vec.h" +#include "atom_vec.h" // IWYU pragma: export + #include "kokkos_type.h" #include diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.cpp b/src/KOKKOS/atom_vec_molecular_kokkos.cpp index 7832d6f9b0..7e3cdbf5e3 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.cpp +++ b/src/KOKKOS/atom_vec_molecular_kokkos.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "atom_vec_molecular_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "modify.h" -#include "fix.h" -#include "atom_masks.h" -#include "memory_kokkos.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "memory_kokkos.h" +#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.cpp b/src/KOKKOS/atom_vec_sphere_kokkos.cpp index b1099d0fa6..6b62014e4a 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.cpp +++ b/src/KOKKOS/atom_vec_sphere_kokkos.cpp @@ -12,27 +12,26 @@ ------------------------------------------------------------------------- */ #include "atom_vec_sphere_kokkos.h" -#include -#include + #include "atom_kokkos.h" #include "atom_masks.h" #include "comm_kokkos.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_adapt.h" #include "math_const.h" #include "memory.h" -#include "error.h" #include "memory_kokkos.h" -#include "utils.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; +using namespace MathConst; #define DELTA 10 -static const double MY_PI = 3.14159265358979323846; // pi - /* ---------------------------------------------------------------------- */ AtomVecSphereKokkos::AtomVecSphereKokkos(LAMMPS *lmp) : AtomVecKokkos(lmp) diff --git a/src/KOKKOS/bond_class2_kokkos.cpp b/src/KOKKOS/bond_class2_kokkos.cpp index 88504608f6..07712df203 100644 --- a/src/KOKKOS/bond_class2_kokkos.cpp +++ b/src/KOKKOS/bond_class2_kokkos.cpp @@ -16,16 +16,15 @@ ------------------------------------------------------------------------- */ #include "bond_class2_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "force.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/bond_fene_kokkos.cpp b/src/KOKKOS/bond_fene_kokkos.cpp index e6aa27649f..1ee82476b2 100644 --- a/src/KOKKOS/bond_fene_kokkos.cpp +++ b/src/KOKKOS/bond_fene_kokkos.cpp @@ -16,16 +16,16 @@ ------------------------------------------------------------------------- */ #include "bond_fene_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/bond_harmonic_kokkos.cpp b/src/KOKKOS/bond_harmonic_kokkos.cpp index ee1b58c91f..20b8778463 100644 --- a/src/KOKKOS/bond_harmonic_kokkos.cpp +++ b/src/KOKKOS/bond_harmonic_kokkos.cpp @@ -16,20 +16,18 @@ ------------------------------------------------------------------------- */ #include "bond_harmonic_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "force.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index 8f865f6459..51ba6bbdb2 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -12,23 +12,24 @@ ------------------------------------------------------------------------- */ #include "comm_kokkos.h" -#include "kokkos.h" + #include "atom.h" #include "atom_kokkos.h" +#include "atom_masks.h" #include "atom_vec.h" #include "atom_vec_kokkos.h" -#include "domain.h" -#include "atom_masks.h" -#include "error.h" -#include "memory_kokkos.h" -#include "force.h" -#include "pair.h" -#include "fix.h" #include "compute.h" +#include "domain.h" #include "dump.h" -#include "output.h" -#include "modify.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "kokkos.h" #include "kokkos_base.h" +#include "memory_kokkos.h" +#include "modify.h" +#include "output.h" +#include "pair.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/comm_tiled_kokkos.cpp b/src/KOKKOS/comm_tiled_kokkos.cpp index a29d9f63b3..88d3d1ac8c 100644 --- a/src/KOKKOS/comm_tiled_kokkos.cpp +++ b/src/KOKKOS/comm_tiled_kokkos.cpp @@ -12,22 +12,10 @@ ------------------------------------------------------------------------- */ #include "comm_tiled_kokkos.h" -#include -#include "comm_brick.h" + #include "atom_kokkos.h" -#include "atom_vec.h" -#include "domain.h" -#include "force.h" -#include "pair.h" -#include "neighbor.h" -#include "modify.h" -#include "fix.h" -#include "compute.h" -#include "output.h" -#include "dump.h" -#include "memory_kokkos.h" -#include "error.h" #include "atom_masks.h" +#include "atom_vec.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/compute_coord_atom_kokkos.cpp b/src/KOKKOS/compute_coord_atom_kokkos.cpp index 90bd151b2d..c1f9324942 100644 --- a/src/KOKKOS/compute_coord_atom_kokkos.cpp +++ b/src/KOKKOS/compute_coord_atom_kokkos.cpp @@ -12,22 +12,18 @@ ------------------------------------------------------------------------- */ #include "compute_coord_atom_kokkos.h" -#include -#include -#include "compute_orientorder_atom_kokkos.h" + #include "atom_kokkos.h" -#include "update.h" +#include "atom_masks.h" +#include "comm.h" +#include "compute_orientorder_atom_kokkos.h" +#include "error.h" +#include "memory_kokkos.h" #include "modify.h" -#include "neighbor_kokkos.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "pair.h" -#include "comm.h" -#include "group.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neighbor_kokkos.h" +#include "update.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp index b17434d09a..6e35dfd94f 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.cpp +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.cpp @@ -16,23 +16,19 @@ ------------------------------------------------------------------------- */ #include "compute_orientorder_atom_kokkos.h" -#include -#include -#include + #include "atom_kokkos.h" -#include "update.h" -#include "modify.h" -#include "neighbor_kokkos.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" -#include "pair.h" -#include "comm.h" -#include "memory_kokkos.h" -#include "error.h" -#include "math_const.h" #include "atom_masks.h" #include "kokkos.h" +#include "math_const.h" +#include "memory_kokkos.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor_kokkos.h" +#include "pair.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/compute_temp_kokkos.cpp b/src/KOKKOS/compute_temp_kokkos.cpp index 0e7fe25540..5e60d62be1 100644 --- a/src/KOKKOS/compute_temp_kokkos.cpp +++ b/src/KOKKOS/compute_temp_kokkos.cpp @@ -12,16 +12,15 @@ ------------------------------------------------------------------------- */ #include "compute_temp_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "update.h" -#include "force.h" -#include "domain.h" -#include "comm.h" -#include "group.h" -#include "error.h" #include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/dihedral_charmm_kokkos.cpp b/src/KOKKOS/dihedral_charmm_kokkos.cpp index 0d8256f306..88b5e1344d 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.cpp +++ b/src/KOKKOS/dihedral_charmm_kokkos.cpp @@ -16,19 +16,18 @@ ------------------------------------------------------------------------- */ #include "dihedral_charmm_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "comm.h" -#include "neighbor_kokkos.h" -#include "domain.h" +#include "atom_masks.h" +#include "error.h" #include "force.h" -#include "pair.h" +#include "kokkos.h" #include "math_const.h" #include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "kokkos.h" +#include "neighbor_kokkos.h" +#include "pair.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/dihedral_class2_kokkos.cpp b/src/KOKKOS/dihedral_class2_kokkos.cpp index 371af44e9a..156a13c2ec 100644 --- a/src/KOKKOS/dihedral_class2_kokkos.cpp +++ b/src/KOKKOS/dihedral_class2_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "dihedral_class2_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "comm.h" -#include "neighbor_kokkos.h" -#include "domain.h" -#include "force.h" -#include "update.h" -#include "memory_kokkos.h" -#include "error.h" #include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory_kokkos.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/dihedral_harmonic_kokkos.cpp b/src/KOKKOS/dihedral_harmonic_kokkos.cpp index 408fa276e4..d4855b10c1 100644 --- a/src/KOKKOS/dihedral_harmonic_kokkos.cpp +++ b/src/KOKKOS/dihedral_harmonic_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "dihedral_harmonic_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "comm.h" -#include "neighbor_kokkos.h" -#include "domain.h" -#include "force.h" -#include "update.h" -#include "memory_kokkos.h" -#include "error.h" #include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory_kokkos.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/dihedral_opls_kokkos.cpp b/src/KOKKOS/dihedral_opls_kokkos.cpp index 309d617f0a..42874936f9 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.cpp +++ b/src/KOKKOS/dihedral_opls_kokkos.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "dihedral_opls_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "comm.h" -#include "neighbor_kokkos.h" -#include "domain.h" -#include "force.h" -#include "update.h" -#include "memory_kokkos.h" -#include "error.h" #include "atom_masks.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory_kokkos.h" +#include "neighbor_kokkos.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/domain_kokkos.h b/src/KOKKOS/domain_kokkos.h index eccc36a021..3bfdeb708b 100644 --- a/src/KOKKOS/domain_kokkos.h +++ b/src/KOKKOS/domain_kokkos.h @@ -14,7 +14,7 @@ #ifndef LMP_DOMAIN_KOKKOS_H #define LMP_DOMAIN_KOKKOS_H -#include "domain.h" +#include "domain.h" // IWYU pragma: export #include "kokkos_type.h" #include "kokkos_few.h" diff --git a/src/KOKKOS/fft3d_kokkos.cpp b/src/KOKKOS/fft3d_kokkos.cpp index e49d780040..ff95998e4e 100644 --- a/src/KOKKOS/fft3d_kokkos.cpp +++ b/src/KOKKOS/fft3d_kokkos.cpp @@ -14,16 +14,13 @@ /* ---------------------------------------------------------------------- Contributing authors: Stan Moore (SNL), Sam Mish (U.C. Davis) ------------------------------------------------------------------------- */ - -#include -#include -#include -#include #include "fft3d_kokkos.h" -#include "remap_kokkos.h" + #include "error.h" #include "kokkos.h" +#include "remap_kokkos.h" +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/fix_deform_kokkos.cpp b/src/KOKKOS/fix_deform_kokkos.cpp index 05eb1c22f6..87d860b5ae 100644 --- a/src/KOKKOS/fix_deform_kokkos.cpp +++ b/src/KOKKOS/fix_deform_kokkos.cpp @@ -16,23 +16,22 @@ ------------------------------------------------------------------------- */ #include "fix_deform_kokkos.h" -#include -#include -#include + #include "atom_kokkos.h" -#include "update.h" -#include "comm.h" -#include "irregular.h" -#include "domain_kokkos.h" -#include "lattice.h" -#include "force.h" -#include "modify.h" -#include "math_const.h" -#include "kspace.h" -#include "input.h" -#include "variable.h" -#include "error.h" #include "atom_masks.h" +#include "domain_kokkos.h" +#include "error.h" +#include "force.h" +#include "input.h" +#include "irregular.h" +#include "kspace.h" +#include "math_const.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_gravity_kokkos.cpp b/src/KOKKOS/fix_gravity_kokkos.cpp index 4f8b57365e..7d413a1d57 100644 --- a/src/KOKKOS/fix_gravity_kokkos.cpp +++ b/src/KOKKOS/fix_gravity_kokkos.cpp @@ -12,13 +12,14 @@ ------------------------------------------------------------------------- */ #include "fix_gravity_kokkos.h" -#include "atom_masks.h" -#include "modify.h" -#include "input.h" -#include "variable.h" -#include "update.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "atom_vec.h" +#include "input.h" +#include "modify.h" +#include "update.h" +#include "variable.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index 44ae18f9a9..dadf9e4c8b 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -12,21 +12,22 @@ ------------------------------------------------------------------------- */ #include "fix_langevin_kokkos.h" -#include -#include "atom_masks.h" + #include "atom_kokkos.h" +#include "atom_masks.h" +#include "comm.h" +#include "compute.h" +#include "error.h" #include "force.h" #include "group.h" -#include "update.h" -#include "error.h" -#include "memory_kokkos.h" -#include "compute.h" -#include "comm.h" -#include "modify.h" #include "input.h" -#include "region.h" +#include "memory_kokkos.h" +#include "modify.h" +#include "update.h" #include "variable.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_minimize_kokkos.cpp b/src/KOKKOS/fix_minimize_kokkos.cpp index e7b10dbb8e..13b9cb02a7 100644 --- a/src/KOKKOS/fix_minimize_kokkos.cpp +++ b/src/KOKKOS/fix_minimize_kokkos.cpp @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #include "fix_minimize_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "domain.h" #include "memory_kokkos.h" -#include "atom_masks.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_momentum_kokkos.cpp b/src/KOKKOS/fix_momentum_kokkos.cpp index 9c9d6cb1cd..be486bf752 100644 --- a/src/KOKKOS/fix_momentum_kokkos.cpp +++ b/src/KOKKOS/fix_momentum_kokkos.cpp @@ -12,17 +12,16 @@ ------------------------------------------------------------------------- */ #include "fix_momentum_kokkos.h" -#include -#include + #include "atom_kokkos.h" #include "atom_masks.h" -#include "domain.h" #include "domain_kokkos.h" #include "group.h" #include "error.h" -#include "force.h" #include "kokkos_few.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_neigh_history_kokkos.cpp b/src/KOKKOS/fix_neigh_history_kokkos.cpp index a43c5ef458..d1f3f66327 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.cpp +++ b/src/KOKKOS/fix_neigh_history_kokkos.cpp @@ -12,13 +12,13 @@ ------------------------------------------------------------------------- */ #include "fix_neigh_history_kokkos.h" + #include "atom_kokkos.h" #include "error.h" #include "memory_kokkos.h" +#include "modify.h" #include "neigh_list_kokkos.h" #include "pair_kokkos.h" -#include "comm.h" -#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/fix_nh_kokkos.cpp b/src/KOKKOS/fix_nh_kokkos.cpp index 96e9663712..a2985502bb 100644 --- a/src/KOKKOS/fix_nh_kokkos.cpp +++ b/src/KOKKOS/fix_nh_kokkos.cpp @@ -16,27 +16,24 @@ ------------------------------------------------------------------------- */ #include "fix_nh_kokkos.h" -#include -#include -#include -#include "math_extra.h" + #include "atom.h" -#include "force.h" -#include "group.h" -#include "comm.h" -#include "neighbor.h" -#include "irregular.h" -#include "modify.h" -#include "fix_deform.h" -#include "compute.h" -#include "kspace.h" -#include "update.h" -#include "respa.h" -#include "domain_kokkos.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" #include "atom_kokkos.h" +#include "atom_masks.h" +#include "comm.h" +#include "compute.h" +#include "domain_kokkos.h" +#include "error.h" +#include "fix_deform.h" +#include "force.h" +#include "irregular.h" +#include "kspace.h" +#include "memory_kokkos.h" +#include "neighbor.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_nph_kokkos.cpp b/src/KOKKOS/fix_nph_kokkos.cpp index d667e29221..7efcb150bd 100644 --- a/src/KOKKOS/fix_nph_kokkos.cpp +++ b/src/KOKKOS/fix_nph_kokkos.cpp @@ -12,10 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_nph_kokkos.h" -#include + #include "modify.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_npt_kokkos.cpp b/src/KOKKOS/fix_npt_kokkos.cpp index 47b3da4efe..5b73eee4d7 100644 --- a/src/KOKKOS/fix_npt_kokkos.cpp +++ b/src/KOKKOS/fix_npt_kokkos.cpp @@ -12,10 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_npt_kokkos.h" -#include + #include "modify.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp index da0a326d5d..beabc55727 100644 --- a/src/KOKKOS/fix_nve_kokkos.cpp +++ b/src/KOKKOS/fix_nve_kokkos.cpp @@ -12,14 +12,11 @@ ------------------------------------------------------------------------- */ #include "fix_nve_kokkos.h" -#include -#include -#include "atom_masks.h" + #include "atom_kokkos.h" -#include "force.h" -#include "update.h" -#include "respa.h" -#include "error.h" +#include "atom_masks.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_nvt_kokkos.cpp b/src/KOKKOS/fix_nvt_kokkos.cpp index 013095abc0..6e69582617 100644 --- a/src/KOKKOS/fix_nvt_kokkos.cpp +++ b/src/KOKKOS/fix_nvt_kokkos.cpp @@ -12,10 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_nvt_kokkos.h" -#include + +#include "error.h" #include "group.h" #include "modify.h" -#include "error.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_property_atom_kokkos.cpp b/src/KOKKOS/fix_property_atom_kokkos.cpp index ff374b885f..185e7445b2 100644 --- a/src/KOKKOS/fix_property_atom_kokkos.cpp +++ b/src/KOKKOS/fix_property_atom_kokkos.cpp @@ -12,14 +12,13 @@ ------------------------------------------------------------------------- */ #include "fix_property_atom_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "comm.h" -#include "memory_kokkos.h" -#include "error.h" -#include "update.h" #include "atom_masks.h" +#include "error.h" +#include "memory_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index 8c007586a9..eac044da28 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -17,21 +17,21 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_reax_kokkos.h" -#include -#include "kokkos.h" + #include "atom.h" -#include "atom_masks.h" #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "kokkos.h" +#include "memory_kokkos.h" #include "neigh_list_kokkos.h" #include "neigh_request.h" +#include "neighbor.h" #include "update.h" -#include "integrate.h" -#include "memory_kokkos.h" -#include "error.h" -#include "pair_reaxc_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp index 3a706ece83..f98ab0314c 100644 --- a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp @@ -16,14 +16,13 @@ ------------------------------------------------------------------------- */ #include "fix_reaxc_bonds_kokkos.h" + #include "atom.h" -#include "pair_reaxc_kokkos.h" -#include "force.h" -#include "compute.h" -#include "memory_kokkos.h" -#include "error.h" -#include "reaxc_defs.h" #include "atom_masks.h" +#include "error.h" +#include "force.h" +#include "memory_kokkos.h" +#include "pair_reaxc_kokkos.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 38968bdd35..18bc4225a7 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -27,7 +27,7 @@ #include "comm.h" #include "domain.h" #include "kokkos.h" -#include "utils.h" + #include // DBL_EPSILON diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp index da516f5ba2..a11e8b4bd4 100644 --- a/src/KOKKOS/fix_setforce_kokkos.cpp +++ b/src/KOKKOS/fix_setforce_kokkos.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_setforce_kokkos.h" -#include + #include "atom_kokkos.h" #include "update.h" #include "modify.h" @@ -24,7 +24,8 @@ #include "error.h" #include "atom_masks.h" #include "kokkos_base.h" -#include "region.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 75964f4829..9be4321ff2 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -35,7 +35,7 @@ #include "fix_shardlow_kokkos.h" #include -#include + #include "atom.h" #include "atom_masks.h" #include "atom_kokkos.h" diff --git a/src/KOKKOS/fix_wall_reflect_kokkos.cpp b/src/KOKKOS/fix_wall_reflect_kokkos.cpp index a5bd6e6e6c..046c97c12b 100644 --- a/src/KOKKOS/fix_wall_reflect_kokkos.cpp +++ b/src/KOKKOS/fix_wall_reflect_kokkos.cpp @@ -12,20 +12,15 @@ ------------------------------------------------------------------------- */ #include "fix_wall_reflect_kokkos.h" -#include -#include -#include "atom_kokkos.h" -#include "comm.h" -#include "update.h" -#include "modify.h" -#include "domain.h" -#include "lattice.h" -#include "input.h" -#include "variable.h" -#include "error.h" -#include "force.h" -#include "atom_masks.h" +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "input.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/KOKKOS/gridcomm_kokkos.cpp b/src/KOKKOS/gridcomm_kokkos.cpp index 5f32c5b4ae..909e3c8544 100644 --- a/src/KOKKOS/gridcomm_kokkos.cpp +++ b/src/KOKKOS/gridcomm_kokkos.cpp @@ -12,14 +12,13 @@ ------------------------------------------------------------------------- */ #include "gridcomm_kokkos.h" -#include + #include "comm.h" -#include "kspace.h" #include "irregular.h" -#include "memory_kokkos.h" -#include "error.h" -#include "kokkos_base_fft.h" #include "kokkos.h" +#include "kokkos_base_fft.h" +#include "kspace.h" +#include "memory_kokkos.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 7e3a4ba68a..79fd0685b0 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -12,19 +12,17 @@ ------------------------------------------------------------------------- */ #include "kokkos.h" -#include -#include + +#include "error.h" +#include "force.h" +#include "memory_kokkos.h" +#include "neigh_list_kokkos.h" +#include "neighbor_kokkos.h" + #include -#include #include #include #include -#include "lammps.h" -#include "force.h" -#include "neighbor_kokkos.h" -#include "neigh_list_kokkos.h" -#include "error.h" -#include "memory_kokkos.h" #ifdef KOKKOS_ENABLE_CUDA @@ -324,7 +322,7 @@ void KokkosLMP::accelerator(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"binsize") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command"); - binsize = force->numeric(FLERR,arg[iarg+1]); + binsize = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"newton") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package kokkos command"); diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 39d30ac785..83e8b9ec7c 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -14,7 +14,7 @@ #ifndef LMP_MEMORY_KOKKOS_H #define LMP_MEMORY_KOKKOS_H -#include "memory.h" +#include "memory.h" // IWYU pragma: export #include "kokkos_type.h" namespace LAMMPS_NS { diff --git a/src/KOKKOS/min_kokkos.cpp b/src/KOKKOS/min_kokkos.cpp index e5f22411f6..032538fe60 100644 --- a/src/KOKKOS/min_kokkos.cpp +++ b/src/KOKKOS/min_kokkos.cpp @@ -16,32 +16,31 @@ ------------------------------------------------------------------------- */ #include "min_kokkos.h" -#include -#include -#include -#include "atom_kokkos.h" -#include "atom_vec.h" -#include "domain.h" -#include "comm.h" -#include "update.h" -#include "modify.h" -#include "fix_minimize_kokkos.h" -#include "compute.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "bond.h" + #include "angle.h" +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "bond.h" +#include "comm.h" +#include "compute.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix_minimize_kokkos.h" +#include "force.h" #include "improper.h" +#include "kokkos.h" #include "kspace.h" +#include "modify.h" +#include "neighbor.h" #include "output.h" +#include "pair.h" #include "thermo.h" #include "timer.h" -#include "memory.h" -#include "error.h" -#include "kokkos.h" -#include "atom_masks.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/min_linesearch_kokkos.cpp b/src/KOKKOS/min_linesearch_kokkos.cpp index cb07c7db86..4306a5bd3b 100644 --- a/src/KOKKOS/min_linesearch_kokkos.cpp +++ b/src/KOKKOS/min_linesearch_kokkos.cpp @@ -16,16 +16,16 @@ ------------------------------------------------------------------------- */ #include "min_linesearch_kokkos.h" -#include -#include + #include "atom_kokkos.h" -#include "modify.h" -#include "fix_minimize_kokkos.h" -#include "pair.h" -#include "output.h" -#include "thermo.h" -#include "error.h" #include "atom_masks.h" +#include "error.h" +#include "fix_minimize_kokkos.h" +#include "output.h" +#include "pair.h" +#include "thermo.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/nbin_kokkos.cpp b/src/KOKKOS/nbin_kokkos.cpp index 89a69dc633..158a87796e 100644 --- a/src/KOKKOS/nbin_kokkos.cpp +++ b/src/KOKKOS/nbin_kokkos.cpp @@ -12,14 +12,11 @@ ------------------------------------------------------------------------- */ #include "nbin_kokkos.h" -#include "neighbor.h" + #include "atom_kokkos.h" -#include "group.h" -#include "domain.h" +#include "atom_masks.h" #include "comm.h" #include "update.h" -#include "error.h" -#include "atom_masks.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/neigh_bond_kokkos.cpp b/src/KOKKOS/neigh_bond_kokkos.cpp index bf9234e17c..021dcc7a1c 100644 --- a/src/KOKKOS/neigh_bond_kokkos.cpp +++ b/src/KOKKOS/neigh_bond_kokkos.cpp @@ -16,22 +16,22 @@ ------------------------------------------------------------------------- */ #include "neigh_bond_kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "atom_vec.h" -#include "molecule.h" -#include "force.h" -#include "update.h" #include "domain_kokkos.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "memory_kokkos.h" +#include "modify.h" #include "output.h" #include "thermo.h" -#include "memory_kokkos.h" -#include "error.h" -#include "modify.h" -#include "fix.h" -#include -#include "atom_masks.h" -#include "domain.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; #define BONDDELTA 10000 diff --git a/src/KOKKOS/neigh_list_kokkos.cpp b/src/KOKKOS/neigh_list_kokkos.cpp index 14591f8246..7db78e38d2 100644 --- a/src/KOKKOS/neigh_list_kokkos.cpp +++ b/src/KOKKOS/neigh_list_kokkos.cpp @@ -12,8 +12,6 @@ ------------------------------------------------------------------------- */ #include "neigh_list_kokkos.h" -#include "atom.h" -#include "memory_kokkos.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/neigh_list_kokkos.h b/src/KOKKOS/neigh_list_kokkos.h index edd775f7f9..8ae873036b 100644 --- a/src/KOKKOS/neigh_list_kokkos.h +++ b/src/KOKKOS/neigh_list_kokkos.h @@ -15,7 +15,8 @@ #define LMP_NEIGH_LIST_KOKKOS_H #include "pointers.h" -#include "neigh_list.h" + +#include "neigh_list.h" // IWYU pragma: export #include "kokkos_type.h" namespace LAMMPS_NS { diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index 4d0cf7ea3a..b21a7cb1ee 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -12,25 +12,26 @@ ------------------------------------------------------------------------- */ #include "neighbor_kokkos.h" -#include "atom_kokkos.h" -#include "pair.h" -#include "fix.h" -#include "neigh_request.h" -#include "memory_kokkos.h" -#include "update.h" -#include "atom_masks.h" -#include "error.h" -#include "kokkos.h" -#include "force.h" -#include "bond.h" + #include "angle.h" -#include "dihedral.h" -#include "improper.h" -#include "style_nbin.h" -#include "style_nstencil.h" -#include "style_npair.h" -#include "style_ntopo.h" +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "bond.h" #include "comm.h" +#include "dihedral.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "improper.h" +#include "kokkos.h" +#include "memory_kokkos.h" +#include "neigh_request.h" +#include "pair.h" +#include "style_nbin.h" +#include "style_npair.h" +#include "style_nstencil.h" +#include "style_ntopo.h" +#include "update.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/neighbor_kokkos.h b/src/KOKKOS/neighbor_kokkos.h index 3829502c0d..304fe8f1da 100644 --- a/src/KOKKOS/neighbor_kokkos.h +++ b/src/KOKKOS/neighbor_kokkos.h @@ -14,11 +14,10 @@ #ifndef LMP_NEIGHBOR_KOKKOS_H #define LMP_NEIGHBOR_KOKKOS_H -#include "neighbor.h" +#include "neighbor.h" // IWYU pragma: export #include "neigh_list_kokkos.h" #include "neigh_bond_kokkos.h" #include "kokkos_type.h" -#include namespace LAMMPS_NS { diff --git a/src/KOKKOS/npair_halffull_kokkos.cpp b/src/KOKKOS/npair_halffull_kokkos.cpp index b109010935..ca9c14b29d 100644 --- a/src/KOKKOS/npair_halffull_kokkos.cpp +++ b/src/KOKKOS/npair_halffull_kokkos.cpp @@ -12,15 +12,14 @@ ------------------------------------------------------------------------- */ #include "npair_halffull_kokkos.h" -#include "neighbor.h" -#include "neigh_list_kokkos.h" + #include "atom_kokkos.h" -#include "atom_vec.h" -#include "molecule.h" -#include "domain.h" -#include "my_page.h" -#include "error.h" #include "atom_masks.h" +#include "atom_vec.h" +#include "domain.h" +#include "neigh_list_kokkos.h" + +#include using namespace LAMMPS_NS; diff --git a/src/KOKKOS/npair_skip_kokkos.cpp b/src/KOKKOS/npair_skip_kokkos.cpp index 13080a9580..81f78844d3 100644 --- a/src/KOKKOS/npair_skip_kokkos.cpp +++ b/src/KOKKOS/npair_skip_kokkos.cpp @@ -12,11 +12,11 @@ ------------------------------------------------------------------------- */ #include "npair_skip_kokkos.h" -#include "neigh_list_kokkos.h" + #include "atom_kokkos.h" -#include "atom_vec.h" -#include "error.h" #include "atom_masks.h" +#include "atom_vec.h" +#include "neigh_list_kokkos.h" using namespace LAMMPS_NS; diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index a97d1dbe13..e3326f3056 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -226,8 +226,8 @@ void PairCoulDebyeKokkos::settings(int narg, char **arg) { if (narg > 2) error->all(FLERR,"Illegal pair_style command"); - kappa = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + kappa = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 28cf65c8d8..280e47b771 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -29,7 +29,7 @@ #include "memory_kokkos.h" #include "error.h" #include "atom_masks.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index da49414892..a4828c00aa 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -29,7 +29,7 @@ #include "memory_kokkos.h" #include "error.h" #include "atom_masks.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 55421bb4e3..035bf87cec 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -17,7 +17,7 @@ #include "pair_exp6_rx_kokkos.h" #include -#include + #include #include "atom.h" #include "comm.h" @@ -32,7 +32,7 @@ #include "neigh_request.h" #include "atom_kokkos.h" #include "kokkos.h" -#include "utils.h" + #ifdef _OPENMP #include @@ -1723,7 +1723,7 @@ void PairExp6rxKokkos::read_file(char *file) FILE *fp; fp = NULL; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); diff --git a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp index 0cebd79c88..9c75f3abe8 100644 --- a/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_overlay_kokkos.cpp @@ -18,6 +18,7 @@ #include "force.h" #include "error.h" + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -34,8 +35,8 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // 3rd arg = pair sub-style name // 4th arg = pair sub-style index if name used multiple times @@ -52,7 +53,7 @@ void PairHybridOverlayKokkos::coeff(int narg, char **arg) if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!isdigit(arg[3][0])) error->all(FLERR,"Incorrect args for pair coefficients"); - int index = force->inumeric(FLERR,arg[3]); + int index = utils::inumeric(FLERR,arg[3],false,lmp); if (index == multiple[m]) break; else continue; } else break; diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index ffafdf7f17..396a5f2d48 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -19,7 +19,7 @@ #define LMP_PAIR_KOKKOS_H #include "Kokkos_Macros.hpp" -#include "pair.h" +#include "pair.h" // IWYU pragma: export #include "neighbor_kokkos.h" #include "neigh_list_kokkos.h" #include "Kokkos_Vectorization.hpp" diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 2f31b180d7..05e0d15dbf 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -277,10 +277,10 @@ void PairLJCutCoulDebyeKokkos::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - kappa = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); + kappa = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[2]); + else cut_coul_global = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that were previously set from data file diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index 5fbc465c76..c4e1ae38cb 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -953,7 +953,7 @@ void PairMultiLucyRXKokkos::settings(int narg, char **arg) else if (strcmp(arg[0],"linear") == 0) tabstyle = LINEAR; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // optional keywords diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index d0fe11285a..3a7359df93 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -16,25 +16,23 @@ ------------------------------------------------------------------------- */ #include "pair_reaxc_kokkos.h" -#include -#include -#include -#include "kokkos.h" + #include "atom_kokkos.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list_kokkos.h" +#include "kokkos.h" #include "math_const.h" #include "math_special.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" +#include "neigh_request.h" +#include "neighbor.h" #include "reaxc_defs.h" #include "reaxc_lookup.h" #include "reaxc_tool_box.h" +#include + #define TEAMSIZE 128 diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index 86845c72fe..b5b59dc456 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -428,7 +428,7 @@ void PairTableKokkos::settings(int narg, char **arg) else if (strcmp(arg[0],"bitmap") == 0) tabstyle = BITMAP; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // optional keywords diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 3dc325371b..09e38e6387 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_table_rx_kokkos.h" -#include + #include #include #include "kokkos.h" @@ -33,7 +33,7 @@ #include "kokkos_few.h" #include "kokkos.h" #include "modify.h" -#include "utils.h" + #include using namespace LAMMPS_NS; @@ -971,7 +971,7 @@ void PairTableRXKokkos::settings(int narg, char **arg) else if (strcmp(arg[0],"bitmap") == 0) tabstyle = BITMAP; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // optional keywords @@ -1025,8 +1025,8 @@ void PairTableRXKokkos::coeff(int narg, char **arg) if (!rx_flag) error->all(FLERR,"PairTableRX requires a fix rx command."); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); @@ -1063,7 +1063,7 @@ void PairTableRXKokkos::coeff(int narg, char **arg) // set table cutoff - if (narg == 7) tb->cut = force->numeric(FLERR,arg[6]); + if (narg == 7) tb->cut = utils::numeric(FLERR,arg[6],false,lmp); else if (tb->rflag) tb->cut = tb->rhi; else tb->cut = tb->rfile[tb->ninput-1]; diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index f5489c0e0c..b5dd43f12a 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -16,20 +16,21 @@ ------------------------------------------------------------------------- */ #include "pair_vashishta_kokkos.h" -#include -#include -#include "kokkos.h" -#include "pair_kokkos.h" + #include "atom_kokkos.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "force.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" +#include "force.h" +#include "kokkos.h" +#include "math_const.h" #include "memory_kokkos.h" #include "neigh_list_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "math_const.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index e71e5d6d53..4a795833fb 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -16,26 +16,22 @@ ------------------------------------------------------------------------- */ #include "pppm_kokkos.h" -#include -#include -#include "atom_kokkos.h" -#include "comm.h" -#include "gridcomm_kokkos.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "domain.h" -#include "fft3d_kokkos.h" -#include "remap_kokkos.h" -#include "memory_kokkos.h" -#include "error.h" -#include "atom_masks.h" -#include "kokkos.h" -#include "utils.h" -#include "fmt/format.h" +#include "atom_kokkos.h" +#include "atom_masks.h" +#include "domain.h" +#include "error.h" +#include "fft3d_kokkos.h" +#include "force.h" +#include "gridcomm_kokkos.h" +#include "kokkos.h" #include "math_const.h" #include "math_special_kokkos.h" +#include "memory_kokkos.h" +#include "pair.h" +#include "remap_kokkos.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -144,7 +140,7 @@ template void PPPMKokkos::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/kk command"); - accuracy_relative = fabs(force->numeric(FLERR,arg[0])); + accuracy_relative = fabs(utils::numeric(FLERR,arg[0],false,lmp)); } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/remap_kokkos.cpp b/src/KOKKOS/remap_kokkos.cpp index d496db05e2..af87ba3644 100644 --- a/src/KOKKOS/remap_kokkos.cpp +++ b/src/KOKKOS/remap_kokkos.cpp @@ -11,12 +11,10 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include -#include #include "remap_kokkos.h" -#include "pack_kokkos.h" + #include "error.h" +#include "pack_kokkos.h" using namespace LAMMPS_NS; diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index efb35d42b8..6133df398f 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -19,19 +19,17 @@ ------------------------------------------------------------------------- */ #include "ewald.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "pair.h" #include "domain.h" +#include "error.h" +#include "force.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "pair.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -71,7 +69,7 @@ void Ewald::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal kspace_style ewald command"); - accuracy_relative = fabs(force->numeric(FLERR,arg[0])); + accuracy_relative = fabs(utils::numeric(FLERR,arg[0],false,lmp)); } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 1921b8dc55..33d21b416e 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -16,22 +16,20 @@ ------------------------------------------------------------------------- */ #include "ewald_dipole.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "pair.h" #include "domain.h" +#include "error.h" +#include "force.h" #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "error.h" +#include "pair.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index bdbb737de8..94cacd3a75 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -16,21 +16,19 @@ ------------------------------------------------------------------------- */ #include "ewald_dipole_spin.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "pair.h" #include "domain.h" +#include "error.h" +#include "force.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "pair.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index b40e3cd34b..546ac472c9 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -16,23 +16,21 @@ ------------------------------------------------------------------------- */ #include "ewald_disp.h" -#include -#include -#include -#include -#include "math_vector.h" -#include "math_const.h" -#include "math_special.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "pair.h" #include "domain.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "math_const.h" +#include "math_special.h" +#include "math_vector.h" +#include "memory.h" +#include "pair.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -69,7 +67,7 @@ EwaldDisp::EwaldDisp(LAMMPS *lmp) : KSpace(lmp), void EwaldDisp::settings(int narg, char **arg) { if (narg!=1) error->all(FLERR,"Illegal kspace_style ewald/n command"); - accuracy_relative = fabs(force->numeric(FLERR,arg[0])); + accuracy_relative = fabs(utils::numeric(FLERR,arg[0],false,lmp)); } diff --git a/src/KSPACE/fft3d_wrap.cpp b/src/KSPACE/fft3d_wrap.cpp index 507b23d27d..d0e3a2b50c 100644 --- a/src/KSPACE/fft3d_wrap.cpp +++ b/src/KSPACE/fft3d_wrap.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fft3d_wrap.h" -#include + #include "error.h" using namespace LAMMPS_NS; diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 8a7d49091a..c205f9de05 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -16,24 +16,22 @@ ------------------------------------------------------------------------- */ #include "fix_tune_kspace.h" -#include -#include -#include -#include + #include "comm.h" -#include "update.h" +#include "compute.h" +#include "error.h" #include "force.h" #include "info.h" #include "kspace.h" -#include "pair.h" -#include "error.h" -#include "memory.h" -#include "timer.h" -#include "neighbor.h" #include "modify.h" -#include "compute.h" -#include "utils.h" -#include "fmt/format.h" +#include "neighbor.h" +#include "pair.h" +#include "timer.h" +#include "update.h" + +#include +#include +#include #define SWAP(a,b) {temp=(a);(a)=(b);(b)=temp;} #define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a)) @@ -64,7 +62,7 @@ FixTuneKspace::FixTuneKspace(LAMMPS *lmp, int narg, char **arg) : // parse arguments - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix tune/kspace command"); // set up reneighboring diff --git a/src/KSPACE/fix_tune_kspace.h b/src/KSPACE/fix_tune_kspace.h index 339f79626f..3e4db40344 100644 --- a/src/KSPACE/fix_tune_kspace.h +++ b/src/KSPACE/fix_tune_kspace.h @@ -21,7 +21,7 @@ FixStyle(tune/kspace,FixTuneKspace) #define LMP_FIX_TUNE_KSPACE_H #include "fix.h" -#include + namespace LAMMPS_NS { diff --git a/src/KSPACE/gridcomm.cpp b/src/KSPACE/gridcomm.cpp index 4024670b9f..0f899d31cf 100644 --- a/src/KSPACE/gridcomm.cpp +++ b/src/KSPACE/gridcomm.cpp @@ -12,12 +12,12 @@ ------------------------------------------------------------------------- */ #include "gridcomm.h" -#include + #include "comm.h" -#include "kspace.h" -#include "irregular.h" -#include "memory.h" #include "error.h" +#include "irregular.h" +#include "kspace.h" +#include "memory.h" using namespace LAMMPS_NS; diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 973302a054..d0f4d38686 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -16,22 +16,20 @@ ------------------------------------------------------------------------- */ #include "msm.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "gridcomm.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" #include "domain.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" - +#include "force.h" +#include "gridcomm.h" #include "math_const.h" +#include "memory.h" +#include "neighbor.h" +#include "pair.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -108,7 +106,7 @@ MSM::MSM(LAMMPS *lmp) void MSM::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style msm command"); - accuracy_relative = fabs(force->numeric(FLERR,arg[0])); + accuracy_relative = fabs(utils::numeric(FLERR,arg[0],false,lmp)); } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 8236f93c9c..79d33b869d 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -58,7 +58,7 @@ void MSMCG::settings(int narg, char **arg) MSM::settings(narg,arg); - if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); + if (narg == 2) smallq = fabs(utils::numeric(FLERR,arg[1],false,lmp)); else smallq = SMALLQ; } diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index b4d050412a..a05a6a282b 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -240,9 +240,9 @@ void PairBornCoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -264,18 +264,18 @@ void PairBornCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[5]); - double d_one = force->numeric(FLERR,arg[6]); + double c_one = utils::numeric(FLERR,arg[5],false,lmp); + double d_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 8) cut_lj_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_lj_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index a63047ea9f..8d15a6480a 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_buck_coul_long.h" -#include + #include #include #include "atom.h" @@ -24,7 +24,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -240,9 +240,9 @@ void PairBuckCoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -265,16 +265,16 @@ void PairBuckCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[4]); + double c_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index 7408ac12b9..a845ddd1d2 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_buck_long_coul_long.h" -#include + #include #include #include "math_vector.h" @@ -31,7 +31,7 @@ #include "respa.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -97,10 +97,10 @@ void PairBuckLongCoulLong::settings(int narg, char **arg) if (!((ewald_order^ewald_off) & (1<<1))) error->all(FLERR, "Coulomb cut not supported in pair_style buck/long/coul/coul"); - cut_buck_global = force->numeric(FLERR,*(arg++)); + cut_buck_global = utils::numeric(FLERR,*(arg++),false,lmp); if (narg == 4 && ((ewald_order & 0x42) == 0x42)) error->all(FLERR,"Only one cutoff allowed when requesting all long"); - if (narg == 4) cut_coul = force->numeric(FLERR,*arg); + if (narg == 4) cut_coul = utils::numeric(FLERR,*arg,false,lmp); else cut_coul = cut_buck_global; if (allocated) { @@ -200,15 +200,15 @@ void PairBuckLongCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,*(arg++),atom->ntypes,ilo,ihi); - force->bounds(FLERR,*(arg++),atom->ntypes,jlo,jhi); + utils::bounds(FLERR,*(arg++),1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,*(arg++),1,atom->ntypes,jlo,jhi,error); - double buck_a_one = force->numeric(FLERR,*(arg++)); - double buck_rho_one = force->numeric(FLERR,*(arg++)); - double buck_c_one = force->numeric(FLERR,*(arg++)); + double buck_a_one = utils::numeric(FLERR,*(arg++),false,lmp); + double buck_rho_one = utils::numeric(FLERR,*(arg++),false,lmp); + double buck_c_one = utils::numeric(FLERR,*(arg++),false,lmp); double cut_buck_one = cut_buck_global; - if (narg == 6) cut_buck_one = force->numeric(FLERR,*(arg++)); + if (narg == 6) cut_buck_one = utils::numeric(FLERR,*(arg++),false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 9a9f2f3783..2520da2654 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_long.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -199,7 +199,7 @@ void PairCoulLong::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_coul = force->numeric(FLERR,arg[0]); + cut_coul = utils::numeric(FLERR,arg[0],false,lmp); } /* ---------------------------------------------------------------------- @@ -212,8 +212,8 @@ void PairCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 9ea6739c8e..261e93fbc9 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -29,7 +29,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -631,10 +631,10 @@ void PairLJCharmmCoulLong::settings(int narg, char **arg) { if (narg != 2 && narg != 3) error->all(FLERR,"Illegal pair_style command"); - cut_lj_inner = force->numeric(FLERR,arg[0]); - cut_lj = force->numeric(FLERR,arg[1]); + cut_lj_inner = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); } /* ---------------------------------------------------------------------- @@ -647,16 +647,16 @@ void PairLJCharmmCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double eps14_one = epsilon_one; double sigma14_one = sigma_one; if (narg == 6) { - eps14_one = force->numeric(FLERR,arg[4]); - sigma14_one = force->numeric(FLERR,arg[5]); + eps14_one = utils::numeric(FLERR,arg[4],false,lmp); + sigma14_one = utils::numeric(FLERR,arg[5],false,lmp); } int count = 0; diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 36d8126eec..9df9862c11 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -33,7 +33,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -682,10 +682,10 @@ void PairLJCharmmfswCoulLong::settings(int narg, char **arg) { if (narg != 2 && narg != 3) error->all(FLERR,"Illegal pair_style command"); - cut_lj_inner = force->numeric(FLERR,arg[0]); - cut_lj = force->numeric(FLERR,arg[1]); + cut_lj_inner = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); } /* ---------------------------------------------------------------------- @@ -698,16 +698,16 @@ void PairLJCharmmfswCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double eps14_one = epsilon_one; double sigma14_one = sigma_one; if (narg == 6) { - eps14_one = force->numeric(FLERR,arg[4]); - sigma14_one = force->numeric(FLERR,arg[5]); + eps14_one = utils::numeric(FLERR,arg[4],false,lmp); + sigma14_one = utils::numeric(FLERR,arg[5],false,lmp); } int count = 0; diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index 578e5be30c..7fd8a72559 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_long.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -594,9 +594,9 @@ void PairLJCutCoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -619,14 +619,14 @@ void PairLJCutCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.cpp b/src/KSPACE/pair_lj_cut_tip4p_long.cpp index a4f115568f..a62c1bd55b 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_cut_tip4p_long.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_tip4p_long.h" -#include + #include #include #include "angle.h" @@ -30,7 +30,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -430,15 +430,15 @@ void PairLJCutTIP4PLong::settings(int narg, char **arg) { if (narg < 6 || narg > 7) error->all(FLERR,"Illegal pair_style command"); - typeO = force->inumeric(FLERR,arg[0]); - typeH = force->inumeric(FLERR,arg[1]); - typeB = force->inumeric(FLERR,arg[2]); - typeA = force->inumeric(FLERR,arg[3]); - qdist = force->numeric(FLERR,arg[4]); + typeO = utils::inumeric(FLERR,arg[0],false,lmp); + typeH = utils::inumeric(FLERR,arg[1],false,lmp); + typeB = utils::inumeric(FLERR,arg[2],false,lmp); + typeA = utils::inumeric(FLERR,arg[3],false,lmp); + qdist = utils::numeric(FLERR,arg[4],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[5]); + cut_lj_global = utils::numeric(FLERR,arg[5],false,lmp); if (narg == 6) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[6]); + else cut_coul = utils::numeric(FLERR,arg[6],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index 8ece088bd3..b6727c2c99 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_long_coul_long.h" -#include + #include #include #include "math_vector.h" @@ -33,8 +33,8 @@ #include "respa.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; @@ -97,10 +97,10 @@ void PairLJLongCoulLong::settings(int narg, char **arg) if (!((ewald_order^ewald_off) & (1<<1))) error->all(FLERR, "Coulomb cut not supported in pair_style lj/long/coul/long"); - cut_lj_global = force->numeric(FLERR,*(arg++)); + cut_lj_global = utils::numeric(FLERR,*(arg++),false,lmp); if (narg == 4 && ((ewald_order & 0x42) == 0x42)) error->all(FLERR,"Only one cutoff allowed when requesting all long"); - if (narg == 4) cut_coul = force->numeric(FLERR,*arg); + if (narg == 4) cut_coul = utils::numeric(FLERR,*arg,false,lmp); else cut_coul = cut_lj_global; if (allocated) { @@ -198,14 +198,14 @@ void PairLJLongCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index fa8c221382..8f17bda008 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_long_tip4p_long.h" -#include + #include #include #include "angle.h" @@ -30,7 +30,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -1445,16 +1445,16 @@ void PairLJLongTIP4PLong::settings(int narg, char **arg) if (!((ewald_order^ewald_off)&(1<<1))) error->all(FLERR, "Coulomb cut not supported in pair_style lj/long/tip4p/long"); - typeO = force->inumeric(FLERR,arg[1]); - typeH = force->inumeric(FLERR,arg[2]); - typeB = force->inumeric(FLERR,arg[3]); - typeA = force->inumeric(FLERR,arg[4]); - qdist = force->numeric(FLERR,arg[5]); + typeO = utils::inumeric(FLERR,arg[1],false,lmp); + typeH = utils::inumeric(FLERR,arg[2],false,lmp); + typeB = utils::inumeric(FLERR,arg[3],false,lmp); + typeA = utils::inumeric(FLERR,arg[4],false,lmp); + qdist = utils::numeric(FLERR,arg[5],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[6]); + cut_lj_global = utils::numeric(FLERR,arg[6],false,lmp); if (narg == 8) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[7]); + else cut_coul = utils::numeric(FLERR,arg[7],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/KSPACE/pair_tip4p_long.cpp b/src/KSPACE/pair_tip4p_long.cpp index c3ec44b7eb..54973c69c2 100644 --- a/src/KSPACE/pair_tip4p_long.cpp +++ b/src/KSPACE/pair_tip4p_long.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_tip4p_long.h" -#include + #include #include #include "angle.h" @@ -30,7 +30,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -398,13 +398,13 @@ void PairTIP4PLong::settings(int narg, char **arg) { if (narg != 6) error->all(FLERR,"Illegal pair_style command"); - typeO = force->inumeric(FLERR,arg[0]); - typeH = force->inumeric(FLERR,arg[1]); - typeB = force->inumeric(FLERR,arg[2]); - typeA = force->inumeric(FLERR,arg[3]); - qdist = force->numeric(FLERR,arg[4]); + typeO = utils::inumeric(FLERR,arg[0],false,lmp); + typeH = utils::inumeric(FLERR,arg[1],false,lmp); + typeB = utils::inumeric(FLERR,arg[2],false,lmp); + typeA = utils::inumeric(FLERR,arg[3],false,lmp); + qdist = utils::numeric(FLERR,arg[4],false,lmp); - cut_coul = force->numeric(FLERR,arg[5]); + cut_coul = utils::numeric(FLERR,arg[5],false,lmp); } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index e399727001..41ffec4f3b 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -19,28 +19,25 @@ ------------------------------------------------------------------------- */ #include "pppm.h" -#include -#include -#include -#include -#include "atom.h" -#include "comm.h" -#include "gridcomm.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" -#include "domain.h" -#include "fft3d_wrap.h" -#include "remap_wrap.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fft3d_wrap.h" +#include "force.h" +#include "gridcomm.h" #include "math_const.h" #include "math_special.h" +#include "memory.h" +#include "neighbor.h" +#include "pair.h" +#include "remap_wrap.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -164,7 +161,7 @@ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), void PPPM::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm command"); - accuracy_relative = fabs(force->numeric(FLERR,arg[0])); + accuracy_relative = fabs(utils::numeric(FLERR,arg[0],false,lmp)); } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index 392d19336a..b319014c78 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -16,20 +16,18 @@ ------------------------------------------------------------------------- */ #include "pppm_cg.h" -#include -#include -#include + #include "atom.h" -#include "gridcomm.h" #include "domain.h" #include "error.h" -#include "force.h" -#include "neighbor.h" -#include "memory.h" +#include "gridcomm.h" #include "math_const.h" +#include "memory.h" +#include "neighbor.h" #include "remap.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -66,7 +64,7 @@ void PPPMCG::settings(int narg, char **arg) PPPM::settings(narg,arg); - if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); + if (narg == 2) smallq = fabs(utils::numeric(FLERR,arg[1],false,lmp)); else smallq = SMALLQ; } diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 1a87c81bee..1b7d325326 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -16,26 +16,23 @@ ------------------------------------------------------------------------- */ #include "pppm_dipole.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "gridcomm.h" -#include "force.h" -#include "pair.h" #include "domain.h" -#include "fft3d_wrap.h" -#include "remap_wrap.h" -#include "memory.h" #include "error.h" -#include "update.h" -#include "utils.h" -#include "fmt/format.h" - +#include "fft3d_wrap.h" +#include "force.h" +#include "gridcomm.h" #include "math_const.h" #include "math_special.h" +#include "memory.h" +#include "pair.h" +#include "remap_wrap.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 4e33c11793..595c257331 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -16,22 +16,19 @@ ------------------------------------------------------------------------- */ #include "pppm_dipole_spin.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "gridcomm.h" -#include "force.h" -#include "pair.h" #include "domain.h" -#include "memory.h" #include "error.h" -#include "update.h" -#include "utils.h" -#include "fmt/format.h" - +#include "force.h" +#include "gridcomm.h" #include "math_const.h" +#include "memory.h" +#include "pair.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index c81dcbf909..a484751a81 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -17,26 +17,24 @@ ------------------------------------------------------------------------- */ #include "pppm_disp.h" -#include -#include -#include -#include -#include "math_const.h" -#include "atom.h" -#include "comm.h" -#include "gridcomm.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "bond.h" + #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" #include "domain.h" -#include "fft3d_wrap.h" -#include "remap_wrap.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "fft3d_wrap.h" +#include "force.h" +#include "gridcomm.h" +#include "math_const.h" +#include "memory.h" +#include "neighbor.h" +#include "pair.h" +#include "remap_wrap.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -228,7 +226,7 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), void PPPMDisp::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal kspace_style pppm/disp command"); - accuracy_relative = fabs(force->numeric(FLERR,arg[0])); + accuracy_relative = fabs(utils::numeric(FLERR,arg[0],false,lmp)); } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/remap_wrap.cpp b/src/KSPACE/remap_wrap.cpp index 7929cd053c..4aaaa1329e 100644 --- a/src/KSPACE/remap_wrap.cpp +++ b/src/KSPACE/remap_wrap.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "remap_wrap.h" -#include + #include "error.h" using namespace LAMMPS_NS; diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 31d62f0645..54169d08d7 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_comb.h" -#include + #include #include #include "pair_comb.h" @@ -30,8 +30,8 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -49,8 +49,8 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), respa_level_support = 1; ilevel_respa = 0; - nevery = force->inumeric(FLERR,arg[3]); - precision = force->numeric(FLERR,arg[4]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + precision = utils::numeric(FLERR,arg[4],false,lmp); if (nevery <= 0 || precision <= 0.0) error->all(FLERR,"Illegal fix qeq/comb command"); diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index 74fd03e080..ff30ac7b1e 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -17,9 +17,9 @@ ------------------------------------------------------------------------- */ #include "pair_adp.h" -#include + #include -#include + #include #include "atom.h" #include "force.h" @@ -28,7 +28,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 085905192e..7ab2eaa27b 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -21,23 +21,23 @@ ------------------------------------------------------------------------- */ #include "pair_airebo.h" -#include -#include -#include + #include "atom.h" -#include "neighbor.h" -#include "force.h" #include "comm.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "my_page.h" +#include "error.h" +#include "force.h" #include "math_special.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" #include "potential_file_reader.h" -#include "fmt/format.h" +#include "text_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathSpecial; @@ -154,15 +154,15 @@ void PairAIREBO::settings(int narg, char **arg) if (narg != 1 && narg != 3 && narg != 4) error->all(FLERR,"Illegal pair_style command"); - cutlj = force->numeric(FLERR,arg[0]); + cutlj = utils::numeric(FLERR,arg[0],false,lmp); if (narg >= 3) { - ljflag = force->inumeric(FLERR,arg[1]); - torflag = force->inumeric(FLERR,arg[2]); + ljflag = utils::inumeric(FLERR,arg[1],false,lmp); + torflag = utils::inumeric(FLERR,arg[2],false,lmp); } if (narg == 4) { sigcut = cutlj; - sigmin = force->numeric(FLERR,arg[3]); + sigmin = utils::numeric(FLERR,arg[3],false,lmp); sigwid = sigcut - sigmin; } diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index e943b6bfdd..2a69e70b81 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_atm.h" -#include + #include #include "atom.h" #include "citeme.h" @@ -27,7 +27,7 @@ #include "neigh_list.h" #include "neigh_request.h" #include "neighbor.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -210,8 +210,8 @@ void PairATM::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); - cut_triple = force->numeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_triple = utils::numeric(FLERR,arg[1],false,lmp); } /* ---------------------------------------------------------------------- @@ -224,11 +224,11 @@ void PairATM::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,klo,khi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - force->bounds(FLERR,arg[2],atom->ntypes,klo,khi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg[2],1,atom->ntypes,klo,khi,error); - double nu_one = force->numeric(FLERR,arg[3]); + double nu_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index 5b080c9f0e..e7c2f64672 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -33,22 +33,21 @@ ------------------------------------------------------------------------- */ #include "pair_bop.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "potential_file_reader.h" +#include "text_file_reader.h" +#include "tokenizer.h" + #include #include -#include -#include -#include "atom.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" -#include "potential_file_reader.h" -#include "fmt/format.h" using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_comb.cpp b/src/MANYBODY/pair_comb.cpp index 6b8d4e428e..a27aaef4ab 100644 --- a/src/MANYBODY/pair_comb.cpp +++ b/src/MANYBODY/pair_comb.cpp @@ -19,9 +19,9 @@ ------------------------------------------------------------------------- */ #include "pair_comb.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -34,7 +34,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 385e3ca35d..265d30c6f7 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -18,25 +18,24 @@ ------------------------------------------------------------------------- */ #include "pair_comb3.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "my_page.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "group.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" #include "potential_file_reader.h" -#include "fmt/format.h" +#include "text_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index da2385237b..999384ea2f 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "pair_eam.h" -#include + #include -#include + #include #include "atom.h" #include "force.h" @@ -28,7 +28,7 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" @@ -378,8 +378,8 @@ void PairEAM::coeff(int narg, char **arg) // parse pair of atom types int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read funcfl file if hasn't already been read // store filename in Funcfl data struct diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index 3e33d40ee4..d30f46aa36 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -16,16 +16,15 @@ ------------------------------------------------------------------------- */ #include "pair_eam_alloy.h" -#include -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index 01c8a3fffe..dc36c73272 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "pair_eam_cd.h" -#include + #include -#include + #include #include "atom.h" #include "force.h" @@ -29,8 +29,8 @@ #include "memory.h" #include "error.h" #include "tokenizer.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; @@ -504,7 +504,7 @@ void PairEAMCD::read_h_coeff(char *filename) char line[MAXLINE]; char nextline[MAXLINE]; int convert_flag = unit_convert_flag; - fptr = force->open_potential(filename, &convert_flag); + fptr = utils::open_potential(filename, lmp, &convert_flag); if (fptr == NULL) error->one(FLERR,fmt::format("Cannot open EAMCD potential file {}", filename)); diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index fbe6bee529..dd45d12da3 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -16,16 +16,15 @@ ------------------------------------------------------------------------- */ #include "pair_eam_fs.h" -#include -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index 4321bd9f8b..cb5a95faa2 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -16,20 +16,18 @@ ------------------------------------------------------------------------- */ #include "pair_eim.h" -#include + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "tokenizer.h" + #include #include -#include "atom.h" -#include "force.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" -#include "potential_file_reader.h" -#include "fmt/format.h" using namespace LAMMPS_NS; @@ -1061,7 +1059,7 @@ EIMPotentialFileReader::EIMPotentialFileReader(LAMMPS *lmp, } int unit_convert = auto_convert; - FILE *fp = force->open_potential(filename.c_str(), &unit_convert); + FILE *fp = utils::open_potential(filename, lmp, &unit_convert); conversion_factor = utils::get_conversion_factor(utils::ENERGY,unit_convert); if (fp == NULL) { diff --git a/src/MANYBODY/pair_eim.h b/src/MANYBODY/pair_eim.h index 1266ffd242..75f8ea6bea 100644 --- a/src/MANYBODY/pair_eim.h +++ b/src/MANYBODY/pair_eim.h @@ -21,7 +21,7 @@ PairStyle(eim,PairEIM) #define LMP_PAIR_EIM_H #include "pair.h" -#include + #include namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 0928d14696..051c30f873 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -17,9 +17,9 @@ ------------------------------------------------------------------------- */ #include "pair_gw.h" -#include + #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -29,7 +29,7 @@ #include "comm.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index 1a2bf5eb5d..ee3bebda13 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -17,21 +17,18 @@ ------------------------------------------------------------------------- */ #include "pair_gw_zbl.h" -#include -#include -#include -#include -#include "atom.h" -#include "update.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" -#include "potential_file_reader.h" +#include "comm.h" +#include "error.h" #include "math_const.h" +#include "memory.h" +#include "potential_file_reader.h" +#include "tokenizer.h" +#include "update.h" + +#include +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index 7c29f44afc..d2e478b37d 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lcbop.h" -#include + #include #include #include "atom.h" @@ -29,7 +29,7 @@ #include "my_page.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -969,7 +969,7 @@ void PairLCBOP::read_file(char *filename) // read file on proc 0 if (me == 0) { - FILE *fp = force->open_potential(filename); + FILE *fp = utils::open_potential(filename,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open LCBOP potential file %s",filename); diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index dc537a7b58..0a197a1576 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -17,9 +17,9 @@ ------------------------------------------------------------------------- */ #include "pair_nb3b_harmonic.h" -#include + #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -29,7 +29,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 502580719a..0f7fd7a1c7 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -17,21 +17,20 @@ ------------------------------------------------------------------------- */ #include "pair_polymorphic.h" -#include -#include -#include -#include + #include "atom.h" -#include "neighbor.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "neighbor.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index 18956699d7..2593905b22 100644 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -22,7 +22,6 @@ PairStyle(polymorphic,PairPolymorphic) #include "pair.h" #include -#include namespace LAMMPS_NS { diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index f6b5a803d2..2deb45ac75 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -16,21 +16,20 @@ ------------------------------------------------------------------------- */ #include "pair_sw.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" #include "error.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "utils.h" -#include "tokenizer.h" +#include "neighbor.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index c57740963f..c08c722e5f 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -16,24 +16,22 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff.h" -#include -#include -#include -#include -#include "atom.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" -#include "potential_file_reader.h" +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" #include "math_const.h" #include "math_special.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "potential_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MANYBODY/pair_tersoff_mod.cpp b/src/MANYBODY/pair_tersoff_mod.cpp index d1ab6f2034..ea40125ce4 100644 --- a/src/MANYBODY/pair_tersoff_mod.cpp +++ b/src/MANYBODY/pair_tersoff_mod.cpp @@ -17,20 +17,17 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_mod.h" -#include -#include -#include -#include -#include "atom.h" -#include "force.h" + #include "comm.h" +#include "error.h" #include "math_const.h" #include "math_special.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "tokenizer.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MANYBODY/pair_tersoff_mod_c.cpp b/src/MANYBODY/pair_tersoff_mod_c.cpp index ff8916cdcd..6a6497afae 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.cpp +++ b/src/MANYBODY/pair_tersoff_mod_c.cpp @@ -16,18 +16,15 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_mod_c.h" -#include -#include -#include -#include -#include "atom.h" -#include "force.h" + #include "comm.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/MANYBODY/pair_tersoff_zbl.cpp b/src/MANYBODY/pair_tersoff_zbl.cpp index 141cb45964..fad89195b2 100644 --- a/src/MANYBODY/pair_tersoff_zbl.cpp +++ b/src/MANYBODY/pair_tersoff_zbl.cpp @@ -17,21 +17,18 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_zbl.h" -#include -#include -#include -#include -#include "atom.h" -#include "update.h" -#include "force.h" + #include "comm.h" -#include "memory.h" #include "error.h" #include "math_const.h" #include "math_special.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 815854a34b..63765234b3 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -17,9 +17,9 @@ ------------------------------------------------------------------------- */ #include "pair_vashishta.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -29,7 +29,7 @@ #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index bf39183b9d..5e0c2c16f7 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -230,8 +230,8 @@ void PairVashishtaTable::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - ntable = force->inumeric(FLERR,arg[0]); - tabinner = force->numeric(FLERR,arg[1]); + ntable = utils::inumeric(FLERR,arg[0],false,lmp); + tabinner = utils::numeric(FLERR,arg[1],false,lmp); if (tabinner <= 0.0) error->all(FLERR,"Illegal inner cutoff for tabulation"); diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index 9a4a0b6a7f..f786179aa4 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_atom_swap.h" -#include + #include #include #include @@ -68,10 +68,10 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : // required args - nevery = force->inumeric(FLERR,arg[3]); - ncycles = force->inumeric(FLERR,arg[4]); - seed = force->inumeric(FLERR,arg[5]); - double temperature = force->numeric(FLERR,arg[6]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + ncycles = utils::inumeric(FLERR,arg[4],false,lmp); + seed = utils::inumeric(FLERR,arg[5],false,lmp); + double temperature = utils::numeric(FLERR,arg[6],false,lmp); beta = 1.0/(force->boltz*temperature); if (nevery <= 0) error->all(FLERR,"Illegal fix atom/swap command"); @@ -161,7 +161,7 @@ void FixAtomSwap::options(int narg, char **arg) while (iarg < narg) { if (isalpha(arg[iarg][0])) break; if (nswaptypes >= atom->ntypes) error->all(FLERR,"Illegal fix atom/swap command"); - type_list[nswaptypes] = force->numeric(FLERR,arg[iarg]); + type_list[nswaptypes] = utils::numeric(FLERR,arg[iarg],false,lmp); nswaptypes++; iarg++; } @@ -172,7 +172,7 @@ void FixAtomSwap::options(int narg, char **arg) if (isalpha(arg[iarg][0])) break; nmutypes++; if (nmutypes > atom->ntypes) error->all(FLERR,"Illegal fix atom/swap command"); - mu[nmutypes] = force->numeric(FLERR,arg[iarg]); + mu[nmutypes] = utils::numeric(FLERR,arg[iarg],false,lmp); iarg++; } } else error->all(FLERR,"Illegal fix atom/swap command"); diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 2e8200f751..8a7cd20b0f 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_bond_break.h" -#include + #include #include "update.h" #include "respa.h" @@ -41,7 +41,7 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/break command"); force_reneighbor = 1; @@ -51,8 +51,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - btype = force->inumeric(FLERR,arg[4]); - cutoff = force->numeric(FLERR,arg[5]); + btype = utils::inumeric(FLERR,arg[4],false,lmp); + cutoff = utils::numeric(FLERR,arg[5],false,lmp); if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR,"Invalid bond type in fix bond/break command"); @@ -69,8 +69,8 @@ FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"prob") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/break command"); - fraction = force->numeric(FLERR,arg[iarg+1]); - seed = force->inumeric(FLERR,arg[iarg+2]); + fraction = utils::numeric(FLERR,arg[iarg+1],false,lmp); + seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (fraction < 0.0 || fraction > 1.0) error->all(FLERR,"Illegal fix bond/break command"); if (seed <= 0) error->all(FLERR,"Illegal fix bond/break command"); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 9639832db9..a2c2eee2c5 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_bond_create.h" -#include + #include #include "update.h" #include "respa.h" @@ -47,7 +47,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/create command"); force_reneighbor = 1; @@ -57,10 +57,10 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - iatomtype = force->inumeric(FLERR,arg[4]); - jatomtype = force->inumeric(FLERR,arg[5]); - double cutoff = force->numeric(FLERR,arg[6]); - btype = force->inumeric(FLERR,arg[7]); + iatomtype = utils::inumeric(FLERR,arg[4],false,lmp); + jatomtype = utils::inumeric(FLERR,arg[5],false,lmp); + double cutoff = utils::numeric(FLERR,arg[6],false,lmp); + btype = utils::inumeric(FLERR,arg[7],false,lmp); if (iatomtype < 1 || iatomtype > atom->ntypes || jatomtype < 1 || jatomtype > atom->ntypes) @@ -90,49 +90,49 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"iparam") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - imaxbond = force->inumeric(FLERR,arg[iarg+1]); - inewtype = force->inumeric(FLERR,arg[iarg+2]); + imaxbond = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + inewtype = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (imaxbond < 0) error->all(FLERR,"Illegal fix bond/create command"); if (inewtype < 1 || inewtype > atom->ntypes) error->all(FLERR,"Invalid atom type in fix bond/create command"); iarg += 3; } else if (strcmp(arg[iarg],"jparam") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - jmaxbond = force->inumeric(FLERR,arg[iarg+1]); - jnewtype = force->inumeric(FLERR,arg[iarg+2]); + jmaxbond = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + jnewtype = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (jmaxbond < 0) error->all(FLERR,"Illegal fix bond/create command"); if (jnewtype < 1 || jnewtype > atom->ntypes) error->all(FLERR,"Invalid atom type in fix bond/create command"); iarg += 3; } else if (strcmp(arg[iarg],"prob") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create command"); - fraction = force->numeric(FLERR,arg[iarg+1]); - seed = force->inumeric(FLERR,arg[iarg+2]); + fraction = utils::numeric(FLERR,arg[iarg+1],false,lmp); + seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (fraction < 0.0 || fraction > 1.0) error->all(FLERR,"Illegal fix bond/create command"); if (seed <= 0) error->all(FLERR,"Illegal fix bond/create command"); iarg += 3; } else if (strcmp(arg[iarg],"atype") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/create command"); - atype = force->inumeric(FLERR,arg[iarg+1]); + atype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atype < 0) error->all(FLERR,"Illegal fix bond/create command"); iarg += 2; } else if (strcmp(arg[iarg],"dtype") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/create command"); - dtype = force->inumeric(FLERR,arg[iarg+1]); + dtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (dtype < 0) error->all(FLERR,"Illegal fix bond/create command"); iarg += 2; } else if (strcmp(arg[iarg],"itype") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/create command"); - itype = force->inumeric(FLERR,arg[iarg+1]); + itype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (itype < 0) error->all(FLERR,"Illegal fix bond/create command"); iarg += 2; } else if (strcmp(arg[iarg],"aconstrain") == 0 && strcmp(style,"bond/create/angle") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix bond/create/angle command"); - amin = force->numeric(FLERR,arg[iarg+1]); - amax = force->inumeric(FLERR,arg[iarg+2]); + amin = utils::numeric(FLERR,arg[iarg+1],false,lmp); + amax = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (amin >= amax) error->all(FLERR,"Illegal fix bond/create/angle command"); if (amin < 0 || amin > 180) diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 8d3ff14f48..270a497772 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_bond_swap.h" -#include + #include #include #include "atom.h" @@ -59,7 +59,7 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : if (narg != 7) error->all(FLERR,"Illegal fix bond/swap command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix bond/swap command"); force_reneighbor = 1; @@ -69,13 +69,13 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - fraction = force->numeric(FLERR,arg[4]); - double cutoff = force->numeric(FLERR,arg[5]); + fraction = utils::numeric(FLERR,arg[4],false,lmp); + double cutoff = utils::numeric(FLERR,arg[5],false,lmp); cutsq = cutoff*cutoff; // initialize Marsaglia RNG with processor-unique seed - int seed = force->inumeric(FLERR,arg[6]); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); random = new RanMars(lmp,seed + comm->me); // error check diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index f977f59c53..fc306696ed 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_gcmc.h" -#include + #include #include #include "atom.h" @@ -87,14 +87,14 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : // required args - nevery = force->inumeric(FLERR,arg[3]); - nexchanges = force->inumeric(FLERR,arg[4]); - nmcmoves = force->inumeric(FLERR,arg[5]); - ngcmc_type = force->inumeric(FLERR,arg[6]); - seed = force->inumeric(FLERR,arg[7]); - reservoir_temperature = force->numeric(FLERR,arg[8]); - chemical_potential = force->numeric(FLERR,arg[9]); - displace = force->numeric(FLERR,arg[10]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nexchanges = utils::inumeric(FLERR,arg[4],false,lmp); + nmcmoves = utils::inumeric(FLERR,arg[5],false,lmp); + ngcmc_type = utils::inumeric(FLERR,arg[6],false,lmp); + seed = utils::inumeric(FLERR,arg[7],false,lmp); + reservoir_temperature = utils::numeric(FLERR,arg[8],false,lmp); + chemical_potential = utils::numeric(FLERR,arg[9],false,lmp); + displace = utils::numeric(FLERR,arg[10],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix gcmc command"); if (nexchanges < 0) error->all(FLERR,"Illegal fix gcmc command"); @@ -287,9 +287,9 @@ void FixGCMC::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"mcmoves") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix gcmc command"); - patomtrans = force->numeric(FLERR,arg[iarg+1]); - pmoltrans = force->numeric(FLERR,arg[iarg+2]); - pmolrotate = force->numeric(FLERR,arg[iarg+3]); + patomtrans = utils::numeric(FLERR,arg[iarg+1],false,lmp); + pmoltrans = utils::numeric(FLERR,arg[iarg+2],false,lmp); + pmolrotate = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (patomtrans < 0 || pmoltrans < 0 || pmolrotate < 0) error->all(FLERR,"Illegal fix gcmc command"); pmctot = patomtrans + pmoltrans + pmolrotate; @@ -308,21 +308,21 @@ void FixGCMC::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"maxangle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - max_rotation_angle = force->numeric(FLERR,arg[iarg+1]); + max_rotation_angle = utils::numeric(FLERR,arg[iarg+1],false,lmp); max_rotation_angle *= MY_PI/180; iarg += 2; } else if (strcmp(arg[iarg],"pressure") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - pressure = force->numeric(FLERR,arg[iarg+1]); + pressure = utils::numeric(FLERR,arg[iarg+1],false,lmp); pressure_flag = true; iarg += 2; } else if (strcmp(arg[iarg],"fugacity_coeff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - fugacity_coeff = force->numeric(FLERR,arg[iarg+1]); + fugacity_coeff = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - charge = force->numeric(FLERR,arg[iarg+1]); + charge = utils::numeric(FLERR,arg[iarg+1],false,lmp); charge_flag = true; iarg += 2; } else if (strcmp(arg[iarg],"rigid") == 0) { @@ -369,7 +369,7 @@ void FixGCMC::options(int narg, char **arg) ngrouptypesmax*sizeof(char *), "fix_gcmc:grouptypestrings"); } - grouptypes[ngrouptypes] = force->inumeric(FLERR,arg[iarg+1]); + grouptypes[ngrouptypes] = utils::inumeric(FLERR,arg[iarg+1],false,lmp); int n = strlen(arg[iarg+2]) + 1; grouptypestrings[ngrouptypes] = new char[n]; strcpy(grouptypestrings[ngrouptypes],arg[iarg+2]); @@ -377,25 +377,25 @@ void FixGCMC::options(int narg, char **arg) iarg += 3; } else if (strcmp(arg[iarg],"intra_energy") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - energy_intra = force->numeric(FLERR,arg[iarg+1]); + energy_intra = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"tfac_insert") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - tfac_insert = force->numeric(FLERR,arg[iarg+1]); + tfac_insert = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"overlap_cutoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - double rtmp = force->numeric(FLERR,arg[iarg+1]); + double rtmp = utils::numeric(FLERR,arg[iarg+1],false,lmp); overlap_cutoffsq = rtmp*rtmp; overlap_flag = 1; iarg += 2; } else if (strcmp(arg[iarg],"min") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - min_ngas = force->numeric(FLERR,arg[iarg+1]); + min_ngas = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"max") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - max_ngas = force->numeric(FLERR,arg[iarg+1]); + max_ngas = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR,"Illegal fix gcmc command"); } diff --git a/src/MC/fix_tfmc.cpp b/src/MC/fix_tfmc.cpp index e57f1cdf4a..b855c0b79e 100644 --- a/src/MC/fix_tfmc.cpp +++ b/src/MC/fix_tfmc.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_tfmc.h" -#include + #include #include #include @@ -44,9 +44,9 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : // although we are not doing MD, we would like to use tfMC as an MD "drop in" time_integrate = 1; - d_max = force->numeric(FLERR,arg[3]); - T_set = force->numeric(FLERR,arg[4]); - seed = force->inumeric(FLERR,arg[5]); + d_max = utils::numeric(FLERR,arg[3],false,lmp); + T_set = utils::numeric(FLERR,arg[4],false,lmp); + seed = utils::inumeric(FLERR,arg[5],false,lmp); if (d_max <= 0) error->all(FLERR,"Fix tfmc displacement length must be > 0"); if (T_set <= 0) error->all(FLERR,"Fix tfmc temperature must be > 0"); @@ -62,9 +62,9 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"com") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix tfmc command"); comflag = 1; - xflag = force->inumeric(FLERR,arg[iarg+1]); - yflag = force->inumeric(FLERR,arg[iarg+2]); - zflag = force->inumeric(FLERR,arg[iarg+3]); + xflag = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + yflag = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + zflag = utils::inumeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"rot") == 0) { if (iarg+1 > narg) error->all(FLERR,"Illegal fix tfmc command"); diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index af904bfe6a..94b2481742 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -15,38 +15,35 @@ Contributing author: Evangelos Voyiatzis (Royal DSM) ------------------------------------------------------------------------- */ -#include -#include -#include #include "fix_widom.h" + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "atom_vec_hybrid.h" -#include "molecule.h" -#include "update.h" -#include "modify.h" -#include "fix.h" +#include "bond.h" #include "comm.h" #include "compute.h" -#include "group.h" -#include "domain.h" -#include "region.h" -#include "random_park.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "group.h" #include "improper.h" #include "kspace.h" -#include "math_extra.h" #include "math_const.h" +#include "math_extra.h" #include "memory.h" -#include "error.h" -#include "thermo.h" -#include "output.h" +#include "modify.h" +#include "molecule.h" #include "neighbor.h" -#include +#include "pair.h" +#include "random_park.h" +#include "region.h" +#include "update.h" + +#include +#include using namespace std; using namespace LAMMPS_NS; @@ -83,11 +80,11 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : // required args - nevery = force->inumeric(FLERR,arg[3]); - ninsertions = force->inumeric(FLERR,arg[4]); - nwidom_type = force->inumeric(FLERR,arg[5]); - seed = force->inumeric(FLERR,arg[6]); - insertion_temperature = force->numeric(FLERR,arg[7]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + ninsertions = utils::inumeric(FLERR,arg[4],false,lmp); + nwidom_type = utils::inumeric(FLERR,arg[5],false,lmp); + seed = utils::inumeric(FLERR,arg[6],false,lmp); + insertion_temperature = utils::numeric(FLERR,arg[7],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix Widom command"); if (ninsertions < 0) error->all(FLERR,"Illegal fix Widom command"); @@ -234,7 +231,7 @@ void FixWidom::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix Widom command"); - charge = force->numeric(FLERR,arg[iarg+1]); + charge = utils::numeric(FLERR,arg[iarg+1],false,lmp); charge_flag = true; iarg += 2; } else if (strcmp(arg[iarg],"full_energy") == 0) { @@ -242,7 +239,7 @@ void FixWidom::options(int narg, char **arg) iarg += 1; } else if (strcmp(arg[iarg],"intra_energy") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix Widom command"); - energy_intra = force->numeric(FLERR,arg[iarg+1]); + energy_intra = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR,"Illegal fix Widom command"); } diff --git a/src/MC/fix_widom.h b/src/MC/fix_widom.h index 05060e76ac..19102e4f4a 100644 --- a/src/MC/fix_widom.h +++ b/src/MC/fix_widom.h @@ -20,7 +20,6 @@ FixStyle(widom,FixWidom) #ifndef LMP_FIX_WIDOM_H #define LMP_FIX_WIDOM_H -#include #include "fix.h" namespace LAMMPS_NS { diff --git a/src/MC/pair_dsmc.cpp b/src/MC/pair_dsmc.cpp index ed03ca6ffc..588d57f324 100644 --- a/src/MC/pair_dsmc.cpp +++ b/src/MC/pair_dsmc.cpp @@ -16,19 +16,17 @@ ------------------------------------------------------------------------- */ #include "pair_dsmc.h" -#include -#include -#include + #include "atom.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" -#include "domain.h" -#include "update.h" #include "random_mars.h" -#include "utils.h" -#include "fmt/format.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -209,12 +207,12 @@ void PairDSMC::settings(int narg, char **arg) if (narg != 6) error->all(FLERR,"Illegal pair_style command"); cut_global = 0.0; - max_cell_size = force->numeric(FLERR,arg[0]); - seed = force->inumeric(FLERR,arg[1]); - weighting = force->numeric(FLERR,arg[2]); - T_ref = force->numeric(FLERR,arg[3]); - recompute_vsigmamax_stride = force->inumeric(FLERR,arg[4]); - vsigmamax_samples = force->inumeric(FLERR,arg[5]); + max_cell_size = utils::numeric(FLERR,arg[0],false,lmp); + seed = utils::inumeric(FLERR,arg[1],false,lmp); + weighting = utils::numeric(FLERR,arg[2],false,lmp); + T_ref = utils::numeric(FLERR,arg[3],false,lmp); + recompute_vsigmamax_stride = utils::inumeric(FLERR,arg[4],false,lmp); + vsigmamax_samples = utils::inumeric(FLERR,arg[5],false,lmp); // initialize Marsaglia RNG with processor-unique seed @@ -245,13 +243,13 @@ void PairDSMC::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double sigma_one = force->numeric(FLERR,arg[2]); + double sigma_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MISC/compute_msd_nongauss.cpp b/src/MISC/compute_msd_nongauss.cpp index 6123bf49af..7f4e6b1f3c 100644 --- a/src/MISC/compute_msd_nongauss.cpp +++ b/src/MISC/compute_msd_nongauss.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_msd_nongauss.h" -#include + #include "atom.h" #include "update.h" #include "group.h" diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index 06188de238..d8be8679c6 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_ti.h" -#include + #include #include "atom.h" #include "update.h" @@ -28,6 +28,7 @@ #include "variable.h" #include "error.h" + using namespace LAMMPS_NS; enum{PAIR,TAIL,KSPACE}; @@ -79,7 +80,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : int n = strlen(arg[iarg]) + 1; pstyle[nterms] = new char[n]; strcpy(pstyle[nterms],arg[iarg]); - force->bounds(FLERR,arg[iarg+1],atom->ntypes,ilo[nterms],ihi[nterms]); + utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,ilo[nterms],ihi[nterms],error); iarg += 1; if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) { diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index 022591839f..9f2bbfe424 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -24,7 +24,7 @@ #include "dump_xtc.h" #include -#include + #include #include #include "domain.h" @@ -283,7 +283,7 @@ int DumpXTC::modify_param(int narg, char **arg) return 2; } else if (strcmp(arg[0],"precision") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - precision = force->numeric(FLERR,arg[1]); + precision = utils::numeric(FLERR,arg[1],false,lmp); if ((fabs(precision-10.0) > EPS) && (fabs(precision-100.0) > EPS) && (fabs(precision-1000.0) > EPS) && (fabs(precision-10000.0) > EPS) && (fabs(precision-100000.0) > EPS) && @@ -292,13 +292,13 @@ int DumpXTC::modify_param(int narg, char **arg) return 2; } else if (strcmp(arg[0],"sfactor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - sfactor = force->numeric(FLERR,arg[1]); + sfactor = utils::numeric(FLERR,arg[1],false,lmp); if (sfactor <= 0.0) error->all(FLERR,"Illegal dump_modify sfactor value (must be > 0.0)"); return 2; } else if (strcmp(arg[0],"tfactor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - tfactor = force->numeric(FLERR,arg[1]); + tfactor = utils::numeric(FLERR,arg[1],false,lmp); if (tfactor <= 0.0) error->all(FLERR,"Illegal dump_modify tfactor value (must be > 0.0)"); return 2; diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 4d65457340..7ee6fce1b9 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -12,26 +12,25 @@ ------------------------------------------------------------------------- */ #include "fix_deposit.h" -#include -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "molecule.h" -#include "force.h" -#include "update.h" -#include "modify.h" -#include "fix.h" #include "comm.h" #include "domain.h" -#include "lattice.h" -#include "region.h" -#include "random_park.h" -#include "math_extra.h" -#include "math_const.h" -#include "memory.h" #include "error.h" -#include "fmt/format.h" +#include "fix.h" +#include "lattice.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "molecule.h" +#include "random_park.h" +#include "region.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -56,10 +55,10 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : // required args - ninsert = force->inumeric(FLERR,arg[3]); - ntype = force->inumeric(FLERR,arg[4]); - nfreq = force->inumeric(FLERR,arg[5]); - seed = force->inumeric(FLERR,arg[6]); + ninsert = utils::inumeric(FLERR,arg[3],false,lmp); + ntype = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); + seed = utils::inumeric(FLERR,arg[6],false,lmp); if (seed <= 0) error->all(FLERR,"Illegal fix deposit command"); @@ -712,9 +711,9 @@ void FixDeposit::options(int narg, char **arg) } else if (strcmp(arg[iarg],"molfrac") == 0) { if (mode != MOLECULE) error->all(FLERR,"Illegal fix deposit command"); if (iarg+nmol+1 > narg) error->all(FLERR,"Illegal fix deposit command"); - molfrac[0] = force->numeric(FLERR,arg[iarg+1]); + molfrac[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); for (int i = 1; i < nmol; i++) - molfrac[i] = molfrac[i-1] + force->numeric(FLERR,arg[iarg+i+1]); + molfrac[i] = molfrac[i-1] + utils::numeric(FLERR,arg[iarg+i+1],false,lmp); if (molfrac[nmol-1] < 1.0-EPSILON || molfrac[nmol-1] > 1.0+EPSILON) error->all(FLERR,"Illegal fix deposit command"); molfrac[nmol-1] = 1.0; @@ -747,54 +746,54 @@ void FixDeposit::options(int narg, char **arg) if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); globalflag = 1; localflag = 0; - lo = force->numeric(FLERR,arg[iarg+1]); - hi = force->numeric(FLERR,arg[iarg+2]); + lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"local") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); localflag = 1; globalflag = 0; - lo = force->numeric(FLERR,arg[iarg+1]); - hi = force->numeric(FLERR,arg[iarg+2]); - deltasq = force->numeric(FLERR,arg[iarg+3]) * - force->numeric(FLERR,arg[iarg+3]); + lo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + hi = utils::numeric(FLERR,arg[iarg+2],false,lmp); + deltasq = utils::numeric(FLERR,arg[iarg+3],false,lmp) * + utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"near") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - nearsq = force->numeric(FLERR,arg[iarg+1]) * - force->numeric(FLERR,arg[iarg+1]); + nearsq = utils::numeric(FLERR,arg[iarg+1],false,lmp) * + utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"attempt") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); - maxattempt = force->inumeric(FLERR,arg[iarg+1]); + maxattempt = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"rate") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix deposit command"); rateflag = 1; - rate = force->numeric(FLERR,arg[iarg+1]); + rate = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"vx") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); - vxlo = force->numeric(FLERR,arg[iarg+1]); - vxhi = force->numeric(FLERR,arg[iarg+2]); + vxlo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + vxhi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"vy") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); - vylo = force->numeric(FLERR,arg[iarg+1]); - vyhi = force->numeric(FLERR,arg[iarg+2]); + vylo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + vyhi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"vz") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deposit command"); - vzlo = force->numeric(FLERR,arg[iarg+1]); - vzhi = force->numeric(FLERR,arg[iarg+2]); + vzlo = utils::numeric(FLERR,arg[iarg+1],false,lmp); + vzhi = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"orient") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); orientflag = 1; - rx = force->numeric(FLERR,arg[iarg+1]); - ry = force->numeric(FLERR,arg[iarg+2]); - rz = force->numeric(FLERR,arg[iarg+3]); + rx = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ry = utils::numeric(FLERR,arg[iarg+2],false,lmp); + rz = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (domain->dimension == 2 && (rx != 0.0 || ry != 0.0)) error->all(FLERR,"Illegal fix deposit orient settings"); if (rx == 0.0 && ry == 0.0 && rz == 0.0) @@ -808,17 +807,17 @@ void FixDeposit::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"gaussian") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix deposit command"); - xmid = force->numeric(FLERR,arg[iarg+1]); - ymid = force->numeric(FLERR,arg[iarg+2]); - zmid = force->numeric(FLERR,arg[iarg+3]); - sigma = force->numeric(FLERR,arg[iarg+4]); + xmid = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ymid = utils::numeric(FLERR,arg[iarg+2],false,lmp); + zmid = utils::numeric(FLERR,arg[iarg+3],false,lmp); + sigma = utils::numeric(FLERR,arg[iarg+4],false,lmp); distflag = DIST_GAUSSIAN; iarg += 5; } else if (strcmp(arg[iarg],"target") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deposit command"); - tx = force->numeric(FLERR,arg[iarg+1]); - ty = force->numeric(FLERR,arg[iarg+2]); - tz = force->numeric(FLERR,arg[iarg+3]); + tx = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ty = utils::numeric(FLERR,arg[iarg+2],false,lmp); + tz = utils::numeric(FLERR,arg[iarg+3],false,lmp); targetflag = 1; iarg += 4; } else error->all(FLERR,"Illegal fix deposit command"); diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index 5a13b93b91..bd2f9acfb9 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_efield.h" -#include + #include #include "atom.h" #include "update.h" @@ -64,7 +64,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : xstr = new char[n]; strcpy(xstr,&arg[3][2]); } else { - ex = qe2f * force->numeric(FLERR,arg[3]); + ex = qe2f * utils::numeric(FLERR,arg[3],false,lmp); xstyle = CONSTANT; } @@ -73,7 +73,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : ystr = new char[n]; strcpy(ystr,&arg[4][2]); } else { - ey = qe2f * force->numeric(FLERR,arg[4]); + ey = qe2f * utils::numeric(FLERR,arg[4],false,lmp); ystyle = CONSTANT; } @@ -82,7 +82,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : zstr = new char[n]; strcpy(zstr,&arg[5][2]); } else { - ez = qe2f * force->numeric(FLERR,arg[5]); + ez = qe2f * utils::numeric(FLERR,arg[5],false,lmp); zstyle = CONSTANT; } diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index c7e7af9057..6396d139a0 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_evaporate.h" -#include + #include #include "atom.h" #include "atom_vec.h" @@ -41,13 +41,13 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extscalar = 0; - nevery = force->inumeric(FLERR,arg[3]); - nflux = force->inumeric(FLERR,arg[4]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nflux = utils::inumeric(FLERR,arg[4],false,lmp); iregion = domain->find_region(arg[5]); int n = strlen(arg[5]) + 1; idregion = new char[n]; strcpy(idregion,arg[5]); - int seed = force->inumeric(FLERR,arg[6]); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); if (nevery <= 0 || nflux <= 0) error->all(FLERR,"Illegal fix evaporate command"); diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 0e4c61813b..75642b632f 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_gld.h" -#include + #include #include #include "atom.h" @@ -55,16 +55,16 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : // 1 = Group ID (e.g., all) // 2 = gld (name of this fix) // 3 = t_start (Starting target temperature) - t_start = force->numeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[3],false,lmp); // 4 = t_stop (Stopping target temperature) - t_stop = force->numeric(FLERR,arg[4]); + t_stop = utils::numeric(FLERR,arg[4],false,lmp); // 5 = prony_terms (number of terms in Prony series) - prony_terms = force->inumeric(FLERR,arg[5]); + prony_terms = utils::inumeric(FLERR,arg[5],false,lmp); // 6 = seed (random seed) - int seed = force->inumeric(FLERR,arg[6]); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); // 7 = series type if(strcmp(arg[7],"pprony") == 0) { @@ -99,8 +99,8 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : int iarg = narg_min; int icoeff = 0; while (iarg < narg && icoeff < prony_terms) { - double pc = force->numeric(FLERR,arg[iarg]); - double ptau = force->numeric(FLERR,arg[iarg+1]); + double pc = utils::numeric(FLERR,arg[iarg],false,lmp); + double ptau = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (pc < 0) error->all(FLERR,"Fix gld c coefficients must be >= 0"); diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index 68a27b68be..1ca24a5906 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -16,13 +16,14 @@ ------------------------------------------------------------------------- */ #include "fix_oneway.h" -#include + #include "atom.h" #include "domain.h" #include "error.h" -#include "force.h" #include "region.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; @@ -38,7 +39,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (narg < 6) error->all(FLERR,"Illegal fix oneway command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery < 1) error->all(FLERR,"Illegal fix oneway command"); int len = strlen(arg[4]); diff --git a/src/MISC/fix_orient_bcc.cpp b/src/MISC/fix_orient_bcc.cpp index 8548ee04cf..cc22a509ba 100644 --- a/src/MISC/fix_orient_bcc.cpp +++ b/src/MISC/fix_orient_bcc.cpp @@ -19,25 +19,21 @@ ------------------------------------------------------------------------- */ #include "fix_orient_bcc.h" -#include -#include -#include -#include -#include + #include "atom.h" -#include "update.h" -#include "respa.h" -#include "neighbor.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "math_const.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "comm.h" -#include "force.h" -#include "math_const.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -78,12 +74,12 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - nstats = force->inumeric(FLERR,arg[3]); - direction_of_motion = force->inumeric(FLERR,arg[4]); - a = force->numeric(FLERR,arg[5]); - Vxi = force->numeric(FLERR,arg[6]); - uxif_low = force->numeric(FLERR,arg[7]); - uxif_high = force->numeric(FLERR,arg[8]); + nstats = utils::inumeric(FLERR,arg[3],false,lmp); + direction_of_motion = utils::inumeric(FLERR,arg[4],false,lmp); + a = utils::numeric(FLERR,arg[5],false,lmp); + Vxi = utils::numeric(FLERR,arg[6],false,lmp); + uxif_low = utils::numeric(FLERR,arg[7],false,lmp); + uxif_high = utils::numeric(FLERR,arg[8],false,lmp); if (direction_of_motion == 0) { int n = strlen(arg[9]) + 1; diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index 97c545d189..f391eab91e 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -16,25 +16,21 @@ ------------------------------------------------------------------------- */ #include "fix_orient_fcc.h" -#include -#include -#include -#include -#include + #include "atom.h" -#include "update.h" -#include "respa.h" -#include "neighbor.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "math_const.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "comm.h" -#include "force.h" -#include "math_const.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -76,12 +72,12 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - nstats = force->inumeric(FLERR,arg[3]); - direction_of_motion = force->inumeric(FLERR,arg[4]); - a = force->numeric(FLERR,arg[5]); - Vxi = force->numeric(FLERR,arg[6]); - uxif_low = force->numeric(FLERR,arg[7]); - uxif_high = force->numeric(FLERR,arg[8]); + nstats = utils::inumeric(FLERR,arg[3],false,lmp); + direction_of_motion = utils::inumeric(FLERR,arg[4],false,lmp); + a = utils::numeric(FLERR,arg[5],false,lmp); + Vxi = utils::numeric(FLERR,arg[6],false,lmp); + uxif_low = utils::numeric(FLERR,arg[7],false,lmp); + uxif_high = utils::numeric(FLERR,arg[8],false,lmp); if (direction_of_motion == 0) { int n = strlen(arg[9]) + 1; diff --git a/src/MISC/fix_thermal_conductivity.cpp b/src/MISC/fix_thermal_conductivity.cpp index d0add6fecb..115045db81 100644 --- a/src/MISC/fix_thermal_conductivity.cpp +++ b/src/MISC/fix_thermal_conductivity.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_thermal_conductivity.h" -#include + #include #include "atom.h" #include "force.h" @@ -41,7 +41,7 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix thermal/conductivity command"); scalar_flag = 1; @@ -53,7 +53,7 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, else if (strcmp(arg[4],"z") == 0) edim = 2; else error->all(FLERR,"Illegal fix thermal/conductivity command"); - nbin = force->inumeric(FLERR,arg[5]); + nbin = utils::inumeric(FLERR,arg[5],false,lmp); if (nbin % 2 || nbin <= 2) error->all(FLERR,"Illegal fix thermal/conductivity command"); @@ -66,7 +66,7 @@ FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, if (strcmp(arg[iarg],"swap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix thermal/conductivity command"); - nswap = force->inumeric(FLERR,arg[iarg+1]); + nswap = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nswap <= 0) error->all(FLERR, "Fix thermal/conductivity swap value must be positive"); diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index 896eb24b7c..2d38f3c6c6 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_ttm.h" -#include + #include #include #include "atom.h" @@ -29,8 +29,8 @@ #include "random_mars.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + #include "tokenizer.h" using namespace LAMMPS_NS; @@ -58,17 +58,17 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; restart_global = 1; - seed = force->inumeric(FLERR,arg[3]); - electronic_specific_heat = force->numeric(FLERR,arg[4]); - electronic_density = force->numeric(FLERR,arg[5]); - electronic_thermal_conductivity = force->numeric(FLERR,arg[6]); - gamma_p = force->numeric(FLERR,arg[7]); - gamma_s = force->numeric(FLERR,arg[8]); - v_0 = force->numeric(FLERR,arg[9]); - nxnodes = force->inumeric(FLERR,arg[10]); - nynodes = force->inumeric(FLERR,arg[11]); - nznodes = force->inumeric(FLERR,arg[12]); - nfileevery = force->inumeric(FLERR,arg[14]); + seed = utils::inumeric(FLERR,arg[3],false,lmp); + electronic_specific_heat = utils::numeric(FLERR,arg[4],false,lmp); + electronic_density = utils::numeric(FLERR,arg[5],false,lmp); + electronic_thermal_conductivity = utils::numeric(FLERR,arg[6],false,lmp); + gamma_p = utils::numeric(FLERR,arg[7],false,lmp); + gamma_s = utils::numeric(FLERR,arg[8],false,lmp); + v_0 = utils::numeric(FLERR,arg[9],false,lmp); + nxnodes = utils::inumeric(FLERR,arg[10],false,lmp); + nynodes = utils::inumeric(FLERR,arg[11],false,lmp); + nznodes = utils::inumeric(FLERR,arg[12],false,lmp); + nfileevery = utils::inumeric(FLERR,arg[14],false,lmp); if (nfileevery) { if (narg != 16) error->all(FLERR,"Illegal fix ttm command"); diff --git a/src/MISC/fix_viscosity.cpp b/src/MISC/fix_viscosity.cpp index d5a97cd4b0..5dcd2d291d 100644 --- a/src/MISC/fix_viscosity.cpp +++ b/src/MISC/fix_viscosity.cpp @@ -17,14 +17,14 @@ ------------------------------------------------------------------------- */ #include "fix_viscosity.h" -#include -#include -#include + #include "atom.h" #include "domain.h" -#include "modify.h" #include "error.h" -#include "force.h" +#include "modify.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -43,7 +43,7 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix viscosity command"); scalar_flag = 1; @@ -60,7 +60,7 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[5],"z") == 0) pdim = 2; else error->all(FLERR,"Illegal fix viscosity command"); - nbin = force->inumeric(FLERR,arg[6]); + nbin = utils::inumeric(FLERR,arg[6],false,lmp); if (nbin % 2 || nbin <= 2) error->all(FLERR,"Illegal fix viscosity command"); // optional keywords @@ -72,14 +72,14 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"swap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command"); - nswap = force->inumeric(FLERR,arg[iarg+1]); + nswap = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nswap <= 0) error->all(FLERR,"Fix viscosity swap value must be positive"); iarg += 2; } else if (strcmp(arg[iarg],"vtarget") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command"); if (strcmp(arg[iarg+1],"INF") == 0) vtarget = BIG; - else vtarget = force->numeric(FLERR,arg[iarg+1]); + else vtarget = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (vtarget <= 0.0) error->all(FLERR,"Fix viscosity vtarget value must be positive"); iarg += 2; diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index 07731fe93b..4fc1fb0628 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_nm_cut.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -179,7 +179,7 @@ void PairNMCut::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -202,16 +202,16 @@ void PairNMCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double e0_one = force->numeric(FLERR,arg[2]); - double r0_one = force->numeric(FLERR,arg[3]); - double nn_one = force->numeric(FLERR,arg[4]); - double mm_one = force->numeric(FLERR,arg[5]); + double e0_one = utils::numeric(FLERR,arg[2],false,lmp); + double r0_one = utils::numeric(FLERR,arg[3],false,lmp); + double nn_one = utils::numeric(FLERR,arg[4],false,lmp); + double mm_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_one = cut_global; - if (narg == 7) cut_one = force->numeric(FLERR,arg[6]); + if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 270f4080ee..4a18680415 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_nm_cut_coul_cut.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -203,9 +203,9 @@ void PairNMCutCoulCut::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[1]); + else cut_coul_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -231,18 +231,18 @@ void PairNMCutCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double e0_one = force->numeric(FLERR,arg[2]); - double r0_one = force->numeric(FLERR,arg[3]); - double nn_one = force->numeric(FLERR,arg[4]); - double mm_one = force->numeric(FLERR,arg[5]); + double e0_one = utils::numeric(FLERR,arg[2],false,lmp); + double r0_one = utils::numeric(FLERR,arg[3],false,lmp); + double nn_one = utils::numeric(FLERR,arg[4],false,lmp); + double mm_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 7) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[4]); - if (narg == 8) cut_coul_one = force->numeric(FLERR,arg[5]); + if (narg >= 7) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); + if (narg == 8) cut_coul_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index b63ede2b63..576637c593 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_nm_cut_coul_long.h" -#include + #include #include #include "atom.h" @@ -28,7 +28,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -242,9 +242,9 @@ void PairNMCutCoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -267,16 +267,16 @@ void PairNMCutCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double e0_one = force->numeric(FLERR,arg[2]); - double r0_one = force->numeric(FLERR,arg[3]); - double nn_one = force->numeric(FLERR,arg[4]); - double mm_one = force->numeric(FLERR,arg[5]); + double e0_one = utils::numeric(FLERR,arg[2],false,lmp); + double r0_one = utils::numeric(FLERR,arg[3],false,lmp); + double nn_one = utils::numeric(FLERR,arg[4],false,lmp); + double mm_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 7) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 7) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp index 134994f829..956cb0196f 100644 --- a/src/MLIAP/compute_mliap.cpp +++ b/src/MLIAP/compute_mliap.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include "mliap_data.h" #include "mliap_model_linear.h" #include "mliap_model_quadratic.h" @@ -22,7 +22,6 @@ #include "update.h" #include "modify.h" #include "neighbor.h" -#include "neigh_list.h" #include "neigh_request.h" #include "force.h" #include "pair.h" diff --git a/src/MLIAP/compute_mliap.h b/src/MLIAP/compute_mliap.h index 5602ace89b..1172111247 100644 --- a/src/MLIAP/compute_mliap.h +++ b/src/MLIAP/compute_mliap.h @@ -21,7 +21,7 @@ ComputeStyle(mliap,ComputeMLIAP) #define LMP_COMPUTE_MLIAP_H #include "compute.h" -#include + namespace LAMMPS_NS { diff --git a/src/MLIAP/mliap_data.cpp b/src/MLIAP/mliap_data.cpp index 7bffd8ec3b..a7e50012cb 100644 --- a/src/MLIAP/mliap_data.cpp +++ b/src/MLIAP/mliap_data.cpp @@ -11,24 +11,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include #include "mliap_data.h" -#include "mliap_model_linear.h" -#include "mliap_model_quadratic.h" -#include "mliap_descriptor_snap.h" -#include "compute_mliap.h" + #include "atom.h" -#include "update.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" -#include "pair.h" -#include "comm.h" #include "memory.h" -#include "error.h" +#include "mliap_descriptor.h" +#include "mliap_model.h" +#include "neigh_list.h" using namespace LAMMPS_NS; diff --git a/src/MLIAP/mliap_descriptor.cpp b/src/MLIAP/mliap_descriptor.cpp index d654b33008..63d4241e01 100644 --- a/src/MLIAP/mliap_descriptor.cpp +++ b/src/MLIAP/mliap_descriptor.cpp @@ -12,14 +12,9 @@ ------------------------------------------------------------------------- */ #include "mliap_descriptor.h" -#include "atom.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; -#define MAXLINE 1024 -#define MAXWORD 3 /* ---------------------------------------------------------------------- */ diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 24e8b19a65..5f0ee33c8c 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -12,20 +12,17 @@ ------------------------------------------------------------------------- */ #include "mliap_descriptor_snap.h" -#include "pair_mliap.h" -#include "mliap_data.h" -#include -#include -#include -#include + #include "atom.h" -#include "force.h" #include "comm.h" -#include "utils.h" -#include "sna.h" -#include "memory.h" #include "error.h" -#include "fmt/format.h" +#include "memory.h" +#include "mliap_data.h" +#include "pair_mliap.h" +#include "sna.h" + +#include +#include using namespace LAMMPS_NS; @@ -376,7 +373,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) FILE *fpparam; if (comm->me == 0) { - fpparam = force->open_potential(paramfilename); + fpparam = utils::open_potential(paramfilename,lmp,nullptr); if (fpparam == NULL) error->one(FLERR,fmt::format("Cannot open SNAP parameter file {}: {}", paramfilename, utils::getsyserror())); diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index bc760b7a68..b731e1c9f8 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -12,17 +12,12 @@ ------------------------------------------------------------------------- */ #include "mliap_model.h" -#include "pair_mliap.h" -#include -#include -#include "atom.h" -#include "force.h" + #include "comm.h" -#include "utils.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" -#include "fmt/format.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; @@ -85,7 +80,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) FILE *fpcoeff; if (comm->me == 0) { - fpcoeff = force->open_potential(coefffilename); + fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); if (fpcoeff == NULL) error->one(FLERR,fmt::format("Cannot open MLIAPModel coeff file {}: {}", coefffilename,utils::getsyserror())); diff --git a/src/MLIAP/mliap_model_linear.h b/src/MLIAP/mliap_model_linear.h index 67ba0985a2..326407faa8 100644 --- a/src/MLIAP/mliap_model_linear.h +++ b/src/MLIAP/mliap_model_linear.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { class MLIAPModelLinear : public MLIAPModel { public: - MLIAPModelLinear(LAMMPS*, char* = NULL); + MLIAPModelLinear(LAMMPS*, char* = nullptr); ~MLIAPModelLinear(); virtual int get_nparams(); virtual int get_gamma_nnz(class MLIAPData*); diff --git a/src/MLIAP/pair_mliap.cpp b/src/MLIAP/pair_mliap.cpp index f2e042141c..4c6d906787 100644 --- a/src/MLIAP/pair_mliap.cpp +++ b/src/MLIAP/pair_mliap.cpp @@ -11,22 +11,22 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include -#include -#include +#include "pair_mliap.h" + #include "mliap_data.h" #include "mliap_model_linear.h" #include "mliap_model_quadratic.h" #include "mliap_descriptor_snap.h" -#include "pair_mliap.h" + #include "atom.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 161ad90ea3..6cd550384d 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_charmm.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -196,12 +196,12 @@ void AngleCharmm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double theta0_one = force->numeric(FLERR,arg[2]); - double k_ub_one = force->numeric(FLERR,arg[3]); - double r_ub_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_one = utils::numeric(FLERR,arg[2],false,lmp); + double k_ub_one = utils::numeric(FLERR,arg[3],false,lmp); + double r_ub_one = utils::numeric(FLERR,arg[4],false,lmp); // convert theta0 from degrees to radians diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 59593d2448..0288a61d83 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "angle_cosine.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -156,9 +156,9 @@ void AngleCosine::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index b305ece7dd..1a05edc20b 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_cosine_periodic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -27,7 +27,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -201,11 +201,11 @@ void AngleCosinePeriodic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double c_one = force->numeric(FLERR,arg[1]); - int b_one = force->inumeric(FLERR,arg[2]); - int n_one = force->inumeric(FLERR,arg[3]); + double c_one = utils::numeric(FLERR,arg[1],false,lmp); + int b_one = utils::inumeric(FLERR,arg[2],false,lmp); + int n_one = utils::inumeric(FLERR,arg[3],false,lmp); if (n_one <= 0) error->all(FLERR,"Incorrect args for angle coefficients"); int count = 0; diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 9056600c3f..5fb40b54c9 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_cosine_squared.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -172,10 +172,10 @@ void AngleCosineSquared::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double theta0_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_one = utils::numeric(FLERR,arg[2],false,lmp); // convert theta0 from degrees to radians diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index baeb9a8ed8..eb5e48ec9b 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "angle_harmonic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -172,10 +172,10 @@ void AngleHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double theta0_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_one = utils::numeric(FLERR,arg[2],false,lmp); // convert theta0 from degrees to radians diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 4890a11975..100b75cb0a 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "angle_table.h" -#include + #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -28,10 +28,10 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "table_file_reader.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -190,7 +190,7 @@ void AngleTable::settings(int narg, char **arg) else if (strcmp(arg[0],"spline") == 0) tabstyle = SPLINE; else error->all(FLERR,"Unknown table style in angle style table"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of angle table entries"); // delete old tables, since cannot just change settings @@ -218,7 +218,7 @@ void AngleTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/MOLECULE/atom_vec_template.cpp b/src/MOLECULE/atom_vec_template.cpp index 97d4c865ba..ead8de7cb5 100644 --- a/src/MOLECULE/atom_vec_template.cpp +++ b/src/MOLECULE/atom_vec_template.cpp @@ -12,15 +12,10 @@ ------------------------------------------------------------------------- */ #include "atom_vec_template.h" + #include "atom.h" -#include "molecule.h" -#include "comm.h" -#include "domain.h" -#include "modify.h" -#include "fix.h" -#include "memory.h" #include "error.h" -#include "utils.h" +#include "molecule.h" using namespace LAMMPS_NS; diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index 357c37b7a2..b2271d45fc 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "bond_fene.h" -#include + #include #include #include "atom.h" @@ -22,8 +22,8 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; @@ -152,12 +152,12 @@ void BondFENE::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double r0_one = force->numeric(FLERR,arg[2]); - double epsilon_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); + double epsilon_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 9cdc2639a5..676d5f6871 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "bond_fene_expand.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -21,7 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -159,13 +159,13 @@ void BondFENEExpand::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double r0_one = force->numeric(FLERR,arg[2]); - double epsilon_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); - double shift_one = force->numeric(FLERR,arg[5]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); + double epsilon_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); + double shift_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 27447d7298..89b3830cb5 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "bond_gromos.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -24,7 +24,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -123,10 +123,10 @@ void BondGromos::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double r0_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 5ea60cda46..28100512a8 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "bond_harmonic.h" -#include + #include #include #include "atom.h" @@ -21,7 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -124,10 +124,10 @@ void BondHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double r0_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index c644d2be1c..49074e1cdc 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "bond_morse.h" -#include + #include #include #include "atom.h" @@ -25,7 +25,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -126,11 +126,11 @@ void BondMorse::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double d0_one = force->numeric(FLERR,arg[1]); - double alpha_one = force->numeric(FLERR,arg[2]); - double r0_one = force->numeric(FLERR,arg[3]); + double d0_one = utils::numeric(FLERR,arg[1],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[2],false,lmp); + double r0_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 1451fa29c2..63b640730a 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "bond_nonlinear.h" -#include + #include #include #include "atom.h" @@ -21,7 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -123,11 +123,11 @@ void BondNonlinear::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double epsilon_one = force->numeric(FLERR,arg[1]); - double r0_one = force->numeric(FLERR,arg[2]); - double lamda_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[1],false,lmp); + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); + double lamda_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index 813e322473..c8d182e4ff 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "bond_quartic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -25,7 +25,7 @@ #include "pair.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -201,13 +201,13 @@ void BondQuartic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double b1_one = force->numeric(FLERR,arg[2]); - double b2_one = force->numeric(FLERR,arg[3]); - double rc_one = force->numeric(FLERR,arg[4]); - double u0_one = force->numeric(FLERR,arg[5]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double b1_one = utils::numeric(FLERR,arg[2],false,lmp); + double b2_one = utils::numeric(FLERR,arg[3],false,lmp); + double rc_one = utils::numeric(FLERR,arg[4],false,lmp); + double u0_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 3a1529a155..5cc91ceae0 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "bond_table.h" -#include + #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,10 +26,10 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "table_file_reader.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; @@ -142,7 +142,7 @@ void BondTable::settings(int narg, char **arg) else if (strcmp(arg[0],"spline") == 0) tabstyle = SPLINE; else error->all(FLERR,"Unknown table style in bond style table"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of bond table entries"); // delete old tables, since cannot just change settings @@ -170,7 +170,7 @@ void BondTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); int me; MPI_Comm_rank(world,&me); diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 0163772123..11422e0820 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_charmm.h" -#include + #include #include #include "atom.h" @@ -29,7 +29,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -330,16 +330,16 @@ void DihedralCharmm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // require integer values of shift for backwards compatibility // arbitrary phase angle shift could be allowed, but would break // backwards compatibility and is probably not needed - double k_one = force->numeric(FLERR,arg[1]); - int multiplicity_one = force->inumeric(FLERR,arg[2]); - int shift_one = force->inumeric(FLERR,arg[3]); - double weight_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + int multiplicity_one = utils::inumeric(FLERR,arg[2],false,lmp); + int shift_one = utils::inumeric(FLERR,arg[3],false,lmp); + double weight_one = utils::numeric(FLERR,arg[4],false,lmp); if (multiplicity_one < 0) error->all(FLERR,"Incorrect multiplicity arg for dihedral coefficients"); diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 39b7e92bd2..408be8ef99 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -19,7 +19,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_charmmfsw.h" -#include + #include #include #include "atom.h" @@ -32,7 +32,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -348,16 +348,16 @@ void DihedralCharmmfsw::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // require integer values of shift for backwards compatibility // arbitrary phase angle shift could be allowed, but would break // backwards compatibility and is probably not needed - double k_one = force->numeric(FLERR,arg[1]); - int multiplicity_one = force->inumeric(FLERR,arg[2]); - int shift_one = force->inumeric(FLERR,arg[3]); - double weight_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + int multiplicity_one = utils::inumeric(FLERR,arg[2],false,lmp); + int shift_one = utils::inumeric(FLERR,arg[3],false,lmp); + double weight_one = utils::numeric(FLERR,arg[4],false,lmp); if (multiplicity_one < 0) error->all(FLERR,"Incorrect multiplicity arg for dihedral coefficients"); diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 48adf07903..55e2f25006 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_harmonic.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -274,11 +274,11 @@ void DihedralHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - int sign_one = force->inumeric(FLERR,arg[2]); - int multiplicity_one = force->inumeric(FLERR,arg[3]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + int sign_one = utils::inumeric(FLERR,arg[2],false,lmp); + int multiplicity_one = utils::inumeric(FLERR,arg[3],false,lmp); // require sign = +/- 1 for backwards compatibility // arbitrary phase angle shift could be allowed, but would break diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 26461883c6..40e026c2f1 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_helix.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -285,11 +285,11 @@ void DihedralHelix::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double aphi_one = force->numeric(FLERR,arg[1]); - double bphi_one = force->numeric(FLERR,arg[2]); - double cphi_one = force->numeric(FLERR,arg[3]); + double aphi_one = utils::numeric(FLERR,arg[1],false,lmp); + double bphi_one = utils::numeric(FLERR,arg[2],false,lmp); + double cphi_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index b5db685247..963304da80 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_multi_harmonic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -25,7 +25,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -275,13 +275,13 @@ void DihedralMultiHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double a1_one = force->numeric(FLERR,arg[1]); - double a2_one = force->numeric(FLERR,arg[2]); - double a3_one = force->numeric(FLERR,arg[3]); - double a4_one = force->numeric(FLERR,arg[4]); - double a5_one = force->numeric(FLERR,arg[5]); + double a1_one = utils::numeric(FLERR,arg[1],false,lmp); + double a2_one = utils::numeric(FLERR,arg[2],false,lmp); + double a3_one = utils::numeric(FLERR,arg[3],false,lmp); + double a4_one = utils::numeric(FLERR,arg[4],false,lmp); + double a5_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index 5dd268b39f..fe05dc7c3d 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_opls.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -288,12 +288,12 @@ void DihedralOPLS::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double k1_one = force->numeric(FLERR,arg[1]); - double k2_one = force->numeric(FLERR,arg[2]); - double k3_one = force->numeric(FLERR,arg[3]); - double k4_one = force->numeric(FLERR,arg[4]); + double k1_one = utils::numeric(FLERR,arg[1],false,lmp); + double k2_one = utils::numeric(FLERR,arg[2],false,lmp); + double k3_one = utils::numeric(FLERR,arg[3],false,lmp); + double k4_one = utils::numeric(FLERR,arg[4],false,lmp); // store 1/2 factor with prefactor diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 5d95ae73c2..2de6dd4183 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -28,9 +28,9 @@ ------------------------------------------------------------------------- */ #include "fix_cmap.h" -#include + #include -#include + #include #include "atom.h" #include "update.h" @@ -41,8 +41,8 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -633,7 +633,7 @@ void FixCMAP::read_grid_map(char *cmapfile) FILE *fp = NULL; if (comm->me == 0) { - fp = force->open_potential(cmapfile); + fp = utils::open_potential(cmapfile,lmp,nullptr); if (fp == NULL) error->one(FLERR,fmt::format("Cannot open fix cmap file {}: {}", cmapfile, utils::getsyserror())); diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 0ffb3f3c31..90cf3eee39 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "improper_cvff.h" -#include + #include #include "atom.h" #include "comm.h" @@ -21,7 +21,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -296,11 +296,11 @@ void ImproperCvff::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - int sign_one = force->inumeric(FLERR,arg[2]); - int multiplicity_one = force->inumeric(FLERR,arg[3]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + int sign_one = utils::inumeric(FLERR,arg[2],false,lmp); + int multiplicity_one = utils::inumeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index e90bc04c90..6327ea8b06 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "improper_harmonic.h" -#include + #include #include "atom.h" #include "comm.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -238,10 +238,10 @@ void ImproperHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double chi_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi_one = utils::numeric(FLERR,arg[2],false,lmp); // convert chi from degrees to radians diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 5259b6baf4..7b2c4e0b09 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "improper_umbrella.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -276,10 +276,10 @@ void ImproperUmbrella::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double w_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double w_one = utils::numeric(FLERR,arg[2],false,lmp); // convert w0 from degrees to radians diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 647060eab7..6d9c851422 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -31,6 +31,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; @@ -300,10 +301,10 @@ void PairHbondDreidingLJ::settings(int narg, char **arg) { if (narg != 4) error->all(FLERR,"Illegal pair_style command"); - ap_global = force->inumeric(FLERR,arg[0]); - cut_inner_global = force->numeric(FLERR,arg[1]); - cut_outer_global = force->numeric(FLERR,arg[2]); - cut_angle_global = force->numeric(FLERR,arg[3]) * MY_PI/180.0; + ap_global = utils::inumeric(FLERR,arg[0],false,lmp); + cut_inner_global = utils::numeric(FLERR,arg[1],false,lmp); + cut_outer_global = utils::numeric(FLERR,arg[2],false,lmp); + cut_angle_global = utils::numeric(FLERR,arg[3],false,lmp) * MY_PI/180.0; } /* ---------------------------------------------------------------------- @@ -317,30 +318,30 @@ void PairHbondDreidingLJ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,klo,khi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - force->bounds(FLERR,arg[2],atom->ntypes,klo,khi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg[2],1,atom->ntypes,klo,khi,error); int donor_flag; if (strcmp(arg[3],"i") == 0) donor_flag = 0; else if (strcmp(arg[3],"j") == 0) donor_flag = 1; else error->all(FLERR,"Incorrect args for pair coefficients"); - double epsilon_one = force->numeric(FLERR,arg[4]); - double sigma_one = force->numeric(FLERR,arg[5]); + double epsilon_one = utils::numeric(FLERR,arg[4],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[5],false,lmp); int ap_one = ap_global; - if (narg > 6) ap_one = force->inumeric(FLERR,arg[6]); + if (narg > 6) ap_one = utils::inumeric(FLERR,arg[6],false,lmp); double cut_inner_one = cut_inner_global; double cut_outer_one = cut_outer_global; if (narg > 8) { - cut_inner_one = force->numeric(FLERR,arg[7]); - cut_outer_one = force->numeric(FLERR,arg[8]); + cut_inner_one = utils::numeric(FLERR,arg[7],false,lmp); + cut_outer_one = utils::numeric(FLERR,arg[8],false,lmp); } if (cut_inner_one>cut_outer_one) error->all(FLERR,"Pair inner cutoff >= Pair outer cutoff"); double cut_angle_one = cut_angle_global; - if (narg == 10) cut_angle_one = force->numeric(FLERR,arg[9]) * MY_PI/180.0; + if (narg == 10) cut_angle_one = utils::numeric(FLERR,arg[9],false,lmp) * MY_PI/180.0; // grow params array if necessary if (nparams == maxparam) { diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index 44eefc07fd..422da8d827 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -31,6 +31,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; @@ -241,31 +242,31 @@ void PairHbondDreidingMorse::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,klo,khi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); - force->bounds(FLERR,arg[2],atom->ntypes,klo,khi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); + utils::bounds(FLERR,arg[2],1,atom->ntypes,klo,khi,error); int donor_flag; if (strcmp(arg[3],"i") == 0) donor_flag = 0; else if (strcmp(arg[3],"j") == 0) donor_flag = 1; else error->all(FLERR,"Incorrect args for pair coefficients"); - double d0_one = force->numeric(FLERR,arg[4]); - double alpha_one = force->numeric(FLERR,arg[5]); - double r0_one = force->numeric(FLERR,arg[6]); + double d0_one = utils::numeric(FLERR,arg[4],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[5],false,lmp); + double r0_one = utils::numeric(FLERR,arg[6],false,lmp); int ap_one = ap_global; - if (narg > 7) ap_one = force->inumeric(FLERR,arg[7]); + if (narg > 7) ap_one = utils::inumeric(FLERR,arg[7],false,lmp); double cut_inner_one = cut_inner_global; double cut_outer_one = cut_outer_global; if (narg > 9) { - cut_inner_one = force->numeric(FLERR,arg[8]); - cut_outer_one = force->numeric(FLERR,arg[9]); + cut_inner_one = utils::numeric(FLERR,arg[8],false,lmp); + cut_outer_one = utils::numeric(FLERR,arg[9],false,lmp); } if (cut_inner_one>cut_outer_one) error->all(FLERR,"Pair inner cutoff >= Pair outer cutoff"); double cut_angle_one = cut_angle_global; - if (narg > 10) cut_angle_one = force->numeric(FLERR,arg[10]) * MY_PI/180.0; + if (narg > 10) cut_angle_one = utils::numeric(FLERR,arg[10],false,lmp) * MY_PI/180.0; // grow params array if necessary diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index 0712f6be73..dea6bd6251 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_charmm_coul_charmm.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -224,14 +224,14 @@ void PairLJCharmmCoulCharmm::settings(int narg, char **arg) if (narg != 2 && narg != 4) error->all(FLERR,"Illegal pair_style command"); - cut_lj_inner = force->numeric(FLERR,arg[0]); - cut_lj = force->numeric(FLERR,arg[1]); + cut_lj_inner = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) { cut_coul_inner = cut_lj_inner; cut_coul = cut_lj; } else { - cut_coul_inner = force->numeric(FLERR,arg[2]); - cut_coul = force->numeric(FLERR,arg[3]); + cut_coul_inner = utils::numeric(FLERR,arg[2],false,lmp); + cut_coul = utils::numeric(FLERR,arg[3],false,lmp); } } @@ -246,16 +246,16 @@ void PairLJCharmmCoulCharmm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double eps14_one = epsilon_one; double sigma14_one = sigma_one; if (narg == 6) { - eps14_one = force->numeric(FLERR,arg[4]); - sigma14_one = force->numeric(FLERR,arg[5]); + eps14_one = utils::numeric(FLERR,arg[4],false,lmp); + sigma14_one = utils::numeric(FLERR,arg[5],false,lmp); } int count = 0; diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 026b96c00c..31083312a9 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -20,7 +20,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_charmmfsw_coul_charmmfsh.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -250,12 +250,12 @@ void PairLJCharmmfswCoulCharmmfsh::settings(int narg, char **arg) if (narg != 2 && narg != 3) error->all(FLERR,"Illegal pair_style command"); - cut_lj_inner = force->numeric(FLERR,arg[0]); - cut_lj = force->numeric(FLERR,arg[1]); + cut_lj_inner = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) { cut_coul = cut_lj; } else { - cut_coul = force->numeric(FLERR,arg[2]); + cut_coul = utils::numeric(FLERR,arg[2],false,lmp); } } @@ -270,16 +270,16 @@ void PairLJCharmmfswCoulCharmmfsh::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double eps14_one = epsilon_one; double sigma14_one = sigma_one; if (narg == 6) { - eps14_one = force->numeric(FLERR,arg[4]); - sigma14_one = force->numeric(FLERR,arg[5]); + eps14_one = utils::numeric(FLERR,arg[4],false,lmp); + sigma14_one = utils::numeric(FLERR,arg[5],false,lmp); } int count = 0; diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index 673fb83066..b5ed255789 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_tip4p_cut.h" -#include + #include #include #include "atom.h" @@ -30,7 +30,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -425,15 +425,15 @@ void PairLJCutTIP4PCut::settings(int narg, char **arg) { if (narg < 6 || narg > 7) error->all(FLERR,"Illegal pair_style command"); - typeO = force->inumeric(FLERR,arg[0]); - typeH = force->inumeric(FLERR,arg[1]); - typeB = force->inumeric(FLERR,arg[2]); - typeA = force->inumeric(FLERR,arg[3]); - qdist = force->numeric(FLERR,arg[4]); + typeO = utils::inumeric(FLERR,arg[0],false,lmp); + typeH = utils::inumeric(FLERR,arg[1],false,lmp); + typeB = utils::inumeric(FLERR,arg[2],false,lmp); + typeA = utils::inumeric(FLERR,arg[3],false,lmp); + qdist = utils::numeric(FLERR,arg[4],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[5]); + cut_lj_global = utils::numeric(FLERR,arg[5],false,lmp); if (narg == 6) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[6]); + else cut_coul = utils::numeric(FLERR,arg[6],false,lmp); cut_coulsq = cut_coul * cut_coul; cut_coulsqplus = (cut_coul + 2.0*qdist) * (cut_coul + 2.0*qdist); @@ -457,14 +457,14 @@ void PairLJCutTIP4PCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 334dbf89c8..8d8f5ec78e 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_tip4p_cut.h" -#include + #include #include "atom.h" #include "force.h" @@ -28,7 +28,7 @@ #include "comm.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -373,12 +373,12 @@ void PairTIP4PCut::settings(int narg, char **arg) { if (narg != 6) error->all(FLERR,"Illegal pair_style command"); - typeO = force->inumeric(FLERR,arg[0]); - typeH = force->inumeric(FLERR,arg[1]); - typeB = force->inumeric(FLERR,arg[2]); - typeA = force->inumeric(FLERR,arg[3]); - qdist = force->numeric(FLERR,arg[4]); - cut_coul = force->numeric(FLERR,arg[5]); + typeO = utils::inumeric(FLERR,arg[0],false,lmp); + typeH = utils::inumeric(FLERR,arg[1],false,lmp); + typeB = utils::inumeric(FLERR,arg[2],false,lmp); + typeA = utils::inumeric(FLERR,arg[3],false,lmp); + qdist = utils::numeric(FLERR,arg[4],false,lmp); + cut_coul = utils::numeric(FLERR,arg[5],false,lmp); cut_coulsq = cut_coul * cut_coul; cut_coulsqplus = (cut_coul + 2.0*qdist) * (cut_coul + 2.0*qdist); @@ -395,8 +395,8 @@ void PairTIP4PCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 9d15e8b1a8..62d940af37 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -18,7 +18,7 @@ #include "omp_compat.h" #include "dump_atom_mpiio.h" #include -#include + #include #include "domain.h" #include "update.h" diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index bca19e58c8..6d5fc3da8e 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -17,15 +17,16 @@ #include "omp_compat.h" #include "dump_cfg_mpiio.h" -#include -#include -#include + #include "atom.h" #include "domain.h" #include "update.h" #include "memory.h" #include "error.h" +#include +#include + #ifdef LMP_USER_IO_TIMER #include #include diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index 3f9c09738e..b623df82d0 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -18,7 +18,7 @@ #include "omp_compat.h" #include "dump_custom_mpiio.h" #include -#include + #include #include "domain.h" #include "input.h" diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index d1b2d5079a..139245e4b0 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -18,7 +18,7 @@ #include "omp_compat.h" #include "dump_xyz_mpiio.h" #include -#include + #include #include "domain.h" #include "update.h" diff --git a/src/MPIIO/restart_mpiio.cpp b/src/MPIIO/restart_mpiio.cpp index 66c7d8a417..b2caa411e3 100644 --- a/src/MPIIO/restart_mpiio.cpp +++ b/src/MPIIO/restart_mpiio.cpp @@ -16,8 +16,7 @@ ------------------------------------------------------------------------- */ #include "restart_mpiio.h" -#include -#include + #include "error.h" using namespace LAMMPS_NS; diff --git a/src/MSCG/fix_mscg.cpp b/src/MSCG/fix_mscg.cpp index caa9a528a7..29d6d550e4 100644 --- a/src/MSCG/fix_mscg.cpp +++ b/src/MSCG/fix_mscg.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "fix_mscg.h" -#include + #include -#include + #include "mscg.h" #include "atom.h" #include "comm.h" @@ -43,7 +43,7 @@ FixMSCG::FixMSCG(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal fix mscg command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix mscg command"); me = comm->me; diff --git a/src/Makefile b/src/Makefile index 4528c027cf..8216d5164c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -85,8 +85,8 @@ PACKUSERUC = $(call uppercase,$(PACKUSER)) YESDIR = $(call uppercase,$(@:yes-%=%)) NODIR = $(call uppercase,$(@:no-%=%)) -LIBDIR = $($(@:lib-%=%)) -LIBUSERDIR = $($(@:lib-user-%=%)) +LIBDIR = $(@:lib-%=%) +LIBUSERDIR = $(@:lib-user-%=%) # List of all targets diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index e6b6fb72f4..82510e8177 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -21,7 +21,7 @@ #include "pair_eam_opt.h" #include -#include + #include "atom.h" #include "comm.h" #include "force.h" diff --git a/src/OPT/pair_lj_charmm_coul_long_opt.cpp b/src/OPT/pair_lj_charmm_coul_long_opt.cpp index 3dc6bdb6b4..a7fbfb823a 100644 --- a/src/OPT/pair_lj_charmm_coul_long_opt.cpp +++ b/src/OPT/pair_lj_charmm_coul_long_opt.cpp @@ -20,7 +20,7 @@ #include "pair_lj_charmm_coul_long_opt.h" #include -#include + #include "atom.h" #include "force.h" #include "neigh_list.h" diff --git a/src/OPT/pair_lj_cut_opt.cpp b/src/OPT/pair_lj_cut_opt.cpp index 3b3a19a9e8..a31f521ecc 100644 --- a/src/OPT/pair_lj_cut_opt.cpp +++ b/src/OPT/pair_lj_cut_opt.cpp @@ -19,7 +19,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_opt.h" -#include + #include "atom.h" #include "force.h" #include "neigh_list.h" diff --git a/src/OPT/pair_morse_opt.cpp b/src/OPT/pair_morse_opt.cpp index 1d2e226777..89d254ee04 100644 --- a/src/OPT/pair_morse_opt.cpp +++ b/src/OPT/pair_morse_opt.cpp @@ -20,7 +20,7 @@ #include "pair_morse_opt.h" #include -#include + #include "atom.h" #include "force.h" #include "neigh_list.h" diff --git a/src/OPT/pair_ufm_opt.cpp b/src/OPT/pair_ufm_opt.cpp index d824d82e6c..2cb5323745 100644 --- a/src/OPT/pair_ufm_opt.cpp +++ b/src/OPT/pair_ufm_opt.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_ufm_opt.h" -#include + #include #include "atom.h" #include "force.h" diff --git a/src/PERI/atom_vec_peri.cpp b/src/PERI/atom_vec_peri.cpp index 5ce74575ba..ada25431c8 100644 --- a/src/PERI/atom_vec_peri.cpp +++ b/src/PERI/atom_vec_peri.cpp @@ -16,13 +16,14 @@ ------------------------------------------------------------------------- */ #include "atom_vec_peri.h" -#include -#include + #include "atom.h" #include "citeme.h" -#include "memory.h" #include "error.h" +#include +#include + using namespace LAMMPS_NS; static const char cite_peri_package[] = diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 022eb0bab6..2950381197 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_peri_neigh.h" -#include + #include #include "pair_peri_lps.h" #include "pair_peri_ves.h" diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index cae33fe580..0e5760ac8d 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -16,24 +16,22 @@ ------------------------------------------------------------------------- */ #include "pair_peri_eps.h" -#include + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_peri_neigh.h" +#include "force.h" +#include "lattice.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" + #include #include -#include -#include "atom.h" -#include "domain.h" -#include "lattice.h" -#include "force.h" -#include "modify.h" -#include "fix.h" -#include "fix_peri_neigh.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "math_const.h" -#include "error.h" -#include "utils.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -450,15 +448,15 @@ void PairPeriEPS::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double bulkmodulus_one = force->numeric(FLERR,arg[2]); - double shearmodulus_one = force->numeric(FLERR,arg[3]); - double cut_one = force->numeric(FLERR,arg[4]); - double s00_one = force->numeric(FLERR,arg[5]); - double alpha_one = force->numeric(FLERR,arg[6]); - double myieldstress_one = force->numeric(FLERR,arg[7]); + double bulkmodulus_one = utils::numeric(FLERR,arg[2],false,lmp); + double shearmodulus_one = utils::numeric(FLERR,arg[3],false,lmp); + double cut_one = utils::numeric(FLERR,arg[4],false,lmp); + double s00_one = utils::numeric(FLERR,arg[5],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[6],false,lmp); + double myieldstress_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index 65c6c30e19..b60f28d9f1 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -16,24 +16,21 @@ ------------------------------------------------------------------------- */ #include "pair_peri_lps.h" -#include -#include -#include -#include + #include "atom.h" -#include "domain.h" -#include "lattice.h" -#include "force.h" -#include "modify.h" -#include "fix.h" -#include "fix_peri_neigh.h" #include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" +#include "domain.h" #include "error.h" -#include "utils.h" +#include "fix_peri_neigh.h" +#include "force.h" +#include "lattice.h" #include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" + +#include using namespace LAMMPS_NS; @@ -378,14 +375,14 @@ void PairPeriLPS::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double bulkmodulus_one = force->numeric(FLERR,arg[2]); - double shearmodulus_one = force->numeric(FLERR,arg[3]); - double cut_one = force->numeric(FLERR,arg[4]); - double s00_one = force->numeric(FLERR,arg[5]); - double alpha_one = force->numeric(FLERR,arg[6]); + double bulkmodulus_one = utils::numeric(FLERR,arg[2],false,lmp); + double shearmodulus_one = utils::numeric(FLERR,arg[3],false,lmp); + double cut_one = utils::numeric(FLERR,arg[4],false,lmp); + double s00_one = utils::numeric(FLERR,arg[5],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 7c900b5c4e..5d6973a915 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -16,24 +16,21 @@ ------------------------------------------------------------------------- */ #include "pair_peri_pmb.h" -#include + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_peri_neigh.h" +#include "force.h" +#include "lattice.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" + #include #include -#include -#include -#include "atom.h" -#include "domain.h" -#include "lattice.h" -#include "force.h" -#include "modify.h" -#include "fix.h" -#include "fix_peri_neigh.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "utils.h" using namespace LAMMPS_NS; @@ -311,13 +308,13 @@ void PairPeriPMB::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double kspring_one = force->numeric(FLERR,arg[2]); - double cut_one = force->numeric(FLERR,arg[3]); - double s00_one = force->numeric(FLERR,arg[4]); - double alpha_one = force->numeric(FLERR,arg[5]); + double kspring_one = utils::numeric(FLERR,arg[2],false,lmp); + double cut_one = utils::numeric(FLERR,arg[3],false,lmp); + double s00_one = utils::numeric(FLERR,arg[4],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index ed9babf5ed..93c980702b 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -16,25 +16,22 @@ ------------------------------------------------------------------------- */ #include "pair_peri_ves.h" -#include -#include -#include -#include + #include "atom.h" -#include "domain.h" -#include "lattice.h" -#include "force.h" -#include "modify.h" -#include "fix.h" -#include "fix_peri_neigh.h" #include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" +#include "domain.h" #include "error.h" -#include "utils.h" +#include "fix_peri_neigh.h" +#include "force.h" +#include "lattice.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" #include "update.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -426,16 +423,16 @@ void PairPeriVES::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double bulkmodulus_one = force->numeric(FLERR,arg[2]); - double shearmodulus_one = force->numeric(FLERR,arg[3]); - double cut_one = force->numeric(FLERR,arg[4]); - double s00_one = force->numeric(FLERR,arg[5]); - double alpha_one = force->numeric(FLERR,arg[6]); - double mlambdai_one = force->numeric(FLERR,arg[7]); - double mtaui_one = force->numeric(FLERR,arg[8]); + double bulkmodulus_one = utils::numeric(FLERR,arg[2],false,lmp); + double shearmodulus_one = utils::numeric(FLERR,arg[3],false,lmp); + double cut_one = utils::numeric(FLERR,arg[4],false,lmp); + double s00_one = utils::numeric(FLERR,arg[5],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[6],false,lmp); + double mlambdai_one = utils::numeric(FLERR,arg[7],false,lmp); + double mtaui_one = utils::numeric(FLERR,arg[8],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index b0b1287717..12dc59c286 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -18,10 +18,10 @@ ------------------------------------------------------------------------- */ #include "fix_poems.h" -#include + #include #include -#include + #include "workspace.h" #include "atom.h" #include "domain.h" @@ -34,8 +34,8 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/PYTHON/fix_python_invoke.cpp b/src/PYTHON/fix_python_invoke.cpp index 57ea2e9148..8966d9a9db 100644 --- a/src/PYTHON/fix_python_invoke.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -16,13 +16,14 @@ ------------------------------------------------------------------------- */ #include "fix_python_invoke.h" -#include // IWYU pragma: keep -#include -#include "force.h" -#include "update.h" + #include "error.h" #include "lmppython.h" #include "python_compat.h" +#include "update.h" + +#include +#include // IWYU pragma: export using namespace LAMMPS_NS; using namespace FixConst; @@ -34,7 +35,7 @@ FixPythonInvoke::FixPythonInvoke(LAMMPS *lmp, int narg, char **arg) : { if (narg != 6) error->all(FLERR,"Illegal fix python/invoke command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix python/invoke command"); // ensure Python interpreter is initialized diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index be63b851a2..53bde5e804 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -16,12 +16,14 @@ ------------------------------------------------------------------------- */ #include "fix_python_move.h" -#include // IWYU pragma: keep -#include -#include "lmppython.h" + #include "error.h" +#include "lmppython.h" #include "python_compat.h" +#include +#include // IWYU pragma: export + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 8fbb3e6f8b..074de2f39a 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -16,17 +16,18 @@ ------------------------------------------------------------------------- */ #include "pair_python.h" -#include // IWYU pragma: keep -#include -#include + #include "atom.h" -#include "force.h" -#include "memory.h" -#include "update.h" -#include "neigh_list.h" -#include "lmppython.h" #include "error.h" +#include "force.h" +#include "lmppython.h" +#include "memory.h" +#include "neigh_list.h" #include "python_compat.h" +#include "update.h" + +#include +#include // IWYU pragma: export using namespace LAMMPS_NS; @@ -233,7 +234,7 @@ void PairPython::settings(int narg, char **arg) if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); } /* ---------------------------------------------------------------------- diff --git a/src/PYTHON/python_compat.h b/src/PYTHON/python_compat.h index 175d797ffa..effac81cef 100644 --- a/src/PYTHON/python_compat.h +++ b/src/PYTHON/python_compat.h @@ -14,6 +14,8 @@ #ifndef LMP_PYTHON_COMPAT_H #define LMP_PYTHON_COMPAT_H +#include + // Wrap API changes between Python 2 and 3 using macros #if PY_MAJOR_VERSION == 2 #define PY_INT_FROM_LONG(X) PyInt_FromLong(X) diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index b1183677d4..cb35cba85a 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -12,19 +12,19 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing author: Richard Berger and Axel Kohlmeyer (Temple U) + Contributing authors: Richard Berger and Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ #include "python_impl.h" -#include -#include -#include // IWYU pragma: keep -#include "force.h" -#include "input.h" -#include "variable.h" -#include "memory.h" + #include "error.h" +#include "input.h" +#include "memory.h" #include "python_compat.h" +#include "variable.h" + +#include +#include // IWYU pragma: export using namespace LAMMPS_NS; @@ -148,7 +148,7 @@ void PythonImpl::command(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"input") == 0) { if (iarg+2 > narg) error->all(FLERR,"Invalid python command"); - ninput = force->inumeric(FLERR,arg[iarg+1]); + ninput = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (ninput < 0) error->all(FLERR,"Invalid python command"); iarg += 2; istr = new char*[ninput]; @@ -168,7 +168,7 @@ void PythonImpl::command(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"length") == 0) { if (iarg+2 > narg) error->all(FLERR,"Invalid python command"); - length_longstr = force->inumeric(FLERR,arg[iarg+1]); + length_longstr = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (length_longstr <= 0) error->all(FLERR,"Invalid python command"); iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { @@ -433,7 +433,7 @@ int PythonImpl::create_entry(char *name) strcpy(pfuncs[ifunc].svalue[i],&istr[i][2]); } else { pfuncs[ifunc].ivarflag[i] = 0; - pfuncs[ifunc].ivalue[i] = force->inumeric(FLERR,istr[i]); + pfuncs[ifunc].ivalue[i] = utils::inumeric(FLERR,istr[i],false,lmp); } } else if (type == 'f') { pfuncs[ifunc].itype[i] = DOUBLE; @@ -444,7 +444,7 @@ int PythonImpl::create_entry(char *name) strcpy(pfuncs[ifunc].svalue[i],&istr[i][2]); } else { pfuncs[ifunc].ivarflag[i] = 0; - pfuncs[ifunc].dvalue[i] = force->numeric(FLERR,istr[i]); + pfuncs[ifunc].dvalue[i] = utils::numeric(FLERR,istr[i],false,lmp); } } else if (type == 's') { pfuncs[ifunc].itype[i] = STRING; diff --git a/src/Purge.list b/src/Purge.list index ebe1a9c484..0251f923be 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -49,6 +49,8 @@ packages_ntopo.h # other auto-generated files lmpinstalledpkgs.h lmpgitversion.h +# removed on 9 Sep 2020 +mergesort.h # renamed on 8 May 2020 fix_meso.cpp fix_meso.h diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 63fa3caefe..5cadce617f 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_qeq.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -45,10 +45,10 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : { if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); - nevery = force->inumeric(FLERR,arg[3]); - cutoff = force->numeric(FLERR,arg[4]); - tolerance = force->numeric(FLERR,arg[5]); - maxiter = force->inumeric(FLERR,arg[6]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + cutoff = utils::numeric(FLERR,arg[4],false,lmp); + tolerance = utils::numeric(FLERR,arg[5],false,lmp); + maxiter = utils::inumeric(FLERR,arg[6],false,lmp); // check for sane arguments if ((nevery <= 0) || (cutoff <= 0.0) || (tolerance <= 0.0) || (maxiter <= 0)) @@ -707,7 +707,7 @@ void FixQEq::read_file(char *file) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open fix qeq parameter file %s",file); @@ -753,13 +753,13 @@ void FixQEq::read_file(char *file) n < 6; words[++n] = strtok(NULL," \t\n\r\f")); - force->bounds(FLERR,words[0],ntypes,nlo,nhi); + utils::bounds(FLERR,words[0],1,ntypes,nlo,nhi,error); for (n=nlo; n <=nhi; ++n) { - chi[n] = force->numeric(FLERR,words[1]); - eta[n] = force->numeric(FLERR,words[2]); - gamma[n] = force->numeric(FLERR,words[3]); - zeta[n] = force->numeric(FLERR,words[4]); - zcore[n] = force->numeric(FLERR,words[5]); + chi[n] = utils::numeric(FLERR,words[1],false,lmp); + eta[n] = utils::numeric(FLERR,words[2],false,lmp); + gamma[n] = utils::numeric(FLERR,words[3],false,lmp); + zeta[n] = utils::numeric(FLERR,words[4],false,lmp); + zcore[n] = utils::numeric(FLERR,words[5],false,lmp); setflag[n] = 1; } } diff --git a/src/QEQ/fix_qeq_dynamic.cpp b/src/QEQ/fix_qeq_dynamic.cpp index a2cc683b56..7f50736b18 100644 --- a/src/QEQ/fix_qeq_dynamic.cpp +++ b/src/QEQ/fix_qeq_dynamic.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_dynamic.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 265528a089..6dcc5e9cdc 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_fire.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 4f5369eb87..327a9c5b3a 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -17,7 +17,7 @@ #include "fix_qeq_slater.h" #include -#include + #include #include "atom.h" #include "comm.h" diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index a6abcce85d..531f488e60 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -16,16 +16,16 @@ ------------------------------------------------------------------------- */ #include "compute_event_displace.h" -#include -#include + #include "atom.h" #include "domain.h" -#include "modify.h" -#include "fix_event.h" #include "error.h" -#include "force.h" +#include "fix_event.h" +#include "modify.h" #include "update.h" +#include + using namespace LAMMPS_NS; #define INVOKED_SCALAR 1 @@ -40,7 +40,7 @@ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; extscalar = 0; - double displace_dist = force->numeric(FLERR,arg[3]); + double displace_dist = utils::numeric(FLERR,arg[3],false,lmp); if (displace_dist <= 0.0) error->all(FLERR,"Distance must be > 0 for compute event/displace"); displace_distsq = displace_dist * displace_dist; diff --git a/src/REPLICA/fix_event_hyper.cpp b/src/REPLICA/fix_event_hyper.cpp index ddbe10adc9..ba784cc3e9 100644 --- a/src/REPLICA/fix_event_hyper.cpp +++ b/src/REPLICA/fix_event_hyper.cpp @@ -12,6 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_event_hyper.h" + #include "comm.h" #include "error.h" #include "update.h" diff --git a/src/REPLICA/fix_hyper_global.cpp b/src/REPLICA/fix_hyper_global.cpp index bc5df921c6..f104d14c2f 100644 --- a/src/REPLICA/fix_hyper_global.cpp +++ b/src/REPLICA/fix_hyper_global.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_hyper_global.h" -#include + #include #include #include "atom.h" @@ -56,10 +56,10 @@ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : extscalar = 0; extvector = 0; - cutbond = force->numeric(FLERR,arg[3]); - qfactor = force->numeric(FLERR,arg[4]); - vmax = force->numeric(FLERR,arg[5]); - tequil = force->numeric(FLERR,arg[6]); + cutbond = utils::numeric(FLERR,arg[3],false,lmp); + qfactor = utils::numeric(FLERR,arg[4],false,lmp); + vmax = utils::numeric(FLERR,arg[5],false,lmp); + tequil = utils::numeric(FLERR,arg[6],false,lmp); if (cutbond < 0.0 || qfactor <= 0.0 || vmax < 0.0 || tequil <= 0.0) error->all(FLERR,"Illegal fix hyper/global command"); diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index d5311fc37d..da444bc451 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -12,10 +12,10 @@ ------------------------------------------------------------------------- */ #include "fix_hyper_local.h" -#include + #include #include -#include + #include "atom.h" #include "update.h" #include "group.h" @@ -30,7 +30,7 @@ #include "math_extra.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -75,13 +75,13 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : extscalar = 0; extvector = 0; - cutbond = force->numeric(FLERR,arg[3]); - qfactor = force->numeric(FLERR,arg[4]); - vmax = force->numeric(FLERR,arg[5]); - tequil = force->numeric(FLERR,arg[6]); - dcut = force->numeric(FLERR,arg[7]); - alpha_user = force->numeric(FLERR,arg[8]); - boost_target = force->numeric(FLERR,arg[9]); + cutbond = utils::numeric(FLERR,arg[3],false,lmp); + qfactor = utils::numeric(FLERR,arg[4],false,lmp); + vmax = utils::numeric(FLERR,arg[5],false,lmp); + tequil = utils::numeric(FLERR,arg[6],false,lmp); + dcut = utils::numeric(FLERR,arg[7],false,lmp); + alpha_user = utils::numeric(FLERR,arg[8],false,lmp); + boost_target = utils::numeric(FLERR,arg[9],false,lmp); if (cutbond < 0.0 || qfactor < 0.0 || vmax < 0.0 || tequil <= 0.0 || dcut <= 0.0 || alpha_user <= 0.0 || boost_target < 1.0) @@ -105,13 +105,13 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"bound") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix hyper/local command"); - boundfrac = force->numeric(FLERR,arg[iarg+1]); + boundfrac = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (boundfrac < 0.0) boundflag = 0; else boundflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"reset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix hyper/local command"); - resetfreq = force->inumeric(FLERR,arg[iarg+1]); + resetfreq = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (resetfreq < -1) error->all(FLERR,"Illegal fix hyper/local command"); iarg += 2; } else if (strcmp(arg[iarg],"check/ghost") == 0) { @@ -120,7 +120,7 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"check/bias") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix hyper/local command"); checkbias = 1; - checkbias_every = force->inumeric(FLERR,arg[iarg+1]); + checkbias_every = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (strcmp(arg[iarg+2],"error") == 0) checkbias_flag = ERROR; else if (strcmp(arg[iarg+2],"warn") == 0) checkbias_flag = WARN; else if (strcmp(arg[iarg+2],"ignore") == 0) checkbias_flag = IGNORE; @@ -164,7 +164,7 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : maxbondperatom = FCCBONDS; numcoeff = NULL; clist = NULL; - cpage = new MyPage; + cpage = new MyPage; cpage->init(maxbondperatom,1024*maxbondperatom,1); // set comm sizes needed by this fix @@ -976,7 +976,7 @@ void FixHyperLocal::build_bond_list(int natom) memory->sfree(clist); maxcoeff = atom->nmax; memory->create(numcoeff,maxcoeff,"hyper/local:numcoeff"); - clist = (OneCoeff **) memory->smalloc(maxcoeff*sizeof(OneCoeff *), + clist = (HyperOneCoeff **) memory->smalloc(maxcoeff*sizeof(HyperOneCoeff *), "hyper/local:clist"); } @@ -1741,7 +1741,7 @@ double FixHyperLocal::memory_usage() bytes += 2*maxall * sizeof(double); // maxstrain,maxstrain_domain if (checkbias) bytes += maxall * sizeof(tagint); // biasflag bytes += maxcoeff * sizeof(int); // numcoeff - bytes += maxcoeff * sizeof(OneCoeff *); // clist - bytes += maxlocal*maxbondperatom * sizeof(OneCoeff); // cpage estimate + bytes += maxcoeff * sizeof(HyperOneCoeff *); // clist + bytes += maxlocal*maxbondperatom * sizeof(HyperOneCoeff); // cpage estimate return bytes; } diff --git a/src/REPLICA/fix_hyper_local.h b/src/REPLICA/fix_hyper_local.h index 4fb54d166c..aa3f050bb9 100644 --- a/src/REPLICA/fix_hyper_local.h +++ b/src/REPLICA/fix_hyper_local.h @@ -23,6 +23,8 @@ FixStyle(hyper/local,FixHyperLocal) #include "fix_hyper.h" namespace LAMMPS_NS { + // forward declaration. struct HyperOneCoeff is defined in my_page.h + struct HyperOneCoeff; class FixHyperLocal : public FixHyper { public: @@ -183,13 +185,8 @@ class FixHyperLocal : public FixHyper { // data structs for persisting bias coeffs when bond list is reformed - struct OneCoeff { - double biascoeff; - tagint tag; - }; - - MyPage *cpage; // pages of OneCoeff datums for clist - OneCoeff **clist; // ptrs to vectors of bias coeffs for each atom + MyPage *cpage;// pages of OneCoeff datums for clist + HyperOneCoeff **clist; // ptrs to vectors of bias coeffs for each atom int *numcoeff; // # of bias coeffs per atom (one per bond) int maxcoeff; // allocate sized of clist and numcoeff diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index b3af01fda4..b8fd0f6442 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -17,22 +17,21 @@ ------------------------------------------------------------------------- */ #include "fix_neb.h" -#include -#include -#include -#include + +#include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" #include "universe.h" #include "update.h" -#include "atom.h" -#include "domain.h" -#include "comm.h" -#include "modify.h" -#include "compute.h" -#include "group.h" -#include "memory.h" -#include "error.h" -#include "force.h" -#include "math_const.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -56,7 +55,7 @@ FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix neb command"); - kspring = force->numeric(FLERR,arg[3]); + kspring = utils::numeric(FLERR,arg[3],false,lmp); if (kspring <= 0.0) error->all(FLERR,"Illegal fix neb command"); // optional params @@ -85,7 +84,7 @@ FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"perp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix neb command"); PerpSpring = true; - kspringPerp = force->numeric(FLERR,arg[iarg+1]); + kspringPerp = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (kspringPerp == 0.0) PerpSpring = false; if (kspringPerp < 0.0) error->all(FLERR,"Illegal fix neb command"); iarg += 2; @@ -94,22 +93,22 @@ FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : if (iarg+3 > narg) error->all(FLERR,"Illegal fix neb command"); if (strcmp(arg[iarg+1],"first") == 0) { FreeEndIni = true; - kspringIni = force->numeric(FLERR,arg[iarg+2]); + kspringIni = utils::numeric(FLERR,arg[iarg+2],false,lmp); } else if (strcmp(arg[iarg+1],"last") == 0) { FreeEndFinal = true; FinalAndInterWithRespToEIni = false; FreeEndFinalWithRespToEIni = false; - kspringFinal = force->numeric(FLERR,arg[iarg+2]); + kspringFinal = utils::numeric(FLERR,arg[iarg+2],false,lmp); } else if (strcmp(arg[iarg+1],"last/efirst") == 0) { FreeEndFinal = false; FinalAndInterWithRespToEIni = false; FreeEndFinalWithRespToEIni = true; - kspringFinal = force->numeric(FLERR,arg[iarg+2]); + kspringFinal = utils::numeric(FLERR,arg[iarg+2],false,lmp); } else if (strcmp(arg[iarg+1],"last/efirst/middle") == 0) { FreeEndFinal = false; FinalAndInterWithRespToEIni = true; FreeEndFinalWithRespToEIni = true; - kspringFinal = force->numeric(FLERR,arg[iarg+2]); + kspringFinal = utils::numeric(FLERR,arg[iarg+2],false,lmp); } else error->all(FLERR,"Illegal fix neb command"); iarg += 3; @@ -238,7 +237,7 @@ void FixNEB::init() if (atom->nmax > maxlocal) reallocate(); - if (MULTI_PROC && counts == NULL) { + if ((cmode == MULTI_PROC) && (counts == NULL)) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index 6a2891dee1..6c4cba4ab8 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -12,28 +12,25 @@ ------------------------------------------------------------------------- */ #include "hyper.h" -#include -#include -#include -#include "update.h" -#include "domain.h" -#include "region.h" -#include "integrate.h" -#include "min.h" -#include "force.h" -#include "neighbor.h" -#include "modify.h" + #include "compute_event_displace.h" -#include "fix_hyper.h" -#include "fix_event_hyper.h" -#include "output.h" +#include "domain.h" #include "dump.h" -#include "finish.h" -#include "timer.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "finish.h" +#include "fix_event_hyper.h" +#include "fix_hyper.h" +#include "integrate.h" +#include "memory.h" +#include "min.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "region.h" +#include "timer.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -59,8 +56,8 @@ void Hyper::command(int narg, char **arg) if (narg < 4) error->all(FLERR,"Illegal hyper command"); - int nsteps = force->inumeric(FLERR,arg[0]); - t_event = force->inumeric(FLERR,arg[1]); + int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); + t_event = utils::inumeric(FLERR,arg[1],false,lmp); char *id_fix = new char[strlen(arg[2])+1]; strcpy(id_fix,arg[2]); @@ -459,10 +456,10 @@ void Hyper::options(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"min") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal hyper command"); - etol = force->numeric(FLERR,arg[iarg+1]); - ftol = force->numeric(FLERR,arg[iarg+2]); - maxiter = force->inumeric(FLERR,arg[iarg+3]); - maxeval = force->inumeric(FLERR,arg[iarg+4]); + etol = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ftol = utils::numeric(FLERR,arg[iarg+2],false,lmp); + maxiter = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + maxeval = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (maxiter < 0) error->all(FLERR,"Illegal hyper command"); iarg += 5; @@ -478,7 +475,7 @@ void Hyper::options(int narg, char **arg) } else if (strcmp(arg[iarg],"rebond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal hyper command"); - rebond = force->inumeric(FLERR,arg[iarg+1]); + rebond = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR,"Illegal hyper command"); diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 5a1f942815..2d1dd6eea7 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -12,28 +12,26 @@ ------------------------------------------------------------------------- */ #include "neb.h" -#include -#include -#include -#include -#include "universe.h" + #include "atom.h" -#include "update.h" -#include "domain.h" #include "comm.h" -#include "min.h" -#include "modify.h" +#include "domain.h" +#include "error.h" +#include "finish.h" #include "fix.h" #include "fix_neb.h" +#include "math_const.h" +#include "memory.h" +#include "min.h" +#include "modify.h" #include "output.h" #include "thermo.h" -#include "finish.h" #include "timer.h" -#include "memory.h" -#include "error.h" -#include "force.h" -#include "math_const.h" -#include "utils.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -110,11 +108,11 @@ void NEB::command(int narg, char **arg) if (narg < 6) error->universe_all(FLERR,"Illegal NEB command"); - etol = force->numeric(FLERR,arg[0]); - ftol = force->numeric(FLERR,arg[1]); - n1steps = force->inumeric(FLERR,arg[2]); - n2steps = force->inumeric(FLERR,arg[3]); - nevery = force->inumeric(FLERR,arg[4]); + etol = utils::numeric(FLERR,arg[0],false,lmp); + ftol = utils::numeric(FLERR,arg[1],false,lmp); + n1steps = utils::inumeric(FLERR,arg[2],false,lmp); + n2steps = utils::inumeric(FLERR,arg[3],false,lmp); + nevery = utils::inumeric(FLERR,arg[4],false,lmp); // error checks diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 633fcefc80..cdb1eb9b02 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -16,32 +16,29 @@ ------------------------------------------------------------------------- */ #include "prd.h" -#include -#include -#include + +#include "atom.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "fix_event_prd.h" +#include "integrate.h" +#include "memory.h" +#include "min.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "random_mars.h" +#include "random_park.h" +#include "region.h" +#include "timer.h" #include "universe.h" #include "update.h" -#include "atom.h" -#include "domain.h" -#include "region.h" -#include "comm.h" #include "velocity.h" -#include "integrate.h" -#include "min.h" -#include "neighbor.h" -#include "modify.h" -#include "compute.h" -#include "fix.h" -#include "fix_event_prd.h" -#include "force.h" -#include "random_park.h" -#include "random_mars.h" -#include "output.h" -#include "finish.h" -#include "timer.h" -#include "memory.h" -#include "error.h" -#include "utils.h" + +#include using namespace LAMMPS_NS; @@ -74,15 +71,15 @@ void PRD::command(int narg, char **arg) // read as double so can cast to bigint - int nsteps = force->inumeric(FLERR,arg[0]); - t_event = force->inumeric(FLERR,arg[1]); - n_dephase = force->inumeric(FLERR,arg[2]); - t_dephase = force->inumeric(FLERR,arg[3]); - t_corr = force->inumeric(FLERR,arg[4]); + int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); + t_event = utils::inumeric(FLERR,arg[1],false,lmp); + n_dephase = utils::inumeric(FLERR,arg[2],false,lmp); + t_dephase = utils::inumeric(FLERR,arg[3],false,lmp); + t_corr = utils::inumeric(FLERR,arg[4],false,lmp); char *id_compute = new char[strlen(arg[5])+1]; strcpy(id_compute,arg[5]); - int seed = force->inumeric(FLERR,arg[6]); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); options(narg-7,&arg[7]); @@ -892,17 +889,17 @@ void PRD::options(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"min") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal prd command"); - etol = force->numeric(FLERR,arg[iarg+1]); - ftol = force->numeric(FLERR,arg[iarg+2]); - maxiter = force->inumeric(FLERR,arg[iarg+3]); - maxeval = force->inumeric(FLERR,arg[iarg+4]); + etol = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ftol = utils::numeric(FLERR,arg[iarg+2],false,lmp); + maxiter = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + maxeval = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (maxiter < 0) error->all(FLERR,"Illegal prd command"); iarg += 5; } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal prd command"); temp_flag = 1; - temp_dephase = force->numeric(FLERR,arg[iarg+1]); + temp_dephase = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (temp_dephase <= 0.0) error->all(FLERR,"Illegal prd command"); iarg += 2; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index a629ee6b04..db74b63c35 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -16,28 +16,28 @@ ------------------------------------------------------------------------- */ #include "tad.h" -#include -#include -#include -#include "universe.h" -#include "update.h" + #include "atom.h" -#include "domain.h" -#include "integrate.h" -#include "min.h" -#include "neighbor.h" -#include "modify.h" -#include "neb.h" #include "compute.h" +#include "domain.h" +#include "error.h" +#include "finish.h" #include "fix_event_tad.h" #include "fix_store.h" #include "force.h" -#include "output.h" -#include "finish.h" -#include "timer.h" +#include "integrate.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "min.h" +#include "modify.h" +#include "neb.h" +#include "neighbor.h" +#include "output.h" +#include "timer.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -82,12 +82,12 @@ void TAD::command(int narg, char **arg) if (narg < 7) error->universe_all(FLERR,"Illegal tad command"); - nsteps = force->inumeric(FLERR,arg[0]); - t_event = force->inumeric(FLERR,arg[1]); - templo = force->numeric(FLERR,arg[2]); - temphi = force->numeric(FLERR,arg[3]); - delta_conf = force->numeric(FLERR,arg[4]); - tmax = force->numeric(FLERR,arg[5]); + nsteps = utils::inumeric(FLERR,arg[0],false,lmp); + t_event = utils::inumeric(FLERR,arg[1],false,lmp); + templo = utils::numeric(FLERR,arg[2],false,lmp); + temphi = utils::numeric(FLERR,arg[3],false,lmp); + delta_conf = utils::numeric(FLERR,arg[4],false,lmp); + tmax = utils::numeric(FLERR,arg[5],false,lmp); char *id_compute = new char[strlen(arg[6])+1]; strcpy(id_compute,arg[6]); @@ -592,10 +592,10 @@ void TAD::options(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"min") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal tad command"); - etol = force->numeric(FLERR,arg[iarg+1]); - ftol = force->numeric(FLERR,arg[iarg+2]); - maxiter = force->inumeric(FLERR,arg[iarg+3]); - maxeval = force->inumeric(FLERR,arg[iarg+4]); + etol = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ftol = utils::numeric(FLERR,arg[iarg+2],false,lmp); + maxiter = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + maxeval = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (maxiter < 0 || maxeval < 0 || etol < 0.0 || ftol < 0.0 ) error->all(FLERR,"Illegal tad command"); @@ -603,11 +603,11 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal tad command"); - etol_neb = force->numeric(FLERR,arg[iarg+1]); - ftol_neb = force->numeric(FLERR,arg[iarg+2]); - n1steps_neb = force->inumeric(FLERR,arg[iarg+3]); - n2steps_neb = force->inumeric(FLERR,arg[iarg+4]); - nevery_neb = force->inumeric(FLERR,arg[iarg+5]); + etol_neb = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ftol_neb = utils::numeric(FLERR,arg[iarg+2],false,lmp); + n1steps_neb = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + n2steps_neb = utils::inumeric(FLERR,arg[iarg+4],false,lmp); + nevery_neb = utils::inumeric(FLERR,arg[iarg+5],false,lmp); if (etol_neb < 0.0 || ftol_neb < 0.0 || n1steps_neb < 0 || n2steps_neb < 0 || nevery_neb < 0) error->all(FLERR,"Illegal tad command"); @@ -623,7 +623,7 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb_step") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal tad command"); - dt_neb = force->numeric(FLERR,arg[iarg+1]); + dt_neb = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (dt_neb <= 0.0) error->all(FLERR,"Illegal tad command"); iarg += 2; diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index a4c67108d3..0cce389bf0 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -16,22 +16,23 @@ ------------------------------------------------------------------------- */ #include "temper.h" -#include -#include -#include "universe.h" -#include "domain.h" + #include "atom.h" -#include "update.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "fix.h" +#include "force.h" #include "integrate.h" #include "modify.h" -#include "compute.h" -#include "force.h" -#include "fix.h" #include "random_park.h" -#include "finish.h" #include "timer.h" -#include "error.h" -#include "utils.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -67,9 +68,9 @@ void Temper::command(int narg, char **arg) if (narg != 6 && narg != 7) error->universe_all(FLERR,"Illegal temper command"); - int nsteps = force->inumeric(FLERR,arg[0]); - nevery = force->inumeric(FLERR,arg[1]); - double temp = force->numeric(FLERR,arg[2]); + int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); + nevery = utils::inumeric(FLERR,arg[1],false,lmp); + double temp = utils::numeric(FLERR,arg[2],false,lmp); // ignore temper command, if walltime limit was already reached @@ -80,11 +81,11 @@ void Temper::command(int narg, char **arg) if (whichfix == modify->nfix) error->universe_all(FLERR,"Tempering fix ID is not defined"); - seed_swap = force->inumeric(FLERR,arg[4]); - seed_boltz = force->inumeric(FLERR,arg[5]); + seed_swap = utils::inumeric(FLERR,arg[4],false,lmp); + seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); my_set_temp = universe->iworld; - if (narg == 7) my_set_temp = force->inumeric(FLERR,arg[6]); + if (narg == 7) my_set_temp = utils::inumeric(FLERR,arg[6],false,lmp); if ((my_set_temp < 0) || (my_set_temp >= universe->nworlds)) error->universe_one(FLERR,"Illegal temperature index"); diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index a5efc22d11..03b79cc750 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -23,7 +23,7 @@ ------------------------------------------------------------------------- */ #include "fix_ehex.h" -#include + #include #include #include "atom.h" @@ -59,13 +59,13 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), // apply fix every nevery timesteps - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix ehex command"); // heat flux into the reservoir - heat_input = force->numeric(FLERR,arg[4]); + heat_input = utils::numeric(FLERR,arg[4],false,lmp); // optional args diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index ff31ab9755..436b2191ff 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_rattle.h" -#include + #include #include #include "atom.h" diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 0d15f22090..f74cce8233 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid.h" -#include + #include -#include + #include #include "math_extra.h" #include "atom.h" @@ -35,8 +35,8 @@ #include "memory.h" #include "error.h" #include "rigid_const.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -226,7 +226,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"group") == 0) { if (narg < 5) error->all(FLERR,"Illegal fix rigid command"); rstyle = GROUP; - nbody = force->inumeric(FLERR,arg[4]); + nbody = utils::inumeric(FLERR,arg[4],false,lmp); if (nbody <= 0) error->all(FLERR,"Illegal fix rigid command"); if (narg < 5+nbody) error->all(FLERR,"Illegal fix rigid command"); iarg = 5+nbody; @@ -340,7 +340,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix rigid command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; @@ -371,7 +371,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix rigid command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; @@ -404,10 +404,10 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : strcmp(style,"rigid/omp") != 0 && strcmp(style,"rigid/nve/omp") != 0) error->all(FLERR,"Illegal fix rigid command"); langflag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); - seed = force->inumeric(FLERR,arg[iarg+4]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); + seed = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (t_period <= 0.0) error->all(FLERR,"Fix rigid langevin period must be > 0.0"); if (seed <= 0) error->all(FLERR,"Illegal fix rigid command"); @@ -418,9 +418,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (!utils::strmatch(style,"^rigid/n.t")) error->all(FLERR,"Illegal fix rigid command"); tstat_flag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"iso") == 0) { @@ -428,10 +428,10 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (!utils::strmatch(style,"^rigid/np.")) error->all(FLERR,"Illegal fix rigid command"); pcouple = XYZ; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -443,10 +443,10 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (!utils::strmatch(style,"^rigid/np.")) error->all(FLERR,"Illegal fix rigid command"); - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -458,9 +458,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (!utils::strmatch(style,"^rigid/np.")) error->all(FLERR,"Illegal fix rigid command"); - p_start[0] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = 1; iarg += 4; @@ -468,9 +468,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (!utils::strmatch(style,"^rigid/np.")) error->all(FLERR,"Illegal fix rigid command"); - p_start[1] = force->numeric(FLERR,arg[iarg+1]); - p_stop[1] = force->numeric(FLERR,arg[iarg+2]); - p_period[1] = force->numeric(FLERR,arg[iarg+3]); + p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[1] = 1; iarg += 4; @@ -478,9 +478,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (!utils::strmatch(style,"^rigid/np.")) error->all(FLERR,"Illegal fix rigid command"); - p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[2] = 1; iarg += 4; @@ -515,16 +515,16 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid command"); if (!utils::strmatch(style,"^rigid/n.t")) error->all(FLERR,"Illegal fix rigid command"); - t_chain = force->inumeric(FLERR,arg[iarg+1]); - t_iter = force->inumeric(FLERR,arg[iarg+2]); - t_order = force->inumeric(FLERR,arg[iarg+3]); + t_chain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + t_iter = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + t_order = utils::inumeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid command"); if (!utils::strmatch(style,"^rigid/np.")) error->all(FLERR,"Illegal fix rigid command"); - p_chain = force->inumeric(FLERR,arg[iarg+1]); + p_chain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"infile") == 0) { diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index 5b75640549..d1204e2bbc 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_nh_small.h" -#include + #include #include #include "math_extra.h" diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index f12c53bf3a..85cadc826e 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_rigid_small.h" -#include + #include -#include + #include #include #include "math_extra.h" @@ -39,8 +39,8 @@ #include "memory.h" #include "error.h" #include "rigid_const.h" -#include "utils.h" -#include "fmt/format.h" + + #include @@ -210,10 +210,10 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : (strcmp(style,"rigid/nph/small") != 0)) error->all(FLERR,"Illegal fix rigid/small command"); langflag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); - seed = force->inumeric(FLERR,arg[iarg+4]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); + seed = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (t_period <= 0.0) error->all(FLERR,"Fix rigid/small langevin period must be > 0.0"); if (seed <= 0) error->all(FLERR,"Illegal fix rigid/small command"); @@ -252,9 +252,9 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (!utils::strmatch(style,"^rigid/n.t/small")) error->all(FLERR,"Illegal fix rigid command"); tstat_flag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"iso") == 0) { @@ -262,10 +262,10 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (!utils::strmatch(style,"^rigid/np./small")) error->all(FLERR,"Illegal fix rigid/small command"); pcouple = XYZ; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -277,10 +277,10 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); if (!utils::strmatch(style,"^rigid/np./small")) error->all(FLERR,"Illegal fix rigid/small command"); - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (domain->dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -292,9 +292,9 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); if (!utils::strmatch(style,"^rigid/np./small")) error->all(FLERR,"Illegal fix rigid/small command"); - p_start[0] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = 1; iarg += 4; @@ -302,9 +302,9 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); if (!utils::strmatch(style,"^rigid/np./small")) error->all(FLERR,"Illegal fix rigid/small command"); - p_start[1] = force->numeric(FLERR,arg[iarg+1]); - p_stop[1] = force->numeric(FLERR,arg[iarg+2]); - p_period[1] = force->numeric(FLERR,arg[iarg+3]); + p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[1] = 1; iarg += 4; @@ -312,9 +312,9 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); if (!utils::strmatch(style,"^rigid/np./small")) error->all(FLERR,"Illegal fix rigid/small command"); - p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[2] = 1; iarg += 4; @@ -349,16 +349,16 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix rigid/small command"); if (!utils::strmatch(style,"^rigid/n.t/small")) error->all(FLERR,"Illegal fix rigid/small command"); - t_chain = force->inumeric(FLERR,arg[iarg+1]); - t_iter = force->inumeric(FLERR,arg[iarg+2]); - t_order = force->inumeric(FLERR,arg[iarg+3]); + t_chain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + t_iter = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + t_order = utils::inumeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix rigid/small command"); if (!utils::strmatch(style,"^rigid/np./small")) error->all(FLERR,"Illegal fix rigid/small command"); - p_chain = force->inumeric(FLERR,arg[iarg+1]); + p_chain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"gravity") == 0) { diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index a216526528..ee88f57341 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_shake.h" -#include + #include #include #include @@ -32,8 +32,8 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -95,9 +95,9 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : if (narg < 8) error->all(FLERR,"Illegal fix shake command"); - tolerance = force->numeric(FLERR,arg[3]); - max_iter = force->inumeric(FLERR,arg[4]); - output_every = force->inumeric(FLERR,arg[5]); + tolerance = utils::numeric(FLERR,arg[3],false,lmp); + max_iter = utils::inumeric(FLERR,arg[4],false,lmp); + output_every = utils::inumeric(FLERR,arg[5],false,lmp); // parse SHAKE args for bond and angle types // will be used by find_clusters @@ -131,25 +131,25 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // read numeric args of b,a,t,m else if (mode == 'b') { - int i = force->inumeric(FLERR,arg[next]); + int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->nbondtypes) error->all(FLERR,"Invalid bond type index for fix shake"); bond_flag[i] = 1; } else if (mode == 'a') { - int i = force->inumeric(FLERR,arg[next]); + int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->nangletypes) error->all(FLERR,"Invalid angle type index for fix shake"); angle_flag[i] = 1; } else if (mode == 't') { - int i = force->inumeric(FLERR,arg[next]); + int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->ntypes) error->all(FLERR,"Invalid atom type index for fix shake"); type_flag[i] = 1; } else if (mode == 'm') { - double massone = force->numeric(FLERR,arg[next]); + double massone = utils::numeric(FLERR,arg[next],false,lmp); if (massone == 0.0) error->all(FLERR,"Invalid atom mass for fix shake"); if (nmass == atom->ntypes) error->all(FLERR,"Too many masses for fix shake"); diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 1a6b128cd5..509e45202c 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_append_atoms.h" -#include + #include #include #include "atom.h" @@ -114,7 +114,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Append boundary must be shrink/minimum"); } else if (strcmp(arg[iarg],"freq") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - freq = force->inumeric(FLERR,arg[iarg+1]); + freq = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"spatial") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); @@ -123,7 +123,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : "Bad fix ID in fix append/atoms command"); spatflag = 1; int n = strlen(arg[iarg+1]); - spatlead = force->numeric(FLERR,arg[iarg+2]); + spatlead = utils::numeric(FLERR,arg[iarg+2],false,lmp); char *suffix = new char[n]; strcpy(suffix,&arg[iarg+1][2]); n = strlen(suffix) + 1; @@ -133,15 +133,15 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : iarg += 3; } else if (strcmp(arg[iarg],"basis") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - int ibasis = force->inumeric(FLERR,arg[iarg+1]); - int itype = force->inumeric(FLERR,arg[iarg+2]); + int ibasis = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + int itype = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Invalid basis setting in fix append/atoms command"); basistype[ibasis-1] = itype; iarg += 3; } else if (strcmp(arg[iarg],"size") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); - size = force->numeric(FLERR,arg[iarg+1]); + size = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"units") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix append/atoms command"); @@ -152,20 +152,20 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"random") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command"); ranflag = 1; - ranx = force->numeric(FLERR,arg[iarg+1]); - rany = force->numeric(FLERR,arg[iarg+2]); - ranz = force->numeric(FLERR,arg[iarg+3]); - xseed = force->inumeric(FLERR,arg[iarg+4]); + ranx = utils::numeric(FLERR,arg[iarg+1],false,lmp); + rany = utils::numeric(FLERR,arg[iarg+2],false,lmp); + ranz = utils::numeric(FLERR,arg[iarg+3],false,lmp); + xseed = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (xseed <= 0) error->all(FLERR,"Illegal fix append/atoms command"); randomx = new RanMars(lmp,xseed + comm->me); iarg += 5; } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix append/atoms command"); tempflag = 1; - t_target = force->numeric(FLERR,arg[iarg+1]); - t_period = force->numeric(FLERR,arg[iarg+2]); - tseed = force->inumeric(FLERR,arg[iarg+3]); - t_extent = force->numeric(FLERR,arg[iarg+4]); + t_target = utils::numeric(FLERR,arg[iarg+1],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+2],false,lmp); + tseed = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + t_extent = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (t_target <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_period <= 0) error->all(FLERR,"Illegal fix append/atoms command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix append/atoms command"); diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index c9591e92ac..3930133221 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "fix_msst.h" -#include + #include #include #include "atom.h" @@ -32,8 +32,8 @@ #include "domain.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -90,7 +90,7 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : box_change |= BOX_CHANGE_Z; } else error->all(FLERR,"Illegal fix msst command"); - velocity = force->numeric(FLERR,arg[4]); + velocity = utils::numeric(FLERR,arg[4],false,lmp); if (velocity < 0) error->all(FLERR,"Illegal fix msst command"); // optional args @@ -99,30 +99,30 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"q") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - qmass = force->numeric(FLERR,arg[iarg+1]); + qmass = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"mu") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - mu = force->numeric(FLERR,arg[iarg+1]); + mu = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"p0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - p0 = force->numeric(FLERR,arg[iarg+1]); + p0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); p0_set = 1; iarg += 2; } else if (strcmp(arg[iarg],"v0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - v0 = force->numeric(FLERR,arg[iarg+1]); + v0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); v0_set = 1; iarg += 2; } else if (strcmp(arg[iarg],"e0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - e0 = force->numeric(FLERR,arg[iarg+1]); + e0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); e0_set = 1; iarg += 2; } else if (strcmp(arg[iarg],"tscale") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - tscale = force->numeric(FLERR,arg[iarg+1]); + tscale = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix msst tscale must satisfy 0 <= tscale < 1"); iarg += 2; @@ -134,7 +134,7 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"beta") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix msst command"); - beta = force->numeric(FLERR,arg[iarg+1]); + beta = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (beta < 0.0 || beta > 1.0) error->all(FLERR,"Illegal fix msst command"); iarg += 2; diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 8ad787d759..1179bb6b35 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -439,17 +439,17 @@ int FixNPHug::modify_param(int narg, char **arg) { if (strcmp(arg[0],"e0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); - e0 = force->numeric(FLERR,arg[1]); + e0 = utils::numeric(FLERR,arg[1],false,lmp); e0_set = 1; return 2; } else if (strcmp(arg[0],"v0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); - v0 = force->numeric(FLERR,arg[1]); + v0 = utils::numeric(FLERR,arg[1],false,lmp); v0_set = 1; return 2; } else if (strcmp(arg[0],"p0") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix nphug command"); - p0 = force->numeric(FLERR,arg[1]); + p0 = utils::numeric(FLERR,arg[1],false,lmp); p0_set = 1; return 2; } diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index 5a359d9f6f..a796c1a4b4 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -71,19 +71,19 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix wall/piston command only available at zlo"); else if (strcmp(arg[iarg],"vel") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall/piston command"); - vz = force->numeric(FLERR,arg[iarg+1]); + vz = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"pos") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall/piston command"); - z0 = force->numeric(FLERR,arg[iarg+1]); + z0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"temp") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal fix wall/piston command"); tempflag = 1; - t_target = force->numeric(FLERR,arg[iarg+1]); - t_period = force->numeric(FLERR,arg[iarg+2]); - tseed = force->inumeric(FLERR,arg[iarg+3]); - t_extent = force->numeric(FLERR,arg[iarg+4]); + t_target = utils::numeric(FLERR,arg[iarg+1],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+2],false,lmp); + tseed = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + t_extent = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (t_target <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_period <= 0) error->all(FLERR,"Illegal fix wall/piston command"); if (t_extent <= 0) error->all(FLERR,"Illegal fix wall/piston command"); @@ -94,7 +94,7 @@ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : iarg += 5; } else if (strcmp(arg[iarg],"rough") == 0) { roughflag = 1; - roughdist = force->numeric(FLERR,arg[iarg+1]); + roughdist = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"ramp") == 0) { rampflag = 1; diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index 4a57f31ec3..37b82b86f0 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -13,7 +13,7 @@ #include "compute_sna_atom.h" #include -#include + #include "sna.h" #include "atom.h" #include "update.h" @@ -114,9 +114,9 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal compute sna/atom command"); chemflag = 1; memory->create(map,ntypes+1,"compute_sna_atom:map"); - nelements = force->inumeric(FLERR,arg[iarg+1]); + nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); for(int i = 0; i < ntypes; i++) { - int jelem = force->inumeric(FLERR,arg[iarg+2+i]); + int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute sna/atom command"); map[i+1] = jelem; diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index cd0c0cbc41..bb546708b8 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -13,7 +13,7 @@ #include "compute_snad_atom.h" #include -#include + #include "sna.h" #include "atom.h" #include "update.h" @@ -112,9 +112,9 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal compute snad/atom command"); chemflag = 1; memory->create(map,ntypes+1,"compute_snad_atom:map"); - nelements = force->inumeric(FLERR,arg[iarg+1]); + nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); for(int i = 0; i < ntypes; i++) { - int jelem = force->inumeric(FLERR,arg[iarg+2+i]); + int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute snad/atom command"); map[i+1] = jelem; diff --git a/src/SNAP/compute_snap.cpp b/src/SNAP/compute_snap.cpp index 613fc1a862..ca989a75b4 100644 --- a/src/SNAP/compute_snap.cpp +++ b/src/SNAP/compute_snap.cpp @@ -13,7 +13,7 @@ #include "compute_snap.h" #include -#include + #include "sna.h" #include "atom.h" #include "update.h" @@ -118,9 +118,9 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal compute snap command"); chemflag = 1; memory->create(map,ntypes+1,"compute_snap:map"); - nelements = force->inumeric(FLERR,arg[iarg+1]); + nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); for(int i = 0; i < ntypes; i++) { - int jelem = force->inumeric(FLERR,arg[iarg+2+i]); + int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute snap command"); map[i+1] = jelem; diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index 2d33c35563..dd562cac5c 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -13,7 +13,7 @@ #include "compute_snav_atom.h" #include -#include + #include "sna.h" #include "atom.h" #include "update.h" @@ -107,9 +107,9 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal compute sna/atom command"); chemflag = 1; memory->create(map,ntypes+1,"compute_sna_atom:map"); - nelements = force->inumeric(FLERR,arg[iarg+1]); + nelements = utils::inumeric(FLERR,arg[iarg+1],false,lmp); for(int i = 0; i < ntypes; i++) { - int jelem = force->inumeric(FLERR,arg[iarg+2+i]); + int jelem = utils::inumeric(FLERR,arg[iarg+2+i],false,lmp); if (jelem < 0 || jelem >= nelements) error->all(FLERR,"Illegal compute snav/atom command"); map[i+1] = jelem; diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index 63867f1691..cb1a71aa45 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "pair_snap.h" -#include + #include -#include + #include #include "atom.h" #include "force.h" @@ -25,7 +25,7 @@ #include "sna.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -515,7 +515,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpcoeff; if (comm->me == 0) { - fpcoeff = force->open_potential(coefffilename); + fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); if (fpcoeff == NULL) { char str[128]; snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); @@ -662,7 +662,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpparam; if (comm->me == 0) { - fpparam = force->open_potential(paramfilename); + fpparam = utils::open_potential(paramfilename,lmp,nullptr); if (fpparam == NULL) { char str[128]; snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 94eff27f53..281100740a 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ #include "compute_spin.h" -#include + #include #include #include "atom.h" diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 6b9ad517bb..82bf83ac10 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -34,7 +34,7 @@ #include "random_mars.h" #include "respa.h" #include "update.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -53,9 +53,9 @@ FixLangevinSpin::FixLangevinSpin(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; nevery = 1; - temp = force->numeric(FLERR,arg[3]); - alpha_t = force->numeric(FLERR,arg[4]); - seed = force->inumeric(FLERR,arg[5]); + temp = utils::numeric(FLERR,arg[3],false,lmp); + alpha_t = utils::numeric(FLERR,arg[4],false,lmp); + seed = utils::inumeric(FLERR,arg[5],false,lmp); if (alpha_t < 0.0) { error->all(FLERR,"Illegal langevin/spin command"); diff --git a/src/SPIN/fix_neb_spin.cpp b/src/SPIN/fix_neb_spin.cpp index 5acbbf59e8..0b2e86e465 100644 --- a/src/SPIN/fix_neb_spin.cpp +++ b/src/SPIN/fix_neb_spin.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ #include "fix_neb_spin.h" -#include + #include #include #include "universe.h" @@ -57,7 +57,7 @@ FixNEBSpin::FixNEBSpin(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix neb_spin command"); - kspring = force->numeric(FLERR,arg[3]); + kspring = utils::numeric(FLERR,arg[3],false,lmp); if (kspring <= 0.0) error->all(FLERR,"Illegal fix neb command"); // optional params diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index b788d27d05..cbb367e438 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ #include "fix_precession_spin.h" -#include + #include #include #include "atom.h" @@ -80,33 +80,33 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lm if (strcmp(arg[iarg],"zeeman") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix precession/spin command"); zeeman_flag = 1; - H_field = force->numeric(FLERR,arg[iarg+1]); - nhx = force->numeric(FLERR,arg[iarg+2]); - nhy = force->numeric(FLERR,arg[iarg+3]); - nhz = force->numeric(FLERR,arg[iarg+4]); + H_field = utils::numeric(FLERR,arg[iarg+1],false,lmp); + nhx = utils::numeric(FLERR,arg[iarg+2],false,lmp); + nhy = utils::numeric(FLERR,arg[iarg+3],false,lmp); + nhz = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else if (strcmp(arg[iarg],"anisotropy") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix precession/spin command"); aniso_flag = 1; - Ka = force->numeric(FLERR,arg[iarg+1]); - nax = force->numeric(FLERR,arg[iarg+2]); - nay = force->numeric(FLERR,arg[iarg+3]); - naz = force->numeric(FLERR,arg[iarg+4]); + Ka = utils::numeric(FLERR,arg[iarg+1],false,lmp); + nax = utils::numeric(FLERR,arg[iarg+2],false,lmp); + nay = utils::numeric(FLERR,arg[iarg+3],false,lmp); + naz = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else if (strcmp(arg[iarg],"cubic") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix precession/spin command"); cubic_flag = 1; - k1c = force->numeric(FLERR,arg[iarg+1]); - k2c = force->numeric(FLERR,arg[iarg+2]); - nc1x = force->numeric(FLERR,arg[iarg+3]); - nc1y = force->numeric(FLERR,arg[iarg+4]); - nc1z = force->numeric(FLERR,arg[iarg+5]); - nc2x = force->numeric(FLERR,arg[iarg+6]); - nc2y = force->numeric(FLERR,arg[iarg+7]); - nc2z = force->numeric(FLERR,arg[iarg+8]); - nc3x = force->numeric(FLERR,arg[iarg+9]); - nc3y = force->numeric(FLERR,arg[iarg+10]); - nc3z = force->numeric(FLERR,arg[iarg+11]); + k1c = utils::numeric(FLERR,arg[iarg+1],false,lmp); + k2c = utils::numeric(FLERR,arg[iarg+2],false,lmp); + nc1x = utils::numeric(FLERR,arg[iarg+3],false,lmp); + nc1y = utils::numeric(FLERR,arg[iarg+4],false,lmp); + nc1z = utils::numeric(FLERR,arg[iarg+5],false,lmp); + nc2x = utils::numeric(FLERR,arg[iarg+6],false,lmp); + nc2y = utils::numeric(FLERR,arg[iarg+7],false,lmp); + nc2z = utils::numeric(FLERR,arg[iarg+8],false,lmp); + nc3x = utils::numeric(FLERR,arg[iarg+9],false,lmp); + nc3y = utils::numeric(FLERR,arg[iarg+10],false,lmp); + nc3z = utils::numeric(FLERR,arg[iarg+11],false,lmp); iarg += 12; } else error->all(FLERR,"Illegal precession/spin command"); } diff --git a/src/SPIN/min_spin.cpp b/src/SPIN/min_spin.cpp index f6a6b90891..f36f11f2a9 100644 --- a/src/SPIN/min_spin.cpp +++ b/src/SPIN/min_spin.cpp @@ -18,17 +18,17 @@ ------------------------------------------------------------------------- */ #include "min_spin.h" -#include -#include -#include -#include "universe.h" + #include "atom.h" -#include "force.h" -#include "update.h" -#include "output.h" -#include "timer.h" #include "error.h" #include "math_const.h" +#include "output.h" +#include "timer.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -78,12 +78,12 @@ int MinSpin::modify_param(int narg, char **arg) { if (strcmp(arg[0],"alpha_damp") == 0) { if (narg < 2) error->all(FLERR,"Illegal min_modify command"); - alpha_damp = force->numeric(FLERR,arg[1]); + alpha_damp = utils::numeric(FLERR,arg[1],false,lmp); return 2; } if (strcmp(arg[0],"discrete_factor") == 0) { if (narg < 2) error->all(FLERR,"Illegal min_modify command"); - discrete_factor = force->numeric(FLERR,arg[1]); + discrete_factor = utils::numeric(FLERR,arg[1],false,lmp); return 2; } return 0; diff --git a/src/SPIN/min_spin_cg.cpp b/src/SPIN/min_spin_cg.cpp index de1ef39f66..4b8b745419 100644 --- a/src/SPIN/min_spin_cg.cpp +++ b/src/SPIN/min_spin_cg.cpp @@ -21,25 +21,22 @@ preprint arXiv:1904.02669. ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "min_spin_cg.h" -#include "universe.h" + #include "atom.h" #include "citeme.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "update.h" +#include "math_const.h" +#include "memory.h" #include "output.h" #include "timer.h" -#include "error.h" -#include "memory.h" -#include "modify.h" -#include "math_special.h" -#include "math_const.h" #include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -148,7 +145,7 @@ int MinSpinCG::modify_param(int narg, char **arg) { if (strcmp(arg[0],"discrete_factor") == 0) { if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); - discrete_factor = force->numeric(FLERR,arg[1]); + discrete_factor = utils::numeric(FLERR,arg[1],false,lmp); return 2; } return 0; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index df12782528..40029b7e71 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -21,24 +21,22 @@ preprint arXiv:1904.02669. ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "min_spin_lbfgs.h" + #include "atom.h" #include "citeme.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "update.h" +#include "math_const.h" +#include "memory.h" #include "output.h" #include "timer.h" -#include "error.h" -#include "memory.h" -#include "modify.h" -#include "math_special.h" -#include "math_const.h" #include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -156,7 +154,7 @@ int MinSpinLBFGS::modify_param(int narg, char **arg) if (strcmp(arg[0],"discrete_factor") == 0) { if (narg < 2) error->all(FLERR,"Illegal min_modify command"); double discrete_factor; - discrete_factor = force->numeric(FLERR,arg[1]); + discrete_factor = utils::numeric(FLERR,arg[1],false,lmp); maxepsrot = MY_2PI / (10 * discrete_factor); return 2; } diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 168e288181..a89ca403ce 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -22,29 +22,26 @@ ------------------------------------------------------------------------- */ #include "neb_spin.h" -#include -#include -#include -#include -#include "citeme.h" -#include "force.h" -#include "universe.h" + #include "atom.h" -#include "update.h" -#include "domain.h" +#include "citeme.h" #include "comm.h" -#include "min.h" -#include "modify.h" +#include "domain.h" +#include "error.h" +#include "finish.h" #include "fix.h" #include "fix_neb_spin.h" +#include "memory.h" +#include "min.h" +#include "modify.h" #include "output.h" #include "thermo.h" -#include "finish.h" #include "timer.h" -#include "memory.h" -#include "error.h" -#include "math_const.h" -#include "utils.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -94,11 +91,11 @@ void NEBSpin::command(int narg, char **arg) if (narg < 6) error->universe_all(FLERR,"Illegal NEBSpin command"); - etol = force->numeric(FLERR,arg[0]); - ttol = force->numeric(FLERR,arg[1]); - n1steps = force->inumeric(FLERR,arg[2]); - n2steps = force->inumeric(FLERR,arg[3]); - nevery = force->inumeric(FLERR,arg[4]); + etol = utils::numeric(FLERR,arg[0],false,lmp); + ttol = utils::numeric(FLERR,arg[1],false,lmp); + n1steps = utils::inumeric(FLERR,arg[2],false,lmp); + n2steps = utils::inumeric(FLERR,arg[3],false,lmp); + nevery = utils::inumeric(FLERR,arg[4],false,lmp); // error checks diff --git a/src/SPIN/pair_spin_dipole_cut.cpp b/src/SPIN/pair_spin_dipole_cut.cpp index cdae3c0bab..b27c9736b2 100644 --- a/src/SPIN/pair_spin_dipole_cut.cpp +++ b/src/SPIN/pair_spin_dipole_cut.cpp @@ -22,20 +22,17 @@ ------------------------------------------------------------------------- */ #include "pair_spin_dipole_cut.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "neigh_list.h" -#include "fix.h" +#include "error.h" #include "force.h" #include "math_const.h" #include "memory.h" -#include "modify.h" -#include "error.h" -#include "update.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -76,7 +73,7 @@ void PairSpinDipoleCut::settings(int narg, char **arg) { PairSpin::settings(narg,arg); - cut_spin_long_global = force->numeric(FLERR,arg[0]); + cut_spin_long_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -105,10 +102,10 @@ void PairSpinDipoleCut::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double spin_long_cut_one = force->numeric(FLERR,arg[2]); + double spin_long_cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/SPIN/pair_spin_dipole_long.cpp b/src/SPIN/pair_spin_dipole_long.cpp index aeb916cfae..d4b1b8e43e 100644 --- a/src/SPIN/pair_spin_dipole_long.cpp +++ b/src/SPIN/pair_spin_dipole_long.cpp @@ -17,21 +17,18 @@ ------------------------------------------------------------------------- */ #include "pair_spin_dipole_long.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "neigh_list.h" -#include "fix.h" +#include "error.h" #include "force.h" #include "kspace.h" #include "math_const.h" #include "memory.h" -#include "modify.h" -#include "error.h" -#include "update.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -81,7 +78,7 @@ void PairSpinDipoleLong::settings(int narg, char **arg) { PairSpin::settings(narg,arg); - cut_spin_long_global = force->numeric(FLERR,arg[0]); + cut_spin_long_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -109,10 +106,10 @@ void PairSpinDipoleLong::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double spin_long_cut_one = force->numeric(FLERR,arg[2]); + double spin_long_cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index c6b0564463..e27f9fad7d 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -22,19 +22,16 @@ ------------------------------------------------------------------------- */ #include "pair_spin_dmi.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "error.h" #include "force.h" -#include "fix.h" -#include "neigh_list.h" #include "memory.h" -#include "modify.h" -#include "update.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; @@ -65,7 +62,7 @@ void PairSpinDmi::settings(int narg, char **arg) { PairSpin::settings(narg,arg); - cut_spin_dmi_global = force->numeric(FLERR,arg[0]); + cut_spin_dmi_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -98,14 +95,14 @@ void PairSpinDmi::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - const double rij = force->numeric(FLERR,arg[3]); - const double dm = (force->numeric(FLERR,arg[4])); - double dmx = force->numeric(FLERR,arg[5]); - double dmy = force->numeric(FLERR,arg[6]); - double dmz = force->numeric(FLERR,arg[7]); + const double rij = utils::numeric(FLERR,arg[3],false,lmp); + const double dm = utils::numeric(FLERR,arg[4],false,lmp); + double dmx = utils::numeric(FLERR,arg[5],false,lmp); + double dmy = utils::numeric(FLERR,arg[6],false,lmp); + double dmz = utils::numeric(FLERR,arg[7],false,lmp); double inorm = 1.0/(dmx*dmx+dmy*dmy+dmz*dmz); dmx *= inorm; diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 5c5d5cb1a4..27da47dd0f 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -22,19 +22,16 @@ ------------------------------------------------------------------------- */ #include "pair_spin_exchange.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "error.h" -#include "fix.h" #include "force.h" -#include "neigh_list.h" #include "memory.h" -#include "modify.h" -#include "update.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; @@ -62,7 +59,7 @@ void PairSpinExchange::settings(int narg, char **arg) { PairSpin::settings(narg,arg); - cut_spin_exchange_global = force->numeric(FLERR,arg[0]); + cut_spin_exchange_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -92,15 +89,15 @@ void PairSpinExchange::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // get exchange arguments from input command - const double rc = force->numeric(FLERR,arg[3]); - const double j1 = force->numeric(FLERR,arg[4]); - const double j2 = force->numeric(FLERR,arg[5]); - const double j3 = force->numeric(FLERR,arg[6]); + const double rc = utils::numeric(FLERR,arg[3],false,lmp); + const double j1 = utils::numeric(FLERR,arg[4],false,lmp); + const double j2 = utils::numeric(FLERR,arg[5],false,lmp); + const double j3 = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 741305fbf4..2242cf985d 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -22,19 +22,16 @@ ------------------------------------------------------------------------- */ #include "pair_spin_magelec.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "error.h" -#include "fix.h" #include "force.h" -#include "neigh_list.h" #include "memory.h" -#include "modify.h" -#include "update.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; @@ -64,7 +61,7 @@ void PairSpinMagelec::settings(int narg, char **arg) PairSpin::settings(narg,arg); - cut_spin_magelec_global = force->numeric(FLERR,arg[0]); + cut_spin_magelec_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -95,14 +92,14 @@ void PairSpinMagelec::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - const double rij = force->numeric(FLERR,arg[3]); - const double magelec = (force->numeric(FLERR,arg[4])); - double mex = force->numeric(FLERR,arg[5]); - double mey = force->numeric(FLERR,arg[6]); - double mez = force->numeric(FLERR,arg[7]); + const double rij = utils::numeric(FLERR,arg[3],false,lmp); + const double magelec = utils::numeric(FLERR,arg[4],false,lmp); + double mex = utils::numeric(FLERR,arg[5],false,lmp); + double mey = utils::numeric(FLERR,arg[6],false,lmp); + double mez = utils::numeric(FLERR,arg[7],false,lmp); double inorm = 1.0/(mex*mex+mey*mey+mez*mez); mex *= inorm; diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index 4fd8ecc215..33ea904c0c 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -22,19 +22,16 @@ ------------------------------------------------------------------------- */ #include "pair_spin_neel.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "error.h" -#include "fix.h" #include "force.h" -#include "neigh_list.h" #include "memory.h" -#include "modify.h" -#include "update.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; @@ -66,7 +63,7 @@ void PairSpinNeel::settings(int narg, char **arg) { PairSpin::settings(narg,arg); - cut_spin_neel_global = force->numeric(FLERR,arg[0]); + cut_spin_neel_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -99,16 +96,16 @@ void PairSpinNeel::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - const double rij = force->numeric(FLERR,arg[3]); - const double k1 = force->numeric(FLERR,arg[4]); - const double k2 = force->numeric(FLERR,arg[5]); - const double k3 = force->numeric(FLERR,arg[6]); - const double l1 = force->numeric(FLERR,arg[7]); - const double l2 = force->numeric(FLERR,arg[8]); - const double l3 = force->numeric(FLERR,arg[9]); + const double rij = utils::numeric(FLERR,arg[3],false,lmp); + const double k1 = utils::numeric(FLERR,arg[4],false,lmp); + const double k2 = utils::numeric(FLERR,arg[5],false,lmp); + const double k3 = utils::numeric(FLERR,arg[6],false,lmp); + const double l1 = utils::numeric(FLERR,arg[7],false,lmp); + const double l2 = utils::numeric(FLERR,arg[8],false,lmp); + const double l3 = utils::numeric(FLERR,arg[9],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 8f15128399..688522c1bd 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_srd.h" -#include + #include #include #include "math_extra.h" @@ -94,15 +94,15 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), global_freq = 1; extvector = 0; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); bigexist = 1; if (strcmp(arg[4],"NULL") == 0) bigexist = 0; else biggroup = group->find(arg[4]); - temperature_srd = force->numeric(FLERR,arg[5]); - gridsrd = force->numeric(FLERR,arg[6]); - int seed = force->inumeric(FLERR,arg[7]); + temperature_srd = utils::numeric(FLERR,arg[5],false,lmp); + gridsrd = utils::numeric(FLERR,arg[6],false,lmp); + int seed = utils::inumeric(FLERR,arg[7],false,lmp); // parse options @@ -125,7 +125,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), while (iarg < narg) { if (strcmp(arg[iarg],"lamda") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - lamda = force->numeric(FLERR,arg[iarg+1]); + lamda = utils::numeric(FLERR,arg[iarg+1],false,lmp); lamdaflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"collision") == 0) { @@ -155,22 +155,22 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), iarg += 2; } else if (strcmp(arg[iarg],"radius") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - radfactor = force->numeric(FLERR,arg[iarg+1]); + radfactor = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"bounce") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - maxbounceallow = force->inumeric(FLERR,arg[iarg+1]); + maxbounceallow = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"search") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); - gridsearch = force->numeric(FLERR,arg[iarg+1]); + gridsearch = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"cubic") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command"); if (strcmp(arg[iarg+1],"error") == 0) cubicflag = CUBIC_ERROR; else if (strcmp(arg[iarg+1],"warn") == 0) cubicflag = CUBIC_WARN; else error->all(FLERR,"Illegal fix srd command"); - cubictol = force->numeric(FLERR,arg[iarg+2]); + cubictol = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"shift") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix srd command"); @@ -178,7 +178,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), else if (strcmp(arg[iarg+1],"yes") == 0) shiftuser = SHIFT_YES; else if (strcmp(arg[iarg+1],"possible") == 0) shiftuser = SHIFT_POSSIBLE; else error->all(FLERR,"Illegal fix srd command"); - shiftseed = force->inumeric(FLERR,arg[iarg+2]); + shiftseed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"tstat") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix srd command"); diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index ab113df28a..8ffd764447 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -12,18 +12,18 @@ ------------------------------------------------------------------------- */ #include "fix_wall_srd.h" -#include -#include -#include "fix.h" + #include "domain.h" -#include "lattice.h" +#include "error.h" +#include "fix.h" #include "input.h" +#include "lattice.h" +#include "memory.h" #include "modify.h" #include "update.h" #include "variable.h" -#include "memory.h" -#include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -76,7 +76,7 @@ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) : strcpy(varstr[nwall],&arg[iarg+1][2]); } else { wallstyle[nwall] = CONSTANT; - coord0[nwall] = force->numeric(FLERR,arg[iarg+1]); + coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp); } nwall++; diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index 2165132856..dd02676466 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -12,23 +12,15 @@ ------------------------------------------------------------------------- */ #include "fix_atc.h" -#include -#include -#include -#include "fix_nve.h" + #include "atom.h" -#include "force.h" -#include "update.h" -#include "respa.h" -#include "error.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "pointers.h" #include "comm.h" +#include "error.h" #include "group.h" +#include "neigh_request.h" +#include "neighbor.h" #include "ATC_Method.h" -#include "ATC_Transfer.h" #include "ATC_TransferKernel.h" #include "ATC_TransferPartitionOfUnity.h" #include "ATC_CouplingEnergy.h" @@ -37,6 +29,8 @@ #include "ATC_CouplingMomentumEnergy.h" #include "LammpsInterface.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; using std::string; diff --git a/src/USER-ATC/fix_atc.h b/src/USER-ATC/fix_atc.h index 2512c658db..5bf26f6eaa 100644 --- a/src/USER-ATC/fix_atc.h +++ b/src/USER-ATC/fix_atc.h @@ -8,7 +8,6 @@ FixStyle(atc,FixATC) #define FIX_ATC_H #include "fix.h" -#include "pointers.h" // access to lammps pointers namespace ATC { class ATC_Method; diff --git a/src/USER-AWPMD/atom_vec_wavepacket.cpp b/src/USER-AWPMD/atom_vec_wavepacket.cpp index 0d11e983ad..46b239be08 100644 --- a/src/USER-AWPMD/atom_vec_wavepacket.cpp +++ b/src/USER-AWPMD/atom_vec_wavepacket.cpp @@ -16,9 +16,10 @@ ------------------------------------------------------------------------- */ #include "atom_vec_wavepacket.h" -#include + #include "atom.h" -#include "error.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-AWPMD/fix_nve_awpmd.cpp b/src/USER-AWPMD/fix_nve_awpmd.cpp index 2aa2e7680b..178f0f42de 100644 --- a/src/USER-AWPMD/fix_nve_awpmd.cpp +++ b/src/USER-AWPMD/fix_nve_awpmd.cpp @@ -22,7 +22,7 @@ #include "update.h" #include "respa.h" #include "error.h" -#include "utils.h" + #include "TCP/wpmd_split.h" diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index e382a1cb9c..5e23b7fc69 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -16,29 +16,30 @@ ------------------------------------------------------------------------- */ #include "pair_awpmd_cut.h" -#include -#include -#include -#include -#include + #include "atom.h" -#include "update.h" -#include "min.h" -#include "domain.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" -#include "neighbor.h" +#include "memory.h" +#include "min.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" -#include "utils.h" +#include "neighbor.h" +#include "update.h" #include "logexc.h" #include "vector_3.h" #include "TCP/wpmd.h" #include "TCP/wpmd_split.h" +#include +#include +#include +#include +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -237,7 +238,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) etmap[etag[i]].push_back(i); } else - error->all(FLERR,fmt("Invalid spin value (%d) for particle %d !",spin[i],i)); + error->all(FLERR,logfmt("Invalid spin value (%d) for particle %d !",spin[i],i)); } // ion force vector Vector_3 *fi=NULL; @@ -254,7 +255,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) for(size_t k=0;kall(FLERR,fmt("WP splits for one electron should have the same spin (at particles %d, %d)!",el[0],i)); + error->all(FLERR,logfmt("WP splits for one electron should have the same spin (at particles %d, %d)!",el[0],i)); double m= atom->mass ? atom->mass[type[i]] : force->e_mass; Vector_3 xx=Vector_3(x[i][0],x[i][1],x[i][2]); Vector_3 rv=m*Vector_3(v[i][0],v[i][1],v[i][2]); @@ -407,7 +408,7 @@ void PairAWPMDCut::allocate() void PairAWPMDCut::settings(int narg, char **arg){ if (narg < 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); ermscale=1.; width_pbc=0.; @@ -427,21 +428,21 @@ void PairAWPMDCut::settings(int narg, char **arg){ i++; if(i>=narg) error->all(FLERR,"Setting 'fix' should be followed by a number in awpmd/cut"); - wpmd->w0=force->numeric(FLERR,arg[i]); + wpmd->w0=utils::numeric(FLERR,arg[i],false,lmp); } else if(!strcmp(arg[i],"harm")){ wpmd->constraint=AWPMD::HARM; i++; if(i>=narg) error->all(FLERR,"Setting 'harm' should be followed by a number in awpmd/cut"); - wpmd->w0=force->numeric(FLERR,arg[i]); + wpmd->w0=utils::numeric(FLERR,arg[i],false,lmp); wpmd->set_harm_constr(wpmd->w0); } else if(!strcmp(arg[i],"pbc")){ i++; if(i>=narg) error->all(FLERR,"Setting 'pbc' should be followed by a number in awpmd/cut"); - width_pbc=force->numeric(FLERR,arg[i]); + width_pbc=utils::numeric(FLERR,arg[i],false,lmp); } else if(!strcmp(arg[i],"relax")) wpmd->constraint=AWPMD::RELAX; @@ -449,7 +450,7 @@ void PairAWPMDCut::settings(int narg, char **arg){ i++; if(i>=narg) error->all(FLERR,"Setting 'ermscale' should be followed by a number in awpmd/cut"); - ermscale=force->numeric(FLERR,arg[i]); + ermscale=utils::numeric(FLERR,arg[i],false,lmp); } else if(!strcmp(arg[i],"flex_press")) flexible_pressure_flag = 1; @@ -484,11 +485,11 @@ void PairAWPMDCut::coeff(int narg, char **arg) } int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; - if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); + if (narg == 3) cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index d0a24b99a3..a4b8de84bd 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -15,24 +15,23 @@ ------------------------------------------------------------------------- */ #include "compute_pressure_bocs.h" -#include -#include -#include -#include + +#include "angle.h" #include "atom.h" -#include "update.h" +#include "bond.h" +#include "dihedral.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" -#include "dihedral.h" #include "improper.h" #include "kspace.h" -#include "error.h" +#include "modify.h" +#include "pair.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; @@ -112,6 +111,9 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : vector = new double[size_vector]; nvirial = 0; vptr = NULL; + + splines = NULL; + spline_length = 0; } /* ---------------------------------------------------------------------- */ @@ -212,13 +214,11 @@ double ComputePressureBocs::find_index(double * grid, double value) if (value >= grid[i] && value <= (grid[i] + spacing)) { return i; } + error->all(FLERR, fmt::format("find_index could not find value in grid for value: {}", value)); for (int i = 0; i < gridsize; ++i) { fprintf(stderr, "grid %d: %f\n",i,grid[i]); } - char * errmsg = (char *) calloc(100,sizeof(char)); - sprintf(errmsg,"Value %f does not fall within spline grid.\n",value); - error->all(FLERR,errmsg); exit(1); } @@ -233,12 +233,12 @@ double ComputePressureBocs::get_cg_p_corr(double ** grid, int basis_type, int i = find_index(grid[0],vCG); double correction, deltax = vCG - grid[0][i]; - if (basis_type == 1) + if (basis_type == BASIS_LINEAR_SPLINE) { correction = grid[1][i] + (deltax) * ( grid[1][i+1] - grid[1][i] ) / ( grid[0][i+1] - grid[0][i] ); } - else if (basis_type == 2) + else if (basis_type == BASIS_CUBIC_SPLINE) { correction = grid[1][i] + (grid[2][i] * deltax) + (grid[3][i] * pow(deltax,2)) + (grid[4][i] * pow(deltax,3)); @@ -257,7 +257,7 @@ double ComputePressureBocs::get_cg_p_corr(double ** grid, int basis_type, void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis, double *sent_phi_coeff, int sent_N_mol, double sent_vavg) { - if (basis_type == 0) { p_basis_type = 0; } + if (basis_type == BASIS_ANALYTIC) { p_basis_type = BASIS_ANALYTIC; } else { error->all(FLERR,"Incorrect basis type passed to ComputePressureBocs\n"); @@ -281,8 +281,8 @@ void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis, void ComputePressureBocs::send_cg_info(int basis_type, double ** in_splines, int gridsize) { - if (basis_type == 1) { p_basis_type = 1; } - else if (basis_type == 2) { p_basis_type = 2; } + if (basis_type == BASIS_LINEAR_SPLINE) { p_basis_type = BASIS_LINEAR_SPLINE; } + else if (basis_type == BASIS_CUBIC_SPLINE) { p_basis_type = BASIS_CUBIC_SPLINE; } else { error->all(FLERR,"Incorrect basis type passed to ComputePressureBocs\n"); @@ -318,11 +318,11 @@ double ComputePressureBocs::compute_scalar() volume = (domain->xprd * domain->yprd * domain->zprd); /* MRD NJD if block */ - if ( p_basis_type == 0 ) + if ( p_basis_type == BASIS_ANALYTIC ) { correction = get_cg_p_corr(N_basis,phi_coeff,N_mol,vavg,volume); } - else if ( p_basis_type == 1 || p_basis_type == 2 ) + else if ( p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) { correction = get_cg_p_corr(splines, p_basis_type, volume); } diff --git a/src/USER-BOCS/compute_pressure_bocs.h b/src/USER-BOCS/compute_pressure_bocs.h index 4fb932c508..6592d5b35e 100644 --- a/src/USER-BOCS/compute_pressure_bocs.h +++ b/src/USER-BOCS/compute_pressure_bocs.h @@ -27,7 +27,15 @@ ComputeStyle(PRESSURE/BOCS,ComputePressureBocs) #include "compute.h" namespace LAMMPS_NS { -// ComputePressure -> ComputePressureBocs MRD NJD + // Enumerate the p_basis_type magic values to improve readability: + enum{BASIS_ANALYTIC, BASIS_LINEAR_SPLINE, BASIS_CUBIC_SPLINE}; + // Enumerate the data file column names to improve readability + enum{VOLUME, PRESSURE_CORRECTION}; + // Declare names for the number of columns in the splines data structure to improve readability + const int NUM_LINEAR_SPLINE_COLUMNS = 2; // linear spline columns passed to compute + const int NUM_CUBIC_SPLINE_COLUMNS = 5; // cubic spline columns passed to compute + + // ComputePressure -> ComputePressureBocs MRD NJD class ComputePressureBocs : public Compute { public: ComputePressureBocs(class LAMMPS *, int, char **); diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 7c2f75a8ce..6f7962c83f 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -15,27 +15,30 @@ ------------------------------------------------------------------------- */ #include "fix_bocs.h" + #include -#include + #include +#include + #include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "compute.h" +#include "compute_pressure_bocs.h" +#include "domain.h" +#include "error.h" +#include "fix_deform.h" + #include "force.h" #include "group.h" -#include "comm.h" -#include "neighbor.h" #include "irregular.h" -#include "modify.h" -#include "fix_deform.h" -#include "compute.h" #include "kspace.h" -#include "update.h" -#include "respa.h" -#include "domain.h" #include "memory.h" -#include "error.h" -#include "citeme.h" - -#include "compute_pressure_bocs.h" +#include "modify.h" +#include "neighbor.h" +#include "respa.h" +#include "update.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -59,8 +62,12 @@ enum{NOBIAS,BIAS}; enum{NONE,XYZ,XY,YZ,XZ}; enum{ISO,ANISO,TRICLINIC}; -// NB: Keep error and warning messages less than 255 chars long. -const int MAX_MESSAGE_LENGTH = 256; +const int NUM_INPUT_DATA_COLUMNS = 2; // columns in the pressure correction file + +// NB: +// - Keep error and warning messages less than 255 chars long. +// - Allocate your char buffer to be 1 char longer than this +const int MAX_MESSAGE_LENGTH = 255; /* ---------------------------------------------------------------------- NVT,NPH,NPT integrators for improved Nose-Hoover equations of motion @@ -111,6 +118,9 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : p_match_coeffs = NULL; + splines = NULL; + spline_length = 0; + // turn on tilt factor scaling, whenever applicable dimension = domain->dimension; @@ -149,10 +159,10 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix bocs command"); tstat_flag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); t_target = t_start; - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (t_start <= 0.0 || t_stop <= 0.0) error->all(FLERR, "Target temperature for fix bocs cannot be 0.0"); @@ -167,11 +177,11 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : p_match_flag = 1; pcouple = XYZ; p_start[0] = p_start[1] = p_start[2] = - force->numeric(FLERR,arg[iarg+1]); + utils::numeric(FLERR,arg[iarg+1],false,lmp); p_stop[0] = p_stop[1] = p_stop[2] = - force->numeric(FLERR,arg[iarg+2]); + utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; p_flag[3] = p_flag[4] = p_flag[5] = 0; // MRD @@ -183,48 +193,47 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : if ( strcmp(arg[iarg], "analytic") == 0 ) { if (iarg + 4 > narg) { - error->all(FLERR,"Illegal fix bocs command. basis type analytic" + error->all(FLERR,"Illegal fix bocs command. Basis type analytic" " must be followed by: avg_vol n_mol n_pmatch_coeff"); } - p_basis_type = 0; - vavg = force->numeric(FLERR,arg[iarg+1]); - N_mol = force->inumeric(FLERR,arg[iarg+2]); - N_p_match = force->inumeric(FLERR,arg[iarg+3]); + p_basis_type = BASIS_ANALYTIC; + vavg = utils::numeric(FLERR,arg[iarg+1],false,lmp); + N_mol = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + N_p_match = utils::inumeric(FLERR,arg[iarg+3],false,lmp); p_match_coeffs = (double *) (calloc(N_p_match, sizeof(double)) ); iarg += 4; if (iarg + N_p_match > narg) error->all(FLERR,"Illegal fix bocs command. Missing coeffs."); for (int pmatchi = 0; pmatchi < N_p_match; pmatchi++) - p_match_coeffs[pmatchi] = force->numeric(FLERR,arg[iarg+pmatchi]); + p_match_coeffs[pmatchi] = utils::numeric(FLERR,arg[iarg+pmatchi],false,lmp); iarg += (N_p_match); } else if (strcmp(arg[iarg], "linear_spline") == 0 ) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command. " "Supply a file name after linear_spline."); - p_basis_type = 1; + p_basis_type = BASIS_LINEAR_SPLINE; spline_length = read_F_table( arg[iarg+1], p_basis_type ); iarg += 2; } else if (strcmp(arg[iarg], "cubic_spline") == 0 ) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command. " "Supply a file name after cubic_spline."); - p_basis_type = 2; + p_basis_type = BASIS_CUBIC_SPLINE; spline_length = read_F_table( arg[iarg+1], p_basis_type ); iarg += 2; } else { - char errmsg[256]; - snprintf(errmsg,256,"CG basis type %s is not recognized\nSupported " - "basis types: analytic linear_spline cubic_spline",arg[iarg]); + std::string errmsg = fmt::format("CG basis type {} is not recognized\nSupported " + "basis types: analytic linear_spline cubic_spline",arg[iarg]); error->all(FLERR,errmsg); } // END NJD MRD } else if (strcmp(arg[iarg],"tchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command"); - mtchain = force->inumeric(FLERR,arg[iarg+1]); + mtchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); // used by FixNVTSllod to preserve non-default value mtchain_default_flag = 0; if (mtchain < 1) error->all(FLERR,"Illegal fix bocs command"); iarg += 2; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command"); - mpchain = force->inumeric(FLERR,arg[iarg+1]); + mpchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (mpchain < 0) error->all(FLERR,"Illegal fix bocs command"); iarg += 2; } else if (strcmp(arg[iarg],"mtk") == 0) { @@ -235,18 +244,17 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"tloop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command"); - nc_tchain = force->inumeric(FLERR,arg[iarg+1]); + nc_tchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nc_tchain < 0) error->all(FLERR,"Illegal fix bocs command"); iarg += 2; } else if (strcmp(arg[iarg],"ploop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bocs command"); - nc_pchain = force->inumeric(FLERR,arg[iarg+1]); + nc_pchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nc_pchain < 0) error->all(FLERR,"Illegal fix bocs command"); iarg += 2; } else { - char errmsg[128]; - snprintf(errmsg,128,"Illegal fix bocs command: unrecognized keyword %s" - ,arg[iarg]); + std::string errmsg = fmt::format("Illegal fix bocs command: unrecognized keyword {}", + arg[iarg]); error->all(FLERR,errmsg); } } @@ -471,6 +479,12 @@ FixBocs::~FixBocs() } } if (p_match_coeffs) free(p_match_coeffs); + + // Free splines memory structure + if (splines != NULL) { + memory->destroy(splines); + spline_length = 0; + } } /* ---------------------------------------------------------------------- */ @@ -537,12 +551,12 @@ void FixBocs::init() { if (pressure) { - if (p_basis_type == 0) + if (p_basis_type == BASIS_ANALYTIC) { ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg); } - else if ( p_basis_type == 1 || p_basis_type == 2 ) + else if ( p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) { ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, spline_length); @@ -630,28 +644,42 @@ void FixBocs::init() // NJD MRD 2 functions int FixBocs::read_F_table( char *filename, int p_basis_type ) { - FILE *fpi; - int N_columns = 2, n_entries = 0, i; - float f1, f2; - int test_sscanf; - double **data = (double **) calloc(N_columns,sizeof(double *)); - char * line = (char *) calloc(200,sizeof(char)); - + std::string message; + double **data; bool badInput = false; - char badDataMsg[MAX_MESSAGE_LENGTH]; - fpi = fopen(filename,"r"); - if (fpi) - { - while (fgets(line,199,fpi)) { ++n_entries; } - - for (i = 0; i < N_columns; ++i) - { - data[i] = (double *) calloc(n_entries,sizeof(double)); + int numEntries = 0; + FILE *fpi = fopen(filename,"r"); + if (fpi) { + // Old code read the input file twice. Now we simply + // read all the lines from the input file into a string vector, + // then work with the data in-memory rather than do a second pass + // through the file. + // NB: LAMMPS coding guidelines prefer cstdio so we are intentionally + // foregoing reading with getline + if (comm->me == 0) { + error->message(FLERR, fmt::format("INFO: About to read data file: {}", filename)); } - // Don't need to re-open the file to make a second pass through it - // simply rewind to beginning - rewind(fpi); + // Data file lines hold two floating point numbers. + // Line length we allocate should be long enough without being too long. + // 128 seems safe for a line we expect to be < 30 chars. + const int MAX_F_TABLE_LINE_LENGTH = 128; + char line[MAX_F_TABLE_LINE_LENGTH]; + std::vector inputLines; + while (fgets(line, MAX_F_TABLE_LINE_LENGTH, fpi)) { + inputLines.push_back(std::string(line)); + } + fclose(fpi); + + numEntries = inputLines.size(); + if (comm->me == 0) { + error->message(FLERR, fmt::format("INFO: Read {} lines from file", numEntries)); + } + + + // Allocate memory for the two dimensional matrix + // that holds data from the input file. + memory->create(data, NUM_INPUT_DATA_COLUMNS, numEntries, "data"); double stdVolumeInterval = 0.0; double currVolumeInterval = 0.0; @@ -659,125 +687,157 @@ int FixBocs::read_F_table( char *filename, int p_basis_type ) // The literature indicates getting this value right in the // general case can be pretty complicated. I don't think it // needs to be complicated here, though. At least based on the - // sample data I've seen where the volume values are fairly - // large. + // sample data I've seen where the volume values are fairly large. const double volumeIntervalTolerance = 0.001; - n_entries = 0; - while( fgets(line,199,fpi)) { - ++n_entries; - test_sscanf = sscanf(line," %f , %f ",&f1, &f2); + int lineNum = 0; // this value is only for message + int numBadVolumeIntervals = 0; // count these for message + float f1, f2; + int test_sscanf; + for (int i = 0; i < inputLines.size(); ++i) { + lineNum++; // count each line processed now so lineNum messages can be 1-based + test_sscanf = sscanf(inputLines.at(i).c_str()," %f , %f ",&f1, &f2); if (test_sscanf == 2) { - data[0][n_entries-1] = (double) f1; - data[1][n_entries-1] = (double) f2; - if (n_entries == 2) { - stdVolumeInterval = data[0][n_entries-1] - data[0][n_entries-2]; + //if (comm->me == 0) { + // error->message(FLERR, fmt::format("INFO: f1 = {}, f2 = {}", f1, f2)); + //} + data[VOLUME][i] = (double)f1; + data[PRESSURE_CORRECTION][i] = (double)f2; + if (i == 1) + { + // second entry is used to compute the validation interval used below + stdVolumeInterval = data[VOLUME][i] - data[VOLUME][i-1]; + //if (comm->me == 0) { + // error->message(FLERR, fmt::format("INFO: standard volume interval computed: {}", stdVolumeInterval)); + //} } - else if (n_entries > 2) { - currVolumeInterval = data[0][n_entries-1] - data[0][n_entries-2]; + else if (i > 1) + { + // after second entry, all intervals are validated + currVolumeInterval = data[VOLUME][i] - data[VOLUME][i-1]; + //if (comm->me == 0) { + // error->message(FLERR, fmt::format("INFO: current volume interval: {}", currVolumeInterval)); + //} if (fabs(currVolumeInterval - stdVolumeInterval) > volumeIntervalTolerance) { - snprintf(badDataMsg,MAX_MESSAGE_LENGTH, - "BAD VOLUME INTERVAL: spline analysis requires uniform" - " volume distribution, found inconsistent volume" - " differential, line %d of file %s\n\tline: %s", - n_entries,filename,line); - error->message(FLERR,badDataMsg); + if (comm->me == 0) { + message = fmt::format("Bad volume interval. Spline analysis requires uniform" + " volume distribution, found inconsistent volume" + " differential, line {} of file {}\n\tline: {}", + lineNum, filename, inputLines.at(i)); + error->warning(FLERR, message); + } badInput = true; + numBadVolumeIntervals++; } + // no concluding else is intentional: i = 0, first line, no interval to validate } - // no else -- first entry is simply ignored } else { - snprintf(badDataMsg,MAX_MESSAGE_LENGTH, - "BAD INPUT FORMAT: did not find 2 comma separated numeric" - " values in line %d of file %s\n\tline: %s", - n_entries,filename,line); - error->message(FLERR,badDataMsg); + if (comm->me == 0) { + message = fmt::format("Bad input format: did not find 2 comma separated numeric" + " values in line {} of file {}\n\tline: {}", + lineNum, filename, inputLines.at(i)); + error->warning(FLERR, message); + } badInput = true; } - } - fclose(fpi); - } - else { - char errmsg[MAX_MESSAGE_LENGTH]; - snprintf(errmsg,MAX_MESSAGE_LENGTH,"Unable to open file: %s\n",filename); - error->all(FLERR,errmsg); - } - - if (badInput) { - char errmsg[MAX_MESSAGE_LENGTH]; - snprintf(errmsg,MAX_MESSAGE_LENGTH, - "Bad volume / pressure-correction data: %s\nSee details above",filename); - error->all(FLERR,errmsg); - } - - if (p_basis_type == 1) - { - splines = (double **) calloc(2,sizeof(double *)); - splines[0] = (double *) calloc(n_entries,sizeof(double)); - splines[1] = (double *) calloc(n_entries,sizeof(double)); - int idxa, idxb; - for (idxa = 0; idxa < 2; ++idxa) - { - for (idxb = 0; idxb < n_entries; ++idxb) + if (badInput) { - splines[idxa][idxb] = data[idxa][idxb]; + numBadVolumeIntervals++; } } + + if (numBadVolumeIntervals > 0 && comm->me == 0) { + error->message(FLERR, fmt::format("INFO: total number bad volume intervals = {}", numBadVolumeIntervals)); + } } - else if (p_basis_type == 2) + else { + error->all(FLERR,fmt::format("ERROR: Unable to open file: {}", filename)); + } + + if (badInput && comm->me == 0) { + error->warning(FLERR,fmt::format("Bad volume / pressure-correction data: {}\nSee details above", filename)); + } + + if (p_basis_type == BASIS_LINEAR_SPLINE) { - spline_length = n_entries; - build_cubic_splines(data); - n_entries -= 1; + spline_length = numEntries; + numEntries = build_linear_splines(data); + } + else if (p_basis_type == BASIS_CUBIC_SPLINE) + { + spline_length = numEntries; + numEntries = build_cubic_splines(data); } else { - char errmsg[MAX_MESSAGE_LENGTH]; - snprintf(errmsg, MAX_MESSAGE_LENGTH, - "ERROR: invalid p_basis_type value of %d in read_F_table", - p_basis_type); - error->all(FLERR,errmsg); + error->all(FLERR,fmt::format("ERROR: invalid p_basis_type value of {} in read_F_table", p_basis_type)); } - // cleanup - for (i = 0; i < N_columns; ++i) { - free(data[i]); - } - free(data); - return n_entries; + + memory->destroy(data); + return numEntries; } -void FixBocs::build_cubic_splines( double **data ) +int FixBocs::build_linear_splines(double **data) { + //if (comm->me == 0) { + //error->message(FLERR, fmt::format("INFO: entering build_linear_splines, spline_length = {}", spline_length)); + //} + splines = (double **) calloc(NUM_LINEAR_SPLINE_COLUMNS,sizeof(double *)); + splines[VOLUME] = (double *) calloc(spline_length,sizeof(double)); + splines[PRESSURE_CORRECTION] = (double *) calloc(spline_length,sizeof(double)); + + for (int i = 0; i < spline_length; ++i) + { + splines[VOLUME][i] = data[VOLUME][i]; + splines[PRESSURE_CORRECTION][i] = data[PRESSURE_CORRECTION][i]; + } + + if (comm->me == 0) { + error->message(FLERR, fmt::format("INFO: leaving build_linear_splines, spline_length = {}", spline_length)); + } + + return spline_length; +} + +int FixBocs::build_cubic_splines(double **data) { - double *a, *b, *d, *h, *alpha, *c, *l, *mu, *z; + //if (comm->me == 0) { + //error->message(FLERR, fmt::format("INFO: entering build_cubic_splines, spline_length = {}", spline_length)); + //} int n = spline_length; - double alpha_i; - a = (double *) calloc(n,sizeof(double)); - b = (double *) calloc(n+1,sizeof(double)); - d = (double *) calloc(n+1,sizeof(double)); - h = (double *) calloc(n,sizeof(double)); - alpha = (double *) calloc(n,sizeof(double)); - c = (double *) calloc(n+1,sizeof(double)); - l = (double *) calloc(n,sizeof(double)); - mu = (double *) calloc(n,sizeof(double)); - z = (double *) calloc(n,sizeof(double)); - int idx; + double *a, *b, *d, *h, *alpha, *c, *l, *mu, *z; + // 2020-07-17 ag: + // valgrind says that we read/write a[n] down in the + // for(int j=n-1; j>=0; j--) loop below + // and I agree. + // So the size of a must be n+1, not n as was found + // in the original code. + memory->create(a, n+1, "a"); + memory->create(b, n+1, "b"); + memory->create(c, n+1, "c"); + memory->create(d, n+1, "d"); + + memory->create(h, n, "h"); + memory->create(alpha, n, "alpha"); + memory->create(l, n, "l"); + memory->create(mu, n, "mu"); + memory->create(z, n, "z"); + for (int i=0; i1 && i<(n-1)) { alpha_i = (3.0 / h[i]) * ( data[1][i+1] - data[1][i]) - (3.0 / h[i-1] ) - * ( data[1][i] - data[1][i-1] ); + * ( data[1][i] - data[1][i-1] ); alpha[i-1] = alpha_i; } } @@ -795,8 +855,12 @@ void FixBocs::build_cubic_splines( double **data ) mu[n-1] = 0.0; z[n-1] = 0.0; - c[n] = 0.0; + // 2020-07-17 ag: We've been using an uninitialized value for a[n] + // That seems like a bad idea. This may not be the right value + // but its a value. + a[n] = 0.0; b[n] = 0.0; + c[n] = 0.0; d[n] = 0.0; for(int j=n-1; j>=0; j--) @@ -807,21 +871,35 @@ void FixBocs::build_cubic_splines( double **data ) d[j] = (c[j+1]-c[j])/(3.0 * h[j]); } - splines = (double **) calloc(5,sizeof(double *)); - for ( idx = 0; idx < 5; ++idx) - { - splines[idx] = (double *) calloc(n-1,sizeof(double)); - } - idx = 0; - for ( idx = 0; idx < n - 1; ++idx) + int numSplines = n - 1; + memory->create(splines, NUM_CUBIC_SPLINE_COLUMNS, numSplines, "splines"); + for (int idx = 0; idx < numSplines; ++idx) { + splines[0][idx] = data[0][idx]; splines[1][idx] = a[idx]; splines[2][idx] = b[idx]; splines[3][idx] = c[idx]; splines[4][idx] = d[idx]; - splines[0][idx] = data[0][idx]; } + + memory->destroy(a); + memory->destroy(b); + memory->destroy(c); + memory->destroy(d); + + memory->destroy(h); + memory->destroy(alpha); + memory->destroy(l); + memory->destroy(mu); + memory->destroy(z); + + if (comm->me == 0) { + error->message(FLERR, fmt::format("INFO: leaving build_cubic_splines, numSplines = {}", numSplines)); + } + + // Tell the caller how many splines we created + return numSplines; } // END NJD MRD 2 functions @@ -1519,20 +1597,21 @@ int FixBocs::modify_param(int narg, char **arg) if (p_match_flag) // NJD MRD { - if ( p_basis_type == 0 ) + if ( p_basis_type == BASIS_ANALYTIC ) { ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg); } - else if ( p_basis_type == 1 || p_basis_type == 2 ) + else if ( p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) { - ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, - spline_length ); + ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, spline_length ); } } if (pressure->pressflag == 0) - error->all(FLERR,"Fix_modify pressure ID does not compute pressure"); + { + error->all(FLERR, "Fix_modify pressure ID does not compute pressure"); + } return 2; } diff --git a/src/USER-BOCS/fix_bocs.h b/src/USER-BOCS/fix_bocs.h index 34090e4f3a..a1a9f58d2b 100644 --- a/src/USER-BOCS/fix_bocs.h +++ b/src/USER-BOCS/fix_bocs.h @@ -26,7 +26,6 @@ FixStyle(bocs,FixBocs) #include "fix.h" - namespace LAMMPS_NS { class FixBocs : public Fix { @@ -151,7 +150,8 @@ class FixBocs : public Fix { void nhc_press_integrate(); int read_F_table(char *, int); - void build_cubic_splines(double **); + int build_linear_splines(double **); + int build_cubic_splines(double **); virtual void nve_x(); // may be overwritten by child classes virtual void nve_v(); @@ -180,6 +180,10 @@ Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. +E: CG basis type XXX is not recognized + +See second line of message for supported basis types. + E: Target temperature for fix bocs cannot be 0.0 Self-explanatory. diff --git a/src/USER-CGDNA/bond_oxdna_fene.cpp b/src/USER-CGDNA/bond_oxdna_fene.cpp index b2737fc4cd..c9540bf0c0 100644 --- a/src/USER-CGDNA/bond_oxdna_fene.cpp +++ b/src/USER-CGDNA/bond_oxdna_fene.cpp @@ -15,7 +15,7 @@ ------------------------------------------------------------------------- */ #include "bond_oxdna_fene.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -24,7 +24,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "atom_vec_ellipsoid.h" #include "math_extra.h" @@ -302,11 +302,11 @@ void BondOxdnaFene::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double Delta_one = force->numeric(FLERR,arg[2]); - double r0_one = force->numeric(FLERR,arg[3]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double Delta_one = utils::numeric(FLERR,arg[2],false,lmp); + double r0_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; diff --git a/src/USER-CGDNA/bond_oxrna2_fene.cpp b/src/USER-CGDNA/bond_oxrna2_fene.cpp index bdddccda87..2dee1224d3 100644 --- a/src/USER-CGDNA/bond_oxrna2_fene.cpp +++ b/src/USER-CGDNA/bond_oxrna2_fene.cpp @@ -14,8 +14,6 @@ Contributing author: Oliver Henrich (University of Strathclyde, Glasgow) ------------------------------------------------------------------------- */ -#include -#include #include "bond_oxrna2_fene.h" using namespace LAMMPS_NS; diff --git a/src/USER-CGDNA/fix_nve_dotc_langevin.cpp b/src/USER-CGDNA/fix_nve_dotc_langevin.cpp index 59def4c812..17b1fb7b42 100644 --- a/src/USER-CGDNA/fix_nve_dotc_langevin.cpp +++ b/src/USER-CGDNA/fix_nve_dotc_langevin.cpp @@ -16,16 +16,17 @@ ------------------------------------------------------------------------- */ #include "fix_nve_dotc_langevin.h" -#include -#include -#include "math_extra.h" + #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "force.h" -#include "update.h" #include "comm.h" -#include "random_mars.h" #include "error.h" +#include "math_extra.h" +#include "random_mars.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -40,13 +41,13 @@ FixNVEDotcLangevin::FixNVEDotcLangevin(LAMMPS *lmp, int narg, char **arg) : { if (narg != 9) error->all(FLERR,"Illegal fix nve/dotc/langevin command"); - t_start = force->numeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[3],false,lmp); t_target = t_start; - t_stop = force->numeric(FLERR,arg[4]); - t_period = force->numeric(FLERR,arg[5]); + t_stop = utils::numeric(FLERR,arg[4],false,lmp); + t_period = utils::numeric(FLERR,arg[5],false,lmp); if (t_period <= 0.0) error->all(FLERR,"Fix nve/dotc/langevin period must be > 0.0"); gamma = 1.0/t_period; - seed = force->inumeric(FLERR,arg[6]); + seed = utils::inumeric(FLERR,arg[6],false,lmp); if (seed <= 0) error->all(FLERR,"Illegal fix nve/dotc/langevin command"); if (strcmp(arg[7],"angmom") == 0) { @@ -56,7 +57,7 @@ FixNVEDotcLangevin::FixNVEDotcLangevin(LAMMPS *lmp, int narg, char **arg) : Gamma = 0.0; } else { - ascale = force->numeric(FLERR,arg[8]); + ascale = utils::numeric(FLERR,arg[8],false,lmp); Gamma = gamma * ascale; } diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index 51ff26cc6e..662d55c590 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -15,21 +15,20 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna2_coaxstk.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neigh_list.h" + #include #include -#include "mf_oxdna.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -555,8 +554,8 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; @@ -578,30 +577,30 @@ void PairOxdna2Coaxstk::coeff(int narg, char **arg) double AA_cxst1_one, BB_cxst1_one; - k_cxst_one = force->numeric(FLERR,arg[2]); - cut_cxst_0_one = force->numeric(FLERR,arg[3]); - cut_cxst_c_one = force->numeric(FLERR,arg[4]); - cut_cxst_lo_one = force->numeric(FLERR,arg[5]); - cut_cxst_hi_one = force->numeric(FLERR,arg[6]); + k_cxst_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_cxst_0_one = utils::numeric(FLERR,arg[3],false,lmp); + cut_cxst_c_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_cxst_lo_one = utils::numeric(FLERR,arg[5],false,lmp); + cut_cxst_hi_one = utils::numeric(FLERR,arg[6],false,lmp); - a_cxst1_one = force->numeric(FLERR,arg[7]); - theta_cxst1_0_one = force->numeric(FLERR,arg[8]); - dtheta_cxst1_ast_one = force->numeric(FLERR,arg[9]); + a_cxst1_one = utils::numeric(FLERR,arg[7],false,lmp); + theta_cxst1_0_one = utils::numeric(FLERR,arg[8],false,lmp); + dtheta_cxst1_ast_one = utils::numeric(FLERR,arg[9],false,lmp); - a_cxst4_one = force->numeric(FLERR,arg[10]); - theta_cxst4_0_one = force->numeric(FLERR,arg[11]); - dtheta_cxst4_ast_one = force->numeric(FLERR,arg[12]); + a_cxst4_one = utils::numeric(FLERR,arg[10],false,lmp); + theta_cxst4_0_one = utils::numeric(FLERR,arg[11],false,lmp); + dtheta_cxst4_ast_one = utils::numeric(FLERR,arg[12],false,lmp); - a_cxst5_one = force->numeric(FLERR,arg[13]); - theta_cxst5_0_one = force->numeric(FLERR,arg[14]); - dtheta_cxst5_ast_one = force->numeric(FLERR,arg[15]); + a_cxst5_one = utils::numeric(FLERR,arg[13],false,lmp); + theta_cxst5_0_one = utils::numeric(FLERR,arg[14],false,lmp); + dtheta_cxst5_ast_one = utils::numeric(FLERR,arg[15],false,lmp); - a_cxst6_one = force->numeric(FLERR,arg[16]); - theta_cxst6_0_one = force->numeric(FLERR,arg[17]); - dtheta_cxst6_ast_one = force->numeric(FLERR,arg[18]); + a_cxst6_one = utils::numeric(FLERR,arg[16],false,lmp); + theta_cxst6_0_one = utils::numeric(FLERR,arg[17],false,lmp); + dtheta_cxst6_ast_one = utils::numeric(FLERR,arg[18],false,lmp); - AA_cxst1_one = force->numeric(FLERR,arg[19]); - BB_cxst1_one = force->numeric(FLERR,arg[20]); + AA_cxst1_one = utils::numeric(FLERR,arg[19],false,lmp); + BB_cxst1_one = utils::numeric(FLERR,arg[20],false,lmp); b_cxst_lo_one = 0.25 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one)/ (0.5 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one) - diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index e698d8d906..f23ca4fbf7 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -15,19 +15,18 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna2_dh.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "neigh_list.h" + #include #include -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; @@ -277,16 +276,16 @@ void PairOxdna2Dh::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); count = 0; double T, rhos_dh_one, qeff_dh_one; - T = force->numeric(FLERR,arg[2]); - rhos_dh_one = force->numeric(FLERR,arg[3]); - qeff_dh_one = force->numeric(FLERR,arg[4]); + T = utils::numeric(FLERR,arg[2],false,lmp); + rhos_dh_one = utils::numeric(FLERR,arg[3],false,lmp); + qeff_dh_one = utils::numeric(FLERR,arg[4],false,lmp); double lambda_dh_one, kappa_dh_one, qeff_dh_pf_one; double b_dh_one, cut_dh_ast_one, cut_dh_c_one; diff --git a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp index 750c6c022d..f1d425a0b3 100644 --- a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp @@ -15,21 +15,20 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna_coaxstk.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neigh_list.h" + #include #include -#include "mf_oxdna.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -685,8 +684,8 @@ void PairOxdnaCoaxstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; @@ -709,32 +708,32 @@ void PairOxdnaCoaxstk::coeff(int narg, char **arg) double a_cxst3p_one, cosphi_cxst3p_ast_one, b_cxst3p_one, cosphi_cxst3p_c_one; double a_cxst4p_one, cosphi_cxst4p_ast_one, b_cxst4p_one, cosphi_cxst4p_c_one; - k_cxst_one = force->numeric(FLERR,arg[2]); - cut_cxst_0_one = force->numeric(FLERR,arg[3]); - cut_cxst_c_one = force->numeric(FLERR,arg[4]); - cut_cxst_lo_one = force->numeric(FLERR,arg[5]); - cut_cxst_hi_one = force->numeric(FLERR,arg[6]); + k_cxst_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_cxst_0_one = utils::numeric(FLERR,arg[3],false,lmp); + cut_cxst_c_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_cxst_lo_one = utils::numeric(FLERR,arg[5],false,lmp); + cut_cxst_hi_one = utils::numeric(FLERR,arg[6],false,lmp); - a_cxst1_one = force->numeric(FLERR,arg[7]); - theta_cxst1_0_one = force->numeric(FLERR,arg[8]); - dtheta_cxst1_ast_one = force->numeric(FLERR,arg[9]); + a_cxst1_one = utils::numeric(FLERR,arg[7],false,lmp); + theta_cxst1_0_one = utils::numeric(FLERR,arg[8],false,lmp); + dtheta_cxst1_ast_one = utils::numeric(FLERR,arg[9],false,lmp); - a_cxst4_one = force->numeric(FLERR,arg[10]); - theta_cxst4_0_one = force->numeric(FLERR,arg[11]); - dtheta_cxst4_ast_one = force->numeric(FLERR,arg[12]); + a_cxst4_one = utils::numeric(FLERR,arg[10],false,lmp); + theta_cxst4_0_one = utils::numeric(FLERR,arg[11],false,lmp); + dtheta_cxst4_ast_one = utils::numeric(FLERR,arg[12],false,lmp); - a_cxst5_one = force->numeric(FLERR,arg[13]); - theta_cxst5_0_one = force->numeric(FLERR,arg[14]); - dtheta_cxst5_ast_one = force->numeric(FLERR,arg[15]); + a_cxst5_one = utils::numeric(FLERR,arg[13],false,lmp); + theta_cxst5_0_one = utils::numeric(FLERR,arg[14],false,lmp); + dtheta_cxst5_ast_one = utils::numeric(FLERR,arg[15],false,lmp); - a_cxst6_one = force->numeric(FLERR,arg[16]); - theta_cxst6_0_one = force->numeric(FLERR,arg[17]); - dtheta_cxst6_ast_one = force->numeric(FLERR,arg[18]); + a_cxst6_one = utils::numeric(FLERR,arg[16],false,lmp); + theta_cxst6_0_one = utils::numeric(FLERR,arg[17],false,lmp); + dtheta_cxst6_ast_one = utils::numeric(FLERR,arg[18],false,lmp); - a_cxst3p_one = force->numeric(FLERR,arg[19]); - cosphi_cxst3p_ast_one = force->numeric(FLERR,arg[20]); - a_cxst4p_one = force->numeric(FLERR,arg[21]); - cosphi_cxst4p_ast_one = force->numeric(FLERR,arg[22]); + a_cxst3p_one = utils::numeric(FLERR,arg[19],false,lmp); + cosphi_cxst3p_ast_one = utils::numeric(FLERR,arg[20],false,lmp); + a_cxst4p_one = utils::numeric(FLERR,arg[21],false,lmp); + cosphi_cxst4p_ast_one = utils::numeric(FLERR,arg[22],false,lmp); b_cxst_lo_one = 0.25 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one)/ (0.5 * (cut_cxst_lo_one - cut_cxst_0_one) * (cut_cxst_lo_one - cut_cxst_0_one) - diff --git a/src/USER-CGDNA/pair_oxdna_excv.cpp b/src/USER-CGDNA/pair_oxdna_excv.cpp index e8e2fad020..ad96186b6b 100644 --- a/src/USER-CGDNA/pair_oxdna_excv.cpp +++ b/src/USER-CGDNA/pair_oxdna_excv.cpp @@ -15,20 +15,19 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna_excv.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neigh_list.h" + #include #include -#include "mf_oxdna.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; using namespace MFOxdna; @@ -455,8 +454,8 @@ void PairOxdnaExcv::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); count = 0; @@ -471,9 +470,9 @@ void PairOxdnaExcv::coeff(int narg, char **arg) // Excluded volume interaction // LJ parameters - epsilon_ss_one = force->numeric(FLERR,arg[2]); - sigma_ss_one = force->numeric(FLERR,arg[3]); - cut_ss_ast_one = force->numeric(FLERR,arg[4]); + epsilon_ss_one = utils::numeric(FLERR,arg[2],false,lmp); + sigma_ss_one = utils::numeric(FLERR,arg[3],false,lmp); + cut_ss_ast_one = utils::numeric(FLERR,arg[4],false,lmp); // smoothing - determined through continuity and differentiability b_ss_one = 4.0/sigma_ss_one @@ -502,9 +501,9 @@ void PairOxdnaExcv::coeff(int narg, char **arg) count = 0; // LJ parameters - epsilon_sb_one = force->numeric(FLERR,arg[5]); - sigma_sb_one = force->numeric(FLERR,arg[6]); - cut_sb_ast_one = force->numeric(FLERR,arg[7]); + epsilon_sb_one = utils::numeric(FLERR,arg[5],false,lmp); + sigma_sb_one = utils::numeric(FLERR,arg[6],false,lmp); + cut_sb_ast_one = utils::numeric(FLERR,arg[7],false,lmp); // smoothing - determined through continuity and differentiability b_sb_one = 4.0/sigma_sb_one @@ -533,9 +532,9 @@ void PairOxdnaExcv::coeff(int narg, char **arg) count = 0; // LJ parameters - epsilon_bb_one = force->numeric(FLERR,arg[8]); - sigma_bb_one = force->numeric(FLERR,arg[9]); - cut_bb_ast_one = force->numeric(FLERR,arg[10]); + epsilon_bb_one = utils::numeric(FLERR,arg[8],false,lmp); + sigma_bb_one = utils::numeric(FLERR,arg[9],false,lmp); + cut_bb_ast_one = utils::numeric(FLERR,arg[10],false,lmp); // smoothing - determined through continuity and differentiability b_bb_one = 4.0/sigma_bb_one diff --git a/src/USER-CGDNA/pair_oxdna_hbond.cpp b/src/USER-CGDNA/pair_oxdna_hbond.cpp index 26042339ea..7987210d7a 100644 --- a/src/USER-CGDNA/pair_oxdna_hbond.cpp +++ b/src/USER-CGDNA/pair_oxdna_hbond.cpp @@ -15,20 +15,19 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna_hbond.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neigh_list.h" + #include #include -#include "mf_oxdna.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; using namespace MFOxdna; @@ -634,8 +633,8 @@ void PairOxdnaHbond::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,imod4,jmod4; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // h-bonding interaction count = 0; @@ -667,36 +666,36 @@ void PairOxdnaHbond::coeff(int narg, char **arg) if (strcmp(arg[2],"seqav") == 0) seqdepflag = 0; if (strcmp(arg[2],"seqdep") == 0) seqdepflag = 1; - epsilon_hb_one = force->numeric(FLERR,arg[3]); - a_hb_one = force->numeric(FLERR,arg[4]); - cut_hb_0_one = force->numeric(FLERR,arg[5]); - cut_hb_c_one = force->numeric(FLERR,arg[6]); - cut_hb_lo_one = force->numeric(FLERR,arg[7]); - cut_hb_hi_one = force->numeric(FLERR,arg[8]); + epsilon_hb_one = utils::numeric(FLERR,arg[3],false,lmp); + a_hb_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_hb_0_one = utils::numeric(FLERR,arg[5],false,lmp); + cut_hb_c_one = utils::numeric(FLERR,arg[6],false,lmp); + cut_hb_lo_one = utils::numeric(FLERR,arg[7],false,lmp); + cut_hb_hi_one = utils::numeric(FLERR,arg[8],false,lmp); - a_hb1_one = force->numeric(FLERR,arg[9]); - theta_hb1_0_one = force->numeric(FLERR,arg[10]); - dtheta_hb1_ast_one = force->numeric(FLERR,arg[11]); + a_hb1_one = utils::numeric(FLERR,arg[9],false,lmp); + theta_hb1_0_one = utils::numeric(FLERR,arg[10],false,lmp); + dtheta_hb1_ast_one = utils::numeric(FLERR,arg[11],false,lmp); - a_hb2_one = force->numeric(FLERR,arg[12]); - theta_hb2_0_one = force->numeric(FLERR,arg[13]); - dtheta_hb2_ast_one = force->numeric(FLERR,arg[14]); + a_hb2_one = utils::numeric(FLERR,arg[12],false,lmp); + theta_hb2_0_one = utils::numeric(FLERR,arg[13],false,lmp); + dtheta_hb2_ast_one = utils::numeric(FLERR,arg[14],false,lmp); - a_hb3_one = force->numeric(FLERR,arg[15]); - theta_hb3_0_one = force->numeric(FLERR,arg[16]); - dtheta_hb3_ast_one = force->numeric(FLERR,arg[17]); + a_hb3_one = utils::numeric(FLERR,arg[15],false,lmp); + theta_hb3_0_one = utils::numeric(FLERR,arg[16],false,lmp); + dtheta_hb3_ast_one = utils::numeric(FLERR,arg[17],false,lmp); - a_hb4_one = force->numeric(FLERR,arg[18]); - theta_hb4_0_one = force->numeric(FLERR,arg[19]); - dtheta_hb4_ast_one = force->numeric(FLERR,arg[20]); + a_hb4_one = utils::numeric(FLERR,arg[18],false,lmp); + theta_hb4_0_one = utils::numeric(FLERR,arg[19],false,lmp); + dtheta_hb4_ast_one = utils::numeric(FLERR,arg[20],false,lmp); - a_hb7_one = force->numeric(FLERR,arg[21]); - theta_hb7_0_one = force->numeric(FLERR,arg[22]); - dtheta_hb7_ast_one = force->numeric(FLERR,arg[23]); + a_hb7_one = utils::numeric(FLERR,arg[21],false,lmp); + theta_hb7_0_one = utils::numeric(FLERR,arg[22],false,lmp); + dtheta_hb7_ast_one = utils::numeric(FLERR,arg[23],false,lmp); - a_hb8_one = force->numeric(FLERR,arg[24]); - theta_hb8_0_one = force->numeric(FLERR,arg[25]); - dtheta_hb8_ast_one = force->numeric(FLERR,arg[26]); + a_hb8_one = utils::numeric(FLERR,arg[24],false,lmp); + theta_hb8_0_one = utils::numeric(FLERR,arg[25],false,lmp); + dtheta_hb8_ast_one = utils::numeric(FLERR,arg[26],false,lmp); b_hb_lo_one = 2*a_hb_one*exp(-a_hb_one*(cut_hb_lo_one-cut_hb_0_one))* 2*a_hb_one*exp(-a_hb_one*(cut_hb_lo_one-cut_hb_0_one))* diff --git a/src/USER-CGDNA/pair_oxdna_stk.cpp b/src/USER-CGDNA/pair_oxdna_stk.cpp index 4d1c4a7101..bf52d61182 100644 --- a/src/USER-CGDNA/pair_oxdna_stk.cpp +++ b/src/USER-CGDNA/pair_oxdna_stk.cpp @@ -15,7 +15,7 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna_stk.h" -#include + #include #include #include @@ -26,7 +26,7 @@ #include "neighbor.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "atom_vec_ellipsoid.h" #include "math_extra.h" @@ -779,8 +779,8 @@ void PairOxdnaStk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi,imod4,jmod4; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // stacking interaction count = 0; @@ -807,30 +807,30 @@ void PairOxdnaStk::coeff(int narg, char **arg) if (strcmp(arg[2],"seqav") == 0) seqdepflag = 0; if (strcmp(arg[2],"seqdep") == 0) seqdepflag = 1; - T = force->numeric(FLERR,arg[3]); - xi_st_one = force->numeric(FLERR,arg[4]); - kappa_st_one = force->numeric(FLERR,arg[5]); + T = utils::numeric(FLERR,arg[3],false,lmp); + xi_st_one = utils::numeric(FLERR,arg[4],false,lmp); + kappa_st_one = utils::numeric(FLERR,arg[5],false,lmp); epsilon_st_one = stacking_strength(xi_st_one, kappa_st_one, T); - a_st_one = force->numeric(FLERR,arg[6]); - cut_st_0_one = force->numeric(FLERR,arg[7]); - cut_st_c_one = force->numeric(FLERR,arg[8]); - cut_st_lo_one = force->numeric(FLERR,arg[9]); - cut_st_hi_one = force->numeric(FLERR,arg[10]); + a_st_one = utils::numeric(FLERR,arg[6],false,lmp); + cut_st_0_one = utils::numeric(FLERR,arg[7],false,lmp); + cut_st_c_one = utils::numeric(FLERR,arg[8],false,lmp); + cut_st_lo_one = utils::numeric(FLERR,arg[9],false,lmp); + cut_st_hi_one = utils::numeric(FLERR,arg[10],false,lmp); - a_st4_one = force->numeric(FLERR,arg[11]); - theta_st4_0_one = force->numeric(FLERR,arg[12]); - dtheta_st4_ast_one = force->numeric(FLERR,arg[13]); - a_st5_one = force->numeric(FLERR,arg[14]); - theta_st5_0_one = force->numeric(FLERR,arg[15]); - dtheta_st5_ast_one = force->numeric(FLERR,arg[16]); - a_st6_one = force->numeric(FLERR,arg[17]); - theta_st6_0_one = force->numeric(FLERR,arg[18]); - dtheta_st6_ast_one = force->numeric(FLERR,arg[19]); - a_st1_one = force->numeric(FLERR,arg[20]); - cosphi_st1_ast_one = force->numeric(FLERR,arg[21]); - a_st2_one = force->numeric(FLERR,arg[22]); - cosphi_st2_ast_one = force->numeric(FLERR,arg[23]); + a_st4_one = utils::numeric(FLERR,arg[11],false,lmp); + theta_st4_0_one = utils::numeric(FLERR,arg[12],false,lmp); + dtheta_st4_ast_one = utils::numeric(FLERR,arg[13],false,lmp); + a_st5_one = utils::numeric(FLERR,arg[14],false,lmp); + theta_st5_0_one = utils::numeric(FLERR,arg[15],false,lmp); + dtheta_st5_ast_one = utils::numeric(FLERR,arg[16],false,lmp); + a_st6_one = utils::numeric(FLERR,arg[17],false,lmp); + theta_st6_0_one = utils::numeric(FLERR,arg[18],false,lmp); + dtheta_st6_ast_one = utils::numeric(FLERR,arg[19],false,lmp); + a_st1_one = utils::numeric(FLERR,arg[20],false,lmp); + cosphi_st1_ast_one = utils::numeric(FLERR,arg[21],false,lmp); + a_st2_one = utils::numeric(FLERR,arg[22],false,lmp); + cosphi_st2_ast_one = utils::numeric(FLERR,arg[23],false,lmp); b_st_lo_one = 2*a_st_one*exp(-a_st_one*(cut_st_lo_one-cut_st_0_one))* 2*a_st_one*exp(-a_st_one*(cut_st_lo_one-cut_st_0_one))* diff --git a/src/USER-CGDNA/pair_oxdna_xstk.cpp b/src/USER-CGDNA/pair_oxdna_xstk.cpp index a1fc86bd4d..1751499683 100644 --- a/src/USER-CGDNA/pair_oxdna_xstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_xstk.cpp @@ -15,21 +15,20 @@ ------------------------------------------------------------------------- */ #include "pair_oxdna_xstk.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neigh_list.h" + #include #include -#include "mf_oxdna.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -630,8 +629,8 @@ void PairOxdnaXstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; @@ -657,35 +656,35 @@ void PairOxdnaXstk::coeff(int narg, char **arg) double a_xst8_one, theta_xst8_0_one, dtheta_xst8_ast_one; double b_xst8_one, dtheta_xst8_c_one; - k_xst_one = force->numeric(FLERR,arg[2]); - cut_xst_0_one = force->numeric(FLERR,arg[3]); - cut_xst_c_one = force->numeric(FLERR,arg[4]); - cut_xst_lo_one = force->numeric(FLERR,arg[5]); - cut_xst_hi_one = force->numeric(FLERR,arg[6]); + k_xst_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_xst_0_one = utils::numeric(FLERR,arg[3],false,lmp); + cut_xst_c_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_xst_lo_one = utils::numeric(FLERR,arg[5],false,lmp); + cut_xst_hi_one = utils::numeric(FLERR,arg[6],false,lmp); - a_xst1_one = force->numeric(FLERR,arg[7]); - theta_xst1_0_one = force->numeric(FLERR,arg[8]); - dtheta_xst1_ast_one = force->numeric(FLERR,arg[9]); + a_xst1_one = utils::numeric(FLERR,arg[7],false,lmp); + theta_xst1_0_one = utils::numeric(FLERR,arg[8],false,lmp); + dtheta_xst1_ast_one = utils::numeric(FLERR,arg[9],false,lmp); - a_xst2_one = force->numeric(FLERR,arg[10]); - theta_xst2_0_one = force->numeric(FLERR,arg[11]); - dtheta_xst2_ast_one = force->numeric(FLERR,arg[12]); + a_xst2_one = utils::numeric(FLERR,arg[10],false,lmp); + theta_xst2_0_one = utils::numeric(FLERR,arg[11],false,lmp); + dtheta_xst2_ast_one = utils::numeric(FLERR,arg[12],false,lmp); - a_xst3_one = force->numeric(FLERR,arg[13]); - theta_xst3_0_one = force->numeric(FLERR,arg[14]); - dtheta_xst3_ast_one = force->numeric(FLERR,arg[15]); + a_xst3_one = utils::numeric(FLERR,arg[13],false,lmp); + theta_xst3_0_one = utils::numeric(FLERR,arg[14],false,lmp); + dtheta_xst3_ast_one = utils::numeric(FLERR,arg[15],false,lmp); - a_xst4_one = force->numeric(FLERR,arg[16]); - theta_xst4_0_one = force->numeric(FLERR,arg[17]); - dtheta_xst4_ast_one = force->numeric(FLERR,arg[18]); + a_xst4_one = utils::numeric(FLERR,arg[16],false,lmp); + theta_xst4_0_one = utils::numeric(FLERR,arg[17],false,lmp); + dtheta_xst4_ast_one = utils::numeric(FLERR,arg[18],false,lmp); - a_xst7_one = force->numeric(FLERR,arg[19]); - theta_xst7_0_one = force->numeric(FLERR,arg[20]); - dtheta_xst7_ast_one = force->numeric(FLERR,arg[21]); + a_xst7_one = utils::numeric(FLERR,arg[19],false,lmp); + theta_xst7_0_one = utils::numeric(FLERR,arg[20],false,lmp); + dtheta_xst7_ast_one = utils::numeric(FLERR,arg[21],false,lmp); - a_xst8_one = force->numeric(FLERR,arg[22]); - theta_xst8_0_one = force->numeric(FLERR,arg[23]); - dtheta_xst8_ast_one = force->numeric(FLERR,arg[24]); + a_xst8_one = utils::numeric(FLERR,arg[22],false,lmp); + theta_xst8_0_one = utils::numeric(FLERR,arg[23],false,lmp); + dtheta_xst8_ast_one = utils::numeric(FLERR,arg[24],false,lmp); b_xst_lo_one = 0.25 * (cut_xst_lo_one - cut_xst_0_one) * (cut_xst_lo_one - cut_xst_0_one)/ diff --git a/src/USER-CGDNA/pair_oxrna2_excv.cpp b/src/USER-CGDNA/pair_oxrna2_excv.cpp index 3c0194d636..af9fdaaaa1 100644 --- a/src/USER-CGDNA/pair_oxrna2_excv.cpp +++ b/src/USER-CGDNA/pair_oxrna2_excv.cpp @@ -14,12 +14,10 @@ Contributing author: Oliver Henrich (University of Strathclyde, Glasgow) ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "pair_oxrna2_excv.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGDNA/pair_oxrna2_stk.cpp b/src/USER-CGDNA/pair_oxrna2_stk.cpp index de2cd63799..fd02946134 100644 --- a/src/USER-CGDNA/pair_oxrna2_stk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_stk.cpp @@ -14,26 +14,22 @@ Contributing author: Oliver Henrich (University of Strathclyde, Glasgow) ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "pair_oxrna2_stk.h" -#include "mf_oxdna.h" + #include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "integrate.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" -#include "utils.h" #include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" #include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neighbor.h" + +#include +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -863,8 +859,8 @@ void PairOxrna2Stk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // stacking interaction count = 0; @@ -894,35 +890,35 @@ void PairOxrna2Stk::coeff(int narg, char **arg) if (strcmp(arg[2],"seqav") == 0) seqdepflag = 0; if (strcmp(arg[2],"seqdep") == 0) seqdepflag = 1; - T = force->numeric(FLERR,arg[3]); - xi_st_one = force->numeric(FLERR,arg[4]); - kappa_st_one = force->numeric(FLERR,arg[5]); + T = utils::numeric(FLERR,arg[3],false,lmp); + xi_st_one = utils::numeric(FLERR,arg[4],false,lmp); + kappa_st_one = utils::numeric(FLERR,arg[5],false,lmp); epsilon_st_one = stacking_strength(xi_st_one, kappa_st_one, T); - a_st_one = force->numeric(FLERR,arg[6]); - cut_st_0_one = force->numeric(FLERR,arg[7]); - cut_st_c_one = force->numeric(FLERR,arg[8]); - cut_st_lo_one = force->numeric(FLERR,arg[9]); - cut_st_hi_one = force->numeric(FLERR,arg[10]); + a_st_one = utils::numeric(FLERR,arg[6],false,lmp); + cut_st_0_one = utils::numeric(FLERR,arg[7],false,lmp); + cut_st_c_one = utils::numeric(FLERR,arg[8],false,lmp); + cut_st_lo_one = utils::numeric(FLERR,arg[9],false,lmp); + cut_st_hi_one = utils::numeric(FLERR,arg[10],false,lmp); - a_st5_one = force->numeric(FLERR,arg[11]); - theta_st5_0_one = force->numeric(FLERR,arg[12]); - dtheta_st5_ast_one = force->numeric(FLERR,arg[13]); - a_st6_one = force->numeric(FLERR,arg[14]); - theta_st6_0_one = force->numeric(FLERR,arg[15]); - dtheta_st6_ast_one = force->numeric(FLERR,arg[16]); + a_st5_one = utils::numeric(FLERR,arg[11],false,lmp); + theta_st5_0_one = utils::numeric(FLERR,arg[12],false,lmp); + dtheta_st5_ast_one = utils::numeric(FLERR,arg[13],false,lmp); + a_st6_one = utils::numeric(FLERR,arg[14],false,lmp); + theta_st6_0_one = utils::numeric(FLERR,arg[15],false,lmp); + dtheta_st6_ast_one = utils::numeric(FLERR,arg[16],false,lmp); - a_st9_one = force->numeric(FLERR,arg[17]); - theta_st9_0_one = force->numeric(FLERR,arg[18]); - dtheta_st9_ast_one = force->numeric(FLERR,arg[19]); - a_st10_one = force->numeric(FLERR,arg[20]); - theta_st10_0_one = force->numeric(FLERR,arg[21]); - dtheta_st10_ast_one = force->numeric(FLERR,arg[22]); + a_st9_one = utils::numeric(FLERR,arg[17],false,lmp); + theta_st9_0_one = utils::numeric(FLERR,arg[18],false,lmp); + dtheta_st9_ast_one = utils::numeric(FLERR,arg[19],false,lmp); + a_st10_one = utils::numeric(FLERR,arg[20],false,lmp); + theta_st10_0_one = utils::numeric(FLERR,arg[21],false,lmp); + dtheta_st10_ast_one = utils::numeric(FLERR,arg[22],false,lmp); - a_st1_one = force->numeric(FLERR,arg[23]); - cosphi_st1_ast_one = force->numeric(FLERR,arg[24]); - a_st2_one = force->numeric(FLERR,arg[25]); - cosphi_st2_ast_one = force->numeric(FLERR,arg[26]); + a_st1_one = utils::numeric(FLERR,arg[23],false,lmp); + cosphi_st1_ast_one = utils::numeric(FLERR,arg[24],false,lmp); + a_st2_one = utils::numeric(FLERR,arg[25],false,lmp); + cosphi_st2_ast_one = utils::numeric(FLERR,arg[26],false,lmp); b_st_lo_one = 2*a_st_one*exp(-a_st_one*(cut_st_lo_one-cut_st_0_one))* 2*a_st_one*exp(-a_st_one*(cut_st_lo_one-cut_st_0_one))* diff --git a/src/USER-CGDNA/pair_oxrna2_xstk.cpp b/src/USER-CGDNA/pair_oxrna2_xstk.cpp index 73a73c1ea0..673ef1c9a3 100644 --- a/src/USER-CGDNA/pair_oxrna2_xstk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_xstk.cpp @@ -15,21 +15,20 @@ ------------------------------------------------------------------------- */ #include "pair_oxrna2_xstk.h" -#include + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" +#include "mf_oxdna.h" +#include "neigh_list.h" + #include #include -#include "mf_oxdna.h" -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "math_const.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "atom_vec_ellipsoid.h" -#include "math_extra.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -580,8 +579,8 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // cross-stacking interaction count = 0; @@ -604,31 +603,31 @@ void PairOxrna2Xstk::coeff(int narg, char **arg) double a_xst8_one, theta_xst8_0_one, dtheta_xst8_ast_one; double b_xst8_one, dtheta_xst8_c_one; - k_xst_one = force->numeric(FLERR,arg[2]); - cut_xst_0_one = force->numeric(FLERR,arg[3]); - cut_xst_c_one = force->numeric(FLERR,arg[4]); - cut_xst_lo_one = force->numeric(FLERR,arg[5]); - cut_xst_hi_one = force->numeric(FLERR,arg[6]); + k_xst_one = utils::numeric(FLERR,arg[2],false,lmp); + cut_xst_0_one = utils::numeric(FLERR,arg[3],false,lmp); + cut_xst_c_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_xst_lo_one = utils::numeric(FLERR,arg[5],false,lmp); + cut_xst_hi_one = utils::numeric(FLERR,arg[6],false,lmp); - a_xst1_one = force->numeric(FLERR,arg[7]); - theta_xst1_0_one = force->numeric(FLERR,arg[8]); - dtheta_xst1_ast_one = force->numeric(FLERR,arg[9]); + a_xst1_one = utils::numeric(FLERR,arg[7],false,lmp); + theta_xst1_0_one = utils::numeric(FLERR,arg[8],false,lmp); + dtheta_xst1_ast_one = utils::numeric(FLERR,arg[9],false,lmp); - a_xst2_one = force->numeric(FLERR,arg[10]); - theta_xst2_0_one = force->numeric(FLERR,arg[11]); - dtheta_xst2_ast_one = force->numeric(FLERR,arg[12]); + a_xst2_one = utils::numeric(FLERR,arg[10],false,lmp); + theta_xst2_0_one = utils::numeric(FLERR,arg[11],false,lmp); + dtheta_xst2_ast_one = utils::numeric(FLERR,arg[12],false,lmp); - a_xst3_one = force->numeric(FLERR,arg[13]); - theta_xst3_0_one = force->numeric(FLERR,arg[14]); - dtheta_xst3_ast_one = force->numeric(FLERR,arg[15]); + a_xst3_one = utils::numeric(FLERR,arg[13],false,lmp); + theta_xst3_0_one = utils::numeric(FLERR,arg[14],false,lmp); + dtheta_xst3_ast_one = utils::numeric(FLERR,arg[15],false,lmp); - a_xst7_one = force->numeric(FLERR,arg[16]); - theta_xst7_0_one = force->numeric(FLERR,arg[17]); - dtheta_xst7_ast_one = force->numeric(FLERR,arg[18]); + a_xst7_one = utils::numeric(FLERR,arg[16],false,lmp); + theta_xst7_0_one = utils::numeric(FLERR,arg[17],false,lmp); + dtheta_xst7_ast_one = utils::numeric(FLERR,arg[18],false,lmp); - a_xst8_one = force->numeric(FLERR,arg[19]); - theta_xst8_0_one = force->numeric(FLERR,arg[20]); - dtheta_xst8_ast_one = force->numeric(FLERR,arg[21]); + a_xst8_one = utils::numeric(FLERR,arg[19],false,lmp); + theta_xst8_0_one = utils::numeric(FLERR,arg[20],false,lmp); + dtheta_xst8_ast_one = utils::numeric(FLERR,arg[21],false,lmp); b_xst_lo_one = 0.25 * (cut_xst_lo_one - cut_xst_0_one) * (cut_xst_lo_one - cut_xst_0_one)/ diff --git a/src/USER-CGSDK/angle_sdk.cpp b/src/USER-CGSDK/angle_sdk.cpp index 11b3a8308c..6f97d2104f 100644 --- a/src/USER-CGSDK/angle_sdk.cpp +++ b/src/USER-CGSDK/angle_sdk.cpp @@ -19,7 +19,7 @@ ------------------------------------------------------------------------- */ #include "angle_sdk.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -30,7 +30,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "lj_sdk_common.h" @@ -241,10 +241,10 @@ void AngleSDK::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double theta0_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_one = utils::numeric(FLERR,arg[2],false,lmp); double repscale_one=1.0; // backward compatibility with old cg/cmm style input: @@ -253,9 +253,9 @@ void AngleSDK::coeff(int narg, char **arg) // otherwise assume repscale 1.0, since we were using // epsilon to turn repulsion on or off. if (narg == 6) { - repscale_one = force->numeric(FLERR,arg[4]); + repscale_one = utils::numeric(FLERR,arg[4],false,lmp); if (repscale_one > 0.0) repscale_one = 1.0; - } else if (narg == 4) repscale_one = force->numeric(FLERR,arg[3]); + } else if (narg == 4) repscale_one = utils::numeric(FLERR,arg[3],false,lmp); else if (narg == 3) repscale_one = 1.0; else error->all(FLERR,"Incorrect args for angle coefficients"); diff --git a/src/USER-CGSDK/pair_lj_sdk.cpp b/src/USER-CGSDK/pair_lj_sdk.cpp index 3e4f8deee8..8185e24876 100644 --- a/src/USER-CGSDK/pair_lj_sdk.cpp +++ b/src/USER-CGSDK/pair_lj_sdk.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_sdk.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #define LMP_NEED_SDK_FIND_LJ_TYPE 1 #include "lj_sdk_common.h" @@ -234,7 +234,7 @@ void PairLJSDK::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -256,18 +256,18 @@ void PairLJSDK::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int lj_type_one = find_lj_type(arg[2],lj_type_list); if (lj_type_one == LJ_NOT_SET) error->all(FLERR,"Cannot parse LJ type flag."); - double epsilon_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-CGSDK/pair_lj_sdk.h b/src/USER-CGSDK/pair_lj_sdk.h index ef0263c06b..11c123a72c 100644 --- a/src/USER-CGSDK/pair_lj_sdk.h +++ b/src/USER-CGSDK/pair_lj_sdk.h @@ -27,7 +27,6 @@ PairStyle(lj/sdk,PairLJSDK) #include "pair.h" namespace LAMMPS_NS { -class LAMMPS; class PairLJSDK : public Pair { public: diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp index 7e5852f367..42f1ff3ce7 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_sdk_coul_long.h" -#include + #include #include #include "atom.h" @@ -28,7 +28,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #define LMP_NEED_SDK_FIND_LJ_TYPE 1 #include "lj_sdk_common.h" @@ -293,9 +293,9 @@ void PairLJSDKCoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -318,18 +318,18 @@ void PairLJSDKCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int lj_type_one = find_lj_type(arg[2],lj_type_list); if (lj_type_one == LJ_NOT_SET) error->all(FLERR,"Cannot parse LJ type flag."); - double epsilon_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index 7ce2a93680..fcbfb58456 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -25,29 +25,26 @@ ------------------------------------------------------------------------- */ #include "fix_colvars.h" -#include -#include -#include -#include -#include -#include -#include #include "atom.h" +#include "citeme.h" #include "comm.h" #include "domain.h" #include "error.h" -#include "force.h" #include "memory.h" #include "modify.h" #include "respa.h" #include "universe.h" #include "update.h" -#include "citeme.h" #include "colvarproxy_lammps.h" #include "colvarmodule.h" +#include +#include +#include +#include + static const char colvars_pub[] = "fix colvars command:\n\n" "@Article{fiorin13,\n" @@ -324,7 +321,7 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : } else if (0 == strcmp(arg[argsdone], "output")) { out_name = strdup(arg[argsdone+1]); } else if (0 == strcmp(arg[argsdone], "seed")) { - rng_seed = force->inumeric(FLERR,arg[argsdone+1]); + rng_seed = utils::inumeric(FLERR,arg[argsdone+1],false,lmp); } else if (0 == strcmp(arg[argsdone], "unwrap")) { if (0 == strcmp(arg[argsdone+1], "yes")) { unwrap_flag = 1; diff --git a/src/USER-COLVARS/fix_colvars.h b/src/USER-COLVARS/fix_colvars.h index 2486446f35..fff61ce218 100644 --- a/src/USER-COLVARS/fix_colvars.h +++ b/src/USER-COLVARS/fix_colvars.h @@ -34,7 +34,6 @@ FixStyle(colvars,FixColvars) #define LMP_FIX_COLVARS_H #include "fix.h" -#include class colvarproxy_lammps; diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 1e37e2de9c..07a8ac2d5c 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -17,12 +17,11 @@ ------------------------------------------------------------------------- */ #include "group_ndx.h" -#include -#include + #include "atom.h" #include "comm.h" -#include "group.h" #include "error.h" +#include "group.h" using namespace LAMMPS_NS; diff --git a/src/USER-COLVARS/ndx_group.cpp b/src/USER-COLVARS/ndx_group.cpp index feab2f22b2..bab1592b1e 100644 --- a/src/USER-COLVARS/ndx_group.cpp +++ b/src/USER-COLVARS/ndx_group.cpp @@ -17,13 +17,13 @@ ------------------------------------------------------------------------- */ #include "ndx_group.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "group.h" #include "error.h" +#include "group.h" + +#include using namespace LAMMPS_NS; #define BUFLEN 4096 diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index 5dd47b28bd..d16fbf2876 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -15,23 +15,23 @@ Contributing authors: Shawn Coleman & Douglas Spearot (Arkansas) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "compute_saed.h" -#include -#include -#include -#include -#include "math_const.h" -#include "compute_saed_consts.h" -#include "atom.h" -#include "comm.h" -#include "update.h" -#include "domain.h" -#include "group.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "compute_saed_consts.h" +#include "domain.h" +#include "error.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "update.h" + +#include +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index e75546b548..b48de49c81 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -16,23 +16,23 @@ Updated: 06/17/2015-2 ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "compute_xrd.h" -#include -#include -#include -#include -#include "math_const.h" #include "compute_xrd_consts.h" -#include "atom.h" -#include "comm.h" -#include "update.h" -#include "domain.h" -#include "group.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "group.h" +#include "math_const.h" +#include "memory.h" +#include "update.h" + +#include +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index b6c00c2374..39382264c4 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -17,18 +17,17 @@ ------------------------------------------------------------------------- */ #include "fix_saed_vtk.h" -#include -#include -#include -#include "update.h" -#include "modify.h" + #include "compute.h" #include "compute_saed.h" -#include "memory.h" -#include "error.h" -#include "force.h" #include "domain.h" +#include "error.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -48,9 +47,9 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); - nrepeat = force->inumeric(FLERR,arg[4]); - nfreq = force->inumeric(FLERR,arg[5]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); global_freq = nfreq; @@ -568,14 +567,14 @@ void FixSAEDVTK::options(int narg, char **arg) else error->all(FLERR,"Illegal fix saed/vtk command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix saed/vtk command"); - nwindow = force->inumeric(FLERR,arg[iarg+2]); + nwindow = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nwindow <= 0) error->all(FLERR,"Illegal fix saed/vtk command"); } iarg += 2; if (ave == WINDOW) iarg++; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix saed/vtk command"); - startstep = force->inumeric(FLERR,arg[iarg+1]); + startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"overwrite") == 0) { overwrite = 1; diff --git a/src/USER-DPD/compute_dpd.cpp b/src/USER-DPD/compute_dpd.cpp index 0ef7868164..97e12d5cb4 100644 --- a/src/USER-DPD/compute_dpd.cpp +++ b/src/USER-DPD/compute_dpd.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_dpd.h" -#include + #include "atom.h" #include "update.h" #include "error.h" diff --git a/src/USER-DPD/fix_eos_cv.cpp b/src/USER-DPD/fix_eos_cv.cpp index 5b25519a40..db9b877b1c 100644 --- a/src/USER-DPD/fix_eos_cv.cpp +++ b/src/USER-DPD/fix_eos_cv.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "fix_eos_cv.h" + #include "atom.h" #include "error.h" -#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -29,7 +29,7 @@ FixEOScv::FixEOScv(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg != 4) error->all(FLERR,"Illegal fix eos/cv command"); - cvEOS = force->numeric(FLERR,arg[3]); + cvEOS = utils::numeric(FLERR,arg[3],false,lmp); if(cvEOS <= 0.0) error->all(FLERR,"EOS cv must be > 0.0"); nevery = 1; diff --git a/src/USER-DPD/fix_eos_table.cpp b/src/USER-DPD/fix_eos_table.cpp index dc6310ae42..57cfe03dc8 100644 --- a/src/USER-DPD/fix_eos_table.cpp +++ b/src/USER-DPD/fix_eos_table.cpp @@ -16,14 +16,12 @@ ------------------------------------------------------------------------- */ #include "fix_eos_table.h" -#include -#include -#include + #include "atom.h" #include "error.h" -#include "force.h" #include "memory.h" -#include "utils.h" + +#include #define MAXLINE 1024 @@ -41,7 +39,7 @@ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"linear") == 0) tabstyle = LINEAR; else error->all(FLERR,"Unknown table style in fix eos/table"); - tablength = force->inumeric(FLERR,arg[5]); + tablength = utils::inumeric(FLERR,arg[5],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of eos/table entries"); ntables = 0; @@ -199,7 +197,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file - FILE *fp = force->open_potential(file); + FILE *fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open file %s",file); diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index d9641f2aab..c220d84a57 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -16,8 +16,8 @@ ------------------------------------------------------------------------- */ #include "fix_eos_table_rx.h" -#include -#include + + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "memory.h" #include "comm.h" #include "modify.h" -#include "utils.h" + #define MAXLINE 1024 @@ -60,7 +60,7 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"linear") == 0) tabstyle = LINEAR; else error->all(FLERR,"Unknown table style in fix eos/table/rx"); - tablength = force->inumeric(FLERR,arg[5]); + tablength = utils::inumeric(FLERR,arg[5],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of eos/table/rx entries"); ntables = 0; diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index 77efd1842b..d974d12473 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -12,8 +12,8 @@ ------------------------------------------------------------------------- */ #include "fix_rx.h" -#include -#include + + #include #include #include // DBL_EPSILON @@ -31,7 +31,7 @@ #include "neigh_request.h" #include "math_special.h" #include "pair_dpd_fdt_energy.h" -#include "utils.h" + #include // std::vector<> #include // std::max @@ -266,7 +266,7 @@ void FixRX::post_constructor() FILE *fp; fp = NULL; if (comm->me == 0) { - fp = force->open_potential(kineticsFile); + fp = utils::open_potential(kineticsFile,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open rx file %s",kineticsFile); @@ -855,7 +855,7 @@ void FixRX::read_file(char *file) FILE *fp; fp = NULL; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open rx file %s",file); @@ -892,7 +892,7 @@ void FixRX::read_file(char *file) } // open file on proc 0 - if (comm->me == 0) fp = force->open_potential(file); + if (comm->me == 0) fp = utils::open_potential(file,lmp,nullptr); // read each reaction from kinetics file eof=0; diff --git a/src/USER-DPD/fix_shardlow.cpp b/src/USER-DPD/fix_shardlow.cpp index 18c86976ac..c4480a0373 100644 --- a/src/USER-DPD/fix_shardlow.cpp +++ b/src/USER-DPD/fix_shardlow.cpp @@ -34,27 +34,26 @@ ------------------------------------------------------------------------- */ #include "fix_shardlow.h" -#include -#include -#include -#include + #include "atom.h" -#include "force.h" -#include "update.h" -#include "error.h" +#include "citeme.h" #include "comm.h" -#include "neighbor.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "modify.h" #include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" #include "npair.h" -#include "memory.h" -#include "domain.h" -#include "modify.h" +#include "npair_half_bin_newton_ssa.h" #include "pair_dpd_fdt.h" #include "pair_dpd_fdt_energy.h" -#include "npair_half_bin_newton_ssa.h" -#include "citeme.h" -#include "utils.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 14bbe0b784..1d3d952e9f 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -16,21 +16,20 @@ ------------------------------------------------------------------------- */ #include "pair_dpd_fdt.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "update.h" +#include "error.h" #include "fix.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "random_mars.h" #include "memory.h" #include "modify.h" -#include "error.h" -#include "utils.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "random_mars.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -249,9 +248,9 @@ void PairDPDfdt::settings(int narg, char **arg) // process keywords if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - temperature = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); - seed = force->inumeric(FLERR,arg[2]); + temperature = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); + seed = utils::inumeric(FLERR,arg[2],false,lmp); // initialize Marsaglia RNG with processor-unique seed @@ -279,16 +278,16 @@ void PairDPDfdt::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a0_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double a0_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; a0_is_zero = (a0_one == 0.0); // Typical use with SSA is to set a0 to zero - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index 455af2f481..b843e4601a 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -16,21 +16,20 @@ ------------------------------------------------------------------------- */ #include "pair_dpd_fdt_energy.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "update.h" +#include "error.h" #include "fix.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "random_mars.h" #include "memory.h" #include "modify.h" -#include "error.h" -#include "utils.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "random_mars.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -336,8 +335,8 @@ void PairDPDfdtEnergy::settings(int narg, char **arg) // process keywords if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); - seed = force->inumeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + seed = utils::inumeric(FLERR,arg[1],false,lmp); if (atom->dpd_flag != 1) error->all(FLERR,"pair_style dpd/fdt/energy requires atom_style with internal temperature and energies (e.g. dpd)"); @@ -367,19 +366,19 @@ void PairDPDfdtEnergy::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a0_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double a0_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; double kappa_one, alpha_one; a0_is_zero = (a0_one == 0.0); // Typical use with SSA is to set a0 to zero - kappa_one = force->numeric(FLERR,arg[4]); + kappa_one = utils::numeric(FLERR,arg[4],false,lmp); alpha_one = sqrt(2.0*force->boltz*kappa_one); - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 4ac491afb1..666a1b0ea9 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "pair_exp6_rx.h" -#include + #include -#include + #include #include #include "atom.h" @@ -24,7 +24,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "modify.h" #include "fix.h" @@ -549,7 +549,7 @@ void PairExp6rx::settings(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // optional keywords @@ -589,8 +589,8 @@ void PairExp6rx::coeff(int narg, char **arg) int ilo,ihi,jlo,jhi; int n; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); nspecies = atom->nspecies_dpd; if(nspecies==0) error->all(FLERR,"There are no rx species specified."); @@ -666,10 +666,10 @@ void PairExp6rx::coeff(int narg, char **arg) double cut_one = cut_global; if (strcmp(arg[5],"exponent") == 0){ scalingFlag = EXPONENT; - exponentR = force->numeric(FLERR,arg[6]); - exponentEpsilon = force->numeric(FLERR,arg[7]); + exponentR = utils::numeric(FLERR,arg[6],false,lmp); + exponentEpsilon = utils::numeric(FLERR,arg[7],false,lmp); if (narg > 9) error->all(FLERR,"Incorrect args for pair coefficients"); - if (narg == 9) cut_one = force->numeric(FLERR,arg[8]); + if (narg == 9) cut_one = utils::numeric(FLERR,arg[8],false,lmp); } else if (strcmp(arg[5],"polynomial") == 0){ scalingFlag = POLYNOMIAL; memory->create(coeffAlpha,6,"pair:coeffAlpha"); @@ -677,11 +677,11 @@ void PairExp6rx::coeff(int narg, char **arg) memory->create(coeffRm,6,"pair:coeffRm"); read_file2(arg[6]); if (narg > 8) error->all(FLERR,"Incorrect args for pair coefficients"); - if (narg == 8) cut_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_one = utils::numeric(FLERR,arg[7],false,lmp); } else if (strcmp(arg[5],"none") == 0){ scalingFlag = NONE; if (narg > 7) error->all(FLERR,"Incorrect args for pair coefficients"); - if (narg == 7) cut_one = force->numeric(FLERR,arg[6]); + if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); } else { error->all(FLERR,"Incorrect args for pair coefficients"); } @@ -725,7 +725,7 @@ void PairExp6rx::read_file(char *file) FILE *fp; fp = NULL; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index 1cbb29a93c..ceb5c78eaf 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -21,10 +21,10 @@ The Journal of Chemical Physics, 2016, 144, 104501. ------------------------------------------------------------------------------------------- */ -#include + #include #include "math_const.h" -#include + #include #include "pair_multi_lucy.h" #include "atom.h" @@ -33,9 +33,9 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "citeme.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -240,7 +240,7 @@ void PairMultiLucy::settings(int narg, char **arg) else if (strcmp(arg[0],"linear") == 0) tabstyle = LINEAR; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // delete old tables, since cannot just change settings @@ -269,8 +269,8 @@ void PairMultiLucy::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); @@ -282,7 +282,7 @@ void PairMultiLucy::coeff(int narg, char **arg) bcast_table(tb); // set table cutoff - if (narg == 5) tb->cut = force->numeric(FLERR,arg[4]); + if (narg == 5) tb->cut = utils::numeric(FLERR,arg[4],false,lmp); else if (tb->rflag) tb->cut = tb->rhi; else tb->cut = tb->rfile[tb->ninput-1]; diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index 79df11a038..d769d94783 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -21,10 +21,10 @@ The Journal of Chemical Physics, 2016, 144, 104501. ------------------------------------------------------------------------------------------- */ -#include + #include #include "math_const.h" -#include + #include #include "pair_multi_lucy_rx.h" #include "atom.h" @@ -33,11 +33,11 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "citeme.h" #include "modify.h" #include "fix.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -329,7 +329,7 @@ void PairMultiLucyRX::settings(int narg, char **arg) else if (strcmp(arg[0],"linear") == 0) tabstyle = LINEAR; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // optional keywords @@ -374,8 +374,8 @@ void PairMultiLucyRX::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); @@ -398,7 +398,7 @@ void PairMultiLucyRX::coeff(int narg, char **arg) // set table cutoff - if (narg == 7) tb->cut = force->numeric(FLERR,arg[6]); + if (narg == 7) tb->cut = utils::numeric(FLERR,arg[6],false,lmp); else if (tb->rflag) tb->cut = tb->rhi; else tb->cut = tb->rfile[tb->ninput-1]; @@ -493,7 +493,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // open file - FILE *fp = force->open_potential(file); + FILE *fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open file %s",file); diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index cf64c17c5e..f791107f1d 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_table_rx.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "error.h" #include "modify.h" #include "fix.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -258,7 +258,7 @@ void PairTableRX::settings(int narg, char **arg) else if (strcmp(arg[0],"bitmap") == 0) tabstyle = BITMAP; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // optional keywords @@ -308,8 +308,8 @@ void PairTableRX::coeff(int narg, char **arg) if (!rx_flag) error->all(FLERR,"Pair style table/rx requires a fix rx command."); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); @@ -346,7 +346,7 @@ void PairTableRX::coeff(int narg, char **arg) // set table cutoff - if (narg == 7) tb->cut = force->numeric(FLERR,arg[6]); + if (narg == 7) tb->cut = utils::numeric(FLERR,arg[6],false,lmp); else if (tb->rflag) tb->cut = tb->rhi; else tb->cut = tb->rfile[tb->ninput-1]; diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index a12c248680..b806b4434b 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_drude.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/USER-DRUDE/fix_drude.cpp b/src/USER-DRUDE/fix_drude.cpp index 080408459c..313ac249d7 100644 --- a/src/USER-DRUDE/fix_drude.cpp +++ b/src/USER-DRUDE/fix_drude.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_drude.h" -#include + #include #include #include "atom.h" diff --git a/src/USER-DRUDE/fix_drude_transform.cpp b/src/USER-DRUDE/fix_drude_transform.cpp index 4128c508d6..bdccaaebc8 100644 --- a/src/USER-DRUDE/fix_drude_transform.cpp +++ b/src/USER-DRUDE/fix_drude_transform.cpp @@ -13,7 +13,7 @@ /** Fix Drude Transform ******************************************************/ #include "fix_drude_transform.h" -#include + #include #include #include "fix_drude.h" diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index d413c31bd7..da74510821 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_langevin_drude.h" -#include + #include #include #include "fix_drude.h" @@ -55,12 +55,12 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr_core,&arg[3][2]); tstyle_core = EQUAL; } else { - t_start_core = force->numeric(FLERR,arg[3]); + t_start_core = utils::numeric(FLERR,arg[3],false,lmp); t_target_core = t_start_core; tstyle_core = CONSTANT; } - t_period_core = force->numeric(FLERR,arg[4]); - int seed_core = force->inumeric(FLERR,arg[5]); + t_period_core = utils::numeric(FLERR,arg[4],false,lmp); + int seed_core = utils::inumeric(FLERR,arg[5],false,lmp); // drude temperature tstr_drude = NULL; @@ -70,12 +70,12 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr_drude,&arg[6][2]); tstyle_drude = EQUAL; } else { - t_start_drude = force->numeric(FLERR,arg[6]); + t_start_drude = utils::numeric(FLERR,arg[6],false,lmp); t_target_drude = t_start_drude; tstyle_drude = CONSTANT; } - t_period_drude = force->numeric(FLERR,arg[7]); - int seed_drude = force->inumeric(FLERR,arg[8]); + t_period_drude = utils::numeric(FLERR,arg[7],false,lmp); + int seed_drude = utils::inumeric(FLERR,arg[8],false,lmp); // error checks if (t_period_core <= 0.0) diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index fa4f761663..461f972885 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_thole_long.h" -#include + #include #include #include "fix_drude.h" @@ -29,7 +29,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "modify.h" #include "domain.h" @@ -291,10 +291,10 @@ void PairLJCutTholeLong::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - thole_global = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); + thole_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -320,17 +320,17 @@ void PairLJCutTholeLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double polar_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double polar_one = utils::numeric(FLERR,arg[4],false,lmp); double thole_one = thole_global; - if (narg >=6) thole_one = force->numeric(FLERR,arg[5]); + if (narg >=6) thole_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 7) cut_lj_one = force->numeric(FLERR,arg[6]); + if (narg == 7) cut_lj_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 4dd6cb12c0..281317c076 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_thole.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "fix.h" #include "fix_drude.h" #include "domain.h" @@ -192,8 +192,8 @@ void PairThole::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - thole_global = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + thole_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -219,14 +219,14 @@ void PairThole::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double polar_one = force->numeric(FLERR,arg[2]); + double polar_one = utils::numeric(FLERR,arg[2],false,lmp); double thole_one = thole_global; double cut_one = cut_global; - if (narg >=4) thole_one = force->numeric(FLERR,arg[3]); - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg >=4) thole_one = utils::numeric(FLERR,arg[3],false,lmp); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-EFF/atom_vec_electron.cpp b/src/USER-EFF/atom_vec_electron.cpp index 0912fb0498..65923d2e75 100644 --- a/src/USER-EFF/atom_vec_electron.cpp +++ b/src/USER-EFF/atom_vec_electron.cpp @@ -16,10 +16,11 @@ ------------------------------------------------------------------------- */ #include "atom_vec_electron.h" -#include + #include "atom.h" #include "citeme.h" -#include "error.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-EFF/compute_ke_atom_eff.cpp b/src/USER-EFF/compute_ke_atom_eff.cpp index c943366f1b..001e1d4c43 100644 --- a/src/USER-EFF/compute_ke_atom_eff.cpp +++ b/src/USER-EFF/compute_ke_atom_eff.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include "compute_ke_atom_eff.h" #include "atom.h" #include "update.h" diff --git a/src/USER-EFF/compute_ke_eff.cpp b/src/USER-EFF/compute_ke_eff.cpp index 3e277fc66c..d1781b75f7 100644 --- a/src/USER-EFF/compute_ke_eff.cpp +++ b/src/USER-EFF/compute_ke_eff.cpp @@ -15,8 +15,8 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include -#include + + #include "compute_ke_eff.h" #include "atom.h" #include "update.h" diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index dcf7e86234..90e25ca3c8 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include + #include -#include + #include "compute_temp_deform_eff.h" #include "domain.h" #include "atom.h" diff --git a/src/USER-EFF/compute_temp_eff.cpp b/src/USER-EFF/compute_temp_eff.cpp index e9295ea680..174f032b83 100644 --- a/src/USER-EFF/compute_temp_eff.cpp +++ b/src/USER-EFF/compute_temp_eff.cpp @@ -16,8 +16,8 @@ ------------------------------------------------------------------------- */ #include "compute_temp_eff.h" -#include -#include + + #include "atom.h" #include "update.h" #include "force.h" diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index b27699cde9..c95cf0de2d 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include + #include -#include + #include "compute_temp_region_eff.h" #include "atom.h" #include "update.h" diff --git a/src/USER-EFF/fix_langevin_eff.cpp b/src/USER-EFF/fix_langevin_eff.cpp index 5158d7c681..3966bc7b98 100644 --- a/src/USER-EFF/fix_langevin_eff.cpp +++ b/src/USER-EFF/fix_langevin_eff.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include + #include -#include + #include "fix_langevin_eff.h" #include "atom.h" #include "update.h" diff --git a/src/USER-EFF/fix_nh_eff.cpp b/src/USER-EFF/fix_nh_eff.cpp index 034233732e..d5b574510c 100644 --- a/src/USER-EFF/fix_nh_eff.cpp +++ b/src/USER-EFF/fix_nh_eff.cpp @@ -15,10 +15,10 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ -#include + #include "fix_nh_eff.h" + #include "atom.h" -#include "atom_vec.h" #include "error.h" #include "domain.h" diff --git a/src/USER-EFF/fix_nve_eff.cpp b/src/USER-EFF/fix_nve_eff.cpp index ea719c91c0..f32a45fd46 100644 --- a/src/USER-EFF/fix_nve_eff.cpp +++ b/src/USER-EFF/fix_nve_eff.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include "fix_nve_eff.h" #include "atom.h" #include "force.h" diff --git a/src/USER-EFF/fix_nvt_sllod_eff.cpp b/src/USER-EFF/fix_nvt_sllod_eff.cpp index 0ebbf04d64..02a463b3ba 100644 --- a/src/USER-EFF/fix_nvt_sllod_eff.cpp +++ b/src/USER-EFF/fix_nvt_sllod_eff.cpp @@ -13,7 +13,7 @@ #include #include -#include + #include "fix_nvt_sllod_eff.h" #include "math_extra.h" #include "atom.h" diff --git a/src/USER-EFF/fix_temp_rescale_eff.cpp b/src/USER-EFF/fix_temp_rescale_eff.cpp index 4a8f4b0372..a013270049 100644 --- a/src/USER-EFF/fix_temp_rescale_eff.cpp +++ b/src/USER-EFF/fix_temp_rescale_eff.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include #include "fix_temp_rescale_eff.h" #include "atom.h" @@ -40,17 +40,17 @@ FixTempRescaleEff::FixTempRescaleEff(LAMMPS *lmp, int narg, char **arg) : { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale/eff command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale/eff command"); scalar_flag = 1; global_freq = nevery; extscalar = 1; - t_start = force->numeric(FLERR,arg[4]); - t_stop = force->numeric(FLERR,arg[5]); - t_window = force->numeric(FLERR,arg[6]); - fraction = force->numeric(FLERR,arg[7]); + t_start = utils::numeric(FLERR,arg[4],false,lmp); + t_stop = utils::numeric(FLERR,arg[5],false,lmp); + t_window = utils::numeric(FLERR,arg[6],false,lmp); + fraction = utils::numeric(FLERR,arg[7],false,lmp); // create a new compute temp/eff // id = fix-ID + temp, compute group = fix group diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index f9333f4bec..f4e7af6584 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -15,9 +15,9 @@ Contributing author: Andres Jaramillo-Botero ------------------------------------------------------------------------- */ -#include + #include -#include + #include #include "pair_eff_cut.h" #include "pair_eff_inline.h" @@ -31,7 +31,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -795,7 +795,7 @@ void PairEffCut::settings(int narg, char **arg) PAULI_CORE_D[14] = 0.0; PAULI_CORE_E[14] = 0.0; - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); limit_eradius_flag = 0; pressure_with_evirials_flag = 0; @@ -815,7 +815,7 @@ void PairEffCut::settings(int narg, char **arg) else if (strcmp(arg[iarg],"ecp") == 0) { iarg += 1; while (iarg < narg) { - atype = force->inumeric(FLERR,arg[iarg]); + atype = utils::inumeric(FLERR,arg[iarg],false,lmp); if (strcmp(arg[iarg+1],"C") == 0) ecp_type[atype] = 6; else if (strcmp(arg[iarg+1],"N") == 0) ecp_type[atype] = 7; else if (strcmp(arg[iarg+1],"O") == 0) ecp_type[atype] = 8; @@ -903,11 +903,11 @@ void PairEffCut::coeff(int narg, char **arg) if ((strcmp(arg[0],"*") == 0) || (strcmp(arg[1],"*") == 0)) { int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; - if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); + if (narg == 3) cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -920,19 +920,19 @@ void PairEffCut::coeff(int narg, char **arg) if (count == 0) error->all(FLERR,"Incorrect args for pair coefficients"); } else { int ecp; - ecp = force->inumeric(FLERR,arg[0]); + ecp = utils::inumeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"s") ==0) { - PAULI_CORE_A[ecp_type[ecp]] = force->numeric(FLERR,arg[2]); - PAULI_CORE_B[ecp_type[ecp]] = force->numeric(FLERR,arg[3]); - PAULI_CORE_C[ecp_type[ecp]] = force->numeric(FLERR,arg[4]); + PAULI_CORE_A[ecp_type[ecp]] = utils::numeric(FLERR,arg[2],false,lmp); + PAULI_CORE_B[ecp_type[ecp]] = utils::numeric(FLERR,arg[3],false,lmp); + PAULI_CORE_C[ecp_type[ecp]] = utils::numeric(FLERR,arg[4],false,lmp); PAULI_CORE_D[ecp_type[ecp]] = 0.0; PAULI_CORE_E[ecp_type[ecp]] = 0.0; } else if (strcmp(arg[1],"p") ==0) { - PAULI_CORE_A[ecp_type[ecp]] = force->numeric(FLERR,arg[2]); - PAULI_CORE_B[ecp_type[ecp]] = force->numeric(FLERR,arg[3]); - PAULI_CORE_C[ecp_type[ecp]] = force->numeric(FLERR,arg[4]); - PAULI_CORE_D[ecp_type[ecp]] = force->numeric(FLERR,arg[5]); - PAULI_CORE_E[ecp_type[ecp]] = force->numeric(FLERR,arg[6]); + PAULI_CORE_A[ecp_type[ecp]] = utils::numeric(FLERR,arg[2],false,lmp); + PAULI_CORE_B[ecp_type[ecp]] = utils::numeric(FLERR,arg[3],false,lmp); + PAULI_CORE_C[ecp_type[ecp]] = utils::numeric(FLERR,arg[4],false,lmp); + PAULI_CORE_D[ecp_type[ecp]] = utils::numeric(FLERR,arg[5],false,lmp); + PAULI_CORE_E[ecp_type[ecp]] = utils::numeric(FLERR,arg[6],false,lmp); } else error->all(FLERR,"Illegal pair_coeff command"); } } diff --git a/src/USER-FEP/compute_fep.cpp b/src/USER-FEP/compute_fep.cpp index 1853828db3..ff1e303a30 100644 --- a/src/USER-FEP/compute_fep.cpp +++ b/src/USER-FEP/compute_fep.cpp @@ -18,7 +18,7 @@ #include "compute_fep.h" #include #include -#include + #include "comm.h" #include "update.h" #include "atom.h" @@ -35,6 +35,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; enum{PAIR,ATOM}; @@ -56,7 +57,7 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : fepinitflag = 0; // avoid init to run entirely when called by write_data - temp_fep = force->numeric(FLERR,arg[3]); + temp_fep = utils::numeric(FLERR,arg[3],false,lmp); // count # of perturbations @@ -94,10 +95,10 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : n = strlen(arg[iarg+2]) + 1; perturb[npert].pparam = new char[n]; strcpy(perturb[npert].pparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->ntypes, - perturb[npert].ilo,perturb[npert].ihi); - force->bounds(FLERR,arg[iarg+4],atom->ntypes, - perturb[npert].jlo,perturb[npert].jhi); + utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, + perturb[npert].ilo,perturb[npert].ihi,error); + utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes, + perturb[npert].jlo,perturb[npert].jhi,error); if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) { n = strlen(&arg[iarg+5][2]) + 1; perturb[npert].var = new char[n]; @@ -111,8 +112,8 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : perturb[npert].aparam = CHARGE; chgflag = 1; } else error->all(FLERR,"Illegal atom argument in compute fep"); - force->bounds(FLERR,arg[iarg+2],atom->ntypes, - perturb[npert].ilo,perturb[npert].ihi); + utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes, + perturb[npert].ilo,perturb[npert].ihi,error); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; perturb[npert].var = new char[n]; diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index 46cf32cf0b..2f97b5a0e3 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -33,6 +33,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; @@ -46,7 +47,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 5) error->all(FLERR,"Illegal fix adapt/fep command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery < 0) error->all(FLERR,"Illegal fix adapt/fep command"); dynamic_group_allow = 1; @@ -93,10 +94,10 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : n = strlen(arg[iarg+2]) + 1; adapt[nadapt].pparam = new char[n]; strcpy(adapt[nadapt].pparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->ntypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); - force->bounds(FLERR,arg[iarg+4],atom->ntypes, - adapt[nadapt].jlo,adapt[nadapt].jhi); + utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); + utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes, + adapt[nadapt].jlo,adapt[nadapt].jhi,error); if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) { n = strlen(&arg[iarg+5][2]) + 1; adapt[nadapt].var = new char[n]; @@ -124,8 +125,8 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : adapt[nadapt].aparam = CHARGE; chgflag = 1; } else error->all(FLERR,"Illegal fix adapt/fep command"); - force->bounds(FLERR,arg[iarg+2],atom->ntypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); + utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; adapt[nadapt].var = new char[n]; diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index eb872ab8b9..b0a099a56f 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_cut_soft.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -159,10 +159,10 @@ void PairCoulCutSoft::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphac = force->numeric(FLERR,arg[1]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphac = utils::numeric(FLERR,arg[1],false,lmp); - cut_global = force->numeric(FLERR,arg[2]); + cut_global = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -185,13 +185,13 @@ void PairCoulCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double lambda_one = force->numeric(FLERR,arg[2]); + double lambda_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index a631dca1b7..80173f3f0f 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_long_soft.h" -#include + #include #include #include "atom.h" @@ -28,7 +28,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -186,10 +186,10 @@ void PairCoulLongSoft::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphac = force->numeric(FLERR,arg[1]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphac = utils::numeric(FLERR,arg[1],false,lmp); - cut_coul = force->numeric(FLERR,arg[2]); + cut_coul = utils::numeric(FLERR,arg[2],false,lmp); } /* ---------------------------------------------------------------------- @@ -203,10 +203,10 @@ void PairCoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double lambda_one = force->numeric(FLERR,arg[2]); + double lambda_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index 81c1599508..e13b98329f 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_charmm_coul_long_soft.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -628,14 +628,14 @@ void PairLJCharmmCoulLongSoft::settings(int narg, char **arg) { if (narg != 5 && narg != 6) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); - alphac = force->numeric(FLERR,arg[2]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); + alphac = utils::numeric(FLERR,arg[2],false,lmp); - cut_lj_inner = force->numeric(FLERR,arg[3]); - cut_lj = force->numeric(FLERR,arg[4]); + cut_lj_inner = utils::numeric(FLERR,arg[3],false,lmp); + cut_lj = utils::numeric(FLERR,arg[4],false,lmp); if (narg == 5) cut_coul = cut_lj; - else cut_coul = force->numeric(FLERR,arg[5]); + else cut_coul = utils::numeric(FLERR,arg[5],false,lmp); } /* ---------------------------------------------------------------------- @@ -648,18 +648,18 @@ void PairLJCharmmCoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); double eps14_one = epsilon_one; double sigma14_one = sigma_one; if (narg == 7) { - eps14_one = force->numeric(FLERR,arg[5]); - sigma14_one = force->numeric(FLERR,arg[6]); + eps14_one = utils::numeric(FLERR,arg[5],false,lmp); + sigma14_one = utils::numeric(FLERR,arg[6],false,lmp); } int count = 0; diff --git a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp index 255bdf6a07..bfd5a630f6 100644 --- a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_coul_cut_soft.h" -#include + #include #include #include "atom.h" @@ -23,7 +23,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -198,13 +198,13 @@ void PairLJClass2CoulCutSoft::settings(int narg, char **arg) { if (narg < 4 || narg > 5) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); - alphac = force->numeric(FLERR,arg[2]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); + alphac = utils::numeric(FLERR,arg[2],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[3]); + cut_lj_global = utils::numeric(FLERR,arg[3],false,lmp); if (narg == 4) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[4]); + else cut_coul_global = utils::numeric(FLERR,arg[4],false,lmp); // reset cutoffs that have been explicitly set @@ -229,19 +229,19 @@ void PairLJClass2CoulCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigma_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 6) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[5]); - if (narg == 7) cut_coul_one = force->numeric(FLERR,arg[6]); + if (narg >= 6) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); + if (narg == 7) cut_coul_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index dda10ed9e0..e027a30185 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_coul_long_soft.h" -#include + #include #include #include "atom.h" @@ -24,7 +24,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -213,13 +213,13 @@ void PairLJClass2CoulLongSoft::settings(int narg, char **arg) { if (narg < 4 || narg > 5) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); - alphac = force->numeric(FLERR,arg[2]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); + alphac = utils::numeric(FLERR,arg[2],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[3]); + cut_lj_global = utils::numeric(FLERR,arg[3],false,lmp); if (narg == 4) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[4]); + else cut_coul = utils::numeric(FLERR,arg[4],false,lmp); // reset cutoffs that have been explicitly set @@ -242,17 +242,17 @@ void PairLJClass2CoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigma_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_class2_soft.cpp b/src/USER-FEP/pair_lj_class2_soft.cpp index 957fc0f8ab..0cd1fc9e87 100644 --- a/src/USER-FEP/pair_lj_class2_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_soft.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_class2_soft.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -169,10 +169,10 @@ void PairLJClass2Soft::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); - cut_global = force->numeric(FLERR,arg[2]); + cut_global = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -194,16 +194,16 @@ void PairLJClass2Soft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigma_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index 3f85a2c8aa..a18256f98a 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_cut_soft.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -198,13 +198,13 @@ void PairLJCutCoulCutSoft::settings(int narg, char **arg) { if (narg < 4 || narg > 5) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); - alphac = force->numeric(FLERR,arg[2]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); + alphac = utils::numeric(FLERR,arg[2],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[3]); + cut_lj_global = utils::numeric(FLERR,arg[3],false,lmp); if (narg == 4) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[4]); + else cut_coul_global = utils::numeric(FLERR,arg[4],false,lmp); // reset cutoffs that have been explicitly set @@ -230,19 +230,19 @@ void PairLJCutCoulCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigma_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 6) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[5]); - if (narg == 7) cut_coul_one = force->numeric(FLERR,arg[6]); + if (narg >= 6) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); + if (narg == 7) cut_coul_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index c22b2ca673..4b3fae77b3 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_long_soft.h" -#include + #include #include #include "atom.h" @@ -32,7 +32,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -566,13 +566,13 @@ void PairLJCutCoulLongSoft::settings(int narg, char **arg) { if (narg < 4 || narg > 5) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); - alphac = force->numeric(FLERR,arg[2]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); + alphac = utils::numeric(FLERR,arg[2],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[3]); + cut_lj_global = utils::numeric(FLERR,arg[3],false,lmp); if (narg == 4) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[4]); + else cut_coul = utils::numeric(FLERR,arg[4],false,lmp); // reset cutoffs that have been explicitly set @@ -595,17 +595,17 @@ void PairLJCutCoulLongSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigma_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 92abdf540a..786715d6c9 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_soft.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -450,10 +450,10 @@ void PairLJCutSoft::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->numeric(FLERR,arg[0]); - alphalj = force->numeric(FLERR,arg[1]); + nlambda = utils::numeric(FLERR,arg[0],false,lmp); + alphalj = utils::numeric(FLERR,arg[1],false,lmp); - cut_global = force->numeric(FLERR,arg[2]); + cut_global = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -476,17 +476,17 @@ void PairLJCutSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double lambda_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigma_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp index 0601a641ac..18f8db5021 100644 --- a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_tip4p_long_soft.h" -#include + #include #include #include "angle.h" @@ -31,7 +31,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -413,18 +413,18 @@ void PairLJCutTIP4PLongSoft::settings(int narg, char **arg) { if (narg < 9 || narg > 10) error->all(FLERR,"Illegal pair_style command"); - typeO = force->inumeric(FLERR,arg[0]); - typeH = force->inumeric(FLERR,arg[1]); - typeB = force->inumeric(FLERR,arg[2]); - typeA = force->inumeric(FLERR,arg[3]); - qdist = force->numeric(FLERR,arg[4]); - nlambda = force->numeric(FLERR,arg[5]); - alphalj = force->numeric(FLERR,arg[6]); - alphac = force->numeric(FLERR,arg[7]); + typeO = utils::inumeric(FLERR,arg[0],false,lmp); + typeH = utils::inumeric(FLERR,arg[1],false,lmp); + typeB = utils::inumeric(FLERR,arg[2],false,lmp); + typeA = utils::inumeric(FLERR,arg[3],false,lmp); + qdist = utils::numeric(FLERR,arg[4],false,lmp); + nlambda = utils::numeric(FLERR,arg[5],false,lmp); + alphalj = utils::numeric(FLERR,arg[6],false,lmp); + alphac = utils::numeric(FLERR,arg[7],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[8]); + cut_lj_global = utils::numeric(FLERR,arg[8],false,lmp); if (narg == 9) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[9]); + else cut_coul = utils::numeric(FLERR,arg[9],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index c727ea0c2a..85a30a5414 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_morse_soft.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "memory.h" #include "math_special.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathSpecial; @@ -177,16 +177,16 @@ void PairMorseSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double d0_one = force->numeric(FLERR,arg[2]); - double alpha_one = force->numeric(FLERR,arg[3]); - double r0_one = force->numeric(FLERR,arg[4]); - double lambda_one = force->numeric(FLERR,arg[5]); + double d0_one = utils::numeric(FLERR,arg[2],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[3],false,lmp); + double r0_one = utils::numeric(FLERR,arg[4],false,lmp); + double lambda_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_one = cut_global; - if (narg == 7) cut_one = force->numeric(FLERR,arg[6]); + if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { @@ -212,9 +212,9 @@ void PairMorseSoft::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - nlambda = force->inumeric(FLERR,arg[0]); - shift_range = force->numeric(FLERR,arg[1]); - cut_global = force->numeric(FLERR,arg[2]); + nlambda = utils::inumeric(FLERR,arg[0],false,lmp); + shift_range = utils::numeric(FLERR,arg[1],false,lmp); + cut_global = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/USER-FEP/pair_tip4p_long_soft.cpp b/src/USER-FEP/pair_tip4p_long_soft.cpp index d5e1ae116c..9578befd37 100644 --- a/src/USER-FEP/pair_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_tip4p_long_soft.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_tip4p_long_soft.h" -#include + #include #include #include "angle.h" @@ -31,7 +31,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -381,16 +381,16 @@ void PairTIP4PLongSoft::settings(int narg, char **arg) { if (narg != 8) error->all(FLERR,"Illegal pair_style command"); - typeO = force->inumeric(FLERR,arg[0]); - typeH = force->inumeric(FLERR,arg[1]); - typeB = force->inumeric(FLERR,arg[2]); - typeA = force->inumeric(FLERR,arg[3]); - qdist = force->numeric(FLERR,arg[4]); + typeO = utils::inumeric(FLERR,arg[0],false,lmp); + typeH = utils::inumeric(FLERR,arg[1],false,lmp); + typeB = utils::inumeric(FLERR,arg[2],false,lmp); + typeA = utils::inumeric(FLERR,arg[3],false,lmp); + qdist = utils::numeric(FLERR,arg[4],false,lmp); - nlambda = force->numeric(FLERR,arg[5]); - alphac = force->numeric(FLERR,arg[6]); + nlambda = utils::numeric(FLERR,arg[5],false,lmp); + alphac = utils::numeric(FLERR,arg[6],false,lmp); - cut_coul = force->numeric(FLERR,arg[7]); + cut_coul = utils::numeric(FLERR,arg[7],false,lmp); } /* ---------------------------------------------------------------------- diff --git a/src/USER-H5MD/dump_h5md.cpp b/src/USER-H5MD/dump_h5md.cpp index af77258780..e9daf71867 100644 --- a/src/USER-H5MD/dump_h5md.cpp +++ b/src/USER-H5MD/dump_h5md.cpp @@ -17,7 +17,7 @@ #include #include -#include + #include #include #include "ch5md.h" @@ -74,7 +74,7 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) datafile_from_dump = -1; author_name=NULL; - every_dump = force->inumeric(FLERR,arg[3]); + every_dump = utils::inumeric(FLERR,arg[3],false,lmp); every_position = every_image = -1; every_velocity = every_force = every_species = -1; every_charge = -1; diff --git a/src/USER-INTEL/angle_charmm_intel.cpp b/src/USER-INTEL/angle_charmm_intel.cpp index 9275e82f1c..7aad7f754a 100644 --- a/src/USER-INTEL/angle_charmm_intel.cpp +++ b/src/USER-INTEL/angle_charmm_intel.cpp @@ -15,20 +15,21 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "angle_charmm_intel.h" + #include "atom.h" -#include "neighbor.h" -#include "domain.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "modify.h" #include "math_const.h" #include "memory.h" +#include "modify.h" +#include "neighbor.h" #include "suffix.h" -#include "error.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-INTEL/angle_harmonic_intel.cpp b/src/USER-INTEL/angle_harmonic_intel.cpp index 49a71038da..290f7320b1 100644 --- a/src/USER-INTEL/angle_harmonic_intel.cpp +++ b/src/USER-INTEL/angle_harmonic_intel.cpp @@ -15,20 +15,21 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "angle_harmonic_intel.h" + #include "atom.h" -#include "neighbor.h" -#include "domain.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "modify.h" #include "math_const.h" #include "memory.h" +#include "modify.h" +#include "neighbor.h" #include "suffix.h" -#include "error.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-INTEL/bond_fene_intel.cpp b/src/USER-INTEL/bond_fene_intel.cpp index 5c58e7bf10..6b458aeefb 100644 --- a/src/USER-INTEL/bond_fene_intel.cpp +++ b/src/USER-INTEL/bond_fene_intel.cpp @@ -15,19 +15,21 @@ Contributing author: Stan Moore (Sandia) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include + #include "bond_fene_intel.h" + #include "atom.h" -#include "modify.h" -#include "neighbor.h" -#include "domain.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" +#include "modify.h" +#include "neighbor.h" #include "suffix.h" -#include "error.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/bond_harmonic_intel.cpp b/src/USER-INTEL/bond_harmonic_intel.cpp index 8bf0a82218..84d94b8f3d 100644 --- a/src/USER-INTEL/bond_harmonic_intel.cpp +++ b/src/USER-INTEL/bond_harmonic_intel.cpp @@ -15,19 +15,20 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "bond_harmonic_intel.h" + #include "atom.h" -#include "modify.h" -#include "neighbor.h" -#include "domain.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" +#include "modify.h" +#include "neighbor.h" #include "suffix.h" -#include "error.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/dihedral_charmm_intel.cpp b/src/USER-INTEL/dihedral_charmm_intel.cpp index 61fc1dfbd5..ddfa0c1228 100644 --- a/src/USER-INTEL/dihedral_charmm_intel.cpp +++ b/src/USER-INTEL/dihedral_charmm_intel.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "omp_compat.h" -#include + #include #include "dihedral_charmm_intel.h" #include "atom.h" diff --git a/src/USER-INTEL/dihedral_fourier_intel.cpp b/src/USER-INTEL/dihedral_fourier_intel.cpp index fb8051474e..67b82b62bf 100644 --- a/src/USER-INTEL/dihedral_fourier_intel.cpp +++ b/src/USER-INTEL/dihedral_fourier_intel.cpp @@ -15,22 +15,22 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "dihedral_fourier_intel.h" + #include "atom.h" #include "comm.h" +#include "error.h" +#include "force.h" #include "memory.h" #include "modify.h" #include "neighbor.h" -#include "domain.h" -#include "force.h" -#include "pair.h" -#include "update.h" -#include "error.h" - #include "suffix.h" +#include "update.h" + +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; #define PTOLERANCE (flt_t)1.05 diff --git a/src/USER-INTEL/dihedral_harmonic_intel.cpp b/src/USER-INTEL/dihedral_harmonic_intel.cpp index f6c4ea0fde..ea9bc33c57 100644 --- a/src/USER-INTEL/dihedral_harmonic_intel.cpp +++ b/src/USER-INTEL/dihedral_harmonic_intel.cpp @@ -15,22 +15,22 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "dihedral_harmonic_intel.h" + #include "atom.h" #include "comm.h" +#include "error.h" +#include "force.h" #include "memory.h" #include "modify.h" #include "neighbor.h" -#include "domain.h" -#include "force.h" -#include "pair.h" -#include "update.h" -#include "error.h" - #include "suffix.h" +#include "update.h" + +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; #define PTOLERANCE (flt_t)1.05 diff --git a/src/USER-INTEL/dihedral_opls_intel.cpp b/src/USER-INTEL/dihedral_opls_intel.cpp index 79a8874a72..fa8fd53def 100644 --- a/src/USER-INTEL/dihedral_opls_intel.cpp +++ b/src/USER-INTEL/dihedral_opls_intel.cpp @@ -15,22 +15,22 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "dihedral_opls_intel.h" + #include "atom.h" #include "comm.h" +#include "error.h" +#include "force.h" #include "memory.h" #include "modify.h" #include "neighbor.h" -#include "domain.h" -#include "force.h" -#include "pair.h" -#include "update.h" -#include "error.h" - #include "suffix.h" +#include "update.h" + +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; #define PTOLERANCE (flt_t)1.05 diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index 1f8b5175b8..eacbc7ddcc 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -16,8 +16,8 @@ Anupama Kurpad (Intel) - Host Affinitization ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_intel.h" + #include "comm.h" #include "error.h" #include "force.h" @@ -25,16 +25,9 @@ #include "neigh_request.h" #include "pair.h" #include "pair_hybrid.h" -#include "pair_hybrid_overlay.h" -#include "timer.h" -#include "universe.h" #include "update.h" -#include "utils.h" #include -#include -#include -#include #ifdef _LMP_INTEL_OFFLOAD #ifndef INTEL_OFFLOAD_NOAFFINITY @@ -59,7 +52,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal package intel command"); - int ncops = force->inumeric(FLERR,arg[3]); + int ncops = utils::inumeric(FLERR,arg[3],false,lmp); _nbor_pack_width = 1; _three_body_neighbor = 0; @@ -106,7 +99,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) while (iarg < narg) { if (strcmp(arg[iarg],"omp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); - nomp = force->inumeric(FLERR,arg[iarg+1]); + nomp = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"mode") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); @@ -120,7 +113,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) iarg += 2; } else if (strcmp(arg[iarg],"balance") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); - _offload_balance = force->numeric(FLERR,arg[iarg+1]); + _offload_balance = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "ghost") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal package intel command"); diff --git a/src/USER-INTEL/fix_nh_intel.cpp b/src/USER-INTEL/fix_nh_intel.cpp index a072e823a4..2122bfd370 100644 --- a/src/USER-INTEL/fix_nh_intel.cpp +++ b/src/USER-INTEL/fix_nh_intel.cpp @@ -16,12 +16,11 @@ ------------------------------------------------------------------------- */ #include "fix_nh_intel.h" + #include "atom.h" -#include "compute.h" #include "domain.h" #include "error.h" #include "force.h" -#include "kspace.h" #include "memory.h" #include "modify.h" #include "neighbor.h" @@ -29,7 +28,6 @@ #include #include -#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-INTEL/fix_nve_asphere_intel.cpp b/src/USER-INTEL/fix_nve_asphere_intel.cpp index 7eeb8a1635..55e51227f4 100644 --- a/src/USER-INTEL/fix_nve_asphere_intel.cpp +++ b/src/USER-INTEL/fix_nve_asphere_intel.cpp @@ -15,18 +15,16 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include -#include -#include #include "fix_nve_asphere_intel.h" -#include "math_extra_intel.h" + #include "atom.h" #include "atom_vec_ellipsoid.h" +#include "error.h" #include "force.h" +#include "math_extra_intel.h" +#include "memory.h" #include "neighbor.h" #include "update.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-INTEL/fix_nvt_sllod_intel.cpp b/src/USER-INTEL/fix_nvt_sllod_intel.cpp index f5a5dabfb1..4382542710 100644 --- a/src/USER-INTEL/fix_nvt_sllod_intel.cpp +++ b/src/USER-INTEL/fix_nvt_sllod_intel.cpp @@ -11,18 +11,19 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include #include "fix_nvt_sllod_intel.h" -#include "math_extra.h" + #include "atom.h" +#include "compute.h" #include "domain.h" -#include "group.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_deform.h" -#include "compute.h" -#include "error.h" +#include "group.h" +#include "math_extra.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-INTEL/improper_cvff_intel.cpp b/src/USER-INTEL/improper_cvff_intel.cpp index 4562c63cdb..ba5ff79cd5 100644 --- a/src/USER-INTEL/improper_cvff_intel.cpp +++ b/src/USER-INTEL/improper_cvff_intel.cpp @@ -15,22 +15,22 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include -#include #include "improper_cvff_intel.h" + #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "domain.h" +#include "error.h" #include "force.h" -#include "update.h" #include "math_const.h" #include "memory.h" #include "modify.h" +#include "neighbor.h" #include "suffix.h" -#include "error.h" +#include "update.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-INTEL/improper_harmonic_intel.cpp b/src/USER-INTEL/improper_harmonic_intel.cpp index fc5cf08c52..8da3c67022 100644 --- a/src/USER-INTEL/improper_harmonic_intel.cpp +++ b/src/USER-INTEL/improper_harmonic_intel.cpp @@ -15,22 +15,23 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include -#include + #include "improper_harmonic_intel.h" + #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "domain.h" +#include "error.h" #include "force.h" -#include "update.h" #include "math_const.h" #include "memory.h" #include "modify.h" +#include "neighbor.h" #include "suffix.h" -#include "error.h" +#include "update.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-INTEL/intel_buffers.cpp b/src/USER-INTEL/intel_buffers.cpp index 04791dee78..dc5b0fad5a 100644 --- a/src/USER-INTEL/intel_buffers.cpp +++ b/src/USER-INTEL/intel_buffers.cpp @@ -12,8 +12,8 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include #include "intel_buffers.h" + #include "force.h" #include "memory.h" diff --git a/src/USER-INTEL/nbin_intel.cpp b/src/USER-INTEL/nbin_intel.cpp index 78c6246389..4a046bc845 100644 --- a/src/USER-INTEL/nbin_intel.cpp +++ b/src/USER-INTEL/nbin_intel.cpp @@ -16,13 +16,13 @@ ------------------------------------------------------------------------- */ #include "nbin_intel.h" + #include "atom.h" -#include "group.h" #include "comm.h" -#include "domain.h" +#include "error.h" +#include "group.h" #include "modify.h" #include "update.h" -#include "error.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp index 00b032d495..bd4a95f774 100644 --- a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp @@ -16,15 +16,13 @@ ------------------------------------------------------------------------- */ #include "npair_full_bin_ghost_intel.h" -#include "neighbor.h" -#include "nstencil.h" -#include "neigh_list.h" + #include "atom.h" -#include "atom_vec.h" #include "comm.h" -#include "domain.h" -#include "molecule.h" #include "error.h" +#include "molecule.h" +#include "neigh_list.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_full_bin_intel.cpp b/src/USER-INTEL/npair_full_bin_intel.cpp index 4ef84be75f..c4433ba16c 100644 --- a/src/USER-INTEL/npair_full_bin_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_intel.cpp @@ -16,12 +16,11 @@ ------------------------------------------------------------------------- */ #include "npair_full_bin_intel.h" -#include "neighbor.h" -#include "neigh_list.h" + #include "atom.h" #include "comm.h" -#include "domain.h" -#include "group.h" +#include "neigh_list.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_half_bin_newton_intel.cpp b/src/USER-INTEL/npair_half_bin_newton_intel.cpp index 799ba2b57b..55bac4cdb7 100644 --- a/src/USER-INTEL/npair_half_bin_newton_intel.cpp +++ b/src/USER-INTEL/npair_half_bin_newton_intel.cpp @@ -16,12 +16,11 @@ ------------------------------------------------------------------------- */ #include "npair_half_bin_newton_intel.h" -#include "neighbor.h" -#include "neigh_list.h" + #include "atom.h" #include "comm.h" -#include "domain.h" -#include "group.h" +#include "neigh_list.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp b/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp index 1f859cb5f1..d5384904e5 100644 --- a/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp +++ b/src/USER-INTEL/npair_half_bin_newton_tri_intel.cpp @@ -16,12 +16,11 @@ ------------------------------------------------------------------------- */ #include "npair_half_bin_newton_tri_intel.h" -#include "neighbor.h" -#include "neigh_list.h" + #include "atom.h" #include "comm.h" -#include "domain.h" -#include "group.h" +#include "neigh_list.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_halffull_newton_intel.cpp b/src/USER-INTEL/npair_halffull_newton_intel.cpp index 8248f2257a..dd11802797 100644 --- a/src/USER-INTEL/npair_halffull_newton_intel.cpp +++ b/src/USER-INTEL/npair_halffull_newton_intel.cpp @@ -16,16 +16,14 @@ ------------------------------------------------------------------------- */ #include "npair_halffull_newton_intel.h" -#include "neighbor.h" -#include "neigh_list.h" + #include "atom.h" -#include "atom_vec.h" #include "comm.h" -#include "modify.h" -#include "molecule.h" -#include "domain.h" -#include "my_page.h" #include "error.h" +#include "modify.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_intel.cpp b/src/USER-INTEL/npair_intel.cpp index f7a233efc9..9aae0d27b7 100644 --- a/src/USER-INTEL/npair_intel.cpp +++ b/src/USER-INTEL/npair_intel.cpp @@ -15,13 +15,13 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" +#include "npair_intel.h" + #include "comm.h" #include "domain.h" -#include "timer.h" #include "modify.h" -#include "npair_intel.h" -#include "nstencil.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/npair_intel.h b/src/USER-INTEL/npair_intel.h index 6d4e01462f..e040a1d8f3 100644 --- a/src/USER-INTEL/npair_intel.h +++ b/src/USER-INTEL/npair_intel.h @@ -15,6 +15,7 @@ #define LMP_NPAIR_INTEL_H #include "npair.h" +#include "domain.h" #include "fix_intel.h" #if defined(_OPENMP) diff --git a/src/USER-INTEL/npair_skip_intel.cpp b/src/USER-INTEL/npair_skip_intel.cpp index fa202d5da1..df09829c86 100644 --- a/src/USER-INTEL/npair_skip_intel.cpp +++ b/src/USER-INTEL/npair_skip_intel.cpp @@ -16,17 +16,15 @@ ------------------------------------------------------------------------- */ #include "npair_skip_intel.h" -#include "neighbor.h" -#include "neigh_list.h" + #include "atom.h" -#include "atom_vec.h" #include "comm.h" -#include "modify.h" -#include "molecule.h" -#include "neigh_request.h" -#include "domain.h" -#include "my_page.h" #include "error.h" +#include "modify.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/pair_airebo_intel.cpp b/src/USER-INTEL/pair_airebo_intel.cpp index c1e4a5374a..6b576220fe 100644 --- a/src/USER-INTEL/pair_airebo_intel.cpp +++ b/src/USER-INTEL/pair_airebo_intel.cpp @@ -15,41 +15,37 @@ Contributing author: Markus Hohnerbach (RWTH) ------------------------------------------------------------------------- */ -#ifdef __INTEL_OFFLOAD -#pragma offload_attribute(push, target(mic)) -#endif -#include -#include -#include -#include -#include -#include // requires C++-11 +#include "pair_airebo_intel.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "suffix.h" + #include -#include -#include "lmptype.h" +#include +#include + #include "intel_preprocess.h" #include "intel_intrinsics_airebo.h" + #ifdef __INTEL_OFFLOAD #pragma offload_attribute(pop) #endif +#ifdef __INTEL_OFFLOAD +#pragma offload_attribute(push, target(mic)) +#endif + #if defined(_OPENMP) #include #endif -#include "pair_airebo_intel.h" -#include "atom.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "group.h" -#include "kspace.h" -#include "modify.h" -#include "suffix.h" -#include "math_const.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-INTEL/pair_airebo_morse_intel.cpp b/src/USER-INTEL/pair_airebo_morse_intel.cpp index f68e299fa0..a99ab913ba 100644 --- a/src/USER-INTEL/pair_airebo_morse_intel.cpp +++ b/src/USER-INTEL/pair_airebo_morse_intel.cpp @@ -16,7 +16,6 @@ ------------------------------------------------------------------------- */ #include "pair_airebo_morse_intel.h" -#include "error.h" using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index 4ad4398fbe..a67db0ad32 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -17,7 +17,7 @@ #include #include -#include + #include #include "pair_buck_coul_cut_intel.h" #include "atom.h" diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index 150cfd3ee0..d0cb1837c9 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -17,7 +17,7 @@ #include #include -#include + #include #include "pair_buck_coul_long_intel.h" #include "atom.h" diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index b21ce13a34..bb5b44d260 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -15,20 +15,20 @@ Contributing author: Rodrigo Canales (RWTH Aachen University) ------------------------------------------------------------------------- */ -#include #include "pair_buck_intel.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "group.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" +#include "error.h" #include "math_const.h" #include "memory.h" -#include "suffix.h" -#include "force.h" #include "modify.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "suffix.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index 31430e4bf7..084714daf4 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -15,18 +15,16 @@ Contributing authors: Stephen Foiles (SNL), Murray Daw (SNL) ------------------------------------------------------------------------- */ -#include -#include -#include #include "pair_eam_alloy_intel.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index c5804922f6..8786c0d782 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -15,18 +15,16 @@ Contributing authors: Tim Lau (MIT) ------------------------------------------------------------------------- */ -#include -#include -#include #include "pair_eam_fs_intel.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-INTEL/pair_eam_intel.cpp b/src/USER-INTEL/pair_eam_intel.cpp index 994f0d3910..561621a388 100644 --- a/src/USER-INTEL/pair_eam_intel.cpp +++ b/src/USER-INTEL/pair_eam_intel.cpp @@ -15,22 +15,22 @@ Contributing authors: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "pair_eam_intel.h" + #include "atom.h" -#include "force.h" #include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" #include "suffix.h" +#include +#include + using namespace LAMMPS_NS; #define MAXLINE 1024 diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp index ff8a9869b7..c8e4a3d0ef 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -12,19 +12,22 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include #include "pair_lj_charmm_coul_charmm_intel.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "group.h" #include "memory.h" #include "modify.h" #include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" #include "suffix.h" + +#include +#include + using namespace LAMMPS_NS; #define LJ_T typename IntelBuffers::vec4_t diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index 243c7f577d..34ab97fd35 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -12,20 +12,21 @@ Contributing author: W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include #include "pair_lj_cut_coul_long_intel.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "group.h" #include "kspace.h" #include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" +#include "neighbor.h" #include "suffix.h" + +#include + using namespace LAMMPS_NS; #define C_FORCE_T typename ForceConst::c_force_t diff --git a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp index 8b9670f419..533252d018 100644 --- a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp @@ -15,21 +15,16 @@ Contributing authors: William McDoniel (RWTH Aachen University) ------------------------------------------------------------------------- */ -#include #include "pair_lj_long_coul_long_intel.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "group.h" -#include "kspace.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" +#include "neighbor.h" #include "suffix.h" - using namespace LAMMPS_NS; #define C_FORCE_T typename ForceConst::c_force_t diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 32afcbf8a9..4ec2af40b0 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -17,6 +17,19 @@ #include "pair_sw_intel.h" +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "neighbor.h" +#include "suffix.h" + +#include + #ifdef _LMP_INTEL_OFFLOAD #pragma offload_attribute(push,target(mic)) #endif @@ -25,21 +38,6 @@ #pragma offload_attribute(pop) #endif -#include -#include -#include -#include "atom.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" -#include "modify.h" -#include "suffix.h" #ifdef LMP_USE_AVXCD #include "intel_simd.h" diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index 8784029320..75f5f85f2d 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -17,7 +17,7 @@ #include #include -#include + #include #include "pair_tersoff_intel.h" #include "atom.h" diff --git a/src/USER-INTEL/pppm_disp_intel.cpp b/src/USER-INTEL/pppm_disp_intel.cpp index 270299b4c5..1149c9b2c3 100644 --- a/src/USER-INTEL/pppm_disp_intel.cpp +++ b/src/USER-INTEL/pppm_disp_intel.cpp @@ -15,23 +15,23 @@ Contributing authors: William McDoniel (RWTH Aachen University) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include -#include #include "pppm_disp_intel.h" + #include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" -#include "modify.h" -#include "fft3d_wrap.h" #include "gridcomm.h" #include "math_const.h" #include "math_special.h" #include "memory.h" +#include "modify.h" #include "suffix.h" +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-INTEL/pppm_intel.cpp b/src/USER-INTEL/pppm_intel.cpp index 26af974086..d596df4490 100644 --- a/src/USER-INTEL/pppm_intel.cpp +++ b/src/USER-INTEL/pppm_intel.cpp @@ -18,23 +18,24 @@ W. Michael Brown (Intel) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include -#include #include "pppm_intel.h" + #include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" -#include "modify.h" -#include "fft3d_wrap.h" #include "gridcomm.h" #include "math_const.h" #include "math_special.h" #include "memory.h" +#include "modify.h" #include "suffix.h" +#include +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index 8ad3dbe33e..204a9c073b 100644 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -18,8 +18,8 @@ #include "fix_lb_fluid.h" #include -#include -#include + + #include #include #include diff --git a/src/USER-LB/fix_lb_momentum.cpp b/src/USER-LB/fix_lb_momentum.cpp index 10fffed018..0a307790d5 100644 --- a/src/USER-LB/fix_lb_momentum.cpp +++ b/src/USER-LB/fix_lb_momentum.cpp @@ -19,8 +19,8 @@ ------------------------------------------------------------------------- */ #include "fix_lb_momentum.h" -#include -#include + + #include #include "atom.h" #include "group.h" diff --git a/src/USER-LB/fix_lb_pc.cpp b/src/USER-LB/fix_lb_pc.cpp index d61692419a..2c7e8dbf47 100644 --- a/src/USER-LB/fix_lb_pc.cpp +++ b/src/USER-LB/fix_lb_pc.cpp @@ -26,7 +26,7 @@ #include "domain.h" #include "fix_lb_fluid.h" #include "modify.h" -#include + #include "group.h" using namespace LAMMPS_NS; diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index af1b01043d..f714e31719 100644 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -17,9 +17,9 @@ ------------------------------------------------------------------------- */ #include "fix_lb_rigid_pc_sphere.h" -#include + #include -#include + #include #include "atom.h" #include "domain.h" @@ -32,6 +32,7 @@ #include "error.h" #include "fix_lb_fluid.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -233,7 +234,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; @@ -260,7 +261,7 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : if (iarg+5 > narg) error->all(FLERR,"Illegal fix lb/rigid/pc/sphere command"); int mlo,mhi; - force->bounds(FLERR,arg[iarg+1],nbody,mlo,mhi); + utils::bounds(FLERR,arg[iarg+1],1,nbody,mlo,mhi,error); double xflag,yflag,zflag; if (strcmp(arg[iarg+2],"off") == 0) xflag = 0.0; diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index 74a9a1833f..732ba0909e 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -12,17 +12,16 @@ ------------------------------------------------------------------------- */ #include "fix_manifoldforce.h" // For stuff -#include -#include -#include "atom.h" -#include "update.h" -#include "respa.h" -#include "error.h" -#include "force.h" #include "manifold.h" #include "manifold_factory.h" // For constructing manifold +#include "atom.h" +#include "error.h" +#include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -92,7 +91,7 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Equal-style variables not allowed with fix manifoldforce"); // Use force->numeric to trigger an error if arg is not a number. - params[i] = force->numeric(FLERR,arg[i+4]); + params[i] = utils::numeric(FLERR,arg[i+4],false,lmp); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index 312db1c411..b3122a68d4 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -33,7 +33,7 @@ #include "fix_nve_manifold_rattle.h" -#include + #include #include "atom.h" #include "force.h" @@ -91,8 +91,8 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, next_output = 0; dtv = dtf = 0; - tolerance = force->numeric( FLERR, arg[3] ); - max_iter = force->numeric( FLERR, arg[4] ); + tolerance = utils::numeric( FLERR, arg[3] ,false,lmp); + max_iter = utils::numeric( FLERR, arg[4] ,false,lmp); ptr_m = create_manifold(arg[5], lmp, narg, arg); if (!ptr_m) { @@ -124,7 +124,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, is_var[i] = 1; offset = 2; } else { - force->numeric(FLERR,arg[i+6]); // Check if legal number. + utils::numeric(FLERR,arg[i+6],false,lmp); // Check if legal number. len = strlen( arg[i+6] ) + 1; // +1 for \0. is_var[i] = 0; } @@ -137,7 +137,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, if (!ptr_m->params ) error->all(FLERR,"Failed to allocate params!"); for( int i = 0; i < nvars; ++i ){ // If param i was variable type, it will be set later... - ptr_m->params[i] = is_var[i] ? 0.0 : force->numeric( FLERR, arg[i+6] ); + ptr_m->params[i] = is_var[i] ? 0.0 : utils::numeric( FLERR, arg[i+6] ,false,lmp); } ptr_m->post_param_init(); @@ -146,7 +146,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, int argi = 6 + nvars; while( argi < narg ){ if (strcmp(arg[argi], "every") == 0) { - nevery = force->inumeric(FLERR,arg[argi+1]); + nevery = utils::inumeric(FLERR,arg[argi+1],false,lmp); next_output = update->ntimestep + nevery; if (comm->me == 0) { fprintf(screen,"Outputting every %d steps, next is %d\n", diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp index db3267db28..f07e414ac9 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -101,9 +101,9 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, if (argi+3 >= narg) error->all(FLERR,"Keyword 'temp' needs 3 arguments"); - t_start = force->numeric(FLERR, arg[argi+1]); - t_stop = force->numeric(FLERR, arg[argi+2]); - t_period = force->numeric(FLERR, arg[argi+3]); + t_start = utils::numeric(FLERR, arg[argi+1],false,lmp); + t_stop = utils::numeric(FLERR, arg[argi+2],false,lmp); + t_period = utils::numeric(FLERR, arg[argi+3],false,lmp); t_target = t_start; got_temp = 1; @@ -112,7 +112,7 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, if (argi+1 >= narg) error->all(FLERR,"Keyword 'tchain' needs 1 argument"); - mtchain = force->inumeric(FLERR, arg[argi+1]); + mtchain = utils::inumeric(FLERR, arg[argi+1],false,lmp); argi += 2; } else if (error_on_unknown_keyword) { char msg[2048]; diff --git a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp index b9b7ae7279..ef26999295 100644 --- a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp @@ -3,6 +3,8 @@ #include "comm.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace user_manifold; diff --git a/src/USER-MEAMC/meam.h b/src/USER-MEAMC/meam.h index b4f8fd341b..b974ce5bc8 100644 --- a/src/USER-MEAMC/meam.h +++ b/src/USER-MEAMC/meam.h @@ -1,9 +1,23 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 LMP_MEAM_H #define LMP_MEAM_H +#include "math_const.h" // IWYU pragma: export + #include #include -#include "math_const.h" #define maxelt 5 diff --git a/src/USER-MEAMC/meam_dens_final.cpp b/src/USER-MEAMC/meam_dens_final.cpp index fe9e74ca7c..02c461e6b7 100644 --- a/src/USER-MEAMC/meam_dens_final.cpp +++ b/src/USER-MEAMC/meam_dens_final.cpp @@ -1,3 +1,15 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "meam.h" using namespace LAMMPS_NS; diff --git a/src/USER-MEAMC/meam_dens_init.cpp b/src/USER-MEAMC/meam_dens_init.cpp index 39e3ff9467..7a5ee7a651 100644 --- a/src/USER-MEAMC/meam_dens_init.cpp +++ b/src/USER-MEAMC/meam_dens_init.cpp @@ -1,7 +1,21 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "meam.h" -#include -#include "memory.h" + #include "math_special.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-MEAMC/meam_force.cpp b/src/USER-MEAMC/meam_force.cpp index 2b6832e155..eba4f79ea9 100644 --- a/src/USER-MEAMC/meam_force.cpp +++ b/src/USER-MEAMC/meam_force.cpp @@ -1,10 +1,23 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "meam.h" -#include -#include + #include "math_special.h" -using namespace LAMMPS_NS; +#include +#include +using namespace LAMMPS_NS; void MEAM::meam_force(int i, int eflag_either, int eflag_global, int eflag_atom, int vflag_atom, double* eng_vdwl, diff --git a/src/USER-MEAMC/meam_funcs.cpp b/src/USER-MEAMC/meam_funcs.cpp index 706075ffd0..0a632bc40a 100644 --- a/src/USER-MEAMC/meam_funcs.cpp +++ b/src/USER-MEAMC/meam_funcs.cpp @@ -16,7 +16,9 @@ ------------------------------------------------------------------------- */ #include "meam.h" + #include "math_special.h" + #include using namespace LAMMPS_NS; diff --git a/src/USER-MEAMC/meam_impl.cpp b/src/USER-MEAMC/meam_impl.cpp index 0a0b95e14a..a546aa0c7f 100644 --- a/src/USER-MEAMC/meam_impl.cpp +++ b/src/USER-MEAMC/meam_impl.cpp @@ -16,9 +16,11 @@ ------------------------------------------------------------------------- */ #include "meam.h" -#include + #include "memory.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MEAMC/meam_setup_done.cpp b/src/USER-MEAMC/meam_setup_done.cpp index 25f1bb9e81..ddbb40310c 100644 --- a/src/USER-MEAMC/meam_setup_done.cpp +++ b/src/USER-MEAMC/meam_setup_done.cpp @@ -1,9 +1,23 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "meam.h" + +#include "math_special.h" +#include "memory.h" + #include #include #include -#include "math_special.h" -#include "memory.h" using namespace LAMMPS_NS; diff --git a/src/USER-MEAMC/meam_setup_global.cpp b/src/USER-MEAMC/meam_setup_global.cpp index 60264b87cb..93b866a14f 100644 --- a/src/USER-MEAMC/meam_setup_global.cpp +++ b/src/USER-MEAMC/meam_setup_global.cpp @@ -1,5 +1,19 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "meam.h" + #include + using namespace LAMMPS_NS; template diff --git a/src/USER-MEAMC/meam_setup_param.cpp b/src/USER-MEAMC/meam_setup_param.cpp index f0e04ff1c0..f2c44504de 100644 --- a/src/USER-MEAMC/meam_setup_param.cpp +++ b/src/USER-MEAMC/meam_setup_param.cpp @@ -1,5 +1,22 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "meam.h" + +#include "math_const.h" #include +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index b344dee10a..6f674c9f45 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -16,10 +16,10 @@ ------------------------------------------------------------------------- */ #include "pair_meamc.h" -#include -#include + + #include -#include + #include "meam.h" #include "atom.h" #include "force.h" @@ -29,8 +29,8 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; @@ -364,7 +364,7 @@ void PairMEAMC::read_files(const std::string &globalfile, FILE *fp; if (comm->me == 0) { - fp = force->open_potential(globalfile.c_str()); + fp = utils::open_potential(globalfile,lmp,nullptr); if (fp == NULL) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", globalfile)); @@ -563,7 +563,7 @@ void PairMEAMC::read_files(const std::string &globalfile, // open user param file on proc 0 if (comm->me == 0) { - fp = force->open_potential(userfile.c_str()); + fp = utils::open_potential(userfile,lmp,nullptr); if (fp == NULL) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", userfile)); diff --git a/src/USER-MEAMC/pair_meamc.h b/src/USER-MEAMC/pair_meamc.h index 21e44e7ff2..9cbda8f6ad 100644 --- a/src/USER-MEAMC/pair_meamc.h +++ b/src/USER-MEAMC/pair_meamc.h @@ -22,7 +22,7 @@ PairStyle(meam,PairMEAMC) #define LMP_PAIR_MEAMC_H #include "pair.h" -#include + namespace LAMMPS_NS { diff --git a/src/USER-MESODPD/atom_vec_edpd.cpp b/src/USER-MESODPD/atom_vec_edpd.cpp index d08a626fad..1542c73604 100644 --- a/src/USER-MESODPD/atom_vec_edpd.cpp +++ b/src/USER-MESODPD/atom_vec_edpd.cpp @@ -12,16 +12,13 @@ ------------------------------------------------------------------------- */ #include "atom_vec_edpd.h" -#include + #include "atom.h" -#include "comm.h" -#include "domain.h" -#include "modify.h" -#include "fix.h" -#include "update.h" -#include "memory.h" #include "error.h" -#include "utils.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-MESODPD/atom_vec_tdpd.cpp b/src/USER-MESODPD/atom_vec_tdpd.cpp index f50fe168d6..63b88f921d 100644 --- a/src/USER-MESODPD/atom_vec_tdpd.cpp +++ b/src/USER-MESODPD/atom_vec_tdpd.cpp @@ -16,7 +16,7 @@ #include "atom.h" #include "update.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp index 6378ed5ef6..7e9d5eb29e 100644 --- a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp +++ b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp @@ -11,15 +11,16 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "compute_tdpd_cc_atom.h" + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -31,7 +32,7 @@ ComputeTDPDCCAtom::ComputeTDPDCCAtom(LAMMPS *lmp, int narg, char **arg) : if (narg != 4) error->all(FLERR,"Number of arguments for compute tdpd/cc/atom command != 4"); if (atom->tdpd_flag != 1) error->all(FLERR,"compute tdpd/cc/atom command requires atom_style with concentration (e.g. tdpd)"); - index = force->inumeric(FLERR,arg[3]); + index = utils::inumeric(FLERR,arg[3],false,lmp); peratom_flag = 1; size_peratom_cols = 0; diff --git a/src/USER-MESODPD/fix_edpd_source.cpp b/src/USER-MESODPD/fix_edpd_source.cpp index e62d9a8a79..c84f2f29a2 100644 --- a/src/USER-MESODPD/fix_edpd_source.cpp +++ b/src/USER-MESODPD/fix_edpd_source.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_edpd_source.h" -#include -#include + #include "atom.h" #include "error.h" -#include "force.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -38,21 +39,21 @@ FixEDPDSource::FixEDPDSource(LAMMPS *lmp, int narg, char **arg) : if(option == 0){ if (narg != 9 ) error->all(FLERR,"Illegal fix edpd/source command (5 args for sphere)"); - center[0] = force->numeric(FLERR,arg[iarg++]); - center[1] = force->numeric(FLERR,arg[iarg++]); - center[2] = force->numeric(FLERR,arg[iarg++]); - radius = force->numeric(FLERR,arg[iarg++]); - value = force->numeric(FLERR,arg[iarg++]); + center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[2] = utils::numeric(FLERR,arg[iarg++],false,lmp); + radius = utils::numeric(FLERR,arg[iarg++],false,lmp); + value = utils::numeric(FLERR,arg[iarg++],false,lmp); } else if(option == 1){ if (narg != 11 ) error->all(FLERR,"Illegal fix edpd/edpd command (7 args for cuboid)"); - center[0] = force->numeric(FLERR,arg[iarg++]); - center[1] = force->numeric(FLERR,arg[iarg++]); - center[2] = force->numeric(FLERR,arg[iarg++]); - dLx = force->numeric(FLERR,arg[iarg++]); - dLy = force->numeric(FLERR,arg[iarg++]); - dLz = force->numeric(FLERR,arg[iarg++]); - value = force->numeric(FLERR,arg[iarg++]); + center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[2] = utils::numeric(FLERR,arg[iarg++],false,lmp); + dLx = utils::numeric(FLERR,arg[iarg++],false,lmp); + dLy = utils::numeric(FLERR,arg[iarg++],false,lmp); + dLz = utils::numeric(FLERR,arg[iarg++],false,lmp); + value = utils::numeric(FLERR,arg[iarg++],false,lmp); } else error->all(FLERR,"Illegal fix edpd/source command"); } diff --git a/src/USER-MESODPD/fix_mvv_dpd.cpp b/src/USER-MESODPD/fix_mvv_dpd.cpp index 116bbf506a..4e82085baa 100644 --- a/src/USER-MESODPD/fix_mvv_dpd.cpp +++ b/src/USER-MESODPD/fix_mvv_dpd.cpp @@ -39,7 +39,7 @@ FixMvvDPD::FixMvvDPD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix mvv/dpd command"); verlet = 0.5; - if(narg > 3) verlet = force->numeric(FLERR,arg[3]); + if(narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); dynamic_group_allow = 1; time_integrate = 1; diff --git a/src/USER-MESODPD/fix_mvv_edpd.cpp b/src/USER-MESODPD/fix_mvv_edpd.cpp index 3294d8d682..a0a4bac0b7 100644 --- a/src/USER-MESODPD/fix_mvv_edpd.cpp +++ b/src/USER-MESODPD/fix_mvv_edpd.cpp @@ -48,7 +48,7 @@ FixMvvEDPD::FixMvvEDPD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix mvv/edpd command"); verlet = 0.5; - if(narg > 3) verlet = force->numeric(FLERR,arg[3]); + if(narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); dynamic_group_allow = 1; time_integrate = 1; diff --git a/src/USER-MESODPD/fix_mvv_tdpd.cpp b/src/USER-MESODPD/fix_mvv_tdpd.cpp index b7fe37d7ee..87978eebe3 100644 --- a/src/USER-MESODPD/fix_mvv_tdpd.cpp +++ b/src/USER-MESODPD/fix_mvv_tdpd.cpp @@ -44,7 +44,7 @@ FixMvvTDPD::FixMvvTDPD(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix mvv/tdpd command"); verlet = 0.5; - if(narg > 3) verlet = force->numeric(FLERR,arg[3]); + if(narg > 3) verlet = utils::numeric(FLERR,arg[3],false,lmp); cc_species = atom->cc_species; diff --git a/src/USER-MESODPD/fix_tdpd_source.cpp b/src/USER-MESODPD/fix_tdpd_source.cpp index 990f6a5b78..440c5055fb 100644 --- a/src/USER-MESODPD/fix_tdpd_source.cpp +++ b/src/USER-MESODPD/fix_tdpd_source.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_tdpd_source.h" -#include -#include + #include "atom.h" #include "error.h" -#include "force.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -30,7 +31,7 @@ FixTDPDSource::FixTDPDSource(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Illegal fix tdpd/source command"); int iarg = 3; - cc_index = force->inumeric(FLERR,arg[iarg++]); + cc_index = utils::inumeric(FLERR,arg[iarg++],false,lmp); if (strcmp(arg[iarg],"sphere") == 0) option = 0; else if (strcmp(arg[iarg],"cuboid") == 0) option = 1; @@ -39,21 +40,21 @@ FixTDPDSource::FixTDPDSource(LAMMPS *lmp, int narg, char **arg) : if(option == 0){ if (narg != 10 ) error->all(FLERR,"Illegal fix tdpd/source command (5 args for sphere)"); - center[0] = force->numeric(FLERR,arg[iarg++]); - center[1] = force->numeric(FLERR,arg[iarg++]); - center[2] = force->numeric(FLERR,arg[iarg++]); - radius = force->numeric(FLERR,arg[iarg++]); - value = force->numeric(FLERR,arg[iarg++]); + center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[2] = utils::numeric(FLERR,arg[iarg++],false,lmp); + radius = utils::numeric(FLERR,arg[iarg++],false,lmp); + value = utils::numeric(FLERR,arg[iarg++],false,lmp); } else if(option == 1){ if (narg != 12 ) error->all(FLERR,"Illegal fix tdpd/edpd command (7 args for cuboid)"); - center[0] = force->numeric(FLERR,arg[iarg++]); - center[1] = force->numeric(FLERR,arg[iarg++]); - center[2] = force->numeric(FLERR,arg[iarg++]); - dLx = force->numeric(FLERR,arg[iarg++]); - dLy = force->numeric(FLERR,arg[iarg++]); - dLz = force->numeric(FLERR,arg[iarg++]); - value = force->numeric(FLERR,arg[iarg++]); + center[0] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[1] = utils::numeric(FLERR,arg[iarg++],false,lmp); + center[2] = utils::numeric(FLERR,arg[iarg++],false,lmp); + dLx = utils::numeric(FLERR,arg[iarg++],false,lmp); + dLy = utils::numeric(FLERR,arg[iarg++],false,lmp); + dLz = utils::numeric(FLERR,arg[iarg++],false,lmp); + value = utils::numeric(FLERR,arg[iarg++],false,lmp); } else error->all(FLERR,"Illegal fix tdpd/source command"); } diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index c32477513d..9c2e74b882 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_edpd.h" -#include + #include #include #include @@ -31,7 +31,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -270,8 +270,8 @@ void PairEDPD::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); - seed = force->inumeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + seed = utils::inumeric(FLERR,arg[1],false,lmp); // initialize Marsaglia RNG with processor-unique seed @@ -306,16 +306,16 @@ void PairEDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a0_one = force->numeric(FLERR,arg[2]); - double gamma_one = force->numeric(FLERR,arg[3]); - double power_one = force->numeric(FLERR,arg[4]); - double cut_one = force->numeric(FLERR,arg[5]); - double kappa_one = force->numeric(FLERR,arg[6]); - double powerT_one= force->numeric(FLERR,arg[7]); - double cutT_one = force->numeric(FLERR,arg[8]); + double a0_one = utils::numeric(FLERR,arg[2],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[3],false,lmp); + double power_one = utils::numeric(FLERR,arg[4],false,lmp); + double cut_one = utils::numeric(FLERR,arg[5],false,lmp); + double kappa_one = utils::numeric(FLERR,arg[6],false,lmp); + double powerT_one= utils::numeric(FLERR,arg[7],false,lmp); + double cutT_one = utils::numeric(FLERR,arg[8],false,lmp); int iarg = 9; power_flag = kappa_flag = 0; @@ -325,14 +325,14 @@ void PairEDPD::coeff(int narg, char **arg) if (strcmp(arg[iarg],"power") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal pair edpd coefficients"); for (int i = 0; i < 4; i++) - sc_one[i] = force->numeric(FLERR,arg[iarg+i+1]); + sc_one[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); iarg += 5; power_flag = 1; memory->create(sc,n+1,n+1,4,"pair:sc"); } else if (strcmp(arg[iarg],"kappa") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal pair edpd coefficients"); for (int i = 0; i < 4; i++) - kc_one[i] = force->numeric(FLERR,arg[iarg+i+1]); + kc_one[i] = utils::numeric(FLERR,arg[iarg+i+1],false,lmp); iarg += 5; kappa_flag = 1; memory->create(kc,n+1,n+1,4,"pair:kc"); diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 7f98e6da79..88b6724a03 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_mdpd.h" -#include + #include #include #include "atom.h" @@ -30,7 +30,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -211,9 +211,9 @@ void PairMDPD::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - temperature = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); - seed = force->inumeric(FLERR,arg[2]); + temperature = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); + seed = utils::inumeric(FLERR,arg[2],false,lmp); // initialize Marsaglia RNG with processor-unique seed @@ -245,14 +245,14 @@ void PairMDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double A_one = force->numeric(FLERR,arg[2]); - double B_one = force->numeric(FLERR,arg[3]); - double gamma_one = force->numeric(FLERR,arg[4]); - double cut_one = force->numeric(FLERR,arg[5]); - double cut_two = force->numeric(FLERR,arg[6]); + double A_one = utils::numeric(FLERR,arg[2],false,lmp); + double B_one = utils::numeric(FLERR,arg[3],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[4],false,lmp); + double cut_one = utils::numeric(FLERR,arg[5],false,lmp); + double cut_two = utils::numeric(FLERR,arg[6],false,lmp); if(cut_one < cut_two) error->all(FLERR,"Incorrect args for pair coefficients\n cutA should be larger than cutB."); diff --git a/src/USER-MESODPD/pair_mdpd_rhosum.cpp b/src/USER-MESODPD/pair_mdpd_rhosum.cpp index 05cb123f61..2f25177b0a 100644 --- a/src/USER-MESODPD/pair_mdpd_rhosum.cpp +++ b/src/USER-MESODPD/pair_mdpd_rhosum.cpp @@ -20,16 +20,17 @@ ------------------------------------------------------------------------- */ #include "pair_mdpd_rhosum.h" -#include + #include "atom.h" -#include "force.h" #include "comm.h" +#include "error.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" #include "neighbor.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -196,10 +197,10 @@ void PairMDPDRhoSum::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double cut_one = force->numeric(FLERR,arg[2]); + double cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index f5350de53d..65a518c07e 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -29,7 +29,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -233,9 +233,9 @@ void PairTDPD::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - temperature = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); - seed = force->inumeric(FLERR,arg[2]); + temperature = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); + seed = utils::inumeric(FLERR,arg[2],false,lmp); // initialize Marsaglia RNG with processor-unique seed @@ -269,21 +269,21 @@ void PairTDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a0_one = force->numeric(FLERR,arg[2]); - double gamma_one = force->numeric(FLERR,arg[3]); - double power_one = force->numeric(FLERR,arg[4]); - double cut_one = force->numeric(FLERR,arg[5]); - double cutcc_one = force->numeric(FLERR,arg[6]); + double a0_one = utils::numeric(FLERR,arg[2],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[3],false,lmp); + double power_one = utils::numeric(FLERR,arg[4],false,lmp); + double cut_one = utils::numeric(FLERR,arg[5],false,lmp); + double cutcc_one = utils::numeric(FLERR,arg[6],false,lmp); double *kappa_one = new double[cc_species]; double *epsilon_one = new double[cc_species]; double *powercc_one = new double[cc_species]; for(int k=0; knumeric(FLERR,arg[7+3*k]); - epsilon_one[k] = force->numeric(FLERR,arg[8+3*k]); - powercc_one[k] = force->numeric(FLERR,arg[9+3*k]); + kappa_one[k] = utils::numeric(FLERR,arg[7+3*k],false,lmp); + epsilon_one[k] = utils::numeric(FLERR,arg[8+3*k],false,lmp); + powercc_one[k] = utils::numeric(FLERR,arg[9+3*k],false,lmp); } int count = 0; diff --git a/src/USER-MESONT/compute_mesont.cpp b/src/USER-MESONT/compute_mesont.cpp index 397b071a1b..96792c8988 100644 --- a/src/USER-MESONT/compute_mesont.cpp +++ b/src/USER-MESONT/compute_mesont.cpp @@ -23,7 +23,7 @@ #include "memory.h" #include "error.h" #include "pair.h" -#include + using namespace LAMMPS_NS; diff --git a/src/USER-MESONT/pair_mesocnt.cpp b/src/USER-MESONT/pair_mesocnt.cpp index f486814feb..96d53bd41a 100644 --- a/src/USER-MESONT/pair_mesocnt.cpp +++ b/src/USER-MESONT/pair_mesocnt.cpp @@ -20,9 +20,9 @@ #include #include -#include + #include -#include + #include "atom.h" #include "comm.h" @@ -33,8 +33,8 @@ #include "memory.h" #include "error.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + + #include "math_const.h" #include "math_extra.h" @@ -759,7 +759,7 @@ void PairMesoCNT::read_file() // open file - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) error->one(FLERR,fmt::format("Cannot open mesocnt file: {}",file)); diff --git a/src/USER-MESONT/pair_mesont_tpm.cpp b/src/USER-MESONT/pair_mesont_tpm.cpp index d46fcad813..6d8c8126ae 100644 --- a/src/USER-MESONT/pair_mesont_tpm.cpp +++ b/src/USER-MESONT/pair_mesont_tpm.cpp @@ -16,7 +16,7 @@ #include "pair_mesont_tpm.h" #include "export_mesont.h" -#include + #include "atom.h" #include "comm.h" #include "force.h" @@ -29,7 +29,7 @@ #include #include #include -#include + #include #include #include @@ -586,7 +586,7 @@ void PairMESONTTPM::allocate(){ void PairMESONTTPM::settings(int narg, char **arg){ if ((narg == 0) || (narg > 4)) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set if (allocated) { @@ -604,12 +604,12 @@ void PairMESONTTPM::settings(int narg, char **arg){ mesont_lib_SetTablePath(tab_path, tab_path_length); if (narg > 2) { - BendingMode = force->numeric(FLERR,arg[2]); + BendingMode = utils::numeric(FLERR,arg[2],false,lmp); if ((BendingMode < 0) || (BendingMode > 1)) error->all(FLERR,"Incorrect BendingMode"); } if (narg > 3) { - TPMType = force->numeric(FLERR,arg[3]); + TPMType = utils::numeric(FLERR,arg[3],false,lmp); if ((TPMType < 0) || (TPMType > 1)) error->all(FLERR,"Incorrect TPMType"); } @@ -639,11 +639,11 @@ void PairMESONTTPM::coeff(int narg, char **arg){ if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; - if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); + if (narg == 3) cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 213f73f05a..070e3cb61e 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -22,9 +22,9 @@ ------------------------------------------------------------------------- */ #include "pair_mgpt.h" -#include + #include -#include + #include #include @@ -1904,8 +1904,8 @@ void PairMGPT::coeff(int narg, char **arg) printf("Volumetric pressure is %s.\n",volpres_flag ? "on" : "off"); if(comm->me == 0) { - FILE *parmin_fp = force->open_potential(arg[2]); - FILE *potin_fp = force->open_potential(arg[3]); + FILE *parmin_fp = utils::open_potential(arg[2],lmp,nullptr); + FILE *potin_fp = utils::open_potential(arg[3],lmp,nullptr); if (parmin_fp == NULL || potin_fp == NULL) { char str[128]; sprintf(str,"Cannot open MGPT potential files %s %s",arg[2],arg[3]); diff --git a/src/USER-MISC/README b/src/USER-MISC/README index d0f1266a93..ffb1210efa 100644 --- a/src/USER-MISC/README +++ b/src/USER-MISC/README @@ -63,6 +63,7 @@ fix momentum/chunk, Jiang Xiao (Hong Kong Polytechnic University), polyu-xiao.ji fix npt/cauchy, R. E. Miller (Carleton University), F. Pavia and S. Pattamatta, 12 Jan 2020 fix nvk, Efrem Braun (UC Berkeley), efrem.braun at gmail.com, https://github.com/lammps/lammps/pull/310 fix orient/eco Adrian A. Schratt and Volker Mohles (Ruhr-Uni Bochum), volker.mohles at rub.de, 6 Jun 2020 +fix pafi, Thomas Swinburne (CNRS), swinburne at cinam.univ-mrs.fr, 1st Sep 2020 fix pimd, Yuxing Peng (U Chicago), yuxing at uchicago.edu, 24 Nov 2014 fix propel/self, Stefan Paquay (Brandeis U), stefanpaquay at gmail.com, 20 Jan 2020 fix rhok, Ulf Pedersen (Roskilde U), ulf at urp.dk, 25 Sep 2017 diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index 59f7555709..a986cb8322 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_cosine_shift.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -175,10 +175,10 @@ void AngleCosineShift::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double umin = force->numeric(FLERR,arg[1]); - double theta0 = force->numeric(FLERR,arg[2]); + double umin = utils::numeric(FLERR,arg[1],false,lmp); + double theta0 = utils::numeric(FLERR,arg[2],false,lmp); // k=Umin/2 diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index ef5a2824b9..52bfe751f1 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_cosine_shift_exp.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -203,11 +203,11 @@ void AngleCosineShiftExp::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double umin_ = force->numeric(FLERR,arg[1]); - double theta0_ = force->numeric(FLERR,arg[2]); - double a_ = force->numeric(FLERR,arg[3]); + double umin_ = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_ = utils::numeric(FLERR,arg[2],false,lmp); + double a_ = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index e2fd7e618f..336638f25d 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_dipole.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -160,10 +160,10 @@ void AngleDipole::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double gamma0_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double gamma0_one = utils::numeric(FLERR,arg[2],false,lmp); // convert gamma0 from degrees to radians diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index f83c9c4f88..907ee973bd 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "angle_fourier.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -179,12 +179,12 @@ void AngleFourier::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double C0_one = force->numeric(FLERR,arg[2]); - double C1_one = force->numeric(FLERR,arg[3]); - double C2_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double C0_one = utils::numeric(FLERR,arg[2],false,lmp); + double C1_one = utils::numeric(FLERR,arg[3],false,lmp); + double C2_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index baf4953760..8894f7b4c9 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "angle_fourier_simple.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -193,11 +193,11 @@ void AngleFourierSimple::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double C_one = force->numeric(FLERR,arg[2]); - double N_one = force->numeric(FLERR,arg[3]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double C_one = utils::numeric(FLERR,arg[2],false,lmp); + double N_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index 097e774f17..93f45f9562 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "angle_quartic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -183,12 +183,12 @@ void AngleQuartic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double theta0_one = force->numeric(FLERR,arg[1]); - double k2_one = force->numeric(FLERR,arg[2]); - double k3_one = force->numeric(FLERR,arg[3]); - double k4_one = force->numeric(FLERR,arg[4]); + double theta0_one = utils::numeric(FLERR,arg[1],false,lmp); + double k2_one = utils::numeric(FLERR,arg[2],false,lmp); + double k3_one = utils::numeric(FLERR,arg[3],false,lmp); + double k4_one = utils::numeric(FLERR,arg[4],false,lmp); // convert theta0 from degrees to radians diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index cbcc33a824..5889400b97 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "bond_harmonic_shift.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -24,7 +24,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -128,11 +128,11 @@ void BondHarmonicShift::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double Umin = force->numeric(FLERR,arg[1]); // energy at minimum - double r0_one = force->numeric(FLERR,arg[2]); // position of minimum - double r1_one = force->numeric(FLERR,arg[3]); // position where energy = 0 + double Umin = utils::numeric(FLERR,arg[1],false,lmp); // energy at minimum + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); // position of minimum + double r1_one = utils::numeric(FLERR,arg[3],false,lmp); // position where energy = 0 if (r0_one == r1_one) error->all(FLERR,"Bond harmonic/shift r0 and r1 must be different"); diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index aa051f4bec..86e6263f93 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "bond_harmonic_shift_cut.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -24,7 +24,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -130,11 +130,11 @@ void BondHarmonicShiftCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double Umin = force->numeric(FLERR,arg[1]); // energy at minimum - double r0_one = force->numeric(FLERR,arg[2]); // position of minimum - double r1_one = force->numeric(FLERR,arg[3]); // position where energy = 0 = cutoff + double Umin = utils::numeric(FLERR,arg[1],false,lmp); // energy at minimum + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); // position of minimum + double r1_one = utils::numeric(FLERR,arg[3],false,lmp); // position where energy = 0 = cutoff if (r0_one == r1_one) error->all(FLERR,"Bond harmonic/shift/cut r0 and r1 must be different"); diff --git a/src/USER-MISC/bond_special.cpp b/src/USER-MISC/bond_special.cpp index 31ebbaa406..87671655b1 100644 --- a/src/USER-MISC/bond_special.cpp +++ b/src/USER-MISC/bond_special.cpp @@ -13,18 +13,15 @@ Contributing Author: David Nicholson (MIT) ------------------------------------------------------------------------- */ -#include -#include -#include #include "bond_special.h" + #include "atom.h" -#include "neighbor.h" -#include "domain.h" #include "comm.h" -#include "force.h" -#include "pair.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "memory.h" +#include "neighbor.h" +#include "pair.h" using namespace LAMMPS_NS; @@ -143,10 +140,10 @@ void BondSpecial::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double factor_lj_one = force->numeric(FLERR,arg[1]); - double factor_coul_one = force->numeric(FLERR,arg[2]); + double factor_lj_one = utils::numeric(FLERR,arg[1],false,lmp); + double factor_coul_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/bond_special.h b/src/USER-MISC/bond_special.h index 389990b1d7..d5e360ca53 100644 --- a/src/USER-MISC/bond_special.h +++ b/src/USER-MISC/bond_special.h @@ -22,7 +22,6 @@ BondStyle(special,BondSpecial) #ifndef LMP_BOND_SPECIAL_H #define LMP_BOND_SPECIAL_H -#include #include "bond.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/compute_cnp_atom.cpp b/src/USER-MISC/compute_cnp_atom.cpp index 34882b0272..52656ec9d6 100644 --- a/src/USER-MISC/compute_cnp_atom.cpp +++ b/src/USER-MISC/compute_cnp_atom.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ #include "compute_cnp_atom.h" -#include + #include #include #include "atom.h" @@ -56,7 +56,7 @@ ComputeCNPAtom::ComputeCNPAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; size_peratom_cols = 0; - double cutoff = force->numeric(FLERR,arg[3]); + double cutoff = utils::numeric(FLERR,arg[3],false,lmp); if (cutoff < 0.0) error->all(FLERR,"Illegal compute cnp/atom command"); cutsq = cutoff*cutoff; diff --git a/src/USER-MISC/compute_entropy_atom.cpp b/src/USER-MISC/compute_entropy_atom.cpp index 2641ec9313..d539d51e99 100644 --- a/src/USER-MISC/compute_entropy_atom.cpp +++ b/src/USER-MISC/compute_entropy_atom.cpp @@ -55,10 +55,10 @@ ComputeEntropyAtom(LAMMPS *lmp, int narg, char **arg) : // local is optional and allows using the local density to normalize // the g(r) - sigma = force->numeric(FLERR,arg[3]); + sigma = utils::numeric(FLERR,arg[3],false,lmp); if (sigma <= 0.0) error->all(FLERR,"Illegal compute entropy/atom" " command; sigma must be positive"); - cutoff = force->numeric(FLERR,arg[4]); + cutoff = utils::numeric(FLERR,arg[4],false,lmp); if (cutoff <= 0.0) error->all(FLERR,"Illegal compute entropy/atom" " command; cutoff must be positive"); @@ -77,7 +77,7 @@ ComputeEntropyAtom(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"no") == 0) avg_flag = 0; else error->all(FLERR,"Illegal compute entropy/atom;" " argument after avg should be yes or no"); - cutoff2 = force->numeric(FLERR,arg[iarg+2]); + cutoff2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (cutoff2 < 0.0) error->all(FLERR,"Illegal compute entropy/atom" " command; negative cutoff2"); cutsq2 = cutoff2*cutoff2; diff --git a/src/USER-MISC/compute_hma.cpp b/src/USER-MISC/compute_hma.cpp index d1f3e6b6f8..f2ccf2694d 100644 --- a/src/USER-MISC/compute_hma.cpp +++ b/src/USER-MISC/compute_hma.cpp @@ -43,33 +43,30 @@ properties of crystals by molecular simulation”, Phys. Rev. E 92, 043303 (2015 https://doi.org/10.1103/PhysRevE.92.043303 ------------------------------------------------------------------------- */ -#include -#include -#include #include "compute_hma.h" -#include "atom.h" -#include "update.h" -#include "force.h" -#include "pair.h" -#include "bond.h" + #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" #include "dihedral.h" -#include "improper.h" -#include "kspace.h" -#include "group.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_store.h" +#include "force.h" +#include "group.h" +#include "improper.h" +#include "kspace.h" #include "memory.h" -#include "error.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_request.h" +#include "modify.h" #include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" -#include - +#include using namespace LAMMPS_NS; @@ -145,7 +142,7 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal compute hma command"); if (computeP>-1) continue; computeP = size_vector; - deltaPcap = force->numeric(FLERR, arg[iarg+1]); + deltaPcap = utils::numeric(FLERR, arg[iarg+1],false,lmp); extlist[size_vector] = 0; size_vector++; iarg++; diff --git a/src/USER-MISC/compute_momentum.cpp b/src/USER-MISC/compute_momentum.cpp index 541b52d9c0..f1c35993e3 100644 --- a/src/USER-MISC/compute_momentum.cpp +++ b/src/USER-MISC/compute_momentum.cpp @@ -1,6 +1,6 @@ #include "compute_momentum.h" -#include + #include "atom.h" #include "error.h" #include "update.h" diff --git a/src/USER-MISC/compute_pressure_cylinder.cpp b/src/USER-MISC/compute_pressure_cylinder.cpp index 6d2509d685..6cf375dd19 100644 --- a/src/USER-MISC/compute_pressure_cylinder.cpp +++ b/src/USER-MISC/compute_pressure_cylinder.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_pressure_cylinder.h" -#include + #include #include "atom.h" #include "update.h" @@ -56,10 +56,10 @@ ComputePressureCyl::ComputePressureCyl(LAMMPS *lmp, int narg, char **arg) : if (lmp->citeme) lmp->citeme->add(cite_compute_pressure_cylinder); if (narg != 7) error->all(FLERR,"Illegal compute pressure/cylinder command"); - zlo=force->numeric(FLERR,arg[3]); - zhi=force->numeric(FLERR,arg[4]); - Rmax=force->numeric(FLERR,arg[5]); - bin_width=force->numeric(FLERR,arg[6]); + zlo=utils::numeric(FLERR,arg[3],false,lmp); + zhi=utils::numeric(FLERR,arg[4],false,lmp); + Rmax=utils::numeric(FLERR,arg[5],false,lmp); + bin_width=utils::numeric(FLERR,arg[6],false,lmp); if ((bin_width <= 0.0) || (bin_width > Rmax)) error->all(FLERR,"Illegal compute pressure/cylinder command"); diff --git a/src/USER-MISC/compute_stress_mop.cpp b/src/USER-MISC/compute_stress_mop.cpp index c403ed3247..c733c929ba 100644 --- a/src/USER-MISC/compute_stress_mop.cpp +++ b/src/USER-MISC/compute_stress_mop.cpp @@ -16,7 +16,7 @@ --------------------------------------------------------------------------*/ #include "compute_stress_mop.h" -#include + #include #include @@ -65,7 +65,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : pos = domain->boxhi[dir]; } else if (strcmp(arg[4],"center")==0) { pos = 0.5*(domain->boxlo[dir]+domain->boxhi[dir]); - } else pos = force->numeric(FLERR,arg[4]); + } else pos = utils::numeric(FLERR,arg[4],false,lmp); if ( pos < (domain->boxlo[dir]+domain->prd_half[dir]) ) { pos1 = pos + domain->prd[dir]; diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 9649a61090..323aee851e 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -16,7 +16,7 @@ --------------------------------------------------------------------------*/ #include "compute_stress_mop_profile.h" -#include + #include #include @@ -65,8 +65,8 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a else if (strcmp(arg[4],"upper") == 0) originflag = UPPER; else originflag = COORD; if (originflag == COORD) - origin = force->numeric(FLERR,arg[4]); - delta = force->numeric(FLERR,arg[5]); + origin = utils::numeric(FLERR,arg[4],false,lmp); + delta = utils::numeric(FLERR,arg[5],false,lmp); invdelta = 1.0/delta; // parse values until one isn't recognized diff --git a/src/USER-MISC/compute_temp_rotate.cpp b/src/USER-MISC/compute_temp_rotate.cpp index 94c6115186..c333357a93 100644 --- a/src/USER-MISC/compute_temp_rotate.cpp +++ b/src/USER-MISC/compute_temp_rotate.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_rotate.h" -#include + #include "atom.h" #include "update.h" #include "force.h" diff --git a/src/USER-MISC/compute_viscosity_cos.cpp b/src/USER-MISC/compute_viscosity_cos.cpp index 7311f991cc..dae93a8d81 100644 --- a/src/USER-MISC/compute_viscosity_cos.cpp +++ b/src/USER-MISC/compute_viscosity_cos.cpp @@ -15,17 +15,18 @@ Contributing author: Zheng GONG (ENS de Lyon, z.gong@outlook.com) ------------------------------------------------------------------------- */ -#include #include "compute_viscosity_cos.h" + #include "atom.h" #include "update.h" #include "force.h" #include "domain.h" -#include "comm.h" #include "group.h" #include "error.h" #include "math_const.h" +#include + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 0537e555a2..7c131682fa 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_cosine_shift_exp.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "memory.h" #include "math_const.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -276,11 +276,11 @@ void DihedralCosineShiftExp::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double umin_ = force->numeric(FLERR,arg[1]); - double theta0_ = force->numeric(FLERR,arg[2]); - double a_ = force->numeric(FLERR,arg[3]); + double umin_ = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_ = utils::numeric(FLERR,arg[2],false,lmp); + double a_ = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index f30a5e1eab..066447f92d 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_fourier.h" -#include + #include #include "atom.h" #include "comm.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -297,7 +297,7 @@ void DihedralFourier::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // require integer values of shift for backwards compatibility // arbitrary phase angle shift could be allowed, but would break @@ -306,7 +306,7 @@ void DihedralFourier::coeff(int narg, char **arg) double k_one; int multiplicity_one; double shift_one; - int nterms_one = force->inumeric(FLERR,arg[1]); + int nterms_one = utils::inumeric(FLERR,arg[1],false,lmp); if (nterms_one < 1) error->all(FLERR,"Incorrect number of terms arg for dihedral coefficients"); @@ -324,9 +324,9 @@ void DihedralFourier::coeff(int narg, char **arg) sin_shift[i] = new double [nterms_one]; for (int j = 0; jnumeric(FLERR,arg[offset+1]); - multiplicity_one = force->inumeric(FLERR,arg[offset+2]); - shift_one = force->numeric(FLERR,arg[offset+3]); + k_one = utils::numeric(FLERR,arg[offset+1],false,lmp); + multiplicity_one = utils::inumeric(FLERR,arg[offset+2],false,lmp); + shift_one = utils::numeric(FLERR,arg[offset+3],false,lmp); k[i][j] = k_one; multiplicity[i][j] = multiplicity_one; shift[i][j] = shift_one; diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index 81010a040e..bde8d84070 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_nharmonic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -277,21 +277,21 @@ void DihedralNHarmonic::coeff(int narg, char **arg) { if (narg < 4 ) error->all(FLERR,"Incorrect args for dihedral coefficients"); - int n = force->inumeric(FLERR,arg[1]); + int n = utils::inumeric(FLERR,arg[1],false,lmp); if (narg != n + 2) error->all(FLERR,"Incorrect args for dihedral coefficients"); if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { a[i] = new double [n]; nterms[i] = n; for (int j = 0; j < n; j++ ) { - a[i][j] = force->numeric(FLERR,arg[2+j]); + a[i][j] = utils::numeric(FLERR,arg[2+j],false,lmp); setflag[i] = 1; } count++; diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index 28efad65b7..deafc8391f 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_quadratic.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -27,7 +27,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -287,10 +287,10 @@ void DihedralQuadratic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double phi0_one= force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double phi0_one= utils::numeric(FLERR,arg[2],false,lmp); // require k >= 0 if (k_one < 0.0) diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index c72570c494..15bb458c48 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -18,21 +18,20 @@ ------------------------------------------------------------------------- */ #include "dihedral_spherical.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "neighbor.h" #include "domain.h" +#include "error.h" #include "force.h" #include "math_const.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "neighbor.h" + +#include +#include -using namespace std; using namespace LAMMPS_NS; using namespace MathConst; using namespace MathExtra; @@ -681,9 +680,9 @@ void DihedralSpherical::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - int nterms_one = force->inumeric(FLERR,arg[1]); + int nterms_one = utils::inumeric(FLERR,arg[1],false,lmp); if (nterms_one < 1) error->all(FLERR,"Incorrect number of terms arg for dihedral coefficients"); @@ -706,16 +705,16 @@ void DihedralSpherical::coeff(int narg, char **arg) theta2_offset[i] = new double [nterms_one]; for (int j = 0; j < nterms_one; j++) { int offset = 1+10*j; - Ccoeff[i][j] = force->numeric(FLERR,arg[offset+1]); - phi_mult[i][j] = force->numeric(FLERR,arg[offset+2]); - phi_shift[i][j] = force->numeric(FLERR,arg[offset+3]) * MY_PI/180.0; - phi_offset[i][j] = force->numeric(FLERR,arg[offset+4]); - theta1_mult[i][j] = force->numeric(FLERR,arg[offset+5]); - theta1_shift[i][j] = force->numeric(FLERR,arg[offset+6]) * MY_PI/180.0; - theta1_offset[i][j] = force->numeric(FLERR,arg[offset+7]); - theta2_mult[i][j] = force->numeric(FLERR,arg[offset+8]); - theta2_shift[i][j] = force->numeric(FLERR,arg[offset+9]) * MY_PI/180.0; - theta2_offset[i][j] = force->numeric(FLERR,arg[offset+10]); + Ccoeff[i][j] = utils::numeric(FLERR,arg[offset+1],false,lmp); + phi_mult[i][j] = utils::numeric(FLERR,arg[offset+2],false,lmp); + phi_shift[i][j] = utils::numeric(FLERR,arg[offset+3],false,lmp) * MY_PI/180.0; + phi_offset[i][j] = utils::numeric(FLERR,arg[offset+4],false,lmp); + theta1_mult[i][j] = utils::numeric(FLERR,arg[offset+5],false,lmp); + theta1_shift[i][j] = utils::numeric(FLERR,arg[offset+6],false,lmp) * MY_PI/180.0; + theta1_offset[i][j] = utils::numeric(FLERR,arg[offset+7],false,lmp); + theta2_mult[i][j] = utils::numeric(FLERR,arg[offset+8],false,lmp); + theta2_shift[i][j] = utils::numeric(FLERR,arg[offset+9],false,lmp) * MY_PI/180.0; + theta2_offset[i][j] = utils::numeric(FLERR,arg[offset+10],false,lmp); } setflag[i] = 1; count++; diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 9fd3679106..91a8642b10 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -17,33 +17,24 @@ the "tridiag.c" written by Gerard Jungman for GSL ------------------------------------------------------------------------- */ -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: keep -#include // IWYU pragma: keep +#include "dihedral_table.h" #include "atom.h" #include "comm.h" -#include "neighbor.h" #include "domain.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "dihedral_table.h" -#include "utils.h" -#include "tokenizer.h" -#include "table_file_reader.h" -#include "fmt/format.h" - +#include "force.h" #include "math_const.h" #include "math_extra.h" +#include "memory.h" +#include "neighbor.h" +#include "table_file_reader.h" +#include "tokenizer.h" + +#include +#include +#include // IWYU pragma: keep -using namespace std; using namespace LAMMPS_NS; using namespace MathConst; using namespace MathExtra; @@ -782,7 +773,7 @@ void DihedralTable::settings(int narg, char **arg) else if (strcmp(arg[0],"spline") == 0) tabstyle = SPLINE; else error->all(FLERR,"Unknown table style in dihedral style table"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 3) error->all(FLERR,"Illegal number of dihedral table entries"); // delete old tables, since cannot just change settings @@ -813,7 +804,7 @@ void DihedralTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int me; MPI_Comm_rank(world,&me); @@ -829,28 +820,20 @@ void DihedralTable::coeff(int narg, char **arg) // --- and resolve issues with periodicity --- if (tb->ninput < 2) { - string err_msg; - err_msg = string("Invalid dihedral table length (") - + string(arg[2]) + string(")."); - error->one(FLERR,err_msg); - } - else if ((tb->ninput == 2) && (tabstyle == SPLINE)) { - string err_msg; - err_msg = string("Invalid dihedral spline table length. (Try linear)\n (") - + string(arg[2]) + string(")."); - error->one(FLERR,err_msg); + error->one(FLERR,fmt::format("Invalid dihedral table length ({}).", + arg[2])); + } else if ((tb->ninput == 2) && (tabstyle == SPLINE)) { + error->one(FLERR,fmt::format("Invalid dihedral spline table length. " + "(Try linear)\n ({}).",arg[2])); } // check for monotonicity for (int i=0; i < tb->ninput-1; i++) { if (tb->phifile[i] >= tb->phifile[i+1]) { - stringstream i_str; - i_str << i+1; - string err_msg = - string("Dihedral table values are not increasing (") + - string(arg[2]) + string(", ")+i_str.str()+string("th entry)"); + auto err_msg = fmt::format("Dihedral table values are not increasing " + "({}, {}th entry)",arg[2],i+1); if (i==0) - err_msg += string("\n(This is probably a mistake with your table format.)\n"); + err_msg += std::string("\n(This is probably a mistake with your table format.)\n"); error->all(FLERR,err_msg); } } @@ -859,20 +842,13 @@ void DihedralTable::coeff(int narg, char **arg) double philo = tb->phifile[0]; double phihi = tb->phifile[tb->ninput-1]; if (tb->use_degrees) { - if ((phihi - philo) >= 360) { - string err_msg; - err_msg = string("Dihedral table angle range must be < 360 degrees (") - +string(arg[2]) + string(")."); - error->all(FLERR,err_msg); - } - } - else { - if ((phihi - philo) >= MY_2PI) { - string err_msg; - err_msg = string("Dihedral table angle range must be < 2*PI radians (") - + string(arg[2]) + string(")."); - error->all(FLERR,err_msg); - } + if ((phihi - philo) >= 360) + error->all(FLERR,fmt::format("Dihedral table angle range must be < 360 " + "degrees ({}).",arg[2])); + } else { + if ((phihi - philo) >= MY_2PI) + error->all(FLERR,fmt::format("Dihedral table angle range must be < 2*PI " + "radians ({}).",arg[2])); } // convert phi from degrees to radians @@ -940,10 +916,9 @@ void DihedralTable::coeff(int narg, char **arg) // Optional: allow the user to print out the interpolated spline tables if (me == 0) { - if (!checkU_fname.empty()) - { - ofstream checkU_file; - checkU_file.open(checkU_fname, ios::out); + if (!checkU_fname.empty()) { + std::ofstream checkU_file; + checkU_file.open(checkU_fname, std::ios::out); for (int i=0; i < tablength; i++) { double phi = i*MY_2PI/tablength; double u = tb->e[i]; @@ -953,12 +928,10 @@ void DihedralTable::coeff(int narg, char **arg) } checkU_file.close(); } - if (!checkF_fname.empty()) - { - ofstream checkF_file; - checkF_file.open(checkF_fname, ios::out); - for (int i=0; i < tablength; i++) - { + if (!checkF_fname.empty()) { + std::ofstream checkF_file; + checkF_file.open(checkF_fname, std::ios::out); + for (int i=0; i < tablength; i++) { double phi = i*MY_2PI/tablength; double f; if ((tabstyle == SPLINE) && (tb->f_unspecified)) { @@ -973,8 +946,7 @@ void DihedralTable::coeff(int narg, char **arg) // To be nice and report something, I do the same thing here.) cyc_splintD(tb->phi, tb->e, tb->e2, tablength, MY_2PI,phi); f = -dU_dphi; - } - else + } else // Otherwise we calculated the tb->f[] array. Report its contents. f = tb->f[i]; if (tb->use_degrees) { @@ -991,8 +963,7 @@ void DihedralTable::coeff(int narg, char **arg) // store ptr to table in tabindex int count = 0; - for (int i = ilo; i <= ihi; i++) - { + for (int i = ilo; i <= ihi; i++) { tabindex[i] = ntables; //phi0[i] = tb->phi0; <- equilibrium dihedral angles not supported setflag[i] = 1; @@ -1213,7 +1184,7 @@ void DihedralTable::spline_table(Table *tb) } // for (int i=0; ininput; i++) if ((num_disagreements > tb->ninput/2) && (num_disagreements > 2)) { - string msg("Dihedral table has inconsistent forces and energies. (Try \"NOF\".)\n"); + std::string msg("Dihedral table has inconsistent forces and energies. (Try \"NOF\".)\n"); error->all(FLERR, msg); } @@ -1319,7 +1290,7 @@ void DihedralTable::param_extract(Table *tb, char *line) ValueTokenizer values(line); while (values.has_next()) { - std::string word = values.next_string(); + auto word = values.next_string(); if (word == "N") { tb->ninput = values.next_int(); } @@ -1342,10 +1313,8 @@ void DihedralTable::param_extract(Table *tb, char *line) //else if (word == "EQ") { // tb->theta0 = values.next_double(); //} - else { - string err_msg = fmt::format("Invalid keyword in dihedral angle table parameters ({})", word); - error->one(FLERR,err_msg); - } + else error->one(FLERR,fmt::format("Invalid keyword in dihedral angle " + "table parameters ({})", word)); } } catch (TokenizerException & e) { error->one(FLERR, e.what()); diff --git a/src/USER-MISC/dihedral_table.h b/src/USER-MISC/dihedral_table.h index 8a397b20f2..a8d1f8f8bb 100644 --- a/src/USER-MISC/dihedral_table.h +++ b/src/USER-MISC/dihedral_table.h @@ -24,7 +24,7 @@ DihedralStyle(table,DihedralTable) #ifndef LMP_DIHEDRAL_TABLE_H #define LMP_DIHEDRAL_TABLE_H #include "dihedral.h" -#include + namespace LAMMPS_NS { diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index e2283633bc..f8a2f02596 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -17,12 +17,12 @@ ------------------------------------------------------------------------- */ #include "dihedral_table_cut.h" -#include + #include #include -#include + #include -#include + #include // IWYU pragma: keep #include // IWYU pragma: keep @@ -35,7 +35,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -764,7 +764,7 @@ void DihedralTableCut::settings(int narg, char **arg) else if (strcmp(arg[0],"spline") == 0) tabstyle = SPLINE; else error->all(FLERR,"Unknown table style in dihedral style table_cut"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 3) error->all(FLERR,"Illegal number of dihedral table entries"); // delete old tables, since cannot just change settings @@ -794,11 +794,11 @@ void DihedralTableCut::coeff(int narg, char **arg) if (narg != 7) error->all(FLERR,"Incorrect args for dihedral coefficients"); if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[2]); - double theta0_1_one = force->numeric(FLERR,arg[3]); - double theta0_2_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[2],false,lmp); + double theta0_1_one = utils::numeric(FLERR,arg[3],false,lmp); + double theta0_2_one = utils::numeric(FLERR,arg[4],false,lmp); // convert theta0's from degrees to radians @@ -1078,7 +1078,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // open file - FILE *fp = force->open_potential(file); + FILE *fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { string err_msg = string("Cannot open file ") + string(file); error->one(FLERR,err_msg); diff --git a/src/USER-MISC/fix_accelerate_cos.cpp b/src/USER-MISC/fix_accelerate_cos.cpp index 88e33023fd..4c15685556 100644 --- a/src/USER-MISC/fix_accelerate_cos.cpp +++ b/src/USER-MISC/fix_accelerate_cos.cpp @@ -16,19 +16,15 @@ ------------------------------------------------------------------------- */ #include "fix_accelerate_cos.h" + #include "atom.h" -#include "update.h" -#include "modify.h" #include "domain.h" -#include "region.h" -#include "respa.h" -#include "input.h" -#include "variable.h" -#include "memory.h" #include "error.h" #include "force.h" #include "math_const.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; @@ -37,7 +33,7 @@ using namespace FixConst; FixAccelerateCos::FixAccelerateCos(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR, "Illegal fix accelerate/cos command"); - acceleration = force->numeric(FLERR, arg[3]); + acceleration = utils::numeric(FLERR, arg[3],false,lmp); if (domain->dimension == 2) error->all(FLERR,"Fix accelerate/cos cannot be used with 2d systems"); } diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index 665f1d4a60..ed796280e7 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_addtorque.h" -#include + #include #include "atom.h" #include "update.h" @@ -58,7 +58,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : xstr = new char[n]; strcpy(xstr,&arg[3][2]); } else { - xvalue = force->numeric(FLERR,arg[3]); + xvalue = utils::numeric(FLERR,arg[3],false,lmp); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -66,7 +66,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : ystr = new char[n]; strcpy(ystr,&arg[4][2]); } else { - yvalue = force->numeric(FLERR,arg[4]); + yvalue = utils::numeric(FLERR,arg[4],false,lmp); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -74,7 +74,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : zstr = new char[n]; strcpy(zstr,&arg[5][2]); } else { - zvalue = force->numeric(FLERR,arg[5]); + zvalue = utils::numeric(FLERR,arg[5],false,lmp); zstyle = CONSTANT; } diff --git a/src/USER-MISC/fix_ave_correlate_long.cpp b/src/USER-MISC/fix_ave_correlate_long.cpp index 4d548d585a..d92789f03f 100644 --- a/src/USER-MISC/fix_ave_correlate_long.cpp +++ b/src/USER-MISC/fix_ave_correlate_long.cpp @@ -22,20 +22,19 @@ ------------------------------------------------------------------------- */ #include "fix_ave_correlate_long.h" -#include + +#include "citeme.h" +#include "compute.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + #include -#include #include #include -#include "update.h" -#include "modify.h" -#include "compute.h" -#include "input.h" -#include "variable.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -70,8 +69,8 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); - nfreq = force->inumeric(FLERR,arg[4]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nfreq = utils::inumeric(FLERR,arg[4],false,lmp); restart_global = 1; global_freq = nfreq; @@ -142,22 +141,22 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); - startstep = force->inumeric(FLERR,arg[iarg+1]); + startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"ncorr") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); - numcorrelators = force->inumeric(FLERR,arg[iarg+1]); + numcorrelators = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"nlen") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); - p = force->inumeric(FLERR,arg[iarg+1]); + p = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"ncount") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate/long command"); - m = force->inumeric(FLERR,arg[iarg+1]); + m = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { if (iarg+2 > narg) diff --git a/src/USER-MISC/fix_electron_stopping.cpp b/src/USER-MISC/fix_electron_stopping.cpp index 2130f07420..952ffe7584 100644 --- a/src/USER-MISC/fix_electron_stopping.cpp +++ b/src/USER-MISC/fix_electron_stopping.cpp @@ -17,21 +17,22 @@ ------------------------------------------------------------------------- */ #include "fix_electron_stopping.h" -#include -#include -#include "mpi.h" + #include "atom.h" -#include "update.h" -#include "domain.h" -#include "region.h" -#include "force.h" -#include "fix.h" -#include "memory.h" #include "comm.h" +#include "domain.h" #include "error.h" -#include "neighbor.h" +#include "fix.h" +#include "force.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" +#include "region.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -57,7 +58,7 @@ FixElectronStopping::FixElectronStopping(LAMMPS *lmp, int narg, char **arg) : if (narg < 5) error->all(FLERR, "Illegal fix electron/stopping command: too few arguments"); - Ecut = force->numeric(FLERR, arg[3]); + Ecut = utils::numeric(FLERR, arg[3],false,lmp); if (Ecut <= 0.0) error->all(FLERR, "Illegal fix electron/stopping command: Ecut <= 0"); @@ -83,7 +84,7 @@ FixElectronStopping::FixElectronStopping(LAMMPS *lmp, int narg, char **arg) : minneighflag = true; if (iarg+2 > narg) error->all(FLERR, "Illegal fix electron/stopping command: minneigh number missing"); - minneigh = force->inumeric(FLERR, arg[iarg+1]); + minneigh = utils::inumeric(FLERR, arg[iarg+1],false,lmp); if (minneigh < 0) error->all(FLERR, "Illegal fix electron/stopping command: minneigh < 0"); iarg += 2; @@ -240,7 +241,7 @@ void FixElectronStopping::read_table(const char *file) { char line[MAXLINE]; - FILE *fp = force->open_potential(file); + FILE *fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str, 128, "Cannot open stopping range table %s", file); @@ -261,7 +262,7 @@ void FixElectronStopping::read_table(const char *file) int i = 0; for ( ; i < ncol && pch != NULL; i++) { - elstop_ranges[i][l] = force->numeric(FLERR, pch); + elstop_ranges[i][l] = utils::numeric(FLERR, pch,false,lmp); pch = strtok(NULL, " \t\n\r"); } diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index a245b6b4e5..fb111c1f27 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -22,7 +22,7 @@ ------------------------------------------------------------------------- */ #include "fix_ffl.h" -#include + #include #include #include "atom.h" @@ -64,21 +64,22 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : time_integrate = 1; scalar_flag = 1; - //gamma = 1/ time constant(tau) - if (force->numeric(FLERR,arg[3]) <= 0) + //gamma = 1 / time constant(tau) + gamma = utils::numeric(FLERR,arg[3],false,lmp); + if (gamma <= 0.0) error->all(FLERR,"Illegal fix ffl tau value, should be greater than 0"); - gamma = 1.0/force->numeric(FLERR,arg[3]); + gamma = 1.0/gamma; ffl_every=1; ffl_step=0; // start temperature (t ramp) - t_start = force->numeric(FLERR,arg[4]); + t_start = utils::numeric(FLERR,arg[4],false,lmp); // final temperature (t ramp) - t_stop = force->numeric(FLERR,arg[5]); + t_stop = utils::numeric(FLERR,arg[5],false,lmp); // PRNG seed - int seed = force->inumeric(FLERR,arg[6]); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); // Flip type used, uses rescale if no flip is given if (narg == 8) { diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index 52e979d32c..86650cd50d 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -17,11 +17,11 @@ ------------------------------------------------------------------------- */ #include "fix_filter_corotate.h" -#include + #include #include #include -#include + #include "atom.h" #include "atom_vec.h" #include "comm.h" @@ -110,25 +110,25 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : // read numeric args of b,a,t,m else if (mode == 'b') { - int i = force->inumeric(FLERR,arg[next]); + int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->nbondtypes) error->all(FLERR,"Invalid bond type index for fix filter/corotate"); bond_flag[i] = 1; } else if (mode == 'a') { - int i = force->inumeric(FLERR,arg[next]); + int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->nangletypes) error->all(FLERR,"Invalid angle type index for fix filter/corotate"); angle_flag[i] = 1; } else if (mode == 't') { - int i = force->inumeric(FLERR,arg[next]); + int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->ntypes) error->all(FLERR,"Invalid atom type index for fix filter/corotate"); type_flag[i] = 1; } else if (mode == 'm') { - double massone = force->numeric(FLERR,arg[next]); + double massone = utils::numeric(FLERR,arg[next],false,lmp); if (massone == 0.0) error->all(FLERR,"Invalid atom mass for fix filter/corotate"); if (nmass == atom->ntypes) diff --git a/src/USER-MISC/fix_flow_gauss.cpp b/src/USER-MISC/fix_flow_gauss.cpp index c7b7f86d37..d603e37671 100644 --- a/src/USER-MISC/fix_flow_gauss.cpp +++ b/src/USER-MISC/fix_flow_gauss.cpp @@ -17,16 +17,16 @@ ------------------------------------------------------------------------- */ #include "fix_flow_gauss.h" -#include -#include + #include "atom.h" -#include "force.h" -#include "group.h" -#include "update.h" +#include "citeme.h" #include "domain.h" #include "error.h" -#include "citeme.h" +#include "group.h" #include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -71,7 +71,7 @@ FixFlowGauss::FixFlowGauss(LAMMPS *lmp, int narg, char **arg) : int tmpFlag; for (int ii=0; ii<3; ii++) { - tmpFlag=force->inumeric(FLERR,arg[3+ii]); + tmpFlag=utils::inumeric(FLERR,arg[3+ii],false,lmp); if (tmpFlag==1 || tmpFlag==0) flow[ii]=tmpFlag; else diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index 87dbb19496..f4776c3d6c 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -17,10 +17,10 @@ ------------------------------------------------------------------------- */ #include "fix_gle.h" -#include + #include #include -#include + #include "atom.h" #include "force.h" #include "update.h" @@ -29,7 +29,7 @@ #include "random_mars.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -197,7 +197,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : time_integrate = 1; // number of additional momenta - ns = force->inumeric(FLERR,arg[3]); + ns = utils::inumeric(FLERR,arg[3],false,lmp); ns1sq = (ns+1)*(ns+1); // allocate GLE matrices @@ -209,19 +209,19 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ST = new double[ns1sq]; // start temperature (t ramp) - t_start = force->numeric(FLERR,arg[4]); + t_start = utils::numeric(FLERR,arg[4],false,lmp); // final temperature (t ramp) - t_stop = force->numeric(FLERR,arg[5]); + t_stop = utils::numeric(FLERR,arg[5],false,lmp); // PRNG seed - int seed = force->inumeric(FLERR,arg[6]); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); // LOADING A matrix FILE *fgle = NULL; char *fname = arg[7]; if (comm->me == 0) { - fgle = force->open_potential(fname); + fgle = utils::open_potential(fname,lmp,nullptr); if (fgle == NULL) { char str[128]; snprintf(str,128,"Cannot open A-matrix file %s",fname); @@ -276,7 +276,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : if (iarg+2>narg) error->all(FLERR, "Did not specify interval for applying the GLE"); - gle_every=force->inumeric(FLERR,arg[iarg+1]); + gle_every=utils::inumeric(FLERR,arg[iarg+1],false,lmp); } } @@ -291,7 +291,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : } else { if (comm->me == 0) { - fgle = force->open_potential(fname); + fgle = utils::open_potential(fname,lmp,nullptr); if (fgle == NULL) { char str[128]; snprintf(str,128,"Cannot open C-matrix file %s",fname); diff --git a/src/USER-MISC/fix_grem.cpp b/src/USER-MISC/fix_grem.cpp index 9600cce90e..b17c601f05 100644 --- a/src/USER-MISC/fix_grem.cpp +++ b/src/USER-MISC/fix_grem.cpp @@ -52,9 +52,9 @@ FixGrem::FixGrem(LAMMPS *lmp, int narg, char **arg) : // tbath - temp of bath, the same as defined in thermostat - lambda = force->numeric(FLERR,arg[3]); - eta = force->numeric(FLERR,arg[4]); - h0 = force->numeric(FLERR,arg[5]); + lambda = utils::numeric(FLERR,arg[3],false,lmp); + eta = utils::numeric(FLERR,arg[4],false,lmp); + h0 = utils::numeric(FLERR,arg[5],false,lmp); int n = strlen(arg[6])+1; id_nh = new char[n]; diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 266142b529..7c3fac9c33 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -48,17 +48,16 @@ negotiate an appropriate license for such distribution." ------------------------------------------------------------------------- */ #include "fix_imd.h" + #include "atom.h" #include "comm.h" -#include "update.h" -#include "respa.h" #include "domain.h" -#include "force.h" #include "error.h" #include "group.h" #include "memory.h" +#include "respa.h" +#include "update.h" -#include #include #if defined(_MSC_VER) || defined(__MINGW32__) @@ -446,7 +445,7 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix imd command"); - imd_port = force->inumeric(FLERR,arg[3]); + imd_port = utils::inumeric(FLERR,arg[3],false,lmp); if (imd_port < 1024) error->all(FLERR,"Illegal fix imd parameter: port < 1024"); @@ -473,9 +472,9 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : nowait_flag = 0; } } else if (0 == strcmp(arg[argsdone], "fscale")) { - imd_fscale = force->numeric(FLERR,arg[argsdone+1]); + imd_fscale = utils::numeric(FLERR,arg[argsdone+1],false,lmp); } else if (0 == strcmp(arg[argsdone], "trate")) { - imd_trate = force->inumeric(FLERR,arg[argsdone+1]); + imd_trate = utils::inumeric(FLERR,arg[argsdone+1],false,lmp); } else { error->all(FLERR,"Unknown fix imd parameter"); } diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index 74e757c2e9..b8045a9ff1 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_ipi.h" -#include + #include #include "atom.h" #include "force.h" @@ -45,7 +45,7 @@ using namespace FixConst; // socket interface #ifndef _WIN32 -#include + #include #include #include @@ -185,7 +185,7 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : error->warning(FLERR,"Fix ipi always uses group all"); host = strdup(arg[3]); - port = force->inumeric(FLERR,arg[4]); + port = utils::inumeric(FLERR,arg[4],false,lmp); inet = ((narg > 5) && (strcmp(arg[5],"unix") == 0) ) ? 0 : 1; master = (comm->me==0) ? 1 : 0; diff --git a/src/USER-MISC/fix_momentum_chunk.cpp b/src/USER-MISC/fix_momentum_chunk.cpp index fe6c2f5bea..fcd6d47922 100644 --- a/src/USER-MISC/fix_momentum_chunk.cpp +++ b/src/USER-MISC/fix_momentum_chunk.cpp @@ -12,19 +12,18 @@ ------------------------------------------------------------------------- */ #include "fix_momentum_chunk.h" -#include -#include -#include + #include "atom.h" #include "compute.h" #include "compute_chunk_atom.h" #include "compute_com_chunk.h" #include "domain.h" -#include "group.h" #include "error.h" -#include "force.h" +#include "group.h" #include "modify.h" -#include "fmt/format.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -41,7 +40,7 @@ FixMomentumChunk::FixMomentumChunk(LAMMPS *lmp, int narg, char **arg) : { if (narg < 5) error->all(FLERR,"Illegal fix momentum/chunk command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix momentum/chunk command"); id_chunk = arg[4]; @@ -60,9 +59,9 @@ FixMomentumChunk::FixMomentumChunk(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"linear") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix momentum command"); linear = 1; - xflag = force->inumeric(FLERR,arg[iarg+1]); - yflag = force->inumeric(FLERR,arg[iarg+2]); - zflag = force->inumeric(FLERR,arg[iarg+3]); + xflag = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + yflag = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + zflag = utils::inumeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"angular") == 0) { angular = 1; diff --git a/src/USER-MISC/fix_momentum_chunk.h b/src/USER-MISC/fix_momentum_chunk.h index 5e056f2494..5007e38c69 100644 --- a/src/USER-MISC/fix_momentum_chunk.h +++ b/src/USER-MISC/fix_momentum_chunk.h @@ -21,7 +21,7 @@ FixStyle(momentum/chunk,FixMomentumChunk) #define LMP_FIX_MOMENTUM_CHUNK_H #include "fix.h" -#include + namespace LAMMPS_NS { diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index 067bad47ef..9361d9ebd6 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include #include "fix_npt_cauchy.h" #include "math_extra.h" @@ -134,10 +134,10 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); tstat_flag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); t_target = t_start; - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (t_start <= 0.0 || t_stop <= 0.0) error->all(FLERR, "Target temperature for fix npt/cauchy cannot be 0.0"); @@ -146,10 +146,10 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"iso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); pcouple = XYZ; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -159,10 +159,10 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); pcouple = NONE; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -173,15 +173,15 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); pcouple = NONE; scalexy = scalexz = scaleyz = 0; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; p_start[3] = p_start[4] = p_start[5] = 0.0; p_stop[3] = p_stop[4] = p_stop[5] = 0.0; p_period[3] = p_period[4] = p_period[5] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[3] = p_flag[4] = p_flag[5] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -194,25 +194,25 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : iarg += 4; } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - p_start[0] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = 1; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - p_start[1] = force->numeric(FLERR,arg[iarg+1]); - p_stop[1] = force->numeric(FLERR,arg[iarg+2]); - p_period[1] = force->numeric(FLERR,arg[iarg+3]); + p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[1] = 1; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[2] = 1; deviatoric_flag = 1; iarg += 4; @@ -221,9 +221,9 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - p_start[3] = force->numeric(FLERR,arg[iarg+1]); - p_stop[3] = force->numeric(FLERR,arg[iarg+2]); - p_period[3] = force->numeric(FLERR,arg[iarg+3]); + p_start[3] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[3] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[3] = 1; deviatoric_flag = 1; scaleyz = 0; @@ -232,9 +232,9 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix npt/cauchy command for a 2d simulation"); } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - p_start[4] = force->numeric(FLERR,arg[iarg+1]); - p_stop[4] = force->numeric(FLERR,arg[iarg+2]); - p_period[4] = force->numeric(FLERR,arg[iarg+3]); + p_start[4] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[4] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[4] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[4] = 1; deviatoric_flag = 1; scalexz = 0; @@ -243,9 +243,9 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix npt/cauchy command for a 2d simulation"); } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - p_start[5] = force->numeric(FLERR,arg[iarg+1]); - p_stop[5] = force->numeric(FLERR,arg[iarg+2]); - p_period[5] = force->numeric(FLERR,arg[iarg+3]); + p_start[5] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[5] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[5] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[5] = 1; deviatoric_flag = 1; scalexy = 0; @@ -263,7 +263,7 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"drag") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - drag = force->numeric(FLERR,arg[iarg+1]); + drag = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (drag < 0.0) error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"dilate") == 0) { @@ -283,14 +283,14 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"tchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - mtchain = force->inumeric(FLERR,arg[iarg+1]); + mtchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); // used by FixNVTSllod to preserve non-default value mtchain_default_flag = 0; if (mtchain < 1) error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - mpchain = force->inumeric(FLERR,arg[iarg+1]); + mpchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (mpchain < 0) error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"mtk") == 0) { @@ -301,17 +301,17 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"tloop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - nc_tchain = force->inumeric(FLERR,arg[iarg+1]); + nc_tchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nc_tchain < 0) error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"ploop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - nc_pchain = force->inumeric(FLERR,arg[iarg+1]); + nc_pchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nc_pchain < 0) error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"nreset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - nreset_h0 = force->inumeric(FLERR,arg[iarg+1]); + nreset_h0 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nreset_h0 < 0) error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"scalexy") == 0) { @@ -347,7 +347,7 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix npt/cauchy command"); iarg += 2; } else if (strcmp(arg[iarg],"alpha") == 0) { - alpha = force->numeric(FLERR,arg[iarg+1]); + alpha = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"continue") == 0) { if (strcmp(arg[iarg+1],"yes") != 0 && strcmp(arg[iarg+1],"no") != 0) @@ -357,9 +357,9 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"fixedpoint") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix npt/cauchy command"); - fixedpoint[0] = force->numeric(FLERR,arg[iarg+1]); - fixedpoint[1] = force->numeric(FLERR,arg[iarg+2]); - fixedpoint[2] = force->numeric(FLERR,arg[iarg+3]); + fixedpoint[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + fixedpoint[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + fixedpoint[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; // disc keyword is also parsed in fix/nh/sphere diff --git a/src/USER-MISC/fix_nvk.cpp b/src/USER-MISC/fix_nvk.cpp index 410a269f8c..f0fbddf18d 100644 --- a/src/USER-MISC/fix_nvk.cpp +++ b/src/USER-MISC/fix_nvk.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_nvk.h" -#include + #include #include #include "atom.h" diff --git a/src/USER-MISC/fix_orient_eco.cpp b/src/USER-MISC/fix_orient_eco.cpp index add32e7215..5f1582d580 100644 --- a/src/USER-MISC/fix_orient_eco.cpp +++ b/src/USER-MISC/fix_orient_eco.cpp @@ -16,13 +16,10 @@ ------------------------------------------------------------------------- */ #include "fix_orient_eco.h" -#include -#include -#include + #include "atom.h" #include "citeme.h" #include "comm.h" -#include "domain.h" #include "error.h" #include "force.h" #include "math_const.h" @@ -33,8 +30,9 @@ #include "pair.h" #include "respa.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -82,10 +80,10 @@ FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : peratom_freq = 1; // // parse input parameters - u_0 = force->numeric(FLERR, arg[3]); + u_0 = utils::numeric(FLERR, arg[3],false,lmp); sign = (u_0 >= 0.0 ? 1 : -1); - eta = force->numeric(FLERR, arg[4]); - r_cut = force->numeric(FLERR, arg[5]); + eta = utils::numeric(FLERR, arg[4],false,lmp); + r_cut = utils::numeric(FLERR, arg[5],false,lmp); // read reference orientations from file // work on rank 0 only @@ -97,7 +95,7 @@ FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : char *result; int count; - FILE *infile = force->open_potential(dir_filename); + FILE *infile = utils::open_potential(dir_filename,lmp,nullptr); if (infile == NULL) error->one(FLERR,fmt::format("Cannot open fix orient/eco file {}: {}", dir_filename, utils::getsyserror())); diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp new file mode 100644 index 0000000000..1ac0ffb188 --- /dev/null +++ b/src/USER-MISC/fix_pafi.cpp @@ -0,0 +1,736 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------ + Contributing authors: Thomas Swinburne (CNRS & CINaM, Marseille, France) + + Please cite the related publication: + T.D. Swinburne and M.-C. Marinica, Unsupervised calculation of free energy barriers in large crystalline systems, Physical Review Letters 2018 +------------------------------------------------------------------------- */ + + +#include "fix_pafi.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "respa.h" +#include "update.h" + +#include +#include + +using namespace LAMMPS_NS; + +static const char cite_fix_pafi_package[] = + "citation for fix pafi:\n\n" + "@article{SwinburneMarinica2018,\n" + "author={T. D. Swinburne and M. C. Marinica},\n" + "title={Unsupervised calculation of free energy barriers in large " + "crystalline systems},\n" + "journal={Physical Review Letters},\n" + "volume={120},\n" + "number={13},\n" + "pages={135503},\n" + "year={2018},\n" + "publisher={APS}\n}\n" + "Recommended to be coupled with PAFI++ code:\n" + "https://github.com/tomswinburne/pafi\n"; + +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixPAFI::FixPAFI(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), computename(NULL), random(NULL), + h(NULL), step_respa(NULL) +{ + if (lmp->citeme) lmp->citeme->add(cite_fix_pafi_package); + + if (narg < 11) error->all(FLERR,"Illegal fix pafi command"); + + dynamic_group_allow = 0; + vector_flag = 1; + size_vector = 5; + global_freq = 1; + extvector = 0; + od_flag = 0; + com_flag = 1; + time_integrate = 1; + + int n = strlen(arg[3])+1; + computename = new char[n]; + strcpy(computename,&arg[3][0]); + + icompute = modify->find_compute(computename); + if (icompute == -1) + error->all(FLERR,"Compute ID for fix pafi does not exist"); + PathCompute = modify->compute[icompute]; + if (PathCompute->peratom_flag==0) + error->all(FLERR,"Compute for fix pafi does not calculate a local array"); + if (PathCompute->size_peratom_cols < 9) + error->all(FLERR,"Compute for fix pafi must have 9 fields per atom"); + + if (comm->me==0) + utils::logmesg(lmp,fmt::format("fix pafi compute name,style: {},{}\n",computename,PathCompute->style)); + + respa_level_support = 1; + ilevel_respa = nlevels_respa = 0; + + temperature = utils::numeric(FLERR,arg[4],false,lmp); + t_period = utils::numeric(FLERR,arg[5],false,lmp); + seed = utils::inumeric(FLERR,arg[6],false,lmp); + // TODO UNITS + gamma = 1. / t_period / force->ftm2v; + sqrtD = sqrt(1.) * sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e*temperature) / force->ftm2v; + + // optional args + int iarg = 7; + while (iarg < narg) { + if (strcmp(arg[iarg],"overdamped") == 0) { + if (strcmp(arg[iarg+1],"no") == 0) od_flag = 0; + else if (strcmp(arg[iarg+1],"0") == 0) od_flag = 0; + else if (strcmp(arg[iarg+1],"yes") == 0) od_flag = 1; + else if (strcmp(arg[iarg+1],"1") == 0) od_flag = 1; + iarg += 2; + } else if (strcmp(arg[iarg],"com") == 0) { + if (strcmp(arg[iarg+1],"no") == 0) com_flag = 0; + else if (strcmp(arg[iarg+1],"0") == 0) com_flag = 0; + else if (strcmp(arg[iarg+1],"yes") == 0) com_flag = 1; + else if (strcmp(arg[iarg+1],"1") == 0) com_flag = 1; + iarg += 2; + } else error->all(FLERR,"Illegal fix pafi command"); + } + force_flag = 0; + + for (int i = 0; i < 10; i++) { + c_v[i] = 0.; + c_v_all[i] = 0.; + } + for (int i=0; i<6; i++) { + proj[i] = 0.0; + proj_all[i] = 0.0; + } + for (int i=0; i<5; i++) { + results[i] = 0.0; + results_all[i] = 0.0; + } + maxatom = 1; + memory->create(h,maxatom,3,"FixPAFI:h"); + + // initialize Marsaglia RNG with processor-unique seed + random = new RanMars(lmp,seed + comm->me); + +} + +/* ---------------------------------------------------------------------- */ + +FixPAFI::~FixPAFI() +{ + if (copymode) return; + delete random; + delete [] computename; + memory->destroy(h); +} + +/* ---------------------------------------------------------------------- */ + +int FixPAFI::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + mask |= POST_FORCE_RESPA; + mask |= MIN_POST_FORCE; + mask |= INITIAL_INTEGRATE; + // nve + mask |= FINAL_INTEGRATE; + mask |= INITIAL_INTEGRATE_RESPA; + mask |= FINAL_INTEGRATE_RESPA; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixPAFI::init() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; + + icompute = modify->find_compute(computename); + if (icompute == -1) + error->all(FLERR,"Compute ID for fix pafi does not exist"); + PathCompute = modify->compute[icompute]; + if (PathCompute->peratom_flag==0) + error->all(FLERR,"Compute for fix pafi does not calculate a local array"); + if (PathCompute->size_peratom_cols < 9) + error->all(FLERR,"Compute for fix pafi must have 9 fields per atom"); + + + if (strstr(update->integrate_style,"respa")) { + step_respa = ((Respa *) update->integrate)->step; // nve + nlevels_respa = ((Respa *) update->integrate)->nlevels; + if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); + else ilevel_respa = nlevels_respa-1; + } + +} + +void FixPAFI::setup(int vflag) +{ + if (strstr(update->integrate_style,"verlet")) + post_force(vflag); + else + for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { + ((Respa *) update->integrate)->copy_flevel_f(ilevel); + post_force_respa(vflag,ilevel,0); + ((Respa *) update->integrate)->copy_f_flevel(ilevel); + } +} + +void FixPAFI::min_setup(int vflag) +{ + if (utils::strmatch(update->minimize_style,"^fire")==0 && + utils::strmatch(update->minimize_style,"^quickmin")==0 ) + error->all(FLERR,"fix pafi requires a damped dynamics minimizer"); + min_post_force(vflag); +} + + +void FixPAFI::post_force(int /*vflag*/) +{ + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + // reallocate norm array if necessary + if (atom->nmax > maxatom) { + maxatom = atom->nmax; + memory->destroy(h); + memory->create(h,maxatom,3,"FixPAFI:h"); + } + + PathCompute->compute_peratom(); + double **path = PathCompute->array_atom; + + // proj 0,1,2 = f.n, v.n, h.n + // proj 3,4,5 = psi, f.n**2, f*(1-psi) + // c_v 0,1,2 = fxcom, fycom, fzcom etc + for (int i = 0; i < 10; i++) { + c_v[i] = 0.; + c_v_all[i] = 0.; + } + for (int i = 0; i < 6; i++) { + proj[i] = 0.; + proj_all[i] = 0.; + } + + double deviation[3] = {0.,0.,0.}; + + force_flag=0; + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + h[i][0] = random->uniform() - 0.5; + h[i][1] = random->uniform() - 0.5; + h[i][2] = random->uniform() - 0.5; + + proj[0] += f[i][0] * path[i][3]; // f.n + proj[0] += f[i][1] * path[i][4]; // f.n + proj[0] += f[i][2] * path[i][5]; // f.n + + proj[1] += v[i][0] * path[i][3]; // v.n + proj[1] += v[i][1] * path[i][4]; // v.n + proj[1] += v[i][2] * path[i][5]; // v.n + + proj[2] += h[i][0] * path[i][3]; // h.n + proj[2] += h[i][1] * path[i][4]; // h.n + proj[2] += h[i][2] * path[i][5]; // h.n + + deviation[0] = x[i][0]-path[i][0]; // x-path + deviation[1] = x[i][1]-path[i][1]; // x-path + deviation[2] = x[i][2]-path[i][2]; // x-path + domain->minimum_image(deviation); + + proj[3] += path[i][6]*deviation[0]; // (x-path).dn/nn = psi + proj[3] += path[i][7]*deviation[1]; // (x-path).dn/nn = psi + proj[3] += path[i][8]*deviation[2]; // (x-path).dn/nn = psi + + proj[4] += path[i][3]*deviation[0]; // (x-path).n + proj[4] += path[i][4]*deviation[1]; // (x-path).n + proj[4] += path[i][5]*deviation[2]; // (x-path).n + + proj[5] += f[i][3]*deviation[0]; // (x-path).f + proj[5] += f[i][4]*deviation[1]; // (x-path).f + proj[5] += f[i][5]*deviation[2]; // (x-path).f + + } + } + + if (com_flag == 0){ + c_v[9] += 1.0; + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + + c_v[0] += f[i][0]; + c_v[1] += f[i][1]; + c_v[2] += f[i][2]; + + c_v[3] += v[i][0]; + c_v[4] += v[i][1]; + c_v[5] += v[i][2]; + + c_v[6] += h[i][0]; + c_v[7] += h[i][1]; + c_v[8] += h[i][2]; + + c_v[9] += 1.0; + } + } + MPI_Allreduce(proj,proj_all,6,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(c_v,c_v_all,10,MPI_DOUBLE,MPI_SUM,world); + + // results - f.n*(1-psi), (f.n)^2*(1-psi)^2, 1-psi, dX.n + results_all[0] = proj_all[0] * (1.-proj_all[3]); + results_all[1] = results_all[0] * results_all[0]; + results_all[2] = 1.-proj_all[3]; + results_all[3] = fabs(proj_all[4]); + results_all[4] = proj_all[5]; // dX.f + force_flag = 1; + + for (int i = 0; i < nlocal; i++){ + if (mask[i] & groupbit) { + + f[i][0] -= proj_all[0] * path[i][3] + c_v_all[0]/c_v_all[9]; + f[i][1] -= proj_all[0] * path[i][4] + c_v_all[1]/c_v_all[9]; + f[i][2] -= proj_all[0] * path[i][5] + c_v_all[2]/c_v_all[9]; + + v[i][0] -= proj_all[1] * path[i][3] + c_v_all[3]/c_v_all[9]; + v[i][1] -= proj_all[1] * path[i][4] + c_v_all[4]/c_v_all[9]; + v[i][2] -= proj_all[1] * path[i][5] + c_v_all[5]/c_v_all[9]; + + h[i][0] -= proj_all[2] * path[i][3] + c_v_all[6]/c_v_all[9]; + h[i][1] -= proj_all[2] * path[i][4] + c_v_all[7]/c_v_all[9]; + h[i][2] -= proj_all[2] * path[i][5] + c_v_all[8]/c_v_all[9]; + } + } + + if (od_flag == 0) { + for (int i = 0; i < nlocal; i++){ + if (mask[i] & groupbit) { + if (rmass) mass_f = sqrt(rmass[i]); + else mass_f = sqrt(mass[type[i]]); + + f[i][0] += -gamma * mass_f * mass_f * v[i][0]; + f[i][1] += -gamma * mass_f * mass_f * v[i][1]; + f[i][2] += -gamma * mass_f * mass_f * v[i][2]; + + f[i][0] += sqrtD * mass_f * h[i][0]; + f[i][1] += sqrtD * mass_f * h[i][1]; + f[i][2] += sqrtD * mass_f * h[i][2]; + } + } + } else { + for (int i = 0; i < nlocal; i++){ + if (mask[i] & groupbit) { + + if (rmass) mass_f = sqrt(rmass[i]); + else mass_f = sqrt(mass[type[i]]); + + f[i][0] += sqrtD * h[i][0] * mass_f; + f[i][1] += sqrtD * h[i][1] * mass_f; + f[i][2] += sqrtD * h[i][2] * mass_f; + + f[i][0] /= gamma * mass_f * mass_f; + f[i][1] /= gamma * mass_f * mass_f; + f[i][2] /= gamma * mass_f * mass_f; + + } + } + } + +}; + +void FixPAFI::post_force_respa(int vflag, int ilevel, int /*iloop*/) +{ + // set force to desired value on requested level, 0.0 on other levels + + if (ilevel == ilevel_respa) post_force(vflag); + else { + double **f = atom->f; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + for (int k = 0; k < 3; k++) f[i][k] = 0.0; + } + } +}; + +void FixPAFI::min_post_force(int /*vflag*/) +{ + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + PathCompute->compute_peratom(); + double **path = PathCompute->array_atom; + + // proj 0,1,2 = f.n, v.n, h.n + // proj 3,4,5 = psi, f.n**2, f*(1-psi) + // c_v 0,1,2 = fxcom, fycom, fzcom etc + for (int i = 0; i < 10; i++) { + c_v[i] = 0.; + c_v_all[i] = 0.; + } + for (int i = 0; i < 6; i++) { + proj[i] = 0.; + proj_all[i] = 0.; + } + + double deviation[3] = {0.,0.,0.}; + + force_flag=0; + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + + proj[0] += f[i][0] * path[i][3]; // f.n + proj[0] += f[i][1] * path[i][4]; // f.n + proj[0] += f[i][2] * path[i][5]; // f.n + + proj[1] += v[i][0] * path[i][3]; // v.n + proj[1] += v[i][1] * path[i][4]; // v.n + proj[1] += v[i][2] * path[i][5]; // v.n + + proj[2] += h[i][0] * path[i][3]; // h.n + proj[2] += h[i][1] * path[i][4]; // h.n + proj[2] += h[i][2] * path[i][5]; // h.n + + deviation[0] = x[i][0]-path[i][0]; // x-path + deviation[1] = x[i][1]-path[i][1]; // x-path + deviation[2] = x[i][2]-path[i][2]; // x-path + domain->minimum_image(deviation); + + proj[3] += path[i][6]*deviation[0]; // (x-path).dn/nn = psi + proj[3] += path[i][7]*deviation[1]; // (x-path).dn/nn = psi + proj[3] += path[i][8]*deviation[2]; // (x-path).dn/nn = psi + + proj[4] += path[i][3]*deviation[0]; // (x-path).n + proj[4] += path[i][4]*deviation[1]; // (x-path).n + proj[4] += path[i][5]*deviation[2]; // (x-path).n + + proj[5] += f[i][3]*deviation[0]; // (x-path).f + proj[5] += f[i][4]*deviation[1]; // (x-path).f + proj[5] += f[i][5]*deviation[2]; // (x-path).f + + } + } + + if (com_flag == 0){ + c_v[9] += 1.0; + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + + c_v[0] += f[i][0]; + c_v[1] += f[i][1]; + c_v[2] += f[i][2]; + + c_v[3] += v[i][0]; + c_v[4] += v[i][1]; + c_v[5] += v[i][2]; + + c_v[6] += h[i][0]; + c_v[7] += h[i][1]; + c_v[8] += h[i][2]; + + c_v[9] += 1.0; + } + } + MPI_Allreduce(proj,proj_all,6,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(c_v,c_v_all,10,MPI_DOUBLE,MPI_SUM,world); + + results_all[0] = proj_all[0] * (1.-proj_all[3]); // f.n * psi + results_all[1] = results_all[0] * results_all[0]; // (f.n * psi)^2 + results_all[2] = 1.-proj_all[3]; // psi + results_all[3] = fabs(proj_all[4]); // dX.n + results_all[4] = proj_all[5]; // dX.f + + MPI_Bcast(results_all,5,MPI_DOUBLE,0,world); + force_flag = 1; + + for (int i = 0; i < nlocal; i++){ + if (mask[i] & groupbit) { + + f[i][0] -= proj_all[0] * path[i][3] + c_v_all[0]/c_v_all[9]; + f[i][1] -= proj_all[0] * path[i][4] + c_v_all[1]/c_v_all[9]; + f[i][2] -= proj_all[0] * path[i][5] + c_v_all[2]/c_v_all[9]; + + v[i][0] -= proj_all[1] * path[i][3] + c_v_all[3]/c_v_all[9]; + v[i][1] -= proj_all[1] * path[i][4] + c_v_all[4]/c_v_all[9]; + v[i][2] -= proj_all[1] * path[i][5] + c_v_all[5]/c_v_all[9]; + + } + } +}; + +double FixPAFI::compute_vector(int n) +{ + return results_all[n]; +}; + + + +void FixPAFI::initial_integrate(int /*vflag*/) +{ + double dtfm; + + // update v and x of atoms in group + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + PathCompute->compute_peratom(); + double **path = PathCompute->array_atom; + + for (int i = 0; i < 10; i++) { + c_v[i] = 0.; + c_v_all[i] = 0.; + } + for (int i = 0; i < 6; i++) { + proj[i] = 0.; + proj_all[i] = 0.; + } + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + proj[0] += f[i][0] * path[i][3]; // f.n + proj[0] += f[i][1] * path[i][4]; // f.n + proj[0] += f[i][2] * path[i][5]; // f.n + + proj[1] += v[i][0] * path[i][3]; // v.n + proj[1] += v[i][1] * path[i][4]; // v.n + proj[1] += v[i][2] * path[i][5]; // v.n + } + } + if (com_flag == 0){ + c_v[9] += 1.0; + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + + c_v[0] += v[i][0]; + c_v[1] += v[i][1]; + c_v[2] += v[i][2]; + + c_v[3] += f[i][0]; + c_v[4] += f[i][1]; + c_v[5] += f[i][2]; + + c_v[9] += 1.0; + } + } + + + MPI_Allreduce(proj,proj_all,5,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(c_v,c_v_all,10,MPI_DOUBLE,MPI_SUM,world); + + if (od_flag == 0){ + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * (f[i][0]-path[i][3]*proj_all[0] - c_v_all[3]/c_v_all[9]); + v[i][1] += dtfm * (f[i][1]-path[i][4]*proj_all[0] - c_v_all[4]/c_v_all[9]); + v[i][2] += dtfm * (f[i][2]-path[i][5]*proj_all[0] - c_v_all[5]/c_v_all[9]); + x[i][0] += dtv * (v[i][0]-path[i][3]*proj_all[1] - c_v_all[0]/c_v_all[9]); + x[i][1] += dtv * (v[i][1]-path[i][4]*proj_all[1] - c_v_all[1]/c_v_all[9]); + x[i][2] += dtv * (v[i][2]-path[i][5]*proj_all[1] - c_v_all[2]/c_v_all[9]); + } + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * (f[i][0]-path[i][3]*proj_all[0] - c_v_all[3]/c_v_all[9]); + v[i][1] += dtfm * (f[i][1]-path[i][4]*proj_all[0] - c_v_all[4]/c_v_all[9]); + v[i][2] += dtfm * (f[i][2]-path[i][5]*proj_all[0] - c_v_all[5]/c_v_all[9]); + x[i][0] += dtv * (v[i][0]-path[i][3]*proj_all[1] - c_v_all[0]/c_v_all[9]); + x[i][1] += dtv * (v[i][1]-path[i][4]*proj_all[1] - c_v_all[1]/c_v_all[9]); + x[i][2] += dtv * (v[i][2]-path[i][5]*proj_all[1] - c_v_all[2]/c_v_all[9]); + } + } + } else { + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] = 0.; + v[i][1] = 0.; + v[i][2] = 0.; + x[i][0] += dtv * (f[i][0]-path[i][3]*proj_all[0] - c_v_all[3]/c_v_all[9]); + x[i][1] += dtv * (f[i][1]-path[i][4]*proj_all[0] - c_v_all[4]/c_v_all[9]); + x[i][2] += dtv * (f[i][2]-path[i][5]*proj_all[0] - c_v_all[5]/c_v_all[9]); + } + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] = 0.; + v[i][1] = 0.; + v[i][2] = 0.; + x[i][0] += dtv * (f[i][0]-path[i][3]*proj_all[0] - c_v_all[3]/c_v_all[9]); + x[i][1] += dtv * (f[i][1]-path[i][4]*proj_all[0] - c_v_all[4]/c_v_all[9]); + x[i][2] += dtv * (f[i][2]-path[i][5]*proj_all[0] - c_v_all[5]/c_v_all[9]); + } + } + } +}; + +/* ---------------------------------------------------------------------- */ + +void FixPAFI::final_integrate() +{ + double dtfm; + + // update v of atoms in group + double **v = atom->v; + double **f = atom->f; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + PathCompute->compute_peratom(); + double **path = PathCompute->array_atom; + + for (int i = 0; i < 10; i++) { + c_v[i] = 0.; + c_v_all[i] = 0.; + } + for (int i = 0; i < 6; i++) { + proj[i] = 0.; + proj_all[i] = 0.; + } + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + proj[0] += f[i][0] * path[i][3]; // f.n + proj[0] += f[i][1] * path[i][4]; // f.n + proj[0] += f[i][2] * path[i][5]; // f.n + } + if (com_flag == 0){ + c_v[9] += 1.0; + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + c_v[3] += f[i][0]; + c_v[4] += f[i][1]; + c_v[5] += f[i][2]; + c_v[9] += 1.0; + } + } + + MPI_Allreduce(proj,proj_all,5,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(c_v,c_v_all,10,MPI_DOUBLE,MPI_SUM,world); + + if (od_flag == 0){ + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * (f[i][0]-path[i][3]*proj_all[0] - c_v_all[3]/c_v_all[9]); + v[i][1] += dtfm * (f[i][1]-path[i][4]*proj_all[0] - c_v_all[4]/c_v_all[9]); + v[i][2] += dtfm * (f[i][2]-path[i][5]*proj_all[0] - c_v_all[5]/c_v_all[9]); + } + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * (f[i][0]-path[i][3]*proj_all[0] - c_v_all[3]/c_v_all[9]); + v[i][1] += dtfm * (f[i][1]-path[i][4]*proj_all[0] - c_v_all[4]/c_v_all[9]); + v[i][2] += dtfm * (f[i][2]-path[i][5]*proj_all[0] - c_v_all[5]/c_v_all[9]); + } + } + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + v[i][0] = 0.; + v[i][1] = 0.; + v[i][2] = 0.; + } + } +}; + +/* ---------------------------------------------------------------------- */ + +void FixPAFI::initial_integrate_respa(int vflag, int ilevel, int /*iloop*/) +{ + dtv = step_respa[ilevel]; + dtf = 0.5 * step_respa[ilevel] * force->ftm2v; + + // innermost level - NVE update of v and x + // all other levels - NVE update of v + + if (ilevel == 0) initial_integrate(vflag); + else final_integrate(); +}; + +/* ---------------------------------------------------------------------- */ + +void FixPAFI::final_integrate_respa(int ilevel, int /*iloop*/) +{ + dtf = 0.5 * step_respa[ilevel] * force->ftm2v; + final_integrate(); +}; + +/* ---------------------------------------------------------------------- */ + +void FixPAFI::reset_dt() +{ + dtv = update->dt; + dtf = 0.5 * update->dt * force->ftm2v; +}; + + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double FixPAFI::memory_usage() +{ + double bytes = 0.0; + bytes = maxatom*3 * sizeof(double); + return bytes; +}; diff --git a/src/USER-MISC/fix_pafi.h b/src/USER-MISC/fix_pafi.h new file mode 100644 index 0000000000..dd272601e6 --- /dev/null +++ b/src/USER-MISC/fix_pafi.h @@ -0,0 +1,99 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(pafi,FixPAFI) + +#else + +#ifndef LMP_FIX_PAFI_H +#define LMP_FIX_PAFI_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixPAFI : public Fix { + public: + FixPAFI(class LAMMPS *, int, char **); + virtual ~FixPAFI(); + int setmask(); + virtual void init(); + + void setup(int); + void min_setup(int); + virtual void post_force(int); + + void post_force_respa(int, int, int); + void min_post_force(int); + double compute_vector(int); + // nve + virtual void initial_integrate(int); + virtual void final_integrate(); + virtual void initial_integrate_respa(int, int, int); + virtual void final_integrate_respa(int, int); + virtual void reset_dt(); + + double memory_usage(); + + protected: + int varflag,icompute; + char *computename; + class Compute *PathCompute; + double proj[6], proj_all[6]; // f,v,h, psi + double results[5], results_all[5]; // f.n, (f.n)**2, psi, dx.n + double c_v[10],c_v_all[10]; + double temperature,gamma,sqrtD,t_period,local_norm,mass_f; + int force_flag,od_flag,com_flag; + int nlevels_respa,ilevel_respa; + int maxatom; + class RanMars *random; + int seed; + double **h; + // nve + double dtv,dtf; + double *step_respa; + int mass_require; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +E: Compute ID for fix pafi does not exist + +Self-explanatory. + +E: Compute for fix pafi does not calculate a local array + +Self-explanatory. + +E: Compute for fix pafi has < 3*DIM fields per atom + +Self-explanatory. + +E: Fix pafi requires a damped dynamics minimizer + +Use a different minimization style. + +*/ diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index 8de31f19b3..5be9bf162b 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -22,10 +22,10 @@ ------------------------------------------------------------------------- */ #include "fix_pimd.h" -#include + #include #include -#include + #include "universe.h" #include "comm.h" #include "force.h" diff --git a/src/USER-MISC/fix_propel_self.cpp b/src/USER-MISC/fix_propel_self.cpp index 921ce9b9ef..1b0d780c69 100644 --- a/src/USER-MISC/fix_propel_self.cpp +++ b/src/USER-MISC/fix_propel_self.cpp @@ -19,25 +19,15 @@ #include "fix_propel_self.h" -#include -#include -#include - #include "atom.h" #include "atom_vec_ellipsoid.h" -#include "citeme.h" -#include "comm.h" #include "error.h" -#include "force.h" -#include "group.h" -#include "math.h" #include "math_const.h" #include "math_extra.h" -#include "math_vector.h" -#include "modify.h" -#include "random_mars.h" -#include "respa.h" -#include "update.h" + +#include +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -82,7 +72,7 @@ FixPropelSelf::FixPropelSelf( LAMMPS *lmp, int narg, char **argv ) error->all(FLERR, msg); } - magnitude = force->numeric( FLERR, argv[4] ); + magnitude = utils::numeric( FLERR, argv[4] ,false,lmp); // Handle rest of args: @@ -100,7 +90,7 @@ FixPropelSelf::FixPropelSelf( LAMMPS *lmp, int narg, char **argv ) int flag=0; while (iarg < narg) { if (isdigit(argv[iarg][0])) { - int thistype = force->inumeric(FLERR,argv[iarg]); + int thistype = utils::inumeric(FLERR,argv[iarg],false,lmp); if ((thistype < 1) || (thistype > atom->ntypes)) error->all(FLERR,"Illegal atom type to types keyword"); apply_to_type[thistype] = 1; diff --git a/src/USER-MISC/fix_rhok.cpp b/src/USER-MISC/fix_rhok.cpp index fb041b05cd..b088a86661 100644 --- a/src/USER-MISC/fix_rhok.cpp +++ b/src/USER-MISC/fix_rhok.cpp @@ -14,18 +14,17 @@ ------------------------------------------------------------------------- */ #include "fix_rhok.h" -#include -#include -#include #include "atom.h" +#include "citeme.h" #include "domain.h" #include "error.h" -#include "force.h" +#include "math_const.h" #include "respa.h" #include "update.h" -#include "citeme.h" -#include "math_const.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -68,16 +67,16 @@ FixRhok::FixRhok( LAMMPS* inLMP, int inArgc, char** inArgv ) // Parse fix options int n[3]; - n[0] = force->inumeric(FLERR,inArgv[3]); - n[1] = force->inumeric(FLERR,inArgv[4]); - n[2] = force->inumeric(FLERR,inArgv[5]); + n[0] = utils::inumeric(FLERR,inArgv[3],false,lmp); + n[1] = utils::inumeric(FLERR,inArgv[4],false,lmp); + n[2] = utils::inumeric(FLERR,inArgv[5],false,lmp); mK[0] = n[0]*(2*MY_PI / (domain->boxhi[0] - domain->boxlo[0])); mK[1] = n[1]*(2*MY_PI / (domain->boxhi[1] - domain->boxlo[1])); mK[2] = n[2]*(2*MY_PI / (domain->boxhi[2] - domain->boxlo[2])); - mKappa = force->numeric(FLERR,inArgv[6]); - mRhoK0 = force->numeric(FLERR,inArgv[7]); + mKappa = utils::numeric(FLERR,inArgv[6],false,lmp); + mRhoK0 = utils::numeric(FLERR,inArgv[7],false,lmp); } // Methods that this fix implements diff --git a/src/USER-MISC/fix_smd.cpp b/src/USER-MISC/fix_smd.cpp index 32c040c2b4..0dace284a9 100644 --- a/src/USER-MISC/fix_smd.cpp +++ b/src/USER-MISC/fix_smd.cpp @@ -17,17 +17,17 @@ ------------------------------------------------------------------------- */ #include "fix_smd.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "update.h" -#include "respa.h" #include "domain.h" #include "error.h" -#include "force.h" #include "group.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -64,13 +64,13 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[argoffs],"cvel") == 0) { if (narg < argoffs+3) error->all(FLERR,"Illegal fix smd command"); styleflag |= SMD_CVEL; - k_smd = force->numeric(FLERR,arg[argoffs+1]); - v_smd = force->numeric(FLERR,arg[argoffs+2]); // to be multiplied by update->dt when used. + k_smd = utils::numeric(FLERR,arg[argoffs+1],false,lmp); + v_smd = utils::numeric(FLERR,arg[argoffs+2],false,lmp); // to be multiplied by update->dt when used. argoffs += 3; } else if (strcmp(arg[argoffs],"cfor") == 0) { if (narg < argoffs+2) error->all(FLERR,"Illegal fix smd command"); styleflag |= SMD_CFOR; - f_smd = force->numeric(FLERR,arg[argoffs+1]); + f_smd = utils::numeric(FLERR,arg[argoffs+1],false,lmp); argoffs += 2; } else error->all(FLERR,"Illegal fix smd command"); @@ -78,12 +78,12 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) : if (narg < argoffs+5) error->all(FLERR,"Illegal fix smd command"); styleflag |= SMD_TETHER; if (strcmp(arg[argoffs+1],"NULL") == 0) xflag = 0; - else xc = force->numeric(FLERR,arg[argoffs+1]); + else xc = utils::numeric(FLERR,arg[argoffs+1],false,lmp); if (strcmp(arg[argoffs+2],"NULL") == 0) yflag = 0; - else yc = force->numeric(FLERR,arg[argoffs+2]); + else yc = utils::numeric(FLERR,arg[argoffs+2],false,lmp); if (strcmp(arg[argoffs+3],"NULL") == 0) zflag = 0; - else zc = force->numeric(FLERR,arg[argoffs+3]); - r0 = force->numeric(FLERR,arg[argoffs+4]); + else zc = utils::numeric(FLERR,arg[argoffs+3],false,lmp); + r0 = utils::numeric(FLERR,arg[argoffs+4],false,lmp); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command"); argoffs += 5; } else if (strcmp(arg[argoffs],"couple") == 0) { @@ -98,15 +98,15 @@ FixSMD::FixSMD(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[argoffs+2],"NULL") == 0) xflag = 0; else if (strcmp(arg[argoffs+2],"auto") == 0) styleflag |= SMD_AUTOX; - else xc = force->numeric(FLERR,arg[argoffs+2]); + else xc = utils::numeric(FLERR,arg[argoffs+2],false,lmp); if (strcmp(arg[argoffs+3],"NULL") == 0) yflag = 0; else if (strcmp(arg[argoffs+3],"auto") == 0) styleflag |= SMD_AUTOY; - else yc = force->numeric(FLERR,arg[argoffs+3]); + else yc = utils::numeric(FLERR,arg[argoffs+3],false,lmp); if (strcmp(arg[argoffs+4],"NULL") == 0) zflag = 0; else if (strcmp(arg[argoffs+4],"auto") == 0) styleflag |= SMD_AUTOZ; - else zc = force->numeric(FLERR,arg[argoffs+4]); + else zc = utils::numeric(FLERR,arg[argoffs+4],false,lmp); - r0 = force->numeric(FLERR,arg[argoffs+5]); + r0 = utils::numeric(FLERR,arg[argoffs+5],false,lmp); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix smd command"); argoffs +=6; } else error->all(FLERR,"Illegal fix smd command"); diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index e72ea61b01..97bf1fb07b 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -16,19 +16,19 @@ ------------------------------------------------------------------------- */ #include "fix_srp.h" -#include + +#include "atom.h" +#include "atom_vec.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" + #include #include -#include "atom.h" -#include "force.h" -#include "domain.h" -#include "modify.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "neighbor.h" -#include "atom_vec.h" -#include "modify.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -642,11 +642,11 @@ void FixSRP::restart(char *buf) int FixSRP::modify_param(int /*narg*/, char **arg) { if (strcmp(arg[0],"btype") == 0) { - btype = force->inumeric(FLERR,arg[1]); + btype = utils::inumeric(FLERR,arg[1],false,lmp); return 2; } if (strcmp(arg[0],"bptype") == 0) { - bptype = force->inumeric(FLERR,arg[1]); + bptype = utils::inumeric(FLERR,arg[1],false,lmp); return 2; } return 0; diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 1f7c84b746..bc10b5284c 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -19,16 +19,16 @@ ------------------------------------------------------------------------- */ #include "fix_ti_spring.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "domain.h" -#include "respa.h" -#include "memory.h" -#include "error.h" #include "citeme.h" -#include "force.h" +#include "domain.h" +#include "error.h" +#include "memory.h" +#include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -69,7 +69,7 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : time_depend = 1; // Spring constant. - k = force->numeric(FLERR,arg[3]); + k = utils::numeric(FLERR,arg[3],false,lmp); if (k <= 0.0) error->all(FLERR,"Illegal fix ti/spring command"); // Perform initial allocation of atom-based array @@ -93,15 +93,15 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : // Time variables. t0 = update->ntimestep; // timestep of original/starting coordinates - t_switch = force->bnumeric(FLERR,arg[4]); // Number of steps for switching - t_equil = force->bnumeric(FLERR,arg[5]); // Number of steps for equilibration + t_switch = utils::bnumeric(FLERR,arg[4],false,lmp); // Number of steps for switching + t_equil = utils::bnumeric(FLERR,arg[5],false,lmp); // Number of steps for equilibration if ((t_switch <= 0) || (t_equil < 0)) error->all(FLERR,"Illegal fix ti/spring command"); // Coupling parameter initialization sf = 1; if (narg > 6) { - if (strcmp(arg[6], "function") == 0) sf = force->inumeric(FLERR,arg[7]); + if (strcmp(arg[6], "function") == 0) sf = utils::inumeric(FLERR,arg[7],false,lmp); else error->all(FLERR,"Illegal fix ti/spring switching function"); if ((sf!=1) && (sf!=2)) error->all(FLERR,"Illegal fix ti/spring switching function"); diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index aaeab5989a..c12019528c 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "fix_ttm_mod.h" -#include + #include #include #include "atom.h" @@ -32,8 +32,8 @@ #include "error.h" #include "citeme.h" #include "math_const.h" -#include "utils.h" -#include "fmt/format.h" + + #include "tokenizer.h" using namespace LAMMPS_NS; @@ -84,13 +84,13 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; restart_global = 1; - seed = force->inumeric(FLERR,arg[3]); + seed = utils::inumeric(FLERR,arg[3],false,lmp); if (seed <= 0) error->all(FLERR,"Invalid random number seed in fix ttm/mod command"); - nxnodes = force->inumeric(FLERR,arg[5]); - nynodes = force->inumeric(FLERR,arg[6]); - nznodes = force->inumeric(FLERR,arg[7]); + nxnodes = utils::inumeric(FLERR,arg[5],false,lmp); + nynodes = utils::inumeric(FLERR,arg[6],false,lmp); + nznodes = utils::inumeric(FLERR,arg[7],false,lmp); if (nxnodes <= 0 || nynodes <= 0 || nznodes <= 0) error->all(FLERR,"Fix ttm/mod number of nodes must be > 0"); @@ -98,7 +98,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : if (total_nnodes > MAXSMALLINT) error->all(FLERR,"Too many nodes in fix ttm/mod"); - nfileevery = force->inumeric(FLERR,arg[9]); + nfileevery = utils::inumeric(FLERR,arg[9],false,lmp); if (nfileevery > 0) { if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command"); if (comm->me == 0) { diff --git a/src/USER-MISC/fix_wall_ees.cpp b/src/USER-MISC/fix_wall_ees.cpp index bd7e230472..c4be8b9f1b 100644 --- a/src/USER-MISC/fix_wall_ees.cpp +++ b/src/USER-MISC/fix_wall_ees.cpp @@ -16,13 +16,14 @@ ------------------------------------------------------------------------- */ #include "fix_wall_ees.h" -#include + #include "math_extra.h" #include "atom.h" -#include "atom_vec.h" #include "atom_vec_ellipsoid.h" #include "error.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-MISC/fix_wall_reflect_stochastic.cpp b/src/USER-MISC/fix_wall_reflect_stochastic.cpp index 18bb7ec011..9a8454b017 100644 --- a/src/USER-MISC/fix_wall_reflect_stochastic.cpp +++ b/src/USER-MISC/fix_wall_reflect_stochastic.cpp @@ -17,19 +17,17 @@ ------------------------------------------------------------------------- */ #include "fix_wall_reflect_stochastic.h" -#include -#include + #include "atom.h" #include "comm.h" -#include "update.h" -#include "modify.h" #include "domain.h" +#include "error.h" #include "force.h" #include "lattice.h" -#include "input.h" -#include "variable.h" #include "random_mars.h" -#include "error.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -70,7 +68,7 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix wall/reflect/stochastic command"); - seedfix = force->inumeric(FLERR,arg[4]); + seedfix = utils::inumeric(FLERR,arg[4],false,lmp); if (seedfix <= 0) error->all(FLERR,"Random seed must be a positive number"); int iarg = 5; @@ -103,13 +101,13 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : else coord0[nwall] = domain->boxhi[dim]; } else { wallstyle[nwall] = CONSTANT; - coord0[nwall] = force->numeric(FLERR,arg[iarg+1]); + coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp); } - walltemp[nwall]= force->numeric(FLERR,arg[iarg+2]); + walltemp[nwall]= utils::numeric(FLERR,arg[iarg+2],false,lmp); for (int dir = 0; dir < 3; dir++) { - wallvel[nwall][dir]= force->numeric(FLERR,arg[iarg+dir+3]); + wallvel[nwall][dir]= utils::numeric(FLERR,arg[iarg+dir+3],false,lmp); int dim = wallwhich[nwall] / 2; if ((wallvel[nwall][dir] !=0) & (dir == dim)) error->all(FLERR,"The wall velocity must be tangential"); @@ -119,9 +117,9 @@ FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : // CCL = one for each dimension if (rstyle == CCL) - wallaccom[nwall][dir]= force->numeric(FLERR,arg[iarg+dir+6]); + wallaccom[nwall][dir]= utils::numeric(FLERR,arg[iarg+dir+6],false,lmp); else if (rstyle == MAXWELL) - wallaccom[nwall][dir]= force->numeric(FLERR,arg[iarg+6]); + wallaccom[nwall][dir]= utils::numeric(FLERR,arg[iarg+6],false,lmp); } nwall++; diff --git a/src/USER-MISC/fix_wall_reflect_stochastic.h b/src/USER-MISC/fix_wall_reflect_stochastic.h index 0568dc8ae5..558ad7d084 100644 --- a/src/USER-MISC/fix_wall_reflect_stochastic.h +++ b/src/USER-MISC/fix_wall_reflect_stochastic.h @@ -20,7 +20,6 @@ FixStyle(wall/reflect/stochastic,FixWallReflectStochastic) #ifndef LMP_FIX_WALL_REFLECT_STOCHASTIC_H #define LMP_FIX_WALL_REFLECT_STOCHASTIC_H -#include "random_mars.h" #include "fix_wall_reflect.h" namespace LAMMPS_NS { diff --git a/src/USER-MISC/fix_wall_region_ees.cpp b/src/USER-MISC/fix_wall_region_ees.cpp index 5c6bb1874b..dfb11d6467 100644 --- a/src/USER-MISC/fix_wall_region_ees.cpp +++ b/src/USER-MISC/fix_wall_region_ees.cpp @@ -16,18 +16,18 @@ ------------------------------------------------------------------------- */ #include "fix_wall_region_ees.h" -#include -#include -#include + #include "atom.h" #include "atom_vec_ellipsoid.h" #include "domain.h" -#include "region.h" -#include "force.h" -#include "update.h" -#include "respa.h" #include "error.h" #include "math_extra.h" +#include "region.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -54,9 +54,9 @@ FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) : idregion = new char[n]; strcpy(idregion,arg[3]); - epsilon = force->numeric(FLERR,arg[4]); - sigma = force->numeric(FLERR,arg[5]); - cutoff = force->numeric(FLERR,arg[6]); + epsilon = utils::numeric(FLERR,arg[4],false,lmp); + sigma = utils::numeric(FLERR,arg[5],false,lmp); + cutoff = utils::numeric(FLERR,arg[6],false,lmp); if (cutoff <= 0.0) error->all(FLERR,"Fix wall/region/ees cutoff <= 0.0"); diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index c5556b746d..5714931215 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "improper_cossq.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "math_const.h" using namespace LAMMPS_NS; @@ -269,10 +269,10 @@ void ImproperCossq::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double chi_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/improper_distance.cpp b/src/USER-MISC/improper_distance.cpp index 146bd344f1..476cf8ab43 100644 --- a/src/USER-MISC/improper_distance.cpp +++ b/src/USER-MISC/improper_distance.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "improper_distance.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -211,10 +211,10 @@ void ImproperDistance::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double chi_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi_one = utils::numeric(FLERR,arg[2],false,lmp); // convert chi from degrees to radians diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index beb473d78c..85f7809a02 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "improper_fourier.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "update.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -279,14 +279,14 @@ void ImproperFourier::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double C0_one = force->numeric(FLERR,arg[2]); - double C1_one = force->numeric(FLERR,arg[3]); - double C2_one = force->numeric(FLERR,arg[4]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double C0_one = utils::numeric(FLERR,arg[2],false,lmp); + double C1_one = utils::numeric(FLERR,arg[3],false,lmp); + double C2_one = utils::numeric(FLERR,arg[4],false,lmp); int all_one = 1; - if ( narg == 6 ) all_one = force->inumeric(FLERR,arg[5]); + if ( narg == 6 ) all_one = utils::inumeric(FLERR,arg[5],false,lmp); // convert w0 from degrees to radians diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index 7f818595a2..c85e4850c8 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -37,7 +37,7 @@ ------------------------------------------------------------------------- */ #include "improper_ring.h" -#include + #include #include "atom.h" #include "comm.h" @@ -47,7 +47,7 @@ #include "math_special.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -288,10 +288,10 @@ void ImproperRing ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double chi_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index 4941f2c7b3..41f9bc9531 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -16,22 +16,20 @@ ------------------------------------------------------------------------- */ #include "pair_agni.h" -#include -#include -#include -#include + #include "atom.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "force.h" -#include "comm.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" #include "citeme.h" -#include "math_special.h" +#include "comm.h" +#include "error.h" #include "math_const.h" -#include "utils.h" +#include "math_special.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathSpecial; @@ -358,7 +356,7 @@ void PairAGNI::read_file(char *file) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open AGNI potential file %s",file); diff --git a/src/USER-MISC/pair_buck_mdf.cpp b/src/USER-MISC/pair_buck_mdf.cpp index 1937aeedf7..9ef96f1188 100644 --- a/src/USER-MISC/pair_buck_mdf.cpp +++ b/src/USER-MISC/pair_buck_mdf.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_buck_mdf.h" -#include + #include #include #include "atom.h" @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -184,8 +184,8 @@ void PairBuckMDF::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_inner_global = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + cut_inner_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -208,19 +208,19 @@ void PairBuckMDF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[4]); + double c_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 7) { - cut_inner_one = force->numeric(FLERR,arg[5]); - cut_one = force->numeric(FLERR,arg[6]); + cut_inner_one = utils::numeric(FLERR,arg[5],false,lmp); + cut_one = utils::numeric(FLERR,arg[6],false,lmp); } if (cut_inner_global <= 0.0 || cut_inner_global > cut_global) error->all(FLERR,"Illegal pair_style command"); diff --git a/src/USER-MISC/pair_cosine_squared.cpp b/src/USER-MISC/pair_cosine_squared.cpp index ff0d763b2d..1203cea5f2 100644 --- a/src/USER-MISC/pair_cosine_squared.cpp +++ b/src/USER-MISC/pair_cosine_squared.cpp @@ -15,22 +15,17 @@ ------------------------------------------------------------------------- */ #include "pair_cosine_squared.h" -#include -#include -#include + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "update.h" -#include "integrate.h" -#include "respa.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "neigh_list.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -103,7 +98,7 @@ void PairCosineSquared::settings(int narg, char **arg) error->all(FLERR, "Illegal pair_style command (wrong number of params)"); } - cut_global = force->numeric(FLERR, arg[0]); + cut_global = utils::numeric(FLERR, arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -130,16 +125,16 @@ void PairCosineSquared::coeff(int narg, char **arg) allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR, arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR, arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); - double epsilon_one = force->numeric(FLERR, arg[2]); - double sigma_one = force->numeric(FLERR, arg[3]); + double epsilon_one = utils::numeric(FLERR, arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR, arg[3],false,lmp); double cut_one = cut_global; double wca_one = 0; if (narg == 6) { - cut_one = force->numeric(FLERR, arg[4]); + cut_one = utils::numeric(FLERR, arg[4],false,lmp); if (strcmp(arg[5], "wca") == 0) { wca_one = 1; } else { @@ -149,7 +144,7 @@ void PairCosineSquared::coeff(int narg, char **arg) if (strcmp(arg[4], "wca") == 0) { wca_one = 1; } else { - cut_one = force->numeric(FLERR, arg[4]); + cut_one = utils::numeric(FLERR, arg[4],false,lmp); } } diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index e0c675086f..5a3e12f1a5 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -15,7 +15,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_diel.h" -#include + #include #include "atom.h" #include "comm.h" @@ -24,7 +24,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -159,7 +159,7 @@ void PairCoulDiel::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -181,15 +181,15 @@ void PairCoulDiel::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - eps_s = force->numeric(FLERR,arg[2]); - double rme_one =force->numeric(FLERR,arg[3]); - double sigmae_one = force->numeric(FLERR,arg[4]); + eps_s = utils::numeric(FLERR,arg[2],false,lmp); + double rme_one =utils::numeric(FLERR,arg[3],false,lmp); + double sigmae_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 7ff479b2f7..44ab555b02 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -28,7 +28,7 @@ #include "memory.h" #include "math_special.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -175,8 +175,8 @@ void PairCoulShield::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); - if (narg == 2) tap_flag = force->numeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -198,13 +198,13 @@ void PairCoulShield::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double sigmae_one = force->numeric(FLERR,arg[2]); + double sigmae_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_coul_slater_cut.cpp b/src/USER-MISC/pair_coul_slater_cut.cpp index 33363b869a..5e799178c9 100644 --- a/src/USER-MISC/pair_coul_slater_cut.cpp +++ b/src/USER-MISC/pair_coul_slater_cut.cpp @@ -15,18 +15,15 @@ * Contributing author: Evangelos Voyiatzis (Royal DSM) * ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "pair_coul_slater_cut.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "memory.h" #include "error.h" +#include "force.h" +#include "neigh_list.h" + +#include using namespace LAMMPS_NS; @@ -123,8 +120,8 @@ void PairCoulSlaterCut::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - lamda = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + lamda = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/USER-MISC/pair_coul_slater_long.cpp b/src/USER-MISC/pair_coul_slater_long.cpp index f5b7461db7..0c94254f48 100644 --- a/src/USER-MISC/pair_coul_slater_long.cpp +++ b/src/USER-MISC/pair_coul_slater_long.cpp @@ -15,22 +15,19 @@ * Contributing author: Evangelos Voyiatzis (Royal DSM) * ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "pair_coul_slater_long.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "integrate.h" -#include "respa.h" #include "memory.h" -#include "error.h" +#include "neigh_list.h" +#include "neighbor.h" + +#include +#include using namespace LAMMPS_NS; @@ -209,8 +206,8 @@ void PairCoulSlaterLong::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - lamda = force->numeric(FLERR,arg[0]); - cut_coul = force->numeric(FLERR,arg[1]); + lamda = utils::numeric(FLERR,arg[0],false,lmp); + cut_coul = utils::numeric(FLERR,arg[1],false,lmp); } /* ---------------------------------------------------------------------- @@ -223,8 +220,8 @@ void PairCoulSlaterLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 2e9221537a..7b56caa205 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -21,9 +21,9 @@ ------------------------------------------------------------------------- */ #include "pair_drip.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -33,7 +33,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -223,7 +223,7 @@ void PairDRIP::read_file(char *filename) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(filename); + fp = utils::open_potential(filename,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open DRIP potential file %s",filename); diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index 420e2135bd..a7ed0fcaad 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -15,7 +15,7 @@ ------------------------------------------------------------------------- */ #include "pair_e3b.h" -#include + #include #include #include @@ -381,7 +381,7 @@ void PairE3B::allocateE3B() void PairE3B::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - typeO=force->inumeric(FLERR,arg[0]); + typeO=utils::inumeric(FLERR,arg[0],false,lmp); } /* ---------------------------------------------------------------------- @@ -421,29 +421,29 @@ void PairE3B::coeff(int narg, char **arg) while(iarg < narg) { char *keyword = arg[iarg++]; if (checkKeyword(keyword,"Ea",1,narg-iarg)) - ea=force->numeric(FLERR,arg[iarg++]); + ea=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"Eb",1,narg-iarg)) - eb=force->numeric(FLERR,arg[iarg++]); + eb=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"Ec",1,narg-iarg)) - ec=force->numeric(FLERR,arg[iarg++]); + ec=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"K3",1,narg-iarg)) - k3=force->numeric(FLERR,arg[iarg++]); + k3=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"Rs",1,narg-iarg)) - rs=force->numeric(FLERR,arg[iarg++]); + rs=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"Rc3",1,narg-iarg)) - rc3=force->numeric(FLERR,arg[iarg++]); + rc3=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"Rc2",1,narg-iarg)) - rc2=force->numeric(FLERR,arg[iarg++]); + rc2=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"bondL",1,narg-iarg)) - bondL=force->numeric(FLERR,arg[iarg++]); + bondL=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"E2",1,narg-iarg)) - e2=force->numeric(FLERR,arg[iarg++]); + e2=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"K2",1,narg-iarg)) - k2=force->numeric(FLERR,arg[iarg++]); + k2=utils::numeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"neigh",1,narg-iarg)) - pairPerAtom=force->inumeric(FLERR,arg[iarg++]); + pairPerAtom=utils::inumeric(FLERR,arg[iarg++],false,lmp); else if (checkKeyword(keyword,"preset",1,narg-iarg)) { - presetFlag=force->inumeric(FLERR,arg[iarg++]); + presetFlag=utils::inumeric(FLERR,arg[iarg++],false,lmp); presetParam(presetFlag,repeatFlag,bondL); } else { char str[256]; diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 288160459a..6ccaded35d 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -22,10 +22,10 @@ ------------------------------------------------------------------------- */ #include "pair_edip.h" -#include + #include #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -35,7 +35,7 @@ #include "comm.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -883,7 +883,7 @@ void PairEDIP::read_file(char *file) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 7fe620223b..4a81a41a26 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -18,9 +18,9 @@ ------------------------------------------------------------------------- */ #include "pair_edip_multi.h" -#include + #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -31,7 +31,7 @@ #include "memory.h" #include "error.h" #include "citeme.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -640,7 +640,7 @@ void PairEDIPMulti::read_file(char *file) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 65f792b493..0db7f8739a 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -16,9 +16,9 @@ ------------------------------------------------------------------------- */ #include "pair_extep.h" -#include + #include -#include + #include #include #include "atom.h" @@ -30,7 +30,7 @@ #include "comm.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "math_const.h" @@ -589,7 +589,7 @@ void PairExTeP::read_file(char *file) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open ExTeP potential file %s",file); diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index 2a4f61cce3..c9601c416e 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_gauss_cut.h" -#include + #include #include "atom.h" #include "comm.h" @@ -24,7 +24,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "math_const.h" using namespace LAMMPS_NS; @@ -163,7 +163,7 @@ void PairGaussCut::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -185,18 +185,18 @@ void PairGaussCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double hgauss_one = force->numeric(FLERR,arg[2]); - double rmh_one = force->numeric(FLERR,arg[3]); - double sigmah_one = force->numeric(FLERR,arg[4]); + double hgauss_one = utils::numeric(FLERR,arg[2],false,lmp); + double rmh_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigmah_one = utils::numeric(FLERR,arg[4],false,lmp); if (sigmah_one <= 0.0) error->all(FLERR,"Incorrect args for pair coefficients"); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 106d02dd48..671dcb309d 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -21,9 +21,9 @@ ------------------------------------------------------------------------- */ #include "pair_ilp_graphene_hbn.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -34,7 +34,7 @@ #include "my_page.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -136,8 +136,8 @@ void PairILPGrapheneHBN::settings(int narg, char **arg) if (strcmp(force->pair_style,"hybrid/overlay")!=0) error->all(FLERR,"ERROR: requires hybrid/overlay pair_style"); - cut_global = force->numeric(FLERR,arg[0]); - if (narg == 2) tap_flag = force->numeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -256,7 +256,7 @@ void PairILPGrapheneHBN::read_file(char *filename) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(filename); + fp = utils::open_potential(filename,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open ILP potential file %s",filename); diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index 9627cbc08a..9f986fa101 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -22,9 +22,9 @@ #include "pair_kolmogorov_crespi_full.h" #include -#include + #include -#include + #include "atom.h" #include "comm.h" #include "force.h" @@ -34,7 +34,7 @@ #include "my_page.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -137,8 +137,8 @@ void PairKolmogorovCrespiFull::settings(int narg, char **arg) if (strcmp(force->pair_style,"hybrid/overlay")!=0) error->all(FLERR,"ERROR: requires hybrid/overlay pair_style"); - cut_global = force->numeric(FLERR,arg[0]); - if (narg == 2) tap_flag = force->numeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + if (narg == 2) tap_flag = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -257,7 +257,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(filename); + fp = utils::open_potential(filename,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 4315439624..7ce6f8652a 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -22,9 +22,9 @@ ------------------------------------------------------------------------- */ #include "pair_kolmogorov_crespi_z.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -32,7 +32,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -203,7 +203,7 @@ void PairKolmogorovCrespiZ::settings(int narg, char **arg) if (strcmp(force->pair_style,"hybrid/overlay")!=0) error->all(FLERR,"ERROR: requires hybrid/overlay pair_style"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -228,8 +228,8 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if NULL @@ -315,7 +315,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(filename); + fp = utils::open_potential(filename,lmp,nullptr); if (fp == NULL) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index 53ee82274e..b8f9e5c38f 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -23,9 +23,9 @@ ------------------------------------------------------------------------- */ #include "pair_lebedeva_z.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -33,7 +33,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -199,7 +199,7 @@ void PairLebedevaZ::settings(int narg, char **arg) if (strcmp(force->pair_style,"hybrid/overlay")!=0) error->all(FLERR,"ERROR: requires hybrid/overlay pair_style"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -224,8 +224,8 @@ void PairLebedevaZ::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file // map[i] = which element the Ith atom type is, -1 if NULL @@ -311,7 +311,7 @@ void PairLebedevaZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { - fp = force->open_potential(filename); + fp = utils::open_potential(filename,lmp,nullptr); if (fp == NULL) { char str[128]; sprintf(str,"Cannot open Lebedeva potential file %s",filename); diff --git a/src/USER-MISC/pair_lennard_mdf.cpp b/src/USER-MISC/pair_lennard_mdf.cpp index 4728527a30..31d32db505 100644 --- a/src/USER-MISC/pair_lennard_mdf.cpp +++ b/src/USER-MISC/pair_lennard_mdf.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lennard_mdf.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -184,8 +184,8 @@ void PairLennardMDF::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_inner_global = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + cut_inner_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); if (cut_inner_global <= 0.0 || cut_inner_global > cut_global) error->all(FLERR,"Illegal pair_style command"); @@ -214,17 +214,17 @@ void PairLennardMDF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double aparm_one = force->numeric(FLERR,arg[2]); - double bparm_one = force->numeric(FLERR,arg[3]); + double aparm_one = utils::numeric(FLERR,arg[2],false,lmp); + double bparm_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 6) { - cut_inner_one = force->numeric(FLERR,arg[4]); - cut_one = force->numeric(FLERR,arg[5]); + cut_inner_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_one = utils::numeric(FLERR,arg[5],false,lmp); } if (cut_inner_one <= 0.0 || cut_inner_one > cut_one) error->all(FLERR,"Illegal pair_coeff command"); diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index 2f4e886a61..a93e0a81af 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_list.h" -#include + #include #include #include "atom.h" @@ -25,6 +25,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; static const char * const stylename[] = { @@ -202,13 +203,13 @@ void PairList::settings(int narg, char **arg) if (narg < 2) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[1]); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg > 2) { if (strcmp(arg[2],"nocheck") == 0) check_flag = 0; if (strcmp(arg[2],"check") == 0) check_flag = 1; } - FILE *fp = force->open_potential(arg[0]); + FILE *fp = utils::open_potential(arg[0],lmp,nullptr); char line[1024]; if (fp == NULL) error->all(FLERR,"Cannot open pair list file"); @@ -259,12 +260,12 @@ void PairList::settings(int narg, char **arg) ptr = strtok(NULL," \t\n\r\f"); if ((ptr == NULL) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); - par.parm.harm.k = force->numeric(FLERR,ptr); + par.parm.harm.k = utils::numeric(FLERR,ptr,false,lmp); ptr = strtok(NULL," \t\n\r\f"); if ((ptr == NULL) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); - par.parm.harm.r0 = force->numeric(FLERR,ptr); + par.parm.harm.r0 = utils::numeric(FLERR,ptr,false,lmp); ++nharm; @@ -275,17 +276,17 @@ void PairList::settings(int narg, char **arg) ptr = strtok(NULL," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); - par.parm.morse.d0 = force->numeric(FLERR,ptr); + par.parm.morse.d0 = utils::numeric(FLERR,ptr,false,lmp); ptr = strtok(NULL," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); - par.parm.morse.alpha = force->numeric(FLERR,ptr); + par.parm.morse.alpha = utils::numeric(FLERR,ptr,false,lmp); ptr = strtok(NULL," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); - par.parm.morse.r0 = force->numeric(FLERR,ptr); + par.parm.morse.r0 = utils::numeric(FLERR,ptr,false,lmp); ++nmorse; @@ -296,12 +297,12 @@ void PairList::settings(int narg, char **arg) ptr = strtok(NULL," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); - par.parm.lj126.epsilon = force->numeric(FLERR,ptr); + par.parm.lj126.epsilon = utils::numeric(FLERR,ptr,false,lmp); ptr = strtok(NULL," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); - par.parm.lj126.sigma = force->numeric(FLERR,ptr); + par.parm.lj126.sigma = utils::numeric(FLERR,ptr,false,lmp); ++nlj126; @@ -312,7 +313,7 @@ void PairList::settings(int narg, char **arg) // optional cutoff parameter. if not specified use global value ptr = strtok(NULL," \t\n\r\f"); if ((ptr != NULL) && (*ptr != '#')) { - double cut = force->numeric(FLERR,ptr); + double cut = utils::numeric(FLERR,ptr,false,lmp); par.cutsq = cut*cut; } else { par.cutsq = cut_global*cut_global; @@ -344,8 +345,8 @@ void PairList::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index 3d96a3343c..92e869e58c 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_expand_coul_long.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -626,9 +626,9 @@ void PairLJExpandCoulLong::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[1]); + else cut_coul = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -651,15 +651,15 @@ void PairLJExpandCoulLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double shift_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double shift_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_lj_mdf.cpp b/src/USER-MISC/pair_lj_mdf.cpp index 51e24639b9..baa0e233f2 100644 --- a/src/USER-MISC/pair_lj_mdf.cpp +++ b/src/USER-MISC/pair_lj_mdf.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_mdf.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -186,8 +186,8 @@ void PairLJMDF::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_inner_global = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + cut_inner_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); if (cut_inner_global <= 0.0 || cut_inner_global > cut_global) error->all(FLERR,"Illegal pair_style command"); @@ -216,17 +216,17 @@ void PairLJMDF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 6) { - cut_inner_one = force->numeric(FLERR,arg[4]); - cut_one = force->numeric(FLERR,arg[5]); + cut_inner_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_one = utils::numeric(FLERR,arg[5],false,lmp); } if (cut_inner_global <= 0.0 || cut_inner_global > cut_global) error->all(FLERR,"Illegal pair_style command"); diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index 19bc66bdcb..ab845e69d5 100644 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_sf_dipole_sf.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "update.h" using namespace LAMMPS_NS; @@ -333,9 +333,9 @@ void PairLJSFDipoleSF::settings(int narg, char **arg) if (strcmp(update->unit_style,"electron") == 0) error->all(FLERR,"Cannot (yet) use 'electron' units with dipoles"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[1]); + else cut_coul_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -361,11 +361,11 @@ void PairLJSFDipoleSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; @@ -373,16 +373,16 @@ void PairLJSFDipoleSF::coeff(int narg, char **arg) int iarg = 4; if ((narg > iarg) && (strcmp(arg[iarg],"scale") != 0)) { - cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[iarg]); + cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[iarg],false,lmp); ++iarg; } if ((narg > iarg) && (strcmp(arg[iarg],"scale") != 0)) { - cut_coul_one = force->numeric(FLERR,arg[iarg]); + cut_coul_one = utils::numeric(FLERR,arg[iarg],false,lmp); ++iarg; } if (narg > iarg) { if (strcmp(arg[iarg],"scale") == 0) { - scale_one = force->numeric(FLERR,arg[iarg+1]); + scale_one = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR,"Incorrect args for pair coefficients"); } diff --git a/src/USER-MISC/pair_local_density.cpp b/src/USER-MISC/pair_local_density.cpp index 8ad9793f98..404f6e2db1 100644 --- a/src/USER-MISC/pair_local_density.cpp +++ b/src/USER-MISC/pair_local_density.cpp @@ -18,22 +18,17 @@ ------------------------------------------------------------------------- */ #include "pair_local_density.h" -#include -#include -#include -#include -#include + #include "atom.h" -#include "force.h" -#include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "memory.h" -#include "error.h" -#include "domain.h" #include "citeme.h" -#include "utils.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 5764b09d8a..4d9b3866b7 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -33,7 +33,7 @@ #include "pair_meam_spline.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -43,7 +43,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -458,7 +458,7 @@ void PairMEAMSpline::read_file(const char* filename) int nmultichoose2; // = (n+1)*n/2; if(comm->me == 0) { - FILE *fp = force->open_potential(filename); + FILE *fp = utils::open_potential(filename,lmp,nullptr); if(fp == NULL) { char str[1024]; snprintf(str,128,"Cannot open spline MEAM potential file %s", filename); diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 8d33a6f04f..0a8aae233a 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -25,7 +25,7 @@ #include "pair_meam_sw_spline.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -35,7 +35,7 @@ #include "neigh_request.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -460,7 +460,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) void PairMEAMSWSpline::read_file(const char* filename) { if(comm->me == 0) { - FILE *fp = force->open_potential(filename); + FILE *fp = utils::open_potential(filename,lmp,nullptr); if(fp == NULL) { char str[1024]; snprintf(str,1024,"Cannot open spline MEAM potential file %s", filename); diff --git a/src/USER-MISC/pair_momb.cpp b/src/USER-MISC/pair_momb.cpp index 010aa1e5fd..d534284b57 100644 --- a/src/USER-MISC/pair_momb.cpp +++ b/src/USER-MISC/pair_momb.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_momb.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "citeme.h" using namespace LAMMPS_NS; @@ -189,9 +189,9 @@ void PairMomb::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); - sscale = force->numeric(FLERR,arg[1]); - dscale = force->numeric(FLERR,arg[2]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); + sscale = utils::numeric(FLERR,arg[1],false,lmp); + dscale = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -215,17 +215,17 @@ void PairMomb::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double d0_one = force->numeric(FLERR,arg[2]); - double alpha_one = force->numeric(FLERR,arg[3]); - double r0_one = force->numeric(FLERR,arg[4]); - double c_one = force->numeric(FLERR,arg[5]); - double rr_one = force->numeric(FLERR,arg[6]); + double d0_one = utils::numeric(FLERR,arg[2],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[3],false,lmp); + double r0_one = utils::numeric(FLERR,arg[4],false,lmp); + double c_one = utils::numeric(FLERR,arg[5],false,lmp); + double rr_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_one = cut_global; - if (narg == 8) cut_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_morse_smooth_linear.cpp b/src/USER-MISC/pair_morse_smooth_linear.cpp index 7513eebd98..9f895800df 100644 --- a/src/USER-MISC/pair_morse_smooth_linear.cpp +++ b/src/USER-MISC/pair_morse_smooth_linear.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_morse_smooth_linear.h" -#include + #include #include #include "atom.h" @@ -21,7 +21,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -162,7 +162,7 @@ void PairMorseSmoothLinear::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -184,15 +184,15 @@ void PairMorseSmoothLinear::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double d0_one = force->numeric(FLERR,arg[2]); - double alpha_one = force->numeric(FLERR,arg[3]); - double r0_one = force->numeric(FLERR,arg[4]); + double d0_one = utils::numeric(FLERR,arg[2],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[3],false,lmp); + double r0_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index d0e73b265d..150895108e 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -26,9 +26,9 @@ Please contact Timothy Sirk for questions (tim.sirk@us.army.mil). ------------------------------------------------------------------------- */ #include "pair_srp.h" -#include + #include -#include + #include #include "atom.h" #include "comm.h" @@ -44,7 +44,7 @@ Please contact Timothy Sirk for questions (tim.sirk@us.army.mil). #include "thermo.h" #include "output.h" #include "citeme.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -362,12 +362,12 @@ void PairSRP::settings(int narg, char **arg) if (atom->tag_enable == 0) error->all(FLERR,"Pair_style srp requires atom IDs"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // wildcard if (strcmp(arg[1],"*") == 0) { btype = 0; } else { - btype = force->inumeric(FLERR,arg[1]); + btype = utils::inumeric(FLERR,arg[1],false,lmp); if ((btype > atom->nbondtypes) || (btype <= 0)) error->all(FLERR,"Illegal pair_style command"); } @@ -401,7 +401,7 @@ void PairSRP::settings(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"bptype") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair srp command"); - bptype = force->inumeric(FLERR,arg[iarg+1]); + bptype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if ((bptype < 1) || (bptype > atom->ntypes)) error->all(FLERR,"Illegal bond particle type for srp"); iarg += 2; @@ -429,12 +429,12 @@ void PairSRP::coeff(int narg, char **arg) // set ij bond-bond cutoffs int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], bptype, ilo, ihi); - force->bounds(FLERR,arg[1], bptype, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, bptype, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, bptype, jlo, jhi, error); - double a0_one = force->numeric(FLERR,arg[2]); + double a0_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 4df172a001..1f5cfddff1 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -21,9 +21,9 @@ ------------------------------------------------------------------------- */ #include "pair_tersoff_table.h" -#include + #include -#include + #include #include "atom.h" #include "neighbor.h" @@ -32,7 +32,7 @@ #include "force.h" #include "comm.h" #include "memory.h" -#include "utils.h" + #include "tokenizer.h" #include "potential_file_reader.h" diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 866f923fb9..8d7a4ee2c9 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -67,9 +67,9 @@ void TemperGrem::command(int narg, char **arg) if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper command"); - int nsteps = force->inumeric(FLERR,arg[0]); - nevery = force->inumeric(FLERR,arg[1]); - double lambda = force->numeric(FLERR,arg[2]); + int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); + nevery = utils::inumeric(FLERR,arg[1],false,lmp); + double lambda = utils::numeric(FLERR,arg[2],false,lmp); // ignore temper command, if walltime limit was already reached if (timer->is_timeout()) return; @@ -106,11 +106,11 @@ void TemperGrem::command(int narg, char **arg) pressref = p_start[0]; } - seed_swap = force->inumeric(FLERR,arg[5]); - seed_boltz = force->inumeric(FLERR,arg[6]); + seed_swap = utils::inumeric(FLERR,arg[5],false,lmp); + seed_boltz = utils::inumeric(FLERR,arg[6],false,lmp); my_set_lambda = universe->iworld; - if (narg == 8) my_set_lambda = force->inumeric(FLERR,arg[7]); + if (narg == 8) my_set_lambda = utils::inumeric(FLERR,arg[7],false,lmp); if ((my_set_lambda < 0) || (my_set_lambda >= universe->nworlds)) error->universe_one(FLERR,"Illegal temperature index"); diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index d0a14d8e4d..69f4559cac 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -18,22 +18,23 @@ ------------------------------------------------------------------------- */ #include "temper_npt.h" -#include -#include -#include "universe.h" -#include "domain.h" + #include "atom.h" -#include "update.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "fix.h" +#include "force.h" #include "integrate.h" #include "modify.h" -#include "compute.h" -#include "force.h" -#include "fix.h" #include "random_park.h" -#include "finish.h" #include "timer.h" -#include "error.h" -#include "utils.h" +#include "universe.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -69,10 +70,10 @@ void TemperNPT::command(int narg, char **arg) if (narg != 7 && narg != 8) error->universe_all(FLERR,"Illegal temper/npt command"); - int nsteps = force->inumeric(FLERR,arg[0]); - nevery = force->inumeric(FLERR,arg[1]); - double temp = force->numeric(FLERR,arg[2]); - double press_set = force->numeric(FLERR,arg[6]); + int nsteps = utils::inumeric(FLERR,arg[0],false,lmp); + nevery = utils::inumeric(FLERR,arg[1],false,lmp); + double temp = utils::numeric(FLERR,arg[2],false,lmp); + double press_set = utils::numeric(FLERR,arg[6],false,lmp); // ignore temper command, if walltime limit was already reached @@ -83,11 +84,11 @@ void TemperNPT::command(int narg, char **arg) if (whichfix == modify->nfix) error->universe_all(FLERR,"Tempering fix ID is not defined"); - seed_swap = force->inumeric(FLERR,arg[4]); - seed_boltz = force->inumeric(FLERR,arg[5]); + seed_swap = utils::inumeric(FLERR,arg[4],false,lmp); + seed_boltz = utils::inumeric(FLERR,arg[5],false,lmp); my_set_temp = universe->iworld; - if (narg == 8) my_set_temp = force->inumeric(FLERR,arg[6]); + if (narg == 8) my_set_temp = utils::inumeric(FLERR,arg[6],false,lmp); // swap frequency must evenly divide total # of timesteps diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index 839148bc13..7ef134405d 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "angle_class2_p6.h" -#include + #include #include #include "atom.h" @@ -28,7 +28,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -280,16 +280,16 @@ void AngleClass2P6::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; if (strcmp(arg[1],"bb") == 0) { if (narg != 5) error->all(FLERR,"Incorrect args for angle coefficients"); - double bb_k_one = force->numeric(FLERR,arg[2]); - double bb_r1_one = force->numeric(FLERR,arg[3]); - double bb_r2_one = force->numeric(FLERR,arg[4]); + double bb_k_one = utils::numeric(FLERR,arg[2],false,lmp); + double bb_r1_one = utils::numeric(FLERR,arg[3],false,lmp); + double bb_r2_one = utils::numeric(FLERR,arg[4],false,lmp); for (int i = ilo; i <= ihi; i++) { bb_k[i] = bb_k_one; @@ -302,10 +302,10 @@ void AngleClass2P6::coeff(int narg, char **arg) } else if (strcmp(arg[1],"ba") == 0) { if (narg != 6) error->all(FLERR,"Incorrect args for angle coefficients"); - double ba_k1_one = force->numeric(FLERR,arg[2]); - double ba_k2_one = force->numeric(FLERR,arg[3]); - double ba_r1_one = force->numeric(FLERR,arg[4]); - double ba_r2_one = force->numeric(FLERR,arg[5]); + double ba_k1_one = utils::numeric(FLERR,arg[2],false,lmp); + double ba_k2_one = utils::numeric(FLERR,arg[3],false,lmp); + double ba_r1_one = utils::numeric(FLERR,arg[4],false,lmp); + double ba_r2_one = utils::numeric(FLERR,arg[5],false,lmp); for (int i = ilo; i <= ihi; i++) { ba_k1[i] = ba_k1_one; @@ -319,12 +319,12 @@ void AngleClass2P6::coeff(int narg, char **arg) } else { if (narg != 7) error->all(FLERR,"Incorrect args for angle coefficients"); - double theta0_one = force->numeric(FLERR,arg[1]); - double k2_one = force->numeric(FLERR,arg[2]); - double k3_one = force->numeric(FLERR,arg[3]); - double k4_one = force->numeric(FLERR,arg[4]); - double k5_one = force->numeric(FLERR,arg[5]); - double k6_one = force->numeric(FLERR,arg[6]); + double theta0_one = utils::numeric(FLERR,arg[1],false,lmp); + double k2_one = utils::numeric(FLERR,arg[2],false,lmp); + double k3_one = utils::numeric(FLERR,arg[3],false,lmp); + double k4_one = utils::numeric(FLERR,arg[4],false,lmp); + double k5_one = utils::numeric(FLERR,arg[5],false,lmp); + double k6_one = utils::numeric(FLERR,arg[6],false,lmp); // convert theta0 from degrees to radians diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index a6643601c1..1bede58751 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "angle_cosine_buck6d.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -28,7 +28,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -251,11 +251,11 @@ void AngleCosineBuck6d::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); - double c_one = force->numeric(FLERR,arg[1]); - int n_one = force->inumeric(FLERR,arg[2]); - int th0_one = force->numeric(FLERR,arg[3]); + double c_one = utils::numeric(FLERR,arg[1],false,lmp); + int n_one = utils::inumeric(FLERR,arg[2],false,lmp); + int th0_one = utils::numeric(FLERR,arg[3],false,lmp); if (n_one <= 0) error->all(FLERR,"Incorrect args for angle coefficients"); diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index e38b82067d..bbe6e48a35 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -20,7 +20,7 @@ ------------------------------------------------------------------------- */ #include "improper_inversion_harmonic.h" -#include + #include #include "atom.h" #include "comm.h" @@ -29,7 +29,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -276,10 +276,10 @@ void ImproperInversionHarmonic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double w_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double w_one = utils::numeric(FLERR,arg[2],false,lmp); // convert w0 from degrees to radians diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index 57a935a0b3..0de5423d30 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -29,7 +29,7 @@ #include "memory.h" #include "math_const.h" #include "error.h" -#include "utils.h" + #include "math_special.h" using namespace LAMMPS_NS; @@ -247,11 +247,11 @@ void PairBuck6dCoulGaussDSF::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - vdwl_smooth = force->numeric(FLERR,arg[0]); + vdwl_smooth = utils::numeric(FLERR,arg[0],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[1]); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -275,17 +275,17 @@ void PairBuck6dCoulGaussDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double buck6d1_one = force->numeric(FLERR,arg[2]); - double buck6d2_one = force->numeric(FLERR,arg[3]); - double buck6d3_one = force->numeric(FLERR,arg[4]); - double buck6d4_one = force->numeric(FLERR,arg[5]); - double alpha_one = force->numeric(FLERR,arg[6]); + double buck6d1_one = utils::numeric(FLERR,arg[2],false,lmp); + double buck6d2_one = utils::numeric(FLERR,arg[3],false,lmp); + double buck6d3_one = utils::numeric(FLERR,arg[4],false,lmp); + double buck6d4_one = utils::numeric(FLERR,arg[5],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 8) cut_lj_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_lj_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index d3ccec3a55..c6ba832fff 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_buck6d_coul_gauss_long.h" -#include + #include #include #include "atom.h" @@ -29,7 +29,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "math_special.h" using namespace LAMMPS_NS; @@ -262,12 +262,12 @@ void PairBuck6dCoulGaussLong::settings(int narg, char **arg) { if (narg < 3 || narg > 4) error->all(FLERR,"Illegal pair_style command"); - vdwl_smooth = force->numeric(FLERR,arg[0]); - coul_smooth = force->numeric(FLERR,arg[1]); + vdwl_smooth = utils::numeric(FLERR,arg[0],false,lmp); + coul_smooth = utils::numeric(FLERR,arg[1],false,lmp); - cut_lj_global = force->numeric(FLERR,arg[2]); + cut_lj_global = utils::numeric(FLERR,arg[2],false,lmp); if (narg == 3) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[3]); + else cut_coul = utils::numeric(FLERR,arg[3],false,lmp); // reset cutoffs that have been explicitly set @@ -291,17 +291,17 @@ void PairBuck6dCoulGaussLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double buck6d1_one = force->numeric(FLERR,arg[2]); - double buck6d2_one = force->numeric(FLERR,arg[3]); - double buck6d3_one = force->numeric(FLERR,arg[4]); - double buck6d4_one = force->numeric(FLERR,arg[5]); - double alpha_one = force->numeric(FLERR,arg[6]); + double buck6d1_one = utils::numeric(FLERR,arg[2],false,lmp); + double buck6d2_one = utils::numeric(FLERR,arg[3],false,lmp); + double buck6d3_one = utils::numeric(FLERR,arg[4],false,lmp); + double buck6d4_one = utils::numeric(FLERR,arg[5],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 8) cut_lj_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_lj_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-MOLFILE/dump_molfile.cpp b/src/USER-MOLFILE/dump_molfile.cpp index d9d8ec3c97..e0e92f9339 100644 --- a/src/USER-MOLFILE/dump_molfile.cpp +++ b/src/USER-MOLFILE/dump_molfile.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "dump_molfile.h" -#include + #include #include #include "domain.h" diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index 798beaee09..90a5781fff 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -16,10 +16,10 @@ ------------------------------------------------------------------------- */ #include "molfile_interface.h" +#include "molfile_plugin.h" #include #include -#include #include #include #include @@ -31,8 +31,6 @@ #include #endif -#include "molfile_plugin.h" - #if vmdplugin_ABIVERSION < 16 #error "unsupported VMD molfile plugin ABI version" #endif diff --git a/src/USER-MOLFILE/reader_molfile.cpp b/src/USER-MOLFILE/reader_molfile.cpp index 292a451a87..d26a4d4ba0 100644 --- a/src/USER-MOLFILE/reader_molfile.cpp +++ b/src/USER-MOLFILE/reader_molfile.cpp @@ -16,15 +16,14 @@ ------------------------------------------------------------------------- */ #include "reader_molfile.h" -#include -#include -#include "comm.h" -#include "memory.h" -#include "error.h" - #include "molfile_interface.h" -#include "math_const.h" +#include "comm.h" +#include "error.h" +#include "math_const.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; typedef MolfileInterface MFI; using namespace MathConst; diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp index f297ef45eb..f936de6d02 100644 --- a/src/USER-NETCDF/dump_netcdf.cpp +++ b/src/USER-NETCDF/dump_netcdf.cpp @@ -18,7 +18,7 @@ #if defined(LMP_HAS_NETCDF) #include -#include + #include #include #include "dump_netcdf.h" @@ -990,7 +990,7 @@ int DumpNetCDF::modify_param(int narg, char **arg) iarg++; if (iarg >= narg) error->all(FLERR,"expected additional arg after 'at' keyword."); - framei = force->inumeric(FLERR,arg[iarg]); + framei = utils::inumeric(FLERR,arg[iarg],false,lmp); if (framei == 0) error->all(FLERR,"frame 0 not allowed for 'at' keyword."); else if (framei < 0) framei--; iarg++; diff --git a/src/USER-NETCDF/dump_netcdf_mpiio.cpp b/src/USER-NETCDF/dump_netcdf_mpiio.cpp index 026a6eaa3a..19b0632922 100644 --- a/src/USER-NETCDF/dump_netcdf_mpiio.cpp +++ b/src/USER-NETCDF/dump_netcdf_mpiio.cpp @@ -18,7 +18,7 @@ #if defined(LMP_HAS_PNETCDF) #include -#include + #include #include #include "dump_netcdf_mpiio.h" @@ -1003,7 +1003,7 @@ int DumpNetCDFMPIIO::modify_param(int narg, char **arg) iarg++; if (iarg >= narg) error->all(FLERR,"expected additional arg after 'at' keyword."); - framei = force->inumeric(FLERR,arg[iarg]); + framei = utils::inumeric(FLERR,arg[iarg],false,lmp); if (framei == 0) error->all(FLERR,"frame 0 not allowed for 'at' keyword."); else if (framei < 0) framei--; iarg++; diff --git a/src/USER-OMP/angle_charmm_omp.cpp b/src/USER-OMP/angle_charmm_omp.cpp index 6933afdcd9..abc23367b1 100644 --- a/src/USER-OMP/angle_charmm_omp.cpp +++ b/src/USER-OMP/angle_charmm_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_class2_omp.cpp b/src/USER-OMP/angle_class2_omp.cpp index 09ee59d5af..b33b1c2e2f 100644 --- a/src/USER-OMP/angle_class2_omp.cpp +++ b/src/USER-OMP/angle_class2_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_cosine_delta_omp.cpp b/src/USER-OMP/angle_cosine_delta_omp.cpp index ca5afe1449..0c209d3fe5 100644 --- a/src/USER-OMP/angle_cosine_delta_omp.cpp +++ b/src/USER-OMP/angle_cosine_delta_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_cosine_omp.cpp b/src/USER-OMP/angle_cosine_omp.cpp index 48fdd9ba60..cbeb10e08c 100644 --- a/src/USER-OMP/angle_cosine_omp.cpp +++ b/src/USER-OMP/angle_cosine_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_cosine_periodic_omp.cpp b/src/USER-OMP/angle_cosine_periodic_omp.cpp index a0e45fe131..b59046031a 100644 --- a/src/USER-OMP/angle_cosine_periodic_omp.cpp +++ b/src/USER-OMP/angle_cosine_periodic_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "math_special.h" #include "suffix.h" diff --git a/src/USER-OMP/angle_cosine_shift_exp_omp.cpp b/src/USER-OMP/angle_cosine_shift_exp_omp.cpp index 21019336b3..4870e6a3bb 100644 --- a/src/USER-OMP/angle_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/angle_cosine_shift_exp_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_cosine_shift_omp.cpp b/src/USER-OMP/angle_cosine_shift_omp.cpp index 1e6d712b62..bec65caf6d 100644 --- a/src/USER-OMP/angle_cosine_shift_omp.cpp +++ b/src/USER-OMP/angle_cosine_shift_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_cosine_squared_omp.cpp b/src/USER-OMP/angle_cosine_squared_omp.cpp index 6df1e028a0..dced90a967 100644 --- a/src/USER-OMP/angle_cosine_squared_omp.cpp +++ b/src/USER-OMP/angle_cosine_squared_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_dipole_omp.cpp b/src/USER-OMP/angle_dipole_omp.cpp index 26d8a7817e..cea707161f 100644 --- a/src/USER-OMP/angle_dipole_omp.cpp +++ b/src/USER-OMP/angle_dipole_omp.cpp @@ -23,7 +23,7 @@ #include "error.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_fourier_omp.cpp b/src/USER-OMP/angle_fourier_omp.cpp index b6ddea3ff9..ec9236902c 100644 --- a/src/USER-OMP/angle_fourier_omp.cpp +++ b/src/USER-OMP/angle_fourier_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_fourier_simple_omp.cpp b/src/USER-OMP/angle_fourier_simple_omp.cpp index 992acf7c99..774f06f809 100644 --- a/src/USER-OMP/angle_fourier_simple_omp.cpp +++ b/src/USER-OMP/angle_fourier_simple_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_harmonic_omp.cpp b/src/USER-OMP/angle_harmonic_omp.cpp index 0cfc6f95af..5c81e3cba4 100644 --- a/src/USER-OMP/angle_harmonic_omp.cpp +++ b/src/USER-OMP/angle_harmonic_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_quartic_omp.cpp b/src/USER-OMP/angle_quartic_omp.cpp index a774edb8c4..d6e9285f11 100644 --- a/src/USER-OMP/angle_quartic_omp.cpp +++ b/src/USER-OMP/angle_quartic_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/angle_sdk_omp.cpp b/src/USER-OMP/angle_sdk_omp.cpp index e0bc021f1b..45d6c83aa1 100644 --- a/src/USER-OMP/angle_sdk_omp.cpp +++ b/src/USER-OMP/angle_sdk_omp.cpp @@ -20,7 +20,7 @@ #include #include "atom.h" #include "neighbor.h" -#include "timer.h" + #include "comm.h" #include "force.h" #include "lj_sdk_common.h" diff --git a/src/USER-OMP/angle_table_omp.cpp b/src/USER-OMP/angle_table_omp.cpp index 1af60f85f6..f67d340176 100644 --- a/src/USER-OMP/angle_table_omp.cpp +++ b/src/USER-OMP/angle_table_omp.cpp @@ -22,7 +22,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/bond_class2_omp.cpp b/src/USER-OMP/bond_class2_omp.cpp index 06edf46024..9c52bdb281 100644 --- a/src/USER-OMP/bond_class2_omp.cpp +++ b/src/USER-OMP/bond_class2_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/bond_fene_expand_omp.cpp b/src/USER-OMP/bond_fene_expand_omp.cpp index 5f3dd48841..38df4f50da 100644 --- a/src/USER-OMP/bond_fene_expand_omp.cpp +++ b/src/USER-OMP/bond_fene_expand_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "error.h" #include "update.h" diff --git a/src/USER-OMP/bond_fene_omp.cpp b/src/USER-OMP/bond_fene_omp.cpp index ebf5afdc57..5dde355a76 100644 --- a/src/USER-OMP/bond_fene_omp.cpp +++ b/src/USER-OMP/bond_fene_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "error.h" #include "update.h" diff --git a/src/USER-OMP/bond_gromos_omp.cpp b/src/USER-OMP/bond_gromos_omp.cpp index d4d2d25601..012737f77d 100644 --- a/src/USER-OMP/bond_gromos_omp.cpp +++ b/src/USER-OMP/bond_gromos_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index 9160ee7023..e8f17d5eae 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp index 7a6c616e4a..61a60fa995 100644 --- a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index 19f0a08510..50b4ed98a7 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/bond_morse_omp.cpp b/src/USER-OMP/bond_morse_omp.cpp index 90318c8faf..51586370f5 100644 --- a/src/USER-OMP/bond_morse_omp.cpp +++ b/src/USER-OMP/bond_morse_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index 809950f2b7..720d660eae 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/bond_quartic_omp.cpp b/src/USER-OMP/bond_quartic_omp.cpp index 0efaa10e37..bc1ae96ac9 100644 --- a/src/USER-OMP/bond_quartic_omp.cpp +++ b/src/USER-OMP/bond_quartic_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include "pair.h" #include diff --git a/src/USER-OMP/bond_table_omp.cpp b/src/USER-OMP/bond_table_omp.cpp index f503bcab26..3ccc65441a 100644 --- a/src/USER-OMP/bond_table_omp.cpp +++ b/src/USER-OMP/bond_table_omp.cpp @@ -21,7 +21,7 @@ #include "comm.h" #include "force.h" #include "neighbor.h" -#include "timer.h" + #include diff --git a/src/USER-OMP/dihedral_charmm_omp.cpp b/src/USER-OMP/dihedral_charmm_omp.cpp index afd3071434..8454dc1004 100644 --- a/src/USER-OMP/dihedral_charmm_omp.cpp +++ b/src/USER-OMP/dihedral_charmm_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "pair.h" #include "update.h" diff --git a/src/USER-OMP/dihedral_class2_omp.cpp b/src/USER-OMP/dihedral_class2_omp.cpp index 49b8659e2f..cf65d735a6 100644 --- a/src/USER-OMP/dihedral_class2_omp.cpp +++ b/src/USER-OMP/dihedral_class2_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp index cea22adf1b..5d9164d3b3 100644 --- a/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/USER-OMP/dihedral_cosine_shift_exp_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/dihedral_fourier_omp.cpp b/src/USER-OMP/dihedral_fourier_omp.cpp index 756931774a..be19a6d958 100644 --- a/src/USER-OMP/dihedral_fourier_omp.cpp +++ b/src/USER-OMP/dihedral_fourier_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/dihedral_harmonic_omp.cpp b/src/USER-OMP/dihedral_harmonic_omp.cpp index d1f511954e..3d51a4db43 100644 --- a/src/USER-OMP/dihedral_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_harmonic_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/dihedral_helix_omp.cpp b/src/USER-OMP/dihedral_helix_omp.cpp index 5289fc2c62..5209fac23a 100644 --- a/src/USER-OMP/dihedral_helix_omp.cpp +++ b/src/USER-OMP/dihedral_helix_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "math_const.h" diff --git a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp index edf8a20899..a6e0ab66d6 100644 --- a/src/USER-OMP/dihedral_multi_harmonic_omp.cpp +++ b/src/USER-OMP/dihedral_multi_harmonic_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/dihedral_nharmonic_omp.cpp b/src/USER-OMP/dihedral_nharmonic_omp.cpp index bf51a01713..4604771912 100644 --- a/src/USER-OMP/dihedral_nharmonic_omp.cpp +++ b/src/USER-OMP/dihedral_nharmonic_omp.cpp @@ -24,7 +24,7 @@ #include "force.h" #include "update.h" #include "error.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/dihedral_opls_omp.cpp b/src/USER-OMP/dihedral_opls_omp.cpp index 8814d3f3f0..ff0f6bb12b 100644 --- a/src/USER-OMP/dihedral_opls_omp.cpp +++ b/src/USER-OMP/dihedral_opls_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/dihedral_quadratic_omp.cpp b/src/USER-OMP/dihedral_quadratic_omp.cpp index e61c5f0d85..5ffb8d64f2 100644 --- a/src/USER-OMP/dihedral_quadratic_omp.cpp +++ b/src/USER-OMP/dihedral_quadratic_omp.cpp @@ -24,7 +24,7 @@ #include "force.h" #include "update.h" #include "error.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/dihedral_table_omp.cpp b/src/USER-OMP/dihedral_table_omp.cpp index bf5332a1c1..c18d5fb4c0 100644 --- a/src/USER-OMP/dihedral_table_omp.cpp +++ b/src/USER-OMP/dihedral_table_omp.cpp @@ -23,7 +23,7 @@ #include "domain.h" #include "neighbor.h" #include "force.h" -#include "timer.h" + #include "math_const.h" #include "math_extra.h" diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index ec8d708da2..d5480d2a9f 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -15,18 +15,18 @@ Contributing authors: Roy Pollock (LLNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "ewald_omp.h" -#include -#include + #include "atom.h" #include "comm.h" #include "force.h" -#include "memory.h" -#include "timer.h" #include "math_const.h" - +#include "memory.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/fix_nh_asphere_omp.cpp b/src/USER-OMP/fix_nh_asphere_omp.cpp index 9c7317bebd..26cad769ec 100644 --- a/src/USER-OMP/fix_nh_asphere_omp.cpp +++ b/src/USER-OMP/fix_nh_asphere_omp.cpp @@ -15,19 +15,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include -#include -#include "math_extra.h" #include "fix_nh_asphere_omp.h" + #include "atom.h" #include "atom_vec_ellipsoid.h" #include "compute.h" -#include "group.h" -#include "memory.h" #include "error.h" +#include "math_extra.h" +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index 51e65d24ed..f3c86a7746 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -16,7 +16,9 @@ OpenMP based threading support for LAMMPS ------------------------------------------------------------------------- */ -#include "omp_compat.h" +#include "fix_omp.h" +#include "thr_data.h" + #include "atom.h" #include "comm.h" #include "error.h" @@ -25,10 +27,6 @@ #include "neigh_request.h" #include "universe.h" #include "update.h" -#include "timer.h" - -#include "fix_omp.h" -#include "thr_data.h" #include "pair_hybrid.h" #include "bond_hybrid.h" @@ -39,6 +37,7 @@ #include +#include "omp_compat.h" #if defined(_OPENMP) #include #endif @@ -75,7 +74,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) #pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(nthreads) nthreads = omp_get_num_threads(); else - nthreads = force->inumeric(FLERR,arg[3]); + nthreads = utils::inumeric(FLERR,arg[3],false,lmp); #endif } diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index b0573dfa97..5b2ee88420 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_comb_omp.h" -#include + #include #include #include "pair_comb.h" diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index a10d3127a9..ef0f918cbf 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -32,7 +32,7 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_reax_omp.h" -#include + #include #include "pair_reaxc.h" #include "atom.h" diff --git a/src/USER-OMP/fix_rigid_nh_omp.cpp b/src/USER-OMP/fix_rigid_nh_omp.cpp index 63084fcc9e..d56b633bd0 100644 --- a/src/USER-OMP/fix_rigid_nh_omp.cpp +++ b/src/USER-OMP/fix_rigid_nh_omp.cpp @@ -15,10 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_rigid_nh_omp.h" -#include -#include + #include "atom.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" @@ -29,18 +27,20 @@ #include "error.h" #include "force.h" #include "kspace.h" +#include "math_const.h" +#include "math_extra.h" #include "modify.h" +#include "rigid_const.h" #include "update.h" -#include "timer.h" +#include +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif -#include "math_extra.h" -#include "math_const.h" -#include "rigid_const.h" - using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; diff --git a/src/USER-OMP/fix_rigid_omp.cpp b/src/USER-OMP/fix_rigid_omp.cpp index 9f78f6dc26..62f853d23b 100644 --- a/src/USER-OMP/fix_rigid_omp.cpp +++ b/src/USER-OMP/fix_rigid_omp.cpp @@ -17,7 +17,7 @@ #include "omp_compat.h" #include "fix_rigid_omp.h" -#include + #include #include #include "atom.h" diff --git a/src/USER-OMP/fix_rigid_small_omp.cpp b/src/USER-OMP/fix_rigid_small_omp.cpp index 227b0e1f8a..f720dd617e 100644 --- a/src/USER-OMP/fix_rigid_small_omp.cpp +++ b/src/USER-OMP/fix_rigid_small_omp.cpp @@ -24,7 +24,7 @@ #include "atom_vec_tri.h" #include "comm.h" #include "domain.h" -#include "timer.h" + #if defined(_OPENMP) #include diff --git a/src/USER-OMP/improper_class2_omp.cpp b/src/USER-OMP/improper_class2_omp.cpp index 8927980951..05fc8e4475 100644 --- a/src/USER-OMP/improper_class2_omp.cpp +++ b/src/USER-OMP/improper_class2_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/improper_cossq_omp.cpp b/src/USER-OMP/improper_cossq_omp.cpp index 72d76e8c42..e2a43c58c4 100644 --- a/src/USER-OMP/improper_cossq_omp.cpp +++ b/src/USER-OMP/improper_cossq_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/improper_cvff_omp.cpp b/src/USER-OMP/improper_cvff_omp.cpp index e9ff4bfc73..715819cfb9 100644 --- a/src/USER-OMP/improper_cvff_omp.cpp +++ b/src/USER-OMP/improper_cvff_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/improper_fourier_omp.cpp b/src/USER-OMP/improper_fourier_omp.cpp index 0671bdc375..93dfb9bc99 100644 --- a/src/USER-OMP/improper_fourier_omp.cpp +++ b/src/USER-OMP/improper_fourier_omp.cpp @@ -15,18 +15,20 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "improper_fourier_omp.h" + #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "timer.h" -#include "force.h" -#include "update.h" #include "error.h" - +#include "force.h" +#include "neighbor.h" #include "suffix.h" + +#include "update.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define TOLERANCE 0.05 diff --git a/src/USER-OMP/improper_harmonic_omp.cpp b/src/USER-OMP/improper_harmonic_omp.cpp index 8bef42bf23..6bb76871b2 100644 --- a/src/USER-OMP/improper_harmonic_omp.cpp +++ b/src/USER-OMP/improper_harmonic_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/improper_ring_omp.cpp b/src/USER-OMP/improper_ring_omp.cpp index 4ba67aab70..51ea5e5198 100644 --- a/src/USER-OMP/improper_ring_omp.cpp +++ b/src/USER-OMP/improper_ring_omp.cpp @@ -15,17 +15,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "improper_ring_omp.h" -#include + #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "timer.h" #include "force.h" #include "math_special.h" - +#include "neighbor.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathSpecial; diff --git a/src/USER-OMP/improper_umbrella_omp.cpp b/src/USER-OMP/improper_umbrella_omp.cpp index bf466afb19..0c9befade6 100644 --- a/src/USER-OMP/improper_umbrella_omp.cpp +++ b/src/USER-OMP/improper_umbrella_omp.cpp @@ -21,7 +21,7 @@ #include "atom.h" #include "comm.h" #include "neighbor.h" -#include "timer.h" + #include "force.h" #include "update.h" #include "error.h" diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index 95f9cdb3e8..c42aa8e0c1 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -16,24 +16,24 @@ Original MSM class by: Paul Crozier, Stan Moore, Stephen Bond, (all SNL) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "msm_cg_omp.h" -#include -#include -#include -#include #include "atom.h" -#include "gridcomm.h" #include "domain.h" #include "error.h" #include "force.h" -#include "neighbor.h" +#include "gridcomm.h" #include "memory.h" +#include "neighbor.h" #include "thr_omp.h" -#include "timer.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include + +#include "omp_compat.h" +#if defined(_OPENMP) +#include +#endif using namespace LAMMPS_NS; @@ -62,7 +62,7 @@ void MSMCGOMP::settings(int narg, char **arg) MSMOMP::settings(narg,arg); - if (narg == 2) smallq = fabs(force->numeric(FLERR,arg[1])); + if (narg == 2) smallq = fabs(utils::numeric(FLERR,arg[1],false,Pointers::lmp)); else smallq = SMALLQ; } diff --git a/src/USER-OMP/msm_omp.cpp b/src/USER-OMP/msm_omp.cpp index 2689226725..783ebb40f1 100644 --- a/src/USER-OMP/msm_omp.cpp +++ b/src/USER-OMP/msm_omp.cpp @@ -15,14 +15,15 @@ Contributing authors: Axel Kohlmeyer (Temple U), Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "msm_omp.h" -#include + #include "comm.h" #include "domain.h" #include "error.h" -#include "timer.h" +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 63a539c93c..97d94e5513 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -12,19 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "pair_adp_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index b61bf52e4e..de6903aab9 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -12,21 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include -#include // requires C++-11 #include "pair_agni_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "math_special.h" #include "math_const.h" - +#include "math_special.h" +#include "neigh_list.h" #include "suffix.h" + +#include +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_airebo_morse_omp.cpp b/src/USER-OMP/pair_airebo_morse_omp.cpp index 5d5ac0b885..6977842af2 100644 --- a/src/USER-OMP/pair_airebo_morse_omp.cpp +++ b/src/USER-OMP/pair_airebo_morse_omp.cpp @@ -12,8 +12,6 @@ ------------------------------------------------------------------------- */ #include "pair_airebo_morse_omp.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index 25d6c35174..837734d6e4 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -12,24 +12,24 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_airebo_omp.h" + #include "atom.h" #include "comm.h" #include "error.h" -#include "force.h" +#include "math_special.h" #include "memory.h" #include "my_page.h" -#include "math_special.h" -#include "neighbor.h" #include "neigh_list.h" +#include "suffix.h" +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif -#include "suffix.h" using namespace LAMMPS_NS; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index bb41334153..01e33dc5c5 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -20,7 +20,7 @@ #include "force.h" #include "neigh_list.h" #include "math_special.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index 7f92ab6734..b410c998e1 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_born_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index eec1765859..4adba396e8 100644 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -12,17 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_born_coul_msm_omp.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index ffa069ec4e..9bc6507c6a 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -20,7 +20,7 @@ #include "force.h" #include "neigh_list.h" #include "math_const.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index aaac28d07c..e74f0139c1 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -19,7 +19,7 @@ #include "comm.h" #include "force.h" #include "neigh_list.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index ca28fa14bb..b7b82c3dac 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -12,26 +12,25 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pair_brownian_omp.h" -#include + #include "atom.h" #include "comm.h" #include "domain.h" +#include "fix_wall.h" #include "force.h" #include "input.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "variable.h" -#include "random_mars.h" #include "math_const.h" #include "math_special.h" -#include "timer.h" - -#include "fix_wall.h" - +#include "neigh_list.h" +#include "random_mars.h" #include "suffix.h" +#include "update.h" +#include "variable.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index 939bc223eb..4d8b457281 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -12,25 +12,25 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pair_brownian_poly_omp.h" -#include + #include "atom.h" #include "comm.h" #include "domain.h" +#include "fix_wall.h" #include "force.h" #include "input.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "variable.h" -#include "random_mars.h" -#include "fix_wall.h" - #include "math_const.h" #include "math_special.h" - +#include "neigh_list.h" +#include "random_mars.h" #include "suffix.h" +#include "update.h" +#include "variable.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 4154c1281c..1c433f8083 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_buck_coul_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 1be2b7272f..264073a07e 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_buck_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index b26243b19a..631a1ee61d 100644 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -12,17 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_buck_coul_msm_omp.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp index a2e34b9a1b..00ab1c248c 100644 --- a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp @@ -11,18 +11,19 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ - -#include "omp_compat.h" -#include -#include "math_vector.h" #include "pair_buck_long_coul_long_omp.h" + #include "atom.h" #include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" #include "force.h" - +#include "math_vector.h" +#include "neigh_list.h" #include "suffix.h" + +#include +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index fc85d79c81..bddacaf5b5 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -19,7 +19,7 @@ #include "comm.h" #include "force.h" #include "neigh_list.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index cce588f516..94325232fc 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -12,18 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_colloid_omp.h" + #include "atom.h" #include "comm.h" #include "error.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" #include "math_special.h" - +#include "neigh_list.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 8912cbc243..9a0155d6d3 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -12,19 +12,21 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_comb_omp.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "group.h" -#include "force.h" #include "memory.h" #include "my_page.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" +#if defined(_OPENMP) +#include +#endif using namespace LAMMPS_NS; #define MAXNEIGH 24 diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index 69eb9ac0f3..57b821cb8b 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -19,7 +19,7 @@ #include "comm.h" #include "force.h" #include "neigh_list.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_coul_cut_soft_omp.cpp index 89222903ec..f8b3a36e39 100644 --- a/src/USER-OMP/pair_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_soft_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_coul_cut_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index c22f7340c4..1bb8676998 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -19,7 +19,7 @@ #include "comm.h" #include "force.h" #include "neigh_list.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index 656cdc9421..62f2580426 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_coul_diel_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_coul_dsf_omp.cpp b/src/USER-OMP/pair_coul_dsf_omp.cpp index ddcc8dbeb0..3a8db45634 100644 --- a/src/USER-OMP/pair_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_coul_dsf_omp.cpp @@ -19,7 +19,7 @@ #include "comm.h" #include "force.h" #include "neigh_list.h" -#include "timer.h" + #include "suffix.h" #include "math_const.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index 6c9b9d034d..92cb51f7a4 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_coul_long_soft_omp.cpp b/src/USER-OMP/pair_coul_long_soft_omp.cpp index ff3267fb38..28ba13d5cf 100644 --- a/src/USER-OMP/pair_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_long_soft_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_coul_long_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index 32a657e286..e907d63eb1 100644 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -12,17 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_coul_msm_omp.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index d0f6fdb125..71e8148a50 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -20,7 +20,7 @@ #include "force.h" #include "neigh_list.h" #include "math_const.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index f3a1c29a70..6e3da77cbe 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -21,7 +21,7 @@ #include "neigh_list.h" #include "update.h" #include "random_mars.h" -#include "timer.h" + #include "suffix.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 06e80274bd..823367109b 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -12,18 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_dpd_tstat_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" -#include "update.h" #include "random_mars.h" - #include "suffix.h" +#include "update.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EPSILON 1.0e-10 diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index 3e0e423f3d..c7559420bc 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -15,18 +15,16 @@ Contributing authors: Stephen Foiles (SNL), Murray Daw (SNL) ------------------------------------------------------------------------- */ -#include -#include -#include #include "pair_eam_alloy_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index 76e9840a5c..66a7581c21 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -15,18 +15,16 @@ Contributing authors: Tim Lau (MIT) ------------------------------------------------------------------------- */ -#include -#include -#include #include "pair_eam_fs_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "tokenizer.h" +#include "memory.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index 60ae65def5..e6ba299a4d 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -12,19 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include - #include "pair_eam_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index 0e59674b0e..864ff68f7a 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -12,18 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_edip_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" using namespace LAMMPS_NS; +#include + +#include "omp_compat.h" #define GRIDDENSITY 8000 #define GRIDSTART 0.1 diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 02b765a956..74b460a788 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -12,19 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include - #include "pair_eim_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index 6d5344701d..a453915738 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_gauss_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 103a766614..3e5777e4ec 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_gauss_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EPSILON 1.0e-10 diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index f0fd60a309..991c72a9be 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -12,18 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_gayberne_omp.h" -#include "math_extra.h" -#include "atom.h" -#include "comm.h" -#include "atom_vec_ellipsoid.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_list.h" +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "force.h" +#include "math_extra.h" +#include "neigh_list.h" #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index bb8bbcc984..338eb52453 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -12,22 +12,22 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_hbond_dreiding_lj_omp.h" + #include "atom.h" #include "atom_vec.h" -#include "molecule.h" #include "comm.h" #include "domain.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" - #include "math_const.h" #include "math_special.h" - +#include "molecule.h" +#include "neigh_list.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index 4ad3a8f057..5094d5c193 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -12,22 +12,22 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_hbond_dreiding_morse_omp.h" + #include "atom.h" #include "atom_vec.h" -#include "molecule.h" #include "comm.h" #include "domain.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" - #include "math_const.h" #include "math_special.h" - +#include "molecule.h" +#include "neigh_list.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index adf0aac9b2..5aeec25d13 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj96_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index f357fd9068..3ff02b6109 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -12,16 +12,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_charmm_coul_charmm_implicit_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index 55227e2e10..77caf63f18 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_charmm_coul_charmm_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index 437bd183ed..56cf0a68dd 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_charmm_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp index b32f108098..e19632dc7e 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_charmm_coul_long_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index 0000e63cda..a39ef0aa81 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -12,17 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_charmm_coul_msm_omp.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 59a6841c9e..63fb4fe529 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_class2_coul_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index 480e2adae0..f618f7f423 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_class2_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 2b91e10cfa..39cc320e44 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_class2_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 778c25393d..27f6132491 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cubic_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace PairLJCubicConstants; diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index d560b803f1..2f46e0bfe7 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp index 1c88600e7a..03f0852b06 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_cut_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 79754e704b..82031f91ab 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_debye_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp index ec69a1a1ca..7ab6f31b3f 100644 --- a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp @@ -12,17 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_dsf_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" - -#include "suffix.h" #include "math_const.h" +#include "neigh_list.h" +#include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index 618986389c..c7b6de8022 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp index ce84ba01c3..6e804bd8ae 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_long_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 58e5cee0c2..0e6d11327a 100644 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -12,17 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_msm_omp.h" + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp index 4111c5b22c..0e9a333121 100644 --- a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp @@ -12,17 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_coul_wolf_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" - -#include "suffix.h" #include "math_const.h" +#include "neigh_list.h" +#include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp index 7d5d25c39b..2cc915a435 100644 --- a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_dipole_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 3e7e92de21..2aa71026e3 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -12,16 +12,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_soft_omp.cpp index 5064c4705e..406c5f41d9 100644 --- a/src/USER-OMP/pair_lj_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_soft_omp.cpp @@ -12,16 +12,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp index 72a7d5f16a..b921c8f1c1 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp @@ -15,25 +15,21 @@ Contributing author: Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pair_lj_cut_thole_long_omp.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" +#include "error.h" #include "fix_drude.h" #include "force.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "math_const.h" -#include "error.h" +#include "neigh_list.h" #include "suffix.h" -#include "timer.h" +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.h b/src/USER-OMP/pair_lj_cut_thole_long_omp.h index dc64c5c3a2..212f3c4e2e 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.h +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.h @@ -20,7 +20,6 @@ PairStyle(lj/cut/thole/long/omp,PairLJCutTholeLongOMP) #ifndef LMP_PAIR_LJ_CUT_THOLE_LONG_OMP_H #define LMP_PAIR_LJ_CUT_THOLE_LONG_OMP_H -#include "pair.h" #include "pair_lj_cut_thole_long.h" #include "thr_omp.h" diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 70b5e436fa..89077ba6af 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_expand_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index 0f0a8de2ff..26a6e979b4 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_gromacs_coul_gromacs_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index ea2c9e8f55..3082091539 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_gromacs_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index e74f487129..cdd62ff96e 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -12,17 +12,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_long_coul_long_omp.h" + #include "atom.h" #include "comm.h" -#include "math_vector.h" #include "force.h" -#include "neighbor.h" +#include "math_vector.h" #include "neigh_list.h" - #include "suffix.h" + +#include +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index 9c8de110d7..af24e93a41 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -12,20 +12,21 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_long_tip4p_long_omp.h" + #include "atom.h" -#include "domain.h" #include "comm.h" -#include "math_vector.h" -#include "force.h" -#include "neighbor.h" +#include "domain.h" #include "error.h" +#include "force.h" #include "memory.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index 4ad082cde1..4a53f2c083 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -12,18 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_sdk_coul_long_omp.h" +#include "lj_sdk_common.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - -#include "lj_sdk_common.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace LJSDKParms; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp index 4871356b18..4b89375b5b 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp @@ -13,19 +13,19 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_sdk_coul_msm_omp.h" +#include "lj_sdk_common.h" + #include "atom.h" #include "comm.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" #include "neigh_list.h" - -#include "lj_sdk_common.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace LJSDKParms; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index 9f0671c61c..d5146c6798 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -13,18 +13,18 @@ This style is a simplified re-implementation of the CG/CMM pair style ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_sdk_omp.h" +#include "lj_sdk_common.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - -#include "lj_sdk_common.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace LJSDKParms; diff --git a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp index 1adaf93953..8828b40b98 100644 --- a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_sf_dipole_sf_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index 497c2c3a43..2c0c028189 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_smooth_linear_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index bdb9b3141e..0b4ea4e5f8 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_smooth_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index 9db4239587..caf5a11124 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -12,24 +12,22 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lubricate_omp.h" + #include "atom.h" #include "comm.h" #include "domain.h" +#include "fix_wall.h" #include "force.h" #include "input.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "variable.h" -#include "random_mars.h" -#include "fix_wall.h" -#include "fix_deform.h" #include "math_const.h" - +#include "neigh_list.h" #include "suffix.h" +#include "variable.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index dc143a3160..feb110194f 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -12,24 +12,22 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pair_lubricate_poly_omp.h" -#include + #include "atom.h" #include "comm.h" #include "domain.h" +#include "fix_wall.h" #include "force.h" #include "input.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "update.h" -#include "variable.h" -#include "random_mars.h" -#include "fix_wall.h" -#include "fix_deform.h" #include "math_const.h" - +#include "neigh_list.h" #include "suffix.h" +#include "variable.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index 19fb09dd7b..782371e843 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -12,19 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include - #include "pair_meam_spline_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" +#include "error.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index 1f566dbd42..48687781ef 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_morse_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp index f2ab417028..220fb9481d 100644 --- a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp @@ -13,16 +13,17 @@ Most code borrowed from pair_morse_omp.cpp ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_morse_smooth_linear_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; diff --git a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp index 4326434450..1cfe576a32 100644 --- a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_nm_cut_coul_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp index 970b383f7e..d9e1231827 100644 --- a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_nm_cut_coul_long_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define EWALD_F 1.12837917 diff --git a/src/USER-OMP/pair_nm_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_omp.cpp index a937668fdd..a232da1a90 100644 --- a/src/USER-OMP/pair_nm_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_nm_cut_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index cf29b5cab8..9bf707ad91 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -12,24 +12,24 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "pair_peri_lps_omp.h" -#include "fix.h" -#include "fix_peri_neigh.h" + #include "atom.h" #include "comm.h" #include "domain.h" +#include "fix_peri_neigh.h" #include "force.h" -#include "memory.h" #include "lattice.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" #include "math_const.h" - +#include "memory.h" +#include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 1990b46fe5..28df45b67f 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -12,23 +12,23 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include -#include #include "pair_peri_pmb_omp.h" -#include "fix.h" -#include "fix_peri_neigh.h" + #include "atom.h" #include "comm.h" #include "domain.h" +#include "fix_peri_neigh.h" #include "force.h" -#include "memory.h" #include "lattice.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 73b1373fad..dfc1f428eb 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -34,7 +34,7 @@ ------------------------------------------------------------------------- */ #include "pair_reaxc_omp.h" -#include + #include #include "atom.h" #include "update.h" @@ -48,7 +48,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "timer.h" + #include "reaxc_defs.h" #include "reaxc_types.h" diff --git a/src/USER-OMP/pair_resquared_omp.cpp b/src/USER-OMP/pair_resquared_omp.cpp index 557d212531..689ff297e5 100644 --- a/src/USER-OMP/pair_resquared_omp.cpp +++ b/src/USER-OMP/pair_resquared_omp.cpp @@ -12,18 +12,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_resquared_omp.h" -#include "math_extra.h" + #include "atom.h" #include "comm.h" -#include "atom_vec_ellipsoid.h" #include "force.h" -#include "neighbor.h" +#include "math_extra.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index 85425974cc..f733b5106f 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -12,17 +12,18 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_soft_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" #include "math_const.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index ebe501ff8e..c2eb4cb156 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -12,17 +12,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_sw_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index 2546bfdc9a..f5fbabccab 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -12,17 +12,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_table_omp.h" + #include "atom.h" #include "comm.h" -#include "error.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp index 5e1e6b1b0e..83baa56e44 100644 --- a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp @@ -12,16 +12,14 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_tersoff_mod_c_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index aa90b88375..ab2f07322d 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -12,16 +12,16 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_tersoff_mod_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index 34dbfb73b6..a367749978 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -12,17 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_tersoff_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index a0a7f4c810..8321ad9d9f 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -12,18 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_tersoff_table_omp.h" + #include "atom.h" #include "comm.h" -#include "error.h" -#include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; #define GRIDSTART 0.1 diff --git a/src/USER-OMP/pair_tersoff_zbl_omp.cpp b/src/USER-OMP/pair_tersoff_zbl_omp.cpp index 005cd427a9..7bb3814549 100644 --- a/src/USER-OMP/pair_tersoff_zbl_omp.cpp +++ b/src/USER-OMP/pair_tersoff_zbl_omp.cpp @@ -16,26 +16,19 @@ David Farrell (NWU) - ZBL addition ------------------------------------------------------------------------- */ -#include -#include -#include -#include #include "pair_tersoff_zbl_omp.h" -#include "atom.h" #include "update.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" #include "comm.h" #include "memory.h" #include "error.h" -#include "utils.h" #include "tokenizer.h" #include "potential_file_reader.h" - #include "math_const.h" #include "math_special.h" + +#include +#include + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/pair_ufm_omp.cpp b/src/USER-OMP/pair_ufm_omp.cpp index 605d6dd2c6..e1c2ff457e 100644 --- a/src/USER-OMP/pair_ufm_omp.cpp +++ b/src/USER-OMP/pair_ufm_omp.cpp @@ -14,16 +14,17 @@ Maurice de Koning (Unicamp/Brazil) - dekoning@ifi.unicamp.br ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_ufm_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index 425a06c296..0637fe3dfc 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -12,17 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_vashishta_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_vashishta_table_omp.cpp b/src/USER-OMP/pair_vashishta_table_omp.cpp index 36c86a8995..9650a57e72 100644 --- a/src/USER-OMP/pair_vashishta_table_omp.cpp +++ b/src/USER-OMP/pair_vashishta_table_omp.cpp @@ -12,17 +12,15 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_vashishta_table_omp.h" + #include "atom.h" #include "comm.h" -#include "force.h" #include "memory.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index e6ac3fa9fb..227ec0744f 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_yukawa_colloid_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index f222876cb5..347575e283 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_yukawa_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ diff --git a/src/USER-OMP/pair_zbl_omp.cpp b/src/USER-OMP/pair_zbl_omp.cpp index 284ebbf09c..9679a00b24 100644 --- a/src/USER-OMP/pair_zbl_omp.cpp +++ b/src/USER-OMP/pair_zbl_omp.cpp @@ -12,16 +12,17 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_zbl_omp.h" + #include "atom.h" #include "comm.h" #include "force.h" -#include "neighbor.h" #include "neigh_list.h" - #include "suffix.h" + +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace PairZBLConstants; diff --git a/src/USER-OMP/pppm_cg_omp.cpp b/src/USER-OMP/pppm_cg_omp.cpp index 31098d2675..86997713ef 100644 --- a/src/USER-OMP/pppm_cg_omp.cpp +++ b/src/USER-OMP/pppm_cg_omp.cpp @@ -15,22 +15,24 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pppm_cg_omp.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" #include "force.h" #include "math_const.h" #include "math_special.h" -#include "timer.h" +#include "suffix.h" + +#include +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif -#include "suffix.h" + using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/pppm_disp_omp.cpp b/src/USER-OMP/pppm_disp_omp.cpp index aad77cffc7..96a2cc282e 100644 --- a/src/USER-OMP/pppm_disp_omp.cpp +++ b/src/USER-OMP/pppm_disp_omp.cpp @@ -16,23 +16,24 @@ Rolf Isele-Holder (RWTH Aachen University) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pppm_disp_omp.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" #include "force.h" #include "math_const.h" -#include "timer.h" +#include "suffix.h" + +#include +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif -#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pppm_disp_tip4p_omp.cpp b/src/USER-OMP/pppm_disp_tip4p_omp.cpp index 7da4257e07..93b7a87a61 100644 --- a/src/USER-OMP/pppm_disp_tip4p_omp.cpp +++ b/src/USER-OMP/pppm_disp_tip4p_omp.cpp @@ -15,21 +15,24 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pppm_disp_tip4p_omp.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" #include "error.h" #include "force.h" #include "math_const.h" +#include "suffix.h" + +#include +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif -#include "suffix.h" + using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/USER-OMP/pppm_omp.cpp b/src/USER-OMP/pppm_omp.cpp index e3e46f4de0..7065588526 100644 --- a/src/USER-OMP/pppm_omp.cpp +++ b/src/USER-OMP/pppm_omp.cpp @@ -15,19 +15,19 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pppm_omp.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" #include "force.h" #include "math_const.h" #include "math_special.h" -#include "timer.h" +#include +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/pppm_tip4p_omp.cpp b/src/USER-OMP/pppm_tip4p_omp.cpp index 8bd9805f01..936f3cf31c 100644 --- a/src/USER-OMP/pppm_tip4p_omp.cpp +++ b/src/USER-OMP/pppm_tip4p_omp.cpp @@ -15,11 +15,8 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pppm_tip4p_omp.h" -#include -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" @@ -27,12 +24,16 @@ #include "force.h" #include "math_const.h" #include "math_special.h" -#include "timer.h" +#include "suffix.h" + +#include +#include + +#include "omp_compat.h" #if defined(_OPENMP) #include #endif -#include "suffix.h" using namespace LAMMPS_NS; using namespace MathConst; using namespace MathSpecial; diff --git a/src/USER-OMP/reaxc_bond_orders_omp.cpp b/src/USER-OMP/reaxc_bond_orders_omp.cpp index d581819e00..85a77370fa 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.cpp +++ b/src/USER-OMP/reaxc_bond_orders_omp.cpp @@ -27,8 +27,8 @@ ----------------------------------------------------------------------*/ #include "reaxc_bond_orders_omp.h" -#include -#include +#include "reaxc_bond_orders.h" + #include "fix_omp.h" #include "reaxc_defs.h" #include "pair_reaxc_omp.h" @@ -36,6 +36,9 @@ #include "reaxc_list.h" #include "reaxc_vector.h" +#include +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/reaxc_bond_orders_omp.h b/src/USER-OMP/reaxc_bond_orders_omp.h index 36be3337ad..2027a8628e 100644 --- a/src/USER-OMP/reaxc_bond_orders_omp.h +++ b/src/USER-OMP/reaxc_bond_orders_omp.h @@ -30,7 +30,6 @@ #define __BOND_ORDERS_OMP_H_ #include "reaxc_types.h" -#include "reaxc_bond_orders.h" void Add_dBond_to_ForcesOMP( reax_system*, int, int, storage*, reax_list** ); void Add_dBond_to_Forces_NPTOMP( reax_system *system, int, int, diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index ee4670fe59..ad6ea35eb8 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -26,13 +26,12 @@ . ----------------------------------------------------------------------*/ -#include "omp_compat.h" #include "reaxc_forces_omp.h" -#include -#include + +#include "error.h" #include "fix_omp.h" -#include "reaxc_defs.h" #include "pair_reaxc_omp.h" +#include "reaxc_defs.h" #include "reaxc_bond_orders_omp.h" #include "reaxc_bonds_omp.h" @@ -44,6 +43,9 @@ #include "reaxc_valence_angles_omp.h" #include "reaxc_vector.h" +#include +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp index 22d9df7702..029062470d 100644 --- a/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_hydrogen_bonds_omp.cpp @@ -26,10 +26,8 @@ . ----------------------------------------------------------------------*/ -#include "omp_compat.h" #include "reaxc_hydrogen_bonds_omp.h" -#include -#include + #include "fix_omp.h" #include "pair_reaxc_omp.h" #include "reaxc_defs.h" @@ -38,6 +36,9 @@ #include "reaxc_valence_angles_omp.h" // To access Calculate_dCos_ThetaOMP() #include "reaxc_vector.h" +#include +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/reaxc_init_md_omp.cpp b/src/USER-OMP/reaxc_init_md_omp.cpp index b0cf4a5fb8..fd216844eb 100644 --- a/src/USER-OMP/reaxc_init_md_omp.cpp +++ b/src/USER-OMP/reaxc_init_md_omp.cpp @@ -27,7 +27,7 @@ ----------------------------------------------------------------------*/ #include "reaxc_init_md_omp.h" -#include + #include "reaxc_defs.h" #include "reaxc_forces.h" #include "reaxc_forces_omp.h" @@ -38,6 +38,8 @@ #include "error.h" #include "fmt/format.h" +#include + // Functions defined in reaxc_init_md.cpp extern int Init_MPI_Datatypes(reax_system*, storage*, mpi_datatypes*, MPI_Comm, char*); extern int Init_System(reax_system*, control_params*, char*); diff --git a/src/USER-OMP/reaxc_init_md_omp.h b/src/USER-OMP/reaxc_init_md_omp.h index 8416a768cf..45478ec632 100644 --- a/src/USER-OMP/reaxc_init_md_omp.h +++ b/src/USER-OMP/reaxc_init_md_omp.h @@ -31,6 +31,8 @@ #include "reaxc_types.h" +#include + void InitializeOMP( reax_system*, control_params*, simulation_data*, storage*, reax_list**, output_controls*, mpi_datatypes*, MPI_Comm ); #endif diff --git a/src/USER-OMP/reaxc_multi_body_omp.cpp b/src/USER-OMP/reaxc_multi_body_omp.cpp index 5f4b6d4eb0..57c056fff7 100644 --- a/src/USER-OMP/reaxc_multi_body_omp.cpp +++ b/src/USER-OMP/reaxc_multi_body_omp.cpp @@ -27,14 +27,16 @@ ----------------------------------------------------------------------*/ #include "reaxc_multi_body_omp.h" -#include -#include + #include "fix_omp.h" -#include #include "pair_reaxc_omp.h" + #include "reaxc_defs.h" #include "reaxc_list.h" +#include +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/reaxc_nonbonded_omp.cpp b/src/USER-OMP/reaxc_nonbonded_omp.cpp index 564088880a..3c3ca12575 100644 --- a/src/USER-OMP/reaxc_nonbonded_omp.cpp +++ b/src/USER-OMP/reaxc_nonbonded_omp.cpp @@ -27,17 +27,17 @@ ----------------------------------------------------------------------*/ #include "pair_reaxc_omp.h" -#include "thr_data.h" #include "reaxc_defs.h" #include "reaxc_types.h" #include "reaxc_nonbonded.h" #include "reaxc_nonbonded_omp.h" -#include "reaxc_bond_orders_omp.h" #include "reaxc_list.h" #include "reaxc_vector.h" +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/reaxc_torsion_angles_omp.cpp b/src/USER-OMP/reaxc_torsion_angles_omp.cpp index 68bacb7202..7d567b259c 100644 --- a/src/USER-OMP/reaxc_torsion_angles_omp.cpp +++ b/src/USER-OMP/reaxc_torsion_angles_omp.cpp @@ -27,7 +27,7 @@ ----------------------------------------------------------------------*/ #include "reaxc_torsion_angles_omp.h" -#include + #include "fix_omp.h" #include "pair_reaxc_omp.h" @@ -36,6 +36,8 @@ #include "reaxc_list.h" #include "reaxc_vector.h" +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/reaxc_valence_angles_omp.cpp b/src/USER-OMP/reaxc_valence_angles_omp.cpp index 104fadbbae..f9117d3a53 100644 --- a/src/USER-OMP/reaxc_valence_angles_omp.cpp +++ b/src/USER-OMP/reaxc_valence_angles_omp.cpp @@ -27,11 +27,10 @@ ----------------------------------------------------------------------*/ #include "reaxc_valence_angles_omp.h" -#include -#include -#include "pair_reaxc_omp.h" -#include "fix_omp.h" + #include "error.h" +#include "fix_omp.h" +#include "pair_reaxc_omp.h" #include "reaxc_defs.h" #include "reaxc_types.h" @@ -39,6 +38,8 @@ #include "reaxc_list.h" #include "reaxc_vector.h" +#include + #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/respa_omp.cpp b/src/USER-OMP/respa_omp.cpp index b5e5293aa4..b8d0af5c86 100644 --- a/src/USER-OMP/respa_omp.cpp +++ b/src/USER-OMP/respa_omp.cpp @@ -15,25 +15,25 @@ Contributing authors: Mark Stevens (SNL), Paul Crozier (SNL) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "respa_omp.h" -#include "neighbor.h" -#include "comm.h" -#include "atom.h" -#include "domain.h" -#include "force.h" -#include "pair.h" -#include "bond.h" + #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "force.h" #include "improper.h" #include "kspace.h" -#include "output.h" -#include "update.h" #include "modify.h" -#include "error.h" -#include "timer.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" +#include "update.h" +#include "omp_compat.h" #if defined(_OPENMP) #include #endif diff --git a/src/USER-OMP/thr_data.h b/src/USER-OMP/thr_data.h index 4853d6dbbf..4b87357101 100644 --- a/src/USER-OMP/thr_data.h +++ b/src/USER-OMP/thr_data.h @@ -18,7 +18,7 @@ #ifndef LMP_THR_DATA_H #define LMP_THR_DATA_H -#include "timer.h" +#include "timer.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index c086f6d6b5..6e096defa8 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -24,7 +24,7 @@ #include "force.h" #include "modify.h" #include "neighbor.h" -#include "timer.h" + #include "thr_omp.h" diff --git a/src/USER-PHONON/dynamical_matrix.cpp b/src/USER-PHONON/dynamical_matrix.cpp index d03a8d3ab0..238aa7c96e 100644 --- a/src/USER-PHONON/dynamical_matrix.cpp +++ b/src/USER-PHONON/dynamical_matrix.cpp @@ -2,28 +2,29 @@ // Created by charlie sievers on 6/21/18. // -#include -#include -#include #include "dynamical_matrix.h" -#include "atom.h" -#include "domain.h" -#include "comm.h" -#include "error.h" -#include "group.h" -#include "force.h" -#include "memory.h" -#include "bond.h" + #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "force.h" +#include "group.h" #include "improper.h" #include "kspace.h" -#include "update.h" +#include "memory.h" #include "modify.h" #include "neighbor.h" #include "pair.h" #include "timer.h" -#include "finish.h" +#include "update.h" + +#include +#include #include using namespace LAMMPS_NS; @@ -117,7 +118,7 @@ void DynamicalMatrix::command(int narg, char **arg) if (strcmp(arg[1],"regular") == 0) style = REGULAR; else if (strcmp(arg[1],"eskm") == 0) style = ESKM; else error->all(FLERR,"Illegal Dynamical Matrix command"); - del = force->numeric(FLERR, arg[2]); + del = utils::numeric(FLERR, arg[2],false,lmp); // set option defaults diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index 9b663ce383..382eabe82d 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -23,7 +23,7 @@ konglt@sjtu.edu.cn; konglt@gmail.com ------------------------------------------------------------------------- */ -#include + #include #include #include "fix_phonon.h" @@ -68,13 +68,13 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (narg < 8) error->all(FLERR,"Illegal fix phonon command: number of arguments < 8"); - nevery = force->inumeric(FLERR, arg[3]); // Calculate this fix every n steps! + nevery = utils::inumeric(FLERR, arg[3],false,lmp); // Calculate this fix every n steps! if (nevery < 1) error->all(FLERR,"Illegal fix phonon command"); - nfreq = force->inumeric(FLERR, arg[4]); // frequency to output result + nfreq = utils::inumeric(FLERR, arg[4],false,lmp); // frequency to output result if (nfreq < 1) error->all(FLERR,"Illegal fix phonon command"); - waitsteps = force->bnumeric(FLERR,arg[5]); // Wait this many timesteps before actually measuring + waitsteps = utils::bnumeric(FLERR,arg[5],false,lmp); // Wait this many timesteps before actually measuring if (waitsteps < 0) error->all(FLERR,"Illegal fix phonon command: waitsteps < 0 !"); int n = strlen(arg[6]) + 1; // map file @@ -95,12 +95,12 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) while (iarg < narg){ if (strcmp(arg[iarg],"sysdim") == 0){ if (++iarg >= narg) error->all(FLERR,"Illegal fix phonon command: incomplete command line options."); - sdim = force->inumeric(FLERR, arg[iarg]); + 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."); - nasr = force->inumeric(FLERR, arg[iarg]); + nasr = utils::inumeric(FLERR, arg[iarg],false,lmp); } else { error->all(FLERR,"Illegal fix phonon command: unknown option read!"); @@ -570,10 +570,10 @@ void FixPhonon::readmap() if (fgets(line,MAXLINE,fp) == NULL) error->all(FLERR,"Error while reading header of mapping file!"); - nx = force->inumeric(FLERR, strtok(line, " \n\t\r\f")); - ny = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); - nz = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); - nucell = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); + nx = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); + ny = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + nz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + nucell = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); ntotal = nx*ny*nz; if (ntotal*nucell != ngroup) error->all(FLERR,"FFT mesh and number of atoms in group mismatch!"); @@ -586,11 +586,11 @@ void FixPhonon::readmap() // the remaining lines carry the mapping info for (int i = 0; i < ngroup; ++i){ if (fgets(line,MAXLINE,fp) == NULL) {info = 1; break;} - ix = force->inumeric(FLERR, strtok(line, " \n\t\r\f")); - iy = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); - iz = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); - iu = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); - itag = force->inumeric(FLERR, strtok(NULL, " \n\t\r\f")); + ix = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); + iy = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + iz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + iu = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + itag = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); // check if index is in correct range if (ix < 0 || ix >= nx || iy < 0 || iy >= ny || diff --git a/src/USER-PHONON/third_order.cpp b/src/USER-PHONON/third_order.cpp index 7764287337..e7997d6397 100644 --- a/src/USER-PHONON/third_order.cpp +++ b/src/USER-PHONON/third_order.cpp @@ -3,29 +3,28 @@ // #include "third_order.h" -#include -#include -#include -#include "atom.h" -#include "domain.h" -#include "comm.h" -#include "error.h" -#include "group.h" -#include "force.h" -#include "memory.h" -#include "bond.h" + #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "finish.h" +#include "force.h" +#include "group.h" #include "improper.h" #include "kspace.h" -#include "update.h" +#include "math_special.h" +#include "memory.h" #include "neighbor.h" #include "pair.h" #include "timer.h" -#include "finish.h" -#include "math_special.h" +#include "update.h" + +#include #include -#include using namespace LAMMPS_NS; using namespace MathSpecial; @@ -132,7 +131,7 @@ void ThirdOrder::command(int narg, char **arg) if (style == REGULAR) options(narg-3,&arg[3]); //COME BACK else if (style == BALLISTICO) options(narg-3,&arg[3]); //COME BACK else if (comm->me == 0 && screen) fprintf(screen,"Illegal Dynamical Matrix command\n"); - del = force->numeric(FLERR, arg[2]); + del = utils::numeric(FLERR, arg[2],false,lmp); if (atom->map_style == 0) error->all(FLERR,"third_order command requires an atom map, see atom_modify"); @@ -170,13 +169,11 @@ void ThirdOrder::options(int narg, char **arg) if (narg < 0) error->all(FLERR,"Illegal third_order command"); int iarg = 0; const char *filename = "third_order.dat"; - std::stringstream fss; while (iarg < narg) { if (strcmp(arg[iarg],"file") == 0) { if (iarg+2 > narg) error->all(FLERR, "Illegal third_order command"); - fss << arg[iarg + 1]; - filename = fss.str().c_str(); + filename = arg[iarg + 1]; file_flag = 1; iarg += 2; } else if (strcmp(arg[iarg],"binary") == 0) { diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 3a52bbaaa1..b7a29c7bc9 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include #include "atom.h" @@ -33,7 +33,7 @@ #include "compute.h" #include "modify.h" #include "pair.h" -#include "utils.h" + #include "timer.h" #include "plumed/wrapper/Plumed.h" diff --git a/src/USER-PTM/compute_ptm_atom.cpp b/src/USER-PTM/compute_ptm_atom.cpp index df6a01e6c6..309dd75c19 100644 --- a/src/USER-PTM/compute_ptm_atom.cpp +++ b/src/USER-PTM/compute_ptm_atom.cpp @@ -115,7 +115,7 @@ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg) ptr++; } - double threshold = force->numeric(FLERR, arg[4]); + double threshold = utils::numeric(FLERR, arg[4],false,lmp); if (threshold < 0.0) error->all(FLERR, "Illegal compute ptm/atom command (threshold is negative)"); diff --git a/src/USER-PTM/ptm_deformation_gradient.h b/src/USER-PTM/ptm_deformation_gradient.h index 546efab437..6c686431f6 100644 --- a/src/USER-PTM/ptm_deformation_gradient.h +++ b/src/USER-PTM/ptm_deformation_gradient.h @@ -10,9 +10,11 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #ifndef PTM_DEFORMATION_GRADIENT_H #define PTM_DEFORMATION_GRADIENT_H -#include #include "ptm_constants.h" +#include +#include + namespace ptm { void calculate_deformation_gradient(int num_points, const double (*ideal_points)[3], int8_t* mapping, double (*normalized)[3], const double (*penrose)[3], double* F, double* res); diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index f1a34d9538..9f07030004 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -15,7 +15,7 @@ Contributing author: Axel Kohlmeyer (ICTP) ------------------------------------------------------------------------- */ -#include + #include #include "fix_qmmm.h" #include "atom.h" diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index d58c917308..034738023c 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -17,11 +17,11 @@ ------------------------------------------------------------------------- */ #include "fix_qbmsst.h" -#include + #include #include -#include -#include + + #include "atom.h" #include "force.h" #include "update.h" @@ -34,8 +34,8 @@ #include "error.h" #include "kspace.h" #include "math_const.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -100,70 +100,70 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"q") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - qmass = force->numeric(FLERR,arg[iarg+1]); + qmass = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (qmass < 0.0) error->all(FLERR,"Fix qbmsst qmass must be >= 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"mu") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - mu = force->numeric(FLERR,arg[iarg+1]); + mu = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (mu < 0.0) error->all(FLERR,"Fix qbmsst mu must be >= 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"p0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - p0 = force->numeric(FLERR,arg[iarg+1]); + p0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (p0 < 0.0) error->all(FLERR,"Fix qbmsst p0 must be >= 0.0"); p0_set = 1; iarg += 2; } else if (strcmp(arg[iarg],"v0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - v0 = force->numeric(FLERR,arg[iarg+1]); + v0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (v0 < 0.0) error->all(FLERR,"Fix qbmsst v0 must be >= 0.0"); v0_set = 1; iarg += 2; } else if (strcmp(arg[iarg],"e0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - e0 = force->numeric(FLERR,arg[iarg+1]); + e0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); e0_set = 1; iarg += 2; } else if (strcmp(arg[iarg],"tscale") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - tscale = force->numeric(FLERR,arg[iarg+1]); + tscale = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (tscale < 0.0 || tscale > 1.0) error->all(FLERR,"Fix qbmsst tscale must satisfy 0 <= tscale < 1"); iarg += 2; } else if (strcmp(arg[iarg],"damp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - t_period = force->numeric(FLERR,arg[iarg+1]); + t_period = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (t_period <= 0.0) error->all(FLERR,"Fix qbmsst damp must be > 0.0"); fric_coef = 1/t_period; iarg += 2; } else if (strcmp(arg[iarg],"seed") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - seed = force->inumeric(FLERR,arg[iarg+1]); + seed = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (seed <= 0) error->all(FLERR,"Fix qbmsst seed must be a positive integer"); iarg += 2; } else if (strcmp(arg[iarg],"f_max") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - f_max = force->numeric(FLERR,arg[iarg+1]); + f_max = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (f_max <= 0) error->all(FLERR,"Fix qbmsst f_max must be > 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"N_f") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - N_f = force->inumeric(FLERR,arg[iarg+1]); + N_f = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (N_f <= 0) error->all(FLERR,"Fix qbmsst N_f must be a positive integer"); iarg += 2; } else if (strcmp(arg[iarg],"eta") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - eta = force->numeric(FLERR,arg[iarg+1]); + eta = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (eta <= 0) error->all(FLERR,"Fix qbmsst eta must be >= 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"beta") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - beta = force->inumeric(FLERR,arg[iarg+1]); + beta = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (beta <= 0) error->all(FLERR,"Fix qbmsst beta must be a positive integer"); iarg += 2; } else if (strcmp(arg[iarg],"T_init") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qbmsst command"); - t_init = force->numeric(FLERR,arg[iarg+1]); + t_init = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (t_init <= 0) error->all(FLERR,"Fix qbmsst T_init must be >= 0.0"); iarg += 2; } else error->all(FLERR,"Illegal fix qbmsst command"); diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index a29dbc70a1..3f29229beb 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -17,10 +17,10 @@ ------------------------------------------------------------------------- */ #include "fix_qtb.h" -#include + #include #include -#include + #include "atom.h" #include "force.h" #include "update.h" @@ -32,8 +32,8 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -64,28 +64,28 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"temp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command"); - t_target = force->numeric(FLERR,arg[iarg+1]); + t_target = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (t_target < 0.0) error->all(FLERR,"Fix qtb temp must be >= 0.0"); iarg += 2; } else if (strcmp(arg[iarg],"damp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command"); - t_period = force->numeric(FLERR,arg[iarg+1]); + t_period = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (t_period <= 0.0) error->all(FLERR,"Fix qtb damp must be > 0.0"); fric_coef = 1/t_period; iarg += 2; } else if (strcmp(arg[iarg],"seed") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command"); - seed = force->inumeric(FLERR,arg[iarg+1]); + seed = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (seed <= 0) error->all(FLERR,"Illegal fix qtb command"); iarg += 2; } else if (strcmp(arg[iarg],"f_max") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command"); - f_max = force->numeric(FLERR,arg[iarg+1]); + f_max = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (f_max <= 0) error->all(FLERR,"Illegal fix qtb command"); iarg += 2; } else if (strcmp(arg[iarg],"N_f") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix qtb command"); - N_f = force->inumeric(FLERR,arg[iarg+1]); + N_f = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (N_f <= 0) error->all(FLERR,"Illegal fix qtb command"); iarg += 2; } else error->all(FLERR,"Illegal fix qtb command"); diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 7c762208b7..5511efe681 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -16,10 +16,10 @@ Aidan Thompson (Sandia, athomps@sandia.gov) ------------------------------------------------------------------------- */ -#include + #include #include -#include + #include #include "pair_quip.h" #include "atom.h" @@ -275,7 +275,7 @@ void PairQUIP::coeff(int narg, char **arg) if (strcmp(arg[i],"NULL") == 0) map[i-3] = -1; else - map[i-3] = force->inumeric(FLERR,arg[i]); + map[i-3] = utils::inumeric(FLERR,arg[i],false,lmp); } // clear setflag since coeff() called once with I,J = * * diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 29aa476148..5d57b74056 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -16,34 +16,36 @@ Contributing Author: Jacob Gissinger (jacob.gissinger@colorado.edu) ------------------------------------------------------------------------- */ #include "fix_bond_react.h" -#include -#include -#include -#include -#include "update.h" -#include "modify.h" -#include "respa.h" + #include "atom.h" #include "atom_vec.h" -#include "force.h" -#include "pair.h" +#include "citeme.h" #include "comm.h" #include "domain.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "random_mars.h" -#include "reset_mol_ids.h" -#include "molecule.h" +#include "error.h" +#include "force.h" #include "group.h" -#include "citeme.h" +#include "input.h" #include "math_const.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "input.h" +#include "modify.h" +#include "molecule.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "random_mars.h" +#include "reset_mol_ids.h" +#include "respa.h" +#include "update.h" #include "variable.h" -#include "fmt/format.h" + +#include "superpose3d.h" + +#include +#include +#include #include @@ -78,7 +80,7 @@ static const char cite_fix_bond_react[] = enum{ACCEPT,REJECT,PROCEED,CONTINUE,GUESSFAIL,RESTORE}; // types of available reaction constraints -enum{DISTANCE,ANGLE,DIHEDRAL,ARRHENIUS}; +enum{DISTANCE,ANGLE,DIHEDRAL,ARRHENIUS,RMSD}; // keyword values that accept variables as input enum{NEVERY,RMIN,RMAX,PROB}; @@ -168,7 +170,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"reset_mol_ids") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'reset_mol_ids' keyword has too few arguments"); - if (strcmp(arg[iarg+1],"yes") == 0) ; // default + if (strcmp(arg[iarg+1],"yes") == 0) reset_mol_ids_flag = 1; // default if (strcmp(arg[iarg+1],"no") == 0) reset_mol_ids_flag = 0; iarg += 2; } else if (strcmp(arg[iarg],"react") == 0) { @@ -262,7 +264,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : var_flag[NEVERY][rxn] = 1; delete [] str; } else { - nevery[rxn] = force->inumeric(FLERR,arg[iarg]); + nevery[rxn] = utils::inumeric(FLERR,arg[iarg],false,lmp); if (nevery[rxn] <= 0) error->all(FLERR,"Illegal fix bond/react command: " "'Nevery' must be a positive integer"); } @@ -282,7 +284,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : var_flag[RMIN][rxn] = 1; delete [] str; } else { - double cutoff = force->numeric(FLERR,arg[iarg]); + double cutoff = utils::numeric(FLERR,arg[iarg],false,lmp); if (cutoff < 0.0) error->all(FLERR,"Illegal fix bond/react command: " "'Rmin' cannot be negative"); cutsq[rxn][0] = cutoff*cutoff; @@ -303,7 +305,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : var_flag[RMAX][rxn] = 1; delete [] str; } else { - double cutoff = force->numeric(FLERR,arg[iarg]); + double cutoff = utils::numeric(FLERR,arg[iarg],false,lmp); if (cutoff < 0.0) error->all(FLERR,"Illegal fix bond/react command:" "'Rmax' cannot be negative"); cutsq[rxn][1] = cutoff*cutoff; @@ -341,9 +343,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : delete [] str; } else { // otherwise probability should be a number - fraction[rxn] = force->numeric(FLERR,arg[iarg+1]); + fraction[rxn] = utils::numeric(FLERR,arg[iarg+1],false,lmp); } - seed[rxn] = force->inumeric(FLERR,arg[iarg+2]); + seed[rxn] = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (fraction[rxn] < 0.0 || fraction[rxn] > 1.0) error->all(FLERR,"Illegal fix bond/react command: " "probability fraction must between 0 and 1, inclusive"); @@ -353,7 +355,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"max_rxn") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'max_rxn' has too few arguments"); - max_rxn[rxn] = force->inumeric(FLERR,arg[iarg+1]); + max_rxn[rxn] = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (max_rxn[rxn] < 0) error->all(FLERR,"Illegal fix bond/react command: " "'max_rxn' cannot be negative"); iarg += 2; @@ -362,7 +364,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : "used without stabilization keyword"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: " "'stabilize_steps' has too few arguments"); - limit_duration[rxn] = force->numeric(FLERR,arg[iarg+1]); + limit_duration[rxn] = utils::numeric(FLERR,arg[iarg+1],false,lmp); stabilize_steps_flag[rxn] = 1; iarg += 2; } else if (strcmp(arg[iarg],"update_edges") == 0) { @@ -1857,6 +1859,43 @@ int FixBondReact::check_constraints() prrhob = constraints[i][3]*pow(t,constraints[i][4])* exp(-constraints[i][5]/(force->boltz*t)); if (prrhob < rrhandom[(int) constraints[i][2]]->uniform()) return 0; + } else if (constraints[i][1] == RMSD) { + // call superpose + int n2superpose = 0; + double **xfrozen; // coordinates for the "frozen" target molecule + double **xmobile; // coordinates for the "mobile" molecule + int ifragment = constraints[i][3]; + if (ifragment >= 0) { + for (int j = 0; j < onemol->natoms; j++) + if (onemol->fragmentmask[ifragment][j]) n2superpose++; + memory->create(xfrozen,n2superpose,3,"bond/react:xfrozen"); + memory->create(xmobile,n2superpose,3,"bond/react:xmobile"); + int myincr = 0; + for (int j = 0; j < onemol->natoms; j++) { + if (onemol->fragmentmask[ifragment][j]) { + for (int k = 0; k < 3; k++) { + xfrozen[myincr][k] = x[atom->map(glove[j][1])][k]; + xmobile[myincr][k] = onemol->x[j][k]; + } + myincr++; + } + } + } else { + n2superpose = onemol->natoms; + memory->create(xfrozen,n2superpose,3,"bond/react:xfrozen"); + memory->create(xmobile,n2superpose,3,"bond/react:xmobile"); + for (int j = 0; j < n2superpose; j++) { + for (int k = 0; k < 3; k++) { + xfrozen[j][k] = x[atom->map(glove[j][1])][k]; + xmobile[j][k] = onemol->x[j][k]; + } + } + } + Superpose3D superposer(n2superpose); + double rmsd = superposer.Superpose(xfrozen, xmobile); + if (rmsd > constraints[i][2]) return 0; + memory->destroy(xfrozen); + memory->destroy(xmobile); } } } @@ -3322,6 +3361,17 @@ void FixBondReact::Constraints(char *line, int myrxn) constraints[nconstraints][4] = tmp[1]; constraints[nconstraints][5] = tmp[2]; constraints[nconstraints][6] = tmp[3]; + } else if (strcmp(constraint_type,"rmsd") == 0) { + constraints[nconstraints][1] = RMSD; + strcpy(strargs[0],"0"); + sscanf(line,"%*s %lg %s",&tmp[0],strargs[0]); + constraints[nconstraints][2] = tmp[0]; // RMSDmax + constraints[nconstraints][3] = -1; // optional molecule fragment + if (isalpha(strargs[0][0])) { + int ifragment = onemol->findfragment(strargs[0]); + if (ifragment < 0) error->one(FLERR,"Bond/react: Molecule fragment does not exist"); + else constraints[nconstraints][3] = ifragment; + } } else error->one(FLERR,"Bond/react: Illegal constraint type in 'Constraints' section of map file"); nconstraints++; diff --git a/src/USER-REACTION/math_eigen.h b/src/USER-REACTION/math_eigen.h new file mode 100644 index 0000000000..f8d2be4e21 --- /dev/null +++ b/src/USER-REACTION/math_eigen.h @@ -0,0 +1,1380 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. (Some of the code in this file is also + available using a more premissive license. See below for details.) + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing authors: Yuya Kurebayashi (Tohoku University, Lanczos algorithm) + Andrew Jewett (Scripps Research, Jacobi algorithm) +------------------------------------------------------------------------- */ + +#ifndef _MATH_EIGEN_H +#define _MATH_EIGEN_H + +/// @file This file contains a library of functions and classes which can +/// efficiently perform eigendecomposition for an extremely broad +/// range of matrix types: both real and complex, dense and sparse. +/// Matrices need not be of type "double **", for example. +/// In principle, almost any type of C++ container can be used. +/// Some general C++11 compatible functions for allocating matrices and +/// calculating norms of real and complex vectors are also provided. +/// @note +/// The "Jacobi" and "PEigenDense" classes are used for calculating +/// eigenvalues and eigenvectors of conventional dense square matrices. +/// @note +/// The "LambdaLanczos" class can calculate eigenalues and eigenvectors +/// of more general types of matrices, especially large, sparse matrices. +/// It uses C++ lambda expressions to simplify and generalize the way +/// matrices can be represented. This allows it to be applied to +/// nearly any kind of sparse (or dense) matrix representation. +/// @note +/// The source code for Jacobi and LambdaLanczos is also available at: +/// https://github.com/jewettaij/jacobi_pd (CC0-1.0 license) +/// https://github.com/mrcdr/lambda-lanczos (MIT license) + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace MathEigen { + +// --- Memory allocation for matrices --- + +/// @brief Allocate an arbitrary 2-dimensional array. (Uses row-major order.) +/// @note This function was intended for relatively small matrices (eg 4x4). +/// For large arrays, please use the 2d create() function from "memory.h" +template +void Alloc2D(size_t nrows, //!< size of the array (number of rows) + size_t ncols, //!< size of the array (number of columns) + Entry ***paaX); //!< pointer to a 2D C-style array + +/// @brief Deallocate arrays that were created using Alloc2D(). +template +void Dealloc2D(Entry ***paaX); //!< pointer to 2D multidimensional array + +// --- Complex numbers --- + +/// @brief "realTypeMap" struct is used to the define "real_t" type mapper +/// which returns the C++ type corresponding to the real component of T. +/// @details Consider a function ("l2_norm()") that calculates the +/// (Euclidian) length of a vector of numbers (either real or complex): +/// @code +/// template real_t l2_norm(const std::vector& vec); +/// @endcode +/// The l2_norm is always real by definition. +/// (See https://en.wikipedia.org/wiki/Norm_(mathematics)#Euclidean_norm) +/// The return type of this function ("real_t") indicates that +/// it returns a real number, even if the entries (of type T) +/// are complex numbers. In other words, by default, real_t returns T. +/// However real_t> returns T (not std::complex). +/// We define "real_t" below using C++ template specializations: + +template +struct realTypeMap { + typedef T type; +}; +template +struct realTypeMap> { + typedef T type; +}; +template +using real_t = typename realTypeMap::type; + + +// --- Operations on vectors (of real and complex numbers) --- + +/// @brief Calculate the inner product of two vectors. +/// (For vectors of complex numbers, std::conj() is used.) +template +T inner_prod(const std::vector& v1, const std::vector& v2); + +/// @brief Compute the sum of the absolute values of the entries in v +/// @returns a real number (of type real_t). +template +real_t l1_norm(const std::vector& v); + +/// @brief Calculate the l2_norm (Euclidian length) of vector v. +/// @returns a real number (of type real_t). +template +real_t l2_norm(const std::vector& v); + +/// @brief Multiply a vector (v) by a scalar (c). +template +void scalar_mul(T1 c, std::vector& v); + +/// @brief Divide vector "v" in-place by it's length (l2_norm(v)). +template +void normalize(std::vector& v); + + +// ---- Eigendecomposition of small dense symmetric matrices ---- + +/// @class Jacobi +/// @brief Calculate the eigenvalues and eigevectors of a symmetric matrix +/// using the Jacobi eigenvalue algorithm. Code for the Jacobi class +/// (along with tests and benchmarks) is available free of copyright at +/// https://github.com/jewettaij/jacobi_pd +/// @note The "Vector" and "Matrix" type arguments can be any +/// C or C++ object that support indexing, including pointers or vectors. +/// @details +/// -- Example: -- +/// +/// int n = 5; // Matrix size +/// double **M; // A symmetric n x n matrix you want to diagonalize +/// double *evals; // Store the eigenvalues here. +/// double **evects; // Store the eigenvectors here. +/// // Allocate space for M, evals, and evects, and load contents of M (omitted) +/// +/// // Now create an instance of Jacobi ("eigen_calc"). This will allocate space +/// // for storing intermediate calculations. Once created, it can be reused +/// // multiple times without paying the cost of allocating memory on the heap. +/// +/// Jacobi eigen_calc(n); +/// +/// // Note: +/// // If the matrix you plan to diagonalize (M) is read-only, use this instead: +/// // Jacobi eigen_calc(n); +/// // If you prefer using vectors over C-style pointers, this works also: +/// // Jacobi&, vector>&> eigen_calc(n); +/// +/// // Now, calculate the eigenvalues and eigenvectors of M +/// +/// eigen_calc.Diagonalize(M, evals, evects); +/// +/// --- end of example --- + +template + +class Jacobi +{ + int n; //!< the size of the matrices you want to diagonalize + Scalar **M; //!< local copy of the current matrix being analyzed + // Precomputed cosine, sine, and tangent of the most recent rotation angle: + Scalar c; //!< = cos(θ) + Scalar s; //!< = sin(θ) + Scalar t; //!< = tan(θ), (note |t|<=1) + int *max_idx_row; //!< = keep track of the the maximum element in row i (>i) + +public: + + /// @brief Specify the size of the matrices you want to diagonalize later. + /// @param n the size (ie. number of rows) of the (square) matrix. + void SetSize(int n); + + Jacobi(int n = 0) { Init(); SetSize(n); } + + ~Jacobi() { Dealloc(); } + + // @typedef choose the criteria for sorting eigenvalues and eigenvectors + typedef enum eSortCriteria { + DO_NOT_SORT, + SORT_DECREASING_EVALS, + SORT_INCREASING_EVALS, + SORT_DECREASING_ABS_EVALS, + SORT_INCREASING_ABS_EVALS + } SortCriteria; + + /// @brief Calculate the eigenvalues and eigevectors of a symmetric matrix + /// using the Jacobi eigenvalue algorithm. + /// @returns The number_of_sweeps (= number_of_iterations / (n*(n-1)/2)). + /// If this equals max_num_sweeps, the algorithm failed to converge. + /// @note To reduce the computation time further, set calc_evecs=false. + int + Diagonalize(ConstMatrix mat, //!< the matrix you wish to diagonalize (size n) + Vector eval, //!< store the eigenvalues here + Matrix evec, //!< store the eigenvectors here (in rows) + SortCriteria sort_criteria=SORT_DECREASING_EVALS,//!& source); + Jacobi(Jacobi&& other); + void swap(Jacobi &other); + Jacobi& operator = (Jacobi source); + +}; // class Jacobi + + + + + +// ---- Eigendecomposition of large sparse (and dense) matrices ---- + +// The "LambdaLanczos" is a class useful for calculating eigenvalues +// and eigenvectors of large sparse matrices. Unfortunately, before the +// LambdaLanczos class can be declared, several additional expressions, +// classes and functions that it depends on must be declared first. + +// @brief Create random vectors used at the beginning of the Lanczos algorithm. +// @note "Partially specialization of function" is not allowed, so +// it is mimicked by wrapping the "init" function with a class template. +template +struct VectorRandomInitializer { +public: + static void init(std::vector&); +}; + +template +struct VectorRandomInitializer> { +public: + static void init(std::vector>&); +}; + +/// @brief Return the number of significant decimal digits of type T. +template +inline constexpr int sig_decimal_digit() { + return (int)(std::numeric_limits::digits * + std::log10(std::numeric_limits::radix)); +} + +/// @brief Return 10^-n where n=number of significant decimal digits of type T. +template +inline constexpr T minimum_effective_decimal() { + return std::pow(10, -sig_decimal_digit()); +} + + +/// @brief The LambdaLanczos class provides a general way to calculate +/// the smallest or largest eigenvalue and the corresponding eigenvector +/// of a symmetric (Hermitian) matrix using the Lanczos algorithm. +/// The characteristic feature of LambdaLanczos is that the matrix-vector +/// multiplication routine used in the Lanczos algorithm is adaptable. +/// @details +/// @code +/// +/// //Example: +/// const int n = 3; +/// double M[n][n] = { {-1.0, -1.0, 1.0}, +/// {-1.0, 1.0, 1.0}, +/// { 1.0, 1.0, 1.0} }; +/// // (Its eigenvalues are {-2, 1, 2}) +/// +/// // Specify the matrix-vector multiplication function +/// auto mv_mul = [&](const vector& in, vector& out) { +/// for(int i = 0;i < n;i++) { +/// for(int j = 0;j < n;j++) { +/// out[i] += M[i][j]*in[j]; +/// } +/// } +/// }; +/// +/// LambdaLanczos engine(mv_mul, n, true); +/// // ("true" means to calculate the largest eigenvalue.) +/// engine.eigenvalue_offset = 3.0 # = max_i{Σ_j|Mij|} (see below) +/// double eigenvalue; +/// vector eigenvector(n); +/// int itern = engine.run(eigenvalue, eigenvector); +/// +/// cout << "Iteration count: " << itern << endl; +/// cout << "Eigen value: " << setprecision(16) << eigenvalue << endl; +/// cout << "Eigen vector:"; +/// for(int i = 0; i < n; i++) { +/// cout << eigenvector[i] << " "; +/// } +/// cout << endl; +/// +/// @endcode +/// This feature allows you to use a matrix whose elements are partially given, +/// e.g. a sparse matrix whose non-zero elements are stored as a list of +/// {row-index, column-index, value} tuples. You can also easily combine +/// LambdaLanczos with existing matrix libraries (e.g. Eigen) +/// +/// @note +/// If the matrices you want to analyze are ordinary square matrices, (as in +/// the example) it might be easier to use "PEigenDense" instead. (It is a +/// wrapper which takes care of all of the LambdaLanczos details for you.) +/// +/// @note +/// IMPORTANT: +/// The Lanczos algorithm finds the largest magnitude eigenvalue, so you +/// MUST ensure that the eigenvalue you are seeking has the largest magnitude +/// (regardless of whether it is the maximum or minimum eigenvalue). +/// To insure that this is so, you can add or subtract a number to all +/// of the eigenvalues of the matrix by specifying the "eigenvalue_offset". +/// This number should exceed the largest magnitude eigenvalue of the matrix. +/// According to the Gershgorin theorem, you can estimate this number using +/// r = max_i{Σ_j|Mij|} = max_j{Σ_i|Mij|} +/// (where Mij are the elements of the matrix and Σ_j denotes the sum over j). +/// If find_maximum == true (if you are seeking the maximum eigenvalue), then +/// eigenvalue_offset = +r +/// If find_maximum == false, then +/// eigenvalue_offset = -r +/// The eigenvalue_offset MUST be specified by the user. LambdaLanczos does +/// not have an efficient and general way to access the elements of the matrix. +/// +/// (You can omit this step if you are seeking the maximum eigenvalue, +/// and the matrix is positive definite, or if you are seeking the minimum +/// eigenvalue and the matrix is negative definite.) +/// +/// @note +/// LambdaLanczos is available under the MIT license and downloadable at: +/// https://github.com/mrcdr/lambda-lanczos + +template +class LambdaLanczos { +public: + LambdaLanczos(); + LambdaLanczos(std::function&, std::vector&)> mv_mul, int matrix_size, bool find_maximum); + LambdaLanczos(std::function&, std::vector&)> mv_mul, int matrix_size) : LambdaLanczos(mv_mul, matrix_size, true) {} + + /// @brief Calculate the principal (largest or smallest) eigenvalue + /// of the matrix (and its corresponding eigenvector). + int run(real_t&, std::vector&) const; + + // --- public data members --- + + /// @brief Specify the size of the matrix you will analyze. + /// (This equals the size of the eigenvector which will be returned.) + int matrix_size; + + /// @brief Specify the function used for matrix*vector multiplication + /// used by the Lanczos algorithm. For an ordinary dense matrix, + /// this function is the ordinary matrix*vector product. (See the + /// example above. For a sparse matrix, it will be something else.) + std::function&, std::vector&)> mv_mul; + + /// @brief Are we searching for the maximum or minimum eigenvalue? + /// @note (Usually, you must also specify eigenvalue_offset.) + bool find_maximum = false; + + /// @brief Shift all the eigenvalues by "eigenvalue_offset" during the Lanczos + /// iteration (ie. during LambdaLanczos::run()). The goal is to insure + /// that the correct eigenvalue is selected (the one with the maximum + /// magnitude). + /// @note The eigevalue returned by LambdaLanczos::run() is not effected + /// because after the iteration is finished, it will subtract this + /// number from the eigenvalue before it is returned to the caller. + /// @note Unless your matrix is positive definite or negative definite, + /// you MUST specify eigenvalue_offset. See comment above for details. + real_t eigenvalue_offset = 0.0; + + /// @brief This function sets "eigenvalue_offset" automatically. + /// @note Using this function is not recommended because it is very slow. + /// For efficiency, set the "eigenvalue_offset" yourself. + void ChooseOffset(); + + // The remaining data members usually can be left alone: + int max_iteration; + real_t eps = minimum_effective_decimal>() * 1e3; + real_t tridiag_eps_ratio = 1e-1; + int initial_vector_size = 200; + std::function&)> init_vector = + VectorRandomInitializer::init; + + // (for those who prefer "Set" functions...) + int SetSize(int matrix_size); + void SetMul(std::function&, + std::vector&)> mv_mul); + void SetInitVec(std::function&)> init_vector); + void SetFindMax(bool find_maximum); + void SetEvalOffset(T eigenvalue_offset); + void SetEpsilon(T eps); + void SetTriEpsRatio(T tridiag_eps_ratio); + +private: + static void schmidt_orth(std::vector&, const std::vector>&); + real_t find_minimum_eigenvalue(const std::vector>&, + const std::vector>&) const; + real_t find_maximum_eigenvalue(const std::vector>&, + const std::vector>&) const; + static real_t tridiagonal_eigen_limit(const std::vector>&, + const std::vector>&); + static int num_of_eigs_smaller_than(real_t, + const std::vector>&, + const std::vector>&); + real_t UpperBoundEvals() const; +}; + + + +/// @brief +/// PEigenDense is a class containing only one useful member function: +/// PrincipalEigen(). This function calculates the principal (largest +/// or smallest) eigenvalue and corresponding eigenvector of a square +/// n x n matrix. This can be faster than diagionalizing the entire matrix. +/// (For example by using the Lanczos algorithm or something similar.) +/// @note +/// This code is a wrapper. Internally, it uses the "LambdaLanczos" class. +/// @note +/// For matrices larger than 13x13, PEigenDense::PrincipleEigen() +/// is usually faster than Jacobi::Diagonalize().) + +template +class PEigenDense +{ + size_t n; // the size of the matrix + std::vector evec; // preallocated vector + +public: + void SetSize(int matrix_size) { + n = matrix_size; + evec.resize(n); + } + + PEigenDense(int matrix_size=0):evec(matrix_size) { + SetSize(matrix_size); + } + + /// @brief Calculate the principal eigenvalue and eigenvector of a matrix. + /// @return Return the principal eigenvalue of the matrix. + /// If you want the eigenvector, pass a non-null "evector" argument. + Scalar + PrincipalEigen(ConstMatrix matrix, //!< the input patrix + Vector evector, //!< the eigenvector is stored here + bool find_max=false); //!< want the max or min eigenvalue? + +}; // class PEigenDense + + + +// -------------------------------------- +// ----------- IMPLEMENTATION ----------- +// -------------------------------------- + + + + +// --- Implementation: Memory allocation for matrices --- +template +void Alloc2D(size_t nrows, // size of the array (number of rows) + size_t ncols, // size of the array (number of columns) + Entry ***paaX) // pointer to a 2D C-style array +{ + assert(paaX); + *paaX = new Entry* [nrows]; //conventional 2D C array (pointer-to-pointer) + (*paaX)[0] = new Entry [nrows * ncols]; // 1D C array (contiguous memor) + for(size_t iy=0; iy +void Dealloc2D(Entry ***paaX) // pointer to a 2D C-style array +{ + if (paaX && *paaX) { + delete [] (*paaX)[0]; + delete [] (*paaX); + *paaX = nullptr; + } +} + +/// @brief ConjugateProduct::prod(a,b) is a function which returns a*b by +/// default. If the arguments are complex numbers, it returns conj(a)*b instead. +template +struct ConjugateProduct { +public: + static T prod(T a, T b) { return a*b; } +}; + +template +struct ConjugateProduct> { +public: + static std::complex prod(std::complex a, std::complex b) { + return std::conj(a)*b; + } +}; + + +// --- Implementation: Operations on vectors (of real and complex numbers) --- + +template +inline T inner_prod(const std::vector& v1, const std::vector& v2) { + return std::inner_product(std::begin(v1), std::end(v1), + std::begin(v2), T(), + [](T a, T b) -> T { return a+b; }, + ConjugateProduct::prod); + // T() means zero value of type T + // This spec is required because std::inner_product calculates + // v1*v2 not conj(v1)*v2 +} + +template +inline real_t l2_norm(const std::vector& vec) { + return std::sqrt(std::real(inner_prod(vec, vec))); + // The norm of any complex vector is real by definition. +} + +template +inline void scalar_mul(T1 a, std::vector& vec) { + int n = vec.size(); + for(int i = 0;i < n;i++) + vec[i] *= a; +} + +template +inline void normalize(std::vector& vec) { + scalar_mul(1.0/l2_norm(vec), vec); +} + + +template +inline real_t l1_norm(const std::vector& vec) { + real_t norm = real_t(); // Zero initialization + for(const T& element : vec) + norm += std::abs(element); + return norm; +} + + + + +// --- Implementation: Eigendecomposition of small dense matrices --- + +template +int Jacobi:: +Diagonalize(ConstMatrix mat, // the matrix you wish to diagonalize (size n) + Vector eval, // store the eigenvalues here + Matrix evec, // store the eigenvectors here (in rows) + SortCriteria sort_criteria, // sort results? + bool calc_evec, // calculate the eigenvectors? + int max_num_sweeps) // limit the number of iterations ("sweeps") +{ + // -- Initialization -- + for (int i = 0; i < n; i++) + for (int j = i; j < n; j++) //copy mat[][] into M[][] + M[i][j] = mat[i][j]; //(M[][] is a local copy we can modify) + + if (calc_evec) + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + evec[i][j] = (i==j) ? 1.0 : 0.0; //Set evec equal to the identity matrix + + for (int i = 0; i < n-1; i++) //Initialize the "max_idx_row[]" array + max_idx_row[i] = MaxEntryRow(M, i); //(which is needed by MaxEntry()) + + // -- Iteration -- + int n_iters; + int max_num_iters = max_num_sweeps*n*(n-1)/2; //"sweep" = n*(n-1)/2 iters + for (n_iters=0; n_iters < max_num_iters; n_iters++) { + int i,j; + MaxEntry(M, i, j); // Find the maximum entry in the matrix. Store in i,j + + // If M[i][j] is small compared to M[i][i] and M[j][j], set it to 0. + if ((M[i][i] + M[i][j] == M[i][i]) && (M[j][j] + M[i][j] == M[j][j])) { + M[i][j] = 0.0; + max_idx_row[i] = MaxEntryRow(M,i); //must also update max_idx_row[i] + } + + if (M[i][j] == 0.0) + break; + + // Otherwise, apply a rotation to make M[i][j] = 0 + CalcRot(M, i, j); // Calculate the parameters of the rotation matrix. + ApplyRot(M, i, j); // Apply this rotation to the M matrix. + if (calc_evec) // Optional: If the caller wants the eigenvectors, then + ApplyRotLeft(evec,i,j); // apply the rotation to the eigenvector matrix + + } //for (int n_iters=0; n_iters < max_num_iters; n_iters++) + + // -- Post-processing -- + for (int i = 0; i < n; i++) + eval[i] = M[i][i]; + + // Optional: Sort results by eigenvalue. + SortRows(eval, evec, n, sort_criteria); + + return n_iters / (n*(n-1)/2); //returns the number of "sweeps" (converged?) +} + + +/// brief Calculate the components of a rotation matrix which performs a +/// rotation in the i,j plane by an angle (θ) that (when multiplied on +/// both sides) will zero the ij'th element of M, so that afterwards +/// M[i][j] = 0. The results will be stored in c, s, and t +/// (which store cos(θ), sin(θ), and tan(θ), respectively). + +template +void Jacobi:: +CalcRot(Scalar const *const *M, //!< matrix + int i, //!< row index + int j) //!< column index +{ + t = 1.0; // = tan(θ) + Scalar M_jj_ii = (M[j][j] - M[i][i]); + if (M_jj_ii != 0.0) { + // kappa = (M[j][j] - M[i][i]) / (2*M[i][j]) + Scalar kappa = M_jj_ii; + t = 0.0; + Scalar M_ij = M[i][j]; + if (M_ij != 0.0) { + kappa /= (2.0*M_ij); + // t satisfies: t^2 + 2*t*kappa - 1 = 0 + // (choose the root which has the smaller absolute value) + t = 1.0 / (std::sqrt(1 + kappa*kappa) + std::abs(kappa)); + if (kappa < 0.0) + t = -t; + } + } + assert(std::abs(t) <= 1.0); + c = 1.0 / std::sqrt(1 + t*t); + s = c*t; +} + + +/// brief Perform a similarity transformation by multiplying matrix M on both +/// sides by a rotation matrix (and its transpose) to eliminate M[i][j]. +/// details This rotation matrix performs a rotation in the i,j plane by +/// angle θ. This function assumes that c=cos(θ). s=som(θ), t=tan(θ) +/// have been calculated previously (using the CalcRot() function). +/// It also assumes that iv) are not computed. +/// +/// verbatim +/// +/// M' = R^T * M * R +/// where R the rotation in the i,j plane and ^T denotes the transpose. +/// i j +/// _ _ +/// | 1 | +/// | . | +/// | . | +/// | 1 | +/// | c ... s | +/// | . . . | +/// R = | . 1 . | +/// | . . . | +/// | -s ... c | +/// | 1 | +/// | . | +/// | . | +/// |_ 1 _| +/// +/// endverbatim +/// +/// Let M' denote the matrix M after multiplication by R^T and R. +/// The components of M' are: +/// M'_uv = Σ_w Σ_z R_wu * M_wz * R_zv +/// +/// note +/// The rotation at location i,j will modify all of the matrix +/// elements containing at least one index which is either i or j +/// such as: M[w][i], M[i][w], M[w][j], M[j][w]. +/// Check and see whether these modified matrix elements exceed the +/// corresponding values in max_idx_row[] array for that row. +/// If so, then update max_idx_row for that row. +/// This is somewhat complicated by the fact that we must only consider +/// matrix elements in the upper-right triangle strictly above the diagonal. +/// (ie. matrix elements whose second index is > the first index). + +template +void Jacobi:: +ApplyRot(Scalar **M, // matrix + int i, // row index + int j) // column index +{ + // Recall that c = cos(θ), s = sin(θ), t = tan(θ) (and t <= 1.0) + + // Compute the diagonal elements of M which have changed: + M[i][i] -= t * M[i][j]; + M[j][j] += t * M[i][j]; + + //Update the off-diagonal elements of M which will change (above the diagonal) + assert(i < j); + M[i][j] = 0.0; + + //compute M[w][i] and M[i][w] for all w!=i,considering above-diagonal elements + for (int w=0; w < i; w++) { // 0 <= w < i < j < n + M[i][w] = M[w][i]; //backup the previous value. store below diagonal (i>w) + M[w][i] = c*M[w][i] - s*M[w][j]; //M[w][i], M[w][j] from previous iteration + if (i == max_idx_row[w]) max_idx_row[w] = MaxEntryRow(M, w); + else if (std::abs(M[w][i])>std::abs(M[w][max_idx_row[w]])) max_idx_row[w]=i; + //assert(max_idx_row[w] == MaxEntryRow(M, w)); + } + for (int w=i+1; w < j; w++) { // 0 <= i < w < j < n + M[w][i] = M[i][w]; //backup the previous value. store below diagonal (w>i) + M[i][w] = c*M[i][w] - s*M[w][j]; //M[i][w], M[w][j] from previous iteration + } + for (int w=j+1; w < n; w++) { // 0 <= i < j+1 <= w < n + M[w][i] = M[i][w]; //backup the previous value. store below diagonal (w>i) + M[i][w] = c*M[i][w] - s*M[j][w]; //M[i][w], M[j][w] from previous iteration + } + + // now that we're done modifying row i, we can update max_idx_row[i] + max_idx_row[i] = MaxEntryRow(M, i); + + //compute M[w][j] and M[j][w] for all w!=j,considering above-diagonal elements + for (int w=0; w < i; w++) { // 0 <= w < i < j < n + M[w][j] = s*M[i][w] + c*M[w][j]; //M[i][w], M[w][j] from previous iteration + if (j == max_idx_row[w]) max_idx_row[w] = MaxEntryRow(M, w); + else if (std::abs(M[w][j])>std::abs(M[w][max_idx_row[w]])) max_idx_row[w]=j; + //assert(max_idx_row[w] == MaxEntryRow(M, w)); + } + for (int w=i+1; w < j; w++) { // 0 <= i+1 <= w < j < n + M[w][j] = s*M[w][i] + c*M[w][j]; //M[w][i], M[w][j] from previous iteration + if (j == max_idx_row[w]) max_idx_row[w] = MaxEntryRow(M, w); + else if (std::abs(M[w][j])>std::abs(M[w][max_idx_row[w]])) max_idx_row[w]=j; + //assert(max_idx_row[w] == MaxEntryRow(M, w)); + } + for (int w=j+1; w < n; w++) { // 0 <= i < j < w < n + M[j][w] = s*M[w][i] + c*M[j][w]; //M[w][i], M[j][w] from previous iteration + } + // now that we're done modifying row j, we can update max_idx_row[j] + max_idx_row[j] = MaxEntryRow(M, j); +} //Jacobi::ApplyRot() + + +/// brief Multiply matrix E on the left by the (previously calculated) +/// rotation matrix. +/// +/// details +/// Multiply matrix M on the LEFT side by a transposed rotation matrix, R^T. +/// This matrix performs a rotation in the i,j plane by angle θ +/// (where the arguments "s" and "c" refer to cos(θ) and sin(θ), respectively). +/// +/// verbatim +/// E'_uv = Σ_w R_wu * E_wv +/// endverbatim + +template +void Jacobi:: +ApplyRotLeft(Matrix E, // matrix + int i, // row index + int j) // column index +{ + // recall that c = cos(θ) and s = sin(θ) + for (int v = 0; v < n; v++) { + Scalar Eiv = E[i][v]; //backup E[i][v] + E[i][v] = c*E[i][v] - s*E[j][v]; + E[j][v] = s*Eiv + c*E[j][v]; + } +} + +/// brief Find the off-diagonal index in row i whose absolute value is largest +template +int Jacobi:: +MaxEntryRow(Scalar const *const *M, int i) const { + int j_max = i+1; + for(int j = i+2; j < n; j++) + if (std::abs(M[i][j]) > std::abs(M[i][j_max])) + j_max = j; + return j_max; +} + +/// brief Find the indices (i_max, j_max) marking the location of the +/// entry in the matrix with the largest absolute value. This +/// uses the max_idx_row[] array to find the answer in O(n) time. +/// returns This function does not return a avalue. However after it is +/// invoked, the location of the largest matrix element will be +/// stored in the i_max and j_max arguments. +template +void Jacobi:: +MaxEntry(Scalar const *const *M, int& i_max, int& j_max) const { + // find the maximum entry in the matrix M in O(n) time + i_max = 0; + j_max = max_idx_row[i_max]; + Scalar max_entry = std::abs(M[i_max][j_max]); + int nm1 = n-1; + for (int i=1; i < nm1; i++) { + int j = max_idx_row[i]; + if (std::abs(M[i][j]) > max_entry) { + max_entry = std::abs(M[i][j]); + i_max = i; + j_max = j; + } + } +} + +/// brief Sort the rows in matrix "evec" according to the numbers in "eval". +template +void Jacobi:: +SortRows(Vector eval, // vector containing the keys used for sorting + Matrix evec, // matrix whose rows will be sorted according to v + int n, // size of the vector and matrix + SortCriteria sort_criteria) const // sort eigenvalues? +{ + for (int i = 0; i < n-1; i++) { + int i_max = i; + for (int j = i+1; j < n; j++) { + // find the "maximum" element in the array starting at position i+1 + switch (sort_criteria) { + case SORT_DECREASING_EVALS: + if (eval[j] > eval[i_max]) + i_max = j; + break; + case SORT_INCREASING_EVALS: + if (eval[j] < eval[i_max]) + i_max = j; + break; + case SORT_DECREASING_ABS_EVALS: + if (std::abs(eval[j]) > std::abs(eval[i_max])) + i_max = j; + break; + case SORT_INCREASING_ABS_EVALS: + if (std::abs(eval[j]) < std::abs(eval[i_max])) + i_max = j; + break; + default: + break; + } + } + std::swap(eval[i], eval[i_max]); // sort "eval" + for (int k = 0; k < n; k++) + std::swap(evec[i][k], evec[i_max][k]); // sort "evec" + } +} + +template +void Jacobi:: +Init() { + n = 0; + M = nullptr; + max_idx_row = nullptr; +} + +template +void Jacobi:: +SetSize(int n) { + Dealloc(); + Alloc(n); +} + +// Implementation: Jacobi memory management: + +template +void Jacobi:: +Alloc(int n) { + this->n = n; + if (n > 0) { + max_idx_row = new int[n]; + Alloc2D(n, n, &M); + } +} + +template +void Jacobi:: +Dealloc() { + if (max_idx_row) + delete [] max_idx_row; + Dealloc2D(&M); + Init(); +} + +// Jacobi copy and move constructor, swap, and assignment operator: + +template +Jacobi:: +Jacobi(const Jacobi& source) +{ + Init(); + SetSize(source.n); + assert(n == source.n); + // The following lines aren't really necessary, because the contents + // of source.M and source.max_idx_row are not needed (since they are + // overwritten every time Jacobi::Diagonalize() is invoked). + std::copy(source.max_idx_row, + source.max_idx_row + n, + max_idx_row); + for (int i = 0; i < n; i++) + std::copy(source.M[i], + source.M[i] + n, + M[i]); +} + +template +void Jacobi:: +swap(Jacobi &other) { + std::swap(n, other.n); + std::swap(max_idx_row, other.max_idx_row); + std::swap(M, other.M); +} + +// Move constructor (C++11) +template +Jacobi:: +Jacobi(Jacobi&& other) { + Init(); + swap(*this, other); +} + +// Using the "copy-swap" idiom for the assignment operator +template +Jacobi& +Jacobi:: +operator = (Jacobi source) { + this->swap(source); + return *this; +} + + + +// --- Implementation: Eigendecomposition of large matrices ---- + +template +inline LambdaLanczos::LambdaLanczos() { + this->matrix_size = 0; + this->max_iteration = 0; + this->find_maximum = 0; +} + + +template +inline LambdaLanczos:: +LambdaLanczos(std::function&, + std::vector&)> mv_mul, + int matrix_size, + bool find_maximum) +{ + this->mv_mul = mv_mul; + this->matrix_size = matrix_size; + this->max_iteration = matrix_size; + this->find_maximum = find_maximum; +} + + +template +inline int LambdaLanczos:: +run(real_t& eigvalue, std::vector& eigvec) const +{ + assert(matrix_size > 0); + assert(0 < this->tridiag_eps_ratio && this->tridiag_eps_ratio < 1); + + std::vector> u; // Lanczos vectors + std::vector> alpha; // Diagonal elements of an approximated tridiagonal matrix + std::vector> beta; // Subdiagonal elements of an approximated tridiagonal matrix + + const int n = this->matrix_size; + + u.reserve(this->initial_vector_size); + alpha.reserve(this->initial_vector_size); + beta.reserve(this->initial_vector_size); + + u.emplace_back(n, 0.0); // Same as u.push_back(std::vector(n, 0.0)) + + std::vector vk(n, 0.0); + + real_t alphak = 0.0; + alpha.push_back(alphak); + real_t betak = 0.0; + beta.push_back(betak); + + std::vector uk(n); + this->init_vector(uk); + normalize(uk); + u.push_back(uk); + + real_t ev, pev; // Calculated eigenvalue and previous one + pev = std::numeric_limits>::max(); + + int itern = this->max_iteration; + for(int k = 1;k <= this->max_iteration;k++) { + // vk = (A + offset*E)uk, here E is the identity matrix + for(int i = 0;i < n;i++) { + vk[i] = uk[i]*this->eigenvalue_offset; + } + this->mv_mul(uk, vk); + + alphak = std::real(inner_prod(u.back(), vk)); + + // The inner product is real. + // Proof: + // = + // On the other hand its complex conjugate is + // ^* = = = + // here the condition that matrix A is a symmetric (Hermitian) is used. + // Therefore + // = ^* + // is real. + + alpha.push_back(alphak); + + for(int i = 0;i < n; i++) { + uk[i] = vk[i] - betak*u[k-1][i] - alphak*u[k][i]; + } + + schmidt_orth(uk, u); + + betak = l2_norm(uk); + beta.push_back(betak); + + if(this->find_maximum) { + ev = find_maximum_eigenvalue(alpha, beta); + } else { + ev = find_minimum_eigenvalue(alpha, beta); + } + + const real_t zero_threshold = minimum_effective_decimal>()*1e-1; + if(betak < zero_threshold) { + u.push_back(uk); + // This element will never be accessed, + // but this "push" guarantees u to always have one more element than + // alpha and beta do. + itern = k; + break; + } + + normalize(uk); + u.push_back(uk); + + if(abs(ev-pev) < std::min(abs(ev), abs(pev))*this->eps) { + itern = k; + break; + } else { + pev = ev; + } + } + + eigvalue = ev - this->eigenvalue_offset; + + int m = alpha.size(); + std::vector cv(m+1); + cv[0] = 0.0; + cv[m] = 0.0; + cv[m-1] = 1.0; + + beta[m-1] = 0.0; + + if(eigvec.size() < n) { + eigvec.resize(n); + } + + for(int i = 0;i < n;i++) { + eigvec[i] = cv[m-1]*u[m-1][i]; + } + + for(int k = m-2;k >= 1;k--) { + cv[k] = ((ev - alpha[k+1])*cv[k+1] - beta[k+1]*cv[k+2])/beta[k]; + + for(int i = 0;i < n;i++) { + eigvec[i] += cv[k]*u[k][i]; + } + } + + normalize(eigvec); + + return itern; + +} //LambdaLancos::run() + + + +template +inline void LambdaLanczos:: +schmidt_orth(std::vector& uorth, const std::vector>& u) +{ + // Vectors in u must be normalized, but uorth doesn't have to be. + + int n = uorth.size(); + + for(int k = 0;k < u.size();k++) { + T innprod = inner_prod(uorth, u[k]); + for(int i = 0;i < n;i++) + uorth[i] -= innprod * u[k][i]; + } +} + + +template +inline real_t LambdaLanczos:: +find_minimum_eigenvalue(const std::vector>& alpha, + const std::vector>& beta) const +{ + real_t eps = this->eps * this->tridiag_eps_ratio; + real_t pmid = std::numeric_limits>::max(); + real_t r = tridiagonal_eigen_limit(alpha, beta); + real_t lower = -r; + real_t upper = r; + real_t mid; + int nmid; // Number of eigenvalues smaller than the "mid" + + while(upper-lower > std::min(abs(lower), abs(upper))*eps) { + mid = (lower+upper)/2.0; + nmid = num_of_eigs_smaller_than(mid, alpha, beta); + if(nmid >= 1) { + upper = mid; + } else { + lower = mid; + } + + if(mid == pmid) { + break; // This avoids an infinite loop due to zero matrix + } + pmid = mid; + } + + return lower; // The "lower" almost equals the "upper" here. +} + + +template +inline real_t LambdaLanczos:: +find_maximum_eigenvalue(const std::vector>& alpha, + const std::vector>& beta) const +{ + real_t eps = this->eps * this->tridiag_eps_ratio; + real_t pmid = std::numeric_limits>::max(); + real_t r = tridiagonal_eigen_limit(alpha, beta); + real_t lower = -r; + real_t upper = r; + real_t mid; + int nmid; // Number of eigenvalues smaller than the "mid" + + int m = alpha.size() - 1; // Number of eigenvalues of the approximated + // triangular matrix, which equals the rank of it + + + while(upper-lower > std::min(abs(lower), abs(upper))*eps) { + mid = (lower+upper)/2.0; + nmid = num_of_eigs_smaller_than(mid, alpha, beta); + + if(nmid < m) { + lower = mid; + } else { + upper = mid; + } + + if(mid == pmid) { + break; // This avoids an infinite loop due to zero matrix + } + pmid = mid; + } + + return lower; // The "lower" almost equals the "upper" here. +} + + +/// @brief +/// Compute the upper bound of the absolute value of eigenvalues +/// by Gerschgorin theorem. This routine gives a rough upper bound, +/// but it is sufficient because the bisection routine using +/// the upper bound converges exponentially. + +template +inline real_t LambdaLanczos:: +tridiagonal_eigen_limit(const std::vector>& alpha, + const std::vector>& beta) +{ + real_t r = l1_norm(alpha); + r += 2*l1_norm(beta); + + return r; +} + + + +// Algorithm from +// Peter Arbenz et al. +// "High Performance Algorithms for Structured Matrix Problems" +// Nova Science Publishers, Inc. + +template +inline int LambdaLanczos:: +num_of_eigs_smaller_than(real_t c, + const std::vector>& alpha, + const std::vector>& beta) +{ + real_t q_i = 1.0; + int count = 0; + int m = alpha.size(); + + for(int i = 1;i < m;i++){ + q_i = alpha[i] - c - beta[i-1]*beta[i-1]/q_i; + if(q_i < 0){ + count++; + } + if(q_i == 0){ + q_i = minimum_effective_decimal>(); + } + } + + return count; +} + + +template +inline void LambdaLanczos::ChooseOffset() { + const auto n = this->matrix_size; + std::vector unit_vec_j(n); + std::vector matrix_column_j(n); + real_t eval_upper_bound = 0.0; + /// According to Gershgorin theorem, the maximum (magnitude) eigenvalue should + /// not exceed max_j{Σ_i|Mij|}. We can infer the contents of each column in + /// the matrix by multiplying it by different unit vectors. This is slow. + for (int j = 0; j < n; j++) { + std::fill(unit_vec_j.begin(), unit_vec_j.end(), 0); // fill with zeros + unit_vec_j[j] = 1.0; // = jth element is 1, all other elements are 0 + // Multiplying the matrix by a unit vector (a vector containing only one + // non-zero element at position j) extracts the jth column of the matrix. + this->mv_mul(unit_vec_j, matrix_column_j); + real_t sum_column = 0.0; // compute Σ_i|Mij| + for (int i = 0; i < n; i++) + sum_column += std::abs(matrix_column_j[i]); + if (eval_upper_bound < sum_column) + eval_upper_bound = sum_column; // compute max_j{Σ_i|Mij|} + } + if (find_maximum) + this->eigenvalue_offset = eval_upper_bound; + else + this->eigenvalue_offset = -eval_upper_bound; +} + + +template +inline int LambdaLanczos::SetSize(int matrix_size) +{ + this->matrix_size = matrix_size; + this->max_iteration = matrix_size; + return matrix_size; +} + +template +inline void LambdaLanczos::SetMul(std::function&, std::vector&)> mv_mul) +{ + this->mv_mul = mv_mul; +} + +template +inline void LambdaLanczos::SetInitVec(std::function&)> init_vector) +{ + this->init_vector = init_vector; +} + +template +inline void LambdaLanczos::SetFindMax(bool find_maximum) { + this->find_maximum = find_maximum; +} + +template +inline void LambdaLanczos::SetEvalOffset(T offset) +{ + this->eigenvalue_offset = offset; +} + +template +inline void LambdaLanczos::SetEpsilon(T epsilon) +{ + this->eps = epsilon; +} + +template +inline void LambdaLanczos::SetTriEpsRatio(T tri_eps_ratio) +{ + this->tridiag_eps_ratio = tri_eps_ratio; +} + + + + + +template +inline void VectorRandomInitializer:: +init(std::vector& v) +{ + std::random_device dev; + std::mt19937 mt(dev()); + std::uniform_real_distribution rand((T)(-1.0), (T)(1.0)); + + int n = v.size(); + for(int i = 0;i < n;i++) { + v[i] = rand(mt); + } + + normalize(v); +} + + +template +inline void VectorRandomInitializer>:: +init(std::vector>& v) +{ + std::random_device dev; + std::mt19937 mt(dev()); + std::uniform_real_distribution rand((T)(-1.0), (T)(1.0)); + + int n = v.size(); + for(int i = 0;i < n;i++) { + v[i] = std::complex(rand(mt), rand(mt)); + } + + normalize(v); +} + + +// --- Implementation of PEigenDense + +template +Scalar PEigenDense:: +PrincipalEigen(ConstMatrix matrix, + Vector eigenvector, + bool find_max) +{ + assert(n > 0); + auto matmul = [&](const std::vector& in, std::vector& out) { + for(int i = 0; i < n; i++) { + for(int j = 0; j < n; j++) { + out[i] += matrix[i][j]*in[j]; + } + } + }; + auto init_vec = [&](std::vector& vec) { + for(int i = 0; i < n; i++) + vec[i] = 0.0; + vec[0] = 1.0; + }; + + // "ll_engine" calculates the eigenvalue and eigenvector. + LambdaLanczos ll_engine(matmul, n, find_max); + + // The Lanczos algorithm selects the eigenvalue with the largest magnitude. + // In order to insure that this is the one we want (maxima or minima), we can + // add a constant to all of the eigenvalues by setting "eigenvalue_offset". + Scalar eval_upper_bound = 0.0; + for (int i = 0; i < n; i++) { + Scalar sum_row = 0.0; + for (int j = 0; j < n; i++) + sum_row += std::abs(matrix[i][j]); + if (eval_upper_bound < sum_row) + eval_upper_bound = sum_row; + } + if (find_max) + ll_engine.eigenvalue_offset = eval_upper_bound; + else + ll_engine.eigenvalue_offset = -eval_upper_bound; + + ll_engine.init_vector = init_vec; + + Scalar eval; + + // This line does all of the hard work: + size_t itern = ll_engine.run(eval, evec); + + for (int i = 0; i < n; i++) + eigenvector[i] = evec[i]; + + return eval; +} + + +} //namespace MathEigen + + +#endif //#ifndef _MATH_EIGEN_H diff --git a/src/USER-REACTION/superpose3d.h b/src/USER-REACTION/superpose3d.h new file mode 100644 index 0000000000..e61e8e0c93 --- /dev/null +++ b/src/USER-REACTION/superpose3d.h @@ -0,0 +1,466 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. (Some of the code in this file is also + available using a more premissive license. See below for details.) + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + Contributing author: Andrew Jewett (Scripps Research) + Availability: https://github.com/jewettaij/superpose3d_cpp (MIT license) +------------------------------------------------------------------------- */ + +/// @file superpose3d.hpp +/// @brief Calculate the optimal rotation, translation and scale needed to +/// optimally fit two different point clouds containing n points. +/// @author Andrew Jewett +/// @license MIT + +#ifndef _SUPERPOSE3D_H +#define _SUPERPOSE3D_H + +#include "math_eigen.h" //functions to calculate eigenvalues and eigenvectors + +// ----------------------------------------------------------- +// ------------------------ INTERFACE ------------------------ +// ----------------------------------------------------------- + +/// @brief Superpose3d is a class with only one important member function +/// Superpose(). It is useful for calculating the optimal +/// superposition (rotations, translations, and scale transformations) +/// between two point clouds of the same size. +template +class Superpose3D { +private: + size_t N; //number of points in the point clouds + Scalar *aWeights; //weights applied to points when computing RMSD + MathEigen::Jacobi eigen_calc; // calc eigenvectors + Scalar **aaXf_shifted; //preallocated space for fixed point cloud (Nx3 array) + Scalar **aaXm_shifted; //preallocated space for mobile point cloud (Nx3 array) + +public: + // The following data members store the rotation, translation and scale + // after optimal superposition + Scalar **R; //!< store optimal rotation here (this is a 3x3 array). + Scalar T[3]; //!< store optimal translation here + Scalar c; //!< store optimal scale (typically 1 unless requested by the user) + Scalar q[4]; //!< quaternion corresponding to the rotation stored in R. + // The first entry of q is cos(θ/2). The remaining 3 entries + // of q are the axis of rotation (with length sin(θ/2)). + // (Note: This is not the same as "p" from Diamond's 1988 paper.) + + Superpose3D(size_t N = 0); //!< N=number of points in both point clouds + + Superpose3D(size_t N, //!< N = number of points in both point clouds + ConstArray aWeights); //!< weight per point for computing RMSD + + ~Superpose3D(); + + /// @brief specify he number of points in both point clouds + void SetNumPoints(size_t N); + /// @brief return the number of points in both point clouds + size_t GetNumPoints() { return N; } + /// @brief specify the weight applied to each point when computing RMSD + void SetWeights(ConstArray aWeights); + + /// @brief Use rigid-body transformations (rotations, translations, and + /// optionally scale transformations) to superimpose two point clouds. + /// + /// @details + /// This function takes two lists of xyz coordinates (of the same length) and + /// attempts to superimpose them using rotations, translations, and + /// (optionally) scale transformations. These transformations are applied to + /// to the coordinates in the "aaXm_orig" array (the "mobile" point cloud) + /// in order to minimize the root-mean-squared-distance (RMSD) between the + /// corresponding points in each cloud, where RMSD is defined as: + /// + /// @verbatim + /// sqrt((Σ_n w[n]*Σ_i |X[n][i] - (Σ_j c*R[i][j]*x[n][j]+T[i])|^2)/(Σ_n w[n])) + /// @endverbatim + /// + /// In this formula, the "X_i" and "x_i" are coordinates of the ith fixed and + /// mobile point clouds (represented by "aaXf" and "aaXm" in the code below) + /// and "w_i" are optional weights (represented by "aWeights" in the code). + /// This function implements a more general variant of the method from: + /// @verbatim + /// R. Diamond, (1988) "A Note on the Rotational Superposition Problem", + /// Acta Cryst. A44, pp. 211-216 + /// @endverbatim + /// + /// @note: + /// This code has been augmented with a new feature. The version in the + /// original paper only considers rotation and translation and does not allow + /// coordinates of either cloud to be rescaled (multiplied by a scalar). + /// To enable the ability to rescale the coordinates, set allow_rescale=true. + /// (By default, this feature is disabled.) + /// + /// @returns + /// The RMSD between the 2 pointclouds after optimal rotation, translation + /// (and scaling if requested) was applied to the "mobile" point cloud. + /// After this function is called, the optimal rotation, translation, + /// and scale (if requested) will be stored in the "R", "T", and "c" + /// public data members. + Scalar Superpose(ConstArrayOfCoords aaXf, //!< coords for the "frozen" object + ConstArrayOfCoords aaXm, //!< coords for the "mobile" object + bool allow_rescale=false //!< rescale mobile object? (c≠1?) + ); + + // C++ boilerplate: copy and move constructor, swap, and assignment operator + Superpose3D(const Superpose3D& source); + Superpose3D(Superpose3D&& other); + void swap(Superpose3D &other); + Superpose3D& operator = (Superpose3D source); + +private: + + // memory management: + void Alloc(size_t N); + void Init(); + void Dealloc(); + +}; // class Superpose3D + + + + + +// -------------- IMPLEMENTATION -------------- + + +template +static inline Scalar SQR(Scalar x) {return x*x;} + +template +Scalar Superpose3D:: +Superpose(ConstArrayOfCoords aaXf, // coords for the "frozen" object + ConstArrayOfCoords aaXm, // coords for the "mobile" object + bool allow_rescale) // rescale mobile object? (c!=1?) +{ + assert(aaXf && aaXm); + assert(aaXf_shifted && aaXm_shifted); + assert(aWeights); + assert(R && T); + + // Find the center of mass of each object: + Scalar aCenter_f[3] = {0.0, 0.0, 0.0}; + Scalar aCenter_m[3] = {0.0, 0.0, 0.0}; + Scalar sum_weights = 0.0; + for (size_t n=0; n < N; n++) { + Scalar weight = aWeights[n]; + for (int d=0; d < 3; d++) { + aCenter_f[d] += aaXf[n][d]*weight; + aCenter_m[d] += aaXm[n][d]*weight; + } + sum_weights += weight; + } + assert(sum_weights != 0.0); + for (int d=0; d < 3; d++) { + aCenter_f[d] /= sum_weights; + aCenter_m[d] /= sum_weights; + } + + //Subtract the centers-of-mass from the original coordinates for each object + for (size_t n=0; n < N; n++) { + for (int d=0; d < 3; d++) { + // shift the coordinates so that the new center of mass is at the origin + aaXf_shifted[n][d] = aaXf[n][d] - aCenter_f[d]; + aaXm_shifted[n][d] = aaXm[n][d] - aCenter_m[d]; + } + } + + // Calculate the "M" array from the Diamond paper (equation 16) + Scalar M[3][3]; + for (int i=0; i < 3; i++) + for (int j=0; j < 3; j++) + M[i][j] = 0.0; + + for (size_t n=0; n < N; n++) { + Scalar weight = aWeights[n]; + for (int i=0; i < 3; i++) { + for (int j=0; j < 3; j++) { + M[i][j] += weight * aaXm_shifted[n][i] * aaXf_shifted[n][j]; + } + } + } + + // Calculate Q (equation 17) + Scalar traceM = 0.0; + for (int i=0; i < 3; i++) + traceM += M[i][i]; + Scalar Q[3][3]; + for (int i=0; i < 3; i++) { + for (int j=0; j < 3; j++) { + Q[i][j] = M[i][j] + M[j][i]; + if (i==j) + Q[i][j] -= 2.0 * traceM; + } + } + + // Calculate V (equation 18) + Scalar V[3]; + V[0] = M[1][2] - M[2][1]; + V[1] = M[2][0] - M[0][2]; + V[2] = M[0][1] - M[1][0]; + + // Calculate "P" (equation 22) + // First we must allocate space for the P matrix. It's not safe to declare: + // Scalar P[4][4]; + // ...because most matrix solvers expect arrays in pointer-to-pointer format. + // (a different format). Below I create a fixed size matrix P in this format. + Scalar _P[4*4]; // Contiguous 1D array for storing contents of the 2D P array + Scalar *P[4]; // This version of P has has ** (pointer-to-pointer) format. + for (int i=0; i < 4; i++) // We must make sure that + P[i] = &(_P[4*i]); // P[i] points to the appropriate location in memory + + // Now fill the P array + for (int i=0; i < 3; i++) + for (int j=0; j < 3; j++) + P[i][j] = Q[i][j]; + P[0][3] = V[0]; + P[3][0] = V[0]; + P[1][3] = V[1]; + P[3][1] = V[1]; + P[2][3] = V[2]; + P[3][2] = V[2]; + P[3][3] = 0.0; + + // The vector "p" contains the optimal rotation (backwards quaternion format) + Scalar p[4] = {0.0, 0.0, 0.0, 1.0}; // default value + Scalar pPp = 0.0; // = p^T * P * p (zero by default) + Scalar rmsd = 0.0; // default value + + bool singular = N<2; // (it doesn't make sense to rotate a single point) + + if (! singular) { + // Calculate the principal eigenvalue and eigenvector of matrix P. + // Store the principal eigenvector in "p" + // The vector "p" will contain the optimal rotation (in quaternion format) + + Scalar Evl[4]; // Store the eigenvalues of P here. + Scalar *Evc[4]; // Store the eigevectors here. This version has ** format. + Scalar _Evc[4*4]; // Contiguous 1D array for storing contents of "Evc" array + for (int i=0; i < 4; i++) // We must make sure that + Evc[i] = &(_Evc[4*i]); // Evc[i] points to the correct location in memory + + eigen_calc.Diagonalize(P, Evl, Evc); + + // Note: The eigenvalues are sorted in decreasing order by default. + pPp = Evl[0]; // = the maximum eigenvalue of P + for (int i=0; i < 4; i++) + p[i] = Evc[0][i]; //copy eigenvector corresponding to this eigenvalue to p + } //if (! singular) + + // Now normalize p + Scalar pnorm = 0.0; + for (int i=0; i < 4; i++) + pnorm += p[i]*p[i]; + pnorm = sqrt(pnorm); + for (int i=0; i < 4; i++) + p[i] /= pnorm; + + // Finally, calculate the rotation matrix corresponding to "p" + // (convert a quaternion into a 3x3 rotation matrix) + + R[0][0] = (p[0]*p[0])-(p[1]*p[1])-(p[2]*p[2])+(p[3]*p[3]); + R[1][1] = -(p[0]*p[0])+(p[1]*p[1])-(p[2]*p[2])+(p[3]*p[3]); + R[2][2] = -(p[0]*p[0])-(p[1]*p[1])+(p[2]*p[2])+(p[3]*p[3]); + R[0][1] = 2*(p[0]*p[1] - p[2]*p[3]); + R[1][0] = 2*(p[0]*p[1] + p[2]*p[3]); + R[1][2] = 2*(p[1]*p[2] - p[0]*p[3]); + R[2][1] = 2*(p[1]*p[2] + p[0]*p[3]); + R[0][2] = 2*(p[0]*p[2] + p[1]*p[3]); + R[2][0] = 2*(p[0]*p[2] - p[1]*p[3]); + + q[0] = p[3]; // Note: The "p" variable is not a quaternion in the + q[1] = p[0]; // conventional sense because its elements + q[2] = p[1]; // are in the wrong order. I correct for that here. + q[3] = p[2]; // "q" is the quaternion correspond to rotation R. + + // Optional: Decide the scale factor, c + c = 1.0; // by default, don't rescale the coordinates + + if ((allow_rescale) && (! singular)) { + Scalar Waxaixai = 0.0; + Scalar WaxaiXai = 0.0; + for (size_t a=0; a < N; a++) { + Scalar weight = aWeights[a]; + for (int i=0; i < 3; i++) { + Waxaixai += weight * aaXm_shifted[a][i] * aaXm_shifted[a][i]; + WaxaiXai += weight * aaXm_shifted[a][i] * aaXf_shifted[a][i]; + } + } + c = (WaxaiXai + pPp) / Waxaixai; + + } // if (allow_rescale) + + // Finally compute the RMSD between the two coordinate sets: + // First compute E0 from equation 24 of the paper + Scalar E0 = 0.0; + for (size_t n=0; n < N; n++) { + Scalar weight = aWeights[n]; + for (int d=0; d < 3; d++) + // (remember to include the scale factor "c" that we inserted) + E0 += weight * (SQR(aaXf_shifted[n][d] - c*aaXm_shifted[n][d])); + } + Scalar sum_sqr_dist = E0 - c*2.0*pPp; + if (sum_sqr_dist < 0.0) //(edge case due to rounding error) + sum_sqr_dist = 0.0; + + if (! singular) + rmsd = sqrt(sum_sqr_dist/sum_weights); + + // Lastly, calculate the translational offset. + // If c!=1, this is slightly more complicated than it seems. Recall that: + //RMSD=sqrt((Sum_i w_i * |X_i - Sum_j(c*R_ij*x_j + T_i))|^2) / (Sum_j w_j)) + // =sqrt((Sum_i w_i * |X_i - x_i')|^2) / (Sum_j w_j)) + // where + // x_i' = Sum_j(c*R_ij*x_j) + T_i + // = Xcm_i + c*R_ij*(x_j - xcm_j) + // and Xcm and xcm = center_of_mass for the frozen and mobile point clouds + // + // Hence: + // T_i = Xcm_i - Sum_j c*R_ij*xcm_j + // In the code, Xcm_i is represented by "aCenter_f[i]" + // and xcm_j is represented by "aCenter_m[j]" + + for (int i=0; i < 3; i++) { + T[i] = aCenter_f[i]; + for (int j=0; j < 3; j++) { + T[i] -= c*R[i][j]*aCenter_m[j]; + } + } + + return rmsd; + +} //Superpose3D::Superpose(aaXf, aaXm, allow_rescale) + + +template +void Superpose3D:: +SetNumPoints(size_t N) { + Dealloc(); + Alloc(N); +} + +template +void Superpose3D:: +SetWeights(ConstArray aWeights) { + for (size_t i = 0; i < N; i++) + this->aWeights[i] = aWeights[i]; +} + +template +Superpose3D::Superpose3D(size_t N) + :eigen_calc(4) +{ + Init(); + Alloc(N); +} + +template +Superpose3D:: +Superpose3D(size_t N, ConstArray aWeights) + :eigen_calc(4) +{ + Init(); + Alloc(N); + SetWeights(aWeights); +} + +template +Superpose3D::~Superpose3D() { + Dealloc(); +} + +template +void Superpose3D:: +Init() { + R = nullptr; + aWeights = nullptr; + aaXf_shifted = nullptr; + aaXm_shifted = nullptr; +} + +// memory management: + +template +void Superpose3D:: +Alloc(size_t N) { + this->N = N; + aWeights = new Scalar [N]; + for (size_t i = 0; i < N; i++) + aWeights[i] = 1.0 / N; + MathEigen::Alloc2D(3, 3, &R); + MathEigen::Alloc2D(N, 3, &aaXf_shifted); + MathEigen::Alloc2D(N, 3, &aaXm_shifted); +} + +template +void Superpose3D:: +Dealloc() { + if (R) + MathEigen::Dealloc2D(&R); + if (aWeights) + delete [] aWeights; + if (aaXf_shifted) + MathEigen::Dealloc2D(&aaXf_shifted); + if (aaXm_shifted) + MathEigen::Dealloc2D(&aaXm_shifted); +} + +// memory management: copy and move constructor, swap, and assignment operator: + +template +Superpose3D:: +Superpose3D(const Superpose3D& source) + :eigen_calc(4) +{ + Init(); + Alloc(source.N); + assert(N == source.N); + for (int i = 0; i < N; i++) { + std::copy(source.aaXf_shifted[i], + source.aaXf_shifted[i] + 3, + aaXf_shifted[i]); + std::copy(source.aaXm_shifted[i], + source.aaXm_shifted[i] + 3, + aaXm_shifted[i]); + } +} + +template +void Superpose3D:: +swap(Superpose3D &other) { + std::swap(N, other.N); + std::swap(R, other.R); + std::swap(aaXf_shifted, other.aaXf_shifted); + std::swap(aaXm_shifted, other.aaXm_shifted); +} + +// Move constructor (C++11) +template +Superpose3D:: +Superpose3D(Superpose3D&& other) { + Init(); + swap(*this, other); +} + +// Using the "copy-swap" idiom for the assignment operator +template +Superpose3D& +Superpose3D:: +operator = (Superpose3D source) { + this->swap(source); + return *this; +} + + +#endif //#ifndef _SUPERPOSE3D_H diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index b9cff75d65..4a61cfa03b 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -19,7 +19,7 @@ ------------------------------------------------------------------------- */ #include "fix_qeq_reax.h" -#include + #include #include #include "pair_reaxc.h" @@ -66,12 +66,12 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : if (narg<8 || narg>9) error->all(FLERR,"Illegal fix qeq/reax command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix qeq/reax command"); - swa = force->numeric(FLERR,arg[4]); - swb = force->numeric(FLERR,arg[5]); - tolerance = force->numeric(FLERR,arg[6]); + swa = utils::numeric(FLERR,arg[4],false,lmp); + swb = utils::numeric(FLERR,arg[5],false,lmp); + tolerance = utils::numeric(FLERR,arg[6],false,lmp); int len = strlen(arg[7]) + 1; pertype_option = new char[len]; strcpy(pertype_option,arg[7]); diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index f7ad7ed6d4..c0ffd4c17e 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_reaxc_bonds.h" -#include + #include #include "atom.h" #include "update.h" @@ -44,7 +44,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : ntypes = atom->ntypes; nmax = atom->nmax; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0 ) error->all(FLERR,"Illegal fix reax/c/bonds command"); diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index 74692f1c9b..ec03ab1808 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -17,8 +17,8 @@ ------------------------------------------------------------------------- */ #include "fix_reaxc_species.h" -#include -#include + + #include #include "fix_ave_atom.h" #include "atom.h" diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c89ac5ba77..c38257ae30 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -21,9 +21,9 @@ ------------------------------------------------------------------------- */ #include "pair_reaxc.h" -#include + #include -#include + #include #include #include "atom.h" @@ -39,7 +39,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "reaxc_defs.h" #include "reaxc_types.h" @@ -274,20 +274,20 @@ void PairReaxC::settings(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"safezone") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->safezone = force->numeric(FLERR,arg[iarg+1]); + system->safezone = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (system->safezone < 0.0) error->all(FLERR,"Illegal pair_style reax/c safezone command"); system->saferzone = system->safezone*1.2 + 0.2; iarg += 2; } else if (strcmp(arg[iarg],"mincap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->mincap = force->inumeric(FLERR,arg[iarg+1]); + system->mincap = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (system->mincap < 0) error->all(FLERR,"Illegal pair_style reax/c mincap command"); iarg += 2; } else if (strcmp(arg[iarg],"minhbonds") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_style reax/c command"); - system->minhbonds = force->inumeric(FLERR,arg[iarg+1]); + system->minhbonds = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (system->minhbonds < 0) error->all(FLERR,"Illegal pair_style reax/c minhbonds command"); iarg += 2; @@ -317,7 +317,7 @@ void PairReaxC::coeff( int nargs, char **args ) char *file = args[2]; FILE *fp; - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if (fp != NULL) Read_Force_Field(fp, &(system->reax_param), control); else { diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index 497442fbe8..c49f99a5a0 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -57,7 +57,7 @@ void Scafacos::settings(int narg, char **arg) int n = strlen(arg[0]) + 1; method = new char[n]; strcpy(method,arg[0]); - tolerance = force->numeric(FLERR,arg[1]); + tolerance = utils::numeric(FLERR,arg[1],false,lmp); // optional ScaFaCoS library setting defaults // choose the correct default tolerance type for chosen method diff --git a/src/USER-SDPD/fix_meso_move.cpp b/src/USER-SDPD/fix_meso_move.cpp index 6db2aaa478..c39d142a6e 100644 --- a/src/USER-SDPD/fix_meso_move.cpp +++ b/src/USER-SDPD/fix_meso_move.cpp @@ -74,17 +74,17 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[4],"NULL") == 0) vxflag = 0; else { vxflag = 1; - vx = force->numeric(FLERR,arg[4]); + vx = utils::numeric(FLERR,arg[4],false,lmp); } if (strcmp(arg[5],"NULL") == 0) vyflag = 0; else { vyflag = 1; - vy = force->numeric(FLERR,arg[5]); + vy = utils::numeric(FLERR,arg[5],false,lmp); } if (strcmp(arg[6],"NULL") == 0) vzflag = 0; else { vzflag = 1; - vz = force->numeric(FLERR,arg[6]); + vz = utils::numeric(FLERR,arg[6],false,lmp); } } else if (strcmp(arg[3],"wiggle") == 0) { @@ -94,32 +94,32 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[4],"NULL") == 0) axflag = 0; else { axflag = 1; - ax = force->numeric(FLERR,arg[4]); + ax = utils::numeric(FLERR,arg[4],false,lmp); } if (strcmp(arg[5],"NULL") == 0) ayflag = 0; else { ayflag = 1; - ay = force->numeric(FLERR,arg[5]); + ay = utils::numeric(FLERR,arg[5],false,lmp); } if (strcmp(arg[6],"NULL") == 0) azflag = 0; else { azflag = 1; - az = force->numeric(FLERR,arg[6]); + az = utils::numeric(FLERR,arg[6],false,lmp); } - period = force->numeric(FLERR,arg[7]); + period = utils::numeric(FLERR,arg[7],false,lmp); if (period <= 0.0) error->all(FLERR,"Illegal fix meso/move command"); } else if (strcmp(arg[3],"rotate") == 0) { if (narg < 11) error->all(FLERR,"Illegal fix meso/move command"); iarg = 11; mstyle = ROTATE; - point[0] = force->numeric(FLERR,arg[4]); - point[1] = force->numeric(FLERR,arg[5]); - point[2] = force->numeric(FLERR,arg[6]); - axis[0] = force->numeric(FLERR,arg[7]); - axis[1] = force->numeric(FLERR,arg[8]); - axis[2] = force->numeric(FLERR,arg[9]); - period = force->numeric(FLERR,arg[10]); + point[0] = utils::numeric(FLERR,arg[4],false,lmp); + point[1] = utils::numeric(FLERR,arg[5],false,lmp); + point[2] = utils::numeric(FLERR,arg[6],false,lmp); + axis[0] = utils::numeric(FLERR,arg[7],false,lmp); + axis[1] = utils::numeric(FLERR,arg[8],false,lmp); + axis[2] = utils::numeric(FLERR,arg[9],false,lmp); + period = utils::numeric(FLERR,arg[10],false,lmp); if (period <= 0.0) error->all(FLERR,"Illegal fix meso/move command"); } else if (strcmp(arg[3],"variable") == 0) { diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index b6f0c63546..bf2fc73b01 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -19,17 +19,19 @@ ------------------------------------------------------------------------- */ #include "pair_sdpd_taitwater_isothermal.h" -#include + #include "atom.h" -#include "force.h" #include "comm.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "memory.h" -#include "error.h" #include "domain.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" #include "update.h" + +#include + #ifndef USE_ZEST #include "random_mars.h" #endif @@ -242,15 +244,15 @@ void PairSDPDTaitwaterIsothermal::settings (int narg, char **arg) { error->all (FLERR, "Illegal number of arguments for " "pair_style sdpd/taitwater/isothermal"); - temperature = force->numeric (FLERR, arg[0]); - viscosity = force->numeric (FLERR, arg[1]); + temperature = utils::numeric(FLERR, arg[0], false, lmp); + viscosity = utils::numeric(FLERR, arg[1], false, lmp); if (temperature <= 0) error->all (FLERR, "Temperature must be positive"); if (viscosity <= 0) error->all (FLERR, "Viscosity must be positive"); // seed is immune to underflow/overflow because it is unsigned seed = comm->nprocs + comm->me + atom->nlocal; - if (narg == 3) seed += force->inumeric (FLERR, arg[2]); + if (narg == 3) seed += utils::inumeric(FLERR, arg[2], false, lmp); #ifdef USE_ZEST generator.seed (seed); #else @@ -270,12 +272,12 @@ void PairSDPDTaitwaterIsothermal::coeff (int narg, char **arg) { if (!allocated) allocate(); int ilo, ihi, jlo, jhi; - force->bounds (FLERR, arg[0], atom->ntypes, ilo, ihi); - force->bounds (FLERR, arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR, arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR, arg[1], 1, atom->ntypes, jlo, jhi, error); - double rho0_one = force->numeric (FLERR,arg[2]); - double soundspeed_one = force->numeric (FLERR,arg[3]); - double cut_one = force->numeric (FLERR,arg[4]); + double rho0_one = utils::numeric(FLERR,arg[2], false, lmp); + double soundspeed_one = utils::numeric(FLERR,arg[3], false, lmp); + double cut_one = utils::numeric(FLERR,arg[4], false, lmp); double B_one = soundspeed_one * soundspeed_one * rho0_one / 7.0; if (rho0_one <= 0) error->all (FLERR, "Density must be positive"); diff --git a/src/USER-SMD/atom_vec_smd.cpp b/src/USER-SMD/atom_vec_smd.cpp index 670783a3d7..81a43ff7f3 100644 --- a/src/USER-SMD/atom_vec_smd.cpp +++ b/src/USER-SMD/atom_vec_smd.cpp @@ -23,9 +23,10 @@ ------------------------------------------------------------------------- */ #include "atom_vec_smd.h" -#include + #include "atom.h" -#include "error.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp index 09aeeea74a..81792355e0 100644 --- a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp +++ b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp @@ -23,14 +23,16 @@ ------------------------------------------------------------------------- */ #include "compute_smd_tlsph_defgrad.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include +#include // IWYU pragma: export using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_tlsph_shape.cpp b/src/USER-SMD/compute_smd_tlsph_shape.cpp index ba1a9306ef..a3727871de 100644 --- a/src/USER-SMD/compute_smd_tlsph_shape.cpp +++ b/src/USER-SMD/compute_smd_tlsph_shape.cpp @@ -23,16 +23,18 @@ ------------------------------------------------------------------------- */ #include "compute_smd_tlsph_shape.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" #include "pair.h" +#include "update.h" + +#include +#include // IWYU pragma: export using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_tlsph_strain.cpp b/src/USER-SMD/compute_smd_tlsph_strain.cpp index f0061bf7a1..db51ca4125 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain.cpp @@ -24,16 +24,18 @@ ------------------------------------------------------------------------- */ #include "compute_smd_tlsph_strain.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" #include "pair.h" +#include "update.h" + +#include +#include // IWYU pragma: export using namespace Eigen; using namespace std; diff --git a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp index 895a973f6a..577dc0e40f 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp @@ -23,17 +23,19 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include #include "compute_smd_tlsph_strain_rate.h" + #include "atom.h" -#include "update.h" -#include "modify.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" +#include "modify.h" #include "pair.h" +#include "update.h" + +#include +#include // IWYU pragma: export using namespace Eigen; using namespace LAMMPS_NS; diff --git a/src/USER-SMD/compute_smd_vol.cpp b/src/USER-SMD/compute_smd_vol.cpp index eb1f144275..5999dfaa5d 100644 --- a/src/USER-SMD/compute_smd_vol.cpp +++ b/src/USER-SMD/compute_smd_vol.cpp @@ -23,7 +23,7 @@ ------------------------------------------------------------------------- */ #include "compute_smd_vol.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/USER-SMD/fix_smd_adjust_dt.cpp b/src/USER-SMD/fix_smd_adjust_dt.cpp index ab6dd5ef5c..b5dab3d3a1 100644 --- a/src/USER-SMD/fix_smd_adjust_dt.cpp +++ b/src/USER-SMD/fix_smd_adjust_dt.cpp @@ -23,8 +23,8 @@ ------------------------------------------------------------------------- */ #include "fix_smd_adjust_dt.h" -#include -#include + + #include "update.h" #include "force.h" #include "pair.h" diff --git a/src/USER-SMD/fix_smd_integrate_tlsph.cpp b/src/USER-SMD/fix_smd_integrate_tlsph.cpp index ed039d39d4..7d5e89f895 100644 --- a/src/USER-SMD/fix_smd_integrate_tlsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_tlsph.cpp @@ -74,7 +74,7 @@ FixSMDIntegrateTlsph::FixSMDIntegrateTlsph(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "expected number following limit_velocity"); } - vlimit = force->numeric(FLERR, arg[iarg]); + vlimit = utils::numeric(FLERR, arg[iarg],false,lmp); if (comm->me == 0) { printf("... will limit velocities to <= %g\n", vlimit); } diff --git a/src/USER-SMD/fix_smd_integrate_ulsph.cpp b/src/USER-SMD/fix_smd_integrate_ulsph.cpp index 4978416e66..215759331e 100644 --- a/src/USER-SMD/fix_smd_integrate_ulsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_ulsph.cpp @@ -77,21 +77,21 @@ FixSMDIntegrateUlsph::FixSMDIntegrateUlsph(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "expected three numbers following adjust_radius: factor, min, max"); } - adjust_radius_factor = force->numeric(FLERR, arg[iarg]); + adjust_radius_factor = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected three numbers following adjust_radius: factor, min, max"); } - min_nn = force->inumeric(FLERR, arg[iarg]); + min_nn = utils::inumeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected three numbers following adjust_radius: factor, min, max"); } - max_nn = force->inumeric(FLERR, arg[iarg]); + max_nn = utils::inumeric(FLERR, arg[iarg],false,lmp); if (comm->me == 0) { printf("... will adjust smoothing length dynamically with factor %g to achieve %d to %d neighbors per particle.\n ", @@ -103,7 +103,7 @@ FixSMDIntegrateUlsph::FixSMDIntegrateUlsph(LAMMPS *lmp, int narg, char **arg) : if (iarg == narg) { error->all(FLERR, "expected number following limit_velocity"); } - vlimit = force->numeric(FLERR, arg[iarg]); + vlimit = utils::numeric(FLERR, arg[iarg],false,lmp); if (comm->me == 0) { printf("... will limit velocities to <= %g\n", vlimit); diff --git a/src/USER-SMD/fix_smd_move_triangulated_surface.cpp b/src/USER-SMD/fix_smd_move_triangulated_surface.cpp index cbaad9ac4c..e0e76a18fb 100644 --- a/src/USER-SMD/fix_smd_move_triangulated_surface.cpp +++ b/src/USER-SMD/fix_smd_move_triangulated_surface.cpp @@ -23,15 +23,16 @@ ------------------------------------------------------------------------- */ #include "fix_smd_move_triangulated_surface.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "math_const.h" +#include "update.h" + #include #include #include -#include "atom.h" -#include "comm.h" -#include "force.h" -#include "update.h" -#include "error.h" -#include "math_const.h" using namespace Eigen; using namespace LAMMPS_NS; @@ -77,19 +78,19 @@ FixSMDMoveTriSurf::FixSMDMoveTriSurf(LAMMPS *lmp, int narg, char **arg) : if (iarg == narg) { error->all(FLERR, "expected three floats for velocity following *LINEAR"); } - vx = force->numeric(FLERR, arg[iarg]); + vx = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected three floats for velocity following *LINEAR"); } - vy = force->numeric(FLERR, arg[iarg]); + vy = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected three floats for velocity following *LINEAR"); } - vz = force->numeric(FLERR, arg[iarg]); + vz = utils::numeric(FLERR, arg[iarg],false,lmp); } else if (strcmp(arg[iarg], "*WIGGLE") == 0) { wiggleFlag = true; @@ -101,25 +102,25 @@ FixSMDMoveTriSurf::FixSMDMoveTriSurf(LAMMPS *lmp, int narg, char **arg) : if (iarg == narg) { error->all(FLERR, "expected 4 floats following *WIGGLE : vx vy vz max_travel"); } - vx = force->numeric(FLERR, arg[iarg]); + vx = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 4 floats following *WIGGLE : vx vy vz max_travel"); } - vy = force->numeric(FLERR, arg[iarg]); + vy = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 4 floats following *WIGGLE : vx vy vz max_travel"); } - vz = force->numeric(FLERR, arg[iarg]); + vz = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 4 floats following *WIGGLE : vx vy vz max_travel"); } - wiggle_max_travel = force->numeric(FLERR, arg[iarg]); + wiggle_max_travel = utils::numeric(FLERR, arg[iarg],false,lmp); } else if (strcmp(arg[iarg], "*ROTATE") == 0) { rotateFlag = true; @@ -128,43 +129,43 @@ FixSMDMoveTriSurf::FixSMDMoveTriSurf(LAMMPS *lmp, int narg, char **arg) : if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - origin(0) = force->numeric(FLERR, arg[iarg]); + origin(0) = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - origin(1) = force->numeric(FLERR, arg[iarg]); + origin(1) = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - origin(2) = force->numeric(FLERR, arg[iarg]); + origin(2) = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - rotation_axis(0) = force->numeric(FLERR, arg[iarg]); + rotation_axis(0) = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - rotation_axis(1) = force->numeric(FLERR, arg[iarg]); + rotation_axis(1) = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - rotation_axis(2) = force->numeric(FLERR, arg[iarg]); + rotation_axis(2) = utils::numeric(FLERR, arg[iarg],false,lmp); iarg++; if (iarg == narg) { error->all(FLERR, "expected 7 floats following *ROTATE: origin, rotation axis, and rotation period"); } - rotation_period = force->numeric(FLERR, arg[iarg]); + rotation_period = utils::numeric(FLERR, arg[iarg],false,lmp); /* * construct rotation matrix diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index 2964ded544..d3e71f0e50 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -24,18 +24,18 @@ ------------------------------------------------------------------------- */ #include "fix_smd_setvel.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "domain.h" -#include "region.h" -#include "input.h" -#include "variable.h" -#include "memory.h" #include "error.h" -#include "force.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "region.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -66,7 +66,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3], "NULL") == 0) { xstyle = NONE; } else { - xvalue = force->numeric(FLERR, arg[3]); + xvalue = utils::numeric(FLERR, arg[3],false,lmp); xstyle = CONSTANT; } if (strstr(arg[4], "v_") == arg[4]) { @@ -76,7 +76,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4], "NULL") == 0) { ystyle = NONE; } else { - yvalue = force->numeric(FLERR, arg[4]); + yvalue = utils::numeric(FLERR, arg[4],false,lmp); ystyle = CONSTANT; } if (strstr(arg[5], "v_") == arg[5]) { @@ -86,7 +86,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[5], "NULL") == 0) { zstyle = NONE; } else { - zvalue = force->numeric(FLERR, arg[5]); + zvalue = utils::numeric(FLERR, arg[5],false,lmp); zstyle = CONSTANT; } diff --git a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp index 4ade21a6fd..3e63de08f3 100644 --- a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp +++ b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp @@ -25,7 +25,7 @@ ------------------------------------------------------------------------- */ #include "fix_smd_tlsph_reference_configuration.h" -#include + #include #include "atom.h" #include "comm.h" diff --git a/src/USER-SMD/fix_smd_wall_surface.cpp b/src/USER-SMD/fix_smd_wall_surface.cpp index 9183bcd9ea..10f248c39f 100644 --- a/src/USER-SMD/fix_smd_wall_surface.cpp +++ b/src/USER-SMD/fix_smd_wall_surface.cpp @@ -16,17 +16,16 @@ ------------------------------------------------------------------------- */ #include "fix_smd_wall_surface.h" -#include -#include -#include -#include + #include "atom.h" -#include "domain.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" #include "atom_vec.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "memory.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -51,8 +50,8 @@ FixSMDWallSurface::FixSMDWallSurface(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal number of arguments for fix smd/wall_surface"); filename = strdup(arg[3]); - wall_particle_type = force->inumeric(FLERR, arg[4]); - wall_molecule_id = force->inumeric(FLERR, arg[5]); + wall_particle_type = utils::inumeric(FLERR,arg[4],false,lmp); + wall_molecule_id = utils::inumeric(FLERR,arg[5],false,lmp); if (wall_molecule_id < 65535) { error->one(FLERR, "wall molcule id must be >= 65535\n"); } @@ -310,7 +309,9 @@ void FixSMDWallSurface::read_triangles(int pass) { error->all(FLERR, "Incorrect atom format in data file"); } - normal << force->numeric(FLERR, values[2]), force->numeric(FLERR, values[3]), force->numeric(FLERR, values[4]); + normal << utils::numeric(FLERR, values[2], false, lmp), + utils::numeric(FLERR, values[3], false, lmp), + utils::numeric(FLERR, values[4], false, lmp); //cout << "normal is " << normal << endl; delete[] values; @@ -349,7 +350,9 @@ void FixSMDWallSurface::read_triangles(int pass) { error->all(FLERR, "Incorrect vertex line"); } - vert[k] << force->numeric(FLERR, values[1]), force->numeric(FLERR, values[2]), force->numeric(FLERR, values[3]); + vert[k] << utils::numeric(FLERR, values[1], false, lmp), + utils::numeric(FLERR, values[2], false, lmp), + utils::numeric(FLERR, values[3], false, lmp); //cout << "vertex is " << vert[k] << endl; //printf("%s %s %s\n", values[1], values[2], values[3]); delete[] values; diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index 97be94d833..8d3c06d5e6 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -27,9 +27,9 @@ ------------------------------------------------------------------------- */ #include "pair_smd_hertz.h" -#include + #include -#include + #include #include "atom.h" #include "domain.h" @@ -41,6 +41,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; #define SQRT2 1.414213562e0 @@ -239,7 +240,7 @@ void PairHertz::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR, "Illegal number of args for pair_style hertz"); - scale = force->numeric(FLERR, arg[0]); + scale = utils::numeric(FLERR, arg[0],false,lmp); if (comm->me == 0) { printf("\n>>========>>========>>========>>========>>========>>========>>========>>========\n"); printf("SMD/HERTZ CONTACT SETTINGS:\n"); @@ -260,8 +261,8 @@ void PairHertz::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); double bulkmodulus_one = atof(arg[2]); diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index c932086a32..25301685a7 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -23,10 +23,10 @@ ------------------------------------------------------------------------- */ #include "pair_smd_tlsph.h" -#include + #include #include -#include + #include #include #include "fix_smd_tlsph_reference_configuration.h" @@ -935,7 +935,7 @@ void PairTlsph::settings(int narg, char **arg) { } update_method = UPDATE_CONSTANT_THRESHOLD; - update_threshold = force->numeric(FLERR, arg[iarg]); + update_threshold = utils::numeric(FLERR, arg[iarg],false,lmp); } else if (strcmp(arg[iarg], "*UPDATE_PAIRWISE") == 0) { iarg++; @@ -944,7 +944,7 @@ void PairTlsph::settings(int narg, char **arg) { } update_method = UPDATE_PAIRWISE_RATIO; - update_threshold = force->numeric(FLERR, arg[iarg]); + update_threshold = utils::numeric(FLERR, arg[iarg],false,lmp); } else { char msg[128]; @@ -1002,11 +1002,11 @@ void PairTlsph::coeff(int narg, char **arg) { /* * check that TLSPH parameters are given only in i,i form */ - if (force->inumeric(FLERR, arg[0]) != force->inumeric(FLERR, arg[1])) { + if (utils::inumeric(FLERR, arg[0], false, lmp) != utils::inumeric(FLERR, arg[1], false, lmp)) { sprintf(str, "TLSPH coefficients can only be specified between particles of same type!"); error->all(FLERR, str); } - itype = force->inumeric(FLERR, arg[0]); + itype = utils::inumeric(FLERR, arg[0],false,lmp); // set all eos, strength and failure models to inactive by default eos[itype] = EOS_NONE; @@ -1050,13 +1050,13 @@ void PairTlsph::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[REFERENCE_DENSITY][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[YOUNGS_MODULUS][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Lookup[POISSON_RATIO][itype] = force->numeric(FLERR, arg[ioffset + 3]); - Lookup[VISCOSITY_Q1][itype] = force->numeric(FLERR, arg[ioffset + 4]); - Lookup[VISCOSITY_Q2][itype] = force->numeric(FLERR, arg[ioffset + 5]); - Lookup[HOURGLASS_CONTROL_AMPLITUDE][itype] = force->numeric(FLERR, arg[ioffset + 6]); - Lookup[HEAT_CAPACITY][itype] = force->numeric(FLERR, arg[ioffset + 7]); + Lookup[REFERENCE_DENSITY][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[YOUNGS_MODULUS][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Lookup[POISSON_RATIO][itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); + Lookup[VISCOSITY_Q1][itype] = utils::numeric(FLERR, arg[ioffset + 4],false,lmp); + Lookup[VISCOSITY_Q2][itype] = utils::numeric(FLERR, arg[ioffset + 5],false,lmp); + Lookup[HOURGLASS_CONTROL_AMPLITUDE][itype] = utils::numeric(FLERR, arg[ioffset + 6],false,lmp); + Lookup[HEAT_CAPACITY][itype] = utils::numeric(FLERR, arg[ioffset + 7],false,lmp); Lookup[LAME_LAMBDA][itype] = Lookup[YOUNGS_MODULUS][itype] * Lookup[POISSON_RATIO][itype] / ((1.0 + Lookup[POISSON_RATIO][itype]) * (1.0 - 2.0 * Lookup[POISSON_RATIO][itype])); @@ -1201,8 +1201,8 @@ void PairTlsph::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[YIELD_STRESS][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[HARDENING_PARAMETER][itype] = force->numeric(FLERR, arg[ioffset + 2]); + Lookup[YIELD_STRESS][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[HARDENING_PARAMETER][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); if (comm->me == 0) { printf("%60s\n", "Linear elastic / perfectly plastic strength based on strain rate"); @@ -1245,14 +1245,14 @@ void PairTlsph::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[JC_A][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[JC_B][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Lookup[JC_a][itype] = force->numeric(FLERR, arg[ioffset + 3]); - Lookup[JC_C][itype] = force->numeric(FLERR, arg[ioffset + 4]); - Lookup[JC_epdot0][itype] = force->numeric(FLERR, arg[ioffset + 5]); - Lookup[JC_T0][itype] = force->numeric(FLERR, arg[ioffset + 6]); - Lookup[JC_Tmelt][itype] = force->numeric(FLERR, arg[ioffset + 7]); - Lookup[JC_M][itype] = force->numeric(FLERR, arg[ioffset + 8]); + Lookup[JC_A][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[JC_B][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Lookup[JC_a][itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); + Lookup[JC_C][itype] = utils::numeric(FLERR, arg[ioffset + 4],false,lmp); + Lookup[JC_epdot0][itype] = utils::numeric(FLERR, arg[ioffset + 5],false,lmp); + Lookup[JC_T0][itype] = utils::numeric(FLERR, arg[ioffset + 6],false,lmp); + Lookup[JC_Tmelt][itype] = utils::numeric(FLERR, arg[ioffset + 7],false,lmp); + Lookup[JC_M][itype] = utils::numeric(FLERR, arg[ioffset + 8],false,lmp); if (comm->me == 0) { printf("%60s\n", "Johnson Cook material strength model"); @@ -1370,9 +1370,9 @@ void PairTlsph::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[EOS_SHOCK_C0][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[EOS_SHOCK_S][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Lookup[EOS_SHOCK_GAMMA][itype] = force->numeric(FLERR, arg[ioffset + 3]); + Lookup[EOS_SHOCK_C0][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[EOS_SHOCK_S][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Lookup[EOS_SHOCK_GAMMA][itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "shock EOS based on strain rate"); printf("%60s : %g\n", "reference speed of sound", Lookup[EOS_SHOCK_C0][itype]); @@ -1411,13 +1411,13 @@ void PairTlsph::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[EOS_POLYNOMIAL_C0][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[EOS_POLYNOMIAL_C1][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Lookup[EOS_POLYNOMIAL_C2][itype] = force->numeric(FLERR, arg[ioffset + 3]); - Lookup[EOS_POLYNOMIAL_C3][itype] = force->numeric(FLERR, arg[ioffset + 4]); - Lookup[EOS_POLYNOMIAL_C4][itype] = force->numeric(FLERR, arg[ioffset + 5]); - Lookup[EOS_POLYNOMIAL_C5][itype] = force->numeric(FLERR, arg[ioffset + 6]); - Lookup[EOS_POLYNOMIAL_C6][itype] = force->numeric(FLERR, arg[ioffset + 7]); + Lookup[EOS_POLYNOMIAL_C0][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[EOS_POLYNOMIAL_C1][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Lookup[EOS_POLYNOMIAL_C2][itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); + Lookup[EOS_POLYNOMIAL_C3][itype] = utils::numeric(FLERR, arg[ioffset + 4],false,lmp); + Lookup[EOS_POLYNOMIAL_C4][itype] = utils::numeric(FLERR, arg[ioffset + 5],false,lmp); + Lookup[EOS_POLYNOMIAL_C5][itype] = utils::numeric(FLERR, arg[ioffset + 6],false,lmp); + Lookup[EOS_POLYNOMIAL_C6][itype] = utils::numeric(FLERR, arg[ioffset + 7],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "polynomial EOS based on strain rate"); printf("%60s : %g\n", "parameter c0", Lookup[EOS_POLYNOMIAL_C0][itype]); @@ -1462,7 +1462,7 @@ void PairTlsph::coeff(int narg, char **arg) { failureModel[itype].failure_max_plastic_strain = true; failureModel[itype].integration_point_wise = true; - Lookup[FAILURE_MAX_PLASTIC_STRAIN_THRESHOLD][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[FAILURE_MAX_PLASTIC_STRAIN_THRESHOLD][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "maximum plastic strain failure criterion"); @@ -1506,7 +1506,7 @@ void PairTlsph::coeff(int narg, char **arg) { failureModel[itype].failure_max_pairwise_strain = true; failureModel[itype].integration_point_wise = true; - Lookup[FAILURE_MAX_PAIRWISE_STRAIN_THRESHOLD][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[FAILURE_MAX_PAIRWISE_STRAIN_THRESHOLD][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "maximum pairwise strain failure criterion"); @@ -1546,7 +1546,7 @@ void PairTlsph::coeff(int narg, char **arg) { failureModel[itype].failure_max_principal_strain = true; failureModel[itype].integration_point_wise = true; - Lookup[FAILURE_MAX_PRINCIPAL_STRAIN_THRESHOLD][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[FAILURE_MAX_PRINCIPAL_STRAIN_THRESHOLD][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "maximum principal strain failure criterion"); @@ -1583,11 +1583,11 @@ void PairTlsph::coeff(int narg, char **arg) { failureModel[itype].failure_johnson_cook = true; failureModel[itype].integration_point_wise = true; - Lookup[FAILURE_JC_D1][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[FAILURE_JC_D2][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Lookup[FAILURE_JC_D3][itype] = force->numeric(FLERR, arg[ioffset + 3]); - Lookup[FAILURE_JC_D4][itype] = force->numeric(FLERR, arg[ioffset + 4]); - Lookup[FAILURE_JC_EPDOT0][itype] = force->numeric(FLERR, arg[ioffset + 5]); + Lookup[FAILURE_JC_D1][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[FAILURE_JC_D2][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Lookup[FAILURE_JC_D3][itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); + Lookup[FAILURE_JC_D4][itype] = utils::numeric(FLERR, arg[ioffset + 4],false,lmp); + Lookup[FAILURE_JC_EPDOT0][itype] = utils::numeric(FLERR, arg[ioffset + 5],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "Johnson-Cook failure criterion"); @@ -1631,7 +1631,7 @@ void PairTlsph::coeff(int narg, char **arg) { failureModel[itype].failure_max_principal_stress = true; failureModel[itype].integration_point_wise = true; - Lookup[FAILURE_MAX_PRINCIPAL_STRESS_THRESHOLD][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[FAILURE_MAX_PRINCIPAL_STRESS_THRESHOLD][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "maximum principal stress failure criterion"); @@ -1666,7 +1666,7 @@ void PairTlsph::coeff(int narg, char **arg) { } failureModel[itype].failure_energy_release_rate = true; - Lookup[CRITICAL_ENERGY_RELEASE_RATE][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[CRITICAL_ENERGY_RELEASE_RATE][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf("\n%60s\n", "critical energy release rate failure criterion"); diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index 53a93df7f7..8ccba562e2 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -27,9 +27,9 @@ ------------------------------------------------------------------------- */ #include "pair_smd_triangulated_surface.h" -#include + #include -#include + #include #include #include "atom.h" @@ -42,6 +42,7 @@ #include "memory.h" #include "error.h" + using namespace std; using namespace LAMMPS_NS; using namespace Eigen; @@ -321,7 +322,7 @@ void PairTriSurf::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR, "Illegal number of args for pair_style smd/tri_surface"); - scale = force->numeric(FLERR, arg[0]); + scale = utils::numeric(FLERR, arg[0],false,lmp); if (comm->me == 0) { printf("\n>>========>>========>>========>>========>>========>>========>>========>>========\n"); printf("SMD/TRI_SURFACE CONTACT SETTINGS:\n"); @@ -342,8 +343,8 @@ void PairTriSurf::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1,atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1,atom->ntypes, jlo, jhi, error); double bulkmodulus_one = atof(arg[2]); diff --git a/src/USER-SMD/pair_smd_ulsph.cpp b/src/USER-SMD/pair_smd_ulsph.cpp index 8c8da7b2bc..3a6cdf5d2f 100644 --- a/src/USER-SMD/pair_smd_ulsph.cpp +++ b/src/USER-SMD/pair_smd_ulsph.cpp @@ -23,24 +23,22 @@ ------------------------------------------------------------------------- */ #include "pair_smd_ulsph.h" -#include -#include -#include -#include -#include + #include "atom.h" -#include "domain.h" -#include "force.h" -#include "update.h" #include "comm.h" -#include "neighbor.h" +#include "domain.h" +#include "error.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" +#include "neighbor.h" +#include "smd_kernels.h" #include "smd_material_models.h" #include "smd_math.h" -#include "smd_kernels.h" +#include "update.h" + +#include +#include using namespace SMD_Kernels; using namespace std; @@ -949,9 +947,9 @@ void PairULSPH::coeff(int narg, char **arg) { * if parameters are give in i,i form, i.e., no a cross interaction, set material parameters */ - if (force->inumeric(FLERR, arg[0]) == force->inumeric(FLERR, arg[1])) { + if (utils::inumeric(FLERR, arg[0], false, lmp) == utils::inumeric(FLERR, arg[1], false, lmp)) { - itype = force->inumeric(FLERR, arg[0]); + itype = utils::inumeric(FLERR, arg[0],false,lmp); eos[itype] = viscosity[itype] = strength[itype] = NONE; if (comm->me == 0) { @@ -992,11 +990,11 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[REFERENCE_DENSITY][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[REFERENCE_SOUNDSPEED][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Q1[itype] = force->numeric(FLERR, arg[ioffset + 3]); - Lookup[HEAT_CAPACITY][itype] = force->numeric(FLERR, arg[ioffset + 4]); - Lookup[HOURGLASS_CONTROL_AMPLITUDE][itype] = force->numeric(FLERR, arg[ioffset + 5]); + Lookup[REFERENCE_DENSITY][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[REFERENCE_SOUNDSPEED][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Q1[itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); + Lookup[HEAT_CAPACITY][itype] = utils::numeric(FLERR, arg[ioffset + 4],false,lmp); + Lookup[HOURGLASS_CONTROL_AMPLITUDE][itype] = utils::numeric(FLERR, arg[ioffset + 5],false,lmp); Lookup[BULK_MODULUS][itype] = Lookup[REFERENCE_SOUNDSPEED][itype] * Lookup[REFERENCE_SOUNDSPEED][itype] * Lookup[REFERENCE_DENSITY][itype]; @@ -1057,7 +1055,7 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[EOS_TAIT_EXPONENT][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[EOS_TAIT_EXPONENT][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf(FORMAT2, "Tait EOS"); @@ -1094,7 +1092,7 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[EOS_PERFECT_GAS_GAMMA][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[EOS_PERFECT_GAS_GAMMA][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf(FORMAT2, "Perfect Gas EOS"); @@ -1168,9 +1166,9 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[SHEAR_MODULUS][itype] = force->numeric(FLERR, arg[ioffset + 1]); - Lookup[YIELD_STRENGTH][itype] = force->numeric(FLERR, arg[ioffset + 2]); - Lookup[HARDENING_PARAMETER][itype] = force->numeric(FLERR, arg[ioffset + 3]); + Lookup[SHEAR_MODULUS][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); + Lookup[YIELD_STRENGTH][itype] = utils::numeric(FLERR, arg[ioffset + 2],false,lmp); + Lookup[HARDENING_PARAMETER][itype] = utils::numeric(FLERR, arg[ioffset + 3],false,lmp); if (comm->me == 0) { printf(FORMAT2, "linear elastic / ideal plastic material mode"); @@ -1210,7 +1208,7 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[SHEAR_MODULUS][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[SHEAR_MODULUS][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf(FORMAT2, "linear elastic strength model"); @@ -1248,7 +1246,7 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - Lookup[VISCOSITY_MU][itype] = force->numeric(FLERR, arg[ioffset + 1]); + Lookup[VISCOSITY_MU][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf(FORMAT2, "Newton viscosity model"); @@ -1282,7 +1280,7 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - artificial_pressure[itype][itype] = force->numeric(FLERR, arg[ioffset + 1]); + artificial_pressure[itype][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf(FORMAT2, "Artificial Pressure is enabled."); @@ -1316,7 +1314,7 @@ void PairULSPH::coeff(int narg, char **arg) { error->all(FLERR, str); } - artificial_stress[itype][itype] = force->numeric(FLERR, arg[ioffset + 1]); + artificial_stress[itype][itype] = utils::numeric(FLERR, arg[ioffset + 1],false,lmp); if (comm->me == 0) { printf(FORMAT2, "Artificial Stress is enabled."); @@ -1358,8 +1356,8 @@ void PairULSPH::coeff(int narg, char **arg) { * we are reading a cross-interaction line for particle types i, j */ - itype = force->inumeric(FLERR, arg[0]); - jtype = force->inumeric(FLERR, arg[1]); + itype = utils::inumeric(FLERR, arg[0],false,lmp); + jtype = utils::inumeric(FLERR, arg[1],false,lmp); if (strcmp(arg[2], "*CROSS") != 0) { sprintf(str, "ulsph cross interaction between particle type %d and %d requested, however, *CROSS keyword is missing", diff --git a/src/USER-SMD/smd_material_models.cpp b/src/USER-SMD/smd_material_models.cpp index 096600df52..942b6a8cab 100644 --- a/src/USER-SMD/smd_material_models.cpp +++ b/src/USER-SMD/smd_material_models.cpp @@ -22,12 +22,13 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #include "smd_material_models.h" + +#include "math_special.h" + #include #include -#include #include #include -#include "math_special.h" #include diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index fcf6d141f2..875d254ac9 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -39,9 +39,9 @@ ------------------------------------------------------------------------- */ #include "pair_smtbq.h" -#include + #include -#include + #include #include #include @@ -410,7 +410,7 @@ void PairSMTBQ::read_file(char *file) // open file on all processors FILE *fp; - fp = force->open_potential(file); + fp = utils::open_potential(file,lmp,nullptr); if ( fp == NULL ) { char str[128]; snprintf(str,128,"Cannot open SMTBQ potential file %s",file); diff --git a/src/USER-SPH/atom_vec_sph.cpp b/src/USER-SPH/atom_vec_sph.cpp index 2811c57e6c..93ca2b60a7 100644 --- a/src/USER-SPH/atom_vec_sph.cpp +++ b/src/USER-SPH/atom_vec_sph.cpp @@ -12,9 +12,10 @@ ------------------------------------------------------------------------- */ #include "atom_vec_sph.h" -#include + #include "atom.h" -#include "error.h" + +#include using namespace LAMMPS_NS; diff --git a/src/USER-SPH/pair_sph_heatconduction.cpp b/src/USER-SPH/pair_sph_heatconduction.cpp index ebd2cef684..fb8c928f2d 100644 --- a/src/USER-SPH/pair_sph_heatconduction.cpp +++ b/src/USER-SPH/pair_sph_heatconduction.cpp @@ -20,6 +20,7 @@ #include "neigh_list.h" #include "domain.h" + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -167,11 +168,11 @@ void PairSPHHeatConduction::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double alpha_one = force->numeric(FLERR,arg[2]); - double cut_one = force->numeric(FLERR,arg[3]); + double alpha_one = utils::numeric(FLERR,arg[2],false,lmp); + double cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-SPH/pair_sph_idealgas.cpp b/src/USER-SPH/pair_sph_idealgas.cpp index 1f6b63e199..5480ff8e4c 100644 --- a/src/USER-SPH/pair_sph_idealgas.cpp +++ b/src/USER-SPH/pair_sph_idealgas.cpp @@ -20,6 +20,7 @@ #include "error.h" #include "domain.h" + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -209,11 +210,11 @@ void PairSPHIdealGas::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double viscosity_one = force->numeric(FLERR,arg[2]); - double cut_one = force->numeric(FLERR,arg[3]); + double viscosity_one = utils::numeric(FLERR,arg[2],false,lmp); + double cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-SPH/pair_sph_lj.cpp b/src/USER-SPH/pair_sph_lj.cpp index ae42c413e7..eb76d800c8 100644 --- a/src/USER-SPH/pair_sph_lj.cpp +++ b/src/USER-SPH/pair_sph_lj.cpp @@ -20,6 +20,7 @@ #include "error.h" #include "domain.h" + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -217,11 +218,11 @@ void PairSPHLJ::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double viscosity_one = force->numeric(FLERR,arg[2]); - double cut_one = force->numeric(FLERR,arg[3]); + double viscosity_one = utils::numeric(FLERR,arg[2],false,lmp); + double cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-SPH/pair_sph_rhosum.cpp b/src/USER-SPH/pair_sph_rhosum.cpp index fa51dc3781..3d3065f839 100644 --- a/src/USER-SPH/pair_sph_rhosum.cpp +++ b/src/USER-SPH/pair_sph_rhosum.cpp @@ -12,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "pair_sph_rhosum.h" + #include "atom.h" -#include "force.h" #include "comm.h" +#include "domain.h" +#include "error.h" +#include "memory.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" #include "neighbor.h" #include "update.h" -#include "domain.h" using namespace LAMMPS_NS; @@ -224,7 +224,7 @@ void PairSPHRhoSum::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR, "Illegal number of arguments for pair_style sph/rhosum"); - nstep = force->inumeric(FLERR,arg[0]); + nstep = utils::inumeric(FLERR,arg[0],false,lmp); } /* ---------------------------------------------------------------------- @@ -238,10 +238,10 @@ void PairSPHRhoSum::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double cut_one = force->numeric(FLERR,arg[2]); + double cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-SPH/pair_sph_taitwater.cpp b/src/USER-SPH/pair_sph_taitwater.cpp index 79d9ac7742..c0051201d0 100644 --- a/src/USER-SPH/pair_sph_taitwater.cpp +++ b/src/USER-SPH/pair_sph_taitwater.cpp @@ -21,6 +21,7 @@ #include "error.h" #include "domain.h" + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -239,13 +240,13 @@ void PairSPHTaitwater::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double rho0_one = force->numeric(FLERR,arg[2]); - double soundspeed_one = force->numeric(FLERR,arg[3]); - double viscosity_one = force->numeric(FLERR,arg[4]); - double cut_one = force->numeric(FLERR,arg[5]); + double rho0_one = utils::numeric(FLERR,arg[2],false,lmp); + double soundspeed_one = utils::numeric(FLERR,arg[3],false,lmp); + double viscosity_one = utils::numeric(FLERR,arg[4],false,lmp); + double cut_one = utils::numeric(FLERR,arg[5],false,lmp); double B_one = soundspeed_one * soundspeed_one * rho0_one / 7.0; int count = 0; diff --git a/src/USER-SPH/pair_sph_taitwater_morris.cpp b/src/USER-SPH/pair_sph_taitwater_morris.cpp index 862d2a8053..497aea293b 100644 --- a/src/USER-SPH/pair_sph_taitwater_morris.cpp +++ b/src/USER-SPH/pair_sph_taitwater_morris.cpp @@ -21,6 +21,7 @@ #include "error.h" #include "domain.h" + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -240,13 +241,13 @@ void PairSPHTaitwaterMorris::coeff(int narg, char **arg) { allocate(); int ilo, ihi, jlo, jhi; - force->bounds(FLERR,arg[0], atom->ntypes, ilo, ihi); - force->bounds(FLERR,arg[1], atom->ntypes, jlo, jhi); + utils::bounds(FLERR,arg[0], 1, atom->ntypes, ilo, ihi, error); + utils::bounds(FLERR,arg[1], 1, atom->ntypes, jlo, jhi, error); - double rho0_one = force->numeric(FLERR,arg[2]); - double soundspeed_one = force->numeric(FLERR,arg[3]); - double viscosity_one = force->numeric(FLERR,arg[4]); - double cut_one = force->numeric(FLERR,arg[5]); + double rho0_one = utils::numeric(FLERR,arg[2],false,lmp); + double soundspeed_one = utils::numeric(FLERR,arg[3],false,lmp); + double viscosity_one = utils::numeric(FLERR,arg[4],false,lmp); + double cut_one = utils::numeric(FLERR,arg[5],false,lmp); double B_one = soundspeed_one * soundspeed_one * rho0_one / 7.0; int count = 0; diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index 9d15fbc441..d010b004d5 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_force_tally.h" -#include + #include #include "atom.h" #include "group.h" diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 350bc4b4b6..1a2dd36285 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_heat_flux_tally.h" -#include + #include "atom.h" #include "group.h" #include "pair.h" diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index ce647a04c3..835d1e80bd 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_pe_mol_tally.h" -#include + #include "atom.h" #include "group.h" #include "pair.h" diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index edfa49b1b1..ef7c13fed2 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_pe_tally.h" -#include + #include "atom.h" #include "group.h" #include "pair.h" diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index 1ea096e286..2a0cbc8e4b 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_stress_tally.h" -#include + #include "atom.h" #include "group.h" #include "pair.h" diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index 80866bbd56..f910caac59 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -82,14 +82,14 @@ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : while (iarg narg) error->all(FLERR,"Illegal fix nvt/npt/uef command"); - erate[0] = force->numeric(FLERR,arg[iarg+1]); - erate[1] = force->numeric(FLERR,arg[iarg+2]); + erate[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + erate[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); erate_flag = true; iarg += 3; } else if (strcmp(arg[iarg],"strain")==0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix nvt/npt/uef command"); - strain[0] = force->numeric(FLERR,arg[iarg+1]); - strain[1] = force->numeric(FLERR,arg[iarg+2]); + strain[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + strain[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"ext")==0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/uef command"); diff --git a/src/USER-VTK/dump_vtk.cpp b/src/USER-VTK/dump_vtk.cpp index 7f1443c654..59dba0d90d 100644 --- a/src/USER-VTK/dump_vtk.cpp +++ b/src/USER-VTK/dump_vtk.cpp @@ -23,7 +23,7 @@ ------------------------------------------------------------------------- */ #include -#include + #include #include "dump_vtk.h" #include "atom.h" @@ -2296,7 +2296,7 @@ int DumpVTK::modify_param(int narg, char **arg) // set threshold value - thresh_value[nthresh] = force->numeric(FLERR,arg[3]); + thresh_value[nthresh] = utils::numeric(FLERR,arg[3],false,lmp); nthresh++; return 4; diff --git a/src/USER-VTK/dump_vtk.h b/src/USER-VTK/dump_vtk.h index e8de87f11c..b9db1f88cb 100644 --- a/src/USER-VTK/dump_vtk.h +++ b/src/USER-VTK/dump_vtk.h @@ -27,7 +27,7 @@ DumpStyle(vtk,DumpVTK) #include "dump_custom.h" #include #include -#include + #include #include diff --git a/src/USER-YAFF/angle_cross.cpp b/src/USER-YAFF/angle_cross.cpp index 3d5715c23e..c45af1d198 100644 --- a/src/USER-YAFF/angle_cross.cpp +++ b/src/USER-YAFF/angle_cross.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_cross.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -223,16 +223,16 @@ void AngleCross::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; - double kss_one = force->numeric(FLERR,arg[1]); - double kbs0_one = force->numeric(FLERR,arg[2]); - double kbs1_one = force->numeric(FLERR,arg[3]); - double r0_one = force->numeric(FLERR,arg[4]); - double r1_one = force->numeric(FLERR,arg[5]); - double theta0_one = force->numeric(FLERR,arg[6]); + double kss_one = utils::numeric(FLERR,arg[1],false,lmp); + double kbs0_one = utils::numeric(FLERR,arg[2],false,lmp); + double kbs1_one = utils::numeric(FLERR,arg[3],false,lmp); + double r0_one = utils::numeric(FLERR,arg[4],false,lmp); + double r1_one = utils::numeric(FLERR,arg[5],false,lmp); + double theta0_one = utils::numeric(FLERR,arg[6],false,lmp); for (int i = ilo; i <= ihi; i++) { kss[i] = kss_one; diff --git a/src/USER-YAFF/angle_mm3.cpp b/src/USER-YAFF/angle_mm3.cpp index cb3010e97c..34de772672 100644 --- a/src/USER-YAFF/angle_mm3.cpp +++ b/src/USER-YAFF/angle_mm3.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "angle_mm3.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -180,12 +180,12 @@ void AngleMM3::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); int count = 0; - double k2_one = force->numeric(FLERR,arg[1]); - double theta0_one = force->numeric(FLERR,arg[2]); + double k2_one = utils::numeric(FLERR,arg[1],false,lmp); + double theta0_one = utils::numeric(FLERR,arg[2],false,lmp); // convert theta0 from degrees to radians diff --git a/src/USER-YAFF/bond_mm3.cpp b/src/USER-YAFF/bond_mm3.cpp index 8001e35d74..f5d5fed946 100644 --- a/src/USER-YAFF/bond_mm3.cpp +++ b/src/USER-YAFF/bond_mm3.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "bond_mm3.h" -#include + #include #include "atom.h" #include "neighbor.h" @@ -24,7 +24,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -135,10 +135,10 @@ void BondMM3::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); - double k2_one = force->numeric(FLERR,arg[1]); - double r0_one = force->numeric(FLERR,arg[2]); + double k2_one = utils::numeric(FLERR,arg[1],false,lmp); + double r0_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-YAFF/improper_distharm.cpp b/src/USER-YAFF/improper_distharm.cpp index 751e6e19c2..37039b27e4 100644 --- a/src/USER-YAFF/improper_distharm.cpp +++ b/src/USER-YAFF/improper_distharm.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "improper_distharm.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -219,10 +219,10 @@ void ImproperDistHarm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double chi_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi_one = utils::numeric(FLERR,arg[2],false,lmp); // convert chi from degrees to radians diff --git a/src/USER-YAFF/improper_sqdistharm.cpp b/src/USER-YAFF/improper_sqdistharm.cpp index 82bf4a1755..ddc4d78c93 100644 --- a/src/USER-YAFF/improper_sqdistharm.cpp +++ b/src/USER-YAFF/improper_sqdistharm.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "improper_sqdistharm.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -219,10 +219,10 @@ void ImproperSQDistHarm::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); - double k_one = force->numeric(FLERR,arg[1]); - double chi_one = force->numeric(FLERR,arg[2]); + double k_one = utils::numeric(FLERR,arg[1],false,lmp); + double chi_one = utils::numeric(FLERR,arg[2],false,lmp); // convert chi from degrees to radians diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 37fc143e8b..98fd317794 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_switch3_coulgauss_long.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -267,14 +267,14 @@ void PairLJSwitch3CoulGaussLong::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 2) { cut_coul = cut_lj_global; - truncw = force->numeric(FLERR,arg[1]); + truncw = utils::numeric(FLERR,arg[1],false,lmp); } else { - cut_coul = force->numeric(FLERR,arg[1]); - truncw = force->numeric(FLERR,arg[2]); + cut_coul = utils::numeric(FLERR,arg[1],false,lmp); + truncw = utils::numeric(FLERR,arg[2],false,lmp); } if (truncw>0.0) truncwi = 1.0/truncw; else truncwi = 0.0; @@ -299,15 +299,15 @@ void PairLJSwitch3CoulGaussLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double gamma_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index 6b0466cd6d..e1ee0e0b98 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_mm3_switch3_coulgauss_long.h" -#include + #include #include #include "atom.h" @@ -31,7 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -269,14 +269,14 @@ void PairMM3Switch3CoulGaussLong::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 2) { cut_coul = cut_lj_global; - truncw = force->numeric(FLERR,arg[1]); + truncw = utils::numeric(FLERR,arg[1],false,lmp); } else { - cut_coul = force->numeric(FLERR,arg[1]); - truncw = force->numeric(FLERR,arg[2]); + cut_coul = utils::numeric(FLERR,arg[1],false,lmp); + truncw = utils::numeric(FLERR,arg[2],false,lmp); } if (truncw>0.0) truncwi = 1.0/truncw; else truncwi = 0.0; @@ -301,15 +301,15 @@ void PairMM3Switch3CoulGaussLong::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double gamma_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 6) cut_lj_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index c9b0617f5e..be77b8457b 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_voronoi_atom.h" -#include + #include #include #include @@ -100,15 +100,15 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg], "edge_histo") == 0) { if (iarg + 2 > narg) error->all(FLERR,"Illegal compute voronoi/atom command"); - maxedge = force->inumeric(FLERR,arg[iarg+1]); + maxedge = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "face_threshold") == 0) { if (iarg + 2 > narg) error->all(FLERR,"Illegal compute voronoi/atom command"); - fthresh = force->numeric(FLERR,arg[iarg+1]); + fthresh = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "edge_threshold") == 0) { if (iarg + 2 > narg) error->all(FLERR,"Illegal compute voronoi/atom command"); - ethresh = force->numeric(FLERR,arg[iarg+1]); + ethresh = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg], "neighbors") == 0) { if (iarg + 2 > narg) error->all(FLERR,"Illegal compute voronoi/atom command"); diff --git a/src/angle_deprecated.cpp b/src/angle_deprecated.cpp index fb3f90ec28..7c2426739d 100644 --- a/src/angle_deprecated.cpp +++ b/src/angle_deprecated.cpp @@ -16,12 +16,10 @@ ------------------------------------------------------------------------- */ #include "angle_deprecated.h" -#include #include "angle_hybrid.h" #include "comm.h" #include "force.h" #include "error.h" -#include "utils.h" using namespace LAMMPS_NS; diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 882749b6b2..56590d6757 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -12,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "angle_hybrid.h" -#include -#include -#include + #include "atom.h" #include "neighbor.h" #include "comm.h" #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + +#include +#include using namespace LAMMPS_NS; @@ -267,7 +267,7 @@ void AngleHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); // 2nd arg = angle sub-style name // allow for "none" or "skip" as valid sub-style name diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index 5da8e9d5bc..e087b774e0 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -16,15 +16,14 @@ ------------------------------------------------------------------------- */ #include "angle_zero.h" -#include -#include + #include "atom.h" -#include "force.h" #include "comm.h" #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -87,11 +86,11 @@ void AngleZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nangletypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nangletypes,ilo,ihi,error); double theta0_one = 0.0; if (coeffflag && (narg == 2)) - theta0_one = force->numeric(FLERR,arg[1]); + theta0_one = utils::numeric(FLERR,arg[1],false,lmp); // convert theta0 from degrees to radians diff --git a/src/atom.cpp b/src/atom.cpp index e930a0255e..49ff262764 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -12,31 +12,27 @@ ------------------------------------------------------------------------- */ #include "atom.h" -#include -#include -#include -#include -#include -#include -#include "style_atom.h" #include "atom_vec.h" -#include "atom_vec_ellipsoid.h" +#include "style_atom.h" // IWYU pragma: keep + #include "comm.h" -#include "neighbor.h" -#include "force.h" -#include "modify.h" -#include "fix.h" #include "compute.h" -#include "update.h" #include "domain.h" +#include "error.h" +#include "fix.h" +#include "force.h" #include "group.h" #include "input.h" -#include "variable.h" -#include "molecule.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "modify.h" +#include "molecule.h" +#include "neighbor.h" +#include "update.h" +#include "variable.h" + +#include +#include #ifdef LMP_USER_INTEL #include "neigh_request.h" @@ -51,6 +47,33 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ +/** \class LAMMPS_NS::Atom + * \brief Class to provide access to atom data + +\verbatim embed:rst +The Atom class provides access to atom style related global settings and +per-atom data that is stored with atoms and migrates with them from +sub-domain to sub-domain as atoms move around. This includes topology +data, which is stored with either one specific atom or all atoms involved +depending on the settings of the :doc:`newton command `. + +The actual per-atom data is allocated and managed by one of the various +classes derived from the AtomVec class as determined by +the :doc:`atom_style command `. The pointers in the Atom class +are updated by the AtomVec class as needed. +\endverbatim + */ + +/** Atom class constructor + * + * This resets and initialized all kinds of settings, + * parameters, and pointer variables for per-atom arrays. + * This also initializes the factory for creating + * instances of classes derived from the AtomVec base + * class, which correspond to the selected atom style. + * + * \param lmp pointer to the base LAMMPS class */ + Atom::Atom(LAMMPS *lmp) : Pointers(lmp) { natoms = 0; @@ -692,7 +715,6 @@ AtomVec *Atom::avec_creator(LAMMPS *lmp) return new T(lmp); } - /* ---------------------------------------------------------------------- */ void Atom::init() @@ -795,8 +817,8 @@ void Atom::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"sort") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal atom_modify command"); - sortfreq = force->inumeric(FLERR,arg[iarg+1]); - userbinsize = force->numeric(FLERR,arg[iarg+2]); + sortfreq = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + userbinsize = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (sortfreq < 0 || userbinsize < 0.0) error->all(FLERR,"Illegal atom_modify command"); if (sortfreq >= 0 && firstgroupname) @@ -1576,8 +1598,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) else error->one(FLERR,"Duplicate atom ID in Bodies section of data file"); - ninteger = force->inumeric(FLERR,strtok(NULL," \t\n\r\f")); - ndouble = force->inumeric(FLERR,strtok(NULL," \t\n\r\f")); + ninteger = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ndouble = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); if ((m = map(tagdata)) >= 0) { if (ninteger > maxint) { @@ -1592,9 +1614,9 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) } for (j = 0; j < ninteger; j++) - ivalues[j] = force->inumeric(FLERR,strtok(NULL," \t\n\r\f")); + ivalues[j] = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); for (j = 0; j < ndouble; j++) - dvalues[j] = force->numeric(FLERR,strtok(NULL," \t\n\r\f")); + dvalues[j] = utils::numeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); avec_body->data_body(m,ninteger,ndouble,ivalues,dvalues); @@ -1702,7 +1724,7 @@ void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); int lo,hi; - force->bounds(file,line,arg[0],ntypes,lo,hi); + utils::bounds(file,line,arg[0],1,ntypes,lo,hi,error); if (lo < 1 || hi > ntypes) error->all(file,line,"Invalid type for mass set"); for (int itype = lo; itype <= hi; itype++) { @@ -2305,12 +2327,17 @@ int Atom::find_custom(const char *name, int &flag) return -1; } -/* ---------------------------------------------------------------------- - add a custom variable with name of type flag = 0/1 for int/double - assumes name does not already exist - return index in ivector or dvector of its location -------------------------------------------------------------------------- */ +/** \brief Add a custom per-atom property with the given name and type +\verbatim embed:rst +This function will add a custom per-atom property with the name "name" +as either list of int or double to the list of custom properties. This +function is called, e.g. from :doc:`fix property/atom `. +\endverbatim + * \param name Name of the property (w/o a "d_" or "i_" prefix) + * \param flag Data type of property: 0 for int, 1 for double + * \return Index of property in the respective list of properties + */ int Atom::add_custom(const char *name, int flag) { int index; @@ -2342,12 +2369,19 @@ int Atom::add_custom(const char *name, int flag) return index; } -/* ---------------------------------------------------------------------- - remove a custom variable of type flag = 0/1 for int/double at index - free memory for vector and name and set ptrs to NULL - ivector/dvector and iname/dname lists never shrink -------------------------------------------------------------------------- */ - +/*! \brief Remove a custom per-atom property of a given type + * +\verbatim embed:rst +This will remove a property that was requested e.g. by the +:doc:`fix property/atom ` command. It frees the +allocated memory and sets the pointer to ``NULL`` to the entry in +the list can be reused. The lists of those pointers will never be +compacted or never shrink, so that index to name mappings remain valid. +\endverbatim + * + * \param flag whether the property is integer (=0) or double (=1) + * \param index of that property in the respective list. + */ void Atom::remove_custom(int flag, int index) { if (flag == 0) { @@ -2363,16 +2397,123 @@ void Atom::remove_custom(int flag, int index) } } -/* ---------------------------------------------------------------------- - return a pointer to a named internal variable - if don't recognize name, return NULL -------------------------------------------------------------------------- */ +/** Provide access to internal data of the Atom class by keyword + * +\verbatim embed:rst + +This function is a way to access internal per-atom data. This data is +distributed across MPI ranks and thus only the data for "local" atoms +are expected to be available. Whether also data for "ghost" atoms is +stored and up-to-date depends on various simulation settings. + +This table lists a large part of the supported names, their data types, +length of the data area, and a short description. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Type + - Items per atom + - Description + * - mass + - double + - 1 + - per-type mass. This array is **NOT** a per-atom array + but of length ``ntypes+1``, element 0 is ignored. + * - id + - tagint + - 1 + - atom ID of the particles + * - type + - int + - 1 + - atom type of the particles + * - mask + - int + - 1 + - bitmask for mapping to groups. Individual bits are set + to 0 or 1 for each group. + * - image + - imageint + - 1 + - 3 image flags encoded into a single integer. + See :cpp:func:`lammps_encode_image_flags`. + * - x + - double + - 3 + - x-, y-, and z-coordinate of the particles + * - v + - double + - 3 + - x-, y-, and z-component of the velocity of the particles + * - f + - double + - 3 + - x-, y-, and z-component of the force on the particles + * - molecule + - int + - 1 + - molecule ID of the particles + * - q + - double + - 1 + - charge of the particles + * - mu + - double + - 3 + - dipole moment of the particles + * - omega + - double + - 3 + - x-, y-, and z-component of rotational velocity of the particles + * - angmom + - double + - 3 + - x-, y-, and z-component of angular momentum of the particles + * - torque + - double + - 3 + - x-, y-, and z-component of the torque on the particles + * - radius + - double + - 1 + - radius of the (extended) particles + * - rmass + - double + - 1 + - per-atom mass of the particles. ``NULL`` if per-type masses are + used. See the :cpp:func:`rmass_flag` setting. + * - ellipsoid + - int + - 1 + - 1 if the particle is an ellipsoidal particle, 0 if not + * - line + - int + - 1 + - 1 if the particle is a line particle, 0 if not + * - tri + - int + - 1 + - 1 if the particle is a triangulated particle, 0 if not + * - body + - int + - 1 + - 1 if the particle is a body particle, 0 if not + +\endverbatim + * + * \param name string with the keyword of the desired property. + Typically the name of the pointer variable returned + * \return pointer to the requested data cast to ``void *`` or NULL */ void *Atom::extract(char *name) { // -------------------------------------------------------------------- // 4th customization section: customize by adding new variable name + /* NOTE: this array is only of length ntypes+1 */ if (strcmp(name,"mass") == 0) return (void *) mass; if (strcmp(name,"id") == 0) return (void *) tag; @@ -2393,6 +2534,7 @@ void *Atom::extract(char *name) if (strcmp(name,"ellipsoid") == 0) return (void *) ellipsoid; if (strcmp(name,"line") == 0) return (void *) line; if (strcmp(name,"tri") == 0) return (void *) tri; + if (strcmp(name,"body") == 0) return (void *) body; if (strcmp(name,"vfrac") == 0) return (void *) vfrac; if (strcmp(name,"s0") == 0) return (void *) s0; diff --git a/src/atom.h b/src/atom.h index 4dac15d758..21b9c06f8c 100644 --- a/src/atom.h +++ b/src/atom.h @@ -15,16 +15,20 @@ #define LMP_ATOM_H #include "pointers.h" + #include #include -#include namespace LAMMPS_NS { + // forward declaration + + class AtomVec; + class Atom : protected Pointers { public: char *atom_style; - class AtomVec *avec; + AtomVec *avec; enum{DOUBLE,INT,BIGINT}; // atom counts @@ -273,12 +277,12 @@ class Atom : protected Pointers { void add_peratom_vary(const char *, void *, int, int *, void *, int collength=0); void create_avec(const std::string &, int, char **, int); - virtual class AtomVec *new_avec(const std::string &, int, int &); + virtual AtomVec *new_avec(const std::string &, int, int &); void init(); void setup(); - class AtomVec *style_match(const char *); + AtomVec *style_match(const char *); void modify_params(int, char **); void tag_check(); void tag_extend(); @@ -296,8 +300,8 @@ class Atom : protected Pointers { void data_angles(int, char *, int *, tagint, int); void data_dihedrals(int, char *, int *, tagint, int); void data_impropers(int, char *, int *, tagint, int); - void data_bonus(int, char *, class AtomVec *, tagint); - void data_bodies(int, char *, class AtomVec *, tagint); + void data_bonus(int, char *, AtomVec *, tagint); + void data_bodies(int, char *, AtomVec *, tagint); void data_fix_compute_variable(int, int); virtual void allocate_type_arrays(); diff --git a/src/atom_map.cpp b/src/atom_map.cpp index c23aeec83c..02b97a1134 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "atom.h" -#include -#include + #include "comm.h" -#include "memory.h" #include "error.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 261b068997..4a00e5852b 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -12,20 +12,19 @@ ------------------------------------------------------------------------- */ #include "atom_vec.h" -#include -#include + #include "atom.h" #include "comm.h" #include "domain.h" -#include "force.h" -#include "modify.h" +#include "error.h" #include "fix.h" +#include "force.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "modify.h" #include "tokenizer.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 10cbb9c841..e9044519c9 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -12,18 +12,17 @@ ------------------------------------------------------------------------- */ #include "atom_vec_body.h" -#include -#include -#include "my_pool_chunk.h" -#include "style_body.h" -#include "body.h" +#include "style_body.h" // IWYU pragma: keep + #include "atom.h" -#include "domain.h" -#include "modify.h" +#include "body.h" +#include "error.h" #include "fix.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "modify.h" +#include "my_pool_chunk.h" + +#include using namespace LAMMPS_NS; @@ -556,7 +555,7 @@ bigint AtomVecBody::memory_usage_bonus() { bigint bytes = 0; bytes += nmax_bonus*sizeof(Bonus); - bytes += icp->size + dcp->size; + bytes += icp->size() + dcp->size(); int nall = nlocal_bonus + nghost_bonus; for (int i = 0; i < nall; i++) { diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index dc2760c5f9..c22111f48c 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -16,16 +16,16 @@ ------------------------------------------------------------------------- */ #include "atom_vec_ellipsoid.h" -#include -#include "math_extra.h" + #include "atom.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "math_const.h" +#include "math_extra.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index db593dcee0..7a8c73570d 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -12,13 +12,13 @@ ------------------------------------------------------------------------- */ #include "atom_vec_hybrid.h" -#include + #include "atom.h" #include "comm.h" -#include "memory.h" #include "error.h" #include "tokenizer.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; @@ -595,7 +595,7 @@ void AtomVecHybrid::build_styles() nallstyles = 0; #define ATOM_CLASS #define AtomStyle(key,Class) nallstyles++; -#include "style_atom.h" +#include "style_atom.h" // IWYU pragma: keep #undef AtomStyle #undef ATOM_CLASS @@ -609,7 +609,7 @@ void AtomVecHybrid::build_styles() allstyles[nallstyles] = new char[n]; \ strcpy(allstyles[nallstyles],#key); \ nallstyles++; -#include "style_atom.h" +#include "style_atom.h" // IWYU pragma: keep #undef AtomStyle #undef ATOM_CLASS } diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index af768f9943..88dcb8c2fa 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -12,17 +12,17 @@ ------------------------------------------------------------------------- */ #include "atom_vec_line.h" -#include -#include + #include "atom.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 03f417b1d0..03412a11cc 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -12,14 +12,15 @@ ------------------------------------------------------------------------- */ #include "atom_vec_sphere.h" -#include + #include "atom.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_adapt.h" #include "math_const.h" -#include "error.h" -#include "utils.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index d5b48b9540..e391a73215 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -12,18 +12,18 @@ ------------------------------------------------------------------------- */ #include "atom_vec_tri.h" -#include -#include -#include "math_extra.h" + #include "atom.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "math_const.h" +#include "math_extra.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; diff --git a/src/balance.cpp b/src/balance.cpp index d5032d8923..af8d904812 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -19,28 +19,26 @@ // #define BALANCE_DEBUG 1 #include "balance.h" -#include -#include -#include + #include "atom.h" #include "comm.h" -#include "rcb.h" -#include "irregular.h" #include "domain.h" -#include "force.h" -#include "update.h" -#include "modify.h" +#include "error.h" #include "fix_store.h" #include "imbalance.h" #include "imbalance_group.h" -#include "imbalance_time.h" #include "imbalance_neigh.h" #include "imbalance_store.h" +#include "imbalance_time.h" #include "imbalance_var.h" +#include "irregular.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" +#include "rcb.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -119,7 +117,7 @@ void Balance::command(int narg, char **arg) if (narg < 2) error->all(FLERR,"Illegal balance command"); - thresh = force->numeric(FLERR,arg[0]); + thresh = utils::numeric(FLERR,arg[0],false,lmp); int dimension = domain->dimension; int *procgrid = comm->procgrid; @@ -145,7 +143,7 @@ void Balance::command(int narg, char **arg) user_xsplit[0] = 0.0; iarg++; for (int i = 1; i < procgrid[0]; i++) - user_xsplit[i] = force->numeric(FLERR,arg[iarg++]); + user_xsplit[i] = utils::numeric(FLERR,arg[iarg++],false,lmp); user_xsplit[procgrid[0]] = 1.0; } } else if (strcmp(arg[iarg],"y") == 0) { @@ -165,7 +163,7 @@ void Balance::command(int narg, char **arg) user_ysplit[0] = 0.0; iarg++; for (int i = 1; i < procgrid[1]; i++) - user_ysplit[i] = force->numeric(FLERR,arg[iarg++]); + user_ysplit[i] = utils::numeric(FLERR,arg[iarg++],false,lmp); user_ysplit[procgrid[1]] = 1.0; } } else if (strcmp(arg[iarg],"z") == 0) { @@ -185,7 +183,7 @@ void Balance::command(int narg, char **arg) user_zsplit[0] = 0.0; iarg++; for (int i = 1; i < procgrid[2]; i++) - user_zsplit[i] = force->numeric(FLERR,arg[iarg++]); + user_zsplit[i] = utils::numeric(FLERR,arg[iarg++],false,lmp); user_zsplit[procgrid[2]] = 1.0; } @@ -195,9 +193,9 @@ void Balance::command(int narg, char **arg) style = SHIFT; if (strlen(arg[iarg+1]) > 3) error->all(FLERR,"Illegal balance command"); strcpy(bstr,arg[iarg+1]); - nitermax = force->inumeric(FLERR,arg[iarg+2]); + nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nitermax <= 0) error->all(FLERR,"Illegal balance command"); - stopthresh = force->numeric(FLERR,arg[iarg+3]); + stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (stopthresh < 1.0) error->all(FLERR,"Illegal balance command"); iarg += 4; diff --git a/src/body.h b/src/body.h index 1c742d3e65..c9c289792e 100644 --- a/src/body.h +++ b/src/body.h @@ -15,7 +15,7 @@ #define LMP_BODY_H #include "pointers.h" -#include "atom_vec_body.h" +#include "atom_vec_body.h" // IWYU pragma: keep namespace LAMMPS_NS { diff --git a/src/bond.cpp b/src/bond.cpp index 0fb42da98a..1f953bbd19 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -12,20 +12,18 @@ ------------------------------------------------------------------------- */ #include "bond.h" -#include -#include -#include + #include "atom.h" +#include "atom_masks.h" #include "comm.h" +#include "error.h" #include "force.h" +#include "memory.h" #include "neighbor.h" #include "suffix.h" -#include "atom_masks.h" -#include "memory.h" -#include "error.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; @@ -236,16 +234,16 @@ void Bond::write_file(int narg, char **arg) int itype = 0; int jtype = 0; if (narg == 8) { - itype = force->inumeric(FLERR,arg[6]); - jtype = force->inumeric(FLERR,arg[7]); + itype = utils::inumeric(FLERR,arg[6],false,lmp); + jtype = utils::inumeric(FLERR,arg[7],false,lmp); if (itype < 1 || itype > atom->ntypes || jtype < 1 || jtype > atom->ntypes) error->all(FLERR,"Invalid atom types in bond_write command"); } - int btype = force->inumeric(FLERR,arg[0]); - int n = force->inumeric(FLERR,arg[1]); - double inner = force->numeric(FLERR,arg[2]); - double outer = force->numeric(FLERR,arg[3]); + int btype = utils::inumeric(FLERR,arg[0],false,lmp); + int n = utils::inumeric(FLERR,arg[1],false,lmp); + double inner = utils::numeric(FLERR,arg[2],false,lmp); + double outer = utils::numeric(FLERR,arg[3],false,lmp); if (inner <= 0.0 || inner >= outer) error->all(FLERR,"Invalid rlo/rhi values in bond_write command"); diff --git a/src/bond_deprecated.cpp b/src/bond_deprecated.cpp index 0d91f73ea7..5422ab35f6 100644 --- a/src/bond_deprecated.cpp +++ b/src/bond_deprecated.cpp @@ -16,12 +16,11 @@ ------------------------------------------------------------------------- */ #include "bond_deprecated.h" -#include + #include "bond_hybrid.h" #include "comm.h" -#include "force.h" #include "error.h" -#include "utils.h" +#include "force.h" using namespace LAMMPS_NS; diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index aadc25987a..b42683c300 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -12,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "bond_hybrid.h" -#include -#include -#include + #include "atom.h" -#include "neighbor.h" #include "comm.h" +#include "error.h" #include "force.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "neighbor.h" + +#include +#include using namespace LAMMPS_NS; @@ -268,7 +268,7 @@ void BondHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); // 2nd arg = bond sub-style name // allow for "none" as valid sub-style name diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index cb336ddd67..71146ec4d6 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -16,14 +16,13 @@ ------------------------------------------------------------------------- */ #include "bond_zero.h" -#include -#include + #include "atom.h" -#include "force.h" #include "comm.h" -#include "memory.h" #include "error.h" -#include "utils.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; @@ -85,11 +84,11 @@ void BondZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nbondtypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nbondtypes,ilo,ihi,error); double r0_one = 0.0; if (coeffflag && (narg == 2)) - r0_one = force->numeric(FLERR,arg[1]); + r0_one = utils::numeric(FLERR,arg[1],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/change_box.cpp b/src/change_box.cpp index ff7658a01f..1bd3fe733f 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -12,22 +12,20 @@ ------------------------------------------------------------------------- */ #include "change_box.h" -#include + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "group.h" +#include "irregular.h" +#include "lattice.h" +#include "modify.h" +#include "output.h" + #include #include -#include "atom.h" -#include "modify.h" -#include "fix.h" -#include "domain.h" -#include "lattice.h" -#include "comm.h" -#include "irregular.h" -#include "output.h" -#include "group.h" -#include "error.h" -#include "force.h" -#include "utils.h" -#include "fmt/format.h" using namespace LAMMPS_NS; @@ -83,23 +81,23 @@ void ChangeBox::command(int narg, char **arg) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = FINAL; - ops[nops].flo = force->numeric(FLERR,arg[iarg+2]); - ops[nops].fhi = force->numeric(FLERR,arg[iarg+3]); + ops[nops].flo = utils::numeric(FLERR,arg[iarg+2],false,lmp); + ops[nops].fhi = utils::numeric(FLERR,arg[iarg+3],false,lmp); ops[nops].vdim1 = ops[nops].vdim2 = -1; nops++; iarg += 4; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = DELTA; - ops[nops].dlo = force->numeric(FLERR,arg[iarg+2]); - ops[nops].dhi = force->numeric(FLERR,arg[iarg+3]); + ops[nops].dlo = utils::numeric(FLERR,arg[iarg+2],false,lmp); + ops[nops].dhi = utils::numeric(FLERR,arg[iarg+3],false,lmp); ops[nops].vdim1 = ops[nops].vdim2 = -1; nops++; iarg += 4; } else if (strcmp(arg[iarg+1],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = SCALE; - ops[nops].scale = force->numeric(FLERR,arg[iarg+2]); + ops[nops].scale = utils::numeric(FLERR,arg[iarg+2],false,lmp); ops[nops].vdim1 = ops[nops].vdim2 = -1; nops++; iarg += 3; @@ -129,13 +127,13 @@ void ChangeBox::command(int narg, char **arg) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = FINAL; - ops[nops].ftilt = force->numeric(FLERR,arg[iarg+2]); + ops[nops].ftilt = utils::numeric(FLERR,arg[iarg+2],false,lmp); nops++; iarg += 3; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal change_box command"); ops[nops].flavor = DELTA; - ops[nops].dtilt = force->numeric(FLERR,arg[iarg+2]); + ops[nops].dtilt = utils::numeric(FLERR,arg[iarg+2],false,lmp); nops++; iarg += 3; } else error->all(FLERR,"Illegal change_box command"); diff --git a/src/comm.cpp b/src/comm.cpp index 7902545330..7b351e12fc 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -12,31 +12,29 @@ ------------------------------------------------------------------------- */ #include "comm.h" -#include -#include -#include -#include "universe.h" -#include "atom.h" -#include "atom_vec.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "modify.h" -#include "neighbor.h" -#include "fix.h" -#include "compute.h" -#include "domain.h" -#include "output.h" -#include "dump.h" -#include "group.h" -#include "procmap.h" -#include "irregular.h" + #include "accelerator_kokkos.h" -#include "memory.h" +#include "atom.h" // IWYU pragma: keep +#include "atom_vec.h" +#include "bond.h" +#include "compute.h" +#include "domain.h" // IWYU pragma: keep +#include "dump.h" #include "error.h" +#include "fix.h" +#include "force.h" +#include "group.h" +#include "irregular.h" +#include "memory.h" // IWYU pragma: keep +#include "modify.h" +#include "neighbor.h" // IWYU pragma: keep +#include "output.h" +#include "pair.h" +#include "procmap.h" +#include "universe.h" #include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include #ifdef _OPENMP #include @@ -300,7 +298,7 @@ void Comm::modify_params(int narg, char **arg) if (mode == Comm::MULTI) error->all(FLERR, "Use cutoff/multi keyword to set cutoff in multi mode"); - cutghostuser = force->numeric(FLERR,arg[iarg+1]); + cutghostuser = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (cutghostuser < 0.0) error->all(FLERR,"Invalid cutoff in comm_modify command"); iarg += 2; @@ -320,8 +318,8 @@ void Comm::modify_params(int narg, char **arg) for (i=0; i < ntypes+1; ++i) cutusermulti[i] = -1.0; } - force->bounds(FLERR,arg[iarg+1],ntypes,nlo,nhi,1); - cut = force->numeric(FLERR,arg[iarg+2]); + utils::bounds(FLERR,arg[iarg+1],1,ntypes,nlo,nhi,error); + cut = utils::numeric(FLERR,arg[iarg+2],false,lmp); cutghostuser = MAX(cutghostuser,cut); if (cut < 0.0) error->all(FLERR,"Invalid cutoff in comm_modify command"); @@ -348,11 +346,11 @@ void Comm::set_processors(int narg, char **arg) if (narg < 3) error->all(FLERR,"Illegal processors command"); if (strcmp(arg[0],"*") == 0) user_procgrid[0] = 0; - else user_procgrid[0] = force->inumeric(FLERR,arg[0]); + else user_procgrid[0] = utils::inumeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"*") == 0) user_procgrid[1] = 0; - else user_procgrid[1] = force->inumeric(FLERR,arg[1]); + else user_procgrid[1] = utils::inumeric(FLERR,arg[1],false,lmp); if (strcmp(arg[2],"*") == 0) user_procgrid[2] = 0; - else user_procgrid[2] = force->inumeric(FLERR,arg[2]); + else user_procgrid[2] = utils::inumeric(FLERR,arg[2],false,lmp); if (user_procgrid[0] < 0 || user_procgrid[1] < 0 || user_procgrid[2] < 0) error->all(FLERR,"Illegal processors command"); @@ -373,13 +371,13 @@ void Comm::set_processors(int narg, char **arg) if (iarg+6 > narg) error->all(FLERR,"Illegal processors command"); gridflag = TWOLEVEL; - ncores = force->inumeric(FLERR,arg[iarg+2]); + ncores = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (strcmp(arg[iarg+3],"*") == 0) user_coregrid[0] = 0; - else user_coregrid[0] = force->inumeric(FLERR,arg[iarg+3]); + else user_coregrid[0] = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (strcmp(arg[iarg+4],"*") == 0) user_coregrid[1] = 0; - else user_coregrid[1] = force->inumeric(FLERR,arg[iarg+4]); + else user_coregrid[1] = utils::inumeric(FLERR,arg[iarg+4],false,lmp); if (strcmp(arg[iarg+5],"*") == 0) user_coregrid[2] = 0; - else user_coregrid[2] = force->inumeric(FLERR,arg[iarg+5]); + else user_coregrid[2] = utils::inumeric(FLERR,arg[iarg+5],false,lmp); if (ncores <= 0 || user_coregrid[0] < 0 || user_coregrid[1] < 0 || user_coregrid[2] < 0) @@ -422,8 +420,8 @@ void Comm::set_processors(int narg, char **arg) error->all(FLERR, "Cannot use processors part command " "without using partitions"); - int isend = force->inumeric(FLERR,arg[iarg+1]); - int irecv = force->inumeric(FLERR,arg[iarg+2]); + int isend = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + int irecv = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (isend < 1 || isend > universe->nworlds || irecv < 1 || irecv > universe->nworlds || isend == irecv) error->all(FLERR,"Invalid partitions in processors part command"); diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index c5ec8b35f4..37a4f0ae3d 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -16,19 +16,20 @@ ------------------------------------------------------------------------- */ #include "comm_brick.h" -#include -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "pair.h" -#include "domain.h" -#include "neighbor.h" -#include "fix.h" #include "compute.h" +#include "domain.h" #include "dump.h" #include "error.h" +#include "fix.h" #include "memory.h" +#include "neighbor.h" +#include "pair.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 9f0169568d..48c9680d2f 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -17,19 +17,20 @@ ------------------------------------------------------------------------- */ #include "comm_tiled.h" -#include -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "domain.h" -#include "pair.h" -#include "neighbor.h" -#include "fix.h" #include "compute.h" +#include "domain.h" #include "dump.h" -#include "memory.h" #include "error.h" +#include "fix.h" +#include "memory.h" +#include "neighbor.h" +#include "pair.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/compute.cpp b/src/compute.cpp index 4009396eb0..4cde9ff567 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -12,16 +12,17 @@ ------------------------------------------------------------------------- */ #include "compute.h" + +#include "atom_masks.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "group.h" +#include "memory.h" +#include "modify.h" + #include #include -#include "domain.h" -#include "force.h" -#include "group.h" -#include "modify.h" -#include "fix.h" -#include "atom_masks.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; @@ -129,7 +130,7 @@ void Compute::modify_params(int narg, char **arg) if (strcmp(arg[iarg],"extra") == 0 || strcmp(arg[iarg],"extra/dof") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); - extra_dof = force->numeric(FLERR,arg[iarg+1]); + extra_dof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"dynamic") == 0 || strcmp(arg[iarg],"dynamic/dof") == 0) { diff --git a/src/compute_adf.cpp b/src/compute_adf.cpp index dee5fb214f..5d55f1fbbb 100644 --- a/src/compute_adf.cpp +++ b/src/compute_adf.cpp @@ -16,20 +16,21 @@ ------------------------------------------------------------------------- */ #include "compute_adf.h" -#include -#include -#include + #include "atom.h" -#include "update.h" +#include "comm.h" +#include "error.h" #include "force.h" -#include "pair.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "comm.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -67,7 +68,7 @@ ComputeADF::ComputeADF(LAMMPS *lmp, int narg, char **arg) : ordinate_style = DEGREE; cutflag = 0; - nbin = force->inumeric(FLERR,arg[3]); + nbin = utils::inumeric(FLERR,arg[3],false,lmp); if (nbin < 1) error->all(FLERR,"Illegal compute adf command"); // optional args @@ -134,19 +135,19 @@ ComputeADF::ComputeADF(LAMMPS *lmp, int narg, char **arg) : cutflag = 1; iarg = 4; for (int m = 0; m < ntriples; m++) { - force->bounds(FLERR,arg[iarg],atom->ntypes,ilo[m],ihi[m]); - force->bounds(FLERR,arg[iarg+1],atom->ntypes,jlo[m],jhi[m]); - force->bounds(FLERR,arg[iarg+2],atom->ntypes,klo[m],khi[m]); + utils::bounds(FLERR,arg[iarg],1,atom->ntypes,ilo[m],ihi[m],error); + utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,jlo[m],jhi[m],error); + utils::bounds(FLERR,arg[iarg+2],1,atom->ntypes,klo[m],khi[m],error); if (ilo[m] > ihi[m] || jlo[m] > jhi[m] || klo[m] > khi[m]) error->all(FLERR,"Illegal compute adf command"); - rcutinnerj[m] = force->numeric(FLERR,arg[iarg+3]); - rcutouterj[m] = force->numeric(FLERR,arg[iarg+4]); + rcutinnerj[m] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + rcutouterj[m] = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (rcutinnerj[m] < 0.0 || rcutinnerj[m] >= rcutouterj[m]) error->all(FLERR,"Illegal compute adf command"); - rcutinnerk[m] = force->numeric(FLERR,arg[iarg+5]); - rcutouterk[m] = force->numeric(FLERR,arg[iarg+6]); + rcutinnerk[m] = utils::numeric(FLERR,arg[iarg+5],false,lmp); + rcutouterk[m] = utils::numeric(FLERR,arg[iarg+6],false,lmp); if (rcutinnerk[m] < 0.0 || rcutinnerk[m] >= rcutouterk[m]) error->all(FLERR,"Illegal compute adf command"); iarg += nargsperadf; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index e495ac6899..6b6f376b4c 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -16,23 +16,23 @@ ------------------------------------------------------------------------- */ #include "compute_aggregate_atom.h" -#include -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "update.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" #include "pair.h" -#include "force.h" -#include "comm.h" -#include "memory.h" -#include "error.h" +#include "update.h" -#include "group.h" +#include +#include using namespace LAMMPS_NS; @@ -44,7 +44,7 @@ ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal compute aggregate/atom command"); - double cutoff = force->numeric(FLERR,arg[3]); + double cutoff = utils::numeric(FLERR,arg[3],false,lmp); cutsq = cutoff*cutoff; if (atom->avec->bonds_allow == 0) diff --git a/src/compute_angle.cpp b/src/compute_angle.cpp index fc72a58453..e3e44efbbb 100644 --- a/src/compute_angle.cpp +++ b/src/compute_angle.cpp @@ -12,12 +12,12 @@ ------------------------------------------------------------------------- */ #include "compute_angle.h" -#include + #include "angle.h" -#include "update.h" -#include "force.h" #include "angle_hybrid.h" #include "error.h" +#include "force.h" +#include "update.h" using namespace LAMMPS_NS; diff --git a/src/compute_angmom_chunk.cpp b/src/compute_angmom_chunk.cpp index 05ea963b82..6c9f1d65a2 100644 --- a/src/compute_angmom_chunk.cpp +++ b/src/compute_angmom_chunk.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "compute_angmom_chunk.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "compute_chunk_atom.h" #include "domain.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/compute_bond.cpp b/src/compute_bond.cpp index 5cc947c764..503582bc65 100644 --- a/src/compute_bond.cpp +++ b/src/compute_bond.cpp @@ -12,12 +12,12 @@ ------------------------------------------------------------------------- */ #include "compute_bond.h" -#include + #include "bond.h" -#include "update.h" -#include "force.h" #include "bond_hybrid.h" #include "error.h" +#include "force.h" +#include "update.h" using namespace LAMMPS_NS; diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 18fc31390f..f88dea9ebe 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -43,7 +43,7 @@ ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"fcc") == 0) nnn = 12; else if (strcmp(arg[3],"bcc") == 0) nnn = 8; - else nnn = force->inumeric(FLERR,arg[3]); + else nnn = utils::inumeric(FLERR,arg[3],false,lmp); // default values diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index c8e4269b56..d0044410d8 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -14,29 +14,27 @@ // NOTE: allow for bin center to be variables for sphere/cylinder #include "compute_chunk_atom.h" -#include -#include -#include -#include -#include -#include + #include "atom.h" -#include "update.h" -#include "force.h" +#include "comm.h" #include "domain.h" -#include "region.h" -#include "lattice.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "fix_store.h" -#include "comm.h" #include "group.h" #include "input.h" -#include "variable.h" +#include "lattice.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "fmt/format.h" +#include "modify.h" +#include "region.h" +#include "update.h" +#include "variable.h" + +#include +#include +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -108,12 +106,12 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : ncoord = 1; iarg = 4; if (iarg+6 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - sorigin_user[0] = force->numeric(FLERR,arg[iarg]); - sorigin_user[1] = force->numeric(FLERR,arg[iarg+1]); - sorigin_user[2] = force->numeric(FLERR,arg[iarg+2]); - sradmin_user = force->numeric(FLERR,arg[iarg+3]); - sradmax_user = force->numeric(FLERR,arg[iarg+4]); - nsbin = force->inumeric(FLERR,arg[iarg+5]); + sorigin_user[0] = utils::numeric(FLERR,arg[iarg],false,lmp); + sorigin_user[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + sorigin_user[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + sradmin_user = utils::numeric(FLERR,arg[iarg+3],false,lmp); + sradmax_user = utils::numeric(FLERR,arg[iarg+4],false,lmp); + nsbin = utils::inumeric(FLERR,arg[iarg+5],false,lmp); iarg += 6; } else if (strcmp(arg[3],"bin/cylinder") == 0) { binflag = 1; @@ -134,12 +132,12 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : } if (iarg+5 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); corigin_user[dim[0]] = 0.0; - corigin_user[cdim1] = force->numeric(FLERR,arg[iarg]); - corigin_user[cdim2] = force->numeric(FLERR,arg[iarg+1]); - cradmin_user = force->numeric(FLERR,arg[iarg+2]); - cradmax_user = force->numeric(FLERR,arg[iarg+3]); + corigin_user[cdim1] = utils::numeric(FLERR,arg[iarg],false,lmp); + corigin_user[cdim2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + cradmin_user = utils::numeric(FLERR,arg[iarg+2],false,lmp); + cradmax_user = utils::numeric(FLERR,arg[iarg+3],false,lmp); - ncbin = force->inumeric(FLERR,arg[iarg+4]); + ncbin = utils::inumeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else if (strcmp(arg[3],"type") == 0) { @@ -218,7 +216,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"limit") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - limit = force->inumeric(FLERR,arg[iarg+1]); + limit = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (limit < 0) error->all(FLERR,"Illegal compute chunk/atom command"); if (limit && !compress) limitfirst = 1; iarg += 2; @@ -261,11 +259,11 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER; else minflag[idim] = COORD; if (minflag[idim] == COORD) - minvalue[idim] = force->numeric(FLERR,arg[iarg+2]); + minvalue[idim] = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER; else maxflag[idim] = COORD; if (maxflag[idim] == COORD) - maxvalue[idim] = force->numeric(FLERR,arg[iarg+3]); + maxvalue[idim] = utils::numeric(FLERR,arg[iarg+3],false,lmp); else error->all(FLERR,"Illegal compute chunk/atom command"); iarg += 4; } else if (strcmp(arg[iarg],"units") == 0) { @@ -1983,9 +1981,9 @@ void ComputeChunkAtom::readdim(int narg, char **arg, int iarg, int idim) else if (strcmp(arg[iarg+1],"upper") == 0) originflag[idim] = UPPER; else originflag[idim] = COORD; if (originflag[idim] == COORD) - origin[idim] = force->numeric(FLERR,arg[iarg+1]); + origin[idim] = utils::numeric(FLERR,arg[iarg+1],false,lmp); - delta[idim] = force->numeric(FLERR,arg[iarg+2]); + delta[idim] = utils::numeric(FLERR,arg[iarg+2],false,lmp); } /* ---------------------------------------------------------------------- diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 41dbf2d5cb..953ae3a8cb 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -12,18 +12,17 @@ ------------------------------------------------------------------------- */ #include "compute_chunk_spread_atom.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" -#include "fix.h" #include "compute.h" #include "compute_chunk_atom.h" -#include "input.h" -#include "memory.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -54,7 +53,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : int iarg = 4; int expand = 0; char **earg; - int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg); + int nargnew = utils::expand_args(FLERR,narg-iarg,&arg[iarg],1,earg,lmp); if (earg != &arg[iarg]) expand = 1; arg = earg; diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index ff227b3590..8086ef3f41 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -12,22 +12,22 @@ ------------------------------------------------------------------------- */ #include "compute_cluster_atom.h" -#include -#include -#include + #include "atom.h" -#include "update.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" +#include "neighbor.h" #include "pair.h" -#include "comm.h" -#include "memory.h" -#include "error.h" +#include "update.h" -#include "group.h" +#include +#include using namespace LAMMPS_NS; @@ -41,7 +41,7 @@ ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : { if (narg != 4) error->all(FLERR,"Illegal compute cluster/atom command"); - double cutoff = force->numeric(FLERR,arg[3]); + double cutoff = utils::numeric(FLERR,arg[3],false,lmp); cutsq = cutoff*cutoff; peratom_flag = 1; diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index 7ab9e8adf2..e9b6f16990 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -16,21 +16,21 @@ ------------------------------------------------------------------------- */ #include "compute_cna_atom.h" -#include -#include -#include + #include "atom.h" -#include "update.h" +#include "comm.h" +#include "error.h" #include "force.h" -#include "pair.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "fmt/format.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -51,7 +51,7 @@ ComputeCNAAtom::ComputeCNAAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; size_peratom_cols = 0; - double cutoff = force->numeric(FLERR,arg[3]); + double cutoff = utils::numeric(FLERR,arg[3],false,lmp); if (cutoff < 0.0) error->all(FLERR,"Illegal compute cna/atom command"); cutsq = cutoff*cutoff; diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index c39911214c..8398311a05 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "compute_com_chunk.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "compute_chunk_atom.h" #include "domain.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index 4a96c29a24..cb919d3a83 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -12,22 +12,23 @@ ------------------------------------------------------------------------- */ #include "compute_coord_atom.h" -#include -#include -#include "compute_orientorder_atom.h" + #include "atom.h" -#include "update.h" -#include "modify.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "force.h" -#include "pair.h" #include "comm.h" +#include "compute_orientorder_atom.h" +#include "error.h" +#include "force.h" #include "group.h" #include "memory.h" -#include "error.h" -#include "utils.h" +#include "modify.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -48,7 +49,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"cutoff") == 0) { cstyle = CUTOFF; - double cutoff = force->numeric(FLERR,arg[4]); + double cutoff = utils::numeric(FLERR,arg[4],false,lmp); cutsq = cutoff*cutoff; int iarg = 5; @@ -75,7 +76,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : } else { ncol = 0; while (iarg < narg) { - force->bounds(FLERR,arg[iarg],ntypes,typelo[ncol],typehi[ncol]); + utils::bounds(FLERR,arg[iarg],1,ntypes,typelo[ncol],typehi[ncol],error); if (typelo[ncol] > typehi[ncol]) error->all(FLERR,"Illegal compute coord/atom command"); ncol++; @@ -97,7 +98,7 @@ ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : if (!utils::strmatch(modify->compute[iorientorder]->style,"^orientorder/atom")) error->all(FLERR,"Compute coord/atom compute ID is not orientorder/atom"); - threshold = force->numeric(FLERR,arg[5]); + threshold = utils::numeric(FLERR,arg[5],false,lmp); if (threshold <= -1.0 || threshold >= 1.0) error->all(FLERR,"Compute coord/atom threshold not between -1 and 1"); diff --git a/src/compute_deprecated.cpp b/src/compute_deprecated.cpp index 2419e5bc8b..4b7e3dae3c 100644 --- a/src/compute_deprecated.cpp +++ b/src/compute_deprecated.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "compute_deprecated.h" -#include + #include "comm.h" #include "error.h" -#include "utils.h" using namespace LAMMPS_NS; diff --git a/src/compute_dihedral.cpp b/src/compute_dihedral.cpp index e50903104a..8853887f18 100644 --- a/src/compute_dihedral.cpp +++ b/src/compute_dihedral.cpp @@ -12,12 +12,12 @@ ------------------------------------------------------------------------- */ #include "compute_dihedral.h" -#include -#include "update.h" -#include "force.h" + #include "dihedral.h" #include "dihedral_hybrid.h" #include "error.h" +#include "force.h" +#include "update.h" using namespace LAMMPS_NS; diff --git a/src/compute_dipole_chunk.cpp b/src/compute_dipole_chunk.cpp index 3790da2035..361ee36c18 100644 --- a/src/compute_dipole_chunk.cpp +++ b/src/compute_dipole_chunk.cpp @@ -12,17 +12,18 @@ ------------------------------------------------------------------------- */ #include "compute_dipole_chunk.h" -#include -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "compute_chunk_atom.h" #include "domain.h" -#include "memory.h" #include "error.h" #include "math_special.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathSpecial; diff --git a/src/compute_displace_atom.cpp b/src/compute_displace_atom.cpp index b20dd3bec3..4b194cfab1 100644 --- a/src/compute_displace_atom.cpp +++ b/src/compute_displace_atom.cpp @@ -12,19 +12,20 @@ ------------------------------------------------------------------------- */ #include "compute_displace_atom.h" + +#include "atom.h" +#include "domain.h" +#include "error.h" +#include "fix_store.h" +#include "group.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + #include #include -#include "atom.h" -#include "update.h" -#include "group.h" -#include "domain.h" -#include "modify.h" -#include "fix_store.h" -#include "input.h" -#include "variable.h" -#include "memory.h" -#include "error.h" -#include "fmt/format.h" using namespace LAMMPS_NS; diff --git a/src/compute_erotate_sphere.cpp b/src/compute_erotate_sphere.cpp index 2a8588f061..447b28b51a 100644 --- a/src/compute_erotate_sphere.cpp +++ b/src/compute_erotate_sphere.cpp @@ -12,11 +12,11 @@ ------------------------------------------------------------------------- */ #include "compute_erotate_sphere.h" -#include + #include "atom.h" -#include "update.h" -#include "force.h" #include "error.h" +#include "force.h" +#include "update.h" using namespace LAMMPS_NS; diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index 664e2fa9ec..db003c93e7 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -16,17 +16,17 @@ ------------------------------------------------------------------------- */ #include "compute_fragment_atom.h" -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "update.h" -#include "modify.h" -#include "force.h" -#include "group.h" #include "comm.h" -#include "memory.h" #include "error.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/compute_global_atom.cpp b/src/compute_global_atom.cpp index f015ec910a..b3e4f88bf3 100644 --- a/src/compute_global_atom.cpp +++ b/src/compute_global_atom.cpp @@ -12,16 +12,17 @@ ------------------------------------------------------------------------- */ #include "compute_global_atom.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "input.h" -#include "variable.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; @@ -80,7 +81,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg); + int nargnew = utils::expand_args(FLERR,narg-iarg,&arg[iarg],1,earg,lmp); if (earg != &arg[iarg]) expand = 1; arg = earg; diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index c8876daeef..ca0483fce9 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "compute_group_group.h" -#include + #include #include #include "atom.h" diff --git a/src/compute_gyration.cpp b/src/compute_gyration.cpp index bce0c0de85..81876109c4 100644 --- a/src/compute_gyration.cpp +++ b/src/compute_gyration.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_gyration.h" -#include + #include "update.h" #include "atom.h" #include "group.h" diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index 5677ce4b6a..ad0520bc01 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_gyration_chunk.h" -#include + #include #include #include "atom.h" diff --git a/src/compute_heat_flux.cpp b/src/compute_heat_flux.cpp index 7b607bd4db..15a17949eb 100644 --- a/src/compute_heat_flux.cpp +++ b/src/compute_heat_flux.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "compute_heat_flux.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index b4ffd91b43..00f81dc845 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -59,7 +59,7 @@ ComputeHexOrderAtom::ComputeHexOrderAtom(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"degree") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute hexorder/atom command"); - ndegree = force->numeric(FLERR,arg[iarg+1]); + ndegree = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (ndegree < 0) error->all(FLERR,"Illegal compute hexorder/atom command"); iarg += 2; @@ -68,14 +68,14 @@ ComputeHexOrderAtom::ComputeHexOrderAtom(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"NULL") == 0) nnn = 0; else { - nnn = force->numeric(FLERR,arg[iarg+1]); + nnn = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (nnn < 0) error->all(FLERR,"Illegal compute hexorder/atom command"); } iarg += 2; } else if (strcmp(arg[iarg],"cutoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute hexorder/atom command"); - double cutoff = force->numeric(FLERR,arg[iarg+1]); + double cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (cutoff <= 0.0) error->all(FLERR,"Illegal compute hexorder/atom command"); cutsq = cutoff*cutoff; diff --git a/src/compute_improper.cpp b/src/compute_improper.cpp index 181771dcfb..3721dbfd48 100644 --- a/src/compute_improper.cpp +++ b/src/compute_improper.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_improper.h" -#include + #include "update.h" #include "force.h" #include "improper.h" diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index be980a08ee..65de1d7bb5 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_inertia_chunk.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_ke.cpp b/src/compute_ke.cpp index c6ba478dcb..e673f7fe53 100644 --- a/src/compute_ke.cpp +++ b/src/compute_ke.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_ke.h" -#include + #include "atom.h" #include "update.h" #include "force.h" diff --git a/src/compute_msd.cpp b/src/compute_msd.cpp index 930f979bf0..d23c389ab6 100644 --- a/src/compute_msd.cpp +++ b/src/compute_msd.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "compute_msd.h" -#include + #include -#include + #include "atom.h" #include "update.h" #include "group.h" @@ -22,7 +22,7 @@ #include "modify.h" #include "fix_store.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index dda921ef42..b0e2520f99 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "compute_msd_chunk.h" -#include + #include -#include + #include "atom.h" #include "group.h" #include "update.h" @@ -24,7 +24,7 @@ #include "fix_store.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 327c64493f..4151b2cdb8 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_omega_chunk.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index c278ccc520..7323b6ef01 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -17,26 +17,25 @@ ------------------------------------------------------------------------- */ #include "compute_orientorder_atom.h" -#include -#include -#include + #include "atom.h" -#include "update.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" #include "neigh_list.h" #include "neigh_request.h" -#include "force.h" +#include "neighbor.h" #include "pair.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "math_const.h" -#include "fmt/format.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; -using namespace std; #ifdef DBL_EPSILON #define MY_EPSILON (10.0*DBL_EPSILON) @@ -85,7 +84,7 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg if (strcmp(arg[iarg+1],"NULL") == 0) { nnn = 0; } else { - nnn = force->numeric(FLERR,arg[iarg+1]); + nnn = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (nnn <= 0) error->all(FLERR,"Illegal compute orientorder/atom command"); } @@ -93,7 +92,7 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg } else if (strcmp(arg[iarg],"degrees") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command"); - nqlist = force->numeric(FLERR,arg[iarg+1]); + nqlist = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (nqlist <= 0) error->all(FLERR,"Illegal compute orientorder/atom command"); memory->destroy(qlist); @@ -103,7 +102,7 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg error->all(FLERR,"Illegal compute orientorder/atom command"); qmax = 0; for (int il = 0; il < nqlist; il++) { - qlist[il] = force->numeric(FLERR,arg[iarg+il]); + qlist[il] = utils::numeric(FLERR,arg[iarg+il],false,lmp); if (qlist[il] < 0) error->all(FLERR,"Illegal compute orientorder/atom command"); if (qlist[il] > qmax) qmax = qlist[il]; @@ -127,7 +126,7 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg qlcompflag = 1; if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command"); - qlcomp = force->numeric(FLERR,arg[iarg+1]); + qlcomp = utils::numeric(FLERR,arg[iarg+1],false,lmp); iqlcomp = -1; for (int il = 0; il < nqlist; il++) if (qlcomp == qlist[il]) { @@ -140,7 +139,7 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg } else if (strcmp(arg[iarg],"cutoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command"); - double cutoff = force->numeric(FLERR,arg[iarg+1]); + double cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (cutoff <= 0.0) error->all(FLERR,"Illegal compute orientorder/atom command"); cutsq = cutoff*cutoff; @@ -148,7 +147,7 @@ ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg } else if (strcmp(arg[iarg],"chunksize") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute orientorder/atom command"); - chunksize = force->numeric(FLERR,arg[iarg+1]); + chunksize = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (chunksize <= 0) error->all(FLERR,"Illegal compute orientorder/atom command"); iarg += 2; diff --git a/src/compute_pair.cpp b/src/compute_pair.cpp index e9a3faf723..7ace5615a7 100644 --- a/src/compute_pair.cpp +++ b/src/compute_pair.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_pair.h" -#include + #include #include #include "update.h" @@ -48,7 +48,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : if (narg > iarg) { if (isdigit(arg[iarg][0])) { - nsub = force->inumeric(FLERR,arg[iarg]); + nsub = utils::inumeric(FLERR,arg[iarg],false,lmp); ++iarg; if (nsub <= 0) error->all(FLERR,"Illegal compute pair command"); diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index 2018d929f3..e41221f70b 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -12,18 +12,19 @@ ------------------------------------------------------------------------- */ #include "compute_pair_local.h" + +#include "atom.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "update.h" + #include #include -#include -#include "atom.h" -#include "update.h" -#include "force.h" -#include "pair.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; diff --git a/src/compute_pe.cpp b/src/compute_pe.cpp index 379de0f9de..d9ed312328 100644 --- a/src/compute_pe.cpp +++ b/src/compute_pe.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_pe.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index cb0743a7d6..90e4f9b39c 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -12,23 +12,24 @@ ------------------------------------------------------------------------- */ #include "compute_pressure.h" -#include -#include + +#include "angle.h" #include "atom.h" -#include "update.h" +#include "bond.h" +#include "dihedral.h" #include "domain.h" -#include "modify.h" +#include "error.h" #include "fix.h" #include "force.h" -#include "pair.h" -#include "pair_hybrid.h" -#include "bond.h" -#include "angle.h" -#include "dihedral.h" #include "improper.h" #include "kspace.h" -#include "error.h" +#include "modify.h" +#include "pair.h" +#include "pair_hybrid.h" +#include "update.h" +#include +#include using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -90,7 +91,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : if (narg > iarg) { if (isdigit(arg[iarg][0])) { - nsub = force->inumeric(FLERR,arg[iarg]); + nsub = utils::inumeric(FLERR,arg[iarg],false,lmp); ++iarg; if (nsub <= 0) error->all(FLERR,"Illegal compute pressure command"); diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index 579c7cae3f..c27cfc4096 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_property_chunk.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index 501a506c98..a28223b3a7 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_rdf.h" -#include + #include #include #include "atom.h" @@ -33,6 +33,7 @@ #include "error.h" #include "comm.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -49,7 +50,7 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : array_flag = 1; extarray = 0; - nbin = force->inumeric(FLERR,arg[3]); + nbin = utils::inumeric(FLERR,arg[3],false,lmp); if (nbin < 1) error->all(FLERR,"Illegal compute rdf command"); // optional args @@ -66,7 +67,7 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"cutoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute rdf command"); - cutoff_user = force->numeric(FLERR,arg[iarg+1]); + cutoff_user = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (cutoff_user <= 0.0) cutflag = 0; else cutflag = 1; iarg += 2; @@ -98,8 +99,8 @@ ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : } else { iarg = 4; for (int ipair = 0; ipair < npairs; ipair++) { - force->bounds(FLERR,arg[iarg],atom->ntypes,ilo[ipair],ihi[ipair]); - force->bounds(FLERR,arg[iarg+1],atom->ntypes,jlo[ipair],jhi[ipair]); + utils::bounds(FLERR,arg[iarg],1,atom->ntypes,ilo[ipair],ihi[ipair],error); + utils::bounds(FLERR,arg[iarg+1],1,atom->ntypes,jlo[ipair],jhi[ipair],error); if (ilo[ipair] > ihi[ipair] || jlo[ipair] > jhi[ipair]) error->all(FLERR,"Illegal compute rdf command"); iarg += 2; diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index 8467554faa..b024b4365c 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "compute_reduce.h" -#include + #include -#include + #include "atom.h" #include "update.h" #include "domain.h" @@ -26,6 +26,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; enum{SUM,SUMSQ,MINN,MAXX,AVE,AVESQ}; // also in ComputeReduceRegion @@ -78,7 +79,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg); + int nargnew = utils::expand_args(FLERR,narg-iarg,&arg[iarg],1,earg,lmp); if (earg != &arg[iarg]) expand = 1; arg = earg; diff --git a/src/compute_reduce.h b/src/compute_reduce.h index 9701f0e61e..00c1a9a6b9 100644 --- a/src/compute_reduce.h +++ b/src/compute_reduce.h @@ -20,7 +20,7 @@ ComputeStyle(reduce,ComputeReduce) #ifndef LMP_COMPUTE_REDUCE_H #define LMP_COMPUTE_REDUCE_H -#include "compute.h" +#include "compute.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/compute_reduce_chunk.cpp b/src/compute_reduce_chunk.cpp index 3b68e20fcb..6e8aa48410 100644 --- a/src/compute_reduce_chunk.cpp +++ b/src/compute_reduce_chunk.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "compute_reduce_chunk.h" -#include + #include -#include + #include "atom.h" #include "update.h" #include "modify.h" @@ -26,6 +26,7 @@ #include "memory.h" #include "error.h" + using namespace LAMMPS_NS; enum{SUM,MINN,MAXX}; @@ -64,7 +65,7 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - int nargnew = input->expand_args(narg-iarg,&arg[iarg],1,earg); + int nargnew = utils::expand_args(FLERR,narg-iarg,&arg[iarg],1,earg,lmp); if (earg != &arg[iarg]) expand = 1; arg = earg; diff --git a/src/compute_reduce_region.cpp b/src/compute_reduce_region.cpp index 9074124a61..8153618a88 100644 --- a/src/compute_reduce_region.cpp +++ b/src/compute_reduce_region.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_reduce_region.h" -#include + #include "atom.h" #include "update.h" #include "modify.h" diff --git a/src/compute_slice.cpp b/src/compute_slice.cpp index 67b60882f6..ca4b735d6e 100644 --- a/src/compute_slice.cpp +++ b/src/compute_slice.cpp @@ -12,17 +12,16 @@ ------------------------------------------------------------------------- */ #include "compute_slice.h" -#include -#include -#include -#include "update.h" -#include "modify.h" + +#include "error.h" #include "fix.h" #include "input.h" -#include "variable.h" #include "memory.h" -#include "error.h" -#include "force.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; @@ -41,9 +40,9 @@ ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nstart = force->inumeric(FLERR,arg[3]); - nstop = force->inumeric(FLERR,arg[4]); - nskip = force->inumeric(FLERR,arg[5]); + nstart = utils::inumeric(FLERR,arg[3],false,lmp); + nstop = utils::inumeric(FLERR,arg[4],false,lmp); + nskip = utils::inumeric(FLERR,arg[5],false,lmp); if (nstart < 1 || nstop < nstart || nskip < 1) error->all(FLERR,"Illegal compute slice command"); diff --git a/src/compute_temp.cpp b/src/compute_temp.cpp index 402b84bb4b..6af5d2b86c 100644 --- a/src/compute_temp.cpp +++ b/src/compute_temp.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp.h" -#include + #include "atom.h" #include "update.h" #include "force.h" diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 0fa5bbbb8a..54f0529006 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_chunk.h" -#include + #include #include "atom.h" #include "update.h" @@ -94,12 +94,12 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"adof") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command"); - adof = force->numeric(FLERR,arg[iarg+1]); + adof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"cdof") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/chunk command"); - cdof = force->numeric(FLERR,arg[iarg+1]); + cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else error->all(FLERR,"Illegal compute temp/chunk command"); } diff --git a/src/compute_temp_com.cpp b/src/compute_temp_com.cpp index dc12e8f6db..f69eaadf2b 100644 --- a/src/compute_temp_com.cpp +++ b/src/compute_temp_com.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_com.h" -#include + #include "atom.h" #include "update.h" #include "force.h" diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index 7d81a84bc4..b50962a2c6 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_deform.h" -#include + #include #include "domain.h" #include "atom.h" diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index f5f29d9dc0..85e51d2a5d 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_partial.h" -#include + #include "atom.h" #include "update.h" #include "force.h" @@ -37,9 +37,9 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 1; - xflag = force->inumeric(FLERR,arg[3]); - yflag = force->inumeric(FLERR,arg[4]); - zflag = force->inumeric(FLERR,arg[5]); + xflag = utils::inumeric(FLERR,arg[3],false,lmp); + yflag = utils::inumeric(FLERR,arg[4],false,lmp); + zflag = utils::inumeric(FLERR,arg[5],false,lmp); if ((xflag != 0 && xflag != 1) || (yflag != 0 && yflag != 1) || (zflag != 0 && zflag != 1)) error->all(FLERR,"Illegal compute temp/partial command"); diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index fce145848e..eacca87e19 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_profile.h" -#include + #include #include "atom.h" #include "update.h" @@ -39,9 +39,9 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 1; - xflag = force->inumeric(FLERR,arg[3]); - yflag = force->inumeric(FLERR,arg[4]); - zflag = force->inumeric(FLERR,arg[5]); + xflag = utils::inumeric(FLERR,arg[3],false,lmp); + yflag = utils::inumeric(FLERR,arg[4],false,lmp); + zflag = utils::inumeric(FLERR,arg[5],false,lmp); if (zflag && domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot use vz for 2d systemx"); @@ -57,44 +57,44 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : int iarg = 6; if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/profile command"); - nbinx = force->inumeric(FLERR,arg[iarg+1]); + nbinx = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/profile command"); - nbiny = force->inumeric(FLERR,arg[iarg+1]); + nbiny = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbinz = force->inumeric(FLERR,arg[iarg+1]); + nbinz = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal compute temp/profile command"); - nbinx = force->inumeric(FLERR,arg[iarg+1]); - nbiny = force->inumeric(FLERR,arg[iarg+2]); + nbinx = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + nbiny = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbiny = force->inumeric(FLERR,arg[iarg+1]); - nbinz = force->inumeric(FLERR,arg[iarg+2]); + nbiny = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + nbinz = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbinx = force->inumeric(FLERR,arg[iarg+1]); - nbinz = force->inumeric(FLERR,arg[iarg+2]); + nbinx = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + nbinz = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"xyz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal compute temp/profile command"); if (domain->dimension == 2) error->all(FLERR,"Compute temp/profile cannot bin z for 2d systems"); - nbinx = force->inumeric(FLERR,arg[iarg+1]); - nbiny = force->inumeric(FLERR,arg[iarg+2]); - nbinz = force->inumeric(FLERR,arg[iarg+3]); + nbinx = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + nbiny = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + nbinz = utils::inumeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else error->all(FLERR,"Illegal compute temp/profile command"); diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index 30f6701fcd..3874c1f286 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_ramp.h" -#include + #include #include "atom.h" #include "update.h" @@ -71,14 +71,14 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal compute temp/ramp command"); if (v_dim == 0) { - v_lo = xscale*force->numeric(FLERR,arg[4]); - v_hi = xscale*force->numeric(FLERR,arg[5]); + v_lo = xscale*utils::numeric(FLERR,arg[4],false,lmp); + v_hi = xscale*utils::numeric(FLERR,arg[5],false,lmp); } else if (v_dim == 1) { - v_lo = yscale*force->numeric(FLERR,arg[4]); - v_hi = yscale*force->numeric(FLERR,arg[5]); + v_lo = yscale*utils::numeric(FLERR,arg[4],false,lmp); + v_hi = yscale*utils::numeric(FLERR,arg[5],false,lmp); } else if (v_dim == 2) { - v_lo = zscale*force->numeric(FLERR,arg[4]); - v_hi = zscale*force->numeric(FLERR,arg[5]); + v_lo = zscale*utils::numeric(FLERR,arg[4],false,lmp); + v_hi = zscale*utils::numeric(FLERR,arg[5],false,lmp); } if (strcmp(arg[6],"x") == 0) coord_dim = 0; @@ -87,14 +87,14 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal compute temp/ramp command"); if (coord_dim == 0) { - coord_lo = xscale*force->numeric(FLERR,arg[7]); - coord_hi = xscale*force->numeric(FLERR,arg[8]); + coord_lo = xscale*utils::numeric(FLERR,arg[7],false,lmp); + coord_hi = xscale*utils::numeric(FLERR,arg[8],false,lmp); } else if (coord_dim == 1) { - coord_lo = yscale*force->numeric(FLERR,arg[7]); - coord_hi = yscale*force->numeric(FLERR,arg[8]); + coord_lo = yscale*utils::numeric(FLERR,arg[7],false,lmp); + coord_hi = yscale*utils::numeric(FLERR,arg[8],false,lmp); } else if (coord_dim == 2) { - coord_lo = zscale*force->numeric(FLERR,arg[7]); - coord_hi = zscale*force->numeric(FLERR,arg[8]); + coord_lo = zscale*utils::numeric(FLERR,arg[7],false,lmp); + coord_hi = zscale*utils::numeric(FLERR,arg[8],false,lmp); } maxbias = 0; diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index 4c0b925eb6..74955da421 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_region.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_temp_sphere.cpp b/src/compute_temp_sphere.cpp index 786ef523ad..6ef3038d68 100644 --- a/src/compute_temp_sphere.cpp +++ b/src/compute_temp_sphere.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_temp_sphere.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index 35eef8fe10..c0b648418b 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_torque_chunk.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index ec19137a0e..635c3e4161 100644 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -12,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "compute_vacf.h" -#include + #include -#include + #include "atom.h" #include "update.h" #include "group.h" #include "modify.h" #include "fix_store.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index b0a8dbeee7..6651110e77 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "compute_vcm_chunk.h" -#include + #include #include "atom.h" #include "update.h" diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index de20e15698..7e84e9cce0 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -16,31 +16,27 @@ ------------------------------------------------------------------------- */ #include "create_atoms.h" -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "molecule.h" #include "comm.h" -#include "irregular.h" -#include "modify.h" -#include "force.h" -#include "special.h" #include "domain.h" -#include "lattice.h" -#include "region.h" -#include "input.h" -#include "variable.h" -#include "random_park.h" -#include "random_mars.h" -#include "math_extra.h" -#include "math_const.h" #include "error.h" +#include "input.h" +#include "irregular.h" +#include "lattice.h" +#include "math_const.h" +#include "math_extra.h" #include "memory.h" +#include "modify.h" +#include "molecule.h" +#include "random_mars.h" +#include "random_park.h" +#include "region.h" +#include "special.h" +#include "variable.h" -#include -#include "utils.h" -#include "fmt/format.h" +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -88,7 +84,7 @@ void CreateAtoms::command(int narg, char **arg) // parse arguments if (narg < 2) error->all(FLERR,"Illegal create_atoms command"); - ntype = force->inumeric(FLERR,arg[0]); + ntype = utils::inumeric(FLERR,arg[0],false,lmp); int iarg; if (strcmp(arg[1],"box") == 0) { @@ -107,15 +103,15 @@ void CreateAtoms::command(int narg, char **arg) } else if (strcmp(arg[1],"single") == 0) { style = SINGLE; if (narg < 5) error->all(FLERR,"Illegal create_atoms command"); - xone[0] = force->numeric(FLERR,arg[2]); - xone[1] = force->numeric(FLERR,arg[3]); - xone[2] = force->numeric(FLERR,arg[4]); + xone[0] = utils::numeric(FLERR,arg[2],false,lmp); + xone[1] = utils::numeric(FLERR,arg[3],false,lmp); + xone[2] = utils::numeric(FLERR,arg[4],false,lmp); iarg = 5; } else if (strcmp(arg[1],"random") == 0) { style = RANDOM; if (narg < 5) error->all(FLERR,"Illegal create_atoms command"); - nrandom = force->inumeric(FLERR,arg[2]); - seed = force->inumeric(FLERR,arg[3]); + nrandom = utils::inumeric(FLERR,arg[2],false,lmp); + seed = utils::inumeric(FLERR,arg[3],false,lmp); if (strcmp(arg[4],"NULL") == 0) nregion = -1; else { nregion = domain->find_region(arg[4]); @@ -146,8 +142,8 @@ void CreateAtoms::command(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"basis") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); - int ibasis = force->inumeric(FLERR,arg[iarg+1]); - int itype = force->inumeric(FLERR,arg[iarg+2]); + int ibasis = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + int itype = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (ibasis <= 0 || ibasis > nbasis || itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Invalid basis setting in create_atoms command"); basistype[ibasis-1] = itype; @@ -168,7 +164,7 @@ void CreateAtoms::command(int narg, char **arg) "create_atoms has multiple molecules"); mode = MOLECULE; onemol = atom->molecules[imol]; - molseed = force->inumeric(FLERR,arg[iarg+2]); + molseed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"units") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command"); @@ -207,10 +203,10 @@ void CreateAtoms::command(int narg, char **arg) if (iarg+5 > narg) error->all(FLERR,"Illegal create_atoms command"); double thetaone; double axisone[3]; - thetaone = force->numeric(FLERR,arg[iarg+1]) / 180.0 * MY_PI;; - axisone[0] = force->numeric(FLERR,arg[iarg+2]); - axisone[1] = force->numeric(FLERR,arg[iarg+3]); - axisone[2] = force->numeric(FLERR,arg[iarg+4]); + thetaone = utils::numeric(FLERR,arg[iarg+1],false,lmp) / 180.0 * MY_PI;; + axisone[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + axisone[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + axisone[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (axisone[0] == 0.0 && axisone[1] == 0.0 && axisone[2] == 0.0) error->all(FLERR,"Illegal create_atoms command"); if (domain->dimension == 2 && (axisone[0] != 0.0 || axisone[1] != 0.0)) @@ -221,16 +217,16 @@ void CreateAtoms::command(int narg, char **arg) } else if (strcmp(arg[iarg],"ratio") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); subsetflag = RATIO; - subsetfrac = force->numeric(FLERR,arg[iarg+1]); - subsetseed = force->inumeric(FLERR,arg[iarg+2]); + subsetfrac = utils::numeric(FLERR,arg[iarg+1],false,lmp); + subsetseed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (subsetfrac <= 0.0 || subsetfrac > 1.0 || subsetseed <= 0) error->all(FLERR,"Illegal create_atoms command"); iarg += 3; } else if (strcmp(arg[iarg],"subset") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); subsetflag = SUBSET; - nsubset = force->bnumeric(FLERR,arg[iarg+1]); - subsetseed = force->inumeric(FLERR,arg[iarg+2]); + nsubset = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); + subsetseed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nsubset <= 0 || subsetseed <= 0) error->all(FLERR,"Illegal create_atoms command"); iarg += 3; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index e210a5e061..9e3eb65801 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -18,21 +18,19 @@ ------------------------------------------------------------------------- */ #include "create_bonds.h" -#include -#include -#include + #include "atom.h" -#include "domain.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list.h" #include "comm.h" -#include "group.h" -#include "special.h" +#include "domain.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "force.h" +#include "group.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "special.h" + +#include using namespace LAMMPS_NS; @@ -69,38 +67,38 @@ void CreateBonds::command(int narg, char **arg) igroup = group->find(arg[2]); if (igroup == -1) error->all(FLERR,"Cannot find create_bonds group ID"); group2bit = group->bitmask[igroup]; - btype = force->inumeric(FLERR,arg[3]); - rmin = force->numeric(FLERR,arg[4]); - rmax = force->numeric(FLERR,arg[5]); + btype = utils::inumeric(FLERR,arg[3],false,lmp); + rmin = utils::numeric(FLERR,arg[4],false,lmp); + rmax = utils::numeric(FLERR,arg[5],false,lmp); if (rmin > rmax) error->all(FLERR,"Illegal create_bonds command"); iarg = 6; } else if (strcmp(arg[0],"single/bond") == 0) { style = SBOND; if (narg < 4) error->all(FLERR,"Illegal create_bonds command"); - btype = force->inumeric(FLERR,arg[1]); - batom1 = force->tnumeric(FLERR,arg[2]); - batom2 = force->tnumeric(FLERR,arg[3]); + btype = utils::inumeric(FLERR,arg[1],false,lmp); + batom1 = utils::tnumeric(FLERR,arg[2],false,lmp); + batom2 = utils::tnumeric(FLERR,arg[3],false,lmp); if (batom1 == batom2) error->all(FLERR,"Illegal create_bonds command"); iarg = 4; } else if (strcmp(arg[0],"single/angle") == 0) { style = SANGLE; if (narg < 5) error->all(FLERR,"Illegal create_bonds command"); - atype = force->inumeric(FLERR,arg[1]); - aatom1 = force->tnumeric(FLERR,arg[2]); - aatom2 = force->tnumeric(FLERR,arg[3]); - aatom3 = force->tnumeric(FLERR,arg[4]); + atype = utils::inumeric(FLERR,arg[1],false,lmp); + aatom1 = utils::tnumeric(FLERR,arg[2],false,lmp); + aatom2 = utils::tnumeric(FLERR,arg[3],false,lmp); + aatom3 = utils::tnumeric(FLERR,arg[4],false,lmp); if ((aatom1 == aatom2) || (aatom1 == aatom3) || (aatom2 == aatom3)) error->all(FLERR,"Illegal create_bonds command"); iarg = 5; } else if (strcmp(arg[0],"single/dihedral") == 0) { style = SDIHEDRAL; if (narg < 6) error->all(FLERR,"Illegal create_bonds command"); - dtype = force->inumeric(FLERR,arg[1]); - datom1 = force->tnumeric(FLERR,arg[2]); - datom2 = force->tnumeric(FLERR,arg[3]); - datom3 = force->tnumeric(FLERR,arg[4]); - datom4 = force->tnumeric(FLERR,arg[5]); + dtype = utils::inumeric(FLERR,arg[1],false,lmp); + datom1 = utils::tnumeric(FLERR,arg[2],false,lmp); + datom2 = utils::tnumeric(FLERR,arg[3],false,lmp); + datom3 = utils::tnumeric(FLERR,arg[4],false,lmp); + datom4 = utils::tnumeric(FLERR,arg[5],false,lmp); if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) || (datom2 == datom3) || (datom2 == datom4) || (datom3 == datom4)) error->all(FLERR,"Illegal create_bonds command"); @@ -108,11 +106,11 @@ void CreateBonds::command(int narg, char **arg) } else if (strcmp(arg[0],"single/improper") == 0) { style = SIMPROPER; if (narg < 6) error->all(FLERR,"Illegal create_bonds command"); - dtype = force->inumeric(FLERR,arg[1]); - datom1 = force->tnumeric(FLERR,arg[2]); - datom2 = force->tnumeric(FLERR,arg[3]); - datom3 = force->tnumeric(FLERR,arg[4]); - datom4 = force->tnumeric(FLERR,arg[5]); + dtype = utils::inumeric(FLERR,arg[1],false,lmp); + datom1 = utils::tnumeric(FLERR,arg[2],false,lmp); + datom2 = utils::tnumeric(FLERR,arg[3],false,lmp); + datom3 = utils::tnumeric(FLERR,arg[4],false,lmp); + datom4 = utils::tnumeric(FLERR,arg[5],false,lmp); if ((datom1 == datom2) || (datom1 == datom3) || (datom1 == datom4) || (datom2 == datom3) || (datom2 == datom4) || (datom3 == datom4)) error->all(FLERR,"Illegal create_bonds command"); diff --git a/src/create_box.cpp b/src/create_box.cpp index 4a826cb691..f5d9edb844 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -96,7 +96,7 @@ void CreateBox::command(int narg, char **arg) // set atom and topology type quantities - atom->ntypes = force->inumeric(FLERR,arg[0]); + atom->ntypes = utils::inumeric(FLERR,arg[0],false,lmp); atom->nbondtypes = 0; atom->nangletypes = 0; atom->ndihedraltypes = 0; @@ -110,53 +110,53 @@ void CreateBox::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->bonds_allow) error->all(FLERR,"No bonds allowed with this atom style"); - atom->nbondtypes = force->inumeric(FLERR,arg[iarg+1]); + atom->nbondtypes = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"angle/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->angles_allow) error->all(FLERR,"No angles allowed with this atom style"); - atom->nangletypes = force->inumeric(FLERR,arg[iarg+1]); + atom->nangletypes = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"dihedral/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->dihedrals_allow) error->all(FLERR,"No dihedrals allowed with this atom style"); - atom->ndihedraltypes = force->inumeric(FLERR,arg[iarg+1]); + atom->ndihedraltypes = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"improper/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->impropers_allow) error->all(FLERR,"No impropers allowed with this atom style"); - atom->nimpropertypes = force->inumeric(FLERR,arg[iarg+1]); + atom->nimpropertypes = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"extra/bond/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->bonds_allow) error->all(FLERR,"No bonds allowed with this atom style"); - atom->bond_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->bond_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"extra/angle/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->angles_allow) error->all(FLERR,"No angles allowed with this atom style"); - atom->angle_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->angle_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"extra/dihedral/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->dihedrals_allow) error->all(FLERR,"No dihedrals allowed with this atom style"); - atom->dihedral_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->dihedral_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"extra/improper/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); if (!atom->avec->impropers_allow) error->all(FLERR,"No impropers allowed with this atom style"); - atom->improper_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->improper_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"extra/special/per/atom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal create_box command"); - force->special_extra = force->inumeric(FLERR,arg[iarg+1]); + force->special_extra = utils::inumeric(FLERR,arg[iarg+1],false,lmp); atom->maxspecial += force->special_extra; iarg += 2; } else error->all(FLERR,"Illegal create_box command"); diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 03d5d2f65d..8baee645cf 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -12,33 +12,30 @@ ------------------------------------------------------------------------- */ #include "delete_atoms.h" -#include -#include -#include + #include "atom.h" #include "atom_vec.h" +#include "atom_vec_body.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" -#include "atom_vec_body.h" -#include "molecule.h" #include "comm.h" #include "domain.h" +#include "error.h" #include "force.h" #include "group.h" -#include "region.h" +#include "memory.h" #include "modify.h" -#include "neighbor.h" +#include "molecule.h" #include "neigh_list.h" #include "neigh_request.h" +#include "neighbor.h" #include "random_mars.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "region.h" +#include #include -#include +#include using namespace LAMMPS_NS; @@ -270,7 +267,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // read args - double cut = force->numeric(FLERR,arg[1]); + double cut = utils::numeric(FLERR,arg[1],false,lmp); double cutsq = cut*cut; int igroup1 = group->find(arg[2]); @@ -430,8 +427,8 @@ void DeleteAtoms::delete_porosity(int narg, char **arg) if (iregion == -1) error->all(FLERR,"Could not find delete_atoms region ID"); domain->regions[iregion]->prematch(); - double porosity_fraction = force->numeric(FLERR,arg[2]); - int seed = force->inumeric(FLERR,arg[3]); + double porosity_fraction = utils::numeric(FLERR,arg[2],false,lmp); + int seed = utils::inumeric(FLERR,arg[3],false,lmp); options(narg-4,&arg[4]); RanMars *random = new RanMars(lmp,seed + comm->me); diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index 7b9260bc52..b8ec5f7883 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -12,20 +12,17 @@ ------------------------------------------------------------------------- */ #include "delete_bonds.h" -#include -#include -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "domain.h" #include "comm.h" +#include "domain.h" +#include "error.h" #include "force.h" #include "group.h" #include "special.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; @@ -75,7 +72,7 @@ void DeleteBonds::command(int narg, char **arg) else error->all(FLERR,"Illegal delete_bonds command"); // setup list of types (atom,bond,etc) to consider - // use force->bounds(FLERR,) to allow setting of range of types + // use utils::bounds(FLERR,) to allow setting of range of types // range can be 0 to ntypes inclusive int *tlist = NULL; @@ -94,7 +91,7 @@ void DeleteBonds::command(int narg, char **arg) tlist = new int[n+1]; for (int i = 0; i <= n; i++) tlist[i] = 0; int nlo,nhi; - force->bounds(FLERR,arg[2],n,nlo,nhi,0); + utils::bounds(FLERR,arg[2],0,n,nlo,nhi,error); for (int i = nlo; i <= nhi; i++) tlist[i] = 1; iarg++; diff --git a/src/deprecated.cpp b/src/deprecated.cpp index dc0ab400d4..ab9cc8cf44 100644 --- a/src/deprecated.cpp +++ b/src/deprecated.cpp @@ -16,11 +16,10 @@ ------------------------------------------------------------------------- */ #include "deprecated.h" -#include + #include "comm.h" #include "error.h" #include "input.h" -#include "utils.h" using namespace LAMMPS_NS; diff --git a/src/dihedral_deprecated.cpp b/src/dihedral_deprecated.cpp index 1709f7d3d7..91ef3e8e9e 100644 --- a/src/dihedral_deprecated.cpp +++ b/src/dihedral_deprecated.cpp @@ -16,12 +16,12 @@ ------------------------------------------------------------------------- */ #include "dihedral_deprecated.h" -#include -#include "dihedral_hybrid.h" + #include "comm.h" -#include "force.h" +#include "dihedral_hybrid.h" #include "error.h" -#include "utils.h" +#include "force.h" + using namespace LAMMPS_NS; diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index ca5c90093c..61e0fdc72a 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "dihedral_hybrid.h" -#include + #include #include #include "atom.h" @@ -21,7 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -255,7 +255,7 @@ void DihedralHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); // 2nd arg = dihedral sub-style name // allow for "none" or "skip" as valid sub-style name diff --git a/src/dihedral_zero.cpp b/src/dihedral_zero.cpp index daf46fe79a..9570590c09 100644 --- a/src/dihedral_zero.cpp +++ b/src/dihedral_zero.cpp @@ -16,11 +16,12 @@ ------------------------------------------------------------------------- */ #include "dihedral_zero.h" -#include + #include "atom.h" -#include "force.h" -#include "memory.h" #include "error.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; @@ -80,7 +81,7 @@ void DihedralZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ndihedraltypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ndihedraltypes,ilo,ihi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 82b7bf9492..018288d470 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -12,30 +12,28 @@ ------------------------------------------------------------------------- */ #include "displace_atoms.h" -#include -#include -#include + #include "atom.h" -#include "modify.h" -#include "domain.h" -#include "lattice.h" -#include "comm.h" -#include "irregular.h" -#include "group.h" -#include "math_const.h" -#include "random_park.h" -#include "force.h" -#include "input.h" -#include "variable.h" +#include "atom_vec_body.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" -#include "atom_vec_body.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "group.h" +#include "input.h" +#include "irregular.h" +#include "lattice.h" +#include "math_const.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" +#include "random_park.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -128,14 +126,14 @@ void DisplaceAtoms::command(int narg, char **arg) double d_lo,d_hi; if (d_dim == 0) { - d_lo = xscale*force->numeric(FLERR,arg[3]); - d_hi = xscale*force->numeric(FLERR,arg[4]); + d_lo = xscale*utils::numeric(FLERR,arg[3],false,lmp); + d_hi = xscale*utils::numeric(FLERR,arg[4],false,lmp); } else if (d_dim == 1) { - d_lo = yscale*force->numeric(FLERR,arg[3]); - d_hi = yscale*force->numeric(FLERR,arg[4]); + d_lo = yscale*utils::numeric(FLERR,arg[3],false,lmp); + d_hi = yscale*utils::numeric(FLERR,arg[4],false,lmp); } else if (d_dim == 2) { - d_lo = zscale*force->numeric(FLERR,arg[3]); - d_hi = zscale*force->numeric(FLERR,arg[4]); + d_lo = zscale*utils::numeric(FLERR,arg[3],false,lmp); + d_hi = zscale*utils::numeric(FLERR,arg[4],false,lmp); } int coord_dim = 0; @@ -146,14 +144,14 @@ void DisplaceAtoms::command(int narg, char **arg) double coord_lo,coord_hi; if (coord_dim == 0) { - coord_lo = xscale*force->numeric(FLERR,arg[6]); - coord_hi = xscale*force->numeric(FLERR,arg[7]); + coord_lo = xscale*utils::numeric(FLERR,arg[6],false,lmp); + coord_hi = xscale*utils::numeric(FLERR,arg[7],false,lmp); } else if (coord_dim == 1) { - coord_lo = yscale*force->numeric(FLERR,arg[6]); - coord_hi = yscale*force->numeric(FLERR,arg[7]); + coord_lo = yscale*utils::numeric(FLERR,arg[6],false,lmp); + coord_hi = yscale*utils::numeric(FLERR,arg[7],false,lmp); } else if (coord_dim == 2) { - coord_lo = zscale*force->numeric(FLERR,arg[6]); - coord_hi = zscale*force->numeric(FLERR,arg[7]); + coord_lo = zscale*utils::numeric(FLERR,arg[6],false,lmp); + coord_hi = zscale*utils::numeric(FLERR,arg[7],false,lmp); } double **x = atom->x; @@ -179,10 +177,10 @@ void DisplaceAtoms::command(int narg, char **arg) if (style == RANDOM) { RanPark *random = new RanPark(lmp,1); - double dx = xscale*force->numeric(FLERR,arg[2]); - double dy = yscale*force->numeric(FLERR,arg[3]); - double dz = zscale*force->numeric(FLERR,arg[4]); - int seed = force->inumeric(FLERR,arg[5]); + double dx = xscale*utils::numeric(FLERR,arg[2],false,lmp); + double dy = yscale*utils::numeric(FLERR,arg[3],false,lmp); + double dz = zscale*utils::numeric(FLERR,arg[4],false,lmp); + int seed = utils::inumeric(FLERR,arg[5],false,lmp); if (seed <= 0) error->all(FLERR,"Illegal displace_atoms random command"); double **x = atom->x; @@ -219,13 +217,13 @@ void DisplaceAtoms::command(int narg, char **arg) double *quat; int dim = domain->dimension; - point[0] = xscale*force->numeric(FLERR,arg[2]); - point[1] = yscale*force->numeric(FLERR,arg[3]); - point[2] = zscale*force->numeric(FLERR,arg[4]); - axis[0] = force->numeric(FLERR,arg[5]); - axis[1] = force->numeric(FLERR,arg[6]); - axis[2] = force->numeric(FLERR,arg[7]); - double theta = force->numeric(FLERR,arg[8]); + point[0] = xscale*utils::numeric(FLERR,arg[2],false,lmp); + point[1] = yscale*utils::numeric(FLERR,arg[3],false,lmp); + point[2] = zscale*utils::numeric(FLERR,arg[4],false,lmp); + axis[0] = utils::numeric(FLERR,arg[5],false,lmp); + axis[1] = utils::numeric(FLERR,arg[6],false,lmp); + axis[2] = utils::numeric(FLERR,arg[7],false,lmp); + double theta = utils::numeric(FLERR,arg[8],false,lmp); if (dim == 2 && (axis[0] != 0.0 || axis[1] != 0.0)) error->all(FLERR,"Invalid displace_atoms rotate axis for 2d"); @@ -372,7 +370,7 @@ void DisplaceAtoms::move(int idim, char *arg, double scale) int nlocal = atom->nlocal; if (strstr(arg,"v_") != arg) { - double delta = scale*force->numeric(FLERR,arg); + double delta = scale*utils::numeric(FLERR,arg,false,lmp); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += delta; diff --git a/src/domain.cpp b/src/domain.cpp index 81de88d1ee..984c735a20 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -16,30 +16,28 @@ ------------------------------------------------------------------------- */ #include "domain.h" -#include -#include -#include -#include -#include "style_region.h" +#include "style_region.h" // IWYU pragma: keep + #include "atom.h" #include "atom_vec.h" -#include "molecule.h" -#include "force.h" -#include "kspace.h" -#include "update.h" -#include "modify.h" +#include "comm.h" +#include "error.h" #include "fix.h" #include "fix_deform.h" -#include "region.h" +#include "force.h" +#include "kspace.h" #include "lattice.h" -#include "comm.h" +#include "memory.h" +#include "modify.h" +#include "molecule.h" #include "output.h" +#include "region.h" #include "thermo.h" #include "universe.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -108,7 +106,8 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) #define REGION_CLASS #define RegionStyle(key,Class) \ (*region_map)[#key] = ®ion_creator; -#include "style_region.h" +#include "style_region.h" // IWYU pragma: keep + #undef RegionStyle #undef REGION_CLASS } diff --git a/src/domain.h b/src/domain.h index 58b935ce01..d807463bf3 100644 --- a/src/domain.h +++ b/src/domain.h @@ -14,12 +14,13 @@ #ifndef LMP_DOMAIN_H #define LMP_DOMAIN_H -#include -#include -#include #include "pointers.h" +#include +#include + namespace LAMMPS_NS { + class Region; class Domain : protected Pointers { public: @@ -90,7 +91,7 @@ class Domain : protected Pointers { int nregion; // # of defined Regions int maxregion; // max # list can hold - class Region **regions; // list of defined Regions + Region **regions; // list of defined Regions int copymode; enum{NO_REMAP,X_REMAP,V_REMAP}; diff --git a/src/dump.cpp b/src/dump.cpp index 83b74f1bbc..febc3d0821 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -12,28 +12,26 @@ ------------------------------------------------------------------------- */ #include "dump.h" -#include -#include + #include "atom.h" #include "irregular.h" #include "update.h" #include "domain.h" #include "group.h" #include "output.h" -#include "force.h" #include "modify.h" #include "fix.h" #include "compute.h" #include "memory.h" #include "error.h" +#include + using namespace LAMMPS_NS; #if defined(LMP_QSORT) // allocate space for static class variable Dump *Dump::dumpptr; -#else -#include "mergesort.h" #endif #define BIG 1.0e20 @@ -116,6 +114,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // check file suffixes // if ends in .bin = binary file // else if ends in .gz = gzipped text file + // else if ends in .zst = Zstd compressed text file // else ASCII text file fp = NULL; @@ -153,6 +152,8 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) if (suffix > filename && strcmp(suffix,".bin") == 0) binary = 1; suffix = filename + strlen(filename) - strlen(".gz"); if (suffix > filename && strcmp(suffix,".gz") == 0) compressed = 1; + suffix = filename + strlen(filename) - strlen(".zst"); + if (suffix > filename && strcmp(suffix,".zst") == 0) compressed = 1; } /* ---------------------------------------------------------------------- */ @@ -763,9 +764,9 @@ void Dump::sort() #else if (!reorderflag) { for (i = 0; i < nme; i++) index[i] = i; - if (sortcol == 0) merge_sort(index,nme,(void *)this,idcompare); - else if (sortorder == ASCEND) merge_sort(index,nme,(void *)this,bufcompare); - else merge_sort(index,nme,(void *)this,bufcompare_reverse); + if (sortcol == 0) utils::merge_sort(index,nme,(void *)this,idcompare); + else if (sortorder == ASCEND) utils::merge_sort(index,nme,(void *)this,bufcompare); + else utils::merge_sort(index,nme,(void *)this,bufcompare_reverse); } #endif @@ -938,7 +939,7 @@ void Dump::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"delay") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); - delaystep = force->bnumeric(FLERR,arg[iarg+1]); + delaystep = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (delaystep >= 0) delay_flag = 1; else delay_flag = 0; iarg += 2; @@ -956,7 +957,7 @@ void Dump::modify_params(int narg, char **arg) strcpy(output->var_dump[idump],&arg[iarg+1][2]); n = 0; } else { - n = force->inumeric(FLERR,arg[iarg+1]); + n = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (n <= 0) error->all(FLERR,"Illegal dump_modify command"); } output->every_dump[idump] = n; @@ -967,7 +968,7 @@ void Dump::modify_params(int narg, char **arg) if (!multiproc) error->all(FLERR,"Cannot use dump_modify fileper " "without % in dump file name"); - int nper = force->inumeric(FLERR,arg[iarg+1]); + int nper = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nper <= 0) error->all(FLERR,"Illegal dump_modify command"); multiproc = nprocs/nper; @@ -1048,7 +1049,7 @@ void Dump::modify_params(int narg, char **arg) delete[] nameslist[idx]; delete[] nameslist; } - maxfiles = force->inumeric(FLERR,arg[iarg+1]); + maxfiles = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (maxfiles == 0) error->all(FLERR,"Illegal dump_modify command"); if (maxfiles > 0) { nameslist = new char*[maxfiles]; @@ -1063,7 +1064,7 @@ void Dump::modify_params(int narg, char **arg) if (!multiproc) error->all(FLERR,"Cannot use dump_modify nfile " "without % in dump file name"); - int nfile = force->inumeric(FLERR,arg[iarg+1]); + int nfile = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nfile <= 0) error->all(FLERR,"Illegal dump_modify command"); nfile = MIN(nfile,nprocs); @@ -1093,7 +1094,7 @@ void Dump::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"pad") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); - padflag = force->inumeric(FLERR,arg[iarg+1]); + padflag = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (padflag < 0) error->all(FLERR,"Illegal dump_modify command"); iarg += 2; @@ -1113,7 +1114,7 @@ void Dump::modify_params(int narg, char **arg) sortorder = ASCEND; } else { sort_flag = 1; - sortcol = force->inumeric(FLERR,arg[iarg+1]); + sortcol = utils::inumeric(FLERR,arg[iarg+1],false,lmp); sortorder = ASCEND; if (sortcol == 0) error->all(FLERR,"Illegal dump_modify command"); if (sortcol < 0) { diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 3297ecb4e7..167d88789c 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -12,24 +12,22 @@ ------------------------------------------------------------------------- */ #include "dump_custom.h" -#include -#include -#include + #include "atom.h" -#include "force.h" -#include "domain.h" -#include "region.h" -#include "group.h" -#include "input.h" -#include "modify.h" #include "compute.h" +#include "domain.h" +#include "error.h" #include "fix.h" #include "fix_store.h" +#include "group.h" +#include "input.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "region.h" #include "update.h" #include "variable.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; @@ -67,7 +65,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : clearstep = 1; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal dump custom command"); // expand args if any have wildcard character "*" @@ -76,7 +74,7 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : // nfield may be shrunk below if extra optional args exist expand = 0; - nfield = nargnew = input->expand_args(narg-5,&arg[5],1,earg); + nfield = nargnew = utils::expand_args(FLERR,narg-5,&arg[5],1,earg,lmp); if (earg != &arg[5]) expand = 1; // allocate field vectors @@ -1747,7 +1745,7 @@ int DumpCustom::modify_param(int narg, char **arg) strcpy(format_float_user,arg[2]); } else { - int i = force->inumeric(FLERR,arg[1]) - 1; + int i = utils::inumeric(FLERR,arg[1],false,lmp) - 1; if (i < 0 || i >= size_one) error->all(FLERR,"Illegal dump_modify command"); if (format_column_user[i]) delete [] format_column_user[i]; @@ -2059,7 +2057,7 @@ int DumpCustom::modify_param(int narg, char **arg) // id = dump-ID + nthreshlast + DUMP_STORE, fix group = dump group if (strcmp(arg[3],"LAST") != 0) { - thresh_value[nthresh] = force->numeric(FLERR,arg[3]); + thresh_value[nthresh] = utils::numeric(FLERR,arg[3],false,lmp); thresh_last[nthresh] = -1; } else { thresh_fix = (FixStore **) diff --git a/src/dump_deprecated.cpp b/src/dump_deprecated.cpp index 822bed7832..ed8336eebc 100644 --- a/src/dump_deprecated.cpp +++ b/src/dump_deprecated.cpp @@ -12,10 +12,9 @@ ------------------------------------------------------------------------- */ #include "dump_deprecated.h" -#include + #include "comm.h" #include "error.h" -#include "utils.h" using namespace LAMMPS_NS; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index a78c214e08..96a338950b 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "dump_image.h" -#include + #include #include #include @@ -36,6 +36,7 @@ #include "error.h" #include "memory.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -152,7 +153,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"adiam") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command"); adiam = NUMERIC; - adiamvalue = force->numeric(FLERR,arg[iarg+1]); + adiamvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (adiamvalue <= 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 2; @@ -167,7 +168,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal dump image command"); if (!islower(arg[iarg+2][0])) { bdiam = NUMERIC; - bdiamvalue = force->numeric(FLERR,arg[iarg+2]); + bdiamvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (bdiamvalue <= 0.0) error->all(FLERR,"Illegal dump image command"); } else if (strcmp(arg[iarg+2],"atom") == 0) bdiam = ATOM; else if (strcmp(arg[iarg+2],"type") == 0) bdiam = TYPE; @@ -182,7 +183,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"type") == 0) lcolor = TYPE; else error->all(FLERR,"Illegal dump image command"); ldiam = NUMERIC; - ldiamvalue = force->numeric(FLERR,arg[iarg+2]); + ldiamvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg],"tri") == 0) { @@ -190,8 +191,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : triflag = YES; if (strcmp(arg[iarg+1],"type") == 0) tcolor = TYPE; else error->all(FLERR,"Illegal dump image command"); - tstyle = force->inumeric(FLERR,arg[iarg+2]); - tdiamvalue = force->numeric(FLERR,arg[iarg+3]); + tstyle = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + tdiamvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"body") == 0) { @@ -199,8 +200,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : bodyflag = YES; if (strcmp(arg[iarg+1],"type") == 0) bodycolor = TYPE; else error->all(FLERR,"Illegal dump image command"); - bodyflag1 = force->numeric(FLERR,arg[iarg+2]); - bodyflag2 = force->numeric(FLERR,arg[iarg+3]); + bodyflag1 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + bodyflag2 = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"fix") == 0) { @@ -209,14 +210,14 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : fixID = arg[iarg+1]; if (strcmp(arg[iarg+2],"type") == 0) fixcolor = TYPE; else error->all(FLERR,"Illegal dump image command"); - fixflag1 = force->numeric(FLERR,arg[iarg+3]); - fixflag2 = force->numeric(FLERR,arg[iarg+4]); + fixflag1 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + fixflag2 = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else if (strcmp(arg[iarg],"size") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command"); - int width = force->inumeric(FLERR,arg[iarg+1]); - int height = force->inumeric(FLERR,arg[iarg+2]); + int width = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + int height = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (width <= 0 || height <= 0) error->all(FLERR,"Illegal dump image command"); image->width = width; @@ -230,7 +231,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : thetastr = new char[n]; strcpy(thetastr,&arg[iarg+1][2]); } else { - double theta = force->numeric(FLERR,arg[iarg+1]); + double theta = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (theta < 0.0 || theta > 180.0) error->all(FLERR,"Invalid dump image theta value"); theta *= MY_PI/180.0; @@ -241,7 +242,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : phistr = new char[n]; strcpy(phistr,&arg[iarg+2][2]); } else { - double phi = force->numeric(FLERR,arg[iarg+2]); + double phi = utils::numeric(FLERR,arg[iarg+2],false,lmp); phi *= MY_PI/180.0; image->phi = phi; } @@ -257,19 +258,19 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : cxstr = new char[n]; strcpy(cxstr,&arg[iarg+2][2]); cflag = DYNAMIC; - } else cx = force->numeric(FLERR,arg[iarg+2]); + } else cx = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; cystr = new char[n]; strcpy(cystr,&arg[iarg+3][2]); cflag = DYNAMIC; - } else cy = force->numeric(FLERR,arg[iarg+3]); + } else cy = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { int n = strlen(&arg[iarg+4][2]) + 1; czstr = new char[n]; strcpy(czstr,&arg[iarg+4][2]); cflag = DYNAMIC; - } else cz = force->numeric(FLERR,arg[iarg+4]); + } else cz = utils::numeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else if (strcmp(arg[iarg],"up") == 0) { @@ -278,17 +279,17 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : int n = strlen(&arg[iarg+1][2]) + 1; upxstr = new char[n]; strcpy(upxstr,&arg[iarg+1][2]); - } else image->up[0] = force->numeric(FLERR,arg[iarg+1]); + } else image->up[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; upystr = new char[n]; strcpy(upystr,&arg[iarg+2][2]); - } else image->up[1] = force->numeric(FLERR,arg[iarg+2]); + } else image->up[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; upzstr = new char[n]; strcpy(upzstr,&arg[iarg+3][2]); - } else image->up[2] = force->numeric(FLERR,arg[iarg+3]); + } else image->up[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"zoom") == 0) { @@ -298,7 +299,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : zoomstr = new char[n]; strcpy(zoomstr,&arg[iarg+1][2]); } else { - double zoom = force->numeric(FLERR,arg[iarg+1]); + double zoom = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (zoom <= 0.0) error->all(FLERR,"Illegal dump image command"); image->zoom = zoom; } @@ -312,7 +313,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : perspstr = new char[n]; strcpy(perspstr,&arg[iarg+1][2]); } else { - double persp = force->numeric(FLERR,arg[iarg+1]); + double persp = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (persp < 0.0) error->all(FLERR,"Illegal dump image command"); image->persp = persp; } @@ -323,7 +324,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) boxflag = YES; else if (strcmp(arg[iarg+1],"no") == 0) boxflag = NO; else error->all(FLERR,"Illegal dump image command"); - boxdiam = force->numeric(FLERR,arg[iarg+2]); + boxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 3; @@ -332,8 +333,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) axesflag = YES; else if (strcmp(arg[iarg+1],"no") == 0) axesflag = NO; else error->all(FLERR,"Illegal dump image command"); - axeslen = force->numeric(FLERR,arg[iarg+2]); - axesdiam = force->numeric(FLERR,arg[iarg+3]); + axeslen = utils::numeric(FLERR,arg[iarg+2],false,lmp); + axesdiam = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (axeslen < 0.0 || axesdiam < 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 4; @@ -343,13 +344,13 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) subboxflag = YES; else if (strcmp(arg[iarg+1],"no") == 0) subboxflag = NO; else error->all(FLERR,"Illegal dump image command"); - subboxdiam = force->numeric(FLERR,arg[iarg+2]); + subboxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (subboxdiam < 0.0) error->all(FLERR,"Illegal dump image command"); iarg += 3; } else if (strcmp(arg[iarg],"shiny") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command"); - double shiny = force->numeric(FLERR,arg[iarg+1]); + double shiny = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (shiny < 0.0 || shiny > 1.0) error->all(FLERR,"Illegal dump image command"); image->shiny = shiny; @@ -360,10 +361,10 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg+1],"yes") == 0) image->ssao = YES; else if (strcmp(arg[iarg+1],"no") == 0) image->ssao = NO; else error->all(FLERR,"Illegal dump image command"); - int seed = force->inumeric(FLERR,arg[iarg+2]); + int seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (seed <= 0) error->all(FLERR,"Illegal dump image command"); image->seed = seed; - double ssaoint = force->numeric(FLERR,arg[iarg+3]); + double ssaoint = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (ssaoint < 0.0 || ssaoint > 1.0) error->all(FLERR,"Illegal dump image command"); image->ssaoint = ssaoint; @@ -1246,7 +1247,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"acolor") == 0) { if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi); + utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); // ptrs = list of ncount colornames separated by '/' @@ -1280,8 +1281,8 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"adiam") == 0) { if (narg < 3) error->all(FLERR,"Illegal dump_modify command"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi); - double diam = force->numeric(FLERR,arg[2]); + utils::bounds(FLERR,arg[1],1,atom->ntypes,nlo,nhi,error); + double diam = utils::numeric(FLERR,arg[2],false,lmp); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) diamtype[i] = diam; return 3; @@ -1295,7 +1296,7 @@ int DumpImage::modify_param(int narg, char **arg) else if (arg[3][0] == 'c') factor = 2; else if (arg[3][0] == 'd') factor = 3; else error->all(FLERR,"Illegal dump_modify command"); - int nentry = force->inumeric(FLERR,arg[5]); + int nentry = utils::inumeric(FLERR,arg[5],false,lmp); if (nentry < 1) error->all(FLERR,"Illegal dump_modify command"); int n = 6 + factor*nentry; if (narg < n) error->all(FLERR,"Illegal dump_modify command"); @@ -1309,7 +1310,7 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bcolor not allowed with no bond types"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->nbondtypes,nlo,nhi); + utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); // ptrs = list of ncount colornames separated by '/' @@ -1345,8 +1346,8 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bdiam not allowed with no bond types"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->nbondtypes,nlo,nhi); - double diam = force->numeric(FLERR,arg[2]); + utils::bounds(FLERR,arg[1],1,atom->nbondtypes,nlo,nhi,error); + double diam = utils::numeric(FLERR,arg[2],false,lmp); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam; return 3; @@ -1372,7 +1373,9 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"color") == 0) { if (narg < 5) error->all(FLERR,"Illegal dump_modify command"); - int flag = image->addcolor(arg[1],force->numeric(FLERR,arg[2]),force->numeric(FLERR,arg[3]),force->numeric(FLERR,arg[4])); + int flag = image->addcolor(arg[1],utils::numeric(FLERR,arg[2],false,lmp), + utils::numeric(FLERR,arg[3],false,lmp), + utils::numeric(FLERR,arg[4],false,lmp)); if (flag) error->all(FLERR,"Illegal dump_modify command"); return 5; } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 21a96d1e8a..a71166ec57 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -12,18 +12,16 @@ ------------------------------------------------------------------------- */ #include "dump_local.h" -#include -#include -#include -#include "modify.h" -#include "fix.h" + #include "compute.h" #include "domain.h" -#include "update.h" -#include "input.h" -#include "memory.h" #include "error.h" -#include "force.h" +#include "fix.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -45,7 +43,7 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : clearstep = 1; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal dump local command"); if (binary) @@ -57,7 +55,7 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - nfield = input->expand_args(nfield,&arg[5],1,earg); + nfield = utils::expand_args(FLERR,nfield,&arg[5],1,earg,lmp); if (earg != &arg[5]) expand = 1; @@ -268,14 +266,14 @@ void DumpLocal::write_header(bigint ndump) fprintf(fp,BIGINT_FORMAT "\n",ndump); if (domain->triclinic) { fprintf(fp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr); - fprintf(fp,"%g %g %g\n",boxxlo,boxxhi,boxxy); - fprintf(fp,"%g %g %g\n",boxylo,boxyhi,boxxz); - fprintf(fp,"%g %g %g\n",boxzlo,boxzhi,boxyz); + fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy); + fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz); + fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz); } else { fprintf(fp,"ITEM: BOX BOUNDS %s\n",boundstr); - fprintf(fp,"%g %g\n",boxxlo,boxxhi); - fprintf(fp,"%g %g\n",boxylo,boxyhi); - fprintf(fp,"%g %g\n",boxzlo,boxzhi); + fprintf(fp,"%-1.16e %-1.16e\n",boxxlo,boxxhi); + fprintf(fp,"%-1.16e %-1.16e\n",boxylo,boxyhi); + fprintf(fp,"%-1.16e %-1.16e\n",boxzlo,boxzhi); } fprintf(fp,"ITEM: %s %s\n",label,columns); } diff --git a/src/dump_movie.cpp b/src/dump_movie.cpp index 68a77c8f63..5f6d0b80d7 100644 --- a/src/dump_movie.cpp +++ b/src/dump_movie.cpp @@ -16,11 +16,11 @@ ------------------------------------------------------------------------- */ #include "dump_movie.h" -#include + #include "comm.h" -#include "force.h" #include "error.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; @@ -84,14 +84,14 @@ int DumpMovie::modify_param(int narg, char **arg) if (strcmp(arg[0],"bitrate") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - bitrate = force->inumeric(FLERR,arg[1]); + bitrate = utils::inumeric(FLERR,arg[1],false,lmp); if (bitrate <= 0.0) error->all(FLERR,"Illegal dump_modify command"); return 2; } if (strcmp(arg[0],"framerate") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - framerate = force->numeric(FLERR,arg[1]); + framerate = utils::numeric(FLERR,arg[1],false,lmp); if ((framerate <= 0.1) || (framerate > 24.0)) error->all(FLERR,"Illegal dump_modify framerate command"); return 2; diff --git a/src/error.cpp b/src/error.cpp index 7458f816c0..0ea218887f 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -12,16 +12,11 @@ ------------------------------------------------------------------------- */ #include "error.h" -#include -#include -#include -#include -#include "universe.h" -#include "output.h" -#include "input.h" + #include "accelerator_kokkos.h" -#include "utils.h" -#include "fmt/format.h" +#include "input.h" +#include "output.h" +#include "universe.h" #if defined(LAMMPS_EXCEPTIONS) #include "update.h" diff --git a/src/error.h b/src/error.h index 40c1559464..dedebc4148 100644 --- a/src/error.h +++ b/src/error.h @@ -15,7 +15,6 @@ #define LMP_ERROR_H #include "pointers.h" -#include #ifdef LAMMPS_EXCEPTIONS #include "exceptions.h" diff --git a/src/file_writer.h b/src/file_writer.h new file mode 100644 index 0000000000..766ccc85e7 --- /dev/null +++ b/src/file_writer.h @@ -0,0 +1,53 @@ + +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Richard Berger (Temple U) +------------------------------------------------------------------------- */ + +#ifndef LMP_FILE_WRITER_H +#define LMP_FILE_WRITER_H + +#include + +namespace LAMMPS_NS { + +class FileWriter { +public: + FileWriter() = default; + virtual ~FileWriter() = default; + virtual void open(const std::string & path) = 0; + virtual void close() = 0; + virtual void flush() = 0; + virtual size_t write(const void * buffer, size_t length) = 0; + virtual bool isopen() const = 0; +}; + +class FileWriterException : public std::exception { + std::string message; +public: + FileWriterException(const std::string & msg) : message(msg) { + } + + ~FileWriterException() throw() { + } + + virtual const char * what() const throw() { + return message.c_str(); + } +}; + +} + +#endif diff --git a/src/finish.cpp b/src/finish.cpp index 51f886b5db..3bfe3a7bbf 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -12,28 +12,26 @@ ------------------------------------------------------------------------- */ #include "finish.h" -#include -#include -#include -#include + #include "accelerator_kokkos.h" #include "atom.h" #include "atom_vec.h" -#include "molecule.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "update.h" +#include "memory.h" // IWYU pragma: keep #include "min.h" -#include "neighbor.h" +#include "molecule.h" #include "neigh_list.h" #include "neigh_request.h" -#include "memory.h" -#include "error.h" -#include "timer.h" +#include "neighbor.h" // IWYU pragma: keep +#include "timer.h" // IWYU pragma: keep #include "universe.h" -#include "utils.h" -#include "fmt/format.h" +#include "update.h" + +#include +#include #ifdef LMP_USER_OMP #include "modify.h" diff --git a/src/fix.cpp b/src/fix.cpp index c15f5638e2..03313739a1 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -12,14 +12,15 @@ ------------------------------------------------------------------------- */ #include "fix.h" + +#include "atom.h" +#include "atom_masks.h" +#include "error.h" +#include "group.h" +#include "memory.h" + #include #include -#include "atom.h" -#include "group.h" -#include "force.h" -#include "atom_masks.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -163,7 +164,7 @@ void Fix::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"respa") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix_modify command"); if (!respa_level_support) error->all(FLERR,"Illegal fix_modify command"); - int lvl = force->inumeric(FLERR,arg[iarg+1]); + int lvl = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (lvl < 0) error->all(FLERR,"Illegal fix_modify command"); respa_level = lvl-1; iarg += 2; diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index c502dc6595..dba4fde077 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -30,8 +30,8 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -46,7 +46,7 @@ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) { if (narg < 5) error->all(FLERR,"Illegal fix adapt command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery < 0) error->all(FLERR,"Illegal fix adapt command"); dynamic_group_allow = 1; @@ -98,10 +98,10 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) adapt[nadapt].pparam = new char[n]; adapt[nadapt].pair = NULL; strcpy(adapt[nadapt].pparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->ntypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); - force->bounds(FLERR,arg[iarg+4],atom->ntypes, - adapt[nadapt].jlo,adapt[nadapt].jhi); + utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); + utils::bounds(FLERR,arg[iarg+4],1,atom->ntypes, + adapt[nadapt].jlo,adapt[nadapt].jhi,error); if (strstr(arg[iarg+5],"v_") == arg[iarg+5]) { n = strlen(&arg[iarg+5][2]) + 1; adapt[nadapt].var = new char[n]; @@ -120,8 +120,8 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) adapt[nadapt].bparam = new char[n]; adapt[nadapt].bond = NULL; strcpy(adapt[nadapt].bparam,arg[iarg+2]); - force->bounds(FLERR,arg[iarg+3],atom->nbondtypes, - adapt[nadapt].ilo,adapt[nadapt].ihi); + utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { n = strlen(&arg[iarg+4][2]) + 1; adapt[nadapt].var = new char[n]; @@ -354,7 +354,7 @@ void FixAdapt::init() int nsub = 0; if ((cptr = strchr(pstyle,':'))) { *cptr = '\0'; - nsub = force->inumeric(FLERR,cptr+1); + nsub = utils::inumeric(FLERR,cptr+1,false,lmp); } if (lmp->suffix_enable) { diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 275ec2c846..0983728ea9 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -12,21 +12,20 @@ ------------------------------------------------------------------------- */ #include "fix_addforce.h" -#include -#include -#include + #include "atom.h" #include "atom_masks.h" -#include "update.h" -#include "modify.h" #include "domain.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" #include "region.h" #include "respa.h" -#include "input.h" +#include "update.h" #include "variable.h" -#include "memory.h" -#include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -60,7 +59,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : xstr = new char[n]; strcpy(xstr,&arg[3][2]); } else { - xvalue = force->numeric(FLERR,arg[3]); + xvalue = utils::numeric(FLERR,arg[3],false,lmp); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -68,7 +67,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : ystr = new char[n]; strcpy(ystr,&arg[4][2]); } else { - yvalue = force->numeric(FLERR,arg[4]); + yvalue = utils::numeric(FLERR,arg[4],false,lmp); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -76,7 +75,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : zstr = new char[n]; strcpy(zstr,&arg[5][2]); } else { - zvalue = force->numeric(FLERR,arg[5]); + zvalue = utils::numeric(FLERR,arg[5],false,lmp); zstyle = CONSTANT; } diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index 694df2bcf7..da009c55d5 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -12,17 +12,17 @@ ------------------------------------------------------------------------- */ #include "fix_ave_atom.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "compute.h" -#include "input.h" -#include "variable.h" -#include "memory.h" #include "error.h" -#include "force.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -40,9 +40,9 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : { if (narg < 7) error->all(FLERR,"Illegal fix ave/atom command"); - nevery = force->inumeric(FLERR,arg[3]); - nrepeat = force->inumeric(FLERR,arg[4]); - peratom_freq = force->inumeric(FLERR,arg[5]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + peratom_freq = utils::inumeric(FLERR,arg[5],false,lmp); nvalues = narg - 6; @@ -51,7 +51,7 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - nvalues = input->expand_args(nvalues,&arg[6],1,earg); + nvalues = utils::expand_args(FLERR,nvalues,&arg[6],1,earg,lmp); if (earg != &arg[6]) expand = 1; arg = earg; diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 2987783b2a..18fb335279 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -12,8 +12,8 @@ ------------------------------------------------------------------------- */ #include "fix_ave_chunk.h" -#include -#include + + #include #include #include "atom.h" @@ -27,8 +27,8 @@ #include "variable.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -57,9 +57,9 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); - nrepeat = force->inumeric(FLERR,arg[4]); - nfreq = force->inumeric(FLERR,arg[5]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); int n = strlen(arg[6]) + 1; idchunk = new char[n]; @@ -72,7 +72,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - int nargnew = input->expand_args(narg-7,&arg[7],1,earg); + int nargnew = utils::expand_args(FLERR,narg-7,&arg[7],1,earg,lmp); if (earg != &arg[7]) expand = 1; arg = earg; @@ -196,7 +196,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Illegal fix ave/chunk command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/chunk command"); - nwindow = force->inumeric(FLERR,arg[iarg+2]); + nwindow = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/chunk command"); } iarg += 2; @@ -213,12 +213,12 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"adof") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/chunk command"); - adof = force->numeric(FLERR,arg[iarg+1]); + adof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"cdof") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/chunk command"); - cdof = force->numeric(FLERR,arg[iarg+1]); + cdof = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 2231611d1e..031dfc26bf 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -18,20 +18,17 @@ ------------------------------------------------------------------------- */ #include "fix_ave_correlate.h" -#include -#include + +#include "compute.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + #include #include -#include "update.h" -#include "modify.h" -#include "compute.h" -#include "input.h" -#include "variable.h" -#include "memory.h" -#include "error.h" -#include "force.h" -#include "utils.h" -#include "fmt/format.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -55,9 +52,9 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); - nrepeat = force->inumeric(FLERR,arg[4]); - nfreq = force->inumeric(FLERR,arg[5]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); global_freq = nfreq; @@ -65,7 +62,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): int expand = 0; char **earg; - int nargnew = input->expand_args(narg-6,&arg[6],0,earg); + int nargnew = utils::expand_args(FLERR,narg-6,&arg[6],0,earg,lmp); if (earg != &arg[6]) expand = 1; arg = earg; @@ -140,11 +137,11 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): iarg += 2; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); - startstep = force->inumeric(FLERR,arg[iarg+1]); + startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"prefactor") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); - prefactor = force->numeric(FLERR,arg[iarg+1]); + prefactor = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"file") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index d0bedba34a..3a9346498f 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -12,21 +12,18 @@ ------------------------------------------------------------------------- */ #include "fix_ave_histo.h" -#include -#include + +#include "atom.h" +#include "compute.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + #include #include -#include "atom.h" -#include "update.h" -#include "modify.h" -#include "compute.h" -#include "input.h" -#include "variable.h" -#include "memory.h" -#include "error.h" -#include "force.h" -#include "utils.h" -#include "fmt/format.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -57,9 +54,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); - nrepeat = force->inumeric(FLERR,arg[4]); - nfreq = force->inumeric(FLERR,arg[5]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); global_freq = nfreq; vector_flag = 1; @@ -70,9 +67,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : extarray = 0; dynamic_group_allow = 1; - lo = force->numeric(FLERR,arg[6]); - hi = force->numeric(FLERR,arg[7]); - nbins = force->inumeric(FLERR,arg[8]); + lo = utils::numeric(FLERR,arg[6],false,lmp); + hi = utils::numeric(FLERR,arg[7],false,lmp); + nbins = utils::inumeric(FLERR,arg[8],false,lmp); // scan values to count them // then read options so know mode = SCALAR/VECTOR before re-reading values @@ -107,7 +104,7 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - nvalues = input->expand_args(nvalues,&arg[9],mode,earg); + nvalues = utils::expand_args(FLERR,nvalues,&arg[9],mode,earg,lmp); if (earg != &arg[9]) expand = 1; arg = earg; @@ -985,14 +982,14 @@ void FixAveHisto::options(int iarg, int narg, char **arg) else error->all(FLERR,"Illegal fix ave/histo command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/histo command"); - nwindow = force->inumeric(FLERR,arg[iarg+2]); + nwindow = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/histo command"); } iarg += 2; if (ave == WINDOW) iarg++; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); - startstep = force->inumeric(FLERR,arg[iarg+1]); + startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"mode") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 4b86681153..5e93df0313 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -15,7 +15,7 @@ Contributing author: Shawn Coleman (ARL) ------------------------------------------------------------------------- */ #include "fix_ave_histo_weight.h" -#include + #include #include "fix.h" #include "atom.h" diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 84c5c04f11..9c493b9846 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -16,20 +16,17 @@ ------------------------------------------------------------------------- */ #include "fix_ave_time.h" -#include -#include + +#include "compute.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + #include #include -#include "update.h" -#include "force.h" -#include "modify.h" -#include "compute.h" -#include "input.h" -#include "variable.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -56,9 +53,9 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); - nevery = force->inumeric(FLERR,arg[3]); - nrepeat = force->inumeric(FLERR,arg[4]); - nfreq = force->inumeric(FLERR,arg[5]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); global_freq = nfreq; @@ -88,7 +85,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : int expand = 0; char **earg; - nvalues = input->expand_args(nvalues,&arg[6],mode,earg); + nvalues = utils::expand_args(FLERR,nvalues,&arg[6],mode,earg,lmp); if (earg != &arg[6]) expand = 1; arg = earg; @@ -1058,14 +1055,14 @@ void FixAveTime::options(int iarg, int narg, char **arg) else error->all(FLERR,"Illegal fix ave/time command"); if (ave == WINDOW) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix ave/time command"); - nwindow = force->inumeric(FLERR,arg[iarg+2]); + nwindow = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nwindow <= 0) error->all(FLERR,"Illegal fix ave/time command"); } iarg += 2; if (ave == WINDOW) iarg++; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); - startstep = force->inumeric(FLERR,arg[iarg+1]); + startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"mode") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); @@ -1076,7 +1073,7 @@ void FixAveTime::options(int iarg, int narg, char **arg) } else if (strcmp(arg[iarg],"off") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); memory->grow(offlist,noff+1,"ave/time:offlist"); - offlist[noff++] = force->inumeric(FLERR,arg[iarg+1]); + offlist[noff++] = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"overwrite") == 0) { overwrite = 1; diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index 8ad07780a9..00ec0d67ba 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -12,18 +12,18 @@ ------------------------------------------------------------------------- */ #include "fix_aveforce.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "domain.h" +#include "error.h" +#include "input.h" +#include "modify.h" #include "region.h" #include "respa.h" -#include "input.h" +#include "update.h" #include "variable.h" -#include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -55,7 +55,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"NULL") == 0) { xstyle = NONE; } else { - xvalue = force->numeric(FLERR,arg[3]); + xvalue = utils::numeric(FLERR,arg[3],false,lmp); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -65,7 +65,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4],"NULL") == 0) { ystyle = NONE; } else { - yvalue = force->numeric(FLERR,arg[4]); + yvalue = utils::numeric(FLERR,arg[4],false,lmp); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -75,7 +75,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[5],"NULL") == 0) { zstyle = NONE; } else { - zvalue = force->numeric(FLERR,arg[5]); + zvalue = utils::numeric(FLERR,arg[5],false,lmp); zstyle = CONSTANT; } diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index f374a7c5c5..7cee835375 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -52,9 +52,9 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : int dimension = domain->dimension; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery < 0) error->all(FLERR,"Illegal fix balance command"); - thresh = force->numeric(FLERR,arg[4]); + thresh = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"shift") == 0) lbstyle = SHIFT; else if (strcmp(arg[5],"rcb") == 0) lbstyle = BISECTION; @@ -66,9 +66,9 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : if (strlen(arg[iarg+1]) > 3) error->all(FLERR,"Illegal fix balance command"); strcpy(bstr,arg[iarg+1]); - nitermax = force->inumeric(FLERR,arg[iarg+2]); + nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp); if (nitermax <= 0) error->all(FLERR,"Illegal fix balance command"); - stopthresh = force->numeric(FLERR,arg[iarg+3]); + stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (stopthresh < 1.0) error->all(FLERR,"Illegal fix balance command"); iarg += 4; } else if (lbstyle == BISECTION) { diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 832799831e..5fd9ef190e 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -18,7 +18,7 @@ #include "fix_box_relax.h" #include #include -#include + #include "atom.h" #include "domain.h" #include "update.h" @@ -29,7 +29,7 @@ #include "compute.h" #include "error.h" #include "math_extra.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -90,7 +90,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"iso") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); pcouple = XYZ; - p_target[0] = p_target[1] = p_target[2] = force->numeric(FLERR,arg[iarg+1]); + p_target[0] = p_target[1] = p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_target[2] = 0.0; @@ -100,7 +100,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); pcouple = NONE; - p_target[0] = p_target[1] = p_target[2] = force->numeric(FLERR,arg[iarg+1]); + p_target[0] = p_target[1] = p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_target[2] = 0.0; @@ -111,7 +111,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); pcouple = NONE; scalexy = scalexz = scaleyz = 0; - p_target[0] = p_target[1] = p_target[2] = force->numeric(FLERR,arg[iarg+1]); + p_target[0] = p_target[1] = p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; p_target[3] = p_target[4] = p_target[5] = 0.0; p_flag[3] = p_flag[4] = p_flag[5] = 1; @@ -123,19 +123,19 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[0] = force->numeric(FLERR,arg[iarg+1]); + p_target[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[0] = 1; deviatoric_flag = 1; iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[1] = force->numeric(FLERR,arg[iarg+1]); + p_target[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[1] = 1; deviatoric_flag = 1; iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[2] = force->numeric(FLERR,arg[iarg+1]); + p_target[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[2] = 1; deviatoric_flag = 1; iarg += 2; @@ -144,7 +144,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[3] = force->numeric(FLERR,arg[iarg+1]); + p_target[3] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[3] = 1; deviatoric_flag = 1; scaleyz = 0; @@ -153,7 +153,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix box/relax command for a 2d simulation"); } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[4] = force->numeric(FLERR,arg[iarg+1]); + p_target[4] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[4] = 1; deviatoric_flag = 1; scalexz = 0; @@ -162,7 +162,7 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix box/relax command for a 2d simulation"); } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - p_target[5] = force->numeric(FLERR,arg[iarg+1]); + p_target[5] = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_flag[5] = 1; deviatoric_flag = 1; scalexy = 0; @@ -186,11 +186,11 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"vmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - vmax = force->numeric(FLERR,arg[iarg+1]); + vmax = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"nreset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix box/relax command"); - nreset_h0 = force->inumeric(FLERR,arg[iarg+1]); + nreset_h0 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nreset_h0 < 0) error->all(FLERR,"Illegal fix box/relax command"); iarg += 2; } else if (strcmp(arg[iarg],"scalexy") == 0) { @@ -213,9 +213,9 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"fixedpoint") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix box/relax command"); - fixedpoint[0] = force->numeric(FLERR,arg[iarg+1]); - fixedpoint[1] = force->numeric(FLERR,arg[iarg+2]); - fixedpoint[2] = force->numeric(FLERR,arg[iarg+3]); + fixedpoint[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + fixedpoint[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + fixedpoint[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else error->all(FLERR,"Illegal fix box/relax command"); } diff --git a/src/fix_controller.cpp b/src/fix_controller.cpp index f7012e5565..92fd42f3db 100644 --- a/src/fix_controller.cpp +++ b/src/fix_controller.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "fix_controller.h" -#include -#include -#include "force.h" -#include "update.h" -#include "modify.h" + #include "compute.h" -#include "input.h" -#include "variable.h" #include "error.h" +#include "input.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -43,13 +43,13 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 0; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix controller command"); - alpha = force->numeric(FLERR,arg[4]); - kp = force->numeric(FLERR,arg[5]); - ki = force->numeric(FLERR,arg[6]); - kd = force->numeric(FLERR,arg[7]); + alpha = utils::numeric(FLERR,arg[4],false,lmp); + kp = utils::numeric(FLERR,arg[5],false,lmp); + ki = utils::numeric(FLERR,arg[6],false,lmp); + kd = utils::numeric(FLERR,arg[7],false,lmp); // process variable arg @@ -84,7 +84,7 @@ FixController::FixController(LAMMPS *lmp, int narg, char **arg) : // setpoint arg - setpoint = force->numeric(FLERR,arg[iarg]); + setpoint = utils::numeric(FLERR,arg[iarg],false,lmp); iarg++; // control variable arg diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 2514f28fa5..b4c36ca43e 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -50,7 +50,7 @@ rfix(NULL), irregular(NULL), set(NULL) restart_global = 1; pre_exchange_migrate = 1; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix deform command"); // set defaults @@ -77,34 +77,34 @@ rfix(NULL), irregular(NULL), set(NULL) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = FINAL; - set[index].flo = force->numeric(FLERR,arg[iarg+2]); - set[index].fhi = force->numeric(FLERR,arg[iarg+3]); + set[index].flo = utils::numeric(FLERR,arg[iarg+2],false,lmp); + set[index].fhi = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = DELTA; - set[index].dlo = force->numeric(FLERR,arg[iarg+2]); - set[index].dhi = force->numeric(FLERR,arg[iarg+3]); + set[index].dlo = utils::numeric(FLERR,arg[iarg+2],false,lmp); + set[index].dhi = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg+1],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = SCALE; - set[index].scale = force->numeric(FLERR,arg[iarg+2]); + set[index].scale = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"vel") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = VEL; - set[index].vel = force->numeric(FLERR,arg[iarg+2]); + set[index].vel = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"erate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = ERATE; - set[index].rate = force->numeric(FLERR,arg[iarg+2]); + set[index].rate = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"trate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = TRATE; - set[index].rate = force->numeric(FLERR,arg[iarg+2]); + set[index].rate = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"volume") == 0) { set[index].style = VOLUME; @@ -112,8 +112,8 @@ rfix(NULL), irregular(NULL), set(NULL) } else if (strcmp(arg[iarg+1],"wiggle") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = WIGGLE; - set[index].amplitude = force->numeric(FLERR,arg[iarg+2]); - set[index].tperiod = force->numeric(FLERR,arg[iarg+3]); + set[index].amplitude = utils::numeric(FLERR,arg[iarg+2],false,lmp); + set[index].tperiod = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (set[index].tperiod <= 0.0) error->all(FLERR,"Illegal fix deform command"); iarg += 4; @@ -149,33 +149,33 @@ rfix(NULL), irregular(NULL), set(NULL) if (strcmp(arg[iarg+1],"final") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = FINAL; - set[index].ftilt = force->numeric(FLERR,arg[iarg+2]); + set[index].ftilt = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"delta") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = DELTA; - set[index].dtilt = force->numeric(FLERR,arg[iarg+2]); + set[index].dtilt = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"vel") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = VEL; - set[index].vel = force->numeric(FLERR,arg[iarg+2]); + set[index].vel = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"erate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = ERATE; - set[index].rate = force->numeric(FLERR,arg[iarg+2]); + set[index].rate = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"trate") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = TRATE; - set[index].rate = force->numeric(FLERR,arg[iarg+2]); + set[index].rate = utils::numeric(FLERR,arg[iarg+2],false,lmp); iarg += 3; } else if (strcmp(arg[iarg+1],"wiggle") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix deform command"); set[index].style = WIGGLE; - set[index].amplitude = force->numeric(FLERR,arg[iarg+2]); - set[index].tperiod = force->numeric(FLERR,arg[iarg+3]); + set[index].amplitude = utils::numeric(FLERR,arg[iarg+2],false,lmp); + set[index].tperiod = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (set[index].tperiod <= 0.0) error->all(FLERR,"Illegal fix deform command"); iarg += 4; diff --git a/src/fix_deprecated.cpp b/src/fix_deprecated.cpp index d3ceb69ea0..877eac0524 100644 --- a/src/fix_deprecated.cpp +++ b/src/fix_deprecated.cpp @@ -12,10 +12,10 @@ ------------------------------------------------------------------------- */ #include "fix_deprecated.h" -#include + #include "comm.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/fix_drag.cpp b/src/fix_drag.cpp index 9af5a37675..2400014569 100644 --- a/src/fix_drag.cpp +++ b/src/fix_drag.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "fix_drag.h" -#include -#include -#include + #include "atom.h" -#include "update.h" -#include "respa.h" #include "domain.h" #include "error.h" -#include "force.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -42,14 +42,14 @@ FixDrag::FixDrag(LAMMPS *lmp, int narg, char **arg) : xflag = yflag = zflag = 1; if (strcmp(arg[3],"NULL") == 0) xflag = 0; - else xc = force->numeric(FLERR,arg[3]); + else xc = utils::numeric(FLERR,arg[3],false,lmp); if (strcmp(arg[4],"NULL") == 0) yflag = 0; - else yc = force->numeric(FLERR,arg[4]); + else yc = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"NULL") == 0) zflag = 0; - else zc = force->numeric(FLERR,arg[5]); + else zc = utils::numeric(FLERR,arg[5],false,lmp); - f_mag = force->numeric(FLERR,arg[6]); - delta = force->numeric(FLERR,arg[7]); + f_mag = utils::numeric(FLERR,arg[6],false,lmp); + delta = utils::numeric(FLERR,arg[7],false,lmp); force_flag = 0; ftotal[0] = ftotal[1] = ftotal[2] = 0.0; diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index da4bdad827..360f0d2998 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_dt_reset.h" -#include + #include #include #include "atom.h" @@ -50,16 +50,16 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) : extvector = 0; dynamic_group_allow = 1; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix dt/reset command"); minbound = maxbound = 1; tmin = tmax = 0.0; if (strcmp(arg[4],"NULL") == 0) minbound = 0; - else tmin = force->numeric(FLERR,arg[4]); + else tmin = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"NULL") == 0) maxbound = 0; - else tmax = force->numeric(FLERR,arg[5]); - xmax = force->numeric(FLERR,arg[6]); + else tmax = utils::numeric(FLERR,arg[5],false,lmp); + xmax = utils::numeric(FLERR,arg[6],false,lmp); if (minbound && tmin < 0.0) error->all(FLERR,"Illegal fix dt/reset command"); if (maxbound && tmax < 0.0) error->all(FLERR,"Illegal fix dt/reset command"); @@ -80,7 +80,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"emax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix dt/reset command"); - emax = force->numeric(FLERR,arg[iarg+1]); + emax = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (emax <= 0.0) error->all(FLERR,"Illegal fix dt/reset command"); iarg += 2; } else error->all(FLERR,"Illegal fix dt/reset command"); diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index 7dd8c08204..be2a74d81b 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -19,7 +19,7 @@ #include "modify.h" #include "respa.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_external.cpp b/src/fix_external.cpp index afb420df93..1db7e15295 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -12,12 +12,13 @@ ------------------------------------------------------------------------- */ #include "fix_external.h" -#include + #include "atom.h" -#include "update.h" -#include "memory.h" #include "error.h" -#include "force.h" +#include "memory.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -41,14 +42,14 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"pf/callback") == 0) { if (narg != 6) error->all(FLERR,"Illegal fix external command"); mode = PF_CALLBACK; - ncall = force->inumeric(FLERR,arg[4]); - napply = force->inumeric(FLERR,arg[5]); + ncall = utils::inumeric(FLERR,arg[4],false,lmp); + napply = utils::inumeric(FLERR,arg[5],false,lmp); if (ncall <= 0 || napply <= 0) error->all(FLERR,"Illegal fix external command"); } else if (strcmp(arg[3],"pf/array") == 0) { if (narg != 5) error->all(FLERR,"Illegal fix external command"); mode = PF_ARRAY; - napply = force->inumeric(FLERR,arg[4]); + napply = utils::inumeric(FLERR,arg[4],false,lmp); if (napply <= 0) error->all(FLERR,"Illegal fix external command"); } else error->all(FLERR,"Illegal fix external command"); diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index 2c56181415..6dff937385 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -12,19 +12,19 @@ ------------------------------------------------------------------------- */ #include "fix_gravity.h" -#include + +#include "atom.h" +#include "domain.h" +#include "error.h" +#include "input.h" +#include "math_const.h" +#include "modify.h" +#include "respa.h" +#include "update.h" +#include "variable.h" + #include #include -#include "atom.h" -#include "update.h" -#include "domain.h" -#include "respa.h" -#include "modify.h" -#include "input.h" -#include "variable.h" -#include "math_const.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -58,7 +58,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(mstr,&arg[3][2]); mstyle = EQUAL; } else { - magnitude = force->numeric(FLERR,arg[3]); + magnitude = utils::numeric(FLERR,arg[3],false,lmp); mstyle = CONSTANT; } @@ -73,7 +73,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(vstr,&arg[5][2]); vstyle = EQUAL; } else { - vert = force->numeric(FLERR,arg[5]); + vert = utils::numeric(FLERR,arg[5],false,lmp); vstyle = CONSTANT; } iarg = 6; @@ -87,7 +87,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(pstr,&arg[5][2]); pstyle = EQUAL; } else { - phi = force->numeric(FLERR,arg[5]); + phi = utils::numeric(FLERR,arg[5],false,lmp); pstyle = CONSTANT; } if (strstr(arg[6],"v_") == arg[6]) { @@ -96,7 +96,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[6][2]); tstyle = EQUAL; } else { - theta = force->numeric(FLERR,arg[6]); + theta = utils::numeric(FLERR,arg[6],false,lmp); tstyle = CONSTANT; } iarg = 7; @@ -110,7 +110,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(xstr,&arg[5][2]); xstyle = EQUAL; } else { - xdir = force->numeric(FLERR,arg[5]); + xdir = utils::numeric(FLERR,arg[5],false,lmp); xstyle = CONSTANT; } if (strstr(arg[6],"v_") == arg[6]) { @@ -119,7 +119,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(ystr,&arg[6][2]); ystyle = EQUAL; } else { - ydir = force->numeric(FLERR,arg[6]); + ydir = utils::numeric(FLERR,arg[6],false,lmp); ystyle = CONSTANT; } if (strstr(arg[7],"v_") == arg[7]) { @@ -128,7 +128,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : strcpy(zstr,&arg[7][2]); zstyle = EQUAL; } else { - zdir = force->numeric(FLERR,arg[7]); + zdir = utils::numeric(FLERR,arg[7],false,lmp); zstyle = CONSTANT; } iarg = 8; diff --git a/src/fix_group.cpp b/src/fix_group.cpp index d2eea9f781..bb51fafa12 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -12,20 +12,21 @@ ------------------------------------------------------------------------- */ #include "fix_group.h" -#include -#include "group.h" -#include "update.h" + #include "atom.h" -#include "force.h" #include "comm.h" #include "domain.h" -#include "region.h" -#include "modify.h" -#include "respa.h" -#include "input.h" -#include "variable.h" -#include "memory.h" #include "error.h" +#include "group.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "region.h" +#include "respa.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -86,7 +87,7 @@ idregion(NULL), idvar(NULL), idprop(NULL) iarg += 2; } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); - nevery = force->inumeric(FLERR,arg[iarg+1]); + nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal group command"); iarg += 2; } else error->all(FLERR,"Illegal group command"); diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index c5960dfe13..f8222e3ece 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -12,21 +12,19 @@ ------------------------------------------------------------------------- */ #include "fix_halt.h" -#include + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "input.h" +#include "modify.h" +#include "neighbor.h" +#include "timer.h" +#include "update.h" +#include "variable.h" + #include #include -#include -#include "update.h" -#include "force.h" -#include "input.h" -#include "variable.h" -#include "atom.h" -#include "neighbor.h" -#include "modify.h" -#include "comm.h" -#include "timer.h" -#include "error.h" -#include "fmt/format.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -42,7 +40,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), idvar(NULL), dlimit_path(NULL) { if (narg < 7) error->all(FLERR,"Illegal fix halt command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix halt command"); // comparison args @@ -80,7 +78,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : else error->all(FLERR,"Invalid fix halt operator"); ++iarg; - value = force->numeric(FLERR,arg[iarg]); + value = utils::numeric(FLERR,arg[iarg],false,lmp); // parse optional args diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index 65ca47c46d..e2eb399322 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_heat.h" -#include + #include #include #include "atom.h" @@ -47,7 +47,7 @@ idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) global_freq = 1; extscalar = 0; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix heat command"); hstr = NULL; @@ -57,7 +57,7 @@ idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) hstr = new char[n]; strcpy(hstr,&arg[4][2]); } else { - heat_input = force->numeric(FLERR,arg[4]); + heat_input = utils::numeric(FLERR,arg[4],false,lmp); hstyle = CONSTANT; } diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 04837ff39b..ae58f27913 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -16,19 +16,19 @@ ------------------------------------------------------------------------- */ #include "fix_indent.h" -#include -#include -#include + #include "atom.h" -#include "input.h" -#include "variable.h" #include "domain.h" +#include "error.h" +#include "input.h" #include "lattice.h" -#include "update.h" #include "modify.h" #include "respa.h" -#include "error.h" -#include "force.h" +#include "update.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -53,7 +53,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - k = force->numeric(FLERR,arg[3]); + k = utils::numeric(FLERR,arg[3],false,lmp); k3 = k/3.0; // read options from end of input line @@ -421,22 +421,22 @@ void FixIndent::options(int narg, char **arg) int n = strlen(&arg[iarg+1][2]) + 1; xstr = new char[n]; strcpy(xstr,&arg[iarg+1][2]); - } else xvalue = force->numeric(FLERR,arg[iarg+1]); + } else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[iarg+2][2]); - } else yvalue = force->numeric(FLERR,arg[iarg+2]); + } else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[iarg+3][2]); - } else zvalue = force->numeric(FLERR,arg[iarg+3]); + } else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { int n = strlen(&arg[iarg+4][2]) + 1; rstr = new char[n]; strcpy(rstr,&arg[iarg+4][2]); - } else rvalue = force->numeric(FLERR,arg[iarg+4]); + } else rvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp); istyle = SPHERE; iarg += 5; @@ -450,43 +450,43 @@ void FixIndent::options(int narg, char **arg) int n = strlen(&arg[iarg+2][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[iarg+2][2]); - } else yvalue = force->numeric(FLERR,arg[iarg+2]); + } else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[iarg+3][2]); - } else zvalue = force->numeric(FLERR,arg[iarg+3]); + } else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); } else if (strcmp(arg[iarg+1],"y") == 0) { cdim = 1; if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; xstr = new char[n]; strcpy(xstr,&arg[iarg+2][2]); - } else xvalue = force->numeric(FLERR,arg[iarg+2]); + } else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[iarg+3][2]); - } else zvalue = force->numeric(FLERR,arg[iarg+3]); + } else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); } else if (strcmp(arg[iarg+1],"z") == 0) { cdim = 2; if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { int n = strlen(&arg[iarg+2][2]) + 1; xstr = new char[n]; strcpy(xstr,&arg[iarg+2][2]); - } else xvalue = force->numeric(FLERR,arg[iarg+2]); + } else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) { int n = strlen(&arg[iarg+3][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[iarg+3][2]); - } else yvalue = force->numeric(FLERR,arg[iarg+3]); + } else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); } else error->all(FLERR,"Illegal fix indent command"); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) { int n = strlen(&arg[iarg+4][2]) + 1; rstr = new char[n]; strcpy(rstr,&arg[iarg+4][2]); - } else rvalue = force->numeric(FLERR,arg[iarg+4]); + } else rvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp); istyle = CYLINDER; iarg += 5; @@ -502,7 +502,7 @@ void FixIndent::options(int narg, char **arg) int n = strlen(&arg[iarg+2][2]) + 1; pstr = new char[n]; strcpy(pstr,&arg[iarg+2][2]); - } else pvalue = force->numeric(FLERR,arg[iarg+2]); + } else pvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strcmp(arg[iarg+3],"lo") == 0) planeside = -1; else if (strcmp(arg[iarg+3],"hi") == 0) planeside = 1; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 4ec34a3631..9d0b5f28f1 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -20,7 +20,7 @@ ------------------------------------------------------------------------- */ #include "fix_langevin.h" -#include + #include #include #include "math_extra.h" @@ -38,7 +38,7 @@ #include "memory.h" #include "error.h" #include "group.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -69,14 +69,14 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : tstr = new char[n]; strcpy(tstr,&arg[3][2]); } else { - t_start = force->numeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[3],false,lmp); t_target = t_start; tstyle = CONSTANT; } - t_stop = force->numeric(FLERR,arg[4]); - t_period = force->numeric(FLERR,arg[5]); - seed = force->inumeric(FLERR,arg[6]); + t_stop = utils::numeric(FLERR,arg[4],false,lmp); + t_period = utils::numeric(FLERR,arg[5],false,lmp); + seed = utils::inumeric(FLERR,arg[6],false,lmp); if (t_period <= 0.0) error->all(FLERR,"Fix langevin period must be > 0.0"); if (seed <= 0) error->all(FLERR,"Illegal fix langevin command"); @@ -107,7 +107,7 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"angmom") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); if (strcmp(arg[iarg+1],"no") == 0) ascale = 0.0; - else ascale = force->numeric(FLERR,arg[iarg+1]); + else ascale = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"gjf") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); @@ -133,8 +133,8 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix langevin command"); - int itype = force->inumeric(FLERR,arg[iarg+1]); - double scale = force->numeric(FLERR,arg[iarg+2]); + int itype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + double scale = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Illegal fix langevin command"); ratio[itype] = scale; diff --git a/src/fix_lineforce.cpp b/src/fix_lineforce.cpp index c153ee65dd..cacec13302 100644 --- a/src/fix_lineforce.cpp +++ b/src/fix_lineforce.cpp @@ -12,13 +12,14 @@ ------------------------------------------------------------------------- */ #include "fix_lineforce.h" + +#include "atom.h" +#include "error.h" +#include "respa.h" +#include "update.h" + #include #include -#include "atom.h" -#include "update.h" -#include "respa.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -31,9 +32,9 @@ FixLineForce::FixLineForce(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; if (narg != 6) error->all(FLERR,"Illegal fix lineforce command"); - xdir = force->numeric(FLERR,arg[3]); - ydir = force->numeric(FLERR,arg[4]); - zdir = force->numeric(FLERR,arg[5]); + xdir = utils::numeric(FLERR,arg[3],false,lmp); + ydir = utils::numeric(FLERR,arg[4],false,lmp); + zdir = utils::numeric(FLERR,arg[5],false,lmp); double len = sqrt(xdir*xdir + ydir*ydir + zdir*zdir); if (len == 0.0) error->all(FLERR,"Illegal fix lineforce command"); diff --git a/src/fix_momentum.cpp b/src/fix_momentum.cpp index a363cb8eac..259099e07c 100644 --- a/src/fix_momentum.cpp +++ b/src/fix_momentum.cpp @@ -12,14 +12,14 @@ ------------------------------------------------------------------------- */ #include "fix_momentum.h" -#include -#include -#include + #include "atom.h" #include "domain.h" -#include "group.h" #include "error.h" -#include "force.h" +#include "group.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -34,7 +34,7 @@ FixMomentum::FixMomentum(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal fix momentum command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix momentum command"); dynamic = linear = angular = rescale = 0; @@ -44,9 +44,9 @@ FixMomentum::FixMomentum(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"linear") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix momentum command"); linear = 1; - xflag = force->inumeric(FLERR,arg[iarg+1]); - yflag = force->inumeric(FLERR,arg[iarg+2]); - zflag = force->inumeric(FLERR,arg[iarg+3]); + xflag = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + yflag = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + zflag = utils::inumeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"angular") == 0) { angular = 1; diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 8c58146c52..d6f61af091 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -75,17 +75,17 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[4],"NULL") == 0) vxflag = 0; else { vxflag = 1; - vx = force->numeric(FLERR,arg[4]); + vx = utils::numeric(FLERR,arg[4],false,lmp); } if (strcmp(arg[5],"NULL") == 0) vyflag = 0; else { vyflag = 1; - vy = force->numeric(FLERR,arg[5]); + vy = utils::numeric(FLERR,arg[5],false,lmp); } if (strcmp(arg[6],"NULL") == 0) vzflag = 0; else { vzflag = 1; - vz = force->numeric(FLERR,arg[6]); + vz = utils::numeric(FLERR,arg[6],false,lmp); } } else if (strcmp(arg[3],"wiggle") == 0) { @@ -95,32 +95,32 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[4],"NULL") == 0) axflag = 0; else { axflag = 1; - ax = force->numeric(FLERR,arg[4]); + ax = utils::numeric(FLERR,arg[4],false,lmp); } if (strcmp(arg[5],"NULL") == 0) ayflag = 0; else { ayflag = 1; - ay = force->numeric(FLERR,arg[5]); + ay = utils::numeric(FLERR,arg[5],false,lmp); } if (strcmp(arg[6],"NULL") == 0) azflag = 0; else { azflag = 1; - az = force->numeric(FLERR,arg[6]); + az = utils::numeric(FLERR,arg[6],false,lmp); } - period = force->numeric(FLERR,arg[7]); + period = utils::numeric(FLERR,arg[7],false,lmp); if (period <= 0.0) error->all(FLERR,"Illegal fix move command"); } else if (strcmp(arg[3],"rotate") == 0) { if (narg < 11) error->all(FLERR,"Illegal fix move command"); iarg = 11; mstyle = ROTATE; - point[0] = force->numeric(FLERR,arg[4]); - point[1] = force->numeric(FLERR,arg[5]); - point[2] = force->numeric(FLERR,arg[6]); - axis[0] = force->numeric(FLERR,arg[7]); - axis[1] = force->numeric(FLERR,arg[8]); - axis[2] = force->numeric(FLERR,arg[9]); - period = force->numeric(FLERR,arg[10]); + point[0] = utils::numeric(FLERR,arg[4],false,lmp); + point[1] = utils::numeric(FLERR,arg[5],false,lmp); + point[2] = utils::numeric(FLERR,arg[6],false,lmp); + axis[0] = utils::numeric(FLERR,arg[7],false,lmp); + axis[1] = utils::numeric(FLERR,arg[8],false,lmp); + axis[2] = utils::numeric(FLERR,arg[9],false,lmp); + period = utils::numeric(FLERR,arg[10],false,lmp); if (period <= 0.0) error->all(FLERR,"Illegal fix move command"); } else if (strcmp(arg[3],"variable") == 0) { diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index e3d0d2830a..43415a6ef5 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_neigh_history.h" -#include + #include #include "my_page.h" #include "atom.h" @@ -45,7 +45,7 @@ FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : newton_pair = force->newton_pair; - dnum = force->inumeric(FLERR,arg[3]); + dnum = utils::inumeric(FLERR,arg[3],false,lmp); dnumbytes = dnum * sizeof(double); zeroes = new double[dnum]; diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 014a2b8855..0e3dc8931f 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -129,10 +129,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"temp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); tstat_flag = 1; - t_start = force->numeric(FLERR,arg[iarg+1]); + t_start = utils::numeric(FLERR,arg[iarg+1],false,lmp); t_target = t_start; - t_stop = force->numeric(FLERR,arg[iarg+2]); - t_period = force->numeric(FLERR,arg[iarg+3]); + t_stop = utils::numeric(FLERR,arg[iarg+2],false,lmp); + t_period = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (t_start <= 0.0 || t_stop <= 0.0) error->all(FLERR, "Target temperature for fix nvt/npt/nph cannot be 0.0"); @@ -141,10 +141,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"iso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = XYZ; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -154,10 +154,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"aniso") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = NONE; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -168,15 +168,15 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); pcouple = NONE; scalexy = scalexz = scaleyz = 0; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); p_period[0] = p_period[1] = p_period[2] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; p_start[3] = p_start[4] = p_start[5] = 0.0; p_stop[3] = p_stop[4] = p_stop[5] = 0.0; p_period[3] = p_period[4] = p_period[5] = - force->numeric(FLERR,arg[iarg+3]); + utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[3] = p_flag[4] = p_flag[5] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -189,25 +189,25 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : iarg += 4; } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[0] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = 1; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[1] = force->numeric(FLERR,arg[iarg+1]); - p_stop[1] = force->numeric(FLERR,arg[iarg+2]); - p_period[1] = force->numeric(FLERR,arg[iarg+3]); + p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[1] = 1; deviatoric_flag = 1; iarg += 4; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[2] = 1; deviatoric_flag = 1; iarg += 4; @@ -216,9 +216,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"yz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[3] = force->numeric(FLERR,arg[iarg+1]); - p_stop[3] = force->numeric(FLERR,arg[iarg+2]); - p_period[3] = force->numeric(FLERR,arg[iarg+3]); + p_start[3] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[3] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[3] = 1; deviatoric_flag = 1; scaleyz = 0; @@ -227,9 +227,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); } else if (strcmp(arg[iarg],"xz") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[4] = force->numeric(FLERR,arg[iarg+1]); - p_stop[4] = force->numeric(FLERR,arg[iarg+2]); - p_period[4] = force->numeric(FLERR,arg[iarg+3]); + p_start[4] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[4] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[4] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[4] = 1; deviatoric_flag = 1; scalexz = 0; @@ -238,9 +238,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Invalid fix nvt/npt/nph command for a 2d simulation"); } else if (strcmp(arg[iarg],"xy") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_start[5] = force->numeric(FLERR,arg[iarg+1]); - p_stop[5] = force->numeric(FLERR,arg[iarg+2]); - p_period[5] = force->numeric(FLERR,arg[iarg+3]); + p_start[5] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[5] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[5] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[5] = 1; deviatoric_flag = 1; scalexy = 0; @@ -258,12 +258,12 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"drag") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - drag = force->numeric(FLERR,arg[iarg+1]); + drag = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (drag < 0.0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"ptemp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - p_temp = force->numeric(FLERR,arg[iarg+1]); + p_temp = utils::numeric(FLERR,arg[iarg+1],false,lmp); p_temp_flag = 1; if (p_temp <= 0.0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; @@ -284,14 +284,14 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"tchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - mtchain = force->inumeric(FLERR,arg[iarg+1]); + mtchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); // used by FixNVTSllod to preserve non-default value mtchain_default_flag = 0; if (mtchain < 1) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"pchain") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - mpchain = force->inumeric(FLERR,arg[iarg+1]); + mpchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (mpchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"mtk") == 0) { @@ -302,17 +302,17 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"tloop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nc_tchain = force->inumeric(FLERR,arg[iarg+1]); + nc_tchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nc_tchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"ploop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nc_pchain = force->inumeric(FLERR,arg[iarg+1]); + nc_pchain = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nc_pchain < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"nreset") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - nreset_h0 = force->inumeric(FLERR,arg[iarg+1]); + nreset_h0 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nreset_h0 < 0) error->all(FLERR,"Illegal fix nvt/npt/nph command"); iarg += 2; } else if (strcmp(arg[iarg],"scalexy") == 0) { @@ -349,9 +349,9 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"fixedpoint") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix nvt/npt/nph command"); - fixedpoint[0] = force->numeric(FLERR,arg[iarg+1]); - fixedpoint[1] = force->numeric(FLERR,arg[iarg+2]); - fixedpoint[2] = force->numeric(FLERR,arg[iarg+3]); + fixedpoint[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + fixedpoint[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + fixedpoint[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; // disc keyword is also parsed in fix/nh/sphere diff --git a/src/fix_nh.h b/src/fix_nh.h index 624b0c8bb4..f137ecbe55 100644 --- a/src/fix_nh.h +++ b/src/fix_nh.h @@ -14,7 +14,7 @@ #ifndef LMP_FIX_NH_H #define LMP_FIX_NH_H -#include "fix.h" +#include "fix.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/fix_nh_sphere.cpp b/src/fix_nh_sphere.cpp index 1ff3fc2d4d..d60798e007 100644 --- a/src/fix_nh_sphere.cpp +++ b/src/fix_nh_sphere.cpp @@ -16,15 +16,16 @@ ------------------------------------------------------------------------- */ #include "fix_nh_sphere.h" -#include -#include + #include "atom.h" -#include "atom_vec.h" +#include "domain.h" #include "error.h" #include "force.h" -#include "domain.h" -#include "math_vector.h" #include "math_extra.h" +#include "math_vector.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_nph.cpp b/src/fix_nph.cpp index 9251ce384e..f4ff71d3a3 100644 --- a/src/fix_nph.cpp +++ b/src/fix_nph.cpp @@ -13,7 +13,7 @@ #include "fix_nph.h" #include -#include + #include "modify.h" #include "error.h" diff --git a/src/fix_nph_sphere.cpp b/src/fix_nph_sphere.cpp index cf2298f5f8..b49eb0c5c5 100644 --- a/src/fix_nph_sphere.cpp +++ b/src/fix_nph_sphere.cpp @@ -13,7 +13,7 @@ #include "fix_nph_sphere.h" #include -#include + #include "modify.h" #include "error.h" diff --git a/src/fix_npt.cpp b/src/fix_npt.cpp index 6949ead1d6..f6ec24991b 100644 --- a/src/fix_npt.cpp +++ b/src/fix_npt.cpp @@ -13,7 +13,7 @@ #include "fix_npt.h" #include -#include + #include "modify.h" #include "error.h" diff --git a/src/fix_npt_sphere.cpp b/src/fix_npt_sphere.cpp index e38d88fadd..1bd879c786 100644 --- a/src/fix_npt_sphere.cpp +++ b/src/fix_npt_sphere.cpp @@ -13,7 +13,7 @@ #include "fix_npt_sphere.h" #include -#include + #include "modify.h" #include "error.h" diff --git a/src/fix_numdiff.cpp b/src/fix_numdiff.cpp index a4ac86e0c5..145d60e8df 100644 --- a/src/fix_numdiff.cpp +++ b/src/fix_numdiff.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "fix_numdiff.h" -#include + #include #include "atom.h" #include "domain.h" @@ -50,8 +50,8 @@ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 3; respa_level_support = 1; - nevery = force->inumeric(FLERR,arg[3]); - delta = force->numeric(FLERR,arg[4]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + delta = utils::numeric(FLERR,arg[4],false,lmp); if (nevery <= 0 || delta <= 0.0) error->all(FLERR,"Illegal fix numdiff command"); diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index d63c736e73..ed79c6b21b 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "fix_nve_limit.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "modify.h" #include "comm.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -40,7 +40,7 @@ FixNVELimit::FixNVELimit(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; dynamic_group_allow = 1; - xlimit = force->numeric(FLERR,arg[3]); + xlimit = utils::numeric(FLERR,arg[3],false,lmp); ncount = 0; } diff --git a/src/fix_nve_sphere.cpp b/src/fix_nve_sphere.cpp index c0fea17c2b..87fba3eca3 100644 --- a/src/fix_nve_sphere.cpp +++ b/src/fix_nve_sphere.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "fix_nve_sphere.h" -#include -#include + #include "atom.h" #include "domain.h" -#include "atom_vec.h" -#include "force.h" #include "error.h" -#include "math_vector.h" +#include "force.h" #include "math_extra.h" +#include "math_vector.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_nvt.cpp b/src/fix_nvt.cpp index 7868693b69..f7a53cf382 100644 --- a/src/fix_nvt.cpp +++ b/src/fix_nvt.cpp @@ -13,11 +13,11 @@ #include "fix_nvt.h" #include -#include + #include "group.h" #include "modify.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_nvt_sllod.cpp b/src/fix_nvt_sllod.cpp index ccf7aaecaf..3cc88772d7 100644 --- a/src/fix_nvt_sllod.cpp +++ b/src/fix_nvt_sllod.cpp @@ -26,7 +26,7 @@ #include "fix_deform.h" #include "compute.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_nvt_sphere.cpp b/src/fix_nvt_sphere.cpp index 40c3ba19e3..7c4159455f 100644 --- a/src/fix_nvt_sphere.cpp +++ b/src/fix_nvt_sphere.cpp @@ -13,11 +13,11 @@ #include "fix_nvt_sphere.h" #include -#include + #include "group.h" #include "modify.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_planeforce.cpp b/src/fix_planeforce.cpp index a3f27277bd..2e3bcadd69 100644 --- a/src/fix_planeforce.cpp +++ b/src/fix_planeforce.cpp @@ -12,13 +12,14 @@ ------------------------------------------------------------------------- */ #include "fix_planeforce.h" + +#include "atom.h" +#include "error.h" +#include "respa.h" +#include "update.h" + #include #include -#include "atom.h" -#include "update.h" -#include "respa.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -31,9 +32,9 @@ FixPlaneForce::FixPlaneForce(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; if (narg != 6) error->all(FLERR,"Illegal fix planeforce command"); - xdir = force->numeric(FLERR,arg[3]); - ydir = force->numeric(FLERR,arg[4]); - zdir = force->numeric(FLERR,arg[5]); + xdir = utils::numeric(FLERR,arg[3],false,lmp); + ydir = utils::numeric(FLERR,arg[4],false,lmp); + zdir = utils::numeric(FLERR,arg[5],false,lmp); double len = sqrt(xdir*xdir + ydir*ydir + zdir*zdir); if (len == 0.0) error->all(FLERR,"Illegal fix planeforce command"); diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index db6d56799a..a90bf86c56 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -14,7 +14,7 @@ #include "fix_press_berendsen.h" #include #include -#include + #include "atom.h" #include "force.h" #include "comm.h" @@ -68,9 +68,9 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); pcouple = XYZ; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = p_period[1] = p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -81,9 +81,9 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); pcouple = NONE; - p_start[0] = p_start[1] = p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = p_stop[1] = p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = p_period[1] = p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = p_start[1] = p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = p_stop[1] = p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = p_period[1] = p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = p_flag[1] = p_flag[2] = 1; if (dimension == 2) { p_start[2] = p_stop[2] = p_period[2] = 0.0; @@ -94,25 +94,25 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); - p_start[0] = force->numeric(FLERR,arg[iarg+1]); - p_stop[0] = force->numeric(FLERR,arg[iarg+2]); - p_period[0] = force->numeric(FLERR,arg[iarg+3]); + p_start[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[0] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[0] = 1; iarg += 4; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); - p_start[1] = force->numeric(FLERR,arg[iarg+1]); - p_stop[1] = force->numeric(FLERR,arg[iarg+2]); - p_period[1] = force->numeric(FLERR,arg[iarg+3]); + p_start[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[1] = 1; iarg += 4; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); - p_start[2] = force->numeric(FLERR,arg[iarg+1]); - p_stop[2] = force->numeric(FLERR,arg[iarg+2]); - p_period[2] = force->numeric(FLERR,arg[iarg+3]); + p_start[2] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + p_stop[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + p_period[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); p_flag[2] = 1; iarg += 4; if (dimension == 2) @@ -132,7 +132,7 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"modulus") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix press/berendsen command"); - bulkmodulus = force->numeric(FLERR,arg[iarg+1]); + bulkmodulus = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (bulkmodulus <= 0.0) error->all(FLERR,"Illegal fix press/berendsen command"); iarg += 2; diff --git a/src/fix_print.cpp b/src/fix_print.cpp index fac639ae63..78fceea184 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -12,17 +12,15 @@ ------------------------------------------------------------------------- */ #include "fix_print.h" -#include -#include -#include "update.h" -#include "input.h" -#include "modify.h" -#include "variable.h" -#include "memory.h" + #include "error.h" -#include "force.h" -#include "utils.h" -#include "fmt/format.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -40,7 +38,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : strcpy(var_print,&arg[3][2]); nevery = 1; } else { - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix print command"); } diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 374d0069fd..07108721c4 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -12,14 +12,14 @@ ------------------------------------------------------------------------- */ #include "fix_property_atom.h" -#include + #include #include "atom.h" #include "comm.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index afedf9c12c..2e10b15ffa 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #include "fix_read_restart.h" + #include "atom.h" #include "memory.h" -#include "force.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -25,8 +25,8 @@ FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), count(NULL), extra(NULL) { - nextra = force->inumeric(FLERR,arg[3]); - int nfix = force->inumeric(FLERR,arg[4]); + nextra = utils::inumeric(FLERR,arg[3],false,lmp); + int nfix = utils::inumeric(FLERR,arg[4],false,lmp); // perform initial allocation of atom-based array // register with Atom class diff --git a/src/fix_recenter.cpp b/src/fix_recenter.cpp index f461e0fa52..3f9eec9ee4 100644 --- a/src/fix_recenter.cpp +++ b/src/fix_recenter.cpp @@ -16,18 +16,19 @@ ------------------------------------------------------------------------- */ #include "fix_recenter.h" -#include -#include + #include "atom.h" -#include "group.h" -#include "update.h" +#include "comm.h" #include "domain.h" +#include "error.h" +#include "group.h" #include "lattice.h" #include "modify.h" -#include "comm.h" #include "respa.h" -#include "error.h" -#include "force.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -56,13 +57,13 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"NULL") == 0) xflag = 0; else if (strcmp(arg[3],"INIT") == 0) xinitflag = 1; - else xcom = force->numeric(FLERR,arg[3]); + else xcom = utils::numeric(FLERR,arg[3],false,lmp); if (strcmp(arg[4],"NULL") == 0) yflag = 0; else if (strcmp(arg[4],"INIT") == 0) yinitflag = 1; - else ycom = force->numeric(FLERR,arg[4]); + else ycom = utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"NULL") == 0) zflag = 0; else if (strcmp(arg[5],"INIT") == 0) zinitflag = 1; - else zcom = force->numeric(FLERR,arg[5]); + else zcom = utils::numeric(FLERR,arg[5],false,lmp); // optional args diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index 742dd5c58b..b116f8ccac 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "fix_respa.h" -#include + #include "atom.h" -#include "force.h" #include "memory.h" +#include + using namespace LAMMPS_NS; using namespace FixConst; @@ -28,7 +29,7 @@ FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : { // nlevels = # of rRESPA levels - nlevels = force->inumeric(FLERR,arg[3]); + nlevels = utils::inumeric(FLERR,arg[3],false,lmp); // optional arguments store_torque = 0; diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 07ff7dc13c..4f675bf7bf 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_restrain.h" -#include + #include #include #include "atom.h" @@ -29,7 +29,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -83,62 +83,62 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"bond") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = BOND; - ids[nrestrain][0] = force->tnumeric(FLERR,arg[iarg+1]); - ids[nrestrain][1] = force->tnumeric(FLERR,arg[iarg+2]); - kstart[nrestrain] = force->numeric(FLERR,arg[iarg+3]); - kstop[nrestrain] = force->numeric(FLERR,arg[iarg+4]); - deqstart[nrestrain] = force->numeric(FLERR,arg[iarg+5]); + ids[nrestrain][0] = utils::tnumeric(FLERR,arg[iarg+1],false,lmp); + ids[nrestrain][1] = utils::tnumeric(FLERR,arg[iarg+2],false,lmp); + kstart[nrestrain] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + kstop[nrestrain] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + deqstart[nrestrain] = utils::numeric(FLERR,arg[iarg+5],false,lmp); if (iarg+6 == narg) { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); + deqstop[nrestrain] = utils::numeric(FLERR,arg[iarg+5],false,lmp); iarg += 6; } else { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); + deqstop[nrestrain] = utils::numeric(FLERR,arg[iarg+6],false,lmp); iarg += 7; } } else if (strcmp(arg[iarg],"lbound") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = LBOUND; - ids[nrestrain][0] = force->tnumeric(FLERR,arg[iarg+1]); - ids[nrestrain][1] = force->tnumeric(FLERR,arg[iarg+2]); - kstart[nrestrain] = force->numeric(FLERR,arg[iarg+3]); - kstop[nrestrain] = force->numeric(FLERR,arg[iarg+4]); - deqstart[nrestrain] = force->numeric(FLERR,arg[iarg+5]); + ids[nrestrain][0] = utils::tnumeric(FLERR,arg[iarg+1],false,lmp); + ids[nrestrain][1] = utils::tnumeric(FLERR,arg[iarg+2],false,lmp); + kstart[nrestrain] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + kstop[nrestrain] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + deqstart[nrestrain] = utils::numeric(FLERR,arg[iarg+5],false,lmp); if (iarg+6 == narg) { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); + deqstop[nrestrain] = utils::numeric(FLERR,arg[iarg+5],false,lmp); iarg += 6; } else { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); + deqstop[nrestrain] = utils::numeric(FLERR,arg[iarg+6],false,lmp); iarg += 7; } } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+7 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = ANGLE; - ids[nrestrain][0] = force->tnumeric(FLERR,arg[iarg+1]); - ids[nrestrain][1] = force->tnumeric(FLERR,arg[iarg+2]); - ids[nrestrain][2] = force->tnumeric(FLERR,arg[iarg+3]); - kstart[nrestrain] = force->numeric(FLERR,arg[iarg+4]); - kstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); - target[nrestrain] = force->numeric(FLERR,arg[iarg+6]); + ids[nrestrain][0] = utils::tnumeric(FLERR,arg[iarg+1],false,lmp); + ids[nrestrain][1] = utils::tnumeric(FLERR,arg[iarg+2],false,lmp); + ids[nrestrain][2] = utils::tnumeric(FLERR,arg[iarg+3],false,lmp); + kstart[nrestrain] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + kstop[nrestrain] = utils::numeric(FLERR,arg[iarg+5],false,lmp); + target[nrestrain] = utils::numeric(FLERR,arg[iarg+6],false,lmp); target[nrestrain] *= MY_PI / 180.0; iarg += 7; } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+8 > narg) error->all(FLERR,"Illegal fix restrain command"); rstyle[nrestrain] = DIHEDRAL; mult[nrestrain] = 1; - ids[nrestrain][0] = force->tnumeric(FLERR,arg[iarg+1]); - ids[nrestrain][1] = force->tnumeric(FLERR,arg[iarg+2]); - ids[nrestrain][2] = force->tnumeric(FLERR,arg[iarg+3]); - ids[nrestrain][3] = force->tnumeric(FLERR,arg[iarg+4]); - kstart[nrestrain] = force->numeric(FLERR,arg[iarg+5]); - kstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); - target[nrestrain] = force->numeric(FLERR,arg[iarg+7]); + ids[nrestrain][0] = utils::tnumeric(FLERR,arg[iarg+1],false,lmp); + ids[nrestrain][1] = utils::tnumeric(FLERR,arg[iarg+2],false,lmp); + ids[nrestrain][2] = utils::tnumeric(FLERR,arg[iarg+3],false,lmp); + ids[nrestrain][3] = utils::tnumeric(FLERR,arg[iarg+4],false,lmp); + kstart[nrestrain] = utils::numeric(FLERR,arg[iarg+5],false,lmp); + kstop[nrestrain] = utils::numeric(FLERR,arg[iarg+6],false,lmp); + target[nrestrain] = utils::numeric(FLERR,arg[iarg+7],false,lmp); target[nrestrain] *= MY_PI / 180.0; cos_target[nrestrain] = cos(target[nrestrain]); sin_target[nrestrain] = sin(target[nrestrain]); iarg += 8; if ((iarg < narg) && (strcmp("mult",arg[iarg]) == 0)) { if (iarg+1 > narg) error->all(FLERR,"Illegal fix restrain command"); - mult[nrestrain] = force->inumeric(FLERR,arg[iarg+1]); + mult[nrestrain] = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (mult[nrestrain] < 0) error->all(FLERR,"Illegal fix restrain command"); iarg += 2; diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 108d18afb6..229890c5df 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -12,19 +12,19 @@ ------------------------------------------------------------------------- */ #include "fix_setforce.h" -#include -#include + #include "atom.h" -#include "update.h" -#include "modify.h" #include "domain.h" +#include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" #include "region.h" #include "respa.h" -#include "input.h" +#include "update.h" #include "variable.h" -#include "memory.h" -#include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -55,7 +55,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[3],"NULL") == 0) { xstyle = NONE; } else { - xvalue = force->numeric(FLERR,arg[3]); + xvalue = utils::numeric(FLERR,arg[3],false,lmp); xstyle = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -65,7 +65,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4],"NULL") == 0) { ystyle = NONE; } else { - yvalue = force->numeric(FLERR,arg[4]); + yvalue = utils::numeric(FLERR,arg[4],false,lmp); ystyle = CONSTANT; } if (strstr(arg[5],"v_") == arg[5]) { @@ -75,7 +75,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[5],"NULL") == 0) { zstyle = NONE; } else { - zvalue = force->numeric(FLERR,arg[5]); + zvalue = utils::numeric(FLERR,arg[5],false,lmp); zstyle = CONSTANT; } diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 510b194ab7..2d695add26 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -16,14 +16,15 @@ ------------------------------------------------------------------------- */ #include "fix_spring.h" + +#include "atom.h" +#include "error.h" +#include "group.h" +#include "respa.h" +#include "update.h" + #include #include -#include "atom.h" -#include "update.h" -#include "respa.h" -#include "force.h" -#include "group.h" -#include "error.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -53,15 +54,15 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[3],"tether") == 0) { if (narg != 9) error->all(FLERR,"Illegal fix spring command"); styleflag = TETHER; - k_spring = force->numeric(FLERR,arg[4]); + k_spring = utils::numeric(FLERR,arg[4],false,lmp); xflag = yflag = zflag = 1; if (strcmp(arg[5],"NULL") == 0) xflag = 0; - else xc = force->numeric(FLERR,arg[5]); + else xc = utils::numeric(FLERR,arg[5],false,lmp); if (strcmp(arg[6],"NULL") == 0) yflag = 0; - else yc = force->numeric(FLERR,arg[6]); + else yc = utils::numeric(FLERR,arg[6],false,lmp); if (strcmp(arg[7],"NULL") == 0) zflag = 0; - else zc = force->numeric(FLERR,arg[7]); - r0 = force->numeric(FLERR,arg[8]); + else zc = utils::numeric(FLERR,arg[7],false,lmp); + r0 = utils::numeric(FLERR,arg[8],false,lmp); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix spring command"); } else if (strcmp(arg[3],"couple") == 0) { @@ -78,15 +79,15 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Two groups cannot be the same in fix spring couple"); group2bit = group->bitmask[igroup2]; - k_spring = force->numeric(FLERR,arg[5]); + k_spring = utils::numeric(FLERR,arg[5],false,lmp); xflag = yflag = zflag = 1; if (strcmp(arg[6],"NULL") == 0) xflag = 0; - else xc = force->numeric(FLERR,arg[6]); + else xc = utils::numeric(FLERR,arg[6],false,lmp); if (strcmp(arg[7],"NULL") == 0) yflag = 0; - else yc = force->numeric(FLERR,arg[7]); + else yc = utils::numeric(FLERR,arg[7],false,lmp); if (strcmp(arg[8],"NULL") == 0) zflag = 0; - else zc = force->numeric(FLERR,arg[8]); - r0 = force->numeric(FLERR,arg[9]); + else zc = utils::numeric(FLERR,arg[8],false,lmp); + r0 = utils::numeric(FLERR,arg[9],false,lmp); if (r0 < 0) error->all(FLERR,"R0 < 0 for fix spring command"); } else error->all(FLERR,"Illegal fix spring command"); diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index f9f36e11e9..d8de88bd63 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -12,18 +12,19 @@ ------------------------------------------------------------------------- */ #include "fix_spring_chunk.h" -#include -#include + #include "atom.h" #include "comm.h" -#include "update.h" -#include "force.h" -#include "respa.h" -#include "modify.h" #include "compute_chunk_atom.h" #include "compute_com_chunk.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "modify.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -45,7 +46,7 @@ FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - k_spring = force->numeric(FLERR,arg[3]); + k_spring = utils::numeric(FLERR,arg[3],false,lmp); int n = strlen(arg[4]) + 1; idchunk = new char[n]; diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 1c65023169..5715e7eb88 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -17,15 +17,16 @@ ------------------------------------------------------------------------- */ #include "fix_spring_rg.h" -#include + #include "atom.h" #include "comm.h" -#include "update.h" -#include "group.h" -#include "respa.h" #include "domain.h" #include "error.h" -#include "force.h" +#include "group.h" +#include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -37,10 +38,10 @@ FixSpringRG::FixSpringRG(LAMMPS *lmp, int narg, char **arg) : { if (narg != 5) error->all(FLERR,"Illegal fix spring/rg command"); - k = force->numeric(FLERR,arg[3]); + k = utils::numeric(FLERR,arg[3],false,lmp); rg0_flag = 0; if (strcmp(arg[4],"NULL") == 0) rg0_flag = 1; - else rg0 = force->numeric(FLERR,arg[4]); + else rg0 = utils::numeric(FLERR,arg[4],false,lmp); restart_global = 1; scalar_flag = 1; diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 4f8a03c8bd..8e7b3eb925 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -16,15 +16,15 @@ ------------------------------------------------------------------------- */ #include "fix_spring_self.h" -#include -#include + #include "atom.h" -#include "update.h" #include "domain.h" -#include "respa.h" -#include "memory.h" #include "error.h" -#include "force.h" +#include "memory.h" +#include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -44,7 +44,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; respa_level_support = 1; - k = force->numeric(FLERR,arg[3]); + k = utils::numeric(FLERR,arg[3],false,lmp); if (k <= 0.0) error->all(FLERR,"Illegal fix spring/self command"); xflag = yflag = zflag = 1; diff --git a/src/fix_store.cpp b/src/fix_store.cpp index 3cf3125be5..3eb2075250 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -12,12 +12,13 @@ ------------------------------------------------------------------------- */ #include "fix_store.h" -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "memory.h" #include "error.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -52,16 +53,16 @@ vstore(NULL), astore(NULL), rbuf(NULL) if (flavor == GLOBAL) { restart_global = 1; - nrow = force->inumeric(FLERR,arg[4]); - ncol = force->inumeric(FLERR,arg[5]); + nrow = utils::inumeric(FLERR,arg[4],false,lmp); + ncol = utils::inumeric(FLERR,arg[5],false,lmp); if (nrow <= 0 || ncol <= 0) error->all(FLERR,"Illegal fix store command"); vecflag = 0; if (ncol == 1) vecflag = 1; } if (flavor == PERATOM) { - restart_peratom = force->inumeric(FLERR,arg[4]); - nvalues = force->inumeric(FLERR,arg[5]); + restart_peratom = utils::inumeric(FLERR,arg[4],false,lmp); + nvalues = utils::inumeric(FLERR,arg[5],false,lmp); if (restart_peratom < 0 or restart_peratom > 1 || nvalues <= 0) error->all(FLERR,"Illegal fix store command"); vecflag = 0; diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index e1e2aab663..fd4563b7ad 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -12,20 +12,20 @@ ------------------------------------------------------------------------- */ #include "fix_store_state.h" -#include -#include + #include "atom.h" -#include "domain.h" -#include "update.h" -#include "group.h" -#include "modify.h" #include "compute.h" -#include "fix.h" -#include "input.h" -#include "variable.h" -#include "memory.h" +#include "domain.h" #include "error.h" -#include "force.h" +#include "fix.h" +#include "group.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -47,7 +47,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : restart_peratom = 1; peratom_freq = 1; - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery < 0) error->all(FLERR,"Illegal fix store/state command"); // parse values until one isn't recognized diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 7a1d1d06fc..ec2965d072 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -13,7 +13,7 @@ #include "fix_temp_berendsen.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -25,7 +25,7 @@ #include "modify.h" #include "compute.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -57,13 +57,13 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[3][2]); tstyle = EQUAL; } else { - t_start = force->numeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[3],false,lmp); t_target = t_start; tstyle = CONSTANT; } - t_stop = force->numeric(FLERR,arg[4]); - t_period = force->numeric(FLERR,arg[5]); + t_stop = utils::numeric(FLERR,arg[4],false,lmp); + t_period = utils::numeric(FLERR,arg[5],false,lmp); // error checks diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index 89664d9913..cf7e9e9fe2 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -17,7 +17,7 @@ #include "fix_temp_csld.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -31,7 +31,7 @@ #include "compute.h" #include "random_mars.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -63,14 +63,14 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[3][2]); tstyle = EQUAL; } else { - t_start = force->numeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[3],false,lmp); t_target = t_start; tstyle = CONSTANT; } - t_stop = force->numeric(FLERR,arg[4]); - t_period = force->numeric(FLERR,arg[5]); - int seed = force->inumeric(FLERR,arg[6]); + t_stop = utils::numeric(FLERR,arg[4],false,lmp); + t_period = utils::numeric(FLERR,arg[5],false,lmp); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); // error checks diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index 90200e2566..c620905102 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -17,10 +17,10 @@ ------------------------------------------------------------------------- */ #include "fix_temp_csvr.h" -#include + #include #include -#include + #include "atom.h" #include "force.h" #include "comm.h" @@ -32,7 +32,7 @@ #include "compute.h" #include "random_mars.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -140,14 +140,14 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[3][2]); tstyle = EQUAL; } else { - t_start = force->numeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[3],false,lmp); t_target = t_start; tstyle = CONSTANT; } - t_stop = force->numeric(FLERR,arg[4]); - t_period = force->numeric(FLERR,arg[5]); - int seed = force->inumeric(FLERR,arg[6]); + t_stop = utils::numeric(FLERR,arg[4],false,lmp); + t_period = utils::numeric(FLERR,arg[5],false,lmp); + int seed = utils::inumeric(FLERR,arg[6],false,lmp); // error checks diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 083f590c9a..b5cb9c9a1b 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -13,7 +13,7 @@ #include "fix_temp_rescale.h" #include -#include + #include #include "atom.h" #include "force.h" @@ -25,7 +25,7 @@ #include "modify.h" #include "compute.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; using namespace FixConst; @@ -41,7 +41,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale command"); restart_global = 1; @@ -57,14 +57,14 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : strcpy(tstr,&arg[4][2]); tstyle = EQUAL; } else { - t_start = force->numeric(FLERR,arg[4]); + t_start = utils::numeric(FLERR,arg[4],false,lmp); t_target = t_start; tstyle = CONSTANT; } - t_stop = force->numeric(FLERR,arg[5]); - t_window = force->numeric(FLERR,arg[6]); - fraction = force->numeric(FLERR,arg[7]); + t_stop = utils::numeric(FLERR,arg[5],false,lmp); + t_window = utils::numeric(FLERR,arg[6],false,lmp); + fraction = utils::numeric(FLERR,arg[7],false,lmp); // create a new compute temp // id = fix-ID + temp, compute group = fix group diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 5db7bacbc6..12e36d890e 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "fix_tmd.h" -#include + #include #include #include "atom.h" @@ -29,8 +29,8 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + + using namespace LAMMPS_NS; using namespace FixConst; @@ -45,8 +45,8 @@ nfileevery(0), fp(NULL), xf(NULL), xold(NULL) { if (narg < 6) error->all(FLERR,"Illegal fix tmd command"); - rho_stop = force->numeric(FLERR,arg[3]); - nfileevery = force->inumeric(FLERR,arg[5]); + rho_stop = utils::numeric(FLERR,arg[3],false,lmp); + nfileevery = utils::inumeric(FLERR,arg[5],false,lmp); if (rho_stop < 0 || nfileevery < 0) error->all(FLERR,"Illegal fix tmd command"); if (nfileevery && narg != 7) error->all(FLERR,"Illegal fix tmd command"); diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index 53093acbf6..6bcdfe948e 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -12,16 +12,16 @@ ------------------------------------------------------------------------- */ #include "fix_vector.h" -#include -#include -#include "update.h" -#include "force.h" -#include "modify.h" + #include "compute.h" -#include "input.h" -#include "variable.h" -#include "memory.h" #include "error.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -42,7 +42,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : { if (narg < 5) error->all(FLERR,"Illegal fix vector command"); - nevery = force->inumeric(FLERR,arg[3]); + nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix vector command"); nvalues = narg-4; diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index bdd1e19976..08649280d8 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -12,12 +12,13 @@ ------------------------------------------------------------------------- */ #include "fix_viscous.h" -#include + #include "atom.h" -#include "update.h" -#include "respa.h" #include "error.h" -#include "force.h" +#include "respa.h" +#include "update.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -32,7 +33,7 @@ FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix viscous command"); - double gamma_one = force->numeric(FLERR,arg[3]); + double gamma_one = utils::numeric(FLERR,arg[3],false,lmp); gamma = new double[atom->ntypes+1]; for (int i = 1; i <= atom->ntypes; i++) gamma[i] = gamma_one; @@ -42,8 +43,8 @@ FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"scale") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal fix viscous command"); - int itype = force->inumeric(FLERR,arg[iarg+1]); - double scale = force->numeric(FLERR,arg[iarg+2]); + int itype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + double scale = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (itype <= 0 || itype > atom->ntypes) error->all(FLERR,"Illegal fix viscous command"); gamma[itype] = gamma_one * scale; diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index a30b14c231..cb822f1090 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -12,18 +12,17 @@ ------------------------------------------------------------------------- */ #include "fix_wall.h" -#include -#include -#include "input.h" -#include "variable.h" + #include "domain.h" +#include "error.h" +#include "input.h" #include "lattice.h" -#include "update.h" #include "modify.h" #include "respa.h" -#include "error.h" -#include "force.h" -#include "utils.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -87,7 +86,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(xstr[nwall],&arg[iarg+1][2]); } else { xstyle[nwall] = CONSTANT; - coord0[nwall] = force->numeric(FLERR,arg[iarg+1]); + coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp); } if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) { @@ -96,7 +95,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(estr[nwall],&arg[iarg+2][2]); estyle[nwall] = VARIABLE; } else { - epsilon[nwall] = force->numeric(FLERR,arg[iarg+2]); + epsilon[nwall] = utils::numeric(FLERR,arg[iarg+2],false,lmp); estyle[nwall] = CONSTANT; } @@ -107,7 +106,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(astr[nwall],&arg[iarg+3][2]); astyle[nwall] = VARIABLE; } else { - alpha[nwall] = force->numeric(FLERR,arg[iarg+3]); + alpha[nwall] = utils::numeric(FLERR,arg[iarg+3],false,lmp); astyle[nwall] = CONSTANT; } ++iarg; @@ -119,11 +118,11 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : strcpy(sstr[nwall],&arg[iarg+3][2]); sstyle[nwall] = VARIABLE; } else { - sigma[nwall] = force->numeric(FLERR,arg[iarg+3]); + sigma[nwall] = utils::numeric(FLERR,arg[iarg+3],false,lmp); sstyle[nwall] = CONSTANT; } - cutoff[nwall] = force->numeric(FLERR,arg[iarg+4]); + cutoff[nwall] = utils::numeric(FLERR,arg[iarg+4],false,lmp); nwall++; iarg += 5; diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index 032a11e328..227ef66564 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -12,17 +12,18 @@ ------------------------------------------------------------------------- */ #include "fix_wall_reflect.h" -#include + #include "atom.h" #include "comm.h" -#include "update.h" -#include "modify.h" #include "domain.h" -#include "force.h" -#include "lattice.h" -#include "input.h" -#include "variable.h" #include "error.h" +#include "input.h" +#include "lattice.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -79,7 +80,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : strcpy(varstr[nwall],&arg[iarg+1][2]); } else { wallstyle[nwall] = CONSTANT; - coord0[nwall] = force->numeric(FLERR,arg[iarg+1]); + coord0[nwall] = utils::numeric(FLERR,arg[iarg+1],false,lmp); } nwall++; diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index 70bde90d2b..fc3735cfbf 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -12,17 +12,17 @@ ------------------------------------------------------------------------- */ #include "fix_wall_region.h" -#include -#include -#include + #include "atom.h" #include "domain.h" -#include "region.h" -#include "force.h" -#include "update.h" -#include "respa.h" #include "error.h" #include "math_const.h" +#include "region.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -71,18 +71,18 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : if (narg != 9) error->all(FLERR,"Illegal fix wall/region command"); - epsilon = force->numeric(FLERR,arg[5]); - alpha = force->numeric(FLERR,arg[6]); - sigma = force->numeric(FLERR,arg[7]); - cutoff = force->numeric(FLERR,arg[8]); + epsilon = utils::numeric(FLERR,arg[5],false,lmp); + alpha = utils::numeric(FLERR,arg[6],false,lmp); + sigma = utils::numeric(FLERR,arg[7],false,lmp); + cutoff = utils::numeric(FLERR,arg[8],false,lmp); } else { if (narg != 8) error->all(FLERR,"Illegal fix wall/region command"); - epsilon = force->numeric(FLERR,arg[5]); - sigma = force->numeric(FLERR,arg[6]); - cutoff = force->numeric(FLERR,arg[7]); + epsilon = utils::numeric(FLERR,arg[5],false,lmp); + sigma = utils::numeric(FLERR,arg[6],false,lmp); + cutoff = utils::numeric(FLERR,arg[7],false,lmp); } if (cutoff <= 0.0) error->all(FLERR,"Fix wall/region cutoff <= 0.0"); diff --git a/src/force.cpp b/src/force.cpp index babb052e84..701113d7ef 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -12,31 +12,27 @@ ------------------------------------------------------------------------- */ #include "force.h" -#include -#include -#include -#include -#include "style_bond.h" -#include "style_angle.h" -#include "style_dihedral.h" -#include "style_improper.h" -#include "style_pair.h" -#include "style_kspace.h" +#include "style_angle.h" // IWYU pragma: keep +#include "style_bond.h" // IWYU pragma: keep +#include "style_dihedral.h" // IWYU pragma: keep +#include "style_improper.h" // IWYU pragma: keep +#include "style_kspace.h" // IWYU pragma: keep +#include "style_pair.h" // IWYU pragma: keep + +#include "angle.h" #include "atom.h" +#include "bond.h" +#include "bond_hybrid.h" #include "comm.h" +#include "dihedral.h" +#include "error.h" +#include "improper.h" +#include "kspace.h" #include "pair.h" #include "pair_hybrid.h" #include "pair_hybrid_overlay.h" -#include "bond.h" -#include "bond_hybrid.h" -#include "angle.h" -#include "dihedral.h" -#include "improper.h" -#include "kspace.h" -#include "error.h" -#include "update.h" -#include "utils.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; @@ -799,21 +795,21 @@ void Force::set_special(int narg, char **arg) iarg += 1; } else if (strcmp(arg[iarg],"lj/coul") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_lj[1] = special_coul[1] = numeric(FLERR,arg[iarg+1]); - special_lj[2] = special_coul[2] = numeric(FLERR,arg[iarg+2]); - special_lj[3] = special_coul[3] = numeric(FLERR,arg[iarg+3]); + special_lj[1] = special_coul[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + special_lj[2] = special_coul[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + special_lj[3] = special_coul[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"lj") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_lj[1] = numeric(FLERR,arg[iarg+1]); - special_lj[2] = numeric(FLERR,arg[iarg+2]); - special_lj[3] = numeric(FLERR,arg[iarg+3]); + special_lj[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + special_lj[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + special_lj[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"coul") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal special_bonds command"); - special_coul[1] = numeric(FLERR,arg[iarg+1]); - special_coul[2] = numeric(FLERR,arg[iarg+2]); - special_coul[3] = numeric(FLERR,arg[iarg+3]); + special_coul[1] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + special_coul[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + special_coul[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal special_bonds command"); @@ -836,225 +832,6 @@ void Force::set_special(int narg, char **arg) error->all(FLERR,"Illegal special_bonds command"); } -/* ---------------------------------------------------------------------- - compute bounds implied by numeric str with a possible wildcard asterik - 1 = lower bound, nmax = upper bound - 5 possibilities: - (1) i = i to i, (2) * = nmin to nmax, - (3) i* = i to nmax, (4) *j = nmin to j, (5) i*j = i to j - return nlo,nhi -------------------------------------------------------------------------- */ - -void Force::bounds(const char *file, int line, char *str, - int nmax, int &nlo, int &nhi, int nmin) -{ - char *ptr = strchr(str,'*'); - - if (ptr == NULL) { - nlo = nhi = atoi(str); - } else if (strlen(str) == 1) { - nlo = nmin; - nhi = nmax; - } else if (ptr == str) { - nlo = nmin; - nhi = atoi(ptr+1); - } else if (strlen(ptr+1) == 0) { - nlo = atoi(str); - nhi = nmax; - } else { - nlo = atoi(str); - nhi = atoi(ptr+1); - } - - if (nlo < nmin || nhi > nmax || nlo > nhi) - error->all(file,line,"Numeric index is out of bounds"); -} - -/* ---------------------------------------------------------------------- - compute bounds implied by numeric str with a possible wildcard asterik - 1 = lower bound, nmax = upper bound - 5 possibilities: - (1) i = i to i, (2) * = nmin to nmax, - (3) i* = i to nmax, (4) *j = nmin to j, (5) i*j = i to j - return nlo,nhi -------------------------------------------------------------------------- */ - -void Force::boundsbig(const char *file, int line, char *str, - bigint nmax, bigint &nlo, bigint &nhi, bigint nmin) -{ - char *ptr = strchr(str,'*'); - - if (ptr == NULL) { - nlo = nhi = ATOBIGINT(str); - } else if (strlen(str) == 1) { - nlo = nmin; - nhi = nmax; - } else if (ptr == str) { - nlo = nmin; - nhi = ATOBIGINT(ptr+1); - } else if (strlen(ptr+1) == 0) { - nlo = ATOBIGINT(str); - nhi = nmax; - } else { - nlo = ATOBIGINT(str); - nhi = ATOBIGINT(ptr+1); - } - - if (nlo < nmin || nhi > nmax || nlo > nhi) - error->all(file,line,"Numeric index is out of bounds"); -} - -/* ---------------------------------------------------------------------- - read a floating point value from a string - generate an error if not a legitimate floating point value - called by various commands to check validity of their arguments -------------------------------------------------------------------------- */ - -double Force::numeric(const char *file, int line, char *str) -{ - int n = 0; - - if (str) n = strlen(str); - if (n == 0) - error->all(file,line,"Expected floating point parameter instead of" - " NULL or empty string in input script or data file"); - - for (int i = 0; i < n; i++) { - if (isdigit(str[i])) continue; - if (str[i] == '-' || str[i] == '+' || str[i] == '.') continue; - if (str[i] == 'e' || str[i] == 'E') continue; - error->all(file,line,fmt::format("Expected floating point parameter " - "instead of '{}' in input script or data file",str)); - } - - return atof(str); -} - -/* ---------------------------------------------------------------------- - read an integer value from a string - generate an error if not a legitimate integer value - called by various commands to check validity of their arguments -------------------------------------------------------------------------- */ - -int Force::inumeric(const char *file, int line, char *str) -{ - int n = 0; - - if (str) n = strlen(str); - if (n == 0) - error->all(file,line,"Expected integer parameter instead of " - "NULL or empty string in input script or data file"); - - for (int i = 0; i < n; i++) { - if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue; - error->all(file,line,fmt::format("Expected integer parameter instead " - "of '{}' in input script or data file",str)); - } - - return atoi(str); -} - -/* ---------------------------------------------------------------------- - read a big integer value from a string - generate an error if not a legitimate integer value - called by various commands to check validity of their arguments -------------------------------------------------------------------------- */ - -bigint Force::bnumeric(const char *file, int line, char *str) -{ - int n = 0; - - if (str) n = strlen(str); - if (n == 0) - error->all(file,line,"Expected integer parameter instead of " - "NULL or empty string in input script or data file"); - - for (int i = 0; i < n; i++) { - if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue; - error->all(file,line,fmt::format("Expected integer parameter instead " - "of '{}' in input script or data file",str)); - } - - return ATOBIGINT(str); -} - -/* ---------------------------------------------------------------------- - read a tag integer value from a string - generate an error if not a legitimate integer value - called by various commands to check validity of their arguments -------------------------------------------------------------------------- */ - -tagint Force::tnumeric(const char *file, int line, char *str) -{ - int n = 0; - - if (str) n = strlen(str); - if (n == 0) - error->all(file,line,"Expected integer parameter instead of " - "NULL or empty string in input script or data file"); - - for (int i = 0; i < n; i++) { - if (isdigit(str[i]) || str[i] == '-' || str[i] == '+') continue; - error->all(file,line,fmt::format("Expected integer parameter instead " - "of '{}' in input script or data file",str)); - } - - return ATOTAGINT(str); -} - -/* ---------------------------------------------------------------------- - open a potential file as specified by name - if fails, search in dir specified by env variable LAMMPS_POTENTIALS -------------------------------------------------------------------------- */ - -FILE *Force::open_potential(const char *name, int *auto_convert) -{ - std::string filepath = utils::get_potential_file_path(name); - - if(!filepath.empty()) { - std::string unit_style = update->unit_style; - std::string date = utils::get_potential_date(filepath, "potential"); - std::string units = utils::get_potential_units(filepath, "potential"); - - if(!date.empty() && (comm->me == 0)) { - utils::logmesg(lmp, fmt::format("Reading potential file {} " - "with DATE: {}\n", name, date)); - } - - if (auto_convert == nullptr) { - if (!units.empty() && (units != unit_style) && (comm->me == 0)) { - error->one(FLERR, fmt::format("Potential file {} requires {} units " - "but {} units are in use", name, units, - unit_style)); - return nullptr; - } - } else { - if (units.empty() || units == unit_style) { - *auto_convert = utils::NOCONVERT; - } else { - if ((units == "metal") && (unit_style == "real") - && (*auto_convert & utils::METAL2REAL)) { - *auto_convert = utils::METAL2REAL; - } else if ((units == "real") && (unit_style == "metal") - && (*auto_convert & utils::REAL2METAL)) { - *auto_convert = utils::REAL2METAL; - } else { - error->one(FLERR, fmt::format("Potential file {} requires {} units " - "but {} units are in use", name, - units, unit_style)); - return nullptr; - } - } - if ((*auto_convert != utils::NOCONVERT) && (comm->me == 0)) - lmp->error->warning(FLERR, fmt::format("Converting potential file in " - "{} units to {} units", - units, unit_style)); - } - return fopen(filepath.c_str(), "r"); - } - return nullptr; -} - /* ---------------------------------------------------------------------- memory usage of force classes ------------------------------------------------------------------------- */ diff --git a/src/force.h b/src/force.h index b566f02fb7..1302e20f12 100644 --- a/src/force.h +++ b/src/force.h @@ -15,10 +15,16 @@ #define LMP_FORCE_H #include "pointers.h" + #include -#include namespace LAMMPS_NS { + class Angle; + class Bond; + class Dihedral; + class Improper; + class KSpace; + class Pair; class Force : protected Pointers { public: @@ -47,23 +53,23 @@ class Force : protected Pointers { int newton,newton_pair,newton_bond; // Newton's 3rd law settings - class Pair *pair; + Pair *pair; char *pair_style; char *pair_restart; - class Bond *bond; + Bond *bond; char *bond_style; - class Angle *angle; + Angle *angle; char *angle_style; - class Dihedral *dihedral; + Dihedral *dihedral; char *dihedral_style; - class Improper *improper; + Improper *improper; char *improper_style; - class KSpace *kspace; + KSpace *kspace; char *kspace_style; typedef Pair *(*PairCreator)(LAMMPS *); @@ -102,40 +108,32 @@ class Force : protected Pointers { void setup(); void create_pair(const std::string &, int); - class Pair *new_pair(const std::string &, int, int &); - class Pair *pair_match(const std::string &, int, int nsub=0); + Pair *new_pair(const std::string &, int, int &); + Pair *pair_match(const std::string &, int, int nsub=0); char *pair_match_ptr(Pair *); void create_bond(const std::string &, int); - class Bond *new_bond(const std::string &, int, int &); - class Bond *bond_match(const std::string &); + Bond *new_bond(const std::string &, int, int &); + Bond *bond_match(const std::string &); void create_angle(const std::string &, int); - class Angle *new_angle(const std::string &, int, int &); - class Angle *angle_match(const std::string &); + Angle *new_angle(const std::string &, int, int &); + Angle *angle_match(const std::string &); void create_dihedral(const std::string &, int); - class Dihedral *new_dihedral(const std::string &, int, int &); - class Dihedral *dihedral_match(const std::string &); + Dihedral *new_dihedral(const std::string &, int, int &); + Dihedral *dihedral_match(const std::string &); void create_improper(const std::string &, int); - class Improper *new_improper(const std::string &, int, int &); - class Improper *improper_match(const std::string &); + Improper *new_improper(const std::string &, int, int &); + Improper *improper_match(const std::string &); void create_kspace(const std::string &, int); - class KSpace *new_kspace(const std::string &, int, int &); - class KSpace *kspace_match(const std::string &, int); + KSpace *new_kspace(const std::string &, int, int &); + KSpace *kspace_match(const std::string &, int); void store_style(char *&, const std::string &, int); void set_special(int, char **); - void bounds(const char *, int, char *, int, int &, int &, int nmin=1); - void boundsbig(const char *, int, char *, bigint, bigint &, bigint &, bigint nmin=1); - double numeric(const char *, int, char *); - int inumeric(const char *, int, char *); - bigint bnumeric(const char *, int, char *); - tagint tnumeric(const char *, int, char *); - - FILE *open_potential(const char *, int *auto_convert = nullptr); bigint memory_usage(); diff --git a/src/group.cpp b/src/group.cpp index 79405c9344..a2e20a6ab1 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -12,30 +12,28 @@ ------------------------------------------------------------------------- */ #include "group.h" -#include -#include -#include -#include -#include -#include "domain.h" + #include "atom.h" -#include "force.h" #include "comm.h" -#include "region.h" -#include "modify.h" -#include "fix.h" #include "compute.h" -#include "output.h" -#include "input.h" -#include "variable.h" +#include "domain.h" #include "dump.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "input.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" +#include "output.h" +#include "region.h" +#include "variable.h" +#include +#include #include +#include +#include using namespace LAMMPS_NS; @@ -229,12 +227,12 @@ void Group::assign(int narg, char **arg) else error->all(FLERR,"Illegal group command"); tagint bound1,bound2; - bound1 = force->tnumeric(FLERR,arg[3]); + bound1 = utils::tnumeric(FLERR,arg[3],false,lmp); bound2 = -1; if (condition == BETWEEN) { if (narg != 5) error->all(FLERR,"Illegal group command"); - bound2 = force->tnumeric(FLERR,arg[4]); + bound2 = utils::tnumeric(FLERR,arg[4],false,lmp); } else if (narg != 4) error->all(FLERR,"Illegal group command"); int *attribute = NULL; @@ -311,13 +309,13 @@ void Group::assign(int narg, char **arg) delta = 1; if (strchr(arg[iarg],':')) { ptr = strtok(arg[iarg],":"); - start = force->tnumeric(FLERR,ptr); + start = utils::tnumeric(FLERR,ptr,false,lmp); ptr = strtok(NULL,":"); - stop = force->tnumeric(FLERR,ptr); + stop = utils::tnumeric(FLERR,ptr,false,lmp); ptr = strtok(NULL,":"); - if (ptr) delta = force->tnumeric(FLERR,ptr); + if (ptr) delta = utils::tnumeric(FLERR,ptr,false,lmp); } else { - start = stop = force->tnumeric(FLERR,arg[iarg]); + start = stop = utils::tnumeric(FLERR,arg[iarg],false,lmp); } if (delta < 1) error->all(FLERR,"Illegal range increment value"); @@ -538,7 +536,7 @@ void Group::assign(int narg, char **arg) void Group::assign(const std::string &groupcmd) { - std::vector args = utils::split_words(groupcmd); + auto args = utils::split_words(groupcmd); char **newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { diff --git a/src/group.h b/src/group.h index b9a5c27140..39c446d119 100644 --- a/src/group.h +++ b/src/group.h @@ -15,8 +15,8 @@ #define LMP_GROUP_H #include "pointers.h" + #include -#include namespace LAMMPS_NS { diff --git a/src/image.cpp b/src/image.cpp index e264ba3979..755be587d8 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -16,16 +16,16 @@ ------------------------------------------------------------------------- */ #include "image.h" -#include -#include -#include -#include -#include "math_extra.h" -#include "random_mars.h" -#include "math_const.h" + #include "error.h" -#include "force.h" +#include "math_const.h" +#include "math_extra.h" #include "memory.h" +#include "random_mars.h" + +#include +#include +#include #ifdef LAMMPS_JPEG #include @@ -1708,13 +1708,13 @@ int ColorMap::reset(int narg, char **arg) { if (!islower(arg[0][0])) { mlo = NUMERIC; - mlovalue = force->numeric(FLERR,arg[0]); + mlovalue = utils::numeric(FLERR,arg[0],false,lmp); } else if (strcmp(arg[0],"min") == 0) mlo = MINVALUE; else return 1; if (!islower(arg[1][0])) { mhi = NUMERIC; - mhivalue = force->numeric(FLERR,arg[1]); + mhivalue = utils::numeric(FLERR,arg[1],false,lmp); } else if (strcmp(arg[1],"max") == 0) mhi = MAXVALUE; else return 1; @@ -1733,12 +1733,12 @@ int ColorMap::reset(int narg, char **arg) else return 1; if (mstyle == SEQUENTIAL) { - mbinsize = force->numeric(FLERR,arg[3]); + mbinsize = utils::numeric(FLERR,arg[3],false,lmp); if (mbinsize <= 0.0) return 1; mbinsizeinv = 1.0/mbinsize; } - nentry = force->inumeric(FLERR,arg[4]); + nentry = utils::inumeric(FLERR,arg[4],false,lmp); if (nentry < 1) return 1; delete [] mentry; mentry = new MapEntry[nentry]; @@ -1751,7 +1751,7 @@ int ColorMap::reset(int narg, char **arg) if (n+2 > narg) return 1; if (!islower(arg[n][0])) { mentry[i].single = NUMERIC; - mentry[i].svalue = force->numeric(FLERR,arg[n]); + mentry[i].svalue = utils::numeric(FLERR,arg[n],false,lmp); } else if (strcmp(arg[n],"min") == 0) mentry[i].single = MINVALUE; else if (strcmp(arg[n],"max") == 0) mentry[i].single = MAXVALUE; else return 1; @@ -1761,13 +1761,13 @@ int ColorMap::reset(int narg, char **arg) if (n+3 > narg) return 1; if (!islower(arg[n][0])) { mentry[i].lo = NUMERIC; - mentry[i].lvalue = force->numeric(FLERR,arg[n]); + mentry[i].lvalue = utils::numeric(FLERR,arg[n],false,lmp); } else if (strcmp(arg[n],"min") == 0) mentry[i].lo = MINVALUE; else if (strcmp(arg[n],"max") == 0) mentry[i].lo = MAXVALUE; else return 1; if (!islower(arg[n+1][0])) { mentry[i].hi = NUMERIC; - mentry[i].hvalue = force->numeric(FLERR,arg[n+1]); + mentry[i].hvalue = utils::numeric(FLERR,arg[n+1],false,lmp); } else if (strcmp(arg[n+1],"min") == 0) mentry[i].hi = MINVALUE; else if (strcmp(arg[n+1],"max") == 0) mentry[i].hi = MAXVALUE; else return 1; diff --git a/src/imbalance_group.cpp b/src/imbalance_group.cpp index dd3370ae92..f604f150b5 100644 --- a/src/imbalance_group.cpp +++ b/src/imbalance_group.cpp @@ -12,12 +12,10 @@ ------------------------------------------------------------------------- */ #include "imbalance_group.h" + #include "atom.h" -#include "force.h" -#include "group.h" #include "error.h" -#include -#include "fmt/format.h" +#include "group.h" using namespace LAMMPS_NS; @@ -40,7 +38,7 @@ int ImbalanceGroup::options(int narg, char **arg) { if (narg < 3) error->all(FLERR,"Illegal balance weight command"); - num = force->inumeric(FLERR,arg[0]); + num = utils::inumeric(FLERR,arg[0],false,lmp); if (num < 1) error->all(FLERR,"Illegal balance weight command"); if (2*num+1 > narg) error->all(FLERR,"Illegal balance weight command"); @@ -50,7 +48,7 @@ int ImbalanceGroup::options(int narg, char **arg) id[i] = group->find(arg[2*i+1]); if (id[i] < 0) error->all(FLERR,"Unknown group in balance weight command"); - factor[i] = force->numeric(FLERR,arg[2*i+2]); + factor[i] = utils::numeric(FLERR,arg[2*i+2],false,lmp); if (factor[i] <= 0.0) error->all(FLERR,"Illegal balance weight command"); } return 2*num+1; diff --git a/src/imbalance_neigh.cpp b/src/imbalance_neigh.cpp index c50b430c51..70d5580b9c 100644 --- a/src/imbalance_neigh.cpp +++ b/src/imbalance_neigh.cpp @@ -12,15 +12,13 @@ ------------------------------------------------------------------------- */ #include "imbalance_neigh.h" -#include + #include "atom.h" #include "comm.h" -#include "force.h" -#include "neighbor.h" -#include "neigh_request.h" -#include "neigh_list.h" #include "error.h" -#include "fmt/format.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" using namespace LAMMPS_NS; @@ -38,7 +36,7 @@ ImbalanceNeigh::ImbalanceNeigh(LAMMPS *lmp) : Imbalance(lmp) int ImbalanceNeigh::options(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal balance weight command"); - factor = force->numeric(FLERR,arg[0]); + factor = utils::numeric(FLERR,arg[0],false,lmp); if (factor <= 0.0) error->all(FLERR,"Illegal balance weight command"); return 1; } diff --git a/src/imbalance_store.cpp b/src/imbalance_store.cpp index 919d1f3f61..2661b57b25 100644 --- a/src/imbalance_store.cpp +++ b/src/imbalance_store.cpp @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #include "imbalance_store.h" -#include + #include "atom.h" #include "error.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; diff --git a/src/imbalance_time.cpp b/src/imbalance_time.cpp index 898d3ceef0..438728ef3e 100644 --- a/src/imbalance_time.cpp +++ b/src/imbalance_time.cpp @@ -12,12 +12,10 @@ ------------------------------------------------------------------------- */ #include "imbalance_time.h" -#include + #include "atom.h" -#include "force.h" -#include "timer.h" #include "error.h" -#include "fmt/format.h" +#include "timer.h" using namespace LAMMPS_NS; @@ -32,7 +30,7 @@ ImbalanceTime::ImbalanceTime(LAMMPS *lmp) : Imbalance(lmp) {} int ImbalanceTime::options(int narg, char **arg) { if (narg < 1) error->all(FLERR,"Illegal balance weight command"); - factor = force->numeric(FLERR,arg[0]); + factor = utils::numeric(FLERR,arg[0],false,lmp); if (factor <= 0.0) error->all(FLERR,"Illegal balance weight command"); return 1; } diff --git a/src/imbalance_var.cpp b/src/imbalance_var.cpp index d1a76ed9f7..a2c940789e 100644 --- a/src/imbalance_var.cpp +++ b/src/imbalance_var.cpp @@ -12,15 +12,15 @@ ------------------------------------------------------------------------- */ #include "imbalance_var.h" -#include -#include + #include "atom.h" +#include "error.h" #include "group.h" #include "input.h" -#include "variable.h" #include "memory.h" -#include "error.h" -#include "fmt/format.h" +#include "variable.h" + +#include using namespace LAMMPS_NS; diff --git a/src/improper_deprecated.cpp b/src/improper_deprecated.cpp index 0c1a45603e..431cc03997 100644 --- a/src/improper_deprecated.cpp +++ b/src/improper_deprecated.cpp @@ -16,12 +16,12 @@ ------------------------------------------------------------------------- */ #include "improper_deprecated.h" -#include + #include "improper_hybrid.h" #include "comm.h" #include "force.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 69dfc2d9cd..096e0c3614 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "improper_hybrid.h" -#include + #include #include #include "atom.h" @@ -21,7 +21,7 @@ #include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -263,7 +263,7 @@ void ImproperHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); // 2nd arg = improper sub-style name // allow for "none" as valid sub-style name diff --git a/src/improper_zero.cpp b/src/improper_zero.cpp index efa70c8ff5..3da38a890c 100644 --- a/src/improper_zero.cpp +++ b/src/improper_zero.cpp @@ -16,11 +16,12 @@ ------------------------------------------------------------------------- */ #include "improper_zero.h" -#include + #include "atom.h" -#include "force.h" -#include "memory.h" #include "error.h" +#include "memory.h" + +#include using namespace LAMMPS_NS; @@ -80,7 +81,7 @@ void ImproperZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->nimpropertypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->nimpropertypes,ilo,ihi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/info.cpp b/src/info.cpp index fbe43442f0..87161e9ca5 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -17,39 +17,37 @@ ------------------------------------------------------------------------- */ #include "info.h" -#include -#include -#include -#include -#include -#include -#include + #include "accelerator_kokkos.h" +#include "angle.h" #include "atom.h" +#include "bond.h" #include "comm.h" #include "compute.h" +#include "dihedral.h" #include "domain.h" #include "dump.h" +#include "error.h" #include "fix.h" #include "force.h" -#include "pair.h" -#include "pair_hybrid.h" -#include "bond.h" -#include "angle.h" -#include "dihedral.h" -#include "improper.h" #include "group.h" +#include "improper.h" #include "input.h" #include "modify.h" #include "neighbor.h" #include "output.h" +#include "pair.h" +#include "pair_hybrid.h" #include "region.h" #include "universe.h" -#include "variable.h" #include "update.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "variable.h" + +#include +#include +#include +#include +#include #ifdef _WIN32 #define PSAPI_VERSION 1 @@ -105,6 +103,8 @@ static const int STYLES = ATOM_STYLES | INTEGRATE_STYLES | MINIMIZE_STYLES | DUMP_STYLES | COMMAND_STYLES; } +using namespace LAMMPS_NS; + static const char *varstyles[] = { "index", "loop", "world", "universe", "uloop", "string", "getenv", "file", "atomfile", "format", "equal", "atom", "vector", "python", "internal", "(unknown)"}; @@ -116,17 +116,15 @@ static const char *commlayout[] = { "uniform", "nonuniform", "irregular" }; static const char bstyles[] = "pfsm"; -using namespace LAMMPS_NS; -using namespace std; +template +static void print_columns(FILE *fp, std::map *styles); template -static void print_columns(FILE* fp, map * styles); +static bool find_style(const LAMMPS *lmp, std::map *styles, + const std::string &name, bool suffix_check); template -static bool find_style(const LAMMPS * lmp, map * styles, const string & name, bool suffix_check); - -template -static vector get_style_names(map * styles); +static std::vector get_style_names(std::map *styles); /* ---------------------------------------------------------------------- */ @@ -357,7 +355,7 @@ void Info::command(int narg, char **arg) if (flags & COMM) { int major,minor; - string version = get_mpi_info(major,minor); + std::string version = get_mpi_info(major,minor); fmt::print(out,"\nCommunication information:\n" "MPI library level: MPI v{}.{}\n" @@ -949,7 +947,7 @@ bool Info::is_defined(const char *category, const char *name) return false; } -bool Info::has_style(const string & category, const string & name) +bool Info::has_style(const std::string &category, const std::string &name) { if ( category == "atom" ) { return find_style(lmp, atom->avec_map, name, false); @@ -983,7 +981,7 @@ bool Info::has_style(const string & category, const string & name) return false; } -vector Info::get_available_styles(const string & category) +std::vector Info::get_available_styles(const std::string &category) { if ( category == "atom" ) { return get_style_names(atom->avec_map); @@ -1014,13 +1012,13 @@ vector Info::get_available_styles(const string & category) } else if( category == "command" ) { return get_style_names(input->command_map); } - return vector(); + return std::vector(); } template -static vector get_style_names(map * styles) +static std::vector get_style_names(std::map *styles) { - vector names; + std::vector names; names.reserve(styles->size()); for(auto const& kv : *styles) { @@ -1033,7 +1031,8 @@ static vector get_style_names(map * styles) } template -static bool find_style(const LAMMPS* lmp, map * styles, const string & name, bool suffix_check) +static bool find_style(const LAMMPS *lmp, std::map *styles, + const std::string &name, bool suffix_check) { if (styles->find(name) != styles->end()) { return true; @@ -1041,13 +1040,13 @@ static bool find_style(const LAMMPS* lmp, map * styles, const if (suffix_check && lmp->suffix_enable) { if (lmp->suffix) { - string name_w_suffix = name + "/" + lmp->suffix; + std::string name_w_suffix = name + "/" + lmp->suffix; if (find_style(lmp, styles, name_w_suffix, false)) { return true; } } if (lmp->suffix2) { - string name_w_suffix = name + "/" + lmp->suffix2; + std::string name_w_suffix = name + "/" + lmp->suffix2; if (find_style(lmp, styles, name_w_suffix, false)) { return true; } @@ -1057,7 +1056,7 @@ static bool find_style(const LAMMPS* lmp, map * styles, const } template -static void print_columns(FILE* fp, map * styles) +static void print_columns(FILE *fp, std::map *styles) { if (styles->empty()) { fprintf(fp, "\nNone"); @@ -1066,8 +1065,8 @@ static void print_columns(FILE* fp, map * styles) // std::map keys are already sorted int pos = 80; - for(typename map::iterator it = styles->begin(); it != styles->end(); ++it) { - const string & style_name = it->first; + for(typename std::map::iterator it = styles->begin(); it != styles->end(); ++it) { + const std::string &style_name = it->first; // skip "secret" styles if (isupper(style_name[0])) continue; @@ -1149,9 +1148,9 @@ bool Info::has_package(const char * package_name) { /* ---------------------------------------------------------------------- */ #define _INFOBUF_SIZE 256 -string Info::get_os_info() +std::string Info::get_os_info() { - string buf; + std::string buf; #if defined(_WIN32) DWORD fullversion,majorv,minorv,buildv=0; @@ -1191,9 +1190,9 @@ string Info::get_os_info() return buf; } -string Info::get_compiler_info() +std::string Info::get_compiler_info() { - string buf; + std::string buf; #if __clang__ buf = fmt::format("Clang C++ {}", __VERSION__); #elif __INTEL_COMPILER @@ -1208,7 +1207,7 @@ string Info::get_compiler_info() return buf; } -string Info::get_openmp_info() +std::string Info::get_openmp_info() { #if !defined(_OPENMP) @@ -1243,7 +1242,7 @@ string Info::get_openmp_info() #endif } -string Info::get_mpi_vendor() { +std::string Info::get_mpi_vendor() { #if defined(MPI_STUBS) return "MPI STUBS"; #elif defined(OPEN_MPI) @@ -1263,7 +1262,7 @@ string Info::get_mpi_vendor() { #endif } -string Info::get_mpi_info(int &major, int &minor) +std::string Info::get_mpi_info(int &major, int &minor) { int len; #if (defined(MPI_VERSION) && (MPI_VERSION > 2)) || defined(MPI_STUBS) @@ -1279,10 +1278,10 @@ string Info::get_mpi_info(int &major, int &minor) char *ptr = strchr(version+80,'\n'); if (ptr) *ptr = '\0'; } - return string(version); + return std::string(version); } -string Info::get_cxx_info() +std::string Info::get_cxx_info() { #if __cplusplus > 201703L return "newer than C++17"; diff --git a/src/info.h b/src/info.h index 5a379eaa78..65690ab28e 100644 --- a/src/info.h +++ b/src/info.h @@ -21,7 +21,7 @@ CommandStyle(info,Info) #define LMP_INFO_H #include "pointers.h" -#include + #include namespace LAMMPS_NS { diff --git a/src/input.cpp b/src/input.cpp index dd640f18b0..6456f6c229 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -12,45 +12,42 @@ ------------------------------------------------------------------------- */ #include "input.h" -#include -#include -#include -#include -#include -#include -#include -#include "style_command.h" -#include "universe.h" + +#include "accelerator_kokkos.h" +#include "angle.h" #include "atom.h" #include "atom_vec.h" +#include "bond.h" #include "comm.h" #include "comm_brick.h" #include "comm_tiled.h" -#include "group.h" -#include "domain.h" -#include "output.h" -#include "thermo.h" -#include "force.h" -#include "pair.h" -#include "min.h" -#include "modify.h" #include "compute.h" -#include "fix.h" -#include "bond.h" -#include "angle.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "group.h" #include "improper.h" #include "kspace.h" -#include "update.h" -#include "neighbor.h" -#include "special.h" -#include "timer.h" -#include "variable.h" -#include "accelerator_kokkos.h" -#include "error.h" #include "memory.h" -#include "utils.h" -#include "fmt/format.h" +#include "min.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" +#include "special.h" +#include "style_command.h" +#include "thermo.h" +#include "timer.h" +#include "universe.h" +#include "update.h" +#include "variable.h" + +#include +#include +#include +#include +#include #ifdef _WIN32 #include @@ -63,6 +60,37 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ +/** \class LAMMPS_NS::Input + * \brief Class for processing commands and input files + * +\verbatim embed:rst + +The Input class contains methods for reading, pre-processing and +parsing LAMMPS commands and input files and will dispatch commands +to the respective class instances or contains the code to execute +the commands directly. It also contains the instance of the +Variable class which performs computations and text substitutions. + +\endverbatim */ + +/** Input class constructor + * +\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 +initializes an instance of the Variable class. + +To execute a command, a specific class instance, derived from +:cpp:class:`Pointers`, is created, then its ``command()`` member +function executed, and finally the class instance is deleted. + +\endverbatim + * + * \param lmp pointer to the base LAMMPS class + * \param argc number of entries in *argv* + * \param argv argument vector */ + Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) { MPI_Comm_rank(world,&me); @@ -140,10 +168,15 @@ Input::~Input() delete command_map; } -/* ---------------------------------------------------------------------- - process all input from infile - infile = stdin or file if command-line arg "-in" was used -------------------------------------------------------------------------- */ +/** Process all input from the ``FILE *`` pointer *infile* + * +\verbatim embed:rst + +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. + +\endverbatim */ void Input::file() { @@ -232,10 +265,21 @@ void Input::file() } } -/* ---------------------------------------------------------------------- - process all input from file at filename - mostly called from library interface -------------------------------------------------------------------------- */ +/** Process all input from the file *filename* + * +\verbatim embed:rst + +This function opens the file at the path *filename*, put the current +file pointer stored in *infile* on a stack and instead assign *infile* +with the newly opened file pointer. Then it will call the +:cpp:func:`Input::file() ` function to read, +parse and execute the contents of that file. When the end of the file +is reached, it is closed and the previous file pointer from the infile +file pointer stack restored to *infile*. + +\endverbatim + * + * \param filename name of file with LAMMPS commands */ void Input::file(const char *filename) { @@ -266,11 +310,19 @@ void Input::file(const char *filename) } } -/* ---------------------------------------------------------------------- - invoke one command in single - first copy to line, then parse, then execute it - return command name to caller -------------------------------------------------------------------------- */ +/** Process a single command from a string in *single* + * +\verbatim embed:rst + +This function takes the text in *single*, makes a copy, parses that, +executes the command and returns the name of the command (without the +arguments). If there was no command in *single* it will return +``NULL``. + +\endverbatim + * + * \param single string with LAMMPS command + * \return string with name of the parsed command w/o arguments */ char *Input::one(const std::string &single) { @@ -599,141 +651,6 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) strcpy(str,str2); } -/* ---------------------------------------------------------------------- - expand arg to earg, for arguments with syntax c_ID[*] or f_ID[*] - fields to consider in input arg range from iarg to narg - return new expanded # of values, and copy them w/out "*" into earg - if any expansion occurs, earg is new allocation, must be freed by caller - if no expansion occurs, earg just points to arg, caller need not free -------------------------------------------------------------------------- */ - -int Input::expand_args(int narg, char **arg, int mode, char **&earg) -{ - int n,iarg,index,nlo,nhi,nmax,expandflag,icompute,ifix; - char *ptr1,*ptr2,*str; - - ptr1 = NULL; - for (iarg = 0; iarg < narg; iarg++) { - ptr1 = strchr(arg[iarg],'*'); - if (ptr1) break; - } - - if (!ptr1) { - earg = arg; - return narg; - } - - // maxarg should always end up equal to newarg, so caller can free earg - - int maxarg = narg-iarg; - earg = (char **) memory->smalloc(maxarg*sizeof(char *),"input:earg"); - - int newarg = 0; - for (iarg = 0; iarg < narg; iarg++) { - expandflag = 0; - - if (strncmp(arg[iarg],"c_",2) == 0 || - strncmp(arg[iarg],"f_",2) == 0) { - - ptr1 = strchr(&arg[iarg][2],'['); - if (ptr1) { - ptr2 = strchr(ptr1,']'); - if (ptr2) { - *ptr2 = '\0'; - if (strchr(ptr1,'*')) { - if (arg[iarg][0] == 'c') { - *ptr1 = '\0'; - icompute = modify->find_compute(&arg[iarg][2]); - *ptr1 = '['; - - // check for global vector/array, peratom array, local array - - if (icompute >= 0) { - if (mode == 0 && modify->compute[icompute]->vector_flag) { - nmax = modify->compute[icompute]->size_vector; - expandflag = 1; - } else if (mode == 1 && modify->compute[icompute]->array_flag) { - nmax = modify->compute[icompute]->size_array_cols; - expandflag = 1; - } else if (modify->compute[icompute]->peratom_flag && - modify->compute[icompute]->size_peratom_cols) { - nmax = modify->compute[icompute]->size_peratom_cols; - expandflag = 1; - } else if (modify->compute[icompute]->local_flag && - modify->compute[icompute]->size_local_cols) { - nmax = modify->compute[icompute]->size_local_cols; - expandflag = 1; - } - } - } else if (arg[iarg][0] == 'f') { - *ptr1 = '\0'; - ifix = modify->find_fix(&arg[iarg][2]); - *ptr1 = '['; - - // check for global vector/array, peratom array, local array - - if (ifix >= 0) { - if (mode == 0 && modify->fix[ifix]->vector_flag) { - nmax = modify->fix[ifix]->size_vector; - expandflag = 1; - } else if (mode == 1 && modify->fix[ifix]->array_flag) { - nmax = modify->fix[ifix]->size_array_cols; - expandflag = 1; - } else if (modify->fix[ifix]->peratom_flag && - modify->fix[ifix]->size_peratom_cols) { - nmax = modify->fix[ifix]->size_peratom_cols; - expandflag = 1; - } else if (modify->fix[ifix]->local_flag && - modify->fix[ifix]->size_local_cols) { - nmax = modify->fix[ifix]->size_local_cols; - expandflag = 1; - } - } - } - } - *ptr2 = ']'; - } - } - } - - if (expandflag) { - *ptr2 = '\0'; - force->bounds(FLERR,ptr1+1,nmax,nlo,nhi); - *ptr2 = ']'; - if (newarg+nhi-nlo+1 > maxarg) { - maxarg += nhi-nlo+1; - earg = (char **) - memory->srealloc(earg,maxarg*sizeof(char *),"input:earg"); - } - for (index = nlo; index <= nhi; index++) { - n = strlen(arg[iarg]) + 16; // 16 = space for large inserted integer - str = earg[newarg] = new char[n]; - strncpy(str,arg[iarg],ptr1+1-arg[iarg]); - sprintf(&str[ptr1+1-arg[iarg]],"%d",index); - strcat(str,ptr2); - newarg++; - } - - } else { - if (newarg == maxarg) { - maxarg++; - earg = (char **) - memory->srealloc(earg,maxarg*sizeof(char *),"input:earg"); - } - n = strlen(arg[iarg]) + 1; - earg[newarg] = new char[n]; - strcpy(earg[newarg],arg[iarg]); - newarg++; - } - } - - //printf("NEWARG %d\n",newarg); - //for (int i = 0; i < newarg; i++) - // printf(" arg %d: %s\n",i,earg[i]); - - return newarg; -} - /* ---------------------------------------------------------------------- return number of triple quotes in line ------------------------------------------------------------------------- */ @@ -1139,7 +1056,7 @@ void Input::partition() else error->all(FLERR,"Illegal partition command"); int ilo,ihi; - force->bounds(FLERR,arg[1],universe->nworlds,ilo,ihi); + utils::bounds(FLERR,arg[1],1,universe->nworlds,ilo,ihi,error); // copy original line to copy, since will use strtok() on it // ptr = start of 4th word @@ -1235,7 +1152,7 @@ void Input::python() void Input::quit() { if (narg == 0) error->done(0); // 1 would be fully backwards compatible - if (narg == 1) error->done(force->inumeric(FLERR,arg[0])); + if (narg == 1) error->done(utils::inumeric(FLERR,arg[0],false,lmp)); error->all(FLERR,"Illegal quit command"); } @@ -1509,7 +1426,7 @@ void Input::compute_modify() void Input::dielectric() { if (narg != 1) error->all(FLERR,"Illegal dielectric command"); - force->dielectric = force->numeric(FLERR,arg[0]); + force->dielectric = utils::numeric(FLERR,arg[0],false,lmp); } /* ---------------------------------------------------------------------- */ @@ -1543,7 +1460,7 @@ void Input::dimension() if (narg != 1) error->all(FLERR,"Illegal dimension command"); if (domain->box_exist) error->all(FLERR,"Dimension command after simulation box is defined"); - domain->dimension = force->inumeric(FLERR,arg[0]); + domain->dimension = utils::inumeric(FLERR,arg[0],false,lmp); if (domain->dimension != 2 && domain->dimension != 3) error->all(FLERR,"Illegal dimension command"); @@ -1953,7 +1870,7 @@ void Input::timer_command() void Input::timestep() { if (narg != 1) error->all(FLERR,"Illegal timestep command"); - update->dt = force->numeric(FLERR,arg[0]); + update->dt = utils::numeric(FLERR,arg[0],false,lmp); } /* ---------------------------------------------------------------------- */ diff --git a/src/input.h b/src/input.h index a50f769561..b8ffb276f9 100644 --- a/src/input.h +++ b/src/input.h @@ -15,8 +15,8 @@ #define LMP_INPUT_H #include "pointers.h" + #include -#include namespace LAMMPS_NS { @@ -38,7 +38,6 @@ class Input : protected Pointers { char *one(const std::string&); // process a single command void substitute(char *&, char *&, int &, int &, int); // substitute for variables in a string - int expand_args(int, char **, int, char **&); // expand args due to wildcard void write_echo(const std::string &); // send text to active echo file pointers protected: diff --git a/src/irregular.cpp b/src/irregular.cpp index 2213b37d55..fbb572fd88 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "irregular.h" -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "domain.h" #include "comm.h" -#include "modify.h" +#include "domain.h" #include "fix.h" #include "memory.h" +#include "modify.h" + +#include using namespace LAMMPS_NS; @@ -30,7 +31,6 @@ using namespace LAMMPS_NS; int *Irregular::proc_recv_copy; static int compare_standalone(const void *, const void *); #else -#include "mergesort.h" // prototype for non-class function static int compare_standalone(const int, const int, void *); #endif @@ -440,7 +440,7 @@ int Irregular::create_atom(int n, int *sizes, int *proclist, int sortflag) proc_recv_copy = proc_recv; qsort(order,nrecv_proc,sizeof(int),compare_standalone); #else - merge_sort(order,nrecv_proc,(void *)proc_recv,compare_standalone); + utils::merge_sort(order,nrecv_proc,(void *)proc_recv,compare_standalone); #endif int j; @@ -714,7 +714,7 @@ int Irregular::create_data(int n, int *proclist, int sortflag) proc_recv_copy = proc_recv; qsort(order,nrecv_proc,sizeof(int),compare_standalone); #else - merge_sort(order,nrecv_proc,(void *)proc_recv,compare_standalone); + utils::merge_sort(order,nrecv_proc,(void *)proc_recv,compare_standalone); #endif int j; @@ -888,7 +888,7 @@ int Irregular::create_data_grouped(int n, int *procs, int sortflag) proc_recv_copy = proc_recv; qsort(order,nrecv_proc,sizeof(int),compare_standalone); #else - merge_sort(order,nrecv_proc,(void *)proc_recv,compare_standalone); + utils::merge_sort(order,nrecv_proc,(void *)proc_recv,compare_standalone); #endif int j; diff --git a/src/kspace.cpp b/src/kspace.cpp index 13be635794..e51cc54c97 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -12,21 +12,19 @@ ------------------------------------------------------------------------- */ #include "kspace.h" -#include -#include -#include -#include -#include + #include "atom.h" -#include "comm.h" -#include "force.h" -#include "pair.h" -#include "memory.h" #include "atom_masks.h" -#include "error.h" -#include "suffix.h" +#include "comm.h" #include "domain.h" -#include "fmt/format.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "pair.h" +#include "suffix.h" + +#include +#include using namespace LAMMPS_NS; @@ -453,9 +451,9 @@ void KSpace::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"mesh") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command"); - nx_pppm = nx_msm_max = force->inumeric(FLERR,arg[iarg+1]); - ny_pppm = ny_msm_max = force->inumeric(FLERR,arg[iarg+2]); - nz_pppm = nz_msm_max = force->inumeric(FLERR,arg[iarg+3]); + nx_pppm = nx_msm_max = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + ny_pppm = ny_msm_max = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + nz_pppm = nz_msm_max = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) gridflag = 0; else if (nx_pppm <= 0 || ny_pppm <= 0 || nz_pppm <= 0) @@ -465,9 +463,9 @@ void KSpace::modify_params(int narg, char **arg) iarg += 4; } else if (strcmp(arg[iarg],"mesh/disp") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal kspace_modify command"); - nx_pppm_6 = force->inumeric(FLERR,arg[iarg+1]); - ny_pppm_6 = force->inumeric(FLERR,arg[iarg+2]); - nz_pppm_6 = force->inumeric(FLERR,arg[iarg+3]); + nx_pppm_6 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + ny_pppm_6 = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + nz_pppm_6 = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (nx_pppm_6 == 0 && ny_pppm_6 == 0 && nz_pppm_6 == 0) gridflag_6 = 0; else if (nx_pppm_6 <= 0 || ny_pppm_6 <= 0 || nz_pppm_6 == 0) @@ -477,15 +475,15 @@ void KSpace::modify_params(int narg, char **arg) iarg += 4; } else if (strcmp(arg[iarg],"order") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - order = force->inumeric(FLERR,arg[iarg+1]); + order = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"order/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - order_6 = force->inumeric(FLERR,arg[iarg+1]); + order_6 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"minorder") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - minorder = force->inumeric(FLERR,arg[iarg+1]); + minorder = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (minorder < 2) error->all(FLERR,"Illegal kspace_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"overlap") == 0) { @@ -496,17 +494,17 @@ void KSpace::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"force") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - accuracy_absolute = force->numeric(FLERR,arg[iarg+1]); + accuracy_absolute = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"gewald") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - g_ewald = force->numeric(FLERR,arg[iarg+1]); + g_ewald = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (g_ewald == 0.0) gewaldflag = 0; else gewaldflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"gewald/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal kspace_modify command"); - g_ewald_6 = force->numeric(FLERR,arg[iarg+1]); + g_ewald_6 = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (g_ewald_6 == 0.0) gewaldflag_6 = 0; else gewaldflag_6 = 1; iarg += 2; @@ -516,7 +514,7 @@ void KSpace::modify_params(int narg, char **arg) slabflag = 2; } else { slabflag = 1; - slab_volfactor = force->numeric(FLERR,arg[iarg+1]); + slab_volfactor = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (slab_volfactor <= 1.0) error->all(FLERR,"Bad kspace_modify slab parameter"); if (slab_volfactor < 2.0 && comm->me == 0) diff --git a/src/kspace_deprecated.cpp b/src/kspace_deprecated.cpp index 5dc2b50e2b..16e9ff6abb 100644 --- a/src/kspace_deprecated.cpp +++ b/src/kspace_deprecated.cpp @@ -16,11 +16,10 @@ ------------------------------------------------------------------------- */ #include "kspace_deprecated.h" -#include + #include "comm.h" #include "force.h" #include "error.h" -#include "utils.h" using namespace LAMMPS_NS; diff --git a/src/lammps.cpp b/src/lammps.cpp index ded9d93167..f6952354ba 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -12,13 +12,7 @@ ------------------------------------------------------------------------- */ #include "lammps.h" -#include -#include -#include -#include -#include -#include -#include + #include "style_angle.h" // IWYU pragma: keep #include "style_atom.h" // IWYU pragma: keep #include "style_bond.h" // IWYU pragma: keep @@ -36,12 +30,12 @@ #include "universe.h" #include "input.h" #include "info.h" -#include "atom.h" +#include "atom.h" // IWYU pragma: keep #include "update.h" -#include "neighbor.h" +#include "neighbor.h" // IWYU pragma: keep #include "comm.h" #include "comm_brick.h" -#include "domain.h" +#include "domain.h" // IWYU pragma: keep #include "force.h" #include "modify.h" #include "group.h" @@ -54,8 +48,11 @@ #include "version.h" #include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" + +#include +#include +#include +#include #include "lmpinstalledpkgs.h" #include "lmpgitversion.h" @@ -83,14 +80,30 @@ struct LAMMPS_NS::package_styles_lists { using namespace LAMMPS_NS; -/* ---------------------------------------------------------------------- - start up LAMMPS - allocate fundamental classes (memory, error, universe, input) - parse input switches - initialize communicators, screen & logfile output - input is allocated at end after MPI info is setup -------------------------------------------------------------------------- */ +/** \class LAMMPS_NS::LAMMPS + * \brief LAMMPS simulation instance + * + * The LAMMPS class contains pointers of all constituent class instances + * and global variables that are used by a LAMMPS simulation. Its contents + * represent the entire state of the simulation. + * + * 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. + * The specifics of setting up and running a simulation are handled by the + * individual component class instances. */ +/** Create a LAMMPS simulation instance + * + * The LAMMPS constructor starts up a simulation by allocating all + * fundamental classes in the necessary order, parses input switches + * and their arguments, initializes communicators, screen and logfile + * output FILE pointers. + * + * \param narg number of arguments + * \param arg list of arguments + * \param communicator MPI communicator used by this LAMMPS instance + */ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : memory(NULL), error(NULL), universe(NULL), input(NULL), atom(NULL), update(NULL), neighbor(NULL), comm(NULL), domain(NULL), force(NULL), @@ -639,14 +652,13 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : } } -/* ---------------------------------------------------------------------- - shutdown LAMMPS - delete top-level classes - close screen and log files in world and universe - output files were already closed in destroy() - delete fundamental classes -------------------------------------------------------------------------- */ - +/** Shut down a LAMMPS simulation instance + * + * The LAMMPS destructor shuts down the simulation by deleting top-level class + * instances, closing screen and log files for the global instance (aka "world") + * and files and MPI communicators in sub-partitions ("universes"). Then it + * deletes the fundamental class instances and copies of data inside the class. + */ LAMMPS::~LAMMPS() { const int me = comm->me; @@ -992,6 +1004,11 @@ void _noopt LAMMPS::init_pkg_lists() #undef REGION_CLASS } +/** Return true if a LAMMPS package is enabled in this binary + * + * \param pkg name of package + * \return true if yes, else false + */ bool LAMMPS::is_installed_pkg(const char *pkg) { for (int i=0; installed_packages[i] != NULL; ++i) @@ -1008,6 +1025,16 @@ bool LAMMPS::is_installed_pkg(const char *pkg) } \ } +/** \brief Return name of package that a specific style belongs to + * + * This function checks the given name against all list of styles + * for all type of styles and if the name and the style match, it + * returns which package this style belongs to. + * + * \param style Type of style (e.g. atom, pair, fix, etc.) + * \param name Name of style + * \return Name of the package this style is part of + */ const char *LAMMPS::match_style(const char *style, const char *name) { check_for_match(angle,style,name); diff --git a/src/lammps.h b/src/lammps.h index dc2916f214..e1fcc0e319 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -85,8 +85,10 @@ class LAMMPS { struct package_styles_lists *pkg_lists; void init_pkg_lists(); void help(); - LAMMPS() {}; // prohibit using the default constructor - LAMMPS(const LAMMPS &) {}; // prohibit using the copy constructor + /// Default constructor. Declared private to prohibit its use + LAMMPS() {}; + /// Copy constructor. Declared private to prohibit its use + LAMMPS(const LAMMPS &) {}; }; } diff --git a/src/lattice.cpp b/src/lattice.cpp index 8ecf9fed73..68f3e7abe1 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -12,17 +12,15 @@ ------------------------------------------------------------------------- */ #include "lattice.h" + +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "memory.h" +#include "update.h" + #include #include -#include -#include "update.h" -#include "domain.h" -#include "comm.h" -#include "force.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" using namespace LAMMPS_NS; @@ -58,7 +56,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // before Force class is instantiated, just use atof() in that case if (force) - xlattice = ylattice = zlattice = force->numeric(FLERR,arg[1]); + xlattice = ylattice = zlattice = utils::numeric(FLERR,arg[1],false,lmp); else xlattice = ylattice = zlattice = atof(arg[1]); @@ -83,7 +81,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // scale = conversion factor between lattice and box units if (narg < 2) error->all(FLERR,"Illegal lattice command"); - scale = force->numeric(FLERR,arg[1]); + scale = utils::numeric(FLERR,arg[1],false,lmp); if (scale <= 0.0) error->all(FLERR,"Illegal lattice command"); // set basis atoms for each style @@ -150,9 +148,9 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) while (iarg < narg) { if (strcmp(arg[iarg],"origin") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal lattice command"); - origin[0] = force->numeric(FLERR,arg[iarg+1]); - origin[1] = force->numeric(FLERR,arg[iarg+2]); - origin[2] = force->numeric(FLERR,arg[iarg+3]); + origin[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + origin[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + origin[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (origin[0] < 0.0 || origin[0] >= 1.0 || origin[1] < 0.0 || origin[1] >= 1.0 || origin[2] < 0.0 || origin[2] >= 1.0) @@ -170,17 +168,17 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) if (dim == 0) orient = orientx; else if (dim == 1) orient = orienty; else if (dim == 2) orient = orientz; - orient[0] = force->inumeric(FLERR,arg[iarg+2]); - orient[1] = force->inumeric(FLERR,arg[iarg+3]); - orient[2] = force->inumeric(FLERR,arg[iarg+4]); + orient[0] = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + orient[1] = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + orient[2] = utils::inumeric(FLERR,arg[iarg+4],false,lmp); iarg += 5; } else if (strcmp(arg[iarg],"spacing") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal lattice command"); spaceflag = 1; - xlattice = force->numeric(FLERR,arg[iarg+1]); - ylattice = force->numeric(FLERR,arg[iarg+2]); - zlattice = force->numeric(FLERR,arg[iarg+3]); + xlattice = utils::numeric(FLERR,arg[iarg+1],false,lmp); + ylattice = utils::numeric(FLERR,arg[iarg+2],false,lmp); + zlattice = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"a1") == 0) { @@ -188,27 +186,27 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) if (style != CUSTOM) error->all(FLERR, "Invalid option in lattice command for non-custom style"); - a1[0] = force->numeric(FLERR,arg[iarg+1]); - a1[1] = force->numeric(FLERR,arg[iarg+2]); - a1[2] = force->numeric(FLERR,arg[iarg+3]); + a1[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + a1[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + a1[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"a2") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal lattice command"); if (style != CUSTOM) error->all(FLERR, "Invalid option in lattice command for non-custom style"); - a2[0] = force->numeric(FLERR,arg[iarg+1]); - a2[1] = force->numeric(FLERR,arg[iarg+2]); - a2[2] = force->numeric(FLERR,arg[iarg+3]); + a2[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + a2[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + a2[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"a3") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal lattice command"); if (style != CUSTOM) error->all(FLERR, "Invalid option in lattice command for non-custom style"); - a3[0] = force->numeric(FLERR,arg[iarg+1]); - a3[1] = force->numeric(FLERR,arg[iarg+2]); - a3[2] = force->numeric(FLERR,arg[iarg+3]); + a3[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + a3[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + a3[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"basis") == 0) { @@ -216,9 +214,9 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) if (style != CUSTOM) error->all(FLERR, "Invalid option in lattice command for non-custom style"); - double x = force->numeric(FLERR,arg[iarg+1]); - double y = force->numeric(FLERR,arg[iarg+2]); - double z = force->numeric(FLERR,arg[iarg+3]); + double x = utils::numeric(FLERR,arg[iarg+1],false,lmp); + double y = utils::numeric(FLERR,arg[iarg+2],false,lmp); + double z = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (x < 0.0 || x >= 1.0 || y < 0.0 || y >= 1.0 || z < 0.0 || z >= 1.0) error->all(FLERR,"Illegal lattice command"); add_basis(x,y,z); diff --git a/src/library.cpp b/src/library.cpp index 5cfc6f3149..72105bdd15 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -11,37 +11,36 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -// C or Fortran style library interface to LAMMPS -// customize by adding new LAMMPS-specific functions +// C style library interface to LAMMPS. +// See the manual for detailed documentation. #include "library.h" #include -#include -#include -#include -#include "universe.h" -#include "atom_vec.h" + #include "atom.h" +#include "atom_vec.h" +#include "comm.h" +#include "compute.h" #include "domain.h" -#include "update.h" +#include "error.h" +#include "fix.h" +#include "fix_external.h" +#include "force.h" #include "group.h" +#include "info.h" #include "input.h" -#include "variable.h" +#include "memory.h" #include "modify.h" +#include "neigh_list.h" +#include "neighbor.h" #include "output.h" #include "thermo.h" -#include "compute.h" -#include "fix.h" -#include "comm.h" -#include "memory.h" -#include "error.h" -#include "force.h" -#include "info.h" -#include "fix_external.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" -#include "fmt/format.h" +#include "universe.h" +#include "update.h" +#include "variable.h" + +#include +#include #if defined(LAMMPS_EXCEPTIONS) #include "exceptions.h" @@ -92,139 +91,337 @@ using namespace LAMMPS_NS; #endif // ---------------------------------------------------------------------- -// library API functions to create/destroy an instance of LAMMPS -// and communicate commands to it +// Library functions to create/destroy an instance of LAMMPS // ---------------------------------------------------------------------- -/* ---------------------------------------------------------------------- - create an instance of LAMMPS and return pointer to it - pass in command-line args and MPI communicator to run on -------------------------------------------------------------------------- */ +/** Create instance of the LAMMPS class and return pointer to it. + * +\verbatim embed:rst -void lammps_open(int argc, char **argv, MPI_Comm communicator, void **ptr) +The :cpp:func:`lammps_open` function creates a new :cpp:class:`LAMMPS +` class instance while passing in a list of strings +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 +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. + +If for some reason the creation or initialization of the LAMMPS instance +fails a null pointer is returned. + +.. versionchanged:: 15Sep2020 + + This function now has the pointer to the created LAMMPS class + instance as return value. For backward compatibility it is still + possible to provide the address of a pointer variable as final + argument *ptr*\ . This use is deprecated and may be removed in + the future. The *ptr* argument may be ``NULL`` and is then ignored. + +.. note:: + + This function is not declared when the code linking to the LAMMPS + library interface is compiled with ``-DLAMMPS_LIB_NO_MPI``, or + contains a ``#define LAMMPS_LIB_NO_MPI 1`` statement before + ``#include "library.h"``. In that case, you must use the + :cpp:func:`lammps_open_no_mpi` function. + +\endverbatim + * + * \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`` + * \return pointer to new LAMMPS instance cast to ``void *`` */ + +void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) { + LAMMPS *lmp = NULL; + lammps_mpi_init(); + #ifdef LAMMPS_EXCEPTIONS try { - LAMMPS *lmp = new LAMMPS(argc,argv,communicator); - *ptr = (void *) lmp; + lmp = new LAMMPS(argc, argv, comm); + if (ptr) *ptr = (void *) lmp; } catch(LAMMPSException & e) { fmt::print(stderr, "LAMMPS Exception: {}", e.message); *ptr = (void *) NULL; } #else - LAMMPS *lmp = new LAMMPS(argc,argv,communicator); - *ptr = (void *) lmp; + lmp = new LAMMPS(argc, argv, comm); + if (ptr) *ptr = (void *) lmp; #endif + return (void *) lmp; } -/* ---------------------------------------------------------------------- - create an instance of LAMMPS and return pointer to it - caller doesn't know MPI communicator, so use MPI_COMM_WORLD - initialize MPI if needed -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void lammps_open_no_mpi(int argc, char **argv, void **ptr) +/** Variant of ``lammps_open()`` that implicitly uses ``MPI_COMM_WORLD``. + * +\verbatim embed:rst + +This function is a version of :cpp:func:`lammps_open`, that is missing +the MPI communicator argument. It will use ``MPI_COMM_WORLD`` instead. +The type and purpose of arguments and return value are otherwise the +same. + +Outside of the convenience, this function is useful, when the LAMMPS +library was compiled in serial mode, but the calling code runs in +parallel and the ``MPI_Comm`` data type of the STUBS library would not +be compatible with that of the calling code. + +If for some reason the creation or initialization of the LAMMPS instance +fails a null pointer is returned. + +.. versionchanged:: 15Sep2020 + + This function now has the pointer to the created LAMMPS class + instance as return value. For backward compatibility it is still + possible to provide the address of a pointer variable as final + argument *ptr*\ . This use is deprecated and may be removed in + the future. The *ptr* argument may be ``NULL`` and is then ignored. + +\endverbatim + * + * \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 *`` */ + +void *lammps_open_no_mpi(int argc, char **argv, void **ptr) +{ + return lammps_open(argc,argv,MPI_COMM_WORLD,ptr); +} + +/* ---------------------------------------------------------------------- */ + +/** Variant of ``lammps_open()`` using a Fortran MPI communicator. + * +\verbatim embed:rst + +This function is a version of :cpp:func:`lammps_open`, that uses an +integer for the MPI communicator as the MPI Fortran interface does. It +is used in the :f:func:`lammps` constructor of the LAMMPS Fortran +module. Internally it converts the *f_comm* argument into a C-style MPI +communicator with ``MPI_Comm_f2c()`` and then calls +:cpp:func:`lammps_open`. + +If for some reason the creation or initialization of the LAMMPS instance +fails a null pointer is returned. + +.. versionadded:: 15Sep2020 + +\endverbatim + * + * \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 *`` */ + +void *lammps_open_fortran(int argc, char **argv, int f_comm) +{ + lammps_mpi_init(); + MPI_Comm c_comm = MPI_Comm_f2c((MPI_Fint)f_comm); + return lammps_open(argc, argv, c_comm, nullptr); +} + +/* ---------------------------------------------------------------------- */ + +/** Delete a LAMMPS instance created by lammps_open() or its variants. + * +\verbatim embed:rst + +This function deletes the LAMMPS class instance pointed to by ``handle`` +that was created by one of the :cpp:func:`lammps_open` variants. It +does **not** call ``MPI_Finalize()`` to allow creating and deleting +multiple LAMMPS instances concurrently or sequentially. See +:cpp:func:`lammps_mpi_finalize` for a function performing this operation. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance */ + +void lammps_close(void *handle) +{ + LAMMPS *lmp = (LAMMPS *) handle; + delete lmp; +} + +/* ---------------------------------------------------------------------- */ + +/** Ensure the MPI environment is initialized. + * +\verbatim embed:rst + +The MPI standard requires that any MPI application must call +``MPI_Init()`` exactly once before performing any other MPI function +calls. This function checks, whether MPI is already initialized and +calls ``MPI_Init()`` in case it is not. + +.. versionadded:: 15Sep2020 + +\endverbatim */ + +void lammps_mpi_init() { int flag; MPI_Initialized(&flag); if (!flag) { - int argc = 0; - char **argv = NULL; + // provide a dummy argc and argv for MPI_Init(). + int argc = 1; + char *args[] = { (char *)"liblammps" , NULL }; + char **argv = args; MPI_Init(&argc,&argv); } - - MPI_Comm communicator = MPI_COMM_WORLD; - -#ifdef LAMMPS_EXCEPTIONS - try - { - LAMMPS *lmp = new LAMMPS(argc,argv,communicator); - *ptr = (void *) lmp; - } - catch(LAMMPSException & e) { - fmt::print(stderr, "LAMMPS Exception: {}", e.message); - *ptr = (void*) NULL; - } -#else - LAMMPS *lmp = new LAMMPS(argc,argv,communicator); - *ptr = (void *) lmp; -#endif } -/* ---------------------------------------------------------------------- - destruct an instance of LAMMPS -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void lammps_close(void *ptr) +/** Shut down the MPI infrastructure. + * +\verbatim embed:rst + +The MPI standard requires that any MPI application calls +``MPI_Finalize()`` before exiting. Even if a calling program does not +do any MPI calls, MPI is still initialized internally to avoid errors +accessing any MPI functions. This function should then be called right +before exiting the program to wait until all (parallel) tasks are +completed and then MPI is cleanly shut down. After this function no +more MPI calls may be made. + +.. versionadded:: 15Sep2020 + +\endverbatim */ + +void lammps_mpi_finalize() { - LAMMPS *lmp = (LAMMPS *) ptr; - delete lmp; + MPI_Barrier(MPI_COMM_WORLD); + MPI_Finalize(); } -/* ---------------------------------------------------------------------- - get the numerical representation of the current LAMMPS version -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -int lammps_version(void *ptr) +/** Free memory buffer allocated by LAMMPS. + * +\verbatim embed:rst + +Some of the LAMMPS C library interface functions return data as pointer +to a buffer that has been allocated by LAMMPS or the library interface. +This function can be used to delete those in order to avoid memory +leaks. + +\endverbatim + * + * \param ptr pointer to data allocated by LAMMPS */ + +void lammps_free(void *ptr) { - LAMMPS *lmp = (LAMMPS *) ptr; - return atoi(lmp->universe->num_ver); + free(ptr); } -/* ---------------------------------------------------------------------- - process an input script in filename str -------------------------------------------------------------------------- */ +// ---------------------------------------------------------------------- +// Library functions to process commands +// ---------------------------------------------------------------------- -void lammps_file(void *ptr, char *str) +/** Process LAMMPS input from a file. + * +\verbatim embed:rst + +This function processes commands in the file pointed to by *filename* +line by line and thus functions very similar to the :doc:`include +` command. The function returns when the end of the file is +reached and the commands have completed. + +The actual work is done by the functions +:cpp:func:`Input::file(const char *)` +and :cpp:func:`Input::file()`. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param filename name of a file with LAMMPS input */ + +void lammps_file(void *handle, const char *filename) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { if (lmp->update->whichflag != 0) - lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + lmp->error->all(FLERR,"Library error: issuing LAMMPS commands " + "during a run is not allowed."); else - lmp->input->file(str); + lmp->input->file(filename); } END_CAPTURE } -/* ---------------------------------------------------------------------- - process a single input command in str - does not matter if str ends in newline - return command name to caller -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -char *lammps_command(void *ptr, char *str) +/** Process a single LAMMPS input command from a string. + * +\verbatim embed:rst + +This function tells LAMMPS to execute the single command in the string +*cmd*. The entire string is considered as command and need not have a +(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. + +The function returns the name of the command on success or ``NULL`` when +passing a string without a command. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param cmd string with a single LAMMPS command + * \return string with parsed command name or ``NULL`` */ + +char *lammps_command(void *handle, const char *cmd) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; char *result = NULL; BEGIN_CAPTURE { if (lmp->update->whichflag != 0) - lmp->error->all(FLERR,"Library error: issuing LAMMPS command during run"); + lmp->error->all(FLERR,"Library error: issuing LAMMPS commands " + "during a run is not allowed."); else - result = lmp->input->one(str); + result = lmp->input->one(cmd); } END_CAPTURE return result; } -/* ---------------------------------------------------------------------- - process multiple input commands in cmds = list of strings - does not matter if each string ends in newline - create long contatentated string for processing by commands_string() - insert newlines in concatenated string as needed -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void lammps_commands_list(void *ptr, int ncmd, char **cmds) +/** Process multiple LAMMPS input commands from list of strings. + * +\verbatim embed:rst + +This function processes multiple commands from a list of strings by +first concatenating the individual strings in *cmds* into a single +string, inserting newline characters as needed. The combined string +is passed to :cpp:func:`lammps_commands_string` for processing. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param ncmd number of lines in *cmds* + * \param cmds list of strings with LAMMPS commands */ + +void lammps_commands_list(void *handle, int ncmd, const char **cmds) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; int n = ncmd+1; for (int i = 0; i < ncmd; i++) n += strlen(cmds[i]); @@ -243,19 +440,37 @@ void lammps_commands_list(void *ptr, int ncmd, char **cmds) } } - lammps_commands_string(ptr,str); + lammps_commands_string(handle,str); lmp->memory->sfree(str); } -/* ---------------------------------------------------------------------- - process multiple input commands in single long str, separated by newlines - single command can span multiple lines via continuation characters - multi-line commands enabled by triple quotes will not work -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void lammps_commands_string(void *ptr, char *str) +/** Process a block of LAMMPS input commands from a single string. + * +\verbatim embed:rst + +This function processes a multi-line string similar to a block of +commands from a file. The string may have multiple lines (separated by +newline characters) and also single commands may be distributed over +multiple lines with continuation characters ('&'). Those lines are +combined by removing the '&' and the following newline character. After +this processing the string is handed to LAMMPS for parsing and +executing. + +.. note:: + + Multi-line commands enabled by triple quotes will NOT work with + this function. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param str string with block of LAMMPS input commands */ + +void lammps_commands_string(void *handle, const char *str) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; // make copy of str so can strtok() it @@ -291,56 +506,546 @@ void lammps_commands_string(void *ptr, char *str) delete [] copy; } -/* ---------------------------------------------------------------------- - clean-up function to free memory allocated by lib and returned to caller -------------------------------------------------------------------------- */ +// ----------------------------------------------------------------------- +// Library functions to extract info from LAMMPS or set data in LAMMPS +// ----------------------------------------------------------------------- -void lammps_free(void *ptr) +/** Get numerical representation of the LAMMPS version date. + * +\verbatim embed:rst + +The :cpp:func:`lammps_version` function returns an integer representing +the version of the LAMMPS code in the format YYYYMMDD. This can be used +to implement backward compatibility in software using the LAMMPS library +interface. The specific format guarantees, that this version number is +growing with every new LAMMPS release. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \return an integer representing the version data in the + * format YYYYMMDD */ + +int lammps_version(void *handle) { - free(ptr); + LAMMPS *lmp = (LAMMPS *) handle; + return atoi(lmp->universe->num_ver); } -// ---------------------------------------------------------------------- -// library API functions to extract info from LAMMPS or set info in LAMMPS -// ---------------------------------------------------------------------- +/* ---------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- - add LAMMPS-specific library functions - all must receive LAMMPS pointer as argument - customize by adding a function here and in library.h header file -------------------------------------------------------------------------- */ +/** Return the total number of atoms in the system. + * +\verbatim embed:rst -/* ---------------------------------------------------------------------- - extract a LAMMPS setting as an integer - only use for settings that require return of an int - customize by adding names -------------------------------------------------------------------------- */ +This number may be very large when running large simulations across +multiple processors. Depending on compile time choices, LAMMPS may be +using either 32-bit or a 64-bit integer to store this number. For +portability this function returns thus a double precision +floating point number, which can represent up to a 53-bit signed +integer exactly (:math:`\approx 10^{16}`). -int lammps_extract_setting(void * /*ptr*/, char *name) +As an alternative, you can use :cpp:func:`lammps_extract_global` +and cast the resulting pointer to an integer pointer of the correct +size and dereference it. The size of that integer (in bytes) can be +queried by calling :cpp:func:`lammps_extract_setting` to return +the size of a ``bigint`` integer. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \return total number of atoms or 0 if value is too large */ + +double lammps_get_natoms(void *handle) { - if (strcmp(name,"bigint") == 0) return sizeof(bigint); - if (strcmp(name,"tagint") == 0) return sizeof(tagint); - if (strcmp(name,"imageint") == 0) return sizeof(imageint); + LAMMPS *lmp = (LAMMPS *) handle; + + double natoms = static_cast (lmp->atom->natoms); + if (natoms > 9.0e15) return 0; // TODO:XXX why not -1? + return natoms; +} + +/* ---------------------------------------------------------------------- */ + +/** Get current value of a thermo keyword. + * +\verbatim embed:rst + +This function returns the current value of a :doc:`thermo keyword +`. Unlike :cpp:func:`lammps_extract_global` it does not +give access to the storage of the desired data but returns its value as +a double, so it can also return information that is computed on-the-fly. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param keyword string with the name of the thermo keyword + * \return value of the requested thermo property or 0.0 */ + +double lammps_get_thermo(void *handle, char *keyword) +{ + LAMMPS *lmp = (LAMMPS *) handle; + double dval = 0.0; + + BEGIN_CAPTURE + { + lmp->output->thermo->evaluate_keyword(keyword,&dval); + } + END_CAPTURE + + return dval; +} + +/* ---------------------------------------------------------------------- */ + +/** Extract simulation box parameters. + * +\verbatim embed:rst + +This function (re-)initializes the simulation box and boundary +information and then assign the designated data to the locations in the +pointers passed as arguments. Any argument (except the first) may be +a NULL pointer and then will not be assigned. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param boxlo pointer to 3 doubles where the lower box boundary is stored + * \param boxhi pointer to 3 doubles where the upper box boundary is stored + * \param xy pointer to a double where the xy tilt factor is stored + * \param yz pointer to a double where the yz tilt factor is stored + * \param xz pointer to a double where the xz tilt factor is stored + * \param pflags pointer to 3 ints, set to 1 for periodic boundaries + and 0 for non-periodic + * \param boxflag pointer to an int, which is set to 1 if the box will be + * changed during a simulation by a fix and 0 if not. */ + +void lammps_extract_box(void *handle, double *boxlo, double *boxhi, + double *xy, double *yz, double *xz, + int *pflags, int *boxflag) +{ + LAMMPS *lmp = (LAMMPS *) handle; + Domain *domain = lmp->domain; + + BEGIN_CAPTURE + { + // do nothing if box does not yet exist + if ((lmp->domain->box_exist == 0) + && (lmp->comm->me == 0)) { + lmp->error->warning(FLERR,"Calling lammps_extract_box without a box"); + return; + } + + // domain->init() is needed to update domain->box_change + domain->init(); + + if (boxlo) { + boxlo[0] = domain->boxlo[0]; + boxlo[1] = domain->boxlo[1]; + boxlo[2] = domain->boxlo[2]; + } + if (boxhi) { + boxhi[0] = domain->boxhi[0]; + boxhi[1] = domain->boxhi[1]; + boxhi[2] = domain->boxhi[2]; + } + if (xy) *xy = domain->xy; + if (yz) *yz = domain->yz; + if (xz) *xz = domain->xz; + + if (pflags) { + pflags[0] = domain->periodicity[0]; + pflags[1] = domain->periodicity[1]; + pflags[2] = domain->periodicity[2]; + } + if (boxflag) *boxflag = domain->box_change; + } + END_CAPTURE +} + +/* ---------------------------------------------------------------------- */ + +/** Reset simulation box parameters. + * +\verbatim embed:rst + +This function sets the simulation box dimensions (upper and lower bounds +and tilt factors) from the provided data and then re-initializes the box +information and all derived settings. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param boxlo pointer to 3 doubles containing the lower box boundary + * \param boxhi pointer to 3 doubles containing the upper box boundary + * \param xy xy tilt factor + * \param yz yz tilt factor + * \param xz xz tilt factor */ + +void lammps_reset_box(void *handle, double *boxlo, double *boxhi, + double xy, double yz, double xz) +{ + LAMMPS *lmp = (LAMMPS *) handle; + Domain *domain = lmp->domain; + + BEGIN_CAPTURE + { + // error if box does not exist + if ((lmp->domain->box_exist == 0) + && (lmp->comm->me == 0)) { + lmp->error->warning(FLERR,"Calling lammps_reset_box without a box"); + return; + } + domain->boxlo[0] = boxlo[0]; + domain->boxlo[1] = boxlo[1]; + domain->boxlo[2] = boxlo[2]; + domain->boxhi[0] = boxhi[0]; + domain->boxhi[1] = boxhi[1]; + domain->boxhi[2] = boxhi[2]; + + domain->xy = xy; + domain->yz = yz; + domain->xz = xz; + + domain->set_global_box(); + lmp->comm->set_proc_grid(); + domain->set_local_box(); + } + END_CAPTURE +} + +/* ---------------------------------------------------------------------- */ + +/** Query LAMMPS about global settings. + * +\verbatim embed:rst + +This function will retrieve or compute global properties. In contrast to +:cpp:func:`lammps_get_thermo` this function returns an ``int``. The +following keywords are currently supported. If a keyword is not +recognized, the function returns -1. Please also see :cpp:func:`lammps_extract_global`. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Keyword + - Description / Return value + * - bigint + - size of the ``bigint`` integer type, 4 or 8 bytes. + Set at :ref:`compile time `. + * - tagint + - size of the ``tagint`` integer type, 4 or 8 bytes. + Set at :ref:`compile time `. + * - imageint + - size of the ``imageint`` integer type, 4 or 8 bytes. + Set at :ref:`compile time `. + * - dimension + - Number of dimensions: 2 or 3. See :doc:`dimension`. + * - box_exist + - 1 if the simulation box is defined, 0 if not. + See :doc:`create_box`. + * - triclinic + - 1 if the the simulation box is triclinic, 0 if orthogonal. + See :doc:`change_box`. + * - nlocal + - number of "owned" atoms of the current MPI rank. + * - nghost + - number of "ghost" atoms of the current MPI rank. + * - nall + - number of all "owned" and "ghost" atoms of the current MPI rank. + * - nmax + - maximum of nlocal+nghost across all MPI ranks (for per-atom data array size). + * - ntypes + - number of atom types + * - molecule_flag + - 1 if the atom style includes molecular topology data. See :doc:`atom_style`. + * - q_flag + - 1 if the atom style includes point charges. See :doc:`atom_style`. + * - mu_flag + - 1 if the atom style includes point dipoles. See :doc:`atom_style`. + * - rmass_flag + - 1 if the atom style includes per-atom masses, 0 if there are per-type masses. See :doc:`atom_style`. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param keyword string with the name of the thermo keyword + * \return value of the queried setting or -1 if unknown */ + +int lammps_extract_setting(void * handle, char *keyword) +{ + LAMMPS *lmp = (LAMMPS *) handle; + +// This can be customized by adding keywords and documenting them in the section above. + if (strcmp(keyword,"bigint") == 0) return sizeof(bigint); + if (strcmp(keyword,"tagint") == 0) return sizeof(tagint); + if (strcmp(keyword,"imageint") == 0) return sizeof(imageint); + + if (strcmp(keyword,"dimension") == 0) return lmp->domain->dimension; + if (strcmp(keyword,"box_exist") == 0) return lmp->domain->box_exist; + if (strcmp(keyword,"triclinic") == 0) return lmp->domain->triclinic; + + if (strcmp(keyword,"nlocal") == 0) return lmp->atom->nlocal; + if (strcmp(keyword,"nghost") == 0) return lmp->atom->nghost; + if (strcmp(keyword,"nall") == 0) return lmp->atom->nlocal+lmp->atom->nghost; + if (strcmp(keyword,"nmax") == 0) return lmp->atom->nmax; + if (strcmp(keyword,"ntypes") == 0) return lmp->atom->ntypes; + + if (strcmp(keyword,"molecule_flag") == 0) return lmp->atom->molecule_flag; + if (strcmp(keyword,"q_flag") == 0) return lmp->atom->q_flag; + if (strcmp(keyword,"mu_flag") == 0) return lmp->atom->mu_flag; + if (strcmp(keyword,"rmass_flag") == 0) return lmp->atom->rmass_flag; return -1; } -/* ---------------------------------------------------------------------- - extract a pointer to an internal LAMMPS global entity - name = desired quantity, e.g. dt or boxyhi or natoms - returns a void pointer to the entity - which the caller can cast to the proper data type - returns a NULL if name not listed below - this function need only be invoked once - the returned pointer is a permanent valid reference to the quantity - customize by adding names -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void *lammps_extract_global(void *ptr, char *name) +/** Get pointer to internal global LAMMPS variables or arrays. + * +\verbatim embed:rst + +This function returns a pointer to the location of some global property +stored in one of the constituent classes of a LAMMPS instance. The +returned pointer is cast to ``void *`` and needs to be cast to a pointer +of the type that the entity represents. The pointers returned by this +function are generally persistent; therefore it is not necessary to call +the function again, unless a :doc:`clear` command is issued which wipes +out and recreates the contents of the :cpp:class:`LAMMPS +` class. + +Please also see :cpp:func:`lammps_extract_setting`, +:cpp:func:`lammps_get_thermo`, and :cpp:func:`lammps_extract_box`. + +.. warning:: + + Modifying the data in the location pointed to by the returned pointer + may lead to inconsistent internal data and thus may cause failures or + crashes or bogus simulations. In general it is thus usually better + to use a LAMMPS input command that sets or changes these parameters. + Those will takes care of all side effects and necessary updates of + settings derived from such settings. Where possible a reference to + such a command or a relevant section of the manual is given below. + +This table lists the supported names, their data types, length of the +data area, and a short description. The ``bigint`` type may be defined +to be either an ``int`` or an ``int64_t``. This is selected at +:ref:`compile time `. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Name + - Type + - Length + - Description + * - units + - char \* + - 1 + - string with the current unit style. See :doc:`units`. + * - dt + - double + - 1 + - length of the time step. See :doc:`timestep`. + * - ntimestep + - bigint + - 1 + - current time step number. See :doc:`reset_timestep`. + * - boxlo + - double + - 3 + - lower box boundaries. See :doc:`create_box`. + * - boxhi + - double + - 3 + - upper box boundaries. See :doc:`create_box`. + * - boxxlo + - double + - 1 + - lower box boundary in x-direction. See :doc:`create_box`. + * - boxxhi + - double + - 1 + - upper box boundary in x-direction. See :doc:`create_box`. + * - boxylo + - double + - 1 + - lower box boundary in y-direction. See :doc:`create_box`. + * - boxyhi + - double + - 1 + - upper box boundary in y-direction. See :doc:`create_box`. + * - boxzlo + - double + - 1 + - lower box boundary in z-direction. See :doc:`create_box`. + * - boxzhi + - double + - 1 + - upper box boundary in z-direction. See :doc:`create_box`. + * - periodicity + - int + - 3 + - 0 if non-periodic, 1 if periodic for x, y, and z; + See :doc:`boundary`. + * - triclinic + - int + - 1 + - 1 if the the simulation box is triclinic, 0 if orthogonal; + See :doc:`change_box`. + * - xy + - double + - 1 + - triclinic tilt factor. See :doc:`Howto_triclinic`. + * - yz + - double + - 1 + - triclinic tilt factor. See :doc:`Howto_triclinic`. + * - xz + - double + - 1 + - triclinic tilt factor. See :doc:`Howto_triclinic`. + * - natoms + - bigint + - 1 + - total number of atoms in the simulation. + * - nbonds + - bigint + - 1 + - total number of bonds in the simulation. + * - nangles + - bigint + - 1 + - total number of angles in the simulation. + * - ndihedrals + - bigint + - 1 + - total number of dihedrals in the simulation. + * - nimpropers + - bigint + - 1 + - total number of impropers in the simulation. + * - nlocal + - int + - 1 + - number of "owned" atoms of the current MPI rank. + * - nghost + - int + - 1 + - number of "ghost" atoms of the current MPI rank. + * - nmax + - int + - 1 + - maximum of nlocal+nghost across all MPI ranks (for per-atom data array size). + * - ntypes + - int + - 1 + - number of atom types + * - q_flag + - int + - 1 + - 1 if the atom style includes point charges. See :doc:`atom_style`. + * - atime + - double + - 1 + - accumulated simulation time in time units. + * - atimestep + - bigint + - 1 + - the number of the timestep when "atime" was last updated. + * - boltz + - double + - 1 + - value of the "boltz" constant. See :doc:`units`. + * - hplanck + - double + - 1 + - value of the "hplanck" constant. See :doc:`units`. + * - mvv2e + - double + - 1 + - factor to convert :math:`\frac{1}{2}mv^2` for a particle to + the current energy unit; See :doc:`units`. + * - ftm2v + - double + - 1 + - (description missing) See :doc:`units`. + * - mv2d + - double + - 1 + - (description missing) See :doc:`units`. + * - nktv2p + - double + - 1 + - (description missing) See :doc:`units`. + * - qqr2e + - double + - 1 + - factor to convert :math:`\frac{q_i q_j}{r}` to energy units; + See :doc:`units`. + * - qe2f + - double + - 1 + - (description missing) See :doc:`units`. + * - vxmu2f + - double + - 1 + - (description missing) See :doc:`units`. + * - xxt2kmu + - double + - 1 + - (description missing) See :doc:`units`. + * - dielectric + - double + - 1 + - value of the dielectric constant. See :doc:`dielectric`. + * - qqrd2e + - double + - 1 + - (description missing) See :doc:`units`. + * - e_mass + - double + - 1 + - (description missing) See :doc:`units`. + * - hhmrr2e + - double + - 1 + - (description missing) See :doc:`units`. + * - mvh2r + - double + - 1 + - (description missing) See :doc:`units`. + * - angstrom + - double + - 1 + - constant to convert current length unit to angstroms; + 1.0 for reduced (aka "lj") units. See :doc:`units`. + * - femtosecond + - double + - 1 + - constant to convert current time unit to femtoseconds; + 1.0 for reduced (aka "lj") units + * - qelectron + - double + - 1 + - (description missing) See :doc:`units`. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param name string with the name of the extracted property + * \return pointer (cast to ``void *``) to the location of the + requested property. NULL if name is not known. */ + +void *lammps_extract_global(void *handle, char *name) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; + if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt; + if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep; if (strcmp(name,"boxlo") == 0) return (void *) lmp->domain->boxlo; if (strcmp(name,"boxhi") == 0) return (void *) lmp->domain->boxhi; if (strcmp(name,"boxxlo") == 0) return (void *) &lmp->domain->boxlo[0]; @@ -350,7 +1055,7 @@ void *lammps_extract_global(void *ptr, char *name) if (strcmp(name,"boxzlo") == 0) return (void *) &lmp->domain->boxlo[2]; if (strcmp(name,"boxzhi") == 0) return (void *) &lmp->domain->boxhi[2]; if (strcmp(name,"periodicity") == 0) return (void *) lmp->domain->periodicity; - + if (strcmp(name,"triclinic") == 0) return (void *) &lmp->domain->triclinic; if (strcmp(name,"xy") == 0) return (void *) &lmp->domain->xy; if (strcmp(name,"xz") == 0) return (void *) &lmp->domain->xz; if (strcmp(name,"yz") == 0) return (void *) &lmp->domain->yz; @@ -363,10 +1068,6 @@ void *lammps_extract_global(void *ptr, char *name) if (strcmp(name,"nghost") == 0) return (void *) &lmp->atom->nghost; if (strcmp(name,"nmax") == 0) return (void *) &lmp->atom->nmax; if (strcmp(name,"ntypes") == 0) return (void *) &lmp->atom->ntypes; - if (strcmp(name,"ntimestep") == 0) return (void *) &lmp->update->ntimestep; - - if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; - if (strcmp(name,"triclinic") == 0) return (void *) &lmp->domain->triclinic; if (strcmp(name,"q_flag") == 0) return (void *) &lmp->atom->q_flag; @@ -402,85 +1103,294 @@ void *lammps_extract_global(void *ptr, char *name) return NULL; } -/* ---------------------------------------------------------------------- - extract simulation box parameters - see domain.h for definition of these arguments - domain->init() call needed to set box_change -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void lammps_extract_box(void *ptr, double *boxlo, double *boxhi, - double *xy, double *yz, double *xz, - int *periodicity, int *box_change) +/** Get pointer to a LAMMPS per-atom property. + * +\verbatim embed:rst + +This function returns a pointer to the location of per-atom properties +(and per-atom-type properties in the case of the 'mass' keyword). +Per-atom data is distributed across sub-domains and thus MPI ranks. The +returned pointer is cast to ``void *`` and needs to be cast to a pointer +of data type that the entity represents. + +A table with supported keywords is included in the documentation +of the :cpp:func:`Atom::extract() ` function. + +.. note:: + + The pointers returned by this function are generally not persistent + since per-atom data may be re-distributed, re-allocated, and + re-ordered at every re-neighboring operation. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param name string with the name of the extracted property + * \return pointer (cast to ``void *``) to the location of the + * requested data or ``NULL`` if not found. */ + +void *lammps_extract_atom(void *handle, char *name) { - LAMMPS *lmp = (LAMMPS *) ptr; - Domain *domain = lmp->domain; - domain->init(); - - boxlo[0] = domain->boxlo[0]; - boxlo[1] = domain->boxlo[1]; - boxlo[2] = domain->boxlo[2]; - boxhi[0] = domain->boxhi[0]; - boxhi[1] = domain->boxhi[1]; - boxhi[2] = domain->boxhi[2]; - - *xy = domain->xy; - *yz = domain->yz; - *xz = domain->xz; - - periodicity[0] = domain->periodicity[0]; - periodicity[1] = domain->periodicity[1]; - periodicity[2] = domain->periodicity[2]; - - *box_change = domain->box_change; -} - -/* ---------------------------------------------------------------------- - extract a pointer to an internal LAMMPS atom-based entity - name = desired quantity, e.g. x or mass - returns a void pointer to the entity - which the caller can cast to the proper data type - returns a NULL if Atom::extract() does not recognize the name - the returned pointer is not a permanent valid reference to the - per-atom quantity, since LAMMPS may reallocate per-atom data - customize by adding names to Atom::extract() -------------------------------------------------------------------------- */ - -void *lammps_extract_atom(void *ptr, char *name) -{ - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; return lmp->atom->extract(name); } -/* ---------------------------------------------------------------------- - extract a pointer to an internal LAMMPS compute-based entity - the compute is invoked if its value(s) is not current - id = compute ID - style = 0 for global data, 1 for per-atom data, 2 for local data - type = 0 for scalar, 1 for vector, 2 for array - for global data, returns a pointer to the - compute's internal data structure for the entity - caller should cast it to (double *) for a scalar or vector - caller should cast it to (double **) for an array - for per-atom or local vector/array data, returns a pointer to the - compute's internal data structure for the entity - caller should cast it to (double *) for a vector - caller should cast it to (double **) for an array - for local data, accessing scalar data for the compute (type = 0), - returns a pointer that should be cast to (int *) which points to - an int with the number of local rows, i.e. the length of the local array. - returns a void pointer to the compute's internal data structure - for the entity which the caller can cast to the proper data type - returns a NULL if id is not recognized or style/type not supported - the returned pointer is not a permanent valid reference to the - compute data, this function should be re-invoked - IMPORTANT: if the compute is not current it will be invoked - LAMMPS cannot easily check here if it is valid to invoke the compute, - so caller must insure that it is OK -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void *lammps_extract_compute(void *ptr, char *id, int style, int type) +/** Create N atoms from list of coordinates + * +\verbatim embed:rst + +The prototype for this function when compiling with ``-DLAMMPS_BIGBIG`` +is: + +.. code-block:: c + + int lammps_create_atoms(void *handle, int n, int64_t *id, int *type, double *x, double *v, int64_t *image, int bexpand); + +This function creates additional atoms from a given list of coordinates +and a list of atom types. Additionally the atom-IDs, velocities, and +image flags may be provided. If atom-IDs are not provided, they will be +automatically created as a sequence following the largest existing +atom-ID. + +This function is useful to add atoms to a simulation or - in tandem with +:cpp:func:`lammps_reset_box` - to restore a previously extracted and +saved state of a simulation. Additional properties for the new atoms +can then be assigned via the :cpp:func:`lammps_scatter_atoms` +:cpp:func:`lammps_extract_atom` functions. + +For non-periodic boundaries, atoms will **not** be created that have +coordinates outside the box unless it is a shrink-wrap boundary and the +shrinkexceed flag has been set to a non-zero value. For periodic +boundaries atoms will be wrapped back into the simulation cell and its +image flags adjusted accordingly, unless explicit image flags are +provided. + +The function returns the number of atoms created or -1 on failure, e.g. +when called before as box has been created. + +Coordinates and velocities have to be given in a 1d-array in the order +X(1),Y(1),Z(1),X(2),Y(2),Z(2),...,X(N),Y(N),Z(N). + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param n number of atoms, N, to be added to the system + * \param id pointer to N atom IDs; ``NULL`` will generate IDs + * \param type pointer to N atom types (required) + * \param x pointer to 3N doubles with x-,y-,z- positions + of the new atoms (required) + * \param v pointer to 3N doubles with x-,y-,z- velocities + of the new atoms (set to 0.0 if ``NULL``) + * \param image pointer to N imageint sets of image flags, or ``NULL`` + * \param bexpand if 1, atoms outside of shrink-wrap boundaries will + still be created and not dropped and the box extended + * \return number of atoms created on success; + -1 on failure (no box, no atom IDs, etc.) */ + +int lammps_create_atoms(void *handle, int n, tagint *id, int *type, + double *x, double *v, imageint *image, + int bexpand) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; + bigint natoms_prev = lmp->atom->natoms; + + BEGIN_CAPTURE + { + // error if box does not exist or tags not defined + + int flag = 0; + std::string msg("Failure in lammps_create_atoms: "); + if (lmp->domain->box_exist == 0) { + flag = 1; + msg += "trying to create atoms before before simulation box is defined"; + } + if (lmp->atom->tag_enable == 0) { + flag = 1; + msg += "must have atom IDs to use this function"; + } + + if (flag) { + if (lmp->comm->me == 0) lmp->error->warning(FLERR,msg.c_str()); + return -1; + } + + // loop over all N atoms on all MPI ranks + // if this proc would own it based on its coordinates, invoke create_atom() + // optionally set atom tags and velocities + + Atom *atom = lmp->atom; + Domain *domain = lmp->domain; + int nlocal = atom->nlocal; + + int nlocal_prev = nlocal; + double xdata[3]; + + for (int i = 0; i < n; i++) { + xdata[0] = x[3*i]; + xdata[1] = x[3*i+1]; + xdata[2] = x[3*i+2]; + imageint * img = image ? image + i : NULL; + tagint tag = id ? id[i] : 0; + + // create atom only on MPI rank that would own it + + if (!domain->ownatom(tag, xdata, img, bexpand)) continue; + + atom->avec->create_atom(type[i],xdata); + if (id) atom->tag[nlocal] = id[i]; + else atom->tag[nlocal] = 0; + if (v) { + atom->v[nlocal][0] = v[3*i]; + atom->v[nlocal][1] = v[3*i+1]; + atom->v[nlocal][2] = v[3*i+2]; + } + if (image) atom->image[nlocal] = image[i]; + nlocal++; + } + + // if no tags are given explicitly, create new and unique tags + + if (id == NULL) atom->tag_extend(); + + // reset box info, if extended when adding atoms. + + if (bexpand) domain->reset_box(); + + // need to reset atom->natoms inside LAMMPS + + bigint ncurrent = nlocal; + MPI_Allreduce(&ncurrent,&lmp->atom->natoms,1,MPI_LMP_BIGINT, + MPI_SUM,lmp->world); + + // init per-atom fix/compute/variable values for created atoms + + atom->data_fix_compute_variable(nlocal_prev,nlocal); + + // if global map exists, reset it + // invoke map_init() b/c atom count has grown + + if (lmp->atom->map_style) { + lmp->atom->map_init(); + lmp->atom->map_set(); + } + } + END_CAPTURE; + return (int) lmp->atom->natoms - natoms_prev; +} + +// ---------------------------------------------------------------------- +// Library functions to access data from computes, fixes, variables in LAMMPS +// ---------------------------------------------------------------------- + +/** Get pointer to data from a LAMMPS compute. + * +\verbatim embed:rst + +This function returns a pointer to the location of data provided by a +:doc:`compute` instance identified by the compute-ID. Computes may +provide global, per-atom, or local data, and those may be a scalar, a +vector, or an array or they may provide the information about the +dimensions of the respective data. Since computes may provide multiple +kinds of data, it is required to set style and type flags representing +what specific data is desired. This also determines to what kind of +pointer the returned pointer needs to be cast to access the data +correctly. The function returns ``NULL`` if the compute ID is not found +or the requested data is not available or current. The following table +lists the available options. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Style (see :cpp:enum:`_LMP_STYLE_CONST`) + - Type (see :cpp:enum:`_LMP_TYPE_CONST`) + - Returned type + - Returned data + * - LMP_STYLE_GLOBAL + - LMP_TYPE_SCALAR + - ``double *`` + - Global scalar + * - LMP_STYLE_GLOBAL + - LMP_TYPE_VECTOR + - ``double *`` + - Global vector + * - LMP_STYLE_GLOBAL + - LMP_TYPE_ARRAY + - ``double **`` + - Global array + * - LMP_STYLE_GLOBAL + - LMP_SIZE_VECTOR + - ``int *`` + - Length of global vector + * - LMP_STYLE_GLOBAL + - LMP_SIZE_ROWS + - ``int *`` + - Rows of global array + * - LMP_STYLE_GLOBAL + - LMP_SIZE_COLS + - ``int *`` + - Columns of global array + * - LMP_STYLE_ATOM + - LMP_TYPE_VECTOR + - ``double *`` + - Per-atom value + * - LMP_STYLE_ATOM + - LMP_TYPE_ARRAY + - ``double **`` + - Per-atom vector + * - LMP_STYLE_ATOM + - LMP_SIZE_COLS + - ``int *`` + - Columns in per-atom array, 0 if vector + * - LMP_STYLE_LOCAL + - LMP_TYPE_VECTOR + - ``double *`` + - Local data vector + * - LMP_STYLE_LOCAL + - LMP_TYPE_ARRAY + - ``double **`` + - Local data array + * - LMP_STYLE_LOCAL + - LMP_SIZE_ROWS + - ``int *`` + - Number of local data rows + * - LMP_STYLE_LOCAL + - LMP_SIZE_COLS + - ``int *`` + - Number of local data columns + +The pointers returned by this function are generally not persistent +since the computed data may be re-distributed, re-allocated, and +re-ordered at every invocation. It is advisable to re-invoke this +function before the data is accessed, or make a copy if the data shall +be used after other LAMMPS commands have been issued. + +.. note:: + + If the compute's data is not computed for the current step, the + compute will be invoked. LAMMPS cannot easily check at that time, if + it is valid to invoke a compute, so it may fail with an error. The + caller has to check to avoid such an error. + + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param id string with ID of the compute + * \param style constant indicating the style of data requested + (global, per-atom, or local) + * \param type constant indicating type of data (scalar, vector, + or array) or size of rows or columns + * \return pointer (cast to ``void *``) to the location of the + * requested data or ``NULL`` if not found. */ + +void *lammps_extract_compute(void *handle, char *id, int style, int type) +{ + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -488,42 +1398,53 @@ void *lammps_extract_compute(void *ptr, char *id, int style, int type) if (icompute < 0) return NULL; Compute *compute = lmp->modify->compute[icompute]; - if (style == 0) { - if (type == 0) { + if (style == LMP_STYLE_GLOBAL) { + if (type == LMP_TYPE_SCALAR) { if (!compute->scalar_flag) return NULL; if (compute->invoked_scalar != lmp->update->ntimestep) compute->compute_scalar(); return (void *) &compute->scalar; } - if (type == 1) { + if ((type == LMP_TYPE_VECTOR) || (type == LMP_SIZE_VECTOR)) { if (!compute->vector_flag) return NULL; if (compute->invoked_vector != lmp->update->ntimestep) compute->compute_vector(); - return (void *) compute->vector; + if (type == LMP_TYPE_VECTOR) + return (void *) compute->vector; + else + return (void *) &compute->size_vector; } - if (type == 2) { + if ((type == LMP_TYPE_ARRAY) || (type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { if (!compute->array_flag) return NULL; if (compute->invoked_array != lmp->update->ntimestep) compute->compute_array(); - return (void *) compute->array; + if (type == LMP_TYPE_ARRAY) + return (void *) compute->array; + else if (type == LMP_SIZE_ROWS) + return (void *) &compute->size_array_rows; + else + return (void *) &compute->size_array_cols; } } - if (style == 1) { + if (style == LMP_STYLE_ATOM) { if (!compute->peratom_flag) return NULL; if (compute->invoked_peratom != lmp->update->ntimestep) compute->compute_peratom(); - if (type == 1) return (void *) compute->vector_atom; - if (type == 2) return (void *) compute->array_atom; + if (type == LMP_TYPE_VECTOR) return (void *) compute->vector_atom; + if (type == LMP_TYPE_ARRAY) return (void *) compute->array_atom; + if (type == LMP_SIZE_COLS) return (void *) &compute->size_peratom_cols; } - if (style == 2) { + if (style == LMP_STYLE_LOCAL) { if (!compute->local_flag) return NULL; if (compute->invoked_local != lmp->update->ntimestep) compute->compute_local(); - if (type == 0) return (void *) &compute->size_local_rows; - if (type == 1) return (void *) compute->vector_local; - if (type == 2) return (void *) compute->array_local; + if (type == LMP_TYPE_SCALAR) return (void *) &compute->size_local_rows; /* for backward compatibility */ + if (type == LMP_TYPE_VECTOR) return (void *) compute->vector_local; + if (type == LMP_TYPE_ARRAY) return (void *) compute->array_local; + if (type == LMP_SIZE_ROWS) return (void *) &compute->size_local_rows; + if (type == LMP_SIZE_COLS) return (void *) &compute->size_local_cols; } } END_CAPTURE @@ -531,34 +1452,130 @@ void *lammps_extract_compute(void *ptr, char *id, int style, int type) return NULL; } -/* ---------------------------------------------------------------------- - extract a pointer to an internal LAMMPS fix-based entity - id = fix ID - style = 0 for global data, 1 for per-atom data, 2 for local data - type = 0 for scalar, 1 for vector, 2 for array - i,j = indices needed only to specify which global vector or array value - for global data, returns a pointer to a memory location - which is allocated by this function - which the caller can cast to a (double *) which points to the value - for per-atom or local data, returns a pointer to the - fix's internal data structure for the entity - caller should cast it to (double *) for a vector - caller should cast it to (double **) for an array - returns a NULL if id is not recognized or style/type not supported - IMPORTANT: for global data, - this function allocates a double to store the value in, - so the caller must free this memory to avoid a leak, e.g. - double *dptr = (double *) lammps_extract_fix(); - double value = *dptr; - lammps_free(dptr); - IMPORTANT: LAMMPS cannot easily check here when info extracted from - the fix is valid, so caller must insure that it is OK -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void *lammps_extract_fix(void *ptr, char *id, int style, int type, - int i, int j) +/** Get pointer to data from a LAMMPS fix. + * +\verbatim embed:rst + +This function returns a pointer to data provided by a :doc:`fix` +instance identified by its fix-ID. Fixes may provide global, per-atom, +or local data, and those may be a scalar, a vector, or an array, or they +may provide the information about the dimensions of the respective data. +Since individual fixes may provide multiple kinds of data, it is +required to set style and type flags representing what specific data is +desired. This also determines to what kind of pointer the returned +pointer needs to be cast to access the data correctly. The function +returns ``NULL`` if the fix ID is not found or the requested data is not +available. + +.. note:: + + When requesting global data, the fix data can only be accessed one + item at a time without access to the pointer itself. Thus this + function will allocate storage for a single double value, copy the + returned value to it, and returns a pointer to the location of the + copy. Therefore the allocated storage needs to be freed after its + use to avoid a memory leak. Example: + + .. code-block:: c + + double *dptr = (double *) lammps_extract_fix(handle,name,0,1,0,0); + double value = *dptr; + lammps_free((void *)dptr); + +The following table lists the available options. + +.. list-table:: + :header-rows: 1 + :widths: auto + + * - Style (see :cpp:enum:`_LMP_STYLE_CONST`) + - Type (see :cpp:enum:`_LMP_TYPE_CONST`) + - Returned type + - Returned data + * - LMP_STYLE_GLOBAL + - LMP_TYPE_SCALAR + - ``double *`` + - Copy of global scalar + * - LMP_STYLE_GLOBAL + - LMP_TYPE_VECTOR + - ``double *`` + - Copy of global vector element at index nrow + * - LMP_STYLE_GLOBAL + - LMP_TYPE_ARRAY + - ``double *`` + - Copy of global array element at nrow, ncol + * - LMP_STYLE_GLOBAL + - LMP_SIZE_VECTOR + - ``int *`` + - Length of global vector + * - LMP_STYLE_GLOBAL + - LMP_SIZE_ROWS + - ``int *`` + - Rows in global array + * - LMP_STYLE_GLOBAL + - LMP_SIZE_COLS + - ``int *`` + - Columns in global array + * - LMP_STYLE_ATOM + - LMP_TYPE_VECTOR + - ``double *`` + - Per-atom value + * - LMP_STYLE_ATOM + - LMP_TYPE_ARRAY + - ``double **`` + - Per-atom vector + * - LMP_STYLE_ATOM + - LMP_SIZE_COLS + - ``int *`` + - Columns of per-atom array, 0 if vector + * - LMP_STYLE_LOCAL + - LMP_TYPE_VECTOR + - ``double *`` + - Local data vector + * - LMP_STYLE_LOCAL + - LMP_TYPE_ARRAY + - ``double **`` + - Local data array + * - LMP_STYLE_LOCAL + - LMP_SIZE_ROWS + - ``int *`` + - Number of local data rows + * - LMP_STYLE_LOCAL + - LMP_SIZE_COLS + - ``int *`` + - Number of local data columns + +The pointers returned by this function for per-atom or local data are +generally not persistent, since the computed data may be re-distributed, +re-allocated, and re-ordered at every invocation of the fix. It is thus +advisable to re-invoke this function before the data is accessed, or +make a copy, if the data shall be used after other LAMMPS commands have +been issued. + +.. note:: + + LAMMPS cannot easily check if it is valid to access the data, so it + may fail with an error. The caller has to avoid such an error. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param id string with ID of the fix + * \param style constant indicating the style of data requested + (global, per-atom, or local) + * \param type constant indicating type of data (scalar, vector, + or array) or size of rows or columns + * \param nrow row index (only used for global vectors and arrays) + * \param ncol column index (only used for global arrays) + * \return pointer (cast to ``void *``) to the location of the + * requested data or ``NULL`` if not found. */ + +void *lammps_extract_fix(void *handle, char *id, int style, int type, + int nrow, int ncol) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -566,38 +1583,52 @@ void *lammps_extract_fix(void *ptr, char *id, int style, int type, if (ifix < 0) return NULL; Fix *fix = lmp->modify->fix[ifix]; - if (style == 0) { - if (type == 0) { + if (style == LMP_STYLE_GLOBAL) { + if (type == LMP_TYPE_SCALAR) { if (!fix->scalar_flag) return NULL; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_scalar(); return (void *) dptr; } - if (type == 1) { + if (type == LMP_TYPE_VECTOR) { if (!fix->vector_flag) return NULL; double *dptr = (double *) malloc(sizeof(double)); - *dptr = fix->compute_vector(i); + *dptr = fix->compute_vector(nrow); return (void *) dptr; } - if (type == 2) { + if (type == LMP_TYPE_ARRAY) { if (!fix->array_flag) return NULL; double *dptr = (double *) malloc(sizeof(double)); - *dptr = fix->compute_array(i,j); + *dptr = fix->compute_array(nrow,ncol); return (void *) dptr; } + if (type == LMP_SIZE_VECTOR) { + if (!fix->vector_flag) return NULL; + return (void *) &fix->size_vector; + } + if ((type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { + if (!fix->array_flag) return NULL; + if (type == LMP_SIZE_ROWS) + return (void *) &fix->size_array_rows; + else + return (void *) &fix->size_array_cols; + } } - if (style == 1) { + if (style == LMP_STYLE_ATOM) { if (!fix->peratom_flag) return NULL; - if (type == 1) return (void *) fix->vector_atom; - if (type == 2) return (void *) fix->array_atom; + if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_atom; + if (type == LMP_TYPE_ARRAY) return (void *) fix->array_atom; + if (type == LMP_SIZE_COLS) return (void *) &fix->size_peratom_cols; } - if (style == 2) { + if (style == LMP_STYLE_LOCAL) { if (!fix->local_flag) return NULL; - if (type == 0) return (void *) &fix->size_local_rows; - if (type == 1) return (void *) fix->vector_local; - if (type == 2) return (void *) fix->array_local; + if (type == LMP_TYPE_SCALAR) return (void *) &fix->size_local_rows; + if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_local; + if (type == LMP_TYPE_ARRAY) return (void *) fix->array_local; + if (type == LMP_SIZE_ROWS) return (void *) &fix->size_local_rows; + if (type == LMP_SIZE_COLS) return (void *) &fix->size_local_cols; } } END_CAPTURE @@ -605,36 +1636,63 @@ void *lammps_extract_fix(void *ptr, char *id, int style, int type, return NULL; } -/* ---------------------------------------------------------------------- - extract a pointer to an internal LAMMPS evaluated variable - name = variable name, must be equal-style or atom-style variable - group = group ID for evaluating an atom-style variable, else NULL - for equal-style variable, returns a pointer to a memory location - which is allocated by this function - which the caller can cast to a (double *) which points to the value - for atom-style variable, returns a pointer to the - vector of per-atom values on each processor, - which the caller can cast to a (double *) which points to the values - returns a NULL if name is not recognized or not equal-style or atom-style - IMPORTANT: for both equal-style and atom-style variables, - this function allocates memory to store the variable data in - so the caller must free this memory to avoid a leak - e.g. for equal-style variables - double *dptr = (double *) lammps_extract_variable(); - double value = *dptr; - lammps_free(dptr); - e.g. for atom-style variables - double *vector = (double *) lammps_extract_variable(); - use the vector values - lammps_free(vector); - IMPORTANT: LAMMPS cannot easily check here when it is valid to evaluate - the variable or any fixes or computes or thermodynamic info it references, - so caller must insure that it is OK -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -void *lammps_extract_variable(void *ptr, char *name, char *group) +/** Get pointer to data from a LAMMPS variable. + * +\verbatim embed:rst + +This function returns a pointer to data from a LAMMPS :doc:`variable` +identified by its name. The variable must be either an *equal*\ -style +compatible or an *atom*\ -style variable. Variables of style *internal* +are compatible with *equal*\ -style variables and so are *python*\ +-style variables, if they return a numeric value. The function returns +``NULL`` when a variable of the provided *name* is not found or of an +incompatible style. The *group* argument is only used for *atom*\ +-style variables and ignored otherwise. If set to ``NULL`` when +extracting data from and *atom*\ -style variable, the group is assumed +to be "all". + +.. note:: + + When requesting data from an *equal*\ -style or compatible variable + this function allocates storage for a single double value, copies the + returned value to it, and returns a pointer to the location of the + copy. Therefore the allocated storage needs to be freed after its + use to avoid a memory leak. Example: + + .. code-block:: c + + double *dptr = (double *) lammps_extract_variable(handle,name,NULL); + double value = *dptr; + lammps_free((void *)dptr); + + For *atom*\ -style variables the data returned is a pointer to an + allocated block of storage of double of the length ``atom->nlocal``. + To avoid a memory leak, also this pointer needs to be freed after use. + +Since the data is returned as copies, the location will persist, but its +values will not be updated, in case the variable is re-evaluated. + +.. note:: + + LAMMPS cannot easily check if it is valid to access the data + referenced by the variables, e.g. computes or fixes or thermodynamic + info, so it may fail with an error. The caller has to make certain, + that the data is extracted only when it safe to evaluate the variable + and thus an error and crash is avoided. + +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance + * \param name name of the variable + * \param group group-ID for atom style variable or ``NULL`` + * \return pointer (cast to ``void *``) to the location of the + * requested data or ``NULL`` if not found. */ + +void *lammps_extract_variable(void *handle, char *name, char *group) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -648,6 +1706,7 @@ void *lammps_extract_variable(void *ptr, char *name, char *group) } if (lmp->input->variable->atomstyle(ivar)) { + if (group == NULL) group = (char *)"all"; int igroup = lmp->group->find(group); if (igroup < 0) return NULL; int nlocal = lmp->atom->nlocal; @@ -661,51 +1720,22 @@ void *lammps_extract_variable(void *ptr, char *name, char *group) return NULL; } -/* ---------------------------------------------------------------------- - return the current value of a thermo keyword as a double - unlike lammps_extract_global() this does not give access to the - storage of the data in question - instead it triggers the Thermo class to compute the current value - and returns it -------------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- */ -double lammps_get_thermo(void *ptr, char *name) +/** Set the value of a string-style variable. + * + * This function assigns a new value from the string str to the + * string-style variable name. Returns -1 if a variable of that + * name does not exist or is not a string-style variable, otherwise 0. + * + * \param handle pointer to a previously created LAMMPS instance + * \param name name of the variable + * \param str new value of the variable + * \return 0 on success or -1 on failure + */ +int lammps_set_variable(void *handle, char *name, char *str) { - LAMMPS *lmp = (LAMMPS *) ptr; - double dval = 0.0; - - BEGIN_CAPTURE - { - lmp->output->thermo->evaluate_keyword(name,&dval); - } - END_CAPTURE - - return dval; -} - -/* ---------------------------------------------------------------------- - return the total number of atoms in the system - useful before call to lammps_get_atoms() so can pre-allocate vector -------------------------------------------------------------------------- */ - -int lammps_get_natoms(void *ptr) -{ - LAMMPS *lmp = (LAMMPS *) ptr; - - if (lmp->atom->natoms > MAXSMALLINT) return 0; - int natoms = static_cast (lmp->atom->natoms); - return natoms; -} - -/* ---------------------------------------------------------------------- - set the value of a STRING variable to str - return -1 if variable doesn't exist or not a STRING variable - return 0 for success -------------------------------------------------------------------------- */ - -int lammps_set_variable(void *ptr, char *name, char *str) -{ - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; int err = -1; BEGIN_CAPTURE @@ -717,33 +1747,9 @@ int lammps_set_variable(void *ptr, char *name, char *str) return err; } -/* ---------------------------------------------------------------------- - reset simulation box parameters - see domain.h for definition of these arguments - assumes domain->set_initial_box() has been invoked previously -------------------------------------------------------------------------- */ - -void lammps_reset_box(void *ptr, double *boxlo, double *boxhi, - double xy, double yz, double xz) -{ - LAMMPS *lmp = (LAMMPS *) ptr; - Domain *domain = lmp->domain; - - domain->boxlo[0] = boxlo[0]; - domain->boxlo[1] = boxlo[1]; - domain->boxlo[2] = boxlo[2]; - domain->boxhi[0] = boxhi[0]; - domain->boxhi[1] = boxhi[1]; - domain->boxhi[2] = boxhi[2]; - - domain->xy = xy; - domain->yz = yz; - domain->xz = xz; - - domain->set_global_box(); - lmp->comm->set_proc_grid(); - domain->set_local_box(); -} +// ---------------------------------------------------------------------- +// Library functions for scatter/gather operations of data +// ---------------------------------------------------------------------- /* ---------------------------------------------------------------------- gather the named atom-based entity for all atoms @@ -767,10 +1773,10 @@ void lammps_reset_box(void *ptr, double *boxlo, double *boxhi, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_gather_atoms(void *ptr, char * /*name */, +void lammps_gather_atoms(void *handle, char * /*name */, int /*type*/, int /*count*/, void * /*data*/) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -780,10 +1786,10 @@ void lammps_gather_atoms(void *ptr, char * /*name */, END_CAPTURE } #else -void lammps_gather_atoms(void *ptr, char *name, +void lammps_gather_atoms(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -908,10 +1914,10 @@ void lammps_gather_atoms(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_gather_atoms_concat(void *ptr, char * /*name */, +void lammps_gather_atoms_concat(void *handle, char * /*name */, int /*type*/, int /*count*/, void * /*data*/) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -921,10 +1927,10 @@ void lammps_gather_atoms_concat(void *ptr, char * /*name */, END_CAPTURE } #else -void lammps_gather_atoms_concat(void *ptr, char *name, +void lammps_gather_atoms_concat(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1067,11 +2073,11 @@ void lammps_gather_atoms_concat(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_gather_atoms_subset(void *ptr, char * /*name */, +void lammps_gather_atoms_subset(void *handle, char * /*name */, int /*type*/, int /*count*/, int /*ndata*/, int * /*ids*/, void * /*data*/) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1081,11 +2087,11 @@ void lammps_gather_atoms_subset(void *ptr, char * /*name */, END_CAPTURE } #else -void lammps_gather_atoms_subset(void *ptr, char *name, +void lammps_gather_atoms_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1217,10 +2223,10 @@ void lammps_gather_atoms_subset(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_scatter_atoms(void *ptr, char * /*name */, +void lammps_scatter_atoms(void *handle, char * /*name */, int /*type*/, int /*count*/, void * /*data*/) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1230,10 +2236,10 @@ void lammps_scatter_atoms(void *ptr, char * /*name */, END_CAPTURE } #else -void lammps_scatter_atoms(void *ptr, char *name, +void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1345,11 +2351,11 @@ void lammps_scatter_atoms(void *ptr, char *name, ------------------------------------------------------------------------- */ #if defined(LAMMPS_BIGBIG) -void lammps_scatter_atoms_subset(void *ptr, char * /*name */, +void lammps_scatter_atoms_subset(void *handle, char * /*name */, int /*type*/, int /*count*/, int /*ndata*/, int * /*ids*/, void * /*data*/) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1359,11 +2365,11 @@ void lammps_scatter_atoms_subset(void *ptr, char * /*name */, END_CAPTURE } #else -void lammps_scatter_atoms_subset(void *ptr, char *name, +void lammps_scatter_atoms_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1463,118 +2469,1173 @@ void lammps_scatter_atoms_subset(void *ptr, char *name, } #endif -/* ---------------------------------------------------------------------- - create N atoms and assign them to procs based on coords - id = atom IDs (optional, NULL will generate 1 to N) - type = N-length vector of atom types (required) - x = 3N-length 1d vector of atom coords (required) - v = 3N-length 1d vector of atom velocities (optional, NULL if just 0.0) - image flags can be treated in two ways: - (a) image = vector of current image flags - each atom will be remapped into periodic box by domain->ownatom() - image flag will be incremented accordingly and stored with atom - (b) image = NULL - each atom will be remapped into periodic box by domain->ownatom() - image flag will be set to 0 by atom->avec->create_atom() - shrinkexceed = 1 allows atoms to be outside a shrinkwrapped boundary - passed to ownatom() which will assign them to boundary proc - important if atoms may be (slightly) outside non-periodic dim - e.g. due to restoring a snapshot from a previous run and previous box - id and image must be 32-bit integers - x,v = ordered by xyz, then by atom - e.g. x[0][0],x[0][1],x[0][2],x[1][0],x[1][1],x[1][2],x[2][0],... -------------------------------------------------------------------------- */ -void lammps_create_atoms(void *ptr, int n, tagint *id, int *type, - double *x, double *v, imageint *image, - int shrinkexceed) +/* ---------------------------------------------------------------------- + Contributing author: Thomas Swinburne (CNRS & CINaM, Marseille, France) + gather the named atom-based entity for all atoms + return it in user-allocated data + data will be ordered by atom ID + requirement for consecutive atom IDs (1 to N) + see gather_concat() to return data for all atoms, unordered + see gather_subset() to return data for only a subset of atoms + name = "x" , "f" or other atom properties + "d_name" or "i_name" for fix property/atom quantities + "f_fix", "c_compute" for fixes / computes + will return error if fix/compute doesn't isn't atom-based + type = 0 for integer values, 1 for double values + count = # of per-atom values, e.g. 1 for type or charge, 3 for x or f + use count = 3 with "image" if want single image flag unpacked into xyz + return atom-based values in 1d data, ordered by count, then by atom ID + e.g. x[0][0],x[0][1],x[0][2],x[1][0],x[1][1],x[1][2],x[2][0],... + data must be pre-allocated by caller to correct length + correct length = count*Natoms, as queried by get_natoms() + method: + alloc and zero count*Natom length vector + loop over Nlocal to fill vector with my values + Allreduce to sum vector into data across all procs +------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_gather(void *ptr, char * /*name*/, int /*type*/, + int /*count*/, void * /*data*/) { LAMMPS *lmp = (LAMMPS *) ptr; BEGIN_CAPTURE { - // error if box does not exist or tags not defined - - int flag = 0; - if (lmp->domain->box_exist == 0) flag = 1; - if (lmp->atom->tag_enable == 0) flag = 1; - if (flag) { - if (lmp->comm->me == 0) - lmp->error->warning(FLERR,"Library error in lammps_create_atoms"); - return; - } - - // loop over N atoms of entire system - // if this proc owns it based on coords, invoke create_atom() - // optionally set atom tags and velocities - - Atom *atom = lmp->atom; - Domain *domain = lmp->domain; - int nlocal = atom->nlocal; - - bigint natoms_prev = atom->natoms; - int nlocal_prev = nlocal; - double xdata[3]; - - for (int i = 0; i < n; i++) { - xdata[0] = x[3*i]; - xdata[1] = x[3*i+1]; - xdata[2] = x[3*i+2]; - imageint * img = image ? &image[i] : NULL; - tagint tag = id ? id[i] : -1; - if (!domain->ownatom(tag, xdata, img, shrinkexceed)) continue; - - atom->avec->create_atom(type[i],xdata); - if (id) atom->tag[nlocal] = id[i]; - else atom->tag[nlocal] = i+1; - if (v) { - atom->v[nlocal][0] = v[3*i]; - atom->v[nlocal][1] = v[3*i+1]; - atom->v[nlocal][2] = v[3*i+2]; - } - if (image) atom->image[nlocal] = image[i]; - nlocal++; - } - - // need to reset atom->natoms inside LAMMPS - - bigint ncurrent = nlocal; - MPI_Allreduce(&ncurrent,&lmp->atom->natoms,1,MPI_LMP_BIGINT, - MPI_SUM,lmp->world); - - // init per-atom fix/compute/variable values for created atoms - - atom->data_fix_compute_variable(nlocal_prev,nlocal); - - // if global map exists, reset it - // invoke map_init() b/c atom count has grown - - if (lmp->atom->map_style) { - lmp->atom->map_init(); - lmp->atom->map_set(); - } - - // warn if new natoms is not correct - - if ((lmp->atom->natoms != natoms_prev + n) && (lmp->comm->me == 0)) - lmp->error->warning(FLERR,fmt::format("Library warning in " - "lammps_create_atoms: " - "invalid total atoms {} vs. {}", - lmp->atom->natoms,natoms_prev+n)); + lmp->error->all(FLERR,"Library function lammps_gather" + " not compatible with -DLAMMPS_BIGBIG"); } END_CAPTURE } +#else +void lammps_gather(void *ptr, char *name, int type, int count, void *data) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + int i,j,offset,fcid,ltype; + + // error if tags are not defined or not consecutive + int flag = 0; + if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) + flag = 1; + if (lmp->atom->natoms > MAXSMALLINT) flag = 1; + if (flag) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,"Library error in lammps_gather"); + return; + } + + int natoms = static_cast (lmp->atom->natoms); + + void *vptr = lmp->atom->extract(name); + + if (vptr==NULL && strstr(name,"f_") == name) { // fix + + fcid = lmp->modify->find_fix(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather: unknown fix id"); + return; + } + + if (lmp->modify->fix[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_gather:" + " fix does not return peratom data"); + return; + } + if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_gather:" + " count != values peratom for fix"); + return; + } + + if (lmp->update->ntimestep % lmp->modify->fix[fcid]->peratom_freq) { + lmp->error->all(FLERR,"lammps_gather:" + " fix not computed at compatible time"); + return; + } + + if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + else vptr = (void *) lmp->modify->fix[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"c_") == name) { // compute + + fcid = lmp->modify->find_compute(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather: unknown compute id"); + return; + } + + if (lmp->modify->compute[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_gather:" + " compute does not return peratom data"); + return; + } + if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_gather:" + " count != values peratom for compute"); + return; + } + + if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) + lmp->modify->compute[fcid]->compute_peratom(); + + if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + else vptr = (void *) lmp->modify->compute[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + + fcid = lmp->atom->find_custom(&name[2], ltype); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather: unknown property/atom id"); + return; + } + if (ltype != type) { + lmp->error->warning(FLERR,"lammps_gather: mismatch property/atom type"); + return; + } + if (count != 1) { + lmp->error->warning(FLERR,"lammps_gather: property/atom has count=1"); + return; + } + if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + else vptr = (void *) lmp->atom->dvector[fcid]; + + } + + + if (vptr == NULL) { + lmp->error->warning(FLERR,"lammps_gather: unknown property name"); + return; + } + + // copy = Natom length vector of per-atom values + // use atom ID to insert each atom's values into copy + // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID + if (type==0) { + int *vector = NULL; + int **array = NULL; + + const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); + + if ((count == 1) || imgunpack) vector = (int *) vptr; + else array = (int **) vptr; + + int *copy; + lmp->memory->create(copy,count*natoms,"lib/gather:copy"); + for (i = 0; i < count*natoms; i++) copy[i] = 0; + + tagint *tag = lmp->atom->tag; + int nlocal = lmp->atom->nlocal; + + if (count == 1) { + for (i = 0; i < nlocal; i++) + copy[tag[i]-1] = vector[i]; + + } else if (imgunpack) { + for (i = 0; i < nlocal; i++) { + offset = count*(tag[i]-1); + const int image = vector[i]; + copy[offset++] = (image & IMGMASK) - IMGMAX; + copy[offset++] = ((image >> IMGBITS) & IMGMASK) - IMGMAX; + copy[offset++] = ((image >> IMG2BITS) & IMGMASK) - IMGMAX; + } + + } else { + for (i = 0; i < nlocal; i++) { + offset = count*(tag[i]-1); + for (j = 0; j < count; j++) + copy[offset++] = array[i][j]; + } + } + + MPI_Allreduce(copy,data,count*natoms,MPI_INT,MPI_SUM,lmp->world); + lmp->memory->destroy(copy); + + } else { + + double *vector = NULL; + double **array = NULL; + if (count == 1) vector = (double *) vptr; + else array = (double **) vptr; + + double *copy; + lmp->memory->create(copy,count*natoms,"lib/gather:copy"); + for (i = 0; i < count*natoms; i++) copy[i] = 0.0; + + tagint *tag = lmp->atom->tag; + int nlocal = lmp->atom->nlocal; + + if (count == 1) { + for (i = 0; i < nlocal; i++) + copy[tag[i]-1] = vector[i]; + } else { + for (i = 0; i < nlocal; i++) { + offset = count*(tag[i]-1); + for (j = 0; j < count; j++) + copy[offset++] = array[i][j]; + } + } + MPI_Allreduce(copy,data,count*natoms,MPI_DOUBLE,MPI_SUM,lmp->world); + lmp->memory->destroy(copy); + } + } + END_CAPTURE +} +#endif + +/* ---------------------------------------------------------------------- + Contributing author: Thomas Swinburne (CNRS & CINaM, Marseille, France) + gather the named atom-based entity for all atoms + return it in user-allocated data + data will be ordered by atom ID + requirement for consecutive atom IDs (1 to N) + see gather() to return data ordered by consecutive atom IDs + see gather_subset() to return data for only a subset of atoms + name = "x" , "f" or other atom properties + "d_name" or "i_name" for fix property/atom quantities + "f_fix", "c_compute" for fixes / computes + will return error if fix/compute doesn't isn't atom-based + type = 0 for integer values, 1 for double values + count = # of per-atom values, e.g. 1 for type or charge, 3 for x or f + use count = 3 with "image" if want single image flag unpacked into xyz + return atom-based values in 1d data, ordered by count, then by atom ID + e.g. x[0][0],x[0][1],x[0][2],x[1][0],x[1][1],x[1][2],x[2][0],... + data must be pre-allocated by caller to correct length + correct length = count*Natoms, as queried by get_natoms() + method: + alloc and zero count*Natom length vector + loop over Nlocal to fill vector with my values + Allreduce to sum vector into data across all procs +------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_gather_concat(void *ptr, char * /*name*/, int /*type*/, + int /*count*/, void * /*data*/) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + lmp->error->all(FLERR,"Library function lammps_gather_concat" + " not compatible with -DLAMMPS_BIGBIG"); + } + END_CAPTURE +} +#else +void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + int i,j,offset,fcid,ltype; + + // error if tags are not defined or not consecutive + int flag = 0; + if (lmp->atom->tag_enable == 0) flag = 1; + if (lmp->atom->natoms > MAXSMALLINT) flag = 1; + if (flag) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,"Library error in lammps_gather_concat"); + return; + } + + + int natoms = static_cast (lmp->atom->natoms); + + void *vptr = lmp->atom->extract(name); + + if (vptr==NULL && strstr(name,"f_") == name) { // fix + + fcid = lmp->modify->find_fix(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather_concat: unknown fix id"); + return; + } + + if (lmp->modify->fix[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_gather_concat:" + " fix does not return peratom data"); + return; + } + if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_gather_concat:" + " count != values peratom for fix"); + return; + } + + + if (lmp->update->ntimestep % lmp->modify->fix[fcid]->peratom_freq) { + lmp->error->all(FLERR,"lammps_gather_concat:" + " fix not computed at compatible time"); + return; + } + + if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + else vptr = (void *) lmp->modify->fix[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"c_") == name) { // compute + + fcid = lmp->modify->find_compute(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather_concat: unknown compute id"); + return; + } + + if (lmp->modify->compute[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_gather_concat:" + " compute does not return peratom data"); + return; + } + if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_gather_concat:" + " count != values peratom for compute"); + return; + } + + if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) + lmp->modify->compute[fcid]->compute_peratom(); + + if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + else vptr = (void *) lmp->modify->compute[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + + fcid = lmp->atom->find_custom(&name[2], ltype); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather_concat: " + "unknown property/atom id"); + return; + } + if (ltype != type) { + lmp->error->warning(FLERR,"lammps_gather_concat: " + "mismatch property/atom type"); + return; + } + if (count != 1) { + lmp->error->warning(FLERR,"lammps_gather_concat: " + "property/atom has count=1"); + return; + } + if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + else vptr = (void *) lmp->atom->dvector[fcid]; + + } + + if (vptr == NULL) { + lmp->error->warning(FLERR,"lammps_gather_concat: unknown property name"); + return; + } + + // perform MPI_Allgatherv on each proc's chunk of Nlocal atoms + + int nprocs = lmp->comm->nprocs; + + int *recvcounts,*displs; + lmp->memory->create(recvcounts,nprocs,"lib/gather:recvcounts"); + lmp->memory->create(displs,nprocs,"lib/gather:displs"); + + if (type == 0) { + int *vector = NULL; + int **array = NULL; + const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); + + if ((count == 1) || imgunpack) vector = (int *) vptr; + else array = (int **) vptr; + + int *copy; + lmp->memory->create(copy,count*natoms,"lib/gather:copy"); + for (i = 0; i < count*natoms; i++) copy[i] = 0; + + int nlocal = lmp->atom->nlocal; + + if (count == 1) { + MPI_Allgather(&nlocal,1,MPI_INT,recvcounts,1,MPI_INT,lmp->world); + displs[0] = 0; + for (i = 1; i < nprocs; i++) + displs[i] = displs[i-1] + recvcounts[i-1]; + MPI_Allgatherv(vector,nlocal,MPI_INT,data,recvcounts,displs, + MPI_INT,lmp->world); + + } else if (imgunpack) { + int *copy; + lmp->memory->create(copy,count*nlocal,"lib/gather:copy"); + offset = 0; + for (i = 0; i < nlocal; i++) { + const int image = vector[i]; + copy[offset++] = (image & IMGMASK) - IMGMAX; + copy[offset++] = ((image >> IMGBITS) & IMGMASK) - IMGMAX; + copy[offset++] = ((image >> IMG2BITS) & IMGMASK) - IMGMAX; + } + int n = count*nlocal; + MPI_Allgather(&n,1,MPI_INT,recvcounts,1,MPI_INT,lmp->world); + displs[0] = 0; + for (i = 1; i < nprocs; i++) + displs[i] = displs[i-1] + recvcounts[i-1]; + MPI_Allgatherv(copy,count*nlocal,MPI_INT, + data,recvcounts,displs,MPI_INT,lmp->world); + lmp->memory->destroy(copy); + + } else { + int n = count*nlocal; + MPI_Allgather(&n,1,MPI_INT,recvcounts,1,MPI_INT,lmp->world); + displs[0] = 0; + for (i = 1; i < nprocs; i++) + displs[i] = displs[i-1] + recvcounts[i-1]; + MPI_Allgatherv(&array[0][0],count*nlocal,MPI_INT, + data,recvcounts,displs,MPI_INT,lmp->world); + } + + } else { + double *vector = NULL; + double **array = NULL; + if (count == 1) vector = (double *) vptr; + else array = (double **) vptr; + + int nlocal = lmp->atom->nlocal; + + if (count == 1) { + MPI_Allgather(&nlocal,1,MPI_INT,recvcounts,1,MPI_INT,lmp->world); + displs[0] = 0; + for (i = 1; i < nprocs; i++) + displs[i] = displs[i-1] + recvcounts[i-1]; + MPI_Allgatherv(vector,nlocal,MPI_DOUBLE,data,recvcounts,displs, + MPI_DOUBLE,lmp->world); + + } else { + int n = count*nlocal; + MPI_Allgather(&n,1,MPI_INT,recvcounts,1,MPI_INT,lmp->world); + displs[0] = 0; + for (i = 1; i < nprocs; i++) + displs[i] = displs[i-1] + recvcounts[i-1]; + MPI_Allgatherv(&array[0][0],count*nlocal,MPI_DOUBLE, + data,recvcounts,displs,MPI_DOUBLE,lmp->world); + } + } + + lmp->memory->destroy(recvcounts); + lmp->memory->destroy(displs); + } + END_CAPTURE +} +#endif + +/* ---------------------------------------------------------------------- + Contributing author: Thomas Swinburne (CNRS & CINaM, Marseille, France) + gather the named atom-based entity for all atoms + return it in user-allocated data + data will be ordered by atom ID + requirement for consecutive atom IDs (1 to N) + see gather() to return data ordered by consecutive atom IDs + see gather_concat() to return data for all atoms, unordered + name = "x" , "f" or other atom properties + "d_name" or "i_name" for fix property/atom quantities + "f_fix", "c_compute" for fixes / computes + will return error if fix/compute doesn't isn't atom-based + type = 0 for integer values, 1 for double values + count = # of per-atom values, e.g. 1 for type or charge, 3 for x or f + use count = 3 with "image" if want single image flag unpacked into xyz + return atom-based values in 1d data, ordered by count, then by atom ID + e.g. x[0][0],x[0][1],x[0][2],x[1][0],x[1][1],x[1][2],x[2][0],... + data must be pre-allocated by caller to correct length + correct length = count*Natoms, as queried by get_natoms() + method: + alloc and zero count*Natom length vector + loop over Nlocal to fill vector with my values + Allreduce to sum vector into data across all procs +------------------------------------------------------------------------- */ +#if defined(LAMMPS_BIGBIG) +void lammps_gather_subset(void *ptr, char * /*name */, + int /*type*/, int /*count*/, + int /*ndata*/, int * /*ids*/, void * /*data*/) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + lmp->error->all(FLERR,"Library function lammps_gather_subset() " + "is not compatible with -DLAMMPS_BIGBIG"); + } + END_CAPTURE +} +#else +void lammps_gather_subset(void *ptr, char *name, + int type, int count, + int ndata, int *ids, void *data) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + int i,j,m,offset,fcid,ltype; + tagint id; + + // error if tags are not defined or not consecutive + int flag = 0; + if (lmp->atom->tag_enable == 0) flag = 1; + if (lmp->atom->natoms > MAXSMALLINT) flag = 1; + if (flag) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,"Library error in lammps_gather_subset"); + return; + } + + int natoms = static_cast (lmp->atom->natoms); + + void *vptr = lmp->atom->extract(name); + + if (vptr==NULL && strstr(name,"f_") == name) { // fix + + fcid = lmp->modify->find_fix(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather_subset: unknown fix id"); + return; + } + + if (lmp->modify->fix[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_gather_subset:" + " fix does not return peratom data"); + return; + } + if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_gather_subset:" + " count != values peratom for fix"); + return; + } + + + if (lmp->update->ntimestep % lmp->modify->fix[fcid]->peratom_freq) { + lmp->error->all(FLERR,"lammps_gather_subset:" + " fix not computed at compatible time"); + return; + } + + if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + else vptr = (void *) lmp->modify->fix[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"c_") == name) { // compute + + fcid = lmp->modify->find_compute(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather_subset: unknown compute id"); + return; + } + + if (lmp->modify->compute[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_gather_subset:" + " compute does not return peratom data"); + return; + } + if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_gather_subset:" + " count != values peratom for compute"); + return; + } + + if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) + lmp->modify->compute[fcid]->compute_peratom(); + + if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + else vptr = (void *) lmp->modify->compute[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + + fcid = lmp->atom->find_custom(&name[2], ltype); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_gather_subset: " + "unknown property/atom id"); + return; + } + if (ltype != type) { + lmp->error->warning(FLERR,"lammps_gather_subset: " + "mismatch property/atom type"); + return; + } + if (count != 1) { + lmp->error->warning(FLERR,"lammps_gather_subset: " + "property/atom has count=1"); + return; + } + if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + else vptr = (void *) lmp->atom->dvector[fcid]; + + } + + if (vptr == NULL) { + lmp->error->warning(FLERR,"lammps_gather_subset: " + "unknown property name"); + return; + } + + // copy = Ndata length vector of per-atom values + // use atom ID to insert each atom's values into copy + // MPI_Allreduce with MPI_SUM to merge into data + + if (type == 0) { + int *vector = NULL; + int **array = NULL; + const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); + + if ((count == 1) || imgunpack) vector = (int *) vptr; + else array = (int **) vptr; + + int *copy; + lmp->memory->create(copy,count*ndata,"lib/gather:copy"); + for (i = 0; i < count*ndata; i++) copy[i] = 0; + + int nlocal = lmp->atom->nlocal; + + if (count == 1) { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0 && m < nlocal) + copy[i] = vector[m]; + } + + } else if (imgunpack) { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0 && m < nlocal) { + offset = count*i; + const int image = vector[m]; + copy[offset++] = (image & IMGMASK) - IMGMAX; + copy[offset++] = ((image >> IMGBITS) & IMGMASK) - IMGMAX; + copy[offset++] = ((image >> IMG2BITS) & IMGMASK) - IMGMAX; + } + } + + } else { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0 && m < nlocal) { + offset = count*i; + for (j = 0; j < count; j++) + copy[offset++] = array[m][j]; + } + } + } + + MPI_Allreduce(copy,data,count*ndata,MPI_INT,MPI_SUM,lmp->world); + lmp->memory->destroy(copy); + + } else { + double *vector = NULL; + double **array = NULL; + if (count == 1) vector = (double *) vptr; + else array = (double **) vptr; + + double *copy; + lmp->memory->create(copy,count*ndata,"lib/gather:copy"); + for (i = 0; i < count*ndata; i++) copy[i] = 0.0; + + int nlocal = lmp->atom->nlocal; + + if (count == 1) { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0 && m < nlocal) + copy[i] = vector[m]; + } + + } else { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0 && m < nlocal) { + offset = count*i; + for (j = 0; j < count; j++) + copy[offset++] = array[m][j]; + } + } + } + + MPI_Allreduce(copy,data,count*ndata,MPI_DOUBLE,MPI_SUM,lmp->world); + lmp->memory->destroy(copy); + } + } + END_CAPTURE +} +#endif + +/* ---------------------------------------------------------------------- + Contributing author: Thomas Swinburne (CNRS & CINaM, Marseille, France) + scatter the named atom-based entity in data to all atoms + data will be ordered by atom ID + requirement for consecutive atom IDs (1 to N) + see scatter_subset() to scatter data for some (or all) atoms, unordered + name = "x" , "f" or other atom properties + "d_name" or "i_name" for fix property/atom quantities + "f_fix", "c_compute" for fixes / computes + will return error if fix/compute doesn't isn't atom-based + type = 0 for integer values, 1 for double values + count = # of per-atom values, e.g. 1 for type or charge, 3 for x or f + use count = 3 with "image" if want single image flag unpacked into xyz + return atom-based values in 1d data, ordered by count, then by atom ID + e.g. x[0][0],x[0][1],x[0][2],x[1][0],x[1][1],x[1][2],x[2][0],... + data must be pre-allocated by caller to correct length + correct length = count*Natoms, as queried by get_natoms() + method: + alloc and zero count*Natom length vector + loop over Nlocal to fill vector with my values + Allreduce to sum vector into data across all procs +------------------------------------------------------------------------- */ + +#if defined(LAMMPS_BIGBIG) +void lammps_scatter(void *ptr, char * /*name */, + int /*type*/, int /*count*/, void * /*data*/) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + lmp->error->all(FLERR,"Library function lammps_scatter() " + "is not compatible with -DLAMMPS_BIGBIG"); + } + END_CAPTURE +} +#else +void lammps_scatter(void *ptr, char *name, + int type, int count, void *data) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + int i,j,m,offset,fcid,ltype; + + // error if tags are not defined or not consecutive or no atom map + // NOTE: test that name = image or ids is not a 64-bit int in code? + + int flag = 0; + if (lmp->atom->tag_enable == 0 || lmp->atom->tag_consecutive() == 0) + flag = 1; + if (lmp->atom->natoms > MAXSMALLINT) flag = 1; + if (lmp->atom->map_style == 0) flag = 1; + if (flag) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,"Library error in lammps_scatter"); + return; + } + + int natoms = static_cast (lmp->atom->natoms); + + void *vptr = lmp->atom->extract(name); + + if (vptr==NULL && strstr(name,"f_") == name) { // fix + + fcid = lmp->modify->find_fix(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_scatter: unknown fix id"); + return; + } + + if (lmp->modify->fix[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_scatter:" + " fix does not return peratom data"); + return; + } + if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_scatter:" + " count != values peratom for fix"); + return; + } + + if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + else vptr = (void *) lmp->modify->fix[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"c_") == name) { // compute + + fcid = lmp->modify->find_compute(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_scatter: unknown compute id"); + return; + } + + if (lmp->modify->compute[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_scatter:" + " compute does not return peratom data"); + return; + } + if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_scatter:" + " count != values peratom for compute"); + return; + } + + if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) + lmp->modify->compute[fcid]->compute_peratom(); + + if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + else vptr = (void *) lmp->modify->compute[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + + fcid = lmp->atom->find_custom(&name[2], ltype); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_scatter: unknown property/atom id"); + return; + } + if (ltype != type) { + lmp->error->warning(FLERR,"lammps_scatter: mismatch property/atom type"); + return; + } + if (count != 1) { + lmp->error->warning(FLERR,"lammps_scatter: property/atom has count=1"); + return; + } + if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + else vptr = (void *) lmp->atom->dvector[fcid]; + + } + + if(vptr == NULL) { + lmp->error->warning(FLERR,"lammps_scatter: unknown property name"); + return; + } + + // copy = Natom length vector of per-atom values + // use atom ID to insert each atom's values into copy + // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID + + if (type == 0) { + int *vector = NULL; + int **array = NULL; + const int imgpack = (count == 3) && (strcmp(name,"image") == 0); + + if ((count == 1) || imgpack) vector = (int *) vptr; + else array = (int **) vptr; + int *dptr = (int *) data; + + if (count == 1) { + for (i = 0; i < natoms; i++) + if ((m = lmp->atom->map(i+1)) >= 0) + vector[m] = dptr[i]; + + } else if (imgpack) { + for (i = 0; i < natoms; i++) + if ((m = lmp->atom->map(i+1)) >= 0) { + offset = count*i; + int image = dptr[offset++] + IMGMAX; + image += (dptr[offset++] + IMGMAX) << IMGBITS; + image += (dptr[offset++] + IMGMAX) << IMG2BITS; + vector[m] = image; + } + + } else { + for (i = 0; i < natoms; i++) + if ((m = lmp->atom->map(i+1)) >= 0) { + offset = count*i; + for (j = 0; j < count; j++) + array[m][j] = dptr[offset++]; + } + } + + } else { + double *vector = NULL; + double **array = NULL; + if (count == 1) vector = (double *) vptr; + else array = (double **) vptr; + double *dptr = (double *) data; + + if (count == 1) { + for (i = 0; i < natoms; i++) + if ((m = lmp->atom->map(i+1)) >= 0) + vector[m] = dptr[i]; + + } else { + for (i = 0; i < natoms; i++) { + if ((m = lmp->atom->map(i+1)) >= 0) { + offset = count*i; + for (j = 0; j < count; j++) + array[m][j] = dptr[offset++]; + } + } + } + } + } + END_CAPTURE +} +#endif + +/* ---------------------------------------------------------------------- + Contributing author: Thomas Swinburne (CNRS & CINaM, Marseille, France) + scatter the named atom-based entity in data to a subset of atoms + data is ordered by provided atom IDs + no requirement for consecutive atom IDs (1 to N) + see scatter_atoms() to scatter data for all atoms, ordered by consecutive IDs + name = desired quantity, e.g. x or charge + type = 0 for integer values, 1 for double values + count = # of per-atom values, e.g. 1 for type or charge, 3 for x or f + use count = 3 with "image" for xyz to be packed into single image flag + ndata = # of atoms in ids and data (could be all atoms) + ids = list of Ndata atom IDs to scatter data to + data = atom-based values in 1d data, ordered by count, then by atom ID + e.g. x[0][0],x[0][1],x[0][2],x[1][0],x[1][1],x[1][2],x[2][0],... + data must be correct length = count*Ndata + method: + loop over Ndata, if I own atom ID, set its values from data +------------------------------------------------------------------------- */ + +#if defined(LAMMPS_BIGBIG) +void lammps_scatter_subset(void *ptr, char * /*name */, + int /*type*/, int /*count*/, + int /*ndata*/, int * /*ids*/, void * /*data*/) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + lmp->error->all(FLERR,"Library function lammps_scatter_subset() " + "is not compatible with -DLAMMPS_BIGBIG"); + } + END_CAPTURE +} +#else +void lammps_scatter_subset(void *ptr, char *name, + int type, int count, + int ndata, int *ids, void *data) +{ + LAMMPS *lmp = (LAMMPS *) ptr; + + BEGIN_CAPTURE + { + int i,j,m,offset,fcid,ltype; + tagint id; + + // error if tags are not defined or no atom map + // NOTE: test that name = image or ids is not a 64-bit int in code? + + int flag = 0; + if (lmp->atom->tag_enable == 0) flag = 1; + if (lmp->atom->natoms > MAXSMALLINT) flag = 1; + if (lmp->atom->map_style == 0) flag = 1; + if (flag) { + if (lmp->comm->me == 0) + lmp->error->warning(FLERR,"Library error in lammps_scatter_atoms_subset"); + return; + } + + void *vptr = lmp->atom->extract(name); + + if (vptr==NULL && strstr(name,"f_") == name) { // fix + + fcid = lmp->modify->find_fix(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_scatter_subset: unknown fix id"); + return; + } + + if (lmp->modify->fix[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_scatter_subset:" + " fix does not return peratom data"); + return; + } + if (count>1 && lmp->modify->fix[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_scatter_subset:" + " count != values peratom for fix"); + return; + } + + if(count==1) vptr = (void *) lmp->modify->fix[fcid]->vector_atom; + else vptr = (void *) lmp->modify->fix[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"c_") == name) { // compute + + fcid = lmp->modify->find_compute(&name[2]); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_scatter_subset: unknown compute id"); + return; + } + + if (lmp->modify->compute[fcid]->peratom_flag == 0) { + lmp->error->warning(FLERR,"lammps_scatter_subset:" + " compute does not return peratom data"); + return; + } + if (count>1 && lmp->modify->compute[fcid]->size_peratom_cols != count) { + lmp->error->warning(FLERR,"lammps_scatter_subset:" + " count != values peratom for compute"); + return; + } + + if (lmp->modify->compute[fcid]->invoked_peratom != lmp->update->ntimestep) + lmp->modify->compute[fcid]->compute_peratom(); + + if(count==1) vptr = (void *) lmp->modify->compute[fcid]->vector_atom; + else vptr = (void *) lmp->modify->compute[fcid]->array_atom; + + + } + + if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + + fcid = lmp->atom->find_custom(&name[2], ltype); + if (fcid < 0) { + lmp->error->warning(FLERR,"lammps_scatter_subset: " + "unknown property/atom id"); + return; + } + if (ltype != type) { + lmp->error->warning(FLERR,"lammps_scatter_subset: " + "mismatch property/atom type"); + return; + } + if (count != 1) { + lmp->error->warning(FLERR,"lammps_scatter_subset: " + "property/atom has count=1"); + return; + } + if(ltype==0) vptr = (void *) lmp->atom->ivector[fcid]; + else vptr = (void *) lmp->atom->dvector[fcid]; + + } + + if(vptr == NULL) { + lmp->error->warning(FLERR,"lammps_scatter_atoms_subset: " + "unknown property name"); + return; + } + + // copy = Natom length vector of per-atom values + // use atom ID to insert each atom's values into copy + // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID + + if (type == 0) { + int *vector = NULL; + int **array = NULL; + const int imgpack = (count == 3) && (strcmp(name,"image") == 0); + + if ((count == 1) || imgpack) vector = (int *) vptr; + else array = (int **) vptr; + int *dptr = (int *) data; + + if (count == 1) { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0) + vector[m] = dptr[i]; + } + + } else if (imgpack) { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0) { + offset = count*i; + int image = dptr[offset++] + IMGMAX; + image += (dptr[offset++] + IMGMAX) << IMGBITS; + image += (dptr[offset++] + IMGMAX) << IMG2BITS; + vector[m] = image; + } + } + + } else { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0) { + offset = count*i; + for (j = 0; j < count; j++) + array[m][j] = dptr[offset++]; + } + } + } + + } else { + double *vector = NULL; + double **array = NULL; + if (count == 1) vector = (double *) vptr; + else array = (double **) vptr; + double *dptr = (double *) data; + + if (count == 1) { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0) + vector[m] = dptr[i]; + } + + } else { + for (i = 0; i < ndata; i++) { + id = ids[i]; + if ((m = lmp->atom->map(id)) >= 0) { + offset = count*i; + for (j = 0; j < count; j++) + array[m][j] = dptr[offset++]; + } + } + } + } + } + END_CAPTURE +} +#endif + /* ---------------------------------------------------------------------- find fix external with given ID and set the callback function and caller pointer ------------------------------------------------------------------------- */ -void lammps_set_fix_external_callback(void *ptr, char *id, FixExternalFnPtr callback_ptr, void * caller) +void lammps_set_fix_external_callback(void *handle, char *id, FixExternalFnPtr callback_ptr, void * caller) { - LAMMPS *lmp = (LAMMPS *) ptr; + LAMMPS *lmp = (LAMMPS *) handle; FixExternal::FnPtr callback = (FixExternal::FnPtr) callback_ptr; + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) { + char str[128]; + snprintf(str, 128, "Can not find fix with ID '%s'!", id); + lmp->error->all(FLERR,str); + } + + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0){ + char str[128]; + snprintf(str, 128, "Fix '%s' is not of style external!", id); + lmp->error->all(FLERR,str); + } + + FixExternal * fext = (FixExternal*) fix; + fext->set_callback(callback, caller); + } + END_CAPTURE +} + +/* set global energy contribution from fix external */ +void lammps_fix_external_set_energy_global(void *handle, char *id, + double energy) +{ + LAMMPS *lmp = (LAMMPS *) handle; + BEGIN_CAPTURE { int ifix = lmp->modify->find_fix(id); @@ -1587,20 +3648,63 @@ void lammps_set_fix_external_callback(void *ptr, char *id, FixExternalFnPtr call lmp->error->all(FLERR,fmt::format("Fix '{}' is not of style external!", id)); FixExternal * fext = (FixExternal*) fix; - fext->set_callback(callback, caller); + fext->set_energy_global(energy); } END_CAPTURE } +/* set global virial contribution from fix external */ +void lammps_fix_external_set_virial_global(void *handle, char *id, + double *virial) +{ + LAMMPS *lmp = (LAMMPS *) handle; -// ---------------------------------------------------------------------- -// library API functions for accessing LAMMPS configuration -// ---------------------------------------------------------------------- + BEGIN_CAPTURE + { + int ifix = lmp->modify->find_fix(id); + if (ifix < 0) + lmp->error->all(FLERR,fmt::format("Can not find fix with ID '{}'!", id)); -int lammps_config_has_package(char * package_name) { - return Info::has_package(package_name); + Fix *fix = lmp->modify->fix[ifix]; + + if (strcmp("external",fix->style) != 0) + lmp->error->all(FLERR,fmt::format("Fix '{}' is not of style external!", id)); + + FixExternal * fext = (FixExternal*) fix; + fext->set_virial_global(virial); + } + END_CAPTURE } +// ---------------------------------------------------------------------- +// Library functions for accessing LAMMPS configuration +// ---------------------------------------------------------------------- + +/** Check if a specific package has been included in LAMMPS + * +\verbatim embed:rst +This function checks if the LAMMPS library in use includes the +specific :doc:`LAMMPS package ` provided as argument. +\endverbatim + * + * \param name string with the name of the package + * \return 1 if included, 0 if not. + */ +int lammps_config_has_package(char * name) { + return Info::has_package(name) ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + +/** Count the number of installed packages in the LAMMPS library. + * +\verbatim embed:rst +This function counts how many :doc:`LAMMPS packages ` are +included in the LAMMPS library in use. +\endverbatim + * + * \return number of packages included + */ int lammps_config_package_count() { int i = 0; while(LAMMPS::installed_packages[i] != NULL) { @@ -1609,105 +3713,222 @@ int lammps_config_package_count() { return i; } -int lammps_config_package_name(int index, char * buffer, int max_size) { - int i = 0; - while(LAMMPS::installed_packages[i] != NULL && i < index) { - ++i; +/* ---------------------------------------------------------------------- */ + +/** Get the name of a package in the list of installed packages in the LAMMPS library. + * +\verbatim embed:rst +This function copies the name of the package with the index *idx* into the +provided C-style string buffer. The length of the buffer must be provided +as *buf_size* argument. If the name of the package exceeds the length of the +buffer, it will be truncated accordingly. If the index is out of range, +the function returns 0 and *buffer* is set to an empty string, otherwise 1; +\endverbatim + * + * \param idx index of the package in the list of included packages (0 <= idx < package count) + * \param buffer string buffer to copy the name of the package to + * \param buf_size size of the provided string buffer + * \return 1 if successful, otherwise 0 + */ +int lammps_config_package_name(int idx, char * buffer, int buf_size) { + int maxidx = lammps_config_package_count(); + if ((idx < 0) || (idx >= maxidx)) { + buffer[0] = '\0'; + return 0; } - if(LAMMPS::installed_packages[i] != NULL) { - strncpy(buffer, LAMMPS::installed_packages[i], max_size); - return true; - } - - return false; + strncpy(buffer, LAMMPS::installed_packages[idx], buf_size); + return 1; } -int lammps_has_style(void * ptr, char * category, char * name) { - LAMMPS *lmp = (LAMMPS *) ptr; +/* ---------------------------------------------------------------------- */ + +/** Check if a specific style has been included in LAMMPS + * +\verbatim embed:rst +This function checks if the LAMMPS library in use includes the +specific *style* of a specific *category* provided as an argument. +Valid categories are: *atom*\ , *integrate*\ , *minimize*\ , +*pair*\ , *bond*\ , *angle*\ , *dihedral*\ , *improper*\ , *kspace*\ , +*compute*\ , *fix*\ , *region*\ , *dump*\ , and *command*\ . +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param category category of the style + * \param name name of the style + * \return 1 if included, 0 if not. + */ +int lammps_has_style(void * handle, char * category, char * name) { + LAMMPS *lmp = (LAMMPS *) handle; Info info(lmp); - return info.has_style(category, name); + return info.has_style(category, name) ? 0 : 1; } -int lammps_style_count(void * ptr, char * category) { - LAMMPS *lmp = (LAMMPS *) ptr; +/* ---------------------------------------------------------------------- */ + +/** Count the number of styles of category in the LAMMPS library. + * +\verbatim embed:rst +This function counts how many styles in the provided *category* +are included in the LAMMPS library in use. +Please see :cpp:func:`lammps_has_style` for a list of valid +categories. +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param category category of styles + * \return number of styles in category + */ +int lammps_style_count(void * handle, char * category) { + LAMMPS *lmp = (LAMMPS *) handle; Info info(lmp); return info.get_available_styles(category).size(); } -int lammps_style_name(void* ptr, char * category, int index, char * buffer, int max_size) { - LAMMPS *lmp = (LAMMPS *) ptr; +/* ---------------------------------------------------------------------- */ + +/** Look up the name of a style by index in the list of style of a given category in the LAMMPS library. + * +\verbatim embed:rst +This function copies the name of the package with the index *idx* into the +provided C-style string buffer. The length of the buffer must be provided +as *buf_size* argument. If the name of the package exceeds the length of the +buffer, it will be truncated accordingly. If the index is out of range, +the function returns 0 and *buffer* is set to an empty string, otherwise 1. +Please see :cpp:func:`lammps_has_style` for a list of valid categories. +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param category category of styles + * \param idx index of the package in the list of included packages (0 <= idx < style count) + * \param buffer string buffer to copy the name of the style to + * \param buf_size size of the provided string buffer + * \return 1 if successful, otherwise 0 + */ +int lammps_style_name(void* handle, char * category, int idx, char * buffer, int buf_size) { + LAMMPS *lmp = (LAMMPS *) handle; Info info(lmp); auto styles = info.get_available_styles(category); - if (index < (int)styles.size()) { - strncpy(buffer, styles[index].c_str(), max_size); - return true; + if ((idx >=0) && (idx < (int) styles.size())) { + strncpy(buffer, styles[idx].c_str(), buf_size); + return 1; } - return false; -} - -int lammps_config_has_gzip_support() { - return Info::has_gzip_support(); -} - -int lammps_config_has_png_support() { - return Info::has_png_support(); -} - -int lammps_config_has_jpeg_support() { - return Info::has_jpeg_support(); -} - -int lammps_config_has_ffmpeg_support() { - return Info::has_ffmpeg_support(); -} - -int lammps_config_has_exceptions() { - return Info::has_exceptions(); -} - -// ---------------------------------------------------------------------- -// library API functions for error handling -// ---------------------------------------------------------------------- - -#ifdef LAMMPS_EXCEPTIONS - -/* ---------------------------------------------------------------------- - check if a new error message -------------------------------------------------------------------------- */ - -int lammps_has_error(void *ptr) { - LAMMPS *lmp = (LAMMPS *)ptr; - Error *error = lmp->error; - return (error->get_last_error().empty()) ? 0 : 1; -} - -/* ---------------------------------------------------------------------- - copy the last error message of LAMMPS into a character buffer - return value encodes which type of error: - 1 = normal error (recoverable) - 2 = abort error (non-recoverable) -------------------------------------------------------------------------- */ - -int lammps_get_last_error_message(void *ptr, char * buffer, int buffer_size) { - LAMMPS *lmp = (LAMMPS *)ptr; - Error *error = lmp->error; - - if(!error->get_last_error().empty()) { - int error_type = error->get_last_error_type(); - strncpy(buffer, error->get_last_error().c_str(), buffer_size-1); - error->set_last_error("", ERROR_NONE); - return error_type; - } + buffer[0] = '\0'; return 0; } -#endif +/* ---------------------------------------------------------------------- */ -/******************************************************************************* - * Find neighbor list index of pair style neighbor list +/** This function is used to query whether LAMMPS was compiled with + * a real MPI library or in serial. + * + * \return 0 when compiled with MPI STUBS, otherwise 1 */ + +int lammps_config_has_mpi_support() +{ +#ifdef MPI_STUBS + return 0; +#else + return 1; +#endif +} + +/* ---------------------------------------------------------------------- */ + +/** Check if the LAMMPS library supports compressed files via a pipe to gzip + +\verbatim embed:rst +Several LAMMPS commands (e.g. :doc:`read_data`, :doc:`write_data`, +:doc:`dump styles atom, custom, and xyz `) support reading and +writing compressed files via creating a pipe to the ``gzip`` program. +This function checks whether this feature was :ref:`enabled at compile +time `. It does **not** check whether the ``gzip`` itself is +installed and usable. +\endverbatim + * + * \return 1 if yes, otherwise 0 + */ +int lammps_config_has_gzip_support() { + return Info::has_gzip_support() ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + +/** Check if the LAMMPS library supports writing PNG format images + +\verbatim embed:rst +The LAMMPS :doc:`dump style image ` supports writing multiple +image file formats. Most of them need, however, support from an external +library and using that has to be :ref:`enabled at compile time `. +This function checks whether support for the `PNG image file format +`_ is available +in the current LAMMPS library. +\endverbatim + * + * \return 1 if yes, otherwise 0 + */ +int lammps_config_has_png_support() { + return Info::has_png_support() ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + +/** Check if the LAMMPS library supports writing JPEG format images + +\verbatim embed:rst +The LAMMPS :doc:`dump style image ` supports writing multiple +image file formats. Most of them need, however, support from an external +library and using that has to be :ref:`enabled at compile time `. +This function checks whether support for the `JPEG image file format +`_ is available in the current LAMMPS library. +\endverbatim + * + * \return 1 if yes, otherwise 0 + */ +int lammps_config_has_jpeg_support() { + return Info::has_jpeg_support() ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + +/** Check if the LAMMPS library supports creating movie files via a pipe to ffmpeg + +\verbatim embed:rst +The LAMMPS :doc:`dump style movie ` supports generating movies +from images on-the-fly via creating a pipe to the +`ffmpeg `_ program. +This function checks whether this feature was :ref:`enabled at compile time `. +It does **not** check whether the ``ffmpeg`` itself is installed and usable. +\endverbatim + * + * \return 1 if yes, otherwise 0 + */ +int lammps_config_has_ffmpeg_support() { + return Info::has_ffmpeg_support() ? 1 : 0; +} + +/* ---------------------------------------------------------------------- */ + +/** Check whether LAMMPS errors will throw a C++ exception + * +\verbatim embed:rst +In case of errors LAMMPS will either abort or throw a C++ exception. +The latter has to be :ref:`enabled at compile time `. +This function checks if exceptions were enabled. +\endverbatim + * \return 1 if yes, otherwise 0 + */ +int lammps_config_has_exceptions() { + return Info::has_exceptions() ? 1 : 0; +} + +// ---------------------------------------------------------------------- +// Library functions for accessing neighbor lists +// ---------------------------------------------------------------------- + +/** Find neighbor list index of pair style neighbor list * * Try finding pair instance that matches style. If exact is set, the pair must * match style exactly. If exact is 0, style must only be contained. If pair is @@ -1718,18 +3939,18 @@ int lammps_get_last_error_message(void *ptr, char * buffer, int buffer_size) { * index. Thus, providing this request index ensures that the correct neighbor * list index is returned. * - * @param ptr Pointer to LAMMPS instance - * @param style String used to search for pair style instance - * @param exact Flag to control whether style should match exactly or only + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param style String used to search for pair style instance + * \param exact Flag to control whether style should match exactly or only * must be contained in pair style name - * @param nsub match nsub-th hybrid sub-style - * @param request request index that specifies which neighbor list should be + * \param nsub match nsub-th hybrid sub-style + * \param request request index that specifies which neighbor list should be * returned, in case there are multiple neighbor lists requests * for the found pair style - * @return return neighbor list index if found, otherwise -1 - ******************************************************************************/ -int lammps_find_pair_neighlist(void* ptr, char * style, int exact, int nsub, int request) { - LAMMPS * lmp = (LAMMPS *) ptr; + * \return return neighbor list index if found, otherwise -1 + */ +int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, int request) { + LAMMPS * lmp = (LAMMPS *) handle; Pair* pair = lmp->force->pair_match(style, exact, nsub); if (pair != NULL) { @@ -1746,17 +3967,18 @@ int lammps_find_pair_neighlist(void* ptr, char * style, int exact, int nsub, int return -1; } -/******************************************************************************* - * Find neighbor list index of fix neighbor list +/* ---------------------------------------------------------------------- */ + +/** Find neighbor list index of fix neighbor list * - * @param ptr Pointer to LAMMPS instance - * @param id Identifier of fix instance - * @param request request index that specifies which request should be returned, + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id Identifier of fix instance + * \param request request index that specifies which request should be returned, * in case there are multiple neighbor lists for this fix - * @return return neighbor list index if found, otherwise -1 - ******************************************************************************/ -int lammps_find_fix_neighlist(void* ptr, char * id, int request) { - LAMMPS * lmp = (LAMMPS *) ptr; + * \return return neighbor list index if found, otherwise -1 + */ +int lammps_find_fix_neighlist(void* handle, char * id, int request) { + LAMMPS * lmp = (LAMMPS *) handle; Fix* fix = NULL; const int nfix = lmp->modify->nfix; @@ -1782,17 +4004,18 @@ int lammps_find_fix_neighlist(void* ptr, char * id, int request) { return -1; } -/******************************************************************************* - * Find neighbor list index of compute neighbor list +/* ---------------------------------------------------------------------- */ + +/** Find neighbor list index of compute neighbor list * - * @param ptr Pointer to LAMMPS instance - * @param id Identifier of fix instance - * @param request request index that specifies which request should be returned, + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param id Identifier of fix instance + * \param request request index that specifies which request should be returned, * in case there are multiple neighbor lists for this fix - * @return return neighbor list index if found, otherwise -1 - ******************************************************************************/ -int lammps_find_compute_neighlist(void* ptr, char * id, int request) { - LAMMPS * lmp = (LAMMPS *) ptr; + * \return return neighbor list index if found, otherwise -1 + */ +int lammps_find_compute_neighlist(void* handle, char * id, int request) { + LAMMPS * lmp = (LAMMPS *) handle; Compute* compute = NULL; const int ncompute = lmp->modify->ncompute; @@ -1818,16 +4041,17 @@ int lammps_find_compute_neighlist(void* ptr, char * id, int request) { return -1; } -/******************************************************************************* - * Return the number of entries in the neighbor list with given index +/* ---------------------------------------------------------------------- */ + +/** Return the number of entries in the neighbor list with given index * - * @param ptr Pointer to LAMMPS instance - * @param idx neighbor list index - * @return return number of entries in neighbor list, -1 if idx is + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param idx neighbor list index + * \return return number of entries in neighbor list, -1 if idx is * not a valid index - ******************************************************************************/ -int lammps_neighlist_num_elements(void * ptr, int idx) { - LAMMPS * lmp = (LAMMPS *) ptr; + */ +int lammps_neighlist_num_elements(void * handle, int idx) { + LAMMPS * lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; if(idx < 0 || idx >= neighbor->nlist) { @@ -1838,21 +4062,22 @@ int lammps_neighlist_num_elements(void * ptr, int idx) { return list->inum; } -/******************************************************************************* - * Return atom local index, number of neighbors, and array of neighbor local +/* ---------------------------------------------------------------------- */ + +/** Return atom local index, number of neighbors, and array of neighbor local * atom indices of neighbor list entry * - * @param ptr Pointer to LAMMPS instance - * @param idx neighbor list index - * @param element neighbor list element index - * @param[out] iatom atom local index in range [0, nlocal + nghost), -1 if - invalid idx or element index - * @param[out] numneigh number of neighbors of atom i or 0 - * @param[out] neighbors pointer to array of neighbor atom local indices or + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param idx index of this neighbor list in the list of all neighbor lists + * \param element index of this neighbor list entry + * \param[out] iatom local atom index (i.e. in the range [0, nlocal + nghost), -1 if + invalid idx or element value + * \param[out] numneigh number of neighbors of atom iatom or 0 + * \param[out] neighbors pointer to array of neighbor atom local indices or * NULL - ******************************************************************************/ -void lammps_neighlist_element_neighbors(void * ptr, int idx, int element, int * iatom, int * numneigh, int ** neighbors) { - LAMMPS * lmp = (LAMMPS *) ptr; + */ +void lammps_neighlist_element_neighbors(void * handle, int idx, int element, int * iatom, int * numneigh, int ** neighbors) { + LAMMPS * lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; *iatom = -1; *numneigh = 0; @@ -1873,3 +4098,154 @@ void lammps_neighlist_element_neighbors(void * ptr, int idx, int element, int * *numneigh = list->numneigh[i]; *neighbors = list->firstneigh[i]; } + +// ---------------------------------------------------------------------- +// utility functions +// ---------------------------------------------------------------------- + +/** Encode three integer image flags into a single imageint. + * +\verbatim embed:rst + +The prototype for this function when compiling with ``-DLAMMPS_BIGBIG`` +is: + +.. code-block:: c + + int64_t lammps_encode_image_flags(int ix, int iy, int iz); + +This function performs the bit-shift, addition, and bit-wise OR +operations necessary to combine the values of three integers +representing the image flags in x-, y-, and z-direction. Unless +LAMMPS is compiled with -DLAMMPS_BIGBIG, those integers are +limited 10-bit signed integers [-512, 511]. Otherwise the return +type changes from ``int`` to ``int64_t`` and the valid range for +the individual image flags becomes [-1048576,1048575], +i.e. that of a 21-bit signed integer. There is no check on whether +the arguments conform to these requirements. + +\endverbatim + * + * \param ix image flag value in x + * \param iy image flag value in y + * \param iz image flag value in z + * \return encoded image flag integer */ + +imageint lammps_encode_image_flags(int ix, int iy, int iz) +{ + imageint image = ((imageint) (ix + IMGMAX) & IMGMASK) | + (((imageint) (iy + IMGMAX) & IMGMASK) << IMGBITS) | + (((imageint) (iz + IMGMAX) & IMGMASK) << IMG2BITS); + return image; +} + +/* ---------------------------------------------------------------------- */ + +/** Decode a single image flag integer into three regular integers + * +\verbatim embed:rst + +The prototype for this function when compiling with ``-DLAMMPS_BIGBIG`` +is: + +.. code-block:: c + + void lammps_decode_image_flags(int64_t image, int *flags); + +This function does the reverse operation of +:cpp:func:`lammps_encode_image_flags` and takes an image flag integer +does the bit-shift and bit-masking operations to decode it and stores +the resulting three regular integers into the buffer pointed to by +*flags*. + +\endverbatim + * + * \param image encoded image flag integer + * \param flags pointer to storage where the decoded image flags are stored. */ + +void lammps_decode_image_flags(imageint image, int *flags) +{ + flags[0] = (image & IMGMASK) - IMGMAX; + flags[1] = (image >> IMGBITS & IMGMASK) - IMGMAX; + flags[2] = (image >> IMG2BITS) - IMGMAX; +} + +// ---------------------------------------------------------------------- +// Library functions for error handling with exceptions enabled +// ---------------------------------------------------------------------- + +/** Check if there is a (new) error message available + +\verbatim embed:rst +This function can be used to query if an error inside of LAMMPS +has thrown a :ref:`C++ exception `. + +.. note: + + This function will always report "no error" when the LAMMPS library + has been compiled without ``-DLAMMPS_EXCEPTIONS`` which turns fatal + errors aborting LAMMPS into a C++ exceptions. You can use the library + function :cpp:func:`lammps_config_has_exceptions` to check if this is + the case. +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \return 0 on no error, 1 on error. + */ +int lammps_has_error(void *handle) { +#ifdef LAMMPS_EXCEPTIONS + LAMMPS * lmp = (LAMMPS *) handle; + Error * error = lmp->error; + return (error->get_last_error().empty()) ? 0 : 1; +#else + return 0; +#endif +} + +/* ---------------------------------------------------------------------- */ + +/** Copy the last error message into the provided buffer + +\verbatim embed:rst +This function can be used to retrieve the error message that was set +in the event of an error inside of LAMMPS which resulted in a +:ref:`C++ exception `. A suitable buffer for a C-style +string has to be provided and its length. If the internally stored +error message is longer, it will be truncated accordingly. The return +value of the function corresponds to the kind of error: a "1" indicates +an error that occurred on all MPI ranks and is often recoverable, while +a "2" indicates an abort that would happen only in a single MPI rank +and thus may not be recoverable as other MPI ranks may be waiting on +the failing MPI ranks to send messages. + +.. note: + + This function will do nothing when the LAMMPS library has been + compiled without ``-DLAMMPS_EXCEPTIONS`` which turns errors aborting + LAMMPS into a C++ exceptions. You can use the library function + :cpp:func:`lammps_config_has_exceptions` to check if this is the case. +\endverbatim + * + * \param handle pointer to a previously created LAMMPS instance cast to ``void *``. + * \param buffer string buffer to copy the error message to + * \param buf_size size of the provided string buffer + * \return 1 when all ranks had the error, 1 on a single rank error. + */ +int lammps_get_last_error_message(void *handle, char * buffer, int buf_size) { +#ifdef LAMMPS_EXCEPTIONS + LAMMPS * lmp = (LAMMPS *) handle; + Error * error = lmp->error; + + if(!error->get_last_error().empty()) { + int error_type = error->get_last_error_type(); + strncpy(buffer, error->get_last_error().c_str(), buf_size-1); + error->set_last_error("", ERROR_NONE); + return error_type; + } +#endif + return 0; +} + +// Local Variables: +// fill-column: 72 +// End: diff --git a/src/library.h b/src/library.h index d078474454..0ffd111d7b 100644 --- a/src/library.h +++ b/src/library.h @@ -1,4 +1,4 @@ -/* -*- c++ -*- ---------------------------------------------------------- +/* -*- c -*- ------------------------------------------------------------ LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator http://lammps.sandia.gov, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov @@ -14,54 +14,131 @@ #ifndef LAMMPS_LIBRARY_H #define LAMMPS_LIBRARY_H -/* - C or Fortran style library interface to LAMMPS - new LAMMPS-specific functions can be added -*/ +/* C style library interface to LAMMPS which allows to create and + * control instances of the LAMMPS C++ class and exchange data with it. + * The C bindings are the basis for the Python and Fortran modules. + * + * If needed, new LAMMPS-specific functions can be added to expose + * additional LAMMPS functionality to this library interface. */ -/* - * Follow the behavior of regular LAMMPS compilation and assume - * -DLAMMPS_SMALLBIG when no define is set. - */ -#if !defined(LAMMPS_BIGBIG) && !defined(LAMMPS_SMALLBIG) && !defined(LAMMPS_SMALLSMALL) +/* We follow the behavior of regular LAMMPS compilation and assume + * -DLAMMPS_SMALLBIG when no define is set. */ + +#if !defined(LAMMPS_BIGBIG) \ + && !defined(LAMMPS_SMALLBIG) \ + && !defined(LAMMPS_SMALLSMALL) #define LAMMPS_SMALLBIG #endif +/* To allow including the library interface without MPI */ + +#if !defined(LAMMPS_LIB_NO_MPI) #include +#endif + #if defined(LAMMPS_BIGBIG) || defined(LAMMPS_SMALLBIG) #include /* for int64_t */ #endif -/* ifdefs allow this file to be included in a C program */ +/** Style constants for extracting data from computes and fixes. + * + * Must be kept in sync with the equivalent constants in lammps.py */ + +enum _LMP_STYLE_CONST { + LMP_STYLE_GLOBAL=0, /*!< return global data */ + LMP_STYLE_ATOM =1, /*!< return per-atom data */ + LMP_STYLE_LOCAL =2 /*!< return local data */ +}; + +/** Type and size constants for extracting data from computes and fixes. + * + * Must be kept in sync with the equivalent constants in lammps.py */ + +enum _LMP_TYPE_CONST { + LMP_TYPE_SCALAR=0, /*!< return scalar */ + LMP_TYPE_VECTOR=1, /*!< return vector */ + LMP_TYPE_ARRAY =2, /*!< return array */ + LMP_SIZE_VECTOR=3, /*!< return length of vector */ + LMP_SIZE_ROWS =4, /*!< return number of rows */ + LMP_SIZE_COLS =5 /*!< return number of columns */ +}; + +/* Ifdefs to allow this file to be included in C and C++ programs */ #ifdef __cplusplus extern "C" { #endif -void lammps_open(int, char **, MPI_Comm, void **); -void lammps_open_no_mpi(int, char **, void **); -void lammps_close(void *); -int lammps_version(void *); -void lammps_file(void *, char *); -char *lammps_command(void *, char *); -void lammps_commands_list(void *, int, char **); -void lammps_commands_string(void *, char *); -void lammps_free(void *); +/* ---------------------------------------------------------------------- + * Library functions to create/destroy an instance of LAMMPS + * ---------------------------------------------------------------------- */ -int lammps_extract_setting(void *, char *); -void *lammps_extract_global(void *, char *); -void lammps_extract_box(void *, double *, double *, - double *, double *, double *, int *, int *); -void *lammps_extract_atom(void *, char *); -void *lammps_extract_compute(void *, char *, int, int); -void *lammps_extract_fix(void *, char *, int, int, int, int); -void *lammps_extract_variable(void *, char *, char *); +#if !defined(LAMMPS_LIB_NO_MPI) +void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr); +#endif +void *lammps_open_no_mpi(int argc, char **argv, void **ptr); +void *lammps_open_fortran(int argc, char **argv, int f_comm); +void lammps_close(void *handle); +void lammps_mpi_init(); +void lammps_mpi_finalize(); +void lammps_free(void *ptr); -double lammps_get_thermo(void *, char *); -int lammps_get_natoms(void *); +/* ---------------------------------------------------------------------- + * Library functions to process commands + * ---------------------------------------------------------------------- */ + +void lammps_file(void *handle, const char *file); + +char *lammps_command(void *handle, const char *cmd); +void lammps_commands_list(void *handle, int ncmd, const char **cmds); +void lammps_commands_string(void *handle, const char *str); + +/* ----------------------------------------------------------------------- + * Library functions to extract info from LAMMPS or set data in LAMMPS + * ----------------------------------------------------------------------- */ + +int lammps_version(void *handle); +double lammps_get_natoms(void *handle); +double lammps_get_thermo(void *handle, char *keyword); + +void lammps_extract_box(void *handle, double *boxlo, double *boxhi, + double *xy, double *yz, double *xz, + int *pflags, int *boxflag); +void lammps_reset_box(void *handle, double *boxlo, double *boxhi, + double xy, double yz, double xz); + +int lammps_extract_setting(void *handle, char *keyword); +void *lammps_extract_global(void *handle, char *name); +void *lammps_extract_atom(void *handle, char *name); + +#if !defined(LAMMPS_BIGBIG) +int lammps_create_atoms(void *handle, int n, int *id, int *type, + double *x, double *v, int *image, int bexpand); +#else +int lammps_create_atoms(void *handle, int n, int64_t *id, int *type, + double *x, double *v, int64_t* image, int bexpand); +#endif + +/* ---------------------------------------------------------------------- + * Library functions to access data from computes, fixes, variables in LAMMPS + * ---------------------------------------------------------------------- */ + +void *lammps_extract_compute(void *handle, char *id, int, int); +void *lammps_extract_fix(void *handle, char *, int, int, int, int); +void *lammps_extract_variable(void *handle, char *, char *); +int lammps_set_variable(void *, char *, char *); + +/* ---------------------------------------------------------------------- + * Library functions for scatter/gather operations of data + * ---------------------------------------------------------------------- */ + + +void lammps_gather(void *, char *, int, int, void *); +void lammps_gather_concat(void *, char *, int, int, void *); +void lammps_gather_subset(void *, char *, int, int, int, int *, void *); +void lammps_scatter(void *, char *, int, int, void *); +void lammps_scatter_subset(void *, char *, int, int, int, int *, void *); -int lammps_set_variable(void *, char *, char *); -void lammps_reset_box(void *, double *, double *, double, double, double); void lammps_gather_atoms(void *, char *, int, int, void *); void lammps_gather_atoms_concat(void *, char *, int, int, void *); @@ -69,6 +146,46 @@ void lammps_gather_atoms_subset(void *, char *, int, int, int, int *, void *); void lammps_scatter_atoms(void *, char *, int, int, void *); void lammps_scatter_atoms_subset(void *, char *, int, int, int, int *, void *); +/* ---------------------------------------------------------------------- + * Library functions for retrieving configuration information + * ---------------------------------------------------------------------- */ + +int lammps_config_has_mpi_support(); +int lammps_config_has_package(char *); +int lammps_config_package_count(); +int lammps_config_package_name(int, char *, int); +int lammps_config_has_gzip_support(); +int lammps_config_has_png_support(); +int lammps_config_has_jpeg_support(); +int lammps_config_has_ffmpeg_support(); +int lammps_config_has_exceptions(); + +int lammps_has_style(void *, char *, char *); +int lammps_style_count(void *, char *); +int lammps_style_name(void *, char *, int, char *, int); + +/* ---------------------------------------------------------------------- + * Library functions for accessing neighbor lists + * ---------------------------------------------------------------------- */ + +int lammps_find_pair_neighlist(void*, char *, int, int, int); +int lammps_find_fix_neighlist(void*, char *, int); +int lammps_find_compute_neighlist(void*, char *, int); +int lammps_neighlist_num_elements(void*, int); +void lammps_neighlist_element_neighbors(void *, int, int, int *, int *, int ** ); + +/* ---------------------------------------------------------------------- + * Utility functions + * ---------------------------------------------------------------------- */ + +#if !defined(LAMMPS_BIGBIG) +int lammps_encode_image_flags(int ix, int iy, int iz); +void lammps_decode_image_flags(int image, int *flags); +#else +int64_t lammps_encode_image_flags(int ix, int iy, int iz); +void lammps_decode_image_flags(int64_t image, int *flags); +#endif + #if defined(LAMMPS_BIGBIG) typedef void (*FixExternalFnPtr)(void *, int64_t, int, int64_t *, double **, double **); void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); @@ -79,49 +196,18 @@ void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); typedef void (*FixExternalFnPtr)(void *, int, int, int *, double **, double **); void lammps_set_fix_external_callback(void *, char *, FixExternalFnPtr, void*); #endif +void lammps_fix_external_set_energy_global(void *, char *, double); +void lammps_fix_external_set_virial_global(void *, char *, double *); -int lammps_config_has_package(char * package_name); -int lammps_config_package_count(); -int lammps_config_package_name(int index, char * buffer, int max_size); -int lammps_config_has_gzip_support(); -int lammps_config_has_png_support(); -int lammps_config_has_jpeg_support(); -int lammps_config_has_ffmpeg_support(); -int lammps_config_has_exceptions(); +int lammps_has_error(void *handle); +int lammps_get_last_error_message(void *handle, char *buffer, int buf_size); -int lammps_has_style(void* ptr, char * category, char * name); -int lammps_style_count(void* ptr, char * category); -int lammps_style_name(void*ptr, char * category, int index, char * buffer, int max_size); - -int lammps_find_pair_neighlist(void* ptr, char * style, int exact, int nsub, int request); -int lammps_find_fix_neighlist(void* ptr, char * id, int request); -int lammps_find_compute_neighlist(void* ptr, char * id, int request); -int lammps_neighlist_num_elements(void* ptr, int idx); -void lammps_neighlist_element_neighbors(void * ptr, int idx, int element, int * iatom, int * numneigh, int ** neighbors); - -// lammps_create_atoms() takes tagint and imageint as args -// ifdef insures they are compatible with rest of LAMMPS -// caller must match to how LAMMPS library is built - -#ifdef LAMMPS_BIGBIG -void lammps_create_atoms(void *, int, int64_t *, int *, - double *, double *, int64_t *, int); -#else -void lammps_create_atoms(void *, int, int *, int *, - double *, double *, int *, int); -#endif - -#ifdef LAMMPS_EXCEPTIONS -int lammps_has_error(void *); -int lammps_get_last_error_message(void *, char *, int); -#endif - -#undef LAMMPS #ifdef __cplusplus } #endif #endif /* LAMMPS_LIBRARY_H */ + /* ERROR/WARNING messages: E: Library error: issuing LAMMPS command during run @@ -172,3 +258,7 @@ W: Library warning in lammps_create_atoms, invalid total atoms %ld %ld UNDOCUMENTED */ + +/* Local Variables: + * fill-column: 72 + * End: */ diff --git a/src/lmptype.h b/src/lmptype.h index 68af28af61..e0e081dd12 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -42,10 +42,10 @@ #define __STDC_FORMAT_MACROS #endif -#include -#include -#include -#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export // grrr - IBM Power6 does not provide this def in their system header files @@ -250,17 +250,23 @@ The typecast prevents compiler warnings about possible truncations. // functions and avoid compiler warnings about variable tracking. // Disable for broken -D_FORTIFY_SOURCE feature. -#if defined(_FORTIFY_SOURCE) && (_FORTIFY_SOURCE > 0) -#define _noopt -#elif defined(__clang__) +#if defined(__clang__) # define _noopt __attribute__((optnone)) #elif defined(__INTEL_COMPILER) # define _noopt #elif defined(__GNUC__) # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9)) -# define _noopt __attribute__((optimize("O0","no-var-tracking-assignments"))) +# if defined(_FORTIFY_SOURCE) && (_FORTIFY_SOURCE > 0) +# define _noopt __attribute__((optimize("no-var-tracking-assignments"))) +# else +# define _noopt __attribute__((optimize("O0","no-var-tracking-assignments"))) +# endif # else -# define _noopt __attribute__((optimize("O0"))) +# if defined(_FORTIFY_SOURCE) && (_FORTIFY_SOURCE > 0) +# define _noopt +# else +# define _noopt __attribute__((optimize("O0"))) +# endif # endif #else # define _noopt diff --git a/src/main.cpp b/src/main.cpp index 9fb084aaea..d705db4e5b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,9 +12,11 @@ ------------------------------------------------------------------------- */ #include "lammps.h" -#include #include "input.h" +#include +#include + #if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE) #include #endif diff --git a/src/memory.cpp b/src/memory.cpp index 6211687a7a..bbbc233bbf 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -12,9 +12,8 @@ ------------------------------------------------------------------------- */ #include "memory.h" -#include + #include "error.h" -#include "fmt/format.h" #if defined(LMP_USER_INTEL) && defined(__INTEL_COMPILER) #ifndef LMP_INTEL_NO_TBB diff --git a/src/mergesort.h b/src/mergesort.h deleted file mode 100644 index edb745922f..0000000000 --- a/src/mergesort.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - 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 LMP_MERGESORT -#define LMP_MERGESORT - -#include - -// custom hybrid upward merge sort implementation with support to pass -// an opaque pointer to the comparison function, e.g. for access to -// class members. this avoids having to use global variables. -// for improved performance, we employ an in-place insertion sort on -// chunks of up to 64 elements and switch to merge sort from then on. - -// part 1. insertion sort for pre-sorting of small chunks - -static void insertion_sort(int *index, int num, void *ptr, - int (*comp)(int, int, void*)) -{ - if (num < 2) return; - for (int i=1; i < num; ++i) { - int tmp = index[i]; - for (int j=i-1; j >= 0; --j) { - if ((*comp)(index[j],tmp,ptr) > 0) { - index[j+1] = index[j]; - } else { - index[j+1] = tmp; - break; - } - if (j == 0) index[0] = tmp; - } - } -} - -// part 2. merge two sublists - -static void do_merge(int *idx, int *buf, int llo, int lhi, int rlo, int rhi, - void *ptr, int (*comp)(int, int, void *)) -{ - int i = llo; - int l = llo; - int r = rlo; - while ((l < lhi) && (r < rhi)) { - if ((*comp)(buf[l],buf[r],ptr) < 0) - idx[i++] = buf[l++]; - else idx[i++] = buf[r++]; - } - - while (l < lhi) idx[i++] = buf[l++]; - while (r < rhi) idx[i++] = buf[r++]; -} - -// part 3: loop over sublists doubling in size with each iteration. -// pre-sort sublists with insertion sort for better performance. - -static void merge_sort(int *index, int num, void *ptr, - int (*comp)(int, int, void *)) -{ - if (num < 2) return; - - int chunk,i,j; - - // do insertion sort on chunks of up to 64 elements - - chunk = 64; - for (i=0; i < num; i += chunk) { - j = (i+chunk > num) ? num-i : chunk; - insertion_sort(index+i,j,ptr,comp); - } - - // already done? - - if (chunk >= num) return; - - // continue with merge sort on the pre-sorted chunks. - // we need an extra buffer for temporary storage and two - // pointers to operate on, so we can swap the pointers - // rather than copying to the hold buffer in each pass - - int *buf = new int[num]; - int *dest = index; - int *hold = buf; - - while (chunk < num) { - int m; - - // swap hold and destination buffer - - int *tmp = dest; dest = hold; hold = tmp; - - // merge from hold array to destination array - - for (i=0; i < num-1; i += 2*chunk) { - j = i + 2*chunk; - if (j > num) j=num; - m = i+chunk; - if (m > num) m=num; - do_merge(dest,hold,i,m,m,j,ptr,comp); - } - - // copy all indices not handled by the chunked merge sort loop - - for ( ; i < num ; i++ ) dest[i] = hold[i]; - chunk *= 2; - } - - // if the final sorted data is in buf, copy back to index - - if (dest == buf) memcpy(index,buf,sizeof(int)*num); - - delete[] buf; -} - -#endif diff --git a/src/min.cpp b/src/min.cpp index b14137f689..6bcb4b4e2e 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -20,32 +20,32 @@ ------------------------------------------------------------------------- */ #include "min.h" -#include -#include -#include + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "domain.h" -#include "comm.h" -#include "update.h" -#include "modify.h" -#include "fix_minimize.h" -#include "compute.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" #include "bond.h" -#include "angle.h" +#include "comm.h" +#include "compute.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix_minimize.h" +#include "force.h" #include "improper.h" #include "kspace.h" -#include "output.h" -#include "thermo.h" -#include "timer.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "fmt/format.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" +#include "thermo.h" +#include "timer.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -671,35 +671,35 @@ void Min::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"dmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - dmax = force->numeric(FLERR,arg[iarg+1]); + dmax = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"delaystep") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - delaystep = force->numeric(FLERR,arg[iarg+1]); + delaystep = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"dtgrow") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - dtgrow = force->numeric(FLERR,arg[iarg+1]); + dtgrow = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"dtshrink") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - dtshrink = force->numeric(FLERR,arg[iarg+1]); + dtshrink = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"alpha0") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - alpha0 = force->numeric(FLERR,arg[iarg+1]); + alpha0 = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"alphashrink") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - alphashrink = force->numeric(FLERR,arg[iarg+1]); + alphashrink = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"tmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - tmax = force->numeric(FLERR,arg[iarg+1]); + tmax = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"tmin") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - tmin = force->numeric(FLERR,arg[iarg+1]); + tmin = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"halfstepback") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); @@ -715,7 +715,7 @@ void Min::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"vdfmax") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); - max_vdotf_negatif = force->numeric(FLERR,arg[iarg+1]); + max_vdotf_negatif = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"integrator") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); diff --git a/src/min.h b/src/min.h index b23c9b6670..1db196a55e 100644 --- a/src/min.h +++ b/src/min.h @@ -14,7 +14,7 @@ #ifndef LMP_MIN_H #define LMP_MIN_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/min_cg.cpp b/src/min_cg.cpp index 46da4bfa5b..511b16cef8 100644 --- a/src/min_cg.cpp +++ b/src/min_cg.cpp @@ -12,12 +12,13 @@ ------------------------------------------------------------------------- */ #include "min_cg.h" -#include -#include + #include "error.h" -#include "update.h" #include "output.h" #include "timer.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/min_fire.cpp b/src/min_fire.cpp index 53bedfbb6c..b7225a1a5a 100644 --- a/src/min_fire.cpp +++ b/src/min_fire.cpp @@ -16,21 +16,18 @@ Erik Bitzek, FAU Erlangen-Nuernberg ------------------------------------------------------------------------- */ -#include #include "min_fire.h" -#include "universe.h" + #include "atom.h" +#include "comm.h" +#include "error.h" #include "force.h" -#include "update.h" #include "output.h" #include "timer.h" -#include "error.h" -#include "variable.h" -#include "modify.h" -#include "compute.h" -#include "domain.h" -#include "neighbor.h" -#include "comm.h" +#include "universe.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/min_fire_old.cpp b/src/min_fire_old.cpp index bd76b2d1fc..6efd00a4b8 100644 --- a/src/min_fire_old.cpp +++ b/src/min_fire_old.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "min_fire_old.h" -#include -#include -#include "universe.h" + #include "atom.h" #include "error.h" #include "force.h" -#include "update.h" #include "output.h" #include "timer.h" +#include "universe.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/min_hftn.cpp b/src/min_hftn.cpp index 63432aab63..909f0b0689 100644 --- a/src/min_hftn.cpp +++ b/src/min_hftn.cpp @@ -18,17 +18,18 @@ ------------------------------------------------------------------------- */ #include "min_hftn.h" -#include -#include -#include + #include "atom.h" #include "error.h" #include "fix_minimize.h" #include "modify.h" #include "output.h" #include "pair.h" -#include "update.h" #include "timer.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index a7a10dcd51..7226f61614 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -22,15 +22,16 @@ ------------------------------------------------------------------------- */ #include "min_linesearch.h" -#include -#include + #include "atom.h" -#include "modify.h" #include "fix_minimize.h" -#include "pair.h" +#include "modify.h" #include "output.h" +#include "pair.h" #include "thermo.h" +#include + using namespace LAMMPS_NS; // ALPHA_MAX = max alpha allowed to avoid long backtracks diff --git a/src/min_quickmin.cpp b/src/min_quickmin.cpp index 5e7643bf3b..025e80b95d 100644 --- a/src/min_quickmin.cpp +++ b/src/min_quickmin.cpp @@ -12,15 +12,16 @@ ------------------------------------------------------------------------- */ #include "min_quickmin.h" -#include -#include -#include "universe.h" + #include "atom.h" #include "error.h" #include "force.h" -#include "update.h" #include "output.h" #include "timer.h" +#include "universe.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/min_sd.cpp b/src/min_sd.cpp index d973ec1c82..5868acbe48 100644 --- a/src/min_sd.cpp +++ b/src/min_sd.cpp @@ -12,11 +12,13 @@ ------------------------------------------------------------------------- */ #include "min_sd.h" -#include + #include "error.h" -#include "update.h" #include "output.h" #include "timer.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/minimize.cpp b/src/minimize.cpp index 94fdcd8681..451412ecc8 100644 --- a/src/minimize.cpp +++ b/src/minimize.cpp @@ -12,13 +12,13 @@ ------------------------------------------------------------------------- */ #include "minimize.h" + #include "domain.h" -#include "update.h" -#include "min.h" -#include "finish.h" -#include "timer.h" #include "error.h" -#include "force.h" +#include "finish.h" +#include "min.h" +#include "timer.h" +#include "update.h" using namespace LAMMPS_NS; @@ -38,10 +38,10 @@ void Minimize::command(int narg, char **arg) // ignore minimize command, if walltime limit was already reached if (timer->is_timeout()) return; - update->etol = force->numeric(FLERR,arg[0]); - update->ftol = force->numeric(FLERR,arg[1]); - update->nsteps = force->inumeric(FLERR,arg[2]); - update->max_eval = force->inumeric(FLERR,arg[3]); + update->etol = utils::numeric(FLERR,arg[0],false,lmp); + update->ftol = utils::numeric(FLERR,arg[1],false,lmp); + update->nsteps = utils::inumeric(FLERR,arg[2],false,lmp); + update->max_eval = utils::inumeric(FLERR,arg[3],false,lmp); if (update->etol < 0.0 || update->ftol < 0.0) error->all(FLERR,"Illegal minimize command"); diff --git a/src/modify.cpp b/src/modify.cpp index 96335946ae..c88d52b623 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -12,24 +12,24 @@ ------------------------------------------------------------------------- */ #include "modify.h" -#include -#include #include "style_compute.h" #include "style_fix.h" + #include "atom.h" #include "comm.h" -#include "fix.h" #include "compute.h" -#include "group.h" -#include "update.h" #include "domain.h" -#include "region.h" -#include "input.h" -#include "variable.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "fix.h" +#include "group.h" +#include "input.h" +#include "memory.h" +#include "region.h" +#include "update.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -947,7 +947,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) void Modify::add_fix(const std::string &fixcmd, int trysuffix) { - std::vector args = utils::split_words(fixcmd); + auto args = utils::split_words(fixcmd); char **newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { @@ -1249,7 +1249,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) void Modify::add_compute(const std::string &computecmd, int trysuffix) { - std::vector args = utils::split_words(computecmd); + auto args = utils::split_words(computecmd); char **newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { diff --git a/src/modify.h b/src/modify.h index 05eebc7e14..4c3db0a1b9 100644 --- a/src/modify.h +++ b/src/modify.h @@ -15,11 +15,14 @@ #define LMP_MODIFY_H #include "pointers.h" + #include -#include namespace LAMMPS_NS { + class Compute; + class Fix; + class Modify : protected Pointers { friend class Info; friend class FixSRP; @@ -27,7 +30,6 @@ class Modify : protected Pointers { friend class RespaOMP; public: - int nfix,maxfix; int n_initial_integrate,n_post_integrate,n_pre_exchange; int n_pre_neighbor,n_post_neighbor; int n_pre_force,n_pre_reverse,n_post_force; @@ -41,11 +43,12 @@ class Modify : protected Pointers { int nfix_restart_global; // stored fix global info from restart file int nfix_restart_peratom; // stored fix peratom info from restart file - class Fix **fix; // list of fixes + int nfix,maxfix; + Fix **fix; // list of fixes int *fmask; // bit mask for when each fix is applied - int ncompute,maxcompute; // list of computes - class Compute **compute; + int ncompute,maxcompute; + Compute **compute; // list of computes Modify(class LAMMPS *); virtual ~Modify(); diff --git a/src/molecule.cpp b/src/molecule.cpp index 8221a08b5f..0d81f49a50 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -12,23 +12,22 @@ ------------------------------------------------------------------------- */ #include "molecule.h" -#include -#include -#include -#include + #include "atom.h" #include "atom_vec.h" #include "atom_vec_body.h" -#include "force.h" #include "comm.h" #include "domain.h" +#include "error.h" +#include "force.h" #include "math_extra.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" #include "tokenizer.h" +#include +#include +#include + using namespace LAMMPS_NS; #define MAXLINE 256 @@ -79,43 +78,43 @@ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : while (iarg < narg) { if (strcmp(arg[iarg],"offset") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal molecule command"); - toffset = force->inumeric(FLERR,arg[iarg+1]); - boffset = force->inumeric(FLERR,arg[iarg+2]); - aoffset = force->inumeric(FLERR,arg[iarg+3]); - doffset = force->inumeric(FLERR,arg[iarg+4]); - ioffset = force->inumeric(FLERR,arg[iarg+5]); + toffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + boffset = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + aoffset = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + doffset = utils::inumeric(FLERR,arg[iarg+4],false,lmp); + ioffset = utils::inumeric(FLERR,arg[iarg+5],false,lmp); if (toffset < 0 || boffset < 0 || aoffset < 0 || doffset < 0 || ioffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 6; } else if (strcmp(arg[iarg],"toff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal molecule command"); - toffset = force->inumeric(FLERR,arg[iarg+1]); + toffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (toffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 2; } else if (strcmp(arg[iarg],"boff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal molecule command"); - boffset = force->inumeric(FLERR,arg[iarg+1]); + boffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (boffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 2; } else if (strcmp(arg[iarg],"aoff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal molecule command"); - aoffset = force->inumeric(FLERR,arg[iarg+1]); + aoffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (aoffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 2; } else if (strcmp(arg[iarg],"doff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal molecule command"); - doffset = force->inumeric(FLERR,arg[iarg+1]); + doffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (doffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 2; } else if (strcmp(arg[iarg],"ioff") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal molecule command"); - ioffset = force->inumeric(FLERR,arg[iarg+1]); + ioffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (ioffset < 0) error->all(FLERR,"Illegal molecule command"); iarg += 2; } else if (strcmp(arg[iarg],"scale") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal molecule command"); - sizescale = force->numeric(FLERR,arg[iarg+1]); + sizescale = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (sizescale <= 0.0) error->all(FLERR,"Illegal molecule command"); iarg += 2; } else break; @@ -773,7 +772,7 @@ void Molecule::fragments(char *line) ValueTokenizer values(line); - if (values.count() > natoms+1) + if ((int)values.count() > natoms+1) error->one(FLERR,"Invalid atom ID in Fragments section of molecule file"); fragmentnames[i] = values.next_string(); diff --git a/src/molecule.h b/src/molecule.h index d752be3f81..5a3fa5a327 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -15,7 +15,7 @@ #define LMP_ONE_MOLECULE_H #include "pointers.h" -#include + #include namespace LAMMPS_NS { diff --git a/src/my_page.cpp b/src/my_page.cpp new file mode 100644 index 0000000000..95dd56fecd --- /dev/null +++ b/src/my_page.cpp @@ -0,0 +1,193 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "my_page.h" + +#include + +#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) +#define LAMMPS_MEMALIGN 64 +#endif + +using namespace LAMMPS_NS; + +/** \class LAMMPS_NS::MyPage + * \brief Templated class for storing chunks of datums in pages. + * + * The size of the chunk may vary from call to call, but must be + * less or equal than the *maxchunk* setting. + * The chunks are not returnable like with malloc() (i.e. you cannot + * call free() on them individually). One can only reset and start over. + * The purpose of this class is to replace many small memory allocations + * via malloc() with a few large ones. Since the pages are never freed + * until the class is re-initialized, they can be re-used without having + * to re-allocate them by calling the reset() method. + * + * The settings *maxchunk*, *pagesize*, and *pagedelta* control + * the memory allocation strategy. The *maxchunk* value represents + * the expected largest number of items per chunk. If there is + * less space left on the current page, a new page is allocated + * for the next chunk. The *pagesize* value represents how many + * items can fit on a single page. It should have space for multiple + * chunks of size *maxchunk*. The combination of these two + * parameters determines how much memory is wasted by either switching + * to the next page too soon or allocating too large pages that never + * get properly used. It is an error, if a requested chunk is larger + * than *maxchunk*. The *pagedelta* parameter determines how many + * pages are allocated in one go. In combination with the *pagesize* + * setting, this determines how often blocks of memory get allocated + * (fewer allocations will result in faster execution). + * + * \note + * This is a template class with explicit instantiation. If the class + * is used with a new data type a new explicit instantiation may need to + * be added at the end of the file ``src/my_page.cpp`` to avoid symbol + * lookup errors. */ + +/** Create a class instance + * + * Need to call init() before use to define allocation settings */ + +template +MyPage::MyPage() : ndatum(0), nchunk(0), pages(nullptr), page(nullptr), + npage(0), ipage(-1), index(-1), maxchunk(-1), + pagesize(-1), pagedelta(1), errorflag(0) {}; + +template +MyPage::~MyPage() { + deallocate(); +} + +/** (Re-)initialize the set of pages and allocation parameters. + * + * This also frees all previously allocated storage and allocates + * the first page(s). + * + * \param user_maxchunk Expected maximum number of items for one chunk + * \param user_pagesize Number of items on a single memory page + * \param user_pagedelta Number of pages to allocate with one malloc + * \return 1 if there were invalid parameters, 2 if there was an allocation error or 0 if successful */ + +template +int MyPage::init(int user_maxchunk, int user_pagesize, + int user_pagedelta) { + maxchunk = user_maxchunk; + pagesize = user_pagesize; + pagedelta = user_pagedelta; + + if (maxchunk <= 0 || pagesize <= 0 || pagedelta <= 0) return 1; + if (maxchunk > pagesize) return 1; + + // free storage if re-initialized + + deallocate(); + + // initial page allocation + + allocate(); + if (errorflag) return 2; + reset(); + return 0; + } + +/** Pointer to location that can store N items. + * + * This will allocate more pages as needed. + * If the parameter *N* is larger than the *maxchunk* + * setting an error is flagged. + * + * \param n number of items for which storage is requested + * \return memory location or null pointer, if error or allocation failed */ + +template +T *MyPage::get(int n) { + if (n > maxchunk) { + errorflag = 1; + return NULL; + } + ndatum += n; + nchunk++; + + // return pointer from current page + if (index+n <= pagesize) { + int start = index; + index += n; + return &page[start]; + } + + // allocate new page + ipage++; + if (ipage == npage) { + allocate(); + if (errorflag) return NULL; + } + page = pages[ipage]; + index = n; + return &page[0]; +} + + +/** Reset state of memory pool without freeing any memory */ + +template +void MyPage::reset() { + ndatum = nchunk = 0; + index = ipage = 0; + page = (pages != nullptr) ? pages[ipage] : nullptr; + errorflag = 0; +} + +/* ---------------------------------------------------------------------- */ + +template +void MyPage::allocate() { + npage += pagedelta; + pages = (T **) realloc(pages,npage*sizeof(T *)); + if (!pages) { + errorflag = 2; + return; + } + + for (int i = npage-pagedelta; i < npage; i++) { +#if defined(LAMMPS_MEMALIGN) + void *ptr; + if (posix_memalign(&ptr, LAMMPS_MEMALIGN, pagesize*sizeof(T))) + errorflag = 2; + pages[i] = (T *) ptr; +#else + pages[i] = (T *) malloc(pagesize*sizeof(T)); + if (!pages[i]) errorflag = 2; +#endif + } +} + +/** Free all allocated pages of this class instance */ + +template +void MyPage::deallocate() { + reset(); + for (int i = 0; i < npage; i++) free(pages[i]); + free(pages); + pages = nullptr; + npage = 0; +} + +// explicit instantiations + +namespace LAMMPS_NS { + template class MyPage; + template class MyPage; + template class MyPage; + template class MyPage; + template class MyPage; +} diff --git a/src/my_page.h b/src/my_page.h index 01542a9174..4beb397ae2 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -12,144 +12,41 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- -MyPage = templated class for storing chunks of datums in pages - chunks are not returnable, can only reset and start over - replaces many small mallocs with a few large mallocs - pages are never freed, so can reuse w/out reallocs -usage: - request one datum at a time, repeat, clear - request chunks of datums in each get() or vget(), repeat, clear - chunk size can vary from request to request - chunk size can be known in advance or registered after usage via vgot() -inputs: - template T = one datum, e.g. int, double, struct, int[3] - for int[3], access datum as ivec[i][2] -methods: - T *get() = return ptr to one datum - T *get(N) = return ptr to N datums, N < maxchunk required - T *vget() = return ptr to maxchunk datums, use as needed, then call vgot() - all gets return NULL if error encountered - vgot(N) = used N datums of previous vget(), N < maxchunk required - void init(maxchunk, pagesize, pagedelta) - define allocation params and allocate first page(s) - call right after constructor - can call again to reset allocation params and free previous pages - maxchunk = max # of datums in one chunk, default = 1 - pagesize = # of datums in one page, default = 1024 - should be big enough to store multiple chunks - pagedelta = # of pages to allocate at a time, default = 1 - return 1 if bad params - void reset() = clear pages w/out freeing - int size() = return total size of allocated pages in bytes - int status() = return error status - 0 = ok, 1 = chunksize > maxchunk, 2 = allocation error + templated class for storing chunks of datums in pages ------------------------------------------------------------------------- */ #ifndef LAMMPS_MY_PAGE_H #define LAMMPS_MY_PAGE_H -#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) -#define LAMMPS_MEMALIGN 64 -#endif +#include "lmptype.h" -#include namespace LAMMPS_NS { +struct HyperOneCoeff { + double biascoeff; + tagint tag; +}; + template class MyPage { public: int ndatum; // total # of stored datums int nchunk; // total # of stored chunks + MyPage(); + virtual ~MyPage(); - MyPage() { - ndatum = nchunk = 0; - pages = NULL; - npage = 0; - errorflag = 0; - } + int init(int user_maxchunk=1, int user_pagesize=1024, + int user_pagedelta=1); - // (re)initialize allocation params - // also allocate first page(s) + T *get(int n=1); - int init(int user_maxchunk = 1, int user_pagesize = 1024, - int user_pagedelta = 1) { - maxchunk = user_maxchunk; - pagesize = user_pagesize; - pagedelta = user_pagedelta; - - if (maxchunk <= 0 || pagesize <= 0 || pagedelta <= 0) return 1; - if (maxchunk > pagesize) return 1; - - // free any previously allocated pages - - for (int i = 0; i < npage; i++) free(pages[i]); - free(pages); - - // initial page allocation - - ndatum = nchunk = 0; - pages = NULL; - npage = 0; - allocate(); - if (errorflag) return 2; - ipage = index = 0; - page = pages[ipage]; - return 0; - } - - // free all allocated pages - - ~MyPage() { - for (int i = 0; i < npage; i++) free(pages[i]); - free(pages); - } - - // get ptr to one datum - // return NULL if run out of memory - - T *get() { - ndatum++; - nchunk++; - if (index < pagesize) return &page[index++]; - ipage++; - if (ipage == npage) { - allocate(); - if (errorflag) return NULL; - } - page = pages[ipage]; - index = 0; - return &page[index++]; - } - - // get ptr to location that can store N datums - // error if N > maxchunk - // return NULL if run out of memory - - T *get(int n) { - if (n > maxchunk) { - errorflag = 1; - return NULL; - } - ndatum += n; - nchunk++; - if (index+n <= pagesize) { - int start = index; - index += n; - return &page[start]; - } - ipage++; - if (ipage == npage) { - allocate(); - if (errorflag) return NULL; - } - page = pages[ipage]; - index = n; - return &page[0]; - } - - // get ptr to location that can store maxchunk datums - // will return same ptr as previous call if vgot() not called - // return NULL if run out of memory + /** Get pointer to location that can store *maxchunk* items. + * + * This will return the same pointer as the previous call to + * this function unless vgot() is called afterwards to record + * how many items of the chunk were actually used. + * + * \return pointer to chunk of memory or null pointer if run out of memory */ T *vget() { if (index+maxchunk <= pagesize) return &page[index]; @@ -163,9 +60,14 @@ class MyPage { return &page[index]; } - // increment by N = # of values stored in loc returned by vget() - // OK to not call if vget() ptr was not used - // error if N > maxchunk + /** Mark *N* items as used of the chunk reserved with a preceding call to vget(). + * + * This will advance the internal pointer inside the current memory page. + * It is not necessary to call this function for *N* = 0, that is the reserved + * storage was not used. A following call to vget() will then reserve the + * same location again. It is an error if *N* > *maxchunk*. + * + * \param n Number of items used in previously reserved chunk */ void vgot(int n) { if (n > maxchunk) errorflag = 1; @@ -174,25 +76,21 @@ class MyPage { index += n; } - // clear all pages, without freeing any memory + void reset(); - void reset() { - ndatum = nchunk = 0; - index = ipage = 0; - page = pages[ipage]; + /** Return total size of allocated pages + * + * \return total storage used in bytes */ + + double size() const { + return (double)npage*pagesize*sizeof(T); } - // return total size of allocated pages + /** Return error status + * + * \return 0 if no error, 1 requested chunk size > maxchunk, 2 if malloc failed */ - int size() const { - return npage*pagesize*sizeof(T); - } - - // return error status - - int status() const { - return errorflag; - } + int status() const { return errorflag; } private: T **pages; // list of allocated pages @@ -208,27 +106,8 @@ class MyPage { int errorflag; // flag > 0 if error has occurred // 1 = chunk size exceeded maxchunk // 2 = memory allocation error - - void allocate() { - npage += pagedelta; - pages = (T **) realloc(pages,npage*sizeof(T *)); - if (!pages) { - errorflag = 2; - return; - } - - for (int i = npage-pagedelta; i < npage; i++) { -#if defined(LAMMPS_MEMALIGN) - void *ptr; - if (posix_memalign(&ptr, LAMMPS_MEMALIGN, pagesize*sizeof(T))) - errorflag = 2; - pages[i] = (T *) ptr; -#else - pages[i] = (T *) malloc(pagesize*sizeof(T)); - if (!pages[i]) errorflag = 2; -#endif - } - } + void allocate(); + void deallocate(); }; } diff --git a/src/my_pool_chunk.cpp b/src/my_pool_chunk.cpp new file mode 100644 index 0000000000..a8364f8d89 --- /dev/null +++ b/src/my_pool_chunk.cpp @@ -0,0 +1,228 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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 "my_pool_chunk.h" + +#include +#include + +#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) +#define LAMMPS_MEMALIGN 64 +#endif + +using namespace LAMMPS_NS; + +/** \class LAMMPS_NS::MyPoolChunk + * \brief Templated class for storing chunks of datums in pages + * + * The size of the chunk may vary from call to call between the + * *minchunk* and *maxchunk* setting. Chunks may be returned + * to the pool for re-use. Chunks can be reserved in *nbin* + * different sizes between *minchunk* and *maxchunk*. + * The *chunksperpage* setting specifies how many chunks are stored + * on any page and the *pagedelta* setting determines how many + * pages are allocated in one go. Pages are never freed, so they + * can be re-used without re-allocation. + * + * \note + * This is a template class with explicit instantiation. If the class + * is used with a new data type a new explicit instantiation may need + * to be added at the end of the file ``src/my_pool_chunk.cpp`` to + * avoid symbol lookup errors. */ + +/** Create a class instance and set memory pool parameters + * + * \param user_minchunk Minimal chunk size + * \param user_maxchunk Maximal chunk size + * \param user_nbin Number of bins of different chunk sizes + * \param user_chunkperpage Number of chunks per page + * \param user_pagedelta Number of pages to allocate in one go */ + +template +MyPoolChunk::MyPoolChunk(int user_minchunk, int user_maxchunk, int user_nbin, + int user_chunkperpage, int user_pagedelta) { + minchunk = user_minchunk; + maxchunk = user_maxchunk; + nbin = user_nbin; + chunkperpage = user_chunkperpage; + pagedelta = user_pagedelta; + + errorflag = 0; + if (minchunk <= 0 || minchunk > maxchunk) errorflag = 1; + if (user_nbin <= 0 || chunkperpage <= 0 || pagedelta <= 0) errorflag = 1; + + freehead = new int[nbin]; + chunksize = new int[nbin]; + if (!freehead || !chunksize) errorflag = 1; + if (errorflag) return; + + // insure nbin*binsize spans minchunk to maxchunk inclusive + + binsize = (maxchunk-minchunk+1) / nbin; + if (minchunk + nbin*binsize <= maxchunk) binsize++; + + freelist = nullptr; + for (int ibin = 0; ibin < nbin; ibin++) { + freehead[ibin] = -1; + chunksize[ibin] = minchunk + (ibin+1)*binsize - 1; + if (chunksize[ibin] > maxchunk) chunksize[ibin] = maxchunk; + } + + ndatum = nchunk = 0; + pages = nullptr; + whichbin = nullptr; + npage = 0; +} + +/** Destroy class instance and free all allocated memory */ +template +MyPoolChunk::~MyPoolChunk() { + delete [] freehead; + delete [] chunksize; + if (npage) { + free(freelist); + for (int i = 0; i < npage; i++) free(pages[i]); + free(pages); + free(whichbin); + } +} + +/** Return pointer/index of unused chunk of size maxchunk + * + * \param index Index of chunk in memory pool + * \return Pointer to requested chunk of storage */ + +template +T *MyPoolChunk::get(int &index) { + int ibin = nbin-1; + if (freehead[ibin] < 0) { + allocate(ibin); + if (errorflag) { + index = -1; + return nullptr; + } + } + + ndatum += maxchunk; + nchunk++; + index = freehead[ibin]; + int ipage = index/chunkperpage; + int ientry = index % chunkperpage; + freehead[ibin] = freelist[index]; + return &pages[ipage][ientry*chunksize[ibin]]; +} + +/** Return pointer/index of unused chunk of size N + * + * \param n Size of chunk + * \param index Index of chunk in memory pool + * \return Pointer to requested chunk of storage */ + +template +T *MyPoolChunk::get(int n, int &index) { + if (n < minchunk || n > maxchunk) { + errorflag = 3; + index = -1; + return nullptr; + } + + int ibin = (n-minchunk) / binsize; + if (freehead[ibin] < 0) { + allocate(ibin); + if (errorflag) { + index = -1; + return nullptr; + } + } + + ndatum += n; + nchunk++; + index = freehead[ibin]; + int ipage = index/chunkperpage; + int ientry = index % chunkperpage; + freehead[ibin] = freelist[index]; + return &pages[ipage][ientry*chunksize[ibin]]; +} + +/** Put indexed chunk back into memory pool via free list + * + * \param index Memory chunk index returned by call to get() */ + +template +void MyPoolChunk::put(int index) { + if (index < 0) return; + int ipage = index/chunkperpage; + int ibin = whichbin[ipage]; + nchunk--; + ndatum -= chunksize[ibin]; + freelist[index] = freehead[ibin]; + freehead[ibin] = index; + } + + +template +void MyPoolChunk::allocate(int ibin) { + int oldpage = npage; + npage += pagedelta; + freelist = (int *) realloc(freelist,npage*chunkperpage*sizeof(int)); + pages = (T **) realloc(pages,npage*sizeof(T *)); + whichbin = (int *) realloc(whichbin,npage*sizeof(int)); + if (!freelist || !pages) { + errorflag = 2; + return; + } + + // allocate pages with appropriate chunksize for ibin + + for (int i = oldpage; i < npage; i++) { + whichbin[i] = ibin; +#if defined(LAMMPS_MEMALIGN) + void *ptr; + if (posix_memalign(&ptr, LAMMPS_MEMALIGN, + chunkperpage*chunksize[ibin]*sizeof(T))) + errorflag = 2; + pages[i] = (T *) ptr; +#else + pages[i] = (T *) malloc(chunkperpage*chunksize[ibin]*sizeof(T)); + if (!pages[i]) errorflag = 2; +#endif + } + + // reset free list for unused chunks on new pages + + freehead[ibin] = oldpage*chunkperpage; + for (int i = freehead[ibin]; i < npage*chunkperpage; i++) freelist[i] = i+1; + freelist[npage*chunkperpage-1] = -1; +} + +/** Return total size of allocated pages + * + * \return total storage used in bytes */ + +template +double MyPoolChunk::size() const { + double bytes = npage*chunkperpage*sizeof(int); + bytes += npage*sizeof(T *); + bytes += npage*sizeof(int); + for (int i=0; i < npage; ++i) + bytes += chunkperpage*chunksize[i]*sizeof(T); + + return bytes; +} + +// explicit instantiations + +namespace LAMMPS_NS { + template class MyPoolChunk; + template class MyPoolChunk; +} diff --git a/src/my_pool_chunk.h b/src/my_pool_chunk.h index da196f5ec9..a9bcbd3e80 100644 --- a/src/my_pool_chunk.h +++ b/src/my_pool_chunk.h @@ -9,46 +9,11 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- -MyPoolChunk = templated class for storing chunks of datums in pages - chunks can be returned to pool for reuse - chunks come in nbin different fixed sizes so can reuse - replaces many small mallocs with a few large mallocs - pages are never freed, so can reuse w/out reallocs -usage: - continuously get() and put() chunks as needed - NOTE: could add a clear() if retain info on mapping of pages to bins -inputs: - template T = one datum, e.g. int, double, struct - minchunk = min # of datums in one chunk, def = 1 - maxchunk = max # of datums in one chunk, def = 1 - nbin = # of bins between minchunk and maxchunk - chunkperpage = # of chunks in one page, def = 1024 - pagedelta = # of pages to allocate at a time, def = 1 -methods: - T *get(index) = return ptr/index to unused chunk of size maxchunk - T *get(N,index) = return ptr/index to unused chunk of size N - minchunk <= N <= maxchunk required - put(index) = return indexed chunk to pool (same index returned by get) - int size() = return total size of allocated pages in bytes -public variables: - ndatum = total # of stored datums - nchunk = total # of stored chunks - size = total size of all allocated pages in daums - errorflag = flag for various error conditions -------------------------------------------------------------------------- */ + ------------------------------------------------------------------------- */ #ifndef LAMMPS_MY_POOL_CHUNK_H #define LAMMPS_MY_POOL_CHUNK_H -#if defined(LMP_USER_INTEL) && !defined(LAMMPS_MEMALIGN) && !defined(_WIN32) -#define LAMMPS_MEMALIGN 64 -#endif - -#include - namespace LAMMPS_NS { template @@ -56,113 +21,36 @@ class MyPoolChunk { public: int ndatum; // total # of stored datums int nchunk; // total # of stored chunks - int size; // total size of all allocated pages in datums - int errorflag; // flag > 1 if error has occurred - // 1 = invalid inputs - // 2 = memory allocation error - // 3 = chunk size exceeded maxchunk MyPoolChunk(int user_minchunk = 1, int user_maxchunk = 1, int user_nbin = 1, - int user_chunkperpage = 1024, int user_pagedelta = 1) { - minchunk = user_minchunk; - maxchunk = user_maxchunk; - nbin = user_nbin; - chunkperpage = user_chunkperpage; - pagedelta = user_pagedelta; - - errorflag = 0; - if (minchunk <= 0 || minchunk > maxchunk) errorflag = 1; - if (user_nbin <= 0 || chunkperpage <= 0 || pagedelta <= 0) errorflag = 1; - - freehead = new int[nbin]; - chunksize = new int[nbin]; - if (!freehead || !chunksize) errorflag = 1; - if (errorflag) return; - - // insure nbin*binsize spans minchunk to maxchunk inclusive - - binsize = (maxchunk-minchunk+1) / nbin; - if (minchunk + nbin*binsize <= maxchunk) binsize++; - - freelist = NULL; - for (int ibin = 0; ibin < nbin; ibin++) { - freehead[ibin] = -1; - chunksize[ibin] = minchunk + (ibin+1)*binsize - 1; - if (chunksize[ibin] > maxchunk) chunksize[ibin] = maxchunk; - } - - ndatum = nchunk = size = 0; - pages = NULL; - whichbin = NULL; - npage = 0; - } + int user_chunkperpage = 1024, int user_pagedelta = 1); // free all allocated memory - ~MyPoolChunk() { - delete [] freehead; - delete [] chunksize; - if (npage) { - free(freelist); - for (int i = 0; i < npage; i++) free(pages[i]); - free(pages); - free(whichbin); - } - } + ~MyPoolChunk(); // return pointer/index of unused chunk of size maxchunk - T *get(int &index) { - int ibin = nbin-1; - if (freehead[ibin] < 0) { - allocate(ibin); - if (errorflag) return NULL; - } - - ndatum += maxchunk; - nchunk++; - index = freehead[ibin]; - int ipage = index/chunkperpage; - int ientry = index % chunkperpage; - freehead[ibin] = freelist[index]; - return &pages[ipage][ientry*chunksize[ibin]]; - } + T *get(int &index); // return pointer/index of unused chunk of size N - T *get(int n, int &index) { - if (n < minchunk || n > maxchunk) { - errorflag = 3; - return NULL; - } - - int ibin = (n-minchunk) / binsize; - if (freehead[ibin] < 0) { - allocate(ibin); - if (errorflag) return NULL; - } - - ndatum += n; - nchunk++; - index = freehead[ibin]; - int ipage = index/chunkperpage; - int ientry = index % chunkperpage; - freehead[ibin] = freelist[index]; - return &pages[ipage][ientry*chunksize[ibin]]; - } + T *get(int n, int &index); // return indexed chunk to pool via free list // index = -1 if no allocated chunk - void put(int index) { - if (index < 0) return; - int ipage = index/chunkperpage; - int ibin = whichbin[ipage]; - nchunk--; - ndatum -= chunksize[ibin]; - freelist[index] = freehead[ibin]; - freehead[ibin] = index; - } + void put(int index); + + // total memory used in bytes + + double size() const; + + /** Return error status + * + * \return 0 if no error, 1 if invalid input, 2 if malloc() failed, 3 if chunk > maxchunk */ + + int status() const { return errorflag; } private: int minchunk; // min # of datums per chunk @@ -171,6 +59,10 @@ class MyPoolChunk { int chunkperpage; // # of chunks on every page, regardless of which bin int pagedelta; // # of pages to allocate at once, default = 1 int binsize; // delta in chunk sizes between adjacent bins + int errorflag; // flag > 0 if error has occurred + // 1 = invalid inputs + // 2 = memory allocation error + // 3 = chunk size exceeded maxchunk T **pages; // list of allocated pages int *whichbin; // which bin each page belongs to @@ -179,42 +71,7 @@ class MyPoolChunk { int *freehead; // index of first unused chunk in each bin int *chunksize; // size of chunks in each bin - void allocate(int ibin) { - int oldpage = npage; - npage += pagedelta; - freelist = (int *) realloc(freelist,npage*chunkperpage*sizeof(int)); - pages = (T **) realloc(pages,npage*sizeof(T *)); - whichbin = (int *) realloc(whichbin,npage*sizeof(int)); - if (!freelist || !pages) { - errorflag = 2; - return; - } - - // allocate pages with appropriate chunksize for ibin - - for (int i = oldpage; i < npage; i++) { - whichbin[i] = ibin; -#if defined(LAMMPS_MEMALIGN) - void *ptr; - if (posix_memalign(&ptr, LAMMPS_MEMALIGN, - chunkperpage*chunksize[ibin]*sizeof(T))) - errorflag = 2; - pages[i] = (T *) ptr; -#else - pages[i] = (T *) malloc(chunkperpage*chunksize[ibin]*sizeof(T)); - size += chunkperpage*chunksize[ibin]; - if (!pages[i]) errorflag = 2; -#endif - } - - // reset free list for unused chunks on new pages - - freehead[ibin] = oldpage*chunkperpage; - for (int i = freehead[ibin]; i < npage*chunkperpage; i++) freelist[i] = i+1; - freelist[npage*chunkperpage-1] = -1; - } + void allocate(int ibin); }; - } - #endif diff --git a/src/neigh_list.h b/src/neigh_list.h index 501188a724..c26b008136 100644 --- a/src/neigh_list.h +++ b/src/neigh_list.h @@ -14,7 +14,7 @@ #ifndef LMP_NEIGH_LIST_H #define LMP_NEIGH_LIST_H -#include "pointers.h" +#include "pointers.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 70333461ba..66ab92496a 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -16,38 +16,37 @@ ------------------------------------------------------------------------- */ #include "neighbor.h" -#include -#include -#include -#include "neigh_list.h" -#include "neigh_request.h" -#include "nbin.h" -#include "nstencil.h" -#include "npair.h" -#include "ntopo.h" -#include "style_nbin.h" -#include "style_nstencil.h" -#include "style_npair.h" -#include "style_ntopo.h" + #include "atom.h" #include "atom_vec.h" +#include "citeme.h" #include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "fix.h" #include "force.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "nbin.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "npair.h" +#include "nstencil.h" +#include "ntopo.h" +#include "output.h" #include "pair.h" #include "pair_hybrid.h" -#include "domain.h" -#include "group.h" -#include "modify.h" -#include "fix.h" -#include "compute.h" -#include "update.h" #include "respa.h" -#include "output.h" -#include "citeme.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "style_nbin.h" +#include "style_npair.h" +#include "style_nstencil.h" +#include "style_ntopo.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace NeighConst; @@ -2194,7 +2193,7 @@ void Neighbor::set(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal neighbor command"); - skin = force->numeric(FLERR,arg[0]); + skin = utils::numeric(FLERR,arg[0],false,lmp); if (skin < 0.0) error->all(FLERR,"Illegal neighbor command"); if (strcmp(arg[1],"nsq") == 0) style = Neighbor::NSQ; @@ -2236,12 +2235,12 @@ void Neighbor::modify_params(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - every = force->inumeric(FLERR,arg[iarg+1]); + every = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (every <= 0) error->all(FLERR,"Illegal neigh_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"delay") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - delay = force->inumeric(FLERR,arg[iarg+1]); + delay = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (delay < 0) error->all(FLERR,"Illegal neigh_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"check") == 0) { @@ -2259,16 +2258,16 @@ void Neighbor::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"page") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); old_pgsize = pgsize; - pgsize = force->inumeric(FLERR,arg[iarg+1]); + pgsize = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"one") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); old_oneatom = oneatom; - oneatom = force->inumeric(FLERR,arg[iarg+1]); + oneatom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"binsize") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal neigh_modify command"); - binsize_user = force->numeric(FLERR,arg[iarg+1]); + binsize_user = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (binsize_user <= 0.0) binsizeflag = 0; else binsizeflag = 1; iarg += 2; @@ -2300,8 +2299,8 @@ void Neighbor::modify_params(int narg, char **arg) memory->grow(ex1_type,maxex_type,"neigh:ex1_type"); memory->grow(ex2_type,maxex_type,"neigh:ex2_type"); } - ex1_type[nex_type] = force->inumeric(FLERR,arg[iarg+2]); - ex2_type[nex_type] = force->inumeric(FLERR,arg[iarg+3]); + ex1_type[nex_type] = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + ex2_type[nex_type] = utils::inumeric(FLERR,arg[iarg+3],false,lmp); nex_type++; iarg += 4; diff --git a/src/ntopo.cpp b/src/ntopo.cpp index ca63b85328..d4ddcc7fc0 100644 --- a/src/ntopo.cpp +++ b/src/ntopo.cpp @@ -12,13 +12,13 @@ ------------------------------------------------------------------------- */ #include "ntopo.h" -#include + #include "atom.h" -#include "neighbor.h" #include "comm.h" #include "domain.h" -#include "memory.h" #include "error.h" +#include "memory.h" +#include "neighbor.h" using namespace LAMMPS_NS; diff --git a/src/ntopo_angle_all.cpp b/src/ntopo_angle_all.cpp index 71521e6891..21ac894d92 100644 --- a/src/ntopo_angle_all.cpp +++ b/src/ntopo_angle_all.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_angle_all.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_angle_partial.cpp b/src/ntopo_angle_partial.cpp index c72073718e..583339ed11 100644 --- a/src/ntopo_angle_partial.cpp +++ b/src/ntopo_angle_partial.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_angle_partial.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_angle_template.cpp b/src/ntopo_angle_template.cpp index d6303a0ad4..17e17ca462 100644 --- a/src/ntopo_angle_template.cpp +++ b/src/ntopo_angle_template.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_angle_template.h" -#include + #include "atom.h" #include "atom_vec.h" #include "force.h" @@ -23,7 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_bond_all.cpp b/src/ntopo_bond_all.cpp index 9fac01bdba..20ec5aa290 100644 --- a/src/ntopo_bond_all.cpp +++ b/src/ntopo_bond_all.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_bond_all.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_bond_partial.cpp b/src/ntopo_bond_partial.cpp index 138f8f4330..9b5914b2c8 100644 --- a/src/ntopo_bond_partial.cpp +++ b/src/ntopo_bond_partial.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_bond_partial.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_bond_template.cpp b/src/ntopo_bond_template.cpp index a651715320..88a31460d9 100644 --- a/src/ntopo_bond_template.cpp +++ b/src/ntopo_bond_template.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_bond_template.h" -#include + #include "atom.h" #include "atom_vec.h" #include "force.h" @@ -23,7 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_dihedral_all.cpp b/src/ntopo_dihedral_all.cpp index 81193605c1..bcfe8ce712 100644 --- a/src/ntopo_dihedral_all.cpp +++ b/src/ntopo_dihedral_all.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_dihedral_all.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_dihedral_partial.cpp b/src/ntopo_dihedral_partial.cpp index 855fa800b6..31a78c5c48 100644 --- a/src/ntopo_dihedral_partial.cpp +++ b/src/ntopo_dihedral_partial.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_dihedral_partial.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_dihedral_template.cpp b/src/ntopo_dihedral_template.cpp index 06fac50400..0d2a9451e0 100644 --- a/src/ntopo_dihedral_template.cpp +++ b/src/ntopo_dihedral_template.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_dihedral_template.h" -#include + #include "atom.h" #include "atom_vec.h" #include "force.h" @@ -23,7 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_improper_all.cpp b/src/ntopo_improper_all.cpp index e839e9161b..53f229a86a 100644 --- a/src/ntopo_improper_all.cpp +++ b/src/ntopo_improper_all.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_improper_all.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_improper_partial.cpp b/src/ntopo_improper_partial.cpp index c4c6ec3177..8fc619c9e4 100644 --- a/src/ntopo_improper_partial.cpp +++ b/src/ntopo_improper_partial.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_improper_partial.h" -#include + #include "atom.h" #include "force.h" #include "domain.h" @@ -21,7 +21,7 @@ #include "thermo.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/ntopo_improper_template.cpp b/src/ntopo_improper_template.cpp index 060ba173fd..bd19d5877c 100644 --- a/src/ntopo_improper_template.cpp +++ b/src/ntopo_improper_template.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "ntopo_improper_template.h" -#include + #include "atom.h" #include "atom_vec.h" #include "force.h" @@ -23,7 +23,7 @@ #include "molecule.h" #include "memory.h" #include "error.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; diff --git a/src/output.cpp b/src/output.cpp index 6051e04055..6c90198de4 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -12,27 +12,25 @@ ------------------------------------------------------------------------- */ #include "output.h" -#include -#include -#include -#include "style_dump.h" +#include "style_dump.h" // IWYU pragma: keep + #include "atom.h" -#include "neighbor.h" -#include "input.h" -#include "variable.h" #include "comm.h" -#include "update.h" -#include "group.h" #include "domain.h" -#include "thermo.h" -#include "modify.h" -#include "force.h" #include "dump.h" -#include "write_restart.h" -#include "memory.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "force.h" +#include "group.h" +#include "input.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "thermo.h" +#include "update.h" +#include "variable.h" +#include "write_restart.h" + +#include using namespace LAMMPS_NS; @@ -81,7 +79,7 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp) #define DUMP_CLASS #define DumpStyle(key,Class) \ (*dump_map)[#key] = &dump_creator; -#include "style_dump.h" +#include "style_dump.h" // IWYU pragma: keep #undef DumpStyle #undef DUMP_CLASS } @@ -541,7 +539,7 @@ void Output::add_dump(int narg, char **arg) error->all(FLERR,"Reuse of dump ID"); int igroup = group->find(arg[1]); if (igroup == -1) error->all(FLERR,"Could not find dump group ID"); - if (force->inumeric(FLERR,arg[3]) <= 0) + if (utils::inumeric(FLERR,arg[3],false,lmp) <= 0) error->all(FLERR,"Invalid dump frequency"); // extend Dump list if necessary @@ -572,7 +570,7 @@ void Output::add_dump(int narg, char **arg) dump[ndump] = dump_creator(lmp, narg, arg); } else error->all(FLERR,utils::check_packages_for_style("dump",arg[2],lmp)); - every_dump[ndump] = force->inumeric(FLERR,arg[3]); + every_dump[ndump] = utils::inumeric(FLERR,arg[3],false,lmp); if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command"); last_dump[ndump] = -1; var_dump[ndump] = NULL; @@ -670,7 +668,7 @@ void Output::set_thermo(int narg, char **arg) var_thermo = new char[n]; strcpy(var_thermo,&arg[0][2]); } else { - thermo_every = force->inumeric(FLERR,arg[0]); + thermo_every = utils::inumeric(FLERR,arg[0],false,lmp); if (thermo_every < 0) error->all(FLERR,"Illegal thermo command"); } } @@ -714,7 +712,7 @@ void Output::create_restart(int narg, char **arg) int varflag = 0; if (strstr(arg[0],"v_") == arg[0]) varflag = 1; - else every = force->inumeric(FLERR,arg[0]); + else every = utils::inumeric(FLERR,arg[0],false,lmp); if (!varflag && every == 0) { if (narg != 1) error->all(FLERR,"Illegal restart command"); diff --git a/src/output.h b/src/output.h index 1bf4128ee0..06be7b244a 100644 --- a/src/output.h +++ b/src/output.h @@ -15,11 +15,13 @@ #define LMP_OUTPUT_H #include "pointers.h" + #include -#include namespace LAMMPS_NS { +class Dump; + class Output : protected Pointers { public: bigint next; // next timestep for any kind of output @@ -39,7 +41,7 @@ class Output : protected Pointers { bigint *last_dump; // last timestep each snapshot was output char **var_dump; // variable name for dump frequency int *ivar_dump; // variable index for dump frequency - class Dump **dump; // list of defined Dumps + Dump **dump; // list of defined Dumps int restart_flag; // 1 if any restart files are written int restart_flag_single; // 1 if single restart files are written diff --git a/src/pair.cpp b/src/pair.cpp index db9792cdbc..d869bbe8d8 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -16,28 +16,26 @@ ------------------------------------------------------------------------- */ #include "pair.h" -#include + +#include "atom.h" +#include "atom_masks.h" +#include "comm.h" +#include "compute.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "kspace.h" +#include "math_const.h" +#include "memory.h" +#include "neighbor.h" +#include "suffix.h" +#include "update.h" + #include // IWYU pragma: keep #include // IWYU pragma: keep #include #include #include -#include -#include "atom.h" -#include "neighbor.h" -#include "domain.h" -#include "comm.h" -#include "force.h" -#include "kspace.h" -#include "compute.h" -#include "suffix.h" -#include "atom_masks.h" -#include "memory.h" -#include "math_const.h" -#include "error.h" -#include "update.h" -#include "utils.h" -#include "fmt/format.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -161,23 +159,23 @@ void Pair::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"table") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - ncoultablebits = force->inumeric(FLERR,arg[iarg+1]); + ncoultablebits = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (ncoultablebits > (int)sizeof(float)*CHAR_BIT) error->all(FLERR,"Too many total bits for bitmapped lookup table"); iarg += 2; } else if (strcmp(arg[iarg],"table/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - ndisptablebits = force->inumeric(FLERR,arg[iarg+1]); + ndisptablebits = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (ndisptablebits > (int)sizeof(float)*CHAR_BIT) error->all(FLERR,"Too many total bits for bitmapped lookup table"); iarg += 2; } else if (strcmp(arg[iarg],"tabinner") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - tabinner = force->numeric(FLERR,arg[iarg+1]); + tabinner = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"tabinner/disp") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); - tabinner_disp = force->numeric(FLERR,arg[iarg+1]); + tabinner_disp = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"tail") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal pair_modify command"); @@ -1622,12 +1620,12 @@ void Pair::write_file(int narg, char **arg) // parse arguments - int itype = force->inumeric(FLERR,arg[0]); - int jtype = force->inumeric(FLERR,arg[1]); + int itype = utils::inumeric(FLERR,arg[0],false,lmp); + int jtype = utils::inumeric(FLERR,arg[1],false,lmp); if (itype < 1 || itype > atom->ntypes || jtype < 1 || jtype > atom->ntypes) error->all(FLERR,"Invalid atom types in pair_write command"); - int n = force->inumeric(FLERR,arg[2]); + int n = utils::inumeric(FLERR,arg[2],false,lmp); int style = NONE; if (strcmp(arg[3],"r") == 0) style = RLINEAR; @@ -1635,8 +1633,8 @@ void Pair::write_file(int narg, char **arg) else if (strcmp(arg[3],"bitmap") == 0) style = BMP; else error->all(FLERR,"Invalid style in pair_write command"); - double inner = force->numeric(FLERR,arg[4]); - double outer = force->numeric(FLERR,arg[5]); + double inner = utils::numeric(FLERR,arg[4],false,lmp); + double outer = utils::numeric(FLERR,arg[5],false,lmp); if (inner <= 0.0 || inner >= outer) error->all(FLERR,"Invalid cutoffs in pair_write command"); @@ -1709,8 +1707,8 @@ void Pair::write_file(int narg, char **arg) double q[2]; q[0] = q[1] = 1.0; if (narg == 10) { - q[0] = force->numeric(FLERR,arg[8]); - q[1] = force->numeric(FLERR,arg[9]); + q[0] = utils::numeric(FLERR,arg[8],false,lmp); + q[1] = utils::numeric(FLERR,arg[9],false,lmp); } double *q_hold; diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index 6085398d4c..87aa0bab5f 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_beck.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "memory.h" #include "error.h" #include "math_special.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathSpecial; @@ -176,7 +176,7 @@ void PairBeck::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -199,17 +199,17 @@ void PairBeck::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double AA_one = force->numeric(FLERR,arg[2]); - double BB_one = force->numeric(FLERR,arg[3]); - double aa_one = force->numeric(FLERR,arg[4]); - double alpha_one = force->numeric(FLERR,arg[5]); - double beta_one = force->numeric(FLERR,arg[6]); + double AA_one = utils::numeric(FLERR,arg[2],false,lmp); + double BB_one = utils::numeric(FLERR,arg[3],false,lmp); + double aa_one = utils::numeric(FLERR,arg[4],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[5],false,lmp); + double beta_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_one = cut_global; - if (narg == 8) cut_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_born.cpp b/src/pair_born.cpp index b0aba57df5..5b0d3a6562 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_born.h" -#include + #include #include #include "atom.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -177,7 +177,7 @@ void PairBorn::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -199,18 +199,18 @@ void PairBorn::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[5]); - double d_one = force->numeric(FLERR,arg[6]); + double c_one = utils::numeric(FLERR,arg[5],false,lmp); + double d_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_one = cut_global; - if (narg == 8) cut_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp index 3e8c76696b..e4617b5c4b 100644 --- a/src/pair_born_coul_dsf.cpp +++ b/src/pair_born_coul_dsf.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_born_coul_dsf.h" -#include + #include #include "atom.h" #include "comm.h" @@ -28,7 +28,7 @@ #include "memory.h" #include "error.h" #include "math_special.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -216,10 +216,10 @@ void PairBornCoulDSF::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - alpha = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); + alpha = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); if (allocated) { int i,j; @@ -240,18 +240,18 @@ void PairBornCoulDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[5]); - double d_one = force->numeric(FLERR,arg[6]); + double c_one = utils::numeric(FLERR,arg[5],false,lmp); + double d_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 8) cut_lj_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_lj_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index dc4e4b8e3f..30fe8fcde9 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_born_coul_wolf.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -219,10 +219,10 @@ void PairBornCoulWolf::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - alf = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); + alf = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); if (allocated) { int i,j; @@ -243,18 +243,18 @@ void PairBornCoulWolf::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); - double sigma_one = force->numeric(FLERR,arg[4]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[4],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[5]); - double d_one = force->numeric(FLERR,arg[6]); + double c_one = utils::numeric(FLERR,arg[5],false,lmp); + double d_one = utils::numeric(FLERR,arg[6],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 8) cut_lj_one = force->numeric(FLERR,arg[7]); + if (narg == 8) cut_lj_one = utils::numeric(FLERR,arg[7],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 6fc1c782e0..1abdbcc68b 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_buck.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -169,7 +169,7 @@ void PairBuck::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -192,16 +192,16 @@ void PairBuck::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[4]); + double c_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index de36b58df2..9fac17aede 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_buck_coul_cut.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -197,9 +197,9 @@ void PairBuckCoulCut::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[1]); + else cut_coul_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -225,18 +225,18 @@ void PairBuckCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double rho_one = force->numeric(FLERR,arg[3]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double rho_one = utils::numeric(FLERR,arg[3],false,lmp); if (rho_one <= 0) error->all(FLERR,"Incorrect args for pair coefficients"); - double c_one = force->numeric(FLERR,arg[4]); + double c_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 6) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[5]); - if (narg == 7) cut_coul_one = force->numeric(FLERR,arg[6]); + if (narg >= 6) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[5],false,lmp); + if (narg == 7) cut_coul_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index a197955085..67c471a5e3 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_cut.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -149,7 +149,7 @@ void PairCoulCut::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -172,11 +172,11 @@ void PairCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; - if (narg == 3) cut_one = force->numeric(FLERR,arg[2]); + if (narg == 3) cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_coul_debye.cpp b/src/pair_coul_debye.cpp index b45353837a..2093718245 100644 --- a/src/pair_coul_debye.cpp +++ b/src/pair_coul_debye.cpp @@ -12,14 +12,14 @@ ------------------------------------------------------------------------- */ #include "pair_coul_debye.h" -#include + #include #include "atom.h" #include "comm.h" #include "force.h" #include "neigh_list.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -114,8 +114,8 @@ void PairCoulDebye::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - kappa = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + kappa = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index 992ee33ecb..ee124c7f59 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_dsf.h" -#include + #include #include #include "atom.h" @@ -28,7 +28,7 @@ #include "memory.h" #include "math_const.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -171,8 +171,8 @@ void PairCoulDSF::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - alpha = force->numeric(FLERR,arg[0]); - cut_coul = force->numeric(FLERR,arg[1]); + alpha = utils::numeric(FLERR,arg[0],false,lmp); + cut_coul = utils::numeric(FLERR,arg[1],false,lmp); } /* ---------------------------------------------------------------------- @@ -185,8 +185,8 @@ void PairCoulDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 5b7d7ea08a..e538275b3c 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -16,23 +16,22 @@ ------------------------------------------------------------------------- */ #include "pair_coul_streitz.h" -#include -#include -#include -#include + #include "atom.h" #include "comm.h" +#include "error.h" #include "force.h" #include "kspace.h" -#include "neighbor.h" -#include "neigh_list.h" -#include "neigh_request.h" #include "math_const.h" #include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" #include "potential_file_reader.h" +#include "tokenizer.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -112,11 +111,11 @@ void PairCoulStreitz::settings(int narg, char **arg) { if (narg < 2) error->all(FLERR,"Illegal pair_style command"); - cut_coul = force->numeric(FLERR,arg[0]); + cut_coul = utils::numeric(FLERR,arg[0],false,lmp); if (strcmp(arg[1],"wolf") == 0){ kspacetype = 1; - g_wolf = force->numeric(FLERR,arg[2]); + g_wolf = utils::numeric(FLERR,arg[2],false,lmp); } else if (strcmp(arg[1],"ewald") == 0){ ewaldflag = pppmflag = 1; kspacetype = 2; diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index b34877f508..e3079dcaf6 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_coul_wolf.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -172,8 +172,8 @@ void PairCoulWolf::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - alf = force->numeric(FLERR,arg[0]); - cut_coul = force->numeric(FLERR,arg[1]); + alf = utils::numeric(FLERR,arg[0],false,lmp); + cut_coul = utils::numeric(FLERR,arg[1],false,lmp); } /* ---------------------------------------------------------------------- @@ -186,8 +186,8 @@ void PairCoulWolf::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_deprecated.cpp b/src/pair_deprecated.cpp index 75cb7efcdf..046726892e 100644 --- a/src/pair_deprecated.cpp +++ b/src/pair_deprecated.cpp @@ -16,12 +16,12 @@ ------------------------------------------------------------------------- */ #include "pair_deprecated.h" -#include + #include "pair_hybrid.h" #include "comm.h" #include "force.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index ef0b7dd21d..d0d9b98fc9 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_dpd.h" -#include + #include #include "atom.h" #include "comm.h" @@ -27,7 +27,7 @@ #include "random_mars.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -190,9 +190,9 @@ void PairDPD::settings(int narg, char **arg) { if (narg != 3) error->all(FLERR,"Illegal pair_style command"); - temperature = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); - seed = force->inumeric(FLERR,arg[2]); + temperature = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); + seed = utils::inumeric(FLERR,arg[2],false,lmp); // initialize Marsaglia RNG with processor-unique seed @@ -221,14 +221,14 @@ void PairDPD::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a0_one = force->numeric(FLERR,arg[2]); - double gamma_one = force->numeric(FLERR,arg[3]); + double a0_one = utils::numeric(FLERR,arg[2],false,lmp); + double gamma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index 8366ff459f..dd0e144953 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_dpd_tstat.h" -#include + #include #include "atom.h" #include "update.h" @@ -21,7 +21,7 @@ #include "comm.h" #include "random_mars.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -142,10 +142,10 @@ void PairDPDTstat::settings(int narg, char **arg) { if (narg != 4) error->all(FLERR,"Illegal pair_style command"); - t_start = force->numeric(FLERR,arg[0]); - t_stop = force->numeric(FLERR,arg[1]); - cut_global = force->numeric(FLERR,arg[2]); - seed = force->inumeric(FLERR,arg[3]); + t_start = utils::numeric(FLERR,arg[0],false,lmp); + t_stop = utils::numeric(FLERR,arg[1],false,lmp); + cut_global = utils::numeric(FLERR,arg[2],false,lmp); + seed = utils::inumeric(FLERR,arg[3],false,lmp); temperature = t_start; @@ -176,14 +176,14 @@ void PairDPDTstat::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double a0_one = 0.0; - double gamma_one = force->numeric(FLERR,arg[2]); + double gamma_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index dcc3ac5f51..6732296764 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_gauss.h" -#include + #include #include #include "atom.h" @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -164,7 +164,7 @@ void PairGauss::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -187,14 +187,14 @@ void PairGauss::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); - double b_one = force->numeric(FLERR,arg[3]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); + double b_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 646ddefc3e..0b1882f12b 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -13,7 +13,7 @@ ------------------------------------------------------------------------- */ #include "pair_hybrid.h" -#include + #include #include #include "atom.h" @@ -26,9 +26,9 @@ #include "memory.h" #include "error.h" #include "respa.h" -#include "utils.h" + #include "suffix.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; @@ -438,8 +438,8 @@ void PairHybrid::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // 3rd arg = pair sub-style name // 4th arg = pair sub-style index if name used multiple times @@ -456,7 +456,7 @@ void PairHybrid::coeff(int narg, char **arg) if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!isdigit(arg[3][0])) error->all(FLERR,"Incorrect args for pair coefficients"); - int index = force->inumeric(FLERR,arg[3]); + int index = utils::inumeric(FLERR,arg[3],false,lmp); if (index == multiple[m]) break; else continue; } else break; @@ -864,7 +864,7 @@ void PairHybrid::modify_params(int narg, char **arg) if (multiple[m]) { if (narg < 3) error->all(FLERR,"Illegal pair_modify command"); - int multiflag = force->inumeric(FLERR,arg[2]); + int multiflag = utils::inumeric(FLERR,arg[2],false,lmp); for (m = 0; m < nstyles; m++) if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break; if (m == nstyles) @@ -934,9 +934,9 @@ void PairHybrid::modify_special(int m, int /*narg*/, char **arg) int i; special[0] = 1.0; - special[1] = force->numeric(FLERR,arg[1]); - special[2] = force->numeric(FLERR,arg[2]); - special[3] = force->numeric(FLERR,arg[3]); + special[1] = utils::numeric(FLERR,arg[1],false,lmp); + special[2] = utils::numeric(FLERR,arg[2],false,lmp); + special[3] = utils::numeric(FLERR,arg[3],false,lmp); // have to cast to PairHybrid to work around C++ access restriction diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 4c2acfe8ba..34c4cfe418 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "pair_hybrid_overlay.h" + +#include "atom.h" +#include "error.h" + #include #include -#include "atom.h" -#include "force.h" -#include "error.h" using namespace LAMMPS_NS; @@ -34,8 +35,8 @@ void PairHybridOverlay::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // 3rd arg = pair sub-style name // 4th arg = pair sub-style index if name used multiple times @@ -52,7 +53,7 @@ void PairHybridOverlay::coeff(int narg, char **arg) if (narg < 4) error->all(FLERR,"Incorrect args for pair coefficients"); if (!isdigit(arg[3][0])) error->all(FLERR,"Incorrect args for pair coefficients"); - int index = force->inumeric(FLERR,arg[3]); + int index = utils::inumeric(FLERR,arg[3],false,lmp); if (index == multiple[m]) break; else continue; } else break; diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index 8be6fefa44..a4ba3b8585 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj96_cut.h" -#include + #include #include #include "atom.h" @@ -30,7 +30,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -433,7 +433,7 @@ void PairLJ96Cut::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -456,14 +456,14 @@ void PairLJ96Cut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index 366554178f..b6c91cafe2 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cubic.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace PairLJCubicConstants; @@ -192,11 +192,11 @@ void PairLJCubic::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double rmin = sigma_one*RT6TWO; int count = 0; diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index 60bb7bceee..bd42801f3b 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut.h" -#include + #include #include #include "atom.h" @@ -30,7 +30,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -427,7 +427,7 @@ void PairLJCut::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -450,14 +450,14 @@ void PairLJCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 7f0f89a5bf..669d48c860 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_cut.h" -#include + #include #include #include "atom.h" @@ -23,7 +23,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -189,9 +189,9 @@ void PairLJCutCoulCut::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Illegal pair_style command"); - cut_lj_global = force->numeric(FLERR,arg[0]); + cut_lj_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 1) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[1]); + else cut_coul_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -217,16 +217,16 @@ void PairLJCutCoulCut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; double cut_coul_one = cut_coul_global; - if (narg >= 5) cut_coul_one = cut_lj_one = force->numeric(FLERR,arg[4]); - if (narg == 6) cut_coul_one = force->numeric(FLERR,arg[5]); + if (narg >= 5) cut_coul_one = cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); + if (narg == 6) cut_coul_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_cut_coul_debye.cpp b/src/pair_lj_cut_coul_debye.cpp index a65d7aa50f..3ddb898c8f 100644 --- a/src/pair_lj_cut_coul_debye.cpp +++ b/src/pair_lj_cut_coul_debye.cpp @@ -12,14 +12,14 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_debye.h" -#include + #include #include "atom.h" #include "neigh_list.h" #include "force.h" #include "comm.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -133,10 +133,10 @@ void PairLJCutCoulDebye::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - kappa = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); + kappa = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul_global = cut_lj_global; - else cut_coul_global = force->numeric(FLERR,arg[2]); + else cut_coul_global = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that were previously set from data file diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index 9dc6c001f4..952a140039 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -17,7 +17,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_dsf.h" -#include + #include #include #include "atom.h" @@ -28,7 +28,7 @@ #include "memory.h" #include "math_const.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -214,10 +214,10 @@ void PairLJCutCoulDSF::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - alpha = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); + alpha = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) cut_coul = cut_lj_global; - else cut_coul = force->numeric(FLERR,arg[2]); + else cut_coul = utils::numeric(FLERR,arg[2],false,lmp); // reset cutoffs that have been explicitly set @@ -241,14 +241,14 @@ void PairLJCutCoulDSF::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp index 303d9a88bb..749cc9e6a9 100644 --- a/src/pair_lj_cut_coul_wolf.cpp +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_cut_coul_wolf.h" -#include + #include #include "atom.h" #include "comm.h" @@ -26,7 +26,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -212,9 +212,9 @@ void PairLJCutCoulWolf::settings(int narg, char **arg) { if (narg < 2 || narg > 3) error->all(FLERR,"Illegal pair_style command"); - alf = force->numeric(FLERR,arg[0]); - cut_lj_global = force->numeric(FLERR,arg[1]); - if (narg == 3) cut_coul = force->numeric(FLERR,arg[2]); + alf = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj_global = utils::numeric(FLERR,arg[1],false,lmp); + if (narg == 3) cut_coul = utils::numeric(FLERR,arg[2],false,lmp); else cut_coul = cut_lj_global; if (allocated) { @@ -236,14 +236,14 @@ void PairLJCutCoulWolf::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_lj_one = cut_lj_global; - if (narg == 5) cut_lj_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_lj_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index 98c8a808e2..3f711e2a15 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_expand.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -172,7 +172,7 @@ void PairLJExpand::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -194,15 +194,15 @@ void PairLJExpand::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double shift_one = force->numeric(FLERR,arg[4]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double shift_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index 73f4307d62..0818c60f31 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_gromacs.h" -#include + #include #include "atom.h" #include "comm.h" @@ -24,7 +24,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -190,8 +190,8 @@ void PairLJGromacs::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_inner_global = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + cut_inner_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); if (cut_inner_global <= 0.0 || cut_inner_global > cut_global) error->all(FLERR,"Illegal pair_style command"); @@ -220,17 +220,17 @@ void PairLJGromacs::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 6) { - cut_inner_one = force->numeric(FLERR,arg[4]); - cut_one = force->numeric(FLERR,arg[5]); + cut_inner_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_one = utils::numeric(FLERR,arg[5],false,lmp); } if (cut_inner_one <= 0.0 || cut_inner_one > cut_one) diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index a5663ecfd8..005bc44061 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_gromacs_coul_gromacs.h" -#include + #include #include "atom.h" #include "comm.h" @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -220,14 +220,14 @@ void PairLJGromacsCoulGromacs::settings(int narg, char **arg) if (narg != 2 && narg != 4) error->all(FLERR,"Illegal pair_style command"); - cut_lj_inner = force->numeric(FLERR,arg[0]); - cut_lj = force->numeric(FLERR,arg[1]); + cut_lj_inner = utils::numeric(FLERR,arg[0],false,lmp); + cut_lj = utils::numeric(FLERR,arg[1],false,lmp); if (narg == 2) { cut_coul_inner = cut_lj_inner; cut_coul = cut_lj; } else { - cut_coul_inner = force->numeric(FLERR,arg[2]); - cut_coul = force->numeric(FLERR,arg[3]); + cut_coul_inner = utils::numeric(FLERR,arg[2],false,lmp); + cut_coul = utils::numeric(FLERR,arg[3],false,lmp); } if (cut_lj_inner <= 0.0 || cut_coul_inner < 0.0) @@ -246,11 +246,11 @@ void PairLJGromacsCoulGromacs::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index bf97a44732..a53d703b8b 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_smooth.h" -#include + #include #include "atom.h" #include "comm.h" @@ -24,7 +24,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -195,8 +195,8 @@ void PairLJSmooth::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_inner_global = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + cut_inner_global = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); if (cut_inner_global <= 0.0 || cut_inner_global > cut_global) error->all(FLERR,"Illegal pair_style command"); @@ -225,17 +225,17 @@ void PairLJSmooth::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_inner_one = cut_inner_global; double cut_one = cut_global; if (narg == 6) { - cut_inner_one = force->numeric(FLERR,arg[4]); - cut_one = force->numeric(FLERR,arg[5]); + cut_inner_one = utils::numeric(FLERR,arg[4],false,lmp); + cut_one = utils::numeric(FLERR,arg[5],false,lmp); } if (cut_inner_one <= 0.0 || cut_inner_one > cut_one) diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 19e84f971d..3697208d42 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_lj_smooth_linear.h" -#include + #include #include "atom.h" #include "comm.h" @@ -24,7 +24,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -170,7 +170,7 @@ void PairLJSmoothLinear::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -194,15 +194,15 @@ void PairLJSmoothLinear::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; if (narg == 5) { - cut_one = force->numeric(FLERR,arg[4]); + cut_one = utils::numeric(FLERR,arg[4],false,lmp); } int count = 0; diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index f031401a00..7447e143f7 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -16,7 +16,7 @@ ------------------------------------------------------------------------- */ #include "pair_mie_cut.h" -#include + #include #include #include "atom.h" @@ -30,7 +30,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -438,7 +438,7 @@ void PairMIECut::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -461,16 +461,16 @@ void PairMIECut::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); - double gamR_one = force->numeric(FLERR,arg[4]); - double gamA_one = force->numeric(FLERR,arg[5]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); + double gamR_one = utils::numeric(FLERR,arg[4],false,lmp); + double gamA_one = utils::numeric(FLERR,arg[5],false,lmp); double cut_one = cut_global; - if (narg == 7) cut_one = force->numeric(FLERR,arg[6]); + if (narg == 7) cut_one = utils::numeric(FLERR,arg[6],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index b883036c18..efcc1aa811 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_morse.h" -#include + #include #include #include "atom.h" @@ -21,7 +21,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -158,7 +158,7 @@ void PairMorse::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -181,15 +181,15 @@ void PairMorse::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double d0_one = force->numeric(FLERR,arg[2]); - double alpha_one = force->numeric(FLERR,arg[3]); - double r0_one = force->numeric(FLERR,arg[4]); + double d0_one = utils::numeric(FLERR,arg[2],false,lmp); + double alpha_one = utils::numeric(FLERR,arg[3],false,lmp); + double r0_one = utils::numeric(FLERR,arg[4],false,lmp); double cut_one = cut_global; - if (narg == 6) cut_one = force->numeric(FLERR,arg[5]); + if (narg == 6) cut_one = utils::numeric(FLERR,arg[5],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index ddfc4476dc..f3dd139b69 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_soft.h" -#include + #include #include #include "atom.h" @@ -22,7 +22,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; using namespace MathConst; @@ -149,7 +149,7 @@ void PairSoft::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -172,13 +172,13 @@ void PairSoft::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double prefactor_one = force->numeric(FLERR,arg[2]); + double prefactor_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_table.cpp b/src/pair_table.cpp index bd2a6be654..1711465ffa 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -16,21 +16,21 @@ ------------------------------------------------------------------------- */ #include "pair_table.h" -#include + #include -#include + #include -#include + #include "atom.h" #include "force.h" #include "comm.h" #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + #include "tokenizer.h" #include "table_file_reader.h" -#include "fmt/format.h" + using namespace LAMMPS_NS; @@ -216,7 +216,7 @@ void PairTable::settings(int narg, char **arg) else if (strcmp(arg[0],"bitmap") == 0) tabstyle = BITMAP; else error->all(FLERR,"Unknown table style in pair_style command"); - tablength = force->inumeric(FLERR,arg[1]); + tablength = utils::inumeric(FLERR,arg[1],false,lmp); if (tablength < 2) error->all(FLERR,"Illegal number of pair table entries"); // optional keywords @@ -259,8 +259,8 @@ void PairTable::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); int me; MPI_Comm_rank(world,&me); @@ -273,7 +273,7 @@ void PairTable::coeff(int narg, char **arg) // set table cutoff - if (narg == 5) tb->cut = force->numeric(FLERR,arg[4]); + if (narg == 5) tb->cut = utils::numeric(FLERR,arg[4],false,lmp); else if (tb->rflag) tb->cut = tb->rhi; else tb->cut = tb->rfile[tb->ninput-1]; diff --git a/src/pair_ufm.cpp b/src/pair_ufm.cpp index 3b94902af7..50cc87cf96 100644 --- a/src/pair_ufm.cpp +++ b/src/pair_ufm.cpp @@ -18,7 +18,7 @@ ------------------------------------------------------------------------- */ #include "pair_ufm.h" -#include + #include #include #include "atom.h" @@ -27,7 +27,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -164,7 +164,7 @@ void PairUFM::settings(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); // reset cutoffs that have been explicitly set @@ -187,15 +187,15 @@ void PairUFM::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double epsilon_one = force->numeric(FLERR,arg[2]); - double sigma_one = force->numeric(FLERR,arg[3]); + double epsilon_one = utils::numeric(FLERR,arg[2],false,lmp); + double sigma_one = utils::numeric(FLERR,arg[3],false,lmp); double cut_one = cut_global; - if (narg == 5) cut_one = force->numeric(FLERR,arg[4]); + if (narg == 5) cut_one = utils::numeric(FLERR,arg[4],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index d1e06fdb84..6429492346 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ #include "pair_yukawa.h" -#include + #include #include "atom.h" #include "force.h" @@ -20,7 +20,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; @@ -153,8 +153,8 @@ void PairYukawa::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - kappa = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + kappa = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); // reset cutoffs that have been explicitly set @@ -177,13 +177,13 @@ void PairYukawa::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - double a_one = force->numeric(FLERR,arg[2]); + double a_one = utils::numeric(FLERR,arg[2],false,lmp); double cut_one = cut_global; - if (narg == 4) cut_one = force->numeric(FLERR,arg[3]); + if (narg == 4) cut_one = utils::numeric(FLERR,arg[3],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 2ba499a911..68c63c9806 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -24,7 +24,7 @@ #include "neigh_list.h" #include "memory.h" #include "error.h" -#include "utils.h" + // From J.F. Zeigler, J. P. Biersack and U. Littmark, // "The Stopping and Range of Ions in Matter" volume 1, Pergamon, 1985. @@ -183,8 +183,8 @@ void PairZBL::settings(int narg, char **arg) { if (narg != 2) error->all(FLERR,"Illegal pair_style command"); - cut_inner = force->numeric(FLERR,arg[0]); - cut_global = force->numeric(FLERR,arg[1]); + cut_inner = utils::numeric(FLERR,arg[0],false,lmp); + cut_global = utils::numeric(FLERR,arg[1],false,lmp); if (cut_inner <= 0.0 ) error->all(FLERR,"Illegal pair_style command"); @@ -206,13 +206,13 @@ void PairZBL::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); int jlo,jhi; - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); - z_one = force->numeric(FLERR,arg[2]); - z_two = force->numeric(FLERR,arg[3]); + z_one = utils::numeric(FLERR,arg[2],false,lmp); + z_two = utils::numeric(FLERR,arg[3],false,lmp); // set flag for each i-j pair // set z-parameter only for i-i pairs diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 6ab108ff4f..976bb1ba33 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -16,14 +16,13 @@ ------------------------------------------------------------------------- */ #include "pair_zero.h" -#include -#include + #include "atom.h" #include "comm.h" -#include "force.h" #include "memory.h" #include "error.h" -#include "utils.h" + +#include using namespace LAMMPS_NS; @@ -89,7 +88,7 @@ void PairZero::settings(int narg, char **arg) if ((narg != 1) && (narg != 2)) error->all(FLERR,"Illegal pair_style command"); - cut_global = force->numeric(FLERR,arg[0]); + cut_global = utils::numeric(FLERR,arg[0],false,lmp); if (narg == 2) { if (strcmp("nocoeff",arg[1]) == 0) coeffflag=0; else error->all(FLERR,"Illegal pair_style command"); @@ -117,11 +116,11 @@ void PairZero::coeff(int narg, char **arg) if (!allocated) allocate(); int ilo,ihi,jlo,jhi; - force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); - force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); + utils::bounds(FLERR,arg[0],1,atom->ntypes,ilo,ihi,error); + utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); double cut_one = cut_global; - if (coeffflag && (narg == 3)) cut_one = force->numeric(FLERR,arg[2]); + if (coeffflag && (narg == 3)) cut_one = utils::numeric(FLERR,arg[2],false,lmp); int count = 0; for (int i = ilo; i <= ihi; i++) { diff --git a/src/pointers.h b/src/pointers.h index 2d528db392..04f682f045 100644 --- a/src/pointers.h +++ b/src/pointers.h @@ -21,11 +21,14 @@ #ifndef LMP_POINTERS_H #define LMP_POINTERS_H -#include "lmptype.h" // IWYU pragma: export -#include // IWYU pragma: export -#include // IWYU pragme: export -#include // IWYU pragma: export -#include "lammps.h" // IWYU pragma: export +#include "lmptype.h" // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragme: export +#include // IWYU pragma: export +#include // IWYU pragma: export +#include "lammps.h" // IWYU pragma: export +#include "utils.h" // IWYU pragma: export +#include "fmt/format.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/potential_file_reader.cpp b/src/potential_file_reader.cpp index 47283fd574..a71d7944d6 100644 --- a/src/potential_file_reader.cpp +++ b/src/potential_file_reader.cpp @@ -15,20 +15,29 @@ Contributing authors: Richard Berger (Temple U) ------------------------------------------------------------------------- */ -#include "lammps.h" -#include "force.h" -#include "error.h" -#include "comm.h" #include "potential_file_reader.h" -#include "update.h" -#include "utils.h" -#include "tokenizer.h" -#include "fmt/format.h" -#include +#include "comm.h" +#include "error.h" +#include "text_file_reader.h" +#include "tokenizer.h" +#include "update.h" using namespace LAMMPS_NS; +/** Class for reading and parsing LAMMPS potential files + * + * The value of the class member variable *ignore_comments* controls + * whether any text following the pound sign (#) should be ignored (true) + * or not (false). Default: true, i.e. ignore. + * + * \param lmp Pointer to LAMMPS instance + * \param filename Name of file to be read + * \param potential_name Name of potential style for error messages + * \param auto_convert Bitmask of supported unit conversions + * + * \sa TextFileReader */ + PotentialFileReader::PotentialFileReader(LAMMPS *lmp, const std::string &filename, const std::string &potential_name, @@ -53,14 +62,21 @@ PotentialFileReader::PotentialFileReader(LAMMPS *lmp, } } +/** Closes the file */ + PotentialFileReader::~PotentialFileReader() { delete reader; } +/** Set comment (= text after '#') handling preference for the file to be read + * + * \param value Comment text is ignored if true, or not if false */ void PotentialFileReader::ignore_comments(bool value) { reader->ignore_comments = value; } +/** Read a line but ignore its content */ + void PotentialFileReader::skip_line() { try { reader->skip_line(); @@ -69,6 +85,17 @@ void PotentialFileReader::skip_line() { } } +/** Read the next line(s) until *nparams* words have been read. + * + * This reads a line and counts the words in it, if the number + * is less than the requested number, it will read the next + * line, as well. Output will be a string with all read lines + * combined. The purpose is to somewhat replicate the reading + * behavior of formatted files in Fortran. + * + * \param nparams Number of words that must be read. Default: 0 + * \return String with the concatenated text */ + char *PotentialFileReader::next_line(int nparams) { try { return reader->next_line(nparams); @@ -78,6 +105,15 @@ char *PotentialFileReader::next_line(int nparams) { return nullptr; } +/** Read lines until *n* doubles have been read and stored in array *list* + * + * This reads lines from the file using the next_line() function, + * and splits them into floating-point numbers using the + * ValueTokenizer class and stores the number is the provided list. + * + * \param list Pointer to array with suitable storage for *n* doubles + * \param n Number of doubles to be read */ + void PotentialFileReader::next_dvector(double * list, int n) { try { return reader->next_dvector(list, n); @@ -86,6 +122,16 @@ void PotentialFileReader::next_dvector(double * list, int n) { } } +/** Read text until *nparams* words are read and passed to a tokenizer object for custom parsing. + * + * This reads lines from the file using the next_line() function, + * and splits them into floating-point numbers using the + * ValueTokenizer class and stores the number is the provided list. + * + * \param nparams Number of words to be read + * \param separators String with list of separators. + * \return ValueTokenizer object for read in text */ + ValueTokenizer PotentialFileReader::next_values(int nparams, const std::string & separators) { try { return reader->next_values(nparams, separators); @@ -95,6 +141,10 @@ ValueTokenizer PotentialFileReader::next_values(int nparams, const std::string & return ValueTokenizer(""); } +/** Read next line and convert first word to a double + * + * \return Value of first word in line as double */ + double PotentialFileReader::next_double() { try { char * line = reader->next_line(1); @@ -105,6 +155,10 @@ double PotentialFileReader::next_double() { return 0.0; } +/** Read next line and convert first word to an int + * + * \return Value of first word in line as int */ + int PotentialFileReader::next_int() { try { char * line = reader->next_line(1); @@ -115,6 +169,10 @@ int PotentialFileReader::next_int() { return 0; } +/** Read next line and convert first word to a tagint + * + * \return Value of first word in line as tagint */ + tagint PotentialFileReader::next_tagint() { try { char * line = reader->next_line(1); @@ -125,6 +183,10 @@ tagint PotentialFileReader::next_tagint() { return 0; } +/** Read next line and convert first word to a bigint + * + * \return Value of first word in line as bigint */ + bigint PotentialFileReader::next_bigint() { try { char * line = reader->next_line(1); @@ -135,6 +197,10 @@ bigint PotentialFileReader::next_bigint() { return 0; } +/** Read next line and return first word + * + * \return First word of read in line */ + std::string PotentialFileReader::next_string() { try { char * line = reader->next_line(1); @@ -145,6 +211,12 @@ std::string PotentialFileReader::next_string() { return ""; } +/** Look up and open the potential file + * + * \param path Path of the potential file to open + * \return Pointer to TextFileReader object created + * \sa TextFileReader */ + TextFileReader *PotentialFileReader::open_potential(const std::string &path) { std::string filepath = utils::get_potential_file_path(path); diff --git a/src/potential_file_reader.h b/src/potential_file_reader.h index 9094d3957a..d3befca282 100644 --- a/src/potential_file_reader.h +++ b/src/potential_file_reader.h @@ -18,14 +18,13 @@ #ifndef LMP_POTENTIAL_FILE_READER_H #define LMP_POTENTIAL_FILE_READER_H -#include - -#include "pointers.h" +#include "pointers.h" // IWYU pragma: export #include "tokenizer.h" -#include "text_file_reader.h" namespace LAMMPS_NS { + class TextFileReader; + class PotentialFileReader : protected Pointers { protected: TextFileReader *reader; diff --git a/src/procmap.cpp b/src/procmap.cpp index 1741e351fe..f80af9330e 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -16,18 +16,18 @@ ------------------------------------------------------------------------- */ #include "procmap.h" -#include + +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "math_extra.h" +#include "memory.h" +#include "universe.h" + #include #include #include -#include #include -#include "universe.h" -#include "comm.h" -#include "domain.h" -#include "math_extra.h" -#include "memory.h" -#include "error.h" using namespace LAMMPS_NS; diff --git a/src/rcb.cpp b/src/rcb.cpp index 2cc70a2de9..03c99560b3 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "rcb.h" -#include -#include + #include "irregular.h" #include "memory.h" +#include + using namespace LAMMPS_NS; #define MYHUGE 1.0e30 diff --git a/src/read_data.cpp b/src/read_data.cpp index 19e5c56b81..2a6801b3a5 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -16,34 +16,32 @@ // before lmptype.h can set flags to insure it is done correctly #include "read_data.h" -#include -#include -#include -#include + +#include "angle.h" #include "atom.h" #include "atom_vec.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" -#include "molecule.h" -#include "group.h" +#include "bond.h" #include "comm.h" -#include "update.h" -#include "modify.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" #include "fix.h" #include "force.h" -#include "pair.h" -#include "domain.h" -#include "bond.h" -#include "angle.h" -#include "dihedral.h" +#include "group.h" #include "improper.h" -#include "special.h" #include "irregular.h" -#include "error.h" #include "memory.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" +#include "molecule.h" +#include "pair.h" +#include "special.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; @@ -148,13 +146,13 @@ void ReadData::command(int narg, char **arg) if (atom->molecule_flag && (iarg+3 > narg)) error->all(FLERR,"Illegal read_data command"); addflag = VALUE; - bigint offset = force->bnumeric(FLERR,arg[iarg+1]); + bigint offset = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (offset > MAXTAGINT) error->all(FLERR,"Read data add atomID offset is too big"); id_offset = offset; if (atom->molecule_flag) { - offset = force->bnumeric(FLERR,arg[iarg+2]); + offset = utils::bnumeric(FLERR,arg[iarg+2],false,lmp); if (offset > MAXTAGINT) error->all(FLERR,"Read data add molID offset is too big"); mol_offset = offset; @@ -165,11 +163,11 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(arg[iarg],"offset") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal read_data command"); offsetflag = 1; - toffset = force->inumeric(FLERR,arg[iarg+1]); - boffset = force->inumeric(FLERR,arg[iarg+2]); - aoffset = force->inumeric(FLERR,arg[iarg+3]); - doffset = force->inumeric(FLERR,arg[iarg+4]); - ioffset = force->inumeric(FLERR,arg[iarg+5]); + toffset = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + boffset = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + aoffset = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + doffset = utils::inumeric(FLERR,arg[iarg+4],false,lmp); + ioffset = utils::inumeric(FLERR,arg[iarg+5],false,lmp); if (toffset < 0 || boffset < 0 || aoffset < 0 || doffset < 0 || ioffset < 0) error->all(FLERR,"Illegal read_data command"); @@ -177,9 +175,9 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(arg[iarg],"shift") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal read_data command"); shiftflag = 1; - shift[0] = force->numeric(FLERR,arg[iarg+1]); - shift[1] = force->numeric(FLERR,arg[iarg+2]); - shift[2] = force->numeric(FLERR,arg[iarg+3]); + shift[0] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + shift[1] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + shift[2] = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (domain->dimension == 2 && shift[2] != 0.0) error->all(FLERR,"Non-zero read_data shift z value for 2d simulation"); iarg += 4; @@ -188,28 +186,28 @@ void ReadData::command(int narg, char **arg) iarg ++; } else if (strcmp(arg[iarg],"extra/atom/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); - extra_atom_types = force->inumeric(FLERR,arg[iarg+1]); + extra_atom_types = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (extra_atom_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; } else if (strcmp(arg[iarg],"extra/bond/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (!atom->avec->bonds_allow) error->all(FLERR,"No bonds allowed with this atom style"); - extra_bond_types = force->inumeric(FLERR,arg[iarg+1]); + extra_bond_types = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (extra_bond_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; } else if (strcmp(arg[iarg],"extra/angle/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (!atom->avec->angles_allow) error->all(FLERR,"No angles allowed with this atom style"); - extra_angle_types = force->inumeric(FLERR,arg[iarg+1]); + extra_angle_types = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (extra_angle_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; } else if (strcmp(arg[iarg],"extra/dihedral/types") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (!atom->avec->dihedrals_allow) error->all(FLERR,"No dihedrals allowed with this atom style"); - extra_dihedral_types = force->inumeric(FLERR,arg[iarg+1]); + extra_dihedral_types = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (extra_dihedral_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -217,7 +215,7 @@ void ReadData::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (!atom->avec->impropers_allow) error->all(FLERR,"No impropers allowed with this atom style"); - extra_improper_types = force->inumeric(FLERR,arg[iarg+1]); + extra_improper_types = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (extra_improper_types < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -225,7 +223,7 @@ void ReadData::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (! atom->molecular) error->all(FLERR,"No bonds allowed with this atom style"); - atom->extra_bond_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->extra_bond_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->extra_bond_per_atom < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -233,7 +231,7 @@ void ReadData::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (! atom->molecular) error->all(FLERR,"No angles allowed with this atom style"); - atom->extra_angle_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->extra_angle_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->extra_angle_per_atom < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -241,7 +239,7 @@ void ReadData::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (! atom->molecular) error->all(FLERR,"No dihedrals allowed with this atom style"); - atom->extra_dihedral_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->extra_dihedral_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->extra_dihedral_per_atom < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -249,7 +247,7 @@ void ReadData::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (! atom->molecular) error->all(FLERR,"No impropers allowed with this atom style"); - atom->extra_improper_per_atom = force->inumeric(FLERR,arg[iarg+1]); + atom->extra_improper_per_atom = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->extra_improper_per_atom < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -257,7 +255,7 @@ void ReadData::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal read_data command"); if (! atom->molecular) error->all(FLERR,"No bonded interactions allowed with this atom style"); - force->special_extra = force->inumeric(FLERR,arg[iarg+1]); + force->special_extra = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (force->special_extra < 0) error->all(FLERR,"Illegal read_data command"); iarg += 2; @@ -2075,11 +2073,11 @@ void ReadData::parse_coeffs(char *line, const char *addstr, if (narg == 0) return; if (noffset) { - int value = force->inumeric(FLERR,arg[0]); + int value = utils::inumeric(FLERR,arg[0],false,lmp); sprintf(argoffset1,"%d",value+offset); arg[0] = argoffset1; if (noffset == 2) { - value = force->inumeric(FLERR,arg[1]); + value = utils::inumeric(FLERR,arg[1],false,lmp); sprintf(argoffset2,"%d",value+offset); arg[1] = argoffset2; } diff --git a/src/read_dump.cpp b/src/read_dump.cpp index f47eda3262..10218fe617 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -20,22 +20,19 @@ // before lmptype.h can set flags to insure it is done correctly #include "read_dump.h" -#include -#include -#include -#include "reader.h" -#include "style_reader.h" + #include "atom.h" #include "atom_vec.h" -#include "update.h" -#include "domain.h" #include "comm.h" -#include "force.h" -#include "irregular.h" +#include "domain.h" #include "error.h" +#include "irregular.h" #include "memory.h" -#include "utils.h" -#include "fmt/format.h" +#include "reader.h" +#include "style_reader.h" // IWYU pragma: keep +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -110,7 +107,7 @@ void ReadDump::command(int narg, char **arg) if (narg < 2) error->all(FLERR,"Illegal read_dump command"); store_files(1,&arg[0]); - bigint nstep = force->bnumeric(FLERR,arg[1]); + bigint nstep = utils::bnumeric(FLERR,arg[1],false,lmp); int nremain = narg - 2; if (nremain) nremain = fields_and_keywords(nremain,&arg[narg-nremain]); @@ -246,7 +243,7 @@ void ReadDump::setup_reader(int narg, char **arg) for (int i = 0; i < nreader; i++) \ readers[i] = new Class(lmp); \ } -#include "style_reader.h" +#include "style_reader.h" // IWYU pragma: keep #undef READER_CLASS // unrecognized style @@ -1217,7 +1214,7 @@ int ReadDump::fields_and_keywords(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"nfile") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command"); - multiproc_nfile = force->inumeric(FLERR,arg[iarg+1]); + multiproc_nfile = utils::inumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"box") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal read_dump command"); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index 157992bce3..dcab9f834c 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -12,31 +12,30 @@ ------------------------------------------------------------------------- */ #include "read_restart.h" -#include -#include -#include + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "domain.h" -#include "comm.h" -#include "irregular.h" -#include "update.h" -#include "modify.h" -#include "fix_read_restart.h" -#include "group.h" -#include "force.h" -#include "pair.h" #include "bond.h" -#include "angle.h" +#include "comm.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix_read_restart.h" +#include "force.h" +#include "group.h" #include "improper.h" +#include "irregular.h" +#include "memory.h" +#include "modify.h" +#include "mpiio.h" +#include "pair.h" #include "special.h" #include "universe.h" -#include "mpiio.h" -#include "memory.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "update.h" + +#include +#include #include "lmprestart.h" diff --git a/src/reader.cpp b/src/reader.cpp index 2a6e4bf90c..8230fa3ed3 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -12,10 +12,10 @@ ------------------------------------------------------------------------- */ #include "reader.h" -#include + #include "error.h" -#include "utils.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; diff --git a/src/reader_native.cpp b/src/reader_native.cpp index b329dd4f70..e0f0d7792b 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -12,14 +12,14 @@ ------------------------------------------------------------------------- */ #include "reader_native.h" -#include -#include -#include "atom.h" -#include "memory.h" + #include "error.h" -#include "utils.h" +#include "memory.h" #include "tokenizer.h" +#include +#include + using namespace LAMMPS_NS; #define MAXLINE 1024 // max line length in dump file @@ -320,7 +320,7 @@ void ReaderNative::read_atoms(int n, int nfield, double **fields) // tokenize the line std::vector words = Tokenizer(line).as_vector(); - if (words.size() < nwords) error->one(FLERR,"Insufficient columns in dump file"); + if ((int)words.size() < nwords) error->one(FLERR,"Insufficient columns in dump file"); // convert selected fields to floats diff --git a/src/reader_native.h b/src/reader_native.h index 6456dc275a..d1c8433016 100644 --- a/src/reader_native.h +++ b/src/reader_native.h @@ -23,9 +23,8 @@ ReaderStyle(native,ReaderNative) #define LMP_READER_NATIVE_H #include "reader.h" -#include + #include -#include namespace LAMMPS_NS { diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index a5209956b9..8a2f7a3989 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -16,10 +16,9 @@ ------------------------------------------------------------------------- */ #include "reader_xyz.h" -#include + #include "memory.h" #include "error.h" -#include "force.h" using namespace LAMMPS_NS; @@ -65,7 +64,7 @@ int ReaderXYZ::read_time(bigint &ntimestep) break; } } - natoms = force->bnumeric(FLERR,line); + natoms = utils::bnumeric(FLERR,line,false,lmp); if (natoms < 1) error->one(FLERR,"Dump file is incorrectly formatted"); diff --git a/src/region.cpp b/src/region.cpp index 7a676de1af..15b6fee272 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -12,16 +12,17 @@ ------------------------------------------------------------------------- */ #include "region.h" + +#include "domain.h" +#include "error.h" +#include "input.h" +#include "lattice.h" +#include "math_extra.h" +#include "update.h" +#include "variable.h" + #include #include -#include "update.h" -#include "domain.h" -#include "lattice.h" -#include "input.h" -#include "variable.h" -#include "math_extra.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; @@ -365,18 +366,18 @@ void Region::options(int narg, char **arg) int n = strlen(&arg[iarg+1][2]) + 1; tstr = new char[n]; strcpy(tstr,&arg[iarg+1][2]); - point[0] = force->numeric(FLERR,arg[iarg+2]); - point[1] = force->numeric(FLERR,arg[iarg+3]); - point[2] = force->numeric(FLERR,arg[iarg+4]); - axis[0] = force->numeric(FLERR,arg[iarg+5]); - axis[1] = force->numeric(FLERR,arg[iarg+6]); - axis[2] = force->numeric(FLERR,arg[iarg+7]); + point[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + point[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + point[2] = utils::numeric(FLERR,arg[iarg+4],false,lmp); + axis[0] = utils::numeric(FLERR,arg[iarg+5],false,lmp); + axis[1] = utils::numeric(FLERR,arg[iarg+6],false,lmp); + axis[2] = utils::numeric(FLERR,arg[iarg+7],false,lmp); rotateflag = 1; iarg += 8; } else if (strcmp(arg[iarg],"open") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal region command"); - int iface = force->inumeric(FLERR,arg[iarg+1]); + int iface = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (iface < 1 || iface > 6) error->all(FLERR,"Illegal region command"); // additional checks on valid face index are done by region classes open_faces[iface-1] = 1; diff --git a/src/region_block.cpp b/src/region_block.cpp index 8ea8b3f202..2204f2e6a4 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -12,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "region_block.h" -#include -#include "force.h" + #include "domain.h" -#include "math_extra.h" #include "error.h" +#include "math_extra.h" + +#include using namespace LAMMPS_NS; @@ -34,7 +35,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[2],"INF") == 0) xlo = -BIG; else if (domain->triclinic == 0) xlo = domain->boxlo[0]; else xlo = domain->boxlo_bound[0]; - } else xlo = xscale*force->numeric(FLERR,arg[2]); + } else xlo = xscale*utils::numeric(FLERR,arg[2],false,lmp); if (strcmp(arg[3],"INF") == 0 || strcmp(arg[3],"EDGE") == 0) { if (domain->box_exist == 0) @@ -42,7 +43,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[3],"INF") == 0) xhi = BIG; else if (domain->triclinic == 0) xhi = domain->boxhi[0]; else xhi = domain->boxhi_bound[0]; - } else xhi = xscale*force->numeric(FLERR,arg[3]); + } else xhi = xscale*utils::numeric(FLERR,arg[3],false,lmp); if (strcmp(arg[4],"INF") == 0 || strcmp(arg[4],"EDGE") == 0) { if (domain->box_exist == 0) @@ -50,7 +51,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[4],"INF") == 0) ylo = -BIG; else if (domain->triclinic == 0) ylo = domain->boxlo[1]; else ylo = domain->boxlo_bound[1]; - } else ylo = yscale*force->numeric(FLERR,arg[4]); + } else ylo = yscale*utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"INF") == 0 || strcmp(arg[5],"EDGE") == 0) { if (domain->box_exist == 0) @@ -58,7 +59,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[5],"INF") == 0) yhi = BIG; else if (domain->triclinic == 0) yhi = domain->boxhi[1]; else yhi = domain->boxhi_bound[1]; - } else yhi = yscale*force->numeric(FLERR,arg[5]); + } else yhi = yscale*utils::numeric(FLERR,arg[5],false,lmp); if (strcmp(arg[6],"INF") == 0 || strcmp(arg[6],"EDGE") == 0) { if (domain->box_exist == 0) @@ -66,7 +67,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[6],"INF") == 0) zlo = -BIG; else if (domain->triclinic == 0) zlo = domain->boxlo[2]; else zlo = domain->boxlo_bound[2]; - } else zlo = zscale*force->numeric(FLERR,arg[6]); + } else zlo = zscale*utils::numeric(FLERR,arg[6],false,lmp); if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { if (domain->box_exist == 0) @@ -74,7 +75,7 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) if (strcmp(arg[7],"INF") == 0) zhi = BIG; else if (domain->triclinic == 0) zhi = domain->boxhi[2]; else zhi = domain->boxhi_bound[2]; - } else zhi = zscale*force->numeric(FLERR,arg[7]); + } else zhi = zscale*utils::numeric(FLERR,arg[7],false,lmp); // error check diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 3c7d0a29d8..d669008e93 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -16,11 +16,12 @@ ------------------------------------------------------------------------- */ #include "region_cone.h" -#include -#include + #include "domain.h" #include "error.h" -#include "force.h" + +#include +#include using namespace LAMMPS_NS; @@ -43,20 +44,20 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : axis = arg[2][0]; if (axis == 'x') { - c1 = yscale*force->numeric(FLERR,arg[3]); - c2 = zscale*force->numeric(FLERR,arg[4]); - radiuslo = yscale*force->numeric(FLERR,arg[5]); - radiushi = yscale*force->numeric(FLERR,arg[6]); + c1 = yscale*utils::numeric(FLERR,arg[3],false,lmp); + c2 = zscale*utils::numeric(FLERR,arg[4],false,lmp); + radiuslo = yscale*utils::numeric(FLERR,arg[5],false,lmp); + radiushi = yscale*utils::numeric(FLERR,arg[6],false,lmp); } else if (axis == 'y') { - c1 = xscale*force->numeric(FLERR,arg[3]); - c2 = zscale*force->numeric(FLERR,arg[4]); - radiuslo = xscale*force->numeric(FLERR,arg[5]); - radiushi = xscale*force->numeric(FLERR,arg[6]); + c1 = xscale*utils::numeric(FLERR,arg[3],false,lmp); + c2 = zscale*utils::numeric(FLERR,arg[4],false,lmp); + radiuslo = xscale*utils::numeric(FLERR,arg[5],false,lmp); + radiushi = xscale*utils::numeric(FLERR,arg[6],false,lmp); } else if (axis == 'z') { - c1 = xscale*force->numeric(FLERR,arg[3]); - c2 = yscale*force->numeric(FLERR,arg[4]); - radiuslo = xscale*force->numeric(FLERR,arg[5]); - radiushi = xscale*force->numeric(FLERR,arg[6]); + c1 = xscale*utils::numeric(FLERR,arg[3],false,lmp); + c2 = yscale*utils::numeric(FLERR,arg[4],false,lmp); + radiuslo = xscale*utils::numeric(FLERR,arg[5],false,lmp); + radiushi = xscale*utils::numeric(FLERR,arg[6],false,lmp); } if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { @@ -78,9 +79,9 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : else lo = domain->boxlo_bound[2]; } } else { - if (axis == 'x') lo = xscale*force->numeric(FLERR,arg[7]); - if (axis == 'y') lo = yscale*force->numeric(FLERR,arg[7]); - if (axis == 'z') lo = zscale*force->numeric(FLERR,arg[7]); + if (axis == 'x') lo = xscale*utils::numeric(FLERR,arg[7],false,lmp); + if (axis == 'y') lo = yscale*utils::numeric(FLERR,arg[7],false,lmp); + if (axis == 'z') lo = zscale*utils::numeric(FLERR,arg[7],false,lmp); } if (strcmp(arg[8],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { @@ -102,9 +103,9 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : else hi = domain->boxhi_bound[2]; } } else { - if (axis == 'x') hi = xscale*force->numeric(FLERR,arg[8]); - if (axis == 'y') hi = yscale*force->numeric(FLERR,arg[8]); - if (axis == 'z') hi = zscale*force->numeric(FLERR,arg[8]); + if (axis == 'x') hi = xscale*utils::numeric(FLERR,arg[8],false,lmp); + if (axis == 'y') hi = yscale*utils::numeric(FLERR,arg[8],false,lmp); + if (axis == 'z') hi = zscale*utils::numeric(FLERR,arg[8],false,lmp); } // error check diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index b2c06270d0..f7676a3d74 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -12,14 +12,15 @@ ------------------------------------------------------------------------- */ #include "region_cylinder.h" + +#include "domain.h" +#include "error.h" +#include "input.h" +#include "update.h" +#include "variable.h" + #include #include -#include "update.h" -#include "domain.h" -#include "input.h" -#include "variable.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; @@ -51,7 +52,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : c1style = VARIABLE; varshape = 1; } else { - c1 = yscale*force->numeric(FLERR,arg[3]); + c1 = yscale*utils::numeric(FLERR,arg[3],false,lmp); c1style = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -62,7 +63,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : c2style = VARIABLE; varshape = 1; } else { - c2 = zscale*force->numeric(FLERR,arg[4]); + c2 = zscale*utils::numeric(FLERR,arg[4],false,lmp); c2style = CONSTANT; } } else if (axis == 'y') { @@ -74,7 +75,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : c1style = VARIABLE; varshape = 1; } else { - c1 = xscale*force->numeric(FLERR,arg[3]); + c1 = xscale*utils::numeric(FLERR,arg[3],false,lmp); c1style = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -85,7 +86,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : c2style = VARIABLE; varshape = 1; } else { - c2 = zscale*force->numeric(FLERR,arg[4]); + c2 = zscale*utils::numeric(FLERR,arg[4],false,lmp); c2style = CONSTANT; } } else if (axis == 'z') { @@ -97,7 +98,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : c1style = VARIABLE; varshape = 1; } else { - c1 = xscale*force->numeric(FLERR,arg[3]); + c1 = xscale*utils::numeric(FLERR,arg[3],false,lmp); c1style = CONSTANT; } if (strstr(arg[4],"v_") == arg[4]) { @@ -108,7 +109,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : c2style = VARIABLE; varshape = 1; } else { - c2 = yscale*force->numeric(FLERR,arg[4]); + c2 = yscale*utils::numeric(FLERR,arg[4],false,lmp); c2style = CONSTANT; } } @@ -121,7 +122,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : rstyle = VARIABLE; varshape = 1; } else { - radius = force->numeric(FLERR,arg[5]); + radius = utils::numeric(FLERR,arg[5],false,lmp); if (axis == 'x') radius *= yscale; else radius *= xscale; rstyle = CONSTANT; @@ -151,9 +152,9 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : else lo = domain->boxlo_bound[2]; } } else { - if (axis == 'x') lo = xscale*force->numeric(FLERR,arg[6]); - if (axis == 'y') lo = yscale*force->numeric(FLERR,arg[6]); - if (axis == 'z') lo = zscale*force->numeric(FLERR,arg[6]); + if (axis == 'x') lo = xscale*utils::numeric(FLERR,arg[6],false,lmp); + if (axis == 'y') lo = yscale*utils::numeric(FLERR,arg[6],false,lmp); + if (axis == 'z') lo = zscale*utils::numeric(FLERR,arg[6],false,lmp); } if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { @@ -175,9 +176,9 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : else hi = domain->boxhi_bound[2]; } } else { - if (axis == 'x') hi = xscale*force->numeric(FLERR,arg[7]); - if (axis == 'y') hi = yscale*force->numeric(FLERR,arg[7]); - if (axis == 'z') hi = zscale*force->numeric(FLERR,arg[7]); + if (axis == 'x') hi = xscale*utils::numeric(FLERR,arg[7],false,lmp); + if (axis == 'y') hi = yscale*utils::numeric(FLERR,arg[7],false,lmp); + if (axis == 'z') hi = zscale*utils::numeric(FLERR,arg[7],false,lmp); } // error check diff --git a/src/region_deprecated.cpp b/src/region_deprecated.cpp index afbe9e4189..137c167ab9 100644 --- a/src/region_deprecated.cpp +++ b/src/region_deprecated.cpp @@ -12,10 +12,10 @@ ------------------------------------------------------------------------- */ #include "region_deprecated.h" -#include + #include "comm.h" #include "error.h" -#include "utils.h" + using namespace LAMMPS_NS; diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index fe074a6b4c..a61e2556b0 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #include "region_intersect.h" -#include + #include "domain.h" #include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; @@ -27,7 +28,7 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : nregion = 0; if (narg < 5) error->all(FLERR,"Illegal region command"); - int n = force->inumeric(FLERR,arg[2]); + int n = utils::inumeric(FLERR,arg[2],false,lmp); if (n < 2) error->all(FLERR,"Illegal region command"); options(narg-(n+3),&arg[n+3]); diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 85671357ef..4895c1f081 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -12,9 +12,10 @@ ------------------------------------------------------------------------- */ #include "region_plane.h" -#include + #include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; @@ -25,12 +26,12 @@ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : { options(narg-8,&arg[8]); - xp = xscale*force->numeric(FLERR,arg[2]); - yp = yscale*force->numeric(FLERR,arg[3]); - zp = zscale*force->numeric(FLERR,arg[4]); - normal[0] = xscale*force->numeric(FLERR,arg[5]); - normal[1] = yscale*force->numeric(FLERR,arg[6]); - normal[2] = zscale*force->numeric(FLERR,arg[7]); + xp = xscale*utils::numeric(FLERR,arg[2],false,lmp); + yp = yscale*utils::numeric(FLERR,arg[3],false,lmp); + zp = zscale*utils::numeric(FLERR,arg[4],false,lmp); + normal[0] = xscale*utils::numeric(FLERR,arg[5],false,lmp); + normal[1] = yscale*utils::numeric(FLERR,arg[6],false,lmp); + normal[2] = zscale*utils::numeric(FLERR,arg[7],false,lmp); // enforce unit normal diff --git a/src/region_prism.cpp b/src/region_prism.cpp index b6c54c2fb9..af270cc47f 100644 --- a/src/region_prism.cpp +++ b/src/region_prism.cpp @@ -16,11 +16,12 @@ ------------------------------------------------------------------------- */ #include "region_prism.h" -#include + #include "domain.h" -#include "force.h" -#include "math_extra.h" #include "error.h" +#include "math_extra.h" + +#include using namespace LAMMPS_NS; @@ -37,46 +38,46 @@ RegPrism::RegPrism(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[2],"INF") == 0) xlo = -BIG; else xlo = domain->boxlo[0]; - } else xlo = xscale*force->numeric(FLERR,arg[2]); + } else xlo = xscale*utils::numeric(FLERR,arg[2],false,lmp); if (strcmp(arg[3],"INF") == 0 || strcmp(arg[3],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[3],"INF") == 0) xhi = BIG; else xhi = domain->boxhi[0]; - } else xhi = xscale*force->numeric(FLERR,arg[3]); + } else xhi = xscale*utils::numeric(FLERR,arg[3],false,lmp); if (strcmp(arg[4],"INF") == 0 || strcmp(arg[4],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[4],"INF") == 0) ylo = -BIG; else ylo = domain->boxlo[1]; - } else ylo = yscale*force->numeric(FLERR,arg[4]); + } else ylo = yscale*utils::numeric(FLERR,arg[4],false,lmp); if (strcmp(arg[5],"INF") == 0 || strcmp(arg[5],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[5],"INF") == 0) yhi = BIG; else yhi = domain->boxhi[1]; - } else yhi = yscale*force->numeric(FLERR,arg[5]); + } else yhi = yscale*utils::numeric(FLERR,arg[5],false,lmp); if (strcmp(arg[6],"INF") == 0 || strcmp(arg[6],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[6],"INF") == 0) zlo = -BIG; else zlo = domain->boxlo[2]; - } else zlo = zscale*force->numeric(FLERR,arg[6]); + } else zlo = zscale*utils::numeric(FLERR,arg[6],false,lmp); if (strcmp(arg[7],"INF") == 0 || strcmp(arg[7],"EDGE") == 0) { if (domain->box_exist == 0) error->all(FLERR,"Cannot use region INF or EDGE when box does not exist"); if (strcmp(arg[7],"INF") == 0) zhi = BIG; else zhi = domain->boxhi[2]; - } else zhi = zscale*force->numeric(FLERR,arg[7]); + } else zhi = zscale*utils::numeric(FLERR,arg[7],false,lmp); - xy = xscale*force->numeric(FLERR,arg[8]); - xz = xscale*force->numeric(FLERR,arg[9]); - yz = yscale*force->numeric(FLERR,arg[10]); + xy = xscale*utils::numeric(FLERR,arg[8],false,lmp); + xz = xscale*utils::numeric(FLERR,arg[9],false,lmp); + yz = yscale*utils::numeric(FLERR,arg[10],false,lmp); // error check // prism cannot be 0 thickness in any dim, else inverse blows up diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index bf874ad311..4256af4213 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -12,13 +12,14 @@ ------------------------------------------------------------------------- */ #include "region_sphere.h" + +#include "error.h" +#include "input.h" +#include "update.h" +#include "variable.h" + #include #include -#include "update.h" -#include "input.h" -#include "variable.h" -#include "error.h" -#include "force.h" using namespace LAMMPS_NS; @@ -39,7 +40,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : xstyle = VARIABLE; varshape = 1; } else { - xc = xscale*force->numeric(FLERR,arg[2]); + xc = xscale*utils::numeric(FLERR,arg[2],false,lmp); xstyle = CONSTANT; } @@ -51,7 +52,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : ystyle = VARIABLE; varshape = 1; } else { - yc = yscale*force->numeric(FLERR,arg[3]); + yc = yscale*utils::numeric(FLERR,arg[3],false,lmp); ystyle = CONSTANT; } @@ -63,7 +64,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : zstyle = VARIABLE; varshape = 1; } else { - zc = zscale*force->numeric(FLERR,arg[4]); + zc = zscale*utils::numeric(FLERR,arg[4],false,lmp); zstyle = CONSTANT; } @@ -75,7 +76,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : rstyle = VARIABLE; varshape = 1; } else { - radius = xscale*force->numeric(FLERR,arg[5]); + radius = xscale*utils::numeric(FLERR,arg[5],false,lmp); rstyle = CONSTANT; } diff --git a/src/region_union.cpp b/src/region_union.cpp index be1fe6eeff..677f1022f9 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #include "region_union.h" -#include + #include "domain.h" #include "error.h" -#include "force.h" + +#include using namespace LAMMPS_NS; @@ -28,7 +29,7 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), { nregion = 0; if (narg < 5) error->all(FLERR,"Illegal region command"); - int n = force->inumeric(FLERR,arg[2]); + int n = utils::inumeric(FLERR,arg[2],false,lmp); if (n < 2) error->all(FLERR,"Illegal region command"); options(narg-(n+3),&arg[n+3]); diff --git a/src/replicate.cpp b/src/replicate.cpp index 6fe37bc600..374d7113b2 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -12,19 +12,17 @@ ------------------------------------------------------------------------- */ #include "replicate.h" -#include -#include + +#include "accelerator_kokkos.h" #include "atom.h" #include "atom_vec.h" -#include "force.h" -#include "domain.h" #include "comm.h" -#include "special.h" -#include "accelerator_kokkos.h" -#include "memory.h" +#include "domain.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "memory.h" +#include "special.h" + +#include using namespace LAMMPS_NS; @@ -52,9 +50,9 @@ void Replicate::command(int narg, char **arg) // nrep = total # of replications - int nx = force->inumeric(FLERR,arg[0]); - int ny = force->inumeric(FLERR,arg[1]); - int nz = force->inumeric(FLERR,arg[2]); + int nx = utils::inumeric(FLERR,arg[0],false,lmp); + int ny = utils::inumeric(FLERR,arg[1],false,lmp); + int nz = utils::inumeric(FLERR,arg[2],false,lmp); int nrep = nx*ny*nz; int bbox_flag = 0; diff --git a/src/rerun.cpp b/src/rerun.cpp index 3cd1c53628..51c0f6fdb2 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -12,17 +12,18 @@ ------------------------------------------------------------------------- */ #include "rerun.h" -#include -#include "read_dump.h" + #include "domain.h" -#include "update.h" +#include "error.h" +#include "finish.h" #include "integrate.h" #include "modify.h" #include "output.h" -#include "finish.h" +#include "read_dump.h" #include "timer.h" -#include "error.h" -#include "force.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -70,34 +71,34 @@ void Rerun::command(int narg, char **arg) while (iarg < narg) { if (strcmp(arg[iarg],"first") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); - first = force->bnumeric(FLERR,arg[iarg+1]); + first = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (first < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"last") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); - last = force->bnumeric(FLERR,arg[iarg+1]); + last = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (last < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); - nevery = force->inumeric(FLERR,arg[iarg+1]); + nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nevery < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"skip") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); - nskip = force->inumeric(FLERR,arg[iarg+1]); + nskip = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nskip <= 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); startflag = 1; - start = force->bnumeric(FLERR,arg[iarg+1]); + start = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (start < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"stop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal rerun command"); stopflag = 1; - stop = force->bnumeric(FLERR,arg[iarg+1]); + stop = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); if (stop < 0) error->all(FLERR,"Illegal rerun command"); iarg += 2; } else if (strcmp(arg[iarg],"dump") == 0) { diff --git a/src/reset_atom_ids.cpp b/src/reset_atom_ids.cpp index 526de60cba..406df7e608 100644 --- a/src/reset_atom_ids.cpp +++ b/src/reset_atom_ids.cpp @@ -12,19 +12,19 @@ ------------------------------------------------------------------------- */ #include "reset_atom_ids.h" -#include -#include + #include "atom.h" #include "atom_vec.h" -#include "domain.h" #include "comm.h" -#include "modify.h" -#include "fix.h" -#include "special.h" -#include "memory.h" +#include "domain.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "fix.h" +#include "memory.h" +#include "modify.h" +#include "special.h" + +#include +#include using namespace LAMMPS_NS; @@ -34,7 +34,6 @@ using namespace LAMMPS_NS; ResetIDs::AtomRvous *ResetIDs::sortrvous; static int compare_coords(const void *, const void *); #else -#include "mergesort.h" // prototype for non-class function static int compare_coords(const int, const int, void *); #endif @@ -509,7 +508,7 @@ int ResetIDs::sort_bins(int n, char *inbuf, sortrvous = in; qsort(order,count[ibin],sizeof(int),compare_coords); #else - merge_sort(order,count[ibin],(void *) in,compare_coords); + utils::merge_sort(order,count[ibin],(void *) in,compare_coords); #endif head[ibin] = last[ibin] = -1; diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index a6cfb69185..ad2caad656 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -16,17 +16,17 @@ ------------------------------------------------------------------------- */ #include "reset_mol_ids.h" -#include + #include "atom.h" -#include "domain.h" #include "comm.h" +#include "compute_chunk_atom.h" +#include "compute_fragment_atom.h" +#include "domain.h" +#include "error.h" #include "group.h" #include "modify.h" -#include "compute_fragment_atom.h" -#include "compute_chunk_atom.h" -#include "utils.h" -#include "error.h" -#include "fmt/format.h" + +#include using namespace LAMMPS_NS; diff --git a/src/reset_mol_ids.h b/src/reset_mol_ids.h index 9d2dd24bc8..fbb6fceb03 100644 --- a/src/reset_mol_ids.h +++ b/src/reset_mol_ids.h @@ -21,7 +21,6 @@ CommandStyle(reset_mol_ids,ResetMolIDs) #define LMP_RESET_MOL_IDS_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/src/respa.cpp b/src/respa.cpp index f894333e39..c970c63a19 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -16,30 +16,29 @@ ------------------------------------------------------------------------- */ #include "respa.h" -#include -#include -#include "neighbor.h" + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "domain.h" -#include "comm.h" -#include "fix.h" -#include "force.h" -#include "pair.h" #include "bond.h" -#include "angle.h" +#include "comm.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "fix_respa.h" +#include "force.h" #include "improper.h" #include "kspace.h" -#include "output.h" -#include "update.h" #include "modify.h" -#include "fix_respa.h" -#include "timer.h" -#include "error.h" -#include "utils.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" #include "pair_hybrid.h" -#include "fmt/format.h" +#include "timer.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -53,13 +52,13 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : nhybrid_styles = 0; if (narg < 1) error->all(FLERR,"Illegal run_style respa command"); - nlevels = force->inumeric(FLERR,arg[0]); + nlevels = utils::inumeric(FLERR,arg[0],false,lmp); if (nlevels < 1) error->all(FLERR,"Respa levels must be >= 1"); if (narg < nlevels) error->all(FLERR,"Illegal run_style respa command"); loop = new int[nlevels]; for (int iarg = 1; iarg < nlevels; iarg++) { - loop[iarg-1] = force->inumeric(FLERR,arg[iarg]); + loop[iarg-1] = utils::inumeric(FLERR,arg[iarg],false,lmp); if (loop[iarg-1] <= 0) error->all(FLERR,"Illegal run_style respa command"); } loop[nlevels-1] = 1; @@ -81,43 +80,43 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg],"bond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_bond = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_bond = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_angle = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_angle = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_dihedral = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_dihedral = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"improper") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_improper = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_improper = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"pair") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_pair = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_pair = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"inner") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_inner = force->inumeric(FLERR,arg[iarg+1]) - 1; - cutoff[0] = force->numeric(FLERR,arg[iarg+2]); - cutoff[1] = force->numeric(FLERR,arg[iarg+3]); + level_inner = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; + cutoff[0] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + cutoff[1] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"middle") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_middle = force->inumeric(FLERR,arg[iarg+1]) - 1; - cutoff[2] = force->numeric(FLERR,arg[iarg+2]); - cutoff[3] = force->numeric(FLERR,arg[iarg+3]); + level_middle = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; + cutoff[2] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + cutoff[3] = utils::numeric(FLERR,arg[iarg+3],false,lmp); iarg += 4; } else if (strcmp(arg[iarg],"outer") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_outer = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_outer = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"kspace") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run_style respa command"); - level_kspace = force->inumeric(FLERR,arg[iarg+1]) - 1; + level_kspace = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; iarg += 2; } else if (strcmp(arg[iarg],"hybrid") == 0) { // the hybrid keyword requires a hybrid pair style @@ -132,7 +131,7 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : hybrid_compute = new int[nhybrid_styles]; for (int i=0; i < nhybrid_styles; ++i) { ++iarg; - hybrid_level[i] = force->inumeric(FLERR,arg[iarg])-1; + hybrid_level[i] = utils::inumeric(FLERR,arg[iarg],false,lmp)-1; } ++iarg; } else error->all(FLERR,"Illegal run_style respa command"); diff --git a/src/run.cpp b/src/run.cpp index 2c2f00a7a8..166955d6ac 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -12,17 +12,18 @@ ------------------------------------------------------------------------- */ #include "run.h" -#include + #include "domain.h" -#include "update.h" -#include "force.h" +#include "error.h" +#include "finish.h" +#include "input.h" #include "integrate.h" #include "modify.h" #include "output.h" -#include "finish.h" -#include "input.h" #include "timer.h" -#include "error.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -45,7 +46,7 @@ void Run::command(int narg, char **arg) if (timer->is_timeout()) return; - bigint nsteps_input = force->bnumeric(FLERR,arg[0]); + bigint nsteps_input = utils::bnumeric(FLERR,arg[0],false,lmp); // parse optional args @@ -68,12 +69,12 @@ void Run::command(int narg, char **arg) } else if (strcmp(arg[iarg],"start") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run command"); startflag = 1; - start = force->bnumeric(FLERR,arg[iarg+1]); + start = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"stop") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run command"); stopflag = 1; - stop = force->bnumeric(FLERR,arg[iarg+1]); + stop = utils::bnumeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"pre") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal run command"); @@ -94,7 +95,7 @@ void Run::command(int narg, char **arg) } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); - nevery = force->inumeric(FLERR,arg[iarg+1]); + nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal run command"); first = iarg+2; last = narg-1; diff --git a/src/set.cpp b/src/set.cpp index 01176f68c0..3b2cd44ad0 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -12,32 +12,30 @@ ------------------------------------------------------------------------- */ #include "set.h" -#include -#include -#include -#include + #include "atom.h" #include "atom_vec.h" +#include "atom_vec_body.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" -#include "atom_vec_body.h" -#include "domain.h" -#include "region.h" -#include "group.h" #include "comm.h" -#include "force.h" -#include "input.h" -#include "variable.h" -#include "random_park.h" -#include "random_mars.h" -#include "math_extra.h" -#include "math_const.h" -#include "memory.h" +#include "domain.h" #include "error.h" +#include "force.h" +#include "group.h" +#include "input.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" #include "modify.h" -#include "utils.h" -#include "fmt/format.h" +#include "random_mars.h" +#include "random_park.h" +#include "region.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -95,15 +93,15 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg],"type") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else ivalue = force->inumeric(FLERR,arg[iarg+1]); + else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); set(TYPE); iarg += 2; } else if (strcmp(arg[iarg],"type/fraction") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - newtype = force->inumeric(FLERR,arg[iarg+1]); - fraction = force->numeric(FLERR,arg[iarg+2]); - ivalue = force->inumeric(FLERR,arg[iarg+3]); + newtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + fraction = utils::numeric(FLERR,arg[iarg+2],false,lmp); + ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (newtype <= 0 || newtype > atom->ntypes) error->all(FLERR,"Invalid value in set command"); if (fraction < 0.0 || fraction > 1.0) @@ -115,9 +113,9 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"type/ratio") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - newtype = force->inumeric(FLERR,arg[iarg+1]); - fraction = force->numeric(FLERR,arg[iarg+2]); - ivalue = force->inumeric(FLERR,arg[iarg+3]); + newtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + fraction = utils::numeric(FLERR,arg[iarg+2],false,lmp); + ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (newtype <= 0 || newtype > atom->ntypes) error->all(FLERR,"Invalid value in set command"); if (fraction < 0.0 || fraction > 1.0) @@ -129,9 +127,9 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"type/subset") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); - newtype = force->inumeric(FLERR,arg[iarg+1]); - nsubset = force->bnumeric(FLERR,arg[iarg+2]); - ivalue = force->inumeric(FLERR,arg[iarg+3]); + newtype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + nsubset = utils::bnumeric(FLERR,arg[iarg+2],false,lmp); + ivalue = utils::inumeric(FLERR,arg[iarg+3],false,lmp); if (newtype <= 0 || newtype > atom->ntypes) error->all(FLERR,"Invalid value in set command"); if (nsubset < 0) @@ -144,7 +142,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"mol") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else ivalue = force->inumeric(FLERR,arg[iarg+1]); + else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (!atom->molecule_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MOLECULE); @@ -153,49 +151,49 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"x") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); set(X); iarg += 2; } else if (strcmp(arg[iarg],"y") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); set(Y); iarg += 2; } else if (strcmp(arg[iarg],"z") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); set(Z); iarg += 2; } else if (strcmp(arg[iarg],"vx") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); set(VX); iarg += 2; } else if (strcmp(arg[iarg],"vy") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); set(VY); iarg += 2; } else if (strcmp(arg[iarg],"vz") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); set(VZ); iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->q_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(CHARGE); @@ -204,7 +202,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"mass") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->rmass_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(MASS); @@ -213,11 +211,11 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"shape") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else xvalue = force->numeric(FLERR,arg[iarg+1]); + else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else yvalue = force->numeric(FLERR,arg[iarg+2]); + else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else zvalue = force->numeric(FLERR,arg[iarg+3]); + else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (!atom->ellipsoid_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(SHAPE); @@ -226,7 +224,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"length") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(LENGTH); @@ -235,7 +233,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"tri") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->tri_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(TRI); @@ -244,11 +242,11 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"dipole") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else xvalue = force->numeric(FLERR,arg[iarg+1]); + else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else yvalue = force->numeric(FLERR,arg[iarg+2]); + else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else zvalue = force->numeric(FLERR,arg[iarg+3]); + else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (!atom->mu_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(DIPOLE); @@ -256,8 +254,8 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"dipole/random") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); - dvalue = force->numeric(FLERR,arg[iarg+2]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (!atom->mu_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) @@ -270,13 +268,13 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"spin") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else xvalue = force->numeric(FLERR,arg[iarg+2]); + else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else yvalue = force->numeric(FLERR,arg[iarg+3]); + else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4); - else zvalue = force->numeric(FLERR,arg[iarg+4]); + else zvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (!atom->sp_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(SPIN); @@ -284,8 +282,8 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"spin/random") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); - dvalue = force->numeric(FLERR,arg[iarg+2]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (!atom->sp_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) @@ -298,13 +296,13 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"quat") == 0) { if (iarg+5 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else xvalue = force->numeric(FLERR,arg[iarg+1]); + else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else yvalue = force->numeric(FLERR,arg[iarg+2]); + else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else zvalue = force->numeric(FLERR,arg[iarg+3]); + else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (strstr(arg[iarg+4],"v_") == arg[iarg+4]) varparse(arg[iarg+4],4); - else wvalue = force->numeric(FLERR,arg[iarg+4]); + else wvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp); if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(QUAT); @@ -312,7 +310,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"quat/random") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) @@ -324,7 +322,7 @@ void Set::command(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { - dvalue = force->numeric(FLERR,arg[iarg+1]); + dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); dvalue *= MY_PI/180.0; } if (!atom->line_flag) @@ -334,7 +332,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"theta/random") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (!atom->line_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) @@ -345,11 +343,11 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"angmom") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else xvalue = force->numeric(FLERR,arg[iarg+1]); + else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else yvalue = force->numeric(FLERR,arg[iarg+2]); + else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else zvalue = force->numeric(FLERR,arg[iarg+3]); + else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (!atom->angmom_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(ANGMOM); @@ -358,11 +356,11 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"omega") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else xvalue = force->numeric(FLERR,arg[iarg+1]); + else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else yvalue = force->numeric(FLERR,arg[iarg+2]); + else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else zvalue = force->numeric(FLERR,arg[iarg+3]); + else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (!atom->omega_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(OMEGA); @@ -371,7 +369,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"diameter") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->radius_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(DIAMETER); @@ -381,7 +379,7 @@ void Set::command(int narg, char **arg) (strcmp(arg[iarg],"density/disc") == 0)) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->rmass_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue <= 0.0) error->all(FLERR,"Invalid density in set command"); @@ -397,7 +395,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"volume") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->vfrac_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (dvalue <= 0.0) error->all(FLERR,"Invalid volume in set command"); @@ -410,17 +408,17 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg+1],"NULL") != 0) { ximageflag = 1; if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else ximage = force->inumeric(FLERR,arg[iarg+1]); + else ximage = utils::inumeric(FLERR,arg[iarg+1],false,lmp); } if (strcmp(arg[iarg+2],"NULL") != 0) { yimageflag = 1; if (strstr(arg[iarg+2],"v_") == arg[iarg+2]) varparse(arg[iarg+2],2); - else yimage = force->inumeric(FLERR,arg[iarg+2]); + else yimage = utils::inumeric(FLERR,arg[iarg+2],false,lmp); } if (strcmp(arg[iarg+3],"NULL") != 0) { zimageflag = 1; if (strstr(arg[iarg+3],"v_") == arg[iarg+3]) varparse(arg[iarg+3],3); - else zimage = force->inumeric(FLERR,arg[iarg+3]); + else zimage = utils::inumeric(FLERR,arg[iarg+3],false,lmp); } if (ximageflag && ximage && !domain->xperiodic) error->all(FLERR, @@ -436,7 +434,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"bond") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->avec->bonds_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nbondtypes) @@ -446,7 +444,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->avec->angles_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nangletypes) @@ -456,7 +454,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"dihedral") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->ndihedraltypes) @@ -466,7 +464,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"improper") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - ivalue = force->inumeric(FLERR,arg[iarg+1]); + ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (atom->avec->impropers_allow == 0) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0 || ivalue > atom->nimpropertypes) @@ -477,7 +475,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"sph/e") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->esph_flag) error->all(FLERR,"Cannot set meso/e for this atom style"); set(SPH_E); @@ -486,7 +484,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"sph/cv") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->cv_flag) error->all(FLERR,"Cannot set meso/cv for this atom style"); set(SPH_CV); @@ -495,7 +493,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"sph/rho") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->rho_flag) error->all(FLERR,"Cannot set meso/rho for this atom style"); set(SPH_RHO); @@ -506,7 +504,7 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { - dvalue = force->numeric(FLERR,arg[iarg+1]); + dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); } if (!atom->edpd_flag) @@ -519,7 +517,7 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { - dvalue = force->numeric(FLERR,arg[iarg+1]); + dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); } if (!atom->edpd_flag) @@ -532,8 +530,8 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { - cc_index = force->inumeric(FLERR,arg[iarg+1]); - dvalue = force->numeric(FLERR,arg[iarg+2]); + cc_index = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); if (cc_index < 1) error->all(FLERR,"Illegal set command"); } if (!atom->tdpd_flag) @@ -544,7 +542,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"smd/mass/density") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->smd_flag) error->all(FLERR,"Cannot set smd/mass/density for this atom style"); set(SMD_MASS_DENSITY); @@ -553,7 +551,7 @@ void Set::command(int narg, char **arg) } else if (strcmp(arg[iarg],"smd/contact/radius") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (!atom->smd_flag) error->all(FLERR,"Cannot set smd/contact/radius " "for this atom style"); @@ -565,7 +563,7 @@ void Set::command(int narg, char **arg) if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; else if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); else { - dvalue = force->numeric(FLERR,arg[iarg+1]); + dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); } if (!atom->dpd_flag) @@ -576,7 +574,7 @@ void Set::command(int narg, char **arg) } else if (strstr(arg[iarg],"i_") == arg[iarg]) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else ivalue = force->inumeric(FLERR,arg[iarg+1]); + else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); int flag; index_custom = atom->find_custom(&arg[iarg][2],flag); if (index_custom < 0 || flag != 0) @@ -587,7 +585,7 @@ void Set::command(int narg, char **arg) } else if (strstr(arg[iarg],"d_") == arg[iarg]) { if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); if (strstr(arg[iarg+1],"v_") == arg[iarg+1]) varparse(arg[iarg+1],1); - else dvalue = force->numeric(FLERR,arg[iarg+1]); + else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); int flag; index_custom = atom->find_custom(&arg[iarg][2],flag); if (index_custom < 0 || flag != 1) @@ -633,7 +631,7 @@ void Set::selection(int n) if (atom->tag_enable == 0) error->all(FLERR,"Cannot use set atom with no atom IDs defined"); bigint nlobig,nhibig; - force->boundsbig(FLERR,id,MAXTAGINT,nlobig,nhibig); + utils::bounds(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error); tagint *tag = atom->tag; for (int i = 0; i < n; i++) @@ -644,7 +642,7 @@ void Set::selection(int n) if (atom->molecule_flag == 0) error->all(FLERR,"Cannot use set mol with no molecule IDs defined"); bigint nlobig,nhibig; - force->boundsbig(FLERR,id,MAXTAGINT,nlobig,nhibig); + utils::bounds(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error); tagint *molecule = atom->molecule; for (int i = 0; i < n; i++) @@ -652,7 +650,7 @@ void Set::selection(int n) else select[i] = 0; } else if (style == TYPE_SELECT) { - force->bounds(FLERR,id,atom->ntypes,nlo,nhi); + utils::bounds(FLERR,id,1,atom->ntypes,nlo,nhi,error); int *type = atom->type; for (int i = 0; i < n; i++) diff --git a/src/special.cpp b/src/special.cpp index 3780fab5c0..eb74f534f7 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -12,18 +12,16 @@ ------------------------------------------------------------------------- */ #include "special.h" -#include -#include "atom.h" -#include "atom_vec.h" -#include "force.h" -#include "comm.h" -#include "modify.h" -#include "fix.h" + #include "accelerator_kokkos.h" // IWYU pragma: export +#include "atom.h" #include "atom_masks.h" +#include "atom_vec.h" +#include "comm.h" +#include "fix.h" +#include "force.h" #include "memory.h" -#include "utils.h" -#include "fmt/format.h" +#include "modify.h" using namespace LAMMPS_NS; diff --git a/src/table_file_reader.cpp b/src/table_file_reader.cpp index 525db24961..50843c119e 100644 --- a/src/table_file_reader.cpp +++ b/src/table_file_reader.cpp @@ -15,14 +15,10 @@ Contributing authors: Richard Berger (Temple U) ------------------------------------------------------------------------- */ -#include "lammps.h" -#include "error.h" #include "table_file_reader.h" -#include "utils.h" -#include "tokenizer.h" -#include "fmt/format.h" -#include +#include "text_file_reader.h" +#include "tokenizer.h" using namespace LAMMPS_NS; diff --git a/src/text_file_reader.cpp b/src/text_file_reader.cpp index 8abe1b001f..3c63bba5fb 100644 --- a/src/text_file_reader.cpp +++ b/src/text_file_reader.cpp @@ -15,19 +15,27 @@ Contributing authors: Richard Berger (Temple U) ------------------------------------------------------------------------- */ -#include "lammps.h" -#include "force.h" -#include "error.h" -#include "comm.h" -#include "utils.h" #include "text_file_reader.h" -#include "tokenizer.h" + #include "fmt/format.h" +#include "tokenizer.h" +#include "utils.h" #include using namespace LAMMPS_NS; +/** Class for reading and parsing text files + * + * The value of the class member variable *ignore_comments* controls + * whether any text following the pound sign (#) should be ignored (true) + * or not (false). Default: true, i.e. ignore. + * + * \param filename Name of file to be read + * \param filetype Description of file type for error messages + * + * \sa PotentialFileReader */ + TextFileReader::TextFileReader(const std::string &filename, const std::string &filetype) : filename(filename), filetype(filetype), ignore_comments(true) { @@ -38,10 +46,14 @@ TextFileReader::TextFileReader(const std::string &filename, const std::string &f } } +/** Closes the file */ + TextFileReader::~TextFileReader() { fclose(fp); } +/** Read the next line and ignore it */ + void TextFileReader::skip_line() { char *ptr = fgets(line, MAXLINE, fp); if (ptr == nullptr) { @@ -50,6 +62,20 @@ void TextFileReader::skip_line() { } } +/** Read the next line(s) until *nparams* words have been read. + * + * This reads a line and counts the words in it, if the number + * is less than the requested number, it will read the next + * line, as well. Output will be a string with all read lines + * combined. The purpose is to somewhat replicate the reading + * behavior of formatted files in Fortran. + * + * If the *ignore_comments* class member has the value *true*, + * then any text read in is truncated at the first '#' character. + * + * \param nparams Number of words that must be read. Default: 0 + * \return String with the concatenated text */ + char *TextFileReader::next_line(int nparams) { // concatenate lines until have nparams words int n = 0; @@ -82,7 +108,6 @@ char *TextFileReader::next_line(int nparams) { return nullptr; } - // strip comment if (ignore_comments && (ptr = strchr(line, '#'))) *ptr = '\0'; @@ -97,6 +122,15 @@ char *TextFileReader::next_line(int nparams) { return line; } +/** Read lines until *n* doubles have been read and stored in array *list* + * + * This reads lines from the file using the next_line() function, + * and splits them into floating-point numbers using the + * ValueTokenizer class and stores the number is the provided list. + * + * \param list Pointer to array with suitable storage for *n* doubles + * \param n Number of doubles to be read */ + void TextFileReader::next_dvector(double * list, int n) { int i = 0; while (i < n) { @@ -116,6 +150,16 @@ void TextFileReader::next_dvector(double * list, int n) { } } +/** Read text until *nparams* words are read and passed to a tokenizer object for custom parsing. + * + * This reads lines from the file using the next_line() function, + * and splits them into floating-point numbers using the + * ValueTokenizer class and stores the number is the provided list. + * + * \param nparams Number of words to be read + * \param separators String with list of separators. + * \return ValueTokenizer object for read in text */ + ValueTokenizer TextFileReader::next_values(int nparams, const std::string & separators) { return ValueTokenizer(next_line(nparams), separators); } diff --git a/src/text_file_reader.h b/src/text_file_reader.h index 80a5d756ea..65af0a08d9 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -18,11 +18,10 @@ #ifndef LMP_TEXT_FILE_READER_H #define LMP_TEXT_FILE_READER_H -#include -#include -#include #include "tokenizer.h" +#include + namespace LAMMPS_NS { class TextFileReader { @@ -33,7 +32,7 @@ namespace LAMMPS_NS FILE *fp; public: - bool ignore_comments; + bool ignore_comments; //!< Controls whether comments are ignored TextFileReader(const std::string &filename, const std::string &filetype); ~TextFileReader(); diff --git a/src/thermo.cpp b/src/thermo.cpp index 547d363285..787b0cdda8 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -16,37 +16,36 @@ // before lmptype.h can set flags to insure it is done correctly #include "thermo.h" -#include + +#include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" +#include "compute.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "fix.h" +#include "force.h" +#include "group.h" +#include "improper.h" +#include "input.h" +#include "kspace.h" +#include "lattice.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" +#include "timer.h" +#include "tokenizer.h" +#include "universe.h" +#include "update.h" +#include "variable.h" + #include #include -#include "atom.h" -#include "update.h" -#include "comm.h" -#include "domain.h" -#include "universe.h" -#include "lattice.h" -#include "group.h" -#include "modify.h" -#include "fix.h" -#include "compute.h" -#include "input.h" -#include "variable.h" -#include "neighbor.h" -#include "force.h" -#include "pair.h" -#include "bond.h" -#include "angle.h" -#include "dihedral.h" -#include "improper.h" -#include "kspace.h" -#include "output.h" -#include "timer.h" -#include "memory.h" -#include "error.h" -#include "math_const.h" -#include "utils.h" -#include "fmt/format.h" -#include "tokenizer.h" using namespace LAMMPS_NS; using namespace MathConst; @@ -126,7 +125,7 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) int expand = 0; char **earg; - int nvalues = input->expand_args(narg-1,&arg[1],0,earg); + int nvalues = utils::expand_args(FLERR,narg-1,&arg[1],0,earg,lmp); if (earg != &arg[1]) expand = 1; line = new char[256+nvalues*64]; @@ -608,7 +607,7 @@ void Thermo::modify_params(int narg, char **arg) format_float_user = new char[n]; strcpy(format_float_user,arg[iarg+2]); } else { - int i = force->inumeric(FLERR,arg[iarg+1]) - 1; + int i = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; if (i < 0 || i >= nfield_initial+1) error->all(FLERR,"Illegal thermo_modify command"); if (format_column_user[i]) delete [] format_column_user[i]; diff --git a/src/timer.cpp b/src/timer.cpp index 97f0e8abab..adf143b4ae 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -12,13 +12,11 @@ ------------------------------------------------------------------------- */ #include "timer.h" -#include -#include -#include + #include "comm.h" #include "error.h" -#include "force.h" -#include "utils.h" + +#include #ifdef _WIN32 #include @@ -277,7 +275,7 @@ void Timer::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"every") == 0) { ++iarg; if (iarg < narg) { - _checkfreq = force->inumeric(FLERR,arg[iarg]); + _checkfreq = utils::inumeric(FLERR,arg[iarg],false,lmp); if (_checkfreq <= 0) error->all(FLERR,"Illegal timers command"); } else error->all(FLERR,"Illegal timers command"); diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 62605f76c3..3b172181a2 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -17,9 +17,11 @@ #include "tokenizer.h" #include "utils.h" -#include #include "fmt/format.h" +#include +#include + using namespace LAMMPS_NS; TokenizerException::TokenizerException(const std::string & msg, const std::string & token){ @@ -30,6 +32,16 @@ TokenizerException::TokenizerException(const std::string & msg, const std::strin } } +/** Class for splitting text into words + * + * This tokenizer will break down a string into sub-strings (i.e words) + * separated by the given separator characters. + * + * \param str string to be processed + * \param separators string with separator characters (default: " \t\r\n\f") + * + * \sa ValueTokenizer TokenizerException */ + Tokenizer::Tokenizer(const std::string & str, const std::string & separators) : text(str), separators(separators), start(0), ntokens(std::string::npos) { @@ -48,14 +60,23 @@ Tokenizer::Tokenizer(Tokenizer && rhs) : reset(); } +/*! Re-position the tokenizer state to the first word, + * i.e. the first non-separator character */ void Tokenizer::reset() { start = text.find_first_not_of(separators); } +/*! Search the text to be processed for a sub-string. + * + * \param str string to be searched for + * \return true if string was found, false if not */ bool Tokenizer::contains(const std::string & str) const { return text.find(str) != std::string::npos; } +/*! Skip over a given number of tokens + * + * \param n number of tokens to skip over */ void Tokenizer::skip(int n) { for(int i = 0; i < n; ++i) { if(!has_next()) throw TokenizerException("No more tokens", ""); @@ -70,10 +91,16 @@ void Tokenizer::skip(int n) { } } +/*! Indicate whether more tokens are available + * + * \return true if there are more tokens, false if not */ bool Tokenizer::has_next() const { return start != std::string::npos; } +/*! Retrieve next token. + * + * \return string with the next token */ std::string Tokenizer::next() { if(!has_next()) throw TokenizerException("No more tokens", ""); @@ -90,6 +117,9 @@ std::string Tokenizer::next() { return token; } +/*! Count number of tokens in text. + * + * \return number of counted tokens */ size_t Tokenizer::count() { // lazy evaluation if (ntokens == std::string::npos) { @@ -98,6 +128,9 @@ size_t Tokenizer::count() { return ntokens; } +/*! Retrieve the entire text converted to an STL vector of tokens. + * + * \return The STL vector */ std::vector Tokenizer::as_vector() { // store current state size_t current = start; @@ -117,6 +150,12 @@ std::vector Tokenizer::as_vector() { return tokens; } +/*! Class for reading text with numbers + * + * \param str String to be processed + * \param separators String with separator characters (default: " \t\r\n\f") + * + * \sa Tokenizer InvalidIntegerException InvalidFloatException */ ValueTokenizer::ValueTokenizer(const std::string & str, const std::string & separators) : tokens(str, separators) { } @@ -127,14 +166,24 @@ ValueTokenizer::ValueTokenizer(const ValueTokenizer & rhs) : tokens(rhs.tokens) ValueTokenizer::ValueTokenizer(ValueTokenizer && rhs) : tokens(std::move(rhs.tokens)) { } +/*! Indicate whether more tokens are available + * + * \return true if there are more tokens, false if not */ bool ValueTokenizer::has_next() const { return tokens.has_next(); } +/*! Search the text to be processed for a sub-string. + * + * \param value string with value to be searched for + * \return true if string was found, false if not */ bool ValueTokenizer::contains(const std::string & value) const { return tokens.contains(value); } +/*! Retrieve next token + * + * \return string with next token */ std::string ValueTokenizer::next_string() { if (has_next()) { std::string value = tokens.next(); @@ -143,6 +192,9 @@ std::string ValueTokenizer::next_string() { return ""; } +/*! Retrieve next token and convert to int + * + * \return value of next token */ int ValueTokenizer::next_int() { if (has_next()) { std::string current = tokens.next(); @@ -155,6 +207,9 @@ int ValueTokenizer::next_int() { return 0; } +/*! Retrieve next token and convert to bigint + * + * \return value of next token */ bigint ValueTokenizer::next_bigint() { if (has_next()) { std::string current = tokens.next(); @@ -167,6 +222,9 @@ bigint ValueTokenizer::next_bigint() { return 0; } +/*! Retrieve next token and convert to tagint + * + * \return value of next token */ tagint ValueTokenizer::next_tagint() { if (has_next()) { std::string current = tokens.next(); @@ -179,6 +237,9 @@ tagint ValueTokenizer::next_tagint() { return 0; } +/*! Retrieve next token and convert to double + * + * \return value of next token */ double ValueTokenizer::next_double() { if (has_next()) { std::string current = tokens.next(); @@ -191,10 +252,16 @@ double ValueTokenizer::next_double() { return 0.0; } +/*! Skip over a given number of tokens + * + * \param n number of tokens to skip over */ void ValueTokenizer::skip(int n) { tokens.skip(n); } +/*! Count number of tokens in text. + * + * \return number of counted tokens */ size_t ValueTokenizer::count() { return tokens.count(); } diff --git a/src/tokenizer.h b/src/tokenizer.h index cc77c8ee0d..2db9870866 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -18,10 +18,11 @@ #ifndef LMP_TOKENIZER_H #define LMP_TOKENIZER_H -#include -#include #include "lmptype.h" -#include + +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export namespace LAMMPS_NS { @@ -33,7 +34,7 @@ class Tokenizer { size_t start; size_t ntokens; public: - Tokenizer(const std::string & str, const std::string & separators = TOKENIZER_DEFAULT_SEPARATORS); + Tokenizer(const std::string &str, const std::string &separators = TOKENIZER_DEFAULT_SEPARATORS); Tokenizer(Tokenizer &&); Tokenizer(const Tokenizer &); Tokenizer& operator=(const Tokenizer&) = default; @@ -42,7 +43,7 @@ public: void reset(); void skip(int n); bool has_next() const; - bool contains(const std::string & str) const; + bool contains(const std::string &str) const; std::string next(); size_t count(); @@ -52,11 +53,17 @@ public: class TokenizerException : public std::exception { std::string message; public: - TokenizerException(const std::string & msg, const std::string & token); + /** Thrown during retrieving or skipping tokens + * + * \param msg String with error message + * \param token String of the token/word that caused the error */ + TokenizerException(const std::string &msg, const std::string &token); ~TokenizerException() throw() { } + /** Retrieve message describing the thrown exception + * \return string with error message */ virtual const char * what() const throw() { return message.c_str(); } @@ -64,20 +71,26 @@ public: class InvalidIntegerException : public TokenizerException { public: - InvalidIntegerException(const std::string & token) : TokenizerException("Not a valid integer number", token) { - } + /** Thrown during converting string to integer number + * + * \param token String of the token/word that caused the error */ + InvalidIntegerException(const std::string &token) + : TokenizerException("Not a valid integer number", token) {} }; class InvalidFloatException : public TokenizerException { public: - InvalidFloatException(const std::string & token) : TokenizerException("Not a valid floating-point number", token) { - } + /** Thrown during converting string to floating point number + * + * \param token String of the token/word that caused the error */ + InvalidFloatException(const std::string &token) + : TokenizerException("Not a valid floating-point number", token) {} }; class ValueTokenizer { Tokenizer tokens; public: - ValueTokenizer(const std::string & str, const std::string & separators = TOKENIZER_DEFAULT_SEPARATORS); + ValueTokenizer(const std::string &str, const std::string &separators = TOKENIZER_DEFAULT_SEPARATORS); ValueTokenizer(const ValueTokenizer &); ValueTokenizer(ValueTokenizer &&); ValueTokenizer& operator=(const ValueTokenizer&) = default; @@ -90,7 +103,7 @@ public: double next_double(); bool has_next() const; - bool contains(const std::string & value) const; + bool contains(const std::string &value) const; void skip(int ntokens); size_t count(); diff --git a/src/universe.cpp b/src/universe.cpp index 0fad232d2c..cd079a45c0 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -12,23 +12,18 @@ ------------------------------------------------------------------------- */ #include "universe.h" -#include -#include -#include -#include -#include "version.h" + #include "error.h" -#include "force.h" #include "memory.h" -#include "utils.h" -#include "fmt/format.h" +#include "version.h" + +#include +#include using namespace LAMMPS_NS; #define MAXLINE 256 -static char *date2num(const char *version); - /* ---------------------------------------------------------------------- create & initialize the universe of processors in communicator ------------------------------------------------------------------------- */ @@ -36,7 +31,9 @@ static char *date2num(const char *version); Universe::Universe(LAMMPS *lmp, MPI_Comm communicator) : Pointers(lmp) { version = (const char *) LAMMPS_VERSION; - num_ver = date2num(version); + auto tmp_ver = new char[10]; + snprintf(tmp_ver,10,"%08d",utils::date2num(version)); + num_ver = tmp_ver; uworld = uorig = communicator; MPI_Comm_rank(uworld,&me); @@ -84,7 +81,7 @@ void Universe::reorder(char *style, char *arg) if (uworld != uorig) MPI_Comm_free(&uworld); if (strcmp(style,"nth") == 0) { - int n = force->inumeric(FLERR,arg); + int n = utils::inumeric(FLERR,arg,false,lmp); if (n <= 0) error->universe_all(FLERR,"Invalid -reorder N value"); if (nprocs % n) @@ -237,43 +234,3 @@ int Universe::consistent() if (n == nprocs) return 1; else return 0; } - -// helper function to convert the LAMMPS date string to a version id -// that can be used for both string and numerical comparisons -// where newer versions are larger than older ones. - -char *date2num(const char *version) -{ - int day,month,year; - day = month = year = 0; - - if (version) { - - day = atoi(version); - - while (*version != '\0' && (isdigit(*version) || *version == ' ')) - ++version; - - if (strncmp(version,"Jan",3) == 0) month = 1; - if (strncmp(version,"Feb",3) == 0) month = 2; - if (strncmp(version,"Mar",3) == 0) month = 3; - if (strncmp(version,"Apr",3) == 0) month = 4; - if (strncmp(version,"May",3) == 0) month = 5; - if (strncmp(version,"Jun",3) == 0) month = 6; - if (strncmp(version,"Jul",3) == 0) month = 7; - if (strncmp(version,"Aug",3) == 0) month = 8; - if (strncmp(version,"Sep",3) == 0) month = 9; - if (strncmp(version,"Oct",3) == 0) month = 10; - if (strncmp(version,"Nov",3) == 0) month = 11; - if (strncmp(version,"Dec",3) == 0) month = 12; - - while (*version != '\0' && !isdigit(*version)) - ++version; - - year = atoi(version); - } - - char *ver = new char[12]; - snprintf(ver,12,"%04d%02d%02d", year % 10000, month, day % 100); - return ver; -} diff --git a/src/update.cpp b/src/update.cpp index 612b4de409..399584473c 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -15,8 +15,8 @@ #include #include "integrate.h" #include "min.h" -#include "style_integrate.h" -#include "style_minimize.h" +#include "style_integrate.h" // IWYU pragma: keep +#include "style_minimize.h" // IWYU pragma: keep #include "neighbor.h" #include "force.h" #include "modify.h" @@ -61,7 +61,7 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) #define INTEGRATE_CLASS #define IntegrateStyle(key,Class) \ (*integrate_map)[#key] = &integrate_creator; -#include "style_integrate.h" +#include "style_integrate.h" // IWYU pragma: keep #undef IntegrateStyle #undef INTEGRATE_CLASS @@ -70,7 +70,7 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) #define MINIMIZE_CLASS #define MinimizeStyle(key,Class) \ (*minimize_map)[#key] = &minimize_creator; -#include "style_minimize.h" +#include "style_minimize.h" // IWYU pragma: keep #undef MinimizeStyle #undef MINIMIZE_CLASS @@ -446,7 +446,7 @@ Min *Update::minimize_creator(LAMMPS *lmp) void Update::reset_timestep(int narg, char **arg) { if (narg != 1) error->all(FLERR,"Illegal reset_timestep command"); - bigint newstep = force->bnumeric(FLERR,arg[0]); + bigint newstep = utils::bnumeric(FLERR,arg[0],false,lmp); reset_timestep(newstep); } diff --git a/src/update.h b/src/update.h index e70325a498..558719f4cc 100644 --- a/src/update.h +++ b/src/update.h @@ -15,8 +15,8 @@ #define LMP_UPDATE_H #include "pointers.h" + #include -#include namespace LAMMPS_NS { diff --git a/src/utils.cpp b/src/utils.cpp index f841086673..f63deac0dc 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -12,14 +12,20 @@ ------------------------------------------------------------------------- */ #include "utils.h" -#include -#include -#include -#include "lammps.h" + +#include "comm.h" +#include "compute.h" #include "error.h" -#include "tokenizer.h" +#include "fix.h" +#include "memory.h" +#include "modify.h" #include "text_file_reader.h" -#include "fmt/format.h" +#include "tokenizer.h" +#include "update.h" + +#include +#include +#include #if defined(__linux__) #include // for readlink @@ -65,13 +71,23 @@ extern "C" static int re_match(const char *text, const char *pattern); } +//////////////////////////////////////////////////////////////////////// +// Merge sort support functions + +static void do_merge(int *idx, int *buf, int llo, int lhi, int rlo, int rhi, + void *ptr, int (*comp)(int, int, void *)); +static void insertion_sort(int *index, int num, void *ptr, + int (*comp)(int, int, void*)); + +//////////////////////////////////////////////////////////////////////// + using namespace LAMMPS_NS; /** More flexible and specific matching of a string against a pattern. * This function is supposed to be a more safe, more specific and * simple to use API to find pattern matches. The purpose is to replace * uses of either strncmp() or strstr() in the code base to find - * substrings safely. With strncmp() finding prefixes, the number of + * sub-strings safely. With strncmp() finding prefixes, the number of * characters to match must be counted, which can lead to errors, * while using "^pattern" will do the same with less problems. * Matching for suffixes using strstr() is not as specific as 'pattern$', @@ -88,7 +104,7 @@ bool utils::strmatch(const std::string &text, const std::string &pattern) return (pos >= 0); } -/* This simplifies the repetitive task of outputting some +/** This function simplifies the repetitive task of outputting some * message to both the screen and/or the log file. In combination * with using fmt::format(), which returns the formatted text * in a std::string() instance, this can be used to reduce @@ -109,9 +125,11 @@ std::string utils::getsyserror() return std::string(strerror(errno)); } -/* - * On Linux the folder /proc/self/fd holds symbolic links to the actual +/** On Linux the folder /proc/self/fd holds symbolic links to the actual * pathnames associated with each open file descriptor of the current process. + * + * This function is used to provide a filename with error messages in functions + * where the filename is not passed as an argument, but the FILE * pointer. */ const char *utils::guesspath(char *buf, int len, FILE *fp) { @@ -348,6 +366,184 @@ tagint utils::tnumeric(const char *file, int line, const char *str, return ATOTAGINT(str); } +/* ---------------------------------------------------------------------- + compute bounds implied by numeric str with a possible wildcard asterisk +------------------------------------------------------------------------- */ +template +void utils::bounds(const char *file, int line, const std::string &str, + bigint nmin, bigint nmax, TYPE &nlo, TYPE &nhi, Error *error) +{ + size_t found = str.find_first_of("*"); + + nlo = nhi = -1; + if (found == std::string::npos) { // contains no '*' + nlo = nhi = strtol(str.c_str(),NULL,10); + } else if (str.size() == 1) { // is only '*' + nlo = nmin; + nhi = nmax; + } else if (found == 0) { // is '*j' + nlo = nmin; + nhi = strtol(str.substr(1).c_str(),NULL,10); + } else if (str.size() == found+1) { // is 'i*' + nlo = strtol(str.c_str(),NULL,10); + nhi = nmax; + } else { // is 'i*j' + nlo = strtol(str.c_str(),NULL,10); + nhi = strtol(str.substr(found+1).c_str(),NULL,10); + } + + if (error) { + if (nlo < nmin) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nlo,nmin,nmax)); + else if (nhi > nmax) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nhi,nmin,nmax)); + else if (nlo > nhi) + error->all(file,line,fmt::format("Numeric index {} is out of bounds" + "({}-{})",nlo,nmin,nhi)); + } +} + +template void utils::bounds<>(const char *, int, const std::string &, + bigint, bigint, int &, int &, Error *); +template void utils::bounds<>(const char *, int, const std::string &, + bigint, bigint, long &, long &, Error *); +template void utils::bounds<>(const char *, int, const std::string &, + bigint, bigint, long long &, long long &, Error *); + +/* ------------------------------------------------------------------------- + Expand list of arguments in arg to earg if arg contains wildcards +------------------------------------------------------------------------- */ + +int utils::expand_args(const char *file, int line, int narg, char **arg, + int mode, char **&earg, LAMMPS *lmp) +{ + int n,iarg,index,nlo,nhi,nmax,expandflag,icompute,ifix; + char *ptr1,*ptr2,*str; + + ptr1 = NULL; + for (iarg = 0; iarg < narg; iarg++) { + ptr1 = strchr(arg[iarg],'*'); + if (ptr1) break; + } + + if (!ptr1) { + earg = arg; + return narg; + } + + // maxarg should always end up equal to newarg, so caller can free earg + + int maxarg = narg-iarg; + earg = (char **) lmp->memory->smalloc(maxarg*sizeof(char *),"input:earg"); + + int newarg = 0; + for (iarg = 0; iarg < narg; iarg++) { + expandflag = 0; + + if (strncmp(arg[iarg],"c_",2) == 0 || + strncmp(arg[iarg],"f_",2) == 0) { + + ptr1 = strchr(&arg[iarg][2],'['); + if (ptr1) { + ptr2 = strchr(ptr1,']'); + if (ptr2) { + *ptr2 = '\0'; + if (strchr(ptr1,'*')) { + if (arg[iarg][0] == 'c') { + *ptr1 = '\0'; + icompute = lmp->modify->find_compute(&arg[iarg][2]); + *ptr1 = '['; + + // check for global vector/array, peratom array, local array + + if (icompute >= 0) { + if (mode == 0 && lmp->modify->compute[icompute]->vector_flag) { + nmax = lmp->modify->compute[icompute]->size_vector; + expandflag = 1; + } else if (mode == 1 && lmp->modify->compute[icompute]->array_flag) { + nmax = lmp->modify->compute[icompute]->size_array_cols; + expandflag = 1; + } else if (lmp->modify->compute[icompute]->peratom_flag && + lmp->modify->compute[icompute]->size_peratom_cols) { + nmax = lmp->modify->compute[icompute]->size_peratom_cols; + expandflag = 1; + } else if (lmp->modify->compute[icompute]->local_flag && + lmp->modify->compute[icompute]->size_local_cols) { + nmax = lmp->modify->compute[icompute]->size_local_cols; + expandflag = 1; + } + } + } else if (arg[iarg][0] == 'f') { + *ptr1 = '\0'; + ifix = lmp->modify->find_fix(&arg[iarg][2]); + *ptr1 = '['; + + // check for global vector/array, peratom array, local array + + if (ifix >= 0) { + if (mode == 0 && lmp->modify->fix[ifix]->vector_flag) { + nmax = lmp->modify->fix[ifix]->size_vector; + expandflag = 1; + } else if (mode == 1 && lmp->modify->fix[ifix]->array_flag) { + nmax = lmp->modify->fix[ifix]->size_array_cols; + expandflag = 1; + } else if (lmp->modify->fix[ifix]->peratom_flag && + lmp->modify->fix[ifix]->size_peratom_cols) { + nmax = lmp->modify->fix[ifix]->size_peratom_cols; + expandflag = 1; + } else if (lmp->modify->fix[ifix]->local_flag && + lmp->modify->fix[ifix]->size_local_cols) { + nmax = lmp->modify->fix[ifix]->size_local_cols; + expandflag = 1; + } + } + } + } + *ptr2 = ']'; + } + } + } + + if (expandflag) { + *ptr2 = '\0'; + bounds(file,line,ptr1+1,1,nmax,nlo,nhi,lmp->error); + *ptr2 = ']'; + if (newarg+nhi-nlo+1 > maxarg) { + maxarg += nhi-nlo+1; + earg = (char **) + lmp->memory->srealloc(earg,maxarg*sizeof(char *),"input:earg"); + } + for (index = nlo; index <= nhi; index++) { + n = strlen(arg[iarg]) + 16; // 16 = space for large inserted integer + str = earg[newarg] = new char[n]; + strncpy(str,arg[iarg],ptr1+1-arg[iarg]); + sprintf(&str[ptr1+1-arg[iarg]],"%d",index); + strcat(str,ptr2); + newarg++; + } + + } else { + if (newarg == maxarg) { + maxarg++; + earg = (char **) + lmp->memory->srealloc(earg,maxarg*sizeof(char *),"input:earg"); + } + n = strlen(arg[iarg]) + 1; + earg[newarg] = new char[n]; + strcpy(earg[newarg],arg[iarg]); + newarg++; + } + } + + //printf("NEWARG %d\n",newarg); + //for (int i = 0; i < newarg; i++) + // printf(" arg %d: %s\n",i,earg[i]); + + return newarg; +} + /* ---------------------------------------------------------------------- Return string without leading or trailing whitespace ------------------------------------------------------------------------- */ @@ -606,6 +802,11 @@ bool utils::file_is_readable(const std::string &path) { search current directory and the LAMMPS_POTENTIALS directory if specified ------------------------------------------------------------------------- */ +#if defined(_WIN32) +#define OS_PATH_VAR_SEP ";" +#else +#define OS_PATH_VAR_SEP ":" +#endif std::string utils::get_potential_file_path(const std::string &path) { std::string filepath = path; @@ -615,19 +816,25 @@ std::string utils::get_potential_file_path(const std::string &path) { return filepath; } else { // try the environment variable directory - const char *path = getenv("LAMMPS_POTENTIALS"); + const char *var = getenv("LAMMPS_POTENTIALS"); - if (path != nullptr){ - std::string pot = utils::path_basename(filepath); - filepath = utils::path_join(path, pot); + if (var != nullptr){ + Tokenizer dirs(var,OS_PATH_VAR_SEP); - if (utils::file_is_readable(filepath)) { - return filepath; + while (dirs.has_next()) { + auto pot = utils::path_basename(filepath); + auto path = dirs.next(); + filepath = utils::path_join(path, pot); + + if (utils::file_is_readable(filepath)) { + return filepath; + } } } } return ""; } +#undef OS_PATH_VAR_SEP /* ---------------------------------------------------------------------- read first line of potential file @@ -639,14 +846,10 @@ std::string utils::get_potential_date(const std::string &path, const std::string reader.ignore_comments = false; char *line = reader.next_line(); - ValueTokenizer values(line); - while (values.has_next()) { - std::string word = values.next_string(); - if (word == "DATE:") { - if (values.has_next()) { - std::string date = values.next_string(); - return date; - } + Tokenizer words(line); + while (words.has_next()) { + if (words.next() == "DATE:") { + if (words.has_next()) return words.next(); } } return ""; @@ -662,14 +865,10 @@ std::string utils::get_potential_units(const std::string &path, const std::strin reader.ignore_comments = false; char *line = reader.next_line(); - ValueTokenizer values(line); - while (values.has_next()) { - std::string word = values.next_string(); - if (word == "UNITS:") { - if (values.has_next()) { - std::string units = values.next_string(); - return units; - } + Tokenizer words(line); + while (words.has_next()) { + if (words.next() == "UNITS:") { + if (words.has_next()) return words.next(); } } return ""; @@ -705,6 +904,63 @@ double utils::get_conversion_factor(const int property, const int conversion) return 0.0; } +/* ---------------------------------------------------------------------- + open a potential file as specified by name + if fails, search in dir specified by env variable LAMMPS_POTENTIALS +------------------------------------------------------------------------- */ + +FILE *utils::open_potential(const std::string &name, LAMMPS *lmp, + int *auto_convert) +{ + auto error = lmp->error; + auto me = lmp->comm->me; + + std::string filepath = get_potential_file_path(name); + + if(!filepath.empty()) { + std::string unit_style = lmp->update->unit_style; + std::string date = get_potential_date(filepath, "potential"); + std::string units = get_potential_units(filepath, "potential"); + + if(!date.empty() && (me == 0)) { + logmesg(lmp, fmt::format("Reading potential file {} " + "with DATE: {}\n", name, date)); + } + + if (auto_convert == nullptr) { + if (!units.empty() && (units != unit_style) && (me == 0)) { + error->one(FLERR, fmt::format("Potential file {} requires {} units " + "but {} units are in use", name, units, + unit_style)); + return nullptr; + } + } else { + if (units.empty() || units == unit_style) { + *auto_convert = NOCONVERT; + } else { + if ((units == "metal") && (unit_style == "real") + && (*auto_convert & METAL2REAL)) { + *auto_convert = METAL2REAL; + } else if ((units == "real") && (unit_style == "metal") + && (*auto_convert & REAL2METAL)) { + *auto_convert = REAL2METAL; + } else { + error->one(FLERR, fmt::format("Potential file {} requires {} units " + "but {} units are in use", name, + units, unit_style)); + return nullptr; + } + } + if ((*auto_convert != NOCONVERT) && (me == 0)) + error->warning(FLERR, fmt::format("Converting potential file in " + "{} units to {} units", + units, unit_style)); + } + return fopen(filepath.c_str(), "r"); + } + return nullptr; +} + /* ---------------------------------------------------------------------- convert a timespec ([[HH:]MM:]SS) to seconds the strings "off" and "unlimited" result in -1.0; @@ -737,6 +993,141 @@ double utils::timespec2seconds(const std::string ×pec) return vals[0]; } +/* ---------------------------------------------------------------------- + convert a LAMMPS version date (1Jan01) to a number +------------------------------------------------------------------------- */ + +int utils::date2num(const std::string &date) +{ + std::size_t found = date.find_first_not_of("0123456789 "); + int num = strtol(date.substr(0,found).c_str(),NULL,10); + auto month = date.substr(found); + found = month.find_first_of("0123456789 "); + num += strtol(month.substr(found).c_str(),NULL,10)*10000; + if (num < 1000000) num += 20000000; + + if (strmatch(month,"^Jan")) num += 100; + else if (strmatch(month,"^Feb")) num += 200; + else if (strmatch(month,"^Mar")) num += 300; + else if (strmatch(month,"^Apr")) num += 400; + else if (strmatch(month,"^May")) num += 500; + else if (strmatch(month,"^Jun")) num += 600; + else if (strmatch(month,"^Jul")) num += 700; + else if (strmatch(month,"^Aug")) num += 800; + else if (strmatch(month,"^Sep")) num += 900; + else if (strmatch(month,"^Oct")) num += 1000; + else if (strmatch(month,"^Nov")) num += 1100; + else if (strmatch(month,"^Dec")) num += 1200; + return num; +} + +/* ---------------------------------------------------------------------- + * Merge sort part 1: Loop over sublists doubling in size with each iteration. + * Pre-sort small sublists with insertion sort for better overall performance. +------------------------------------------------------------------------- */ + +void utils::merge_sort(int *index, int num, void *ptr, + int (*comp)(int, int, void *)) +{ + if (num < 2) return; + + int chunk,i,j; + + // do insertion sort on chunks of up to 64 elements + + chunk = 64; + for (i=0; i < num; i += chunk) { + j = (i+chunk > num) ? num-i : chunk; + insertion_sort(index+i,j,ptr,comp); + } + + // already done? + + if (chunk >= num) return; + + // continue with merge sort on the pre-sorted chunks. + // we need an extra buffer for temporary storage and two + // pointers to operate on, so we can swap the pointers + // rather than copying to the hold buffer in each pass + + int *buf = new int[num]; + int *dest = index; + int *hold = buf; + + while (chunk < num) { + int m; + + // swap hold and destination buffer + + int *tmp = dest; dest = hold; hold = tmp; + + // merge from hold array to destination array + + for (i=0; i < num-1; i += 2*chunk) { + j = i + 2*chunk; + if (j > num) j=num; + m = i+chunk; + if (m > num) m=num; + do_merge(dest,hold,i,m,m,j,ptr,comp); + } + + // copy all indices not handled by the chunked merge sort loop + + for ( ; i < num ; i++ ) dest[i] = hold[i]; + chunk *= 2; + } + + // if the final sorted data is in buf, copy back to index + + if (dest == buf) memcpy(index,buf,sizeof(int)*num); + + delete[] buf; +} + +/* ------------------------------------------------------------------ */ + +/* ---------------------------------------------------------------------- + * Merge sort part 2: Insertion sort for pre-sorting of small chunks +------------------------------------------------------------------------- */ + +void insertion_sort(int *index, int num, void *ptr, + int (*comp)(int, int, void*)) +{ + if (num < 2) return; + for (int i=1; i < num; ++i) { + int tmp = index[i]; + for (int j=i-1; j >= 0; --j) { + if ((*comp)(index[j],tmp,ptr) > 0) { + index[j+1] = index[j]; + } else { + index[j+1] = tmp; + break; + } + if (j == 0) index[0] = tmp; + } + } +} + +/* ---------------------------------------------------------------------- + * Merge sort part 3: Merge two sublists +------------------------------------------------------------------------- */ + +static void do_merge(int *idx, int *buf, int llo, int lhi, int rlo, int rhi, + void *ptr, int (*comp)(int, int, void *)) +{ + int i = llo; + int l = llo; + int r = rlo; + while ((l < lhi) && (r < rhi)) { + if ((*comp)(buf[l],buf[r],ptr) < 0) + idx[i++] = buf[l++]; + else idx[i++] = buf[r++]; + } + + while (l < lhi) idx[i++] = buf[l++]; + while (r < rhi) idx[i++] = buf[r++]; +} + /* ------------------------------------------------------------------ */ extern "C" { diff --git a/src/utils.h b/src/utils.h index 4b9d3f7e81..06aef4654f 100644 --- a/src/utils.h +++ b/src/utils.h @@ -33,23 +33,23 @@ namespace LAMMPS_NS { * * \param text the text to be matched against the pattern * \param pattern the search pattern, which may contain regexp markers - * \return true if the pattern matches, false if not - */ + * \return true if the pattern matches, false if not */ + bool strmatch(const std::string &text, const std::string &pattern); /** Send message to screen and logfile, if available * * \param lmp pointer to LAMMPS class instance - * \param mesg message to be printed - */ + * \param mesg message to be printed */ + void logmesg(LAMMPS *lmp, const std::string &mesg); /** return a string representing the current system error status * * This is a wrapper around calling strerror(errno). * - * \return error string - */ + * \return error string */ + std::string getsyserror(); /** safe wrapper around fgets() which aborts on errors @@ -61,8 +61,8 @@ namespace LAMMPS_NS { * \param size size of buffer s (max number of bytes read by fgets()) * \param fp file pointer used by fgets() * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) - * \param error pointer to Error class instance (for abort) - */ + * \param error pointer to Error class instance (for abort) */ + void sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp, const char *filename, Error *error); @@ -76,8 +76,8 @@ namespace LAMMPS_NS { * \param num number of data elements read by fread() * \param fp file pointer used by fread() * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) - * \param error pointer to Error class instance (for abort) - */ + * \param error pointer to Error class instance (for abort) */ + void sfread(const char *srcname, int srcline, void *s, size_t size, size_t num, FILE *fp, const char *filename, Error *error); @@ -86,20 +86,20 @@ namespace LAMMPS_NS { * \param style type of style that is to be checked for * \param name name of style that was not found * \param lmp pointer to top-level LAMMPS class instance - * \return string usable for error messages - */ + * \return string usable for error messages */ + std::string check_packages_for_style(const std::string &style, const std::string &name, LAMMPS *lmp); /** Convert a string to a floating point number while checking * if it is a valid floating point or integer number * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return double precision floating point number + * \param lmp pointer to top-level LAMMPS class instance + * \return double precision floating point number */ double numeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); @@ -107,111 +107,163 @@ namespace LAMMPS_NS { /** Convert a string to an integer number while checking * if it is a valid integer number (regular int) * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return integer number (regular int) - */ + * \param lmp pointer to top-level LAMMPS class instance + * \return integer number (regular int) */ + int inumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); /** Convert a string to an integer number while checking * if it is a valid integer number (bigint) * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return integer number (bigint) - */ + * \param lmp pointer to top-level LAMMPS class instance + * \return integer number (bigint) */ + bigint bnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); /** Convert a string to an integer number while checking * if it is a valid integer number (tagint) * - * \param file name of source file for error message - * \param line in source file for error message - * \param str string to be converted to number - * \param do_abort determines whether to call Error::one() or Error::all() - * \param lmp pointer to top-level LAMMPS class instance - * \return integer number (tagint) - */ + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be converted to number + * \param do_abort determines whether to call Error::one() or Error::all() + * \param lmp pointer to top-level LAMMPS class instance + * \return integer number (tagint) */ + tagint tnumeric(const char *file, int line, const char *str, bool do_abort, LAMMPS *lmp); + /** Compute index bounds derived from a string with a possible wildcard + * + * This functions processes the string in *str* and set the values of *nlo* + * and *nhi* according to the following five cases: + * + * - a single number, i: nlo = i; nhi = i; + * - a single asterisk, \*: nlo = nmin; nhi = nmax; + * - a single number followed by an asterisk, i\*: nlo = i; nhi = nmax; + * - a single asterisk followed by a number, \*i: nlo = nmin; nhi = i; + * - two numbers with an asterisk in between. i\*j: nlo = i; nhi = j; + * + * \param file name of source file for error message + * \param line line number in source file for error message + * \param str string to be processed + * \param nmin smallest possible lower bound + * \param nmax largest allowed upper bound + * \param nlo lower bound + * \param nhi upper bound + * \param error pointer to Error class for out-of-bounds messages */ + + template + void bounds(const char *file, int line, const std::string &str, + bigint nmin, bigint nmax, TYPE &nlo, TYPE &nhi, Error *error); + + /** Expand list of arguments when containing fix/compute wildcards + * + * This function searches the list of arguments in *arg* for strings + * of the kind c_ID[*] or f_ID[*] referring to computes or fixes. + * Any such strings are replaced by one or more strings with the + * '*' character replaced by the corresponding possible numbers as + * determined from the fix or compute instance. Other strings are + * just copied. If the *mode* parameter is set to 0, expand global + * vectors, but not global arrays; if it is set to 1, expand global + * arrays (by column) but not global vectors. + * + * If any expansion happens, the earg list and all its + * strings are new allocations and must be freed explicitly by the + * caller. Otherwise arg and earg will point to the same address + * and no explicit de-allocation is needed by the caller. + * + * \param file name of source file for error message + * \param line line number in source file for error message + * \param narg number of arguments in current list + * \param arg argument list, possibly containing wildcards + * \param mode select between global vectors(=0) and arrays (=1) + * \param earg new argument list with wildcards expanded + * \param lmp pointer to top-level LAMMPS class instance + * \return number of arguments in expanded list */ + + int expand_args(const char *file, int line, int narg, char **arg, + int mode, char **&earg, LAMMPS *lmp); + /** Trim leading and trailing whitespace. Like TRIM() in Fortran. * * \param line string that should be trimmed - * \return new string without whitespace (string) - */ + * \return new string without whitespace (string) */ + std::string trim(const std::string &line); - /** Trim anything from '#' onward + /** Return string with anything from '#' onward removed * * \param line string that should be trimmed - * \return new string without comment (string) - */ + * \return new string without comment (string) */ + std::string trim_comment(const std::string &line); - /** Count words in string + /** Count words in string with custom choice of separating characters * * \param text string that should be searched * \param separators string containing characters that will be treated as whitespace - * \return number of words found - */ + * \return number of words found */ + size_t count_words(const std::string &text, const std::string &separators); /** Count words in string, ignore any whitespace matching " \t\r\n\f" * * \param text string that should be searched - * \return number of words found - */ + * \return number of words found */ + size_t count_words(const std::string &text); /** Count words in C-string, ignore any whitespace matching " \t\r\n\f" * * \param text string that should be searched - * \return number of words found - */ + * \return number of words found */ + size_t count_words(const char *text); /** Count words in a single line, trim anything from '#' onward * * \param text string that should be trimmed and searched * \param separators string containing characters that will be treated as whitespace - * \return number of words found - */ + * \return number of words found */ + size_t trim_and_count_words(const std::string &text, const std::string &separators = " \t\r\n\f"); /** Take text and split into non-whitespace words. * - * This can handle 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 processing. Use a tokenizer for that. + * 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 processing. + * Use a tokenizer class for that. * * \param text string that should be split - * \return STL vector with the words - */ + * \return STL vector with the words */ + std::vector split_words(const std::string &text); /** Check if string can be converted to valid integer * * \param str string that should be checked - * \return true, if string contains valid integer, false otherwise - */ + * \return true, if string contains valid a integer, false otherwise */ + bool is_integer(const std::string &str); /** Check if string can be converted to valid floating-point number * * \param str string that should be checked - * \return true, if string contains valid floating-point number, false otherwise - */ + * \return true, if string contains valid number, false otherwise */ + bool is_double(const std::string &str); /** Try to detect pathname from FILE pointer. @@ -220,56 +272,61 @@ namespace LAMMPS_NS { * * \param buf storage buffer for pathname. output will be truncated if not large enough * \param len size of storage buffer. output will be truncated to this length - 1 - * \param fp FILE pointer structe from STDIO library for which we want to detect the name - * \return pointer to the storage buffer, i.e. buf - */ + * \param fp FILE pointer struct from STDIO library for which we want to detect the name + * \return pointer to the storage buffer, i.e. buf */ + const char *guesspath(char *buf, int len, FILE *fp); /** Strip off leading part of path, return just the filename * * \param path file path - * \return file name - */ + * \return file name */ + std::string path_basename(const std::string &path); - /** - * \brief Join two paths - * \param a first path - * \param b second path - * \return combined path - */ + /** Join two pathname segments + * + * This uses the forward slash '/' character unless LAMMPS is compiled + * for Windows where it used the equivalent backward slash '\\'. + * + * \param a first path + * \param b second path + * \return combined path */ + std::string path_join(const std::string &a, const std::string &b); - /** - * \brief Check if file exists and is readable + /** Check if file exists and is readable + * * \param path file path - * \return true if file exists and is readable - */ + * \return true if file exists and is readable */ + bool file_is_readable(const std::string &path); /** Determine full path of potential file. If file is not found in current directory, - * search LAMMPS_POTENTIALS folder + * search directories listed in LAMMPS_POTENTIALS environment variable * * \param path file path - * \return full path to potential file - */ + * \return full path to potential file */ + std::string get_potential_file_path(const std::string &path); /** Read potential file and return DATE field if it is present * * \param path file path * \param potential_name name of potential that is being read - * \return DATE field if present - */ - std::string get_potential_date(const std::string &path, const std::string &potential_name); + * \return DATE field if present */ + + std::string get_potential_date(const std::string &path, + const std::string &potential_name); /** Read potential file and return UNITS field if it is present * * \param path file path * \param potential_name name of potential that is being read - * \return UNITS field if present - */ - std::string get_potential_units(const std::string &path, const std::string &potential_name); + * \return UNITS field if present */ + + std::string get_potential_units(const std::string &path, + const std::string &potential_name); enum { NOCONVERT = 0, METAL2REAL = 1, REAL2METAL = 1<<1 }; enum { UNKNOWN = 0, ENERGY }; @@ -277,26 +334,83 @@ namespace LAMMPS_NS { /** Return bitmask of available conversion factors for a given property * * \param property property to be converted - * \return bitmask indicating available conversions - */ + * \return bitmask indicating available conversions */ int get_supported_conversions(const int property); /** Return unit conversion factor for given property and selected from/to units * * \param property property to be converted * \param conversion constant indicating the conversion - * \return conversion factor - */ + * \return conversion factor */ + double get_conversion_factor(const int property, const int conversion); + /** Open a potential file as specified by *name* + * + * If opening the file directly fails, the function will search for + * it in the list of folder pointed to by the environment variable + * ``LAMMPS_POTENTIALS`` (if it is set). + * + * If the potential file has a ``UNITS`` tag in the first line, the + * tag's value is compared to the current unit style setting. + * The behavior of the function then depends on the value of the + * *auto_convert* parameter. If it is ``NULL``, then the unit values + * must match or else the open will fail with an error. Otherwise + * the bitmask that *auto_convert* points to is used check for + * compatibility with possible automatic conversions by the calling + * function. If compatible, the bitmask is set to the required + * conversion or ``utils::NOCONVERT``. + * + * \param name file- or pathname of the potential file + * \param lmp pointer to top-level LAMMPS class instance + * \param auto_convert pointer to unit conversion bitmask or NULL + * \return FILE pointer of the opened potential file or NULL*/ + + FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert); + /** Convert a time string to seconds * * The strings "off" and "unlimited" result in -1 * * \param timespec a string in the following format: ([[HH:]MM:]SS) - * \return total in seconds - */ + * \return total in seconds */ + double timespec2seconds(const std::string ×pec); + + /** Convert a LAMMPS version date to a number + * + * This will generate a number YYYYMMDD from a date string + * (with or without blanks) that is suitable for numerical + * comparisons, i.e. later dates will generate a larger number. + * + * The day may or may not have a leading zero, the month + * is identified by the first 3 letters (so there may be more) + * and the year may be 2 or 4 digits (the missing 2 digits will + * be assumed as 20. That is 04 corresponds to 2004). + * + * No check is made whether the date is valid. + * + * \param date string in the format (Day Month Year) + * \return date code */ + int date2num(const std::string &date); + + /** Custom merge sort implementation + * + * This function provides a custom upward hybrid merge sort + * implementation with support to pass an opaque pointer to + * the comparison function, e.g. for access to class members. + * This avoids having to use global variables. For improved + * performance, it uses an in-place insertion sort on initial + * chunks of up to 64 elements and switches to merge sort from + * then on. + * + * \param index Array with indices to be sorted + * \param num Length of the index array + * \param ptr Pointer to opaque object passed to comparison function + * \param comp Pointer to comparison function */ + + void merge_sort(int *index, int num, void *ptr, + int (*comp)(int, int, void *)); } } diff --git a/src/variable.cpp b/src/variable.cpp index 8eecc4690f..8d4416dfa7 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -12,36 +12,33 @@ ------------------------------------------------------------------------- */ #include "variable.h" -#include -#include -#include -#include -#include -#include -#include -#include "universe.h" + #include "atom.h" -#include "update.h" -#include "group.h" -#include "domain.h" #include "comm.h" -#include "region.h" -#include "modify.h" #include "compute.h" -#include "input.h" +#include "domain.h" +#include "error.h" #include "fix.h" #include "fix_store.h" -#include "force.h" -#include "output.h" -#include "thermo.h" -#include "random_mars.h" -#include "math_const.h" -#include "lmppython.h" -#include "memory.h" +#include "group.h" #include "info.h" -#include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "input.h" +#include "lmppython.h" +#include "math_const.h" +#include "memory.h" +#include "modify.h" +#include "output.h" +#include "random_mars.h" +#include "region.h" +#include "thermo.h" +#include "universe.h" +#include "update.h" + +#include +#include +#include +#include +#include using namespace LAMMPS_NS; using namespace MathConst; @@ -189,7 +186,7 @@ void Variable::set(int narg, char **arg) int nfirst = 0,nlast = 0; if (narg == 3 || (narg == 4 && strcmp(arg[3],"pad") == 0)) { nfirst = 1; - nlast = force->inumeric(FLERR,arg[2]); + nlast = utils::inumeric(FLERR,arg[2],false,lmp); if (nlast <= 0) error->all(FLERR,"Illegal variable command"); if (narg == 4 && strcmp(arg[3],"pad") == 0) { char digits[12]; @@ -197,8 +194,8 @@ void Variable::set(int narg, char **arg) pad[nvar] = strlen(digits); } else pad[nvar] = 0; } else if (narg == 4 || (narg == 5 && strcmp(arg[4],"pad") == 0)) { - nfirst = force->inumeric(FLERR,arg[2]); - nlast = force->inumeric(FLERR,arg[3]); + nfirst = utils::inumeric(FLERR,arg[2],false,lmp); + nlast = utils::inumeric(FLERR,arg[3],false,lmp); if (nfirst > nlast || nlast < 0) error->all(FLERR,"Illegal variable command"); if (narg == 5 && strcmp(arg[4],"pad") == 0) { @@ -252,7 +249,7 @@ void Variable::set(int narg, char **arg) if (find(arg[0]) >= 0) return; if (nvar == maxvar) grow(); style[nvar] = ULOOP; - num[nvar] = force->inumeric(FLERR,arg[2]); + num[nvar] = utils::inumeric(FLERR,arg[2],false,lmp); data[nvar] = new char*[1]; data[nvar][0] = NULL; if (narg == 4) { @@ -508,7 +505,7 @@ void Variable::set(int narg, char **arg) if (ivar >= 0) { if (style[ivar] != INTERNAL) error->all(FLERR,"Cannot redefine variable as a different style"); - dvalue[nvar] = force->numeric(FLERR,arg[2]); + dvalue[nvar] = utils::numeric(FLERR,arg[2],false,lmp); replaceflag = 1; } else { if (nvar == maxvar) grow(); @@ -518,7 +515,7 @@ void Variable::set(int narg, char **arg) pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; data[nvar][0] = new char[VALUELENGTH]; - dvalue[nvar] = force->numeric(FLERR,arg[2]); + dvalue[nvar] = utils::numeric(FLERR,arg[2],false,lmp); } } else error->all(FLERR,"Illegal variable command"); @@ -5198,7 +5195,7 @@ int VarReader::read_peratom() if (n == 0) return 1; MPI_Bcast(str,n,MPI_CHAR,0,world); - bigint nlines = force->bnumeric(FLERR,str); + bigint nlines = utils::bnumeric(FLERR,str,false,lmp); tagint map_tag_max = atom->map_tag_max; bigint nread = 0; diff --git a/src/variable.h b/src/variable.h index f5ea11c0b4..efffacc7bb 100644 --- a/src/variable.h +++ b/src/variable.h @@ -15,7 +15,6 @@ #define LMP_VARIABLE_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/src/velocity.cpp b/src/velocity.cpp index c2776ea174..eafa98cb7c 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -12,24 +12,24 @@ ------------------------------------------------------------------------- */ #include "velocity.h" -#include -#include + #include "atom.h" -#include "domain.h" -#include "lattice.h" -#include "input.h" -#include "variable.h" -#include "force.h" -#include "modify.h" -#include "fix.h" +#include "comm.h" #include "compute.h" #include "compute_temp.h" -#include "random_park.h" -#include "group.h" -#include "comm.h" -#include "memory.h" +#include "domain.h" #include "error.h" -#include "utils.h" +#include "fix.h" +#include "group.h" +#include "input.h" +#include "lattice.h" +#include "memory.h" +#include "modify.h" +#include "random_park.h" +#include "variable.h" + +#include +#include using namespace LAMMPS_NS; @@ -127,8 +127,8 @@ void Velocity::command(int narg, char **arg) // create() invoked differently, so can be called externally if (style == CREATE) { - double t_desired = force->numeric(FLERR,arg[2]); - int seed = force->inumeric(FLERR,arg[3]); + double t_desired = utils::numeric(FLERR,arg[2],false,lmp); + int seed = utils::inumeric(FLERR,arg[3],false,lmp); create(t_desired,seed); } else if (style == SET) set(narg-2,&arg[2]); @@ -424,21 +424,21 @@ void Velocity::set(int /*narg*/, char **arg) xstr = new char[n]; strcpy(xstr,&arg[0][2]); } else if (strcmp(arg[0],"NULL") == 0) xstyle = NONE; - else vx = force->numeric(FLERR,arg[0]); + else vx = utils::numeric(FLERR,arg[0],false,lmp); if (strstr(arg[1],"v_") == arg[1]) { int n = strlen(&arg[1][2]) + 1; ystr = new char[n]; strcpy(ystr,&arg[1][2]); } else if (strcmp(arg[1],"NULL") == 0) ystyle = NONE; - else vy = force->numeric(FLERR,arg[1]); + else vy = utils::numeric(FLERR,arg[1],false,lmp); if (strstr(arg[2],"v_") == arg[2]) { int n = strlen(&arg[2][2]) + 1; zstr = new char[n]; strcpy(zstr,&arg[2][2]); } else if (strcmp(arg[2],"NULL") == 0) zstyle = NONE; - else vz = force->numeric(FLERR,arg[2]); + else vz = utils::numeric(FLERR,arg[2],false,lmp); // set and apply scale factors @@ -578,7 +578,7 @@ void Velocity::set(int /*narg*/, char **arg) void Velocity::scale(int /*narg*/, char **arg) { - double t_desired = force->numeric(FLERR,arg[0]); + double t_desired = utils::numeric(FLERR,arg[0],false,lmp); // if temperature = NULL, create a new ComputeTemp with the velocity group @@ -649,14 +649,14 @@ void Velocity::ramp(int /*narg*/, char **arg) double v_lo,v_hi; if (v_dim == 0) { - v_lo = xscale*force->numeric(FLERR,arg[1]); - v_hi = xscale*force->numeric(FLERR,arg[2]); + v_lo = xscale*utils::numeric(FLERR,arg[1],false,lmp); + v_hi = xscale*utils::numeric(FLERR,arg[2],false,lmp); } else if (v_dim == 1) { - v_lo = yscale*force->numeric(FLERR,arg[1]); - v_hi = yscale*force->numeric(FLERR,arg[2]); + v_lo = yscale*utils::numeric(FLERR,arg[1],false,lmp); + v_hi = yscale*utils::numeric(FLERR,arg[2],false,lmp); } else if (v_dim == 2) { - v_lo = zscale*force->numeric(FLERR,arg[1]); - v_hi = zscale*force->numeric(FLERR,arg[2]); + v_lo = zscale*utils::numeric(FLERR,arg[1],false,lmp); + v_hi = zscale*utils::numeric(FLERR,arg[2],false,lmp); } int coord_dim = 0; @@ -667,14 +667,14 @@ void Velocity::ramp(int /*narg*/, char **arg) double coord_lo,coord_hi; if (coord_dim == 0) { - coord_lo = xscale*force->numeric(FLERR,arg[4]); - coord_hi = xscale*force->numeric(FLERR,arg[5]); + coord_lo = xscale*utils::numeric(FLERR,arg[4],false,lmp); + coord_hi = xscale*utils::numeric(FLERR,arg[5],false,lmp); } else if (coord_dim == 1) { - coord_lo = yscale*force->numeric(FLERR,arg[4]); - coord_hi = yscale*force->numeric(FLERR,arg[5]); + coord_lo = yscale*utils::numeric(FLERR,arg[4],false,lmp); + coord_hi = yscale*utils::numeric(FLERR,arg[5],false,lmp); } else if (coord_dim == 2) { - coord_lo = zscale*force->numeric(FLERR,arg[4]); - coord_hi = zscale*force->numeric(FLERR,arg[5]); + coord_lo = zscale*utils::numeric(FLERR,arg[4],false,lmp); + coord_hi = zscale*utils::numeric(FLERR,arg[5],false,lmp); } // vramp = ramped velocity component for v_dim diff --git a/src/verlet.cpp b/src/verlet.cpp index 97c5f918b5..a7b9ba4c22 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -12,26 +12,26 @@ ------------------------------------------------------------------------- */ #include "verlet.h" -#include -#include -#include "neighbor.h" -#include "domain.h" -#include "comm.h" + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "force.h" -#include "pair.h" #include "bond.h" -#include "angle.h" +#include "comm.h" #include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "force.h" #include "improper.h" #include "kspace.h" -#include "output.h" -#include "update.h" #include "modify.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" #include "timer.h" -#include "error.h" -#include "fmt/format.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 612f5bb123..121a2ed1fd 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -12,22 +12,21 @@ ------------------------------------------------------------------------- */ #include "write_coeff.h" -#include -#include -#include -#include -#include "pair.h" -#include "bond.h" + #include "angle.h" -#include "dihedral.h" -#include "improper.h" +#include "bond.h" #include "comm.h" -#include "force.h" -#include "universe.h" -#include "error.h" +#include "dihedral.h" #include "domain.h" -#include "utils.h" -#include "fmt/format.h" +#include "error.h" +#include "force.h" +#include "improper.h" +#include "pair.h" +#include "universe.h" + +#include +#include +#include using namespace LAMMPS_NS; diff --git a/src/write_data.cpp b/src/write_data.cpp index d549d8bf77..53d277b723 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -12,29 +12,27 @@ ------------------------------------------------------------------------- */ #include "write_data.h" -#include -#include -#include + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "force.h" -#include "pair.h" #include "bond.h" -#include "angle.h" -#include "dihedral.h" -#include "improper.h" -#include "update.h" -#include "modify.h" -#include "fix.h" -#include "domain.h" -#include "universe.h" #include "comm.h" -#include "output.h" -#include "thermo.h" -#include "memory.h" +#include "dihedral.h" +#include "domain.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "fix.h" +#include "force.h" +#include "improper.h" +#include "memory.h" +#include "modify.h" +#include "output.h" +#include "pair.h" +#include "thermo.h" +#include "universe.h" +#include "update.h" + +#include using namespace LAMMPS_NS; diff --git a/src/write_data.h b/src/write_data.h index e94e7f5595..a4e71c9cda 100644 --- a/src/write_data.h +++ b/src/write_data.h @@ -21,7 +21,6 @@ CommandStyle(write_data,WriteData) #define LMP_WRITE_DATA_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 9b257b9ab0..56839a2f5e 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -16,15 +16,16 @@ ------------------------------------------------------------------------- */ #include "write_dump.h" -#include -#include #include "style_dump.h" + +#include "comm.h" #include "dump.h" #include "dump_image.h" -#include "comm.h" -#include "update.h" #include "error.h" -#include "utils.h" +#include "update.h" + +#include + using namespace LAMMPS_NS; diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 062add3b3c..256d7a377e 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -12,32 +12,30 @@ ------------------------------------------------------------------------- */ #include "write_restart.h" -#include -#include -#include + +#include "angle.h" #include "atom.h" #include "atom_vec.h" -#include "group.h" -#include "force.h" -#include "pair.h" #include "bond.h" -#include "angle.h" -#include "dihedral.h" -#include "improper.h" -#include "update.h" -#include "neighbor.h" -#include "domain.h" -#include "modify.h" -#include "fix.h" -#include "universe.h" #include "comm.h" -#include "output.h" -#include "thermo.h" -#include "mpiio.h" -#include "memory.h" +#include "dihedral.h" +#include "domain.h" #include "error.h" -#include "utils.h" -#include "fmt/format.h" +#include "fix.h" +#include "force.h" +#include "group.h" +#include "improper.h" +#include "memory.h" +#include "modify.h" +#include "mpiio.h" +#include "neighbor.h" +#include "output.h" +#include "pair.h" +#include "thermo.h" +#include "universe.h" +#include "update.h" + +#include #include "lmprestart.h" @@ -159,7 +157,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, if (!multiproc) error->all(FLERR,"Cannot use write_restart fileper " "without % in restart file name"); - int nper = force->inumeric(FLERR,arg[iarg+1]); + int nper = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nper <= 0) error->all(FLERR,"Illegal write_restart command"); multiproc = nprocs/nper; @@ -177,7 +175,7 @@ void WriteRestart::multiproc_options(int multiproc_caller, int mpiioflag_caller, if (!multiproc) error->all(FLERR,"Cannot use write_restart nfile " "without % in restart file name"); - int nfile = force->inumeric(FLERR,arg[iarg+1]); + int nfile = utils::inumeric(FLERR,arg[iarg+1],false,lmp); if (nfile <= 0) error->all(FLERR,"Illegal write_restart command"); nfile = MIN(nfile,nprocs); diff --git a/src/write_restart.h b/src/write_restart.h index 5056f50636..a4a606482e 100644 --- a/src/write_restart.h +++ b/src/write_restart.h @@ -21,7 +21,6 @@ CommandStyle(write_restart,WriteRestart) #define LMP_WRITE_RESTART_H #include "pointers.h" -#include namespace LAMMPS_NS { diff --git a/tools/doxygen/Developer.dox.lammps b/tools/doxygen/Developer.dox.lammps deleted file mode 100644 index 8e9e3de232..0000000000 --- a/tools/doxygen/Developer.dox.lammps +++ /dev/null @@ -1,456 +0,0 @@ -/** - -@mainpage Lammps Developer Guide -@tableofcontents - -

LAMMPS Documentation

-

and

-

LAMMPS Developer Guide

-

LAMMPS_VERSION

- - -This document is a developer guide to the LAMMPS molecular dynamics package, whose WWW site is at lammps.sandia.gov. It describes the internal structure and algorithms of the code. Sections will be added as we have time, and in response to requests from developers and users. - - -@section SCT_Lammps_source_files LAMMPS source files - -LAMMPS source files are in two directories of the distribution tarball. The src directory has the majority of them, all of which are C++ files (*.cpp and *.h). Many of these files are in the src directory itself. There are also dozens of "packages", which can be included or excluded when LAMMPS is built. See the doc/Section_start.html section of the manual for more information about packages, or type "make" from within the src directory, which lists package-related commands, such as "make package-status". The source files for each package are in an all-uppercase sub-directory of src, like src/MOLECULE or src/USER-CUDA. If the package is currently installed, copies of the package source files will also exist in the src directory itself. The src/STUBS sub-directory is not a package but contains a dummy version of the MPI library, used when building a serial version of the code. - -The lib directory also contains source code for external libraries, used by a few of the packages. Each sub-directory, like meam or gpu, contains the source files, some of which are in different languages such as Fortran. The files are compiled into libraries from within each sub-directory, e.g. performing a "make" in the lib/meam directory creates a libmeam.a file. These libraries are statically linked to during a LAMMPS build, if the corresponding package is installed. - -LAMMPS C++ source files almost always come in pairs, such as run.cpp and run.h. The pair of files defines a C++ class, the LAMMPS_NS::Run class in this case, which contains the code invoked by the run command in a LAMMPS input script. As this example illustrates, source file and class names often have a one-to-one correspondence with a command used in a LAMMPS input script. Some source files and classes do not have a corresponding input script command, e.g. force.cpp and the LAMMPS_NS::Force class. They are discussed in the next section. - - -@section SCT_Class_hierarchy_of_LAMMPS Class hierarchy of LAMMPS - -Though LAMMPS has a lot of source files and classes, its class hierarchy is quite simple, as outlined in figure @ref classes. Each boxed name refers to a class and has a pair of associated source files in lammps/src, e.g. memory.cpp and memory.h. More details on the class and its methods and data structures can be found by examining its *.h file. - -LAMMPS_NS::LAMMPS (src/lammps.cpp and src/lammps.h) is the top-level class for the entire code. It holds an "instance" of LAMMPS and can be instantiated one or more times by a calling code. For example, the file src/main.cpp simply instantiates one instance of LAMMPS and passes it the input script. - -The file src/library.cpp contains a C-style library interface to the LAMMPS_NS::LAMMPS class. See the lammps/couple and lammps/python directories for examples of simple programs that use LAMMPS through its library interface. A driver program can instantiate the LAMMPS_NS::LAMMPS class multiple times, e.g. to embed several atomistic simulation regions within a mesoscale or continuum simulation domain. - -There are a dozen or so top-level classes within the LAMMPS_NS::LAMMPS class that are visible everywhere in the code. They are shaded blue in figure @ref classes. Thus any class can refer to the y-coordinate of local atom "i" as atom@f$\rightarrow@f$x[i][1]. This visibility is enabled by a bit of cleverness in the LAMMPS_NS::Pointers class (see src/pointers.h) which every class inherits from. - -There are a handful of virtual parent classes in LAMMPS that define what LAMMPS calls "styles". They are shaded red in figure @ref classes. Each of these are parents of a number of child classes that implement the interface defined by the parent class. For example, the "fix style" has around 100 child classes. They are the possible fixes that can be specified by the fix command in an input script, e.g. fix nve, fix shake, fix ave/time, etc. The corresponding classes are LAMMPS_NS::Fix (for the parent class), LAMMPS_NS::FixNVE, LAMMPS_NS::FixShake, LAMMPS_NS::FixAveTime, etc. The source files for these classes are easy to identify in the src directory, since they begin with the word "fix", e,g, fix_nve.cpp, fix_shake.cpp, fix_ave_time.cpp, etc. - -The one exception is child class files for the "command" style. These implement specific commands in the input script that can be invoked before/after/between runs or which launch a simulation. Examples are the create_box, minimize, run, and velocity commands which encode the LAMMPS_NS::CreateBox, LAMMPS_NS::Minimize, LAMMPS_NS::Run, and LAMMPS_NS::Velocity classes. The corresponding files are create_box.cpp, minimize.cpp, run.cpp, and velocity.cpp. - -The list of command style files can be found by typing "grep COMMAND_CLASS *.h" from within the src directory, since that word in the header file identifies the class as an input script command. Similar words can be grepped to list files for the other LAMMPS styles. E.g. ATOM_CLASS, PAIR_CLASS, BOND_CLASS, REGION_CLASS, FIX_CLASS, COMPUTE_CLASS, DUMP_CLASS, etc. - -
- -@anchor classes @image html classes.png "Class hierarchy within LAMMPS source code" - -@anchor classes @image latex classes.eps "Class hierarchy within LAMMPS source code" - -
- -More details on individual classes in figure @ref classes are as -follows: - -- The LAMMPS_NS::Memory class handles allocation of all large vectors and arrays. - -- The LAMMPS_NS::Error class prints all error and warning messages. - -- The LAMMPS_NS::Universe class sets up partitions of processors so that multiple simulations can be run, each on a subset of the processors allocated for a run, e.g. by the mpirun command. - -- The LAMMPS_NS::Input class reads an input script, stores variables, and invokes stand-alone commands that are child classes of the LAMMPS_NS::Command class. - -- As discussed above, the LAMMPS_NS::Command class is a parent class for certain input script commands that perform a one-time operation before/after/between simulations or which invoke a simulation. They are instantiated from within the LAMMPS_NS::Input class, invoked, then immediately destructed. - -- The LAMMPS_NS::Finish class is instantiated to print statistics to the screen after a simulation is performed, by commands like run and minimize. - -- The LAMMPS_NS::Special class walks the bond topology of a molecular system to find 1st, 2nd, 3rd neighbors of each atom. It is invoked by several commands, like read_data, read_restart, and replicate. - -- The LAMMPS_NS::Atom class stores all per-atom arrays. More precisely, they are allocated and stored by the LAMMPS_NS::AtomVec class, and the LAMMPS_NS::Atom class simply stores a pointer to them. The LAMMPS_NS::AtomVec class is a parent class for atom styles, defined by the atom_style command. - -- The LAMMPS_NS::Update class holds an integrator and a minimizer. The LAMMPS_NS::Integrate class is a parent style for the Verlet and rRESPA time integrators, as defined by the run_style input command. The LAMMPS_NS::Min class is a parent style for various energy minimizers. - -- The LAMMPS_NS::Neighbor class builds and stores neighbor lists. The LAMMPS_NS::NeighList class stores a single list (for all atoms). The LAMMPS_NS::NeighRequest class is called by pair, fix, or compute styles when they need a particular kind of neighbor list. - -- The LAMMPS_NS::Comm class performs interprocessor communication, typically of ghost atom information. This usually involves MPI message exchanges with 6 neighboring processors in the 3d logical grid of processors mapped to the simulation box. Sometimes the LAMMPS_NS::Irregular class is used, when atoms may migrate to arbitrary processors. - -- The LAMMPS_NS::Domain class stores the simulation box geometry, as well as the geometric LAMMPS_NS::Region and any user definition of a LAMMPS_NS::Lattice. The latter are defined by region and lattice commands in an input script. - -- The LAMMPS_NS::Force class computes various forces between atoms. The LAMMPS_NS::Pair parent class is for non-bonded or pair-wise forces, which in LAMMPS lingo includes many-body forces such as the Tersoff 3-body potential. The LAMMPS_NS::Bond, LAMMPS_NS::Angle, LAMMPS_NS::Dihedral, LAMMPS_NS::Improper parent classes are styles for bonded interactions within a static molecular topology. The LAMMPS_NS::KSpace parent class is for computing long-range Coulombic interactions. One of its child classes, LAMMPS_NS::PPPM, uses the LAMMPS_NS::FFT3d and LAMMPS_NS::Remap classes to communicate grid-based information with neighboring processors. - -- The LAMMPS_NS::Modify class stores lists of LAMMPS_NS::Fix and LAMMPS_NS::Compute classes, both of which are parent styles. - -- The LAMMPS_NS::Group class manipulates groups that atoms are assigned to via the group command. It also computes various attributes of groups of atoms. - -- The LAMMPS_NS::Output class is used to generate 3 kinds of output from a LAMMPS simulation: thermodynamic information printed to the screen and log file, dump file snapshots, and restart files. These correspond to the LAMMPS_NS::Thermo, LAMMPS_NS::Dump, and LAMMPS_NS::WriteRestart classes respectively. The LAMMPS_NS::Dump class is a parent style. - -- The LAMMPS_NS::Timer class logs MPI timing information, output at the end of a run. - - -@section SCT_How_a_timestep_works How a timestep works - -The first and most fundamental operation within LAMMPS to understand is how a timestep is structured. Timestepping is performed by the LAMMPS_NS::Integrate class within the LAMMPS_NS::Update class. Since LAMMPS_NS::Integrate is a parent class, corresponding to the run_style input script command, it has child classes. In this section, the timestep implemented by the LAMMPS_NS::Verlet child class is described. A similar timestep is implemented by the LAMMPS_NS::Respa child class, for the rRESPA hierarchical timestepping method. The LAMMPS_NS::Min parent class performs energy minimization, so does not perform a literal timestep. But it has logic similar to what is described here, to compute forces and invoke fixes at each iteration of a minimization. Differences between time integration and minimization are highlighted at the end of this section. - -The LAMMPS_NS::Verlet class is encoded in the src/verlet.cpp and verlet.h files. It implements the velocity-Verlet timestepping algorithm. The workhorse method is LAMMPS_NS::Verlet::run(), but first we highlight several other methods in the class. - -- The LAMMPS_NS::Verlet::init() method is called at the beginning of each dynamics run. It simply sets some internal flags, based on user settings in other parts of the code. - -- The LAMMPS_NS::Verlet::setup() or LAMMPS_NS::Verlet::setup_minimal() methods are also called before each run. The velocity-Verlet method requires current forces be calculated before the first timestep, so these routines compute forces due to all atomic interactions, using the same logic that appears in the timestepping described next. A few fixes are also invoked, using the mechanism described in the next section. Various counters are also initialized before the run begins. The LAMMPS_NS::Verlet::setup_minimal() method is a variant that has a flag for performing less setup. This is used when runs are continued and information from the previous run is still valid. For example, if repeated short LAMMPS runs are being invoked, interleaved by other commands, via the "pre no" and "every" options of the run command, the LAMMPS_NS::Verlet::setup_minimal() method is used. - -- The LAMMPS_NS::Verlet::force_clear() method initializes force and other arrays to zero before each timestep, so that forces (torques, etc) can be accumulated. - -Now for the LAMMPS_NS::Verlet::run() method. Its structure in hi-level pseudo code is shown in figure @ref Verlet. In the actual code in src/verlet.cpp some of these operations are conditionally invoked. - - -@verbatim - -loop over N timesteps: - ev_set() - - fix->initial_integrate() - fix->post_integrate() - - nflag = neighbor->decide() - if nflag: - fix->pre_exchange() - domain->pbc() - domain->reset_box() - comm->setup() - neighbor->setup_bins() - comm->exchange() - comm->borders() - fix->pre_neighbor() - neighbor->build() - else - comm->forward_comm() - - force_clear() - fix->pre_force() - - pair->compute() - bond->compute() - angle->compute() - dihedral->compute() - improper->compute() - kspace->compute() - - comm->reverse_comm() - - fix->post_force() - fix->final_integrate() - fix->end_of_step() - - if any output on this step: output->write() - -@endverbatim - -@anchor Verlet
**Pseudo-code for the Verlet::run() method**
- - -The LAMMPS_NS::Integrate::ev_set() method (in the parent LAMMPS_NS::Integrate class), sets two flags LAMMPS_NS::Integrate::eflag and LAMMPS_NS::Integrate::vflag for energy and virial computation. Each flag encodes whether global and/or per-atom energy and virial should be calculated on this timestep, because some fix or variable or output will need it. These flags are passed to the various methods that compute particle interactions, so that they can skip the extra calculations if the energy and virial are not needed. See the comments with the LAMMPS_NS::Integrate::ev_set() method which document the flag values. - -At various points of the timestep, fixes are invoked, e.g. fix@f$\rightarrow@f$initial_integrate(). In the code, this is actually done via the LAMMPS_NS::Modify class which stores all the Fix objects and lists of which should be invoked at what point in the timestep. Fixes are the LAMMPS mechanism for tailoring the operations of a timestep for a particular simulation. As described elsewhere (unwritten section), each fix has one or more methods, each of which is invoked at a specific stage of the timestep, as in figure @ref Verlet. All the fixes defined in an input script with an LAMMPS_NS::Fix::initial_integrate() method are invoked at the beginning of each timestep. The fix commands fix nve, fix nvt and fix npt are examples, since they perform the start-of-timestep velocity-Verlet integration to update velocities by a half-step, and coordinates by a full step. The LAMMPS_NS::Fix::post_integrate() method is next. Only a few fixes use this, e.g. to reflect particles off box boundaries in the LAMMPS_NS::FixWallReflect class. - -The LAMMPS_NS::Neighbor::decide() method in the Neighbor class determines whether neighbor lists need to be rebuilt on the current timestep. If not, coordinates of ghost atoms are acquired by each processor via the LAMMPS_NS::Comm::forward_comm() method of the LAMMPS_NS::Comm class. If neighbor lists need to be built, several operations within the inner if clause of figure @ref Verlet are first invoked. The LAMMPS_NS::Fix::pre_exchange() method of any defined fixes is invoked first. Typically this inserts or deletes particles from the system. - -Periodic boundary conditions are then applied by the LAMMPS_NS::Domain class via its LAMMPS_NS::Domain::pbc() method to remap particles that have moved outside the simulation box back into the box. Note that this is not done every timestep. but only when neighbor lists are rebuilt. This is so that each processor’s sub-domain will have consistent (nearby) atom coordinates for its owned and ghost atoms. It is also why dumped atom coordinates can be slightly outside the simulation box. - -The box boundaries are then reset (if needed) via the LAMMPS_NS::Domain::reset_box() method of the Domain class, e.g. if box boundaries are shrink-wrapped to current particle coordinates. A change in the box size or shape requires internal information for communicating ghost atoms (LAMMPS_NS::Comm class) and neighbor list bins (LAMMPS_NS::Neighbor class) be updated. The LAMMPS_NS::Comm::setup() method of the LAMMPS_NS::Comm class and LAMMPS_NS::Neighbor::setup_bins() method of the LAMMPS_NS::Neighbor class perform the update. - -The code is now ready to migrate atoms that have left a processor’s geometric sub-domain to new processors. The LAMMPS_NS::Comm::exchange() method of the LAMMPS_NS::Comm class performs this operation. The LAMMPS_NS::Comm::borders() method of the LAMMPS_NS::Comm class then identifies ghost atoms surrounding each processor’s sub-domain and communicates ghost atom information to neighboring processors. It does this by looping over all the atoms owned by a processor to make lists of those to send to each neighbor processor. On subsequent timesteps, the lists are used by the LAMMPS_NS::Comm::forward_comm() method. - -Fixes with a LAMMPS_NS::Fix::pre_neighbor() method are then called. These typically re-build some data structure stored by the fix that depends on the current atoms owned by each processor. - -Now that each processor has a current list of its owned and ghost atoms, LAMMPS is ready to rebuild neighbor lists via the LAMMPS_NS::Neighbor::build() method of the LAMMPS_NS::Neighbor class. This is typically done by binning all owned and ghost atoms, and scanning a stencil of bins around each owned atom’s bin to make a Verlet list of neighboring atoms within the force cutoff plus neighbor skin distance. - -In the next portion of the timestep, all interaction forces between particles are computed, after zeroing the per-atom force vector via the LAMMPS_NS::Verlet::force_clear() method. If the newton flag is set to "on" by the newton command, forces on both owned and ghost atoms are calculated. - -Pairwise forces are calculated first, which enables the global virial (if requested) to be calculated cheaply (at the end of the LAMMPS_NS::Pair::compute() method), by a dot product of atom coordinates and forces. By including owned and ghost atoms in the dot product, the effect of periodic boundary conditions is correctly accounted for. Molecular topology interactions (bonds, angles, dihedrals, impropers) are calculated next. The final contribution is from long-range Coulombic interactions, invoked by the LAMMPS_NS::KSpace class. - -If the newton flag is on, forces on ghost atoms are communicated and summed back to their corresponding owned atoms. The LAMMPS_NS::Comm::reverse_comm() method of the LAMMPS_NS::Comm class performs this operation, which is essentially the inverse operation of sending copies of owned atom coordinates to other processor’s ghost atoms. - -At this point in the timestep, the total force on each atom is known. Additional force constraints (external forces, SHAKE, etc) are applied by Fixes that have a LAMMPS_NS::Fix::post_force() method. The second half of the velocity-Verlet integration is then performed (another half-step update of the velocities) via fixes like fix nve, fix nvt and fix npt. - -At the end of the timestep, fixes that define an LAMMPS_NS::Fix::end_of_step() method are invoked. These typically perform a diagnostic calculation, e.g. the fix ave/time and fix ave/spatial fixes. - -The final operation of the timestep is to perform any requested output, via the LAMMPS_NS::Output::write() method of the LAMMPS_NS::Output class. There are 3 kinds of LAMMPS output: - -- thermodynamic output to the screen and log file, -- snapshots of atom data to a dump file, and -- restart files. - -See the thermo_style, dump, and restart commands for more details. - -The iteration performed by an energy minimization is similar to the dynamics timestep of figure @ref Verlet. Forces are computed, neighbor lists are built as needed, atoms migrate to new processors, and atom coordinates and forces are communicated to neighboring processors. The only difference is what LAMMPS_NS::Fix class operations are invoked when. Only a subset of LAMMPS fixes are useful during energy minimization, as explained in their individual doc pages. The relevant LAMMPS_NS::Fix class methods are LAMMPS_NS::Fix::min_pre_exchange(), LAMMPS_NS::Fix::min_pre_force(), and LAMMPS_NS::Fix::min_post_force(). Each is invoked at the appropriate place within the minimization iteration. For example, the LAMMPS_NS::Fix::min_post_force() method is analogous to the LAMMPS_NS::Fix::post_force() method for dynamics; it is used to alter or constrain forces on each atom, which affects the minimization procedure. - - -@section SCT_Extending_LAMMPS Extending LAMMPS - -The Section_modify.html file in the doc directory of the LAMMPS distribution gives an overview of how LAMMPS can be extended by writing new classes that derive from existing parent classes in LAMMPS. - - -@subsection SST_New_fixes New fixes - -(this section has been provided by Kirill Lykov) - -Here, some specific coding details are provided for writing a new fix. - -Writing fixes is a flexible way of extending LAMMPS. Users can implement many things using fixes: - -- changing particles attributes (positions, velocities, forces, etc.). Example: LAMMPS_NS::FixFreeze. - -- reading/writing data. Example: LAMMPS_NS::FixReadRestart. - -- implementing boundary conditions. Example: LAMMPS_NS::FixWall. - -- saving information about particles for future use (previous positions, for instance). Example: LAMMPS_NS::FixStoreState. - -All fixes are derived from class LAMMPS_NS::Fix and must have constructor with the signature: - -@verbatim - -FixMine(class LAMMPS *, int, char **) - -@endverbatim - -Every fix must be registered in LAMMPS by writing the following lines of code in the header before include guards: - -@verbatim - -#ifdef FIX_CLASS -FixStyle(your/fix/name,FixMine) -#else - -@endverbatim - -Where `your/fix/name` is a name of your fix in the script and `FixMine` is the name of the class. This code allows LAMMPS to find your fix when it parses input script. In addition, your fix header must be included in the file style_fix.h. In case if you use LAMMPS make, this file is generated automatically - all files starting with prefix `fix_` are included, so call your header the same way. Otherwise, don’t forget to add your include into style_fix.h. - -Let’s write a simple fix which will print average velocity at the end of each timestep. First of all, implement a constructor: - -@verbatim - -FixPrintVel::FixPrintVel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) -{ - - if (narg < 4) - error->all(FLERR,"Illegal fix print command"); - - nevery = atoi(arg[3]); - - if (nevery <= 0) - error->all(FLERR,"Illegal fix print command"); -} - -@endverbatim - -In the constructor you should parse your fix arguments which are specified in the script. All fixes have pretty the same syntax: - -@verbatim - -fix [fix_identifier] [group_name] [fix_name] [fix_arguments]. - -@endverbatim - -The first 3 parameters are parsed by Fix class constructor, while `[fix_arguments]` should be parsed by you. In our case, we need to specify how often we want to print an average velocity. For instance, once in 50 timesteps: `fix 1 print/vel 50`. There is a special variable in Fix class called nevery which specifies how often the method `end_of_step()` is called. Thus all we need to do is just set it up. - -The next method we need to implement is `setmask()`: - -@verbatim - -int FixPrintVel::setmask() -{ - int mask = 0; - mask |= FixConst::END_OF_STEP; - return mask; -} - -@endverbatim - -Here user specifies which methods of your fix should be called during the execution. For instance, `END_OF_STEP` corresponds to the LAMMPS_NS::Fix::end_of_step() method. Overall, there are 8 most important methods that are called in predefined order during the execution of the Verlet algorithm as was mentioned in Section 3: - -- LAMMPS_NS::Fix::initial_integrate() - -- LAMMPS_NS::Fix::post_integrate() - -- LAMMPS_NS::Fix::pre_exchange() - -- LAMMPS_NS::Fix::pre_neighbor() - -- LAMMPS_NS::Fix::pre_force() - -- LAMMPS_NS::Fix::post_force() - -- LAMMPS_NS::Fix::final_integrate() - -- LAMMPS_NS::Fix::end_of_step() - -The fix developer must understand when he wants to execute his code. In case if we want to write `FixPrintVel`, we need only LAMMPS_NS::Fix::end_of_step(): - -@verbatim - -void FixPrintVel::end_of_step() -{ - // for add3, scale3 - using namespace MathExtra; - - double** v = atom->v; - int nlocal = atom->nlocal; - double localAvgVel[4]; // 4th element for particles count - memset(localAvgVel, 0, 4 * sizeof(double)); - for (int particleInd = 0; particleInd < nlocal; ++particleInd) { - add3(localAvgVel, v[particleInd], localAvgVel); - } - localAvgVel[3] = nlocal; - double globalAvgVel[4]; - memset(globalAvgVel, 0, 4 * sizeof(double)); - MPI_Allreduce(localAvgVel, globalAvgVel, 4, MPI_DOUBLE, MPI_SUM, world); - scale3(1.0 / globalAvgVel[3], globalAvgVel); - if (comm->me == 0) { - printf("%e, %e, %e\n", globalAvgVel[0], globalAvgVel[1], globalAvgVel[2]); - } -} - -@endverbatim - - -In the code above, we use MathExtra routines defined in math_extra.h. There are bunch of math functions to work with arrays of doubles as with math vectors. - -In this code we use an instance of LAMMPS_NS::Atom class. This object is stored in the LAMMPS_NS::Pointers class (see pointers.h). This object contains all global information about the simulation system. Data from LAMMPS_NS::Pointers class available to all classes inherited from it using protected inheritance. Hence when you write you own class, which is going to use LAMMPS data, don’t forget to inherit from the class LAMMPS_NS::Pointers. When writing fixes we inherit from class LAMMPS_NS::Fix which is inherited from LAMMPS_NS::Pointers so there is no need to inherit from it directly. - -The code above computes average velocity for all particles in the simulation. Yet you have one unused parameter in fix call from the script - `[group_name]`. This parameter specifies the group of atoms used in the fix. So we should compute average for all particles in the simulation if `group_name == all`, but it can be any group. The group information is specified by groupbit which is defined in class LAMMPS_NS::Fix: - -@verbatim - -for (int particleInd = 0; particleInd < nlocal; ++particleInd) { - if (atom->mask[particleInd] & groupbit) { - // Do all job here - } - } - -@endverbatim - -Class LAMMPS_NS::Atom encapsulates atoms positions, velocities, forces, etc. The user can access them using particle index. Note, that particle indexes are usually changed every timestep because of sorting. - -Lets consider another LAMMPS_NS::Fix example. We want to have a fix which stores atoms position from previous time step in your fix. The local atoms indexes will not be valid on the next iteration. In order to handle this situation there are several methods which should be implemented: - -- LAMMPS_NS::Fix::memory_usage() `/double memory_usage(void)/` - return how much memory fix uses - -- LAMMPS_NS::Fix::grow_arrays() `/void grow_arrays(int)/` - do reallocation of the per particle arrays in your fix - -- LAMMPS_NS::Fix::copy_arrays() `/void copy_arrays(int i, int j)/` - copy i-th per-particle information to j-th. Used when atoms sorting is performed - -- LAMMPS_NS::Fix::set_arrays() `/void set_arrays(int i)/` - sets i-th particle related information to zero - -Note, that if your class implements these methods, it must call add calls of LAMMPS_NS::Atom::add_callback and LAMMPS_NS::Atom::delete_callback to constructor and destructor: - -@verbatim - -FixSavePos::FixSavePos(LAMMPS *lmp, int narg, char **arg) -{ - //... - atom->add_callback(0); -} - -FixSavePos::~FixSavePos() -{ - atom->delete_callback(id, 0); -} - -@endverbatim - -Since we want to store positions of atoms from previous timestep, we -need to add `double** x` to the header file. Than add allocation code to -constructor: - -@verbatim - -memory->create(this->x, atom->nmax, 3, "FixSavePos:x"); . - -@endverbatim - -Free memory at destructor: - -@verbatim - -memory->destroy(x); - -@endverbatim - -Finally, implement mentioned methods: - -@verbatim - -double FixSavePos::memory_usage() -{ - int nmax = atom->nmax; - double bytes = 0.0; - bytes += nmax * 3 * sizeof(double); - return bytes; -} - -void FixSavePos::grow_arrays(int nmax) -{ - memory->grow(this->x, nmax, 3, "FixSavePos:x"); -} - -void FixSavePos::copy_arrays(int i, int j) -{ - memcpy(this->x[j], this->x[i], sizeof(double) * 3); -} - -void FixSavePos::set_arrays(int i) -{ - memset(this->x[i], 0, sizeof(double) * 3); -} - -int FixSavePos::pack_exchange(int i, double *buf) -{ - int m = 0; - buf[m++] = x[i][0]; - buf[m++] = x[i][1]; - buf[m++] = x[i][2]; - - return m; -} - -int FixSavePos::unpack_exchange(int nlocal, double *buf) -{ - int m = 0; - x[nlocal][0] = buf[m++]; - x[nlocal][1] = buf[m++]; - x[nlocal][2] = buf[m++]; - - return m; -} - -@endverbatim - -Now, a little bit about memory allocation. We used LAMMPS_NS::Memory class which is just a bunch of template functions for allocating 1D and 2D arrays. So you need to add include memory.h to have access to them. - -Finally, if you need to write or read some global information used in your fix to of from a restart file, you might do it by setting flag - -@verbatim - -restart_global = 1 - -@endverbatim - -in the constructor and implementing methods LAMMPS_NS::Fix::write_restart() `/void write_restart(FILE *fp)/` and LAMMPS_NS::Fix::restart() `/void restart(char *buf)/`. - - -@subsection SST_New_commands New commands - -New commands can be added to LAMMPS input scripts by adding new classes that have a “command” method. For example, the create_atoms, read_data, velocity and run commands are all implemented in this fashion. When such a command is encountered in the LAMMPS input script, LAMMPS simply creates a class with the corresponding name, invokes the “command” method of the class, and passes it the arguments from the input script. The command method can perform whatever operations it wishes on LAMMPS data structures. - - -@subsection SST_New_computes New computes - -Classes that compute scalar and vector quantities like temperature and the pressure tensor, as well as classes that compute per-atom quantities like kinetic energy and the centro-symmetry parameter are derived from the LAMMPS_NS::Compute class. New styles can be created to add new calculations to LAMMPS. Compute_temp.cpp is a simple example of computing a scalar temperature. - - -@subsection SST_New_pair_styles New pair styles - -Classes that compute pairwise interactions are derived from the LAMMPS_NS::Pair class. In LAMMPS, pairwise calculation include manybody potentials such as EAM or Tersoff where particles interact without a static bond topology. New styles can be created to add new pair potentials to LAMMPS. - - -@subsection SST_New_bonds_angles_dihedrals_impropers New bonds, angles, dihedrals and impropers - -Classes that compute molecular interactions are derived from the LAMMPS_NS::Bond, LAMMPS_NS::Angle, LAMMPS_NS::Dihedral, and LAMMPS_NS::Improper classes. New styles can be created to add new potentials to LAMMPS. - -*/ diff --git a/tools/doxygen/Doxyfile.lammps b/tools/doxygen/Doxyfile.lammps deleted file mode 100644 index f872541857..0000000000 --- a/tools/doxygen/Doxyfile.lammps +++ /dev/null @@ -1,2557 +0,0 @@ -# Doxyfile 1.8.15 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See -# https://www.gnu.org/software/libiconv/ for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "LAMMPS - Large Atomic and Molecular Massive Parallel Simulator" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "LAMMPS - Developer Guide - LAMMPS_VERSION" - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = tools/doxygen/doc - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines (in the resulting output). You can put ^^ in the value part of an -# alias to insert a newline as if a physical newline was in the original file. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 0 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = YES - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = YES - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = YES - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = tools/doxygen/Developer.dox \ - src/ \ - src/ASPHERE \ - src/BODY \ - src/CLASS2 \ - src/COLLOID \ - src/COMPRESS \ - src/CORESHELL \ - src/DEPEND \ - src/DIPOLE \ - src/GPU \ - src/GRANULAR \ - src/KIM \ - src/KOKKOS \ - src/KSPACE \ - src/LATTE \ - src/MAKE \ - src/MANYBODY \ - src/MC \ - src/MEAM \ - src/MISC \ - src/MOLECULE \ - src/MPIIO \ - src/MSCG \ - src/OPT \ - src/PERI \ - src/POEMS \ - src/PYTHON \ - src/QEQ \ - src/REAX \ - src/REPLICA \ - src/RIGID \ - src/SHOCK \ - src/SNAP \ - src/SRD \ - src/VORONOI \ - src/USER-AWPMD \ - src/USER-CGDNA \ - src/USER-CGSDK \ - src/USER-COLVARS \ - src/USER-DIFFRACTION \ - src/USER-DPD \ - src/USER-DRUDE \ - src/USER-EFF \ - src/USER-FEP \ - src/USER-H5MD \ - src/USER-INTEL \ - src/USER-LB \ - src/USER-MANIFOLD \ - src/USER-MEAMC \ - src/USER-MESO \ - src/USER-MGPT \ - src/USER-MISC \ - src/USER-MOLFILE \ - src/USER-NETCDF \ - src/USER-OMP \ - src/USER-PHONON \ - src/USER-QMMM \ - src/USER-QTB \ - src/USER-QUIP \ - src/USER-REAXC \ - src/USER-SMD \ - src/USER-SMTBQ \ - src/USER-SPH \ - src/USER-TALLY \ - src/USER-UEF \ - src/USER-VTK \ - src/STUBS - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: https://www.gnu.org/software/libiconv/) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.idl \ - *.ddl \ - *.odl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.cs \ - *.d \ - *.php \ - *.php4 \ - *.php5 \ - *.phtml \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.py \ - *.pyw \ - *.f90 \ - *.f95 \ - *.f03 \ - *.f08 \ - *.f \ - *.for \ - *.tcl \ - *.vhd \ - *.vhdl \ - *.ucf \ - *.qsf - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = examples - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = in.* - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = tools/doxygen - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see https://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# https://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML -# documentation will contain a main index with vertical navigation menus that -# are dynamically created via Javascript. If disabled, the navigation index will -# consists of multiple levels of tabs that are statically embedded in every HTML -# page. Disable this option to support browsers that do not have Javascript, -# like the Qt help browser. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_MENUS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANSPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# https://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /