diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 182dd302b6..44a5ced761 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,8 +5,8 @@ Thank your for considering to contribute to the LAMMPS software project. The following is a set of guidelines as well as explanations of policies and work flows for contributing to the LAMMPS molecular dynamics software project. These guidelines focus on submitting issues or pull requests on the LAMMPS GitHub project. Thus please also have a look at: -* [The guide for submitting new features in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html) -* [The guide on programming style and requirement in the LAMMPS manual](https://lammps.sandia.gov/doc/Modify_contribute.html) +* [The guide for submitting new features in the LAMMPS manual](https://www.lammps.org/doc/Modify_contribute.html) +* [The guide on programming style and requirement in the LAMMPS manual](https://www.lammps.org/doc/Modify_style.html) * [The GitHub tutorial in the LAMMPS manual](http://lammps.sandia.gov/doc/Howto_github.html) ## Table of Contents diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 7c3ad71f0b..18afe550b9 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -105,8 +105,28 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") endif() endif() +# silence excessive warnings for new Intel Compilers +if(CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") + set(CMAKE_TUNE_DEFAULT "-Wno-tautological-constant-compare") +endif() + +# silence excessive warnings for PGI/NVHPC compilers +if((CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "PGI")) + set(CMAKE_TUNE_DEFAULT "-Minform=severe") +endif() + +# silence nvcc warnings +if((PKG_KOKKOS) AND (Kokkos_ENABLE_CUDA)) + set(CMAKE_TUNE_DEFAULT "${CMAKE_TUNE_DEFAULT} -Xcudafe --diag_suppress=unrecognized_pragma") +endif() + # we require C++11 without extensions. Kokkos requires at least C++14 (currently) -set(CMAKE_CXX_STANDARD 11) +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() +if(CMAKE_CXX_STANDARD LESS 11) + message(FATAL_ERROR "C++ standard must be set to at least 11") +endif() if(PKG_KOKKOS AND (CMAKE_CXX_STANDARD LESS 14)) set(CMAKE_CXX_STANDARD 14) endif() @@ -172,6 +192,7 @@ set(STANDARD_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK @@ -469,6 +490,7 @@ set(CMAKE_TUNE_FLAGS "${CMAKE_TUNE_DEFAULT}" CACHE STRING "Compiler and machine separate_arguments(CMAKE_TUNE_FLAGS) foreach(_FLAG ${CMAKE_TUNE_FLAGS}) target_compile_options(lammps PRIVATE ${_FLAG}) + target_compile_options(lmp PRIVATE ${_FLAG}) endforeach() ######################################################################## # Basic system tests (standard libraries, headers, functions, types) # diff --git a/cmake/Modules/Documentation.cmake b/cmake/Modules/Documentation.cmake index 16dd5dd4fa..35661843a2 100644 --- a/cmake/Modules/Documentation.cmake +++ b/cmake/Modules/Documentation.cmake @@ -7,13 +7,13 @@ if(BUILD_DOC) # Sphinx 3.x requires at least Python 3.5 if(CMAKE_VERSION VERSION_LESS 3.12) find_package(PythonInterp 3.5 REQUIRED) - set(VIRTUALENV ${PYTHON_EXECUTABLE} -m virtualenv -p ${PYTHON_EXECUTABLE}) + set(VIRTUALENV ${PYTHON_EXECUTABLE} -m venv) else() find_package(Python3 REQUIRED COMPONENTS Interpreter) if(Python3_VERSION VERSION_LESS 3.5) message(FATAL_ERROR "Python 3.5 and up is required to build the HTML documentation") endif() - set(VIRTUALENV ${Python3_EXECUTABLE} -m virtualenv -p ${Python3_EXECUTABLE}) + set(VIRTUALENV ${Python3_EXECUTABLE} -m venv) endif() find_package(Doxygen 1.8.10 REQUIRED) diff --git a/cmake/Modules/Packages/COLVARS.cmake b/cmake/Modules/Packages/COLVARS.cmake index 3488aa62b1..da5b685536 100644 --- a/cmake/Modules/Packages/COLVARS.cmake +++ b/cmake/Modules/Packages/COLVARS.cmake @@ -19,6 +19,10 @@ endif() add_library(colvars STATIC ${COLVARS_SOURCES}) target_compile_definitions(colvars PRIVATE -DCOLVARS_LAMMPS) +separate_arguments(CMAKE_TUNE_FLAGS) +foreach(_FLAG ${CMAKE_TUNE_FLAGS}) + target_compile_options(colvars PRIVATE ${_FLAG}) +endforeach() set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACHINE}) target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) # The line below is needed to locate math_eigen_impl.h diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 53b5f33b9b..75569aa55d 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -80,14 +80,14 @@ if(GPU_API STREQUAL "CUDA") # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH}") - # apply the following to build "fat" CUDA binaries only for known CUDA toolkits - if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - message(WARNING "Untested CUDA Toolkit version. Use at your own risk") + # apply the following to build "fat" CUDA binaries only for known CUDA toolkits since version 8.0 + # only the Kepler achitecture and beyond is supported + if(CUDA_VERSION VERSION_LESS 8.0) + message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") + elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") + set(GPU_CUDA_GENCODE "-arch=all") else() - # Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0 - if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0")) - string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20] ") - endif() # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30] ") @@ -120,6 +120,14 @@ if(GPU_API STREQUAL "CUDA") if(CUDA_VERSION VERSION_GREATER_EQUAL "11.1") string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_86,code=[sm_86,compute_86]") endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() + # # Lovelace (GPU Arch 9.x) is supported by CUDA 12.0? and later + #if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + # string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_9x,code=[sm_9x,compute_9x]") + #endif() endif() cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS ${CUDA_REQUEST_PIC} @@ -257,43 +265,47 @@ elseif(GPU_API STREQUAL "HIP") find_package(CUDA REQUIRED) set(HIP_ARCH "sm_50" CACHE STRING "HIP primary CUDA architecture (e.g. sm_60)") - # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice - # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture - set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}") - # Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0 - if((CUDA_VERSION VERSION_GREATER_EQUAL "3.2") AND (CUDA_VERSION VERSION_LESS "9.0")) - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_20,code=[sm_20,compute_20]") - endif() - # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 - if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30]") - endif() - # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11.0 - if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) - string(APPEND HIP_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") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]") - endif() - # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]") - endif() - # Volta (GPU Arch 7.0) is supported by CUDA 9 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]") - endif() - # Turing (GPU Arch 7.5) is supported by CUDA 10 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]") - endif() - # Ampere (GPU Arch 8.0) is supported by CUDA 11 and later - if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") - string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") - endif() - if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") - message(WARNING "Unsupported CUDA version. Use at your own risk.") + if(CUDA_VERSION VERSION_LESS 8.0) + message(FATAL_ERROR "CUDA Toolkit version 8.0 or later is required") + elseif(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + message(WARNING "Untested CUDA Toolkit version ${CUDA_VERSION}. Use at your own risk") + set(HIP_CUDA_GENCODE "-arch=all") + else() + # build arch/gencode commands for nvcc based on CUDA toolkit version and use choice + # --arch translates directly instead of JIT, so this should be for the preferred or most common architecture + set(HIP_CUDA_GENCODE "-arch=${HIP_ARCH}") + # Kepler (GPU Arch 3.0) is supported by CUDA 5 to CUDA 10.2 + if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "11.0")) + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_30,code=[sm_30,compute_30]") + endif() + # Kepler (GPU Arch 3.5) is supported by CUDA 5 to CUDA 11.0 + if((CUDA_VERSION VERSION_GREATER_EQUAL "5.0") AND (CUDA_VERSION VERSION_LESS "12.0")) + string(APPEND HIP_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") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52]") + endif() + # Pascal (GPU Arch 6.x) is supported by CUDA 8 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "8.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61]") + endif() + # Volta (GPU Arch 7.0) is supported by CUDA 9 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "9.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_70,code=[sm_70,compute_70]") + endif() + # Turing (GPU Arch 7.5) is supported by CUDA 10 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "10.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_75,code=[sm_75,compute_75]") + endif() + # Ampere (GPU Arch 8.0) is supported by CUDA 11 and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "11.0") + string(APPEND HIP_CUDA_GENCODE " -gencode arch=compute_80,code=[sm_80,compute_80]") + endif() + # Hopper (GPU Arch 9.0) is supported by CUDA 12.0? and later + if(CUDA_VERSION VERSION_GREATER_EQUAL "12.0") + string(APPEND GPU_CUDA_GENCODE " -gencode arch=compute_90,code=[sm_90,compute_90]") + endif() endif() endif() diff --git a/cmake/Modules/Packages/H5MD.cmake b/cmake/Modules/Packages/H5MD.cmake index 4fcae93027..6f6922f13e 100644 --- a/cmake/Modules/Packages/H5MD.cmake +++ b/cmake/Modules/Packages/H5MD.cmake @@ -1,5 +1,14 @@ enable_language(C) +# we don't use the parallel i/o interface. +set(HDF5_PREFER_PARALLEL FALSE) + find_package(HDF5 REQUIRED) + +# parallel HDF5 will import incompatible MPI headers with a serial build +if((NOT BUILD_MPI) AND HDF5_IS_PARALLEL) + message(FATAL_ERROR "Serial LAMMPS build and parallel HDF5 library are not compatible") +endif() + target_link_libraries(h5md PRIVATE ${HDF5_LIBRARIES}) target_include_directories(h5md PUBLIC ${HDF5_INCLUDE_DIRS}) diff --git a/cmake/Modules/Packages/MACHDYN.cmake b/cmake/Modules/Packages/MACHDYN.cmake index d90ca8146c..fcc298da2f 100644 --- a/cmake/Modules/Packages/MACHDYN.cmake +++ b/cmake/Modules/Packages/MACHDYN.cmake @@ -36,3 +36,5 @@ endif() if((CMAKE_CXX_COMPILER_ID STREQUAL "PGI") OR (CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")) target_compile_definitions(lammps PRIVATE -DEIGEN_DONT_VECTORIZE) endif() + +target_compile_definitions(lammps PRIVATE -DEIGEN_NO_CUDA) diff --git a/cmake/Modules/Packages/MDI.cmake b/cmake/Modules/Packages/MDI.cmake index c7ef6130b8..1eec53db37 100644 --- a/cmake/Modules/Packages/MDI.cmake +++ b/cmake/Modules/Packages/MDI.cmake @@ -8,8 +8,8 @@ option(DOWNLOAD_MDI "Download and compile the MDI library instead of using an al if(DOWNLOAD_MDI) message(STATUS "MDI download requested - we will build our own") - set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.3.0.tar.gz" CACHE STRING "URL for MDI tarball") - set(MDI_MD5 "8a8da217148bd9b700083b67d795af5e" CACHE STRING "MD5 checksum for MDI tarball") + set(MDI_URL "https://github.com/MolSSI-MDI/MDI_Library/archive/v1.3.2.tar.gz" CACHE STRING "URL for MDI tarball") + set(MDI_MD5 "836f5da400d8cff0f0e4435640f9454f" CACHE STRING "MD5 checksum for MDI tarball") mark_as_advanced(MDI_URL) mark_as_advanced(MDI_MD5) enable_language(C) diff --git a/cmake/presets/all_off.cmake b/cmake/presets/all_off.cmake index da0a589f19..895f26845f 100644 --- a/cmake/presets/all_off.cmake +++ b/cmake/presets/all_off.cmake @@ -8,6 +8,7 @@ set(ALL_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK diff --git a/cmake/presets/all_on.cmake b/cmake/presets/all_on.cmake index 405c1c6588..90b0f02c4b 100644 --- a/cmake/presets/all_on.cmake +++ b/cmake/presets/all_on.cmake @@ -10,6 +10,7 @@ set(ALL_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK diff --git a/cmake/presets/kokkos-cuda.cmake b/cmake/presets/kokkos-cuda.cmake index 36d099479d..c0f9e7f21b 100644 --- a/cmake/presets/kokkos-cuda.cmake +++ b/cmake/presets/kokkos-cuda.cmake @@ -5,7 +5,5 @@ set(PKG_KOKKOS ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE) -set(Kokkos_ARCH_MAXWELL50 on CACHE BOOL "" FORCE) +set(Kokkos_ARCH_PASCAL60 ON CACHE BOOL "" FORCE) set(BUILD_OMP ON CACHE BOOL "" FORCE) -get_filename_component(NVCC_WRAPPER_CMD ${CMAKE_CURRENT_SOURCE_DIR}/../lib/kokkos/bin/nvcc_wrapper ABSOLUTE) -set(CMAKE_CXX_COMPILER ${NVCC_WRAPPER_CMD} CACHE FILEPATH "" FORCE) diff --git a/cmake/presets/mingw-cross.cmake b/cmake/presets/mingw-cross.cmake index 5b284739ee..81db71729a 100644 --- a/cmake/presets/mingw-cross.cmake +++ b/cmake/presets/mingw-cross.cmake @@ -4,6 +4,7 @@ set(WIN_PACKAGES AWPMD BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK diff --git a/cmake/presets/most.cmake b/cmake/presets/most.cmake index 3531a2154d..5e408f17cf 100644 --- a/cmake/presets/most.cmake +++ b/cmake/presets/most.cmake @@ -6,6 +6,7 @@ set(ALL_PACKAGES ASPHERE BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK diff --git a/cmake/presets/pgi.cmake b/cmake/presets/pgi.cmake index b34cb05331..2b7fee7efa 100644 --- a/cmake/presets/pgi.cmake +++ b/cmake/presets/pgi.cmake @@ -1,4 +1,4 @@ -# preset that will enable clang/clang++ with support for MPI and OpenMP (on Linux boxes) +# preset that will enable PGI (Nvidia) compilers with support for MPI and OpenMP (on Linux boxes) set(CMAKE_CXX_COMPILER "pgc++" CACHE STRING "" FORCE) set(CMAKE_C_COMPILER "pgcc" CACHE STRING "" FORCE) diff --git a/cmake/presets/windows.cmake b/cmake/presets/windows.cmake index 66b59e56d2..14bedb6575 100644 --- a/cmake/presets/windows.cmake +++ b/cmake/presets/windows.cmake @@ -2,6 +2,7 @@ set(WIN_PACKAGES ASPHERE BOCS BODY + BPM BROWNIAN CG-DNA CG-SDK diff --git a/doc/.gitignore b/doc/.gitignore index 7649fb34f1..7c953d2432 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,6 +1,6 @@ /old /html -/html-offline +/fasthtml /epub /latex /mathjax diff --git a/doc/Makefile b/doc/Makefile index a082018dfb..113a64ec10 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -14,34 +14,22 @@ ANCHORCHECK = $(VENV)/bin/rst_anchor_check SPHINXCONFIG = $(BUILDDIR)/utils/sphinx-config MATHJAX = $(SPHINXCONFIG)/_static/mathjax -PYTHON = $(shell which python3) -DOXYGEN = $(shell which doxygen) -VIRTUALENV = virtualenv +PYTHON = $(word 3,$(shell type python3)) +DOXYGEN = $(word 3,$(shell type doxygen)) HAS_PYTHON3 = NO -HAS_VIRTUALENV = NO HAS_DOXYGEN = NO HAS_PDFLATEX = NO -ifeq ($(shell which python3 >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type python3 >/dev/null 2>&1; echo $$?), 0) HAS_PYTHON3 = YES endif -ifeq ($(shell which doxygen >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type doxygen >/dev/null 2>&1; echo $$?), 0) HAS_DOXYGEN = YES endif -ifeq ($(shell which virtualenv-3 >/dev/null 2>&1; echo $$?), 0) -VIRTUALENV = virtualenv-3 -HAS_VIRTUALENV = YES -endif - -ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0) -VIRTUALENV = virtualenv -HAS_VIRTUALENV = YES -endif - -ifeq ($(shell which pdflatex >/dev/null 2>&1; echo $$?), 0) -ifeq ($(shell which latexmk >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type pdflatex >/dev/null 2>&1; echo $$?), 0) +ifeq ($(shell type latexmk >/dev/null 2>&1; echo $$?), 0) HAS_PDFLATEX = YES endif endif @@ -58,7 +46,7 @@ SPHINXEXTRA = -E -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiproc # we only want to use explicitly listed files. DOXYFILES = $(shell sed -n -e 's/\#.*$$//' -e '/^ *INPUT \+=/,/^[A-Z_]\+ \+=/p' doxygen/Doxyfile.in | sed -e 's/@LAMMPS_SOURCE_DIR@/..\/src/g' -e 's/\\//g' -e 's/ \+/ /' -e 's/[A-Z_]\+ \+= *\(YES\|NO\|\)//') -.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen +.PHONY: help clean-all clean clean-spelling epub mobi rst html pdf spelling anchor_check style_check char_check xmlgen fasthtml # ------------------------------------------ @@ -70,7 +58,8 @@ help: @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)" @echo " (requires ebook-convert tool from calibre)" - @echo " clean remove all intermediate RST files" + @echo " fasthtml approximate HTML page creation in fasthtml dir (for development)" + @echo " clean remove all intermediate files" @echo " clean-all reset the entire build environment" @echo " anchor_check scan for duplicate anchor labels" @echo " style_check check for complete and consistent style lists" @@ -83,7 +72,7 @@ clean-all: clean 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 + rm -rf $(BUILDDIR)/html $(BUILDDIR)/epub $(BUILDDIR)/latex $(BUILDDIR)/doctrees $(BUILDDIR)/doxygen/xml $(BUILDDIR)/doxygen-warn.log $(BUILDDIR)/doxygen/Doxyfile $(SPHINXCONFIG)/conf.py $(BUILDDIR)/fasthtml clean-spelling: rm -rf $(BUILDDIR)/spelling @@ -118,6 +107,23 @@ html: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) @rm -rf html/PDF/.[sg]* @echo "Build finished. The HTML pages are in doc/html." +fasthtml: xmlgen $(VENV) $(SPHINXCONFIG)/conf.py $(ANCHORCHECK) $(MATHJAX) + @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi + @$(MAKE) $(MFLAGS) -C graphviz all + @mkdir -p fasthtml + @(\ + . $(VENV)/bin/activate ; env PYTHONWARNINGS= \ + sphinx-build -j 4 -b html -c $(SPHINXCONFIG) -d $(BUILDDIR)/fasthtml/doctrees $(RSTDIR) fasthtml ;\ + deactivate ;\ + ) + @rm -rf fasthtml/_sources + @rm -rf fasthtml/PDF + @rm -rf fasthtml/USER + @rm -rf fasthtml/JPG + @cp -r src/PDF fasthtml/PDF + @rm -rf fasthtml/PDF/.[sg]* + @echo "Fast HTML build finished. The HTML pages are in doc/fasthtml." + spelling: xmlgen $(SPHINXCONFIG)/conf.py $(VENV) $(SPHINXCONFIG)/false_positives.txt @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @(\ @@ -220,9 +226,8 @@ $(VENV): @if [ "$(HAS_BASH)" == "NO" ] ; then echo "bash was not found at $(OSHELL)! Please use: $(MAKE) SHELL=/path/to/bash" 1>&2; exit 1; fi @if [ "$(HAS_PYTHON3)" == "NO" ] ; then echo "python3 was not found! Please see README for further instructions" 1>&2; exit 1; fi @if [ "$(HAS_DOXYGEN)" == "NO" ] ; then echo "doxygen was not found! Please see README for further instructions" 1>&2; exit 1; fi - @if [ "$(HAS_VIRTUALENV)" == "NO" ] ; then echo "virtualenv was not found! Please see README for further instructions" 1>&2; exit 1; fi @( \ - $(VIRTUALENV) -p $(PYTHON) $(VENV); \ + $(PYTHON) -m venv $(VENV); \ . $(VENV)/bin/activate; \ pip $(PIP_OPTIONS) install --upgrade pip; \ pip $(PIP_OPTIONS) install -r $(BUILDDIR)/utils/requirements.txt; \ diff --git a/doc/msi2lmp.1 b/doc/msi2lmp.1 index ba771da7dc..f088603483 100644 --- a/doc/msi2lmp.1 +++ b/doc/msi2lmp.1 @@ -98,7 +98,7 @@ msi2lmp decane -c 0 -f oplsaa .SH COPYRIGHT -© 2003--2021 Sandia Corporation +© 2003--2022 Sandia Corporation This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as diff --git a/doc/src/Build_development.rst b/doc/src/Build_development.rst index 5492a1e536..66e12a0d69 100644 --- a/doc/src/Build_development.rst +++ b/doc/src/Build_development.rst @@ -486,14 +486,14 @@ The following options are available. make fix-whitespace # correct whitespace issues in files make check-homepage # search for files with old LAMMPS homepage URLs make fix-homepage # correct LAMMPS homepage URLs in files + make check-errordocs # search for deprecated error docs in header files + make fix-errordocs # remove error docs in header files make check-permissions # search for files with permissions issues make fix-permissions # correct permissions issues in files + make check # run all check targets from above -These should help to replace all TAB characters with blanks and remove -any trailing whitespace. Also all LAMMPS homepage URL references can be -updated to the location change from Sandia to the lammps.org domain. -And the permission check can remove executable permissions from non-executable -files (like source code). +These should help to make source and documentation files conforming +to some the coding style preferences of the LAMMPS developers. Clang-format support -------------------- diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index c7ebe3c374..8caf043c42 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -141,8 +141,6 @@ CMake build :code:`GPU_ARCH` settings for different GPU hardware is as follows: -* 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 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) @@ -160,6 +158,12 @@ 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. +When compiling for CUDA or HIP with CUDA, version 8.0 or later of the CUDA toolkit +is required and a GPU architecture of Kepler or later, which must *also* be +supported by the CUDA toolkit in use **and** the CUDA driver in use. +When compiling for OpenCL, OpenCL version 1.2 or later is required and the +GPU must be supported by the GPU driver and OpenCL runtime bundled with the driver. + When building with CMake, you **must NOT** build the GPU library in ``lib/gpu`` using the traditional build procedure. CMake will detect files generated by that process and will terminate with an error and a suggestion for how to remove them. diff --git a/doc/src/Build_manual.rst b/doc/src/Build_manual.rst index 5dbefd8b6e..90633d0811 100644 --- a/doc/src/Build_manual.rst +++ b/doc/src/Build_manual.rst @@ -78,11 +78,12 @@ folder. The following ``make`` commands are available: make html # generate HTML in html dir using Sphinx make pdf # generate PDF as Manual.pdf using Sphinx and PDFLaTeX - make fetch # fetch HTML pages and PDF files from LAMMPS website - # and unpack into the html_www folder and Manual_www.pdf make epub # generate LAMMPS.epub in ePUB format using Sphinx make mobi # generate LAMMPS.mobi in MOBI format using ebook-convert + make fasthtml # generate approximate HTML in fasthtml dir using Sphinx + # some Sphinx extensions do not work correctly with this + make clean # remove intermediate RST files created by HTML build make clean-all # remove entire build folder and any cached data @@ -193,8 +194,13 @@ folder need to be updated or new files added. These files are written in `reStructuredText `_ markup for translation with the Sphinx tool. Before contributing any documentation, please check that both the HTML -and the PDF format documentation can translate without errors. Please also -check the output to the console for any warnings or problems. There will +and the PDF format documentation can translate without errors. During +testing the html translation, you may use the ``make fasthtml`` command +which does an approximate translation (i.e. not all Sphinx features and +extensions will work), but runs very fast because it will only translate +files that have been changed since the last ``make fasthtml`` command. + +Please also check the output to the console for any warnings or problems. There will be multiple tests run automatically: - A test for correctness of all anchor labels and their references diff --git a/doc/src/Commands_bond.rst b/doc/src/Commands_bond.rst index d0083d7c63..40b99a5fb8 100644 --- a/doc/src/Commands_bond.rst +++ b/doc/src/Commands_bond.rst @@ -32,6 +32,8 @@ OPT. * * * + * :doc:`bpm/rotational ` + * :doc:`bpm/spring ` * :doc:`class2 (ko) ` * :doc:`fene (iko) ` * :doc:`fene/expand (o) ` diff --git a/doc/src/Commands_compute.rst b/doc/src/Commands_compute.rst index 6309fe83e2..61c5e83eda 100644 --- a/doc/src/Commands_compute.rst +++ b/doc/src/Commands_compute.rst @@ -33,6 +33,7 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`body/local ` * :doc:`bond ` * :doc:`bond/local ` + * :doc:`born/matrix ` * :doc:`centro/atom ` * :doc:`centroid/stress/atom ` * :doc:`chunk/atom ` @@ -91,6 +92,7 @@ KOKKOS, o = OPENMP, t = OPT. * :doc:`msd ` * :doc:`msd/chunk ` * :doc:`msd/nongauss ` + * :doc:`nbond/atom ` * :doc:`omega/chunk ` * :doc:`orientorder/atom (k) ` * :doc:`pair ` diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index d48e4cd31f..7dc3f324b4 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -144,6 +144,7 @@ OPT. * :doc:`nve/manifold/rattle ` * :doc:`nve/noforce ` * :doc:`nve/sphere (ko) ` + * :doc:`nve/bpm/sphere ` * :doc:`nve/spin ` * :doc:`nve/tri ` * :doc:`nvk ` @@ -161,7 +162,6 @@ OPT. * :doc:`orient/fcc ` * :doc:`orient/eco ` * :doc:`pafi ` - * :doc:`pair/tracker ` * :doc:`phonon ` * :doc:`pimd ` * :doc:`planeforce ` diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 7a1ed4ee72..4ddfed6df0 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -53,6 +53,7 @@ OPT. * :doc:`born/coul/msm (o) ` * :doc:`born/coul/wolf (go) ` * :doc:`born/coul/wolf/cs (g) ` + * :doc:`bpm/spring ` * :doc:`brownian (o) ` * :doc:`brownian/poly (o) ` * :doc:`buck (giko) ` @@ -123,7 +124,7 @@ OPT. * :doc:`hbond/dreiding/lj (o) ` * :doc:`hbond/dreiding/morse (o) ` * :doc:`hdnnp ` - * :doc:`ilp/graphene/hbn ` + * :doc:`ilp/graphene/hbn (t) ` * :doc:`ilp/tmd ` * :doc:`kolmogorov/crespi/full ` * :doc:`kolmogorov/crespi/z ` @@ -151,7 +152,7 @@ OPT. * :doc:`lj/cut/coul/cut/dielectric (o) ` * :doc:`lj/cut/coul/cut/soft (o) ` * :doc:`lj/cut/coul/debye (gko) ` - * :doc:`lj/cut/coul/debye/dielectric ` + * :doc:`lj/cut/coul/debye/dielectric (o) ` * :doc:`lj/cut/coul/dsf (gko) ` * :doc:`lj/cut/coul/long (gikot) ` * :doc:`lj/cut/coul/long/cs ` diff --git a/doc/src/Developer_utils.rst b/doc/src/Developer_utils.rst index 9c6ef67945..d7b1f077dd 100644 --- a/doc/src/Developer_utils.rst +++ b/doc/src/Developer_utils.rst @@ -211,6 +211,12 @@ Convenience functions .. doxygenfunction:: logmesg(LAMMPS *lmp, const std::string &mesg) :project: progguide +.. doxygenfunction:: errorurl + :project: progguide + +.. doxygenfunction:: missing_cmd_args + :project: progguide + .. doxygenfunction:: flush_buffers(LAMMPS *lmp) :project: progguide diff --git a/doc/src/Errors.rst b/doc/src/Errors.rst index 5975c22c41..3e8ebc7f8e 100644 --- a/doc/src/Errors.rst +++ b/doc/src/Errors.rst @@ -11,6 +11,7 @@ them. :maxdepth: 1 Errors_common + Errors_details Errors_bugs Errors_debug Errors_messages diff --git a/doc/src/Errors_details.rst b/doc/src/Errors_details.rst new file mode 100644 index 0000000000..b63d80a9ae --- /dev/null +++ b/doc/src/Errors_details.rst @@ -0,0 +1,27 @@ +Error and warning details +========================= + +Many errors or warnings are self-explanatory and thus straightforward to +resolve. However, there are also cases, where there is no single cause +and explanation, where LAMMPS can only detect symptoms of an error but +not the exact cause, or where the explanation needs to be more detailed than +what can be fit into a message printed by the program. The following are +discussions of such cases. + +.. _err0001: + +Unknown identifier in data file +------------------------------- + +This error happens when LAMMPS encounters a line of text in an unexpected format +while reading a data file. This is most commonly cause by inconsistent header and +section data. The header section informs LAMMPS how many entries or lines are expected in the +various sections (like Atoms, Masses, Pair Coeffs, *etc.*\ ) of the data file. +If there is a mismatch, LAMMPS will either keep reading beyond the end of a section +or stop reading before the section has ended. + +Such a mismatch can happen unexpectedly when the first line of the data +is *not* a comment as required by the format. That would result in +LAMMPS expecting, for instance, 0 atoms because the "atoms" header line +is treated as a comment. + diff --git a/doc/src/Examples.rst b/doc/src/Examples.rst index 57092a01d7..bbd4db8508 100644 --- a/doc/src/Examples.rst +++ b/doc/src/Examples.rst @@ -54,6 +54,8 @@ Lowercase directories +-------------+------------------------------------------------------------------+ | body | body particles, 2d system | +-------------+------------------------------------------------------------------+ +| bpm | BPM simulations of pouring elastic grains and plate impact | ++-------------+------------------------------------------------------------------+ | cmap | CMAP 5-body contributions to CHARMM force field | +-------------+------------------------------------------------------------------+ | colloid | big colloid particles in a small particle solvent, 2d system | diff --git a/doc/src/Howto.rst b/doc/src/Howto.rst index a96f64145e..0f1abcd7d7 100644 --- a/doc/src/Howto.rst +++ b/doc/src/Howto.rst @@ -23,6 +23,8 @@ General howto Howto_library Howto_couple Howto_mdi + Howto_bpm + Howto_broken_bonds Settings howto ============== diff --git a/doc/src/Howto_bpm.rst b/doc/src/Howto_bpm.rst new file mode 100644 index 0000000000..2f015162e0 --- /dev/null +++ b/doc/src/Howto_bpm.rst @@ -0,0 +1,119 @@ +Bonded particle models +====================== + +The BPM package implements bonded particle models which can be used to +simulate mesoscale solids. Solids are constructed as a collection of +particles which each represent a coarse-grained region of space much +larger than the atomistic scale. Particles within a solid region are +then connected by a network of bonds to provide solid elasticity. + +Unlike traditional bonds in molecular dynamics, the equilibrium bond +length can vary between bonds. Bonds store the reference state. This +includes setting the equilibrium length equal to the initial distance +between the two particles but can also include data on the bond +orientation for rotational models. This produces a stress free initial +state. Furthermore, bonds are allowed to break under large strains +producing fracture. The examples/bpm directory has sample input scripts +for simulations of the fragmentation of an impacted plate and the +pouring of extended, elastic bodies. + +---------- + +Bonds can be created using a :doc:`read data ` or +:doc:`create bonds ` command. Alternatively, a +:doc:`molecule ` template with bonds can be used with +:doc:`fix deposit ` or :doc:`fix pour ` to +create solid grains. + +In this implementation, bonds store their reference state when they are +first computed in the setup of the first simulation run. Data is then +preserved across run commands and is written to :doc:`binary restart +files ` such that restarting the system will not reset the +reference state of a bond. Bonds that are created midway into a run, +such as those created by pouring grains using :doc:`fix pour +`, are initialized on that timestep. + +As bonds can be broken between neighbor list builds, the +:doc:`special_bonds ` command works differently for BPM +bond styles. There are two possible settings which determine how pair +interactions work between bonded particles. First, one can turn off +all pair interactions between bonded particles. Unlike :doc:`bond +quartic `, this is not done by subtracting pair forces +during the bond computation but rather by dynamically updating the +special bond list. This is the default behavior of BPM bond styles and +is done by updating the 1-2 special bond list as bonds break. To do +this, LAMMPS requires :doc:`newton ` bond off such that all +processors containing an atom know when a bond breaks. Additionally, +one must do either (A) or (B). + +A) Use the following special bond settings + + .. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 1 1 1 + + These settings accomplish two goals. First, they turn off 1-3 and 1-4 + special bond lists, which are not currently supported for BPMs. As + BPMs often have dense bond networks, generating 1-3 and 1-4 special + bond lists is expensive. By setting the lj weight for 1-2 bonds to + zero, this turns off pairwise interactions. Even though there are no + charges in BPM models, setting a nonzero coul weight for 1-2 bonds + ensures all bonded neighbors are still included in the neighbor list + in case bonds break between neighbor list builds. + +B) Alternatively, one can simply overlay pair interactions such that all + bonded particles also feel pair interactions. This can be + accomplished by using the *overlay/pair* keyword present in all bpm + bond styles and by using the following special bond settings + + .. code-block:: LAMMPS + + special_bonds lj/coul 1 1 1 + +See the :doc:`Howto ` page on broken bonds for +more information. + +---------- + +Currently there are two types of bonds included in the BPM +package. The first bond style, :doc:`bond bpm/spring +`, only applies pairwise, central body forces. Point +particles must have :doc:`bond atom style ` and may be +thought of as nodes in a spring network. Alternatively, the second +bond style, :doc:`bond bpm/rotational `, resolves +tangential forces and torques arising with the shearing, bending, and +twisting of the bond due to rotation or displacement of particles. +Particles are similar to those used in the :doc:`granular package +`, :doc:`atom style sphere `. However, +they must also track the current orientation of particles and store bonds +and therefore use a :doc:`bpm/sphere atom style `. +This also requires a unique integrator :doc:`fix nve/bpm/sphere +` which numerically integrates orientation similar +to :doc:`fix nve/asphere `. + +To monitor the fracture of bonds in the system, all BPM bond styles +have the ability to record instances of bond breakage to output using +the :doc:`dump local ` command. Additionally, one can use +:doc:`compute nbond/atom ` to tally the current +number of bonds per atom. + +In addition to bond styles, a new pair style :doc:`pair bpm/spring +` was added to accompany the bpm/spring bond +style. This pair style is simply a hookean repulsion with similar +velocity damping as its sister bond style. + +---------- + +While LAMMPS has many utilities to create and delete bonds, *only* +the following are currently compatible with BPM bond styles: + +* :doc:`create_bonds ` +* :doc:`delete_bonds ` +* :doc:`fix bond/create ` +* :doc:`fix bond/break ` +* :doc:`fix bond/swap ` + +Note :doc:`create_bonds ` requires certain special_bonds settings. +To subtract pair interactions, one will need to switch between different +special_bonds settings in the input script. An example is found in +examples/bpm/impact. diff --git a/doc/src/Howto_broken_bonds.rst b/doc/src/Howto_broken_bonds.rst new file mode 100644 index 0000000000..1a356df510 --- /dev/null +++ b/doc/src/Howto_broken_bonds.rst @@ -0,0 +1,48 @@ +Broken Bonds +============ + +Typically, bond interactions persist for the duration of a simulation +in LAMMPS. However, there are some exceptions that allow for bonds to +break including the :doc:`quartic bond style ` and the +bond styles in the :doc:`BPM package ` which contains the +:doc:`bpm/spring ` and +:doc:`bpm/rotational ` bond styles. In these cases, +a bond can be broken if it is stretched beyond a user-defined threshold. +LAMMPS accomplishes this by setting the bond type to zero such that the +bond force is no longer computed. + +Users are normally able to weight the contribution of pair forces to atoms +that are bonded using the :doc:`special_bonds command `. +When bonds break, this is not always the case. For the quartic bond style, +pair forces are always turned off between bonded particles. LAMMPS does +this via a computational sleight-of-hand. It subtracts the pairwise +interaction as part of the bond computation. When the bond breaks, the +subtraction stops. For this to work, the pairwise interaction must always +be computed by the :doc:`pair_style ` command, whether the bond +is broken or not. This means that :doc:`special_bonds ` must +be set to 1,1,1. After the bond breaks, the pairwise interaction between the +two atoms is turned on, since they are no longer bonded. + +In the BPM package, one can either turn off all pair interactions between +bonded particles or leave them on, overlaying pair forces on top of bond +forces. To remove pair forces, the special bond list is dynamically +updated. More details can be found on the :doc:`Howto BPM ` +page. + +Bonds can also be broken by fixes which change bond topology, including +:doc:`fix bond/break ` and +:doc:`fix bond/react `. These fixes will automatically +trigger a rebuild of the neighbor list and update special bond data structures +when bonds are broken. + +Note that when bonds are dumped to a file via the :doc:`dump local ` command, bonds with type 0 are not included. The +:doc:`delete_bonds ` command can also be used to query the +status of broken bonds or permanently delete them, e.g.: + +.. code-block:: LAMMPS + + delete_bonds all stats + delete_bonds all bond 0 remove + +The compute :doc:`nbond/atom ` can also be used +to tally the current number of bonds per atom, excluding broken bonds. diff --git a/doc/src/Howto_elastic.rst b/doc/src/Howto_elastic.rst index 4870942458..d77ff3e778 100644 --- a/doc/src/Howto_elastic.rst +++ b/doc/src/Howto_elastic.rst @@ -18,23 +18,52 @@ At zero temperature, it is easy to estimate these derivatives by deforming the simulation box in one of the six directions using the :doc:`change_box ` command and measuring the change in the stress tensor. A general-purpose script that does this is given in the -examples/elastic directory described on the :doc:`Examples ` +examples/ELASTIC directory described on the :doc:`Examples ` doc page. Calculating elastic constants at finite temperature is more challenging, because it is necessary to run a simulation that performs -time averages of differential properties. One way to do this is to -measure the change in average stress tensor in an NVT simulations when +time averages of differential properties. There are at least +3 ways to do this in LAMMPS. The most reliable way to do this is +by exploiting the relationship between elastic constants, stress +fluctuations, and the Born matrix, the second derivatives of energy +w.r.t. strain :ref:`(Ray) `. +The Born matrix calculation has been enabled by +the :doc:`compute born/matrix ` command, +which works for any bonded or non-bonded potential in LAMMPS. +The most expensive part of the calculation is the sampling of +the stress fluctuations. Several examples of this method are +provided in the examples/ELASTIC_T/BORN_MATRIX directory +described on the :doc:`Examples ` doc page. + +A second way is to measure +the change in average stress tensor in an NVT simulations when the cell volume undergoes a finite deformation. In order to balance the systematic and statistical errors in this method, the magnitude of the deformation must be chosen judiciously, and care must be taken to fully equilibrate the deformed cell before sampling the stress -tensor. Another approach is to sample the triclinic cell fluctuations +tensor. An example of this method is provided in the +examples/ELASTIC_T/DEFORMATION directory +described on the :doc:`Examples ` doc page. + +Another approach is to sample the triclinic cell fluctuations that occur in an NPT simulation. This method can also be slow to -converge and requires careful post-processing :ref:`(Shinoda) ` +converge and requires careful post-processing :ref:`(Shinoda) `. +We do not provide an example of this method. + +A nice review of the advantages and disadvantages of all of these methods +is provided in the paper by Clavier et al. :ref:`(Clavier) `. ---------- +.. _Ray: + +**(Ray)** J. R. Ray and A. Rahman, J Chem Phys, 80, 4423 (1984). + .. _Shinoda1: **(Shinoda)** Shinoda, Shiga, and Mikami, Phys Rev B, 69, 134103 (2004). + +.. _Clavier: + +**(Clavier)** G. Clavier, N. Desbiens, E. Bourasseau, V. Lachet, N. Brusselle-Dupend and B. Rousseau, Mol Sim, 43, 1413 (2017). diff --git a/doc/src/Modify_atom.rst b/doc/src/Modify_atom.rst index 5c3a96789e..6d278b3816 100644 --- a/doc/src/Modify_atom.rst +++ b/doc/src/Modify_atom.rst @@ -9,34 +9,34 @@ A new atom style can be created if one of the existing atom styles does not define all the attributes you need to store and communicate with atoms. -Atom_vec_atomic.cpp is the simplest example of an atom style. +The file ``atom_vec_atomic.cpp`` is the simplest example of an atom style. Examining the code for others will make these instructions more clear. -Note that the :doc:`atom style hybrid ` command can be -used to define atoms or particles which have the union of properties -of individual styles. Also the :doc:`fix property/atom ` -command can be used to add a single property (e.g. charge -or a molecule ID) to a style that does not have it. It can also be -used to add custom properties to an atom, with options to communicate -them with ghost atoms or read them from a data file. Other LAMMPS -commands can access these custom properties, as can new pair, fix, -compute styles that are written to work with these properties. For +Note that the :doc:`atom style hybrid ` command can be used +to define atoms or particles which have the union of properties of +individual styles. Also the :doc:`fix property/atom +` command can be used to add a single property +(e.g. charge or a molecule ID) to a style that does not have it. It can +also be used to add custom properties to an atom, with options to +communicate them with ghost atoms or read them from a data file. Other +LAMMPS commands can access these custom properties, as can new pair, +fix, compute styles that are written to work with these properties. For example, the :doc:`set ` command can be used to set the values of custom per-atom properties from an input script. All of these methods -are less work than writing code for a new atom style. +are less work than writing and testing(!) code for a new atom style. If you follow these directions your new style will automatically work in tandem with others via the :doc:`atom_style hybrid ` command. -The first step is to define a set of strings in the constructor of the -new derived class. Each string will have zero or more space-separated -variable names which are identical to those used in the atom.h header -file for per-atom properties. Note that some represent per-atom +The first step is to define a set of string lists in the constructor of +the new derived class. Each list will have zero or more comma-separated +strings that correspond to the variable names used in the ``atom.h`` +header file for per-atom properties. Note that some represent per-atom vectors (q, molecule) while other are per-atom arrays (x,v). For all -but the last 2 strings you do not need to specify any of +but the last two lists you do not need to specify any of (id,type,x,v,f). Those are included automatically as needed in the -other strings. +other lists. .. list-table:: @@ -65,16 +65,16 @@ other strings. * - fields_data_vel - list of properties (in order) in the Velocities section of a data file, as read by :doc:`read_data ` -In these strings you can list variable names which LAMMPS already -defines (in some other atom style), or you can create new variable -names. You should not re-use a LAMMPS variable for something with -different meaning in your atom style. If the meaning is related, but -interpreted differently by your atom style, then using the same -variable name means a user should not use your style and the other -style together in a :doc:`atom_style hybrid ` command. -Because there will only be one value of the variable and different -parts of LAMMPS will then likely use it differently. LAMMPS has -no way of checking for this. +In these lists you can list variable names which LAMMPS already defines +(in some other atom style), or you can create new variable names. You +should not re-use a LAMMPS variable in your atom style that is used for +something with a different meaning in another atom style. If the +meaning is related, but interpreted differently by your atom style, then +using the same variable name means a user must not use your style and +the other style together in a :doc:`atom_style hybrid ` +command. Because there will only be one value of the variable and +different parts of LAMMPS will then likely use it differently. LAMMPS +has no way of checking for this. If you are defining new variable names then make them descriptive and unique to your new atom style. For example choosing "e" for energy is @@ -85,32 +85,31 @@ If any of the variable names in your new atom style do not exist in LAMMPS, you need to add them to the src/atom.h and atom.cpp files. Search for the word "customize" or "customization" in these 2 files to -see where to add your variable. Adding a flag to the 2nd -customization section in atom.h is only necessary if your code (e.g. a -pair style) needs to check that a per-atom property is defined. These -flags should also be set in the constructor of the atom style child -class. +see where to add your variable. Adding a flag to the 2nd customization +section in ``atom.h`` is only necessary if your code (e.g. a pair style) +needs to check that a per-atom property is defined. These flags should +also be set in the constructor of the atom style child class. -In atom.cpp, aside from the constructor and destructor, there are 3 +In ``atom.cpp``, aside from the constructor and destructor, there are 3 methods that a new variable name or flag needs to be added to. -In Atom::peratom_create() when using the add_peratom() method, a -final length argument of 0 is for per-atom vectors, a length > 1 is -for per-atom arrays. Note the use of an extra per-thread flag and the -add_peratom_vary() method when last dimension of the array is +In ``Atom::peratom_create()`` when using the ``Atom::add_peratom()`` +method, a cols argument of 0 is for per-atom vectors, a length > +1 is for per-atom arrays. Note the use of the extra per-thread flag and +the add_peratom_vary() method when last dimension of the array is variable-length. -Adding the variable name to Atom::extract() enable the per-atom data +Adding the variable name to Atom::extract() enables the per-atom data to be accessed through the :doc:`LAMMPS library interface ` by a calling code, including from :doc:`Python `. The constructor of the new atom style will also typically set a few -flags which are defined at the top of atom_vec.h. If these are +flags which are defined at the top of ``atom_vec.h``. If these are unclear, see how other atom styles use them. -The grow_pointers() method is also required to make -a copy of peratom data pointers, as explained in the code. +The grow_pointers() method is also required to make a copy of peratom +data pointers, as explained in the code. There are a number of other optional methods which your atom style can implement. These are only needed if you need to do something diff --git a/doc/src/Modify_style.rst b/doc/src/Modify_style.rst index 3114ca4457..0ee600acc5 100644 --- a/doc/src/Modify_style.rst +++ b/doc/src/Modify_style.rst @@ -223,6 +223,13 @@ and readable by all and no executable permissions. Executable permissions (0755) should only be on shell scripts or python or similar scripts for interpreted script languages. +You can check for these issues with the python scripts in the +:ref:`"tools/coding_standard" ` folder. When run +normally with a source file or a source folder as argument, they will +list all non-conforming lines. By adding the `-f` flag to the command +line, they will modify the flagged files to try removing the detected +issues. + Indentation and Placement of Braces (strongly preferred) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -240,6 +247,53 @@ reformatting from clang-format yields undesirable output may be protected with placing a pair `// clang-format off` and `// clang-format on` comments around that block. +Error or warning messages and explanations (preferred) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionchanged:: 27Apr2022 + +Starting with LAMMPS version 27 April 2022 the LAMMPS developers have +agreed on a new policy for error and warning messages. + +Previously, all error and warning strings were supposed to be listed in +the class header files with an explanation. Those would then be +regularly "harvested" and transferred to alphabetically sorted lists in +the manual. To avoid excessively long lists and to reduce effort, this +came with a requirement to have rather generic error messages (e.g. +"Illegal ... command"). To identify the specific cause, the name of the +source file and the line number of the error location would be printed, +so that one could look up the cause by reading the source code. + +The new policy encourages more specific error messages that ideally +indicate the cause directly and no further lookup would be needed. +This is aided by using the `{fmt} library `_ to convert +the Error class commands so that they take a variable number of arguments +and error text will be treated like a {fmt} syntax format string. +Error messages should still kept to a single line or two lines at the most. + +For more complex explanations or errors that have multiple possible +reasons, a paragraph should be added to the `Error_details` page with an +error code reference (e.g. ``.. _err0001:``) then the utility function +:cpp:func:`utils::errorurl() ` can be used +to generate an URL that will directly lead to that paragraph. An error +for missing arguments can be easily generated using the +:cpp:func:`utils::missing_cmd_args() +` convenience function. + +The transformation of existing LAMMPS code to this new scheme is ongoing +and - given the size of the LAMMPS source code - will take a significant +amount of time until completion. However, for new code following the +new approach is strongly preferred. The expectation is that the new +scheme will make it easier for LAMMPS users, developers, and +maintainers. + +An example for this approach would be the +``src/read_data.cpp`` and ``src/atom.cpp`` files that implement the +:doc:`read_data ` and :doc:`atom_modify ` +commands and that may create :ref:`"Unknown identifier in data file" ` +errors that seem difficult to debug for users because they may have +one of multiple possible reasons, and thus require some additional explanations. + Programming language standards (required) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/src/Packages_details.rst b/doc/src/Packages_details.rst index e5e07c2f2c..b326eec2ac 100644 --- a/doc/src/Packages_details.rst +++ b/doc/src/Packages_details.rst @@ -32,6 +32,7 @@ page gives those details. * :ref:`AWPMD ` * :ref:`BOCS ` * :ref:`BODY ` + * :ref:`BPM ` * :ref:`BROWNIAN ` * :ref:`CG-DNA ` * :ref:`CG-SDK ` @@ -284,6 +285,33 @@ overview. ---------- +.. _PKG-BPM: + +BPM package +------------ + +**Contents:** + +Pair styles, bond styles, fixes, and computes for bonded particle +models for mesoscale simulations of solids and fracture. See the +:doc:`Howto bpm ` page for an overview. + +**Authors:** Joel T. Clemmer (Sandia National Labs) + +**Supporting info:** + +* src/BPM filenames -> commands +* :doc:`Howto_bpm ` +* :doc:`atom_style bpm/sphere ` +* :doc:`bond_style bpm/rotational ` +* :doc:`bond_style bpm/spring ` +* :doc:`compute nbond/atom ` +* :doc:`fix nve/bpm/sphere ` +* :doc:`pair_style bpm/spring ` +* examples/bpm + +---------- + .. _PKG-BROWNIAN: BROWNIAN package @@ -529,8 +557,20 @@ To use this package, also the :ref:`KSPACE ` and **Supporting info:** * src/DIELECTRIC: filenames -> commands +* :doc:`atom_style dielectric ` +* :doc:`pair_style coul/cut/dielectric ` +* :doc:`pair_style coul/long/dielectric ` +* :doc:`pair_style lj/cut/coul/cut/dielectric ` +* :doc:`pair_style lj/cut/coul/debye/dielectric ` +* :doc:`pair_style lj/cut/coul/long/dielectric ` +* :doc:`pair_style lj/cut/coul/msm/dielectric ` +* :doc:`pair_style pppm/dielectric ` +* :doc:`pair_style pppm/disp/dielectric ` +* :doc:`pair_style msm/dielectric ` +* :doc:`fix_style polarize/bem/icc ` +* :doc:`fix_style polarize/bem/gmres ` +* :doc:`fix_style polarize/functional ` * :doc:`compute efield/atom ` -* TODO: add all styles * examples/PACKAGES/dielectric ---------- @@ -1571,7 +1611,6 @@ listing, "ls src/MISC", to see the list of commands. * :doc:`pair_style list ` * :doc:`pair_style srp ` * :doc:`pair_style tracker ` -* :doc:`fix pair/tracker ` ---------- diff --git a/doc/src/Packages_list.rst b/doc/src/Packages_list.rst index ee2020a5ef..c4449d4373 100644 --- a/doc/src/Packages_list.rst +++ b/doc/src/Packages_list.rst @@ -58,6 +58,11 @@ whether an extra library is needed to build and use the package: - :doc:`Howto body ` - body - no + * - :ref:`BPM ` + - bonded particle models + - :doc:`Howto bpm ` + - bpm + - no * - :ref:`BROWNIAN ` - Brownian dynamics, self-propelled particles - :doc:`fix brownian `, :doc:`fix propel/self ` diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index f24659b278..558824a81b 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -87,7 +87,7 @@ Miscellaneous tools .. table_from_list:: :columns: 6 - * :ref:`CMake ` + * :ref:`LAMMPS coding standards ` * :ref:`emacs ` * :ref:`i-pi ` * :ref:`kate ` @@ -189,27 +189,32 @@ for the :doc:`chain benchmark `. ---------- -.. _cmake: +.. _coding_standard: -CMake tools ------------ +LAMMPS coding standard +---------------------- -The ``cmbuild`` script is a wrapper around using ``cmake --build ---target`` and allows compiling LAMMPS in a :ref:`CMake build folder -` with a make-like syntax regardless of the actual build -tool and the specific name of the program used (e.g. ``ninja-v1.10`` or -``gmake``) when using ``-D CMAKE_MAKE_PROGRAM=``. +The ``coding_standard`` folder contains multiple python scripts to +check for and apply some LAMMPS coding conventions. The following +scripts are available: .. parsed-literal:: - Usage: cmbuild [-v] [-h] [-C ] [-j ] [] + permissions.py # detects if sources have executable permissions and scripts have not + whitespace.py # detects TAB characters and trailing whitespace + homepage.py # detects outdated LAMMPS homepage URLs (pointing to sandia.gov instead of lammps.org) + errordocs.py # detects deprecated error docs in header files - Options: - -h print this message - -j allow processing of NUM concurrent tasks - -C DIRECTORY execute build in folder DIRECTORY - -v produce verbose output +The tools need to be given the main folder of the LAMMPS distribution +or individual file names as argument and will by default check them +and report any non-compliance. With the optional ``-f`` argument the +corresponding script will try to change the non-compliant file(s) to +match the conventions. +For convenience this scripts can also be invoked by the make file in +the ``src`` folder with, `make check-whitespace` or `make fix-whitespace` +to either detect or edit the files. Correspondingly for the other python +scripts. `make check` will run all checks. ---------- diff --git a/doc/src/atom_style.rst b/doc/src/atom_style.rst index 3a525b27f5..bd0c193962 100644 --- a/doc/src/atom_style.rst +++ b/doc/src/atom_style.rst @@ -10,7 +10,7 @@ Syntax atom_style style args -* style = *angle* or *atomic* or *body* or *bond* or *charge* or *dipole* or *dpd* or *edpd* or *electron* or *ellipsoid* or *full* or *line* or *mdpd* or *molecular* or *oxdna* or *peri* or *smd* or *sph* or *sphere* or *spin* or *tdpd* or *tri* or *template* or *hybrid* +* style = *angle* or *atomic* or *body* or *bond* or *charge* or *dipole* or *dpd* or *edpd* or *electron* or *ellipsoid* or *full* or *line* or *mdpd* or *molecular* or *oxdna* or *peri* or *smd* or *sph* or *sphere* or *bpm/sphere* or *spin* or *tdpd* or *tri* or *template* or *hybrid* .. parsed-literal:: @@ -21,6 +21,7 @@ Syntax see the :doc:`Howto body ` doc page for details *sphere* arg = 0/1 (optional) for static/dynamic particle radii + *bpm/sphere* arg = 0/1 (optional) for static/dynamic particle radii *tdpd* arg = Nspecies Nspecies = # of chemical species *template* arg = template-ID @@ -120,6 +121,8 @@ quantities. +--------------+-----------------------------------------------------+--------------------------------------+ | *sphere* | diameter, mass, angular velocity | granular models | +--------------+-----------------------------------------------------+--------------------------------------+ +| *bpm/sphere* | diameter, mass, angular velocity, quaternion | granular bonded particle models (BPM)| ++--------------+-----------------------------------------------------+--------------------------------------+ | *spin* | magnetic moment | system with magnetic particles | +--------------+-----------------------------------------------------+--------------------------------------+ | *tdpd* | chemical concentration | tDPD particles | @@ -141,8 +144,9 @@ quantities. output the custom values. All of the above styles define point particles, except the *sphere*, -*ellipsoid*, *electron*, *peri*, *wavepacket*, *line*, *tri*, and -*body* styles, which define finite-size particles. See the :doc:`Howto spherical ` page for an overview of using +*bpm/sphere*, *ellipsoid*, *electron*, *peri*, *wavepacket*, *line*, +*tri*, and *body* styles, which define finite-size particles. See the +:doc:`Howto spherical ` page for an overview of using finite-size particle models with LAMMPS. All of the point-particle styles assign mass to particles on a @@ -150,15 +154,15 @@ per-type basis, using the :doc:`mass ` command, The finite-size particle styles assign mass to individual particles on a per-particle basis. -For the *sphere* style, the particles are spheres and each stores a +For the *sphere* and *bpm/sphere* styles, the particles are spheres and each stores a per-particle diameter and mass. If the diameter > 0.0, the particle is a finite-size sphere. If the diameter = 0.0, it is a point particle. Note that by use of the *disc* keyword with the :doc:`fix nve/sphere `, :doc:`fix nvt/sphere `, :doc:`fix nph/sphere `, :doc:`fix npt/sphere -` commands, spheres can be effectively treated as 2d +` commands for the *sphere* style, spheres can be effectively treated as 2d discs for a 2d simulation if desired. See also the :doc:`set -density/disc ` command. The *sphere* style takes an optional 0 +density/disc ` command. The *sphere* and *bpm/sphere* styles take an optional 0 or 1 argument. A value of 0 means the radius of each sphere is constant for the duration of the simulation. A value of 1 means the radii may vary dynamically during the simulation, e.g. due to use of @@ -195,6 +199,8 @@ position, which is represented by the eradius = electron size. For the *peri* style, the particles are spherical and each stores a per-particle mass and volume. +The *bpm/sphere* style is part of the BPM package. + The *oxdna* style is for coarse-grained nucleotides and stores the 3'-to-5' polarity of the nucleotide strand, which is set through the bond topology in the data file. The first (second) atom in a diff --git a/doc/src/bond_bpm_rotational.rst b/doc/src/bond_bpm_rotational.rst new file mode 100644 index 0000000000..b13d27dfbe --- /dev/null +++ b/doc/src/bond_bpm_rotational.rst @@ -0,0 +1,258 @@ +.. index:: bond_style bpm/rotational + +bond_style bpm/rotational command +================================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + bond_style bpm/rotational keyword value attribute1 attribute2 ... + +* optional keyword = *overlay/pair* or *store/local* or *smooth* + + .. parsed-literal:: + + *store/local* values = fix_ID N attributes ... + * fix_ID = ID of associated internal fix to store data + * N = prepare data for output every this many timesteps + * attributes = zero or more of the below attributes may be appended + + *id1, id2* = IDs of 2 atoms in the bond + *time* = the timestep the bond broke + *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) + *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) + + *overlay/pair* value = none + bonded particles will still interact with pair forces + + *smooth* value = *yes* or *no* + smooths bond forces near the breaking point + +Examples +"""""""" + +.. code-block:: LAMMPS + + bond_style bpm/rotational + bond_coeff 1 1.0 0.2 0.02 0.02 0.20 0.04 0.04 0.04 0.1 0.02 0.002 0.002 + + bond_style bpm/rotational myfix 1000 time id1 id2 + fix myfix all store/local 1000 3 + dump 1 all local 1000 dump.broken f_myfix[1] f_myfix[2] f_myfix[3] + dump_modify 1 write_header no + +Description +""""""""""" + +The *bpm/rotational* bond style computes forces and torques based on +deviations from the initial reference state of the two atoms. The +reference state is stored by each bond when it is first computed in +the setup of a run. Data is then preserved across run commands and is +written to :doc:`binary restart files ` such that restarting +the system will not reset the reference state of a bond. + +Forces include a normal and tangential component. The base normal force +has a magnitude of + +.. math:: + + f_r = k_r (r - r_0) + +where :math:`k_r` is a stiffness and :math:`r` is the current distance and +:math:`r_0` is the initial distance between the two particles. + +A tangential force is applied perpendicular to the normal direction +which is proportional to the tangential shear displacement with a +stiffness of :math:`k_s`. This tangential force also induces a torque. +In addition, bending and twisting torques are also applied to +particles which are proportional to angular bending and twisting +displacements with stiffnesses of :math`k_b` and :math:`k_t', +respectively. Details on the calculations of shear displacements and +angular displacements can be found in :ref:`(Wang) ` and +:ref:`(Wang and Mora) `. + +Bonds will break under sufficient stress. A breaking criteria is calculated + +.. math:: + + B = \mathrm{max}\{0, \frac{f_r}{f_{r,c}} + \frac{|f_s|}{f_{s,c}} + + \frac{|\tau_b|}{\tau_{b,c}} + \frac{|\tau_t|}{\tau_{t,c}} \} + +where :math:`|f_s|` is the magnitude of the shear force and +:math:`|\tau_b|` and :math:`|\tau_t|` are the magnitudes of the +bending and twisting forces, respectively. The corresponding variables +:math:`f_{r,c}` :math:`f_{s,c}`, :math:`\tau_{b,c}`, and +:math:`\tau_{t,c}` are critical limits to each force or torque. If +:math:`B` is ever equal to or exceeds one, the bond will break. This +is done by setting by setting its type to 0 such that forces and +torques are no longer computed. + +After computing the base magnitudes of the forces and torques, they +can be optionally multiplied by an extra factor :math:`w` to smoothly +interpolate forces and torques to zero as the bond breaks. This term +is calculated as :math:`w = (1.0 - B^4)`. This smoothing factor can be +added or removed using the *smooth* keyword. + +Finally, additional damping forces and torques are applied to the two +particles. A force is applied proportional to the difference in the +normal velocity of particles using a similar construction as +dissipative particle dynamics (:ref:`(Groot) `): + +.. math:: + + F_D = - \gamma_n w (\hat{r} \bullet \vec{v}) + +where :math:`\gamma_n` is the damping strength, :math:`\hat{r}` is the +radial normal vector, and :math:`\vec{v}` is the velocity difference +between the two particles. Similarly, tangential forces are applied to +each atom proportional to the relative differences in sliding +velocities with a constant prefactor :math:`\gamma_s` (:ref:`(Wang et +al.) `) along with their associated torques. The rolling and +twisting components of the relative angular velocities of the two +atoms are also damped by applying torques with prefactors of +:math:`\gamma_r` and :math:`\gamma_t`, respectively. + +The following coefficients must be defined for each bond type via the +:doc:`bond_coeff ` command as in the example above, or in +the data file or restart files read by the :doc:`read_data ` +or :doc:`read_restart ` commands: + +* :math:`k_r` (force/distance units) +* :math:`k_s` (force/distance units) +* :math:`k_t` (force*distance/radians units) +* :math:`k_b` (force*distance/radians units) +* :math:`f_{r,c}` (force units) +* :math:`f_{s,c}` (force units) +* :math:`\tau_{b,c}` (force*distance units) +* :math:`\tau_{t,c}` (force*distance units) +* :math:`\gamma_n` (force/velocity units) +* :math:`\gamma_s` (force/velocity units) +* :math:`\gamma_r` (force*distance/velocity units) +* :math:`\gamma_t` (force*distance/velocity units) + +By default, pair forces are not calculated between bonded particles. +Pair forces can alternatively be overlaid on top of bond forces using +the *overlay/pair* keyword. These settings require specific +:doc:`special_bonds ` settings described in the +restrictions. Further details can be found in the `:doc: how to +` page on BPMs. + +If the *store/local* keyword is used, this fix will track bonds that +break during the simulation. Whenever a bond breaks, data is processed +and transferred to an internal fix labeled *fix_ID*. This allows the +local data to be accessed by other LAMMPS commands. +Following any optional keyword/value arguments, a list of one or more +attributes is specified. These include the IDs of the two atoms in +the bond. The other attributes for the two atoms include the timestep +during which the bond broke and the current/initial center of mass +position of the two atoms. + +Data is continuously accumulated over intervals of *N* +timesteps. At the end of each interval, all of the saved accumulated +data is deleted to make room for new data. Individual datum may +therefore persist anywhere between *1* to *N* timesteps depending on +when they are saved. This data can be accessed using the *fix_ID* and a +:doc:`dump local ` command. To ensure all data is output, +the dump frequency should correspond to the same interval of *N* +timesteps. A dump frequency of an integer multiple of *N* can be used +to regularly output a sample of the accumulated data. + +Note that when unbroken bonds are dumped to a file via the +:doc:`dump local ` command, bonds with type 0 (broken bonds) +are not included. +The :doc:`delete_bonds ` command can also be used to +query the status of broken bonds or permanently delete them, e.g.: + +.. code-block:: LAMMPS + + delete_bonds all stats + delete_bonds all bond 0 remove + + +---------- + +Restart and other info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This bond style writes the reference state of each bond to +:doc:`binary restart files `. Loading a restart file will +properly resume bonds. + +The single() function of these pair styles returns 0.0 for the energy +of a pairwise interaction, since energy is not conserved in these +dissipative potentials. It also returns only the normal component of +the pairwise interaction force. + +The accumulated data is not written to restart files and should be +output before a restart file is written to avoid missing data. + +The internal fix calculates a local vector or local array depending on the +number of input values. The length of the vector or number of rows in +the array is the number of recorded, lost interactions. If a single +input is specified, a local vector is produced. If two or more inputs +are specified, a local array is produced where the number of columns = +the number of inputs. The vector or array can be accessed by any +command that uses local values from a compute as input. See the +:doc:`Howto output ` page for an overview of LAMMPS +output options. + +The vector or array will be floating point values that correspond to +the specified attribute. + +Restrictions +"""""""""""" + +This bond style can only be used if LAMMPS was built with the BPM +package. See the :doc:`Build package ` doc page for +more info. + +By default if pair interactions are to be disabled, this bond style +requires setting + +.. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 1 1 1 + +and :doc:`newton ` must be set to bond off. If the +*overlay/pair* option is used, this bond style alternatively requires +setting + +.. code-block:: LAMMPS + + special_bonds lj/coul 1 1 1 + +The *bpm/rotational* style requires :doc:`atom style bpm/sphere `. + +Related commands +"""""""""""""""" + +:doc:`bond_coeff `, :doc:`fix nve/bpm/sphere ` + +Default +""""""" + +The option defaults are *smooth* = *yes* + +---------- + +.. _Wang2009: + +**(Wang)** Wang, Acta Geotechnica, 4, +p 117-127 (2009). + +.. _Wang2009b: + +**(Wang and Mora)** Wang, Mora, Advances in Geocomputing, +119, p 183-228 (2009). + +.. _Groot3: + +**(Groot)** Groot and Warren, J Chem Phys, 107, 4423-35 (1997). + +.. _Wang20152: + +**(Wang et al, 2015)** Wang, Y., Alonso-Marroquin, F., & Guo, +W. W. (2015). Rolling and sliding in 3-D discrete element +models. Particuology, 23, 49-55. diff --git a/doc/src/bond_bpm_spring.rst b/doc/src/bond_bpm_spring.rst new file mode 100644 index 0000000000..1d2f12701d --- /dev/null +++ b/doc/src/bond_bpm_spring.rst @@ -0,0 +1,202 @@ +.. index:: bond_style bpm/spring + +bond_style bpm/spring command +============================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + bond_style bpm/spring keyword value attribute1 attribute2 ... + +* optional keyword = *overlay/pair* or *store/local* or *smooth* + + .. parsed-literal:: + + *store/local* values = fix_ID N attributes ... + * fix_ID = ID of associated internal fix to store data + * N = prepare data for output every this many timesteps + * attributes = zero or more of the below attributes may be appended + + *id1, id2* = IDs of 2 atoms in the bond + *time* = the timestep the bond broke + *x, y, z* = the center of mass position of the 2 atoms when the bond broke (distance units) + *x/ref, y/ref, z/ref* = the initial center of mass position of the 2 atoms (distance units) + + *overlay/pair* value = none + bonded particles will still interact with pair forces + + *smooth* value = *yes* or *no* + smooths bond forces near the breaking point + +Examples +"""""""" + +.. code-block:: LAMMPS + + bond_style bpm/spring + bond_coeff 1 1.0 0.05 0.1 + + bond_style bpm/spring myfix 1000 time id1 id2 + dump 1 all local 1000 dump.broken f_myfix[1] f_myfix[2] f_myfix[3] + dump_modify 1 write_header no + +Description +""""""""""" + +The *bpm/spring* bond style computes forces and torques based on +deviations from the initial reference state of the two atoms. The +reference state is stored by each bond when it is first computed in +the setup of a run. Data is then preserved across run commands and is +written to :doc:`binary restart files ` such that restarting +the system will not reset the reference state of a bond. + +This bond style only applies central-body forces which conserve the +translational and rotational degrees of freedom of a bonded set of +particles. The force has a magnitude of + +.. math:: + + F = k (r - r_0) w + +where :math:`k_r` is a stiffness, :math:`r` is the current distance +and :math:`r_0` is the initial distance between the two particles, and +:math:`w` is an optional smoothing factor discussed below. Bonds will +break at a strain of :math:`\epsilon_c`. This is done by setting by +setting its type to 0 such that forces are no longer computed. + +An additional damping force is applied to the bonded +particles. This forces is proportional to the difference in the +normal velocity of particles using a similar construction as +dissipative particle dynamics (:ref:`(Groot) `): + +.. math:: + + F_D = - \gamma w (\hat{r} \bullet \vec{v}) + +where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the +radial normal vector, and :math:`\vec{v}` is the velocity difference +between the two particles. + +The smoothing factor :math:`w` can be added or removed using the +*smooth* keyword. It is constructed such that forces smoothly go +to zero, avoiding discontinuities, as bonds approach the critical strain + +.. math:: + + w = 1.0 - \left( \frac{r - r_0}{r_0 \epsilon_c} \right)^8 . + +The following coefficients must be defined for each bond type via the +:doc:`bond_coeff ` command as in the example above, or in +the data file or restart files read by the :doc:`read_data +` or :doc:`read_restart ` commands: + +* :math:`k` (force/distance units) +* :math:`\epsilon_c` (unit less) +* :math:`\gamma` (force/velocity units) + +By default, pair forces are not calculated between bonded particles. +Pair forces can alternatively be overlaid on top of bond forces using +the *overlay/pair* keyword. These settings require specific +:doc:`special_bonds ` settings described in the +restrictions. Further details can be found in the `:doc: how to +` page on BPMs. + +If the *store/local* keyword is used, this fix will track bonds that +break during the simulation. Whenever a bond breaks, data is processed +and transferred to an internal fix labeled *fix_ID*. This allows the +local data to be accessed by other LAMMPS commands. +Following any optional keyword/value arguments, a list of one or more +attributes is specified. These include the IDs of the two atoms in +the bond. The other attributes for the two atoms include the timestep +during which the bond broke and the current/initial center of mass +position of the two atoms. + +Data is continuously accumulated over intervals of *N* +timesteps. At the end of each interval, all of the saved accumulated +data is deleted to make room for new data. Individual datum may +therefore persist anywhere between *1* to *N* timesteps depending on +when they are saved. This data can be accessed using the *fix_ID* and a +:doc:`dump local ` command. To ensure all data is output, +the dump frequency should correspond to the same interval of *N* +timesteps. A dump frequency of an integer multiple of *N* can be used +to regularly output a sample of the accumulated data. + +Note that when unbroken bonds are dumped to a file via the +:doc:`dump local ` command, bonds with type 0 (broken bonds) +are not included. +The :doc:`delete_bonds ` command can also be used to +query the status of broken bonds or permanently delete them, e.g.: + +.. code-block:: LAMMPS + + delete_bonds all stats + delete_bonds all bond 0 remove + +---------- + +Restart and other info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +This bond style writes the reference state of each bond to +:doc:`binary restart files `. Loading a restart +file will properly resume bonds. + +The single() function of these pair styles returns 0.0 for the energy +of a pairwise interaction, since energy is not conserved in these +dissipative potentials. + +The accumulated data is not written to restart files and should be +output before a restart file is written to avoid missing data. + +The internal fix calculates a local vector or local array depending on the +number of input values. The length of the vector or number of rows in +the array is the number of recorded, lost interactions. If a single +input is specified, a local vector is produced. If two or more inputs +are specified, a local array is produced where the number of columns = +the number of inputs. The vector or array can be accessed by any +command that uses local values from a compute as input. See the +:doc:`Howto output ` page for an overview of LAMMPS +output options. + +The vector or array will be floating point values that correspond to +the specified attribute. + +Restrictions +"""""""""""" + +This bond style can only be used if LAMMPS was built with the BPM +package. See the :doc:`Build package ` doc page for +more info. + +By default if pair interactions are to be disabled, this bond style +requires setting + +.. code-block:: LAMMPS + + special_bonds lj 0 1 1 coul 1 1 1 + +and :doc:`newton ` must be set to bond off. If the +*overlay/pair* option is used, this bond style alternatively requires +setting + +.. code-block:: LAMMPS + + special_bonds lj/coul 1 1 1 + +Related commands +"""""""""""""""" + +:doc:`bond_coeff `, :doc:`pair bpm/spring ` + +Default +""""""" + +The option defaults are *smooth* = *yes* + +---------- + +.. _Groot4: + +**(Groot)** Groot and Warren, J Chem Phys, 107, 4423-35 (1997). diff --git a/doc/src/bond_quartic.rst b/doc/src/bond_quartic.rst index 89c33607ac..1f9f9bf4e9 100644 --- a/doc/src/bond_quartic.rst +++ b/doc/src/bond_quartic.rst @@ -67,7 +67,8 @@ local maximum. If a bond length ever becomes :math:`> R_c`, LAMMPS "breaks" the bond, which means two things. First, the bond potential is turned off by setting its type to 0, and is no longer computed. Second, a pairwise interaction between the two atoms is turned on, since they -are no longer bonded. +are no longer bonded. See the :doc:`Howto ` page +on broken bonds for more information. LAMMPS does the second task via a computational sleight-of-hand. It subtracts the pairwise interaction as part of the bond computation. diff --git a/doc/src/bond_style.rst b/doc/src/bond_style.rst index 4dee48a78d..95ba1572c1 100644 --- a/doc/src/bond_style.rst +++ b/doc/src/bond_style.rst @@ -84,6 +84,8 @@ accelerated styles exist. * :doc:`zero ` - topology but no interactions * :doc:`hybrid ` - define multiple styles of bond interactions +* :doc:`bpm/rotational ` - breakable bond with forces and torques based on deviation from reference state +* :doc:`bpm/spring ` - breakable bond with forces based on deviation from reference length * :doc:`class2 ` - COMPASS (class 2) bond * :doc:`fene ` - FENE (finite-extensible non-linear elastic) bond * :doc:`fene/expand ` - FENE bonds with variable size particles diff --git a/doc/src/compute.rst b/doc/src/compute.rst index a149a752b0..6fdedbbb95 100644 --- a/doc/src/compute.rst +++ b/doc/src/compute.rst @@ -179,6 +179,7 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`body/local ` - attributes of body sub-particles * :doc:`bond ` - energy of each bond sub-style * :doc:`bond/local ` - distance and energy of each bond +* :doc:`born/matrix ` - second derivative or potential with respect to strain * :doc:`centro/atom ` - centro-symmetry parameter for each atom * :doc:`centroid/stress/atom ` - centroid based stress tensor for each atom * :doc:`chunk/atom ` - assign chunk IDs to each atom @@ -236,6 +237,7 @@ The individual style names on the :doc:`Commands compute ` pag * :doc:`msd ` - mean-squared displacement of group of atoms * :doc:`msd/chunk ` - mean-squared displacement for each chunk * :doc:`msd/nongauss ` - MSD and non-Gaussian parameter of group of atoms +* :doc:`nbond/atom ` - calculates number of bonds per atom * :doc:`omega/chunk ` - angular velocity for each chunk * :doc:`orientorder/atom ` - Steinhardt bond orientational order parameters Ql * :doc:`pair ` - values computed by a pair style diff --git a/doc/src/compute_born_matrix.rst b/doc/src/compute_born_matrix.rst new file mode 100644 index 0000000000..84d002a621 --- /dev/null +++ b/doc/src/compute_born_matrix.rst @@ -0,0 +1,213 @@ +.. index:: compute born/matrix + +compute born/matrix command +=========================== + +Syntax +"""""" + +.. parsed-literal:: + + compute ID group-ID born/matrix keyword value ... + +* ID, group-ID are documented in :doc:`compute ` command +* born/matrix = style name of this compute command +* zero or more keyword/value pairs may be appended + + .. parsed-literal:: + + keyword = *numdiff* + *numdiff* values = delta virial-ID + delta = magnitude of strain (dimensionless) + virial-ID = ID of pressure compute for virial (string) + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute 1 all born/matrix + compute 1 all born/matrix bond angle + compute 1 all born/matrix numdiff 1.0e-4 myvirial + +Description +""""""""""" + +Define a compute that calculates +:math:`\frac{\partial{}^2U}{\partial\varepsilon_{i}\partial\varepsilon_{j}}` the +second derivatives of the potential energy :math:`U` w.r.t. strain +tensor :math:`\varepsilon` elements. These values are related to: + +.. math:: + + C^{B}_{i,j}=\frac{1}{V}\frac{\partial{}^2U}{\partial{}\varepsilon_{i}\partial\varepsilon_{j}} + +also called the Born term of elastic constants in the stress-stress fluctuation +formalism. This quantity can be used to compute the elastic constant tensor. +Using the symmetric Voigt notation, the elastic constant tensor can be written +as a 6x6 symmetric matrix: + +.. math:: + + C_{i,j} = \langle{}C^{B}_{i,j}\rangle + + \frac{V}{k_{B}T}\left(\langle\sigma_{i}\sigma_{j}\rangle\right. + \left.- \langle\sigma_{i}\rangle\langle\sigma_{j}\rangle\right) + + \frac{Nk_{B}T}{V} + \left(\delta_{i,j}+(\delta_{1,i}+\delta_{2,i}+\delta_{3,i})\right. + \left.*(\delta_{1,j}+\delta_{2,j}+\delta_{3,j})\right) + +In the above expression, :math:`\sigma` stands for the virial stress +tensor, :math:`\delta` is the Kronecker delta and the usual notation apply for +the number of particle, the temperature and volume respectively :math:`N`, +:math:`T` and :math:`V`. :math:`k_{B}` is the Boltzmann constant. + +The Born term is a symmetric 6x6 matrix, as is the matrix of second derivatives +of potential energy w.r.t strain, +whose 21 independent elements are output in this order: + +.. math:: + + \begin{matrix} + C_{1} & C_{7} & C_{8} & C_{9} & C_{10} & C_{11} \\ + C_{7} & C_{2} & C_{12} & C_{13} & C_{14} & C_{15} \\ + \vdots & C_{12} & C_{3} & C_{16} & C_{17} & C_{18} \\ + \vdots & C_{13} & C_{16} & C_{4} & C_{19} & C_{20} \\ + \vdots & \vdots & \vdots & C_{19} & C_{5} & C_{21} \\ + \vdots & \vdots & \vdots & \vdots & C_{21} & C_{6} + \end{matrix} + +in this matrix the indices of :math:`C_{k}` value are the corresponding element +:math:`k` in the global vector output by this compute. Each term comes from the sum +of the derivatives of every contribution to the potential energy +in the system as explained in :ref:`(VanWorkum) +`. + +The output can be accessed using usual Lammps routines: + +.. code-block:: LAMMPS + + compute 1 all born/matrix + compute 2 all pressure NULL virial + variable S1 equal -c_2[1] + variable S2 equal -c_2[2] + variable S3 equal -c_2[3] + variable S4 equal -c_2[4] + variable S5 equal -c_2[5] + variable S6 equal -c_2[6] + fix 1 all ave/time 1 1 1 v_S1 v_S2 v_S3 v_S4 v_S5 v_S6 c_1[*] file born.out + +In this example, the file *born.out* will contain the information needed to +compute the first and second terms of the elastic constant matrix in a post +processing procedure. The other required quantities can be accessed using any +other *LAMMPS* usual method. Several examples of this method are +provided in the examples/ELASTIC_T/BORN_MATRIX directory +described on the :doc:`Examples ` doc page. + +NOTE: In the above :math:`C_{i,j}` computation, the fluctuation +term involving the virial stress tensor :math:`\sigma` is the +covariance between each elements. In a +solid the stress fluctuations can vary rapidly, while average +fluctuations can be slow to converge. +A detailed analysis of the convergence rate of all the terms in +the elastic tensor +is provided in the paper by Clavier et al. :ref:`(Clavier) `. + +Two different computation methods for the Born matrix are implemented in this +compute and are mutually exclusive. + +The first one is a direct computation from the analytical formula from the +different terms of the potential used for the simulations :ref:`(VanWorkum) +`. However, the implementation of such derivations must be done +for every potential form. This has not been done yet and can be very +complicated for complex potentials. At the moment a warning message is +displayed for every term that is not supporting the compute at the moment. +This method is the default for now. + +The second method uses finite differences of energy to numerically approximate +the second derivatives :ref:`(Zhen) `. This is useful when using +interaction styles for which the analytical second derivatives have not been +implemented. In this cases, the compute applies linear strain fields of +magnitude *delta* to all the atoms relative to a point at the center of the +box. The strain fields are in six different directions, corresponding to the +six Cartesian components of the stress tensor defined by LAMMPS. For each +direction it applies the strain field in both the positive and negative senses, +and the new stress virial tensor of the entire system is calculated after each. +The difference in these two virials divided by two times *delta*, approximates +the corresponding components of the second derivative, after applying a +suitable unit conversion. + +.. note:: + + It is important to choose a suitable value for delta, the magnitude of + strains that are used to generate finite difference + approximations to the exact virial stress. For typical systems, a value in + the range of 1 part in 1e5 to 1e6 will be sufficient. + However, the best value will depend on a multitude of factors + including the stiffness of the interatomic potential, the thermodynamic + state of the material being probed, and so on. The only way to be sure + that you have made a good choice is to do a sensitivity study on a + representative atomic configuration, sweeping over a wide range of + values of delta. If delta is too small, the output values will vary + erratically due to truncation effects. If delta is increased beyond a + certain point, the output values will start to vary smoothly with + delta, due to growing contributions from higher order derivatives. In + between these two limits, the numerical virial values should be largely + independent of delta. + +The keyword requires the additional arguments *delta* and *virial-ID*. +*delta* gives the size of the applied strains. *virial-ID* gives +the ID string of the pressure compute that provides the virial stress tensor, +requiring that it use the virial keyword e.g. + +.. code-block:: LAMMPS + + compute myvirial all pressure NULL virial + compute 1 all born/matrix numdiff 1.0e-4 myvirial + +**Output info:** + +This compute calculates a global vector with 21 values that are +the second derivatives of the potential energy w.r.t. strain. +The values are in energy units. +The values are ordered as explained above. These values can be used +by any command that uses global values from a compute as input. See +the :doc:`Howto output ` doc page for an overview of +LAMMPS output options. + +The array values calculated by this compute are all "extensive". + +Restrictions +"""""""""""" + +This compute is part of the EXTRA-COMPUTE package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package +` page for more info. LAMMPS was built with that package. See +the :doc:`Build package ` page for more info. + +The Born term can be decomposed as a product of two terms. The first one is a +general term which depends on the configuration. The second one is specific to +every interaction composing your force field (non-bonded, bonds, angle...). +Currently not all LAMMPS interaction styles implement the *born_matrix* method +giving first and second order derivatives and LAMMPS will exit with an error if +this compute is used with such interactions unless the *numdiff* option is +also used. The *numdiff* option cannot be used with any other keyword. In this +situation, LAMMPS will also exit with an error. + +Default +""""""" + +none + +---------- + +.. _VanWorkum: + +**(Van Workum)** K. Van Workum et al., J. Chem. Phys. 125 144506 (2006) + +.. _Clavier2: + +**(Clavier)** G. Clavier, N. Desbiens, E. Bourasseau, V. Lachet, N. Brusselle-Dupend and B. Rousseau, Mol Sim, 43, 1413 (2017). + +.. _Zhen: + +**(Zhen)** Y. Zhen, C. Chu, Computer Physics Communications 183(2012)261-265 diff --git a/doc/src/compute_nbond_atom.rst b/doc/src/compute_nbond_atom.rst new file mode 100644 index 0000000000..e86986287f --- /dev/null +++ b/doc/src/compute_nbond_atom.rst @@ -0,0 +1,52 @@ +.. index:: compute nbond/atom + +compute nbond/atom command +========================== + +Syntax +"""""" + +.. parsed-literal:: + + compute ID group-ID nbond/atom + +* ID, group-ID are documented in :doc:`compute ` command +* nbond/atom = style name of this compute command + +Examples +"""""""" + +.. code-block:: LAMMPS + + compute 1 all nbond/atom + +Description +""""""""""" + +Define a computation that computes the number of bonds each atom is +part of. Bonds which are broken are not counted in the tally. See +the :doc:`Howto broken bonds ` page for more information. +The number of bonds will be zero for atoms not in the specified +compute group. This compute does not depend on Newton bond settings. + +Output info +""""""""""" + +This compute calculates a per-atom vector, which can be accessed by +any command that uses per-atom values from a compute as input. See +the :doc:`Howto output ` doc page for an overview of +LAMMPS output options. + +Restrictions +"""""""""""" + +This fix can only be used if LAMMPS was built with the BPM package. +See the :doc:`Build package ` doc page for more info. + +Related commands +"""""""""""""""" + +Default +""""""" + +none diff --git a/doc/src/compute_rigid_local.rst b/doc/src/compute_rigid_local.rst index 574f3343be..6817f0ac1e 100644 --- a/doc/src/compute_rigid_local.rst +++ b/doc/src/compute_rigid_local.rst @@ -127,19 +127,16 @@ The *vx*, *vy*, *vz*, *fx*, *fy*, *fz* attributes are components of the COM velocity and force on the COM of the body. The *omegax*, *omegay*, and *omegaz* attributes are the angular -velocity components of the body around its COM. +velocity components of the body in the system frame around its COM. The *angmomx*, *angmomy*, and *angmomz* attributes are the angular -momentum components of the body around its COM. +momentum components of the body in the system frame around its COM. The *quatw*, *quati*, *quatj*, and *quatk* attributes are the components of the 4-vector quaternion representing the orientation of the rigid body. See the :doc:`set ` command for an explanation of the quaternion vector. -The *angmomx*, *angmomy*, and *angmomz* attributes are the angular -momentum components of the body around its COM. - The *tqx*, *tqy*, *tqz* attributes are components of the torque acting on the body around its COM. diff --git a/doc/src/compute_temp_profile.rst b/doc/src/compute_temp_profile.rst index b70206781f..e5830f5cf7 100644 --- a/doc/src/compute_temp_profile.rst +++ b/doc/src/compute_temp_profile.rst @@ -76,21 +76,28 @@ velocity for each atom. Note that if there is only one atom in the bin, its thermal velocity will thus be 0.0. After the spatially-averaged velocity field has been subtracted from -each atom, the temperature is calculated by the formula KE = (dim\*N -- dim\*Nx\*Ny\*Nz) k T/2, where KE = total kinetic energy of the group of -atoms (sum of 1/2 m v\^2), dim = 2 or 3 = dimensionality of the -simulation, N = number of atoms in the group, k = Boltzmann constant, -and T = temperature. The dim\*Nx\*Ny\*Nz term are degrees of freedom -subtracted to adjust for the removal of the center-of-mass velocity in -each of Nx\*Ny\*Nz bins, as discussed in the :ref:`(Evans) ` paper. +each atom, the temperature is calculated by the formula +*KE* = (*dim\*N* - *Ns\*Nx\*Ny\*Nz* - *extra* ) *k* *T*/2, where *KE* = total +kinetic energy of the group of atoms (sum of 1/2 *m* *v*\^2), *dim* = 2 +or 3 = dimensionality of the simulation, *Ns* = 0, 1, 2 or 3 for +streaming velocity subtracted in 0, 1, 2 or 3 dimensions, *extra* = extra +degrees-of-freedom, *N* = number of atoms in the group, *k* = Boltzmann +constant, and *T* = temperature. The *Ns\*Nx\*Ny\*Nz* term is degrees +of freedom subtracted to adjust for the removal of the center-of-mass +velocity in each direction of the *Nx\*Ny\*Nz* bins, as discussed in the +:ref:`(Evans) ` paper. The extra term defaults to (*dim* - *Ns*) +and accounts for overall conservation of center-of-mass velocity across +the group in directions where streaming velocity is *not* subtracted. This +can be altered using the *extra* option of the +:doc:`compute_modify ` command. If the *out* keyword is used with a *tensor* value, which is the default, a kinetic energy tensor, stored as a 6-element vector, is also calculated by this compute for use in the computation of a pressure tensor. The formula for the components of the tensor is the -same as the above formula, except that v\^2 is replaced by vx\*vy for -the xy component, etc. The 6 components of the vector are ordered xx, -yy, zz, xy, xz, yz. +same as the above formula, except that *v*\^2 is replaced by *vx\*vy* for +the xy component, etc. The 6 components of the vector are ordered *xx, +yy, zz, xy, xz, yz.* If the *out* keyword is used with a *bin* value, the count of atoms and computed temperature for each bin are stored for output, as an @@ -123,10 +130,20 @@ needed, the subtracted degrees-of-freedom can be altered using the .. note:: When using the *out* keyword with a value of *bin*, the - calculated temperature for each bin does not include the - degrees-of-freedom adjustment described in the preceding paragraph, - for fixes that constrain molecular motion. It does include the - adjustment due to the *extra* option, which is applied to each bin. + calculated temperature for each bin includes the degrees-of-freedom + adjustment described in the preceding paragraph for fixes that + constrain molecular motion, as well as the adjustment due to + the *extra* option (which defaults to *dim* - *Ns* as described above), + by fractionally applying them based on the fraction of atoms in each + bin. As a result, the bin degrees-of-freedom summed over all bins exactly + equals the degrees-of-freedom used in the scalar temperature calculation, + :math:`\Sigma N_{DOF_i} = N_{DOF}` and the corresponding relation for temperature + is also satisfied :math:`\Sigma N_{DOF_i} T_i = N_{DOF} T`. + These relations will breakdown in cases where the adjustment + exceeds the actual number of degrees-of-freedom in a bin. This could happen + if a bin is empty or in situations where rigid molecules + are non-uniformly distributed, in which case the reported + temperature within a bin may not be accurate. See the :doc:`Howto thermostat ` page for a discussion of different ways to compute temperature and perform diff --git a/doc/src/dump_modify.rst b/doc/src/dump_modify.rst index 9e3f7f738d..c65cd68a29 100644 --- a/doc/src/dump_modify.rst +++ b/doc/src/dump_modify.rst @@ -474,8 +474,9 @@ The *fileper* keyword is documented below with the *nfile* keyword. The *header* keyword toggles whether the dump file will include a header. Excluding a header will reduce the size of the dump file for -fixes such as :doc:`fix pair/tracker ` which do not -require the information typically written to the header. +data produced by :doc:`pair tracker ` or +:doc:`bpm bond styles ` which may not require the +information typically written to the header. ---------- diff --git a/doc/src/fix.rst b/doc/src/fix.rst index de85cb3579..b0ec47fbe6 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -287,6 +287,7 @@ accelerated styles exist. * :doc:`nve/manifold/rattle ` - * :doc:`nve/noforce ` - NVE without forces (v only) * :doc:`nve/sphere ` - NVE for spherical particles +* :doc:`nve/bpm/sphere ` - NVE for spherical particles used in the BPM package * :doc:`nve/spin ` - NVE for a spin or spin-lattice system * :doc:`nve/tri ` - NVE for triangles * :doc:`nvk ` - constant kinetic energy time integration @@ -304,7 +305,6 @@ accelerated styles exist. * :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:`pair/tracker ` - track properties of pairwise interactions * :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_adapt.rst b/doc/src/fix_adapt.rst index b7151334db..625a5b01d0 100644 --- a/doc/src/fix_adapt.rst +++ b/doc/src/fix_adapt.rst @@ -14,7 +14,7 @@ Syntax * adapt = style name of this fix command * N = adapt simulation settings every this many timesteps * one or more attribute/arg pairs may be appended -* attribute = *pair* or *bond* or *kspace* or *atom* +* attribute = *pair* or *bond* or *angle* or *kspace* or *atom* .. parsed-literal:: @@ -28,11 +28,16 @@ Syntax bparam = parameter to adapt over time I = type bond to set parameter for v_name = variable with name that calculates value of bparam + *angle* args = astyle aparam I v_name + astyle = angle style name, e.g. harmonic + aparam = parameter to adapt over time + I = type angle to set parameter for + v_name = variable with name that calculates value of aparam *kspace* arg = v_name v_name = variable with name that calculates scale factor on K-space terms - *atom* args = aparam v_name - aparam = parameter to adapt over time - v_name = variable with name that calculates value of aparam + *atom* args = atomparam v_name + atomparam = parameter to adapt over time + v_name = variable with name that calculates value of atomparam * zero or more keyword/value pairs may be appended * keyword = *scale* or *reset* or *mass* @@ -283,30 +288,62 @@ operates. The only difference is that now a bond coefficient for a given bond type is adapted. A wild-card asterisk can be used in place of or in conjunction with -the bond type argument to set the coefficients for multiple bond types. -This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = the number of -atom types, then an asterisk with no numeric values means all types -from 1 to N. A leading asterisk means all types from 1 to n (inclusive). -A trailing asterisk means all types from n to N (inclusive). A middle -asterisk means all types from m to n (inclusive). +the bond type argument to set the coefficients for multiple bond +types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = +the number of bond types, then an asterisk with no numeric values +means all types from 1 to N. A leading asterisk means all types from +1 to n (inclusive). A trailing asterisk means all types from n to N +(inclusive). A middle asterisk means all types from m to n +(inclusive). Currently *bond* does not support bond_style hybrid nor bond_style -hybrid/overlay as bond styles. The only bonds that currently are -working with fix_adapt are +hybrid/overlay as bond styles. The bond styles that currently work +with fix_adapt are -+------------------------------------+-------+------------+ -| :doc:`class2 ` | r0 | type bonds | -+------------------------------------+-------+------------+ -| :doc:`fene ` | k, r0 | type bonds | -+------------------------------------+-------+------------+ -| :doc:`gromos ` | k, r0 | type bonds | -+------------------------------------+-------+------------+ -| :doc:`harmonic ` | k,r0 | type bonds | -+------------------------------------+-------+------------+ -| :doc:`morse ` | r0 | type bonds | -+------------------------------------+-------+------------+ -| :doc:`nonlinear ` | r0 | type bonds | -+------------------------------------+-------+------------+ ++------------------------------------+-------+-----------------+ +| :doc:`class2 ` | r0 | type bonds | ++------------------------------------+-------+-----------------+ +| :doc:`fene ` | k,r0 | type bonds | ++------------------------------------+-------+-----------------+ +| :doc:`fene/nm ` | k,r0 | type bonds | ++------------------------------------+-------+-----------------+ +| :doc:`gromos ` | k,r0 | type bonds | ++------------------------------------+-------+-----------------+ +| :doc:`harmonic ` | k,r0 | type bonds | ++------------------------------------+-------+-----------------+ +| :doc:`morse ` | r0 | type bonds | ++------------------------------------+-------+-----------------+ +| :doc:`nonlinear ` | epsilon,r0 | type bonds | ++------------------------------------+-------+-----------------+ + +---------- + +The *angle* keyword uses the specified variable to change the value of +an angle coefficient over time, very similar to how the *pair* keyword +operates. The only difference is that now an angle coefficient for a +given angle type is adapted. + +A wild-card asterisk can be used in place of or in conjunction with +the angle type argument to set the coefficients for multiple angle +types. This takes the form "\*" or "\*n" or "n\*" or "m\*n". If N = +the number of angle types, then an asterisk with no numeric values +means all types from 1 to N. A leading asterisk means all types from +1 to n (inclusive). A trailing asterisk means all types from n to N +(inclusive). A middle asterisk means all types from m to n +(inclusive). + +Currently *angle* does not support angle_style hybrid nor angle_style +hybrid/overlay as angle styles. The angle styles that currently work +with fix_adapt are + ++------------------------------------+-------+-----------------+ +| :doc:`harmonic ` | k,theta0 | type angles | ++------------------------------------+-------+-----------------+ +| :doc:`cosine ` | k | type angles | ++------------------------------------+-------+-----------------+ + +Note that internally, theta0 is stored in radians, so the variable +this fix uses to reset theta0 needs to generate values in radians. ---------- diff --git a/doc/src/fix_bond_break.rst b/doc/src/fix_bond_break.rst index 9538fa8ef3..ba12e154c5 100644 --- a/doc/src/fix_bond_break.rst +++ b/doc/src/fix_bond_break.rst @@ -113,6 +113,9 @@ You can dump out snapshots of the current bond topology via the :doc:`dump local may need to thermostat your system to compensate for energy changes resulting from broken bonds (and angles, dihedrals, impropers). +See the :doc:`Howto ` page on broken bonds for more +information on related features in LAMMPS. + ---------- Restart, fix_modify, output, run start/stop, minimize info diff --git a/doc/src/fix_nve.rst b/doc/src/fix_nve.rst index da2184c99f..c50bc4d62f 100644 --- a/doc/src/fix_nve.rst +++ b/doc/src/fix_nve.rst @@ -35,6 +35,10 @@ consistent with the microcanonical ensemble (NVE) provided there are (full) periodic boundary conditions and no other "manipulations" of the system (e.g. fixes that modify forces or velocities). +This fix invokes the velocity form of the +Stoermer-Verlet time integration algorithm (velocity-Verlet). Other +time integration options can be invoked using the :doc:`run_style ` command. + ---------- .. include:: accel_styles.rst @@ -57,7 +61,7 @@ Restrictions Related commands """""""""""""""" -:doc:`fix nvt `, :doc:`fix npt ` +:doc:`fix nvt `, :doc:`fix npt `, :doc:`run_style ` Default """"""" diff --git a/doc/src/fix_nve_bpm_sphere.rst b/doc/src/fix_nve_bpm_sphere.rst new file mode 100644 index 0000000000..861586ab2a --- /dev/null +++ b/doc/src/fix_nve_bpm_sphere.rst @@ -0,0 +1,87 @@ +.. index:: fix nve/bpm/sphere + +fix nve/bpm/sphere command +========================== + +Syntax +"""""" + +.. parsed-literal:: + + fix ID group-ID nve/bpm/sphere + +* ID, group-ID are documented in :doc:`fix ` command +* nve/bpm/sphere = style name of this fix command +* zero or more keyword/value pairs may be appended +* keyword = *disc* + + .. parsed-literal:: + + *disc* value = none = treat particles as 2d discs, not spheres + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all nve/bpm/sphere + fix 1 all nve/bpm/sphere disc + +Description +""""""""""" + +Perform constant NVE integration to update position, velocity, angular +velocity, and quaternion orientation for finite-size spherical +particles in the group each timestep. V is volume; E is energy. This +creates a system trajectory consistent with the microcanonical +ensemble. + +This fix differs from the :doc:`fix nve ` command, which +assumes point particles and only updates their position and velocity. +It also differs from the :doc:`fix nve/sphere ` +command which assumes finite-size spheroid particles which do not +store a quaternion. It thus does not update a particle's orientation +or quaternion. + +If the *disc* keyword is used, then each particle is treated as a 2d +disc (circle) instead of as a sphere. This is only possible for 2d +simulations, as defined by the :doc:`dimension ` keyword. +The only difference between discs and spheres in this context is their +moment of inertia, as used in the time integration. + +---------- + +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. No global or per-atom quantities are stored by +this fix for access by various :doc:`output commands `. +No parameter of this fix can be used with the *start/stop* keywords of +the :doc:`run ` command. This fix is not invoked during +:doc:`energy minimization `. + +Restrictions +"""""""""""" + +This fix requires that atoms store torque, angular velocity (omega), a +radius, and a quaternion as defined by the :doc:`atom_style bpm/sphere +` command. + +All particles in the group must be finite-size spheres with +quaternions. They cannot be point particles. + +Use of the *disc* keyword is only allowed for 2d simulations, as +defined by the :doc:`dimension ` keyword. + +Related commands +"""""""""""""""" + +:doc:`fix nve `, :doc:`fix nve/sphere ` + +Default +""""""" + +none + diff --git a/doc/src/fix_pair_tracker.rst b/doc/src/fix_pair_tracker.rst deleted file mode 100644 index 5c2ecf5774..0000000000 --- a/doc/src/fix_pair_tracker.rst +++ /dev/null @@ -1,124 +0,0 @@ -.. index:: fix pair/tracker - -fix pair/tracker command -======================== - -Syntax -"""""" - -.. parsed-literal:: - - fix ID group-ID pair/tracker N attribute1 attribute2 ... keyword values ... - -* ID, group-ID are documented in :doc:`fix ` command -* pair/tracker = style name of this fix command -* N = prepare data for output every this many timesteps -* one or more attributes may be appended - - .. parsed-literal:: - - possible attributes = id1 id2 time/created time/broken time/total - rmin rave x y z - - .. parsed-literal:: - - id1, id2 = IDs of the 2 atoms in each pair interaction - time/created = the time that the 2 atoms began interacting - time/broken = the time that the 2 atoms stopped interacting - time/total = the total time the 2 atoms interacted - r/min = the minimum radial distance between the 2 atoms during the interaction - r/ave = the average radial distance between the 2 atoms during the interaction - x, y, z = the center of mass position of the 2 atoms when they stopped interacting - -* zero or more keyword/value pairs may be appended -* keyword = *time/min* or *type/include* - - .. parsed-literal:: - - *time/min* value = T - T = minimum interaction time - *type/include* value = arg1 arg2 - arg = separate lists of types (see below) - -Examples -"""""""" - -.. code-block:: LAMMPS - - fix 1 all pair/tracker 1000 id1 id2 time/min 100 - fix 1 all pair/tracker 1000 time/created time/broken type/include 1 * type/include 2 3,4 - -Description -""""""""""" - -Tracks properties of pairwise interactions between two atoms and records data -whenever the atoms move beyond the interaction cutoff. -Must be used in conjunction with :doc:`pair tracker `. -Data is accumulated over a span of *N* timesteps before being deleted. -The number of datums generated, aggregated across all processors, equals -the number of broken interactions. Interactions are only included if both -atoms are included in the specified fix group. Additional filters can be -applied using the *time/min* or *type/include* keywords described below. - -.. note:: - - For extremely long-lived interactions, the calculation of *r/ave* may not be - correct due to double overflow. - -The *time/min* keyword sets a minimum amount of time that an interaction must -persist to be included. This setting can be used to censor short-lived interactions. -The *type/include* keyword filters interactions based on the types of the two atoms. -Data is only saved for interactions between atoms with types in the two lists. -Each list consists of a series of type -ranges separated by commas. The range can be specified as a -single numeric value, or a wildcard asterisk can be used to specify a range -of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For -example, if M = the number of atom types, then an asterisk with no numeric -values means all types from 1 to M. A leading asterisk means all types -from 1 to n (inclusive). A trailing asterisk means all types from n to M -(inclusive). A middle asterisk means all types from m to n (inclusive). -Multiple *type/include* keywords may be added. - ----------- - -Restart, fix_modify, 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. -No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. - -Output info -""""""""""" - -This compute calculates a local vector or local array depending on the -number of input values. The length of the vector or number of rows in -the array is the number of recorded, lost interactions. If a single input is -specified, a local vector is produced. If two or more inputs are -specified, a local array is produced where the number of columns = the -number of inputs. The vector or array can be accessed by any command -that uses local values from a compute as input. See the :doc:`Howto output ` page for an overview of LAMMPS output -options. - -The vector or array values will be doubles that correspond to the -specified attribute. - -Restrictions -"""""""""""" - -Must be used in conjunction with :doc:`pair style tracker `. - -This fix is part of the MISC package. It is only enabled if LAMMPS -was built with that package. See the :doc:`Build package ` page for more info. - -Related commands -"""""""""""""""" - -:doc:`pair tracker ` - -Default -""""""" - -none diff --git a/doc/src/fix_polarize.rst b/doc/src/fix_polarize.rst index b95692b92b..6ed3b36c55 100644 --- a/doc/src/fix_polarize.rst +++ b/doc/src/fix_polarize.rst @@ -80,7 +80,7 @@ It is assumed that the particles cannot pass through the interface during the si so that its local dielectric constant value does not change. There are some example scripts for using these fixes -with LAMMPS in the ``examples/PACKAGES/dielectric directory``. The README file +with LAMMPS in the ``examples/PACKAGES/dielectric`` directory. The README file therein contains specific details on the system setup. Note that the example data files show the additional fields (columns) needed for :doc:`atom_style dielectric ` beyond the conventional fields *id*, *mol*, *type*, *q*, *x*, *y*, and *z*. @@ -91,7 +91,7 @@ For fix *polarize/bem/gmres* and fix *polarize/bem/icc* the induced charges of the atoms in the specified group, which are the vertices on the interface, are computed using the equation: -..math:: +.. math:: \sigma_b(\mathbf{s}) = \dfrac{1 - \bar{\epsilon}}{\bar{\epsilon}} \sigma_f(\mathbf{s}) - \epsilon_0 \dfrac{\Delta \epsilon}{\bar{\epsilon}} @@ -154,6 +154,9 @@ if LAMMPS was built with that package, which requires that also the KSPACE package is installed. See the :doc:`Build package ` page for more info. +Note that the *polarize/bem/gmres* and *polarize/bem/icc* fixes only support +:doc:`units ` *lj*, *real*, *metal*, *si* and *nano* at the moment. + Related commands """""""""""""""" diff --git a/doc/src/fix_property_atom.rst b/doc/src/fix_property_atom.rst index cc92c18655..09286cca38 100644 --- a/doc/src/fix_property_atom.rst +++ b/doc/src/fix_property_atom.rst @@ -304,13 +304,15 @@ uninterrupted fashion. .. warning:: When reading data from a restart file, this fix command has to be - specified **exactly** the same was in the input script that created - the restart file. 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 names and associated date types in the new - fix property/atom command do not match the old one exactly, data - can be corrupted or LAMMPS may crash. + specified **after** the *read_restart* command and **exactly** the + same was in the input script that created the restart file. 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 names and + associated date types in the new fix property/atom command do not + match the old one exactly, data can be corrupted or LAMMPS may crash. + If the fix is specified **before** the *read_restart* command its + data will not be restored. 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_ttm.rst b/doc/src/fix_ttm.rst index 80a18d3dbe..d146321395 100644 --- a/doc/src/fix_ttm.rst +++ b/doc/src/fix_ttm.rst @@ -214,10 +214,10 @@ generate an error. LAMMPS will check if a "UNITS:" tag is in the first line and stop with an error, if there is a mismatch with the current units used. -..note:: +.. note:: The electronic temperature at each grid point must be a non-zero - positive value, both initially, and as the temperature evovles over + positive value, both initially, and as the temperature evolves over time. Thus you must use either the *set* or *infile* keyword or be restarting a simulation that used this fix previously. diff --git a/doc/src/group.rst b/doc/src/group.rst index 1720ecfe1a..9d93e949f9 100644 --- a/doc/src/group.rst +++ b/doc/src/group.rst @@ -258,11 +258,17 @@ assignment is made at the beginning of the minimization, but not during the iterations of the minimizer. The point in the timestep at which atoms are assigned to a dynamic -group is after the initial stage of velocity Verlet time integration -has been performed, and before neighbor lists or forces are computed. -This is the point in the timestep where atom positions have just -changed due to the time integration, so the region criterion should be -accurate, if applied. +group is after interatomic forces have been computed, but before any +fixes which alter forces or otherwise update the system have been +invoked. This means that atom positions have been updated, neighbor +lists and ghost atoms are current, and both intermolecular and +intramolecular forces have been calculated based on the new +coordinates. Thus the region criterion, if applied, should be +accurate. Also, any computes invoked by an atom-style variable should +use updated information for that timestep, e.g. potential energy/atom +or coordination number/atom. Similarly, fixes or computes which are +invoked after that point in the timestep, should operate on the new +group of atoms. .. note:: diff --git a/doc/src/pair_bpm_spring.rst b/doc/src/pair_bpm_spring.rst new file mode 100644 index 0000000000..8235b1c624 --- /dev/null +++ b/doc/src/pair_bpm_spring.rst @@ -0,0 +1,114 @@ +.. index:: pair_style bpm/spring + +pair_style bpm/spring command +============================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + pair_style bpm/spring + +Examples +"""""""" + +.. code-block:: LAMMPS + + pair_style bpm/spring + pair_coeff * * 1.0 1.0 1.0 + pair_coeff 1 1 1.0 1.0 1.0 + +Description +""""""""""" + +Style *bpm/spring* computes pairwise forces with the formula + +.. math:: + + F = k (r - r_c) + +where :math:`k` is a stiffness and :math:`r_c` is the cutoff length. +An additional damping force is also applied to interacting +particles. The force is proportional to the difference in the +normal velocity of particles + +.. math:: + + F_D = - \gamma w (\hat{r} \bullet \vec{v}) + +where :math:`\gamma` is the damping strength, :math:`\hat{r}` is the +radial normal vector, :math:`\vec{v}` is the velocity difference +between the two particles, and :math:`w` is a smoothing factor. +This smoothing factor is constructed such that damping forces go to zero +as particles come out of contact to avoid discontinuities. It is +given by + +.. math:: + + w = 1.0 - \left( \frac{r}{r_c} \right)^8 . + +This pair style is designed for use in a spring-based bonded particle +model. It mirrors the construction of the :doc:`bpm/spring +` bond style. + +This pair interaction is always applied to pairs of non-bonded particles +that are within the interaction distance. For pairs of bonded particles +that are within the interaction distance, there is the option to either +include this pair interaction and overlay the pair force over the bond +force or to exclude this pair interaction such that the two particles +only interact via the bond force. See discussion of the *overlay/pair* +option for BPM bond styles and the :doc:`special_bonds ` +command in the `:doc: how to ` page on BPMs for more details. + +The following coefficients must be defined for each pair of atom types +via the :doc:`pair_coeff ` command as in the examples +above, or in the data file or restart files read by the +:doc:`read_data ` or :doc:`read_restart ` +commands, or by mixing as described below: + +* :math:`k` (force/distance units) +* :math:`r_c` (distance units) +* :math:`\gamma` (force/velocity units) + + +---------- + +Mixing, shift, table, tail correction, restart, rRESPA info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +For atom type pairs I,J and I != J, the A coefficient and cutoff +distance for this pair style can be mixed. A is always mixed via a +*geometric* rule. The cutoff is mixed according to the pair_modify +mix value. The default mix value is *geometric*\ . See the +"pair_modify" command for details. + +This pair style does not support the :doc:`pair_modify ` +shift option, since the pair interaction goes to 0.0 at the cutoff. + +The :doc:`pair_modify ` table and tail options are not +relevant for this pair style. + +This pair style writes its information to :doc:`binary restart files +`, so pair_style and pair_coeff commands do not need to be +specified in an input script that reads a restart file. + +This pair style can only be used via the *pair* keyword of the +:doc:`run_style respa ` command. It does not support the +*inner*, *middle*, *outer* keywords. + +---------- + +Restrictions +"""""""""""" + none + +Related commands +"""""""""""""""" + +:doc:`pair_coeff `, :doc:`bond bpm/spring ` + +Default +""""""" + +none diff --git a/doc/src/pair_dielectric.rst b/doc/src/pair_dielectric.rst index c1f28c2089..dbdd163a76 100644 --- a/doc/src/pair_dielectric.rst +++ b/doc/src/pair_dielectric.rst @@ -3,6 +3,7 @@ .. index:: pair_style lj/cut/coul/cut/dielectric .. index:: pair_style lj/cut/coul/cut/dielectric/omp .. index:: pair_style lj/cut/coul/debye/dielectric +.. index:: pair_style lj/cut/coul/debye/dielectric/omp .. index:: pair_style lj/cut/coul/long/dielectric .. index:: pair_style lj/cut/coul/long/dielectric/omp .. index:: pair_style lj/cut/coul/msm/dielectric @@ -22,6 +23,8 @@ Accelerator Variants: *lj/cut/coul/cut/dielectric/omp* pair_style lj/cut/coul/debye/dielectric command =============================================== +Accelerator Variants: *lj/cut/coul/debye/dielectric/omp* + pair_style lj/cut/coul/long/dielectric command ============================================== diff --git a/doc/src/pair_ilp_graphene_hbn.rst b/doc/src/pair_ilp_graphene_hbn.rst index 04b8a4ddde..de088f2926 100644 --- a/doc/src/pair_ilp_graphene_hbn.rst +++ b/doc/src/pair_ilp_graphene_hbn.rst @@ -1,8 +1,11 @@ .. index:: pair_style ilp/graphene/hbn +.. index:: pair_style ilp/graphene/hbn/opt pair_style ilp/graphene/hbn command =================================== +Accelerator Variant: *ilp/graphene/hbn/opt* + Syntax """""" @@ -125,6 +128,10 @@ headings) the following commands could be included in an input script: ---------- +.. include:: accel_styles.rst + +---------- + Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" diff --git a/doc/src/pair_lj_long.rst b/doc/src/pair_lj_long.rst index f7bdf49189..02ce9b0de5 100644 --- a/doc/src/pair_lj_long.rst +++ b/doc/src/pair_lj_long.rst @@ -238,7 +238,7 @@ none .. _Veld2: -**(In 't Veld)** In 't Veld, Ismail, Grest, J Chem Phys (accepted) (2007). +**(In 't Veld)** In 't Veld, Ismail, Grest, J Chem Phys, 127, 144711 (2007). .. _Jorgensen4: diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index f90a718d95..b42e3c9a50 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -131,6 +131,7 @@ accelerated styles exist. * :doc:`born/coul/msm ` - Born with long-range MSM Coulomb * :doc:`born/coul/wolf ` - Born with Wolf potential for Coulomb * :doc:`born/coul/wolf/cs ` - Born with Wolf potential for Coulomb and core/shell model +* :doc:`bpm/spring ` - repulsive harmonic force with damping * :doc:`brownian ` - Brownian potential for Fast Lubrication Dynamics * :doc:`brownian/poly ` - Brownian potential for Fast Lubrication Dynamics with polydispersity * :doc:`buck ` - Buckingham potential diff --git a/doc/src/pair_tracker.rst b/doc/src/pair_tracker.rst index d2cee1d879..04967e952d 100644 --- a/doc/src/pair_tracker.rst +++ b/doc/src/pair_tracker.rst @@ -8,89 +8,182 @@ Syntax .. code-block:: LAMMPS - pair_style tracker keyword + pair_style tracker fix_ID N keyword values attribute1 attribute2 ... -* zero or more keyword/arg pairs may be appended -* keyword = *finite* +* fix_ID = ID of associated internal fix to store data +* N = prepare data for output every this many timesteps +* zero or more keywords may be appended +* keyword = *finite* or *time/min* or *type/include* .. parsed-literal:: *finite* value = none pair style uses atomic diameters to identify contacts + *time/min* value = T + T = minimum number of timesteps of interaction + *type/include* value = list1 list2 + list1,list2 = separate lists of types (see below) + +* one or more attributes may be appended + + .. parsed-literal:: + + possible attributes = id1 id2 time/created time/broken time/total + r/min r/ave x y z + + .. parsed-literal:: + + id1, id2 = IDs of the 2 atoms in each pair interaction + time/created = the timestep that the 2 atoms began interacting + time/broken = the timestep that the 2 atoms stopped interacting + time/total = the total number of timesteps the 2 atoms interacted + r/min = the minimum radial distance between the 2 atoms during the interaction (distance units) + r/ave = the average radial distance between the 2 atoms during the interaction (distance units) + x, y, z = the center of mass position of the 2 atoms when they stopped interacting (distance units) Examples """""""" .. code-block:: LAMMPS - pair_style hybrid/overlay tracker ... + pair_style hybrid/overlay tracker myfix 1000 id1 id2 type/include 1 * type/include 2 3,4 lj/cut 2.5 pair_coeff 1 1 tracker 2.0 - pair_style hybrid/overlay tracker finite ... + pair_style hybrid/overlay tracker myfix 1000 finite x y z time/min 100 granular pair_coeff * * tracker - fix 1 all pair/tracker 1000 time/created time/broken - dump 1 all local 1000 dump.local f_1[1] f_1[2] + dump 1 all local 1000 dump.local f_myfix[1] f_myfix[2] f_myfix[3] dump_modify 1 write_header no Description """"""""""" -Style *tracker* monitors information about pairwise interactions. -It does not calculate any forces on atoms. -:doc:`Pair hybrid/overlay ` can be used to combine this pair -style with another pair style. Style *tracker* must be used in conjunction -with about :doc:`fix pair_tracker ` which contains -information on what data can be output. +Style *tracker* monitors information about pairwise interactions. It +does not calculate any forces on atoms. :doc:`Pair hybrid/overlay +` can be used to combine this pair style with any other +pair style, as shown in the examples above. -If the *finite* keyword is not defined, the following coefficients must be -defined for each pair of atom types via the :doc:`pair_coeff ` -command as in the examples above, or in the data file or restart files -read by the :doc:`read_data ` or :doc:`read_restart ` -commands, or by mixing as described below: +At each timestep, if two neighboring atoms move beyond the interaction +cutoff, pairwise data is processed and transferred to an internal fix +labeled *fix_ID*. This allows the local data to be accessed by other +LAMMPS commands. Additional +filters can be applied using the *time/min* or *type/include* keywords +described below. Note that this is the interaction cutoff defined by +this pair style, not the short-range cutoff defined by the pair style +that is calculating forces on atoms. + +Following any optional keyword/value arguments, a list of one or more +attributes is specified. These include the IDs of the two atoms in +the pair. The other attributes for the pair of atoms are the +duration of time they were "interacting" or at the point in time they +started or stopped interacting. In this context, "interacting" means +the time window during which the two atoms were closer than the +interaction cutoff distance. The attributes for time/* refer to +timesteps. + +Data is continuously accumulated by the internal fix over intervals of *N* +timesteps. At the end of each interval, all of the saved accumulated +data is deleted to make room for new data. Individual datum may +therefore persist anywhere between *1* to *N* timesteps depending on +when they are saved. This data can be accessed using the *fix_ID* and a +:doc:`dump local ` command. To ensure all data is output, +the dump frequency should correspond to the same interval of *N* +timesteps. A dump frequency of an integer multiple of *N* can be used +to regularly output a sample of the accumulated data. + +---------- + +The following optional keywords may be used. + +If the *finite* keyword is not used, the following coefficients must +be defined for each pair of atom types via the :doc:`pair_coeff +` command as in the examples above, or in the data file or +restart files read by the :doc:`read_data ` or +:doc:`read_restart ` commands, or by mixing as described +below: * cutoff (distance units) -If the *finite* keyword is defined, no coefficients may be defined. -Interaction cutoffs are alternatively calculated based on the -diameter of finite particles. +If the *finite* keyword is used, there are no additional coefficients +to set for each pair of atom types via the +:doc:`pair_coeff ` command. Interaction cutoffs are +instead calculated based on the diameter of finite particles. However +you must still use the :doc:`pair_coeff ` for all atom +types. For example the command +.. code-block:: LAMMPS + + pair_coeff * * + +should be used. + +The *time/min* keyword sets a minimum amount of time that an +interaction must persist to be included. This setting can be used to +censor short-lived interactions. + +The *type/include* keyword filters interactions based on the types of +the two atoms. Data is only saved for interactions between atoms +whose two atom types appear in *list1* and *list2*. Atom type 1 must +be in list1 and atom type 2 in list2. Or vice versa. + +Each type list consists of a series of type ranges separated by +commas. Each range can be specified as a single numeric value, or a +wildcard asterisk can be used to specify a range of values. This +takes the form "\*" or "\*n" or "n\*" or "m\*n". For example, if M = +the number of atom types, then an asterisk with no numeric values +means all types from 1 to M. A leading asterisk means all types from +1 to n (inclusive). A trailing asterisk means all types from n to M +(inclusive). A middle asterisk means all types from m to n +(inclusive). Note that the *type/include* keyword can be specified +multiple times. Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" For atom type pairs I,J and I != J, the cutoff coefficient and cutoff -distance for this pair style can be mixed. The cutoff is always mixed via a -*geometric* rule. The cutoff is mixed according to the pair_modify -mix value. The default mix value is *geometric*\ . See the -"pair_modify" command for details. +distance for this pair style can be mixed. The cutoff is always mixed +via a *geometric* rule. The cutoff is mixed according to the +pair_modify mix value. The default mix value is *geometric*\ . See +the "pair_modify" command for details. -This pair style writes its information to :doc:`binary restart files `, so -pair_style and pair_coeff commands do not need -to be specified in an input script that reads a restart file. +This pair style writes its information to :doc:`binary restart files +`, so pair_style and pair_coeff commands do not need to be +specified in an input script that reads a restart file. The :doc:`pair_modify ` shift, table, and tail options are not relevant for this pair style. +The accumulated data is not written to restart files and should be +output before a restart file is written to avoid missing data. + +The internal fix calculates a local vector or local array depending on the +number of input values. The length of the vector or number of rows in +the array is the number of recorded, lost interactions. If a single +input is specified, a local vector is produced. If two or more inputs +are specified, a local array is produced where the number of columns = +the number of inputs. The vector or array can be accessed by any +command that uses local values from a compute as input. See the +:doc:`Howto output ` page for an overview of LAMMPS +output options. + +The vector or array will be floating point values that correspond to +the specified attribute. + ---------- Restrictions """""""""""" -A corresponding :doc:`fix pair_tracker ` must be defined -to use this pair style. - -This pair style is currently incompatible with granular pair styles that extend -beyond the contact (e.g. JKR and DMT). - This fix is part of the MISC package. It is only enabled if LAMMPS -was built with that package. See the :doc:`Build package ` page for more info. +was built with that package. See the :doc:`Build package +` page for more info. + +This pair style is currently incompatible with granular pair styles +that extend beyond the contact (e.g. JKR and DMT). Related commands """""""""""""""" -:doc:`fix pair_tracker ` - Default """"""" diff --git a/doc/src/read_data.rst b/doc/src/read_data.rst index 24f882b658..68e1efc496 100644 --- a/doc/src/read_data.rst +++ b/doc/src/read_data.rst @@ -650,6 +650,8 @@ of analysis. - atom-ID atom-type rho esph cv x y z * - sphere - atom-ID atom-type diameter density x y z + * - bpm/sphere + - atom-ID molecule-ID atom-type diameter density x y z * - spin - atom-ID atom-type x y z spx spy spz sp * - tdpd diff --git a/doc/src/run_style.rst b/doc/src/run_style.rst index fd63c82b90..e8ba264495 100644 --- a/doc/src/run_style.rst +++ b/doc/src/run_style.rst @@ -67,7 +67,8 @@ Description Choose the style of time integrator used for molecular dynamics simulations performed by LAMMPS. -The *verlet* style is a standard velocity-Verlet integrator. +The *verlet* style is the velocity form of the +Stoermer-Verlet time integration algorithm (velocity-Verlet) ---------- diff --git a/doc/src/set.rst b/doc/src/set.rst index 1ca8168317..cc1d2766e3 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -22,7 +22,7 @@ Syntax *volume* or *image* or *bond* or *angle* or *dihedral* or *improper* or *sph/e* or *sph/cv* or *sph/rho* or *smd/contact/radius* or *smd/mass/density* or *dpd/theta* or - *edpd/temp* or *edpd/cv* or *cc* or + *edpd/temp* or *edpd/cv* or *cc* or *epsilon* or *i_name* or *d_name* or *i2_name* or *d2_name* .. parsed-literal:: @@ -124,6 +124,7 @@ Syntax *cc* values = index cc index = index of a chemical species (1 to Nspecies) cc = chemical concentration of tDPD particles for a species (mole/volume units) + *epsilon* value = dielectric constant of the medium where the atoms reside *i_name* value = custom integer vector with name *d_name* value = custom floating-point vector with name *i2_name* value = column of a custom integer array with name @@ -372,13 +373,13 @@ vector of the particles is set to the 3 specified components. Keyword *omega* sets the angular velocity of selected atoms. The particles must be spheres as defined by the :doc:`atom_style sphere -` command. The angular velocity vector of the particles -is set to the 3 specified components. +` command. The angular velocity vector of the particles is +set to the 3 specified components. Keyword *mass* sets the mass of all selected particles. The particles -must have a per-atom mass attribute, as defined by the -:doc:`atom_style ` command. See the "mass" command for -how to set mass values on a per-type basis. +must have a per-atom mass attribute, as defined by the :doc:`atom_style +` command. See the "mass" command for how to set mass +values on a per-type basis. Keyword *density* or *density/disc* also sets the mass of all selected particles, but in a different way. The particles must have a per-atom @@ -387,22 +388,21 @@ command. If the atom has a radius attribute (see :doc:`atom_style sphere `) and its radius is non-zero, its mass is set from the density and particle volume for 3d systems (the input density is assumed to be in mass/distance\^3 units). For 2d, the default is for -LAMMPS to model particles with a radius attribute as spheres. -However, if the *density/disc* keyword is used, then they can be -modeled as 2d discs (circles). Their mass is set from the density and -particle area (the input density is assumed to be in mass/distance\^2 -units). +LAMMPS to model particles with a radius attribute as spheres. However, +if the *density/disc* keyword is used, then they can be modeled as 2d +discs (circles). Their mass is set from the density and particle area +(the input density is assumed to be in mass/distance\^2 units). If the atom has a shape attribute (see :doc:`atom_style ellipsoid -`) and its 3 shape parameters are non-zero, then its mass -is set from the density and particle volume (the input density is -assumed to be in mass/distance\^3 units). The *density/disc* keyword -has no effect; it does not (yet) treat 3d ellipsoids as 2d ellipses. +`) and its 3 shape parameters are non-zero, then its mass is +set from the density and particle volume (the input density is assumed +to be in mass/distance\^3 units). The *density/disc* keyword has no +effect; it does not (yet) treat 3d ellipsoids as 2d ellipses. If the atom has a length attribute (see :doc:`atom_style line -`) and its length is non-zero, then its mass is set from -the density and line segment length (the input density is assumed to -be in mass/distance units). If the atom has an area attribute (see +`) and its length is non-zero, then its mass is set from the +density and line segment length (the input density is assumed to be in +mass/distance units). If the atom has an area attribute (see :doc:`atom_style tri `) and its area is non-zero, then its mass is set from the density and triangle area (the input density is assumed to be in mass/distance\^2 units). @@ -410,84 +410,91 @@ assumed to be in mass/distance\^2 units). If none of these cases are valid, then the mass is set to the density value directly (the input density is assumed to be in mass units). -Keyword *volume* sets the volume of all selected particles. -Currently, only the :doc:`atom_style peri ` command defines -particles with a volume attribute. Note that this command does not -adjust the particle mass. +Keyword *volume* sets the volume of all selected particles. Currently, +only the :doc:`atom_style peri ` command defines particles +with a volume attribute. Note that this command does not adjust the +particle mass. Keyword *image* sets which image of the simulation box the atom is considered to be in. An image of 0 means it is inside the box as -defined. A value of 2 means add 2 box lengths to get the true value. -A value of -1 means subtract 1 box length to get the true value. -LAMMPS updates these flags as atoms cross periodic boundaries during -the simulation. The flags can be output with atom snapshots via the -:doc:`dump ` command. If a value of NULL is specified for any -of nx,ny,nz, then the current image value for that dimension is -unchanged. For non-periodic dimensions only a value of 0 can be -specified. This command can be useful after a system has been -equilibrated and atoms have diffused one or more box lengths in -various directions. This command can then reset the image values for -atoms so that they are effectively inside the simulation box, e.g if a -diffusion coefficient is about to be measured via the :doc:`compute -msd ` command. Care should be taken not to reset the -image flags of two atoms in a bond to the same value if the bond -straddles a periodic boundary (rather they should be different by +/- -1). This will not affect the dynamics of a simulation, but may mess -up analysis of the trajectories if a LAMMPS diagnostic or your own -analysis relies on the image flags to unwrap a molecule which -straddles the periodic box. +defined. A value of 2 means add 2 box lengths to get the true value. A +value of -1 means subtract 1 box length to get the true value. LAMMPS +updates these flags as atoms cross periodic boundaries during the +simulation. The flags can be output with atom snapshots via the +:doc:`dump ` command. If a value of NULL is specified for any of +nx,ny,nz, then the current image value for that dimension is unchanged. +For non-periodic dimensions only a value of 0 can be specified. This +command can be useful after a system has been equilibrated and atoms +have diffused one or more box lengths in various directions. This +command can then reset the image values for atoms so that they are +effectively inside the simulation box, e.g if a diffusion coefficient is +about to be measured via the :doc:`compute msd ` command. +Care should be taken not to reset the image flags of two atoms in a bond +to the same value if the bond straddles a periodic boundary (rather they +should be different by +/- 1). This will not affect the dynamics of a +simulation, but may mess up analysis of the trajectories if a LAMMPS +diagnostic or your own analysis relies on the image flags to unwrap a +molecule which straddles the periodic box. -Keywords *bond*, *angle*, *dihedral*, and *improper*, set the bond -type (angle type, etc) of all bonds (angles, etc) of selected atoms to -the specified value from 1 to nbondtypes (nangletypes, etc). All -atoms in a particular bond (angle, etc) must be selected atoms in -order for the change to be made. The value of nbondtype (nangletypes, -etc) was set by the *bond types* (\ *angle types*, etc) field in the -header of the data file read by the :doc:`read_data ` -command. These keywords do not allow use of an atom-style variable. +Keywords *bond*, *angle*, *dihedral*, and *improper*, set the bond type +(angle type, etc) of all bonds (angles, etc) of selected atoms to the +specified value from 1 to nbondtypes (nangletypes, etc). All atoms in a +particular bond (angle, etc) must be selected atoms in order for the +change to be made. The value of nbondtype (nangletypes, etc) was set by +the *bond types* (\ *angle types*, etc) field in the header of the data +file read by the :doc:`read_data ` command. These keywords +do not allow use of an atom-style variable. -Keywords *sph/e*, *sph/cv*, and *sph/rho* set the energy, heat -capacity, and density of smoothed particle hydrodynamics (SPH) -particles. See `this PDF guide `_ -to using SPH in LAMMPS. +Keywords *sph/e*, *sph/cv*, and *sph/rho* set the energy, heat capacity, +and density of smoothed particle hydrodynamics (SPH) particles. See +`this PDF guide `_ to using SPH in LAMMPS. -Keyword *smd/mass/density* sets the mass of all selected particles, -but it is only applicable to the Smooth Mach Dynamics package -MACHDYN. It assumes that the particle volume has already been -correctly set and calculates particle mass from the provided mass -density value. +Keyword *smd/mass/density* sets the mass of all selected particles, but +it is only applicable to the Smooth Mach Dynamics package MACHDYN. It +assumes that the particle volume has already been correctly set and +calculates particle mass from the provided mass density value. -Keyword *smd/contact/radius* only applies to simulations with the -Smooth Mach Dynamics package MACHDYN. Itsets an interaction radius -for computing short-range interactions, e.g. repulsive forces to -prevent different individual physical bodies from penetrating each -other. Note that the SPH smoothing kernel diameter used for computing -long range, nonlocal interactions, is set using the *diameter* -keyword. +Keyword *smd/contact/radius* only applies to simulations with the Smooth +Mach Dynamics package MACHDYN. Itsets an interaction radius for +computing short-range interactions, e.g. repulsive forces to prevent +different individual physical bodies from penetrating each other. Note +that the SPH smoothing kernel diameter used for computing long range, +nonlocal interactions, is set using the *diameter* keyword. Keyword *dpd/theta* sets the internal temperature of a DPD particle as -defined by the DPD-REACT package. If the specified value is a number -it must be >= 0.0. If the specified value is NULL, then the kinetic -temperature Tkin of each particle is computed as 3/2 k Tkin = KE = 1/2 -m v\^2 = 1/2 m (vx\*vx+vy\*vy+vz\*vz). Each particle's internal +defined by the DPD-REACT package. If the specified value is a number it +must be >= 0.0. If the specified value is NULL, then the kinetic +temperature Tkin of each particle is computed as 3/2 k Tkin = KE = 1/2 m +v\^2 = 1/2 m (vx\*vx+vy\*vy+vz\*vz). Each particle's internal temperature is set to Tkin. If the specified value is an atom-style -variable, then the variable is evaluated for each particle. If a -value >= 0.0, the internal temperature is set to that value. If it is -< 0.0, the computation of Tkin is performed and the internal -temperature is set to that value. +variable, then the variable is evaluated for each particle. If a value +>= 0.0, the internal temperature is set to that value. If it is < 0.0, +the computation of Tkin is performed and the internal temperature is set +to that value. Keywords *edpd/temp* and *edpd/cv* set the temperature and volumetric heat capacity of an eDPD particle as defined by the DPD-MESO package. Currently, only :doc:`atom_style edpd ` defines particles -with these attributes. The values for the temperature and heat -capacity must be positive. +with these attributes. The values for the temperature and heat capacity +must be positive. Keyword *cc* sets the chemical concentration of a tDPD particle for a specified species as defined by the DPD-MESO package. Currently, only :doc:`atom_style tdpd ` defines particles with this attribute. An integer for "index" selects a chemical species (1 to -Nspecies) where Nspecies is set by the atom_style command. The value -for the chemical concentration must be >= 0.0. +Nspecies) where Nspecies is set by the atom_style command. The value for +the chemical concentration must be >= 0.0. + +Keyword *epsilon* sets the dielectric constant of a particle, precisely +of the medium where the particle resides as defined by the DIELECTRIC +package. Currently, only :doc:`atom_style dielectric ` +defines particles with this attribute. The value for the dielectric +constant must be >= 0.0. Note that the set command with this keyword +will rescale the particle charge accordingly so that the real charge +(e.g., as read from a data file) stays intact. To change the real +charges, one needs to use the set command with the *charge* +keyword. Care must be taken to ensure that the real and scaled charges, +and dielectric constants are consistent. Keywords *i_name*, *d_name*, *i2_name*, *d2_name* refer to custom per-atom integer and floating-point vectors or arrays that have been diff --git a/doc/src/thermo_modify.rst b/doc/src/thermo_modify.rst index ffdbf020a1..225dafdc33 100644 --- a/doc/src/thermo_modify.rst +++ b/doc/src/thermo_modify.rst @@ -252,6 +252,6 @@ flush = no, and temp/press = compute IDs defined by thermo_style. The defaults for the line and format options depend on the thermo style. For styles "one" and "custom", the line and format defaults are "one", -"%10d", and "%12.8g". For style "multi", the line and format defaults +"%10d", and "%14.8g". For style "multi", the line and format defaults are "multi", "%14d", and "%14.4f". For style "yaml", the line and format defaults are "%d" and "%.15g". diff --git a/doc/src/thermo_style.rst b/doc/src/thermo_style.rst index ff0e41ffb0..5d63ed81b6 100644 --- a/doc/src/thermo_style.rst +++ b/doc/src/thermo_style.rst @@ -10,7 +10,7 @@ Syntax thermo_style style args -* style = *one* or *multi* *yaml* or *custom* +* style = *one* or *multi* or *yaml* or *custom* * args = list of arguments for a particular style .. parsed-literal:: diff --git a/doc/utils/requirements.txt b/doc/utils/requirements.txt index 1f5711dd6b..9ff18b3652 100644 --- a/doc/utils/requirements.txt +++ b/doc/utils/requirements.txt @@ -6,3 +6,4 @@ breathe Pygments six pyyaml +wheel diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 3bad9c707e..49a313d491 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -316,6 +316,7 @@ borophene Botero Botu Bouguet +Bourasseau Bourne boxcolor boxhi @@ -329,6 +330,8 @@ boxzlo bp bpclermont bpls +bpm +BPM br Branduardi Branicio @@ -341,6 +344,7 @@ Broglie brownian brownw Broyden +Brusselle Bryantsev Btarget btype @@ -676,6 +680,7 @@ Deresiewicz Derjagin Derjaguin Derlet +Desbiens Deserno Destree destructor @@ -789,6 +794,7 @@ Dullweber dumpfile Dunbrack Dunweg +Dupend Dupont dUs dV @@ -1155,8 +1161,10 @@ gdot GeC Geier gencode +Geocomputing georg Georg +Geotechnica germain Germann Germano @@ -1326,6 +1334,7 @@ Holm holonomic Homebrew hooke +hookean Hookean hostname hotpink @@ -1671,6 +1680,7 @@ Kusters Kutta Kuznetsov kx +Lachet Lackmann Ladd lagrangian @@ -2082,6 +2092,7 @@ monopole monovalent Montalenti Montero +Mora Morefoo Morfill Mori @@ -2211,6 +2222,7 @@ Nbin Nbins nbody Nbody +nbond nbonds nbondtype Nbondtype @@ -3185,12 +3197,14 @@ Steinhauser Stepaniants stepwise Stesmans +stiffnesses Stillinger stk stochastically stochasticity Stockmayer Stoddard +Stoermer stoichiometric stoichiometry Stokesian @@ -3602,6 +3616,7 @@ Voronoi VORONOI Vorselaars Voth +Voyiatzis vpz vratio Vries @@ -3668,6 +3683,7 @@ wn Wolde workflow workflows +Workum Worley Wriggers Wuppertal diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/born_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/born_matrix.out new file mode 100644 index 0000000000..e6854d7bfe --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/born_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 3.36316 1.87373 1.87607 -0.00346 -0.00172 -0.00104 + 1.87373 3.36170 1.87425 0.00443 0.00033 0.00014 + 1.87607 1.87425 3.36573 0.00143 0.00155 0.00127 +-0.00346 0.00443 0.00143 1.87425 0.00127 0.00033 +-0.00172 0.00033 0.00155 0.00127 1.87607 -0.00346 +-0.00104 0.00014 0.00127 0.00033 -0.00346 1.87373 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/compute_born.py b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/compute_born.py new file mode 100644 index 0000000000..0f3265faeb --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/compute_born.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys +import numpy as np + +def reduce_Born(Cf): + C = np.zeros((6,6), dtype=np.float64) + C[0,0] = Cf[0] + C[1,1] = Cf[1] + C[2,2] = Cf[2] + C[3,3] = Cf[3] + C[4,4] = Cf[4] + C[5,5] = Cf[5] + C[0,1] = Cf[6] + C[0,2] = Cf[7] + C[0,3] = Cf[8] + C[0,4] = Cf[9] + C[0,5] = Cf[10] + C[1,2] = Cf[11] + C[1,3] = Cf[12] + C[1,4] = Cf[13] + C[1,5] = Cf[14] + C[2,3] = Cf[15] + C[2,4] = Cf[16] + C[2,5] = Cf[17] + C[3,4] = Cf[18] + C[3,5] = Cf[19] + C[4,5] = Cf[20] + C = np.where(C,C,C.T) + return C + +def compute_delta(): + D = np.zeros((3,3,3,3)) + for a in range(3): + for b in range(3): + for m in range(3): + for n in range(3): + D[a,b,m,n] = (a==m)*(b==n) + (a==n)*(b==m) + d = np.zeros((6,6)) + d[0,0] = D[0,0,0,0] + d[1,1] = D[1,1,1,1] + d[2,2] = D[2,2,2,2] + d[3,3] = D[1,2,1,2] + d[4,4] = D[0,2,0,2] + d[5,5] = D[0,1,0,1] + d[0,1] = D[0,0,1,1] + d[0,2] = D[0,0,2,2] + d[0,3] = D[0,0,1,2] + d[0,4] = D[0,0,0,2] + d[0,5] = D[0,0,0,1] + d[1,2] = D[1,1,2,2] + d[1,3] = D[1,1,1,2] + d[1,4] = D[1,1,0,2] + d[1,5] = D[1,1,0,1] + d[2,3] = D[2,2,1,2] + d[2,4] = D[2,2,0,2] + d[2,5] = D[2,2,0,1] + d[3,4] = D[1,2,0,2] + d[3,5] = D[1,2,0,1] + d[4,5] = D[0,2,0,1] + d = np.where(d,d,d.T) + return d + + +def write_matrix(C, filename): + with open(filename, 'w') as f: + f.write("# Cij Matrix from post process computation\n") + for i in C: + f.write("{:8.5f} {:8.5f} {:8.5f} {:8.5f} {:8.5f} {:8.5f}\n".format( + i[0]*10**-9, i[1]*10**-9, i[2]*10**-9, i[3]*10**-9, i[4]*10**-9, i[5]*10**-9, + ) + ) + return + +def main(): + + N = 500 + vol = 27.047271**3 * 10**-30 # m^3 + T = 60 # K + kb = 1.380649 * 10**-23 # J/K + kbT = T*kb # J + kcalmol2J = 4183.9954/(6.022*10**23) + + born = np.loadtxt('born.out') + stre = np.loadtxt('vir.out') + stre[:, 1:] = -stre[:, 1:]*101325 # -> Pa + try: + mean_born = np.mean(born[:, 1:], axis=0) + except IndexError: + mean_born = born[1:] + + CB = kcalmol2J/vol*reduce_Born(mean_born) # -> J/m^3=Pa + Cs = vol/kbT*np.cov(stre[:,1:].T) + Ct = N*kbT/vol * compute_delta() + C = CB - Cs + Ct + write_matrix(CB, 'born_matrix.out') + write_matrix(Cs, 'stre_matrix.out') + write_matrix(Ct, 'temp_matrix.out') + write_matrix(C, 'full_matrix.out') + C11 = np.mean([C[0,0], C[1,1], C[2,2]]) * 10**-9 + C12 = np.mean([C[0,1], C[0,2], C[1,2]]) * 10**-9 + C44 = np.mean([C[3,3], C[4,4], C[5,5]]) * 10**-9 + eC11 = np.std([C[0,0], C[1,1], C[2,2]]) * 10**-9 + eC12 = np.std([C[0,1], C[0,2], C[1,2]]) * 10**-9 + eC44 = np.std([C[3,3], C[4,4], C[5,5]]) * 10**-9 + print(C*10**-9) + print("C11 = {:f} ± {:f}; C12 = {:f} ± {:f}; C44 = {:f} ± {:f}".format(C11, eC11, C12, eC12, C44, eC44)) + + return + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + raise SystemExit("User interruption.") + diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/full_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/full_matrix.out new file mode 100644 index 0000000000..7eb4f6f540 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/full_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 2.18161 1.13726 1.16596 -0.01607 -0.02637 0.00291 + 1.13726 2.20242 1.16714 0.00386 -0.05820 0.02644 + 1.16596 1.16714 2.24704 -0.00354 -0.00368 0.02714 +-0.01607 0.00386 -0.00354 1.43706 0.00210 0.01003 +-0.02637 -0.05820 -0.00368 0.00210 1.37530 0.01401 + 0.00291 0.02644 0.02714 0.01003 0.01401 1.42403 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/in.ljcov b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/in.ljcov new file mode 100644 index 0000000000..255dd65a14 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/in.ljcov @@ -0,0 +1,154 @@ +# Analytical calculation +# of Born matrix + +# Note that because of cubic symmetry and central forces, we have: +# C11, pure axial == positive mean value: 1,2,3 +# C44==C23, pure shear == positive mean value, exactly match in pairs: (4,12),(5,8),(6,7) +# C14==C56, shear/axial(normal) == zero mean, exactly match in pairs: (9,21),(14,20),(18,19) +# C15, shear/axial(in-plane) == zero mean: 10,11,13,15,16,17 + +# adjustable parameters + +units real +variable nsteps index 100000 # length of run +variable nthermo index 1000 # thermo output interval +variable nlat equal 5 # size of box +variable T equal 60. # Temperature in K +variable rho equal 5.405 # Lattice spacing in A + +atom_style atomic + +lattice fcc ${rho} +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +create_box 1 box +create_atoms 1 box + +mass * 39.948 + +velocity all create ${T} 87287 loop geom +velocity all zero linear + +pair_style lj/cut 12.0 +pair_coeff 1 1 0.238067 3.405 + +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no + +variable vol equal vol +thermo 100 +fix aL all ave/time 1 1 1 v_vol ave running +fix NPT all npt temp $T $T 100 aniso 1. 1. 1000 fixedpoint 0. 0. 0. + +run 20000 + +unfix NPT + +variable newL equal "f_aL^(1./3.)" +change_box all x final 0 ${newL} y final 0. ${newL} z final 0. ${newL} remap units box + +unfix aL + +reset_timestep 0 + +# Conversion variables +variable kb equal 1.38065e-23 # J/K +variable Myvol equal "vol*10^-30" # Volume in m^3 +variable kbt equal "v_kb*v_T" +variable Nat equal atoms +variable Rhokbt equal "v_kbt*v_Nat/v_Myvol" +variable at2Pa equal 101325 +variable kcalmol2J equal "4183.9954/(6.022e23)" +variable C1 equal "v_kcalmol2J/v_Myvol" # Convert Cb from energy to pressure units +variable C2 equal "v_Myvol/v_kbt" # Factor for Cfl terms +variable Pa2GPa equal 1e-9 + +# Born compute giving terms +compute born all born/matrix +# The six virial stress component to compute +compute VIR all pressure NULL virial +variable s1 equal "-c_VIR[1]*v_at2Pa" +variable s2 equal "-c_VIR[2]*v_at2Pa" +variable s3 equal "-c_VIR[3]*v_at2Pa" +variable s6 equal "-c_VIR[4]*v_at2Pa" +variable s5 equal "-c_VIR[5]*v_at2Pa" +variable s4 equal "-c_VIR[6]*v_at2Pa" +variable press equal press + + +# Average of Born term and vector to store stress +# for post processing +fix CB all ave/time 1 ${nthermo} ${nthermo} c_born[*] ave running file born.out overwrite +fix CPR all ave/time 1 1 1 c_VIR[*] file vir.out +fix APR all ave/time 1 1 1 v_press ave running +fix VEC all vector 1 v_s1 v_s2 v_s3 v_s4 v_s5 v_s6 + +thermo ${nthermo} +thermo_style custom step temp press f_APR c_born[1] f_CB[1] c_born[12] f_CB[12] c_born[4] f_CB[4] +thermo_modify line multi + +fix 1 all nvt temp $T $T 100 + +run ${nsteps} + +# Compute vector averages +# Note the indice switch. +# LAMMPS convention is NOT the Voigt notation. +variable aves1 equal "ave(f_VEC[1])" +variable aves2 equal "ave(f_VEC[2])" +variable aves3 equal "ave(f_VEC[3])" +variable aves4 equal "ave(f_VEC[6])" +variable aves5 equal "ave(f_VEC[5])" +variable aves6 equal "ave(f_VEC[4])" + +# Computing the covariance through the - +# is numerically instable. Here we go through the <(s-)^2> +# definition. + +# Computing difference relative to average values +variable ds1 vector "f_VEC[1]-v_aves1" +variable ds2 vector "f_VEC[2]-v_aves2" +variable ds3 vector "f_VEC[3]-v_aves3" +variable ds4 vector "f_VEC[4]-v_aves4" +variable ds5 vector "f_VEC[5]-v_aves5" +variable ds6 vector "f_VEC[6]-v_aves6" + +# Squaring and averaging +variable dds1 vector "v_ds1*v_ds1" +variable dds2 vector "v_ds2*v_ds2" +variable dds3 vector "v_ds3*v_ds3" +variable vars1 equal "ave(v_dds1)" +variable vars2 equal "ave(v_dds2)" +variable vars3 equal "ave(v_dds3)" +variable C11 equal "v_Pa2GPa*(v_C1*f_CB[1] - v_C2*v_vars1 + 2*v_Rhokbt)" +variable C22 equal "v_Pa2GPa*(v_C1*f_CB[2] - v_C2*v_vars2 + 2*v_Rhokbt)" +variable C33 equal "v_Pa2GPa*(v_C1*f_CB[3] - v_C2*v_vars3 + 2*v_Rhokbt)" + +variable dds12 vector "v_ds1*v_ds2" +variable dds13 vector "v_ds1*v_ds3" +variable dds23 vector "v_ds2*v_ds3" +variable vars12 equal "ave(v_dds12)" +variable vars13 equal "ave(v_dds13)" +variable vars23 equal "ave(v_dds23)" +variable C12 equal "v_Pa2GPa*(v_C1*f_CB[7] - v_C2*v_vars12)" +variable C13 equal "v_Pa2GPa*(v_C1*f_CB[8] - v_C2*v_vars13)" +variable C23 equal "v_Pa2GPa*(v_C1*f_CB[12] - v_C2*v_vars23)" + +variable dds4 vector "v_ds4*v_ds4" +variable dds5 vector "v_ds5*v_ds5" +variable dds6 vector "v_ds6*v_ds6" +variable vars4 equal "ave(v_dds4)" +variable vars5 equal "ave(v_dds5)" +variable vars6 equal "ave(v_dds6)" +variable C44 equal "v_Pa2GPa*(v_C1*f_CB[4] - v_C2*v_vars4 + v_Rhokbt)" +variable C55 equal "v_Pa2GPa*(v_C1*f_CB[5] - v_C2*v_vars5 + v_Rhokbt)" +variable C66 equal "v_Pa2GPa*(v_C1*f_CB[6] - v_C2*v_vars6 + v_Rhokbt)" + +variable aC11 equal "(v_C11 + v_C22 + v_C33)/3." +variable aC12 equal "(v_C12 + v_C13 + v_C23)/3." +variable aC44 equal "(v_C44 + v_C55 + v_C66)/3." + +print """ +C11 = ${aC11} +C12 = ${aC12} +C44 = ${aC44} +""" diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/stre_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/stre_matrix.out new file mode 100644 index 0000000000..94c620b646 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/stre_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 1.22342 0.73647 0.71011 0.01261 0.02465 -0.00395 + 0.73647 1.20115 0.70711 0.00057 0.05854 -0.02630 + 0.71011 0.70711 1.16055 0.00497 0.00524 -0.02587 + 0.01261 0.00057 0.00497 0.45813 -0.00083 -0.00969 + 0.02465 0.05854 0.00524 -0.00083 0.52170 -0.01747 +-0.00395 -0.02630 -0.02587 -0.00969 -0.01747 0.47064 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/temp_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/temp_matrix.out new file mode 100644 index 0000000000..62a734b707 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Analytical/temp_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 0.04187 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.04187 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.00000 0.04187 0.00000 0.00000 0.00000 + 0.00000 0.00000 0.00000 0.02093 0.00000 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.02093 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.00000 0.02093 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/born_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/born_matrix.out new file mode 100644 index 0000000000..01c74114f8 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/born_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 3.35855 1.86892 1.87139 0.00233 0.00218 -0.00179 + 1.86892 3.37104 1.87285 0.00112 0.00085 -0.00007 + 1.87139 1.87285 3.37707 -0.00058 0.00038 -0.00057 + 0.00233 0.00112 -0.00058 1.88326 -0.00039 0.00065 + 0.00218 0.00085 0.00038 -0.00039 1.88229 0.00242 +-0.00179 -0.00007 -0.00057 0.00065 0.00242 1.87968 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/compute_born.py b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/compute_born.py new file mode 100644 index 0000000000..0f3265faeb --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/compute_born.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import sys +import numpy as np + +def reduce_Born(Cf): + C = np.zeros((6,6), dtype=np.float64) + C[0,0] = Cf[0] + C[1,1] = Cf[1] + C[2,2] = Cf[2] + C[3,3] = Cf[3] + C[4,4] = Cf[4] + C[5,5] = Cf[5] + C[0,1] = Cf[6] + C[0,2] = Cf[7] + C[0,3] = Cf[8] + C[0,4] = Cf[9] + C[0,5] = Cf[10] + C[1,2] = Cf[11] + C[1,3] = Cf[12] + C[1,4] = Cf[13] + C[1,5] = Cf[14] + C[2,3] = Cf[15] + C[2,4] = Cf[16] + C[2,5] = Cf[17] + C[3,4] = Cf[18] + C[3,5] = Cf[19] + C[4,5] = Cf[20] + C = np.where(C,C,C.T) + return C + +def compute_delta(): + D = np.zeros((3,3,3,3)) + for a in range(3): + for b in range(3): + for m in range(3): + for n in range(3): + D[a,b,m,n] = (a==m)*(b==n) + (a==n)*(b==m) + d = np.zeros((6,6)) + d[0,0] = D[0,0,0,0] + d[1,1] = D[1,1,1,1] + d[2,2] = D[2,2,2,2] + d[3,3] = D[1,2,1,2] + d[4,4] = D[0,2,0,2] + d[5,5] = D[0,1,0,1] + d[0,1] = D[0,0,1,1] + d[0,2] = D[0,0,2,2] + d[0,3] = D[0,0,1,2] + d[0,4] = D[0,0,0,2] + d[0,5] = D[0,0,0,1] + d[1,2] = D[1,1,2,2] + d[1,3] = D[1,1,1,2] + d[1,4] = D[1,1,0,2] + d[1,5] = D[1,1,0,1] + d[2,3] = D[2,2,1,2] + d[2,4] = D[2,2,0,2] + d[2,5] = D[2,2,0,1] + d[3,4] = D[1,2,0,2] + d[3,5] = D[1,2,0,1] + d[4,5] = D[0,2,0,1] + d = np.where(d,d,d.T) + return d + + +def write_matrix(C, filename): + with open(filename, 'w') as f: + f.write("# Cij Matrix from post process computation\n") + for i in C: + f.write("{:8.5f} {:8.5f} {:8.5f} {:8.5f} {:8.5f} {:8.5f}\n".format( + i[0]*10**-9, i[1]*10**-9, i[2]*10**-9, i[3]*10**-9, i[4]*10**-9, i[5]*10**-9, + ) + ) + return + +def main(): + + N = 500 + vol = 27.047271**3 * 10**-30 # m^3 + T = 60 # K + kb = 1.380649 * 10**-23 # J/K + kbT = T*kb # J + kcalmol2J = 4183.9954/(6.022*10**23) + + born = np.loadtxt('born.out') + stre = np.loadtxt('vir.out') + stre[:, 1:] = -stre[:, 1:]*101325 # -> Pa + try: + mean_born = np.mean(born[:, 1:], axis=0) + except IndexError: + mean_born = born[1:] + + CB = kcalmol2J/vol*reduce_Born(mean_born) # -> J/m^3=Pa + Cs = vol/kbT*np.cov(stre[:,1:].T) + Ct = N*kbT/vol * compute_delta() + C = CB - Cs + Ct + write_matrix(CB, 'born_matrix.out') + write_matrix(Cs, 'stre_matrix.out') + write_matrix(Ct, 'temp_matrix.out') + write_matrix(C, 'full_matrix.out') + C11 = np.mean([C[0,0], C[1,1], C[2,2]]) * 10**-9 + C12 = np.mean([C[0,1], C[0,2], C[1,2]]) * 10**-9 + C44 = np.mean([C[3,3], C[4,4], C[5,5]]) * 10**-9 + eC11 = np.std([C[0,0], C[1,1], C[2,2]]) * 10**-9 + eC12 = np.std([C[0,1], C[0,2], C[1,2]]) * 10**-9 + eC44 = np.std([C[3,3], C[4,4], C[5,5]]) * 10**-9 + print(C*10**-9) + print("C11 = {:f} ± {:f}; C12 = {:f} ± {:f}; C44 = {:f} ± {:f}".format(C11, eC11, C12, eC12, C44, eC44)) + + return + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + raise SystemExit("User interruption.") + diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/full_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/full_matrix.out new file mode 100644 index 0000000000..93a2c45e42 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/full_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 2.29922 1.17439 1.20854 -0.01653 -0.01684 0.01188 + 1.17439 2.20673 1.21718 -0.00781 -0.00753 0.00867 + 1.20854 1.21718 2.30804 0.01535 -0.01596 0.00426 +-0.01653 -0.00781 0.01535 1.47647 -0.01355 -0.01601 +-0.01684 -0.00753 -0.01596 -0.01355 1.37905 0.01975 + 0.01188 0.00867 0.00426 -0.01601 0.01975 1.40170 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/in.ljcov b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/in.ljcov new file mode 100644 index 0000000000..6db9cfaa66 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/in.ljcov @@ -0,0 +1,154 @@ +# Numerical difference calculation +# of Born matrix + +# Note that because of cubic symmetry and central forces, we have: +# C11, pure axial == positive mean value: 1,2,3 +# C44==C23, pure shear == positive mean value, exactly match in pairs: (4,12),(5,8),(6,7) +# C14==C56, shear/axial(normal) == zero mean, exactly match in pairs: (9,21),(14,20),(18,19) +# C15, shear/axial(in-plane) == zero mean: 10,11,13,15,16,17 + +# adjustable parameters + +units real +variable nsteps index 100000 # length of run +variable nthermo index 1000 # thermo output interval +variable nlat equal 5 # size of box +variable T equal 60. # Temperature in K +variable rho equal 5.405 # Lattice spacing in A + +atom_style atomic + +lattice fcc ${rho} +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +create_box 1 box +create_atoms 1 box + +mass * 39.948 + +velocity all create ${T} 87287 loop geom +velocity all zero linear + +pair_style lj/cut 12.0 +pair_coeff 1 1 0.238067 3.405 + +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no + +variable vol equal vol +thermo 100 +fix aL all ave/time 1 1 1 v_vol ave running +fix NPT all npt temp $T $T 100 aniso 1. 1. 1000 fixedpoint 0. 0. 0. + +run 20000 + +unfix NPT + +variable newL equal "f_aL^(1./3.)" +change_box all x final 0 ${newL} y final 0. ${newL} z final 0. ${newL} remap units box + +unfix aL + +reset_timestep 0 + +# Conversion variables +variable kb equal 1.38065e-23 # J/K +variable Myvol equal "vol*10^-30" # Volume in m^3 +variable kbt equal "v_kb*v_T" +variable Nat equal atoms +variable Rhokbt equal "v_kbt*v_Nat/v_Myvol" +variable at2Pa equal 101325 +variable kcalmol2J equal "4183.9954/(6.022e23)" +variable C1 equal "v_kcalmol2J/v_Myvol" # Convert Cb from energy to pressure units +variable C2 equal "v_Myvol/v_kbt" # Factor for Cfl terms +variable Pa2GPa equal 1e-9 + +# Born compute giving terms +# The six virial stress component to compute +compute VIR all pressure NULL virial +compute born all born/matrix numdiff 1e-6 VIR +variable s1 equal "-c_VIR[1]*v_at2Pa" +variable s2 equal "-c_VIR[2]*v_at2Pa" +variable s3 equal "-c_VIR[3]*v_at2Pa" +variable s6 equal "-c_VIR[4]*v_at2Pa" +variable s5 equal "-c_VIR[5]*v_at2Pa" +variable s4 equal "-c_VIR[6]*v_at2Pa" +variable press equal press + + +# Average of Born term and vector to store stress +# for post processing +fix CB all ave/time 1 ${nthermo} ${nthermo} c_born[*] ave running file born.out overwrite +fix CPR all ave/time 1 1 1 c_VIR[*] file vir.out +fix APR all ave/time 1 1 1 v_press ave running +fix VEC all vector 1 v_s1 v_s2 v_s3 v_s4 v_s5 v_s6 + +thermo ${nthermo} +thermo_style custom step temp press f_APR c_born[1] f_CB[1] c_born[12] f_CB[12] c_born[4] f_CB[4] +thermo_modify line multi + +fix 1 all nvt temp $T $T 100 + +run ${nsteps} + +# Compute vector averages +# Note the indice switch. +# LAMMPS convention is NOT the Voigt notation. +variable aves1 equal "ave(f_VEC[1])" +variable aves2 equal "ave(f_VEC[2])" +variable aves3 equal "ave(f_VEC[3])" +variable aves4 equal "ave(f_VEC[6])" +variable aves5 equal "ave(f_VEC[5])" +variable aves6 equal "ave(f_VEC[4])" + +# Computing the covariance through the - +# is numerically instable. Here we go through the <(s-)^2> +# definition. + +# Computing difference relative to average values +variable ds1 vector "f_VEC[1]-v_aves1" +variable ds2 vector "f_VEC[2]-v_aves2" +variable ds3 vector "f_VEC[3]-v_aves3" +variable ds4 vector "f_VEC[4]-v_aves4" +variable ds5 vector "f_VEC[5]-v_aves5" +variable ds6 vector "f_VEC[6]-v_aves6" + +# Squaring and averaging +variable dds1 vector "v_ds1*v_ds1" +variable dds2 vector "v_ds2*v_ds2" +variable dds3 vector "v_ds3*v_ds3" +variable vars1 equal "ave(v_dds1)" +variable vars2 equal "ave(v_dds2)" +variable vars3 equal "ave(v_dds3)" +variable C11 equal "v_Pa2GPa*(v_C1*f_CB[1] - v_C2*v_vars1 + 2*v_Rhokbt)" +variable C22 equal "v_Pa2GPa*(v_C1*f_CB[2] - v_C2*v_vars2 + 2*v_Rhokbt)" +variable C33 equal "v_Pa2GPa*(v_C1*f_CB[3] - v_C2*v_vars3 + 2*v_Rhokbt)" + +variable dds12 vector "v_ds1*v_ds2" +variable dds13 vector "v_ds1*v_ds3" +variable dds23 vector "v_ds2*v_ds3" +variable vars12 equal "ave(v_dds12)" +variable vars13 equal "ave(v_dds13)" +variable vars23 equal "ave(v_dds23)" +variable C12 equal "v_Pa2GPa*(v_C1*f_CB[7] - v_C2*v_vars12)" +variable C13 equal "v_Pa2GPa*(v_C1*f_CB[8] - v_C2*v_vars13)" +variable C23 equal "v_Pa2GPa*(v_C1*f_CB[12] - v_C2*v_vars23)" + +variable dds4 vector "v_ds4*v_ds4" +variable dds5 vector "v_ds5*v_ds5" +variable dds6 vector "v_ds6*v_ds6" +variable vars4 equal "ave(v_dds4)" +variable vars5 equal "ave(v_dds5)" +variable vars6 equal "ave(v_dds6)" +variable C44 equal "v_Pa2GPa*(v_C1*f_CB[4] - v_C2*v_vars4 + v_Rhokbt)" +variable C55 equal "v_Pa2GPa*(v_C1*f_CB[5] - v_C2*v_vars5 + v_Rhokbt)" +variable C66 equal "v_Pa2GPa*(v_C1*f_CB[6] - v_C2*v_vars6 + v_Rhokbt)" + +variable aC11 equal "(v_C11 + v_C22 + v_C33)/3." +variable aC12 equal "(v_C12 + v_C13 + v_C23)/3." +variable aC44 equal "(v_C44 + v_C55 + v_C66)/3." + +print """ +C11 = ${aC11} +C12 = ${aC12} +C44 = ${aC44} +""" diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/stre_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/stre_matrix.out new file mode 100644 index 0000000000..c6d64581a2 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/stre_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 1.10120 0.69454 0.66285 0.01885 0.01902 -0.01367 + 0.69454 1.20617 0.65567 0.00893 0.00839 -0.00873 + 0.66285 0.65567 1.11090 -0.01593 0.01634 -0.00483 + 0.01885 0.00893 -0.01593 0.42772 0.01316 0.01666 + 0.01902 0.00839 0.01634 0.01316 0.52416 -0.01733 +-0.01367 -0.00873 -0.00483 0.01666 -0.01733 0.49891 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/temp_matrix.out b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/temp_matrix.out new file mode 100644 index 0000000000..62a734b707 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/Numdiff/temp_matrix.out @@ -0,0 +1,7 @@ +# Cij Matrix from post process computation + 0.04187 0.00000 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.04187 0.00000 0.00000 0.00000 0.00000 + 0.00000 0.00000 0.04187 0.00000 0.00000 0.00000 + 0.00000 0.00000 0.00000 0.02093 0.00000 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.02093 0.00000 + 0.00000 0.00000 0.00000 0.00000 0.00000 0.02093 diff --git a/examples/ELASTIC_T/BORN_MATRIX/Argon/README.md b/examples/ELASTIC_T/BORN_MATRIX/Argon/README.md new file mode 100644 index 0000000000..c0a11af16f --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Argon/README.md @@ -0,0 +1,13 @@ +This repository is a test case for the compute born/matrix. It provides short +scripts creating argon fcc crystal and computing the Born term using the two +methods described in the documentation. + +In the __Analytical__ directory the terms are computed using the analytical +derivation of the Born term for the lj/cut pair style. + +In the __Numdiff__ directory, the Born term is evaluated through small +numerical differences of the stress tensor. This method can be used with any +interaction potential. + +Both script show examples on how to compute the full Cij elastic stiffness +tensor in LAMMPS. diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/Si.sw b/examples/ELASTIC_T/BORN_MATRIX/Silicon/Si.sw new file mode 120000 index 0000000000..e575921334 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/Si.sw @@ -0,0 +1 @@ +../../../../potentials/Si.sw \ No newline at end of file diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/final_output.in b/examples/ELASTIC_T/BORN_MATRIX/Silicon/final_output.in new file mode 100644 index 0000000000..e0d7777b4b --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/final_output.in @@ -0,0 +1,68 @@ +# Average moduli for cubic crystals + +variable C11cubic equal (${C11}+${C22}+${C33})/3.0 +variable C12cubic equal (${C12}+${C13}+${C23})/3.0 +variable C44cubic equal (${C44}+${C55}+${C66})/3.0 + +variable bulkmodulus equal (${C11cubic}+2*${C12cubic})/3.0 +variable shearmodulus1 equal ${C44cubic} +variable shearmodulus2 equal (${C11cubic}-${C12cubic})/2.0 +variable poissonratio equal 1.0/(1.0+${C11cubic}/${C12cubic}) + +# For Stillinger-Weber silicon, the analytical results +# are known to be (E. R. Cowley, 1988): +# C11 = 151.4 GPa +# C12 = 76.4 GPa +# C44 = 56.4 GPa + +#print "=========================================" +#print "Components of the Elastic Constant Tensor" +#print "=========================================" + +print "Elastic Constant C11 = ${C11} ${cunits}" +print "Elastic Constant C22 = ${C22} ${cunits}" +print "Elastic Constant C33 = ${C33} ${cunits}" + +print "Elastic Constant C12 = ${C12} ${cunits}" +print "Elastic Constant C13 = ${C13} ${cunits}" +print "Elastic Constant C23 = ${C23} ${cunits}" + +print "Elastic Constant C44 = ${C44} ${cunits}" +print "Elastic Constant C55 = ${C55} ${cunits}" +print "Elastic Constant C66 = ${C66} ${cunits}" + +print "Elastic Constant C14 = ${C14} ${cunits}" +print "Elastic Constant C15 = ${C15} ${cunits}" +print "Elastic Constant C16 = ${C16} ${cunits}" + +print "Elastic Constant C24 = ${C24} ${cunits}" +print "Elastic Constant C25 = ${C25} ${cunits}" +print "Elastic Constant C26 = ${C26} ${cunits}" + +print "Elastic Constant C34 = ${C34} ${cunits}" +print "Elastic Constant C35 = ${C35} ${cunits}" +print "Elastic Constant C36 = ${C36} ${cunits}" + +print "Elastic Constant C45 = ${C45} ${cunits}" +print "Elastic Constant C46 = ${C46} ${cunits}" +print "Elastic Constant C56 = ${C56} ${cunits}" + +print "=========================================" +print "Average properties for a cubic crystal" +print "=========================================" + +print "Bulk Modulus = ${bulkmodulus} ${cunits}" +print "Shear Modulus 1 = ${shearmodulus1} ${cunits}" +print "Shear Modulus 2 = ${shearmodulus2} ${cunits}" +print "Poisson Ratio = ${poissonratio}" + +# summarize sampling protocol + +variable tmp equal atoms +print "Number of atoms = ${tmp}" +print "Stress sampling interval = ${nevery}" +variable tmp equal ${nrun}/${nevery} +print "Stress sample count = ${tmp}" +print "Born sampling interval = ${neveryborn}" +variable tmp equal ${nrun}/${neveryborn} +print "Born sample count = ${tmp}" diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/in.elastic b/examples/ELASTIC_T/BORN_MATRIX/Silicon/in.elastic new file mode 100644 index 0000000000..cbd0aa208c --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/in.elastic @@ -0,0 +1,25 @@ +# Compute elastic constant tensor for a crystal at finite temperature +# These settings replicate the 1477~K benchmark of +# Kluge, Ray, and Rahman (1986) that is Ref.[15] in: +# Y. Zhen, C. Chu, Computer Physics Communications 183(2012) 261-265 + +# here: Y. Zhen, C. Chu, Computer Physics Communications 183(2012) 261-265 + +include init.in + +# Compute initial state + +include potential.in +thermo_style custom step temp pe press density +run ${nequil} + +# Run dynamics + +include potential.in +include output.in + +run ${nrun} + +# Output final values + +include final_output.in diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/init.in b/examples/ELASTIC_T/BORN_MATRIX/Silicon/init.in new file mode 100644 index 0000000000..09aa85a489 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/init.in @@ -0,0 +1,59 @@ +# NOTE: This script can be modified for different atomic structures, +# units, etc. See in.elastic for more info. +# + +# Define MD parameters +# These can be modified by the user +# These settings replicate the 1477~K benchmark of +# Kluge, Ray, and Rahman (1986) that is Ref.[15] in: +# Y. Zhen, C. Chu, Computer Physics Communications 183(2012) 261-265 + +# select temperature and pressure (lattice constant) + +variable temp index 1477.0 # temperature of initial sample +variable a index 5.457 # lattice constant + +# select sampling parameters, important for speed/convergence + +variable nthermo index 1500 # interval for thermo output +variable nevery index 10 # stress sampling interval +variable neveryborn index 100 # Born sampling interval +variable timestep index 0.000766 # timestep +variable nlat index 3 # number of lattice unit cells + +# other settings + +variable mass1 index 28.06 # mass +variable tdamp index 0.01 # time constant for thermostat +variable seed index 123457 # seed for thermostat +variable thermostat index 1 # 0 if NVE, 1 if NVT +variable delta index 1.0e-6 # Born numdiff strain magnitude + +# hard-coded rules-of-thumb for run length, etc. + +variable nfreq equal ${nthermo} # interval for averaging output +variable nrepeat equal floor(${nfreq}/${nevery}) # number of samples +variable nrepeatborn equal floor(${nfreq}/${neveryborn}) # number of samples +variable nequil equal 10*${nthermo} # length of equilibration run +variable nrun equal 100*${nthermo} # length of equilibrated run + +# generate the box and atom positions using a diamond lattice + +units metal + +boundary p p p + +# this generates a standard 8-atom cubic cell + +lattice diamond $a +region box prism 0 1 0 1 0 1 0 0 0 + +# this generates a 2-atom triclinic cell +#include tri.in + +create_box 1 box +create_atoms 1 box +mass 1 ${mass1} +replicate ${nlat} ${nlat} ${nlat} +velocity all create ${temp} 87287 + diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/output.in b/examples/ELASTIC_T/BORN_MATRIX/Silicon/output.in new file mode 100644 index 0000000000..d6a89cff6a --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/output.in @@ -0,0 +1,140 @@ +# Setup output + +# Stress fluctuation term F + +compute stress all pressure thermo_temp +variable s1 equal c_stress[1] +variable s2 equal c_stress[2] +variable s3 equal c_stress[3] +variable s4 equal c_stress[6] +variable s5 equal c_stress[5] +variable s6 equal c_stress[4] + +variable s11 equal v_s1*v_s1 +variable s22 equal v_s2*v_s2 +variable s33 equal v_s3*v_s3 +variable s44 equal v_s4*v_s4 +variable s55 equal v_s5*v_s5 +variable s66 equal v_s6*v_s6 +variable s33 equal v_s3*v_s3 +variable s12 equal v_s1*v_s2 +variable s13 equal v_s1*v_s3 +variable s14 equal v_s1*v_s4 +variable s15 equal v_s1*v_s5 +variable s16 equal v_s1*v_s6 +variable s23 equal v_s2*v_s3 +variable s24 equal v_s2*v_s4 +variable s25 equal v_s2*v_s5 +variable s26 equal v_s2*v_s6 +variable s34 equal v_s3*v_s4 +variable s35 equal v_s3*v_s5 +variable s36 equal v_s3*v_s6 +variable s45 equal v_s4*v_s5 +variable s46 equal v_s4*v_s6 +variable s56 equal v_s5*v_s6 + +variable mytemp equal temp +variable mypress equal press +variable mype equal pe/atoms +fix avt all ave/time ${nevery} ${nrepeat} ${nfreq} v_mytemp ave running +fix avp all ave/time ${nevery} ${nrepeat} ${nfreq} v_mypress ave running +fix avpe all ave/time ${nevery} ${nrepeat} ${nfreq} v_mype ave running +fix avs all ave/time ${nevery} ${nrepeat} ${nfreq} v_s1 v_s2 v_s3 v_s4 v_s5 v_s6 ave running +fix avssq all ave/time ${nevery} ${nrepeat} ${nfreq} & +v_s11 v_s22 v_s33 v_s44 v_s55 v_s66 & +v_s12 v_s13 v_s14 v_s15 v_s16 & +v_s23 v_s24 v_s25 v_s26 & +v_s34 v_s35 v_s36 & +v_s45 v_s46 & +v_s56 & +ave running + +# bar to GPa +variable pconv equal 1.0e5/1.0e9 +variable cunits index GPa +# metal unit constants from LAMMPS +# force->nktv2p = 1.6021765e6; +# force->boltz = 8.617343e-5; +variable boltz equal 8.617343e-5 +variable nktv2p equal 1.6021765e6 +variable vkt equal vol/(${boltz}*${temp})/${nktv2p} +variable ffac equal ${pconv}*${vkt} + +variable F11 equal -(f_avssq[1]-f_avs[1]*f_avs[1])*${ffac} +variable F22 equal -(f_avssq[2]-f_avs[2]*f_avs[2])*${ffac} +variable F33 equal -(f_avssq[3]-f_avs[3]*f_avs[3])*${ffac} +variable F44 equal -(f_avssq[4]-f_avs[4]*f_avs[4])*${ffac} +variable F55 equal -(f_avssq[5]-f_avs[5]*f_avs[5])*${ffac} +variable F66 equal -(f_avssq[6]-f_avs[6]*f_avs[6])*${ffac} + +variable F12 equal -(f_avssq[7]-f_avs[1]*f_avs[2])*${ffac} +variable F13 equal -(f_avssq[8]-f_avs[1]*f_avs[3])*${ffac} +variable F14 equal -(f_avssq[9]-f_avs[1]*f_avs[4])*${ffac} +variable F15 equal -(f_avssq[10]-f_avs[1]*f_avs[5])*${ffac} +variable F16 equal -(f_avssq[11]-f_avs[1]*f_avs[6])*${ffac} + +variable F23 equal -(f_avssq[12]-f_avs[2]*f_avs[3])*${ffac} +variable F24 equal -(f_avssq[13]-f_avs[2]*f_avs[4])*${ffac} +variable F25 equal -(f_avssq[14]-f_avs[2]*f_avs[5])*${ffac} +variable F26 equal -(f_avssq[15]-f_avs[2]*f_avs[6])*${ffac} + +variable F34 equal -(f_avssq[16]-f_avs[3]*f_avs[4])*${ffac} +variable F35 equal -(f_avssq[17]-f_avs[3]*f_avs[5])*${ffac} +variable F36 equal -(f_avssq[18]-f_avs[3]*f_avs[6])*${ffac} + +variable F45 equal -(f_avssq[19]-f_avs[4]*f_avs[5])*${ffac} +variable F46 equal -(f_avssq[20]-f_avs[4]*f_avs[6])*${ffac} + +variable F56 equal -(f_avssq[21]-f_avs[5]*f_avs[6])*${ffac} + +# Born term + +compute virial all pressure NULL virial +compute born all born/matrix numdiff ${delta} virial +fix avborn all ave/time ${neveryborn} ${nrepeatborn} ${nfreq} c_born[*] ave running + +variable bfac equal ${pconv}*${nktv2p}/vol +variable B vector f_avborn*${bfac} + +# Kinetic term + +variable kfac equal ${pconv}*${nktv2p}*atoms*${boltz}*${temp}/vol +variable K11 equal 4.0*${kfac} +variable K22 equal 4.0*${kfac} +variable K33 equal 4.0*${kfac} +variable K44 equal 2.0*${kfac} +variable K55 equal 2.0*${kfac} +variable K66 equal 2.0*${kfac} + +# Add F, K, and B together + +variable C11 equal v_F11+v_B[1]+v_K11 +variable C22 equal v_F22+v_B[2]+v_K22 +variable C33 equal v_F33+v_B[3]+v_K33 +variable C44 equal v_F44+v_B[4]+v_K44 +variable C55 equal v_F55+v_B[5]+v_K55 +variable C66 equal v_F66+v_B[6]+v_K66 + +variable C12 equal v_F12+v_B[7] +variable C13 equal v_F13+v_B[8] +variable C14 equal v_F14+v_B[9] +variable C15 equal v_F15+v_B[10] +variable C16 equal v_F16+v_B[11] + +variable C23 equal v_F23+v_B[12] +variable C24 equal v_F24+v_B[13] +variable C25 equal v_F25+v_B[14] +variable C26 equal v_F26+v_B[15] + +variable C34 equal v_F34+v_B[16] +variable C35 equal v_F35+v_B[17] +variable C36 equal v_F36+v_B[18] + +variable C45 equal v_F45+v_B[19] +variable C46 equal v_F46+v_B[20] + +variable C56 equal v_F56+v_B[21] + +thermo ${nthermo} +thermo_style custom step temp pe press density f_avt f_avp f_avpe v_F11 v_F22 v_F33 v_F44 v_F55 v_F66 v_F12 v_F13 v_F23 v_B[1] v_B[2] v_B[3] v_B[4] v_B[5] v_B[6] v_B[7] v_B[8] v_B[12] +thermo_modify norm no diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/potential.in b/examples/ELASTIC_T/BORN_MATRIX/Silicon/potential.in new file mode 100644 index 0000000000..43b0fa61c4 --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/potential.in @@ -0,0 +1,21 @@ +# NOTE: This script can be modified for different pair styles +# See in.elastic for more info. + +reset_timestep 0 + +# Choose potential +pair_style sw +pair_coeff * * Si.sw Si + +# Setup neighbor style +neighbor 1.0 nsq +neigh_modify once no every 1 delay 0 check yes + +# Setup MD + +timestep ${timestep} +fix 4 all nve +if "${thermostat} == 1" then & + "fix 5 all langevin ${temp} ${temp} ${tdamp} ${seed}" + + diff --git a/examples/ELASTIC_T/BORN_MATRIX/Silicon/tri.in b/examples/ELASTIC_T/BORN_MATRIX/Silicon/tri.in new file mode 100644 index 0000000000..20bfca16ec --- /dev/null +++ b/examples/ELASTIC_T/BORN_MATRIX/Silicon/tri.in @@ -0,0 +1,26 @@ +# this generates a 2-atom triclinic cell +# due to rotation on to x-axis, +# elastic constant analysis is not working yet + +# unit lattice vectors are +# a1 = (1 0 0) +# a2 = (1/2 sqrt3/2 0) +# a3 = (1/2 1/(2sqrt3) sqrt2/sqrt3) + +variable a1x equal 1 +variable a2x equal 1/2 +variable a2y equal sqrt(3)/2 +variable a3x equal 1/2 +variable a3y equal 1/(2*sqrt(3)) +variable a3z equal sqrt(2/3) +variable l equal $a/sqrt(2) + +lattice custom ${l} & + a1 ${a1x} 0 0 & + a2 ${a2x} ${a2y} 0.0 & + a3 ${a3x} ${a3y} ${a3z} & + basis 0 0 0 & + basis 0.25 0.25 0.25 & + spacing 1 1 1 + +region box prism 0 ${a1x} 0 ${a2y} 0 ${a3z} ${a2x} ${a3x} ${a3y} diff --git a/examples/ELASTIC_T/DEFORMATION/Silicon/Si.sw b/examples/ELASTIC_T/DEFORMATION/Silicon/Si.sw new file mode 120000 index 0000000000..e575921334 --- /dev/null +++ b/examples/ELASTIC_T/DEFORMATION/Silicon/Si.sw @@ -0,0 +1 @@ +../../../../potentials/Si.sw \ No newline at end of file diff --git a/examples/ELASTIC_T/displace.mod b/examples/ELASTIC_T/DEFORMATION/Silicon/displace.mod similarity index 100% rename from examples/ELASTIC_T/displace.mod rename to examples/ELASTIC_T/DEFORMATION/Silicon/displace.mod diff --git a/examples/ELASTIC_T/in.elastic b/examples/ELASTIC_T/DEFORMATION/Silicon/in.elastic similarity index 100% rename from examples/ELASTIC_T/in.elastic rename to examples/ELASTIC_T/DEFORMATION/Silicon/in.elastic diff --git a/examples/ELASTIC_T/init.mod b/examples/ELASTIC_T/DEFORMATION/Silicon/init.mod similarity index 100% rename from examples/ELASTIC_T/init.mod rename to examples/ELASTIC_T/DEFORMATION/Silicon/init.mod diff --git a/examples/ELASTIC_T/potential.mod b/examples/ELASTIC_T/DEFORMATION/Silicon/potential.mod similarity index 93% rename from examples/ELASTIC_T/potential.mod rename to examples/ELASTIC_T/DEFORMATION/Silicon/potential.mod index d4b7cc7158..7cd996d5d5 100644 --- a/examples/ELASTIC_T/potential.mod +++ b/examples/ELASTIC_T/DEFORMATION/Silicon/potential.mod @@ -2,7 +2,7 @@ # See in.elastic for more info. # we must undefine any fix ave/* fix before using reset_timestep -if "$(is_defined(fix,avp)" then "unfix avp" +if "$(is_defined(fix,avp))" then "unfix avp" reset_timestep 0 # Choose potential diff --git a/examples/ELASTIC_T/Si.sw b/examples/ELASTIC_T/Si.sw deleted file mode 100644 index db4be100ef..0000000000 --- a/examples/ELASTIC_T/Si.sw +++ /dev/null @@ -1,18 +0,0 @@ -# DATE: 2007-06-11 CONTRIBUTOR: Aidan Thompson, athomps@sandia.gov CITATION: Stillinger and Weber, Phys Rev B, 31, 5262, (1985) -# Stillinger-Weber parameters for various elements and mixtures -# multiple entries can be added to this file, LAMMPS reads the ones it needs -# these entries are in LAMMPS "metal" units: -# epsilon = eV; sigma = Angstroms -# other quantities are unitless - -# format of a single entry (one or more lines): -# element 1, element 2, element 3, -# epsilon, sigma, a, lambda, gamma, costheta0, A, B, p, q, tol - -# Here are the original parameters in metal units, for Silicon from: -# -# Stillinger and Weber, Phys. Rev. B, v. 31, p. 5262, (1985) -# - -Si Si Si 2.1683 2.0951 1.80 21.0 1.20 -0.333333333333 - 7.049556277 0.6022245584 4.0 0.0 0.0 diff --git a/examples/PACKAGES/dielectric/data.confined b/examples/PACKAGES/dielectric/data.confined index 2e166151bb..8145c829d1 100644 --- a/examples/PACKAGES/dielectric/data.confined +++ b/examples/PACKAGES/dielectric/data.confined @@ -1,4 +1,4 @@ -LAMMPS data file: two oppositely charged ions confined between two walls +LAMMPS data file: two oppositely charged ions confined between two walls epsilon1=2 | epsilon2=10 | epsilon1=2 4002 atoms 3 atom types @@ -4015,5 +4015,5 @@ Atoms # dielectric: id mol type q x y z normx normy normz area_per_patch ed em e 3998 0 1 0 38.5078 42.4438 30.002 0 0 -1 0.866 8 6 6 0 3999 0 1 0 39.0079 41.5776 30.002 0 0 -1 0.866 8 6 6 0 4000 0 1 0 39.508 42.4438 30.002 0 0 -1 0.866 8 6 6 0 -4001 0 2 1 15 20 15 0 0 1 0.866 8 6 10 0 -4002 0 3 -1 25 20 25 0 0 1 0.866 8 6 10 0 +4001 0 2 1 15 20 15 0 0 1 1.0 8 6 10 0 +4002 0 3 -1 25 20 25 0 0 1 1.0 8 6 10 0 diff --git a/examples/PACKAGES/dielectric/in.confined b/examples/PACKAGES/dielectric/in.confined index c9ae6d712a..beb5b9a2b0 100644 --- a/examples/PACKAGES/dielectric/in.confined +++ b/examples/PACKAGES/dielectric/in.confined @@ -4,6 +4,8 @@ # top interface: n = (0, 0, -1) # so that ed's are the same for both interfaces +# Dielectric constants can be set to be different from the input data file + variable epsilon1 index 20 variable epsilon2 index 8 @@ -21,6 +23,8 @@ variable method index gmres # gmres = BEM/GMRES # dof = Direct optimization of the functional # none +# compute the relevant values for the interface particles + variable ed equal "v_epsilon2 - v_epsilon1" variable em equal "(v_epsilon2 + v_epsilon1)/2" variable epsilon equal 1.0 # epsilon at the patch, not used for now @@ -34,12 +38,10 @@ group ions type 2 3 group cations type 2 group anions type 3 -# 1.0 = q * epsilon2 = qreal for cations -# -1.0 = q * epsilon2 = qreal for anions -variable qscale equal "1.0 / v_epsilon2" -set group cations charge ${qscale} -variable qscale equal "-1.0 / v_epsilon2" -set group anions charge ${qscale} +# set the dielectric constant of the medium where the ions reside + +set group cations epsilon ${epsilon2} +set group anions epsilon ${epsilon2} pair_style lj/cut/coul/long/dielectric 1.122 10.0 pair_coeff * * 1.0 1.0 @@ -59,6 +61,8 @@ dump 3 ions custom 100 ions.dump id mol type q x y z fx fy fz #c_ef[1 fix 1 ions nve +# fix modify is used to set the properties of the interface particle group + if "${method} == gmres" then & "fix 3 interface polarize/bem/gmres 1 1.0e-4" & "fix_modify 3 itr_max 50 dielectrics ${ed} ${em} ${epsilon} ${area} NULL" & diff --git a/examples/README b/examples/README index f82fe3b929..8d0d7cf1c9 100644 --- a/examples/README +++ b/examples/README @@ -94,7 +94,7 @@ msst: MSST shock dynamics nb3b: use of nonbonded 3-body harmonic pair style neb: nudged elastic band (NEB) calculation for barrier finding nemd: non-equilibrium MD of 2d sheared system -numdiff: numerical difference computation of forces and virial +numdiff: numerical difference computation of forces, virial, and Born matrix obstacle: flow around two voids in a 2d channel peptide: dynamics of a small solvated peptide chain (5-mer) peri: Peridynamic model of cylinder impacted by indenter @@ -153,12 +153,19 @@ either by itself or in tandem with another code or library. See the COUPLE/README file to get started. The ELASTIC directory has an example script for computing elastic -constants at zero temperature, using an Si example. See the +stiffness tensor (elastic constants) +at zero temperature, using an Si example. See the ELASTIC/in.elastic file for more info. -The ELASTIC_T directory has an example script for computing elastic -constants at finite temperature, using an Si example. See the -ELASTIC_T/in.elastic file for more info. +The ELASTIC_T directory has example scripts for the computing elastic +stiffness tensor at finite temperature. Two different methods are +demonstrated. DEFORMATION estimates the change in the average +stress tensor between multiple simulations +in which small finite deformations are made to the simulation cell. +BORN_MATRIX runs a single simulation in which the Born matrix and stress +fluctuations are averaged. The second method +is newer in LAMMPS and is generally more efficient and +more reliable. The HEAT directory has example scripts for heat exchange algorithms (e.g. used for establishing a thermal gradient), using two different diff --git a/examples/bpm/impact/brokenDump b/examples/bpm/impact/brokenDump new file mode 100644 index 0000000000..ef78518c91 --- /dev/null +++ b/examples/bpm/impact/brokenDump @@ -0,0 +1,3173 @@ +276 5469 5471 +288 1815 1931 +290 1810 1815 +293 1815 1816 +295 5350 5351 +300 1813 1815 +288 1815 1931 +276 5469 5471 +278 5475 5477 +283 5349 5350 +287 5470 5477 +290 5472 5477 +292 5350 5352 +294 5477 5478 +295 5350 5351 +305 1702 1704 +308 1705 5351 +313 1699 1704 +324 1820 5471 +327 1813 1814 +332 1937 1938 +339 5228 5349 +350 1811 1818 +353 1817 5348 +361 1588 1700 +362 1700 5348 +364 1817 5469 +368 1700 5228 +368 1704 1819 +372 1817 5467 +373 5351 5470 +374 1701 1818 +374 1817 5468 +377 1584 1694 +380 5231 5349 +383 1588 5349 +383 5231 5350 +386 1458 1574 +388 1811 1812 +399 1464 1580 +399 1817 1822 +306 1938 5471 +308 1928 1933 +309 1933 1934 +310 1933 2048 +311 5712 5830 +313 1931 1933 +332 1937 1938 +333 1938 1939 +333 2056 2171 +338 1938 1940 +340 2172 2174 +352 2172 5712 +353 2056 2057 +355 2056 2172 +359 5712 5831 +362 2057 2169 +367 1932 1938 +368 2052 5709 +372 2052 2053 +375 5712 5713 +375 2172 2173 +377 2174 2286 +385 5711 5712 +385 2169 5709 +386 1935 1936 +387 2054 2055 +387 2169 5829 +398 2277 2278 +399 2057 2171 +303 5232 5350 +303 5477 5595 +304 5352 5470 +306 1938 5471 +306 5483 5484 +312 5350 5355 +312 5481 5483 +312 5471 5591 +316 5471 5590 +318 5357 5470 +324 1820 5471 +330 5470 5475 +331 5354 5473 +332 5476 5481 +332 5471 5589 +332 5483 5601 +339 5228 5349 +341 5473 5474 +343 5358 5476 +346 5349 5352 +346 5355 5357 +347 5237 5350 +350 5357 5358 +351 5354 5467 +353 1817 5348 +358 5348 5467 +362 1700 5348 +362 5601 5602 +366 5470 5471 +367 5472 5475 +371 5476 5477 +372 1817 5467 +372 5480 5593 +373 5351 5470 +373 5601 5603 +374 1817 5468 +380 5231 5349 +383 1588 5349 +383 5231 5350 +387 5478 5481 +388 5234 5353 +389 5596 5601 +397 5484 5486 +400 5593 5601 +303 5477 5595 +311 5712 5830 +312 5471 5591 +316 5471 5590 +319 5717 5719 +325 5831 5833 +332 5471 5589 +349 5603 5604 +355 5717 5722 +359 5712 5831 +368 2052 5709 +370 5720 5722 +372 5480 5593 +372 5600 5603 +373 5600 5604 +373 5601 5603 +374 5587 5594 +375 5712 5713 +379 5588 5708 +381 5600 5714 +383 5720 5721 +385 5711 5712 +385 2169 5709 +387 2169 5829 +388 5722 5723 +391 5828 5829 +394 5833 5948 +398 5710 5712 +400 5593 5601 +401 1820 1822 +403 1817 1819 +404 1586 1588 +405 1569 1685 +410 1821 1938 +411 1822 5469 +412 1568 1575 +413 1822 1937 +421 1699 1819 +421 5232 5349 +422 1704 1814 +423 1582 1584 +431 1565 1572 +431 1578 1688 +431 1812 1929 +433 5469 5472 +435 1467 1585 +442 1809 1810 +448 1685 1692 +448 1698 1808 +451 1703 5349 +454 1563 1679 +454 1935 1937 +455 1703 5351 +457 1582 1694 +458 1813 1816 +459 1695 1805 +460 1926 1927 +461 1699 1814 +468 1810 1816 +471 1814 1819 +476 1701 1819 +478 1566 1682 +480 1818 1929 +481 1920 1925 +482 1580 1587 +485 5468 5469 +486 1689 1805 +490 1457 1464 +490 1806 1810 +493 1587 1588 +493 1814 1816 +497 1682 1689 +498 1699 1816 +500 1688 1805 +500 1689 1695 +402 2049 2051 +402 2054 2057 +410 1821 1938 +416 2052 5588 +417 2055 2056 +420 1939 2049 +423 1923 1930 +423 2161 2271 +426 2050 2160 +431 1812 1929 +431 2044 2154 +437 2284 2393 +441 1940 2054 +441 2174 5832 +442 2166 2173 +448 1927 1928 +449 2286 5949 +451 2163 2170 +452 2037 2038 +457 2396 2397 +460 1926 1927 +461 1936 2046 +461 2406 2513 +464 1930 1934 +465 2055 5712 +471 1931 1934 +473 1940 5710 +474 2154 2159 +475 2274 2275 +477 1933 2049 +478 1923 2040 +479 2037 2039 +479 2399 2400 +480 1818 1929 +481 1920 1925 +482 1930 2048 +482 2039 2042 +482 2164 2280 +482 2174 5830 +485 1930 1931 +486 1930 1936 +486 2046 2053 +487 1928 1930 +488 2167 2283 +495 2156 2159 +498 1928 1934 +403 5368 5369 +407 5484 5601 +409 5601 5604 +412 5232 5352 +414 5476 5596 +416 5123 5236 +419 5484 5602 +421 5232 5349 +421 5472 5595 +422 5129 5242 +425 5362 5363 +426 5347 5354 +426 5352 5355 +430 5246 5359 +433 5469 5472 +434 5481 5484 +437 5135 5248 +438 5365 5366 +439 5358 5478 +439 5483 5596 +441 5362 5369 +450 5363 5482 +450 5484 5487 +456 5484 5607 +458 5480 5599 +459 5242 5243 +461 5235 5236 +463 5479 5486 +464 5482 5483 +467 5234 5347 +467 5361 5362 +469 5232 5355 +470 5474 5475 +474 5116 5117 +475 5356 5363 +480 5234 5240 +481 5485 5487 +484 5480 5484 +485 5468 5469 +488 5476 5478 +493 5233 5238 +494 5356 5361 +495 5118 5238 +496 5363 5483 +497 5018 5128 +498 5233 5240 +500 5370 5488 +406 5591 5711 +406 5722 5724 +406 5969 5976 +407 5721 5725 +408 5600 5720 +409 5601 5604 +413 5597 5717 +419 5970 6089 +421 5472 5595 +421 6074 6081 +425 5719 5722 +425 5964 6083 +426 5594 5598 +426 5831 5838 +429 5840 5841 +436 5833 5838 +437 5724 5843 +439 5593 5595 +441 5951 5958 +444 5830 5831 +446 5713 5831 +449 5831 5951 +449 2286 5949 +453 5722 5725 +453 5709 5829 +454 5599 5600 +454 5591 5710 +455 5834 5842 +458 5480 5599 +459 5724 5837 +462 5589 5592 +462 6084 6202 +464 5598 5603 +465 2055 5712 +472 5954 5955 +473 1940 5710 +476 5594 5708 +477 5856 5975 +482 2174 5830 +482 5844 5963 +484 5714 5721 +488 5592 5708 +490 6083 6090 +501 1802 1807 +503 1805 1807 +504 1689 1806 +507 1569 1679 +507 1693 1805 +510 1688 1693 +511 1575 1690 +518 1799 1807 +520 1227 1340 +521 1803 1804 +522 1347 1463 +525 1575 1691 +528 1804 1925 +529 1581 1697 +531 1446 1562 +531 1573 1576 +535 1574 1575 +536 1802 1809 +548 1692 1693 +552 1693 1807 +553 1575 1692 +553 1819 1821 +555 1699 1813 +560 1922 1925 +569 5109 5111 +569 1705 1819 +576 1570 1690 +580 1808 1809 +584 1581 1696 +586 1471 5111 +589 1459 1576 +599 1702 1705 +502 2160 2167 +503 1922 1924 +503 2036 2037 +504 1922 2037 +504 2169 5830 +505 2057 2174 +505 2168 2283 +507 1924 2040 +507 2281 2390 +514 2162 2167 +514 2167 2168 +515 1929 1934 +515 2044 2159 +524 1929 1936 +530 2165 2167 +536 2167 2282 +549 2158 2274 +549 2519 2520 +560 1922 1925 +560 2035 2039 +560 2158 2276 +561 2289 5832 +562 1932 1939 +562 2263 2372 +567 2041 2157 +567 2381 2382 +581 1920 2037 +583 1920 1927 +583 5950 5953 +586 2042 2045 +593 5951 5952 +596 5833 5950 +600 2158 2159 +502 5254 5255 +507 5232 5237 +508 5473 5478 +511 5239 5240 +512 5111 5112 +513 5233 5353 +519 4901 5011 +519 5012 5122 +522 5235 5238 +522 5240 5241 +523 5260 5261 +523 5364 5369 +525 5490 5608 +528 5237 5238 +538 5479 5480 +542 5488 5493 +553 5611 5613 +555 5246 5365 +555 5489 5608 +557 4895 5005 +561 5481 5601 +564 5140 5141 +569 5109 5111 +571 5114 5235 +572 5488 5495 +573 5230 5237 +582 5490 5492 +584 5024 5134 +586 1471 5111 +587 5244 5367 +587 5352 5354 +587 5490 5495 +591 5486 5599 +594 5347 5348 +502 5959 6077 +504 2169 5830 +507 5606 5726 +519 5835 5948 +521 5967 6086 +523 5733 5852 +524 5719 5842 +529 5609 5728 +529 5833 5836 +541 5956 5958 +541 5968 5971 +547 5717 5723 +549 5961 6074 +551 6071 6190 +553 5611 5613 +554 5588 5710 +558 5594 5714 +559 5592 5713 +561 5481 5601 +564 5970 6083 +568 5853 5972 +569 5592 5716 +574 5606 5727 +574 5835 5955 +579 5592 5710 +583 5950 5953 +590 5855 5862 +591 5486 5599 +591 5718 5831 +593 5951 5952 +596 5605 5726 +596 5833 5950 +602 1820 1821 +603 1461 1571 +606 1683 1793 +607 1808 1815 +609 1322 1329 +610 1583 1585 +615 1576 1579 +616 1699 1811 +621 1557 1673 +622 1583 5229 +630 1468 1470 +634 1470 1471 +634 5111 5229 +635 1469 1471 +635 1469 1586 +639 1572 1576 +639 1698 1814 +639 1809 1926 +644 5229 5230 +645 1588 1702 +649 1690 1693 +652 1696 1813 +656 1574 1579 +657 1693 1813 +658 1819 1820 +659 1467 1577 +661 1455 1565 +669 1695 1811 +677 1100 1107 +678 1221 1334 +679 1433 1440 +679 1688 1696 +680 1687 1807 +682 1812 1816 +683 1689 1799 +689 1585 5229 +690 1701 1811 +692 1007 1014 +693 1466 1471 +696 1328 1335 +699 1582 1585 +601 1928 2048 +606 2619 2620 +610 2162 2165 +613 2387 2388 +615 2040 2047 +615 2266 2375 +619 2039 2159 +622 2053 2057 +624 2151 2156 +626 2053 2171 +627 2169 2174 +627 2287 2402 +628 2172 5830 +629 2291 2402 +634 2619 2621 +637 2034 2042 +639 1809 1926 +641 2613 2614 +646 1924 2034 +649 2145 2152 +649 2136 2137 +652 2626 2730 +653 2148 2155 +654 1932 1933 +655 1934 2048 +656 2501 2502 +660 2274 2276 +662 2253 2254 +672 1934 1937 +673 2369 2370 +675 2146 2262 +678 1917 1924 +685 2052 2054 +689 1929 1930 +697 1917 2034 +700 2057 5709 +604 5611 5618 +605 4907 5017 +611 5244 5359 +628 5245 5252 +634 5111 5229 +644 5229 5230 +647 5023 5024 +648 5012 5128 +651 4897 4898 +658 5111 5230 +659 5267 5380 +660 5608 5613 +661 5602 5603 +667 5236 5238 +675 5159 5272 +675 5247 5250 +681 5604 5607 +684 5386 5387 +684 5475 5478 +603 5953 5956 +604 5611 5618 +605 6076 6078 +617 6440 6447 +622 5716 5717 +625 5966 5973 +627 5956 6076 +628 2172 5830 +631 6071 6078 +634 5610 5612 +640 5592 5598 +643 5595 5598 +645 5599 5604 +646 5987 5994 +647 5610 5615 +648 5959 6076 +658 5605 5606 +658 5729 5734 +660 5608 5613 +661 5602 5603 +662 5593 5598 +664 6331 6338 +676 5615 5734 +681 5604 5607 +689 5726 5727 +690 5603 5723 +690 5604 5723 +690 5833 5953 +691 5867 5874 +694 5598 5717 +697 5714 5716 +700 2057 5709 +701 1448 1449 +710 1810 1813 +711 1467 1583 +714 1574 1581 +727 1459 1573 +749 1453 1459 +753 1571 1573 +755 1442 1449 +755 1799 1806 +759 1661 1668 +759 1685 1690 +762 1453 1456 +764 1804 1920 +770 1571 1572 +772 1442 1448 +774 1581 1691 +778 1319 1326 +778 1699 1702 +778 1698 1813 +784 1587 1697 +788 1570 1576 +789 1684 1690 +791 1796 1803 +792 1106 1113 +794 1583 1586 +797 1335 1445 +797 5107 5109 +799 1451 1452 +800 1806 1809 +702 5829 5948 +704 1919 1920 +708 2376 2483 +711 2291 5949 +716 2037 2044 +721 2160 2162 +724 2489 2490 +728 1918 1919 +728 1927 2042 +730 2496 2601 +731 5832 5950 +732 1928 1931 +734 2279 2281 +738 2020 2130 +750 1918 2034 +752 2055 5710 +757 2608 2712 +764 1804 1920 +772 2276 2277 +773 2153 2156 +775 2275 2390 +783 2401 2403 +787 2286 5829 +791 1929 1937 +792 2035 2151 +798 1932 1934 +708 4793 4900 +709 5036 5146 +711 5243 5356 +724 5152 5153 +726 5239 5246 +733 5483 5602 +746 5245 5253 +754 5236 5243 +756 5245 5250 +758 5230 5232 +762 4919 5029 +764 5607 5610 +770 5347 5355 +771 5364 5487 +787 5234 5235 +789 5125 5132 +791 5364 5484 +797 5107 5109 +702 5829 5948 +703 5732 5734 +710 6227 6343 +711 2291 5949 +711 6221 6337 +719 5597 5711 +719 5846 5847 +725 5753 5760 +730 5618 5732 +731 5832 5950 +734 5853 5966 +734 6080 6081 +745 5958 6071 +751 6101 6108 +752 2055 5710 +754 5598 5601 +755 5721 5834 +755 6107 6114 +759 5965 6088 +764 5607 5610 +770 5725 5728 +771 5954 6074 +772 5963 5965 +774 5965 6082 +775 5845 5848 +793 6199 6200 +793 6446 6453 +795 5727 5840 +795 5961 6082 +799 5734 5737 +804 1454 1455 +805 1098 1211 +807 1687 1689 +809 1331 1332 +810 984 1094 +817 1332 1450 +820 1326 1442 +826 1442 1444 +827 1221 1333 +834 1911 1918 +846 1095 1208 +846 1821 1822 +851 1691 1692 +855 1800 1804 +858 1574 1580 +865 1338 1448 +867 995 1002 +871 1703 1704 +872 1196 1203 +872 1687 1799 +876 1819 1822 +880 1197 1310 +882 1332 1333 +883 881 989 +883 1687 1801 +886 1082 1089 +887 1587 1704 +887 1689 1807 +888 1704 5351 +890 1818 1937 +897 1690 1691 +804 1919 1922 +809 2149 2265 +824 1921 2037 +825 2052 5710 +834 1911 1918 +834 2041 2158 +835 2041 2045 +849 1921 2031 +856 2037 2042 +872 1917 1919 +888 5950 5952 +890 1818 1937 +803 5467 5468 +807 5011 5018 +808 5130 5250 +808 5254 5261 +813 5130 5253 +819 5131 5132 +819 5485 5492 +819 5488 5490 +834 4882 4883 +842 5364 5370 +845 5352 5467 +847 5227 5234 +848 5370 5490 +853 5125 5131 +855 5485 5493 +862 5020 5021 +863 5228 5348 +871 5599 5601 +874 5108 5114 +876 5366 5370 +878 5008 5015 +878 5369 5488 +879 5015 5133 +885 5021 5131 +888 1704 5351 +890 5125 5133 +890 5366 5485 +812 6081 6085 +814 5850 5968 +818 6452 6459 +819 5725 5730 +820 5723 5725 +825 2052 5710 +826 5604 5728 +832 5725 5842 +837 6102 6220 +846 5959 6082 +846 5973 6086 +861 6084 6201 +870 5598 5716 +871 5599 5601 +871 5725 5845 +871 6085 6201 +887 6233 6349 +892 6077 6196 +899 6337 6344 +903 1576 1578 +904 1336 1339 +909 1704 1705 +909 1806 1917 +913 1218 1325 +913 1700 1705 +923 1470 1586 +924 1304 1311 +929 880 887 +929 978 1088 +931 875 983 +934 1325 1330 +936 1459 1574 +940 1571 1576 +948 1695 1813 +950 1325 1332 +955 1821 1937 +962 1212 1325 +968 1421 1428 +970 1336 1450 +972 1816 1821 +974 1817 1818 +978 1076 1083 +980 1806 1807 +986 1577 1579 +987 1325 1333 +994 1457 1458 +995 1216 1328 +999 1214 1215 +1000 1810 1925 +904 2162 2277 +907 1923 1924 +907 2172 5832 +909 1806 1917 +909 2396 2403 +916 2291 6070 +917 2391 2504 +918 5829 5830 +919 2157 2158 +921 2405 5952 +923 1915 1916 +923 2259 2266 +940 2043 2050 +948 1913 1916 +951 2040 2048 +952 2279 2398 +955 1821 1937 +955 2405 2519 +964 2276 2282 +964 2498 2505 +967 2256 2263 +973 2043 2160 +979 1932 1937 +984 2390 2392 +998 2392 2395 +1000 1810 1925 +902 5132 5251 +904 5131 5251 +911 4786 4787 +922 5242 5249 +934 5360 5479 +939 5136 5138 +946 5488 5489 +969 5249 5362 +976 5364 5367 +979 5257 5259 +979 5257 5264 +981 5249 5368 +983 5243 5362 +988 5393 5506 +994 5248 5255 +906 5966 5974 +907 2172 5832 +916 2291 6070 +918 5829 5830 +926 6092 6093 +936 5600 5722 +936 5963 5968 +937 5963 5964 +940 5853 5974 +941 5851 5856 +946 5966 5971 +948 5858 5859 +951 5840 5960 +963 5847 5960 +966 5605 5612 +973 5838 5951 +979 5852 5857 +987 5851 5974 +988 5730 5843 +993 5841 5845 +994 6355 6362 +996 5851 5854 +997 5965 5968 +1007 1683 1801 +1015 1575 1581 +1016 1693 1696 +1017 1465 1582 +1018 1676 1677 +1019 1332 1336 +1024 1464 1574 +1026 1532 1539 +1027 1212 1319 +1036 1442 1559 +1042 1087 1090 +1043 1790 1797 +1044 1678 1681 +1044 1804 1919 +1059 1330 1444 +1059 1458 1568 +1066 1690 1692 +1071 1792 1905 +1073 1692 1807 +1074 1212 1216 +1077 1690 1807 +1080 1071 1184 +1083 1326 1436 +1090 1705 5469 +1098 1681 1684 +1003 2505 2610 +1004 2168 2288 +1013 2257 2372 +1029 2372 2373 +1037 2154 2161 +1037 2162 2168 +1040 2279 2282 +1044 1804 1919 +1050 1933 1939 +1055 2276 2279 +1064 2389 2506 +1071 1792 1905 +1073 2162 2282 +1078 2278 2392 +1084 2156 2161 +1085 6072 6190 +1089 2719 2820 +1014 5512 5513 +1019 5370 5487 +1026 5010 5013 +1032 5228 5347 +1032 5244 5362 +1033 5130 5135 +1059 5009 5013 +1064 5240 5244 +1070 5488 5608 +1076 5480 5481 +1078 5015 5016 +1085 5029 5030 +1088 5252 5253 +1089 5130 5133 +1090 5127 5128 +1090 1705 5469 +1091 5118 5241 +1094 5487 5490 +1096 5235 5237 +1002 6081 6199 +1004 5962 5964 +1008 5955 5956 +1010 5841 5847 +1011 5968 5969 +1014 5961 6080 +1015 5954 5961 +1016 6206 6316 +1018 5948 5956 +1020 6671 6678 +1022 5844 5845 +1023 5714 5715 +1023 5841 5842 +1032 5843 5844 +1032 5841 5844 +1033 5967 5968 +1038 5963 5969 +1039 5972 5973 +1041 6238 6245 +1044 5844 5962 +1048 5966 5968 +1052 5839 5841 +1053 6428 6435 +1054 5953 5958 +1056 5961 5967 +1060 6076 6079 +1071 6083 6084 +1071 6322 6323 +1072 5839 5954 +1082 6433 6435 +1085 6072 6190 +1088 5754 5873 +1088 5834 5841 +1097 5728 5729 +1098 5843 5849 +1102 1336 1456 +1113 1688 1695 +1117 1801 1802 +1118 731 738 +1118 1696 1698 +1121 1335 1450 +1132 1327 1330 +1136 1453 1455 +1139 1330 1442 +1139 1686 1801 +1142 646 653 +1149 1802 1803 +1155 1327 1444 +1157 953 960 +1158 1216 1327 +1169 1341 1451 +1173 643 650 +1176 1806 1923 +1178 1696 1699 +1181 552 652 +1184 1216 1330 +1185 1330 1335 +1186 1686 1796 +1198 640 647 +1101 2839 2937 +1102 2044 2160 +1107 2274 2279 +1112 6069 6073 +1114 2152 2268 +1128 1912 2028 +1131 2165 2168 +1144 2043 2048 +1148 2402 6068 +1152 2269 2384 +1156 2051 2171 +1159 2150 2270 +1174 2269 2378 +1176 1806 1923 +1176 2269 2386 +1181 2385 2492 +1193 2404 2407 +1194 2516 2521 +1198 1930 2046 +1199 2384 2385 +1103 5611 5616 +1105 5015 5019 +1111 5014 5021 +1113 5493 5496 +1114 4892 5010 +1115 5250 5253 +1127 4891 4892 +1128 5248 5250 +1131 5132 5245 +1133 5136 5259 +1133 5256 5371 +1135 5253 5256 +1139 5495 5496 +1142 4890 4892 +1144 4880 4884 +1146 5014 5022 +1156 5014 5016 +1157 5244 5249 +1159 5011 5128 +1163 5258 5377 +1164 4483 4582 +1174 4360 4361 +1174 5015 5131 +1176 5014 5019 +1178 5239 5247 +1179 5262 5265 +1181 5247 5249 +1187 4772 4885 +1187 5016 5019 +1187 5130 5248 +1190 4588 4589 +1194 4476 4477 +1200 5247 5248 +1103 5611 5616 +1103 6107 6108 +1105 6204 6207 +1111 6201 6202 +1112 6069 6073 +1112 6210 6324 +1114 5739 5860 +1128 5597 5716 +1135 5852 5858 +1141 6084 6090 +1148 2402 6068 +1148 6200 6204 +1150 5865 5978 +1150 6206 6323 +1152 5720 5727 +1157 5854 5857 +1160 5833 5951 +1168 5604 5606 +1168 5849 5850 +1173 6074 6075 +1175 5743 5860 +1180 5959 5962 +1181 5610 5728 +1190 5960 5967 +1195 5951 5956 +1195 6204 6318 +1212 641 743 +1212 1692 1808 +1213 1680 1796 +1215 557 564 +1216 664 671 +1216 737 744 +1220 1098 1205 +1231 1680 1681 +1234 1451 1457 +1237 1681 1795 +1245 1179 1292 +1247 1576 1690 +1249 1092 1199 +1249 1324 1436 +1254 473 480 +1260 468 563 +1260 551 558 +1260 1695 1696 +1265 1211 1212 +1265 1693 1695 +1269 1332 1442 +1272 1808 1810 +1277 1670 1677 +1280 1178 1185 +1287 1320 1430 +1289 1679 1685 +1291 1694 1696 +1294 1212 1218 +1294 1564 1678 +1296 844 851 +1297 549 649 +1298 1324 1438 +1298 1670 1675 +1210 2165 2171 +1211 2500 2506 +1214 2279 2284 +1227 6068 6069 +1233 2269 2273 +1233 2492 2499 +1235 2153 2270 +1248 2385 2498 +1258 2263 2378 +1267 2516 6187 +1268 2050 2166 +1268 2146 2264 +1268 3111 3198 +1269 1906 1907 +1272 2500 2501 +1273 2493 2604 +1277 2497 2499 +1277 2521 6306 +1280 2395 2398 +1283 2054 2171 +1283 2501 2508 +1292 2401 2407 +1295 2800 2898 +1299 3034 3125 +1201 5258 5379 +1203 4902 5014 +1204 5256 5258 +1207 5248 5249 +1209 4595 4698 +1213 5242 5362 +1214 4704 4705 +1214 4784 4897 +1216 5131 5133 +1220 4367 4464 +1222 5359 5360 +1231 5467 5475 +1232 5244 5361 +1234 4373 4470 +1234 5500 5501 +1235 4168 4255 +1239 5490 5613 +1244 5129 5247 +1254 5607 5608 +1255 5131 5136 +1260 4261 4262 +1262 5124 5241 +1262 5260 5262 +1271 5611 5612 +1272 5124 5129 +1273 5120 5241 +1281 5128 5129 +1282 5020 5027 +1283 5264 5265 +1286 5262 5267 +1293 4370 4467 +1296 4363 4364 +1299 4711 4816 +1202 5957 5958 +1203 5723 5728 +1214 5969 5971 +1215 6329 6437 +1217 5837 5842 +1220 5730 5848 +1221 5610 5731 +1221 5853 5854 +1227 5957 5959 +1227 6068 6069 +1228 6684 6791 +1230 6379 6386 +1230 6477 6590 +1230 6902 6909 +1236 5849 5851 +1239 5490 5613 +1243 5729 5736 +1245 6077 6078 +1253 5610 5734 +1257 5609 5723 +1265 5963 6083 +1267 2516 6187 +1271 5611 5612 +1273 5956 5959 +1278 5745 5858 +1278 5863 5866 +1279 5962 5965 +1279 6079 6082 +1279 6262 6269 +1281 6690 6797 +1284 5840 5847 +1285 6992 7088 +1288 5966 5967 +1288 6584 6591 +1288 6579 6689 +1290 6090 6202 +1293 6780 6884 +1296 5721 5840 +1297 5597 5598 +1297 5853 5857 +1300 5745 5749 +1302 1235 1236 +1303 1455 1573 +1304 1222 1333 +1311 1678 1679 +1313 1210 1216 +1324 548 555 +1328 1796 1797 +1329 1329 1439 +1331 1670 1671 +1341 1210 1213 +1342 1584 1700 +1344 1678 1680 +1356 4995 5109 +1361 1801 1804 +1366 1807 1808 +1367 459 554 +1374 1314 1424 +1374 1287 1403 +1376 1215 1322 +1377 750 856 +1382 1328 1330 +1388 647 749 +1395 1096 1207 +1399 1330 1445 +1307 2689 2790 +1308 2497 2612 +1315 2154 2156 +1316 2521 6188 +1318 2171 2173 +1320 2264 2267 +1325 2695 2796 +1326 2898 2899 +1328 3028 3119 +1329 2799 2800 +1331 3138 3225 +1332 2908 3003 +1334 2045 2048 +1334 2045 2047 +1337 2500 2503 +1338 2161 2277 +1343 2261 2380 +1343 2910 2911 +1349 2045 2051 +1352 2264 2270 +1353 1922 2042 +1353 2565 2566 +1356 2454 2559 +1356 2676 2677 +1358 1917 1918 +1358 2803 2901 +1360 2057 2172 +1364 2577 2578 +1366 2815 2913 +1370 3131 3132 +1374 2707 2808 +1384 2229 2230 +1397 3031 3122 +1399 2162 2274 +1302 4473 4474 +1304 5370 5493 +1305 4364 4461 +1307 4271 4363 +1308 4990 4995 +1310 5263 5270 +1311 4592 4695 +1316 5122 5129 +1316 5133 5136 +1317 5072 5182 +1317 5256 5261 +1318 4274 4366 +1320 4701 4702 +1320 4828 4829 +1321 5375 5493 +1325 4480 4579 +1326 5489 5490 +1330 5241 5242 +1330 5374 5375 +1333 4717 4822 +1333 5024 5141 +1350 4364 4368 +1352 4262 4360 +1355 4363 4368 +1356 4995 5109 +1357 4585 4586 +1362 5370 5373 +1367 5496 5613 +1369 4155 4156 +1369 5239 5241 +1375 5473 5480 +1375 5617 5622 +1376 4708 4813 +1377 4835 4942 +1380 4585 4695 +1388 5132 5138 +1389 4162 4249 +1389 4265 4357 +1393 5241 5247 +1398 5107 5114 +1309 6327 6330 +1310 5898 6017 +1314 6578 6585 +1319 5725 5848 +1321 5717 5718 +1324 5739 5745 +1333 6208 6209 +1341 6322 6437 +1343 5832 5951 +1354 5590 5595 +1363 5957 5964 +1367 5496 5613 +1368 5604 5722 +1374 5745 5866 +1375 5617 5622 +1380 5732 5852 +1380 5839 5845 +1387 5839 5956 +1388 5594 5595 +1393 5749 5866 +1395 5751 5864 +1395 6443 6444 +1401 1286 1293 +1403 1096 1205 +1404 1205 1213 +1407 554 561 +1407 1327 1328 +1410 474 569 +1411 1800 1801 +1420 1575 1576 +1422 1328 1333 +1422 1397 1404 +1426 1448 1450 +1433 1458 1573 +1448 1327 1329 +1451 1070 1077 +1454 560 567 +1454 850 857 +1463 1564 1684 +1464 1684 1687 +1467 1664 1781 +1479 1453 1458 +1481 1324 1326 +1481 1585 1588 +1486 1587 1702 +1489 1468 1471 +1497 1564 1569 +1405 2919 2920 +1407 2157 2162 +1413 2393 2399 +1418 2700 2707 +1435 3021 3022 +1436 2809 2907 +1437 2375 2380 +1442 2391 2392 +1454 2925 2926 +1461 2598 2605 +1463 2157 2164 +1465 2034 2041 +1483 2259 2265 +1483 2393 2395 +1483 2497 2502 +1493 2393 2400 +1405 5246 5250 +1434 5253 5255 +1436 5107 5115 +1449 5373 5493 +1458 5254 5374 +1470 4367 4368 +1476 5467 5469 +1476 5372 5491 +1483 4899 4902 +1485 5116 5123 +1493 5263 5264 +1496 4790 4903 +1499 4707 4708 +1409 5743 5861 +1415 6333 6445 +1419 5616 5737 +1421 5742 5855 +1422 5970 6088 +1434 6367 6374 +1435 6330 6445 +1441 5739 5858 +1451 5856 5969 +1456 5618 5740 +1459 5624 5744 +1459 5739 5852 +1460 5731 5851 +1469 5971 5974 +1473 6356 6470 +1480 5999 6006 +1484 5993 6000 +1486 5840 5842 +1491 5737 5740 +1492 5844 5957 +1496 5871 5984 +1498 5732 5737 +1500 5829 5833 +1502 1450 1451 +1514 1227 1334 +1514 1324 1329 +1515 1464 1465 +1518 1085 1086 +1518 1448 1453 +1532 1085 1087 +1537 1081 1084 +1537 1552 1672 +1543 1093 1096 +1546 1693 1808 +1551 1800 1911 +1556 973 1087 +1559 1676 1683 +1563 1096 1101 +1563 1329 1444 +1566 1086 1087 +1571 1101 1208 +1576 1090 1093 +1576 1466 5108 +1577 985 1099 +1580 1094 1101 +1581 1085 1199 +1583 974 975 +1587 1082 1084 +1600 983 990 +1505 2379 2380 +1506 2049 2056 +1512 3128 3129 +1516 2383 2385 +1519 2700 2701 +1521 2155 2271 +1526 2384 2391 +1532 2606 2609 +1534 2156 2270 +1535 2402 5949 +1536 2170 2286 +1537 2053 2169 +1538 2036 2039 +1539 2507 2508 +1551 1800 1911 +1553 2604 2606 +1555 2498 2500 +1560 2931 2932 +1561 2599 2709 +1562 2035 2041 +1568 2713 2814 +1571 2389 2500 +1577 2694 2701 +1597 2383 2492 +1598 2701 2808 +1503 5491 5493 +1505 5260 5380 +1510 5013 5127 +1526 4889 4999 +1530 5376 5491 +1531 5118 5124 +1532 5142 5259 +1536 4897 4904 +1548 5131 5138 +1550 5246 5367 +1553 4706 4708 +1566 5136 5142 +1571 5371 5379 +1576 1466 5108 +1579 5165 5278 +1580 5352 5475 +1580 5382 5385 +1582 5478 5483 +1501 5977 6094 +1506 6005 6012 +1515 5869 5872 +1526 5954 5959 +1535 2402 5949 +1536 5842 5845 +1537 5871 5991 +1543 5766 5885 +1548 5965 5967 +1550 5849 5856 +1576 5632 5633 +1585 5875 5992 +1590 5844 5850 +1590 6244 6251 +1595 5742 5861 +1595 5990 5991 +1596 5748 5861 +1605 1207 1208 +1614 1235 1237 +1618 1088 1090 +1621 1210 1215 +1652 1088 1095 +1652 1330 1332 +1653 979 981 +1665 1208 1210 +1668 1092 1205 +1672 876 988 +1689 1683 1799 +1700 1451 1453 +1605 2256 2261 +1613 2045 2165 +1625 2155 2272 +1629 2389 2498 +1632 2038 2039 +1644 2381 2388 +1654 2493 2606 +1660 2144 2261 +1660 2279 2392 +1679 2278 2279 +1683 2151 2159 +1689 2254 2255 +1700 2261 2264 +1609 5136 5139 +1612 4789 4796 +1620 5123 5124 +1622 5232 5234 +1645 5237 5355 +1646 4902 5022 +1675 5255 5373 +1679 4905 4908 +1693 5255 5256 +1695 4889 4890 +1609 5621 5735 +1620 5750 5752 +1631 6074 6082 +1632 6098 6099 +1633 5855 5857 +1638 5743 5866 +1639 5725 5727 +1653 5854 5856 +1667 5960 5961 +1670 5977 6092 +1672 5749 5751 +1698 5970 5971 +1699 6080 6085 +1704 979 982 +1707 1106 1108 +1746 1002 1113 +1756 1227 1339 +1759 1685 1686 +1764 1793 1800 +1765 1122 1236 +1771 866 968 +1774 1216 1333 +1779 1689 1693 +1792 1187 1188 +1702 2250 2257 +1704 2387 2394 +1716 2153 2154 +1729 2258 2261 +1744 1903 2013 +1755 2517 2622 +1757 2039 2153 +1759 2045 2050 +1762 2521 2628 +1770 2251 2366 +1772 2265 2272 +1774 2151 2153 +1780 2395 2397 +1786 1922 2036 +1793 2593 2703 +1800 2631 2632 +1702 5251 5252 +1707 5504 5510 +1710 5384 5390 +1711 5254 5256 +1715 5390 5503 +1724 5258 5371 +1726 5503 5504 +1727 5018 5134 +1728 4905 5022 +1728 5121 5124 +1739 5503 5505 +1740 4544 4647 +1759 4996 5004 +1759 5384 5503 +1765 5256 5374 +1767 4431 4432 +1767 4896 5010 +1769 4772 4886 +1778 5384 5504 +1785 5114 5115 +1787 5470 5472 +1790 5149 5150 +1790 5267 5385 +1794 5119 5121 +1795 4886 4890 +1799 5123 5241 +1704 5839 5962 +1716 6217 6218 +1722 5960 5968 +1723 6084 6085 +1726 6080 6088 +1738 6078 6195 +1738 6317 6318 +1741 5720 5725 +1753 6077 6083 +1761 6317 6321 +1763 6090 6091 +1764 6092 6094 +1765 5965 6080 +1771 5974 5975 +1776 6097 6100 +1782 5737 5742 +1789 5967 5973 +1789 6092 6097 +1796 5976 5977 +1796 6215 6325 +1806 1100 1102 +1814 1354 5109 +1825 1324 1327 +1825 1570 1685 +1829 1798 1800 +1832 1575 1685 +1834 1563 1678 +1843 1352 4994 +1844 1576 1581 +1844 1799 1801 +1849 1208 1209 +1851 1579 1582 +1856 1339 1341 +1860 1198 1203 +1860 1218 1333 +1865 1122 1237 +1868 1210 1327 +1877 1554 1670 +1892 1230 1345 +1894 1670 1678 +1898 973 976 +1900 1222 1339 +1807 6305 6306 +1814 2616 2617 +1815 2011 2017 +1816 2034 2035 +1820 2625 2632 +1824 2015 2017 +1833 2264 2266 +1833 2282 2284 +1840 2017 2018 +1841 2017 2133 +1847 2016 2017 +1848 2603 2608 +1851 2010 2018 +1857 2377 2380 +1858 2017 2135 +1859 2603 2717 +1863 2742 6308 +1869 2164 2168 +1871 2608 2717 +1871 2626 2735 +1881 2375 2382 +1890 2150 2153 +1890 2606 2607 +1898 2133 2134 +1804 5266 5268 +1805 5265 5268 +1810 5352 5357 +1813 5259 5260 +1814 1354 5109 +1814 5257 5262 +1814 5377 5379 +1821 5006 5122 +1824 4895 5010 +1831 4759 4760 +1837 5268 5271 +1843 1352 4994 +1843 5270 5271 +1848 4663 4768 +1850 5269 5276 +1850 5268 5273 +1852 5629 5634 +1867 5251 5258 +1877 4992 4995 +1881 5267 5268 +1883 5510 5631 +1884 5256 5373 +1887 5271 5274 +1888 5386 5506 +1889 5635 5636 +1894 5112 5114 +1894 5114 5233 +1803 5977 6097 +1807 6305 6306 +1811 6090 6207 +1812 5972 5974 +1814 6073 6187 +1830 6426 6430 +1833 6331 6332 +1834 6099 6211 +1836 6088 6090 +1837 6093 6094 +1846 6089 6090 +1847 6223 6224 +1848 5630 5750 +1852 5629 5634 +1857 6309 6419 +1860 5960 5965 +1860 6085 6207 +1867 6310 6318 +1872 5865 5986 +1872 5973 5974 +1872 6218 6328 +1874 6444 6448 +1875 6211 6219 +1875 6216 6219 +1880 6310 6311 +1883 5510 5631 +1889 5635 5636 +1889 6230 6340 +1894 6311 6419 +1896 6311 6427 +1897 6098 6105 +1910 1349 4991 +1915 975 1086 +1915 1115 1120 +1922 1463 1464 +1923 1350 4991 +1925 989 990 +1926 990 1094 +1938 1084 1087 +1942 1085 1090 +1942 1089 1196 +1945 1570 1575 +1946 1466 5109 +1950 1213 1215 +1979 860 962 +1980 1095 1202 +1997 1096 1208 +1999 1332 1449 +1918 2168 2282 +1921 2384 2386 +1923 2134 2252 +1923 2520 2631 +1931 2260 2376 +1932 1918 2028 +1933 2255 2374 +1936 2156 2276 +1938 2625 2627 +1939 2519 6189 +1951 2496 2607 +1951 2515 2630 +1955 6191 6307 +1959 2163 2164 +1962 2152 2270 +1967 2056 5712 +1974 2516 2518 +1975 2377 2489 +1977 2028 2035 +1988 2605 2715 +1992 2626 2736 +1994 2493 2598 +1998 2238 2245 +1906 5119 5120 +1910 1349 4991 +1910 5274 5389 +1915 5156 5275 +1920 4760 4761 +1923 1350 4991 +1925 5388 5505 +1929 5017 5024 +1929 5117 5236 +1931 4874 4992 +1931 5508 5511 +1933 5233 5235 +1937 5375 5494 +1943 5011 5012 +1946 1466 5109 +1951 5385 5505 +1953 5386 5393 +1964 5154 5274 +1967 4873 4881 +1976 5508 5513 +1980 5113 5120 +1989 5266 5273 +1991 4886 4996 +1994 5269 5270 +1995 5371 5373 +1904 6434 6441 +1905 6339 6451 +1906 6222 6225 +1906 6445 6446 +1910 5719 5724 +1922 5985 6104 +1924 6085 6090 +1925 6325 6332 +1935 6448 6559 +1937 5867 5868 +1937 6107 6109 +1948 6217 6222 +1955 6191 6307 +1956 5959 5961 +1962 6081 6082 +1965 6456 6563 +1966 6236 6346 +1966 6310 6315 +1979 5730 5849 +1979 6446 6447 +1985 6228 6231 +2002 984 990 +2009 1216 1325 +2019 984 1088 +2024 1081 1195 +2025 1091 1092 +2038 1080 1081 +2039 1078 1189 +2046 1565 1570 +2047 864 970 +2048 752 753 +2057 1079 1080 +2062 1329 1445 +2064 968 976 +2070 1331 1338 +2075 1802 1804 +2076 1073 1074 +2083 974 979 +2088 980 981 +2098 1224 1331 +2014 2389 2394 +2015 2601 2608 +2017 2255 2371 +2017 2379 2494 +2022 2711 2714 +2026 2609 2612 +2034 2709 2716 +2038 2249 2368 +2044 2140 2144 +2044 2156 2271 +2052 2251 2368 +2054 2613 2615 +2056 2282 2398 +2056 2710 2817 +2058 2155 2270 +2059 2489 2495 +2060 2369 2371 +2063 2379 2486 +2067 2028 2034 +2074 2486 2487 +2074 2496 2497 +2086 2491 2494 +2088 2371 2374 +2092 2260 2375 +2092 2374 2375 +2100 2390 2391 +2004 5277 5280 +2006 5386 5392 +2007 5014 5015 +2008 5382 5384 +2021 5138 5259 +2023 5259 5262 +2027 5269 5274 +2027 5490 5493 +2030 5155 5162 +2033 5122 5128 +2040 5378 5379 +2043 5009 5119 +2046 5271 5272 +2061 5277 5279 +2064 5268 5391 +2073 4996 5003 +2074 5162 5163 +2076 5160 5283 +2080 5274 5277 +2089 5233 5234 +2094 4993 5000 +2098 5268 5385 +2014 5850 5969 +2016 6203 6318 +2018 6557 6558 +2021 5849 5854 +2028 5721 5842 +2032 5729 5849 +2034 6449 6450 +2045 5731 5854 +2060 6203 6204 +2070 6663 6764 +2090 6559 6560 +2098 5730 5736 +2099 6210 6325 +2099 6327 6329 +2102 1082 1083 +2105 1330 1450 +2114 1093 1094 +2129 971 976 +2132 1088 1093 +2138 1336 1338 +2159 863 864 +2162 1067 1068 +2166 977 978 +2168 759 859 +2173 861 864 +2173 1076 1078 +2188 869 971 +2198 861 867 +2199 1090 1095 +2103 2704 2811 +2105 2602 2712 +2106 2285 2398 +2107 2503 2615 +2108 2607 2612 +2114 2259 2261 +2117 2368 2369 +2123 2615 2618 +2128 2282 2285 +2129 2255 2369 +2130 2377 2382 +2135 2706 2713 +2136 2382 2495 +2136 2611 2721 +2156 2150 2264 +2159 2255 2368 +2172 2604 2605 +2182 2805 2812 +2195 2708 2819 +2196 2811 2817 +2199 2262 2264 +2103 5153 5272 +2108 5045 5161 +2109 4878 4993 +2110 5278 5285 +2111 5256 5379 +2112 5160 5275 +2113 5161 5162 +2118 5629 5636 +2121 4648 4759 +2121 5044 5051 +2139 5159 5277 +2148 5163 5166 +2156 5273 5392 +2159 5386 5388 +2165 5168 5281 +2176 5166 5169 +2179 5158 5278 +2180 4907 5023 +2185 4794 4911 +2196 5164 5166 +2198 4880 4998 +2114 6353 6461 +2118 5629 5636 +2123 6079 6201 +2125 6327 6332 +2130 6454 6565 +2131 5610 5726 +2137 6564 6668 +2150 6569 6570 +2154 6558 6559 +2158 6234 6237 +2162 5846 5848 +2168 5882 5883 +2172 6322 6324 +2177 6453 6560 +2177 6558 6564 +2184 5964 5965 +2184 6202 6207 +2187 6199 6201 +2187 6562 6670 +2192 6203 6209 +2194 6557 6564 +2196 6207 6209 +2197 6685 6796 +2203 1803 1920 +2206 981 1091 +2211 62 63 +2220 757 861 +2223 860 861 +2223 1079 1086 +2228 1088 1094 +2231 976 978 +2233 859 866 +2233 1095 1207 +2238 419 420 +2239 1321 1327 +2240 1074 1075 +2251 335 419 +2257 413 414 +2258 757 859 +2262 751 754 +2266 1073 1080 +2267 420 509 +2270 145 146 +2271 1319 1327 +2273 414 503 +2273 650 746 +2274 329 413 +2274 979 1093 +2275 328 329 +2275 1797 1914 +2278 1322 1327 +2290 648 650 +2294 753 853 +2202 2265 2267 +2203 1803 1920 +2206 2811 2818 +2207 2621 2729 +2227 2377 2494 +2230 2814 2819 +2234 2602 2713 +2236 2360 2367 +2240 2033 2150 +2243 2609 2723 +2244 2813 2816 +2254 2806 2910 +2256 2361 2474 +2261 2812 2816 +2263 1918 2036 +2265 1916 2030 +2271 2817 2818 +2275 1797 1914 +2281 2373 2379 +2285 2609 2614 +2288 2810 2918 +2291 2148 2150 +2294 2145 2150 +2295 2383 2388 +2201 5159 5278 +2214 5165 5166 +2214 5373 5376 +2224 5165 5284 +2230 5000 5115 +2233 5154 5277 +2234 5465 5578 +2235 5007 5121 +2235 5504 5508 +2238 5168 5287 +2244 5578 5580 +2247 5165 5283 +2247 5168 5289 +2253 4906 4913 +2253 5464 5465 +2254 5273 5391 +2255 4438 4543 +2268 4995 5000 +2273 4990 4991 +2273 5268 5383 +2276 4875 4877 +2280 5003 5113 +2285 5162 5281 +2295 5160 5278 +2297 5173 5180 +2212 6445 6448 +2220 6209 6210 +2226 6080 6082 +2231 6582 6686 +2232 6448 6560 +2232 6568 6571 +2248 5705 5825 +2248 6562 6671 +2261 6580 6582 +2262 6688 6691 +2263 6205 6206 +2265 6575 6576 +2273 6676 6679 +2276 6574 6682 +2277 6557 6559 +2284 5730 5731 +2285 6562 6567 +2286 6582 6694 +2289 6202 6203 +2295 6325 6330 +2296 6451 6565 +2302 1075 1078 +2304 324 327 +2305 859 867 +2307 1092 1207 +2309 1210 1212 +2310 975 1085 +2312 1072 1075 +2317 752 859 +2325 746 751 +2326 1072 1189 +2328 330 418 +2331 1072 1078 +2336 1326 1444 +2340 1576 1688 +2346 757 867 +2348 325 326 +2354 1658 1665 +2355 864 867 +2355 1087 1089 +2356 421 424 +2359 326 410 +2360 1067 1074 +2363 247 325 +2365 756 856 +2371 418 420 +2385 416 417 +2386 420 421 +2396 864 866 +2397 521 522 +2398 975 1079 +2301 3570 3572 +2303 2733 2740 +2303 2814 2821 +2306 2810 2816 +2307 2904 2911 +2315 2261 2266 +2315 2382 2388 +2315 2824 2922 +2325 2922 2930 +2328 2816 2918 +2336 2256 2257 +2340 2804 2912 +2343 3606 3613 +2344 2494 2497 +2352 2147 2150 +2353 2929 3024 +2359 2918 2921 +2373 1942 1948 +2375 2366 2372 +2379 2383 2389 +2383 2264 2265 +2383 2700 2808 +2385 2494 2495 +2389 1942 1947 +2392 1942 1946 +2392 2273 2386 +2395 2267 2272 +2396 2918 2920 +2397 3500 3505 +2398 1948 2064 +2400 2703 2709 +2304 4764 4881 +2304 5167 5174 +2307 5141 5260 +2311 5172 5289 +2323 5170 5171 +2335 5608 5609 +2340 5001 5116 +2346 5287 5288 +2362 5118 5236 +2364 5172 5295 +2365 5372 5485 +2371 5463 5465 +2383 5458 5465 +2384 5276 5277 +2385 5054 5171 +2392 5154 5271 +2395 5290 5297 +2397 4790 4796 +2399 5459 5465 +2304 6329 6443 +2306 6204 6319 +2309 6680 6681 +2319 6204 6321 +2322 6567 6671 +2328 6447 6448 +2335 5608 5609 +2337 7478 7479 +2339 6676 6784 +2344 6332 6440 +2349 6443 6445 +2350 6675 6776 +2351 6448 6450 +2351 6568 6682 +2354 2057 5830 +2361 6570 6574 +2373 7289 7361 +2376 6447 6560 +2378 6444 6557 +2379 6322 6327 +2380 6580 6688 +2390 6077 6082 +2393 6449 6563 +2393 6673 6676 +2396 6680 6685 +2400 6206 6210 +2404 1334 1336 +2410 862 863 +2424 427 520 +2453 421 514 +2456 527 528 +2457 324 412 +2459 861 862 +2464 1181 1188 +2477 749 750 +2488 1183 1186 +2493 326 330 +2497 748 749 +2497 753 754 +2497 1205 1206 +2407 2257 2366 +2408 3430 3500 +2413 3505 3568 +2421 2909 3014 +2422 2496 2608 +2423 2383 2500 +2423 3484 3546 +2439 2468 2475 +2444 3599 3600 +2449 3341 3343 +2451 1954 2064 +2452 2703 2710 +2457 1831 1946 +2464 2711 2712 +2479 3478 3546 +2482 2263 2267 +2483 3702 7498 +2485 2708 2713 +2494 2711 2713 +2413 5272 5279 +2418 5175 5295 +2426 5578 5583 +2434 4684 4795 +2434 5175 5178 +2435 5155 5161 +2435 5272 5274 +2437 5334 5452 +2444 5141 5259 +2451 5452 5459 +2460 4794 4799 +2467 5164 5171 +2469 5451 5452 +2480 5453 5566 +2482 5290 5291 +2482 5605 5613 +2494 4905 4906 +2496 4906 4912 +2499 5127 5129 +2500 5049 5169 +2403 6450 6565 +2408 6674 6680 +2412 6082 6083 +2412 6554 6560 +2434 6329 6445 +2434 6679 6784 +2439 6573 6677 +2444 7144 7230 +2445 6561 6665 +2449 7252 7253 +2451 5833 5956 +2452 6557 6565 +2455 6206 6322 +2461 5592 5711 +2461 7144 7145 +2462 6450 6557 +2463 6668 6675 +2467 6680 6682 +2468 6562 6568 +2468 7221 7222 +2477 7379 7380 +2478 7204 7282 +2478 7416 7472 +2479 7253 7325 +2480 6640 6642 +2482 5605 5613 +2482 6668 6676 +2496 7434 7490 +2502 523 526 +2504 1182 1295 +2512 331 332 +2513 979 984 +2519 648 651 +2535 1199 1205 +2543 425 426 +2544 432 521 +2546 1235 4874 +2556 1074 1187 +2560 864 976 +2562 507 601 +2563 426 520 +2565 427 523 +2568 1079 1084 +2569 644 740 +2573 424 426 +2578 1379 1380 +2582 1092 1096 +2587 751 756 +2594 1573 1574 +2600 648 754 +2513 3702 3703 +2518 2383 2495 +2522 2599 2710 +2527 2808 2810 +2531 2812 2916 +2544 3506 3570 +2551 2703 2811 +2573 2603 2712 +2585 3701 3702 +2587 3504 3511 +2598 2606 2608 +2505 5452 5457 +2510 5583 5586 +2512 5447 5560 +2522 4544 4653 +2524 5446 5447 +2526 5292 5295 +2528 4789 4797 +2542 5243 5361 +2546 1235 4874 +2551 5019 5139 +2555 5119 5126 +2561 5290 5292 +2565 4684 4688 +2567 5008 5014 +2567 5446 5448 +2569 4903 4904 +2572 5440 5447 +2583 5459 5460 +2589 5446 5453 +2590 4647 4654 +2590 5289 5290 +2594 5295 5296 +2597 5445 5447 +2501 5843 5845 +2505 6532 6642 +2508 7307 7379 +2513 5860 5863 +2513 6794 6795 +2515 6562 6676 +2515 7409 7410 +2516 6669 6776 +2517 7264 7265 +2524 6316 6317 +2539 5615 5735 +2539 6554 6561 +2548 6670 6673 +2550 7475 7477 +2556 6562 6668 +2568 5717 5724 +2568 6531 6642 +2568 6782 6783 +2569 7343 7344 +2571 7414 7416 +2572 6784 6785 +2581 6776 6782 +2581 7479 7480 +2585 6321 6324 +2591 6559 6561 +2592 7345 7414 +2592 7480 7526 +2594 5855 5860 +2598 6199 6204 +2607 1289 1296 +2609 601 602 +2616 417 421 +2619 1072 1077 +2621 245 327 +2627 1730 1731 +2628 1180 1186 +2629 512 513 +2629 534 628 +2631 330 333 +2632 1183 1297 +2633 1180 1297 +2641 529 627 +2643 1077 1184 +2644 746 754 +2644 1485 1602 +2647 1731 1842 +2650 547 651 +2658 326 327 +2661 653 755 +2668 1183 1184 +2668 1291 1294 +2669 1290 1406 +2686 653 749 +2695 1731 1848 +2607 2611 2715 +2612 2386 2500 +2612 3437 3509 +2615 3600 3607 +2619 2822 2825 +2628 2497 2604 +2630 2905 3006 +2631 3257 3340 +2635 2614 2723 +2640 3540 3547 +2647 1731 1842 +2653 2822 2827 +2654 2391 2395 +2667 2492 2500 +2668 3567 3570 +2683 2815 2919 +2695 1731 1848 +2615 5460 5575 +2617 5328 5451 +2620 5440 5441 +2631 4103 4110 +2631 5281 5287 +2631 5333 5451 +2634 4462 4567 +2638 4794 4797 +2643 5018 5019 +2658 5440 5442 +2661 5434 5435 +2662 5442 5445 +2665 5260 5267 +2666 5008 5013 +2666 5330 5451 +2669 5233 5241 +2678 5459 5572 +2678 5465 5583 +2679 4902 5016 +2679 5270 5389 +2679 5292 5297 +2682 5328 5445 +2684 5147 5267 +2685 5337 5339 +2687 4682 4797 +2687 5322 5445 +2687 5327 5445 +2688 5122 5127 +2690 5460 5577 +2692 5164 5170 +2694 5324 5445 +2698 5294 5407 +2609 6787 6895 +2618 7436 7437 +2625 7320 7391 +2640 7371 7436 +2643 7435 7437 +2646 6788 6789 +2647 6782 6784 +2654 6890 6897 +2659 6330 6332 +2663 7375 7443 +2665 6781 6889 +2666 6684 6790 +2672 6638 6640 +2674 7409 7414 +2676 6082 6085 +2678 7416 7478 +2692 6638 6642 +2705 645 651 +2710 553 652 +2712 332 416 +2713 1731 1847 +2717 1072 1184 +2722 93 157 +2726 1400 1407 +2731 645 648 +2740 896 1004 +2740 1400 1401 +2744 421 512 +2744 753 757 +2745 546 646 +2748 328 330 +2748 336 424 +2749 553 657 +2750 1290 1296 +2754 422 423 +2755 634 635 +2756 112 113 +2756 429 518 +2762 325 328 +2763 1730 1737 +2767 528 622 +2769 1205 1207 +2770 113 179 +2770 1088 1089 +2771 864 869 +2775 552 651 +2775 1081 1083 +2776 1092 1093 +2786 330 336 +2787 553 649 +2791 111 181 +2791 1078 1083 +2792 1208 1213 +2798 1076 1077 +2800 1288 1408 +2703 2721 2722 +2712 2497 2607 +2714 1916 1918 +2723 2152 2153 +2737 2372 2377 +2744 2052 2057 +2750 2912 2915 +2752 3501 3508 +2793 2495 2502 +2702 5135 5254 +2708 4904 5020 +2716 4683 4690 +2717 5454 5457 +2719 5440 5445 +2728 5251 5259 +2732 5578 5579 +2737 5320 5321 +2739 4891 4898 +2742 5339 5452 +2745 5435 5554 +2748 5137 5138 +2749 5298 5415 +2755 5054 5170 +2756 4685 4688 +2756 4794 4796 +2757 4684 4796 +2759 4684 4797 +2778 5466 5583 +2779 5052 5169 +2783 5460 5462 +2786 4573 4580 +2786 5454 5456 +2787 5300 5413 +2790 5257 5258 +2796 5052 5055 +2797 4903 4910 +2798 5454 5572 +2704 6678 6785 +2707 6206 6324 +2725 7411 7414 +2731 7337 7339 +2733 6684 6785 +2747 6770 6777 +2761 6570 6674 +2763 6784 6787 +2770 6677 6678 +2770 6667 6778 +2771 6085 6202 +2776 5843 5848 +2777 7344 7414 +2788 6691 6694 +2793 7343 7350 +2799 6562 6565 +2806 1189 1192 +2810 111 113 +2810 528 629 +2818 433 526 +2820 250 328 +2821 553 555 +2822 111 114 +2825 1075 1077 +2834 1078 1081 +2841 113 187 +2854 1718 1720 +2858 642 740 +2861 556 559 +2869 640 641 +2872 554 556 +2873 1484 1491 +2874 555 556 +2874 1182 1186 +2890 556 657 +2894 463 554 +2813 2146 2150 +2855 2810 2913 +2869 2257 2374 +2898 2814 2816 +2809 5251 5256 +2809 5583 5584 +2813 5263 5268 +2818 5320 5322 +2826 5294 5415 +2828 4898 5016 +2828 5297 5410 +2837 5275 5282 +2841 5457 5460 +2846 5448 5451 +2846 5460 5465 +2848 5315 5434 +2852 5454 5571 +2852 5582 5583 +2855 4677 4683 +2864 5294 5413 +2871 5171 5290 +2875 4574 4683 +2883 5386 5391 +2884 5243 5244 +2890 5462 5583 +2801 6332 6445 +2812 7339 7342 +2814 6685 6688 +2815 7480 7485 +2832 6692 6693 +2832 6882 6976 +2836 7259 7337 +2842 6982 6983 +2844 6562 6564 +2849 5681 5801 +2849 7406 7414 +2851 6556 6561 +2866 6786 6890 +2866 7265 7266 +2868 7480 7483 +2875 6686 6688 +2876 6670 6778 +2877 7263 7265 +2889 7265 7343 +2891 6881 6889 +2893 7417 7477 +2899 7260 7265 +2901 638 734 +2904 1289 1294 +2910 1183 1185 +2911 1288 1405 +2917 463 562 +2918 1397 1402 +2919 1188 1189 +2926 1212 1213 +2927 1073 1078 +2929 647 743 +2934 1485 1600 +2937 462 557 +2937 1400 1405 +2938 157 164 +2941 1282 1402 +2943 1187 1194 +2953 1205 1210 +2968 642 648 +2969 1399 1402 +2984 1184 1186 +2988 648 748 +2990 1278 1394 +2994 1596 1712 +2994 1718 1725 +2919 2361 2476 +2922 1921 1922 +2927 2262 2263 +2938 2810 2912 +2979 2255 2366 +2985 2809 2913 +2901 4578 4691 +2905 4474 4579 +2905 5277 5278 +2907 5259 5261 +2917 5161 5166 +2921 5419 5420 +2924 5460 5583 +2936 5454 5460 +2938 5560 5567 +2944 4474 4478 +2948 5436 5439 +2950 5273 5386 +2958 5434 5439 +2959 5554 5555 +2963 5436 5554 +2965 5326 5446 +2970 5436 5553 +2973 5333 5446 +2974 5438 5439 +2980 5436 5438 +2982 5428 5435 +2989 5265 5267 +2989 5435 5548 +2993 5431 5436 +2999 5431 5439 +2909 6570 6681 +2909 6772 6775 +2909 6776 6783 +2909 7180 7258 +2922 6783 6889 +2922 7262 7265 +2928 7258 7263 +2934 6675 6784 +2943 7265 7342 +2953 6204 6206 +2954 6665 6672 +2961 6883 6886 +2964 6673 6675 +2973 7260 7336 +2975 6558 6562 +2978 6668 6673 +2981 7256 7260 +2984 6880 6886 +2989 6786 6884 +2990 5957 5962 +2993 5954 5962 +3002 1181 1186 +3005 1290 1408 +3029 1403 1404 +3030 981 1093 +3030 1182 1297 +3034 157 162 +3036 642 647 +3062 981 985 +3063 1085 1092 +3067 756 863 +3067 1723 1725 +3075 1078 1195 +3077 1597 1712 +3080 645 646 +3090 467 468 +3096 469 568 +3006 2909 3009 +3009 2806 2912 +3029 2153 2155 +3039 1800 1919 +3064 2812 2813 +3065 2914 3015 +3006 5298 5413 +3010 5318 5438 +3016 4904 5022 +3020 5452 5453 +3021 5441 5447 +3027 4904 4908 +3031 5321 5322 +3033 5130 5247 +3033 5296 5297 +3034 5241 5244 +3037 5169 5171 +3038 5431 5438 +3048 5453 5454 +3056 5327 5440 +3069 5419 5426 +3073 5166 5168 +3083 5418 5421 +3085 5256 5259 +3085 5419 5424 +3093 5306 5425 +3001 7079 7080 +3026 7339 7414 +3037 6667 6670 +3047 7083 7089 +3053 7422 7478 +3057 6764 6771 +3072 6662 6670 +3073 6881 6883 +3078 7476 7480 +3082 6886 6984 +3084 6085 6088 +3089 6982 6984 +3089 7480 7525 +3091 6884 6886 +3092 6878 6883 +3093 6667 6669 +3099 6777 6883 +3100 5839 5842 +3133 469 563 +3135 560 562 +3139 1607 1614 +3152 464 471 +3152 465 560 +3156 1723 1726 +3157 1597 1717 +3164 1080 1193 +3166 471 560 +3171 472 568 +3174 465 471 +3190 1292 1299 +3103 2709 2710 +3121 2793 2898 +3132 2904 2905 +3149 3000 3007 +3176 2804 2906 +3106 5287 5292 +3106 5421 5423 +3127 4904 4905 +3135 5421 5424 +3137 5304 5424 +3146 5420 5421 +3157 5156 5162 +3157 5295 5297 +3167 5427 5428 +3101 6780 6878 +3107 6775 6878 +3107 6882 6883 +3110 6663 6770 +3113 6878 6880 +3114 6884 6891 +3116 6775 6875 +3119 6875 6878 +3124 6987 7081 +3126 6671 6672 +3126 6880 6883 +3128 6780 6883 +3147 6877 6878 +3149 7480 7527 +3152 7477 7480 +3156 6678 6679 +3191 6986 7082 +3197 6885 6886 +3203 1289 1297 +3205 1180 1185 +3215 552 646 +3215 642 742 +3246 553 651 +3246 631 632 +3249 1290 1294 +3255 636 639 +3264 1404 1405 +3280 756 861 +3284 1520 1521 +3218 2055 2057 +3280 2034 2036 +3220 5419 5425 +3222 5310 5425 +3224 5318 5437 +3236 5266 5267 +3251 5377 5378 +3253 5304 5427 +3254 5276 5280 +3265 5431 5432 +3274 5432 5433 +3285 5312 5425 +3290 5309 5427 +3297 5298 5416 +3298 5160 5162 +3248 6981 6987 +3257 6560 6561 +3273 5837 5844 +3285 6785 6786 +3300 6769 6869 +3303 464 472 +3318 463 557 +3318 636 638 +3318 1083 1196 +3322 380 464 +3338 638 742 +3341 966 1070 +3347 1402 1404 +3366 1077 1190 +3377 469 475 +3377 1640 1647 +3380 1284 1394 +3395 1402 1519 +3397 961 1069 +3302 5592 5594 +3301 5416 5421 +3310 5271 5273 +3314 5306 5427 +3314 5428 5429 +3321 5303 5422 +3324 5310 5427 +3327 5303 5416 +3350 5310 5433 +3358 5174 5287 +3364 5312 5433 +3369 5171 5172 +3302 5592 5594 +3304 6671 6676 +3305 6976 6984 +3309 6983 6987 +3311 6882 6982 +3319 6869 6877 +3335 6769 6877 +3347 7170 7171 +3366 6987 7079 +3367 7080 7084 +3376 6881 6888 +3387 6874 6877 +3389 7080 7170 +3392 6890 6891 +3397 7172 7174 +3402 647 748 +3410 373 374 +3415 1069 1075 +3430 373 375 +3438 647 750 +3441 1399 1519 +3456 1388 1395 +3463 633 639 +3467 1277 1278 +3469 1282 1285 +3471 465 554 +3471 642 645 +3475 961 1072 +3480 535 633 +3482 1168 1279 +3419 2362 2363 +3430 5304 5422 +3456 5421 5422 +3457 5437 5438 +3409 6783 6887 +3434 7255 7256 +3454 7262 7334 +3459 6787 6790 +3459 6984 6986 +3490 6559 6562 +3496 6783 6787 +3501 1164 1271 +3518 1173 1280 +3523 1286 1287 +3527 957 1061 +3532 540 634 +3537 749 754 +3546 1291 1293 +3565 1180 1292 +3569 958 1069 +3589 955 958 +3592 531 625 +3502 2005 2115 +3507 5258 5259 +3529 5316 5439 +3562 5318 5439 +3581 5275 5276 +3597 5293 5294 +3505 6787 6789 +3511 6884 6889 +3524 5622 5624 +3541 7169 7172 +3549 5593 5594 +3561 6983 7079 +3571 6985 6986 +3598 7076 7083 +3604 1280 1286 +3608 533 634 +3639 533 534 +3655 1288 1402 +3658 1162 1271 +3665 1388 1393 +3677 642 743 +3681 1265 1382 +3685 1167 1279 +3625 5462 5575 +3634 5316 5433 +3637 5204 5323 +3646 5508 5510 +3652 5324 5443 +3697 5503 5508 +3674 5839 5844 +3711 529 532 +3718 1167 1274 +3720 1162 1273 +3728 1277 1282 +3730 950 951 +3752 1157 1158 +3759 1067 1069 +3766 527 529 +3795 641 737 +3703 5596 5598 +3714 6581 6582 +3812 1044 1151 +3816 642 748 +3840 1293 1409 +3843 643 648 +3873 1186 1189 +3878 1230 1337 +3830 5593 5600 +3812 5271 5277 +3840 5304 5421 +3827 5598 5600 +3830 5593 5600 +3903 1403 1408 +3910 957 1067 +3918 978 1082 +3960 646 651 +3965 1283 1284 +3968 958 961 +3978 646 647 +3909 5303 5421 +3967 5154 5272 +3974 5459 5578 +3981 5309 5422 +3995 5275 5280 +3979 7252 7259 +4028 1463 1468 +4040 1260 1370 +4064 1071 1072 +4070 1184 1190 +4057 2922 2923 +4038 5321 5440 +4013 7337 7344 +4023 7344 7409 +4041 5968 5970 +4047 7342 7344 +4061 7344 7415 +4129 944 945 +4131 851 958 +4154 1250 1251 +4169 1143 1250 +4171 918 1022 +4186 1138 1250 +4191 1244 1250 +4197 1072 1074 +4122 2614 2718 +4144 1818 1822 +4171 5596 5603 +4114 5434 5441 +4122 5172 5287 +4173 5434 5436 +4178 5453 5572 +4110 7174 7252 +4112 7260 7342 +4171 5596 5603 +4183 7257 7260 +4222 1250 1255 +4280 1229 1237 +4294 1233 1340 +4299 1344 1460 +4218 2139 2140 +4244 2140 2250 +4255 2010 2011 +4202 5171 5289 +4209 5572 5577 +4221 5448 5566 +4242 5178 5295 +4254 5415 5417 +4262 5297 5298 +4280 5417 5418 +4289 5177 5295 +4292 5445 5446 +4211 7413 7477 +4216 7416 7477 +4239 6328 6335 +4245 7409 7416 +4263 7411 7416 +4269 7472 7477 +4272 7417 7475 +4296 7483 7485 +4307 1003 1109 +4317 1149 1256 +4325 1265 1266 +4329 1256 1257 +4336 1137 1244 +4347 999 1109 +4359 1189 1190 +4360 1116 1120 +4365 1228 1339 +4393 1265 1273 +4349 2055 5591 +4377 6078 6079 +4386 2822 2922 +4376 5425 5433 +4381 5442 5447 +4392 5430 5433 +4301 7417 7422 +4304 7416 7417 +4343 7260 7263 +4356 6787 6887 +4367 6578 6689 +4377 6078 6079 +4385 7341 7406 +4425 1224 1230 +4431 1265 1270 +4484 2138 2253 +4427 5439 5442 +4433 5298 5421 +4444 4878 4880 +4449 5433 5553 +4455 4877 4878 +4457 4878 4990 +4464 4880 4883 +4473 4880 4881 +4499 5444 5557 +4452 7413 7469 +4566 1035 1142 +4547 5450 5563 +4614 1136 1137 +4666 1023 1130 +4623 2920 3021 +4626 1887 1888 +4655 1818 1935 +4656 2137 2247 +4665 1770 1881 +4626 5428 5430 +4666 5439 5559 +4703 2808 2815 +4729 1894 2004 +4731 2135 2137 +4750 1897 2007 +4775 1891 2001 +4701 5444 5448 +4731 5456 5569 +4752 5448 5453 +4758 5454 5569 +4733 7082 7089 +4736 6676 6678 +4819 2397 2504 +4822 1886 1891 +4844 2013 2014 +4854 1891 2006 +4825 5444 5563 +4895 5450 5569 +4819 6985 6992 +4957 1532 1533 +4959 1579 1580 +4991 1469 1470 +5003 461 468 +5019 524 525 +5019 1082 1087 +5042 955 960 +5008 5615 5729 +5041 7349 7350 +5046 7258 7265 +5112 960 1064 +5115 846 952 +5145 650 753 +5180 1284 1400 +5183 1398 1514 +5188 973 975 +5197 851 953 +5127 1799 1805 +5167 1937 1940 +5223 518 524 +5226 836 938 +5228 646 648 +5265 1515 1631 +5272 862 864 +5290 421 426 +5257 3001 3098 +5231 6991 6998 +5319 537 631 +5320 1396 1399 +5321 1284 1285 +5336 524 529 +5340 543 643 +5342 530 531 +5360 644 748 +5392 975 976 +5372 5054 5164 +5392 5047 5054 +5401 524 526 +5403 419 424 +5410 429 526 +5410 974 981 +5425 1085 1093 +5431 638 740 +5470 648 653 +5490 973 978 +5447 5272 5277 +5427 6893 6894 +5453 6981 7081 +5523 631 636 +5582 524 531 +5583 427 518 +5503 5585 5698 +5555 4936 4937 +5566 4934 5050 +5573 5052 5053 +5586 5203 5210 +5504 6698 6699 +5563 6984 6987 +5602 631 638 +5607 423 512 +5627 427 432 +5644 427 521 +5646 427 526 +5646 4820 4933 +5673 4933 4934 +5697 5586 5701 +5704 529 531 +5733 416 512 +5740 1920 1921 +5716 4934 4938 +5764 5096 5212 +5772 5212 5219 +5776 5089 5096 +5789 5094 5096 +5800 5212 5214 +5850 535 538 +5853 526 527 +5859 1799 1804 +5802 5091 5096 +5814 5096 5102 +5816 5049 5054 +5862 5101 5106 +5865 5206 5213 +5887 6878 6885 +5901 431 432 +5932 633 634 +5970 341 432 +5992 529 534 +5932 5102 5218 +5966 5103 5223 +6089 2051 2166 +6092 5217 5220 +6574 418 419 +6597 4707 4714 +6640 334 335 +6664 4701 4708 +6773 4713 4720 +6791 4477 4582 +6753 5984 5991 +6773 5991 6110 +6845 534 635 +6812 4689 4696 +6824 4576 4583 +6828 4476 4483 +6854 4586 4695 +6953 6882 6886 +7017 522 616 +7051 2397 2401 +7009 7262 7340 +7033 5865 5866 +7050 6984 6985 +7092 5608 5615 +7114 1282 1399 +7170 5852 5860 +7249 426 427 +7296 979 1087 +7247 5864 5871 +7399 2401 2406 +7387 5048 5054 +7448 1406 1407 +7427 2400 2406 +7443 2406 2518 +7442 4938 5052 +7496 4823 4930 diff --git a/examples/bpm/impact/in.bpm.impact.rotational b/examples/bpm/impact/in.bpm.impact.rotational new file mode 100644 index 0000000000..698fa22fb8 --- /dev/null +++ b/examples/bpm/impact/in.bpm.impact.rotational @@ -0,0 +1,51 @@ +units lj +dimension 3 +boundary f f f +atom_style bpm/sphere +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +newton on off +comm_modify vel yes cutoff 2.6 +lattice fcc 1.0 +region box block -25 15 -22 22 -22 22 +create_box 1 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 + +region disk cylinder x 0.0 0.0 20.0 -0.5 0.5 +create_atoms 1 region disk +group plate region disk + +region ball sphere 8.0 0.0 0.0 6.0 +create_atoms 1 region ball +group projectile region ball + +displace_atoms all random 0.1 0.1 0.1 134598738 + +neighbor 1.0 bin +pair_style gran/hooke/history 1.0 NULL 0.5 NULL 0.1 1 +pair_coeff 1 1 + +fix 1 all nve/bpm/sphere + +create_bonds many plate plate 1 0.0 1.5 +create_bonds many projectile projectile 2 0.0 1.5 + +neighbor 0.3 bin +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style bpm/rotational store/local brkbond 100 time id1 id2 +bond_coeff 1 1.0 0.2 0.02 0.02 0.05 0.01 0.01 0.01 0.1 0.2 0.002 0.002 +bond_coeff 2 1.0 0.2 0.02 0.02 0.20 0.04 0.04 0.04 0.1 0.2 0.002 0.002 + +velocity projectile set -0.05 0.0 0.0 +compute nbond all nbond/atom +compute tbond all reduce sum c_nbond + +timestep 0.05 +thermo_style custom step ke pe pxx pyy pzz c_tbond +thermo 100 +thermo_modify lost ignore lost/bond ignore +#dump 1 all custom 100 atomDump id radius x y z c_nbond + +dump 2 all local 100 brokenDump f_brkbond[1] f_brkbond[2] f_brkbond[3] +dump_modify 2 header no + +run 7500 diff --git a/examples/bpm/impact/in.bpm.impact.spring b/examples/bpm/impact/in.bpm.impact.spring new file mode 100644 index 0000000000..7c5c56841b --- /dev/null +++ b/examples/bpm/impact/in.bpm.impact.spring @@ -0,0 +1,53 @@ +units lj +dimension 3 +boundary f f f +atom_style bond +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +newton on off +comm_modify vel yes cutoff 2.6 +lattice fcc 1.0 +region box block -25 15 -22 22 -22 22 +create_box 1 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 + +region disk cylinder x 0.0 0.0 20.0 -0.5 0.5 +create_atoms 1 region disk +group plate region disk + +region ball sphere 8.0 0.0 0.0 6.0 +create_atoms 1 region ball +group projectile region ball + +displace_atoms all random 0.1 0.1 0.1 134598738 + +mass 1 1.0 + +neighbor 1.0 bin +pair_style bpm/spring +pair_coeff 1 1 1.0 1.0 1.0 + +fix 1 all nve + +create_bonds many plate plate 1 0.0 1.5 +create_bonds many projectile projectile 2 0.0 1.5 + +neighbor 0.3 bin +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style bpm/spring store/local brkbond 100 time id1 id2 +bond_coeff 1 1.0 0.04 1.0 +bond_coeff 2 1.0 0.20 1.0 + +velocity projectile set -0.05 0.0 0.0 +compute nbond all nbond/atom +compute tbond all reduce sum c_nbond + +timestep 0.1 +thermo_style custom step ke pe pxx pyy pzz c_tbond +thermo 100 +thermo_modify lost ignore lost/bond ignore +#dump 1 all custom 100 atomDump id x y z c_nbond + +dump 2 all local 100 brokenDump f_brkbond[1] f_brkbond[2] f_brkbond[3] +dump_modify 2 header no + +run 7500 diff --git a/examples/bpm/impact/log.17Feb2022.impact.rotational.g++.4 b/examples/bpm/impact/log.17Feb2022.impact.rotational.g++.4 new file mode 100644 index 0000000000..b76854d5d9 --- /dev/null +++ b/examples/bpm/impact/log.17Feb2022.impact.rotational.g++.4 @@ -0,0 +1,219 @@ +LAMMPS (17 Feb 2022) +units lj +dimension 3 +boundary f f f +atom_style bpm/sphere +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +newton on off +comm_modify vel yes cutoff 2.6 +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block -25 15 -22 22 -22 22 +create_box 1 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 +Created orthogonal box = (-39.685026 -34.922823 -34.922823) to (23.811016 34.922823 34.922823) + 1 by 2 by 2 MPI processor grid + +region disk cylinder x 0.0 0.0 20.0 -0.5 0.5 +create_atoms 1 region disk +Created 7529 atoms + using lattice units in orthogonal box = (-39.685026 -34.922823 -34.922823) to (23.811016 34.922823 34.922823) + create_atoms CPU = 0.002 seconds +group plate region disk +7529 atoms in group plate + +region ball sphere 8.0 0.0 0.0 6.0 +create_atoms 1 region ball +Created 3589 atoms + using lattice units in orthogonal box = (-39.685026 -34.922823 -34.922823) to (23.811016 34.922823 34.922823) + create_atoms CPU = 0.001 seconds +group projectile region ball +3589 atoms in group projectile + +displace_atoms all random 0.1 0.1 0.1 134598738 +Displacing atoms ... + +neighbor 1.0 bin +pair_style gran/hooke/history 1.0 NULL 0.5 NULL 0.1 1 +pair_coeff 1 1 + +fix 1 all nve/bpm/sphere + +create_bonds many plate plate 1 0.0 1.5 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2 + ghost atom cutoff = 2.6 + binsize = 1, bins = 64 70 70 + 2 neighbor lists, perpetual/occasional/extra = 1 1 0 + (1) command create_bonds, occasional + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair gran/hooke/history, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Added 38559 bonds, new total = 38559 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 15 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.001 seconds +create_bonds many projectile projectile 2 0.0 1.5 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +WARNING: Bonds are defined but no bond style is set (../force.cpp:192) +WARNING: Likewise 1-2 special neighbor interactions != 1.0 (../force.cpp:194) +Added 21869 bonds, new total = 60428 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 16 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.001 seconds + +neighbor 0.3 bin +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style bpm/rotational store/local brkbond 100 time id1 id2 +bond_coeff 1 1.0 0.2 0.02 0.02 0.05 0.01 0.01 0.01 0.1 0.2 0.002 0.002 +bond_coeff 2 1.0 0.2 0.02 0.02 0.20 0.04 0.04 0.04 0.1 0.2 0.002 0.002 + +velocity projectile set -0.05 0.0 0.0 +compute nbond all nbond/atom +compute tbond all reduce sum c_nbond + +timestep 0.05 +thermo_style custom step ke pe pxx pyy pzz c_tbond +thermo 100 +thermo_modify lost ignore lost/bond ignore +#dump 1 all custom 100 atomDump id radius x y z c_nbond + +dump 2 all local 100 brokenDump f_brkbond[1] f_brkbond[2] f_brkbond[3] +dump_modify 2 header no + +run 7500 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 2.6 + binsize = 0.65, bins = 98 108 108 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hooke/history, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 33.34 | 33.34 | 33.35 Mbytes +Step KinEng PotEng Pxx Pyy Pzz c_tbond + 0 0.00053238861 0 3.8217307e-05 0 0 10.8703 + 100 0.00053238861 0 3.8217307e-05 1.2166373e-20 1.2308212e-20 10.8703 + 200 0.00053238861 0 3.8217307e-05 1.2454467e-20 1.2479589e-20 10.8703 + 300 0.00053238861 0 3.8217307e-05 1.2256702e-20 1.2621091e-20 10.8703 + 400 0.00053238861 0 3.8217307e-05 1.2170534e-20 1.2751666e-20 10.8703 + 500 0.00053093549 0 3.8484194e-05 7.645531e-08 1.4861825e-07 10.8703 + 600 0.00051485902 0 4.0340751e-05 3.8615876e-07 4.8663463e-07 10.869221 + 700 0.00049942978 0 3.8684008e-05 4.5363318e-07 4.4560229e-07 10.85501 + 800 0.00049465262 0 3.6604612e-05 1.4755468e-07 2.0062093e-07 10.820651 + 900 0.00048784775 0 3.5333139e-05 3.5118328e-07 6.6697625e-07 10.769563 + 1000 0.00048345699 0 3.4702137e-05 7.0312998e-07 4.0218318e-07 10.730347 + 1100 0.00047945073 0 3.5065961e-05 6.2813891e-07 7.4640359e-07 10.703184 + 1200 0.00047512604 0 3.4833144e-05 8.5208604e-07 8.7277583e-07 10.686634 + 1300 0.00047401428 0 3.4236869e-05 1.0321827e-06 7.4545242e-07 10.678 + 1400 0.00047619121 0 3.4416549e-05 8.7518021e-07 7.3979503e-07 10.671704 + 1500 0.0004668728 0 3.4495751e-05 1.4077823e-06 1.517373e-06 10.666127 + 1600 0.00045088371 0 3.3264301e-05 1.8499661e-06 1.9842415e-06 10.66073 + 1700 0.00044275099 0 3.2471064e-05 1.9028747e-06 2.2248947e-06 10.6458 + 1800 0.0004424362 0 3.1846336e-05 1.6208492e-06 1.9291602e-06 10.620615 + 1900 0.00043678957 0 3.1260936e-05 1.4673956e-06 1.6120523e-06 10.603166 + 2000 0.00042747562 0 3.0652107e-05 1.6455486e-06 1.53127e-06 10.576003 + 2100 0.0004214344 0 3.0240727e-05 1.8873967e-06 1.5258622e-06 10.539845 + 2200 0.00041712779 0 3.0329566e-05 1.8846152e-06 1.4971471e-06 10.49937 + 2300 0.00041095769 0 3.0000572e-05 2.3585924e-06 1.6773177e-06 10.471668 + 2400 0.00040883568 0 2.9625158e-05 1.9105554e-06 1.8720763e-06 10.45116 + 2500 0.00040762685 0 2.9441541e-05 1.6848938e-06 1.8877532e-06 10.437309 + 2600 0.00040579873 0 2.9255988e-05 1.7523874e-06 1.636423e-06 10.422378 + 2700 0.00040340975 0 2.9035693e-05 1.673158e-06 1.9038932e-06 10.410505 + 2800 0.00040170914 0 2.8829361e-05 1.6711978e-06 1.9776001e-06 10.400792 + 2900 0.00040015113 0 2.8614186e-05 1.5982427e-06 1.7994733e-06 10.393416 + 3000 0.00040029253 0 2.8470718e-05 1.5589166e-06 1.6682302e-06 10.385321 + 3100 0.00040037329 0 2.8483376e-05 1.2831526e-06 1.4788005e-06 10.378485 + 3200 0.00040142612 0 2.8481287e-05 1.1577988e-06 1.3495778e-06 10.373988 + 3300 0.00040105092 0 2.8547009e-05 1.2155138e-06 1.2633439e-06 10.370031 + 3400 0.00039950673 0 2.8340939e-05 1.1182251e-06 1.1624668e-06 10.364274 + 3500 0.00039715236 0 2.824813e-05 1.3086462e-06 1.2029185e-06 10.360496 + 3600 0.00039446552 0 2.8112283e-05 1.1232321e-06 1.0077217e-06 10.353121 + 3700 0.00039263296 0 2.7927975e-05 1.1083636e-06 1.2091857e-06 10.346645 + 3800 0.00039061341 0 2.7819957e-05 1.1836841e-06 1.3566272e-06 10.341069 + 3900 0.00038985051 0 2.7681947e-05 1.3588359e-06 1.4099727e-06 10.329196 + 4000 0.00038815347 0 2.7492102e-05 1.1111719e-06 1.1700718e-06 10.318043 + 4100 0.00038651302 0 2.7444105e-05 9.9563429e-07 1.4085969e-06 10.311027 + 4200 0.00038565809 0 2.7177341e-05 9.5736307e-07 1.0404482e-06 10.299155 + 4300 0.0003847255 0 2.7029216e-05 9.6204756e-07 1.140804e-06 10.292319 + 4400 0.0003844421 0 2.6841047e-05 9.6570404e-07 1.2319818e-06 10.286203 + 4500 0.0003842788 0 2.6633558e-05 9.6452478e-07 1.1954945e-06 10.278287 + 4600 0.00038365139 0 2.6514403e-05 9.6185846e-07 1.2002452e-06 10.270732 + 4700 0.00038271503 0 2.6374349e-05 9.4061833e-07 1.1774211e-06 10.264796 + 4800 0.00038233688 0 2.638398e-05 1.1644119e-06 1.3746239e-06 10.25742 + 4900 0.00038223496 0 2.6279821e-05 1.1345508e-06 1.4709213e-06 10.246987 + 5000 0.00038219402 0 2.6188871e-05 1.0115151e-06 1.2024203e-06 10.240511 + 5100 0.00038195153 0 2.6137945e-05 1.009856e-06 1.1961088e-06 10.236014 + 5200 0.00038170903 0 2.6103563e-05 1.0046761e-06 1.1881008e-06 10.232236 + 5300 0.00038194303 0 2.6111938e-05 1.0533375e-06 1.2621634e-06 10.230617 + 5400 0.00038147407 0 2.6078641e-05 1.082228e-06 1.2915223e-06 10.230098 + 5500 0.00038156894 0 2.6084488e-05 1.1395485e-06 1.3592644e-06 10.227759 + 5600 0.00038169434 0 2.6085704e-05 1.1173618e-06 1.3003599e-06 10.2256 + 5700 0.00038219734 0 2.6095279e-05 1.1026614e-06 1.280455e-06 10.223621 + 5800 0.00038268758 0 2.6113437e-05 1.1096198e-06 1.2565503e-06 10.222902 + 5900 0.00038300658 0 2.6131709e-05 1.1123595e-06 1.235992e-06 10.222182 + 6000 0.00038250316 0 2.606995e-05 1.1590744e-06 1.2888416e-06 10.221123 + 6100 0.0003821526 0 2.6025605e-05 1.1434025e-06 1.3141861e-06 10.219503 + 6200 0.00038185711 0 2.5991255e-05 1.1471391e-06 1.3427373e-06 10.219503 + 6300 0.00038197679 0 2.5996965e-05 1.1338082e-06 1.3315258e-06 10.218604 + 6400 0.00038232311 0 2.6035805e-05 1.1353407e-06 1.3306683e-06 10.217884 + 6500 0.00038255543 0 2.6091572e-05 1.1768703e-06 1.3629611e-06 10.217704 + 6600 0.00038251887 0 2.6068968e-05 1.1808094e-06 1.3969697e-06 10.217344 + 6700 0.00038177389 0 2.6004288e-05 1.1659866e-06 1.423638e-06 10.218084 + 6800 0.00038096291 0 2.5969494e-05 1.1377343e-06 1.4348787e-06 10.218103 + 6900 0.00038090601 0 2.5951546e-05 1.1327767e-06 1.4311663e-06 10.217024 + 7000 0.00038088094 0 2.5946255e-05 1.1652568e-06 1.4567559e-06 10.215944 + 7100 0.00038094624 0 2.5972593e-05 1.1558871e-06 1.4692935e-06 10.214684 + 7200 0.00038168738 0 2.6002e-05 1.1562707e-06 1.4881081e-06 10.212705 + 7300 0.00038200854 0 2.6038768e-05 1.1339903e-06 1.4808455e-06 10.212345 + 7400 0.00038187543 0 2.6044759e-05 1.101743e-06 1.4758679e-06 10.213084 + 7500 0.00038165297 0 2.6004536e-05 1.0892731e-06 1.4872621e-06 10.214742 +Loop time of 28.804 on 4 procs for 7500 steps with 11111 atoms + +Performance: 1124843.305 tau/day, 260.380 timesteps/s +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.26977 | 0.28058 | 0.2866 | 1.3 | 0.97 +Bond | 22.742 | 23.598 | 24.671 | 16.6 | 81.92 +Neigh | 0.54555 | 0.5728 | 0.60272 | 3.2 | 1.99 +Comm | 1.4024 | 2.5619 | 3.5079 | 54.8 | 8.89 +Output | 0.025307 | 0.025833 | 0.027022 | 0.4 | 0.09 +Modify | 1.592 | 1.6506 | 1.7059 | 4.0 | 5.73 +Other | | 0.1147 | | | 0.40 + +Nlocal: 2777.75 ave 2887 max 2682 min +Histogram: 1 0 0 0 2 0 0 0 0 1 +Nghost: 1152.5 ave 1189 max 1125 min +Histogram: 1 0 1 0 0 1 0 0 0 1 +Neighs: 11515.5 ave 12520 max 10831 min +Histogram: 1 1 0 0 1 0 0 0 0 1 + +Total # of neighbors = 46062 +Ave neighs/atom = 4.1456215 +Ave special neighs/atom = 10.214742 +Neighbor list builds = 408 +Dangerous builds = 0 +Total wall time: 0:00:28 diff --git a/examples/bpm/impact/log.17Feb2022.impact.spring.g++.4 b/examples/bpm/impact/log.17Feb2022.impact.spring.g++.4 new file mode 100644 index 0000000000..9b11f62b88 --- /dev/null +++ b/examples/bpm/impact/log.17Feb2022.impact.spring.g++.4 @@ -0,0 +1,221 @@ +LAMMPS (17 Feb 2022) +units lj +dimension 3 +boundary f f f +atom_style bond +special_bonds lj 0.0 1.0 1.0 coul 0.0 1.0 1.0 +newton on off +comm_modify vel yes cutoff 2.6 +lattice fcc 1.0 +Lattice spacing in x,y,z = 1.5874011 1.5874011 1.5874011 +region box block -25 15 -22 22 -22 22 +create_box 1 box bond/types 2 extra/bond/per/atom 20 extra/special/per/atom 50 +Created orthogonal box = (-39.685026 -34.922823 -34.922823) to (23.811016 34.922823 34.922823) + 1 by 2 by 2 MPI processor grid + +region disk cylinder x 0.0 0.0 20.0 -0.5 0.5 +create_atoms 1 region disk +Created 7529 atoms + using lattice units in orthogonal box = (-39.685026 -34.922823 -34.922823) to (23.811016 34.922823 34.922823) + create_atoms CPU = 0.001 seconds +group plate region disk +7529 atoms in group plate + +region ball sphere 8.0 0.0 0.0 6.0 +create_atoms 1 region ball +Created 3589 atoms + using lattice units in orthogonal box = (-39.685026 -34.922823 -34.922823) to (23.811016 34.922823 34.922823) + create_atoms CPU = 0.000 seconds +group projectile region ball +3589 atoms in group projectile + +displace_atoms all random 0.1 0.1 0.1 134598738 +Displacing atoms ... + +mass 1 1.0 + +neighbor 1.0 bin +pair_style bpm/spring +pair_coeff 1 1 1.0 1.0 1.0 + +fix 1 all nve + +create_bonds many plate plate 1 0.0 1.5 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 2 + ghost atom cutoff = 2.6 + binsize = 1, bins = 64 70 70 + 2 neighbor lists, perpetual/occasional/extra = 1 1 0 + (1) command create_bonds, occasional + attributes: full, newton on + pair build: full/bin + stencil: full/bin/3d + bin: standard + (2) pair bpm/spring, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Added 38559 bonds, new total = 38559 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 15 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.001 seconds +create_bonds many projectile projectile 2 0.0 1.5 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +WARNING: Bonds are defined but no bond style is set (../force.cpp:192) +WARNING: Likewise 1-2 special neighbor interactions != 1.0 (../force.cpp:194) +Added 21869 bonds, new total = 60428 +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 1 1 + special bond factors coul: 0 1 1 + 16 = max # of 1-2 neighbors + 101 = max # of special neighbors + special bonds CPU = 0.001 seconds + +neighbor 0.3 bin +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 + +bond_style bpm/spring store/local brkbond 100 time id1 id2 +bond_coeff 1 1.0 0.04 1.0 +bond_coeff 2 1.0 0.20 1.0 + +velocity projectile set -0.05 0.0 0.0 +compute nbond all nbond/atom +compute tbond all reduce sum c_nbond + +timestep 0.1 +thermo_style custom step ke pe pxx pyy pzz c_tbond +thermo 100 +thermo_modify lost ignore lost/bond ignore +#dump 1 all custom 100 atomDump id x y z c_nbond + +dump 2 all local 100 brokenDump f_brkbond[1] f_brkbond[2] f_brkbond[3] +dump_modify 2 header no + +run 7500 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 2.6 + binsize = 0.65, bins = 98 108 108 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair bpm/spring, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 17.74 | 17.74 | 17.74 Mbytes +Step KinEng PotEng Pxx Pyy Pzz c_tbond + 0 0.0010167873 0 7.298968e-05 0 0 10.8703 + 100 0.0010167873 0 7.298968e-05 -8.7429897e-20 -8.8470837e-20 10.8703 + 200 0.0010167873 0 7.298968e-05 -7.2809565e-20 -8.0915788e-20 10.8703 + 300 0.0009951439 0 9.9273671e-05 8.1569216e-06 8.0922512e-06 10.868142 + 400 0.00095142792 0 0.00012669557 -1.3413721e-05 -1.4800745e-05 10.849793 + 500 0.00092272662 0 8.1708784e-05 -9.7488701e-06 -1.3603634e-05 10.819752 + 600 0.00088967612 0 6.2587266e-05 -5.1954127e-06 -6.781587e-06 10.797985 + 700 0.00086070919 0 8.8529902e-05 -9.9431205e-06 -7.9905211e-06 10.776579 + 800 0.00083543943 0 7.5920357e-05 3.6381024e-07 3.7747551e-06 10.759309 + 900 0.00081190799 0 6.3678219e-05 5.4158243e-06 1.2751247e-05 10.744199 + 1000 0.00078828988 0 7.3079869e-05 -6.6410613e-06 -1.198683e-06 10.728368 + 1100 0.00075664718 0 6.2976995e-05 -4.7863299e-06 -3.9814556e-06 10.711819 + 1200 0.00072472205 0 4.9680233e-05 9.3093553e-06 4.4426393e-06 10.69401 + 1300 0.00070176532 0 5.4048176e-05 1.3051954e-05 7.5448558e-06 10.671164 + 1400 0.00068599319 0 5.4062404e-05 9.9930199e-06 1.0353154e-05 10.650117 + 1500 0.0006786164 0 4.5038593e-05 8.067571e-06 9.8825461e-06 10.636266 + 1600 0.00067466823 0 4.6733251e-05 9.8595584e-06 1.1551081e-05 10.621335 + 1700 0.00066847126 0 5.1472453e-05 2.1569974e-07 6.0070599e-06 10.6127 + 1800 0.00065711827 0 5.0355189e-05 -8.030203e-06 -3.1395588e-06 10.599568 + 1900 0.00063882539 0 4.7146888e-05 -2.0596242e-05 -1.6494542e-05 10.581939 + 2000 0.00061717894 0 4.6698781e-05 -2.5473048e-05 -2.7703615e-05 10.567188 + 2100 0.00059261327 0 3.7701055e-05 -2.4637803e-05 -3.3919162e-05 10.552617 + 2200 0.00056527158 0 3.2239421e-05 -1.8786685e-05 -2.4202734e-05 10.538406 + 2300 0.00054054919 0 2.7410334e-05 -6.701111e-06 -7.4354974e-06 10.520777 + 2400 0.00051820065 0 2.2997206e-05 1.5623767e-05 1.8687824e-05 10.501889 + 2500 0.00049647925 0 1.746693e-05 2.8814144e-05 3.5569425e-05 10.487498 + 2600 0.00047837258 0 1.4127067e-05 3.4245611e-05 4.0208577e-05 10.472387 + 2700 0.00046626924 0 1.3714876e-05 3.7922196e-05 4.1550346e-05 10.456377 + 2800 0.0004560167 0 1.5260976e-05 3.5632577e-05 3.7885738e-05 10.440007 + 2900 0.00045331059 0 1.5194832e-05 3.1036124e-05 2.8633755e-05 10.427955 + 3000 0.00045227799 0 1.4877378e-05 1.9327028e-05 2.1189487e-05 10.414283 + 3100 0.00044866178 0 2.0424612e-05 -2.7242288e-06 7.7121438e-06 10.40349 + 3200 0.00044336453 0 2.3276121e-05 -1.979069e-05 -4.2311089e-06 10.395575 + 3300 0.00043526526 0 2.3338132e-05 -2.834945e-05 -1.7302033e-05 10.389998 + 3400 0.00042817758 0 2.4374527e-05 -2.9870076e-05 -3.0623264e-05 10.382803 + 3500 0.00042182658 0 2.6120627e-05 -2.9449521e-05 -3.787776e-05 10.378126 + 3600 0.00041794291 0 2.4736957e-05 -2.4098172e-05 -3.0529166e-05 10.373628 + 3700 0.0004156005 0 2.7543305e-05 -1.2431749e-05 -1.8626096e-05 10.37075 + 3800 0.0004141461 0 2.4630482e-05 -6.345489e-06 -1.7375803e-05 10.368771 + 3900 0.00041328832 0 2.2220142e-05 4.1471034e-07 -1.3339476e-05 10.366972 + 4000 0.00041121725 0 2.3491321e-05 1.1284551e-05 -5.8651834e-06 10.364634 + 4100 0.00040761876 0 2.6688248e-05 1.9721625e-05 3.7536871e-06 10.362655 + 4200 0.00040301362 0 2.7601916e-05 1.9212118e-05 9.7175996e-06 10.359417 + 4300 0.00040001545 0 2.7243769e-05 1.6889359e-05 1.1857147e-05 10.3551 + 4400 0.00039654521 0 2.561083e-05 1.3863551e-05 1.0593597e-05 10.351142 + 4500 0.00039435924 0 2.4366458e-05 1.2545563e-05 1.1323962e-05 10.348804 + 4600 0.00039250006 0 2.3719127e-05 1.1015167e-05 8.5964046e-06 10.348444 + 4700 0.00039145496 0 2.2943915e-05 8.7824224e-06 5.0397129e-06 10.346825 + 4800 0.00039105331 0 2.4005757e-05 7.5899773e-06 9.033741e-07 10.344846 + 4900 0.0003898798 0 2.3819433e-05 4.9673894e-06 -2.3466459e-06 10.343587 + 5000 0.00038747508 0 2.3605028e-05 -1.1717437e-06 -6.1096657e-06 10.343047 + 5100 0.00038549022 0 2.3453798e-05 -9.9256693e-06 -9.3584148e-06 10.341788 + 5200 0.00038283936 0 2.5243567e-05 -1.5877598e-05 -9.9474447e-06 10.340169 + 5300 0.00038140888 0 2.5522223e-05 -1.9331435e-05 -1.1067039e-05 10.33873 + 5400 0.00037916674 0 2.5181488e-05 -2.1581255e-05 -1.1252641e-05 10.336931 + 5500 0.00037782932 0 2.691805e-05 -1.5768241e-05 -5.6704695e-06 10.334952 + 5600 0.00037628832 0 2.5851445e-05 -1.4239811e-05 -1.9122536e-06 10.333153 + 5700 0.00037451913 0 2.4758416e-05 -1.3252284e-05 -1.9222041e-06 10.331714 + 5800 0.00037328662 0 2.2507032e-05 -9.6704092e-06 -7.5470215e-06 10.330095 + 5900 0.00037253111 0 2.3303086e-05 -4.2828034e-06 -7.888056e-06 10.328476 + 6000 0.00037171133 0 2.4042456e-05 -4.7684985e-06 -6.5164336e-06 10.327397 + 6100 0.00036986726 0 2.4938695e-05 -4.8738316e-06 -4.5380007e-06 10.327037 + 6200 0.0003675822 0 2.3322229e-05 -4.6333093e-06 -5.7086464e-06 10.327037 + 6300 0.00036552389 0 2.1435354e-05 -4.8971566e-06 -3.5935426e-06 10.327037 + 6400 0.00036488091 0 2.0813994e-05 -3.8333319e-06 -3.6595059e-06 10.327037 + 6500 0.00036447973 0 2.2241876e-05 8.7797361e-08 -4.141203e-06 10.327037 + 6600 0.00036383343 0 2.269485e-05 4.9364593e-06 1.3062133e-06 10.326677 + 6700 0.00036305076 0 2.1838759e-05 6.4587048e-06 4.7758772e-06 10.326318 + 6800 0.00036226601 0 2.2916622e-05 6.044926e-06 5.0291597e-06 10.325598 + 6900 0.00036175279 0 2.2691667e-05 6.9998847e-06 5.8988637e-06 10.324699 + 7000 0.00036143633 0 2.1725813e-05 8.1268152e-06 5.0390503e-06 10.324519 + 7100 0.0003610248 0 2.1799675e-05 8.65795e-06 3.1360368e-06 10.323439 + 7200 0.00036086259 0 2.2198029e-05 5.1764734e-06 5.4798783e-07 10.32308 + 7300 0.00036099757 0 2.4160496e-05 1.0310325e-06 -5.115075e-07 10.32254 + 7400 0.00036129334 0 2.5325018e-05 -9.4918158e-07 -1.7064957e-06 10.32218 + 7500 0.00036136655 0 2.3513198e-05 -3.8618451e-06 -4.4344772e-06 10.321281 +Loop time of 4.51074 on 4 procs for 7500 steps with 11118 atoms + +Performance: 14365719.597 tau/day, 1662.699 timesteps/s +93.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.25733 | 0.26952 | 0.28068 | 1.6 | 5.98 +Bond | 1.9391 | 2.0128 | 2.0851 | 3.7 | 44.62 +Neigh | 0.56308 | 0.5941 | 0.62077 | 2.8 | 13.17 +Comm | 0.68282 | 0.80856 | 0.94406 | 10.7 | 17.93 +Output | 0.19287 | 0.1933 | 0.19426 | 0.1 | 4.29 +Modify | 0.53239 | 0.55343 | 0.57349 | 2.0 | 12.27 +Other | | 0.07902 | | | 1.75 + +Nlocal: 2779.5 ave 2862 max 2686 min +Histogram: 1 0 0 0 0 1 1 0 0 1 +Nghost: 1183.25 ave 1220 max 1134 min +Histogram: 1 0 0 0 1 0 0 0 1 1 +Neighs: 11828.8 ave 12387 max 11053 min +Histogram: 1 0 0 0 1 0 0 0 1 1 + +Total # of neighbors = 47315 +Ave neighs/atom = 4.2557115 +Ave special neighs/atom = 10.321461 +Neighbor list builds = 421 +Dangerous builds = 11 +Total wall time: 0:00:04 diff --git a/examples/bpm/pour/in.bpm.pour b/examples/bpm/pour/in.bpm.pour new file mode 100644 index 0000000000..e4cc8557a3 --- /dev/null +++ b/examples/bpm/pour/in.bpm.pour @@ -0,0 +1,35 @@ +units lj +dimension 3 +boundary m m m +atom_style bpm/sphere +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 +newton on off +comm_modify vel yes cutoff 3.3 +region box block -15 15 -15 15 0 60.0 +create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50 + +molecule my_mol "rect.mol" +region wall_cyl cylinder z 0.0 0.0 10.0 EDGE EDGE side in +region dropzone cylinder z 0.0 0.0 10.0 40.0 50.0 side in + +pair_style gran/hertz/history 1.0 NULL 0.5 NULL 0.1 1 +bond_style bpm/rotational +pair_coeff 1 1 +bond_coeff 1 1.0 0.2 0.01 0.01 2.0 0.4 0.02 0.02 0.2 0.04 0.002 0.002 + +compute nbond all nbond/atom +compute tbond all reduce sum c_nbond +compute_modify thermo_temp dynamic/dof yes + +fix 1 all wall/gran hertz/history 1.0 NULL 0.5 NULL 0.1 1 zplane 0.0 NULL +fix 2 all wall/gran/region hertz/history 1.0 NULL 0.5 NULL 0.1 1 region wall_cyl +fix 3 all gravity 1e-4 vector 0 0 -1 +fix 4 all deposit 40 0 1500 712511343 mol my_mol region dropzone near 2.0 vz -0.05 -0.05 +fix 5 all nve/bpm/sphere + +timestep 0.05 +thermo_style custom step ke pe pxx pyy pzz c_tbond +thermo 100 +#dump 1 all custom 500 atomDump id radius x y z c_nbond mol + +run 100000 diff --git a/examples/bpm/pour/log.17Feb2022.pour.g++.4 b/examples/bpm/pour/log.17Feb2022.pour.g++.4 new file mode 100644 index 0000000000..a61c0f1181 --- /dev/null +++ b/examples/bpm/pour/log.17Feb2022.pour.g++.4 @@ -0,0 +1,1091 @@ +LAMMPS (17 Feb 2022) +units lj +dimension 3 +boundary m m m +atom_style bpm/sphere +special_bonds lj 0.0 1.0 1.0 coul 1.0 1.0 1.0 +newton on off +comm_modify vel yes cutoff 3.3 +region box block -15 15 -15 15 0 60.0 +create_box 1 box bond/types 1 extra/bond/per/atom 15 extra/special/per/atom 50 +Created orthogonal box = (-15 -15 0) to (15 15 60) + 1 by 1 by 4 MPI processor grid + +molecule my_mol "rect.mol" +Read molecule template my_mol: + 1 molecules + 0 fragments + 63 atoms with max type 1 + 297 bonds with max type 1 + 0 angles with max type 0 + 0 dihedrals with max type 0 + 0 impropers with max type 0 +region wall_cyl cylinder z 0.0 0.0 10.0 EDGE EDGE side in +region dropzone cylinder z 0.0 0.0 10.0 40.0 50.0 side in + +pair_style gran/hertz/history 1.0 NULL 0.5 NULL 0.1 1 +bond_style bpm/rotational +pair_coeff 1 1 +bond_coeff 1 1.0 0.2 0.01 0.01 2.0 0.4 0.02 0.02 0.2 0.04 0.002 0.002 + +compute nbond all nbond/atom +compute tbond all reduce sum c_nbond +compute_modify thermo_temp dynamic/dof yes + +fix 1 all wall/gran hertz/history 1.0 NULL 0.5 NULL 0.1 1 zplane 0.0 NULL +fix 2 all wall/gran/region hertz/history 1.0 NULL 0.5 NULL 0.1 1 region wall_cyl +fix 3 all gravity 1e-4 vector 0 0 -1 +fix 4 all deposit 40 0 1500 712511343 mol my_mol region dropzone near 2.0 vz -0.05 -0.05 +fix 5 all nve/bpm/sphere + +timestep 0.05 +thermo_style custom step ke pe pxx pyy pzz c_tbond +thermo 100 +#dump 1 all custom 500 atomDump id radius x y z c_nbond mol + +run 100000 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 10 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 1.3 + ghost atom cutoff = 3.3 + binsize = 0.65, bins = 47 47 93 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair gran/hertz/history, perpetual + attributes: half, newton on, size, history + pair build: half/size/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.515 | 6.515 | 6.515 Mbytes +Step KinEng PotEng Pxx Pyy Pzz c_tbond + 0 -0 0 0 0 0 0 + 100 0.0018331948 0 2.0050936e-07 1.2082282e-06 2.8712165e-06 9.4285714 + 200 0.0025933558 0 7.3469794e-07 2.0155735e-06 3.3061759e-06 9.4285714 + 300 0.0036964813 0 3.7946479e-07 5.3005435e-06 2.9691719e-06 9.4285714 + 400 0.0060104433 0 1.5778321e-06 8.4396021e-06 4.0232206e-06 9.4285714 + 500 0.0074435972 0 1.6102287e-06 1.1551491e-05 4.2257246e-06 9.4285714 + 600 0.0077862298 0 1.048357e-06 1.3758458e-05 3.3770448e-06 9.4285714 + 700 0.0075577591 0 1.1527593e-06 1.2533681e-05 3.9545936e-06 9.4285714 + 800 0.0073958844 0 1.1164823e-06 1.2917327e-05 3.2263757e-06 9.4285714 + 900 0.007553697 0 1.190904e-06 1.3294768e-05 3.1421027e-06 9.4285714 + 1000 0.0075815901 0 1.0181785e-06 1.3265265e-05 3.4107996e-06 9.4285714 + 1100 0.0075277384 0 2.0708356e-06 1.2219251e-05 3.2773337e-06 9.4285714 + 1200 0.0075026507 0 1.8286317e-06 1.2395764e-05 3.2819583e-06 9.4285714 + 1300 0.0075665473 0 1.8498736e-06 1.2455125e-05 3.3519775e-06 9.4285714 + 1400 0.0076224701 0 3.1234422e-06 1.0777609e-05 3.8865172e-06 9.4285714 + 1500 0.007603467 0 2.8536732e-06 1.1077739e-05 3.8107558e-06 9.4285714 + 1600 0.0059810407 0 4.3809396e-06 1.6996767e-05 6.5539764e-06 9.4285714 + 1700 0.0080230318 0 5.7884097e-06 2.4435559e-05 7.2370109e-06 9.4285714 + 1800 0.0087482398 0 5.9323986e-06 2.7190078e-05 7.7151041e-06 9.4285714 + 1900 0.0086877574 0 6.1023555e-06 2.6625737e-05 7.8193078e-06 9.4285714 + 2000 0.0086771118 0 6.1635853e-06 2.633267e-05 8.0008845e-06 9.4285714 + 2100 0.0084670091 0 6.7873752e-06 2.5434046e-05 9.0971224e-06 9.4285714 + 2200 0.0083650907 0 8.1704442e-06 2.3699108e-05 8.4515642e-06 9.4285714 + 2300 0.0083549595 0 8.2648511e-06 2.2510949e-05 8.2508581e-06 9.4285714 + 2400 0.0083151535 0 7.7718631e-06 2.2224878e-05 8.8086351e-06 9.4285714 + 2500 0.0083898757 0 7.1987828e-06 2.2855932e-05 9.1000336e-06 9.4285714 + 2600 0.0084145705 0 6.968992e-06 2.3030741e-05 9.2694955e-06 9.4285714 + 2700 0.0082712696 0 7.5971438e-06 2.3186553e-05 1.026296e-05 9.4285714 + 2800 0.0073688706 0 1.0092165e-05 1.6341178e-05 1.0496887e-05 9.4285714 + 2900 0.0072732669 0 8.9857642e-06 1.454313e-05 1.0637501e-05 9.4285714 + 3000 0.0072225948 0 8.5616417e-06 1.4225089e-05 1.0924921e-05 9.4285714 + 3100 0.0048244969 0 6.912522e-06 1.30395e-05 1.3824006e-05 9.4285714 + 3200 0.0045717035 0 5.7159512e-06 1.1181938e-05 1.5108391e-05 9.4285714 + 3300 0.0047679567 0 6.0163783e-06 1.1603014e-05 1.5759942e-05 9.4285714 + 3400 0.0048448212 0 6.3252851e-06 1.2378054e-05 1.5212593e-05 9.4285714 + 3500 0.0048364711 0 6.4847771e-06 1.2719874e-05 1.4888067e-05 9.4285714 + 3600 0.0047125947 0 7.5131511e-06 1.375252e-05 1.5244253e-05 9.4285714 + 3700 0.0045641049 0 7.3441262e-06 1.2981907e-05 1.5049034e-05 9.4285714 + 3800 0.0045540235 0 6.8443099e-06 1.1748155e-05 1.4685806e-05 9.4285714 + 3900 0.0047271202 0 6.7919886e-06 1.2153009e-05 1.4801772e-05 9.4285714 + 4000 0.0049115261 0 6.9084016e-06 1.2385892e-05 1.5231153e-05 9.4285714 + 4100 0.0046819157 0 6.4190119e-06 1.1228312e-05 1.5132413e-05 9.4285714 + 4200 0.0035133816 0 3.6896921e-06 6.5442286e-06 1.4368405e-05 9.4285714 + 4300 0.0031933917 0 1.9641761e-06 3.4983806e-06 1.6912795e-05 9.4285714 + 4400 0.0033515272 0 2.3967939e-06 4.0160705e-06 1.7056596e-05 9.4285714 + 4500 0.0034928951 0 3.0724834e-06 4.4355514e-06 1.6962392e-05 9.4285714 + 4600 0.0029992338 0 3.319899e-06 4.3436095e-06 2.0334274e-05 9.4285714 + 4700 0.0030650658 0 3.9633397e-06 5.6588274e-06 1.8991224e-05 9.4285714 + 4800 0.0031180382 0 4.925768e-06 6.3708181e-06 1.7810728e-05 9.4285714 + 4900 0.0030365003 0 4.6849771e-06 5.6291872e-06 1.8029418e-05 9.4285714 + 5000 0.0030259714 0 5.1846803e-06 5.5730554e-06 1.7488984e-05 9.4285714 + 5100 0.0030499975 0 5.6322417e-06 5.9148203e-06 1.6923105e-05 9.4285714 + 5200 0.003005436 0 5.6903188e-06 5.6637593e-06 1.6700127e-05 9.4285714 + 5300 0.0030000941 0 5.7591855e-06 5.3398134e-06 1.6904108e-05 9.4285714 + 5400 0.0031465827 0 6.1148362e-06 6.2148373e-06 1.7041724e-05 9.4285714 + 5500 0.0031981585 0 5.8718482e-06 5.9970835e-06 1.7984043e-05 9.4285714 + 5600 0.0031525115 0 5.3390747e-06 5.1610119e-06 1.8924721e-05 9.4285714 + 5700 0.0032128781 0 5.6775112e-06 5.2023225e-06 1.9109577e-05 9.4285714 + 5800 0.0030092855 0 5.7676512e-06 4.4808095e-06 2.1160289e-05 9.4285714 + 5900 0.0025015767 0 6.5110611e-06 5.0853279e-06 2.290709e-05 9.4285714 + 6000 0.0024438438 0 6.4803568e-06 4.9314657e-06 2.1450483e-05 9.4285714 + 6100 0.0023816456 0 4.2004621e-06 4.3412206e-06 2.3366694e-05 9.4285714 + 6200 0.0024459343 0 3.4052114e-06 2.3122757e-06 2.3018902e-05 9.4285714 + 6300 0.0025205884 0 3.0607555e-06 2.7404005e-06 2.3612151e-05 9.4285714 + 6400 0.0033754198 0 5.4041464e-06 1.0129204e-05 2.3881911e-05 9.4285714 + 6500 0.0037812296 0 6.9287106e-06 1.2845513e-05 2.4385157e-05 9.4285714 + 6600 0.0038043567 0 4.4366794e-06 1.559564e-05 2.4372156e-05 9.4285714 + 6700 0.0038213959 0 5.6461713e-06 1.6081939e-05 2.556403e-05 9.4285714 + 6800 0.0036977776 0 6.1083638e-06 1.3260883e-05 2.8030458e-05 9.4285714 + 6900 0.0034769765 0 4.281986e-06 1.4287795e-05 2.803258e-05 9.4285714 + 7000 0.0031526409 0 4.8687091e-06 1.1290097e-05 2.9635973e-05 9.4285714 + 7100 0.00317737 0 4.866629e-06 9.8108506e-06 3.1076433e-05 9.4285714 + 7200 0.0034448361 0 4.6533797e-06 1.15597e-05 3.0195614e-05 9.4285714 + 7300 0.0036147362 0 3.4867601e-06 1.2192841e-05 3.0431851e-05 9.4285714 + 7400 0.0035651675 0 2.812314e-06 1.0900977e-05 2.9422055e-05 9.4285714 + 7500 0.0036394064 0 2.6684242e-06 1.038371e-05 2.9650533e-05 9.4285714 + 7600 0.0033086177 0 2.6357178e-06 1.0363505e-05 3.3327311e-05 9.4285714 + 7700 0.0033410425 0 3.9955363e-06 9.2059943e-06 3.3580724e-05 9.4285714 + 7800 0.0035764747 0 7.127102e-06 8.9311151e-06 3.402089e-05 9.4285714 + 7900 0.0039500913 0 1.1222589e-05 9.0137729e-06 3.5074285e-05 9.4285714 + 8000 0.0042963353 0 1.5982303e-05 8.4904673e-06 3.5704562e-05 9.4285714 + 8100 0.0048297614 0 2.2809259e-05 7.6782291e-06 3.714467e-05 9.4285714 + 8200 0.0052301447 0 2.8015774e-05 6.9131186e-06 3.8310186e-05 9.4285714 + 8300 0.005169511 0 2.8580467e-05 6.1476914e-06 3.7651259e-05 9.4285714 + 8400 0.005224324 0 2.9402221e-05 5.0117679e-06 3.873174e-05 9.4285714 + 8500 0.0053049309 0 3.0666777e-05 4.125785e-06 3.9482985e-05 9.4285714 + 8600 0.0052459952 0 3.0525628e-05 4.1952646e-06 3.8726938e-05 9.4285714 + 8700 0.0052955657 0 3.0177531e-05 5.0224986e-06 3.8941323e-05 9.4285714 + 8800 0.0053972257 0 3.1021226e-05 5.261711e-06 3.9283466e-05 9.4285714 + 8900 0.0053679679 0 3.1133172e-05 4.9109387e-06 3.9111316e-05 9.4285714 + 9000 0.0053793586 0 3.0629197e-05 5.8147275e-06 3.8870113e-05 9.4285714 + 9100 0.0048447626 0 3.0571485e-05 6.6542996e-06 4.1908678e-05 9.4285714 + 9200 0.0048688926 0 3.0874982e-05 6.5780749e-06 4.2143302e-05 9.4285714 + 9300 0.0048538957 0 3.0564193e-05 8.1762092e-06 4.2503239e-05 9.4285714 + 9400 0.0046986454 0 2.8378911e-05 1.0639019e-05 4.4317403e-05 9.4285714 + 9500 0.0046145139 0 2.513485e-05 1.036053e-05 4.5570422e-05 9.4285714 + 9600 0.0045277961 0 2.056713e-05 9.8647996e-06 4.5858869e-05 9.4285714 + 9700 0.0043935298 0 1.8390341e-05 9.0322729e-06 4.6271482e-05 9.4285714 + 9800 0.0045363488 0 2.0469706e-05 9.7216528e-06 4.5805899e-05 9.4285714 + 9900 0.0046509978 0 1.9525081e-05 9.5233466e-06 4.862056e-05 9.4285714 + 10000 0.0046493894 0 1.7602305e-05 9.4408537e-06 5.0053515e-05 9.4285714 + 10100 0.0046514856 0 1.6724832e-05 9.9699479e-06 4.928713e-05 9.4285714 + 10200 0.0046209533 0 1.4889196e-05 1.0767419e-05 4.9829248e-05 9.4285714 + 10300 0.0044651031 0 1.0578209e-05 1.1339471e-05 5.1024934e-05 9.4285714 + 10400 0.0041834162 0 6.5253227e-06 1.099852e-05 5.0813498e-05 9.4285714 + 10500 0.0043218845 0 7.2170142e-06 1.2622523e-05 5.0759877e-05 9.4285714 + 10600 0.0045795722 0 1.0140572e-05 2.1058806e-05 5.4332689e-05 9.4285714 + 10700 0.0053833569 0 1.2245942e-05 3.2705455e-05 5.5584298e-05 9.4285714 + 10800 0.0056805981 0 9.642689e-06 4.0045088e-05 5.6378884e-05 9.4285714 + 10900 0.0057157307 0 9.8421383e-06 3.9670248e-05 5.7196914e-05 9.4285714 + 11000 0.005696424 0 1.1871435e-05 3.7351501e-05 5.7130853e-05 9.4285714 + 11100 0.0052078884 0 9.5005747e-06 3.612037e-05 5.1606236e-05 9.4285714 + 11200 0.0052849159 0 1.433919e-05 3.596257e-05 4.8371986e-05 9.4285714 + 11300 0.0054074494 0 1.2828165e-05 3.7628808e-05 5.0495681e-05 9.4285714 + 11400 0.0055432168 0 1.1770167e-05 3.7223129e-05 5.4498301e-05 9.4285714 + 11500 0.0054679467 0 1.1215128e-05 3.5612418e-05 5.5880978e-05 9.4285714 + 11600 0.0052706441 0 1.0611988e-05 3.5785457e-05 5.8094083e-05 9.4285714 + 11700 0.0053724243 0 1.1867616e-05 3.484887e-05 5.7967416e-05 9.4285714 + 11800 0.0054759961 0 9.3774866e-06 3.3307362e-05 6.0256027e-05 9.4285714 + 11900 0.0051146604 0 9.5582838e-06 3.1092749e-05 5.4847298e-05 9.4285714 + 12000 0.0049723565 0 8.4734692e-06 3.1240602e-05 5.3118854e-05 9.4285714 + 12100 0.0046920113 0 8.8947651e-06 3.3402795e-05 5.6254952e-05 9.4285714 + 12200 0.0049570244 0 1.0006616e-05 3.306729e-05 6.1049649e-05 9.4285714 + 12300 0.0049181458 0 8.1394364e-06 3.2634327e-05 6.2527089e-05 9.4285714 + 12400 0.0049245342 0 8.1971979e-06 3.3145464e-05 6.2091332e-05 9.4285714 + 12500 0.0049753042 0 8.9911646e-06 3.4018861e-05 6.1487068e-05 9.4285714 + 12600 0.0048148791 0 8.560766e-06 2.9647432e-05 6.2929427e-05 9.4285714 + 12700 0.0043852178 0 7.5889296e-06 1.8576839e-05 6.5947945e-05 9.4285714 + 12800 0.0041967317 0 8.6473249e-06 1.3892779e-05 6.6599779e-05 9.4285714 + 12900 0.0041911278 0 9.3489002e-06 1.8180223e-05 6.3308096e-05 9.4285714 + 13000 0.0043107924 0 8.5274073e-06 2.2286145e-05 5.9964925e-05 9.4285714 + 13100 0.0043976521 0 8.2741734e-06 2.4530103e-05 5.9567889e-05 9.4285714 + 13200 0.0043474635 0 9.2173493e-06 2.7514155e-05 5.4579308e-05 9.4285714 + 13300 0.0044593969 0 9.3356325e-06 3.0558484e-05 5.3771437e-05 9.4285714 + 13400 0.0044814342 0 9.2387466e-06 2.8998024e-05 5.5887559e-05 9.4285714 + 13500 0.0043982498 0 9.4867492e-06 2.5493297e-05 5.7396094e-05 9.4285714 + 13600 0.0039378503 0 1.0789003e-05 1.9448677e-05 6.1667698e-05 9.4285714 + 13700 0.0036474735 0 1.0885233e-05 1.5729573e-05 5.8520214e-05 9.4285714 + 13800 0.0038236277 0 1.3819358e-05 2.0470733e-05 5.4960098e-05 9.4285714 + 13900 0.0040574402 0 1.6741444e-05 2.391221e-05 5.4045411e-05 9.4285714 + 14000 0.0046440817 0 2.2494809e-05 2.9264007e-05 5.6648145e-05 9.4285714 + 14100 0.0048045755 0 2.2568279e-05 3.260884e-05 5.6960992e-05 9.4285714 + 14200 0.004634799 0 2.2650329e-05 2.7912328e-05 5.7597129e-05 9.4285714 + 14300 0.0046822822 0 2.3142295e-05 2.8536673e-05 5.7795199e-05 9.4285714 + 14400 0.0048282958 0 2.2560586e-05 3.2744704e-05 5.8133575e-05 9.4285714 + 14500 0.004799276 0 2.1374014e-05 3.1342428e-05 6.0569089e-05 9.4285714 + 14600 0.0046554419 0 2.0804876e-05 2.8534311e-05 6.0800428e-05 9.4285714 + 14700 0.0045262414 0 2.1835372e-05 2.8168699e-05 6.2901651e-05 9.4285714 + 14800 0.0043347498 0 1.9615887e-05 3.1686326e-05 6.4194237e-05 9.4285714 + 14900 0.0040641791 0 1.8621801e-05 2.7440899e-05 6.4602045e-05 9.4285714 + 15000 0.0040014911 0 1.6461776e-05 2.5832508e-05 6.08965e-05 9.4285714 + 15100 0.0040015198 0 2.2331361e-05 2.6108777e-05 5.9319862e-05 9.4285714 + 15200 0.004656209 0 3.5268101e-05 3.0082568e-05 5.958373e-05 9.4285714 + 15300 0.0047390215 0 4.1830227e-05 2.7233725e-05 5.8274008e-05 9.4285714 + 15400 0.0047219857 0 4.2798722e-05 2.8282959e-05 5.786682e-05 9.4285714 + 15500 0.0049597215 0 4.5190515e-05 2.9504603e-05 6.2435065e-05 9.4285714 + 15600 0.0049081505 0 4.3186089e-05 2.9977425e-05 6.1726635e-05 9.4285714 + 15700 0.0047978977 0 4.1446883e-05 2.7814159e-05 5.7947919e-05 9.4285714 + 15800 0.0048176861 0 3.9941014e-05 2.6548461e-05 5.9246093e-05 9.4285714 + 15900 0.0049895331 0 4.0485733e-05 2.8703855e-05 6.3382653e-05 9.4285714 + 16000 0.0049288669 0 3.892315e-05 2.9191325e-05 6.2118616e-05 9.4285714 + 16100 0.0048010252 0 3.7199431e-05 2.7134167e-05 6.1752588e-05 9.4285714 + 16200 0.0047925554 0 3.5806262e-05 2.5024463e-05 6.3068301e-05 9.4285714 + 16300 0.0047652048 0 3.3940221e-05 2.6543134e-05 6.7111166e-05 9.4285714 + 16400 0.0043495894 0 3.4655351e-05 1.8892916e-05 6.5825804e-05 9.4285714 + 16500 0.0042677893 0 3.4188541e-05 1.7570016e-05 6.3850178e-05 9.4285714 + 16600 0.0039924053 0 3.2417741e-05 1.7848282e-05 6.5817879e-05 9.4285714 + 16700 0.004110225 0 3.3539186e-05 1.9943078e-05 6.4568545e-05 9.4285714 + 16800 0.0041003344 0 3.6503679e-05 2.0546394e-05 6.2227252e-05 9.4285714 + 16900 0.0040916821 0 3.7342085e-05 2.384663e-05 6.0859481e-05 9.4285714 + 17000 0.0039812122 0 3.671505e-05 2.4137888e-05 5.6933083e-05 9.4285714 + 17100 0.0042480582 0 3.9654732e-05 2.4691844e-05 5.8210554e-05 9.4285714 + 17200 0.0044450353 0 4.0933677e-05 3.019578e-05 5.5604765e-05 9.4285714 + 17300 0.0045016689 0 4.0563484e-05 3.4710888e-05 5.2933625e-05 9.4285714 + 17400 0.0044798864 0 4.0768397e-05 3.3076261e-05 5.2287655e-05 9.4285714 + 17500 0.0044624458 0 3.8361144e-05 3.4320802e-05 5.4620342e-05 9.4285714 + 17600 0.0044477024 0 3.6643486e-05 3.6449296e-05 5.4759028e-05 9.4285714 + 17700 0.0044103517 0 3.8319719e-05 3.7509764e-05 5.0738749e-05 9.4285714 + 17800 0.004341948 0 3.8052635e-05 3.6850602e-05 5.0481977e-05 9.4285714 + 17900 0.0042623319 0 3.5909432e-05 3.5619615e-05 5.2184073e-05 9.4285714 + 18000 0.003726239 0 1.8245827e-05 3.791319e-05 5.0575431e-05 9.4285714 + 18100 0.0034893305 0 1.7957847e-05 3.6788428e-05 5.281228e-05 9.4285714 + 18200 0.0035481187 0 2.2513253e-05 3.461697e-05 5.1791689e-05 9.4285714 + 18300 0.0036251402 0 2.5159661e-05 3.4782379e-05 5.0946509e-05 9.4285714 + 18400 0.0036369749 0 2.4150699e-05 3.6305943e-05 5.0273557e-05 9.4285714 + 18500 0.0034279849 0 2.050142e-05 3.3762641e-05 5.0772554e-05 9.4285714 + 18600 0.0033615572 0 1.8397654e-05 3.3183402e-05 5.2215005e-05 9.4285714 + 18700 0.003406225 0 1.9609619e-05 3.4353871e-05 5.1091792e-05 9.4285714 + 18800 0.0034922323 0 1.9330569e-05 3.4176016e-05 5.2688824e-05 9.4285714 + 18900 0.0034820625 0 1.9280274e-05 3.3807796e-05 5.372272e-05 9.4285714 + 19000 0.0033272524 0 1.6873326e-05 3.594881e-05 5.3862535e-05 9.4285714 + 19100 0.0034010912 0 1.8030816e-05 3.582088e-05 5.4236353e-05 9.4285714 + 19200 0.0030932535 0 1.4863995e-05 2.7793367e-05 5.3934101e-05 9.4285714 + 19300 0.002624051 0 1.210198e-05 1.6467088e-05 5.2583223e-05 9.4285714 + 19400 0.0027583806 0 1.2008108e-05 2.1017092e-05 5.309485e-05 9.4285714 + 19500 0.0029775174 0 1.3352592e-05 2.4636522e-05 5.4043107e-05 9.4285714 + 19600 0.0028689969 0 1.3488363e-05 2.4373881e-05 5.7585286e-05 9.4285714 + 19700 0.0026399127 0 1.4002066e-05 2.7370388e-05 5.4220539e-05 9.4285714 + 19800 0.0025439904 0 1.668679e-05 2.7178009e-05 5.3083248e-05 9.4285714 + 19900 0.0027074939 0 1.5155901e-05 2.5194957e-05 5.3757244e-05 9.4285714 + 20000 0.0027181793 0 1.2268581e-05 2.5236301e-05 5.1395997e-05 9.4285714 + 20100 0.0027315362 0 1.2532955e-05 2.4069296e-05 5.2648391e-05 9.4285714 + 20200 0.0027204191 0 1.2457637e-05 2.419839e-05 5.2229242e-05 9.4285714 + 20300 0.0026457344 0 1.3573924e-05 2.3628429e-05 4.9330286e-05 9.4285714 + 20400 0.0026592475 0 1.3439645e-05 2.4469429e-05 5.1570429e-05 9.4285714 + 20500 0.0026129298 0 1.3261647e-05 2.4468607e-05 5.1163936e-05 9.4285714 + 20600 0.0026532045 0 1.5275975e-05 2.3494207e-05 5.0569472e-05 9.4285714 + 20700 0.0026172433 0 1.4720887e-05 2.1839292e-05 5.0769214e-05 9.4285714 + 20800 0.0025282343 0 1.3852135e-05 2.0845003e-05 4.9690546e-05 9.4285714 + 20900 0.0025383322 0 1.353444e-05 2.2097076e-05 5.1303519e-05 9.4285714 + 21000 0.0024848857 0 1.4032657e-05 2.1964185e-05 5.3050324e-05 9.4285714 + 21100 0.0025091105 0 1.5334232e-05 2.1760041e-05 5.508965e-05 9.4285714 + 21200 0.0027229411 0 1.9418427e-05 2.2335523e-05 5.5657372e-05 9.4285714 + 21300 0.0028888226 0 2.3631969e-05 2.2967648e-05 5.5948438e-05 9.4285714 + 21400 0.0029336429 0 2.5044169e-05 2.2567194e-05 5.5413722e-05 9.4285714 + 21500 0.0029354446 0 2.4712642e-05 2.2624219e-05 5.5920832e-05 9.4285714 + 21600 0.0029270648 0 2.3842417e-05 2.3011885e-05 5.6087719e-05 9.4285714 + 21700 0.0029288781 0 2.3942959e-05 2.2810041e-05 5.7045772e-05 9.4285714 + 21800 0.002884005 0 2.4455829e-05 2.3081577e-05 5.6212968e-05 9.4285714 + 21900 0.0028362206 0 2.3350532e-05 2.49708e-05 5.3642917e-05 9.4285714 + 22000 0.0027784436 0 2.3311918e-05 2.3033334e-05 5.4359393e-05 9.4285714 + 22100 0.0027479829 0 2.4623514e-05 2.0287924e-05 5.3550114e-05 9.4285714 + 22200 0.0027598842 0 2.6073037e-05 2.1629185e-05 5.3119193e-05 9.4285714 + 22300 0.0026078138 0 2.6348246e-05 2.3093425e-05 5.4029431e-05 9.4285714 + 22400 0.0026057112 0 2.7316001e-05 2.4771567e-05 5.3484921e-05 9.4285714 + 22500 0.0026641722 0 2.6434166e-05 2.5849367e-05 5.2175653e-05 9.4285714 + 22600 0.0023728105 0 2.4436322e-05 2.4147316e-05 5.3971034e-05 9.4285714 + 22700 0.0021999097 0 2.4191892e-05 2.2725939e-05 5.3125105e-05 9.4285714 + 22800 0.002178124 0 2.4122577e-05 2.0194755e-05 5.3468522e-05 9.4285714 + 22900 0.0022903704 0 2.1332487e-05 1.8921598e-05 5.4657879e-05 9.4285714 + 23000 0.0022114595 0 1.930828e-05 1.4423335e-05 5.5387271e-05 9.4285714 + 23100 0.0022473179 0 2.0911663e-05 1.3467616e-05 5.4325686e-05 9.4285714 + 23200 0.0022787302 0 2.1538492e-05 1.5779872e-05 5.3591578e-05 9.4285714 + 23300 0.002254193 0 2.0552374e-05 1.7158208e-05 5.201196e-05 9.4285714 + 23400 0.0022032528 0 2.0514024e-05 1.6045426e-05 5.1691057e-05 9.4285714 + 23500 0.0022103262 0 2.2570839e-05 1.4990595e-05 5.0102702e-05 9.4285714 + 23600 0.0022767949 0 2.153875e-05 1.5934866e-05 4.9843486e-05 9.4285714 + 23700 0.002283034 0 2.0348727e-05 1.5852737e-05 4.9211887e-05 9.4285714 + 23800 0.0022293403 0 2.045052e-05 1.3951752e-05 4.9265994e-05 9.4285714 + 23900 0.0022421499 0 2.0541393e-05 1.3873188e-05 4.9783702e-05 9.4285714 + 24000 0.0022708179 0 2.0733448e-05 1.4464939e-05 5.0156761e-05 9.4285714 + 24100 0.0022311644 0 2.1753043e-05 1.4644732e-05 5.3630645e-05 9.4285714 + 24200 0.0022566051 0 2.3030277e-05 1.4212031e-05 5.3868685e-05 9.4285714 + 24300 0.0022547585 0 2.3946322e-05 1.331734e-05 5.2948407e-05 9.4285714 + 24400 0.0022901257 0 2.552016e-05 1.4594528e-05 5.3067402e-05 9.4285714 + 24500 0.0023537103 0 2.9369007e-05 1.5861923e-05 5.3200721e-05 9.4285714 + 24600 0.0023613708 0 2.9444021e-05 1.3691716e-05 5.4296289e-05 9.4285714 + 24700 0.0023237992 0 2.8805716e-05 1.1616027e-05 5.4142589e-05 9.4285714 + 24800 0.0024221927 0 3.1070958e-05 1.2059146e-05 5.406912e-05 9.4285714 + 24900 0.0025882547 0 3.7453428e-05 1.2082125e-05 5.4439426e-05 9.4285714 + 25000 0.0027152266 0 4.2549028e-05 1.1637136e-05 5.4292043e-05 9.4285714 + 25100 0.0028201154 0 4.6710609e-05 1.2903782e-05 5.3790595e-05 9.4285714 + 25200 0.0029086169 0 4.756645e-05 1.3260261e-05 5.7165687e-05 9.4285714 + 25300 0.0028528211 0 4.8705176e-05 1.1918164e-05 5.632163e-05 9.4285714 + 25400 0.0027655631 0 4.7538544e-05 1.186744e-05 5.3917832e-05 9.4285714 + 25500 0.0027631455 0 4.7296868e-05 1.2125391e-05 5.2651056e-05 9.4285714 + 25600 0.0027455338 0 4.8477007e-05 1.2403172e-05 5.7029384e-05 9.4285714 + 25700 0.0027314337 0 4.8377711e-05 1.254263e-05 5.7035789e-05 9.4285714 + 25800 0.0026789336 0 4.9232002e-05 1.1749936e-05 5.7580068e-05 9.4285714 + 25900 0.0026686904 0 5.0376929e-05 1.2811492e-05 5.9087927e-05 9.4285714 + 26000 0.0026703643 0 5.0974299e-05 1.3064292e-05 5.7801118e-05 9.4285714 + 26100 0.0026825353 0 4.9500137e-05 1.1676376e-05 5.695664e-05 9.4285714 + 26200 0.0026825174 0 4.972182e-05 1.0546822e-05 5.7622991e-05 9.4285714 + 26300 0.0025517718 0 4.36237e-05 1.082888e-05 5.8496458e-05 9.4285714 + 26400 0.002448155 0 3.6914303e-05 1.1208368e-05 6.0071981e-05 9.4285714 + 26500 0.0023334395 0 3.2968743e-05 1.0745176e-05 6.0011765e-05 9.4285714 + 26600 0.0023097701 0 3.0179184e-05 1.1497687e-05 5.9980393e-05 9.4285714 + 26700 0.0023614287 0 3.1929774e-05 1.4076482e-05 5.767606e-05 9.4285714 + 26800 0.0023955623 0 3.1551792e-05 1.7121208e-05 5.8187883e-05 9.4285714 + 26900 0.0019993736 0 1.8807723e-05 1.6770089e-05 5.7954922e-05 9.4285714 + 27000 0.0019497677 0 1.7354388e-05 1.6608976e-05 5.6225802e-05 9.4285714 + 27100 0.0020363076 0 2.1348268e-05 1.6918233e-05 5.7949239e-05 9.4285714 + 27200 0.0021974785 0 2.5205825e-05 2.0142198e-05 5.5376701e-05 9.4285714 + 27300 0.002350289 0 2.8900121e-05 2.3754068e-05 5.5263555e-05 9.4285714 + 27400 0.0026460053 0 3.2553147e-05 3.227333e-05 5.7954104e-05 9.4285714 + 27500 0.0027599044 0 3.2851254e-05 3.674649e-05 5.6341966e-05 9.4285714 + 27600 0.0026660556 0 3.2389038e-05 3.4626306e-05 5.5414375e-05 9.4285714 + 27700 0.0026060398 0 3.3223431e-05 3.2391399e-05 5.3340397e-05 9.4285714 + 27800 0.002724511 0 3.372415e-05 3.4485846e-05 5.4707128e-05 9.4285714 + 27900 0.0027318479 0 3.3234708e-05 3.5304313e-05 5.5589046e-05 9.4285714 + 28000 0.0026231478 0 3.2741313e-05 3.3225541e-05 5.398932e-05 9.4285714 + 28100 0.0025508556 0 3.3833477e-05 3.1513842e-05 5.4023598e-05 9.4285714 + 28200 0.0025807152 0 3.4548289e-05 3.3420009e-05 5.5627424e-05 9.4285714 + 28300 0.0024074206 0 3.0461599e-05 3.4140994e-05 5.6820341e-05 9.4285714 + 28400 0.0021292859 0 2.3624321e-05 3.4194604e-05 5.3656462e-05 9.4285714 + 28500 0.0022172558 0 1.8989998e-05 3.8241372e-05 5.0308571e-05 9.4285714 + 28600 0.0022653927 0 2.0006228e-05 4.1839298e-05 5.3834698e-05 9.4285714 + 28700 0.0025914898 0 2.4417865e-05 5.4161998e-05 5.2309701e-05 9.4285714 + 28800 0.0028276024 0 2.7173934e-05 5.9987722e-05 5.1277434e-05 9.4285714 + 28900 0.0029326653 0 2.9972273e-05 5.9404465e-05 5.3442041e-05 9.4285714 + 29000 0.002965493 0 3.0732118e-05 5.8813779e-05 5.4010354e-05 9.4285714 + 29100 0.0029096903 0 2.789911e-05 5.6948857e-05 5.3811328e-05 9.4285714 + 29200 0.0028604262 0 2.8541368e-05 5.5433392e-05 5.5266978e-05 9.4285714 + 29300 0.0028093312 0 3.1626568e-05 5.2793462e-05 5.9393321e-05 9.4285714 + 29400 0.0026786162 0 2.6580766e-05 4.1761109e-05 6.3731211e-05 9.4285714 + 29500 0.0025387867 0 2.4586262e-05 3.1439522e-05 6.5207101e-05 9.4285714 + 29600 0.0026569564 0 2.658665e-05 3.344894e-05 6.5578568e-05 9.4285714 + 29700 0.0027207144 0 2.4629031e-05 3.1640582e-05 7.3229358e-05 9.4285714 + 29800 0.0026892821 0 2.0092233e-05 2.9124688e-05 8.0756571e-05 9.4285714 + 29900 0.002643369 0 2.0481401e-05 3.0183662e-05 7.7273404e-05 9.4285714 + 30000 0.0026484998 0 1.9889243e-05 3.0560067e-05 7.7261634e-05 9.4285714 + 30100 0.0028058509 0 2.6399165e-05 3.004015e-05 8.3212623e-05 9.4285714 + 30200 0.0030353215 0 3.6921703e-05 3.4899864e-05 7.8543173e-05 9.4285714 + 30300 0.0030244988 0 4.0706399e-05 3.6091245e-05 7.4921988e-05 9.4285714 + 30400 0.0030855053 0 4.2502388e-05 3.8438853e-05 7.6268037e-05 9.4285714 + 30500 0.0031141819 0 4.3996743e-05 4.3726389e-05 6.8459715e-05 9.4285714 + 30600 0.0030115458 0 4.436657e-05 4.2288168e-05 6.5970726e-05 9.4285714 + 30700 0.0029700178 0 4.2448638e-05 4.1066034e-05 6.7905919e-05 9.4285714 + 30800 0.0029985358 0 4.3581039e-05 4.2782359e-05 6.616813e-05 9.4285714 + 30900 0.0029689517 0 4.3664983e-05 4.0341198e-05 6.6701993e-05 9.4285714 + 31000 0.0029622718 0 4.3233863e-05 3.8109114e-05 6.615517e-05 9.4285714 + 31100 0.0029693917 0 4.3443429e-05 3.6045147e-05 6.6807218e-05 9.4285714 + 31200 0.0027246348 0 3.8812502e-05 2.5969873e-05 6.9745525e-05 9.4285714 + 31300 0.0025368424 0 3.4331267e-05 2.1427734e-05 6.9565964e-05 9.4285714 + 31400 0.0023736698 0 3.2043786e-05 1.9880875e-05 6.6817156e-05 9.4285714 + 31500 0.0023946514 0 3.3170726e-05 1.9958211e-05 7.0242984e-05 9.4285714 + 31600 0.0025648037 0 3.5948214e-05 2.4022282e-05 7.8512704e-05 9.4285714 + 31700 0.0026956511 0 3.9195772e-05 3.3270216e-05 7.4223245e-05 9.4285714 + 31800 0.002677722 0 3.8651034e-05 3.4084086e-05 7.3747643e-05 9.4285714 + 31900 0.0026705496 0 3.8515991e-05 3.3258169e-05 7.4757118e-05 9.4285714 + 32000 0.0026466417 0 4.2241836e-05 3.449171e-05 7.0551161e-05 9.4285714 + 32100 0.0026464292 0 4.0974715e-05 3.6570061e-05 6.5387411e-05 9.4285714 + 32200 0.0023705665 0 2.951869e-05 3.011444e-05 6.6589524e-05 9.4285714 + 32300 0.0023183595 0 2.2729207e-05 3.0010044e-05 7.2706128e-05 9.4285714 + 32400 0.0023882969 0 2.372595e-05 3.1302357e-05 7.3782281e-05 9.4285714 + 32500 0.0023801754 0 2.2337455e-05 3.0476386e-05 7.5659736e-05 9.4285714 + 32600 0.0024127958 0 2.5510841e-05 3.0854572e-05 7.4410799e-05 9.4285714 + 32700 0.0024031675 0 2.7736693e-05 3.1958346e-05 7.1486437e-05 9.4285714 + 32800 0.0023770089 0 2.6385534e-05 3.3252416e-05 7.2822578e-05 9.4285714 + 32900 0.0023568819 0 2.8634678e-05 3.3258031e-05 6.7686839e-05 9.4285714 + 33000 0.0023407285 0 2.6769773e-05 3.2579304e-05 6.6690925e-05 9.4285714 + 33100 0.002327332 0 2.6645781e-05 3.4007498e-05 6.9628993e-05 9.4285714 + 33200 0.0023912585 0 2.3830565e-05 3.3441643e-05 7.4913813e-05 9.4285714 + 33300 0.0022984153 0 2.4483639e-05 3.2969557e-05 7.7726941e-05 9.4285714 + 33400 0.0022416368 0 2.3898793e-05 3.1031269e-05 7.686001e-05 9.4285714 + 33500 0.0022470637 0 2.0975902e-05 3.0084834e-05 7.570705e-05 9.4285714 + 33600 0.002256129 0 2.0520324e-05 2.8645032e-05 7.7384366e-05 9.4285714 + 33700 0.0022125246 0 1.9872713e-05 2.9850887e-05 7.5881174e-05 9.4285714 + 33800 0.0021842197 0 1.9711523e-05 2.983205e-05 7.3213854e-05 9.4285714 + 33900 0.0021690567 0 1.8055303e-05 2.828677e-05 7.3059722e-05 9.4285714 + 34000 0.0022206311 0 1.8792994e-05 2.8714121e-05 7.5766963e-05 9.4285714 + 34100 0.0022494061 0 2.1426406e-05 2.9683277e-05 7.5164305e-05 9.4285714 + 34200 0.0022085859 0 2.1896897e-05 2.8930132e-05 7.2805525e-05 9.4285714 + 34300 0.0021855633 0 2.0480867e-05 2.9992196e-05 7.2354191e-05 9.4285714 + 34400 0.0021798298 0 2.1236448e-05 3.2053048e-05 7.283282e-05 9.4285714 + 34500 0.0021267289 0 2.2129794e-05 2.8881701e-05 7.1551685e-05 9.4285714 + 34600 0.0020466804 0 2.3010184e-05 2.7531882e-05 7.2523946e-05 9.4285714 + 34700 0.0020969555 0 2.1337061e-05 3.0266865e-05 7.0863423e-05 9.4285714 + 34800 0.0022946237 0 2.2123517e-05 3.8911524e-05 7.2703415e-05 9.4285714 + 34900 0.0024490201 0 2.8420828e-05 5.0378173e-05 7.1772848e-05 9.4285714 + 35000 0.0023320217 0 2.8176618e-05 5.1789577e-05 6.8023074e-05 9.4285714 + 35100 0.0021890324 0 2.4442013e-05 5.2547725e-05 6.1661973e-05 9.4285714 + 35200 0.0022124553 0 2.4530724e-05 5.096875e-05 6.5186855e-05 9.4285714 + 35300 0.0022584165 0 2.7542443e-05 5.427333e-05 6.7536963e-05 9.4285714 + 35400 0.0022737238 0 2.504131e-05 5.4367041e-05 6.7123718e-05 9.4285714 + 35500 0.0021537481 0 2.1567488e-05 4.8699315e-05 6.7335416e-05 9.4285714 + 35600 0.0019831613 0 1.8746091e-05 4.3656184e-05 6.3180625e-05 9.4285714 + 35700 0.0019041909 0 1.9945089e-05 4.3868252e-05 5.8115913e-05 9.4285714 + 35800 0.0018216502 0 2.2392614e-05 4.2188069e-05 5.7629004e-05 9.4285714 + 35900 0.0018071574 0 2.1141753e-05 4.1327783e-05 5.630057e-05 9.4285714 + 36000 0.0018645267 0 2.2735521e-05 4.4296822e-05 5.4259075e-05 9.4285714 + 36100 0.0018474198 0 2.5295637e-05 4.6128849e-05 5.7469914e-05 9.4285714 + 36200 0.0017366166 0 2.6021589e-05 4.5563756e-05 5.5296808e-05 9.4285714 + 36300 0.0016630877 0 2.4135763e-05 4.58324e-05 5.2179718e-05 9.4285714 + 36400 0.0016809967 0 2.3427379e-05 4.7533202e-05 4.714932e-05 9.4285714 + 36500 0.0017478488 0 2.4021161e-05 4.6508842e-05 4.3949519e-05 9.4285714 + 36600 0.0017244649 0 2.3504871e-05 4.3628584e-05 4.3171518e-05 9.4285714 + 36700 0.001694793 0 2.2302323e-05 4.2349904e-05 4.396766e-05 9.4285714 + 36800 0.0016321204 0 2.1042421e-05 3.6396346e-05 4.4901304e-05 9.4285714 + 36900 0.0015208954 0 2.0456403e-05 2.7850556e-05 4.5155127e-05 9.4285714 + 37000 0.0014068755 0 2.0241724e-05 2.1785718e-05 4.5528636e-05 9.4285714 + 37100 0.0013361229 0 1.675977e-05 2.1314381e-05 4.6611487e-05 9.4285714 + 37200 0.001331474 0 1.6204509e-05 2.3621819e-05 5.0433204e-05 9.4285714 + 37300 0.0013895388 0 1.6721652e-05 3.0265014e-05 5.0091541e-05 9.4285714 + 37400 0.001407333 0 1.738976e-05 2.8850978e-05 5.1334019e-05 9.4285714 + 37500 0.0013815772 0 1.6241641e-05 3.0837468e-05 4.6825094e-05 9.4285714 + 37600 0.001367937 0 1.1983552e-05 2.9613642e-05 5.0754355e-05 9.4285714 + 37700 0.0013781896 0 1.1915379e-05 2.9242244e-05 4.8777649e-05 9.4285714 + 37800 0.0013938097 0 1.1529951e-05 3.1628776e-05 4.7715639e-05 9.4285714 + 37900 0.0013788852 0 1.2561324e-05 3.1951817e-05 4.7999073e-05 9.4285714 + 38000 0.0013409916 0 1.2473952e-05 3.1146722e-05 4.8401798e-05 9.4285714 + 38100 0.0013548793 0 1.1004651e-05 2.7320574e-05 4.9651495e-05 9.4285714 + 38200 0.0013619894 0 1.2229314e-05 2.574689e-05 4.9387883e-05 9.4285714 + 38300 0.0013593654 0 1.3392954e-05 2.427172e-05 5.1848635e-05 9.4285714 + 38400 0.0013488508 0 1.256534e-05 2.449982e-05 5.4623064e-05 9.4285714 + 38500 0.0013399961 0 1.2037162e-05 2.0814078e-05 5.6078474e-05 9.4285714 + 38600 0.0013473117 0 1.1744489e-05 1.6853428e-05 5.7231621e-05 9.4285714 + 38700 0.0013275262 0 1.093468e-05 1.4795508e-05 5.769577e-05 9.4285714 + 38800 0.001304838 0 1.1068283e-05 1.3115698e-05 6.0324982e-05 9.4285714 + 38900 0.0012981525 0 1.1709325e-05 1.3131645e-05 5.9760468e-05 9.4285714 + 39000 0.0013241474 0 1.261896e-05 1.4616086e-05 6.0256213e-05 9.4285714 + 39100 0.0013302715 0 1.1838509e-05 1.5600129e-05 6.432053e-05 9.4285714 + 39200 0.0013338793 0 1.2403697e-05 1.6279003e-05 6.2961888e-05 9.4285714 + 39300 0.001337749 0 1.3137034e-05 1.6207867e-05 6.0627848e-05 9.4285714 + 39400 0.0014184127 0 1.6180184e-05 1.8165982e-05 5.8887905e-05 9.4285714 + 39500 0.0015076229 0 1.9522159e-05 1.9795428e-05 5.910332e-05 9.4285714 + 39600 0.001584196 0 2.4027089e-05 2.0838917e-05 5.7603421e-05 9.4285714 + 39700 0.0016673141 0 2.9500045e-05 2.3045542e-05 5.5891462e-05 9.4285714 + 39800 0.0016983633 0 3.0305739e-05 2.4453535e-05 5.5981899e-05 9.4285714 + 39900 0.001721388 0 3.1340689e-05 2.4975831e-05 5.5548483e-05 9.4285714 + 40000 0.0016511866 0 3.370998e-05 2.6328206e-05 5.671433e-05 9.4285714 + 40100 0.0015902117 0 3.3681877e-05 2.5663116e-05 5.3013557e-05 9.4285714 + 40200 0.0016248457 0 3.0865269e-05 2.5397352e-05 5.1452424e-05 9.4285714 + 40300 0.001639017 0 3.1973896e-05 2.5525448e-05 5.4813301e-05 9.4285714 + 40400 0.0015947128 0 3.5965857e-05 2.5225505e-05 5.6385827e-05 9.4285714 + 40500 0.0014886812 0 3.7017265e-05 2.4882355e-05 5.2995469e-05 9.4285714 + 40600 0.001483951 0 3.4221499e-05 2.1479298e-05 5.4046331e-05 9.4285714 + 40700 0.0014877422 0 3.362595e-05 1.8839863e-05 5.5203171e-05 9.4285714 + 40800 0.0014974798 0 3.6392277e-05 1.7485578e-05 5.7247772e-05 9.4285714 + 40900 0.0014499802 0 3.3431089e-05 1.9674968e-05 5.6160238e-05 9.4285714 + 41000 0.001395913 0 2.9658496e-05 1.8273286e-05 5.6527772e-05 9.4285714 + 41100 0.0014079985 0 2.9771219e-05 1.6179289e-05 5.9153644e-05 9.4285714 + 41200 0.0014187083 0 2.7845336e-05 1.9035184e-05 5.7573549e-05 9.4285714 + 41300 0.0014072972 0 2.4886378e-05 2.0795562e-05 5.4986012e-05 9.4285714 + 41400 0.0014168981 0 2.358191e-05 2.1908287e-05 5.4674995e-05 9.4285714 + 41500 0.0014248439 0 2.3385735e-05 2.3170658e-05 5.3269277e-05 9.4285714 + 41600 0.0014225044 0 2.376616e-05 2.5694883e-05 5.2138491e-05 9.4285714 + 41700 0.0014075811 0 2.2374247e-05 2.7567814e-05 5.1299283e-05 9.4285714 + 41800 0.0012680617 0 2.2171263e-05 2.5019906e-05 5.4594068e-05 9.4285714 + 41900 0.0010587818 0 1.5440824e-05 2.093143e-05 5.3361822e-05 9.4285714 + 42000 0.0010007004 0 1.2044875e-05 1.7303459e-05 5.3021476e-05 9.4285714 + 42100 0.0011304402 0 1.2464466e-05 1.9304071e-05 5.5030158e-05 9.4285714 + 42200 0.0012833154 0 1.6978814e-05 2.4344322e-05 5.4664913e-05 9.4285714 + 42300 0.0013573853 0 1.8276863e-05 2.7764513e-05 5.4832226e-05 9.4285714 + 42400 0.0013330633 0 1.7445663e-05 2.5994427e-05 5.6219048e-05 9.4285714 + 42500 0.0012896373 0 1.7549999e-05 2.4461263e-05 5.5316804e-05 9.4285714 + 42600 0.001296775 0 1.7579818e-05 2.4729094e-05 5.4786174e-05 9.4285714 + 42700 0.0013193969 0 1.7589942e-05 2.6653321e-05 5.5601741e-05 9.4285714 + 42800 0.0013144903 0 1.7344148e-05 2.7396405e-05 5.6063261e-05 9.4285714 + 42900 0.0013053554 0 1.812017e-05 2.4357577e-05 5.5400672e-05 9.4285714 + 43000 0.0013061323 0 1.7976023e-05 2.5672617e-05 5.5591174e-05 9.4285714 + 43100 0.0013149372 0 1.8049252e-05 2.7694066e-05 5.7517507e-05 9.4285714 + 43200 0.0013063189 0 1.8000018e-05 2.5312637e-05 5.7758611e-05 9.4285714 + 43300 0.0012669853 0 1.7756679e-05 2.3718058e-05 5.7316755e-05 9.4285714 + 43400 0.0012238388 0 2.0194584e-05 2.1983277e-05 5.5573072e-05 9.4285714 + 43500 0.0012053096 0 2.0662764e-05 2.2371854e-05 5.3240833e-05 9.4285714 + 43600 0.001243323 0 2.3521544e-05 2.3272124e-05 5.4438848e-05 9.4285714 + 43700 0.001354992 0 2.8388806e-05 2.6835727e-05 5.1695181e-05 9.4285714 + 43800 0.0015252788 0 3.4452462e-05 3.2972955e-05 5.1148386e-05 9.4285714 + 43900 0.0016845587 0 3.7891883e-05 3.7259267e-05 5.3712665e-05 9.4285714 + 44000 0.0016987088 0 3.794299e-05 3.9188564e-05 5.22906e-05 9.4285714 + 44100 0.0016663634 0 3.6807094e-05 3.9253716e-05 5.2294244e-05 9.4285714 + 44200 0.0016642734 0 3.7043503e-05 3.9518624e-05 5.2702041e-05 9.4285714 + 44300 0.0016877933 0 3.8179716e-05 4.0630461e-05 5.3339506e-05 9.4285714 + 44400 0.0016937941 0 3.7131293e-05 4.1066259e-05 5.432841e-05 9.4285714 + 44500 0.001658184 0 3.5564842e-05 3.9986051e-05 5.4994687e-05 9.4285714 + 44600 0.0016202756 0 3.6182348e-05 4.0514972e-05 5.4343097e-05 9.4285714 + 44700 0.0012624519 0 3.6496068e-05 3.330838e-05 6.0193182e-05 9.4285714 + 44800 0.0012148648 0 3.7546572e-05 2.4531512e-05 6.0795743e-05 9.4285714 + 44900 0.0012565599 0 2.9767991e-05 2.3526786e-05 5.730112e-05 9.4285714 + 45000 0.0012298496 0 3.3326423e-05 2.2497973e-05 5.3986547e-05 9.4285714 + 45100 0.0012274205 0 3.310721e-05 2.2786466e-05 5.5167469e-05 9.4285714 + 45200 0.0012389066 0 3.4925053e-05 2.3497387e-05 5.4884661e-05 9.4285714 + 45300 0.0012251609 0 3.615161e-05 2.3152279e-05 5.3650078e-05 9.4285714 + 45400 0.0012814774 0 3.746516e-05 2.4153096e-05 5.1029288e-05 9.4285714 + 45500 0.0013450626 0 3.9489551e-05 2.6213973e-05 5.0267505e-05 9.4285714 + 45600 0.0013741472 0 4.2751714e-05 2.6741902e-05 4.9140966e-05 9.4285714 + 45700 0.0014351223 0 4.3930849e-05 2.6748326e-05 4.9411273e-05 9.4285714 + 45800 0.0015284371 0 4.6485067e-05 2.8704517e-05 4.9999511e-05 9.4285714 + 45900 0.001575355 0 4.5717321e-05 3.011393e-05 5.1143199e-05 9.4285714 + 46000 0.0015147792 0 4.1325851e-05 3.0384448e-05 5.1923e-05 9.4285714 + 46100 0.0014504182 0 3.9540594e-05 3.1635289e-05 5.0948968e-05 9.4285714 + 46200 0.0014410639 0 3.965176e-05 3.0362005e-05 4.8786102e-05 9.4285714 + 46300 0.0014810525 0 4.1568241e-05 3.0756475e-05 4.8680363e-05 9.4285714 + 46400 0.0014640215 0 4.309465e-05 2.985089e-05 4.9009517e-05 9.4285714 + 46500 0.0014424933 0 4.2309209e-05 2.9280621e-05 4.8629444e-05 9.4285714 + 46600 0.001441165 0 4.2539286e-05 3.0934085e-05 4.9784857e-05 9.4285714 + 46700 0.0015025344 0 4.4979228e-05 3.1000179e-05 4.8462809e-05 9.4285714 + 46800 0.0015582176 0 4.7282405e-05 3.2706414e-05 4.5724526e-05 9.4285714 + 46900 0.0015803324 0 4.7650091e-05 3.4907217e-05 4.4832148e-05 9.4285714 + 47000 0.001675143 0 5.1693701e-05 3.6882816e-05 4.6006875e-05 9.4285714 + 47100 0.0017769921 0 5.6400585e-05 3.9830957e-05 4.6950937e-05 9.4285714 + 47200 0.0018358006 0 5.9232345e-05 4.3665585e-05 4.6768506e-05 9.4285714 + 47300 0.0017951326 0 5.6422198e-05 4.3944608e-05 4.8336201e-05 9.4285714 + 47400 0.0017057371 0 5.4710398e-05 3.9941549e-05 4.7652027e-05 9.4285714 + 47500 0.0016744493 0 5.2852149e-05 3.7232824e-05 4.5384467e-05 9.4285714 + 47600 0.0014031951 0 4.1326626e-05 3.0025176e-05 4.3875657e-05 9.4285714 + 47700 0.0013373039 0 3.7514245e-05 2.9655038e-05 4.316088e-05 9.4285714 + 47800 0.0014704003 0 4.1417238e-05 3.4940895e-05 4.447442e-05 9.4285714 + 47900 0.0014934525 0 4.3132757e-05 3.7137359e-05 4.4062556e-05 9.4285714 + 48000 0.0014895856 0 4.6046202e-05 3.6927333e-05 4.3726122e-05 9.4285714 + 48100 0.00146967 0 4.6872982e-05 3.9649234e-05 4.597459e-05 9.4285714 + 48200 0.0015682986 0 4.8924923e-05 4.738992e-05 4.3767565e-05 9.4285714 + 48300 0.0017163505 0 5.2171663e-05 5.3787554e-05 4.4084292e-05 9.4285714 + 48400 0.0014261936 0 4.3093196e-05 5.6810791e-05 5.4178929e-05 9.4285714 + 48500 0.0014236361 0 3.9093573e-05 4.8266345e-05 5.346877e-05 9.4285714 + 48600 0.0014562257 0 4.0734834e-05 4.2323892e-05 4.8295024e-05 9.4285714 + 48700 0.0013758282 0 3.6847543e-05 3.5139344e-05 4.8073535e-05 9.4285714 + 48800 0.0014316476 0 3.7554019e-05 3.5556116e-05 4.7370089e-05 9.4285714 + 48900 0.0014805023 0 3.5226264e-05 3.3817592e-05 5.2499511e-05 9.4285714 + 49000 0.0013776549 0 3.2439848e-05 2.997493e-05 5.3101978e-05 9.4285714 + 49100 0.0013617488 0 3.2279492e-05 3.0772411e-05 5.1632538e-05 9.4285714 + 49200 0.0013342401 0 2.8600175e-05 3.2651245e-05 5.3349695e-05 9.4285714 + 49300 0.001276486 0 2.7777544e-05 2.96306e-05 5.4374435e-05 9.4285714 + 49400 0.0011795288 0 2.2827442e-05 2.8085944e-05 5.2012108e-05 9.4285714 + 49500 0.0011435859 0 2.2873378e-05 2.7199584e-05 4.8565744e-05 9.4285714 + 49600 0.001247689 0 2.5002038e-05 3.0378272e-05 5.4987332e-05 9.4285714 + 49700 0.0013371245 0 2.6349724e-05 3.4033827e-05 5.8350385e-05 9.4285714 + 49800 0.001301722 0 2.4983049e-05 3.3355962e-05 5.7259996e-05 9.4285714 + 49900 0.0012728363 0 2.4271773e-05 3.366383e-05 5.4969958e-05 9.4285714 + 50000 0.0013286836 0 2.4626397e-05 3.4888455e-05 5.6333036e-05 9.4285714 + 50100 0.0013460063 0 2.5626025e-05 3.4617082e-05 5.8834535e-05 9.4285714 + 50200 0.0012868089 0 2.3749355e-05 3.3262754e-05 5.7555068e-05 9.4285714 + 50300 0.0012765172 0 2.3286644e-05 3.285494e-05 5.6753429e-05 9.4285714 + 50400 0.0012703222 0 2.2664849e-05 3.2123476e-05 5.8001158e-05 9.4285714 + 50500 0.0011906512 0 1.8988144e-05 2.5734872e-05 6.0360828e-05 9.4285714 + 50600 0.0011537339 0 1.7108695e-05 2.2700119e-05 6.3433107e-05 9.4285714 + 50700 0.0011267336 0 1.7970895e-05 2.4672948e-05 5.8568632e-05 9.4285714 + 50800 0.0011753482 0 1.9468991e-05 2.5939765e-05 5.9862885e-05 9.4285714 + 50900 0.0011919232 0 2.0208188e-05 2.7321787e-05 5.9048906e-05 9.4285714 + 51000 0.0011838525 0 2.1827961e-05 2.9118892e-05 5.2803692e-05 9.4285714 + 51100 0.0011883954 0 2.2709257e-05 2.8506733e-05 5.4654615e-05 9.4285714 + 51200 0.0012349694 0 2.5890907e-05 2.8698467e-05 5.7896353e-05 9.4285714 + 51300 0.0012337432 0 2.7687089e-05 2.7653507e-05 5.9917212e-05 9.4285714 + 51400 0.0011577306 0 2.8378044e-05 2.3224364e-05 5.8057014e-05 9.4285714 + 51500 0.0011811724 0 2.8435714e-05 2.1929674e-05 5.9722575e-05 9.4285714 + 51600 0.0012159313 0 3.1521829e-05 2.2796335e-05 5.924849e-05 9.4285714 + 51700 0.0011936762 0 3.4012729e-05 2.3864808e-05 5.7265759e-05 9.4285714 + 51800 0.00119466 0 3.5158377e-05 2.5231988e-05 5.8412082e-05 9.4285714 + 51900 0.0012013641 0 3.3334001e-05 2.6816388e-05 5.861301e-05 9.4285714 + 52000 0.0011652185 0 3.0940041e-05 2.6655324e-05 5.7090011e-05 9.4285714 + 52100 0.0011222289 0 3.1077905e-05 2.4541748e-05 5.5666069e-05 9.4285714 + 52200 0.0011223637 0 3.2939544e-05 2.5096815e-05 5.6416173e-05 9.4285714 + 52300 0.00108781 0 3.4613486e-05 2.7303053e-05 5.6746437e-05 9.4285714 + 52400 0.0010329114 0 3.6196201e-05 2.8068523e-05 5.2439815e-05 9.4285714 + 52500 0.0010414794 0 3.673215e-05 2.7272718e-05 5.143023e-05 9.4285714 + 52600 0.0011160581 0 3.5468006e-05 2.7495373e-05 5.401667e-05 9.4285714 + 52700 0.0011365494 0 3.6522651e-05 2.8130517e-05 5.1952685e-05 9.4285714 + 52800 0.0011528486 0 3.8067909e-05 3.2231442e-05 4.9590134e-05 9.4285714 + 52900 0.001215765 0 4.2804899e-05 3.6927536e-05 5.1170177e-05 9.4285714 + 53000 0.0013368124 0 4.5592002e-05 4.1563931e-05 5.4427869e-05 9.4285714 + 53100 0.0013407312 0 4.5591201e-05 4.3600841e-05 4.9047373e-05 9.4285714 + 53200 0.0013326843 0 4.4821382e-05 4.1764227e-05 4.6186223e-05 9.4285714 + 53300 0.0013239729 0 4.3827862e-05 4.4020784e-05 4.3852213e-05 9.4285714 + 53400 0.0013217143 0 4.3572994e-05 4.7084118e-05 4.3149657e-05 9.4285714 + 53500 0.0012781803 0 4.460572e-05 4.8061498e-05 4.2708059e-05 9.4285714 + 53600 0.001268382 0 4.458824e-05 4.5673787e-05 4.1230488e-05 9.4285714 + 53700 0.0012069904 0 4.1562438e-05 4.2697726e-05 4.1986265e-05 9.4285714 + 53800 0.0011968988 0 4.5963049e-05 4.0317052e-05 4.3564542e-05 9.4285714 + 53900 0.0011731954 0 4.5626132e-05 3.9016561e-05 4.2699438e-05 9.4285714 + 54000 0.0011606061 0 4.2734103e-05 3.8922865e-05 4.2063758e-05 9.4285714 + 54100 0.0011658982 0 3.9764581e-05 3.672962e-05 4.7476053e-05 9.4285714 + 54200 0.0011195165 0 3.5569124e-05 3.3590873e-05 4.8421311e-05 9.4285714 + 54300 0.0010220393 0 3.2252593e-05 3.0968164e-05 4.987935e-05 9.4285714 + 54400 0.0010086172 0 3.6631232e-05 3.0359237e-05 5.1629214e-05 9.4285714 + 54500 0.0010183988 0 3.7406525e-05 2.632072e-05 5.1823266e-05 9.4285714 + 54600 0.0010068716 0 3.6673782e-05 2.3899354e-05 4.883163e-05 9.4285714 + 54700 0.00099012603 0 3.3975738e-05 2.2165277e-05 4.788027e-05 9.4285714 + 54800 0.0009683722 0 3.235553e-05 2.2982659e-05 5.0112286e-05 9.4285714 + 54900 0.00097629715 0 3.2268492e-05 2.5601046e-05 4.8627644e-05 9.4285714 + 55000 0.00095157382 0 3.1040046e-05 2.437472e-05 4.637034e-05 9.4285714 + 55100 0.00090688968 0 2.9340275e-05 2.1953227e-05 4.3141384e-05 9.4285714 + 55200 0.00088813057 0 2.8284065e-05 2.1733676e-05 4.2934237e-05 9.4285714 + 55300 0.00092557007 0 2.8620339e-05 2.3675426e-05 4.3885475e-05 9.4285714 + 55400 0.00091327263 0 2.762239e-05 2.641616e-05 4.4396082e-05 9.4285714 + 55500 0.00079921186 0 2.9224842e-05 2.5168399e-05 4.3290943e-05 9.4285714 + 55600 0.00081947901 0 2.8418244e-05 2.2268749e-05 4.9968371e-05 9.4285714 + 55700 0.00084804465 0 2.1646302e-05 2.3720621e-05 5.205521e-05 9.4285714 + 55800 0.00085118568 0 2.2504085e-05 2.2872302e-05 4.9963437e-05 9.4285714 + 55900 0.00079015144 0 2.1456661e-05 1.9796776e-05 4.8884464e-05 9.4285714 + 56000 0.00077424122 0 2.2875959e-05 1.721853e-05 4.7217244e-05 9.4285714 + 56100 0.00078729859 0 2.750101e-05 1.8189823e-05 4.7065369e-05 9.4285714 + 56200 0.00073803593 0 2.8848488e-05 1.8153302e-05 4.571796e-05 9.4285714 + 56300 0.00072042566 0 2.842146e-05 1.5690166e-05 4.4828579e-05 9.4285714 + 56400 0.00072618636 0 2.7559372e-05 1.5504007e-05 4.399204e-05 9.4285714 + 56500 0.00072889383 0 2.7924251e-05 1.6823511e-05 4.2305183e-05 9.4285714 + 56600 0.00071687768 0 2.9101443e-05 1.6332857e-05 4.2086891e-05 9.4285714 + 56700 0.00070767909 0 3.0080534e-05 1.532979e-05 4.2661404e-05 9.4285714 + 56800 0.0007079533 0 2.8817943e-05 1.6206535e-05 4.2253735e-05 9.4285714 + 56900 0.00068006672 0 2.7371942e-05 1.7051153e-05 3.9711699e-05 9.4285714 + 57000 0.000671041 0 2.6892964e-05 1.5542748e-05 3.8373488e-05 9.4285714 + 57100 0.00074371147 0 2.8066609e-05 1.8321889e-05 3.9806125e-05 9.4285714 + 57200 0.00081400221 0 2.8670502e-05 2.8899856e-05 4.0663376e-05 9.4285714 + 57300 0.000917037 0 2.7824502e-05 3.9014624e-05 4.2174406e-05 9.4285714 + 57400 0.00094626663 0 2.5794485e-05 4.1535293e-05 4.2086614e-05 9.4285714 + 57500 0.00093346301 0 2.5487117e-05 4.0862488e-05 4.1990151e-05 9.4285714 + 57600 0.00093999622 0 2.6720752e-05 4.0748175e-05 4.3650361e-05 9.4285714 + 57700 0.00094337314 0 2.639701e-05 4.0729782e-05 4.5121665e-05 9.4285714 + 57800 0.00092645123 0 2.6909739e-05 4.0150191e-05 4.3822005e-05 9.4285714 + 57900 0.00091253668 0 2.5642193e-05 3.6671075e-05 4.4028328e-05 9.4285714 + 58000 0.0009262852 0 2.4409205e-05 3.4409346e-05 4.4000636e-05 9.4285714 + 58100 0.00093298888 0 2.3677747e-05 3.2551966e-05 4.3694114e-05 9.4285714 + 58200 0.00093354721 0 2.2375814e-05 3.2117822e-05 4.4639312e-05 9.4285714 + 58300 0.00093283167 0 2.2884257e-05 3.090895e-05 4.5086768e-05 9.4285714 + 58400 0.00093485322 0 2.3712272e-05 3.0236548e-05 4.5930955e-05 9.4285714 + 58500 0.00092566721 0 2.405659e-05 2.87637e-05 4.8903625e-05 9.4285714 + 58600 0.00093205032 0 2.3525309e-05 2.8285934e-05 5.2291285e-05 9.4285714 + 58700 0.00094034992 0 2.4008311e-05 2.5804337e-05 5.3505489e-05 9.4285714 + 58800 0.00096489026 0 2.4355825e-05 2.8532919e-05 5.3761099e-05 9.4285714 + 58900 0.00097781296 0 2.6084526e-05 3.1039765e-05 5.2910774e-05 9.4285714 + 59000 0.00095088201 0 2.7035865e-05 3.1452129e-05 5.3165727e-05 9.4285714 + 59100 0.00092096092 0 2.6786706e-05 3.382956e-05 5.0768712e-05 9.4285714 + 59200 0.0009112309 0 2.5867113e-05 3.4359567e-05 4.9291183e-05 9.4285714 + 59300 0.00090372653 0 2.5622941e-05 3.7144276e-05 4.7289805e-05 9.4285714 + 59400 0.00086115007 0 2.2280155e-05 3.5823023e-05 4.6830658e-05 9.4285714 + 59500 0.00078451189 0 2.2220981e-05 2.6156784e-05 4.6914457e-05 9.4285714 + 59600 0.00078587175 0 2.3370931e-05 2.5032607e-05 4.9704371e-05 9.4285714 + 59700 0.00080103949 0 2.387346e-05 2.8536648e-05 4.7938414e-05 9.4285714 + 59800 0.00078782591 0 2.319423e-05 2.8210585e-05 4.7677072e-05 9.4285714 + 59900 0.00077243837 0 2.3631843e-05 2.8691006e-05 4.7228518e-05 9.4285714 + 60000 0.00075159859 0 2.3775193e-05 2.9335754e-05 4.5277107e-05 9.4285714 + 60100 0.00072169229 0 2.1979779e-05 3.0104074e-05 4.5923405e-05 9.4285714 + 60200 0.00067937954 0 2.0306575e-05 2.8735522e-05 4.5275658e-05 9.4285714 + 60300 0.00067260226 0 2.0810173e-05 2.6609433e-05 4.3648953e-05 9.4285714 + 60400 0.00069286984 0 2.4253823e-05 2.5126495e-05 4.258699e-05 9.4285714 + 60500 0.00069736312 0 2.7101459e-05 2.4283276e-05 4.2346847e-05 9.4285714 + 60600 0.00069858614 0 2.5781332e-05 2.4087945e-05 4.2183121e-05 9.4285714 + 60700 0.00069821214 0 2.4965653e-05 2.080958e-05 4.1576529e-05 9.4285714 + 60800 0.0007035508 0 2.5136105e-05 1.82106e-05 4.2416771e-05 9.4285714 + 60900 0.00070770846 0 2.4339709e-05 1.7024772e-05 4.3565509e-05 9.4285714 + 61000 0.00070195965 0 2.4160978e-05 1.561415e-05 4.4516846e-05 9.4285714 + 61100 0.00067865064 0 2.4754436e-05 1.6095324e-05 4.5917833e-05 9.4285714 + 61200 0.00063690893 0 2.2652857e-05 1.7060397e-05 4.715524e-05 9.4285714 + 61300 0.00064194236 0 2.2650362e-05 1.4267909e-05 4.3531168e-05 9.4285714 + 61400 0.00063121847 0 2.1529461e-05 1.2841701e-05 4.0585367e-05 9.4285714 + 61500 0.00065356029 0 2.3536414e-05 1.3344947e-05 4.1167487e-05 9.4285714 + 61600 0.00066743886 0 2.4866121e-05 1.3946269e-05 4.176316e-05 9.4285714 + 61700 0.00064876312 0 2.3723161e-05 1.3749913e-05 4.2058416e-05 9.4285714 + 61800 0.00063251553 0 2.3037843e-05 1.2308212e-05 4.1311007e-05 9.4285714 + 61900 0.00065196202 0 2.371008e-05 1.2119818e-05 4.1136972e-05 9.4285714 + 62000 0.00066211487 0 2.4305587e-05 1.3415536e-05 4.1013521e-05 9.4285714 + 62100 0.00063838911 0 2.3294318e-05 1.377487e-05 4.0954053e-05 9.4285714 + 62200 0.00062154839 0 2.1558175e-05 1.3359191e-05 4.1245046e-05 9.4285714 + 62300 0.00063042258 0 2.1018073e-05 1.3643859e-05 4.2295629e-05 9.4285714 + 62400 0.00064307282 0 2.2417944e-05 1.3691778e-05 4.3440168e-05 9.4285714 + 62500 0.00062261967 0 2.2993973e-05 1.3754566e-05 4.4100385e-05 9.4285714 + 62600 0.00053916399 0 1.5362019e-05 1.2502815e-05 4.4138039e-05 9.4285714 + 62700 0.00057010612 0 1.5796506e-05 1.2697622e-05 4.4452456e-05 9.4285714 + 62800 0.00057237373 0 1.5874305e-05 1.325341e-05 4.3827972e-05 9.4285714 + 62900 0.00056115858 0 1.6555148e-05 1.3080646e-05 4.434918e-05 9.4285714 + 63000 0.0005691916 0 1.7337274e-05 1.3018716e-05 4.5966666e-05 9.4285714 + 63100 0.00056814223 0 1.8372705e-05 1.3213928e-05 4.5013147e-05 9.4285714 + 63200 0.00055359969 0 1.7755667e-05 1.226889e-05 4.4263871e-05 9.4285714 + 63300 0.00053663894 0 1.6493197e-05 1.0859989e-05 4.3835591e-05 9.4285714 + 63400 0.00055318219 0 1.7265416e-05 1.2265785e-05 4.2879248e-05 9.4285714 + 63500 0.0005601025 0 1.7295499e-05 1.4239119e-05 4.3011721e-05 9.4285714 + 63600 0.00054583913 0 1.6525634e-05 1.4678843e-05 4.2469934e-05 9.4285714 + 63700 0.00053483868 0 1.6625875e-05 1.5078172e-05 4.2493824e-05 9.4285714 + 63800 0.00055522493 0 1.7480604e-05 1.5374684e-05 4.272595e-05 9.4285714 + 63900 0.00056121598 0 1.7772973e-05 1.5172133e-05 4.2798662e-05 9.4285714 + 64000 0.00054407633 0 1.6885044e-05 1.413276e-05 4.2546454e-05 9.4285714 + 64100 0.00053661653 0 1.6234338e-05 1.403684e-05 4.2825695e-05 9.4285714 + 64200 0.00055006192 0 1.6649951e-05 1.4056747e-05 4.3482046e-05 9.4285714 + 64300 0.00055163304 0 1.6461598e-05 1.3167903e-05 4.3726787e-05 9.4285714 + 64400 0.00053078787 0 1.6251525e-05 1.19464e-05 4.3358318e-05 9.4285714 + 64500 0.00052058058 0 1.6643557e-05 1.2630836e-05 4.3429169e-05 9.4285714 + 64600 0.00052834957 0 1.7353655e-05 1.364227e-05 4.2400392e-05 9.4285714 + 64700 0.00051311026 0 1.758087e-05 1.4884436e-05 4.228116e-05 9.4285714 + 64800 0.00048606856 0 1.8167314e-05 1.5185881e-05 4.1313198e-05 9.4285714 + 64900 0.00047345864 0 1.8776746e-05 1.5164217e-05 3.998748e-05 9.4285714 + 65000 0.00048454696 0 1.8995386e-05 1.4818088e-05 3.9244802e-05 9.4285714 + 65100 0.00048928041 0 1.8341025e-05 1.3978549e-05 3.9434274e-05 9.4285714 + 65200 0.00047037779 0 1.7440302e-05 1.2970355e-05 3.8631037e-05 9.4285714 + 65300 0.000474477 0 1.7730462e-05 1.2778417e-05 3.8374171e-05 9.4285714 + 65400 0.00047558993 0 1.8645893e-05 1.303845e-05 3.9299974e-05 9.4285714 + 65500 0.00046258212 0 1.8683635e-05 1.2737042e-05 3.99647e-05 9.4285714 + 65600 0.00044433429 0 1.6571796e-05 1.2754279e-05 3.8518715e-05 9.4285714 + 65700 0.00045238336 0 1.5273478e-05 1.2923777e-05 3.6940008e-05 9.4285714 + 65800 0.00045926142 0 1.5338149e-05 1.2009407e-05 3.6438821e-05 9.4285714 + 65900 0.00045814994 0 1.5980648e-05 1.1749036e-05 3.6297575e-05 9.4285714 + 66000 0.00045395179 0 1.7924167e-05 1.2624087e-05 3.7065746e-05 9.4285714 + 66100 0.00044097892 0 1.9034226e-05 1.356976e-05 3.8933851e-05 9.4285714 + 66200 0.00041508101 0 1.8402026e-05 1.4705713e-05 3.8748663e-05 9.4285714 + 66300 0.00041227685 0 1.908236e-05 1.6649716e-05 3.7753553e-05 9.4285714 + 66400 0.00039539458 0 1.8057048e-05 1.6143874e-05 3.7074006e-05 9.4285714 + 66500 0.00038647539 0 1.698015e-05 1.3801339e-05 3.5358951e-05 9.4285714 + 66600 0.00037432719 0 1.7509843e-05 1.4033428e-05 3.5206119e-05 9.4285714 + 66700 0.00035679642 0 1.8373478e-05 1.412795e-05 3.2664378e-05 9.4285714 + 66800 0.00034618795 0 1.9514845e-05 1.4608894e-05 3.2352472e-05 9.4285714 + 66900 0.00032906055 0 1.8736605e-05 1.523461e-05 3.3161408e-05 9.4285714 + 67000 0.00031945785 0 1.6984612e-05 1.4969242e-05 3.3142807e-05 9.4285714 + 67100 0.00031672216 0 1.7483062e-05 1.5927363e-05 3.3297451e-05 9.4285714 + 67200 0.00030445379 0 1.7092794e-05 1.5979956e-05 3.3953736e-05 9.4285714 + 67300 0.00028386109 0 1.6371034e-05 1.4946504e-05 3.3294272e-05 9.4285714 + 67400 0.00028463754 0 1.6562782e-05 1.522773e-05 3.3193414e-05 9.4285714 + 67500 0.00028212316 0 1.7000058e-05 1.688192e-05 3.0305767e-05 9.4285714 + 67600 0.00027447589 0 1.7252228e-05 1.7793217e-05 2.7940287e-05 9.4285714 + 67700 0.00026388856 0 1.788708e-05 1.7737963e-05 2.7767523e-05 9.4285714 + 67800 0.00024769801 0 1.7986182e-05 1.6911674e-05 2.6242072e-05 9.4285714 + 67900 0.00024192231 0 1.8117237e-05 1.6810584e-05 2.5489128e-05 9.4285714 + 68000 0.00023732277 0 1.7792025e-05 1.6237435e-05 2.3955138e-05 9.4285714 + 68100 0.0002230537 0 1.8040504e-05 1.509807e-05 2.4258324e-05 9.4285714 + 68200 0.00020295655 0 1.7396258e-05 1.432954e-05 2.2297953e-05 9.4285714 + 68300 0.0002040692 0 1.4709241e-05 1.3357816e-05 1.9379008e-05 9.4285714 + 68400 0.0001928169 0 1.3319281e-05 1.3285272e-05 1.9247674e-05 9.4285714 + 68500 0.00019326451 0 1.3554406e-05 1.3433023e-05 2.0649044e-05 9.4285714 + 68600 0.00019061041 0 1.3385102e-05 1.3584385e-05 1.9332432e-05 9.4285714 + 68700 0.00017904605 0 1.3288304e-05 1.3807963e-05 1.7099578e-05 9.4285714 + 68800 0.00017200167 0 1.4014515e-05 1.3305447e-05 1.6005157e-05 9.4285714 + 68900 0.00016728354 0 1.4358398e-05 1.4318143e-05 1.7530654e-05 9.4285714 + 69000 0.00015703321 0 1.5503927e-05 1.5119926e-05 1.7369909e-05 9.4285714 + 69100 0.00014835113 0 1.6646462e-05 1.3971022e-05 1.6344915e-05 9.4285714 + 69200 0.00014631648 0 1.5954987e-05 1.2795675e-05 1.6309035e-05 9.4285714 + 69300 0.00014587978 0 1.5293418e-05 1.2677732e-05 1.7233536e-05 9.4285714 + 69400 0.0001418924 0 1.5258493e-05 1.3019793e-05 1.7515483e-05 9.4285714 + 69500 0.00013332024 0 1.4812384e-05 1.303409e-05 1.7383204e-05 9.4285714 + 69600 0.00013320187 0 1.4156146e-05 1.3180657e-05 1.7662244e-05 9.4285714 + 69700 0.00013039836 0 1.3247552e-05 1.2811783e-05 1.6799406e-05 9.4285714 + 69800 0.00012003394 0 1.2945301e-05 1.2559804e-05 1.5746066e-05 9.4285714 + 69900 0.00011651147 0 1.2355239e-05 1.2393181e-05 1.4350427e-05 9.4285714 + 70000 0.00012197106 0 1.1842768e-05 1.3044816e-05 1.4170863e-05 9.4285714 + 70100 0.00011813389 0 1.1625743e-05 1.3313213e-05 1.5063448e-05 9.4285714 + 70200 0.00011097253 0 1.1590401e-05 1.2554923e-05 1.4597134e-05 9.4285714 + 70300 0.00010887364 0 1.1158154e-05 1.1895927e-05 1.31874e-05 9.4285714 + 70400 0.00010916786 0 1.0956876e-05 1.180273e-05 1.2846539e-05 9.4285714 + 70500 0.00010031774 0 1.0360778e-05 1.1514343e-05 1.2521203e-05 9.4285714 + 70600 9.1002834e-05 0 1.0300514e-05 1.117085e-05 1.1527003e-05 9.4285714 + 70700 8.9186179e-05 0 1.0609829e-05 1.0737094e-05 1.0837865e-05 9.4285714 + 70800 9.1206485e-05 0 1.0401734e-05 9.9843249e-06 1.0249157e-05 9.4285714 + 70900 9.2333335e-05 0 1.0193791e-05 9.0808065e-06 9.8992907e-06 9.4285714 + 71000 9.1646266e-05 0 1.0160677e-05 8.7435373e-06 9.7169582e-06 9.4285714 + 71100 8.9976882e-05 0 1.0153135e-05 9.1409494e-06 9.5718498e-06 9.4285714 + 71200 8.7702811e-05 0 9.8902233e-06 9.1879521e-06 9.8218671e-06 9.4285714 + 71300 8.6905185e-05 0 9.5383545e-06 8.7211783e-06 1.0499374e-05 9.4285714 + 71400 8.5684023e-05 0 9.253314e-06 8.3885129e-06 1.0606272e-05 9.4285714 + 71500 8.303695e-05 0 8.8819413e-06 8.3461936e-06 1.0273368e-05 9.4285714 + 71600 8.0199459e-05 0 8.9747038e-06 8.2066881e-06 9.9704252e-06 9.4285714 + 71700 7.8917712e-05 0 9.0271304e-06 7.7429742e-06 9.9361512e-06 9.4285714 + 71800 8.006745e-05 0 8.8187404e-06 7.4107567e-06 9.9020703e-06 9.4285714 + 71900 7.8740588e-05 0 8.5325535e-06 7.4640436e-06 9.6978695e-06 9.4285714 + 72000 7.758597e-05 0 8.4232259e-06 7.4096936e-06 1.0295265e-05 9.4285714 + 72100 7.7221401e-05 0 8.2221646e-06 7.0735469e-06 1.0729758e-05 9.4285714 + 72200 7.6375029e-05 0 7.8256335e-06 6.6839282e-06 1.0036496e-05 9.4285714 + 72300 7.2834947e-05 0 7.3129398e-06 6.5549375e-06 9.3647818e-06 9.4285714 + 72400 7.2648265e-05 0 7.1756961e-06 6.6155121e-06 9.9549307e-06 9.4285714 + 72500 7.3708292e-05 0 7.2472933e-06 6.3958474e-06 1.0123332e-05 9.4285714 + 72600 7.1153221e-05 0 7.3278587e-06 6.1367701e-06 9.7342661e-06 9.4285714 + 72700 6.9093949e-05 0 7.4363962e-06 5.9533119e-06 9.7560578e-06 9.4285714 + 72800 7.0003138e-05 0 7.5425112e-06 5.8275253e-06 1.0368232e-05 9.4285714 + 72900 7.097186e-05 0 7.4852771e-06 5.9091762e-06 1.0469988e-05 9.4285714 + 73000 6.9754446e-05 0 7.1428704e-06 6.0128613e-06 9.845617e-06 9.4285714 + 73100 6.8919462e-05 0 6.8577848e-06 6.0078752e-06 9.5062768e-06 9.4285714 + 73200 7.0813485e-05 0 6.915193e-06 5.8464766e-06 9.5542243e-06 9.4285714 + 73300 7.2448906e-05 0 7.202029e-06 5.9255145e-06 9.366303e-06 9.4285714 + 73400 7.1636811e-05 0 7.3658376e-06 6.0353436e-06 9.0035204e-06 9.4285714 + 73500 7.0735739e-05 0 7.3378932e-06 5.9233113e-06 9.2103137e-06 9.4285714 + 73600 7.103569e-05 0 7.4016369e-06 5.7191072e-06 9.590302e-06 9.4285714 + 73700 7.1516165e-05 0 7.5406525e-06 5.5544712e-06 9.2023549e-06 9.4285714 + 73800 7.0454708e-05 0 7.349261e-06 5.3580841e-06 8.44158e-06 9.4285714 + 73900 7.0921505e-05 0 7.0116409e-06 5.019628e-06 8.392926e-06 9.4285714 + 74000 7.3462894e-05 0 6.8708293e-06 4.6604305e-06 8.6159539e-06 9.4285714 + 74100 7.3200399e-05 0 6.760504e-06 4.5172181e-06 8.6590907e-06 9.4285714 + 74200 7.1848724e-05 0 6.598806e-06 4.5142909e-06 8.9015449e-06 9.4285714 + 74300 7.2382347e-05 0 6.4910604e-06 4.55638e-06 9.5190459e-06 9.4285714 + 74400 7.3931763e-05 0 6.5463337e-06 4.557173e-06 9.9812236e-06 9.4285714 + 74500 7.4402751e-05 0 6.7422317e-06 4.5967137e-06 9.9997382e-06 9.4285714 + 74600 7.3859362e-05 0 6.7302615e-06 4.5719524e-06 9.8667104e-06 9.4285714 + 74700 7.5361374e-05 0 6.6009004e-06 4.5572386e-06 9.8530775e-06 9.4285714 + 74800 7.7630509e-05 0 6.5656345e-06 4.6832234e-06 9.892975e-06 9.4285714 + 74900 7.7455142e-05 0 6.6195469e-06 4.8215952e-06 9.8988386e-06 9.4285714 + 75000 7.6480769e-05 0 6.6957621e-06 4.8937859e-06 1.0118373e-05 9.4285714 + 75100 7.7275693e-05 0 6.8416988e-06 5.0008953e-06 1.0508524e-05 9.4285714 + 75200 7.8822667e-05 0 7.0137661e-06 5.114046e-06 1.0681512e-05 9.4285714 + 75300 7.923137e-05 0 7.0852228e-06 5.2313082e-06 1.088256e-05 9.4285714 + 75400 7.9015035e-05 0 7.0293657e-06 5.2742411e-06 1.1348177e-05 9.4285714 + 75500 8.0621162e-05 0 6.8467092e-06 5.2679705e-06 1.1831246e-05 9.4285714 + 75600 8.2299447e-05 0 6.6752346e-06 5.2465333e-06 1.1929829e-05 9.4285714 + 75700 8.1993378e-05 0 6.6903556e-06 5.2647445e-06 1.1895978e-05 9.4285714 + 75800 8.1758987e-05 0 6.8566142e-06 5.3086877e-06 1.1919614e-05 9.4285714 + 75900 8.3084215e-05 0 7.0165672e-06 5.385502e-06 1.2070322e-05 9.4285714 + 76000 8.197148e-05 0 7.2302761e-06 5.8394738e-06 1.2278973e-05 9.4285714 + 76100 7.3534139e-05 0 7.7489979e-06 6.0492251e-06 1.2550083e-05 9.4285714 + 76200 6.8283079e-05 0 7.2365372e-06 6.0007678e-06 1.2602817e-05 9.4285714 + 76300 7.8227289e-05 0 6.526694e-06 6.0271465e-06 1.2329383e-05 9.4285714 + 76400 8.2994806e-05 0 6.1815571e-06 5.9430881e-06 1.1701935e-05 9.4285714 + 76500 8.3014892e-05 0 6.1364257e-06 5.9854633e-06 1.1722691e-05 9.4285714 + 76600 8.4226362e-05 0 6.1828506e-06 6.107284e-06 1.1920214e-05 9.4285714 + 76700 8.6131526e-05 0 6.3343928e-06 6.350283e-06 1.228658e-05 9.4285714 + 76800 8.5731394e-05 0 6.4776958e-06 6.4683255e-06 1.249724e-05 9.4285714 + 76900 8.5941781e-05 0 6.4853553e-06 6.4244197e-06 1.2593229e-05 9.4285714 + 77000 8.8001094e-05 0 6.5171523e-06 6.6329655e-06 1.2912514e-05 9.4285714 + 77100 8.7224729e-05 0 6.8494875e-06 7.3872568e-06 1.3297612e-05 9.4285714 + 77200 8.4102799e-05 0 7.0894804e-06 7.3299263e-06 1.367949e-05 9.4285714 + 77300 8.0313409e-05 0 7.4098021e-06 7.2858555e-06 1.3836101e-05 9.4285714 + 77400 7.9230413e-05 0 8.2603924e-06 7.7732932e-06 1.3810185e-05 9.4285714 + 77500 7.811033e-05 0 8.7674355e-06 7.5406409e-06 1.4227076e-05 9.4285714 + 77600 7.7683573e-05 0 9.0788292e-06 7.8133163e-06 1.471022e-05 9.4285714 + 77700 7.5680467e-05 0 8.9108768e-06 8.317342e-06 1.4999553e-05 9.4285714 + 77800 7.3449559e-05 0 8.9694781e-06 8.6900526e-06 1.5086204e-05 9.4285714 + 77900 7.3292429e-05 0 9.139058e-06 8.6084679e-06 1.492615e-05 9.4285714 + 78000 7.2392133e-05 0 9.6080208e-06 8.4852396e-06 1.4857893e-05 9.4285714 + 78100 7.0315679e-05 0 9.945291e-06 8.3218765e-06 1.4719636e-05 9.4285714 + 78200 7.1047062e-05 0 9.8105393e-06 8.1347429e-06 1.4828339e-05 9.4285714 + 78300 6.8370248e-05 0 9.9255038e-06 7.8989844e-06 1.558545e-05 9.4285714 + 78400 6.5550877e-05 0 1.0372272e-05 7.8133098e-06 1.6112e-05 9.4285714 + 78500 6.1683926e-05 0 1.0744202e-05 7.939033e-06 1.6539381e-05 9.4285714 + 78600 6.024047e-05 0 1.0791202e-05 7.9498532e-06 1.6361859e-05 9.4285714 + 78700 5.8543178e-05 0 1.0974316e-05 7.8193457e-06 1.5667857e-05 9.4285714 + 78800 5.5383435e-05 0 1.0534755e-05 7.6453258e-06 1.4396004e-05 9.4285714 + 78900 5.6871546e-05 0 1.0546809e-05 7.6401983e-06 1.380849e-05 9.4285714 + 79000 5.7192958e-05 0 1.0550826e-05 8.0833789e-06 1.3441933e-05 9.4285714 + 79100 4.9998926e-05 0 1.0683768e-05 7.9938172e-06 1.3882479e-05 9.4285714 + 79200 4.9597887e-05 0 1.0901088e-05 7.7919421e-06 1.273575e-05 9.4285714 + 79300 4.8603326e-05 0 1.0971813e-05 8.0875397e-06 1.2027443e-05 9.4285714 + 79400 4.7839304e-05 0 1.0874179e-05 8.144737e-06 1.1956832e-05 9.4285714 + 79500 4.5739018e-05 0 1.076245e-05 8.3910868e-06 1.1534616e-05 9.4285714 + 79600 4.2632104e-05 0 1.0609664e-05 8.6397142e-06 1.1473552e-05 9.4285714 + 79700 4.2716432e-05 0 1.0262604e-05 8.711707e-06 1.0969998e-05 9.4285714 + 79800 4.3345358e-05 0 9.9282847e-06 8.9481901e-06 1.0983222e-05 9.4285714 + 79900 4.2476967e-05 0 9.7375039e-06 9.2548149e-06 1.1285625e-05 9.4285714 + 80000 4.0478442e-05 0 9.558123e-06 8.9295053e-06 1.0784448e-05 9.4285714 + 80100 3.7842198e-05 0 9.0334781e-06 8.2704782e-06 1.0278932e-05 9.4285714 + 80200 2.8735215e-05 0 7.9350731e-06 7.8543447e-06 1.0121553e-05 9.4285714 + 80300 2.5008575e-05 0 7.4613405e-06 7.3076318e-06 9.699202e-06 9.4285714 + 80400 2.7560228e-05 0 7.839602e-06 7.0844901e-06 9.4586824e-06 9.4285714 + 80500 3.0888649e-05 0 8.1838091e-06 6.9204111e-06 9.2656765e-06 9.4285714 + 80600 3.2512804e-05 0 8.4973372e-06 6.7089195e-06 9.1713286e-06 9.4285714 + 80700 3.0635649e-05 0 8.6601613e-06 6.5637472e-06 8.8278453e-06 9.4285714 + 80800 2.7803874e-05 0 8.6135955e-06 6.4140616e-06 8.6556889e-06 9.4285714 + 80900 2.7488104e-05 0 8.7028796e-06 6.3379797e-06 8.3509842e-06 9.4285714 + 81000 2.5760367e-05 0 9.2034736e-06 6.7611736e-06 8.6536526e-06 9.4285714 + 81100 2.0516969e-05 0 9.0513498e-06 6.8144281e-06 9.1119465e-06 9.4285714 + 81200 1.7005384e-05 0 8.916831e-06 6.7768397e-06 9.5240286e-06 9.4285714 + 81300 1.8000969e-05 0 8.7376342e-06 6.8615088e-06 9.6206194e-06 9.4285714 + 81400 1.8404948e-05 0 8.2208204e-06 6.7371396e-06 9.0504462e-06 9.4285714 + 81500 1.7001638e-05 0 8.0003097e-06 6.7725682e-06 8.8647013e-06 9.4285714 + 81600 1.718853e-05 0 7.6914646e-06 6.9104324e-06 8.8869789e-06 9.4285714 + 81700 1.7653551e-05 0 7.3471225e-06 6.8867378e-06 8.8253446e-06 9.4285714 + 81800 1.60697e-05 0 7.0404737e-06 6.8479859e-06 8.5427076e-06 9.4285714 + 81900 1.5286837e-05 0 7.0172686e-06 6.9297068e-06 8.2722832e-06 9.4285714 + 82000 1.6023107e-05 0 7.0983015e-06 6.9736613e-06 8.1332821e-06 9.4285714 + 82100 1.5242285e-05 0 7.0688546e-06 6.8167975e-06 7.6908928e-06 9.4285714 + 82200 1.3697011e-05 0 7.0223727e-06 6.4952373e-06 7.3342404e-06 9.4285714 + 82300 1.3126258e-05 0 7.1571217e-06 6.3810604e-06 7.2195212e-06 9.4285714 + 82400 1.3101796e-05 0 7.2890863e-06 6.3506356e-06 6.9818415e-06 9.4285714 + 82500 1.2930812e-05 0 7.151416e-06 6.216239e-06 6.5772477e-06 9.4285714 + 82600 1.2105591e-05 0 6.7542664e-06 6.1120283e-06 6.3663068e-06 9.4285714 + 82700 1.1430058e-05 0 6.5788951e-06 6.0514089e-06 6.4433754e-06 9.4285714 + 82800 1.1220674e-05 0 6.5791612e-06 6.0531604e-06 6.6770698e-06 9.4285714 + 82900 1.0833337e-05 0 6.47818e-06 6.0122996e-06 6.8321143e-06 9.4285714 + 83000 9.6966107e-06 0 6.2531746e-06 5.9309876e-06 6.8402408e-06 9.4285714 + 83100 9.7912048e-06 0 6.1233799e-06 5.8467558e-06 6.8017122e-06 9.4285714 + 83200 1.0342776e-05 0 6.1812546e-06 5.7996644e-06 6.7456475e-06 9.4285714 + 83300 9.1053605e-06 0 6.2862234e-06 5.7715058e-06 6.6864541e-06 9.4285714 + 83400 8.1376574e-06 0 6.3534217e-06 5.8081229e-06 6.6544011e-06 9.4285714 + 83500 8.3013823e-06 0 6.4049353e-06 5.8627471e-06 6.6442675e-06 9.4285714 + 83600 7.5747246e-06 0 6.3101238e-06 5.9294619e-06 6.6505997e-06 9.4285714 + 83700 6.7051973e-06 0 6.1464953e-06 5.8827036e-06 6.6813364e-06 9.4285714 + 83800 6.7732855e-06 0 6.1039107e-06 5.7663207e-06 6.7463747e-06 9.4285714 + 83900 6.455146e-06 0 6.191176e-06 5.719103e-06 6.7193618e-06 9.4285714 + 84000 6.033363e-06 0 6.1987406e-06 5.6639744e-06 6.7404074e-06 9.4285714 + 84100 6.1544361e-06 0 6.1093662e-06 5.4981158e-06 6.9178146e-06 9.4285714 + 84200 5.8120515e-06 0 5.8682237e-06 5.4078594e-06 7.1748608e-06 9.4285714 + 84300 5.5925414e-06 0 5.8299675e-06 5.4425557e-06 7.3447739e-06 9.4285714 + 84400 5.9495987e-06 0 5.8440449e-06 5.5318695e-06 7.3677152e-06 9.4285714 + 84500 5.7713446e-06 0 5.8137185e-06 5.672038e-06 7.2420253e-06 9.4285714 + 84600 5.2346414e-06 0 5.7724697e-06 5.8135669e-06 7.089944e-06 9.4285714 + 84700 5.3677312e-06 0 5.7932199e-06 5.8900538e-06 6.986661e-06 9.4285714 + 84800 5.5545452e-06 0 5.8402198e-06 5.8520541e-06 6.892677e-06 9.4285714 + 84900 5.35857e-06 0 5.8265347e-06 5.8000233e-06 6.8516545e-06 9.4285714 + 85000 5.4081539e-06 0 5.783936e-06 5.7703706e-06 6.8630043e-06 9.4285714 + 85100 5.6686315e-06 0 5.7695537e-06 5.7106213e-06 6.8449127e-06 9.4285714 + 85200 5.6470622e-06 0 5.8250423e-06 5.6629171e-06 6.774264e-06 9.4285714 + 85300 5.4542991e-06 0 5.9016498e-06 5.6655349e-06 6.7281738e-06 9.4285714 + 85400 5.5974388e-06 0 5.9646597e-06 5.6947162e-06 6.6806947e-06 9.4285714 + 85500 5.9109345e-06 0 5.967179e-06 5.6810561e-06 6.6036521e-06 9.4285714 + 85600 5.8895141e-06 0 5.9638498e-06 5.6150965e-06 6.5709969e-06 9.4285714 + 85700 5.8470051e-06 0 6.0226793e-06 5.5476887e-06 6.650327e-06 9.4285714 + 85800 6.060997e-06 0 6.0805171e-06 5.5114717e-06 6.7408394e-06 9.4285714 + 85900 6.1217894e-06 0 6.1343577e-06 5.5394005e-06 6.8609753e-06 9.4285714 + 86000 5.7550467e-06 0 6.1710899e-06 5.6424943e-06 6.9634617e-06 9.4285714 + 86100 5.6513685e-06 0 6.1564873e-06 5.8517272e-06 6.9818339e-06 9.4285714 + 86200 5.7555479e-06 0 6.1071953e-06 5.9846538e-06 6.9607131e-06 9.4285714 + 86300 5.7587322e-06 0 6.1027542e-06 6.0234009e-06 6.969152e-06 9.4285714 + 86400 5.8389333e-06 0 6.1697397e-06 6.0477528e-06 7.0119472e-06 9.4285714 + 86500 5.9431034e-06 0 6.2597537e-06 6.0475988e-06 7.0667343e-06 9.4285714 + 86600 5.9655129e-06 0 6.2896528e-06 6.0010507e-06 7.0437962e-06 9.4285714 + 86700 6.042955e-06 0 6.2709737e-06 5.8440573e-06 6.9441762e-06 9.4285714 + 86800 6.2666413e-06 0 6.1964071e-06 5.6894309e-06 6.8811779e-06 9.4285714 + 86900 6.5118003e-06 0 6.1051139e-06 5.6557711e-06 6.8722493e-06 9.4285714 + 87000 6.7509257e-06 0 6.0291493e-06 5.6830661e-06 6.916898e-06 9.4285714 + 87100 6.9118143e-06 0 6.0183397e-06 5.6796551e-06 7.0011007e-06 9.4285714 + 87200 6.9983412e-06 0 6.040127e-06 5.6529434e-06 7.127229e-06 9.4285714 + 87300 7.2267392e-06 0 6.0286797e-06 5.6230076e-06 7.2573882e-06 9.4285714 + 87400 7.3928522e-06 0 6.0129878e-06 5.5947139e-06 7.4524445e-06 9.4285714 + 87500 7.1675783e-06 0 6.0469379e-06 5.7445703e-06 7.5694621e-06 9.4285714 + 87600 6.9310557e-06 0 6.1331355e-06 5.8982521e-06 7.5787155e-06 9.4285714 + 87700 6.8020949e-06 0 6.312632e-06 5.9646e-06 7.5159198e-06 9.4285714 + 87800 6.7871509e-06 0 6.4438446e-06 5.8625717e-06 7.4014079e-06 9.4285714 + 87900 7.1459737e-06 0 6.5483239e-06 5.7458287e-06 7.3742373e-06 9.4285714 + 88000 7.4791665e-06 0 6.6494489e-06 5.7733829e-06 7.5763999e-06 9.4285714 + 88100 7.4418527e-06 0 6.7353307e-06 5.903551e-06 7.7655167e-06 9.4285714 + 88200 6.8171325e-06 0 6.9359356e-06 6.0764899e-06 8.0003945e-06 9.4285714 + 88300 5.9535317e-06 0 7.0673476e-06 6.2127209e-06 8.2558166e-06 9.4285714 + 88400 5.8054385e-06 0 7.0393025e-06 6.295728e-06 8.3249618e-06 9.4285714 + 88500 5.7381974e-06 0 6.986322e-06 6.3150237e-06 8.3161166e-06 9.4285714 + 88600 5.8193958e-06 0 6.9610838e-06 6.2643723e-06 8.3456298e-06 9.4285714 + 88700 5.7843884e-06 0 7.025256e-06 6.1780449e-06 8.4360622e-06 9.4285714 + 88800 5.36122e-06 0 7.1886768e-06 6.1335975e-06 8.6566218e-06 9.4285714 + 88900 4.9662584e-06 0 7.2896286e-06 6.1156834e-06 8.7588271e-06 9.4285714 + 89000 5.0244565e-06 0 7.2730496e-06 6.083749e-06 8.7659659e-06 9.4285714 + 89100 5.2140172e-06 0 7.1617638e-06 6.0498839e-06 8.7631514e-06 9.4285714 + 89200 5.4241028e-06 0 7.0779466e-06 6.0064798e-06 8.7654482e-06 9.4285714 + 89300 5.354843e-06 0 7.0385405e-06 5.9746409e-06 8.8526601e-06 9.4285714 + 89400 4.9583346e-06 0 6.9725874e-06 5.9883731e-06 8.8784101e-06 9.4285714 + 89500 4.7804845e-06 0 6.8896169e-06 6.0555358e-06 8.7411283e-06 9.4285714 + 89600 4.5353969e-06 0 6.8441433e-06 6.1441445e-06 8.5998496e-06 9.4285714 + 89700 4.3528727e-06 0 6.9096594e-06 6.2696259e-06 8.4806368e-06 9.4285714 + 89800 4.0677397e-06 0 7.0681849e-06 6.3600745e-06 8.3821485e-06 9.4285714 + 89900 3.4743886e-06 0 7.208934e-06 6.2417154e-06 8.2590362e-06 9.4285714 + 90000 2.9448035e-06 0 7.2648444e-06 6.1025056e-06 8.1567217e-06 9.4285714 + 90100 2.8584378e-06 0 7.2361844e-06 6.0292519e-06 8.1323675e-06 9.4285714 + 90200 3.0154097e-06 0 7.1912833e-06 5.9880227e-06 8.1509776e-06 9.4285714 + 90300 3.0998012e-06 0 7.1621354e-06 5.9387681e-06 8.1447795e-06 9.4285714 + 90400 3.0622205e-06 0 7.1346468e-06 5.8551087e-06 8.0849875e-06 9.4285714 + 90500 2.8987354e-06 0 7.0808755e-06 5.7480505e-06 8.0655448e-06 9.4285714 + 90600 2.6710434e-06 0 7.0205199e-06 5.7165534e-06 8.0846444e-06 9.4285714 + 90700 2.4095074e-06 0 6.9439805e-06 5.7493599e-06 8.0259105e-06 9.4285714 + 90800 2.202904e-06 0 6.9317463e-06 5.8100449e-06 7.9027214e-06 9.4285714 + 90900 2.3181295e-06 0 7.0034101e-06 5.8778489e-06 7.7654197e-06 9.4285714 + 91000 2.3141951e-06 0 7.0766754e-06 5.9435646e-06 7.6679494e-06 9.4285714 + 91100 2.0683071e-06 0 7.0355929e-06 5.9830977e-06 7.5547272e-06 9.4285714 + 91200 1.8857219e-06 0 6.886975e-06 5.9803391e-06 7.3843659e-06 9.4285714 + 91300 1.8327584e-06 0 6.7232199e-06 5.8972482e-06 7.172749e-06 9.4285714 + 91400 1.804747e-06 0 6.6658239e-06 5.7775933e-06 6.9879557e-06 9.4285714 + 91500 1.6349771e-06 0 6.6744755e-06 5.6582742e-06 6.8615206e-06 9.4285714 + 91600 1.5216476e-06 0 6.6865456e-06 5.5795361e-06 6.7883528e-06 9.4285714 + 91700 1.6141413e-06 0 6.68539e-06 5.5586295e-06 6.7422583e-06 9.4285714 + 91800 1.6435107e-06 0 6.6317895e-06 5.6102143e-06 6.7060043e-06 9.4285714 + 91900 1.5649292e-06 0 6.5474777e-06 5.6787362e-06 6.6783459e-06 9.4285714 + 92000 1.5598003e-06 0 6.4984086e-06 5.7448839e-06 6.6563568e-06 9.4285714 + 92100 1.5645521e-06 0 6.502615e-06 5.7854556e-06 6.6299693e-06 9.4285714 + 92200 1.5384794e-06 0 6.5324855e-06 5.791917e-06 6.5998087e-06 9.4285714 + 92300 1.5428705e-06 0 6.5828146e-06 5.7573607e-06 6.564701e-06 9.4285714 + 92400 1.5481835e-06 0 6.6310796e-06 5.6780865e-06 6.551415e-06 9.4285714 + 92500 1.5193765e-06 0 6.6560684e-06 5.5916813e-06 6.568409e-06 9.4285714 + 92600 1.4779648e-06 0 6.6374647e-06 5.5138194e-06 6.605645e-06 9.4285714 + 92700 1.4401385e-06 0 6.5783557e-06 5.466179e-06 6.6343577e-06 9.4285714 + 92800 1.4263884e-06 0 6.5032532e-06 5.4548714e-06 6.6667781e-06 9.4285714 + 92900 1.4318392e-06 0 6.4100939e-06 5.475169e-06 6.7074201e-06 9.4285714 + 93000 1.4336111e-06 0 6.3386325e-06 5.5075916e-06 6.7333938e-06 9.4285714 + 93100 1.4541758e-06 0 6.3430387e-06 5.5366002e-06 6.7522163e-06 9.4285714 + 93200 1.4657669e-06 0 6.4329416e-06 5.581062e-06 6.8176723e-06 9.4285714 + 93300 1.4040886e-06 0 6.5434258e-06 5.6428482e-06 6.9238384e-06 9.4285714 + 93400 1.2988064e-06 0 6.6210628e-06 5.7043118e-06 7.0589134e-06 9.4285714 + 93500 1.2005872e-06 0 6.6510605e-06 5.7583138e-06 7.1470838e-06 9.4285714 + 93600 1.1148329e-06 0 6.6739621e-06 5.8031724e-06 7.198744e-06 9.4285714 + 93700 1.0710007e-06 0 6.7180944e-06 5.8357751e-06 7.2627754e-06 9.4285714 + 93800 1.0923979e-06 0 6.7838026e-06 5.857069e-06 7.3553254e-06 9.4285714 + 93900 1.1070785e-06 0 6.8474162e-06 5.8724205e-06 7.4260353e-06 9.4285714 + 94000 1.0836182e-06 0 6.9184593e-06 5.9063218e-06 7.4593908e-06 9.4285714 + 94100 1.0712532e-06 0 6.9659007e-06 5.9417663e-06 7.4976223e-06 9.4285714 + 94200 1.1089242e-06 0 6.9714436e-06 5.970624e-06 7.55674e-06 9.4285714 + 94300 1.1709624e-06 0 6.9375714e-06 5.9802014e-06 7.6084264e-06 9.4285714 + 94400 1.1698851e-06 0 6.8899943e-06 5.96701e-06 7.6232022e-06 9.4285714 + 94500 1.1331311e-06 0 6.8607818e-06 5.9576831e-06 7.6330828e-06 9.4285714 + 94600 1.1611176e-06 0 6.8775071e-06 5.9659895e-06 7.6539239e-06 9.4285714 + 94700 1.2014763e-06 0 6.9225704e-06 5.978896e-06 7.6602657e-06 9.4285714 + 94800 1.1833928e-06 0 6.9903173e-06 5.9981741e-06 7.6474584e-06 9.4285714 + 94900 1.1648449e-06 0 7.0650539e-06 6.0150496e-06 7.633387e-06 9.4285714 + 95000 1.1252279e-06 0 7.1072978e-06 6.0184786e-06 7.6094493e-06 9.4285714 + 95100 1.0516851e-06 0 7.1142631e-06 6.0065025e-06 7.5761571e-06 9.4285714 + 95200 1.0245214e-06 0 7.1018948e-06 5.993948e-06 7.5486922e-06 9.4285714 + 95300 1.0235812e-06 0 7.0867307e-06 6.0211446e-06 7.52964e-06 9.4285714 + 95400 9.6956254e-07 0 7.0870353e-06 6.072303e-06 7.5090138e-06 9.4285714 + 95500 8.9262312e-07 0 7.0987772e-06 6.1168082e-06 7.5033557e-06 9.4285714 + 95600 8.6064987e-07 0 7.1067297e-06 6.1317068e-06 7.4962696e-06 9.4285714 + 95700 8.7096432e-07 0 7.0919507e-06 6.1268237e-06 7.4461295e-06 9.4285714 + 95800 8.5278957e-07 0 7.0664924e-06 6.1151121e-06 7.3946799e-06 9.4285714 + 95900 7.9717781e-07 0 7.0485109e-06 6.0993542e-06 7.3743405e-06 9.4285714 + 96000 7.7875968e-07 0 7.0534076e-06 6.0721804e-06 7.38935e-06 9.4285714 + 96100 7.8525813e-07 0 7.0843748e-06 6.0420863e-06 7.4393684e-06 9.4285714 + 96200 7.7518366e-07 0 7.1238098e-06 6.028226e-06 7.5045929e-06 9.4285714 + 96300 7.6015915e-07 0 7.1481733e-06 6.0364027e-06 7.5368435e-06 9.4285714 + 96400 7.4067407e-07 0 7.1459565e-06 6.041338e-06 7.4989132e-06 9.4285714 + 96500 7.0061605e-07 0 7.1268071e-06 6.029068e-06 7.4151813e-06 9.4285714 + 96600 6.6164038e-07 0 7.098925e-06 6.0009667e-06 7.3139003e-06 9.4285714 + 96700 6.5255615e-07 0 7.0627067e-06 5.9576708e-06 7.2100844e-06 9.4285714 + 96800 6.5992528e-07 0 7.023092e-06 5.8964071e-06 7.1287006e-06 9.4285714 + 96900 6.618124e-07 0 6.9850613e-06 5.8360203e-06 7.0798167e-06 9.4285714 + 97000 6.7139818e-07 0 6.9588277e-06 5.8062928e-06 7.0552706e-06 9.4285714 + 97100 6.8703272e-07 0 6.9537175e-06 5.8222057e-06 7.0414456e-06 9.4285714 + 97200 6.9368757e-07 0 6.9628009e-06 5.8702813e-06 7.0384753e-06 9.4285714 + 97300 6.9652913e-07 0 6.9734824e-06 5.9290926e-06 7.0544858e-06 9.4285714 + 97400 6.9671901e-07 0 6.9846061e-06 6.0012529e-06 7.083092e-06 9.4285714 + 97500 6.891306e-07 0 6.9869142e-06 6.0395379e-06 7.0939696e-06 9.4285714 + 97600 6.76426e-07 0 6.9788679e-06 6.0215323e-06 7.0606545e-06 9.4285714 + 97700 6.5763751e-07 0 6.9653816e-06 5.9723094e-06 7.0096441e-06 9.4285714 + 97800 6.4854556e-07 0 6.9554426e-06 5.9303617e-06 6.9747745e-06 9.4285714 + 97900 6.5336861e-07 0 6.9405484e-06 5.9124736e-06 6.9578336e-06 9.4285714 + 98000 6.6394525e-07 0 6.9149722e-06 5.9089903e-06 6.9531064e-06 9.4285714 + 98100 6.8885885e-07 0 6.8891311e-06 5.9064849e-06 6.9546779e-06 9.4285714 + 98200 7.2201864e-07 0 6.8704207e-06 5.8899045e-06 6.9512899e-06 9.4285714 + 98300 7.3816538e-07 0 6.8523223e-06 5.8601846e-06 6.9459414e-06 9.4285714 + 98400 7.3631403e-07 0 6.8416192e-06 5.8365194e-06 6.9566027e-06 9.4285714 + 98500 7.2568853e-07 0 6.8359315e-06 5.8202579e-06 6.9826678e-06 9.4285714 + 98600 7.0490905e-07 0 6.8305302e-06 5.8023655e-06 7.0037387e-06 9.4285714 + 98700 6.8484202e-07 0 6.8328514e-06 5.7856688e-06 7.0152903e-06 9.4285714 + 98800 6.6994522e-07 0 6.8665586e-06 5.776709e-06 7.0248186e-06 9.4285714 + 98900 6.2867752e-07 0 6.922678e-06 5.7832988e-06 7.0496494e-06 9.4285714 + 99000 5.6999626e-07 0 6.9604759e-06 5.803298e-06 7.0910089e-06 9.4285714 + 99100 5.2675078e-07 0 6.9689516e-06 5.8313501e-06 7.1326482e-06 9.4285714 + 99200 4.9993032e-07 0 6.9639452e-06 5.8639097e-06 7.1679106e-06 9.4285714 + 99300 4.8034362e-07 0 6.9673566e-06 5.8886473e-06 7.2061899e-06 9.4285714 + 99400 4.633455e-07 0 6.9801545e-06 5.9075721e-06 7.2565116e-06 9.4285714 + 99500 4.423417e-07 0 6.9834282e-06 5.9253367e-06 7.3084834e-06 9.4285714 + 99600 4.2336865e-07 0 6.967599e-06 5.9390331e-06 7.3503483e-06 9.4285714 + 99700 4.0950396e-07 0 6.9366188e-06 5.9452518e-06 7.3763135e-06 9.4285714 + 99800 3.8946719e-07 0 6.9087461e-06 5.9409744e-06 7.3965059e-06 9.4285714 + 99900 3.5789226e-07 0 6.9005219e-06 5.9283255e-06 7.4220159e-06 9.4285714 + 100000 3.23165e-07 0 6.8942094e-06 5.9113196e-06 7.4570026e-06 9.4285714 +Loop time of 178.804 on 4 procs for 100000 steps with 2520 atoms + +Performance: 2416052.451 tau/day, 559.271 timesteps/s +99.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.068905 | 1.0142 | 3.632 | 150.2 | 0.57 +Bond | 2.4179 | 45.255 | 152.45 | 922.4 | 25.31 +Neigh | 2.7318 | 2.7504 | 2.7587 | 0.7 | 1.54 +Comm | 2.2428 | 62.076 | 153.59 | 708.9 | 34.72 +Output | 0.14703 | 1.3253 | 2.7063 | 102.7 | 0.74 +Modify | 0.66661 | 4.887 | 15.428 | 276.1 | 2.73 +Other | | 61.5 | | | 34.39 + +Nlocal: 630 ave 2513 max 0 min +Histogram: 3 0 0 0 0 0 0 0 0 1 +Nghost: 39.25 ave 150 max 0 min +Histogram: 3 0 0 0 0 0 0 0 0 1 +Neighs: 2458 ave 9821 max 0 min +Histogram: 3 0 0 0 0 0 0 0 0 1 + +Total # of neighbors = 9832 +Ave neighs/atom = 3.9015873 +Ave special neighs/atom = 36.31746 +Neighbor list builds = 5178 +Dangerous builds = 314 +Total wall time: 0:02:58 diff --git a/examples/bpm/pour/rect.mol b/examples/bpm/pour/rect.mol new file mode 100644 index 0000000000..16edb17682 --- /dev/null +++ b/examples/bpm/pour/rect.mol @@ -0,0 +1,568 @@ +#Made with create_mol.py + +63 atoms +297 bonds + +Coords +#ID x y z +1 0.0 0.0 0.0 +2 0.7348518971806154 0.7348518971806154 0.0 +3 0.7348518971806154 0.0 0.7348518971806154 +4 0.0 0.7348518971806154 0.7348518971806154 +5 1.4697037943612308 0.0 0.0 +6 1.4697037943612308 0.7348518971806154 0.7348518971806154 +7 0.0 1.4697037943612308 0.0 +8 0.7348518971806154 1.4697037943612308 0.7348518971806154 +9 1.4697037943612308 1.4697037943612308 0.0 +10 0.0 0.0 1.4697037943612308 +11 0.7348518971806154 0.7348518971806154 1.4697037943612308 +12 0.7348518971806154 0.0 2.204555691541846 +13 0.0 0.7348518971806154 2.204555691541846 +14 1.4697037943612308 0.0 1.4697037943612308 +15 1.4697037943612308 0.7348518971806154 2.204555691541846 +16 0.0 1.4697037943612308 1.4697037943612308 +17 0.7348518971806154 1.4697037943612308 2.204555691541846 +18 1.4697037943612308 1.4697037943612308 1.4697037943612308 +19 0.0 0.0 2.9394075887224616 +20 0.7348518971806154 0.7348518971806154 2.9394075887224616 +21 0.7348518971806154 0.0 3.674259485903077 +22 0.0 0.7348518971806154 3.674259485903077 +23 1.4697037943612308 0.0 2.9394075887224616 +24 1.4697037943612308 0.7348518971806154 3.674259485903077 +25 0.0 1.4697037943612308 2.9394075887224616 +26 0.7348518971806154 1.4697037943612308 3.674259485903077 +27 1.4697037943612308 1.4697037943612308 2.9394075887224616 +28 0.0 0.0 4.409111383083692 +29 0.7348518971806154 0.7348518971806154 4.409111383083692 +30 0.7348518971806154 0.0 5.143963280264308 +31 0.0 0.7348518971806154 5.143963280264308 +32 1.4697037943612308 0.0 4.409111383083692 +33 1.4697037943612308 0.7348518971806154 5.143963280264308 +34 0.0 1.4697037943612308 4.409111383083692 +35 0.7348518971806154 1.4697037943612308 5.143963280264308 +36 1.4697037943612308 1.4697037943612308 4.409111383083692 +37 0.0 0.0 5.878815177444923 +38 0.7348518971806154 0.7348518971806154 5.878815177444923 +39 0.7348518971806154 0.0 6.613667074625538 +40 0.0 0.7348518971806154 6.613667074625538 +41 1.4697037943612308 0.0 5.878815177444923 +42 1.4697037943612308 0.7348518971806154 6.613667074625538 +43 0.0 1.4697037943612308 5.878815177444923 +44 0.7348518971806154 1.4697037943612308 6.613667074625538 +45 1.4697037943612308 1.4697037943612308 5.878815177444923 +46 0.0 0.0 7.348518971806154 +47 0.7348518971806154 0.7348518971806154 7.348518971806154 +48 0.7348518971806154 0.0 8.08337086898677 +49 0.0 0.7348518971806154 8.08337086898677 +50 1.4697037943612308 0.0 7.348518971806154 +51 1.4697037943612308 0.7348518971806154 8.08337086898677 +52 0.0 1.4697037943612308 7.348518971806154 +53 0.7348518971806154 1.4697037943612308 8.08337086898677 +54 1.4697037943612308 1.4697037943612308 7.348518971806154 +55 0.0 0.0 8.818222766167384 +56 0.7348518971806154 0.7348518971806154 8.818222766167384 +57 0.7348518971806154 0.0 9.553074663348 +58 0.0 0.7348518971806154 9.553074663348 +59 1.4697037943612308 0.0 8.818222766167384 +60 1.4697037943612308 0.7348518971806154 9.553074663348 +61 0.0 1.4697037943612308 8.818222766167384 +62 0.7348518971806154 1.4697037943612308 9.553074663348 +63 1.4697037943612308 1.4697037943612308 8.818222766167384 + +Types +#ID type +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +33 1 +34 1 +35 1 +36 1 +37 1 +38 1 +39 1 +40 1 +41 1 +42 1 +43 1 +44 1 +45 1 +46 1 +47 1 +48 1 +49 1 +50 1 +51 1 +52 1 +53 1 +54 1 +55 1 +56 1 +57 1 +58 1 +59 1 +60 1 +61 1 +62 1 +63 1 + +Diameters +#ID diameter +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +33 1 +34 1 +35 1 +36 1 +37 1 +38 1 +39 1 +40 1 +41 1 +42 1 +43 1 +44 1 +45 1 +46 1 +47 1 +48 1 +49 1 +50 1 +51 1 +52 1 +53 1 +54 1 +55 1 +56 1 +57 1 +58 1 +59 1 +60 1 +61 1 +62 1 +63 1 + +Masses +#ID mass +1 1 +2 1 +3 1 +4 1 +5 1 +6 1 +7 1 +8 1 +9 1 +10 1 +11 1 +12 1 +13 1 +14 1 +15 1 +16 1 +17 1 +18 1 +19 1 +20 1 +21 1 +22 1 +23 1 +24 1 +25 1 +26 1 +27 1 +28 1 +29 1 +30 1 +31 1 +32 1 +33 1 +34 1 +35 1 +36 1 +37 1 +38 1 +39 1 +40 1 +41 1 +42 1 +43 1 +44 1 +45 1 +46 1 +47 1 +48 1 +49 1 +50 1 +51 1 +52 1 +53 1 +54 1 +55 1 +56 1 +57 1 +58 1 +59 1 +60 1 +61 1 +62 1 +63 1 + +Bonds +#ID type atom1 atom2 +1 1 1 2 +2 1 1 3 +3 1 1 4 +4 1 1 5 +5 1 1 7 +6 1 1 10 +7 1 2 3 +8 1 2 4 +9 1 2 5 +10 1 2 6 +11 1 2 7 +12 1 2 8 +13 1 2 9 +14 1 2 11 +15 1 3 4 +16 1 3 5 +17 1 3 6 +18 1 3 8 +19 1 3 10 +20 1 3 11 +21 1 3 12 +22 1 3 14 +23 1 4 6 +24 1 4 7 +25 1 4 8 +26 1 4 10 +27 1 4 11 +28 1 4 13 +29 1 4 16 +30 1 5 6 +31 1 5 9 +32 1 5 14 +33 1 6 8 +34 1 6 9 +35 1 6 11 +36 1 6 14 +37 1 6 18 +38 1 7 8 +39 1 7 9 +40 1 7 16 +41 1 8 9 +42 1 8 11 +43 1 8 16 +44 1 8 17 +45 1 8 18 +46 1 9 18 +47 1 10 11 +48 1 10 12 +49 1 10 13 +50 1 10 14 +51 1 10 16 +52 1 10 19 +53 1 11 12 +54 1 11 13 +55 1 11 14 +56 1 11 15 +57 1 11 16 +58 1 11 17 +59 1 11 18 +60 1 12 13 +61 1 12 14 +62 1 12 15 +63 1 12 17 +64 1 12 19 +65 1 12 20 +66 1 12 21 +67 1 12 23 +68 1 13 15 +69 1 13 16 +70 1 13 17 +71 1 13 19 +72 1 13 20 +73 1 13 22 +74 1 13 25 +75 1 14 15 +76 1 14 18 +77 1 14 23 +78 1 15 17 +79 1 15 18 +80 1 15 20 +81 1 15 23 +82 1 15 27 +83 1 16 17 +84 1 16 18 +85 1 16 25 +86 1 17 18 +87 1 17 20 +88 1 17 25 +89 1 17 27 +90 1 18 27 +91 1 19 20 +92 1 19 21 +93 1 19 22 +94 1 19 23 +95 1 19 25 +96 1 19 28 +97 1 20 21 +98 1 20 22 +99 1 20 23 +100 1 20 24 +101 1 20 25 +102 1 20 26 +103 1 20 27 +104 1 20 29 +105 1 21 22 +106 1 21 23 +107 1 21 24 +108 1 21 26 +109 1 21 28 +110 1 21 29 +111 1 21 30 +112 1 21 32 +113 1 22 24 +114 1 22 25 +115 1 22 26 +116 1 22 28 +117 1 22 29 +118 1 22 34 +119 1 23 24 +120 1 23 27 +121 1 23 32 +122 1 24 26 +123 1 24 27 +124 1 24 29 +125 1 24 32 +126 1 24 36 +127 1 25 26 +128 1 25 27 +129 1 25 34 +130 1 26 27 +131 1 26 29 +132 1 26 34 +133 1 26 35 +134 1 26 36 +135 1 27 36 +136 1 28 29 +137 1 28 30 +138 1 28 31 +139 1 28 32 +140 1 28 34 +141 1 28 37 +142 1 29 30 +143 1 29 31 +144 1 29 32 +145 1 29 33 +146 1 29 34 +147 1 29 35 +148 1 29 36 +149 1 29 38 +150 1 30 31 +151 1 30 32 +152 1 30 33 +153 1 30 35 +154 1 30 37 +155 1 30 38 +156 1 30 41 +157 1 31 33 +158 1 31 34 +159 1 31 35 +160 1 31 37 +161 1 31 38 +162 1 31 40 +163 1 31 43 +164 1 32 33 +165 1 32 36 +166 1 32 41 +167 1 33 35 +168 1 33 36 +169 1 33 38 +170 1 33 41 +171 1 33 42 +172 1 33 45 +173 1 34 35 +174 1 34 36 +175 1 34 43 +176 1 35 36 +177 1 35 38 +178 1 35 43 +179 1 35 45 +180 1 36 45 +181 1 37 38 +182 1 37 39 +183 1 37 40 +184 1 37 41 +185 1 37 43 +186 1 37 46 +187 1 38 39 +188 1 38 40 +189 1 38 41 +190 1 38 42 +191 1 38 43 +192 1 38 44 +193 1 38 45 +194 1 38 47 +195 1 39 40 +196 1 39 41 +197 1 39 42 +198 1 39 44 +199 1 39 46 +200 1 39 47 +201 1 39 50 +202 1 40 42 +203 1 40 43 +204 1 40 44 +205 1 40 46 +206 1 40 47 +207 1 40 52 +208 1 41 42 +209 1 41 45 +210 1 41 50 +211 1 42 44 +212 1 42 45 +213 1 42 47 +214 1 42 50 +215 1 42 51 +216 1 42 54 +217 1 43 44 +218 1 43 45 +219 1 43 52 +220 1 44 45 +221 1 44 47 +222 1 44 52 +223 1 44 53 +224 1 44 54 +225 1 45 54 +226 1 46 47 +227 1 46 48 +228 1 46 49 +229 1 46 50 +230 1 46 52 +231 1 46 55 +232 1 47 48 +233 1 47 49 +234 1 47 50 +235 1 47 51 +236 1 47 52 +237 1 47 53 +238 1 47 54 +239 1 47 56 +240 1 48 49 +241 1 48 50 +242 1 48 51 +243 1 48 53 +244 1 48 55 +245 1 48 56 +246 1 48 57 +247 1 48 59 +248 1 49 51 +249 1 49 52 +250 1 49 53 +251 1 49 55 +252 1 49 56 +253 1 49 58 +254 1 49 61 +255 1 50 51 +256 1 50 54 +257 1 50 59 +258 1 51 53 +259 1 51 54 +260 1 51 56 +261 1 51 59 +262 1 51 63 +263 1 52 53 +264 1 52 54 +265 1 52 61 +266 1 53 54 +267 1 53 56 +268 1 53 61 +269 1 53 62 +270 1 53 63 +271 1 54 63 +272 1 55 56 +273 1 55 57 +274 1 55 58 +275 1 55 59 +276 1 55 61 +277 1 56 57 +278 1 56 58 +279 1 56 59 +280 1 56 60 +281 1 56 61 +282 1 56 62 +283 1 56 63 +284 1 57 58 +285 1 57 59 +286 1 57 60 +287 1 57 62 +288 1 58 60 +289 1 58 61 +290 1 58 62 +291 1 59 60 +292 1 59 63 +293 1 60 62 +294 1 60 63 +295 1 61 62 +296 1 61 63 +297 1 62 63 diff --git a/examples/mdi/in.aimd.driver.plugin b/examples/mdi/in.aimd.driver.plugin index 858e42e2bd..d8c7fdde62 100644 --- a/examples/mdi/in.aimd.driver.plugin +++ b/examples/mdi/in.aimd.driver.plugin @@ -23,7 +23,7 @@ fix 1 all nve # NPT #fix 1 all npt temp 1.0 1.0 0.1 iso 1.0 1.0 1.0 -fix 2 all mdi/aimd plugin +fix 2 all mdi/aimd fix_modify 2 energy yes virial yes thermo_style custom step temp pe etotal press vol diff --git a/examples/mdi/sequence_driver.py b/examples/mdi/sequence_driver.py index ad1633ba2c..f15b2d4921 100644 --- a/examples/mdi/sequence_driver.py +++ b/examples/mdi/sequence_driver.py @@ -286,18 +286,15 @@ while iarg < narg: if not mdiarg: error() +mdi.MDI_Init(mdiarg) + # LAMMPS engine is a stand-alone code # world = MPI communicator for just this driver # invoke perform_tasks() directly if not plugin: - mdi.MDI_Init(mdiarg) world = mdi.MDI_MPI_get_world_comm() - - # connect to engine - mdicomm = mdi.MDI_Accept_Communicator() - perform_tasks(world,mdicomm,None) # LAMMPS engine is a plugin library @@ -305,7 +302,6 @@ if not plugin: # MDI will call back to perform_tasks() if plugin: - mdi.MDI_Init(mdiarg) world = MPI.COMM_WORLD plugin_args += " -mdi \"-role ENGINE -name lammps -method LINK\"" mdi.MDI_Launch_plugin(plugin,plugin_args,world,perform_tasks,None) diff --git a/examples/numdiff/README.md b/examples/numdiff/README.md index d88f66d65c..10727fe0e3 100644 --- a/examples/numdiff/README.md +++ b/examples/numdiff/README.md @@ -1,8 +1,11 @@ -# LAMMPS FIX NUMDIFF EXAMPLE +# LAMMPS NUMDIFF EXAMPLES FOR FORCES, VIRIAL, and BORN MATRIX -## Numerical Difference Fix +## Numerical Difference Fixes and Computes -This directory contains the ingredients to run an NVE simulation using the numerical difference fix and calculate error in forces. +This directory contains the input script for an NVE simulation with +fix numdiff, fix numdiff/virial, and compute born/matrix numdiff. +In each cases, results are compared to exact analytic expressions +and the small relative differences are reported. Example: ``` @@ -10,4 +13,4 @@ NP=4 #number of processors mpirun -np $NP lmp_mpi -in.numdiff ``` -## Required LAMMPS packages: MOLECULE package +## Required LAMMPS packages: EXTRA-FIX, EXTRA-COMPUTE diff --git a/examples/numdiff/in.numdiff b/examples/numdiff/in.numdiff index cd3d44a9e7..363570da87 100644 --- a/examples/numdiff/in.numdiff +++ b/examples/numdiff/in.numdiff @@ -1,5 +1,5 @@ # Numerical difference calculation -# of error in forces and virial stress +# of error in forces, virial stress, and Born matrix # adjustable parameters @@ -8,8 +8,10 @@ variable nthermo index 10 # thermo output interval variable ndump index 500 # dump output interval variable nlat index 3 # size of box variable fdelta index 1.0e-4 # displacement size -variable vdelta index 1.0e-6 # strain size +variable vdelta index 1.0e-6 # strain size for numdiff/virial +variable bdelta index 1.0e-8 # strain size for numdiff Born matrix variable temp index 10.0 # temperature +variable nugget equal 1.0e-6 # regularization for relerr units metal atom_style atomic @@ -23,8 +25,8 @@ mass 1 39.903 velocity all create ${temp} 2357 mom yes dist gaussian -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 +pair_style lj/cut 5.0 +pair_coeff 1 1 0.0102701 3.42 neighbor 0.0 bin neigh_modify every 1 delay 0 check no @@ -42,7 +44,7 @@ variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 compute faverrsq all reduce ave v_ferrsq variable fsq atom fx^2+fy^2+fz^2 compute favsq all reduce ave v_fsq -variable frelerr equal sqrt(c_faverrsq/c_favsq) +variable frelerr equal sqrt(c_faverrsq/(c_favsq+${nugget})) dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz # define numerical virial stress tensor calculation @@ -67,8 +69,59 @@ variable vsq equal "c_myvirial[1]^2 + & c_myvirial[4]^2 + & c_myvirial[5]^2 + & c_myvirial[6]^2" -variable vrelerr equal sqrt(v_verrsq/v_vsq) +variable vrelerr equal sqrt(v_verrsq/(v_vsq+${nugget})) -thermo_style custom step temp pe etotal press v_frelerr v_vrelerr +# define numerical Born matrix calculation + +compute bornnum all born/matrix numdiff ${bdelta} myvirial +compute born all born/matrix +variable berr vector c_bornnum-c_born +variable berrsq equal "v_berr[1]^2 + & + v_berr[2]^2 + & + v_berr[3]^2 + & + v_berr[4]^2 + & + v_berr[5]^2 + & + v_berr[6]^2 + & + v_berr[7]^2 + & + v_berr[8]^2 + & + v_berr[9]^2 + & + v_berr[10]^2 + & + v_berr[11]^2 + & + v_berr[12]^2 + & + v_berr[13]^2 + & + v_berr[14]^2 + & + v_berr[15]^2 + & + v_berr[16]^2 + & + v_berr[17]^2 + & + v_berr[18]^2 + & + v_berr[19]^2 + & + v_berr[20]^2 + & + v_berr[21]^2" + +variable bsq equal "c_born[1]^2 + & + c_born[2]^2 + & + c_born[3]^2 + & + c_born[4]^2 + & + c_born[5]^2 + & + c_born[6]^2 + & + c_born[7]^2 + & + c_born[8]^2 + & + c_born[9]^2 + & + c_born[10]^2 + & + c_born[11]^2 + & + c_born[12]^2 + & + c_born[13]^2 + & + c_born[14]^2 + & + c_born[15]^2 + & + c_born[16]^2 + & + c_born[17]^2 + & + c_born[18]^2 + & + c_born[19]^2 + & + c_born[20]^2 + & + c_born[21]^2" + +variable brelerr equal sqrt(v_berrsq/(v_bsq+${nugget})) + +thermo_style custom step temp pe etotal press v_frelerr v_vrelerr v_brelerr thermo ${nthermo} run ${nsteps} diff --git a/examples/numdiff/log.19Feb2022.log.numdiff.g++.1 b/examples/numdiff/log.19Feb2022.log.numdiff.g++.1 new file mode 100644 index 0000000000..34edf708bc --- /dev/null +++ b/examples/numdiff/log.19Feb2022.log.numdiff.g++.1 @@ -0,0 +1,197 @@ +LAMMPS (17 Feb 2022) +# Numerical difference calculation +# of error in forces, virial stress, and Born matrix + +# adjustable parameters + +variable nsteps index 500 # length of run +variable nthermo index 10 # thermo output interval +variable ndump index 500 # dump output interval +variable nlat index 3 # size of box +variable fdelta index 1.0e-4 # displacement size +variable vdelta index 1.0e-6 # strain size for numdiff/virial +variable bdelta index 1.0e-8 # strain size for numdiff Born matrix +variable temp index 10.0 # temperature +variable nugget equal 1.0e-6 # regularization for relerr + +units metal +atom_style atomic + +atom_modify map yes +lattice fcc 5.358000 +Lattice spacing in x,y,z = 5.358 5.358 5.358 +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +region box block 0 3 0 ${nlat} 0 ${nlat} +region box block 0 3 0 3 0 ${nlat} +region box block 0 3 0 3 0 3 +create_box 1 box +Created orthogonal box = (0 0 0) to (16.074 16.074 16.074) + 1 by 1 by 1 MPI processor grid +create_atoms 1 box +Created 108 atoms + using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074) + create_atoms CPU = 0.000 seconds +mass 1 39.903 + +velocity all create ${temp} 2357 mom yes dist gaussian +velocity all create 10.0 2357 mom yes dist gaussian + +pair_style lj/cut 5.0 +pair_coeff 1 1 0.0102701 3.42 + +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no + +timestep 0.001 +fix nve all nve + +# define numerical force calculation + +fix numforce all numdiff ${nthermo} ${fdelta} +fix numforce all numdiff 10 ${fdelta} +fix numforce all numdiff 10 1.0e-4 +variable ferrx atom f_numforce[1]-fx +variable ferry atom f_numforce[2]-fy +variable ferrz atom f_numforce[3]-fz +variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 +compute faverrsq all reduce ave v_ferrsq +variable fsq atom fx^2+fy^2+fz^2 +compute favsq all reduce ave v_fsq +variable frelerr equal sqrt(c_faverrsq/(c_favsq+${nugget})) +variable frelerr equal sqrt(c_faverrsq/(c_favsq+1e-06)) +dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz +dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz + +# define numerical virial stress tensor calculation + +compute myvirial all pressure NULL virial +fix numvirial all numdiff/virial ${nthermo} ${vdelta} +fix numvirial all numdiff/virial 10 ${vdelta} +fix numvirial all numdiff/virial 10 1.0e-6 +variable errxx equal f_numvirial[1]-c_myvirial[1] +variable erryy equal f_numvirial[2]-c_myvirial[2] +variable errzz equal f_numvirial[3]-c_myvirial[3] +variable erryz equal f_numvirial[4]-c_myvirial[6] +variable errxz equal f_numvirial[5]-c_myvirial[5] +variable errxy equal f_numvirial[6]-c_myvirial[4] +variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2" +variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2" +variable vrelerr equal sqrt(v_verrsq/(v_vsq+${nugget})) +variable vrelerr equal sqrt(v_verrsq/(v_vsq+1e-06)) + +# define numerical Born matrix calculation + +compute bornnum all born/matrix numdiff ${bdelta} myvirial +compute bornnum all born/matrix numdiff 1.0e-8 myvirial +compute born all born/matrix +variable berr vector c_bornnum-c_born +variable berrsq equal "v_berr[1]^2 + v_berr[2]^2 + v_berr[3]^2 + v_berr[4]^2 + v_berr[5]^2 + v_berr[6]^2 + v_berr[7]^2 + v_berr[8]^2 + v_berr[9]^2 + v_berr[10]^2 + v_berr[11]^2 + v_berr[12]^2 + v_berr[13]^2 + v_berr[14]^2 + v_berr[15]^2 + v_berr[16]^2 + v_berr[17]^2 + v_berr[18]^2 + v_berr[19]^2 + v_berr[20]^2 + v_berr[21]^2" + +variable bsq equal "c_born[1]^2 + c_born[2]^2 + c_born[3]^2 + c_born[4]^2 + c_born[5]^2 + c_born[6]^2 + c_born[7]^2 + c_born[8]^2 + c_born[9]^2 + c_born[10]^2 + c_born[11]^2 + c_born[12]^2 + c_born[13]^2 + c_born[14]^2 + c_born[15]^2 + c_born[16]^2 + c_born[17]^2 + c_born[18]^2 + c_born[19]^2 + c_born[20]^2 + c_born[21]^2" + +variable brelerr equal sqrt(v_berrsq/(v_bsq+${nugget})) +variable brelerr equal sqrt(v_berrsq/(v_bsq+1e-06)) + +thermo_style custom step temp pe etotal press v_frelerr v_vrelerr v_brelerr +thermo ${nthermo} +thermo 10 +run ${nsteps} +run 500 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5 + ghost atom cutoff = 5 + binsize = 2.5, bins = 7 7 7 + 2 neighbor lists, perpetual/occasional/extra = 1 1 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard + (2) compute born/matrix, occasional, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 6.823 | 6.823 | 6.823 Mbytes +Step Temp PotEng TotEng Press v_frelerr v_vrelerr v_brelerr + 0 10 -6.6101864 -6.471878 947.70558 5.7012262e-09 1.4849734e-08 9.036398e-09 + 10 9.9357441 -6.6092976 -6.471878 949.3486 1.3828998e-08 1.9248385e-09 4.0233493e-09 + 20 9.7444561 -6.6066519 -6.4718779 954.23637 1.385204e-08 1.7476399e-09 4.0061081e-09 + 30 9.4311148 -6.6023181 -6.4718779 962.23331 1.4147226e-08 1.7647816e-09 3.3866543e-09 + 40 9.0043293 -6.5964152 -6.4718778 973.10762 1.4128155e-08 1.6390138e-09 3.2652821e-09 + 50 8.4762135 -6.5891108 -6.4718777 986.53572 1.4168048e-08 2.3910821e-09 4.7266627e-09 + 60 7.8621735 -6.5806179 -6.4718775 1002.1092 1.411958e-08 2.0683414e-09 2.6951001e-09 + 70 7.1805874 -6.5711908 -6.4718773 1019.3448 1.4139911e-08 1.6084571e-09 3.1477301e-09 + 80 6.4523557 -6.5611186 -6.4718771 1037.6974 1.4105096e-08 1.9929271e-09 3.4733802e-09 + 90 5.7003071 -6.5507169 -6.4718769 1056.5767 1.4084183e-08 1.750579e-09 4.310104e-09 + 100 4.9484503 -6.5403179 -6.4718767 1075.3674 1.4063796e-08 1.0250271e-09 2.9213594e-09 + 110 4.221081 -6.5302576 -6.4718765 1093.4526 1.400901e-08 1.389277e-09 4.3909721e-09 + 120 3.5417733 -6.520862 -6.4718763 1110.2388 1.4038158e-08 8.6231891e-10 2.5890696e-09 + 130 2.9323072 -6.5124324 -6.4718762 1125.183 1.4048645e-08 7.0840985e-10 3.388192e-09 + 140 2.411607 -6.5052306 -6.471876 1137.8182 1.3968429e-08 1.8508015e-09 3.2976031e-09 + 150 1.9947801 -6.4994654 -6.4718759 1147.7764 1.395965e-08 1.9484728e-09 4.2924605e-09 + 160 1.6923481 -6.4952825 -6.4718759 1154.8063 1.3948606e-08 1.5275137e-09 4.0204309e-09 + 170 1.5097515 -6.492757 -6.4718759 1158.7853 1.3845523e-08 1.5455e-09 4.8781309e-09 + 180 1.4471795 -6.4918916 -6.4718759 1159.7221 1.3788451e-08 1.578099e-09 3.0795316e-09 + 190 1.4997431 -6.4926187 -6.471876 1157.7529 1.374841e-08 2.142073e-09 2.4376961e-09 + 200 1.6579637 -6.4948072 -6.4718761 1153.1286 1.3674788e-08 2.111894e-09 3.7055708e-09 + 210 1.908522 -6.4982727 -6.4718763 1146.1965 1.3639408e-08 1.2386489e-09 3.160881e-09 + 220 2.23518 -6.5027908 -6.4718764 1137.3775 1.3524209e-08 1.7016573e-09 3.6982265e-09 + 230 2.6197892 -6.5081105 -6.4718766 1127.1415 1.3344007e-08 1.5843477e-09 3.7272821e-09 + 240 3.043298 -6.5139681 -6.4718768 1115.9815 1.3245227e-08 1.5502368e-09 3.898015e-09 + 250 3.4866901 -6.5201007 -6.4718769 1104.3906 1.3080142e-08 1.369987e-09 4.9133863e-09 + 260 3.9318061 -6.5262572 -6.4718771 1092.84 1.2885339e-08 1.0743728e-09 5.7271364e-09 + 270 4.3620216 -6.5322076 -6.4718772 1081.7617 1.2705966e-08 1.3618619e-09 2.3225062e-09 + 280 4.7627723 -6.5377504 -6.4718773 1071.5341 1.2480463e-08 1.4346869e-09 3.281167e-09 + 290 5.1219322 -6.542718 -6.4718774 1062.4716 1.2434727e-08 2.1935942e-09 2.8198924e-09 + 300 5.4300557 -6.5469796 -6.4718774 1054.8177 1.2321314e-08 8.2365886e-10 3.2731015e-09 + 310 5.6804997 -6.5504435 -6.4718774 1048.7409 1.2300884e-08 1.4855741e-09 4.1031988e-09 + 320 5.8694423 -6.5530567 -6.4718774 1044.3341 1.2483087e-08 1.8711589e-09 3.9368436e-09 + 330 5.9958115 -6.5548045 -6.4718774 1041.6165 1.2627617e-08 1.9256986e-09 4.3283764e-09 + 340 6.0611353 -6.555708 -6.4718774 1040.5369 1.2935701e-08 1.6609255e-09 3.8728039e-09 + 350 6.0693222 -6.5558211 -6.4718773 1040.9803 1.3218179e-08 1.985355e-09 2.618577e-09 + 360 6.0263776 -6.5552271 -6.4718773 1042.7755 1.3471701e-08 1.5125203e-09 2.936238e-09 + 370 5.9400629 -6.5540332 -6.4718772 1045.7049 1.3676495e-08 1.7364093e-09 2.9097362e-09 + 380 5.8195019 -6.5523657 -6.4718771 1049.515 1.3859995e-08 1.6834835e-09 2.7416302e-09 + 390 5.6747442 -6.5503635 -6.471877 1053.9288 1.3987553e-08 1.7893896e-09 2.8552537e-09 + 400 5.5162948 -6.5481719 -6.4718769 1058.6583 1.4091878e-08 1.4468098e-09 3.2733654e-09 + 410 5.3546269 -6.5459358 -6.4718768 1063.4182 1.4188438e-08 1.7231047e-09 3.3165187e-09 + 420 5.1996958 -6.5437929 -6.4718768 1067.9384 1.4205207e-08 1.3551982e-09 3.8687611e-09 + 430 5.0604771 -6.5418673 -6.4718767 1071.9767 1.4267199e-08 1.361845e-09 3.1210672e-09 + 440 4.9445529 -6.5402639 -6.4718766 1075.3292 1.4253464e-08 1.3945282e-09 2.6483572e-09 + 450 4.8577717 -6.5390637 -6.4718766 1077.8394 1.4240998e-08 1.8767323e-09 3.2040422e-09 + 460 4.8040023 -6.53832 -6.4718766 1079.4048 1.4242259e-08 1.4785379e-09 3.4402279e-09 + 470 4.7849977 -6.5380571 -6.4718766 1079.9795 1.4227939e-08 1.8623848e-09 4.3634918e-09 + 480 4.8003794 -6.5382699 -6.4718766 1079.5756 1.4215836e-08 1.2821795e-09 2.6846581e-09 + 490 4.8477405 -6.538925 -6.4718767 1078.2596 1.4186541e-08 2.47604e-09 3.2044632e-09 + 500 4.9228588 -6.539964 -6.4718767 1076.1469 1.4099819e-08 1.6653302e-09 3.267113e-09 +Loop time of 0.458483 on 1 procs for 500 steps with 108 atoms + +Performance: 94.224 ns/day, 0.255 hours/ns, 1090.552 timesteps/s +99.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.0042278 | 0.0042278 | 0.0042278 | 0.0 | 0.92 +Neigh | 0.02481 | 0.02481 | 0.02481 | 0.0 | 5.41 +Comm | 0.002944 | 0.002944 | 0.002944 | 0.0 | 0.64 +Output | 0.014731 | 0.014731 | 0.014731 | 0.0 | 3.21 +Modify | 0.41122 | 0.41122 | 0.41122 | 0.0 | 89.69 +Other | | 0.0005545 | | | 0.12 + +Nlocal: 108 ave 108 max 108 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 256 ave 256 max 256 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 648 ave 648 max 648 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 648 +Ave neighs/atom = 6 +Neighbor list builds = 500 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/numdiff/log.19Feb2022.log.numdiff.g++.4 b/examples/numdiff/log.19Feb2022.log.numdiff.g++.4 new file mode 100644 index 0000000000..a692a6ad7f --- /dev/null +++ b/examples/numdiff/log.19Feb2022.log.numdiff.g++.4 @@ -0,0 +1,197 @@ +LAMMPS (17 Feb 2022) +# Numerical difference calculation +# of error in forces, virial stress, and Born matrix + +# adjustable parameters + +variable nsteps index 500 # length of run +variable nthermo index 10 # thermo output interval +variable ndump index 500 # dump output interval +variable nlat index 3 # size of box +variable fdelta index 1.0e-4 # displacement size +variable vdelta index 1.0e-6 # strain size for numdiff/virial +variable bdelta index 1.0e-8 # strain size for numdiff Born matrix +variable temp index 10.0 # temperature +variable nugget equal 1.0e-6 # regularization for relerr + +units metal +atom_style atomic + +atom_modify map yes +lattice fcc 5.358000 +Lattice spacing in x,y,z = 5.358 5.358 5.358 +region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} +region box block 0 3 0 ${nlat} 0 ${nlat} +region box block 0 3 0 3 0 ${nlat} +region box block 0 3 0 3 0 3 +create_box 1 box +Created orthogonal box = (0 0 0) to (16.074 16.074 16.074) + 1 by 2 by 2 MPI processor grid +create_atoms 1 box +Created 108 atoms + using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074) + create_atoms CPU = 0.000 seconds +mass 1 39.903 + +velocity all create ${temp} 2357 mom yes dist gaussian +velocity all create 10.0 2357 mom yes dist gaussian + +pair_style lj/cut 5.0 +pair_coeff 1 1 0.0102701 3.42 + +neighbor 0.0 bin +neigh_modify every 1 delay 0 check no + +timestep 0.001 +fix nve all nve + +# define numerical force calculation + +fix numforce all numdiff ${nthermo} ${fdelta} +fix numforce all numdiff 10 ${fdelta} +fix numforce all numdiff 10 1.0e-4 +variable ferrx atom f_numforce[1]-fx +variable ferry atom f_numforce[2]-fy +variable ferrz atom f_numforce[3]-fz +variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 +compute faverrsq all reduce ave v_ferrsq +variable fsq atom fx^2+fy^2+fz^2 +compute favsq all reduce ave v_fsq +variable frelerr equal sqrt(c_faverrsq/(c_favsq+${nugget})) +variable frelerr equal sqrt(c_faverrsq/(c_favsq+1e-06)) +dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz +dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz + +# define numerical virial stress tensor calculation + +compute myvirial all pressure NULL virial +fix numvirial all numdiff/virial ${nthermo} ${vdelta} +fix numvirial all numdiff/virial 10 ${vdelta} +fix numvirial all numdiff/virial 10 1.0e-6 +variable errxx equal f_numvirial[1]-c_myvirial[1] +variable erryy equal f_numvirial[2]-c_myvirial[2] +variable errzz equal f_numvirial[3]-c_myvirial[3] +variable erryz equal f_numvirial[4]-c_myvirial[6] +variable errxz equal f_numvirial[5]-c_myvirial[5] +variable errxy equal f_numvirial[6]-c_myvirial[4] +variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2" +variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2" +variable vrelerr equal sqrt(v_verrsq/(v_vsq+${nugget})) +variable vrelerr equal sqrt(v_verrsq/(v_vsq+1e-06)) + +# define numerical Born matrix calculation + +compute bornnum all born/matrix numdiff ${bdelta} myvirial +compute bornnum all born/matrix numdiff 1.0e-8 myvirial +compute born all born/matrix +variable berr vector c_bornnum-c_born +variable berrsq equal "v_berr[1]^2 + v_berr[2]^2 + v_berr[3]^2 + v_berr[4]^2 + v_berr[5]^2 + v_berr[6]^2 + v_berr[7]^2 + v_berr[8]^2 + v_berr[9]^2 + v_berr[10]^2 + v_berr[11]^2 + v_berr[12]^2 + v_berr[13]^2 + v_berr[14]^2 + v_berr[15]^2 + v_berr[16]^2 + v_berr[17]^2 + v_berr[18]^2 + v_berr[19]^2 + v_berr[20]^2 + v_berr[21]^2" + +variable bsq equal "c_born[1]^2 + c_born[2]^2 + c_born[3]^2 + c_born[4]^2 + c_born[5]^2 + c_born[6]^2 + c_born[7]^2 + c_born[8]^2 + c_born[9]^2 + c_born[10]^2 + c_born[11]^2 + c_born[12]^2 + c_born[13]^2 + c_born[14]^2 + c_born[15]^2 + c_born[16]^2 + c_born[17]^2 + c_born[18]^2 + c_born[19]^2 + c_born[20]^2 + c_born[21]^2" + +variable brelerr equal sqrt(v_berrsq/(v_bsq+${nugget})) +variable brelerr equal sqrt(v_berrsq/(v_bsq+1e-06)) + +thermo_style custom step temp pe etotal press v_frelerr v_vrelerr v_brelerr +thermo ${nthermo} +thermo 10 +run ${nsteps} +run 500 + generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update every 1 steps, delay 0 steps, check no + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5 + ghost atom cutoff = 5 + binsize = 2.5, bins = 7 7 7 + 2 neighbor lists, perpetual/occasional/extra = 1 1 0 + (1) pair lj/cut, perpetual + attributes: half, newton on + pair build: half/bin/atomonly/newton + stencil: half/bin/3d + bin: standard + (2) compute born/matrix, occasional, copy from (1) + attributes: half, newton on + pair build: copy + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 6.816 | 6.816 | 6.816 Mbytes +Step Temp PotEng TotEng Press v_frelerr v_vrelerr v_brelerr + 0 10 -6.6101864 -6.471878 947.70558 1.9110624e-09 9.4407596e-10 3.1867416e-09 + 10 9.9369961 -6.6093149 -6.471878 949.31222 1.3055176e-08 4.996456e-10 2.7421655e-09 + 20 9.7500224 -6.6067289 -6.4718779 954.07898 1.3721178e-08 5.6039795e-10 2.3689718e-09 + 30 9.4448115 -6.6025075 -6.4718779 961.85502 1.3813156e-08 6.8451692e-10 1.9844663e-09 + 40 9.0305392 -6.5967776 -6.4718777 972.39819 1.3961749e-08 3.1134064e-10 1.7915052e-09 + 50 8.5196068 -6.5897109 -6.4718776 985.38158 1.3996941e-08 7.0149406e-10 2.002272e-09 + 60 7.9273388 -6.5815192 -6.4718775 1000.4024 1.4000005e-08 3.5766629e-10 2.4944703e-09 + 70 7.2715879 -6.5724494 -6.4718773 1016.9932 1.3996503e-08 6.2731503e-10 1.7010533e-09 + 80 6.5722375 -6.5627766 -6.4718771 1034.6361 1.3973603e-08 3.1142917e-10 2.808524e-09 + 90 5.8505991 -6.5527956 -6.4718769 1052.7794 1.3983301e-08 3.9931135e-10 2.6118214e-09 + 100 5.128708 -6.542811 -6.4718767 1070.8561 1.395586e-08 2.3152413e-10 2.8742755e-09 + 110 4.4285344 -6.5331269 -6.4718766 1088.305 1.3938374e-08 4.2173005e-10 2.3059886e-09 + 120 3.7711361 -6.5240343 -6.4718764 1104.5919 1.3915264e-08 2.5458038e-10 1.4864012e-09 + 130 3.1757964 -6.5158002 -6.4718762 1119.2319 1.3858843e-08 5.7490448e-10 2.6191823e-09 + 140 2.6591997 -6.5086551 -6.4718761 1131.8095 1.3814891e-08 3.5434633e-10 2.2009364e-09 + 150 2.2347034 -6.5027839 -6.471876 1141.9961 1.3781115e-08 5.0639594e-10 2.9032558e-09 + 160 1.9117661 -6.4983173 -6.471876 1149.564 1.3734288e-08 3.1954962e-10 2.6097446e-09 + 170 1.6955808 -6.4953273 -6.471876 1154.3946 1.3682252e-08 3.5426781e-10 2.9605676e-09 + 180 1.586949 -6.4938249 -6.471876 1156.4812 1.363e-08 4.0804881e-10 2.1707904e-09 + 190 1.5824056 -6.4937621 -6.4718761 1155.925 1.3532637e-08 4.0767685e-10 3.0091462e-09 + 200 1.6745831 -6.4950371 -6.4718762 1152.926 1.3455927e-08 2.953369e-10 2.5029298e-09 + 210 1.8527803 -6.4975018 -6.4718763 1147.7684 1.335224e-08 3.5042319e-10 3.0550064e-09 + 220 2.1036825 -6.5009721 -6.4718764 1140.8026 1.3239176e-08 3.5988448e-10 2.6852683e-09 + 230 2.4121721 -6.5052389 -6.4718766 1132.4243 1.3090019e-08 3.5004036e-10 2.8838602e-09 + 240 2.7621668 -6.5100798 -6.4718767 1123.0538 1.2946525e-08 4.1216361e-10 2.1105916e-09 + 250 3.1374274 -6.5152701 -6.4718768 1113.1152 1.277789e-08 5.9848318e-10 2.3087106e-09 + 260 3.5222906 -6.5205932 -6.471877 1103.0171 1.2591089e-08 2.0080182e-10 1.6969069e-09 + 270 3.9022942 -6.5258491 -6.4718771 1093.1369 1.2432232e-08 4.2494727e-10 1.7375594e-09 + 280 4.2646753 -6.5308612 -6.4718772 1083.8072 1.2268238e-08 6.1239266e-10 1.7005135e-09 + 290 4.598736 -6.5354816 -6.4718772 1075.306 1.2181179e-08 4.9338341e-10 2.1326848e-09 + 300 4.896078 -6.5395941 -6.4718773 1067.85 1.2098274e-08 3.4564838e-10 2.4199891e-09 + 310 5.150715 -6.543116 -6.4718773 1061.5918 1.2184958e-08 4.2383299e-10 2.2243759e-09 + 320 5.3590742 -6.5459978 -6.4718773 1056.6189 1.2312948e-08 3.5194185e-10 1.3856935e-09 + 330 5.5199009 -6.5482222 -6.4718773 1052.9565 1.2573918e-08 4.2401322e-10 2.9882e-09 + 340 5.6340787 -6.5498013 -6.4718773 1050.5719 1.2821551e-08 5.8802825e-10 2.7333289e-09 + 350 5.7043792 -6.5507736 -6.4718772 1049.3813 1.3067314e-08 4.0014945e-10 2.3564728e-09 + 360 5.7351548 -6.5511992 -6.4718772 1049.2581 1.331283e-08 4.1684815e-10 1.735621e-09 + 370 5.7319891 -6.5511553 -6.4718771 1050.042 1.354018e-08 3.8495426e-10 2.4460056e-09 + 380 5.7013193 -6.5507311 -6.4718771 1051.5496 1.3734888e-08 3.5333605e-10 2.5174342e-09 + 390 5.6500487 -6.5500219 -6.471877 1053.5847 1.3892287e-08 3.8154957e-10 1.77358e-09 + 400 5.5851679 -6.5491245 -6.471877 1055.9489 1.3988171e-08 5.8769536e-10 1.9262201e-09 + 410 5.5134009 -6.5481319 -6.4718769 1058.4508 1.4088779e-08 3.6754739e-10 2.7586362e-09 + 420 5.4408957 -6.547129 -6.4718769 1060.9152 1.4139924e-08 4.9030281e-10 3.2871245e-09 + 430 5.3729707 -6.5461895 -6.4718768 1063.1898 1.4173041e-08 5.2345074e-10 3.5995984e-09 + 440 5.3139284 -6.5453729 -6.4718768 1065.1506 1.4191516e-08 5.9481094e-10 2.5005297e-09 + 450 5.2669383 -6.5447229 -6.4718768 1066.7054 1.4168424e-08 3.0799668e-10 2.0864191e-09 + 460 5.2339881 -6.5442672 -6.4718768 1067.7958 1.4163444e-08 6.3927736e-10 2.2872669e-09 + 470 5.2158979 -6.544017 -6.4718768 1068.3968 1.413819e-08 5.5108262e-10 4.4334972e-09 + 480 5.2123873 -6.5439685 -6.4718768 1068.5155 1.4083227e-08 3.9249548e-10 2.5568235e-09 + 490 5.2221849 -6.544104 -6.4718768 1068.188 1.4035287e-08 2.1988631e-10 2.1264034e-09 + 500 5.2431716 -6.5443943 -6.4718768 1067.4759 1.3968666e-08 3.9100701e-10 3.290368e-09 +Loop time of 0.170182 on 4 procs for 500 steps with 108 atoms + +Performance: 253.846 ns/day, 0.095 hours/ns, 2938.035 timesteps/s +99.7% 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.0012069 | 0.0012994 | 0.0013512 | 0.2 | 0.76 +Neigh | 0.0048233 | 0.0050244 | 0.0053881 | 0.3 | 2.95 +Comm | 0.0072462 | 0.0078013 | 0.008175 | 0.4 | 4.58 +Output | 0.0080632 | 0.0081244 | 0.0082899 | 0.1 | 4.77 +Modify | 0.1476 | 0.14764 | 0.14768 | 0.0 | 86.75 +Other | | 0.0002961 | | | 0.17 + +Nlocal: 27 ave 31 max 24 min +Histogram: 1 0 1 0 1 0 0 0 0 1 +Nghost: 135 ave 138 max 131 min +Histogram: 1 0 0 0 0 1 0 1 0 1 +Neighs: 162 ave 191 max 148 min +Histogram: 1 2 0 0 0 0 0 0 0 1 + +Total # of neighbors = 648 +Ave neighs/atom = 6 +Neighbor list builds = 500 +Dangerous builds not checked +Total wall time: 0:00:00 diff --git a/examples/numdiff/log.28Jan2022.log.numdiff.g++.1 b/examples/numdiff/log.28Jan2022.log.numdiff.g++.1 deleted file mode 100644 index f32e72834f..0000000000 --- a/examples/numdiff/log.28Jan2022.log.numdiff.g++.1 +++ /dev/null @@ -1,175 +0,0 @@ -LAMMPS (7 Jan 2022) -# Numerical difference calculation -# of error in forces and virial stress - -# adjustable parameters - -variable nsteps index 500 # length of run -variable nthermo index 10 # thermo output interval -variable ndump index 500 # dump output interval -variable nlat index 3 # size of box -variable fdelta index 1.0e-4 # displacement size -variable vdelta index 1.0e-6 # strain size -variable temp index 10.0 # temperature - -units metal -atom_style atomic - -atom_modify map yes -lattice fcc 5.358000 -Lattice spacing in x,y,z = 5.358 5.358 5.358 -region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} -region box block 0 3 0 ${nlat} 0 ${nlat} -region box block 0 3 0 3 0 ${nlat} -region box block 0 3 0 3 0 3 -create_box 1 box -Created orthogonal box = (0 0 0) to (16.074 16.074 16.074) - 1 by 1 by 1 MPI processor grid -create_atoms 1 box -Created 108 atoms - using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074) - create_atoms CPU = 0.000 seconds -mass 1 39.903 - -velocity all create ${temp} 2357 mom yes dist gaussian -velocity all create 10.0 2357 mom yes dist gaussian - -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 - -neighbor 0.0 bin -neigh_modify every 1 delay 0 check no - -timestep 0.001 -fix nve all nve - -# define numerical force calculation - -fix numforce all numdiff ${nthermo} ${fdelta} -fix numforce all numdiff 10 ${fdelta} -fix numforce all numdiff 10 1.0e-4 -variable ferrx atom f_numforce[1]-fx -variable ferry atom f_numforce[2]-fy -variable ferrz atom f_numforce[3]-fz -variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 -compute faverrsq all reduce ave v_ferrsq -variable fsq atom fx^2+fy^2+fz^2 -compute favsq all reduce ave v_fsq -variable frelerr equal sqrt(c_faverrsq/c_favsq) -dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz -dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz - -# define numerical virial stress tensor calculation - -compute myvirial all pressure NULL virial -fix numvirial all numdiff/virial ${nthermo} ${vdelta} -fix numvirial all numdiff/virial 10 ${vdelta} -fix numvirial all numdiff/virial 10 1.0e-6 -variable errxx equal f_numvirial[1]-c_myvirial[1] -variable erryy equal f_numvirial[2]-c_myvirial[2] -variable errzz equal f_numvirial[3]-c_myvirial[3] -variable erryz equal f_numvirial[4]-c_myvirial[6] -variable errxz equal f_numvirial[5]-c_myvirial[5] -variable errxy equal f_numvirial[6]-c_myvirial[4] -variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2" -variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2" -variable vrelerr equal sqrt(v_verrsq/v_vsq) - -thermo_style custom step temp pe etotal press v_frelerr v_vrelerr -thermo ${nthermo} -thermo 10 -run ${nsteps} -run 500 - generated 0 of 0 mixed pair_coeff terms from geometric mixing rule -Neighbor list info ... - update every 1 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.9407173 - ghost atom cutoff = 5.9407173 - binsize = 2.9703587, bins = 6 6 6 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cubic, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.083 | 6.083 | 6.083 Mbytes -Step Temp PotEng TotEng Press v_frelerr v_vrelerr - 0 10 -7.0259569 -6.8876486 28.564278 19203.344 1.5660292e-06 - 10 9.9376583 -7.0250947 -6.8876486 30.254762 1.5040965e-08 2.1991382e-07 - 20 9.7520139 -7.022527 -6.8876485 35.28505 1.4756358e-08 2.6265315e-06 - 30 9.4477557 -7.0183188 -6.8876485 43.519863 1.4688198e-08 2.6356166e-07 - 40 9.0330215 -7.0125826 -6.8876484 54.727797 1.4637921e-08 5.2292327e-08 - 50 8.5192918 -7.0054772 -6.8876483 68.585553 1.4587854e-08 7.1324716e-08 - 60 7.9212026 -6.997205 -6.8876481 84.684636 1.4525561e-08 3.1108149e-08 - 70 7.2562592 -6.9880081 -6.8876479 102.54088 1.450885e-08 3.2311094e-08 - 80 6.5444294 -6.9781627 -6.8876478 121.60715 1.4444738e-08 2.1776998e-08 - 90 5.8075961 -6.9679715 -6.8876476 141.2895 1.4493562e-08 2.0400898e-08 - 100 5.0688629 -6.957754 -6.8876474 160.9668 1.445455e-08 1.2636688e-08 - 110 4.3517145 -6.947835 -6.8876472 180.0135 1.4460371e-08 1.2528038e-08 - 120 3.6790589 -6.9385314 -6.887647 197.82486 1.4371757e-08 1.4489522e-08 - 130 3.0721984 -6.9301379 -6.8876468 213.84331 1.4364708e-08 1.2461922e-08 - 140 2.5497991 -6.9229125 -6.8876467 227.58429 1.4330926e-08 9.3913926e-09 - 150 2.1269443 -6.917064 -6.8876466 238.6596 1.4287002e-08 4.1510266e-09 - 160 1.8143642 -6.9127407 -6.8876465 246.79599 1.4282669e-08 7.7048281e-09 - 170 1.6179191 -6.9100237 -6.8876465 251.84748 1.42726e-08 1.2719973e-08 - 180 1.5383946 -6.9089239 -6.8876466 253.79991 1.4236534e-08 8.1200831e-09 - 190 1.5716287 -6.9093836 -6.8876467 252.76745 1.41706e-08 6.5670612e-09 - 200 1.7089493 -6.911283 -6.8876468 248.98142 1.4096463e-08 1.1685863e-08 - 210 1.9378716 -6.9144493 -6.8876469 242.77289 1.4008978e-08 1.1226902e-08 - 220 2.2429731 -6.9186692 -6.887647 234.55055 1.3886901e-08 9.9914102e-09 - 230 2.606862 -6.9237023 -6.8876472 224.77626 1.3864576e-08 1.1540228e-08 - 240 3.0111524 -6.9292941 -6.8876474 213.93996 1.3696314e-08 1.1697747e-08 - 250 3.4373794 -6.9351893 -6.8876475 202.53583 1.3626701e-08 1.0398197e-08 - 260 3.8678047 -6.9411426 -6.8876476 191.04084 1.3489489e-08 6.6603364e-09 - 270 4.2860853 -6.9469279 -6.8876478 179.89646 1.3312014e-08 1.1687917e-08 - 280 4.6777954 -6.9523457 -6.8876479 169.49404 1.3081144e-08 1.1336675e-08 - 290 5.030805 -6.9572282 -6.887648 160.16371 1.2947385e-08 1.7342825e-08 - 300 5.3355278 -6.9614428 -6.887648 152.16682 1.2893673e-08 1.7510534e-08 - 310 5.5850532 -6.964894 -6.887648 145.69148 1.2842022e-08 1.2782546e-08 - 320 5.7751794 -6.9675236 -6.8876481 140.85102 1.2903488e-08 1.5319437e-08 - 330 5.9043601 -6.9693103 -6.887648 137.68497 1.3076809e-08 1.1208999e-08 - 340 5.9735784 -6.9702676 -6.887648 136.16232 1.3296904e-08 1.891087e-08 - 350 5.9861549 -6.9704415 -6.887648 136.18679 1.3504051e-08 2.5783601e-08 - 360 5.947496 -6.9699067 -6.8876479 137.60397 1.3731112e-08 2.0556839e-08 - 370 5.8647874 -6.9687627 -6.8876478 140.2101 1.4009878e-08 2.1771736e-08 - 380 5.7466376 -6.9671285 -6.8876477 143.76234 1.4092054e-08 1.1085162e-08 - 390 5.6026773 -6.9651374 -6.8876477 147.99019 1.4282872e-08 2.0221602e-08 - 400 5.4431231 -6.9629305 -6.8876476 152.60787 1.4317739e-08 1.7076065e-08 - 410 5.2783192 -6.960651 -6.8876475 157.32722 1.4415075e-08 2.5031776e-08 - 420 5.1182723 -6.9584374 -6.8876474 161.87063 1.4441435e-08 2.2519289e-08 - 430 4.9722 -6.956417 -6.8876473 165.98344 1.4550624e-08 2.4512613e-08 - 440 4.8481153 -6.9547008 -6.8876473 169.44527 1.4544672e-08 1.4758301e-08 - 450 4.7524707 -6.9533779 -6.8876472 172.07964 1.4546492e-08 1.324687e-08 - 460 4.6898817 -6.9525122 -6.8876472 173.76132 1.4537475e-08 1.351367e-08 - 470 4.6629495 -6.9521397 -6.8876472 174.42109 1.4530458e-08 1.521106e-08 - 480 4.6721922 -6.9522675 -6.8876472 174.04742 1.4543785e-08 1.0905422e-08 - 490 4.7160887 -6.9528747 -6.8876473 172.68525 1.4545591e-08 2.0128525e-08 - 500 4.7912313 -6.953914 -6.8876473 170.43183 1.4438981e-08 1.6062775e-08 -Loop time of 0.837333 on 1 procs for 500 steps with 108 atoms - -Performance: 51.592 ns/day, 0.465 hours/ns, 597.134 timesteps/s -99.8% 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.0097726 | 0.0097726 | 0.0097726 | 0.0 | 1.17 -Neigh | 0.03095 | 0.03095 | 0.03095 | 0.0 | 3.70 -Comm | 0.005564 | 0.005564 | 0.005564 | 0.0 | 0.66 -Output | 0.0042451 | 0.0042451 | 0.0042451 | 0.0 | 0.51 -Modify | 0.78618 | 0.78618 | 0.78618 | 0.0 | 93.89 -Other | | 0.0006258 | | | 0.07 - -Nlocal: 108 ave 108 max 108 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 558 ave 558 max 558 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 972 ave 972 max 972 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 972 -Ave neighs/atom = 9 -Neighbor list builds = 500 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/numdiff/log.28Jan2022.log.numdiff.g++.4 b/examples/numdiff/log.28Jan2022.log.numdiff.g++.4 deleted file mode 100644 index fc56c4aee8..0000000000 --- a/examples/numdiff/log.28Jan2022.log.numdiff.g++.4 +++ /dev/null @@ -1,175 +0,0 @@ -LAMMPS (7 Jan 2022) -# Numerical difference calculation -# of error in forces and virial stress - -# adjustable parameters - -variable nsteps index 500 # length of run -variable nthermo index 10 # thermo output interval -variable ndump index 500 # dump output interval -variable nlat index 3 # size of box -variable fdelta index 1.0e-4 # displacement size -variable vdelta index 1.0e-6 # strain size -variable temp index 10.0 # temperature - -units metal -atom_style atomic - -atom_modify map yes -lattice fcc 5.358000 -Lattice spacing in x,y,z = 5.358 5.358 5.358 -region box block 0 ${nlat} 0 ${nlat} 0 ${nlat} -region box block 0 3 0 ${nlat} 0 ${nlat} -region box block 0 3 0 3 0 ${nlat} -region box block 0 3 0 3 0 3 -create_box 1 box -Created orthogonal box = (0 0 0) to (16.074 16.074 16.074) - 1 by 2 by 2 MPI processor grid -create_atoms 1 box -Created 108 atoms - using lattice units in orthogonal box = (0 0 0) to (16.074 16.074 16.074) - create_atoms CPU = 0.000 seconds -mass 1 39.903 - -velocity all create ${temp} 2357 mom yes dist gaussian -velocity all create 10.0 2357 mom yes dist gaussian - -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 - -neighbor 0.0 bin -neigh_modify every 1 delay 0 check no - -timestep 0.001 -fix nve all nve - -# define numerical force calculation - -fix numforce all numdiff ${nthermo} ${fdelta} -fix numforce all numdiff 10 ${fdelta} -fix numforce all numdiff 10 1.0e-4 -variable ferrx atom f_numforce[1]-fx -variable ferry atom f_numforce[2]-fy -variable ferrz atom f_numforce[3]-fz -variable ferrsq atom v_ferrx^2+v_ferry^2+v_ferrz^2 -compute faverrsq all reduce ave v_ferrsq -variable fsq atom fx^2+fy^2+fz^2 -compute favsq all reduce ave v_fsq -variable frelerr equal sqrt(c_faverrsq/c_favsq) -dump errors all custom ${ndump} force_error.dump v_ferrx v_ferry v_ferrz -dump errors all custom 500 force_error.dump v_ferrx v_ferry v_ferrz - -# define numerical virial stress tensor calculation - -compute myvirial all pressure NULL virial -fix numvirial all numdiff/virial ${nthermo} ${vdelta} -fix numvirial all numdiff/virial 10 ${vdelta} -fix numvirial all numdiff/virial 10 1.0e-6 -variable errxx equal f_numvirial[1]-c_myvirial[1] -variable erryy equal f_numvirial[2]-c_myvirial[2] -variable errzz equal f_numvirial[3]-c_myvirial[3] -variable erryz equal f_numvirial[4]-c_myvirial[6] -variable errxz equal f_numvirial[5]-c_myvirial[5] -variable errxy equal f_numvirial[6]-c_myvirial[4] -variable verrsq equal "v_errxx^2 + v_erryy^2 + v_errzz^2 + v_erryz^2 + v_errxz^2 + v_errxy^2" -variable vsq equal "c_myvirial[1]^2 + c_myvirial[3]^2 + c_myvirial[3]^2 + c_myvirial[4]^2 + c_myvirial[5]^2 + c_myvirial[6]^2" -variable vrelerr equal sqrt(v_verrsq/v_vsq) - -thermo_style custom step temp pe etotal press v_frelerr v_vrelerr -thermo ${nthermo} -thermo 10 -run ${nsteps} -run 500 - generated 0 of 0 mixed pair_coeff terms from geometric mixing rule -Neighbor list info ... - update every 1 steps, delay 0 steps, check no - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 5.9407173 - ghost atom cutoff = 5.9407173 - binsize = 2.9703587, bins = 6 6 6 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cubic, perpetual - attributes: half, newton on - pair build: half/bin/atomonly/newton - stencil: half/bin/3d - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.067 | 6.067 | 6.067 Mbytes -Step Temp PotEng TotEng Press v_frelerr v_vrelerr - 0 10 -7.0259569 -6.8876486 28.564278 10664.391 9.1481187e-08 - 10 9.9388179 -7.0251107 -6.8876486 30.21736 1.4771865e-08 1.3452512e-07 - 20 9.7572185 -7.022599 -6.8876485 35.123527 1.437525e-08 8.0966999e-07 - 30 9.4606673 -7.0184974 -6.8876484 43.132052 1.4375468e-08 1.990012e-08 - 40 9.0579092 -7.0129268 -6.8876483 54.000927 1.4350331e-08 1.7239028e-08 - 50 8.5607685 -7.0060508 -6.8876482 67.403151 1.4353284e-08 7.813181e-09 - 60 7.9838726 -6.9980717 -6.8876481 82.935358 1.4398078e-08 2.022316e-08 - 70 7.3442875 -6.9892255 -6.8876479 100.12892 1.434409e-08 7.5938179e-09 - 80 6.6610579 -6.9797757 -6.8876477 118.46358 1.4324787e-08 7.1972571e-09 - 90 5.9546462 -6.9700053 -6.8876476 137.38365 1.4322718e-08 4.3978378e-09 - 100 5.2462727 -6.9602077 -6.8876474 156.31651 1.4273172e-08 4.6728038e-09 - 110 4.5571706 -6.9506767 -6.8876472 174.69294 1.4266163e-08 3.522225e-09 - 120 3.9077807 -6.9416949 -6.887647 191.96859 1.42241e-08 3.5357511e-09 - 130 3.3169241 -6.9335227 -6.8876469 207.64566 1.4203813e-08 2.5182488e-09 - 140 2.8010028 -6.926387 -6.8876468 221.29333 1.4164215e-08 2.3112509e-09 - 150 2.3732854 -6.9204712 -6.8876467 232.5658 1.4134122e-08 1.9368963e-09 - 160 2.0433329 -6.9159076 -6.8876466 241.21647 1.4095473e-08 3.6806452e-09 - 170 1.8166184 -6.912772 -6.8876466 247.10715 1.4049531e-08 2.5319322e-09 - 180 1.6943727 -6.9110813 -6.8876467 250.21143 1.3997912e-08 1.952404e-09 - 190 1.6736731 -6.910795 -6.8876467 250.61203 1.3915487e-08 1.4271767e-09 - 200 1.7477659 -6.9118199 -6.8876468 248.49223 1.3850618e-08 2.4515718e-09 - 210 1.9065921 -6.9140167 -6.8876469 244.12226 1.3747916e-08 1.7957531e-09 - 220 2.1374676 -6.91721 -6.887647 237.84173 1.3674779e-08 2.6613511e-09 - 230 2.4258607 -6.9211989 -6.8876472 230.0395 1.3565712e-08 3.0777067e-09 - 240 2.7562034 -6.9257679 -6.8876473 221.13265 1.3440442e-08 1.7111501e-09 - 250 3.1126827 -6.9306984 -6.8876474 211.54566 1.3270914e-08 1.6690112e-09 - 260 3.4799641 -6.9357784 -6.8876476 201.69126 1.3105092e-08 2.1637558e-09 - 270 3.8438148 -6.9408108 -6.8876477 191.95361 1.2962846e-08 4.4613506e-09 - 280 4.191607 -6.9456212 -6.8876478 182.6745 1.2846383e-08 3.3730203e-09 - 290 4.5126922 -6.9500621 -6.8876478 174.14285 1.2710692e-08 2.2809889e-09 - 300 4.7986487 -6.9540172 -6.8876479 166.58747 1.2657778e-08 6.9880891e-09 - 310 5.0434083 -6.9574025 -6.8876479 160.17316 1.266381e-08 4.2486217e-09 - 320 5.243275 -6.9601668 -6.8876479 154.99974 1.279856e-08 5.1505673e-09 - 330 5.3968455 -6.9622908 -6.8876479 151.1038 1.2981831e-08 3.3339333e-09 - 340 5.5048468 -6.9637845 -6.8876479 148.46296 1.3159021e-08 1.7881393e-09 - 350 5.569902 -6.9646843 -6.8876479 147.00205 1.3439465e-08 5.6876219e-09 - 360 5.5962378 -6.9650485 -6.8876478 146.60113 1.3645943e-08 7.233847e-09 - 370 5.5893468 -6.9649531 -6.8876478 147.10471 1.3829581e-08 4.5514318e-09 - 380 5.5556199 -6.9644866 -6.8876477 148.33195 1.4005893e-08 4.2971846e-09 - 390 5.5019639 -6.9637444 -6.8876476 150.08725 1.4157454e-08 3.3564262e-09 - 400 5.4354239 -6.962824 -6.8876476 152.17073 1.4226422e-08 4.2393923e-09 - 410 5.3628267 -6.9618199 -6.8876475 154.38825 1.4302679e-08 3.8937698e-09 - 420 5.2904639 -6.960819 -6.8876475 156.56034 1.4381099e-08 4.315875e-09 - 430 5.2238282 -6.9598973 -6.8876474 158.52969 1.4426567e-08 4.2658185e-09 - 440 5.1674149 -6.9591171 -6.8876474 160.16704 1.4453381e-08 5.7055268e-09 - 450 5.1245913 -6.9585248 -6.8876474 161.37513 1.4449488e-08 4.4308801e-09 - 460 5.0975361 -6.9581506 -6.8876474 162.09077 1.4445596e-08 5.8269923e-09 - 470 5.0872416 -6.9580082 -6.8876474 162.28517 1.4444348e-08 4.8263194e-09 - 480 5.0935712 -6.9580957 -6.8876474 161.96268 1.4411666e-08 6.222228e-09 - 490 5.115362 -6.9583971 -6.8876474 161.15816 1.4369716e-08 3.3926077e-09 - 500 5.1505605 -6.958884 -6.8876474 159.9333 1.4288515e-08 3.8845251e-09 -Loop time of 0.252598 on 4 procs for 500 steps with 108 atoms - -Performance: 171.023 ns/day, 0.140 hours/ns, 1979.430 timesteps/s -99.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.0021545 | 0.0022845 | 0.0023794 | 0.2 | 0.90 -Neigh | 0.0063887 | 0.0067604 | 0.0069752 | 0.3 | 2.68 -Comm | 0.01048 | 0.010916 | 0.011408 | 0.3 | 4.32 -Output | 0.0026603 | 0.0027399 | 0.0029738 | 0.3 | 1.08 -Modify | 0.2295 | 0.22952 | 0.22954 | 0.0 | 90.86 -Other | | 0.0003814 | | | 0.15 - -Nlocal: 27 ave 29 max 25 min -Histogram: 1 0 1 0 0 0 0 1 0 1 -Nghost: 325 ave 327 max 323 min -Histogram: 1 0 1 0 0 0 0 1 0 1 -Neighs: 243 ave 273 max 228 min -Histogram: 1 1 1 0 0 0 0 0 0 1 - -Total # of neighbors = 972 -Ave neighs/atom = 9 -Neighbor list builds = 500 -Dangerous builds not checked -Total wall time: 0:00:00 diff --git a/examples/ttm/Si.sw b/examples/ttm/Si.sw new file mode 120000 index 0000000000..812023f52d --- /dev/null +++ b/examples/ttm/Si.sw @@ -0,0 +1 @@ +../../potentials/Si.sw \ No newline at end of file diff --git a/examples/ttm/Si.ttm_mod b/examples/ttm/Si.ttm_mod new file mode 100644 index 0000000000..6e047857ff --- /dev/null +++ b/examples/ttm/Si.ttm_mod @@ -0,0 +1,44 @@ +a_0, energy/(temperature*electron) units +-0.00012899 +a_1, energy/(temperature^2*electron) units +-0.0000000293276 +a_2, energy/(temperature^3*electron) units +-0.0000229991 +a_3, energy/(temperature^4*electron) units +-0.000000927036 +a_4, energy/(temperature^5*electron) units +-0.0000011747 +C_0, energy/(temperature*electron) units +0.000129 +A, 1/temperature units +0.180501 +rho_e, electrons/volume units +0.05 +D_e, length^2/time units +20000 +gamma_p, mass/time units +39.235 +gamma_s, mass/time units +24.443 +v_0, length/time units +79.76 +I_0, energy/(time*length^2) units +0 +lsurface, electron grid units (positive integer) +0 +rsurface, electron grid units (positive integer) +1 +l_skin, length units +1 +tau, time units +0 +B, dimensionless +0 +lambda, length units +0 +n_ion, ions/volume units +0.05 +surface_movement: 0 to disable tracking of surface motion, 1 to enable +0 +T_e_min, temperature units +0 diff --git a/examples/ttm/in.ttm.mod b/examples/ttm/in.ttm.mod new file mode 100644 index 0000000000..93552ad310 --- /dev/null +++ b/examples/ttm/in.ttm.mod @@ -0,0 +1,29 @@ +units metal +atom_style atomic +boundary p p p + +lattice diamond 5.4309 +region box block 0 10 0 10 0 10 +create_box 1 box +mass 1 28.0855 +create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 1 basis 5 1 basis 6 1 basis 7 1 basis 8 1 + +pair_style sw +pair_coeff * * Si.sw Si + +neighbor 2.0 bin +neigh_modify every 5 delay 0 check yes + +fix 1 all nve +fix twotemp all ttm/mod 1354684 Si.ttm_mod 10 10 10 set 1000.0 # outfile 100 T_out.txt + +compute pe all pe/atom +compute ke all ke/atom + +timestep 0.0001 +thermo 100 + +thermo_style custom step temp etotal f_twotemp[1] f_twotemp[2] + thermo_modify format float "%20.16g" + +run 1000 diff --git a/examples/ttm/log.20Apr22.ttm.mod.g++.1 b/examples/ttm/log.20Apr22.ttm.mod.g++.1 new file mode 100644 index 0000000000..6c0470617b --- /dev/null +++ b/examples/ttm/log.20Apr22.ttm.mod.g++.1 @@ -0,0 +1,122 @@ +LAMMPS (24 Mar 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +units metal +atom_style atomic +boundary p p p + +lattice diamond 5.4309 +Lattice spacing in x,y,z = 5.4309 5.4309 5.4309 +region box block 0 10 0 10 0 10 +create_box 1 box +Created orthogonal box = (0 0 0) to (54.309 54.309 54.309) + 1 by 1 by 1 MPI processor grid +mass 1 28.0855 +create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 1 basis 5 1 basis 6 1 basis 7 1 basis 8 1 +Created 8000 atoms + using lattice units in orthogonal box = (0 0 0) to (54.309 54.309 54.309) + create_atoms CPU = 0.001 seconds + +pair_style sw +pair_coeff * * Si.sw Si +Reading sw potential file Si.sw with DATE: 2007-06-11 + +neighbor 2.0 bin +neigh_modify every 5 delay 0 check yes + +fix 1 all nve +fix twotemp all ttm/mod 1354684 Si.ttm_mod 10 10 10 set 1000.0 # outfile 100 T_out.txt + +compute pe all pe/atom +compute ke all ke/atom + +timestep 0.0001 +thermo 100 + +thermo_style custom step temp etotal f_twotemp[1] f_twotemp[2] + thermo_modify format float "%20.16g" + +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- fix ttm/mod command: + +@article{Pisarev2014, +author = {Pisarev, V. V. and Starikov, S. V.}, +title = {{Atomistic simulation of ion track formation in UO2.}}, +journal = {J.~Phys.:~Condens.~Matter}, +volume = {26}, +number = {47}, +pages = {475401}, +year = {2014} +} + +@article{Norman2013, +author = {Norman, G. E. and Starikov, S. V. and Stegailov, V. V. and Saitov, I. M. and Zhilyaev, P. A.}, +title = {{Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}}, +journal = {Contrib.~Plasm.~Phys.}, +number = {2}, +volume = {53}, +pages = {129--139}, +year = {2013} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 5 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.77118 + ghost atom cutoff = 5.77118 + binsize = 2.88559, bins = 19 19 19 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sw, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 4.433 | 4.433 | 4.433 Mbytes + Step Temp TotEng f_twotemp[1] f_twotemp[2] + 0 0 -34692.79996100604 -52.79390940511979 0 + 100 2.004897156140836 -34690.27961013186 -55.34997305431884 0.01301140393178354 + 200 2.837118035232607 -34687.74741132015 -57.93445748841878 0.02696025968760173 + 300 4.263087164947482 -34684.98084093686 -60.75945453846786 0.02175636603841567 + 400 5.568003854939066 -34682.25271040963 -63.56896518300501 0.0300061848347275 + 500 6.225602451570786 -34679.49948952029 -66.40897551884576 0.02768827702656702 + 600 7.608847536264781 -34676.69728436362 -69.32060611557266 0.05579466731854093 + 700 9.049471241531297 -34674.00093206036 -72.10055094219446 0.004335980559879027 + 800 9.826796099683211 -34671.27720242751 -74.9501061086213 0.02371649678091513 + 900 11.8609224958918 -34668.35091308811 -77.98544170794551 0.004658649791374929 + 1000 13.88037467640968 -34665.35025858006 -81.16445160194114 0.07684078334464739 +Loop time of 4.85247 on 1 procs for 1000 steps with 8000 atoms + +Performance: 1.781 ns/day, 13.479 hours/ns, 206.081 timesteps/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 4.1286 | 4.1286 | 4.1286 | 0.0 | 85.08 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.030972 | 0.030972 | 0.030972 | 0.0 | 0.64 +Output | 0.0026351 | 0.0026351 | 0.0026351 | 0.0 | 0.05 +Modify | 0.67848 | 0.67848 | 0.67848 | 0.0 | 13.98 +Other | | 0.01182 | | | 0.24 + +Nlocal: 8000 ave 8000 max 8000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 6725 ave 6725 max 6725 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 272000 ave 272000 max 272000 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 272000 +Ave neighs/atom = 34 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:04 diff --git a/examples/ttm/log.20Apr22.ttm.mod.g++.4 b/examples/ttm/log.20Apr22.ttm.mod.g++.4 new file mode 100644 index 0000000000..fdf9b0cfb5 --- /dev/null +++ b/examples/ttm/log.20Apr22.ttm.mod.g++.4 @@ -0,0 +1,122 @@ +LAMMPS (24 Mar 2022) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98) + using 1 OpenMP thread(s) per MPI task +units metal +atom_style atomic +boundary p p p + +lattice diamond 5.4309 +Lattice spacing in x,y,z = 5.4309 5.4309 5.4309 +region box block 0 10 0 10 0 10 +create_box 1 box +Created orthogonal box = (0 0 0) to (54.309 54.309 54.309) + 1 by 2 by 2 MPI processor grid +mass 1 28.0855 +create_atoms 1 box basis 1 1 basis 2 1 basis 3 1 basis 4 1 basis 5 1 basis 6 1 basis 7 1 basis 8 1 +Created 8000 atoms + using lattice units in orthogonal box = (0 0 0) to (54.309 54.309 54.309) + create_atoms CPU = 0.000 seconds + +pair_style sw +pair_coeff * * Si.sw Si +Reading sw potential file Si.sw with DATE: 2007-06-11 + +neighbor 2.0 bin +neigh_modify every 5 delay 0 check yes + +fix 1 all nve +fix twotemp all ttm/mod 1354684 Si.ttm_mod 10 10 10 set 1000.0 # outfile 100 T_out.txt + +compute pe all pe/atom +compute ke all ke/atom + +timestep 0.0001 +thermo 100 + +thermo_style custom step temp etotal f_twotemp[1] f_twotemp[2] + thermo_modify format float "%20.16g" + +run 1000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- fix ttm/mod command: + +@article{Pisarev2014, +author = {Pisarev, V. V. and Starikov, S. V.}, +title = {{Atomistic simulation of ion track formation in UO2.}}, +journal = {J.~Phys.:~Condens.~Matter}, +volume = {26}, +number = {47}, +pages = {475401}, +year = {2014} +} + +@article{Norman2013, +author = {Norman, G. E. and Starikov, S. V. and Stegailov, V. V. and Saitov, I. M. and Zhilyaev, P. A.}, +title = {{Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}}, +journal = {Contrib.~Plasm.~Phys.}, +number = {2}, +volume = {53}, +pages = {129--139}, +year = {2013} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Neighbor list info ... + update every 5 steps, delay 0 steps, check yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 5.77118 + ghost atom cutoff = 5.77118 + binsize = 2.88559, bins = 19 19 19 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair sw, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 3.436 | 3.436 | 3.436 Mbytes + Step Temp TotEng f_twotemp[1] f_twotemp[2] + 0 0 -34692.79996100361 -52.79390940511979 0 + 100 1.852689977101411 -34690.49204900486 -55.14271612882062 0.027261886765771 + 200 2.735750477179192 -34688.11139028054 -57.57110998717796 0.03387986355513582 + 300 3.931848271449558 -34685.54667417785 -60.18684521127226 0.02261256315262404 + 400 5.462009198576365 -34682.74455105668 -63.05420336037231 0.002402241637719583 + 500 6.267811692893873 -34679.96493887379 -65.93304222280049 0.02448378880218699 + 600 7.21148216150661 -34677.41455784726 -68.58391420045932 0.04114045759945373 + 700 8.84660534187052 -34674.40610468235 -71.68798344296847 0.0237298402743454 + 800 10.1748456457686 -34671.08749605772 -75.11943618276236 0.007538225788030298 + 900 11.27479036162859 -34668.4118066423 -77.92921692176769 0.02537529314475071 + 1000 13.26881394868076 -34665.56617589539 -80.91544540266329 0.03112665440209921 +Loop time of 1.60214 on 4 procs for 1000 steps with 8000 atoms + +Performance: 5.393 ns/day, 4.450 hours/ns, 624.165 timesteps/s +99.7% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.0424 | 1.0558 | 1.0696 | 1.0 | 65.90 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0.05072 | 0.063773 | 0.079458 | 4.9 | 3.98 +Output | 0.0024362 | 0.0024703 | 0.0025297 | 0.1 | 0.15 +Modify | 0.47018 | 0.47332 | 0.48004 | 0.6 | 29.54 +Other | | 0.006786 | | | 0.42 + +Nlocal: 2000 ave 2000 max 2000 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 3165 ave 3165 max 3165 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 0 ave 0 max 0 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 68000 ave 68000 max 68000 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 272000 +Ave neighs/atom = 34 +Neighbor list builds = 0 +Dangerous builds = 0 +Total wall time: 0:00:01 diff --git a/lib/atc/ATC_Coupling.cpp b/lib/atc/ATC_Coupling.cpp index 381e9fee90..188c1b04f2 100644 --- a/lib/atc/ATC_Coupling.cpp +++ b/lib/atc/ATC_Coupling.cpp @@ -775,7 +775,7 @@ namespace ATC { //-------------------------------------------------- /** allow FE_Engine to construct data manager after mesh is constructed */ - void ATC_Coupling::construct_prescribed_data_manager (void) { + void ATC_Coupling::construct_prescribed_data_manager () { prescribedDataMgr_ = new PrescribedDataManager(feEngine_,fieldSizes_); } @@ -1704,7 +1704,7 @@ namespace ATC { //-------------------------------------------------------------- /** method to trigger construction of mesh data after mesh construction */ //-------------------------------------------------------------- - void ATC_Coupling::initialize_mesh_data(void) + void ATC_Coupling::initialize_mesh_data() { int nelts = feEngine_->fe_mesh()->num_elements(); elementToMaterialMap_.reset(nelts); @@ -1715,7 +1715,7 @@ namespace ATC { } //-------------------------------------------------------- - void ATC_Coupling::reset_flux_mask(void) + void ATC_Coupling::reset_flux_mask() { int i; // this is exact only for uniform meshes and certain types of atomic weights diff --git a/lib/atc/ATC_CouplingMomentum.cpp b/lib/atc/ATC_CouplingMomentum.cpp index 9b16efc159..86de830b55 100644 --- a/lib/atc/ATC_CouplingMomentum.cpp +++ b/lib/atc/ATC_CouplingMomentum.cpp @@ -357,7 +357,7 @@ namespace ATC { // compute_scalar : added energy // this is used in the line search //-------------------------------------------------------------------- - double ATC_CouplingMomentum::compute_scalar(void) + double ATC_CouplingMomentum::compute_scalar() { double energy = extrinsicModelManager_.compute_scalar(); return energy; diff --git a/lib/atc/ATC_CouplingMomentumEnergy.cpp b/lib/atc/ATC_CouplingMomentumEnergy.cpp index 08206ba6db..c3b36fb30a 100644 --- a/lib/atc/ATC_CouplingMomentumEnergy.cpp +++ b/lib/atc/ATC_CouplingMomentumEnergy.cpp @@ -327,7 +327,7 @@ namespace ATC { //-------------------------------------------------------------------- // compute_scalar : added energy //-------------------------------------------------------------------- - double ATC_CouplingMomentumEnergy::compute_scalar(void) + double ATC_CouplingMomentumEnergy::compute_scalar() { double energy = 0.0; energy += extrinsicModelManager_.compute_scalar(); @@ -337,7 +337,7 @@ namespace ATC { //-------------------------------------------------------------------- // total kinetic energy //-------------------------------------------------------------------- - double ATC_CouplingMomentumEnergy::kinetic_energy(void) + double ATC_CouplingMomentumEnergy::kinetic_energy() { const MATRIX & M = massMats_[VELOCITY].quantity(); @@ -355,7 +355,7 @@ namespace ATC { //-------------------------------------------------------------------- // total potential energy //-------------------------------------------------------------------- - double ATC_CouplingMomentumEnergy::potential_energy(void) + double ATC_CouplingMomentumEnergy::potential_energy() { Array mask(1); mask(0) = VELOCITY; diff --git a/lib/atc/ATC_Error.h b/lib/atc/ATC_Error.h index 62c22158cf..f4f3f84c24 100644 --- a/lib/atc/ATC_Error.h +++ b/lib/atc/ATC_Error.h @@ -3,6 +3,7 @@ #ifndef ATC_ERROR #define ATC_ERROR +#include #include // the following two convert __LINE__ to a string @@ -23,7 +24,7 @@ namespace ATC { * @brief Base class for throwing run-time errors with descriptions */ -class ATC_Error { +class ATC_Error : public std::exception { public: // constructor @@ -31,17 +32,21 @@ class ATC_Error { { errorDescription_ = "ERROR: " + errorDescription; ERROR_FOR_BACKTRACE - }; + } ATC_Error(std::string location, std::string errorDescription) { errorDescription_ = "ERROR: " + location + ": "+ errorDescription; ERROR_FOR_BACKTRACE - }; + } std::string error_description() { return errorDescription_; - }; + } + + const char *what() const noexcept override { + return errorDescription_.c_str(); + } private: // string describing the type of error diff --git a/lib/atc/ATC_Method.cpp b/lib/atc/ATC_Method.cpp index 6fc8d51aa7..1236c93b2d 100644 --- a/lib/atc/ATC_Method.cpp +++ b/lib/atc/ATC_Method.cpp @@ -1674,7 +1674,7 @@ pecified } //------------------------------------------------------------------- - void ATC_Method::set_reference_potential_energy(void) + void ATC_Method::set_reference_potential_energy() { if (setRefPE_) { if (setRefPEvalue_) { @@ -2170,7 +2170,7 @@ pecified // } } //-------------------------------------------------------- - void ATC_Method::compute_nodeset_output(void) + void ATC_Method::compute_nodeset_output() { map< pair , NodesetOperationType >::const_iterator iter; for (iter = nsetData_.begin(); iter != nsetData_.end();iter++){ @@ -2194,7 +2194,7 @@ pecified } } //-------------------------------------------------------- - void ATC_Method::compute_faceset_output(void) + void ATC_Method::compute_faceset_output() { map < pair, FacesetIntegralType >::const_iterator iter; DENS_MAT values; @@ -2223,7 +2223,7 @@ pecified } } //-------------------------------------------------------- - void ATC_Method::compute_elementset_output(void) + void ATC_Method::compute_elementset_output() { map< pair , ElementsetOperationType >::const_iterator iter; for (iter = esetData_.begin(); iter != esetData_.end();iter++){ @@ -2379,7 +2379,7 @@ pecified } //-------------------------------------------------------- - void ATC_Method::remap_ghost_ref_positions(void) + void ATC_Method::remap_ghost_ref_positions() { int nlocal = lammpsInterface_->nlocal(); diff --git a/lib/atc/ATC_Transfer.cpp b/lib/atc/ATC_Transfer.cpp index 5ea7f1233a..edaa060ab3 100644 --- a/lib/atc/ATC_Transfer.cpp +++ b/lib/atc/ATC_Transfer.cpp @@ -916,12 +916,12 @@ namespace ATC { } //------------------------------------------------------------------- - void ATC_Transfer::compute_bond_matrix(void) + void ATC_Transfer::compute_bond_matrix() { bondMatrix_->reset(); } //------------------------------------------------------------------- - void ATC_Transfer::compute_fields(void) + void ATC_Transfer::compute_fields() { // keep per-atom computes fresh. JAZ and REJ not sure why; diff --git a/lib/atc/ATC_TransferKernel.cpp b/lib/atc/ATC_TransferKernel.cpp index e09139f92c..61dd8fbade 100644 --- a/lib/atc/ATC_TransferKernel.cpp +++ b/lib/atc/ATC_TransferKernel.cpp @@ -83,7 +83,7 @@ using ATC_Utility::to_string; } //------------------------------------------------------------------- - void ATC_TransferKernel::compute_kernel_matrix_molecule(void) // KKM add + void ATC_TransferKernel::compute_kernel_matrix_molecule() // KKM add { int nLocalMol = smallMoleculeSet_->local_molecule_count(); if (nLocal_>0) { diff --git a/lib/atc/AtomicRegulator.cpp b/lib/atc/AtomicRegulator.cpp index 1d2b5d1d85..8f67bdbe34 100644 --- a/lib/atc/AtomicRegulator.cpp +++ b/lib/atc/AtomicRegulator.cpp @@ -688,7 +688,7 @@ namespace ATC { // compute_sparsity // - creates sparsity template //-------------------------------------------------------- - void RegulatorShapeFunction::compute_sparsity(void) + void RegulatorShapeFunction::compute_sparsity() { // first get local pattern from N N^T diff --git a/lib/atc/ChargeRegulator.cpp b/lib/atc/ChargeRegulator.cpp index f0f0423e9a..101ec3f7e7 100644 --- a/lib/atc/ChargeRegulator.cpp +++ b/lib/atc/ChargeRegulator.cpp @@ -198,7 +198,7 @@ namespace ATC { // nomenclature might be a bit backwark: control --> nodes that exert the control, & influence --> atoms that feel the influence - void ChargeRegulatorMethod::initialize(void) + void ChargeRegulatorMethod::initialize() { interscaleManager_ = &(atc_->interscale_manager()); @@ -220,7 +220,7 @@ namespace ATC { int ChargeRegulatorMethod::nlocal() { return atc_->nlocal(); } - void ChargeRegulatorMethod::set_greens_functions(void) + void ChargeRegulatorMethod::set_greens_functions() { // set up Green's function per node for (int i = 0; i < nNodes_; i++) { @@ -272,7 +272,7 @@ namespace ATC { //-------------------------------------------------------- // Initialize //-------------------------------------------------------- - void ChargeRegulatorMethodFeedback::initialize(void) + void ChargeRegulatorMethodFeedback::initialize() { ChargeRegulatorMethod::initialize(); if (surfaceType_ != ChargeRegulator::CONDUCTOR) @@ -284,7 +284,7 @@ namespace ATC { //-------------------------------------------------------- // Initialize //-------------------------------------------------------- - void ChargeRegulatorMethodFeedback::construct_transfers(void) + void ChargeRegulatorMethodFeedback::construct_transfers() { ChargeRegulatorMethod::construct_transfers(); @@ -301,7 +301,7 @@ namespace ATC { //-------------------------------------------------------- // find measurement atoms and nodes //-------------------------------------------------------- - void ChargeRegulatorMethodFeedback::set_influence(void) + void ChargeRegulatorMethodFeedback::set_influence() { // get nodes that overlap influence atoms & compact list of influence atoms @@ -321,7 +321,7 @@ namespace ATC { //-------------------------------------------------------- // constuct a Green's submatrix //-------------------------------------------------------- - void ChargeRegulatorMethodFeedback::set_influence_matrix(void) + void ChargeRegulatorMethodFeedback::set_influence_matrix() { // construct control-influence matrix bar{G}^-1: ds{p} = G{p,m}^-1 dphi{m} @@ -434,7 +434,7 @@ namespace ATC { //-------------------------------------------------------- // Initialize //-------------------------------------------------------- - void ChargeRegulatorMethodImageCharge::initialize(void) + void ChargeRegulatorMethodImageCharge::initialize() { ChargeRegulatorMethod::initialize(); if (surfaceType_ != ChargeRegulator::DIELECTRIC) throw ATC_Error("currently image charge can only mimic a dielectric"); diff --git a/lib/atc/ConcentrationRegulator.cpp b/lib/atc/ConcentrationRegulator.cpp index b6aa6c5265..77796176bc 100644 --- a/lib/atc/ConcentrationRegulator.cpp +++ b/lib/atc/ConcentrationRegulator.cpp @@ -224,7 +224,7 @@ const double kMinScale_ = 10000.; //-------------------------------------------------------- // Initialize //-------------------------------------------------------- - void ConcentrationRegulatorMethodTransition::initialize(void) + void ConcentrationRegulatorMethodTransition::initialize() { #ifdef ATC_VERBOSE lammpsInterface_->print_msg_once( @@ -289,7 +289,7 @@ const double kMinScale_ = 10000.; //-------------------------------------------------------- // pre exchange //-------------------------------------------------------- - void ConcentrationRegulatorMethodTransition::pre_exchange(void) + void ConcentrationRegulatorMethodTransition::pre_exchange() { // return if should not be called on this timestep if ( ! lammpsInterface_->now(frequency_)) return; @@ -312,7 +312,7 @@ const double kMinScale_ = 10000.; //-------------------------------------------------------- // pre force //-------------------------------------------------------- - void ConcentrationRegulatorMethodTransition::pre_force(void) + void ConcentrationRegulatorMethodTransition::pre_force() { transition(); } @@ -353,7 +353,7 @@ const double kMinScale_ = 10000.; //-------------------------------------------------------- // excess //-------------------------------------------------------- - int ConcentrationRegulatorMethodTransition::excess(void) const + int ConcentrationRegulatorMethodTransition::excess() const { int nexcess = count()-targetCount_; nexcess = max(min(nexcess,maxExchanges_),-maxExchanges_); @@ -362,7 +362,7 @@ const double kMinScale_ = 10000.; //-------------------------------------------------------- // count //-------------------------------------------------------- - int ConcentrationRegulatorMethodTransition::count(void) const + int ConcentrationRegulatorMethodTransition::count() const { // integrate concentration over region const DENS_MAT & c = (atc_->field(SPECIES_CONCENTRATION)).quantity(); diff --git a/lib/atc/ExtrinsicModel.cpp b/lib/atc/ExtrinsicModel.cpp index 8dc8b71539..802f3edb90 100644 --- a/lib/atc/ExtrinsicModel.cpp +++ b/lib/atc/ExtrinsicModel.cpp @@ -181,7 +181,7 @@ namespace ATC { //-------------------------------------------------------- // compute_scalar //-------------------------------------------------------- - double ExtrinsicModelManager::compute_scalar(void) + double ExtrinsicModelManager::compute_scalar() { double value = 0.; vector::iterator imodel; @@ -360,7 +360,7 @@ namespace ATC { //-------------------------------------------------------- // initialize //-------------------------------------------------------- - void ExtrinsicModel::initialize(void) + void ExtrinsicModel::initialize() { physicsModel_->initialize(); } diff --git a/lib/atc/ExtrinsicModelElectrostatic.cpp b/lib/atc/ExtrinsicModelElectrostatic.cpp index 73a94b8192..c061b4184c 100644 --- a/lib/atc/ExtrinsicModelElectrostatic.cpp +++ b/lib/atc/ExtrinsicModelElectrostatic.cpp @@ -483,7 +483,7 @@ namespace ATC { //-------------------------------------------------------- // compute_scalar : added energy = - f.x //-------------------------------------------------------- - double ExtrinsicModelElectrostatic::compute_scalar(void) + double ExtrinsicModelElectrostatic::compute_scalar() { //((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->force_reset(); const DENS_MAT & atomPosition = ((atc_->interscale_manager()).fundamental_atom_quantity(LammpsInterface::ATOM_POSITION))->quantity(); diff --git a/lib/atc/FE_Engine.cpp b/lib/atc/FE_Engine.cpp index fc07b5e638..382b1257e1 100644 --- a/lib/atc/FE_Engine.cpp +++ b/lib/atc/FE_Engine.cpp @@ -430,7 +430,7 @@ namespace ATC{ //----------------------------------------------------------------- // write geometry //----------------------------------------------------------------- - void FE_Engine::write_geometry(void) + void FE_Engine::write_geometry() { outputManager_.write_geometry(feMesh_->coordinates(), feMesh_->connectivity()); @@ -2373,7 +2373,7 @@ namespace ATC{ feMesh_->face_shape_function(face, _fN_, _fdN_, _nN_, _fweights_); feMesh_->element_coordinates(elem, xCoords); - MultAB(xCoords,_fN_,xAtIPs,0,1); //xAtIPs = xCoords*(N.transpose()); + MultAB(xCoords,_fN_,xAtIPs,false,true); //xAtIPs = xCoords*(N.transpose()); // interpolate prescribed flux at ips of this element diff --git a/lib/atc/FE_Mesh.cpp b/lib/atc/FE_Mesh.cpp index a516dbfee8..6845c975d9 100644 --- a/lib/atc/FE_Mesh.cpp +++ b/lib/atc/FE_Mesh.cpp @@ -404,7 +404,7 @@ namespace ATC { // ------------------------------------------------------------- // initialize // ------------------------------------------------------------- - void FE_Mesh::initialize(void) + void FE_Mesh::initialize() { bool aligned = is_aligned(); @@ -469,7 +469,7 @@ namespace ATC { // ------------------------------------------------------------- // test whether almost structured // ------------------------------------------------------------- - bool FE_Mesh::is_aligned(void) const + bool FE_Mesh::is_aligned() const { vector foundBestMatch(nSD_,false); vector tangents(nSD_); @@ -518,7 +518,7 @@ namespace ATC { // ------------------------------------------------------------- // element_type // ------------------------------------------------------------- - string FE_Mesh::element_type(void) const { + string FE_Mesh::element_type() const { int npe = feElement_->num_elt_nodes(); if (npe == 4) { return "TET4"; } else if (npe == 8) { return "HEX8"; } @@ -1915,7 +1915,7 @@ namespace ATC { return true; } - void FE_3DMesh::set_unique_connectivity(void) + void FE_3DMesh::set_unique_connectivity() { int numEltNodes = feElement_->num_elt_nodes(); connectivityUnique_.reset(numEltNodes, nElts_); diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 02ace08416..9e2df3e46c 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -387,7 +387,7 @@ double LammpsInterface::atom_quantity_conversion(FundamentalAtomQuantity quantit int LammpsInterface::dimension() const { return lammps_->domain->dimension; } -int LammpsInterface::nregion() const { return lammps_->domain->nregion; } +int LammpsInterface::nregion() const { return lammps_->domain->get_region_list().size(); } void LammpsInterface::box_bounds(double & boxxlo, double & boxxhi, double & boxylo, double & boxyhi, @@ -483,7 +483,7 @@ void LammpsInterface::periodicity_correction(double * x) const } } -void LammpsInterface::set_reference_box(void) const +void LammpsInterface::set_reference_box() const { double * hi = lammps_->domain->boxhi; double * lo = lammps_->domain->boxlo; @@ -527,14 +527,15 @@ void LammpsInterface::box_periodicity(int & xperiodic, zperiodic = lammps_->domain->zperiodic; } -int LammpsInterface::region_id(const char * regionName) const { - int nregion = this->nregion(); - for (int iregion = 0; iregion < nregion; iregion++) { - if (strcmp(regionName, region_name(iregion)) == 0) { +int LammpsInterface::region_id(const char *regionName) const { + auto regions = lammps_->domain->get_region_list(); + int iregion = 0; + for (auto reg : regions) { + if (strcmp(regionName, reg->id) == 0) { return iregion; } + ++iregion; } - throw ATC_Error("Region has not been defined"); return -1; } @@ -570,7 +571,7 @@ void LammpsInterface::closest_image(const double * const xi, const double * cons // ----------------------------------------------------------------- // update interface methods // ----------------------------------------------------------------- -LammpsInterface::UnitsType LammpsInterface::units_style(void) const +LammpsInterface::UnitsType LammpsInterface::units_style() const { if (strcmp(lammps_->update->unit_style,"lj") == 0) return LJ; else if (strcmp(lammps_->update->unit_style,"real") == 0) return REAL; @@ -655,7 +656,7 @@ void LammpsInterface::basis_vectors(double **basis) const } //* gets the (max) lattice constant -double LammpsInterface::max_lattice_constant(void) const +double LammpsInterface::max_lattice_constant() const { double a1[3], a2[3], a3[3]; unit_cell(a1,a2,a3); @@ -666,7 +667,7 @@ double LammpsInterface::max_lattice_constant(void) const } //* computes a cutoff distance halfway between 1st and 2nd nearest neighbors -double LammpsInterface::near_neighbor_cutoff(void) const +double LammpsInterface::near_neighbor_cutoff() const { double cutoff; double alat = LammpsInterface::max_lattice_constant(); @@ -716,7 +717,7 @@ void LammpsInterface::unit_cell(double *a1, double *a2, double *a3) const } //* gets number of atoms in a unit cell -int LammpsInterface::num_atoms_per_cell(void) const +int LammpsInterface::num_atoms_per_cell() const { int naCell = 0; LatticeType type = lattice_style(); @@ -733,7 +734,7 @@ int LammpsInterface::num_atoms_per_cell(void) const } //* gets tributary volume for an atom -double LammpsInterface::volume_per_atom(void) const +double LammpsInterface::volume_per_atom() const { double naCell = num_atoms_per_cell(); double volPerAtom = @@ -1322,61 +1323,73 @@ int** LammpsInterface::bond_list() const { return lammps_->neighbor->bondlist; char * LammpsInterface::region_name(int iRegion) const { - return lammps_->domain->regions[iRegion]->id; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->id; } char * LammpsInterface::region_style(int iRegion) const { - return lammps_->domain->regions[iRegion]->style; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->style; } double LammpsInterface::region_xlo(int iRegion) const { - return lammps_->domain->regions[iRegion]->extent_xlo; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->extent_xlo; } double LammpsInterface::region_xhi(int iRegion) const { - return lammps_->domain->regions[iRegion]->extent_xhi; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->extent_xhi; } double LammpsInterface::region_ylo(int iRegion) const { - return lammps_->domain->regions[iRegion]->extent_ylo; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->extent_ylo; } double LammpsInterface::region_yhi(int iRegion) const { - return lammps_->domain->regions[iRegion]->extent_yhi; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->extent_yhi; } double LammpsInterface::region_zlo(int iRegion) const { - return lammps_->domain->regions[iRegion]->extent_zlo; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->extent_zlo; } double LammpsInterface::region_zhi(int iRegion) const { - return lammps_->domain->regions[iRegion]->extent_zhi; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->extent_zhi; } double LammpsInterface::region_xscale(int iRegion) const { - return lammps_->domain->regions[iRegion]->xscale; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->xscale; } double LammpsInterface::region_yscale(int iRegion) const { - return lammps_->domain->regions[iRegion]->yscale; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->yscale; } double LammpsInterface::region_zscale(int iRegion) const { - return lammps_->domain->regions[iRegion]->zscale; + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->zscale; } int LammpsInterface::region_match(int iRegion, double x, double y, double z) const { - return lammps_->domain->regions[iRegion]->match(x,y,z); + auto regions = lammps_->domain->get_region_list(); + return regions[iRegion]->match(x,y,z); } // ----------------------------------------------------------------- @@ -1468,7 +1481,7 @@ LAMMPS_NS::Compute * LammpsInterface::const_to_active(COMPUTE_POINTER computePoi // compute pe/atom interface methods // - the only compute "owned" by ATC // ----------------------------------------------------------------- -int LammpsInterface::create_compute_pe_peratom(void) const +int LammpsInterface::create_compute_pe_peratom() const { char **list = new char*[4]; string atomPeName = compute_pe_name(); @@ -1493,7 +1506,7 @@ int LammpsInterface::create_compute_pe_peratom(void) const return icompute; } -double * LammpsInterface::compute_pe_peratom(void) const +double * LammpsInterface::compute_pe_peratom() const { if (atomPE_) { atomPE_->compute_peratom(); diff --git a/lib/atc/LinearSolver.cpp b/lib/atc/LinearSolver.cpp index 06683981e7..48fd6c049e 100644 --- a/lib/atc/LinearSolver.cpp +++ b/lib/atc/LinearSolver.cpp @@ -84,7 +84,7 @@ LinearSolver::LinearSolver( // -------------------------------------------------------------------- // Setup // -------------------------------------------------------------------- -void LinearSolver::setup(void) +void LinearSolver::setup() { tol_ = kTol; nVariables_ = matrix_.nRows(); @@ -113,7 +113,7 @@ void LinearSolver::setup(void) // -------------------------------------------------------------------- // Initialize // -------------------------------------------------------------------- -void LinearSolver::allow_reinitialization(void) +void LinearSolver::allow_reinitialization() { if (constraintHandlerType_ == PENALIZE_CONSTRAINTS) { if (matrixModified_ ) throw ATC_Error("LinearSolver: can't allow reinitialization after matrix has been modified"); @@ -157,7 +157,7 @@ void LinearSolver::initialize(const BC_SET * bcs) // -------------------------------------------------------------------- // initialize_matrix // -------------------------------------------------------------------- -void LinearSolver::initialize_matrix(void) +void LinearSolver::initialize_matrix() { if ( initializedMatrix_ ) return; if (constraintHandlerType_ == PENALIZE_CONSTRAINTS) { @@ -172,7 +172,7 @@ void LinearSolver::initialize_matrix(void) // -------------------------------------------------------------------- // initialize_inverse // -------------------------------------------------------------------- -void LinearSolver::initialize_inverse(void) +void LinearSolver::initialize_inverse() { if ( initializedInverse_ ) return; if (solverType_ == ITERATIVE_SOLVE_SYMMETRIC @@ -196,7 +196,7 @@ void LinearSolver::initialize_inverse(void) // -------------------------------------------------------------------- // initialize_rhs // -------------------------------------------------------------------- -void LinearSolver::initialize_rhs(void) +void LinearSolver::initialize_rhs() { if (! rhs_ ) return; if (! bcs_ ) { @@ -215,7 +215,7 @@ void LinearSolver::initialize_rhs(void) // add matrix penalty // - change matrix for Dirichlet conditions: add penalty // -------------------------------------------------------------------- -void LinearSolver::add_matrix_penalty(void) +void LinearSolver::add_matrix_penalty() { penalty_ = kPenalty; // relative to matrix diagonal SPAR_MAT & A = matrixCopy_; @@ -233,7 +233,7 @@ void LinearSolver::add_matrix_penalty(void) // partition matrix // - partition matrix based on Dirichlet constraints // -------------------------------------------------------------------- -void LinearSolver::partition_matrix(void) +void LinearSolver::partition_matrix() { fixedSet_.clear(); BC_SET::const_iterator itr; diff --git a/lib/atc/OutputManager.cpp b/lib/atc/OutputManager.cpp index d66fb0e8dd..6a57bceac1 100644 --- a/lib/atc/OutputManager.cpp +++ b/lib/atc/OutputManager.cpp @@ -172,7 +172,7 @@ void OutputManager::read_restart_file(string fileName, RESTART_LIST *data) //----------------------------------------------------------------------------- //* //----------------------------------------------------------------------------- -void OutputManager::write_globals(void) +void OutputManager::write_globals() { if ( outputPrefix_ == "NULL") return; string file = outputPrefix_ + ".GLOBALS"; @@ -224,7 +224,7 @@ void OutputManager::write_geometry(const MATRIX *coordinates, //----------------------------------------------------------------------------- //* //----------------------------------------------------------------------------- -void OutputManager::write_geometry_ensight(void) +void OutputManager::write_geometry_ensight() { // geometry based on a reference configuration string geom_file_name = outputPrefix_ + ".geo"; @@ -327,7 +327,7 @@ void OutputManager::write_geometry_ensight(void) //----------------------------------------------------------------------------- //* //----------------------------------------------------------------------------- -void OutputManager::write_geometry_text(void) +void OutputManager::write_geometry_text() { if ( outputPrefix_ == "NULL") return; // geometry based on a reference configuration diff --git a/lib/atc/PerPairQuantity.cpp b/lib/atc/PerPairQuantity.cpp index 164c387643..d95c6e42bd 100644 --- a/lib/atc/PerPairQuantity.cpp +++ b/lib/atc/PerPairQuantity.cpp @@ -18,7 +18,7 @@ PairMap::PairMap(LammpsInterface * lammpsInterface, int groupbit ): nPairs_(0), nBonds_(0) { }; -PairMap::~PairMap(void) +PairMap::~PairMap() { }; //========================================================== @@ -27,7 +27,7 @@ PairMapNeighbor::PairMapNeighbor(LammpsInterface * lammpsInterface, int groupbit { }; -void PairMapNeighbor::reset(void) const +void PairMapNeighbor::reset() const { int inum = lammpsInterface_->neighbor_list_inum(); int *ilist = lammpsInterface_->neighbor_list_ilist(); @@ -90,7 +90,7 @@ PairVirialEulerian::PairVirialEulerian(LammpsInterface * lammpsInterface, }; -void PairVirialEulerian::reset(void) const +void PairVirialEulerian::reset() const { int nPairs = pairMap_.size(); quantity_.reset(nPairs,nCols_); @@ -129,7 +129,7 @@ PairVirialLagrangian::PairVirialLagrangian(LammpsInterface * lammpsInterface, }; -void PairVirialLagrangian::reset(void) const +void PairVirialLagrangian::reset() const { int nPairs = pairMap_.size(); quantity_.reset(nPairs,nCols_); @@ -181,7 +181,7 @@ PairPotentialHeatFluxEulerian::PairPotentialHeatFluxEulerian(LammpsInterface * l }; -void PairPotentialHeatFluxEulerian::reset(void) const +void PairPotentialHeatFluxEulerian::reset() const { int nPairs = pairMap_.size(); quantity_.reset(nPairs,nCols_); @@ -217,7 +217,7 @@ PairPotentialHeatFluxLagrangian::PairPotentialHeatFluxLagrangian(LammpsInterface }; -void PairPotentialHeatFluxLagrangian::reset(void) const +void PairPotentialHeatFluxLagrangian::reset() const { int nPairs = pairMap_.size(); quantity_.reset(nPairs,nCols_); @@ -275,7 +275,7 @@ BondMatrixKernel::BondMatrixKernel(LammpsInterface * lammpsInterface, if (kernelFunction_ == nullptr) throw ATC_Error("No AtC kernel function initialized"); }; -void BondMatrixKernel::reset(void) const +void BondMatrixKernel::reset() const { int nPairs = pairMap_.size(); // needs to come after quantity for reset int nNodes = feMesh_->num_nodes_unique(); @@ -328,7 +328,7 @@ BondMatrixPartitionOfUnity::BondMatrixPartitionOfUnity(LammpsInterface * lammpsI lineWg_[i] *= 0.5; } }; -void BondMatrixPartitionOfUnity::reset(void) const +void BondMatrixPartitionOfUnity::reset() const { int nNodes = feMesh_->num_nodes_unique(); int nPairs = pairMap_.size(); diff --git a/lib/atc/PhysicsModel.cpp b/lib/atc/PhysicsModel.cpp index 0cef920e88..0720d86be2 100644 --- a/lib/atc/PhysicsModel.cpp +++ b/lib/atc/PhysicsModel.cpp @@ -108,7 +108,7 @@ void PhysicsModel::parse_material_file(string fileName) fileId.close(); } -void PhysicsModel::initialize(void) +void PhysicsModel::initialize() { // initialize materials vector< Material* >::const_iterator iter; diff --git a/lib/atc/PoissonSolver.cpp b/lib/atc/PoissonSolver.cpp index 3d644e6c58..51b1604c91 100644 --- a/lib/atc/PoissonSolver.cpp +++ b/lib/atc/PoissonSolver.cpp @@ -111,7 +111,7 @@ PoissonSolver::~PoissonSolver() // -------------------------------------------------------------------- // Initialize // -------------------------------------------------------------------- -void PoissonSolver::initialize(void) +void PoissonSolver::initialize() { nNodes_ = feEngine_->num_nodes(); diff --git a/lib/atc/PrescribedDataManager.cpp b/lib/atc/PrescribedDataManager.cpp index 72f6c75e79..aed3ecd281 100644 --- a/lib/atc/PrescribedDataManager.cpp +++ b/lib/atc/PrescribedDataManager.cpp @@ -523,7 +523,7 @@ namespace ATC { // print //------------------------------------------------------------------------- - void PrescribedDataManager::print(void) + void PrescribedDataManager::print() { // print and check consistency enum dataType {FREE=0,FIELD,SOURCE}; diff --git a/lib/atc/SchrodingerSolver.cpp b/lib/atc/SchrodingerSolver.cpp index a59191a229..37680d7578 100644 --- a/lib/atc/SchrodingerSolver.cpp +++ b/lib/atc/SchrodingerSolver.cpp @@ -735,7 +735,7 @@ double fermi_dirac(const double E, const double T) else ATC_Error("schrodinger-poisson solver:too many fixed"); } - GlobalSliceSchrodingerPoissonSolver::~GlobalSliceSchrodingerPoissonSolver(void) { + GlobalSliceSchrodingerPoissonSolver::~GlobalSliceSchrodingerPoissonSolver() { if (solver_) delete solver_; } //-------------------------------------------------------------------------- diff --git a/lib/atc/Stress.cpp b/lib/atc/Stress.cpp index 90608dad15..10ec3ca329 100644 --- a/lib/atc/Stress.cpp +++ b/lib/atc/Stress.cpp @@ -237,7 +237,7 @@ StressCubicElastic::StressCubicElastic(fstream &fileId) } } -void StressCubicElastic::set_tangent(void) +void StressCubicElastic::set_tangent() { C_.reset(6,6); C_(0,0)=C_(1,1)=C_(2,2) =c11_; @@ -374,7 +374,7 @@ StressCauchyBorn::~StressCauchyBorn() //============================================================================== // initialize //============================================================================== -void StressCauchyBorn::initialize(void) +void StressCauchyBorn::initialize() { if (!initialized_) { if (makeLinear_) linearize(); @@ -393,7 +393,7 @@ void StressCauchyBorn::initialize(void) //============================================================================== // compute the bond stiffness consistent with the einstein freq //============================================================================== -double StressCauchyBorn::stiffness(void) const +double StressCauchyBorn::stiffness() const { AtomCluster vac; cblattice_->atom_cluster(eye(3,3), potential_->cutoff_radius(), vac); diff --git a/lib/atc/WeakEquationChargeDiffusion.cpp b/lib/atc/WeakEquationChargeDiffusion.cpp index 246edb0f6e..2384dd246c 100644 --- a/lib/atc/WeakEquationChargeDiffusion.cpp +++ b/lib/atc/WeakEquationChargeDiffusion.cpp @@ -19,7 +19,7 @@ WeakEquationChargeDiffusion::WeakEquationChargeDiffusion() //-------------------------------------------------------------- // Destructor //-------------------------------------------------------------- -WeakEquationChargeDiffusion::~WeakEquationChargeDiffusion(void) +WeakEquationChargeDiffusion::~WeakEquationChargeDiffusion() {} //--------------------------------------------------------------------- // compute capacity diff --git a/lib/atc/WeakEquationDiffusion.cpp b/lib/atc/WeakEquationDiffusion.cpp index 643b7956ba..23393ebdec 100644 --- a/lib/atc/WeakEquationDiffusion.cpp +++ b/lib/atc/WeakEquationDiffusion.cpp @@ -19,7 +19,7 @@ WeakEquationDiffusion::WeakEquationDiffusion() //-------------------------------------------------------------- // Destructor //-------------------------------------------------------------- -WeakEquationDiffusion::~WeakEquationDiffusion(void) +WeakEquationDiffusion::~WeakEquationDiffusion() {} //--------------------------------------------------------------------- // compute capacity diff --git a/lib/atc/WeakEquationElectronContinuity.cpp b/lib/atc/WeakEquationElectronContinuity.cpp index 4c5024c1b1..28b2abd84a 100644 --- a/lib/atc/WeakEquationElectronContinuity.cpp +++ b/lib/atc/WeakEquationElectronContinuity.cpp @@ -18,7 +18,7 @@ WeakEquationElectronContinuity::WeakEquationElectronContinuity() //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationElectronContinuity::~WeakEquationElectronContinuity(void) +WeakEquationElectronContinuity::~WeakEquationElectronContinuity() {} //--------------------------------------------------------------------- @@ -66,7 +66,7 @@ WeakEquationElectronEquilibrium::WeakEquationElectronEquilibrium() //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationElectronEquilibrium::~WeakEquationElectronEquilibrium(void) +WeakEquationElectronEquilibrium::~WeakEquationElectronEquilibrium() {} //--------------------------------------------------------------------- diff --git a/lib/atc/WeakEquationElectronTemperature.cpp b/lib/atc/WeakEquationElectronTemperature.cpp index 368db1005e..975def6486 100644 --- a/lib/atc/WeakEquationElectronTemperature.cpp +++ b/lib/atc/WeakEquationElectronTemperature.cpp @@ -18,7 +18,7 @@ WeakEquationElectronTemperature::WeakEquationElectronTemperature() //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationElectronTemperature::~WeakEquationElectronTemperature(void) +WeakEquationElectronTemperature::~WeakEquationElectronTemperature() {} //--------------------------------------------------------------------- @@ -93,7 +93,7 @@ WeakEquationElectronTemperatureJouleHeating::WeakEquationElectronTemperatureJoul //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationElectronTemperatureJouleHeating::~WeakEquationElectronTemperatureJouleHeating(void) +WeakEquationElectronTemperatureJouleHeating::~WeakEquationElectronTemperatureJouleHeating() {} //--------------------------------------------------------------------- @@ -162,7 +162,7 @@ WeakEquationElectronTemperatureConvection::WeakEquationElectronTemperatureConvec //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationElectronTemperatureConvection::~WeakEquationElectronTemperatureConvection(void) +WeakEquationElectronTemperatureConvection::~WeakEquationElectronTemperatureConvection() { // do nothing } diff --git a/lib/atc/WeakEquationMassDiffusion.cpp b/lib/atc/WeakEquationMassDiffusion.cpp index 122d3ee891..bb079087c3 100644 --- a/lib/atc/WeakEquationMassDiffusion.cpp +++ b/lib/atc/WeakEquationMassDiffusion.cpp @@ -19,7 +19,7 @@ WeakEquationMassDiffusion::WeakEquationMassDiffusion() //-------------------------------------------------------------- // Destructor //-------------------------------------------------------------- -WeakEquationMassDiffusion::~WeakEquationMassDiffusion(void) +WeakEquationMassDiffusion::~WeakEquationMassDiffusion() {} //--------------------------------------------------------------------- // compute capacity diff --git a/lib/atc/WeakEquationPhononTemperature.cpp b/lib/atc/WeakEquationPhononTemperature.cpp index aec735deea..7441ab2ea9 100644 --- a/lib/atc/WeakEquationPhononTemperature.cpp +++ b/lib/atc/WeakEquationPhononTemperature.cpp @@ -19,7 +19,7 @@ WeakEquationPhononTemperature::WeakEquationPhononTemperature() //-------------------------------------------------------------- // Destructor //-------------------------------------------------------------- -WeakEquationPhononTemperature::~WeakEquationPhononTemperature(void) +WeakEquationPhononTemperature::~WeakEquationPhononTemperature() {} //--------------------------------------------------------------------- // compute total energy @@ -67,7 +67,7 @@ WeakEquationPhononTemperatureExchange::WeakEquationPhononTemperatureExchange() //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationPhononTemperatureExchange::~WeakEquationPhononTemperatureExchange(void) +WeakEquationPhononTemperatureExchange::~WeakEquationPhononTemperatureExchange() {} //--------------------------------------------------------------------- diff --git a/lib/atc/WeakEquationSchrodinger.cpp b/lib/atc/WeakEquationSchrodinger.cpp index 07497b1fd5..b4cc3970b3 100644 --- a/lib/atc/WeakEquationSchrodinger.cpp +++ b/lib/atc/WeakEquationSchrodinger.cpp @@ -18,7 +18,7 @@ WeakEquationSchrodinger::WeakEquationSchrodinger() //-------------------------------------------------------------- // Destructor //--------------------------------------------------------------------- -WeakEquationSchrodinger::~WeakEquationSchrodinger(void) +WeakEquationSchrodinger::~WeakEquationSchrodinger() {} //--------------------------------------------------------------------- diff --git a/lib/gpu/Makefile.linux_multi b/lib/gpu/Makefile.linux_multi index f3d89fd9f0..fda640221f 100644 --- a/lib/gpu/Makefile.linux_multi +++ b/lib/gpu/Makefile.linux_multi @@ -13,14 +13,6 @@ endif NVCC = nvcc -# obsolete hardware. not supported by current drivers anymore. -#CUDA_ARCH = -arch=sm_13 -#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 @@ -45,6 +37,9 @@ CUDA_ARCH = -arch=sm_50 #CUDA_ARCH = -arch=sm_80 #CUDA_ARCH = -arch=sm_86 +# Hopper hardware +#CUDA_ARCH = -arch=sm_90 + 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] \ diff --git a/lib/gpu/README b/lib/gpu/README index 3185db3af6..100179feca 100644 --- a/lib/gpu/README +++ b/lib/gpu/README @@ -171,7 +171,13 @@ NOTE: when compiling with CMake, all of the considerations listed below are considered within the CMake configuration process, so no separate compilation of the gpu library is required. Also this will build in support for all compute architecture that are supported by the CUDA toolkit version -used to build the gpu library. +used to build the gpu library. A similar setup is possible using +Makefile.linux_multi after adjusting the settings for the CUDA toolkit in use. + +Only CUDA toolkit version 8.0 and later and only GPU architecture 3.0 +(aka Kepler) and later are supported by this version of LAMMPS. If you want +to use older hard- or software you have to compile for OpenCL or use an older +version of LAMMPS. If you do not want to use a fat binary, that supports multiple CUDA architectures, the CUDA_ARCH must be set to match the GPU architecture. This @@ -225,7 +231,8 @@ If GERYON_NUMA_FISSION is defined at build time, LAMMPS will consider separate NUMA nodes on GPUs or accelerators as separate devices. For example, a 2-socket CPU would appear as two separate devices for OpenCL (and LAMMPS would require two MPI processes to use both sockets with the GPU library - each with its -own device ID as output by ocl_get_devices). +own device ID as output by ocl_get_devices). OpenCL version 1.2 or later is +required. For a debug build, use "-DUCL_DEBUG -DGERYON_KERNEL_DUMP" and remove "-DUCL_NO_EXIT" and "-DMPI_GERYON" from the build options. diff --git a/lib/gpu/geryon/hip_device.h b/lib/gpu/geryon/hip_device.h index 456a03b180..fadeec8711 100644 --- a/lib/gpu/geryon/hip_device.h +++ b/lib/gpu/geryon/hip_device.h @@ -379,18 +379,9 @@ UCL_Device::UCL_Device() { prop.regsPerBlock = hip_prop.regsPerBlock; prop.clockRate = hip_prop.clockRate; prop.computeMode = hip_prop.computeMode; - //CU_SAFE_CALL_NS(hipDeviceGetAttribute(&prop.memPitch, CU_DEVICE_ATTRIBUTE_MAX_PITCH, dev)); - //CU_SAFE_CALL_NS(hipDeviceGetAttribute(&prop.textureAlign, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, dev)); - //#if CUDA_VERSION >= 2020 - //CU_SAFE_CALL_NS(hipDeviceGetAttribute(&prop.kernelExecTimeoutEnabled, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT,dev)); CU_SAFE_CALL_NS(hipDeviceGetAttribute(&prop.integrated, hipDeviceAttributeIntegrated, dev)); - //CU_SAFE_CALL_NS(hipDeviceGetAttribute(&prop.canMapHostMemory, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, dev)); - //#endif - //#if CUDA_VERSION >= 3010 prop.concurrentKernels = hip_prop.concurrentKernels; - //CU_SAFE_CALL_NS(hipDeviceGetAttribute(&prop.ECCEnabled, CU_DEVICE_ATTRIBUTE_ECC_ENABLED, dev)); - //#endif _properties.push_back(prop); } @@ -447,13 +438,11 @@ void UCL_Device::clear() { // List all devices along with all properties void UCL_Device::print_all(std::ostream &out) { - //#if CUDA_VERSION >= 2020 int driver_version; hipDriverGetVersion(&driver_version); out << "Driver Version: " << driver_version/1000 << "." << driver_version%100 << std::endl; - //#endif if (num_devices() == 0) out << "There is no device supporting HIP\n"; @@ -470,12 +459,10 @@ void UCL_Device::print_all(std::ostream &out) { out << "No\n"; out << " Total amount of global memory: " << gigabytes(i) << " GB\n"; - //#if CUDA_VERSION >= 2000 out << " Number of compute units/multiprocessors: " << _properties[i].multiProcessorCount << std::endl; out << " Number of cores: " << cores(i) << std::endl; - //#endif out << " Total amount of constant memory: " << _properties[i].totalConstantMemory << " bytes\n"; out << " Total amount of local/shared memory per block: " @@ -494,58 +481,29 @@ void UCL_Device::print_all(std::ostream &out) { << _properties[i].maxGridSize[0] << " x " << _properties[i].maxGridSize[1] << " x " << _properties[i].maxGridSize[2] << std::endl; - //out << " Maximum memory pitch: " - // << max_pitch(i) << " bytes\n"; - //out << " Texture alignment: " - // << _properties[i].textureAlign << " bytes\n"; out << " Clock rate: " << clock_rate(i) << " GHz\n"; - //#if CUDA_VERSION >= 2020 - //out << " Run time limit on kernels: "; - //if (_properties[i].kernelExecTimeoutEnabled) - // out << "Yes\n"; - //else - // out << "No\n"; out << " Integrated: "; if (_properties[i].integrated) out << "Yes\n"; else out << "No\n"; - //out << " Support host page-locked memory mapping: "; - //if (_properties[i].canMapHostMemory) - // out << "Yes\n"; - //else - // out << "No\n"; out << " Compute mode: "; if (_properties[i].computeMode == hipComputeModeDefault) out << "Default\n"; // multiple threads can use device -//#if CUDA_VERSION >= 8000 -// else if (_properties[i].computeMode == hipComputeModeExclusiveProcess) -//#else else if (_properties[i].computeMode == hipComputeModeExclusive) -//#endif out << "Exclusive\n"; // only thread can use device else if (_properties[i].computeMode == hipComputeModeProhibited) out << "Prohibited\n"; // no thread can use device - //#if CUDART_VERSION >= 4000 else if (_properties[i].computeMode == hipComputeModeExclusiveProcess) out << "Exclusive Process\n"; // multiple threads 1 process - //#endif else out << "Unknown\n"; - //#endif - //#if CUDA_VERSION >= 3010 out << " Concurrent kernel execution: "; if (_properties[i].concurrentKernels) out << "Yes\n"; else out << "No\n"; - //out << " Device has ECC support enabled: "; - //if (_properties[i].ECCEnabled) - // out << "Yes\n"; - //else - // out << "No\n"; - //#endif } } diff --git a/lib/gpu/geryon/hip_macros.h b/lib/gpu/geryon/hip_macros.h index 9c9971b896..96313ec87e 100644 --- a/lib/gpu/geryon/hip_macros.h +++ b/lib/gpu/geryon/hip_macros.h @@ -5,11 +5,7 @@ #include #include -//#if CUDA_VERSION >= 3020 #define CUDA_INT_TYPE size_t -//#else -//#define CUDA_INT_TYPE unsigned -//#endif #ifdef MPI_GERYON #include "mpi.h" diff --git a/lib/gpu/geryon/hip_texture.h b/lib/gpu/geryon/hip_texture.h index eb27c7a1ed..3e8c56a4e4 100644 --- a/lib/gpu/geryon/hip_texture.h +++ b/lib/gpu/geryon/hip_texture.h @@ -71,9 +71,6 @@ class UCL_Texture { /// Make a texture reference available to kernel inline void allow(UCL_Kernel &) { - //#if CUDA_VERSION < 4000 - //CU_SAFE_CALL(cuParamSetTexRef(kernel._kernel, CU_PARAM_TR_DEFAULT, _tex)); - //#endif } private: diff --git a/lib/gpu/geryon/nvd_device.h b/lib/gpu/geryon/nvd_device.h index d5963fd39f..80414c9873 100644 --- a/lib/gpu/geryon/nvd_device.h +++ b/lib/gpu/geryon/nvd_device.h @@ -320,6 +320,9 @@ class UCL_Device { // Grabs the properties for all devices UCL_Device::UCL_Device() { +#if CUDA_VERSION < 8000 +#error CUDA Toolkit version 8 or later required +#endif CU_SAFE_CALL_NS(cuInit(0)); CU_SAFE_CALL_NS(cuDeviceGetCount(&_num_devices)); for (int i=0; i<_num_devices; ++i) { @@ -358,16 +361,12 @@ UCL_Device::UCL_Device() { CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.clockRate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, dev)); CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.textureAlign, CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT, dev)); - #if CUDA_VERSION >= 2020 CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.kernelExecTimeoutEnabled, CU_DEVICE_ATTRIBUTE_KERNEL_EXEC_TIMEOUT,dev)); CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.integrated, CU_DEVICE_ATTRIBUTE_INTEGRATED, dev)); CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.canMapHostMemory, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, dev)); CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.computeMode, CU_DEVICE_ATTRIBUTE_COMPUTE_MODE,dev)); - #endif - #if CUDA_VERSION >= 3010 CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.concurrentKernels, CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS, dev)); CU_SAFE_CALL_NS(cuDeviceGetAttribute(&prop.ECCEnabled, CU_DEVICE_ATTRIBUTE_ECC_ENABLED, dev)); - #endif _properties.push_back(prop); } @@ -415,13 +414,10 @@ void UCL_Device::clear() { // List all devices along with all properties void UCL_Device::print_all(std::ostream &out) { - #if CUDA_VERSION >= 2020 int driver_version; cuDriverGetVersion(&driver_version); out << "CUDA Driver Version: " - << driver_version/1000 << "." << driver_version%100 - << std::endl; - #endif + << driver_version/1000 << "." << driver_version%100 << std::endl; if (num_devices() == 0) out << "There is no device supporting CUDA\n"; @@ -438,12 +434,10 @@ void UCL_Device::print_all(std::ostream &out) { out << "No\n"; out << " Total amount of global memory: " << gigabytes(i) << " GB\n"; - #if CUDA_VERSION >= 2000 out << " Number of compute units/multiprocessors: " << _properties[i].multiProcessorCount << std::endl; out << " Number of cores: " << cores(i) << std::endl; - #endif out << " Total amount of constant memory: " << _properties[i].totalConstantMemory << " bytes\n"; out << " Total amount of local/shared memory per block: " @@ -468,7 +462,6 @@ void UCL_Device::print_all(std::ostream &out) { << _properties[i].textureAlign << " bytes\n"; out << " Clock rate: " << clock_rate(i) << " GHz\n"; - #if CUDA_VERSION >= 2020 out << " Run time limit on kernels: "; if (_properties[i].kernelExecTimeoutEnabled) out << "Yes\n"; @@ -487,22 +480,14 @@ void UCL_Device::print_all(std::ostream &out) { out << " Compute mode: "; if (_properties[i].computeMode == CU_COMPUTEMODE_DEFAULT) out << "Default\n"; // multiple threads can use device -#if CUDA_VERSION >= 8000 else if (_properties[i].computeMode == CU_COMPUTEMODE_EXCLUSIVE_PROCESS) -#else - else if (_properties[i].computeMode == CU_COMPUTEMODE_EXCLUSIVE) -#endif out << "Exclusive\n"; // only thread can use device else if (_properties[i].computeMode == CU_COMPUTEMODE_PROHIBITED) out << "Prohibited\n"; // no thread can use device - #if CUDART_VERSION >= 4000 else if (_properties[i].computeMode == CU_COMPUTEMODE_EXCLUSIVE_PROCESS) out << "Exclusive Process\n"; // multiple threads 1 process - #endif else out << "Unknown\n"; - #endif - #if CUDA_VERSION >= 3010 out << " Concurrent kernel execution: "; if (_properties[i].concurrentKernels) out << "Yes\n"; @@ -513,7 +498,6 @@ void UCL_Device::print_all(std::ostream &out) { out << "Yes\n"; else out << "No\n"; - #endif } } diff --git a/lib/gpu/geryon/nvd_kernel.h b/lib/gpu/geryon/nvd_kernel.h index 798b12e53c..55ba5a8f47 100644 --- a/lib/gpu/geryon/nvd_kernel.h +++ b/lib/gpu/geryon/nvd_kernel.h @@ -165,17 +165,11 @@ class UCL_Program { class UCL_Kernel { public: UCL_Kernel() : _dimensions(1), _num_args(0) { - #if CUDA_VERSION < 4000 - _param_size=0; - #endif _num_blocks[0]=0; } UCL_Kernel(UCL_Program &program, const char *function) : _dimensions(1), _num_args(0) { - #if CUDA_VERSION < 4000 - _param_size=0; - #endif _num_blocks[0]=0; set_function(program,function); _cq=program._cq; @@ -211,11 +205,7 @@ class UCL_Kernel { if (index==_num_args) add_arg(arg); else if (index<_num_args) - #if CUDA_VERSION >= 4000 _kernel_args[index]=arg; - #else - CU_SAFE_CALL(cuParamSetv(_kernel, _offsets[index], arg, sizeof(dtype))); - #endif else assert(0==1); // Must add kernel parameters in sequential order } @@ -242,15 +232,7 @@ class UCL_Kernel { /// Add a kernel argument. inline void add_arg(const CUdeviceptr* const arg) { - #if CUDA_VERSION >= 4000 _kernel_args[_num_args]=(void *)arg; - #else - void* ptr = (void*)(size_t)(*arg); - _param_size = (_param_size + __alignof(ptr) - 1) & ~(__alignof(ptr) - 1); - CU_SAFE_CALL(cuParamSetv(_kernel, _param_size, &ptr, sizeof(ptr))); - _offsets.push_back(_param_size); - _param_size+=sizeof(ptr); - #endif _num_args++; if (_num_args>UCL_MAX_KERNEL_ARGS) assert(0==1); } @@ -258,14 +240,7 @@ class UCL_Kernel { /// Add a kernel argument. template inline void add_arg(const dtype* const arg) { - #if CUDA_VERSION >= 4000 _kernel_args[_num_args]=const_cast(arg); - #else - _param_size = (_param_size+__alignof(dtype)-1) & ~(__alignof(dtype)-1); - CU_SAFE_CALL(cuParamSetv(_kernel,_param_size,(void*)arg,sizeof(dtype))); - _offsets.push_back(_param_size); - _param_size+=sizeof(dtype); - #endif _num_args++; if (_num_args>UCL_MAX_KERNEL_ARGS) assert(0==1); } @@ -298,13 +273,9 @@ class UCL_Kernel { _num_blocks[0]=num_blocks; _num_blocks[1]=1; _num_blocks[2]=1; - #if CUDA_VERSION >= 4000 _block_size[0]=block_size; _block_size[1]=1; _block_size[2]=1; - #else - CU_SAFE_CALL(cuFuncSetBlockShape(_kernel,block_size,1,1)); - #endif } /// Set the number of thread blocks and the number of threads in each block @@ -323,13 +294,9 @@ class UCL_Kernel { _num_blocks[0]=num_blocks_x; _num_blocks[1]=num_blocks_y; _num_blocks[2]=1; - #if CUDA_VERSION >= 4000 _block_size[0]=block_size_x; _block_size[1]=block_size_y; _block_size[2]=1; - #else - CU_SAFE_CALL(cuFuncSetBlockShape(_kernel,block_size_x,block_size_y,1)); - #endif } /// Set the number of thread blocks and the number of threads in each block @@ -350,14 +317,9 @@ class UCL_Kernel { _num_blocks[0]=num_blocks_x; _num_blocks[1]=num_blocks_y; _num_blocks[2]=1; - #if CUDA_VERSION >= 4000 _block_size[0]=block_size_x; _block_size[1]=block_size_y; _block_size[2]=block_size_z; - #else - CU_SAFE_CALL(cuFuncSetBlockShape(_kernel,block_size_x,block_size_y, - block_size_z)); - #endif } /// Set the number of thread blocks and the number of threads in each block @@ -373,23 +335,14 @@ class UCL_Kernel { /// Run the kernel in the default command queue inline void run() { - #if CUDA_VERSION >= 4000 CU_SAFE_CALL(cuLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], _block_size[2],0,_cq,_kernel_args,nullptr)); - #else - CU_SAFE_CALL(cuParamSetSize(_kernel,_param_size)); - CU_SAFE_CALL(cuLaunchGridAsync(_kernel,_num_blocks[0],_num_blocks[1],_cq)); - #endif } /// Clear any arguments associated with the kernel inline void clear_args() { _num_args=0; - #if CUDA_VERSION < 4000 - _offsets.clear(); - _param_size=0; - #endif } /// Return the default command queue/stream associated with this data @@ -406,13 +359,8 @@ class UCL_Kernel { unsigned _num_args; friend class UCL_Texture; - #if CUDA_VERSION >= 4000 unsigned _block_size[3]; void * _kernel_args[UCL_MAX_KERNEL_ARGS]; - #else - std::vector _offsets; - unsigned _param_size; - #endif }; } // namespace diff --git a/lib/gpu/geryon/nvd_macros.h b/lib/gpu/geryon/nvd_macros.h index 08ff84991a..5c1f7f25d5 100644 --- a/lib/gpu/geryon/nvd_macros.h +++ b/lib/gpu/geryon/nvd_macros.h @@ -5,11 +5,7 @@ #include #include -#if CUDA_VERSION >= 3020 #define CUDA_INT_TYPE size_t -#else -#define CUDA_INT_TYPE unsigned -#endif #ifdef MPI_GERYON #include "mpi.h" diff --git a/lib/gpu/geryon/nvd_texture.h b/lib/gpu/geryon/nvd_texture.h index d7d65da903..96e1991859 100644 --- a/lib/gpu/geryon/nvd_texture.h +++ b/lib/gpu/geryon/nvd_texture.h @@ -69,9 +69,6 @@ class UCL_Texture { /// Make a texture reference available to kernel inline void allow(UCL_Kernel &kernel) { - #if CUDA_VERSION < 4000 - CU_SAFE_CALL(cuParamSetTexRef(kernel._kernel, CU_PARAM_TR_DEFAULT, _tex)); - #endif } private: diff --git a/lib/gpu/geryon/ucl_get_devices.cpp b/lib/gpu/geryon/ucl_get_devices.cpp index 994554a252..0982e96680 100644 --- a/lib/gpu/geryon/ucl_get_devices.cpp +++ b/lib/gpu/geryon/ucl_get_devices.cpp @@ -41,7 +41,7 @@ using namespace ucl_cudart; using namespace ucl_hip; #endif -int main(int argc, char** argv) { +int main(int /*argc*/, char** /*argv*/) { UCL_Device cop; std::cout << "Found " << cop.num_platforms() << " platform(s).\n"; if (cop.num_platforms()>0) diff --git a/lib/gpu/geryon/ucl_nv_kernel.h b/lib/gpu/geryon/ucl_nv_kernel.h index 437631ec3a..99cd640627 100644 --- a/lib/gpu/geryon/ucl_nv_kernel.h +++ b/lib/gpu/geryon/ucl_nv_kernel.h @@ -25,21 +25,8 @@ #ifndef UCL_NV_KERNEL_H #define UCL_NV_KERNEL_H -#if (__CUDA_ARCH__ < 200) -#define mul24 __mul24 -#define MEM_THREADS 16 -#else #define mul24(X,Y) (X)*(Y) #define MEM_THREADS 32 -#endif - -#ifdef CUDA_PRE_THREE -struct __builtin_align__(16) _double4 -{ - double x, y, z, w; -}; -typedef struct _double4 double4; -#endif #define GLOBAL_ID_X threadIdx.x+mul24(blockIdx.x,blockDim.x) #define GLOBAL_ID_Y threadIdx.y+mul24(blockIdx.y,blockDim.y) diff --git a/lib/gpu/lal_answer.cpp b/lib/gpu/lal_answer.cpp index e3d4e71b15..361c340ec7 100644 --- a/lib/gpu/lal_answer.cpp +++ b/lib/gpu/lal_answer.cpp @@ -94,13 +94,13 @@ bool AnswerT::init(const int inum, const bool charge, const bool rot, template bool AnswerT::add_fields(const bool charge, const bool rot) { bool realloc=false; - if (charge && _charge==false) { + if (charge && !_charge) { _charge=true; _e_fields++; _ev_fields++; realloc=true; } - if (rot && _rot==false) { + if (rot && !_rot) { _rot=true; realloc=true; } @@ -163,10 +163,8 @@ void AnswerT::copy_answers(const bool eflag, const bool vflag, #endif int csize=_ev_fields; - if (!eflag) - csize-=_e_fields; - if (!vflag) - csize-=6; + if (!eflag) csize-=_e_fields; + if (!vflag) csize-=6; if (csize>0) engv.update_host(_ev_stride*csize,true); @@ -192,8 +190,7 @@ void AnswerT::copy_answers(const bool eflag, const bool vflag, template double AnswerT::energy_virial(double *eatom, double **vatom, double *virial) { - if (_eflag==false && _vflag==false) - return 0.0; + if (!_eflag && !_vflag) return 0.0; double evdwl=0.0; int vstart=0; @@ -241,11 +238,9 @@ double AnswerT::energy_virial(double *eatom, double **vatom, template double AnswerT::energy_virial(double *eatom, double **vatom, double *virial, double &ecoul) { - if (_eflag==false && _vflag==false) - return 0.0; + if (!_eflag && !_vflag) return 0.0; - if (_charge==false) - return energy_virial(eatom,vatom,virial); + if (!_charge) return energy_virial(eatom,vatom,virial); double evdwl=0.0; int vstart=0, iend=_ev_stride; @@ -305,8 +300,8 @@ void AnswerT::get_answers(double **f, double **tor) { if (_ilist==nullptr) { typedef struct { double x,y,z; } vec3d; typedef struct { acctyp x,y,z,w; } vec4d_t; - vec3d *fp=reinterpret_cast(&(f[0][0])); - vec4d_t *forcep=reinterpret_cast(&(force[0])); + auto fp=reinterpret_cast(&(f[0][0])); + auto forcep=reinterpret_cast(&(force[0])); #if (LAL_USE_OMP == 1) #pragma omp parallel @@ -329,8 +324,8 @@ void AnswerT::get_answers(double **f, double **tor) { fp[i].z+=forcep[i].z; } if (_rot) { - vec3d *torp=reinterpret_cast(&(tor[0][0])); - vec4d_t *torquep=reinterpret_cast(&(force[_inum*4])); + auto torp=reinterpret_cast(&(tor[0][0])); + auto torquep=reinterpret_cast(&(force[_inum*4])); for (int i=ifrom; i0) { success=success && (dev_tag.alloc(_max_atoms,*dev, diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index 93c2f4e469..7bf2caaa74 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -101,7 +101,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int ngpu, // Get the names of all nodes int name_length; char node_name[MPI_MAX_PROCESSOR_NAME]; - char *node_names = new char[MPI_MAX_PROCESSOR_NAME*_world_size]; + auto node_names = new char[MPI_MAX_PROCESSOR_NAME*_world_size]; MPI_Get_processor_name(node_name,&name_length); MPI_Allgather(&node_name,MPI_MAX_PROCESSOR_NAME,MPI_CHAR,&node_names[0], MPI_MAX_PROCESSOR_NAME,MPI_CHAR,_comm_world); @@ -201,9 +201,9 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int ngpu, unsigned best_cus = gpu->cus(0); bool type_match = (gpu->device_type(0) == type); for (int i = 1; i < gpu->num_devices(); i++) { - if (type_match==true && gpu->device_type(i)!=type) + if (type_match && gpu->device_type(i)!=type) continue; - if (type_match == false && gpu->device_type(i) == type) { + if (type_match && gpu->device_type(i) == type) { type_match = true; best_cus = gpu->cus(i); best_device = i; @@ -280,7 +280,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int ngpu, MPI_Comm_rank(_comm_gpu,&_gpu_rank); #if !defined(CUDA_PROXY) && !defined(CUDA_MPS_SUPPORT) - if (_procs_per_gpu>1 && gpu->sharing_supported(my_gpu)==false) + if (_procs_per_gpu>1 && !gpu->sharing_supported(my_gpu)) return -7; #endif @@ -400,7 +400,7 @@ int DeviceT::set_ocl_params(std::string s_config, const std::string &extra_args) _ocl_compile_string += " -DCONFIG_ID="+params[0]+ " -DSIMD_SIZE="+params[1]+ " -DMEM_THREADS="+params[2]; - if (gpu->has_shuffle_support()==false) + if (!gpu->has_shuffle_support()) _ocl_compile_string+=" -DSHUFFLE_AVAIL=0"; else _ocl_compile_string+=" -DSHUFFLE_AVAIL="+params[3]; @@ -443,7 +443,7 @@ int DeviceT::init(Answer &ans, const bool charge, const bool vel) { if (!_device_init) return -1; - if (sizeof(acctyp)==sizeof(double) && gpu->double_precision()==false) + if (sizeof(acctyp)==sizeof(double) && !gpu->double_precision()) return -5; // Counts of data transfers for timing overhead estimates @@ -480,11 +480,11 @@ int DeviceT::init(Answer &ans, const bool charge, if (vel) _data_in_estimate++; } else { - if (atom.charge()==false && charge) + if (!atom.charge() && charge) _data_in_estimate++; - if (atom.quaternion()==false && rot) + if (!atom.quaternion() && rot) _data_in_estimate++; - if (atom.velocity()==false && vel) + if (!atom.velocity() && vel) _data_in_estimate++; if (!atom.add_fields(charge,rot,gpu_nbor,gpu_nbor>0 && maxspecial,vel)) return -3; @@ -502,7 +502,7 @@ int DeviceT::init(Answer &ans, const int nlocal, const int nall) { if (!_device_init) return -1; - if (sizeof(acctyp)==sizeof(double) && gpu->double_precision()==false) + if (sizeof(acctyp)==sizeof(double) && !gpu->double_precision()) return -5; if (_init_count==0) { diff --git a/lib/gpu/lal_neighbor.cpp b/lib/gpu/lal_neighbor.cpp index 4060b13491..58476a173b 100644 --- a/lib/gpu/lal_neighbor.cpp +++ b/lib/gpu/lal_neighbor.cpp @@ -113,7 +113,7 @@ bool Neighbor::init(NeighborShared *shared, const int inum, if (!success) return false; - if (_use_packing==false) { + if (!_use_packing) { #ifndef LAL_USE_OLD_NEIGHBOR _shared->compile_kernels(devi, gpu_nbor, compile_flags+ " -DMAX_SUBGROUPS_PER_BLOCK="+toa(_block_nbor_build/_simd_size)); @@ -153,7 +153,7 @@ void Neighbor::alloc(bool &success) { int nt=_max_atoms+_max_host; if (_max_nbors) _max_nbors = ((_max_nbors-1)/_threads_per_atom+1)*_threads_per_atom; - if (_use_packing==false || _gpu_nbor>0) { + if (!_use_packing || _gpu_nbor>0) { if (_max_nbors) success=success && (dev_nbor.alloc((_max_nbors+2)*_max_atoms,*dev)==UCL_SUCCESS); @@ -166,7 +166,7 @@ void Neighbor::alloc(bool &success) { _c_bytes=dev_nbor.row_bytes(); if (_alloc_packed) { - if (_use_packing==false) { + if (!_use_packing) { dev_packed_begin.clear(); success=success && (dev_packed_begin.alloc(_max_atoms,*dev, _packed_permissions)==UCL_SUCCESS); @@ -373,7 +373,7 @@ void Neighbor::get_host(const int inum, int *ilist, int *numj, time_nbor.stop(); - if (_use_packing==false) { + if (!_use_packing) { time_kernel.start(); int GX=static_cast(ceil(static_cast(inum)*_threads_per_atom/ block_size)); @@ -450,7 +450,7 @@ void Neighbor::get_host3(const int inum, const int nlist, int *ilist, int *numj, } time_nbor.stop(); - if (_use_packing==false) { + if (!_use_packing) { time_kernel.start(); int GX=static_cast(ceil(static_cast(inum)*_threads_per_atom/ block_size)); @@ -564,7 +564,7 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum, #endif } - const numtyp cutoff_cast=static_cast(_cutoff); + const auto cutoff_cast=static_cast(_cutoff); if (_maxspecial>0) { time_nbor.start(); @@ -741,12 +741,12 @@ void Neighbor::build_nbor_list(double **x, const int inum, const int host_inum, // If binning on GPU, do this now if (_gpu_nbor==1) { mn = _max_nbors; - const numtyp i_cell_size=static_cast(1.0/_cell_size); + const auto i_cell_size=static_cast(1.0/_cell_size); const int neigh_block=_block_cell_id; const int GX=(int)ceil((double)nall/neigh_block); - const numtyp sublo0=static_cast(sublo[0]); - const numtyp sublo1=static_cast(sublo[1]); - const numtyp sublo2=static_cast(sublo[2]); + const auto sublo0=static_cast(sublo[0]); + const auto sublo1=static_cast(sublo[1]); + const auto sublo2=static_cast(sublo[2]); _shared->k_cell_id.set_size(GX,neigh_block); _shared->k_cell_id.run(&atom.x, &atom.dev_cell_id, &atom.dev_particle_id, &sublo0, &sublo1, diff --git a/lib/gpu/lal_pppm.cpp b/lib/gpu/lal_pppm.cpp index 8f95d38532..911efe69f8 100644 --- a/lib/gpu/lal_pppm.cpp +++ b/lib/gpu/lal_pppm.cpp @@ -303,7 +303,7 @@ int PPPMT::spread(const int ago, const int nlocal, const int nall, double *host_q, double *boxlo, const double delxinv, const double delyinv, const double delzinv) { - if (_precompute_done==false) { + if (!_precompute_done) { atom->acc_timers(); _precompute(ago,nlocal,nall,host_x,host_type,success,host_q,boxlo,delxinv, delyinv,delzinv); @@ -359,7 +359,7 @@ void PPPMT::interp(const grdtyp qqrd2e_scale) { time_interp.stop(); ans->copy_answers(false,false,false,false,0); - if (_kspace_split==false) + if (!_kspace_split) device->add_ans_object(ans); } diff --git a/lib/gpu/lal_pppm_ext.cpp b/lib/gpu/lal_pppm_ext.cpp index d548b94be1..cf009b4479 100644 --- a/lib/gpu/lal_pppm_ext.cpp +++ b/lib/gpu/lal_pppm_ext.cpp @@ -101,7 +101,7 @@ float * pppm_gpu_init_f(const int nlocal, const int nall, FILE *screen, float *b=pppm_gpu_init(PPPMF,nlocal,nall,screen,order,nxlo_out,nylo_out, nzlo_out,nxhi_out,nyhi_out,nzhi_out,rho_coeff,vd_brick, slab_volfactor,nx_pppm,ny_pppm,nz_pppm,split,success); - if (split==false && respa==false) + if (!split && !respa) PPPMF.device->set_single_precompute(&PPPMF); return b; } @@ -146,7 +146,7 @@ double * pppm_gpu_init_d(const int nlocal, const int nall, FILE *screen, nzlo_out,nxhi_out,nyhi_out,nzhi_out,rho_coeff, vd_brick,slab_volfactor,nx_pppm,ny_pppm,nz_pppm, split,success); - if (split==false && respa==false) + if (!split && !respa) PPPMD.device->set_double_precompute(&PPPMD); return b; } diff --git a/lib/gpu/lal_pre_cuda_hip.h b/lib/gpu/lal_pre_cuda_hip.h index dfb6229bed..47a005b998 100644 --- a/lib/gpu/lal_pre_cuda_hip.h +++ b/lib/gpu/lal_pre_cuda_hip.h @@ -58,49 +58,6 @@ #define MAX_BIO_SHARED_TYPES 128 #define PPPM_MAX_SPLINE 8 -// ------------------------------------------------------------------------- -// LEGACY DEVICE CONFIGURATION -// ------------------------------------------------------------------------- - -#ifdef __CUDA_ARCH__ - -#if (__CUDA_ARCH__ < 200) - -#undef CONFIG_ID -#define CONFIG_ID 101 -#define MEM_THREADS 16 -#undef THREADS_PER_ATOM -#define THREADS_PER_ATOM 1 -#undef THREADS_PER_CHARGE -#define THREADS_PER_CHARGE 16 -#undef BLOCK_PAIR -#define BLOCK_PAIR 64 -#undef BLOCK_BIO_PAIR -#define BLOCK_BIO_PAIR 64 -#undef BLOCK_NBOR_BUILD -#define BLOCK_NBOR_BUILD 64 -#undef MAX_SHARED_TYPES -#define MAX_SHARED_TYPES 8 -#undef SHUFFLE_AVAIL -#define SHUFFLE_AVAIL 0 - -#elseif (__CUDA_ARCH__ < 300) - -#undef CONFIG_ID -#define CONFIG_ID 102 -#undef BLOCK_PAIR -#define BLOCK_PAIR 128 -#undef BLOCK_BIO_PAIR -#define BLOCK_BIO_PAIR 128 -#undef MAX_SHARED_TYPES -#define MAX_SHARED_TYPES 8 -#undef SHUFFLE_AVAIL -#define SHUFFLE_AVAIL 0 - -#endif - -#endif - // ------------------------------------------------------------------------- // KERNEL MACROS // ------------------------------------------------------------------------- @@ -111,12 +68,6 @@ #define fast_mul(X,Y) (X)*(Y) -#ifdef __CUDA_ARCH__ -#if (__CUDA_ARCH__ < 200) -#define fast_mul __mul24 -#endif -#endif - #define EVFLAG 1 #define NOUNROLL #define GLOBAL_ID_X threadIdx.x+fast_mul(blockIdx.x,blockDim.x) @@ -220,14 +171,6 @@ // KERNEL MACROS - MATH // ------------------------------------------------------------------------- -#ifdef CUDA_PRE_THREE -struct __builtin_align__(16) _double4 -{ - double x, y, z, w; -}; -typedef struct _double4 double4; -#endif - #ifdef _DOUBLE_DOUBLE #define ucl_exp exp diff --git a/lib/gpu/lal_yukawa_colloid.cpp b/lib/gpu/lal_yukawa_colloid.cpp index a447bb3889..e73a72c79e 100644 --- a/lib/gpu/lal_yukawa_colloid.cpp +++ b/lib/gpu/lal_yukawa_colloid.cpp @@ -69,7 +69,7 @@ int YukawaColloidT::init(const int ntypes, _max_rad_size=static_cast(static_cast(ef_nall)*1.10); - if (_shared_view==false) + if (!_shared_view) c_rad.alloc(_max_rad_size,*(this->ucl_device),UCL_WRITE_ONLY,UCL_READ_ONLY); rad_tex.get_texture(*(this->pair_program),"rad_tex"); @@ -157,7 +157,7 @@ void YukawaColloidT::compute(const int f_ago, const int inum_full, if (nall>_max_rad_size) { _max_rad_size=static_cast(static_cast(nall)*1.10); - if (_shared_view==false) { + if (!_shared_view) { c_rad.resize(_max_rad_size); rad_tex.bind_float(c_rad,1); } @@ -229,7 +229,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, if (nall>_max_rad_size) { _max_rad_size=static_cast(static_cast(nall)*1.10); - if (_shared_view==false) { + if (!_shared_view) { c_rad.resize(_max_rad_size); rad_tex.bind_float(c_rad,1); } diff --git a/lib/mdi/Install.py b/lib/mdi/Install.py index 7f8cc91cd0..a439da34d2 100644 --- a/lib/mdi/Install.py +++ b/lib/mdi/Install.py @@ -34,12 +34,12 @@ make lib-meam args="-m ifort" # build MEAM lib with custom Makefile.ifort (usi # settings -version = "1.3.0" +version = "1.3.2" url = "https://github.com/MolSSI-MDI/MDI_Library/archive/v%s.tar.gz" % version # known checksums for different MDI versions. used to validate the download. checksums = { \ - '1.3.0' : '8a8da217148bd9b700083b67d795af5e', \ + '1.3.2' : '836f5da400d8cff0f0e4435640f9454f', \ } # print error message or help diff --git a/python/lammps/formats.py b/python/lammps/formats.py index a311867253..d34998f01c 100644 --- a/python/lammps/formats.py +++ b/python/lammps/formats.py @@ -19,9 +19,9 @@ import re, yaml try: - from yaml import CSafeLoader as Loader, CSafeDumper as Dumper + from yaml import CSafeLoader as Loader except ImportError: - from yaml import SafeLoader as Loader, SafeDumper as Dumper + from yaml import SafeLoader as Loader class LogFile: """Reads LAMMPS log files and extracts the thermo information diff --git a/src/.gitignore b/src/.gitignore index 97e6590a2b..80b4baa0e5 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -254,6 +254,21 @@ /pair_mesont_tpm.cpp /pair_mesont_tpm.h +/atom_vec_bpm_sphere.cpp +/atom_vec_bpm_sphere.h +/bond_bpm.cpp +/bond_bpm.h +/bond_bpm_rotational.cpp +/bond_bpm_rotational.h +/bond_bpm_spring.cpp +/bond_bpm_spring.h +/compute_nbond_atom.cpp +/compute_nbond_atom.h +/fix_nve_bpm_sphere.cpp +/fix_nve_bpm_sphere.h +/pair_bpm_spring.cpp +/pair_bpm_spring.h + /compute_adf.cpp /compute_adf.h /compute_contact_atom.cpp @@ -438,6 +453,8 @@ /compute_basal_atom.h /compute_body_local.cpp /compute_body_local.h +/compute_born_matrix.cpp +/compute_born_matrix.h /compute_cnp_atom.cpp /compute_cnp_atom.h /compute_damage_atom.cpp @@ -792,8 +809,6 @@ /fix_orient_eco.h /fix_orient_fcc.cpp /fix_orient_fcc.h -/fix_pair_tracker.cpp -/fix_pair_tracker.h /fix_peri_neigh.cpp /fix_peri_neigh.h /fix_phonon.cpp @@ -1078,6 +1093,8 @@ /pair_hdnnp.h /pair_ilp_graphene_hbn.cpp /pair_ilp_graphene_hbn.h +/pair_ilp_graphene_hbn_opt.cpp +/pair_ilp_graphene_hbn_opt.h /pair_ilp_tmd.cpp /pair_ilp_tmd.h /pair_kolmogorov_crespi_full.cpp @@ -1524,3 +1541,4 @@ /pair_smtbq.h /pair_vashishta*.cpp /pair_vashishta*.h + diff --git a/src/ADIOS/dump_atom_adios.cpp b/src/ADIOS/dump_atom_adios.cpp index 7588b6775b..038a332ae5 100644 --- a/src/ADIOS/dump_atom_adios.cpp +++ b/src/ADIOS/dump_atom_adios.cpp @@ -134,10 +134,10 @@ void DumpAtomADIOS::write() // Now we know the global size and the local subset size and offset // of the atoms table - size_t nAtomsGlobal = static_cast(ntotal); - size_t startRow = static_cast(atomOffset); - size_t nAtomsLocal = static_cast(nme); - size_t nColumns = static_cast(size_one); + auto nAtomsGlobal = static_cast(ntotal); + auto startRow = static_cast(atomOffset); + auto nAtomsLocal = static_cast(nme); + auto nColumns = static_cast(size_one); internal->varAtoms.SetShape({nAtomsGlobal, nColumns}); internal->varAtoms.SetSelection({{startRow, 0}, {nAtomsLocal, nColumns}}); @@ -238,7 +238,7 @@ void DumpAtomADIOS::init_style() columnNames = {"id", "type", "xs", "ys", "zs", "ix", "iy", "iz"}; } - for (int icol = 0; icol < (int)columnNames.size(); ++icol) + for (int icol = 0; icol < (int) columnNames.size(); ++icol) if (keyword_user[icol].size()) columnNames[icol] = keyword_user[icol]; // setup function ptrs @@ -296,7 +296,7 @@ void DumpAtomADIOS::init_style() int *boundaryptr = reinterpret_cast(domain->boundary); internal->io.DefineAttribute("boundary", boundaryptr, 6); - size_t nColumns = static_cast(size_one); + auto nColumns = static_cast(size_one); internal->io.DefineAttribute("columns", columnNames.data(), nColumns); internal->io.DefineAttribute("columnstr", columns); internal->io.DefineAttribute("boundarystr", boundstr); diff --git a/src/ADIOS/dump_atom_adios.h b/src/ADIOS/dump_atom_adios.h index 850c4dbf8e..294a0d1519 100644 --- a/src/ADIOS/dump_atom_adios.h +++ b/src/ADIOS/dump_atom_adios.h @@ -44,17 +44,3 @@ class DumpAtomADIOS : public DumpAtom { #endif #endif - -/* ERROR/WARNING messages: - - E: Cannot open dump file %s - - The output file for the dump command cannot be opened. Check that the - path and name are correct. - - E: Too much per-proc info for dump - - Number of local atoms times number of columns must fit in a 32-bit - integer for dump. - - */ diff --git a/src/ADIOS/dump_custom_adios.cpp b/src/ADIOS/dump_custom_adios.cpp index 82cc4a9c0c..0ffe612f2c 100644 --- a/src/ADIOS/dump_custom_adios.cpp +++ b/src/ADIOS/dump_custom_adios.cpp @@ -146,10 +146,10 @@ void DumpCustomADIOS::write() // Now we know the global size and the local subset size and offset // of the atoms table - size_t nAtomsGlobal = static_cast(ntotal); - size_t startRow = static_cast(atomOffset); - size_t nAtomsLocal = static_cast(nme); - size_t nColumns = static_cast(size_one); + auto nAtomsGlobal = static_cast(ntotal); + auto startRow = static_cast(atomOffset); + auto nAtomsLocal = static_cast(nme); + auto nColumns = static_cast(size_one); internal->varAtoms.SetShape({nAtomsGlobal, nColumns}); internal->varAtoms.SetSelection({{startRow, 0}, {nAtomsLocal, nColumns}}); @@ -221,8 +221,10 @@ void DumpCustomADIOS::init_style() int icol = 0; for (auto item : utils::split_words(columns_default)) { if (combined.size()) combined += " "; - if (keyword_user[icol].size()) combined += keyword_user[icol]; - else combined += item; + if (keyword_user[icol].size()) + combined += keyword_user[icol]; + else + combined += item; ++icol; } columns = utils::strdup(combined); @@ -249,34 +251,30 @@ void DumpCustomADIOS::init_style() */ // find current ptr for each compute,fix,variable // check that fix frequency is acceptable - int icompute; for (int i = 0; i < ncompute; i++) { - icompute = modify->find_compute(id_compute[i]); - if (icompute < 0) error->all(FLERR, "Could not find dump custom compute ID"); - compute[i] = modify->compute[icompute]; + compute[i] = modify->get_compute_by_id(id_compute[i]); + if (!compute[i]) + error->all(FLERR, "Could not find dump custom/adios compute ID {}", id_compute[i]); } - int ifix; for (int i = 0; i < nfix; i++) { - ifix = modify->find_fix(id_fix[i]); - if (ifix < 0) error->all(FLERR, "Could not find dump custom fix ID"); - fix[i] = modify->fix[ifix]; - if (nevery % modify->fix[ifix]->peratom_freq) - error->all(FLERR, "Dump custom and fix not computed at compatible times"); + fix[i] = modify->get_fix_by_id(id_fix[i]); + if (!fix[i]) error->all(FLERR, "Could not find dump custom/adios fix ID {}", id_fix[i]); + if (nevery % fix[i]->peratom_freq) + error->all(FLERR, "dump custom/adios and fix {} with ID {} not computed at compatible times", + fix[i]->style, id_fix[i]); } int ivariable; for (int i = 0; i < nvariable; i++) { ivariable = input->variable->find(id_variable[i]); - if (ivariable < 0) error->all(FLERR, "Could not find dump custom variable name"); + if (ivariable < 0) error->all(FLERR, "Could not find dump custom/adios variable name"); variable[i] = ivariable; } // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) error->all(FLERR, "Region ID for dump custom does not exist"); - } + if (idregion && !domain->get_region_by_id(idregion)) + error->all(FLERR, "Region {} for dump custom/adios does not exist", idregion); /* Define the group of variables for the atom style here since it's a fixed * set */ @@ -316,7 +314,7 @@ void DumpCustomADIOS::init_style() int *boundaryptr = reinterpret_cast(domain->boundary); internal->io.DefineAttribute("boundary", boundaryptr, 6); - size_t nColumns = static_cast(size_one); + auto nColumns = static_cast(size_one); internal->io.DefineAttribute("columns", internal->columnNames.data(), nColumns); internal->io.DefineAttribute("columnstr", columns); internal->io.DefineAttribute("boundarystr", boundstr); diff --git a/src/ADIOS/dump_custom_adios.h b/src/ADIOS/dump_custom_adios.h index fde46a0754..b0232defed 100644 --- a/src/ADIOS/dump_custom_adios.h +++ b/src/ADIOS/dump_custom_adios.h @@ -43,43 +43,3 @@ class DumpCustomADIOS : public DumpCustom { #endif #endif - -/* ERROR/WARNING messages: - - E: Cannot open dump file %s - - The output file for the dump command cannot be opened. Check that the - path and name are correct. - - E: Too much per-proc info for dump - - Number of local atoms times number of columns must fit in a 32-bit - integer for dump. - - E: Dump_modify format string is too short - - There are more fields to be dumped in a line of output than your - format string specifies. - - E: Could not find dump custom compute ID - - Self-explanatory. - - E: Could not find dump custom fix ID - - Self-explanatory. - - E: Dump custom and fix not computed at compatible times - - The fix must produce per-atom quantities on timesteps that dump custom - needs them. - - E: Could not find dump custom variable name - - Self-explanatory. - - E: Region ID for dump custom does not exist - - Self-explanatory. - - */ diff --git a/src/ADIOS/reader_adios.cpp b/src/ADIOS/reader_adios.cpp index 6b017599f2..37179c1221 100644 --- a/src/ADIOS/reader_adios.cpp +++ b/src/ADIOS/reader_adios.cpp @@ -221,7 +221,7 @@ bigint ReaderADIOS::read_header(double box[3][3], int &boxinfo, int &triclinic, uint64_t rem = nAtomsTotal % comm->nprocs; nAtoms = nAtomsTotal / comm->nprocs; atomOffset = comm->me * nAtoms; - if (comm->me < (int)rem) { + if (comm->me < (int) rem) { ++nAtoms; atomOffset += comm->me; } else { @@ -421,7 +421,7 @@ void ReaderADIOS::read_atoms(int n, int nfield, double **fields) adios2::Variable varAtoms = internal->io.InquireVariable("atoms"); - if ((uint64_t)n != nAtoms) + if ((uint64_t) n != nAtoms) error->one(FLERR, "ReaderADIOS::read_atoms() expects 'n={}' equal to the number of " "atoms (={}) for process {} in ADIOS file {}.", @@ -450,7 +450,7 @@ void ReaderADIOS::read_atoms(int n, int nfield, double **fields) int ReaderADIOS::find_label(const std::string &label, const std::map &labels) { - std::map::const_iterator it = labels.find(label); + auto it = labels.find(label); if (it != labels.end()) { return it->second; } return -1; } diff --git a/src/ADIOS/reader_adios.h b/src/ADIOS/reader_adios.h index 06616d94fd..18748a8584 100644 --- a/src/ADIOS/reader_adios.h +++ b/src/ADIOS/reader_adios.h @@ -40,8 +40,8 @@ class ReaderADIOS : public Reader { int read_time(bigint &) override; void skip() override; - bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, - int &, int &, int &) override; + bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &, + int &, int &) override; void read_atoms(int, int, double **) override; void open_file(const std::string &) override; diff --git a/src/ASPHERE/compute_erotate_asphere.cpp b/src/ASPHERE/compute_erotate_asphere.cpp index d2118e60ca..192b5e5ed3 100644 --- a/src/ASPHERE/compute_erotate_asphere.cpp +++ b/src/ASPHERE/compute_erotate_asphere.cpp @@ -43,9 +43,9 @@ void ComputeERotateAsphere::init() { // error check - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_line = (AtomVecLine *) atom->style_match("line"); - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_line = dynamic_cast( atom->style_match("line")); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_ellipsoid && !avec_line && !avec_tri) error->all(FLERR,"Compute erotate/asphere requires " "atom style ellipsoid or line or tri"); diff --git a/src/ASPHERE/compute_erotate_asphere.h b/src/ASPHERE/compute_erotate_asphere.h index 895da694b2..c8ae5ca709 100644 --- a/src/ASPHERE/compute_erotate_asphere.h +++ b/src/ASPHERE/compute_erotate_asphere.h @@ -41,21 +41,3 @@ class ComputeERotateAsphere : public Compute { #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 erotate/asphere requires atom style ellipsoid or line or tri - -Self-explanatory. - -E: Compute erotate/asphere requires extended particles - -This compute cannot be used with point particles. - -*/ diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index abf0157f84..84581c63c1 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -94,7 +94,7 @@ void ComputeTempAsphere::init() { // error check - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Compute temp/asphere requires atom style ellipsoid"); diff --git a/src/ASPHERE/compute_temp_asphere.h b/src/ASPHERE/compute_temp_asphere.h index f479459728..8ac9cb1d00 100644 --- a/src/ASPHERE/compute_temp_asphere.h +++ b/src/ASPHERE/compute_temp_asphere.h @@ -52,43 +52,3 @@ class ComputeTempAsphere : public Compute { #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 temp/asphere requires atom style ellipsoid - -Self-explanatory. - -E: Compute temp/asphere requires extended particles - -This compute cannot be used with point particles. - -E: Could not find compute ID for temperature bias - -Self-explanatory. - -E: Bias compute does not calculate temperature - -The specified compute must compute temperature. - -E: Bias compute does not calculate a velocity bias - -The specified compute must compute a bias for temperature. - -E: Bias compute group does not match compute group - -The specified compute must operate on the same group as the parent -compute. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/ASPHERE/fix_nh_asphere.cpp b/src/ASPHERE/fix_nh_asphere.cpp index 357aee9696..11e11926e4 100644 --- a/src/ASPHERE/fix_nh_asphere.cpp +++ b/src/ASPHERE/fix_nh_asphere.cpp @@ -36,7 +36,7 @@ FixNHAsphere::FixNHAsphere(LAMMPS *lmp, int narg, char **arg) : void FixNHAsphere::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR, "Compute nvt/nph/npt asphere requires atom style ellipsoid"); diff --git a/src/ASPHERE/fix_nh_asphere.h b/src/ASPHERE/fix_nh_asphere.h index 89e9d7d96e..5cc49c4cc2 100644 --- a/src/ASPHERE/fix_nh_asphere.h +++ b/src/ASPHERE/fix_nh_asphere.h @@ -35,16 +35,3 @@ class FixNHAsphere : public FixNH { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Compute nvt/nph/npt asphere requires atom style ellipsoid - -Self-explanatory. - -E: Fix nvt/nph/npt asphere requires extended particles - -The shape setting for a particle in the fix group has shape = 0.0, -which means it is a point particle. - -*/ diff --git a/src/ASPHERE/fix_nph_asphere.h b/src/ASPHERE/fix_nph_asphere.h index db1d085384..52b2cdd879 100644 --- a/src/ASPHERE/fix_nph_asphere.h +++ b/src/ASPHERE/fix_nph_asphere.h @@ -33,15 +33,3 @@ class FixNPHAsphere : public FixNHAsphere { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph/asphere - -Self-explanatory. - -E: Pressure control must be used with fix nph/asphere - -Self-explanatory. - -*/ diff --git a/src/ASPHERE/fix_npt_asphere.h b/src/ASPHERE/fix_npt_asphere.h index c0b54a3d82..ccaa9c0313 100644 --- a/src/ASPHERE/fix_npt_asphere.h +++ b/src/ASPHERE/fix_npt_asphere.h @@ -33,15 +33,3 @@ class FixNPTAsphere : public FixNHAsphere { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt/asphere - -Self-explanatory. - -E: Pressure control must be used with fix npt/asphere - -Self-explanatory. - -*/ diff --git a/src/ASPHERE/fix_nve_asphere.cpp b/src/ASPHERE/fix_nve_asphere.cpp index cd70cce871..ee8c8d3b6e 100644 --- a/src/ASPHERE/fix_nve_asphere.cpp +++ b/src/ASPHERE/fix_nve_asphere.cpp @@ -37,7 +37,7 @@ FixNVEAsphere::FixNVEAsphere(LAMMPS *lmp, int narg, char **arg) : void FixNVEAsphere::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Compute nve/asphere requires atom style ellipsoid"); diff --git a/src/ASPHERE/fix_nve_asphere.h b/src/ASPHERE/fix_nve_asphere.h index 8adfbac010..78c49fa2c7 100644 --- a/src/ASPHERE/fix_nve_asphere.h +++ b/src/ASPHERE/fix_nve_asphere.h @@ -39,15 +39,3 @@ class FixNVEAsphere : public FixNVE { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Compute nve/asphere requires atom style ellipsoid - -Self-explanatory. - -E: Fix nve/asphere requires extended particles - -This fix can only be used for particles with a shape setting. - -*/ diff --git a/src/ASPHERE/fix_nve_asphere_noforce.cpp b/src/ASPHERE/fix_nve_asphere_noforce.cpp index 7a489989f1..799df8115a 100644 --- a/src/ASPHERE/fix_nve_asphere_noforce.cpp +++ b/src/ASPHERE/fix_nve_asphere_noforce.cpp @@ -37,7 +37,7 @@ void FixNVEAsphereNoforce::init() { // error check - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!atom->ellipsoid_flag) error->all(FLERR,"Fix nve/asphere/noforce requires atom style ellipsoid"); diff --git a/src/ASPHERE/fix_nve_asphere_noforce.h b/src/ASPHERE/fix_nve_asphere_noforce.h index 0467d443c0..b46ed400f0 100644 --- a/src/ASPHERE/fix_nve_asphere_noforce.h +++ b/src/ASPHERE/fix_nve_asphere_noforce.h @@ -39,21 +39,3 @@ class FixNVEAsphereNoforce : public FixNVENoforce { #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: Fix nve/asphere/noforce requires atom style ellipsoid - -Self-explanatory. - -E: Fix nve/asphere/noforce requires extended particles - -One of the particles is not an ellipsoid. - -*/ diff --git a/src/ASPHERE/fix_nve_line.cpp b/src/ASPHERE/fix_nve_line.cpp index da64444b4f..a46f6cf67b 100644 --- a/src/ASPHERE/fix_nve_line.cpp +++ b/src/ASPHERE/fix_nve_line.cpp @@ -56,7 +56,7 @@ void FixNVELine::init() { // error checks - avec = (AtomVecLine *) atom->style_match("line"); + avec = dynamic_cast( atom->style_match("line")); if (!avec) error->all(FLERR,"Fix nve/line requires atom style line"); if (domain->dimension != 2) diff --git a/src/ASPHERE/fix_nve_line.h b/src/ASPHERE/fix_nve_line.h index d5076dea51..40b18e5ab1 100644 --- a/src/ASPHERE/fix_nve_line.h +++ b/src/ASPHERE/fix_nve_line.h @@ -41,25 +41,3 @@ class FixNVELine : public FixNVE { #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: Fix nve/line requires atom style line - -Self-explanatory. - -E: Fix nve/line can only be used for 2d simulations - -Self-explanatory. - -E: Fix nve/line requires line particles - -Self-explanatory. - -*/ diff --git a/src/ASPHERE/fix_nve_tri.cpp b/src/ASPHERE/fix_nve_tri.cpp index 72287a1807..d41d3ee0ef 100644 --- a/src/ASPHERE/fix_nve_tri.cpp +++ b/src/ASPHERE/fix_nve_tri.cpp @@ -50,7 +50,7 @@ void FixNVETri::init() { // error checks - avec = (AtomVecTri *) atom->style_match("tri"); + avec = dynamic_cast( atom->style_match("tri")); if (!avec) error->all(FLERR,"Fix nve/tri requires atom style tri"); if (domain->dimension != 3) diff --git a/src/ASPHERE/fix_nve_tri.h b/src/ASPHERE/fix_nve_tri.h index daba41b538..b1e91d712c 100644 --- a/src/ASPHERE/fix_nve_tri.h +++ b/src/ASPHERE/fix_nve_tri.h @@ -41,25 +41,3 @@ class FixNVETri : public FixNVE { #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: Fix nve/tri requires atom style tri - -Self-explanatory. - -E: Fix nve/tri can only be used for 3d simulations - -Self-explanatory. - -E: Fix nve/tri requires tri particles - -Self-explanatory. - -*/ diff --git a/src/ASPHERE/fix_nvt_asphere.h b/src/ASPHERE/fix_nvt_asphere.h index cd6c3f8d63..78c9e0a156 100644 --- a/src/ASPHERE/fix_nvt_asphere.h +++ b/src/ASPHERE/fix_nvt_asphere.h @@ -33,15 +33,3 @@ class FixNVTAsphere : public FixNHAsphere { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/asphere - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/asphere - -Self-explanatory. - -*/ diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index d1770894e2..04fa5330f9 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -345,7 +345,7 @@ void PairGayBerne::coeff(int narg, char **arg) void PairGayBerne::init_style() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Pair gayberne requires atom style ellipsoid"); neighbor->add_request(this,NeighConst::REQ_DEFAULT); diff --git a/src/ASPHERE/pair_gayberne.h b/src/ASPHERE/pair_gayberne.h index a4bc07587f..d8975e6ad0 100644 --- a/src/ASPHERE/pair_gayberne.h +++ b/src/ASPHERE/pair_gayberne.h @@ -72,34 +72,3 @@ class PairGayBerne : public Pair { } // namespace LAMMPS_NS #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair gayberne requires atom style ellipsoid - -Self-explanatory. - -E: Pair gayberne requires atoms with same type have same shape - -Self-explanatory. - -E: Pair gayberne epsilon a,b,c coeffs are not all set - -Each atom type involved in pair_style gayberne must -have these 3 coefficients set at least once. - -E: Bad matrix inversion in mldivide3 - -This error should not occur unless the matrix is badly formed. - -*/ diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index a543bac09b..ab1b81ca73 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -402,7 +402,7 @@ void PairLineLJ::coeff(int narg, char **arg) void PairLineLJ::init_style() { - avec = (AtomVecLine *) atom->style_match("line"); + avec = dynamic_cast( atom->style_match("line")); if (!avec) error->all(FLERR,"Pair line/lj requires atom style line"); neighbor->add_request(this,NeighConst::REQ_DEFAULT); diff --git a/src/ASPHERE/pair_line_lj.h b/src/ASPHERE/pair_line_lj.h index c76d601b2f..064e2520c6 100644 --- a/src/ASPHERE/pair_line_lj.h +++ b/src/ASPHERE/pair_line_lj.h @@ -62,26 +62,3 @@ class PairLineLJ : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair line/lj requires atom style line - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index 3dfe09d801..473489632a 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -317,10 +317,10 @@ void PairRESquared::coeff(int narg, char **arg) void PairRESquared::init_style() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); if (!avec) error->all(FLERR, "Pair resquared requires atom style ellipsoid"); - neighbor->add_request(this,NeighConst::REQ_DEFAULT); + neighbor->add_request(this, NeighConst::REQ_DEFAULT); // per-type shape precalculations // require that atom shapes are identical within each type diff --git a/src/ASPHERE/pair_resquared.h b/src/ASPHERE/pair_resquared.h index 3f09ca50d8..4fd3312001 100644 --- a/src/ASPHERE/pair_resquared.h +++ b/src/ASPHERE/pair_resquared.h @@ -92,37 +92,3 @@ class PairRESquared : public Pair { } // namespace LAMMPS_NS #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair resquared requires atom style ellipsoid - -Self-explanatory. - -E: Pair resquared requires atoms with same type have same shape - -Self-explanatory. - -E: Pair resquared epsilon a,b,c coeffs are not all set - -Self-explanatory. - -E: Pair resquared epsilon and sigma coeffs are not all set - -Self-explanatory. - -E: Bad matrix inversion in mldivide3 - -This error should not occur unless the matrix is badly formed. - -*/ diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index 0cb08c41b3..eaec71b055 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -467,7 +467,7 @@ void PairTriLJ::coeff(int narg, char **arg) void PairTriLJ::init_style() { - avec = (AtomVecTri *) atom->style_match("tri"); + avec = dynamic_cast( atom->style_match("tri")); if (!avec) error->all(FLERR,"Pair tri/lj requires atom style tri"); neighbor->add_request(this,NeighConst::REQ_DEFAULT); diff --git a/src/ASPHERE/pair_tri_lj.h b/src/ASPHERE/pair_tri_lj.h index 918a90916e..aaf0d4e7ae 100644 --- a/src/ASPHERE/pair_tri_lj.h +++ b/src/ASPHERE/pair_tri_lj.h @@ -60,21 +60,3 @@ class PairTriLJ : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair tri/lj requires atom style tri - -Self-explanatory. - -*/ diff --git a/src/AWPMD/atom_vec_wavepacket.cpp b/src/AWPMD/atom_vec_wavepacket.cpp index c339e8343f..59a503571e 100644 --- a/src/AWPMD/atom_vec_wavepacket.cpp +++ b/src/AWPMD/atom_vec_wavepacket.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -20,8 +19,6 @@ #include "atom.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -32,33 +29,29 @@ AtomVecWavepacket::AtomVecWavepacket(LAMMPS *lmp) : AtomVec(lmp) molecular = Atom::ATOMIC; forceclearflag = 1; - atom->wavepacket_flag = 1; - atom->electron_flag = 1; // compatible with eff - atom->q_flag = atom->spin_flag = atom->eradius_flag = - atom->ervel_flag = atom->erforce_flag = 1; - atom->cs_flag = atom->csforce_flag = - atom->vforce_flag = atom->ervelforce_flag = atom->etag_flag = 1; + atom->wavepacket_flag = atom->q_flag = atom->spin_flag = atom->eradius_flag = 1; + atom->ervel_flag = atom->erforce_flag = atom->cs_flag = atom->csforce_flag = 1; + atom->vforce_flag = atom->ervelforce_flag = atom->etag_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "q spin eradius ervel erforce cs csforce " - "vforce ervelforce etag"; - fields_copy = (char *) "q spin eradius ervel cs etag"; - fields_comm = (char *) "eradius"; - fields_comm_vel = (char *) "eradius ervel cs"; - fields_reverse = (char *) "erforce ervelforce vforce csforce"; - fields_border = (char *) "q spin eradius etag"; - fields_border_vel = (char *) "q spin eradius etag ervel cs"; - fields_exchange = (char *) "q spin eradius ervel etag cs"; - fields_restart = (char *) "q spin eradius ervel etag cs"; - fields_create = (char *) "q spin eradius ervel etag cs"; - fields_data_atom = (char *) "id type q spin eradius etag cs x"; - fields_data_vel = (char *) "id v ervel"; + fields_grow = {"q", "spin", "eradius", "ervel", "erforce", + "cs", "csforce", "vforce", "ervelforce", "etag"}; + fields_copy = {"q", "spin", "eradius", "ervel", "cs", "etag"}; + fields_comm = {"eradius"}; + fields_comm_vel = {"eradius", "ervel", "cs"}; + fields_reverse = {"erforce", "ervelforce", "vforce", "csforce"}; + fields_border = {"q", "spin", "eradius", "etag"}; + fields_border_vel = {"q", "spin", "eradius", "etag", "ervel", "cs"}; + fields_exchange = {"q", "spin", "eradius", "ervel", "etag", "cs"}; + fields_restart = {"q", "spin", "eradius", "ervel", "etag", "cs"}; + fields_create = {"q", "spin", "eradius", "ervel", "etag", "cs"}; + fields_data_atom = {"id", "type", "q", "spin", "eradius", "etag", "cs", "x"}; + fields_data_vel = {"id", "v", "ervel"}; setup_fields(); } @@ -84,7 +77,7 @@ void AtomVecWavepacket::grow_pointers() void AtomVecWavepacket::force_clear(int n, size_t nbytes) { - memset(&erforce[n],0,nbytes); + memset(&erforce[n], 0, nbytes); } /* ---------------------------------------------------------------------- @@ -112,12 +105,12 @@ void AtomVecWavepacket::data_atom_post(int ilocal) return -1 if name is unknown to this atom style ------------------------------------------------------------------------- */ -int AtomVecWavepacket::property_atom(char *name) +int AtomVecWavepacket::property_atom(const std::string &name) { - if (strcmp(name,"spin") == 0) return 0; - if (strcmp(name,"eradius") == 0) return 1; - if (strcmp(name,"ervel") == 0) return 2; - if (strcmp(name,"erforce") == 0) return 3; + if (name == "spin") return 0; + if (name == "eradius") return 1; + if (name == "ervel") return 2; + if (name == "erforce") return 3; return -1; } @@ -126,34 +119,41 @@ int AtomVecWavepacket::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecWavepacket::pack_property_atom(int index, double *buf, - int nvalues, int groupbit) +void AtomVecWavepacket::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int nlocal = atom->nlocal; int n = 0; if (index == 0) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = spin[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = spin[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 1) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = eradius[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = eradius[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 2) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = ervel[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = ervel[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 3) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = erforce[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = erforce[i]; + else + buf[n] = 0.0; n += nvalues; } } diff --git a/src/AWPMD/atom_vec_wavepacket.h b/src/AWPMD/atom_vec_wavepacket.h index 0a23e23019..9ceaadbb5a 100644 --- a/src/AWPMD/atom_vec_wavepacket.h +++ b/src/AWPMD/atom_vec_wavepacket.h @@ -32,7 +32,7 @@ class AtomVecWavepacket : public AtomVec { void force_clear(int, size_t) override; void create_atom_post(int) override; void data_atom_post(int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; private: diff --git a/src/AWPMD/fix_nve_awpmd.cpp b/src/AWPMD/fix_nve_awpmd.cpp index 812b573826..c37feb2ede 100644 --- a/src/AWPMD/fix_nve_awpmd.cpp +++ b/src/AWPMD/fix_nve_awpmd.cpp @@ -61,9 +61,9 @@ void FixNVEAwpmd::init() dtf = 0.5 * update->dt * force->ftm2v; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; - awpmd_pair=(PairAWPMDCut *)force->pair; + awpmd_pair=dynamic_cast(force->pair); awpmd_pair->wpmd->norm_needed=1; } diff --git a/src/AWPMD/pair_awpmd_cut.cpp b/src/AWPMD/pair_awpmd_cut.cpp index 0c95801421..fcce6006fd 100644 --- a/src/AWPMD/pair_awpmd_cut.cpp +++ b/src/AWPMD/pair_awpmd_cut.cpp @@ -95,10 +95,7 @@ struct cmp_x{ else if (d>tol) return false; d=xx[left.second][2]-xx[right.second][2]; - if (d<-tol) - return true; - else - return false; + return d < -tol; } else return left.firstnfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2]) || (p_flag[3] && dimflag[3]) || (p_flag[4] && dimflag[4]) || (p_flag[5] && dimflag[5])) @@ -523,12 +523,12 @@ void FixBocs::init() { if (p_basis_type == BASIS_ANALYTIC) { - ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, + (dynamic_cast(pressure))->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg); } else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE) { - ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, + (dynamic_cast(pressure))->send_cg_info(p_basis_type, splines, spline_length); } } @@ -589,8 +589,8 @@ void FixBocs::init() else kspace_flag = 0; if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - step_respa = ((Respa *) update->integrate)->step; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; dto = 0.5*step_respa[0]; } @@ -1452,7 +1452,7 @@ int FixBocs::pack_restart_data(double *list) void FixBocs::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); @@ -1551,12 +1551,12 @@ int FixBocs::modify_param(int narg, char **arg) { if (p_basis_type == BASIS_ANALYTIC) { - ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, N_p_match, + (dynamic_cast(pressure))->send_cg_info(p_basis_type, N_p_match, p_match_coeffs, N_mol, vavg); } else if (p_basis_type == BASIS_LINEAR_SPLINE || p_basis_type == BASIS_CUBIC_SPLINE ) { - ((ComputePressureBocs *)pressure)->send_cg_info(p_basis_type, splines, spline_length ); + (dynamic_cast(pressure))->send_cg_info(p_basis_type, splines, spline_length ); } } diff --git a/src/BOCS/fix_bocs.h b/src/BOCS/fix_bocs.h index ee5c70e432..5419506fd3 100644 --- a/src/BOCS/fix_bocs.h +++ b/src/BOCS/fix_bocs.h @@ -30,7 +30,7 @@ namespace LAMMPS_NS { class FixBocs : public Fix { public: FixBocs(class LAMMPS *, int, char **); // MRD NJD - ~FixBocs() override; // MRD NJD + ~FixBocs() override; // MRD NJD int setmask() override; void init() override; void setup(int) override; @@ -169,136 +169,3 @@ class FixBocs : public Fix { #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: 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. - -E: Invalid fix bocs command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix bocs dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix bocs command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix bocs on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix bocs on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix bocs with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix bocs with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix bocs with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix bocs with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix bocs with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix bocs with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix bocs with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix bocs pressure settings - -Settings for coupled dimensions must be the same. - -E: Using update dipole flag requires atom style sphere - -Self-explanatory. - -E: Using update dipole flag requires atom attribute mu - -Self-explanatory. - -E: The dlm flag must be used with update dipole - -Self-explanatory. - -E: Fix bocs damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix npt and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix bocs does not exist - -Self-explanatory. - -E: Pressure ID for fix bocs does not exist - -Self-explanatory. - -E: Fix bocs has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/BODY/body_nparticle.h b/src/BODY/body_nparticle.h index 24db6a68bb..3e814543c4 100644 --- a/src/BODY/body_nparticle.h +++ b/src/BODY/body_nparticle.h @@ -53,27 +53,3 @@ class BodyNparticle : public Body { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid body nparticle command - -Arguments in atom-style command are not correct. - -E: Incorrect # of integer values in Bodies section of data file - -See doc page for body style. - -E: Incorrect integer value in Bodies section of data file - -See doc page for body style. - -E: Incorrect # of floating-point values in Bodies section of data file - -See doc page for body style. - -E: Insufficient Jacobi rotations for body nparticle - -Eigensolve for rigid body was not sufficiently accurate. - -*/ diff --git a/src/BODY/body_rounded_polygon.h b/src/BODY/body_rounded_polygon.h index 284965c466..c6b1cd134f 100644 --- a/src/BODY/body_rounded_polygon.h +++ b/src/BODY/body_rounded_polygon.h @@ -57,32 +57,3 @@ class BodyRoundedPolygon : public Body { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid body rounded/polygon command - -Arguments in atom-style command are not correct. - -E: Invalid format in Bodies section of data file - -The specified number of integer or floating point values does not -appear. - -E: Incorrect # of integer values in Bodies section of data file - -See doc page for body style. - -E: Incorrect integer value in Bodies section of data file - -See doc page for body style. - -E: Incorrect # of floating-point values in Bodies section of data file - -See doc page for body style. - -E: Insufficient Jacobi rotations for body nparticle - -Eigensolve for rigid body was not sufficiently accurate. - -*/ diff --git a/src/BODY/body_rounded_polyhedron.h b/src/BODY/body_rounded_polyhedron.h index 56392391fa..f49bce9574 100644 --- a/src/BODY/body_rounded_polyhedron.h +++ b/src/BODY/body_rounded_polyhedron.h @@ -59,32 +59,3 @@ class BodyRoundedPolyhedron : public Body { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid body rounded/polyhedron command - -Arguments in atom-style command are not correct. - -E: Invalid format in Bodies section of data file - -The specified number of integer or floating point values does not -appear. - -E: Incorrect # of integer values in Bodies section of data file - -See doc page for body style. - -E: Incorrect integer value in Bodies section of data file - -See doc page for body style. - -E: Incorrect # of floating-point values in Bodies section of data file - -See doc page for body style. - -E: Insufficient Jacobi rotations for body rounded/polyhedron - -Eigensolve for rigid body was not sufficiently accurate. - -*/ diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index d8837fa1ea..7d48b0770f 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -53,7 +53,7 @@ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : } } - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Compute body/local requires atom style body"); bptr = avec->bptr; @@ -153,7 +153,7 @@ int ComputeBodyLocal::compute_body(int flag) // perform computation and fill output vector/array int m,n,ibonus; - double *values = new double[bptr->noutcol()]; + auto values = new double[bptr->noutcol()]; double **x = atom->x; tagint *tag = atom->tag; diff --git a/src/BODY/compute_body_local.h b/src/BODY/compute_body_local.h index 824d562637..7462d5cedd 100644 --- a/src/BODY/compute_body_local.h +++ b/src/BODY/compute_body_local.h @@ -49,25 +49,3 @@ class ComputeBodyLocal : public Compute { #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 body/local requires atom style body - -Self-explanatory. - -E: Invalid index in compute body/local command - -Self-explanatory. - -E: Invalid index for non-body particles in compute body/local command - -Only indices 1,2,3 can be used for non-body particles. - -*/ diff --git a/src/BODY/compute_temp_body.cpp b/src/BODY/compute_temp_body.cpp index d8dfc0d279..3f97c2c82f 100644 --- a/src/BODY/compute_temp_body.cpp +++ b/src/BODY/compute_temp_body.cpp @@ -87,7 +87,7 @@ void ComputeTempBody::init() { // error check - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Compute temp/body requires atom style body"); diff --git a/src/BODY/compute_temp_body.h b/src/BODY/compute_temp_body.h index 5e6275ae12..df64211174 100644 --- a/src/BODY/compute_temp_body.h +++ b/src/BODY/compute_temp_body.h @@ -50,43 +50,3 @@ class ComputeTempBody : public Compute { #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 temp/body requires atom style body - -Self-explanatory. - -E: Compute temp/body requires bodies - -This compute can only be applied to body particles. - -E: Could not find compute ID for temperature bias - -Self-explanatory. - -E: Bias compute does not calculate temperature - -The specified compute must compute temperature. - -E: Bias compute does not calculate a velocity bias - -The specified compute must compute a bias for temperature. - -E: Bias compute group does not match compute group - -The specified compute must operate on the same group as the parent -compute. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/BODY/fix_nh_body.cpp b/src/BODY/fix_nh_body.cpp index e9339400cc..ba46bce2ac 100644 --- a/src/BODY/fix_nh_body.cpp +++ b/src/BODY/fix_nh_body.cpp @@ -37,7 +37,7 @@ FixNHBody::FixNHBody(LAMMPS *lmp, int narg, char **arg) : void FixNHBody::init() { - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR, "Compute nvt/nph/npt body requires atom style body"); diff --git a/src/BODY/fix_nh_body.h b/src/BODY/fix_nh_body.h index 899a12c3d6..e442d47097 100644 --- a/src/BODY/fix_nh_body.h +++ b/src/BODY/fix_nh_body.h @@ -35,15 +35,3 @@ class FixNHBody : public FixNH { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Compute nvt/nph/npt body requires atom style body - -Self-explanatory. - -E: Fix nvt/nph/npt body requires bodies - -Self-explanatory. - -*/ diff --git a/src/BODY/fix_nph_body.h b/src/BODY/fix_nph_body.h index 38247e93cb..6bc734a43d 100644 --- a/src/BODY/fix_nph_body.h +++ b/src/BODY/fix_nph_body.h @@ -33,15 +33,3 @@ class FixNPHBody : public FixNHBody { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph/body - -Self-explanatory. - -E: Pressure control must be used with fix nph/body - -Self-explanatory. - -*/ diff --git a/src/BODY/fix_npt_body.h b/src/BODY/fix_npt_body.h index 5fe0c45994..1e977fb688 100644 --- a/src/BODY/fix_npt_body.h +++ b/src/BODY/fix_npt_body.h @@ -33,15 +33,3 @@ class FixNPTBody : public FixNHBody { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt/body - -Self-explanatory. - -E: Pressure control must be used with fix npt/body - -Self-explanatory. - -*/ diff --git a/src/BODY/fix_nve_body.cpp b/src/BODY/fix_nve_body.cpp index c00356f037..f731bed81e 100644 --- a/src/BODY/fix_nve_body.cpp +++ b/src/BODY/fix_nve_body.cpp @@ -30,7 +30,7 @@ FixNVEBody::FixNVEBody(LAMMPS *lmp, int narg, char **arg) : void FixNVEBody::init() { - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Fix nve/body requires atom style body"); // check that all particles are bodies diff --git a/src/BODY/fix_nve_body.h b/src/BODY/fix_nve_body.h index c0ea6d8f7d..c37f6218cd 100644 --- a/src/BODY/fix_nve_body.h +++ b/src/BODY/fix_nve_body.h @@ -39,15 +39,3 @@ class FixNVEBody : public FixNVE { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Fix nve/body requires atom style body - -Self-explanatory. - -E: Fix nve/body requires bodies - -This fix can only be used for particles that are bodies. - -*/ diff --git a/src/BODY/fix_nvt_body.h b/src/BODY/fix_nvt_body.h index 19a75dfd2a..fbed640a6f 100644 --- a/src/BODY/fix_nvt_body.h +++ b/src/BODY/fix_nvt_body.h @@ -33,15 +33,3 @@ class FixNVTBody : public FixNHBody { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/body - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/body - -Self-explanatory. - -*/ diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index e4d25e8489..47467f9d42 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -179,13 +179,13 @@ void FixWallBodyPolygon::init() { dt = update->dt; - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Pair body/rounded/polygon requires atom style body"); if (strcmp(avec->bptr->style,"rounded/polygon") != 0) error->all(FLERR,"Pair body/rounded/polygon requires " "body style rounded/polygon"); - bptr = (BodyRoundedPolygon *) avec->bptr; + bptr = dynamic_cast( avec->bptr); // set pairstyle from body/polygonular pair style diff --git a/src/BODY/fix_wall_body_polygon.h b/src/BODY/fix_wall_body_polygon.h index caf57b45bf..971fdcfe1b 100644 --- a/src/BODY/fix_wall_body_polygon.h +++ b/src/BODY/fix_wall_body_polygon.h @@ -93,34 +93,3 @@ class FixWallBodyPolygon : public Fix { #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: Fix wall/body/polygon requires atom style body rounded/polygon - -Self-explanatory. - -E: Cannot use wall in periodic dimension - -Self-explanatory. - -E: Cannot wiggle and shear fix wall/body/polygon - -Cannot specify both options at the same time. - -E: Invalid wiggle direction for fix wall/body/polygon - -Self-explanatory. - -E: Fix wall/body/polygon is incompatible with Pair style - -Must use a body pair style to define the parameters needed for -this fix. - -*/ diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 522860b469..2e503640d8 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -184,13 +184,13 @@ void FixWallBodyPolyhedron::init() { dt = update->dt; - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Pair body/rounded/polyhedron requires atom style body"); if (strcmp(avec->bptr->style,"rounded/polyhedron") != 0) error->all(FLERR,"Pair body/rounded/polyhedron requires " "body style rounded/polyhedron"); - bptr = (BodyRoundedPolyhedron *) avec->bptr; + bptr = dynamic_cast( avec->bptr); // set pairstyle from body/polyhedronular pair style diff --git a/src/BODY/fix_wall_body_polyhedron.h b/src/BODY/fix_wall_body_polyhedron.h index c931f963d2..9125820fcd 100644 --- a/src/BODY/fix_wall_body_polyhedron.h +++ b/src/BODY/fix_wall_body_polyhedron.h @@ -104,34 +104,3 @@ class FixWallBodyPolyhedron : public Fix { #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: Fix wall/body/polyhedron requires atom style body rounded/polyhedron - -Self-explanatory. - -E: Cannot use wall in periodic dimension - -Self-explanatory. - -E: Cannot wiggle and shear fix wall/body/polygon - -Cannot specify both options at the same time. - -E: Invalid wiggle direction for fix wall/body/polygon - -Self-explanatory. - -E: Fix wall/body/polygon is incompatible with Pair style - -Must use a body pair style to define the parameters needed for -this fix. - -*/ diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index e893350c3e..df2c6c1d23 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -416,11 +416,11 @@ void PairBodyNparticle::coeff(int narg, char **arg) void PairBodyNparticle::init_style() { - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Pair body/nparticle requires atom style body"); if (strcmp(avec->bptr->style,"nparticle") != 0) error->all(FLERR,"Pair body/nparticle requires body style nparticle"); - bptr = (BodyNparticle *) avec->bptr; + bptr = dynamic_cast( avec->bptr); neighbor->add_request(this); } diff --git a/src/BODY/pair_body_nparticle.h b/src/BODY/pair_body_nparticle.h index 1f3d706201..419028e49c 100644 --- a/src/BODY/pair_body_nparticle.h +++ b/src/BODY/pair_body_nparticle.h @@ -58,25 +58,3 @@ class PairBodyNparticle : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair body requires atom style body - -Self-explanatory. - -E: Pair body requires body style nparticle - -This pair style is specific to the nparticle body style. - -*/ diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index aa3a86a821..7485cf4b9c 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -411,13 +411,13 @@ void PairBodyRoundedPolygon::coeff(int narg, char **arg) void PairBodyRoundedPolygon::init_style() { - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Pair body/rounded/polygon requires atom style body"); if (strcmp(avec->bptr->style,"rounded/polygon") != 0) error->all(FLERR,"Pair body/rounded/polygon requires " "body style rounded/polygon"); - bptr = (BodyRoundedPolygon *) avec->bptr; + bptr = dynamic_cast( avec->bptr); if (force->newton_pair == 0) error->all(FLERR,"Pair style body/rounded/polygon requires " diff --git a/src/BODY/pair_body_rounded_polygon.h b/src/BODY/pair_body_rounded_polygon.h index adce835f20..06b5c6b3f2 100644 --- a/src/BODY/pair_body_rounded_polygon.h +++ b/src/BODY/pair_body_rounded_polygon.h @@ -108,25 +108,3 @@ class PairBodyRoundedPolygon : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair body/rounded/polygon requires atom style body rounded/polygon - -Self-explanatory. - -E: Pair body requires body style rounded/polygon - -This pair style is specific to the rounded/polygon body style. - -*/ diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index 8136e82fd8..a9593b5fa2 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -390,13 +390,13 @@ void PairBodyRoundedPolyhedron::coeff(int narg, char **arg) void PairBodyRoundedPolyhedron::init_style() { - avec = (AtomVecBody *) atom->style_match("body"); + avec = dynamic_cast( atom->style_match("body")); if (!avec) error->all(FLERR,"Pair body/rounded/polyhedron requires " "atom style body"); if (strcmp(avec->bptr->style,"rounded/polyhedron") != 0) error->all(FLERR,"Pair body/rounded/polyhedron requires " "body style rounded/polyhedron"); - bptr = (BodyRoundedPolyhedron *) avec->bptr; + bptr = dynamic_cast( avec->bptr); if (force->newton_pair == 0) error->all(FLERR,"Pair style body/rounded/polyhedron requires " diff --git a/src/BODY/pair_body_rounded_polyhedron.h b/src/BODY/pair_body_rounded_polyhedron.h index 457583b9b1..a137ebd4fa 100644 --- a/src/BODY/pair_body_rounded_polyhedron.h +++ b/src/BODY/pair_body_rounded_polyhedron.h @@ -162,25 +162,3 @@ class PairBodyRoundedPolyhedron : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair body/rounded/polyhedron requires atom style body rounded/polyhedron - -Self-explanatory. - -E: Pair body requires body style rounded/polyhedron - -This pair style is specific to the rounded/polyhedron body style. - -*/ diff --git a/src/BPM/atom_vec_bpm_sphere.cpp b/src/BPM/atom_vec_bpm_sphere.cpp new file mode 100644 index 0000000000..460377db6b --- /dev/null +++ b/src/BPM/atom_vec_bpm_sphere.cpp @@ -0,0 +1,248 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "atom_vec_bpm_sphere.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "fix.h" +#include "fix_adapt.h" +#include "math_const.h" +#include "modify.h" +#include "utils.h" + +#include + +using namespace LAMMPS_NS; +using MathConst::MY_PI; + +/* ---------------------------------------------------------------------- */ + +AtomVecBPMSphere::AtomVecBPMSphere(LAMMPS *_lmp) : AtomVec(_lmp) +{ + mass_type = PER_ATOM; + molecular = Atom::MOLECULAR; + bonds_allow = 1; + + atom->molecule_flag = 1; + atom->sphere_flag = 1; + atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = atom->quat_flag = 1; + + // strings with peratom variables to include in each AtomVec method + // strings cannot contain fields in corresponding AtomVec default strings + // order of fields in a string does not matter + // except: fields_data_atom & fields_data_vel must match data file + + fields_grow = {"molecule", "num_bond", "bond_type", "bond_atom", "nspecial", "special", + "radius", "rmass", "omega", "torque", "quat"}; + fields_copy = {"molecule", "num_bond", "bond_type", "bond_atom", "nspecial", + "special", "radius", "rmass", "omega", "quat"}; + fields_comm_vel = {"omega", "quat"}; + fields_reverse = {"torque"}; + fields_border = {"molecule", "radius", "rmass"}; + fields_border_vel = {"molecule", "radius", "rmass", "omega", "quat"}; + fields_exchange = {"molecule", "num_bond", "bond_type", "bond_atom", "nspecial", + "special", "radius", "rmass", "omega", "quat"}; + fields_restart = {"molecule", "num_bond", "bond_type", "bond_atom", + "radius", "rmass", "omega", "quat"}; + fields_create = {"molecule", "num_bond", "nspecial", "radius", "rmass", "omega", "quat"}; + fields_data_atom = {"id", "molecule", "type", "radius", "rmass", "x"}; + fields_data_vel = {"id", "v", "omega"}; + + bond_per_atom = 0; + bond_negative = NULL; +} + +/* ---------------------------------------------------------------------- + process sub-style args + optional arg = 0/1 for static/dynamic particle radii +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::process_args(int narg, char **arg) +{ + if (narg != 0 && narg != 1) error->all(FLERR, "Illegal atom_style bpm/sphere command"); + + radvary = 0; + if (narg == 1) { + radvary = utils::numeric(FLERR, arg[0], true, lmp); + if (radvary < 0 || radvary > 1) error->all(FLERR, "Illegal atom_style bpm/sphere command"); + } + + // dynamic particle radius and mass must be communicated every step + + if (radvary) { + fields_comm = {"radius", "rmass"}; + fields_comm_vel = {"radius", "rmass", "omega"}; + } + + // delay setting up of fields until now + + setup_fields(); +} + +/* ---------------------------------------------------------------------- */ + +void AtomVecBPMSphere::init() +{ + AtomVec::init(); + + // check if optional radvary setting should have been set to 1 + + for (auto ifix : modify->get_fix_by_style("^adapt")) { + if (radvary == 0) { + if ((strcmp(ifix->style, "adapt") == 0) && (dynamic_cast(ifix)->diamflag)) + error->all(FLERR, "Fix adapt changes atom radii but atom_style bpm/sphere is not dynamic"); + // cannot properly check for fix adapt/fep since its header is optional + if ((strcmp(ifix->style, "adapt/fep") == 0) && (comm->me == 0)) + error->warning( + FLERR, "Fix adapt/fep may change atom radii but atom_style bpm/sphere is not dynamic"); + } + } +} + +/* ---------------------------------------------------------------------- + set local copies of all grow ptrs used by this class, except defaults + needed in replicate when 2 atom classes exist and it calls pack_restart() +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::grow_pointers() +{ + radius = atom->radius; + rmass = atom->rmass; + omega = atom->omega; + quat = atom->quat; + + num_bond = atom->num_bond; + bond_type = atom->bond_type; + nspecial = atom->nspecial; +} + +/* ---------------------------------------------------------------------- + initialize non-zero atom quantities +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::create_atom_post(int ilocal) +{ + radius[ilocal] = 0.5; + rmass[ilocal] = 4.0 * MY_PI / 3.0 * 0.5 * 0.5 * 0.5; + + quat[ilocal][0] = 1.0; + quat[ilocal][1] = 0.0; + quat[ilocal][2] = 0.0; + quat[ilocal][3] = 0.0; +} + +/* ---------------------------------------------------------------------- + modify values for AtomVec::pack_restart() to pack +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::pack_restart_pre(int ilocal) +{ + // insure bond_negative vector is needed length + + if (bond_per_atom < atom->bond_per_atom) { + delete[] bond_negative; + bond_per_atom = atom->bond_per_atom; + bond_negative = new int[bond_per_atom]; + } + + // flip any negative types to positive and flag which ones + + any_bond_negative = 0; + for (int m = 0; m < num_bond[ilocal]; m++) { + if (bond_type[ilocal][m] < 0) { + bond_negative[m] = 1; + bond_type[ilocal][m] = -bond_type[ilocal][m]; + any_bond_negative = 1; + } else + bond_negative[m] = 0; + } +} + +/* ---------------------------------------------------------------------- + unmodify values packed by AtomVec::pack_restart() +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::pack_restart_post(int ilocal) +{ + // restore the flagged types to their negative values + + if (any_bond_negative) { + for (int m = 0; m < num_bond[ilocal]; m++) + if (bond_negative[m]) bond_type[ilocal][m] = -bond_type[ilocal][m]; + } +} + +/* ---------------------------------------------------------------------- + initialize other atom quantities after AtomVec::unpack_restart() +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::unpack_restart_init(int ilocal) +{ + nspecial[ilocal][0] = 0; + nspecial[ilocal][1] = 0; + nspecial[ilocal][2] = 0; +} + +/* ---------------------------------------------------------------------- + modify what AtomVec::data_atom() just unpacked + or initialize other atom quantities +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::data_atom_post(int ilocal) +{ + radius_one = 0.5 * atom->radius[ilocal]; + radius[ilocal] = radius_one; + if (radius_one > 0.0) rmass[ilocal] *= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; + + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); + + omega[ilocal][0] = 0.0; + omega[ilocal][1] = 0.0; + omega[ilocal][2] = 0.0; + + quat[ilocal][0] = 1.0; + quat[ilocal][1] = 0.0; + quat[ilocal][2] = 0.0; + quat[ilocal][3] = 0.0; + + num_bond[ilocal] = 0; + nspecial[ilocal][0] = 0; + nspecial[ilocal][1] = 0; + nspecial[ilocal][2] = 0; +} + +/* ---------------------------------------------------------------------- + modify values for AtomVec::pack_data() to pack +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::pack_data_pre(int ilocal) +{ + radius_one = radius[ilocal]; + rmass_one = rmass[ilocal]; + + radius[ilocal] *= 2.0; + if (radius_one != 0.0) + rmass[ilocal] = rmass_one / (4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one); +} + +/* ---------------------------------------------------------------------- + unmodify values packed by AtomVec::pack_data() +------------------------------------------------------------------------- */ + +void AtomVecBPMSphere::pack_data_post(int ilocal) +{ + radius[ilocal] = radius_one; + rmass[ilocal] = rmass_one; +} diff --git a/src/BPM/atom_vec_bpm_sphere.h b/src/BPM/atom_vec_bpm_sphere.h new file mode 100644 index 0000000000..5bd40cc5c0 --- /dev/null +++ b/src/BPM/atom_vec_bpm_sphere.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 ATOM_CLASS +// clang-format off +AtomStyle(bpm/sphere,AtomVecBPMSphere); +// clang-format on +#else + +#ifndef LMP_ATOM_VEC_BPM_SPHERE_H +#define LMP_ATOM_VEC_BPM_SPHERE_H + +#include "atom_vec.h" + +namespace LAMMPS_NS { + +class AtomVecBPMSphere : public AtomVec { + public: + AtomVecBPMSphere(class LAMMPS *); + void process_args(int, char **) override; + void init() override; + + void grow_pointers() override; + void create_atom_post(int) override; + void pack_restart_pre(int) override; + void pack_restart_post(int) override; + void unpack_restart_init(int) override; + void data_atom_post(int) override; + void pack_data_pre(int) override; + void pack_data_post(int) override; + + private: + int *num_bond; + int **bond_type; + int **nspecial; + + double *radius, *rmass; + double **omega, **quat; + + int any_bond_negative; + int bond_per_atom; + int *bond_negative; + + int radvary; + double radius_one, rmass_one; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp new file mode 100644 index 0000000000..b019815cfa --- /dev/null +++ b/src/BPM/bond_bpm.cpp @@ -0,0 +1,415 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "bond_bpm.h" + +#include "atom.h" +#include "domain.h" +#include "error.h" +#include "fix_bond_history.h" +#include "fix_store_local.h" +#include "fix_update_special_bonds.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "update.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +BondBPM::BondBPM(LAMMPS *_lmp) : + Bond(_lmp), id_fix_dummy(nullptr), id_fix_dummy2(nullptr), id_fix_update(nullptr), + id_fix_bond_history(nullptr), id_fix_store_local(nullptr), id_fix_prop_atom(nullptr), + fix_store_local(nullptr), fix_bond_history(nullptr), fix_update_special_bonds(nullptr), + pack_choice(nullptr), output_data(nullptr) + +{ + overlay_flag = 0; + prop_atom_flag = 0; + nvalues = 0; + + r0_max_estimate = 0.0; + max_stretch = 1.0; + + // create dummy fix as placeholder for FixUpdateSpecialBonds & BondHistory + // this is so final order of Modify:fix will conform to input script + // BondHistory technically only needs this if updateflag = 1 + + id_fix_dummy = utils::strdup("BPM_DUMMY"); + modify->add_fix(fmt::format("{} all DUMMY ", id_fix_dummy)); + + id_fix_dummy2 = utils::strdup("BPM_DUMMY2"); + modify->add_fix(fmt::format("{} all DUMMY ", id_fix_dummy2)); +} + +/* ---------------------------------------------------------------------- */ + +BondBPM::~BondBPM() +{ + delete[] pack_choice; + + if (id_fix_dummy) modify->delete_fix(id_fix_dummy); + if (id_fix_dummy2) modify->delete_fix(id_fix_dummy2); + if (id_fix_update) modify->delete_fix(id_fix_update); + if (id_fix_bond_history) modify->delete_fix(id_fix_bond_history); + if (id_fix_store_local) modify->delete_fix(id_fix_store_local); + if (id_fix_prop_atom) modify->delete_fix(id_fix_prop_atom); + + delete[] id_fix_dummy; + delete[] id_fix_dummy2; + delete[] id_fix_update; + delete[] id_fix_bond_history; + delete[] id_fix_store_local; + delete[] id_fix_prop_atom; + + memory->destroy(output_data); +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::init_style() +{ + if (id_fix_store_local) { + auto ifix = modify->get_fix_by_id(id_fix_store_local); + if (!ifix) error->all(FLERR, "Cannot find fix store/local"); + if (strcmp(ifix->style, "STORE_LOCAL") != 0) + error->all(FLERR, "Incorrect fix style matched, not store/local"); + fix_store_local = dynamic_cast(ifix); + fix_store_local->nvalues = nvalues; + } + + if (overlay_flag) { + if (force->special_lj[1] != 1.0) + error->all(FLERR, + "With overlay/pair, BPM bond styles require special_bonds weight of 1.0 for " + "first neighbors"); + if (id_fix_update) { + modify->delete_fix(id_fix_update); + delete[] id_fix_update; + id_fix_update = nullptr; + } + } else { + // Require atoms know about all of their bonds and if they break + if (force->newton_bond) + error->all(FLERR, "Without overlay/pair, BPM bond styles require Newton bond off"); + + // special lj must be 0 1 1 to censor pair forces between bonded particles + // special coulomb must be 1 1 1 to ensure all pairs are included in the + // neighbor list and 1-3 and 1-4 special bond lists are skipped + if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) + error->all(FLERR, + "Without overlay/pair, BPM bond sytles requires special LJ weights = 0,1,1"); + if (force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || + force->special_coul[3] != 1.0) + error->all(FLERR, + "Without overlay/pair, BPM bond sytles requires special Coulomb weights = 1,1,1"); + + if (id_fix_dummy) { + id_fix_update = utils::strdup("BPM_UPDATE_SPECIAL_BONDS"); + fix_update_special_bonds = dynamic_cast(modify->replace_fix( + id_fix_dummy, fmt::format("{} all UPDATE_SPECIAL_BONDS", id_fix_update), 1)); + delete[] id_fix_dummy; + id_fix_dummy = nullptr; + } + } + + if (force->angle || force->dihedral || force->improper) + error->all(FLERR, "Bond style bpm cannot be used with 3,4-body interactions"); + if (atom->molecular == 2) + error->all(FLERR, "Bond style bpm cannot be used with atom style template"); + + // special 1-3 and 1-4 weights must be 1 to prevent building 1-3 and 1-4 special bond lists + if (force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0 || force->special_coul[2] != 1.0 || + force->special_coul[3] != 1.0) + error->all(FLERR, "Bond style bpm requires 1-3 and 1-4 special weights of 1.0"); +} + +/* ---------------------------------------------------------------------- + global settings + All args before store/local command are saved for potential args + for specific bond BPM substyles + All args after optional store/local command are variables stored + in the compute store/local +------------------------------------------------------------------------- */ + +void BondBPM::settings(int narg, char **arg) +{ + leftover_iarg.clear(); + + int iarg = 0; + while (iarg < narg) { + if (strcmp(arg[iarg], "store/local") == 0) { + nvalues = 0; + id_fix_store_local = utils::strdup(arg[iarg + 1]); + store_local_freq = utils::inumeric(FLERR, arg[iarg + 2], false, lmp); + pack_choice = new FnPtrPack[narg - iarg - 1]; + iarg += 3; + while (iarg < narg) { + if (strcmp(arg[iarg], "id1") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_id1; + } else if (strcmp(arg[iarg], "id2") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_id2; + } else if (strcmp(arg[iarg], "time") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_time; + } else if (strcmp(arg[iarg], "x") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_x; + } else if (strcmp(arg[iarg], "y") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_y; + } else if (strcmp(arg[iarg], "z") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_z; + } else if (strcmp(arg[iarg], "x/ref") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_x_ref; + prop_atom_flag = 1; + } else if (strcmp(arg[iarg], "y/ref") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_y_ref; + prop_atom_flag = 1; + } else if (strcmp(arg[iarg], "z/ref") == 0) { + pack_choice[nvalues++] = &BondBPM::pack_z_ref; + prop_atom_flag = 1; + } else { + break; + } + iarg++; + } + } else if (strcmp(arg[iarg], "overlay/pair") == 0) { + overlay_flag = 1; + iarg++; + } else { + leftover_iarg.push_back(iarg); + iarg++; + } + } + + if (id_fix_store_local) { + + if (nvalues == 0) + error->all(FLERR, "Storing local data must include at least one value to output"); + memory->create(output_data, nvalues, "bond/bpm:output_data"); + + auto ifix = modify->get_fix_by_id(id_fix_store_local); + if (!ifix) + ifix = modify->add_fix( + fmt::format("{} all STORE_LOCAL {} {}", id_fix_store_local, store_local_freq, nvalues)); + fix_store_local = dynamic_cast(ifix); + + // Use property/atom to save reference positions as it can transfer to ghost atoms + // This won't work for instances where bonds are added (e.g. fix pour) but in those cases + // a reference state isn't well defined + if (prop_atom_flag == 1) { + + id_fix_prop_atom = utils::strdup("BPM_property_atom"); + char *x_ref_id = utils::strdup("BPM_X_REF"); + char *y_ref_id = utils::strdup("BPM_Y_REF"); + char *z_ref_id = utils::strdup("BPM_Z_REF"); + + ifix = modify->get_fix_by_id(id_fix_prop_atom); + if (!ifix) + ifix = modify->add_fix(fmt::format("{} all property/atom {} {} {} ghost yes", + id_fix_prop_atom, x_ref_id, y_ref_id, z_ref_id)); + + int type_flag; + int col_flag; + index_x_ref = atom->find_custom(x_ref_id, type_flag, col_flag); + index_y_ref = atom->find_custom(y_ref_id, type_flag, col_flag); + index_z_ref = atom->find_custom(z_ref_id, type_flag, col_flag); + + delete[] x_ref_id; + delete[] y_ref_id; + delete[] z_ref_id; + + if (ifix->restart_reset) { + ifix->restart_reset = 0; + } else { + double *x_ref = atom->dvector[index_x_ref]; + double *y_ref = atom->dvector[index_y_ref]; + double *z_ref = atom->dvector[index_z_ref]; + + double **x = atom->x; + for (int i = 0; i < atom->nlocal; i++) { + x_ref[i] = x[i][0]; + y_ref[i] = x[i][1]; + z_ref[i] = x[i][2]; + } + } + } + } +} + +/* ---------------------------------------------------------------------- + used to check bond communiction cutoff - not perfect, estimates based on local-local only +------------------------------------------------------------------------- */ + +double BondBPM::equilibrium_distance(int /*i*/) +{ + // Ghost atoms may not yet be communicated, this may only be an estimate + if (r0_max_estimate == 0) { + int type, j; + double delx, dely, delz, r; + double **x = atom->x; + for (int i = 0; i < atom->nlocal; i++) { + for (int m = 0; m < atom->num_bond[i]; m++) { + type = atom->bond_type[i][m]; + if (type == 0) continue; + + j = atom->map(atom->bond_atom[i][m]); + if (j == -1) continue; + + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + domain->minimum_image(delx, dely, delz); + + r = sqrt(delx * delx + dely * dely + delz * delz); + if (r > r0_max_estimate) r0_max_estimate = r; + } + } + + double temp; + MPI_Allreduce(&r0_max_estimate, &temp, 1, MPI_DOUBLE, MPI_MAX, world); + r0_max_estimate = temp; + } + + // Divide out heuristic prefactor added in comm class + return max_stretch * r0_max_estimate / 1.5; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::process_broken(int i, int j) +{ + if (fix_store_local) { + for (int n = 0; n < nvalues; n++) (this->*pack_choice[n])(n, i, j); + + fix_store_local->add_data(output_data, i, j); + } + + if (fix_update_special_bonds) fix_update_special_bonds->add_broken_bond(i, j); + + // Manually search and remove from atom arrays + // need to remove in case special bonds arrays rebuilt + int m, n; + int nlocal = atom->nlocal; + + tagint *tag = atom->tag; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *num_bond = atom->num_bond; + + if (i < nlocal) { + for (m = 0; m < num_bond[i]; m++) { + if (bond_atom[i][m] == tag[j]) { + bond_type[i][m] = 0; + n = num_bond[i]; + bond_type[i][m] = bond_type[i][n - 1]; + bond_atom[i][m] = bond_atom[i][n - 1]; + fix_bond_history->shift_history(i, m, n - 1); + fix_bond_history->delete_history(i, n - 1); + num_bond[i]--; + break; + } + } + } + + if (j < nlocal) { + for (m = 0; m < num_bond[j]; m++) { + if (bond_atom[j][m] == tag[i]) { + bond_type[j][m] = 0; + n = num_bond[j]; + bond_type[j][m] = bond_type[j][n - 1]; + bond_atom[j][m] = bond_atom[j][n - 1]; + fix_bond_history->shift_history(j, m, n - 1); + fix_bond_history->delete_history(j, n - 1); + num_bond[j]--; + break; + } + } + } +} + +/* ---------------------------------------------------------------------- + one method for every keyword bond bpm can output + the atom property is packed into array or vector +------------------------------------------------------------------------- */ + +void BondBPM::pack_id1(int n, int i, int /*j*/) +{ + tagint *tag = atom->tag; + output_data[n] = tag[i]; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_id2(int n, int /*i*/, int j) +{ + tagint *tag = atom->tag; + output_data[n] = tag[j]; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_time(int n, int /*i*/, int /*j*/) +{ + bigint time = update->ntimestep; + output_data[n] = time; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_x(int n, int i, int j) +{ + double **x = atom->x; + output_data[n] = (x[i][0] + x[j][0]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_y(int n, int i, int j) +{ + double **x = atom->x; + output_data[n] = (x[i][1] + x[j][1]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_z(int n, int i, int j) +{ + double **x = atom->x; + output_data[n] = (x[i][2] + x[j][2]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_x_ref(int n, int i, int j) +{ + double *x = atom->dvector[index_x_ref]; + output_data[n] = (x[i] + x[j]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_y_ref(int n, int i, int j) +{ + double *y = atom->dvector[index_y_ref]; + output_data[n] = (y[i] + y[j]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void BondBPM::pack_z_ref(int n, int i, int j) +{ + double *z = atom->dvector[index_z_ref]; + output_data[n] = (z[i] + z[j]) * 0.5; +} diff --git a/src/BPM/bond_bpm.h b/src/BPM/bond_bpm.h new file mode 100644 index 0000000000..914e91ff82 --- /dev/null +++ b/src/BPM/bond_bpm.h @@ -0,0 +1,72 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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_BOND_BPM_H +#define LMP_BOND_BPM_H + +#include "bond.h" + +#include + +namespace LAMMPS_NS { + +class BondBPM : public Bond { + public: + BondBPM(class LAMMPS *); + ~BondBPM() override; + void compute(int, int) override = 0; + void coeff(int, char **) override = 0; + void init_style() override; + void settings(int, char **) override; + double equilibrium_distance(int) override; + void write_restart(FILE *) override{}; + void read_restart(FILE *) override{}; + void write_data(FILE *) override{}; + double single(int, double, int, int, double &) override = 0; + + protected: + double r0_max_estimate; + double max_stretch; + int store_local_freq; + + std::vector leftover_iarg; + + char *id_fix_dummy, *id_fix_dummy2; + char *id_fix_update, *id_fix_bond_history; + char *id_fix_store_local, *id_fix_prop_atom; + class FixStoreLocal *fix_store_local; + class FixBondHistory *fix_bond_history; + class FixUpdateSpecialBonds *fix_update_special_bonds; + + void process_broken(int, int); + typedef void (BondBPM::*FnPtrPack)(int, int, int); + FnPtrPack *pack_choice; // ptrs to pack functions + double *output_data; + + int prop_atom_flag, nvalues, overlay_flag; + int index_x_ref, index_y_ref, index_z_ref; + + void pack_id1(int, int, int); + void pack_id2(int, int, int); + void pack_time(int, int, int); + void pack_x(int, int, int); + void pack_y(int, int, int); + void pack_z(int, int, int); + void pack_x_ref(int, int, int); + void pack_y_ref(int, int, int); + void pack_z_ref(int, int, int); +}; + +} // namespace LAMMPS_NS + +#endif diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp new file mode 100644 index 0000000000..a43b4c7500 --- /dev/null +++ b/src/BPM/bond_bpm_rotational.cpp @@ -0,0 +1,796 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "bond_bpm_rotational.h" + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_bond_history.h" +#include "force.h" +#include "math_const.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" + +#include + +#define EPSILON 1e-10 + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +BondBPMRotational::BondBPMRotational(LAMMPS *_lmp) : BondBPM(_lmp) +{ + Kr = nullptr; + Ks = nullptr; + Kt = nullptr; + Kb = nullptr; + Fcr = nullptr; + Fcs = nullptr; + Tct = nullptr; + Tcb = nullptr; + gnorm = nullptr; + gslide = nullptr; + groll = nullptr; + gtwist = nullptr; + partial_flag = 1; + smooth_flag = 1; +} + +/* ---------------------------------------------------------------------- */ + +BondBPMRotational::~BondBPMRotational() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(Kr); + memory->destroy(Ks); + memory->destroy(Kt); + memory->destroy(Kb); + memory->destroy(Fcr); + memory->destroy(Fcs); + memory->destroy(Tct); + memory->destroy(Tcb); + memory->destroy(gnorm); + memory->destroy(gslide); + memory->destroy(groll); + memory->destroy(gtwist); + } +} + +/* ---------------------------------------------------------------------- */ + +double BondBPMRotational::acos_limit(double c) +{ + if (c > 1.0) c = 1.0; + if (c < -1.0) c = -1.0; + return acos(c); +} + +/* ---------------------------------------------------------------------- + Store data for a single bond - if bond added after LAMMPS init (e.g. pour) +------------------------------------------------------------------------- */ + +double BondBPMRotational::store_bond(int n, int i, int j) +{ + double delx, dely, delz, r, rinv; + double **x = atom->x; + tagint *tag = atom->tag; + double **bondstore = fix_bond_history->bondstore; + + if (tag[i] < tag[j]) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + } else { + delx = x[j][0] - x[i][0]; + dely = x[j][1] - x[i][1]; + delz = x[j][2] - x[i][2]; + } + + r = sqrt(delx * delx + dely * dely + delz * delz); + rinv = 1.0 / r; + + bondstore[n][0] = r; + bondstore[n][1] = delx * rinv; + bondstore[n][2] = dely * rinv; + bondstore[n][3] = delz * rinv; + + if (i < atom->nlocal) { + for (int m = 0; m < atom->num_bond[i]; m++) { + if (atom->bond_atom[i][m] == tag[j]) { + fix_bond_history->update_atom_value(i, m, 0, r); + fix_bond_history->update_atom_value(i, m, 1, delx * rinv); + fix_bond_history->update_atom_value(i, m, 2, dely * rinv); + fix_bond_history->update_atom_value(i, m, 3, delz * rinv); + } + } + } + + if (j < atom->nlocal) { + for (int m = 0; m < atom->num_bond[j]; m++) { + if (atom->bond_atom[j][m] == tag[i]) { + fix_bond_history->update_atom_value(j, m, 0, r); + fix_bond_history->update_atom_value(j, m, 1, delx * rinv); + fix_bond_history->update_atom_value(j, m, 2, dely * rinv); + fix_bond_history->update_atom_value(j, m, 3, delz * rinv); + } + } + } + + return r; +} + +/* ---------------------------------------------------------------------- + Store data for all bonds called once +------------------------------------------------------------------------- */ + +void BondBPMRotational::store_data() +{ + int i, j, m, type; + double delx, dely, delz, r, rinv; + double **x = atom->x; + int **bond_type = atom->bond_type; + tagint *tag = atom->tag; + + for (i = 0; i < atom->nlocal; i++) { + for (m = 0; m < atom->num_bond[i]; m++) { + type = bond_type[i][m]; + + //Skip if bond was turned off + if (type < 0) continue; + + // map to find index n for tag + j = atom->map(atom->bond_atom[i][m]); + if (j == -1) error->one(FLERR, "Atom missing in BPM bond"); + + // Save orientation as pointing towards small tag + if (tag[i] < tag[j]) { + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + } else { + delx = x[j][0] - x[i][0]; + dely = x[j][1] - x[i][1]; + delz = x[j][2] - x[i][2]; + } + + // Get closest image in case bonded with ghost + domain->minimum_image(delx, dely, delz); + r = sqrt(delx * delx + dely * dely + delz * delz); + rinv = 1.0 / r; + + fix_bond_history->update_atom_value(i, m, 0, r); + fix_bond_history->update_atom_value(i, m, 1, delx * rinv); + fix_bond_history->update_atom_value(i, m, 2, dely * rinv); + fix_bond_history->update_atom_value(i, m, 3, delz * rinv); + } + } + + fix_bond_history->post_neighbor(); +} + +/* ---------------------------------------------------------------------- + Calculate forces using formulation in: + 1) Y. Wang Acta Geotechnica 2009 + 2) P. Mora & Y. Wang Advances in Geomcomputing 2009 +---------------------------------------------------------------------- */ + +double BondBPMRotational::elastic_forces(int i1, int i2, int type, double &Fr, double r_mag, + double r0_mag, double r_mag_inv, double * /*rhat*/, + double *r, double *r0, double *force1on2, + double *torque1on2, double *torque2on1) +{ + double breaking, temp, r0_dot_rb, c, gamma; + double psi, theta, cos_phi, sin_phi; + double mag_in_plane, mag_out_plane; + double Fs_mag, Tt_mag, Tb_mag; + + double q1[4], q2[4]; + double q2inv[4], mq[4], mqinv[4], qp21[4], q21[4], qtmp[4]; + double rb[3], rb_x_r0[3], s[3], t[3]; + double Fs[3], Fsp[3], F_rot[3], Ftmp[3]; + double Ts[3], Tb[3], Tt[3], Tbp[3], Ttp[3], Tsp[3], T_rot[3], Ttmp[3]; + + double **quat = atom->quat; + + q1[0] = quat[i1][0]; + q1[1] = quat[i1][1]; + q1[2] = quat[i1][2]; + q1[3] = quat[i1][3]; + + q2[0] = quat[i2][0]; + q2[1] = quat[i2][1]; + q2[2] = quat[i2][2]; + q2[3] = quat[i2][3]; + + // Calculate normal forces, rb = bond vector in particle 1's frame + MathExtra::qconjugate(q2, q2inv); + MathExtra::quatrotvec(q2inv, r, rb); + Fr = Kr[type] * (r_mag - r0_mag); + + MathExtra::scale3(Fr * r_mag_inv, rb, F_rot); + + // Calculate forces due to tangential displacements (no rotation) + r0_dot_rb = MathExtra::dot3(r0, rb); + c = r0_dot_rb * r_mag_inv / r0_mag; + gamma = acos_limit(c); + + MathExtra::cross3(rb, r0, rb_x_r0); + MathExtra::cross3(rb, rb_x_r0, s); + MathExtra::norm3(s); + + MathExtra::scale3(Ks[type] * r_mag * gamma, s, Fs); + + // Calculate torque due to tangential displacements + MathExtra::cross3(r0, rb, t); + MathExtra::norm3(t); + + MathExtra::scale3(0.5 * r_mag * Ks[type] * r_mag * gamma, t, Ts); + + // Relative rotation force/torque + // Use representation of X'Y'Z' rotations from Wang, Mora 2009 + temp = r_mag + rb[2]; + if (temp < 0.0) temp = 0.0; + mq[0] = sqrt(2) * 0.5 * sqrt(temp * r_mag_inv); + + temp = sqrt(rb[0] * rb[0] + rb[1] * rb[1]); + if (temp != 0.0) { + mq[1] = -sqrt(2) * 0.5 / temp; + temp = r_mag - rb[2]; + if (temp < 0.0) temp = 0.0; + mq[1] *= sqrt(temp * r_mag_inv); + mq[2] = -mq[1]; + mq[1] *= rb[1]; + mq[2] *= rb[0]; + } else { + // If aligned along z axis, x,y terms zero (r_mag-rb[2] = 0) + mq[1] = 0.0; + mq[2] = 0.0; + } + mq[3] = 0.0; + + // qp21 = opposite of r^\circ_21 in Wang + // q21 = opposite of r_21 in Wang + MathExtra::quatquat(q2inv, q1, qp21); + MathExtra::qconjugate(mq, mqinv); + MathExtra::quatquat(mqinv, qp21, qtmp); + MathExtra::quatquat(qtmp, mq, q21); + + temp = sqrt(q21[0] * q21[0] + q21[3] * q21[3]); + if (temp != 0.0) { + c = q21[0] / temp; + psi = 2.0 * acos_limit(c); + } else { + c = 0.0; + psi = 0.0; + } + + // Map negative rotations + if (q21[3] < 0.0) // sin = q21[3]/temp + psi = -psi; + + if (q21[3] == 0.0) psi = 0.0; + + c = q21[0] * q21[0] - q21[1] * q21[1] - q21[2] * q21[2] + q21[3] * q21[3]; + theta = acos_limit(c); + + // Separately calculte magnitude of quaternion in x-y and out of x-y planes + // to avoid dividing by zero + mag_out_plane = (q21[0] * q21[0] + q21[3] * q21[3]); + mag_in_plane = (q21[1] * q21[1] + q21[2] * q21[2]); + + if (mag_in_plane == 0.0) { + // No rotation => no bending/shear torque or extra shear force + // achieve by setting cos/sin = 0 + cos_phi = 0.0; + sin_phi = 0.0; + } else if (mag_out_plane == 0.0) { + // Calculate angle in plane + cos_phi = q21[2] / sqrt(mag_in_plane); + sin_phi = -q21[1] / sqrt(mag_in_plane); + } else { + // Default equations in Mora, Wang 2009 + cos_phi = q21[1] * q21[3] + q21[0] * q21[2]; + sin_phi = q21[2] * q21[3] - q21[0] * q21[1]; + + cos_phi /= sqrt(mag_out_plane * mag_in_plane); + sin_phi /= sqrt(mag_out_plane * mag_in_plane); + } + + Tbp[0] = -Kb[type] * theta * sin_phi; + Tbp[1] = Kb[type] * theta * cos_phi; + Tbp[2] = 0.0; + + Ttp[0] = 0.0; + Ttp[1] = 0.0; + Ttp[2] = Kt[type] * psi; + + Fsp[0] = -0.5 * Ks[type] * r_mag * theta * cos_phi; + Fsp[1] = -0.5 * Ks[type] * r_mag * theta * sin_phi; + Fsp[2] = 0.0; + + Tsp[0] = 0.25 * Ks[type] * r_mag * r_mag * theta * sin_phi; + Tsp[1] = -0.25 * Ks[type] * r_mag * r_mag * theta * cos_phi; + Tsp[2] = 0.0; + + // Rotate forces/torques back to 1st particle's frame + + MathExtra::quatrotvec(mq, Fsp, Ftmp); + MathExtra::quatrotvec(mq, Tsp, Ttmp); + for (int m = 0; m < 3; m++) { + Fs[m] += Ftmp[m]; + Ts[m] += Ttmp[m]; + } + + MathExtra::quatrotvec(mq, Tbp, Tb); + MathExtra::quatrotvec(mq, Ttp, Tt); + + // Sum forces and calculate magnitudes + F_rot[0] += Fs[0]; + F_rot[1] += Fs[1]; + F_rot[2] += Fs[2]; + MathExtra::quatrotvec(q2, F_rot, force1on2); + + T_rot[0] = Ts[0] + Tt[0] + Tb[0]; + T_rot[1] = Ts[1] + Tt[1] + Tb[1]; + T_rot[2] = Ts[2] + Tt[2] + Tb[2]; + MathExtra::quatrotvec(q2, T_rot, torque1on2); + + T_rot[0] = Ts[0] - Tt[0] - Tb[0]; + T_rot[1] = Ts[1] - Tt[1] - Tb[1]; + T_rot[2] = Ts[2] - Tt[2] - Tb[2]; + MathExtra::quatrotvec(q2, T_rot, torque2on1); + + Fs_mag = MathExtra::len3(Fs); + Tt_mag = MathExtra::len3(Tt); + Tb_mag = MathExtra::len3(Tb); + + breaking = Fr / Fcr[type] + Fs_mag / Fcs[type] + Tb_mag / Tcb[type] + Tt_mag / Tct[type]; + if (breaking < 0.0) breaking = 0.0; + + return breaking; +} + +/* ---------------------------------------------------------------------- + Calculate damping using formulation in + Y. Wang, F. Alonso-Marroquin, W. Guo 2015 + Note: n points towards 1 vs pointing towards 2 +---------------------------------------------------------------------- */ + +void BondBPMRotational::damping_forces(int i1, int i2, int type, double &Fr, double *rhat, + double *r, double *force1on2, double *torque1on2, + double *torque2on1) +{ + double v1dotr, v2dotr, w1dotr, w2dotr; + double s1[3], s2[3], tdamp[3], tmp[3]; + double vn1[3], vn2[3], vt1[3], vt2[3], vroll[3]; + double wxn1[3], wxn2[3], wn1[3], wn2[3]; + + double **v = atom->v; + double **omega = atom->omega; + + // Damp normal velocity difference + v1dotr = MathExtra::dot3(v[i1], rhat); + v2dotr = MathExtra::dot3(v[i2], rhat); + + MathExtra::scale3(v1dotr, rhat, vn1); + MathExtra::scale3(v2dotr, rhat, vn2); + + MathExtra::sub3(vn1, vn2, tmp); + MathExtra::scale3(gnorm[type], tmp); + Fr = MathExtra::lensq3(tmp); + MathExtra::add3(force1on2, tmp, force1on2); + + // Damp tangential objective velocities + MathExtra::sub3(v[i1], vn1, vt1); + MathExtra::sub3(v[i2], vn2, vt2); + + MathExtra::sub3(vt2, vt1, tmp); + MathExtra::scale3(0.5, tmp); + + MathExtra::cross3(omega[i1], r, s1); + MathExtra::scale3(-0.5, s1); + MathExtra::sub3(s1, tmp, s1); // Eq 12 + + MathExtra::cross3(omega[i2], r, s2); + MathExtra::scale3(0.5, s2); + MathExtra::add3(s2, tmp, s2); // Eq 13 + + MathExtra::sub3(s1, s2, tmp); + MathExtra::scale3(gslide[type], tmp); + MathExtra::add3(force1on2, tmp, force1on2); + + // Apply corresponding torque + MathExtra::cross3(r, tmp, tdamp); + MathExtra::scale3(0.5, tdamp); + MathExtra::add3(torque1on2, tdamp, torque1on2); + MathExtra::add3(torque2on1, tdamp, torque2on1); + + // Damp rolling + MathExtra::cross3(omega[i1], rhat, wxn1); + MathExtra::cross3(omega[i2], rhat, wxn2); + MathExtra::sub3(wxn1, wxn2, vroll); // Eq. 31 + MathExtra::cross3(r, vroll, tdamp); + + MathExtra::scale3(0.5 * groll[type], tdamp); + MathExtra::add3(torque1on2, tdamp, torque1on2); + MathExtra::scale3(-1.0, tdamp); + MathExtra::add3(torque2on1, tdamp, torque2on1); + + // Damp twist + w1dotr = MathExtra::dot3(omega[i1], rhat); + w2dotr = MathExtra::dot3(omega[i2], rhat); + + MathExtra::scale3(w1dotr, rhat, wn1); + MathExtra::scale3(w2dotr, rhat, wn2); + + MathExtra::sub3(wn1, wn2, tdamp); // Eq. 38 + MathExtra::scale3(0.5 * gtwist[type], tdamp); + MathExtra::add3(torque1on2, tdamp, torque1on2); + MathExtra::scale3(-1.0, tdamp); + MathExtra::add3(torque2on1, tdamp, torque2on1); +} + +/* ---------------------------------------------------------------------- */ + +void BondBPMRotational::compute(int eflag, int vflag) +{ + + if (!fix_bond_history->stored_flag) { + fix_bond_history->stored_flag = true; + store_data(); + } + + int i1, i2, itmp, n, type; + double r[3], r0[3], rhat[3]; + double rsq, r0_mag, r_mag, r_mag_inv; + double Fr, breaking, smooth; + double force1on2[3], torque1on2[3], torque2on1[3]; + + ev_init(eflag, vflag); + + double **x = atom->x; + double **f = atom->f; + double **torque = atom->torque; + tagint *tag = atom->tag; + int **bondlist = neighbor->bondlist; + int nbondlist = neighbor->nbondlist; + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + + double **bondstore = fix_bond_history->bondstore; + + for (n = 0; n < nbondlist; n++) { + + // skip bond if already broken + if (bondlist[n][2] <= 0) continue; + + i1 = bondlist[n][0]; + i2 = bondlist[n][1]; + type = bondlist[n][2]; + r0_mag = bondstore[n][0]; + + // Ensure pair is always ordered such that r0 points in + // a consistent direction and to ensure numerical operations + // are identical to minimize the possibility that a bond straddling + // an mpi grid (newton off) doesn't break on one proc but not the other + if (tag[i2] < tag[i1]) { + itmp = i1; + i1 = i2; + i2 = itmp; + } + + // If bond hasn't been set - should be initialized to zero + if (r0_mag < EPSILON || std::isnan(r0_mag)) r0_mag = store_bond(n, i1, i2); + + r0[0] = bondstore[n][1]; + r0[1] = bondstore[n][2]; + r0[2] = bondstore[n][3]; + MathExtra::scale3(r0_mag, r0); + + // Note this is the reverse of Mora & Wang + MathExtra::sub3(x[i1], x[i2], r); + + rsq = MathExtra::lensq3(r); + r_mag = sqrt(rsq); + r_mag_inv = 1.0 / r_mag; + MathExtra::scale3(r_mag_inv, r, rhat); + + // ------------------------------------------------------// + // Calculate forces, check if bond breaks + // ------------------------------------------------------// + + breaking = elastic_forces(i1, i2, type, Fr, r_mag, r0_mag, r_mag_inv, rhat, r, r0, force1on2, + torque1on2, torque2on1); + + if (breaking >= 1.0) { + bondlist[n][2] = 0; + process_broken(i1, i2); + continue; + } + + damping_forces(i1, i2, type, Fr, rhat, r, force1on2, torque1on2, torque2on1); + + if (smooth_flag) { + smooth = breaking * breaking; + smooth = 1.0 - smooth * smooth; + } else { + smooth = 1.0; + } + + // ------------------------------------------------------// + // Apply forces and torques to particles + // ------------------------------------------------------// + + if (newton_bond || i1 < nlocal) { + f[i1][0] -= force1on2[0] * smooth; + f[i1][1] -= force1on2[1] * smooth; + f[i1][2] -= force1on2[2] * smooth; + + torque[i1][0] += torque2on1[0] * smooth; + torque[i1][1] += torque2on1[1] * smooth; + torque[i1][2] += torque2on1[2] * smooth; + } + + if (newton_bond || i2 < nlocal) { + f[i2][0] += force1on2[0] * smooth; + f[i2][1] += force1on2[1] * smooth; + f[i2][2] += force1on2[2] * smooth; + + torque[i2][0] += torque1on2[0] * smooth; + torque[i2][1] += torque1on2[1] * smooth; + torque[i2][2] += torque1on2[2] * smooth; + } + + if (evflag) ev_tally(i1, i2, nlocal, newton_bond, 0.0, Fr * smooth, r[0], r[1], r[2]); + } +} + +/* ---------------------------------------------------------------------- */ + +void BondBPMRotational::allocate() +{ + allocated = 1; + const int np1 = atom->nbondtypes + 1; + + memory->create(Kr, np1, "bond:Kr"); + memory->create(Ks, np1, "bond:Ks"); + memory->create(Kt, np1, "bond:Kt"); + memory->create(Kb, np1, "bond:Kb"); + memory->create(Fcr, np1, "bond:Fcr"); + memory->create(Fcs, np1, "bond:Fcs"); + memory->create(Tct, np1, "bond:Tct"); + memory->create(Tcb, np1, "bond:Tcb"); + memory->create(gnorm, np1, "bond:gnorm"); + memory->create(gslide, np1, "bond:gslide"); + memory->create(groll, np1, "bond:groll"); + memory->create(gtwist, np1, "bond:gtwist"); + + memory->create(setflag, np1, "bond:setflag"); + for (int i = 1; i < np1; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void BondBPMRotational::coeff(int narg, char **arg) +{ + if (narg != 13) error->all(FLERR, "Incorrect args for bond coefficients"); + if (!allocated) allocate(); + + int ilo, ihi; + utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error); + + double Kr_one = utils::numeric(FLERR, arg[1], false, lmp); + double Ks_one = utils::numeric(FLERR, arg[2], false, lmp); + double Kt_one = utils::numeric(FLERR, arg[3], false, lmp); + double Kb_one = utils::numeric(FLERR, arg[4], false, lmp); + double Fcr_one = utils::numeric(FLERR, arg[5], false, lmp); + double Fcs_one = utils::numeric(FLERR, arg[6], false, lmp); + double Tct_one = utils::numeric(FLERR, arg[7], false, lmp); + double Tcb_one = utils::numeric(FLERR, arg[8], false, lmp); + double gnorm_one = utils::numeric(FLERR, arg[9], false, lmp); + double gslide_one = utils::numeric(FLERR, arg[10], false, lmp); + double groll_one = utils::numeric(FLERR, arg[11], false, lmp); + double gtwist_one = utils::numeric(FLERR, arg[12], false, lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + Kr[i] = Kr_one; + Ks[i] = Ks_one; + Kt[i] = Kt_one; + Kb[i] = Kb_one; + Fcr[i] = Fcr_one; + Fcs[i] = Fcs_one; + Tct[i] = Tct_one; + Tcb[i] = Tcb_one; + gnorm[i] = gnorm_one; + gslide[i] = gslide_one; + groll[i] = groll_one; + gtwist[i] = gtwist_one; + setflag[i] = 1; + count++; + + if (Fcr[i] / Kr[i] > max_stretch) max_stretch = Fcr[i] / Kr[i]; + } + + if (count == 0) error->all(FLERR, "Incorrect args for bond coefficients"); +} + +/* ---------------------------------------------------------------------- + check for correct settings and create fix +------------------------------------------------------------------------- */ + +void BondBPMRotational::init_style() +{ + BondBPM::init_style(); + + if (!atom->quat_flag || !atom->sphere_flag) + error->all(FLERR, "Bond bpm/rotational requires atom style bpm/sphere"); + if (comm->ghost_velocity == 0) + error->all(FLERR, "Bond bpm/rotational requires ghost atoms store velocity"); + + if (domain->dimension == 2) + error->warning(FLERR, "Bond style bpm/rotational not intended for 2d use"); + + if (!id_fix_bond_history) { + id_fix_bond_history = utils::strdup("HISTORY_BPM_ROTATIONAL"); + fix_bond_history = dynamic_cast(modify->replace_fix( + id_fix_dummy2, fmt::format("{} all BOND_HISTORY 0 4", id_fix_bond_history), 1)); + delete[] id_fix_dummy2; + id_fix_dummy2 = nullptr; + } +} + +/* ---------------------------------------------------------------------- */ + +void BondBPMRotational::settings(int narg, char **arg) +{ + BondBPM::settings(narg, arg); + + int iarg; + for (std::size_t i = 0; i < leftover_iarg.size(); i++) { + iarg = leftover_iarg[i]; + if (strcmp(arg[iarg], "smooth") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command"); + smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; + } else { + error->all(FLERR, "Illegal bond_style command"); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void BondBPMRotational::write_restart(FILE *fp) +{ + fwrite(&Kr[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Ks[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Kt[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Kb[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Fcr[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Fcs[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Tct[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&Tcb[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&gnorm[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&gslide[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&groll[1], sizeof(double), atom->nbondtypes, fp); + fwrite(>wist[1], sizeof(double), atom->nbondtypes, fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void BondBPMRotational::read_restart(FILE *fp) +{ + allocate(); + + if (comm->me == 0) { + utils::sfread(FLERR, &Kr[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Ks[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Kt[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Kb[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Fcr[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Fcs[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Tct[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &Tcb[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &gnorm[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &gslide[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &groll[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, >wist[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + } + MPI_Bcast(&Kr[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Ks[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Kt[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Kb[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Fcr[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Fcs[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Tct[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&Tcb[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&gnorm[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&gslide[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&groll[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(>wist[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + + for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void BondBPMRotational::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->nbondtypes; i++) + fprintf(fp, "%d %g %g %g %g %g %g %g %g %g %g %g %g\n", i, Kr[i], Ks[i], Kt[i], Kb[i], Fcr[i], + Fcs[i], Tct[i], Tcb[i], gnorm[i], gslide[i], groll[i], gtwist[i]); +} + +/* ---------------------------------------------------------------------- */ + +double BondBPMRotational::single(int type, double rsq, int i, int j, double &fforce) +{ + // Not yet enabled + if (type <= 0) return 0.0; + + int itmp; + if (atom->tag[j] < atom->tag[i]) { + itmp = i; + i = j; + j = itmp; + } + + double r0_mag, r_mag, r_mag_inv; + double r0[3], r[3], rhat[3]; + for (int n = 0; n < atom->num_bond[i]; n++) { + if (atom->bond_atom[i][n] == atom->tag[j]) { + r0_mag = fix_bond_history->get_atom_value(i, n, 0); + r0[0] = fix_bond_history->get_atom_value(i, n, 1); + r0[1] = fix_bond_history->get_atom_value(i, n, 2); + r0[2] = fix_bond_history->get_atom_value(i, n, 3); + } + } + + double **x = atom->x; + MathExtra::scale3(r0_mag, r0); + MathExtra::sub3(x[i], x[j], r); + + r_mag = sqrt(rsq); + r_mag_inv = 1.0 / r_mag; + MathExtra::scale3(r_mag_inv, r, rhat); + + double breaking, smooth, Fr; + double force1on2[3], torque1on2[3], torque2on1[3]; + breaking = elastic_forces(i, j, type, Fr, r_mag, r0_mag, r_mag_inv, rhat, r, r0, force1on2, + torque1on2, torque2on1); + fforce = Fr; + damping_forces(i, j, type, Fr, rhat, r, force1on2, torque1on2, torque2on1); + fforce += Fr; + + if (smooth_flag) { + smooth = breaking * breaking; + smooth = 1.0 - smooth * smooth; + fforce *= smooth; + } + return 0.0; +} diff --git a/src/BPM/bond_bpm_rotational.h b/src/BPM/bond_bpm_rotational.h new file mode 100644 index 0000000000..952995e949 --- /dev/null +++ b/src/BPM/bond_bpm_rotational.h @@ -0,0 +1,59 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 BOND_CLASS +// clang-format off +BondStyle(bpm/rotational,BondBPMRotational); +// clang-format on +#else + +#ifndef LMP_BOND_BPM_ROTATIONAL_H +#define LMP_BOND_BPM_ROTATIONAL_H + +#include "bond_bpm.h" + +namespace LAMMPS_NS { + +class BondBPMRotational : public BondBPM { + public: + BondBPMRotational(class LAMMPS *); + ~BondBPMRotational() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void settings(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + + protected: + double *Kr, *Ks, *Kt, *Kb, *gnorm, *gslide, *groll, *gtwist; + double *Fcr, *Fcs, *Tct, *Tcb; + int smooth_flag; + + double acos_limit(double); + + double elastic_forces(int, int, int, double &, double, double, double, double *, double *, + double *, double *, double *, double *); + void damping_forces(int, int, int, double &, double *, double *, double *, double *, double *); + + void allocate(); + void store_data(); + double store_bond(int, int, int); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp new file mode 100644 index 0000000000..d5935f612c --- /dev/null +++ b/src/BPM/bond_bpm_spring.cpp @@ -0,0 +1,381 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "bond_bpm_spring.h" + +#include "atom.h" +#include "comm.h" +#include "domain.h" +#include "error.h" +#include "fix_bond_history.h" +#include "force.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" + +#define EPSILON 1e-10 + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +BondBPMSpring::BondBPMSpring(LAMMPS *_lmp) : + BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr) +{ + partial_flag = 1; + smooth_flag = 1; +} + +/* ---------------------------------------------------------------------- */ + +BondBPMSpring::~BondBPMSpring() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(k); + memory->destroy(ecrit); + memory->destroy(gamma); + } +} + +/* ---------------------------------------------------------------------- + Store data for a single bond - if bond added after LAMMPS init (e.g. pour) +------------------------------------------------------------------------- */ + +double BondBPMSpring::store_bond(int n, int i, int j) +{ + double delx, dely, delz, r; + double **x = atom->x; + double **bondstore = fix_bond_history->bondstore; + tagint *tag = atom->tag; + + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + + r = sqrt(delx * delx + dely * dely + delz * delz); + bondstore[n][0] = r; + + if (i < atom->nlocal) { + for (int m = 0; m < atom->num_bond[i]; m++) { + if (atom->bond_atom[i][m] == tag[j]) { fix_bond_history->update_atom_value(i, m, 0, r); } + } + } + + if (j < atom->nlocal) { + for (int m = 0; m < atom->num_bond[j]; m++) { + if (atom->bond_atom[j][m] == tag[i]) { fix_bond_history->update_atom_value(j, m, 0, r); } + } + } + + return r; +} + +/* ---------------------------------------------------------------------- + Store data for all bonds called once +------------------------------------------------------------------------- */ + +void BondBPMSpring::store_data() +{ + int i, j, m, type; + double delx, dely, delz, r; + double **x = atom->x; + int **bond_type = atom->bond_type; + + for (i = 0; i < atom->nlocal; i++) { + for (m = 0; m < atom->num_bond[i]; m++) { + type = bond_type[i][m]; + + //Skip if bond was turned off + if (type < 0) continue; + + // map to find index n + j = atom->map(atom->bond_atom[i][m]); + if (j == -1) error->one(FLERR, "Atom missing in BPM bond"); + + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + + // Get closest image in case bonded with ghost + domain->minimum_image(delx, dely, delz); + r = sqrt(delx * delx + dely * dely + delz * delz); + + fix_bond_history->update_atom_value(i, m, 0, r); + } + } + + fix_bond_history->post_neighbor(); +} + +/* ---------------------------------------------------------------------- */ + +void BondBPMSpring::compute(int eflag, int vflag) +{ + + if (!fix_bond_history->stored_flag) { + fix_bond_history->stored_flag = true; + store_data(); + } + + int i1, i2, itmp, n, type; + double delx, dely, delz, delvx, delvy, delvz; + double e, rsq, r, r0, rinv, smooth, fbond, dot; + + ev_init(eflag, vflag); + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + tagint *tag = atom->tag; + int **bondlist = neighbor->bondlist; + int nbondlist = neighbor->nbondlist; + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + + double **bondstore = fix_bond_history->bondstore; + + for (n = 0; n < nbondlist; n++) { + + // skip bond if already broken + if (bondlist[n][2] <= 0) continue; + + i1 = bondlist[n][0]; + i2 = bondlist[n][1]; + type = bondlist[n][2]; + r0 = bondstore[n][0]; + + // Ensure pair is always ordered to ensure numerical operations + // are identical to minimize the possibility that a bond straddling + // an mpi grid (newton off) doesn't break on one proc but not the other + if (tag[i2] < tag[i1]) { + itmp = i1; + i1 = i2; + i2 = itmp; + } + + // If bond hasn't been set - should be initialized to zero + if (r0 < EPSILON || std::isnan(r0)) r0 = store_bond(n, i1, i2); + + delx = x[i1][0] - x[i2][0]; + dely = x[i1][1] - x[i2][1]; + delz = x[i1][2] - x[i2][2]; + + rsq = delx * delx + dely * dely + delz * delz; + r = sqrt(rsq); + e = (r - r0) / r0; + + if (fabs(e) > ecrit[type]) { + bondlist[n][2] = 0; + process_broken(i1, i2); + continue; + } + + rinv = 1.0 / r; + fbond = k[type] * (r0 - r); + + delvx = v[i1][0] - v[i2][0]; + delvy = v[i1][1] - v[i2][1]; + delvz = v[i1][2] - v[i2][2]; + dot = delx * delvx + dely * delvy + delz * delvz; + fbond -= gamma[type] * dot * rinv; + fbond *= rinv; + + if (smooth_flag) { + smooth = (r - r0) / (r0 * ecrit[type]); + smooth *= smooth; + smooth *= smooth; + smooth *= smooth; + smooth = 1 - smooth; + fbond *= smooth; + } + + if (newton_bond || i1 < nlocal) { + f[i1][0] += delx * fbond; + f[i1][1] += dely * fbond; + f[i1][2] += delz * fbond; + } + + if (newton_bond || i2 < nlocal) { + f[i2][0] -= delx * fbond; + f[i2][1] -= dely * fbond; + f[i2][2] -= delz * fbond; + } + + if (evflag) ev_tally(i1, i2, nlocal, newton_bond, 0.0, fbond, delx, dely, delz); + } +} + +/* ---------------------------------------------------------------------- */ + +void BondBPMSpring::allocate() +{ + allocated = 1; + const int np1 = atom->nbondtypes + 1; + + memory->create(k, np1, "bond:k"); + memory->create(ecrit, np1, "bond:ecrit"); + memory->create(gamma, np1, "bond:gamma"); + + memory->create(setflag, np1, "bond:setflag"); + for (int i = 1; i < np1; i++) setflag[i] = 0; +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more types +------------------------------------------------------------------------- */ + +void BondBPMSpring::coeff(int narg, char **arg) +{ + if (narg != 4) error->all(FLERR, "Incorrect args for bond coefficients"); + if (!allocated) allocate(); + + int ilo, ihi; + utils::bounds(FLERR, arg[0], 1, atom->nbondtypes, ilo, ihi, error); + + double k_one = utils::numeric(FLERR, arg[1], false, lmp); + double ecrit_one = utils::numeric(FLERR, arg[2], false, lmp); + double gamma_one = utils::numeric(FLERR, arg[3], false, lmp); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + k[i] = k_one; + ecrit[i] = ecrit_one; + gamma[i] = gamma_one; + setflag[i] = 1; + count++; + + if (1.0 + ecrit[i] > max_stretch) max_stretch = 1.0 + ecrit[i]; + } + + if (count == 0) error->all(FLERR, "Incorrect args for bond coefficients"); +} + +/* ---------------------------------------------------------------------- + check for correct settings and create fix +------------------------------------------------------------------------- */ + +void BondBPMSpring::init_style() +{ + BondBPM::init_style(); + + if (comm->ghost_velocity == 0) + error->all(FLERR, "Bond bpm/spring requires ghost atoms store velocity"); + + if (!id_fix_bond_history) { + id_fix_bond_history = utils::strdup("HISTORY_BPM_SPRING"); + fix_bond_history = dynamic_cast(modify->replace_fix( + id_fix_dummy2, fmt::format("{} all BOND_HISTORY 0 1", id_fix_bond_history), 1)); + delete[] id_fix_dummy2; + id_fix_dummy2 = nullptr; + } +} + +/* ---------------------------------------------------------------------- */ + +void BondBPMSpring::settings(int narg, char **arg) +{ + BondBPM::settings(narg, arg); + + int iarg; + for (std::size_t i = 0; i < leftover_iarg.size(); i++) { + iarg = leftover_iarg[i]; + if (strcmp(arg[iarg], "smooth") == 0) { + if (iarg + 1 > narg) error->all(FLERR, "Illegal bond bpm command"); + smooth_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); + i += 1; + } else { + error->all(FLERR, "Illegal bond_style command"); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes out coeffs to restart file +------------------------------------------------------------------------- */ + +void BondBPMSpring::write_restart(FILE *fp) +{ + fwrite(&k[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&ecrit[1], sizeof(double), atom->nbondtypes, fp); + fwrite(&gamma[1], sizeof(double), atom->nbondtypes, fp); +} + +/* ---------------------------------------------------------------------- + proc 0 reads coeffs from restart file, bcasts them +------------------------------------------------------------------------- */ + +void BondBPMSpring::read_restart(FILE *fp) +{ + allocate(); + + if (comm->me == 0) { + utils::sfread(FLERR, &k[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &ecrit[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + utils::sfread(FLERR, &gamma[1], sizeof(double), atom->nbondtypes, fp, nullptr, error); + } + MPI_Bcast(&k[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&ecrit[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma[1], atom->nbondtypes, MPI_DOUBLE, 0, world); + + for (int i = 1; i <= atom->nbondtypes; i++) setflag[i] = 1; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void BondBPMSpring::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->nbondtypes; i++) + fprintf(fp, "%d %g %g %g\n", i, k[i], ecrit[i], gamma[i]); +} + +/* ---------------------------------------------------------------------- */ + +double BondBPMSpring::single(int type, double rsq, int i, int j, double &fforce) +{ + if (type <= 0) return 0.0; + + double r0; + for (int n = 0; n < atom->num_bond[i]; n++) { + if (atom->bond_atom[i][n] == atom->tag[j]) r0 = fix_bond_history->get_atom_value(i, n, 0); + } + + double r = sqrt(rsq); + double rinv = 1.0 / r; + fforce = k[type] * (r0 - r); + + double **x = atom->x; + double **v = atom->v; + double delx = x[i][0] - x[j][0]; + double dely = x[i][1] - x[j][1]; + double delz = x[i][2] - x[j][2]; + double delvx = v[i][0] - v[j][0]; + double delvy = v[i][1] - v[j][1]; + double delvz = v[i][2] - v[j][2]; + double dot = delx * delvx + dely * delvy + delz * delvz; + fforce -= gamma[type] * dot * rinv; + fforce *= rinv; + + if (smooth_flag) { + double smooth = (r - r0) / (r0 * ecrit[type]); + smooth *= smooth; + smooth *= smooth; + smooth *= smooth; + smooth = 1 - smooth; + fforce *= smooth; + } + + return 0.0; +} diff --git a/src/BPM/bond_bpm_spring.h b/src/BPM/bond_bpm_spring.h new file mode 100644 index 0000000000..1528dbcd07 --- /dev/null +++ b/src/BPM/bond_bpm_spring.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 BOND_CLASS +// clang-format off +BondStyle(bpm/spring,BondBPMSpring); +// clang-format on +#else + +#ifndef LMP_BOND_BPM_SPRING_H +#define LMP_BOND_BPM_SPRING_H + +#include "bond_bpm.h" + +namespace LAMMPS_NS { + +class BondBPMSpring : public BondBPM { + public: + BondBPMSpring(class LAMMPS *); + ~BondBPMSpring() override; + void compute(int, int) override; + void coeff(int, char **) override; + void init_style() override; + void settings(int, char **) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + double single(int, double, int, int, double &) override; + + protected: + double *k, *ecrit, *gamma; + int smooth_flag; + + void allocate(); + void store_data(); + double store_bond(int, int, int); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/BPM/compute_nbond_atom.cpp b/src/BPM/compute_nbond_atom.cpp new file mode 100644 index 0000000000..cc16473767 --- /dev/null +++ b/src/BPM/compute_nbond_atom.cpp @@ -0,0 +1,145 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "compute_nbond_atom.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "update.h" + +#include + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) : + Compute(_lmp, narg, arg), nbond(nullptr) +{ + if (narg < 3) error->all(FLERR, "Illegal compute nbond/atom command"); + + peratom_flag = 1; + size_peratom_cols = 0; + peatomflag = 1; + timeflag = 1; + comm_reverse = 1; + + nmax = 0; +} + +/* ---------------------------------------------------------------------- */ + +ComputeNBondAtom::~ComputeNBondAtom() +{ + memory->destroy(nbond); +} + +/* ---------------------------------------------------------------------- */ + +void ComputeNBondAtom::compute_peratom() +{ + + invoked_peratom = update->ntimestep; + if (update->eflag_atom != invoked_peratom) + error->all(FLERR, "Per-atom nbond was not tallied on needed timestep"); + + // grow local nbond array if necessary + // needs to be atom->nmax in length + + if (atom->nmax > nmax) { + memory->destroy(nbond); + nmax = atom->nmax; + memory->create(nbond, nmax, "nbond/atom:nbond"); + vector_atom = nbond; + } + + // npair includes ghosts if either newton flag is set + // b/c some bonds/dihedrals call pair::ev_tally with pairwise info + // nbond includes ghosts if newton_bond is set + // ntotal includes ghosts if either newton flag is set + // KSpace includes ghosts if tip4pflag is set + + int nlocal = atom->nlocal; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + + int ntotal = nlocal; + if (force->newton) ntotal += atom->nghost; + + // set local nbond array + int i, j, k; + int *num_bond = atom->num_bond; + int newton_bond = force->newton_bond; + + for (i = 0; i < ntotal; i++) nbond[i] = 0; + + for (i = 0; i < nlocal; i++) { + for (j = 0; j < num_bond[i]; j++) { + if (bond_type[i][j] <= 0) continue; + + k = atom->map(bond_atom[i][j]); + if (k < 0) continue; + + nbond[i] += 1; + if (newton_bond) nbond[k] += 1; + } + } + + // communicate ghost nbond between neighbor procs + if (force->newton) comm->reverse_comm(this); + + // zero nbond of atoms not in group + // only do this after comm since ghost contributions must be included + int *mask = atom->mask; + + for (i = 0; i < nlocal; i++) + if (!(mask[i] & groupbit)) nbond[i] = 0.0; +} + +/* ---------------------------------------------------------------------- */ + +int ComputeNBondAtom::pack_reverse_comm(int n, int first, double *buf) +{ + int i, m, last; + + m = 0; + last = first + n; + for (i = first; i < last; i++) buf[m++] = nbond[i]; + return m; +} + +/* ---------------------------------------------------------------------- */ + +void ComputeNBondAtom::unpack_reverse_comm(int n, int *list, double *buf) +{ + int i, j, m; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + nbond[j] += buf[m++]; + } +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based array +------------------------------------------------------------------------- */ + +double ComputeNBondAtom::memory_usage() +{ + double bytes = nmax * sizeof(double); + return bytes; +} diff --git a/src/BPM/compute_nbond_atom.h b/src/BPM/compute_nbond_atom.h new file mode 100644 index 0000000000..32d4ca2462 --- /dev/null +++ b/src/BPM/compute_nbond_atom.h @@ -0,0 +1,45 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 COMPUTE_CLASS +// clang-format off +ComputeStyle(nbond/atom,ComputeNBondAtom); +// clang-format on +#else + +#ifndef LMP_COMPUTE_NBOND_ATOM_H +#define LMP_COMPUTE_NBOND_ATOM_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeNBondAtom : public Compute { + public: + ComputeNBondAtom(class LAMMPS *, int, char **); + ~ComputeNBondAtom() override; + void init() override {} + void compute_peratom() override; + int pack_reverse_comm(int, int, double *) override; + void unpack_reverse_comm(int, int *, double *) override; + double memory_usage() override; + + private: + int nmax; + double *nbond; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/BPM/fix_nve_bpm_sphere.cpp b/src/BPM/fix_nve_bpm_sphere.cpp new file mode 100644 index 0000000000..77e2441618 --- /dev/null +++ b/src/BPM/fix_nve_bpm_sphere.cpp @@ -0,0 +1,157 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "fix_nve_bpm_sphere.h" + +#include "atom.h" +#include "atom_vec.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "math_extra.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +using namespace MathExtra; + +/* ---------------------------------------------------------------------- */ + +FixNVEBPMSphere::FixNVEBPMSphere(LAMMPS *_lmp, int narg, char **arg) : FixNVE(_lmp, narg, arg) +{ + if (narg < 3) error->all(FLERR, "Illegal fix nve/bpm/sphere command"); + + time_integrate = 1; + + // process extra keywords + // inertia = moment of inertia prefactor for sphere or disc + + inertia = 0.4; + + int iarg = 3; + while (iarg < narg) { + if (strcmp(arg[iarg], "disc") == 0) { + inertia = 0.5; + if (domain->dimension != 2) + error->all(FLERR, "Fix nve/bpm/sphere disc requires 2d simulation"); + iarg++; + } else + error->all(FLERR, "Illegal fix nve/bpm/sphere command"); + } + + inv_inertia = 1.0 / inertia; + + // error checks + + if (!atom->quat_flag || !atom->sphere_flag) + error->all(FLERR, "Fix nve/bpm/sphere requires atom style bpm/sphere"); +} + +/* ---------------------------------------------------------------------- */ + +void FixNVEBPMSphere::init() +{ + FixNVE::init(); + + // check that all particles are finite-size spheres + // no point particles allowed + + double *radius = atom->radius; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) + if (radius[i] == 0.0) error->one(FLERR, "Fix nve/bpm/sphere requires extended particles"); +} + +/* ---------------------------------------------------------------------- */ + +void FixNVEBPMSphere::initial_integrate(int /*vflag*/) +{ + double dtq, dtfm, dtirotate, particle_inertia; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double **omega = atom->omega; + double **torque = atom->torque; + double **quat = atom->quat; + double *radius = atom->radius; + double *rmass = atom->rmass; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + // set timestep here since dt may have changed or come via rRESPA + dtq = 0.5 * dtv; + + // update v,x,omega,quat for all particles + // d_omega/dt = torque / inertia + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + x[i][0] += dtv * v[i][0]; + x[i][1] += dtv * v[i][1]; + x[i][2] += dtv * v[i][2]; + + particle_inertia = inertia * (radius[i] * radius[i] * rmass[i]); + dtirotate = dtf / particle_inertia; + omega[i][0] += dtirotate * torque[i][0]; + omega[i][1] += dtirotate * torque[i][1]; + omega[i][2] += dtirotate * torque[i][2]; + + MathExtra::richardson_sphere(quat[i], omega[i], dtq); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixNVEBPMSphere::final_integrate() +{ + double dtfm, dtirotate, particle_inertia; + + double **v = atom->v; + double **f = atom->f; + double **omega = atom->omega; + double **torque = atom->torque; + double *rmass = atom->rmass; + double *radius = atom->radius; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + // update v,omega for all particles + // d_omega/dt = torque / inertia + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + + particle_inertia = inertia * (radius[i] * radius[i] * rmass[i]); + dtirotate = dtf / particle_inertia; + omega[i][0] += dtirotate * torque[i][0]; + omega[i][1] += dtirotate * torque[i][1]; + omega[i][2] += dtirotate * torque[i][2]; + } +} diff --git a/src/BPM/fix_nve_bpm_sphere.h b/src/BPM/fix_nve_bpm_sphere.h new file mode 100644 index 0000000000..5f96f33df5 --- /dev/null +++ b/src/BPM/fix_nve_bpm_sphere.h @@ -0,0 +1,44 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 +// clang-format off +FixStyle(nve/bpm/sphere,FixNVEBPMSphere); +// clang-format on +#else + +#ifndef LMP_FIX_NVE_BPM_SPHERE_H +#define LMP_FIX_NVE_BPM_SPHERE_H + +#include "fix_nve.h" + +namespace LAMMPS_NS { + +class FixNVEBPMSphere : public FixNVE { + public: + FixNVEBPMSphere(class LAMMPS *, int, char **); + + void init() override; + void initial_integrate(int) override; + void final_integrate() override; + + protected: + double inertia, inv_inertia; + int extra; + int dlm; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/BPM/pair_bpm_spring.cpp b/src/BPM/pair_bpm_spring.cpp new file mode 100644 index 0000000000..40f40b8a3b --- /dev/null +++ b/src/BPM/pair_bpm_spring.cpp @@ -0,0 +1,326 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "pair_bpm_spring.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "memory.h" +#include "neigh_list.h" +#include "neighbor.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +PairBPMSpring::PairBPMSpring(LAMMPS *_lmp) : Pair(_lmp) +{ + writedata = 1; +} + +/* ---------------------------------------------------------------------- */ + +PairBPMSpring::~PairBPMSpring() +{ + if (allocated) { + memory->destroy(setflag); + memory->destroy(cutsq); + + memory->destroy(k); + memory->destroy(cut); + memory->destroy(gamma); + } +} + +/* ---------------------------------------------------------------------- */ + +void PairBPMSpring::compute(int eflag, int vflag) +{ + int i, j, ii, jj, inum, jnum, itype, jtype; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair; + double r, rsq, rinv, factor_lj; + int *ilist, *jlist, *numneigh, **firstneigh; + double vxtmp, vytmp, vztmp, delvx, delvy, delvz, dot, smooth; + + evdwl = 0.0; + if (eflag || vflag) + ev_setup(eflag, vflag); + else + evflag = vflag_fdotr = 0; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + double *special_lj = force->special_lj; + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + vxtmp = v[i][0]; + vytmp = v[i][1]; + vztmp = v[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + + if (factor_lj == 0) continue; + + j &= NEIGHMASK; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r = sqrt(rsq); + + rinv = 1.0 / r; + fpair = k[itype][jtype] * (cut[itype][jtype] - r); + + smooth = rsq / cutsq[itype][jtype]; + smooth *= smooth; + smooth *= smooth; + smooth = 1.0 - smooth; + delvx = vxtmp - v[j][0]; + delvy = vytmp - v[j][1]; + delvz = vztmp - v[j][2]; + dot = delx * delvx + dely * delvy + delz * delvz; + fpair -= gamma[itype][jtype] * dot * smooth * rinv; + + fpair *= factor_lj * rinv; + if (eflag) evdwl = 0.0; + + f[i][0] += delx * fpair; + f[i][1] += dely * fpair; + f[i][2] += delz * fpair; + + if (newton_pair || j < nlocal) { + f[j][0] -= delx * fpair; + f[j][1] -= dely * fpair; + f[j][2] -= delz * fpair; + } + + if (evflag) ev_tally(i, j, nlocal, newton_pair, evdwl, 0.0, fpair, delx, dely, delz); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- + allocate all arrays +------------------------------------------------------------------------- */ + +void PairBPMSpring::allocate() +{ + allocated = 1; + const int np1 = atom->ntypes + 1; + + memory->create(setflag, np1, np1, "pair:setflag"); + for (int i = 1; i < np1; i++) + for (int j = i; j < np1; j++) setflag[i][j] = 0; + + memory->create(cutsq, np1, np1, "pair:cutsq"); + + memory->create(k, np1, np1, "pair:k"); + memory->create(cut, np1, np1, "pair:cut"); + memory->create(gamma, np1, np1, "pair:gamma"); +} + +/* ---------------------------------------------------------------------- + global settings +------------------------------------------------------------------------- */ + +void PairBPMSpring::settings(int narg, char ** /*arg*/) +{ + if (narg != 0) error->all(FLERR, "Illegal pair_style command"); +} + +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ + +void PairBPMSpring::coeff(int narg, char **arg) +{ + if (narg != 5) error->all(FLERR, "Incorrect args for pair coefficients"); + if (!allocated) allocate(); + + int ilo, ihi, 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_one = utils::numeric(FLERR, arg[2], false, lmp); + double cut_one = utils::numeric(FLERR, arg[3], false, lmp); + double gamma_one = utils::numeric(FLERR, arg[4], false, lmp); + + if (cut_one <= 0.0) error->all(FLERR, "Incorrect args for pair coefficients"); + + int count = 0; + for (int i = ilo; i <= ihi; i++) { + for (int j = MAX(jlo, i); j <= jhi; j++) { + k[i][j] = k_one; + cut[i][j] = cut_one; + gamma[i][j] = gamma_one; + + setflag[i][j] = 1; + count++; + } + } + + if (count == 0) error->all(FLERR, "Incorrect args for pair coefficients"); +} + +/* ---------------------------------------------------------------------- + init for one type pair i,j and corresponding j,i +------------------------------------------------------------------------- */ + +double PairBPMSpring::init_one(int i, int j) +{ + if (setflag[i][j] == 0) { + cut[i][j] = mix_distance(cut[i][i], cut[j][j]); + k[i][j] = mix_energy(k[i][i], k[j][j], cut[i][i], cut[j][j]); + gamma[i][j] = mix_energy(gamma[i][i], gamma[j][j], cut[i][i], cut[j][j]); + } + + cut[j][i] = cut[i][j]; + k[j][i] = k[i][j]; + gamma[j][i] = gamma[i][j]; + + return cut[i][j]; +} + +/* ---------------------------------------------------------------------- + proc 0 writes to restart file +------------------------------------------------------------------------- */ + +void PairBPMSpring::write_restart(FILE *fp) +{ + write_restart_settings(fp); + + int i, j; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + fwrite(&setflag[i][j], sizeof(int), 1, fp); + if (setflag[i][j]) { + fwrite(&k[i][j], sizeof(double), 1, fp); + fwrite(&cut[i][j], sizeof(double), 1, fp); + fwrite(&gamma[i][j], sizeof(double), 1, fp); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 reads from restart file, bcasts +------------------------------------------------------------------------- */ + +void PairBPMSpring::read_restart(FILE *fp) +{ + read_restart_settings(fp); + allocate(); + + int i, j; + int me = comm->me; + for (i = 1; i <= atom->ntypes; i++) + for (j = i; j <= atom->ntypes; j++) { + if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); + MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); + if (setflag[i][j]) { + if (me == 0) { + utils::sfread(FLERR, &k[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); + utils::sfread(FLERR, &gamma[i][j], sizeof(double), 1, fp, nullptr, error); + } + MPI_Bcast(&k[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma[i][j], 1, MPI_DOUBLE, 0, world); + } + } +} + +/* ---------------------------------------------------------------------- + proc 0 writes to data file +------------------------------------------------------------------------- */ + +void PairBPMSpring::write_data(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + fprintf(fp, "%d %g %g %g\n", i, k[i][i], cut[i][i], gamma[i][i]); +} + +/* ---------------------------------------------------------------------- + proc 0 writes all pairs to data file +------------------------------------------------------------------------- */ + +void PairBPMSpring::write_data_all(FILE *fp) +{ + for (int i = 1; i <= atom->ntypes; i++) + for (int j = i; j <= atom->ntypes; j++) + fprintf(fp, "%d %d %g %g %g\n", i, j, k[i][j], cut[i][j], gamma[i][j]); +} + +/* ---------------------------------------------------------------------- */ + +double PairBPMSpring::single(int i, int j, int itype, int jtype, double rsq, double /*factor_coul*/, + double factor_lj, double &fforce) +{ + double fpair, r, rinv; + double delx, dely, delz, delvx, delvy, delvz, dot, smooth; + + if (rsq > cutsq[itype][jtype]) return 0.0; + + double **x = atom->x; + double **v = atom->v; + + r = sqrt(rsq); + rinv = 1.0 / r; + + fpair = k[itype][jtype] * (cut[itype][jtype] - r); + + smooth = rsq / cutsq[itype][jtype]; + smooth *= smooth; + smooth = 1.0 - smooth; + delx = x[i][0] - x[j][0]; + dely = x[i][1] - x[j][1]; + delz = x[i][2] - x[j][2]; + delvx = v[i][0] - v[j][0]; + delvy = v[i][1] - v[j][1]; + delvz = v[i][2] - v[j][2]; + dot = delx * delvx + dely * delvy + delz * delvz; + fpair -= gamma[itype][jtype] * dot * rinv * smooth; + + fpair *= factor_lj; + fforce = fpair; + + return 0.0; +} diff --git a/src/BPM/pair_bpm_spring.h b/src/BPM/pair_bpm_spring.h new file mode 100644 index 0000000000..97d7995f14 --- /dev/null +++ b/src/BPM/pair_bpm_spring.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 PAIR_CLASS +// clang-format off +PairStyle(bpm/spring,PairBPMSpring); +// clang-format on +#else + +#ifndef LMP_PAIR_BPM_SPRING_H +#define LMP_PAIR_BPM_SPRING_H + +#include "pair.h" + +namespace LAMMPS_NS { + +class PairBPMSpring : public Pair { + public: + PairBPMSpring(class LAMMPS *); + ~PairBPMSpring() override; + void compute(int, int) override; + void settings(int, char **) override; + void coeff(int, char **) override; + double init_one(int, int) override; + void write_restart(FILE *) override; + void read_restart(FILE *) override; + void write_data(FILE *) override; + void write_data_all(FILE *) override; + double single(int, int, int, int, double, double, double, double &) override; + + protected: + double **k, **cut, **gamma; + + void allocate(); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/BROWNIAN/fix_brownian.h b/src/BROWNIAN/fix_brownian.h index f9f4ab9cd1..703a49cd69 100644 --- a/src/BROWNIAN/fix_brownian.h +++ b/src/BROWNIAN/fix_brownian.h @@ -38,23 +38,3 @@ class FixBrownian : public FixBrownianBase { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix brownian command. - -Wrong number/type of input arguments. - -E: Fix brownian viscous drag coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian diffusion coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian seed must be > 0. - -Self-explanatory. - -*/ diff --git a/src/BROWNIAN/fix_brownian_asphere.cpp b/src/BROWNIAN/fix_brownian_asphere.cpp index d0191c751e..18321cdafd 100644 --- a/src/BROWNIAN/fix_brownian_asphere.cpp +++ b/src/BROWNIAN/fix_brownian_asphere.cpp @@ -56,7 +56,7 @@ FixBrownianAsphere::FixBrownianAsphere(LAMMPS *lmp, int narg, char **arg) : void FixBrownianAsphere::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); if (!avec) error->all(FLERR, "Compute brownian/asphere requires atom style ellipsoid"); // check that all particles are finite-size ellipsoids diff --git a/src/BROWNIAN/fix_brownian_asphere.h b/src/BROWNIAN/fix_brownian_asphere.h index d41d3ae3ac..a9c24d17a2 100644 --- a/src/BROWNIAN/fix_brownian_asphere.h +++ b/src/BROWNIAN/fix_brownian_asphere.h @@ -42,41 +42,3 @@ class FixBrownianAsphere : public FixBrownianBase { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix brownian/asphere command. - -Wrong number/type of input arguments. - -E: Compute brownian/asphere requires atom style sphere - -Self-explanatory. - -E: Compute brownian/asphere requires atom style ellipsoid - -Self-explanatory. - -E: Compute brownian/asphere dipole requires atom attribute mu - -Self-explanatory. - -E: Fix brownian/asphere translational viscous drag coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/asphere rotational viscous drag coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/asphere translational diffusion coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/asphere rotational diffusion coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/asphere seed must be > 0. - -*/ diff --git a/src/BROWNIAN/fix_brownian_base.h b/src/BROWNIAN/fix_brownian_base.h index cc8234f080..6f6be89b0c 100644 --- a/src/BROWNIAN/fix_brownian_base.h +++ b/src/BROWNIAN/fix_brownian_base.h @@ -48,53 +48,12 @@ class FixBrownianBase : public Fix { int noise_flag; // 0/1 for noise off/on int gaussian_noise_flag; // 0/1 for uniform/gaussian noise - double temp; // temperature - double rot_temp; // temperature - double g1, g2; // prefactors in time stepping + double temp; // temperature + double rot_temp; // temperature + double g1, g2; // prefactors in time stepping class RanMars *rng; }; } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal fix brownian command. - -Wrong number/type of input arguments. - -E: Fix brownian gamma_t_eigen values must be > 0. - -Self-explanatory. - -E: Fix brownian gamma_r_eigen values must be > 0. - -Self-explanatory. - -E: Fix brownian seed must be > 0. - -Self-explanatory. - -E: Fix brownian temp must be > 0. - -Self-explanatory. - -E: Fix brownian gamma_t must be > 0. - -Self-explanatory. - -E: Fix brownian gamma_r must be > 0. - -Self-explanatory. - -E: Fix brownian rotation_temp must be > 0. - -Self-explanatory. - -E: Do not explicitly set planar_rotation for 2D simulation - -Self-explanatory. - - -*/ diff --git a/src/BROWNIAN/fix_brownian_sphere.h b/src/BROWNIAN/fix_brownian_sphere.h index a80f2898a1..258c4cbf0d 100644 --- a/src/BROWNIAN/fix_brownian_sphere.h +++ b/src/BROWNIAN/fix_brownian_sphere.h @@ -39,41 +39,3 @@ class FixBrownianSphere : public FixBrownianBase { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix brownian/sphere command. - -Wrong number/type of input arguments. - -E: Compute brownian/sphere requires atom style sphere - -Self-explanatory. - -E: Compute brownian/sphere requires atom attribute mu - -Self-explanatory. - -E: Compute brownian/sphere requires atom style sphere - -Self-explanatory. - -E: Fix brownian/sphere translational viscous drag coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/sphere rotational viscous drag coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/sphere translational diffusion coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/sphere rotational diffusion coefficient must be > 0. - -Self-explanatory. - -E: Fix brownian/sphere seed must be > 0. - -*/ diff --git a/src/BROWNIAN/fix_propel_self.cpp b/src/BROWNIAN/fix_propel_self.cpp index ea7a3c6834..55fce754a6 100644 --- a/src/BROWNIAN/fix_propel_self.cpp +++ b/src/BROWNIAN/fix_propel_self.cpp @@ -100,7 +100,7 @@ void FixPropelSelf::init() error->all(FLERR, "Fix propel/self requires atom attribute mu with option dipole"); if (mode == QUAT) { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); if (!avec) error->all(FLERR, "Fix propel/self requires atom style ellipsoid with option quat"); // check that all particles are finite-size ellipsoids diff --git a/src/BROWNIAN/fix_propel_self.h b/src/BROWNIAN/fix_propel_self.h index 0b8ee4f4b1..887b042051 100644 --- a/src/BROWNIAN/fix_propel_self.h +++ b/src/BROWNIAN/fix_propel_self.h @@ -46,23 +46,3 @@ class FixPropelSelf : public Fix { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix propel/self command. - -Wrong number/type of input arguments. - -E: Fix propel/self requires atom attribute mu with option dipole. - -Self-explanatory. - -E: Fix propel/self requires atom style ellipsoid with option quat. - -Self-explanatory. - -Fix propel/self requires extended particles with option quat. - -Self-explanatory. - -*/ diff --git a/src/CG-DNA/atom_vec_oxdna.cpp b/src/CG-DNA/atom_vec_oxdna.cpp index 120fe5d9ac..52380eca57 100644 --- a/src/CG-DNA/atom_vec_oxdna.cpp +++ b/src/CG-DNA/atom_vec_oxdna.cpp @@ -33,18 +33,13 @@ AtomVecOxdna::AtomVecOxdna(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "id5p"; - fields_copy = (char *) "id5p"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "id5p"; - fields_border_vel = (char *) ""; - fields_exchange = (char *) "id5p"; - fields_restart = (char *) "id5p"; - fields_create = (char *) ""; - fields_data_atom = (char *) "id type x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"id5p"}; + fields_copy = {"id5p"}; + fields_border = {"id5p"}; + fields_exchange = {"id5p"}; + fields_restart = {"id5p"}; + fields_data_atom = {"id", "type", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); diff --git a/src/CG-DNA/atom_vec_oxdna.h b/src/CG-DNA/atom_vec_oxdna.h index 7830aeaf33..4c439dc3a6 100644 --- a/src/CG-DNA/atom_vec_oxdna.h +++ b/src/CG-DNA/atom_vec_oxdna.h @@ -40,7 +40,3 @@ class AtomVecOxdna : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/CG-DNA/bond_oxdna2_fene.h b/src/CG-DNA/bond_oxdna2_fene.h index 3b0c5e0a36..89e291505f 100644 --- a/src/CG-DNA/bond_oxdna2_fene.h +++ b/src/CG-DNA/bond_oxdna2_fene.h @@ -34,30 +34,3 @@ class BondOxdna2Fene : public BondOxdnaFene { #endif #endif - -/* ERROR/WARNING messages: - -W: FENE bond too long: %ld %d %d %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -W: Use special bonds = 0,1,1 with bond style oxdna - -Most FENE models need this setting for the special_bonds command. - -W: FENE bond too long: %ld %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -*/ diff --git a/src/CG-DNA/bond_oxdna_fene.cpp b/src/CG-DNA/bond_oxdna_fene.cpp index 58b127c63c..acaa26b7e1 100644 --- a/src/CG-DNA/bond_oxdna_fene.cpp +++ b/src/CG-DNA/bond_oxdna_fene.cpp @@ -145,16 +145,16 @@ void BondOxdnaFene::ev_tally_xyz(int i, int j, int nlocal, int newton_bond, doub ------------------------------------------------------------------------- */ void BondOxdnaFene::compute(int eflag, int vflag) { - int a,b,in,type; - double delf[3],delta[3],deltb[3]; // force, torque increment;; - double delr[3],ebond,fbond; - double rsq,Deltasq,rlogarg; - double r,rr0,rr0sq; + int a, b, in, type; + double delf[3], delta[3], deltb[3]; // force, torque increment;; + double delr[3], ebond, fbond; + double rsq, Deltasq, rlogarg; + double r, rr0, rr0sq; // vectors COM-backbone site in lab frame - double ra_cs[3],rb_cs[3]; + double ra_cs[3], rb_cs[3]; // Cartesian unit vectors in lab frame - double ax[3],ay[3],az[3]; - double bx[3],by[3],bz[3]; + double ax[3], ay[3], az[3]; + double bx[3], by[3], bz[3]; double **x = atom->x; double **f = atom->f; @@ -170,9 +170,9 @@ void BondOxdnaFene::compute(int eflag, int vflag) // n(x/y/z)_xtrct = extracted local unit vectors in lab frame from oxdna_excv int dim; - nx_xtrct = (double **) force->pair->extract("nx",dim); - ny_xtrct = (double **) force->pair->extract("ny",dim); - nz_xtrct = (double **) force->pair->extract("nz",dim); + nx_xtrct = (double **) force->pair->extract("nx", dim); + ny_xtrct = (double **) force->pair->extract("ny", dim); + nz_xtrct = (double **) force->pair->extract("nz", dim); // loop over FENE bonds diff --git a/src/CG-DNA/bond_oxdna_fene.h b/src/CG-DNA/bond_oxdna_fene.h index d2aa84612a..1f754e817a 100644 --- a/src/CG-DNA/bond_oxdna_fene.h +++ b/src/CG-DNA/bond_oxdna_fene.h @@ -39,8 +39,8 @@ class BondOxdnaFene : public Bond { double single(int, double, int, int, double &) override; protected: - double *k, *Delta, *r0; // FENE - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double *k, *Delta, *r0; // FENE + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors void allocate(); void ev_tally_xyz(int, int, int, int, double, double, double, double, double, double, double); @@ -50,30 +50,3 @@ class BondOxdnaFene : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -W: FENE bond too long: %ld %d %d %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -W: Use special bonds = 0,1,1 with bond style oxdna - -Most FENE models need this setting for the special_bonds command. - -W: FENE bond too long: %ld %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -*/ diff --git a/src/CG-DNA/bond_oxrna2_fene.h b/src/CG-DNA/bond_oxrna2_fene.h index 4260b69174..638fea394e 100644 --- a/src/CG-DNA/bond_oxrna2_fene.h +++ b/src/CG-DNA/bond_oxrna2_fene.h @@ -35,30 +35,3 @@ class BondOxrna2Fene : public BondOxdnaFene { #endif #endif - -/* ERROR/WARNING messages: - -W: FENE bond too long: %ld %d %d %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -W: Use special bonds = 0,1,1 with bond style oxrna - -Most FENE models need this setting for the special_bonds command. - -W: FENE bond too long: %ld %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -*/ diff --git a/src/CG-DNA/fix_nve_dot.cpp b/src/CG-DNA/fix_nve_dot.cpp index 53b13cdbf1..3806e452c3 100644 --- a/src/CG-DNA/fix_nve_dot.cpp +++ b/src/CG-DNA/fix_nve_dot.cpp @@ -37,7 +37,7 @@ FixNVEDot::FixNVEDot(LAMMPS *lmp, int narg, char **arg) : void FixNVEDot::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Compute nve/dot requires atom style ellipsoid"); diff --git a/src/CG-DNA/fix_nve_dot.h b/src/CG-DNA/fix_nve_dot.h index baebaece22..86562f5b74 100644 --- a/src/CG-DNA/fix_nve_dot.h +++ b/src/CG-DNA/fix_nve_dot.h @@ -54,15 +54,3 @@ class FixNVEDot : public FixNVE { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Compute nve/dot requires atom style ellipsoid - -Self-explanatory. - -E: Fix nve/dot requires extended particles - -This fix can only be used for particles with a shape setting. - -*/ diff --git a/src/CG-DNA/fix_nve_dotc_langevin.cpp b/src/CG-DNA/fix_nve_dotc_langevin.cpp index 54c1d1b545..8ca4acf510 100644 --- a/src/CG-DNA/fix_nve_dotc_langevin.cpp +++ b/src/CG-DNA/fix_nve_dotc_langevin.cpp @@ -89,7 +89,7 @@ void FixNVEDotcLangevin::init() int *mask = atom->mask; int nlocal = atom->nlocal; - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Fix nve/dotc/langevin requires atom style ellipsoid"); diff --git a/src/CG-DNA/fix_nve_dotc_langevin.h b/src/CG-DNA/fix_nve_dotc_langevin.h index 9353ae75b9..ab74e13ab5 100644 --- a/src/CG-DNA/fix_nve_dotc_langevin.h +++ b/src/CG-DNA/fix_nve_dotc_langevin.h @@ -64,15 +64,3 @@ class FixNVEDotcLangevin : public FixNVE { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Compute nve/dotc/langevin requires atom style ellipsoid - -Self-explanatory. - -E: Fix nve/dotc/langevin requires extended particles - -This fix can only be used for particles with a shape setting. - -*/ diff --git a/src/CG-DNA/pair_oxdna2_coaxstk.h b/src/CG-DNA/pair_oxdna2_coaxstk.h index 6bf763a1fe..4030194c19 100644 --- a/src/CG-DNA/pair_oxdna2_coaxstk.h +++ b/src/CG-DNA/pair_oxdna2_coaxstk.h @@ -55,7 +55,7 @@ class PairOxdna2Coaxstk : public Pair { double **a_cxst6, **theta_cxst6_0, **dtheta_cxst6_ast; double **b_cxst6, **dtheta_cxst6_c; double **AA_cxst1, **BB_cxst1; - double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; @@ -64,17 +64,3 @@ class PairOxdna2Coaxstk : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna2_dh.h b/src/CG-DNA/pair_oxdna2_dh.h index db37ba0d43..aca5391122 100644 --- a/src/CG-DNA/pair_oxdna2_dh.h +++ b/src/CG-DNA/pair_oxdna2_dh.h @@ -45,7 +45,7 @@ class PairOxdna2Dh : public Pair { protected: double **qeff_dh_pf, **kappa_dh; double **b_dh, **cut_dh_ast, **cutsq_dh_ast, **cut_dh_c, **cutsq_dh_c; - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; @@ -54,17 +54,3 @@ class PairOxdna2Dh : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna2_excv.h b/src/CG-DNA/pair_oxdna2_excv.h index 6c37ed9dc8..c24239d343 100644 --- a/src/CG-DNA/pair_oxdna2_excv.h +++ b/src/CG-DNA/pair_oxdna2_excv.h @@ -35,17 +35,3 @@ class PairOxdna2Excv : public PairOxdnaExcv { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna_coaxstk.h b/src/CG-DNA/pair_oxdna_coaxstk.h index 62ffb7f2c1..67c8b34a9c 100644 --- a/src/CG-DNA/pair_oxdna_coaxstk.h +++ b/src/CG-DNA/pair_oxdna_coaxstk.h @@ -57,7 +57,7 @@ class PairOxdnaCoaxstk : public Pair { double **b_cxst6, **dtheta_cxst6_c; double **a_cxst3p, **cosphi_cxst3p_ast, **b_cxst3p, **cosphi_cxst3p_c; double **a_cxst4p, **cosphi_cxst4p_ast, **b_cxst4p, **cosphi_cxst4p_c; - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; @@ -66,17 +66,3 @@ class PairOxdnaCoaxstk : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna_excv.cpp b/src/CG-DNA/pair_oxdna_excv.cpp index dfc96be13e..a201a5ccf7 100644 --- a/src/CG-DNA/pair_oxdna_excv.cpp +++ b/src/CG-DNA/pair_oxdna_excv.cpp @@ -139,7 +139,7 @@ void PairOxdnaExcv::compute(int eflag, int vflag) int newton_pair = force->newton_pair; int *alist,*blist,*numneigh,**firstneigh; - AtomVecEllipsoid *avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + auto avec = dynamic_cast( atom->style_match("ellipsoid")); AtomVecEllipsoid::Bonus *bonus = avec->bonus; int *ellipsoid = atom->ellipsoid; diff --git a/src/CG-DNA/pair_oxdna_excv.h b/src/CG-DNA/pair_oxdna_excv.h index a255c954bb..17f35b848b 100644 --- a/src/CG-DNA/pair_oxdna_excv.h +++ b/src/CG-DNA/pair_oxdna_excv.h @@ -54,7 +54,7 @@ class PairOxdnaExcv : public Pair { double **lj1_sb, **lj2_sb, **b_sb, **cut_sb_c, **cutsq_sb_c; double **epsilon_bb, **sigma_bb, **cut_bb_ast, **cutsq_bb_ast; double **lj1_bb, **lj2_bb, **b_bb, **cut_bb_c, **cutsq_bb_c; - double **nx, **ny, **nz; // per-atom arrays for local unit vectors + double **nx, **ny, **nz; // per-atom arrays for local unit vectors virtual void allocate(); }; @@ -63,17 +63,3 @@ class PairOxdnaExcv : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna_hbond.h b/src/CG-DNA/pair_oxdna_hbond.h index 32120a79cf..8850e1bd9b 100644 --- a/src/CG-DNA/pair_oxdna_hbond.h +++ b/src/CG-DNA/pair_oxdna_hbond.h @@ -60,7 +60,7 @@ class PairOxdnaHbond : public Pair { double **b_hb7, **dtheta_hb7_c; double **a_hb8, **theta_hb8_0, **dtheta_hb8_ast; double **b_hb8, **dtheta_hb8_c; - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors int seqdepflag; virtual void allocate(); @@ -70,17 +70,3 @@ class PairOxdnaHbond : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna_stk.h b/src/CG-DNA/pair_oxdna_stk.h index 5e9329ea57..ae74ee77ac 100644 --- a/src/CG-DNA/pair_oxdna_stk.h +++ b/src/CG-DNA/pair_oxdna_stk.h @@ -59,7 +59,7 @@ class PairOxdnaStk : public Pair { double **b_st6, **dtheta_st6_c; double **a_st1, **cosphi_st1_ast, **b_st1, **cosphi_st1_c; double **a_st2, **cosphi_st2_ast, **b_st2, **cosphi_st2_c; - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors int seqdepflag; virtual void allocate(); @@ -70,17 +70,3 @@ class PairOxdnaStk : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxdna_xstk.h b/src/CG-DNA/pair_oxdna_xstk.h index 8d0a126943..ae808679f9 100644 --- a/src/CG-DNA/pair_oxdna_xstk.h +++ b/src/CG-DNA/pair_oxdna_xstk.h @@ -59,7 +59,7 @@ class PairOxdnaXstk : public Pair { double **b_xst7, **dtheta_xst7_c; double **a_xst8, **theta_xst8_0, **dtheta_xst8_ast; double **b_xst8, **dtheta_xst8_c; - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; @@ -68,17 +68,3 @@ class PairOxdnaXstk : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxrna2_dh.h b/src/CG-DNA/pair_oxrna2_dh.h index 132805130e..157bc0ae8e 100644 --- a/src/CG-DNA/pair_oxrna2_dh.h +++ b/src/CG-DNA/pair_oxrna2_dh.h @@ -35,17 +35,3 @@ class PairOxrna2Dh : public PairOxdna2Dh { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxrna2_excv.h b/src/CG-DNA/pair_oxrna2_excv.h index 1f28f865a4..2185e17ada 100644 --- a/src/CG-DNA/pair_oxrna2_excv.h +++ b/src/CG-DNA/pair_oxrna2_excv.h @@ -35,17 +35,3 @@ class PairOxrna2Excv : public PairOxdnaExcv { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxrna2_hbond.h b/src/CG-DNA/pair_oxrna2_hbond.h index 7fdd2e8c5b..e84295afb3 100644 --- a/src/CG-DNA/pair_oxrna2_hbond.h +++ b/src/CG-DNA/pair_oxrna2_hbond.h @@ -33,17 +33,3 @@ class PairOxrna2Hbond : public PairOxdnaHbond { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxrna2_stk.h b/src/CG-DNA/pair_oxrna2_stk.h index 8530544fdc..1cf404e73b 100644 --- a/src/CG-DNA/pair_oxrna2_stk.h +++ b/src/CG-DNA/pair_oxrna2_stk.h @@ -60,7 +60,7 @@ class PairOxrna2Stk : public Pair { double **b_st10, **dtheta_st10_c; double **a_st1, **cosphi_st1_ast, **b_st1, **cosphi_st1_c; double **a_st2, **cosphi_st2_ast, **b_st2, **cosphi_st2_c; - double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **ny_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors int seqdepflag; virtual void allocate(); @@ -71,17 +71,3 @@ class PairOxrna2Stk : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-DNA/pair_oxrna2_xstk.h b/src/CG-DNA/pair_oxrna2_xstk.h index c73839b4a7..919ee22857 100644 --- a/src/CG-DNA/pair_oxrna2_xstk.h +++ b/src/CG-DNA/pair_oxrna2_xstk.h @@ -56,7 +56,7 @@ class PairOxrna2Xstk : public Pair { double **b_xst7, **dtheta_xst7_c; double **a_xst8, **theta_xst8_0, **dtheta_xst8_ast; double **b_xst8, **dtheta_xst8_c; - double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors + double **nx_xtrct, **nz_xtrct; // per-atom arrays for local unit vectors virtual void allocate(); }; @@ -65,17 +65,3 @@ class PairOxrna2Xstk : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CG-SDK/pair_lj_sdk_coul_msm.h b/src/CG-SDK/pair_lj_sdk_coul_msm.h index 3b8c7afe47..1b43f39ec9 100644 --- a/src/CG-SDK/pair_lj_sdk_coul_msm.h +++ b/src/CG-SDK/pair_lj_sdk_coul_msm.h @@ -43,12 +43,3 @@ class PairLJSDKCoulMSM : public PairLJSDKCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with Pair style - -The kspace scalar pressure option is not (yet) compatible with at least one of -the defined Pair styles. - -*/ diff --git a/src/CLASS2/angle_class2.h b/src/CLASS2/angle_class2.h index 9c33e2c265..9503a35c70 100644 --- a/src/CLASS2/angle_class2.h +++ b/src/CLASS2/angle_class2.h @@ -49,11 +49,3 @@ class AngleClass2 : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CLASS2/bond_class2.h b/src/CLASS2/bond_class2.h index 3708bcef95..1ca65a8628 100644 --- a/src/CLASS2/bond_class2.h +++ b/src/CLASS2/bond_class2.h @@ -47,11 +47,3 @@ class BondClass2 : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CLASS2/dihedral_class2.h b/src/CLASS2/dihedral_class2.h index 226981b746..5dafe8e043 100644 --- a/src/CLASS2/dihedral_class2.h +++ b/src/CLASS2/dihedral_class2.h @@ -54,20 +54,3 @@ class DihedralClass2 : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Invalid coeffs for this dihedral style - -Cannot set class 2 coeffs in data file for this dihedral style. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CLASS2/improper_class2.h b/src/CLASS2/improper_class2.h index 0017c04892..8646b44735 100644 --- a/src/CLASS2/improper_class2.h +++ b/src/CLASS2/improper_class2.h @@ -49,16 +49,3 @@ class ImproperClass2 : public Improper { #endif #endif - -/* ERROR/WARNING messages: - -W: Improper problem: %d %ld %d %d %d %d - -Conformation of the 4 listed improper atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for improper coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index c95b34232b..f86ba3b035 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -484,7 +484,7 @@ void PairLJClass2::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast(update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -493,8 +493,8 @@ void PairLJClass2::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style, "^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast(update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast(update->integrate))->cutoff; else cut_respa = nullptr; } diff --git a/src/CLASS2/pair_lj_class2.h b/src/CLASS2/pair_lj_class2.h index bc42d434bc..a709be3f54 100644 --- a/src/CLASS2/pair_lj_class2.h +++ b/src/CLASS2/pair_lj_class2.h @@ -58,15 +58,3 @@ class PairLJClass2 : public Pair { #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: Incorrect args for pair coefficients -Self-explanatory. Check the input script or data file. -E: Pair cutoff < Respa interior cutoff -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. -*/ diff --git a/src/CLASS2/pair_lj_class2_coul_cut.h b/src/CLASS2/pair_lj_class2_coul_cut.h index ae2d54f7b4..c9da2222ea 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.h +++ b/src/CLASS2/pair_lj_class2_coul_cut.h @@ -56,21 +56,3 @@ class PairLJClass2CoulCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/class2/coul/cut requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 1b1cc9c5a9..03b1378920 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -672,7 +672,7 @@ void PairLJClass2CoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast(update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -683,8 +683,8 @@ void PairLJClass2CoulLong::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style, "^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast(update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast(update->integrate))->cutoff; else cut_respa = nullptr; diff --git a/src/CLASS2/pair_lj_class2_coul_long.h b/src/CLASS2/pair_lj_class2_coul_long.h index 06c6547cbd..9d1aeb711d 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.h +++ b/src/CLASS2/pair_lj_class2_coul_long.h @@ -62,30 +62,3 @@ class PairLJClass2CoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/class2/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/COLLOID/fix_wall_colloid.h b/src/COLLOID/fix_wall_colloid.h index 4ccec8afb4..7e6adf6308 100644 --- a/src/COLLOID/fix_wall_colloid.h +++ b/src/COLLOID/fix_wall_colloid.h @@ -39,20 +39,3 @@ class FixWallColloid : public FixWall { #endif #endif - -/* ERROR/WARNING messages: - -E: Fix wall/colloid requires atom style sphere - -Self-explanatory. - -E: Fix wall/colloid requires extended particles - -One of the particles has radius 0.0. - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index 5782586654..12362dab6f 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -494,7 +494,7 @@ void PairBrownian::init_style() else if (strstr(modify->fix[i]->style, "wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); flagwall = 1; // Walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast(modify->fix[i]); if (wallfix->xflag) flagwall = 2; // Moving walls exist } } diff --git a/src/COLLOID/pair_brownian.h b/src/COLLOID/pair_brownian.h index ded85d7df1..110e0aec77 100644 --- a/src/COLLOID/pair_brownian.h +++ b/src/COLLOID/pair_brownian.h @@ -62,41 +62,3 @@ class PairBrownian : public Pair { #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. - -W: Cannot include log terms without 1/r terms; setting flagHI to 1 - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair brownian requires atom style sphere - -Self-explanatory. - -W: Pair brownian needs newton pair on for momentum conservation - -Self-explanatory. - -E: Pair brownian requires extended particles - -One of the particles has radius 0.0. - -E: Pair brownian requires monodisperse particles - -All particles must be the same finite size. - -E: Cannot use multiple fix wall commands with pair brownian - -Self-explanatory. - -*/ diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index 2edbbadc0f..d24a65a821 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -362,7 +362,7 @@ void PairBrownianPoly::init_style() error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); flagwall = 1; // Walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast( modify->fix[i]); if (wallfix->xflag) flagwall = 2; // Moving walls exist } } diff --git a/src/COLLOID/pair_brownian_poly.h b/src/COLLOID/pair_brownian_poly.h index 110cb1ccd7..aef5a5c13d 100644 --- a/src/COLLOID/pair_brownian_poly.h +++ b/src/COLLOID/pair_brownian_poly.h @@ -37,23 +37,3 @@ class PairBrownianPoly : public PairBrownian { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair brownian/poly requires newton pair off - -Self-explanatory. - -E: Pair brownian/poly requires atom style sphere - -Self-explanatory. - -E: Pair brownian/poly requires extended particles - -One of the particles has radius 0.0. - -E: Cannot use multiple fix wall commands with pair brownian - -Self-explanatory. - -*/ diff --git a/src/COLLOID/pair_colloid.h b/src/COLLOID/pair_colloid.h index 5e81051a11..27057665e5 100644 --- a/src/COLLOID/pair_colloid.h +++ b/src/COLLOID/pair_colloid.h @@ -57,29 +57,3 @@ class PairColloid : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Overlapping small/large in pair colloid - -This potential is infinite when there is an overlap. - -E: Overlapping large/large in pair colloid - -This potential is infinite when there is an overlap. - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Invalid d1 or d2 value for pair colloid coeff - -Neither d1 or d2 can be < 0. - -*/ diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index c2117cf1ad..1267d42f1f 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -563,7 +563,7 @@ void PairLubricate::init_style() for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) { shearing = flagdeform = 1; - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } @@ -572,7 +572,7 @@ void PairLubricate::init_style() error->all(FLERR, "Cannot use multiple fix wall commands with pair lubricate"); flagwall = 1; // Walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast( modify->fix[i]); if (wallfix->xflag) flagwall = 2; // Moving walls exist } } diff --git a/src/COLLOID/pair_lubricate.h b/src/COLLOID/pair_lubricate.h index cc617f79de..a783312e5e 100644 --- a/src/COLLOID/pair_lubricate.h +++ b/src/COLLOID/pair_lubricate.h @@ -63,41 +63,3 @@ class PairLubricate : public Pair { #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. - -W: Cannot include log terms without 1/r terms; setting flagHI to 1 - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair lubricate requires atom style sphere - -Self-explanatory. - -E: Pair lubricate requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Pair lubricate requires monodisperse particles - -All particles must be the same finite size. - -E: Using pair lubricate with inconsistent fix deform remap option - -Must use remap v option with fix deform with this pair style. - -E: Cannot use multiple fix wall commands with pair lubricate - -Self-explanatory. - -*/ diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index 3d4fbcbc7d..aa83a53ce4 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -1801,7 +1801,7 @@ void PairLubricateU::init_style() "Cannot use multiple fix wall commands with " "pair lubricateU"); flagwall = 1; // Walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast( modify->fix[i]); if (wallfix->xflag) flagwall = 2; // Moving walls exist } } diff --git a/src/COLLOID/pair_lubricateU.h b/src/COLLOID/pair_lubricateU.h index a8544f261a..24be18710e 100644 --- a/src/COLLOID/pair_lubricateU.h +++ b/src/COLLOID/pair_lubricateU.h @@ -78,37 +78,3 @@ class PairLubricateU : public Pair { #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. - -W: Cannot include log terms without 1/r terms; setting flagHI to 1. - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair lubricateU requires atom style sphere - -Self-explanatory. - -E: Pair lubricateU requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Pair lubricateU requires monodisperse particles - -All particles must be the same finite size. - -E: Cannot use multiple fix wall commands with pair lubricateU - -Self-explanatory. - -*/ diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 0aed0df97f..1fad75a68c 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -1165,7 +1165,7 @@ void PairLubricateUPoly::init_style() "Cannot use multiple fix wall commands with " "pair lubricateU"); flagwall = 1; // Walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast( modify->fix[i]); if (wallfix->xflag) flagwall = 2; // Moving walls exist } } diff --git a/src/COLLOID/pair_lubricateU_poly.h b/src/COLLOID/pair_lubricateU_poly.h index 316edcefaf..ed5aab3aed 100644 --- a/src/COLLOID/pair_lubricateU_poly.h +++ b/src/COLLOID/pair_lubricateU_poly.h @@ -47,37 +47,3 @@ class PairLubricateUPoly : public PairLubricateU { #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. - -W: Cannot include log terms without 1/r terms; setting flagHI to 1 - -Self-explanatory. - -E: Pair lubricateU/poly requires newton pair off - -Self-explanatory. - -E: Pair lubricateU/poly requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Pair lubricate/poly requires atom style sphere - -Self-explanatory. - -E: Pair lubricate/poly requires extended particles - -One of the particles has radius 0.0. - -E: Cannot use multiple fix wall commands with pair lubricateU - -Self-explanatory. - -*/ diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index 97aa6bf6ff..38ec073f48 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -463,7 +463,7 @@ void PairLubricatePoly::init_style() for (int i = 0; i < modify->nfix; i++) { if (strcmp(modify->fix[i]->style,"deform") == 0) { shearing = flagdeform = 1; - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } @@ -473,15 +473,15 @@ void PairLubricatePoly::init_style() "Cannot use multiple fix wall commands with " "pair lubricate/poly"); flagwall = 1; // Walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast( modify->fix[i]); if (wallfix->xflag) flagwall = 2; // Moving walls exist } if (strstr(modify->fix[i]->style,"wall") != nullptr) { flagwall = 1; // Walls exist - if (((FixWall *) modify->fix[i])->xflag) { + if ((dynamic_cast( modify->fix[i]))->xflag) { flagwall = 2; // Moving walls exist - wallfix = (FixWall *) modify->fix[i]; + wallfix = dynamic_cast( modify->fix[i]); } } } @@ -539,7 +539,7 @@ void PairLubricatePoly::init_style() for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { shearing = 1; - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using pair lubricate/poly with inconsistent " "fix deform remap option"); } diff --git a/src/COLLOID/pair_lubricate_poly.h b/src/COLLOID/pair_lubricate_poly.h index 12a1dcde1e..1df27834b7 100644 --- a/src/COLLOID/pair_lubricate_poly.h +++ b/src/COLLOID/pair_lubricate_poly.h @@ -36,35 +36,3 @@ class PairLubricatePoly : public PairLubricate { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair lubricate/poly requires newton pair off - -Self-explanatory. - -E: Pair lubricate/poly requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Pair lubricate/poly requires atom style sphere - -Self-explanatory. - -E: Pair lubricate/poly requires extended particles - -One of the particles has radius 0.0. - -E: Using pair lubricate with inconsistent fix deform remap option - -Must use remap v option with fix deform with this pair style. - -E: Cannot use multiple fix wall commands with pair lubricate/poly - -Self-explanatory. - -E: Using pair lubricate/poly with inconsistent fix deform remap option - -If fix deform is used, the remap v option is required. - -*/ diff --git a/src/COLLOID/pair_yukawa_colloid.h b/src/COLLOID/pair_yukawa_colloid.h index ad77da7eea..55f86f9e13 100644 --- a/src/COLLOID/pair_yukawa_colloid.h +++ b/src/COLLOID/pair_yukawa_colloid.h @@ -38,15 +38,3 @@ class PairYukawaColloid : public PairYukawa { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair yukawa/colloid requires atom style sphere - -Self-explanatory. - -E: Pair yukawa/colloid requires atoms with same type have same radius - -Self-explanatory. - -*/ diff --git a/src/COLVARS/colvarproxy_lammps.cpp b/src/COLVARS/colvarproxy_lammps.cpp index dd1f7eb06d..09c280acf9 100644 --- a/src/COLVARS/colvarproxy_lammps.cpp +++ b/src/COLVARS/colvarproxy_lammps.cpp @@ -98,10 +98,10 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp, // try to extract a restart prefix from a potential restart command. LAMMPS_NS::Output *outp = _lmp->output; - if ((outp->restart_every_single > 0) && (outp->restart1 != 0)) { + if ((outp->restart_every_single > 0) && (outp->restart1 != nullptr)) { restart_frequency_engine = outp->restart_every_single; restart_output_prefix_str = std::string(outp->restart1); - } else if ((outp->restart_every_double > 0) && (outp->restart2a != 0)) { + } else if ((outp->restart_every_double > 0) && (outp->restart2a != nullptr)) { restart_frequency_engine = outp->restart_every_double; restart_output_prefix_str = std::string(outp->restart2a); } diff --git a/src/COLVARS/colvarproxy_lammps.h b/src/COLVARS/colvarproxy_lammps.h index 5dbbe8fcfe..579e645054 100644 --- a/src/COLVARS/colvarproxy_lammps.h +++ b/src/COLVARS/colvarproxy_lammps.h @@ -101,7 +101,8 @@ class colvarproxy_lammps : public colvarproxy { void log(std::string const &message) override; void error(std::string const &message) override; - cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const override; + cvm::rvector position_distance(cvm::atom_pos const &pos1, + cvm::atom_pos const &pos2) const override; int backup_file(char const *filename) override; diff --git a/src/COLVARS/fix_colvars.h b/src/COLVARS/fix_colvars.h index eba9b0167f..4d5f19e9a9 100644 --- a/src/COLVARS/fix_colvars.h +++ b/src/COLVARS/fix_colvars.h @@ -97,55 +97,3 @@ class FixColvars : public Fix { #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: Cannot use fix colvars for atoms with rmass attribute - -The colvars library assigns atom masses per atom type, thus atom styles -which allow setting individual per atom masses are not supported. - -E: Missing argument to keyword - -Self-explanatory. A keyword was recognized, but no corresponding value -found. Check the input script syntax and compare to the documentation -for the command. - -E: Incorrect fix colvars unwrap flag - -Self-explanatory. Check the input script syntax. - -E: Unknown fix colvars parameter - -Self-explanatory. Check your input script syntax. - -E: Cannot use fix colvars without atom IDs - -Atom IDs are not defined, but fix colvars needs them to identify an atom. - -E: Fix colvars requires an atom map, see atom_modify - -Use the atom_modify command to create an atom map. - -W: Using fix colvars with minimization - -Some of the functionality supported with the colvars library is not -meaningful with minimization calculations. - -E: Could not find tstat fix ID - -Self-explanatory. The thermostat fix ID provided with the tstat keyword -is not defined (yet or anymore). Check your input file. - -E: Run aborted on request from colvars module - -Some error condition happened inside the colvars library that prohibits -it from continuing. Please examine the output for additional information. - -*/ diff --git a/src/COLVARS/group_ndx.h b/src/COLVARS/group_ndx.h index c1d7c5298b..524d2d6c03 100644 --- a/src/COLVARS/group_ndx.h +++ b/src/COLVARS/group_ndx.h @@ -39,22 +39,3 @@ class Group2Ndx : public Command { #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: Must have atom IDs for group2ndx command - -There are no atom IDs defined in the system, but they are required -to identify atoms in a gromacs style index file. - -E: Cannot open index file for writing - -Self-explanatory. Check your filename, permissions, and disk space or quota. - -*/ diff --git a/src/COLVARS/ndx_group.cpp b/src/COLVARS/ndx_group.cpp index be54c5dca9..9560c41c6a 100644 --- a/src/COLVARS/ndx_group.cpp +++ b/src/COLVARS/ndx_group.cpp @@ -121,7 +121,7 @@ void Ndx2Group::command(int narg, char **arg) } else { - while (1) { + while (true) { MPI_Bcast(&len,1,MPI_INT,0,world); if (len < 0) break; if (len > 1) { diff --git a/src/COLVARS/ndx_group.h b/src/COLVARS/ndx_group.h index ef30f53b17..484c53f109 100644 --- a/src/COLVARS/ndx_group.h +++ b/src/COLVARS/ndx_group.h @@ -40,22 +40,3 @@ class Ndx2Group : public Command { #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: Must have atom IDs for ndx2group command - -There are no atom IDs defined in the system, but they are required -to identify atoms in a gromacs style index file. - -E: Cannot open index file for reading - -Self-explanatory. Check your filename, permissions, and disk space or quota. - -*/ diff --git a/src/COMPRESS/dump_atom_gz.h b/src/COMPRESS/dump_atom_gz.h index b7cd1bf476..fcf27464be 100644 --- a/src/COMPRESS/dump_atom_gz.h +++ b/src/COMPRESS/dump_atom_gz.h @@ -44,15 +44,3 @@ class DumpAtomGZ : public DumpAtom { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump atom/gz only writes compressed files - -The dump atom/gz output file name must have a .gz suffix. - -E: Cannot open dump file - -Self-explanatory. - -*/ diff --git a/src/COMPRESS/dump_atom_zstd.h b/src/COMPRESS/dump_atom_zstd.h index 9bc9796915..35143a983f 100644 --- a/src/COMPRESS/dump_atom_zstd.h +++ b/src/COMPRESS/dump_atom_zstd.h @@ -51,15 +51,3 @@ class DumpAtomZstd : public DumpAtom { #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 3b2f10ddb0..43b24d7bdb 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -91,8 +91,10 @@ void DumpCFGGZ::write_header(bigint n) // 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; + 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 = {:g} Angstrom (basic length-scale)\n", scale); diff --git a/src/COMPRESS/dump_cfg_gz.h b/src/COMPRESS/dump_cfg_gz.h index ca88600b51..b1376861c6 100644 --- a/src/COMPRESS/dump_cfg_gz.h +++ b/src/COMPRESS/dump_cfg_gz.h @@ -44,15 +44,3 @@ class DumpCFGGZ : public DumpCFG { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump cfg/gz only writes compressed files - -The dump cfg/gz output file name must have a .gz suffix. - -E: Cannot open dump file - -Self-explanatory. - -*/ diff --git a/src/COMPRESS/dump_cfg_zstd.h b/src/COMPRESS/dump_cfg_zstd.h index 88541503f8..3b056141a0 100644 --- a/src/COMPRESS/dump_cfg_zstd.h +++ b/src/COMPRESS/dump_cfg_zstd.h @@ -50,15 +50,3 @@ class DumpCFGZstd : public DumpCFG { #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.h b/src/COMPRESS/dump_custom_gz.h index ba0a1a83fc..51ac402050 100644 --- a/src/COMPRESS/dump_custom_gz.h +++ b/src/COMPRESS/dump_custom_gz.h @@ -44,15 +44,3 @@ class DumpCustomGZ : public DumpCustom { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump custom/gz only writes compressed files - -The dump custom/gz output file name must have a .gz suffix. - -E: Cannot open dump file - -Self-explanatory. - -*/ diff --git a/src/COMPRESS/dump_custom_zstd.h b/src/COMPRESS/dump_custom_zstd.h index d9b836c365..56f8022704 100644 --- a/src/COMPRESS/dump_custom_zstd.h +++ b/src/COMPRESS/dump_custom_zstd.h @@ -51,15 +51,3 @@ class DumpCustomZstd : public DumpCustom { #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.h b/src/COMPRESS/dump_local_gz.h index b2e2c55127..ebfb57cd58 100644 --- a/src/COMPRESS/dump_local_gz.h +++ b/src/COMPRESS/dump_local_gz.h @@ -44,15 +44,3 @@ class DumpLocalGZ : public DumpLocal { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump local/gz only writes compressed files - -The dump local/gz output file name must have a .gz suffix. - -E: Cannot open dump file - -Self-explanatory. - -*/ diff --git a/src/COMPRESS/dump_local_zstd.h b/src/COMPRESS/dump_local_zstd.h index cc04c6512a..0dfcf87660 100644 --- a/src/COMPRESS/dump_local_zstd.h +++ b/src/COMPRESS/dump_local_zstd.h @@ -51,15 +51,3 @@ class DumpLocalZstd : public DumpLocal { #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.h b/src/COMPRESS/dump_xyz_gz.h index 714911c735..cd4e22c0ef 100644 --- a/src/COMPRESS/dump_xyz_gz.h +++ b/src/COMPRESS/dump_xyz_gz.h @@ -44,15 +44,3 @@ class DumpXYZGZ : public DumpXYZ { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump xyz/gz only writes compressed files - -The dump xyz/gz output file name must have a .gz suffix. - -E: Cannot open dump file - -Self-explanatory. - -*/ diff --git a/src/COMPRESS/dump_xyz_zstd.h b/src/COMPRESS/dump_xyz_zstd.h index fe93be1156..97380f6c95 100644 --- a/src/COMPRESS/dump_xyz_zstd.h +++ b/src/COMPRESS/dump_xyz_zstd.h @@ -51,15 +51,3 @@ class DumpXYZZstd : public DumpXYZ { #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/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 9b4ca249fa..6a4a5be53f 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -74,7 +74,7 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : strcpy(id_fix,fixcmd.c_str()); fixcmd += fmt::format(" {} STORE peratom 0 1", group->names[igroup]); - fix = (FixStore *)modify->add_fix(fixcmd); + fix = dynamic_cast(modify->add_fix(fixcmd)); // set fix store values = 0 for now // fill them in via setup() once Comm::borders() has been called diff --git a/src/CORESHELL/compute_temp_cs.h b/src/CORESHELL/compute_temp_cs.h index 34449afb47..96ad6ca91a 100644 --- a/src/CORESHELL/compute_temp_cs.h +++ b/src/CORESHELL/compute_temp_cs.h @@ -64,46 +64,3 @@ class ComputeTempCS : public Compute { #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 temp/cs used when bonds are not allowed - -This compute only works on pairs of bonded particles. - -E: Cannot find specified group ID for core particles - -Self-explanatory. - -E: Cannot find specified group ID for shell particles - -Self-explanatory. - -E: Compute temp/cs requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Number of core atoms != number of shell atoms - -There must be a one-to-one pairing of core and shell atoms. - -E: Core/shell partner atom not found - -Could not find one of the atoms in the bond pair. - -E: Core/shell partners were not all found - -Could not find or more atoms in the bond pairs. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/CORESHELL/pair_born_coul_dsf_cs.h b/src/CORESHELL/pair_born_coul_dsf_cs.h index 48d48f3cf9..afb4becfbb 100644 --- a/src/CORESHELL/pair_born_coul_dsf_cs.h +++ b/src/CORESHELL/pair_born_coul_dsf_cs.h @@ -34,26 +34,3 @@ class PairBornCoulDSFCS : public PairBornCoulDSF { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style born/coul/dsf requires atom attribute q - -The atom style defined does not have this attribute. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/CORESHELL/pair_born_coul_long_cs.h b/src/CORESHELL/pair_born_coul_long_cs.h index 61c6e1a22e..a5b44d1729 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.h +++ b/src/CORESHELL/pair_born_coul_long_cs.h @@ -34,30 +34,3 @@ class PairBornCoulLongCS : public PairBornCoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style born/coul/long requires atom attribute q - -An atom style that defines this attribute must be used. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/CORESHELL/pair_born_coul_wolf_cs.h b/src/CORESHELL/pair_born_coul_wolf_cs.h index 433623a3d4..8f052ef8a7 100644 --- a/src/CORESHELL/pair_born_coul_wolf_cs.h +++ b/src/CORESHELL/pair_born_coul_wolf_cs.h @@ -34,27 +34,3 @@ class PairBornCoulWolfCS : public PairBornCoulWolf { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style born/coul/wolf/cs requires atom attribute q - -An atom style that defines this attribute must be used. - - -*/ diff --git a/src/CORESHELL/pair_buck_coul_long_cs.h b/src/CORESHELL/pair_buck_coul_long_cs.h index 8a5ea985e6..0366b748a3 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.h +++ b/src/CORESHELL/pair_buck_coul_long_cs.h @@ -34,30 +34,3 @@ class PairBuckCoulLongCS : public PairBuckCoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style buck/coul/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/CORESHELL/pair_coul_long_cs.h b/src/CORESHELL/pair_coul_long_cs.h index d351556c68..6850152d2b 100644 --- a/src/CORESHELL/pair_coul_long_cs.h +++ b/src/CORESHELL/pair_coul_long_cs.h @@ -34,25 +34,3 @@ class PairCoulLongCS : public PairCoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/CORESHELL/pair_coul_wolf_cs.h b/src/CORESHELL/pair_coul_wolf_cs.h index 5ae626509a..47f3e1a716 100644 --- a/src/CORESHELL/pair_coul_wolf_cs.h +++ b/src/CORESHELL/pair_coul_wolf_cs.h @@ -34,21 +34,3 @@ class PairCoulWolfCS : public PairCoulWolf { #endif #endif /* LMP_PAIR_COUL_WOLF_CS_H_ */ - -/* 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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair coul/wolf/cs requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/CORESHELL/pair_lj_class2_coul_long_cs.h b/src/CORESHELL/pair_lj_class2_coul_long_cs.h index b0f87f1ff3..39548f51a9 100644 --- a/src/CORESHELL/pair_lj_class2_coul_long_cs.h +++ b/src/CORESHELL/pair_lj_class2_coul_long_cs.h @@ -38,30 +38,3 @@ class PairLJClass2CoulLongCS : public PairLJClass2CoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/class2/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.h b/src/CORESHELL/pair_lj_cut_coul_long_cs.h index 4bb1f923f5..aa47b7710b 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.h +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.h @@ -38,30 +38,3 @@ class PairLJCutCoulLongCS : public PairLJCutCoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/DIELECTRIC/atom_vec_dielectric.cpp b/src/DIELECTRIC/atom_vec_dielectric.cpp index 2d6d6d00b1..b15b233991 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.cpp +++ b/src/DIELECTRIC/atom_vec_dielectric.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/ Sandia National Laboratories @@ -18,27 +17,25 @@ #include "citeme.h" #include -#include using namespace LAMMPS_NS; static const char cite_user_dielectric_package[] = - "DIELECTRIC package:\n\n" - "@Article{TrungCPC19,\n" - " author = {Trung Dac Nguyen, Honghao Li, Debarshee Bagchi," - " Francisco J. Solis, Monica Olvera de la Cruz,\n" - " title = {Incorporating surface polarization effects into large-scale" - " coarse-grained Molecular Dynamics simulation},\n" - " journal = {Comp.~Phys.~Comm.},\n" - " year = 2019,\n" - " volume = 241,\n" - " pages = {80--91}\n" - "}\n\n" - ; + "DIELECTRIC package:\n\n" + "@Article{TrungCPC19,\n" + " author = {Trung Dac Nguyen, Honghao Li, Debarshee Bagchi," + " Francisco J. Solis, Monica Olvera de la Cruz,\n" + " title = {Incorporating surface polarization effects into large-scale" + " coarse-grained Molecular Dynamics simulation},\n" + " journal = {Comp.~Phys.~Comm.},\n" + " year = 2019,\n" + " volume = 241,\n" + " pages = {80--91}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ -AtomVecDielectric::AtomVecDielectric(LAMMPS *lmp) : AtomVec(lmp) +AtomVecDielectric::AtomVecDielectric(LAMMPS *_lmp) : AtomVec(_lmp) { if (lmp->citeme) lmp->citeme->add(cite_user_dielectric_package); @@ -47,61 +44,46 @@ AtomVecDielectric::AtomVecDielectric(LAMMPS *lmp) : AtomVec(lmp) mass_type = PER_TYPE; atom->molecule_flag = atom->q_flag = atom->mu_flag = 1; + atom->dielectric_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special " - "mu area ed em epsilon curvature q_unscaled"; - fields_copy = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special " - "mu area ed em epsilon curvature q_unscaled"; - fields_comm = (char *) "q mu area ed em epsilon curvature q_unscaled"; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "q molecule mu area ed em epsilon curvature q_unscaled"; - fields_border_vel = (char *) "q molecule mu area ed em epsilon curvature q_unscaled"; - fields_exchange = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special " - "mu area ed em epsilon curvature q_unscaled"; - fields_restart = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "mu area ed em epsilon curvature q_unscaled"; - fields_create = (char *) - "q molecule num_bond num_angle num_dihedral num_improper nspecial " - "mu area ed em epsilon curvature q_unscaled"; - fields_data_atom = (char *) "id molecule type q x " - "mu3 area ed em epsilon curvature"; - fields_data_vel = (char *) "id v"; + // clang-format off + fields_grow = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special", + "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_copy = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special", + "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_comm = {"q", "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_border = {"q", "molecule", "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_border_vel = {"q", "molecule", "mu", "area", "ed", "em", "epsilon", "curvature", + "q_unscaled"}; + fields_exchange = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", + "angle_type", "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", + "dihedral_atom1", "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", + "improper_type", "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", + "nspecial", "special", "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_restart = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", + "angle_type", "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", + "dihedral_atom1", "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", + "improper_type", "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", + "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_create = {"q", "molecule", "num_bond", "num_angle", "num_dihedral", "num_improper", + "nspecial", "mu", "area", "ed", "em", "epsilon", "curvature", "q_unscaled"}; + fields_data_atom = { "id", "molecule", "type", "q", "x", "mu3", "area", "ed", "em", "epsilon", + "curvature"}; + fields_data_vel = {"id v"}; + // clang-format on setup_fields(); - bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; } @@ -157,13 +139,12 @@ void AtomVecDielectric::data_atom_post(int ilocal) nspecial[ilocal][1] = 0; nspecial[ilocal][2] = 0; - double* q = atom->q; + double *q = atom->q; q_unscaled[ilocal] = q[ilocal]; q[ilocal] /= epsilon[ilocal]; double *mu_one = mu[ilocal]; - mu_one[3] = - sqrt(mu_one[0]*mu_one[0] + mu_one[1]*mu_one[1] + mu_one[2]*mu_one[2]); + mu_one[3] = sqrt(mu_one[0] * mu_one[0] + mu_one[1] * mu_one[1] + mu_one[2] * mu_one[2]); } /* ---------------------------------------------------------------------- @@ -182,14 +163,14 @@ void AtomVecDielectric::unpack_restart_init(int ilocal) return -1 if name is unknown to this atom style ------------------------------------------------------------------------- */ -int AtomVecDielectric::property_atom(char *name) +int AtomVecDielectric::property_atom(const std::string &name) { - if (strcmp(name,"area") == 0) return 0; - if (strcmp(name,"ed") == 0) return 1; - if (strcmp(name,"em") == 0) return 2; - if (strcmp(name,"epsilon") == 0) return 3; - if (strcmp(name,"curvature") == 0) return 4; - if (strcmp(name,"q_unscaled") == 0) return 5; + if (name == "area") return 0; + if (name == "ed") return 1; + if (name == "em") return 2; + if (name == "epsilon") return 3; + if (name == "curvature") return 4; + if (name == "q_unscaled") return 5; return -1; } @@ -198,8 +179,7 @@ int AtomVecDielectric::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecDielectric::pack_property_atom(int index, double *buf, - int nvalues, int groupbit) +void AtomVecDielectric::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -207,38 +187,50 @@ void AtomVecDielectric::pack_property_atom(int index, double *buf, if (index == 0) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = area[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = area[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 1) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = ed[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = ed[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 2) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = em[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = em[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 3) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = epsilon[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = epsilon[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 4) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = curvature[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = curvature[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 5) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = q_unscaled[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = q_unscaled[i]; + else + buf[n] = 0.0; n += nvalues; } } diff --git a/src/DIELECTRIC/atom_vec_dielectric.h b/src/DIELECTRIC/atom_vec_dielectric.h index 2d4510b330..071f790772 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.h +++ b/src/DIELECTRIC/atom_vec_dielectric.h @@ -35,7 +35,7 @@ class AtomVecDielectric : public AtomVec { void create_atom_post(int) override; void data_atom_post(int) override; void unpack_restart_init(int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; protected: @@ -53,16 +53,3 @@ class AtomVecDielectric : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/DIELECTRIC/compute_efield_atom.cpp b/src/DIELECTRIC/compute_efield_atom.cpp index 586d858632..24c29321ed 100644 --- a/src/DIELECTRIC/compute_efield_atom.cpp +++ b/src/DIELECTRIC/compute_efield_atom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/ Sandia National Laboratories @@ -39,10 +38,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), efield(nullptr) +ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *_lmp, int narg, char **arg) : + Compute(_lmp, narg, arg), efield(nullptr) { - if (narg < 3) error->all(FLERR,"Illegal compute efield/atom command"); + if (narg < 3) error->all(FLERR, "Illegal compute efield/atom command"); peratom_flag = 1; size_peratom_cols = 3; @@ -58,9 +57,12 @@ ComputeEfieldAtom::ComputeEfieldAtom(LAMMPS *lmp, int narg, char **arg) : } else { int iarg = 3; while (iarg < narg) { - if (strcmp(arg[iarg],"pair") == 0) pairflag = 1; - else if (strcmp(arg[iarg],"kspace") == 0) kspaceflag = 1; - else error->all(FLERR,"Illegal compute efield/atom command"); + if (strcmp(arg[iarg], "pair") == 0) + pairflag = 1; + else if (strcmp(arg[iarg], "kspace") == 0) + kspaceflag = 1; + else + error->all(FLERR, "Illegal compute efield/atom command"); iarg++; } } @@ -81,7 +83,7 @@ ComputeEfieldAtom::~ComputeEfieldAtom() void ComputeEfieldAtom::init() { - if (!atom->q_flag) error->all(FLERR,"compute efield/atom requires atom attribute q"); + if (!atom->q_flag) error->all(FLERR, "compute efield/atom requires atom attribute q"); if (!force->kspace) kspaceflag = 0; } @@ -89,28 +91,30 @@ void ComputeEfieldAtom::init() void ComputeEfieldAtom::setup() { - if (strcmp(force->pair_style,"lj/cut/coul/long/dielectric") == 0) - efield_pair = ((PairLJCutCoulLongDielectric*)force->pair)->efield; - else if (strcmp(force->pair_style,"lj/cut/coul/long/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulMSMDielectric*)force->pair)->efield; - else if (strcmp(force->pair_style,"lj/cut/coul/msm/dielectric") == 0) - efield_pair = ((PairLJCutCoulMSMDielectric*)force->pair)->efield; - else if (strcmp(force->pair_style,"lj/cut/coul/cut/dielectric") == 0) - efield_pair = ((PairLJCutCoulCutDielectric*)force->pair)->efield; - else if (strcmp(force->pair_style,"lj/cut/coul/cut/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulCutDielectric*)force->pair)->efield; - else if (strcmp(force->pair_style,"coul/long/dielectric") == 0) - efield_pair = ((PairCoulLongDielectric*)force->pair)->efield; - else if (strcmp(force->pair_style,"coul/cut/dielectric") == 0) - efield_pair = ((PairCoulCutDielectric*)force->pair)->efield; - else error->all(FLERR,"Compute efield/atom not supported by pair style"); + if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "coul/long/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else + error->all(FLERR, "Compute efield/atom not supported by pair style"); if (force->kspace) { - if (strcmp(force->kspace_style,"pppm/dielectric") == 0) - efield_kspace = ((PPPMDielectric*)force->kspace)->efield; - else if (strcmp(force->kspace_style,"msm/dielectric") == 0) - efield_kspace = ((MSMDielectric*)force->kspace)->efield; - else error->all(FLERR,"Compute efield/atom not supported by kspace style"); + if (strcmp(force->kspace_style, "pppm/dielectric") == 0) + efield_kspace = (dynamic_cast(force->kspace))->efield; + else if (strcmp(force->kspace_style, "msm/dielectric") == 0) + efield_kspace = (dynamic_cast(force->kspace))->efield; + else + error->all(FLERR, "Compute efield/atom not supported by kspace style"); kspaceflag = 1; } @@ -122,11 +126,11 @@ void ComputeEfieldAtom::setup() void ComputeEfieldAtom::compute_peratom() { - int i,j; + int i, j; invoked_peratom = update->ntimestep; if (update->vflag_atom != invoked_peratom) - error->all(FLERR,"Per-atom virial was not tallied on needed timestep"); + error->all(FLERR, "Per-atom virial was not tallied on needed timestep"); // grow local stress array if necessary // needs to be atom->nmax in length @@ -134,7 +138,7 @@ void ComputeEfieldAtom::compute_peratom() if (atom->nmax > nmax) { memory->destroy(efield); nmax = atom->nmax; - memory->create(efield,nmax,3,"stress/atom:efield"); + memory->create(efield, nmax, 3, "stress/atom:efield"); array_atom = efield; } @@ -144,7 +148,7 @@ void ComputeEfieldAtom::compute_peratom() // ntotal includes ghosts if either newton flag is set // KSpace includes ghosts if tip4pflag is set - double* q = atom->q; + double *q = atom->q; int nlocal = atom->nlocal; int npair = nlocal; int ntotal = nlocal; @@ -156,8 +160,7 @@ void ComputeEfieldAtom::compute_peratom() // clear local stress array for (i = 0; i < ntotal; i++) - for (j = 0; j < 3; j++) - efield[i][j] = 0.0; + for (j = 0; j < 3; j++) efield[i][j] = 0.0; // add in per-atom contributions from each force @@ -170,14 +173,12 @@ void ComputeEfieldAtom::compute_peratom() if (kspaceflag && force->kspace) { for (i = 0; i < nkspace; i++) - for (j = 0; j < 3; j++) - efield[i][j] += efield_kspace[i][j]; + for (j = 0; j < 3; j++) efield[i][j] += efield_kspace[i][j]; } // communicate ghost efield between neighbor procs - if (force->newton || (force->kspace && force->kspace->tip4pflag)) - comm->reverse_comm(this); + if (force->newton || (force->kspace && force->kspace->tip4pflag)) comm->reverse_comm(this); // zero efield of atoms not in group // only do this after comm since ghost contributions must be included @@ -192,12 +193,11 @@ void ComputeEfieldAtom::compute_peratom() } } - /* ---------------------------------------------------------------------- */ int ComputeEfieldAtom::pack_reverse_comm(int n, int first, double *buf) { - int i,m,last; + int i, m, last; m = 0; last = first + n; @@ -213,7 +213,7 @@ int ComputeEfieldAtom::pack_reverse_comm(int n, int first, double *buf) void ComputeEfieldAtom::unpack_reverse_comm(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; m = 0; for (i = 0; i < n; i++) { @@ -230,6 +230,6 @@ void ComputeEfieldAtom::unpack_reverse_comm(int n, int *list, double *buf) double ComputeEfieldAtom::memory_usage() { - double bytes = nmax*3 * sizeof(double); + double bytes = nmax * 3 * sizeof(double); return bytes; } diff --git a/src/DIELECTRIC/compute_efield_atom.h b/src/DIELECTRIC/compute_efield_atom.h index 212893b385..c38cd5860e 100644 --- a/src/DIELECTRIC/compute_efield_atom.h +++ b/src/DIELECTRIC/compute_efield_atom.h @@ -48,27 +48,3 @@ class ComputeEfieldAtom : public Compute { #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: Could not find compute stress/atom temperature ID - -Self-explanatory. - -E: Compute stress/atom temperature ID does not compute temperature - -The specified compute must compute temperature. - -E: Per-atom virial was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to have -tallied the virial, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp index 5d723316c0..7d29cc889c 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.cpp @@ -48,6 +48,7 @@ #include "pair_coul_cut_dielectric.h" #include "pair_coul_long_dielectric.h" #include "pair_lj_cut_coul_cut_dielectric.h" +#include "pair_lj_cut_coul_debye_dielectric.h" #include "pair_lj_cut_coul_long_dielectric.h" #include "pair_lj_cut_coul_msm_dielectric.h" #include "pppm_dielectric.h" @@ -59,19 +60,17 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathConst; - -//#define _POLARIZE_DEBUG +using MathConst::MY_PI; /* ---------------------------------------------------------------------- */ -FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), q_backup(nullptr), c(nullptr), g(nullptr), h(nullptr), r(nullptr), s(nullptr), v(nullptr), - y(nullptr) +FixPolarizeBEMGMRES::FixPolarizeBEMGMRES(LAMMPS *_lmp, int narg, char **arg) : + Fix(_lmp, narg, arg), q_backup(nullptr), c(nullptr), g(nullptr), h(nullptr), r(nullptr), + s(nullptr), v(nullptr), y(nullptr) { if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/gmres command"); - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Fix polarize requires atom style dielectric"); // parse required arguments @@ -211,7 +210,7 @@ void FixPolarizeBEMGMRES::init() if (randomized) { - RanPark *random = new RanPark(lmp, seed_charge + comm->me); + auto random = new RanPark(lmp, seed_charge + comm->me); for (i = 0; i < 100; i++) random->uniform(); double sum, tmp = 0; for (i = 0; i < nlocal; i++) { @@ -235,9 +234,7 @@ void FixPolarizeBEMGMRES::init() } if (comm->me == 0) - utils::logmesg(lmp, - "GMRES solver for {} induced charges " - "using maximum {} q-vectors\n", + utils::logmesg(lmp, "GMRES solver for {} induced charges using maximum {} q-vectors\n", num_induced_charges, mr); } @@ -248,34 +245,76 @@ void FixPolarizeBEMGMRES::setup(int /*vflag*/) // check if the pair styles in use are compatible if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0) - efield_pair = ((PairLJCutCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0) - efield_pair = ((PairLJCutCoulMSMDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0) - efield_pair = ((PairLJCutCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/debye/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/debye/dielectric/omp") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "coul/long/dielectric") == 0) - efield_pair = ((PairCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0) - efield_pair = ((PairCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else - error->all(FLERR, "Pair style not compatible with fix polarize"); + error->all(FLERR, "Pair style not compatible with fix polarize/bem/gmres"); if (kspaceflag) { if (force->kspace) { if (strcmp(force->kspace_style, "pppm/dielectric") == 0) - efield_kspace = ((PPPMDielectric *) force->kspace)->efield; + efield_kspace = (dynamic_cast(force->kspace))->efield; else if (strcmp(force->kspace_style, "msm/dielectric") == 0) - efield_kspace = ((MSMDielectric *) force->kspace)->efield; + efield_kspace = (dynamic_cast(force->kspace))->efield; else error->all(FLERR, "Kspace style not compatible with fix polarize/bem/gmres"); } else error->all(FLERR, "No Kspace style available for fix polarize/bem/gmres"); } + // NOTE: epsilon0e2q converts (epsilon0 * efield) to the unit of (charge unit / squared distance unit) + // efield is computed by pair and kspace styles in the unit of energy unit / charge unit / distance unit + // for units real efield is in the unit of kcal/mol/e/A + // converting from (F/m) (kcal/mol/e/A) to e/A^2 (1 e = 1.6e-19 C, 1 m = 1e+10 A) + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (4184 Nm/6.023e+23) /e/A + // = 8.854187812813e-12 * (4184/6.023e+23) * (1/1.6e-19)^2 e^2 / (1e+10 A) /e/A + // = 0.000240263377163643 e/A^2 + + // for units metal efield is in the unit of eV/e/A + // converting from (F/m) (eV/e/A) to e/A^2 (1 V = 1 Nm/C) + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (1 e Nm/C) /e/A + // = 8.854187812813e-12 * 1/1.6e-19 e^2 / (1e+10 A) /e/A + // = 0.00553386738300813 e/A^2 + + // for units si efield is in the unit of J/C/m + // converting from (F/m) (J/C/m) to C/m^2 + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (1 Nm/C/m) + // = 8.854187812813e-12 C/m^2 + + // for units nano efield is in the unit of attogram nm^2/ns^2/e/nm + // converting from (F/m) (attogram nm^2/ns^2/e/nm) to e/nm^2 + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (1e-21 kg nm^2 / (1e-18s^2) / e / nm) + // = 8.854187812813e-12 (C^2/N/m^2) * (1e-21 kg 1e-9 m / (1e-18s^2) / e) + // = 8.854187812813e-12 (1/1.6e-19)^2 (1e-21 * 1e-9 / (1e-18)) e / (1e+18 nm^2) + // = 0.000345866711328125 e/nm^2 + + epsilon0e2q = 1.0; + if (strcmp(update->unit_style, "real") == 0) + epsilon0e2q = 0.000240263377163643; + else if (strcmp(update->unit_style, "metal") == 0) + epsilon0e2q = 0.00553386738300813; + else if (strcmp(update->unit_style, "si") == 0) + epsilon0e2q = 8.854187812813e-12; + else if (strcmp(update->unit_style, "nano") == 0) + epsilon0e2q = 0.000345866711328125; + else if (strcmp(update->unit_style, "lj") != 0) + error->all(FLERR, "Only unit styles 'lj', 'real', 'metal', 'si' and 'nano' are supported"); + first = 1; compute_induced_charges(); } @@ -306,7 +345,6 @@ void FixPolarizeBEMGMRES::compute_induced_charges() double *em = atom->em; double *epsilon = atom->epsilon; int nlocal = atom->nlocal; - double epsilon0 = force->dielectric; int eflag = 0; int vflag = 0; @@ -354,9 +392,9 @@ void FixPolarizeBEMGMRES::compute_induced_charges() Ey += efield_kspace[i][1]; Ez += efield_kspace[i][2]; } - double dot = (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / epsilon[i]; + double ndotE = epsilon0e2q * (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / epsilon[i]; double sigma_f = q_real[i] / area[i]; - buffer[idx] = (1 - em[i]) * sigma_f - epsilon0 * ed[i] * dot / (4 * MY_PI); + buffer[idx] = (1 - em[i]) * sigma_f - ed[i] * ndotE / (4 * MY_PI); } MPI_Allreduce(buffer, rhs, num_induced_charges, MPI_DOUBLE, MPI_SUM, world); @@ -519,10 +557,6 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r) rho = fabs(g[k]); -#ifdef _POLARIZE_DEBUG - if (comm->me == 0) - error->warning(FLERR, "itr = {}: k = {}, norm(r) = {} norm(b) = {}", itr, k, rho, normb); -#endif if (rho <= rho_tol && rho <= tol_abs) break; } @@ -552,11 +586,6 @@ void FixPolarizeBEMGMRES::gmres_solve(double *x, double *r) rho = sqrt(vec_dot(r, r, n)); -#ifdef _POLARIZE_DEBUG - if (comm->me == 0) - error->warning(FLERR, "itr = {}: norm(r) = {} norm(b) = {}", itr, rho, normb); -#endif - // Barros et al. suggested the condition: norm(r) < EPSILON norm(b) if (rho < tol_rel * normb) break; @@ -584,7 +613,6 @@ void FixPolarizeBEMGMRES::apply_operator(double *w, double *Aw, int /*n*/) double *em = atom->em; double *epsilon = atom->epsilon; int nlocal = atom->nlocal; - double epsilon0 = force->dielectric; int eflag = 0; int vflag = 0; @@ -629,8 +657,8 @@ void FixPolarizeBEMGMRES::apply_operator(double *w, double *Aw, int /*n*/) Ey += efield_kspace[i][1]; Ez += efield_kspace[i][2]; } - double dot = (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / epsilon[i]; - buffer[idx] = em[i] * w[idx] + epsilon0 * ed[i] * dot / (4 * MY_PI); + double ndotE = epsilon0e2q * (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / epsilon[i]; + buffer[idx] = em[i] * w[idx] + ed[i] * ndotE / (4 * MY_PI); } MPI_Allreduce(buffer, Aw, num_induced_charges, MPI_DOUBLE, MPI_SUM, world); @@ -654,7 +682,6 @@ void FixPolarizeBEMGMRES::update_residual(double *w, double *r, int /*n*/) double *em = atom->em; double *epsilon = atom->epsilon; int nlocal = atom->nlocal; - double epsilon0 = force->dielectric; int eflag = 0; int vflag = 0; @@ -701,9 +728,10 @@ void FixPolarizeBEMGMRES::update_residual(double *w, double *r, int /*n*/) Ey += efield_kspace[i][1]; Ez += efield_kspace[i][2]; } - double dot = (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / epsilon[i]; + double ndotE = epsilon0e2q * (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / + epsilon[i] / (4 * MY_PI); double sigma_f = q_real[i] / area[i]; - buffer[idx] = (1 - em[i]) * sigma_f - em[i] * w[idx] - epsilon0 * ed[i] * dot / (4 * MY_PI); + buffer[idx] = (1 - em[i]) * sigma_f - em[i] * w[idx] - ed[i] * ndotE; } MPI_Allreduce(buffer, r, num_induced_charges, MPI_DOUBLE, MPI_SUM, world); diff --git a/src/DIELECTRIC/fix_polarize_bem_gmres.h b/src/DIELECTRIC/fix_polarize_bem_gmres.h index 421fe8afb9..e590b1b35e 100644 --- a/src/DIELECTRIC/fix_polarize_bem_gmres.h +++ b/src/DIELECTRIC/fix_polarize_bem_gmres.h @@ -81,6 +81,7 @@ class FixPolarizeBEMGMRES : public Fix { int randomized; // 1 if generating random induced charges, 0 otherwise double ave_charge; // average random charge int seed_charge; + double epsilon0e2q; // convert epsilon0 times efield to unit of charge per area double *c, *g, *h, *r, *s, *v, *y; // vectors used by the solver double *rhs; // right-hand side vector of the equation Ax = b @@ -108,13 +109,3 @@ class FixPolarizeBEMGMRES : public Fix { #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. - -*/ diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.cpp b/src/DIELECTRIC/fix_polarize_bem_icc.cpp index da4296c1e4..3d451256ff 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.cpp +++ b/src/DIELECTRIC/fix_polarize_bem_icc.cpp @@ -37,6 +37,7 @@ #include "pair_coul_cut_dielectric.h" #include "pair_coul_long_dielectric.h" #include "pair_lj_cut_coul_cut_dielectric.h" +#include "pair_lj_cut_coul_debye_dielectric.h" #include "pair_lj_cut_coul_long_dielectric.h" #include "pair_lj_cut_coul_msm_dielectric.h" #include "pppm_dielectric.h" @@ -48,17 +49,15 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathConst; - -//#define _POLARIZE_DEBUG +using MathConst::MY_PI; /* ---------------------------------------------------------------------- */ -FixPolarizeBEMICC::FixPolarizeBEMICC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) +FixPolarizeBEMICC::FixPolarizeBEMICC(LAMMPS *_lmp, int narg, char **arg) : Fix(_lmp, narg, arg) { if (narg < 5) error->all(FLERR, "Illegal fix polarize/bem/icc command"); - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Fix polarize requires atom style dielectric"); // parse required arguments @@ -116,7 +115,7 @@ void FixPolarizeBEMICC::init() int *mask = atom->mask; int nlocal = atom->nlocal; - RanPark *random = new RanPark(lmp, seed_charge + comm->me); + auto random = new RanPark(lmp, seed_charge + comm->me); for (i = 0; i < 100; i++) random->uniform(); double sum, tmp = 0; for (i = 0; i < nlocal; i++) { @@ -146,42 +145,82 @@ void FixPolarizeBEMICC::setup(int /*vflag*/) // check if the pair styles in use are compatible if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0) - efield_pair = ((PairLJCutCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0) - efield_pair = ((PairLJCutCoulMSMDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0) - efield_pair = ((PairLJCutCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/debye/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/debye/dielectric/omp") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "coul/long/dielectric") == 0) - efield_pair = ((PairCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0) - efield_pair = ((PairCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else error->all(FLERR, "Pair style not compatible with fix polarize/bem/icc"); // check if kspace is used for force computation if (force->kspace) { - kspaceflag = 1; if (strcmp(force->kspace_style, "pppm/dielectric") == 0) - efield_kspace = ((PPPMDielectric *) force->kspace)->efield; + efield_kspace = (dynamic_cast(force->kspace))->efield; else if (strcmp(force->kspace_style, "msm/dielectric") == 0) - efield_kspace = ((MSMDielectric *) force->kspace)->efield; + efield_kspace = (dynamic_cast(force->kspace))->efield; else error->all(FLERR, "Kspace style not compatible with fix polarize/bem/icc"); } else { - if (kspaceflag == 1) { // users specified kspace yes error->warning(FLERR, "No Kspace style available for fix polarize/bem/icc"); kspaceflag = 0; } } + // NOTE: epsilon0e2q converts (epsilon0 * efield) to the unit of (charge unit / squared distance unit) + // efield is computed by pair and kspace styles in the unit of energy unit / charge unit / distance unit + // for units real efield is in the unit of kcal/mol/e/A + // converting from (F/m) (kcal/mol/e/A) to e/A^2 (1 e = 1.6e-19 C, 1 m = 1e+10 A) + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (4184 Nm/6.023e+23) /e/A + // = 8.854187812813e-12 * (4184/6.023e+23) * (1/1.6e-19)^2 e^2 / (1e+10 A) /e/A + // = 0.000240263377163643 e/A^2 + + // for units metal efield is in the unit of eV/e/A + // converting from (F/m) (eV/e/A) to e/A^2 (1 V = 1 Nm/C) + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (1 e Nm/C) /e/A + // = 8.854187812813e-12 * 1/1.6e-19 e^2 / (1e+10 A) /e/A + // = 0.00553386738300813 e/A^2 + + // for units si efield is in the unit of J/C/m + // converting from (F/m) (J/C/m) to C/m^2 + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (1 Nm/C/m) + // = 8.854187812813e-12 C/m^2 + + // for units nano efield is in the unit of attogram nm^2/ns^2/e/nm + // converting from (F/m) (attogram nm^2/ns^2/e/nm) to e/nm^2 + // epsilon0e2q = 8.854187812813e-12 (C^2/N/m^2) * (1e-21 kg nm^2 / (1e-18s^2) / e / nm) + // = 8.854187812813e-12 (C^2/N/m^2) * (1e-21 kg 1e-9 m / (1e-18s^2) / e) + // = 8.854187812813e-12 (1/1.6e-19)^2 (1e-21 * 1e-9 / (1e-18)) e / (1e+18 nm^2) + // = 0.000345866711328125 e/nm^2 + + epsilon0e2q = 1.0; + if (strcmp(update->unit_style, "real") == 0) + epsilon0e2q = 0.000240263377163643; + else if (strcmp(update->unit_style, "metal") == 0) + epsilon0e2q = 0.00553386738300813; + else if (strcmp(update->unit_style, "si") == 0) + epsilon0e2q = 8.854187812813e-12; + else if (strcmp(update->unit_style, "nano") == 0) + epsilon0e2q = 0.000345866711328125; + else if (strcmp(update->unit_style, "lj") != 0) + error->all(FLERR, "Only unit styles 'lj', 'real', 'metal', 'si' and 'nano' are supported"); + compute_induced_charges(); } @@ -212,7 +251,6 @@ void FixPolarizeBEMICC::compute_induced_charges() double *epsilon = atom->epsilon; int *mask = atom->mask; int nlocal = atom->nlocal; - double epsilon0 = force->dielectric; int eflag = 1; int vflag = 0; int itr; @@ -244,10 +282,11 @@ void FixPolarizeBEMICC::compute_induced_charges() } // divide (Ex,Ey,Ez) by epsilon[i] here - double dot = (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / (2 * MY_PI) / epsilon[i]; + double ndotE = epsilon0e2q * (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / + epsilon[i] / (2 * MY_PI); double q_free = q_real[i]; double q_bound = 0; - q_bound = (1.0 / em[i] - 1) * q_free - epsilon0 * (ed[i] / (2 * em[i])) * dot * area[i]; + q_bound = (1.0 / em[i] - 1) * q_free - (ed[i] / (2 * em[i])) * ndotE * area[i]; q[i] = q_free + q_bound; } @@ -281,10 +320,11 @@ void FixPolarizeBEMICC::compute_induced_charges() // note the area[i] is included here to ensure correct charge unit // for direct use in force/efield compute - double dot = (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / (4 * MY_PI) / epsilon[i]; + double ndotE = epsilon0e2q * (Ex * norm[i][0] + Ey * norm[i][1] + Ez * norm[i][2]) / + (4 * MY_PI) / epsilon[i]; double q_bound = q[i] - q_free; q_bound = (1 - omega) * q_bound + - omega * ((1.0 / em[i] - 1) * q_free - epsilon0 * (ed[i] / em[i]) * dot * area[i]); + omega * ((1.0 / em[i] - 1) * q_free - (ed[i] / em[i]) * ndotE * area[i]); q[i] = q_free + q_bound; // Eq. (11) in Tyagi et al., with f from Eq. (6) @@ -303,18 +343,11 @@ void FixPolarizeBEMICC::compute_induced_charges() double delta = fabs(qtmp - q_bound); double r = (fabs(qtmp) > 0) ? delta / fabs(qtmp) : 0; if (tol < r) tol = r; - -#ifdef _POLARIZE_DEBUG -//printf("i = %d: q_bound = %f \n", i, q_bound); -#endif } comm->forward_comm(this); MPI_Allreduce(&tol, &rho, 1, MPI_DOUBLE, MPI_MAX, world); -#ifdef _POLARIZE_DEBUG - printf("itr = %d: rho = %f\n", itr, rho); -#endif if (itr > 0 && rho < tol_rel) break; } diff --git a/src/DIELECTRIC/fix_polarize_bem_icc.h b/src/DIELECTRIC/fix_polarize_bem_icc.h index e7af6edd08..4ca182259f 100644 --- a/src/DIELECTRIC/fix_polarize_bem_icc.h +++ b/src/DIELECTRIC/fix_polarize_bem_icc.h @@ -60,19 +60,10 @@ class FixPolarizeBEMICC : public Fix { int randomized; // 1 if generating random induced charges, 0 otherwise double ave_charge; // average random charge int seed_charge; + double epsilon0e2q; // convert epsilon0 times efield to unit of charge per area }; } // namespace LAMMPS_NS #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. - -*/ diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index 15140e7d58..482bc001a9 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -44,6 +44,7 @@ #include "pair_coul_cut_dielectric.h" #include "pair_coul_long_dielectric.h" #include "pair_lj_cut_coul_cut_dielectric.h" +#include "pair_lj_cut_coul_debye_dielectric.h" #include "pair_lj_cut_coul_long_dielectric.h" #include "pair_lj_cut_coul_msm_dielectric.h" #include "pppm_dielectric.h" @@ -60,18 +61,16 @@ using namespace MathSpecial; enum { REAL2SCALED = 0, SCALED2REAL = 1 }; -#define EPSILON 1e-6 - -//#define _POLARIZE_DEBUG +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -FixPolarizeFunctional::FixPolarizeFunctional(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) +FixPolarizeFunctional::FixPolarizeFunctional(LAMMPS *_lmp, int narg, char **arg) : + Fix(_lmp, narg, arg) { if (narg < 4) error->all(FLERR, "Illegal fix polarize/functional command"); - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Fix polarize/functional requires atom style dielectric"); nevery = utils::inumeric(FLERR, arg[3], false, lmp); @@ -290,19 +289,23 @@ void FixPolarizeFunctional::setup(int /*vflag*/) // check if the pair styles in use are compatible if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric") == 0) - efield_pair = ((PairLJCutCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/long/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/msm/dielectric") == 0) - efield_pair = ((PairLJCutCoulMSMDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric") == 0) - efield_pair = ((PairLJCutCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "lj/cut/coul/cut/dielectric/omp") == 0) - efield_pair = ((PairLJCutCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/debye/dielectric") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; + else if (strcmp(force->pair_style, "lj/cut/coul/debye/dielectric/omp") == 0) + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "coul/long/dielectric") == 0) - efield_pair = ((PairCoulLongDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else if (strcmp(force->pair_style, "coul/cut/dielectric") == 0) - efield_pair = ((PairCoulCutDielectric *) force->pair)->efield; + efield_pair = (dynamic_cast(force->pair))->efield; else error->all(FLERR, "Pair style not compatible with fix polarize/functional"); @@ -310,9 +313,9 @@ void FixPolarizeFunctional::setup(int /*vflag*/) kspaceflag = 1; if (strcmp(force->kspace_style, "pppm/dielectric") == 0) - efield_kspace = ((PPPMDielectric *) force->kspace)->efield; + efield_kspace = (dynamic_cast(force->kspace))->efield; else if (strcmp(force->kspace_style, "msm/dielectric") == 0) - efield_kspace = ((MSMDielectric *) force->kspace)->efield; + efield_kspace = (dynamic_cast(force->kspace))->efield; else error->all(FLERR, "Kspace style not compatible with fix polarize/functional"); @@ -804,16 +807,6 @@ void FixPolarizeFunctional::calculate_Rww_cutoff() MPI_Allreduce(buffer1[0], Rww[0], num_induced_charges * num_induced_charges, MPI_DOUBLE, MPI_SUM, world); - -#ifdef _POLARIZE_DEBUG - if (comm->me == 0) { - FILE *fp = fopen("Rww-functional.txt", "w"); - for (int i = 0; i < num_induced_charges; i++) - fprintf(fp, "%d %g %g %g\n", i, Rww[i][i], Rww[i][num_induced_charges / 2], - Rww[num_induced_charges / 2][i]); - fclose(fp); - } -#endif } /* ---------------------------------------------------------------------- */ diff --git a/src/DIELECTRIC/fix_polarize_functional.h b/src/DIELECTRIC/fix_polarize_functional.h index 010e958542..c4cf8366e8 100644 --- a/src/DIELECTRIC/fix_polarize_functional.h +++ b/src/DIELECTRIC/fix_polarize_functional.h @@ -121,13 +121,3 @@ class FixPolarizeFunctional : public Fix { #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. - -*/ diff --git a/src/DIELECTRIC/msm_dielectric.cpp b/src/DIELECTRIC/msm_dielectric.cpp index 329218a94f..3217c8dbad 100644 --- a/src/DIELECTRIC/msm_dielectric.cpp +++ b/src/DIELECTRIC/msm_dielectric.cpp @@ -34,7 +34,7 @@ enum{REVERSE_RHO,REVERSE_AD,REVERSE_AD_PERATOM}; enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ -MSMDielectric::MSMDielectric(LAMMPS *lmp) : MSM(lmp) +MSMDielectric::MSMDielectric(LAMMPS *_lmp) : MSM(_lmp) { efield = nullptr; phi = nullptr; @@ -58,7 +58,7 @@ void MSMDielectric::init() { MSM::init(); - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast( atom->style_match("dielectric")); if (!avec) error->all(FLERR,"msm/dielectric requires atom style dielectric"); } diff --git a/src/DIELECTRIC/msm_dielectric.h b/src/DIELECTRIC/msm_dielectric.h index 64982afae2..f5a18ec1d0 100644 --- a/src/DIELECTRIC/msm_dielectric.h +++ b/src/DIELECTRIC/msm_dielectric.h @@ -43,13 +43,3 @@ class MSMDielectric : public MSM { #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. - -*/ diff --git a/src/DIELECTRIC/pair_coul_cut_dielectric.cpp b/src/DIELECTRIC/pair_coul_cut_dielectric.cpp index 7e3602967f..aaa39f6aea 100644 --- a/src/DIELECTRIC/pair_coul_cut_dielectric.cpp +++ b/src/DIELECTRIC/pair_coul_cut_dielectric.cpp @@ -29,13 +29,13 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PIS; -#define EPSILON 1e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -PairCoulCutDielectric::PairCoulCutDielectric(LAMMPS *lmp) : PairCoulCut(lmp) +PairCoulCutDielectric::PairCoulCutDielectric(LAMMPS *_lmp) : PairCoulCut(_lmp) { efield = nullptr; nmax = 0; @@ -124,7 +124,7 @@ void PairCoulCutDielectric::compute(int eflag, int vflag) if (rsq < cutsq[itype][jtype] && rsq > EPSILON) { r2inv = 1.0 / rsq; rinv = sqrt(r2inv); - efield_i = scale[itype][jtype] * q[j] * rinv; + efield_i = qqrd2e * scale[itype][jtype] * q[j] * rinv; forcecoul = qtmp * efield_i; fpair_i = factor_coul * etmp * forcecoul * r2inv; @@ -162,7 +162,7 @@ void PairCoulCutDielectric::compute(int eflag, int vflag) void PairCoulCutDielectric::init_style() { - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair coul/cut/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); diff --git a/src/DIELECTRIC/pair_coul_cut_dielectric.h b/src/DIELECTRIC/pair_coul_cut_dielectric.h index bc400302db..50268936b7 100644 --- a/src/DIELECTRIC/pair_coul_cut_dielectric.h +++ b/src/DIELECTRIC/pair_coul_cut_dielectric.h @@ -43,21 +43,3 @@ class PairCoulCutDielectric : public PairCoulCut { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/cut/dielectric requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/DIELECTRIC/pair_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_coul_long_dielectric.cpp index 66a4473bfc..620f0cca34 100644 --- a/src/DIELECTRIC/pair_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_coul_long_dielectric.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec_dielectric.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "kspace.h" #include "math_const.h" @@ -30,19 +31,12 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; - -#define EWALD_F 1.12837917 -#define EWALD_P 0.3275911 -#define A1 0.254829592 -#define A2 -0.284496736 -#define A3 1.421413741 -#define A4 -1.453152027 -#define A5 1.061405429 +using namespace EwaldConst; +using MathConst::MY_PIS; /* ---------------------------------------------------------------------- */ -PairCoulLongDielectric::PairCoulLongDielectric(LAMMPS *lmp) : PairCoulLong(lmp) +PairCoulLongDielectric::PairCoulLongDielectric(LAMMPS *_lmp) : PairCoulLong(_lmp) { efield = nullptr; nmax = 0; @@ -207,7 +201,7 @@ void PairCoulLongDielectric::compute(int eflag, int vflag) void PairCoulLongDielectric::init_style() { - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair coul/long/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); diff --git a/src/DIELECTRIC/pair_coul_long_dielectric.h b/src/DIELECTRIC/pair_coul_long_dielectric.h index 2db2ad1086..41dbeb2964 100644 --- a/src/DIELECTRIC/pair_coul_long_dielectric.h +++ b/src/DIELECTRIC/pair_coul_long_dielectric.h @@ -42,25 +42,3 @@ class PairCoulLongDielectric : public PairCoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/long/dielectric requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp index 94ecdac578..517fbc481a 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.cpp @@ -29,13 +29,13 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PIS; -#define EPSILON 1e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -PairLJCutCoulCutDielectric::PairLJCutCoulCutDielectric(LAMMPS *lmp) : PairLJCutCoulCut(lmp) +PairLJCutCoulCutDielectric::PairLJCutCoulCutDielectric(LAMMPS *_lmp) : PairLJCutCoulCut(_lmp) { efield = nullptr; epot = nullptr; @@ -132,8 +132,8 @@ void PairLJCutCoulCutDielectric::compute(int eflag, int vflag) r2inv = 1.0 / rsq; if (rsq < cut_coulsq[itype][jtype] && rsq > EPSILON) { - efield_i = q[j] * sqrt(r2inv); - forcecoul = qqrd2e * qtmp * efield_i; + efield_i = qqrd2e * q[j] * sqrt(r2inv); + forcecoul = qtmp * efield_i; epot_i = efield_i; } else epot_i = efield_i = forcecoul = 0.0; @@ -190,7 +190,7 @@ void PairLJCutCoulCutDielectric::compute(int eflag, int vflag) void PairLJCutCoulCutDielectric::init_style() { - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair lj/cut/coul/cut/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); diff --git a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h index 77869b09b9..5d88bf59ce 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_cut_dielectric.h @@ -44,21 +44,3 @@ class PairLJCutCoulCutDielectric : public PairLJCutCoulCut { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/cut/dielectric requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp index 8858a444a8..814215872b 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.cpp @@ -29,13 +29,13 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PIS; -#define EPSILON 1e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -PairLJCutCoulDebyeDielectric::PairLJCutCoulDebyeDielectric(LAMMPS *lmp) : PairLJCutCoulDebye(lmp) +PairLJCutCoulDebyeDielectric::PairLJCutCoulDebyeDielectric(LAMMPS *_lmp) : PairLJCutCoulDebye(_lmp) { efield = nullptr; epot = nullptr; @@ -75,10 +75,10 @@ void PairLJCutCoulDebyeDielectric::compute(int eflag, int vflag) double **x = atom->x; double **f = atom->f; double *q = atom->q; - double *eps = avec->epsilon; - double **norm = avec->mu; - double *curvature = avec->curvature; - double *area = avec->area; + double *eps = atom->epsilon; + double **norm = atom->mu; + double *curvature = atom->curvature; + double *area = atom->area; int *type = atom->type; int nlocal = atom->nlocal; double *special_coul = force->special_coul; @@ -140,7 +140,7 @@ void PairLJCutCoulDebyeDielectric::compute(int eflag, int vflag) forcecoul = qtmp * efield_i; epot_i = efield_i; } else - efield_i = forcecoul = 0.0; + epot_i = efield_i = forcecoul = 0.0; if (rsq < cut_ljsq[itype][jtype]) { r6inv = r2inv * r2inv * r2inv; @@ -157,7 +157,6 @@ void PairLJCutCoulDebyeDielectric::compute(int eflag, int vflag) efield[i][0] += delx * efield_i; efield[i][1] += dely * efield_i; efield[i][2] += delz * efield_i; - epot[i] += epot_i; if (newton_pair && j >= nlocal) { @@ -194,7 +193,7 @@ void PairLJCutCoulDebyeDielectric::compute(int eflag, int vflag) void PairLJCutCoulDebyeDielectric::init_style() { - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair lj/cut/coul/debye/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); @@ -207,7 +206,7 @@ double PairLJCutCoulDebyeDielectric::single(int i, int j, int itype, int jtype, { double r2inv, r6inv, forcecoul, forcelj, phicoul, ei, ej, philj; double r, rinv, screening; - double *eps = avec->epsilon; + double *eps = atom->epsilon; r2inv = 1.0 / rsq; if (rsq < cut_coulsq[itype][jtype]) { diff --git a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h index dbe626e669..c70d86368d 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_debye_dielectric.h @@ -44,21 +44,3 @@ class PairLJCutCoulDebyeDielectric : public PairLJCutCoulDebye { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/debye/dielectric requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp index 22a725d045..dad8d74617 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec_dielectric.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "kspace.h" #include "math_const.h" @@ -30,21 +31,14 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using namespace EwaldConst; +using MathConst::MY_PIS; -#define EWALD_F 1.12837917 -#define EWALD_P 0.3275911 -#define A1 0.254829592 -#define A2 -0.284496736 -#define A3 1.421413741 -#define A4 -1.453152027 -#define A5 1.061405429 - -#define EPSILON 1e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -PairLJCutCoulLongDielectric::PairLJCutCoulLongDielectric(LAMMPS *lmp) : PairLJCutCoulLong(lmp) +PairLJCutCoulLongDielectric::PairLJCutCoulLongDielectric(LAMMPS *_lmp) : PairLJCutCoulLong(_lmp) { respa_enable = 0; cut_respa = nullptr; @@ -158,7 +152,7 @@ void PairLJCutCoulLongDielectric::compute(int eflag, int vflag) forcecoul = prefactor * (erfc + EWALD_F * grij * expm2); if (factor_coul < 1.0) forcecoul -= (1.0 - factor_coul) * prefactor; - prefactorE = q[j] / r; + prefactorE = qqrd2e * q[j] / r; efield_i = prefactorE * (erfc + EWALD_F * grij * expm2); if (factor_coul < 1.0) efield_i -= (1.0 - factor_coul) * prefactorE; epot_i = efield_i; @@ -170,13 +164,13 @@ void PairLJCutCoulLongDielectric::compute(int eflag, int vflag) fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction * dftable[itable]; forcecoul = qtmp * q[j] * table; - efield_i = q[j] * table / qqrd2e; + efield_i = q[j] * table; if (factor_coul < 1.0) { table = ctable[itable] + fraction * dctable[itable]; prefactor = qtmp * q[j] * table; forcecoul -= (1.0 - factor_coul) * prefactor; - prefactorE = q[j] * table / qqrd2e; + prefactorE = q[j] * table; efield_i -= (1.0 - factor_coul) * prefactorE; } epot_i = efield_i; @@ -244,7 +238,7 @@ void PairLJCutCoulLongDielectric::compute(int eflag, int vflag) void PairLJCutCoulLongDielectric::init_style() { - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair lj/cut/coul/long/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); diff --git a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h index a267da9915..139b3bc763 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_long_dielectric.h @@ -45,30 +45,3 @@ class PairLJCutCoulLongDielectric : public PairLJCutCoulLong { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long/dielectric requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp index 751f4d509a..0c66f52a4f 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.cpp @@ -31,13 +31,13 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PIS; -#define EPSILON 1e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -PairLJCutCoulMSMDielectric::PairLJCutCoulMSMDielectric(LAMMPS *lmp) : PairLJCutCoulLong(lmp) +PairLJCutCoulMSMDielectric::PairLJCutCoulMSMDielectric(LAMMPS *_lmp) : PairLJCutCoulLong(_lmp) { ewaldflag = pppmflag = 0; msmflag = 1; @@ -165,7 +165,7 @@ void PairLJCutCoulMSMDielectric::compute(int eflag, int vflag) forcecoul = prefactor * fgamma; if (factor_coul < 1.0) forcecoul -= (1.0 - factor_coul) * prefactor; - prefactorE = q[j] / r; + prefactorE = qqrd2e * q[j] / r; efield_i = prefactorE * fgamma; if (factor_coul < 1.0) efield_i -= (1.0 - factor_coul) * prefactorE; @@ -177,13 +177,13 @@ void PairLJCutCoulMSMDielectric::compute(int eflag, int vflag) fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; table = ftable[itable] + fraction * dftable[itable]; forcecoul = qtmp * q[j] * table; - efield_i = q[j] * table / qqrd2e; + efield_i = q[j] * table; if (factor_coul < 1.0) { table = ctable[itable] + fraction * dctable[itable]; prefactor = qtmp * q[j] * table; forcecoul -= (1.0 - factor_coul) * prefactor; - prefactorE = q[j] * table / qqrd2e; + prefactorE = q[j] * table; efield_i -= (1.0 - factor_coul) * prefactorE; } } @@ -352,7 +352,7 @@ double PairLJCutCoulMSMDielectric::single(int i, int j, int itype, int jtype, do void PairLJCutCoulMSMDielectric::init_style() { - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair lj/cut/coul/msm/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); diff --git a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h index 8c0677fbe8..a7cebc94c1 100644 --- a/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h +++ b/src/DIELECTRIC/pair_lj_cut_coul_msm_dielectric.h @@ -45,15 +45,3 @@ class PairLJCutCoulMSMDielectric : public PairLJCutCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -E: Must use 'kspace_modify pressure/scalar no' for rRESPA with kspace_style MSM - -The kspace scalar pressure option cannot (yet) be used with rRESPA. - -*/ diff --git a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp index 3fd86587e9..f99f6438ea 100644 --- a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp +++ b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec_dielectric.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "math_const.h" #include "math_extra.h" @@ -31,20 +32,13 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using namespace EwaldConst; +using MathConst::MY_PIS; using namespace MathExtra; -#define EWALD_F 1.12837917 -#define EWALD_P 0.3275911 -#define A1 0.254829592 -#define A2 -0.284496736 -#define A3 1.421413741 -#define A4 -1.453152027 -#define A5 1.061405429 - /* ---------------------------------------------------------------------- */ -PairLJLongCoulLongDielectric::PairLJLongCoulLongDielectric(LAMMPS *lmp) : PairLJLongCoulLong(lmp) +PairLJLongCoulLongDielectric::PairLJLongCoulLongDielectric(LAMMPS *_lmp) : PairLJLongCoulLong(_lmp) { respa_enable = 0; cut_respa = nullptr; @@ -71,7 +65,7 @@ void PairLJLongCoulLongDielectric::init_style() { PairLJLongCoulLong::init_style(); - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast(atom->style_match("dielectric")); if (!avec) error->all(FLERR, "Pair lj/long/coul/long/dielectric requires atom style dielectric"); neighbor->add_request(this, NeighConst::REQ_FULL); diff --git a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h index ca81a16a1b..50521cee60 100644 --- a/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h +++ b/src/DIELECTRIC/pair_lj_long_coul_long_dielectric.h @@ -44,13 +44,3 @@ class PairLJLongCoulLongDielectric : public PairLJLongCoulLong { #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. - -*/ diff --git a/src/DIELECTRIC/pppm_dielectric.cpp b/src/DIELECTRIC/pppm_dielectric.cpp index 597f51010e..7f32a0a3f3 100644 --- a/src/DIELECTRIC/pppm_dielectric.cpp +++ b/src/DIELECTRIC/pppm_dielectric.cpp @@ -50,7 +50,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ -PPPMDielectric::PPPMDielectric(LAMMPS *lmp) : PPPM(lmp) +PPPMDielectric::PPPMDielectric(LAMMPS *_lmp) : PPPM(_lmp) { group_group_enable = 0; @@ -58,7 +58,7 @@ PPPMDielectric::PPPMDielectric(LAMMPS *lmp) : PPPM(lmp) phi = nullptr; potflag = 0; - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast( atom->style_match("dielectric")); if (!avec) error->all(FLERR,"pppm/dielectric requires atom style dielectric"); } diff --git a/src/DIELECTRIC/pppm_dielectric.h b/src/DIELECTRIC/pppm_dielectric.h index f2427e83f6..92a93daa90 100644 --- a/src/DIELECTRIC/pppm_dielectric.h +++ b/src/DIELECTRIC/pppm_dielectric.h @@ -49,13 +49,3 @@ class PPPMDielectric : public PPPM { #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. - -*/ diff --git a/src/DIELECTRIC/pppm_disp_dielectric.cpp b/src/DIELECTRIC/pppm_disp_dielectric.cpp index 2a7febd304..e525ba7384 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.cpp +++ b/src/DIELECTRIC/pppm_disp_dielectric.cpp @@ -58,7 +58,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM, /* ---------------------------------------------------------------------- */ -PPPMDispDielectric::PPPMDispDielectric(LAMMPS *lmp) : PPPMDisp(lmp) +PPPMDispDielectric::PPPMDispDielectric(LAMMPS *_lmp) : PPPMDisp(_lmp) { dipoleflag = 0; // turned off for now, until dipole works group_group_enable = 0; @@ -69,7 +69,7 @@ PPPMDispDielectric::PPPMDispDielectric(LAMMPS *lmp) : PPPMDisp(lmp) phi = nullptr; potflag = 0; - avec = (AtomVecDielectric *) atom->style_match("dielectric"); + avec = dynamic_cast( atom->style_match("dielectric")); if (!avec) error->all(FLERR,"pppm/dielectric requires atom style dielectric"); } diff --git a/src/DIELECTRIC/pppm_disp_dielectric.h b/src/DIELECTRIC/pppm_disp_dielectric.h index 46b46904f0..b89be02f92 100644 --- a/src/DIELECTRIC/pppm_disp_dielectric.h +++ b/src/DIELECTRIC/pppm_disp_dielectric.h @@ -50,13 +50,3 @@ class PPPMDispDielectric : public PPPMDisp { #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. - -*/ diff --git a/src/DIFFRACTION/compute_saed.cpp b/src/DIFFRACTION/compute_saed.cpp index e2df7fe3b8..e21570d76d 100644 --- a/src/DIFFRACTION/compute_saed.cpp +++ b/src/DIFFRACTION/compute_saed.cpp @@ -348,7 +348,7 @@ void ComputeSAED::compute_vector() utils::logmesg(lmp,"-----\nComputing SAED intensities"); double t0 = platform::walltime(); - double *Fvec = new double[2*nRows]; // Strct factor (real & imaginary) + auto Fvec = new double[2*nRows]; // Strct factor (real & imaginary) // -- Note, vector entries correspond to different RELP ntypes = atom->ntypes; @@ -364,7 +364,7 @@ void ComputeSAED::compute_vector() } } - double *xlocal = new double [3*nlocalgroup]; + auto xlocal = new double [3*nlocalgroup]; int *typelocal = new int [nlocalgroup]; nlocalgroup = 0; @@ -413,7 +413,7 @@ void ComputeSAED::compute_vector() #pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(offset,ASFSAED,typelocal,xlocal,Fvec,m,frac) #endif { - double *f = new double[ntypes]; // atomic structure factor by type + auto f = new double[ntypes]; // atomic structure factor by type int typei = 0; double Fatom1 = 0.0; // structure factor per atom double Fatom2 = 0.0; // structure factor per atom (imaginary) @@ -481,7 +481,7 @@ void ComputeSAED::compute_vector() delete [] f; } - double *scratch = new double[2*nRows]; + auto scratch = new double[2*nRows]; // Sum intensity for each ang-hkl combination across processors MPI_Allreduce(Fvec,scratch,2*nRows,MPI_DOUBLE,MPI_SUM,world); diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index d798c2f4db..aef4d932a9 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -301,7 +301,7 @@ void ComputeXRD::compute_array() double t0 = platform::walltime(); - double *Fvec = new double[2*size_array_rows]; // Strct factor (real & imaginary) + auto Fvec = new double[2*size_array_rows]; // Strct factor (real & imaginary) // -- Note: array rows correspond to different RELP ntypes = atom->ntypes; @@ -317,7 +317,7 @@ void ComputeXRD::compute_array() } } - double *xlocal = new double [3*nlocalgroup]; + auto xlocal = new double [3*nlocalgroup]; int *typelocal = new int [nlocalgroup]; nlocalgroup = 0; @@ -350,7 +350,7 @@ void ComputeXRD::compute_array() #pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(typelocal,xlocal,Fvec,m,frac,ASFXRD) #endif { - double *f = new double[ntypes]; // atomic structure factor by type + auto f = new double[ntypes]; // atomic structure factor by type int n,typei = 0; double Fatom1 = 0.0; // structure factor per atom (real) @@ -486,7 +486,7 @@ void ComputeXRD::compute_array() delete [] f; } // End of pragma omp parallel region - double *scratch = new double[2*size_array_rows]; + auto scratch = new double[2*size_array_rows]; // Sum intensity for each ang-hkl combination across processors MPI_Allreduce(Fvec,scratch,2*size_array_rows,MPI_DOUBLE,MPI_SUM,world); diff --git a/src/DIFFRACTION/fix_saed_vtk.cpp b/src/DIFFRACTION/fix_saed_vtk.cpp index 89627b64ef..45b2db9743 100644 --- a/src/DIFFRACTION/fix_saed_vtk.cpp +++ b/src/DIFFRACTION/fix_saed_vtk.cpp @@ -67,7 +67,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute ID for fix saed/vtk does not exist"); // Check that specified compute is for SAED - compute_saed = (ComputeSAED *) modify->compute[icompute]; + compute_saed = dynamic_cast( modify->compute[icompute]); if (strcmp(compute_saed->style,"saed") != 0) error->all(FLERR,"Fix saed/vtk has invalid compute assigned"); diff --git a/src/DIFFRACTION/fix_saed_vtk.h b/src/DIFFRACTION/fix_saed_vtk.h index 24be1d939c..d50ef01833 100644 --- a/src/DIFFRACTION/fix_saed_vtk.h +++ b/src/DIFFRACTION/fix_saed_vtk.h @@ -80,102 +80,3 @@ class FixSAEDVTK : public Fix { #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 ave/time does not exist - -Self-explanatory. - -E: Fix ID for fix ave/time does not exist - -Self-explanatory. - -E: Invalid fix ave/time off column - -Self-explanatory. - -E: Fix ave/time compute does not calculate a scalar - -Self-explanatory. - -E: Fix ave/time compute does not calculate a vector - -Self-explanatory. - -E: Fix ave/time compute vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix ave/time compute does not calculate an array - -Self-explanatory. - -E: Fix ave/time compute array is accessed out-of-range - -An index for the array is out of bounds. - -E: Fix ave/time fix does not calculate a scalar - -Self-explanatory. - -E: Fix ave/time fix does not calculate a vector - -Self-explanatory. - -E: Fix ave/time fix vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix for fix ave/time not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/time -is requesting a value on a non-allowed timestep. - -E: Fix ave/time fix does not calculate an array - -Self-explanatory. - -E: Fix ave/time fix array is accessed out-of-range - -An index for the array is out of bounds. - -E: Variable name for fix ave/time does not exist - -Self-explanatory. - -E: Fix ave/time variable is not equal-style variable - -Self-explanatory. - -E: Fix ave/time cannot use variable with vector mode - -Variables produce scalar values. - -E: Fix ave/time columns are inconsistent lengths - -Self-explanatory. - -E: Fix ave/time cannot set output array intensive/extensive from these inputs - -One of more of the vector inputs has individual elements which are -flagged as intensive or extensive. Such an input cannot be flagged as -all intensive/extensive when turned into an array by fix ave/time. - -E: Cannot open fix ave/time file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Fix ave/time missed timestep - -You cannot reset the timestep to a value beyond where the fix -expects to next perform averaging. - -*/ diff --git a/src/DIPOLE/angle_dipole.h b/src/DIPOLE/angle_dipole.h index d65ae84e20..6965e1ca5b 100644 --- a/src/DIPOLE/angle_dipole.h +++ b/src/DIPOLE/angle_dipole.h @@ -47,11 +47,3 @@ class AngleDipole : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/DIPOLE/atom_vec_dipole.cpp b/src/DIPOLE/atom_vec_dipole.cpp index a38e1d6d01..2e9fd4226c 100644 --- a/src/DIPOLE/atom_vec_dipole.cpp +++ b/src/DIPOLE/atom_vec_dipole.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -34,18 +33,17 @@ AtomVecDipole::AtomVecDipole(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "q mu"; - fields_copy = (char *) "q mu"; - fields_comm = (char *) "mu3"; - fields_comm_vel = (char *) "mu3"; - fields_reverse = (char *) ""; - fields_border = (char *) "q mu"; - fields_border_vel = (char *) "q mu"; - fields_exchange = (char *) "q mu"; - fields_restart = (char *) "q mu"; - fields_create = (char *) "q mu"; - fields_data_atom = (char *) "id type q x mu3"; - fields_data_vel = (char *) "id v"; + fields_grow = {"q", "mu"}; + fields_copy = {"q", "mu"}; + fields_comm = {"mu3"}; + fields_comm_vel = {"mu3"}; + fields_border = {"q", "mu"}; + fields_border_vel = {"q", "mu"}; + fields_exchange = {"q", "mu"}; + fields_restart = {"q", "mu"}; + fields_create = {"q", "mu"}; + fields_data_atom = {"id", "type", "q", "x", "mu3"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -68,6 +66,5 @@ void AtomVecDipole::grow_pointers() void AtomVecDipole::data_atom_post(int ilocal) { double *mu_one = mu[ilocal]; - mu_one[3] = - sqrt(mu_one[0]*mu_one[0] + mu_one[1]*mu_one[1] + mu_one[2]*mu_one[2]); + mu_one[3] = sqrt(mu_one[0] * mu_one[0] + mu_one[1] * mu_one[1] + mu_one[2] * mu_one[2]); } diff --git a/src/DIPOLE/atom_vec_dipole.h b/src/DIPOLE/atom_vec_dipole.h index 0c76bb54bf..786b884cfe 100644 --- a/src/DIPOLE/atom_vec_dipole.h +++ b/src/DIPOLE/atom_vec_dipole.h @@ -39,7 +39,3 @@ class AtomVecDipole : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.h b/src/DIPOLE/pair_lj_cut_dipole_cut.h index d2d87e3ae5..f42662aa60 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.h +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.h @@ -53,23 +53,3 @@ class PairLJCutDipoleCut : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_style command - -Self-explanatory. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dipole/cut requires atom attributes q, mu, torque - -The atom style defined does not have these attributes. - -*/ diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.h b/src/DIPOLE/pair_lj_cut_dipole_long.h index d563f269a3..03f4c1561c 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.h +++ b/src/DIPOLE/pair_lj_cut_dipole_long.h @@ -58,27 +58,3 @@ class PairLJCutDipoleLong : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_style command - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dipole/long requires atom attributes q, mu, torque - -The atom style defined does not have these attributes. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/DIPOLE/pair_lj_long_dipole_long.h b/src/DIPOLE/pair_lj_long_dipole_long.h index b9f09ec9b1..faf0c3898c 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.h +++ b/src/DIPOLE/pair_lj_long_dipole_long.h @@ -60,66 +60,3 @@ class PairLJLongDipoleLong : public Pair { #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. - -W: Geometric mixing assumed for 1/r^6 coefficients - -Self-explanatory. - -W: Using largest cut-off for lj/long/dipole/long long long - -Self-explanatory. - -E: Cut-offs missing in pair_style lj/long/dipole/long - -Self-explanatory. - -E: Coulombic cut not supported in pair_style lj/long/dipole/long - -Must use long-range Coulombic interactions. - -E: Only one cut-off allowed when requesting all long - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -E: Invoking coulombic in pair style lj/long/dipole/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair lj/long/dipole/long requires atom attributes mu, torque - -The atom style defined does not have these attributes. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair style requires use of kspace_style ewald/disp - -Self-explanatory. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -U: Pair style lj/long/dipole/long does not currently support respa - -This feature is not yet supported. - -*/ diff --git a/src/DIPOLE/pair_lj_sf_dipole_sf.h b/src/DIPOLE/pair_lj_sf_dipole_sf.h index 809d352472..783ec00ad8 100644 --- a/src/DIPOLE/pair_lj_sf_dipole_sf.h +++ b/src/DIPOLE/pair_lj_sf_dipole_sf.h @@ -26,7 +26,7 @@ namespace LAMMPS_NS { class PairLJSFDipoleSF : public Pair { public: - PairLJSFDipoleSF(class LAMMPS *_lmp) : Pair(_lmp) {}; + PairLJSFDipoleSF(class LAMMPS *_lmp) : Pair(_lmp){}; ~PairLJSFDipoleSF() override; void compute(int, int) override; void settings(int, char **) override; diff --git a/src/DPD-BASIC/pair_dpd.h b/src/DPD-BASIC/pair_dpd.h index 2a08c60376..4da94ae8d1 100644 --- a/src/DPD-BASIC/pair_dpd.h +++ b/src/DPD-BASIC/pair_dpd.h @@ -56,30 +56,3 @@ class PairDPD : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dpd requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -W: Pair dpd needs newton pair on for momentum conservation - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/DPD-BASIC/pair_dpd_ext.h b/src/DPD-BASIC/pair_dpd_ext.h index eae8fd9f1d..40377ac310 100644 --- a/src/DPD-BASIC/pair_dpd_ext.h +++ b/src/DPD-BASIC/pair_dpd_ext.h @@ -57,30 +57,3 @@ class PairDPDExt : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dpd requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -W: Pair dpd needs newton pair on for momentum conservation - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/DPD-BASIC/pair_dpd_ext_tstat.h b/src/DPD-BASIC/pair_dpd_ext_tstat.h index 30974c7949..94ef466f0d 100644 --- a/src/DPD-BASIC/pair_dpd_ext_tstat.h +++ b/src/DPD-BASIC/pair_dpd_ext_tstat.h @@ -45,17 +45,3 @@ class PairDPDExtTstat : public PairDPDExt { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/DPD-BASIC/pair_dpd_tstat.h b/src/DPD-BASIC/pair_dpd_tstat.h index c7c41f2b24..b7d985253d 100644 --- a/src/DPD-BASIC/pair_dpd_tstat.h +++ b/src/DPD-BASIC/pair_dpd_tstat.h @@ -45,17 +45,3 @@ class PairDPDTstat : public PairDPD { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/DPD-MESO/atom_vec_edpd.cpp b/src/DPD-MESO/atom_vec_edpd.cpp index cf7c8ed29f..d8592d26f5 100644 --- a/src/DPD-MESO/atom_vec_edpd.cpp +++ b/src/DPD-MESO/atom_vec_edpd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -38,18 +37,18 @@ AtomVecEDPD::AtomVecEDPD(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "edpd_cv edpd_temp edpd_flux vest vest_temp"; - fields_copy = (char *) "edpd_cv edpd_temp edpd_flux vest vest_temp"; - fields_comm = (char *) "edpd_temp vest vest_temp"; - fields_comm_vel = (char *) "edpd_temp vest vest_temp"; - fields_reverse = (char *) "edpd_flux"; - fields_border = (char *) "edpd_cv edpd_temp vest vest_temp"; - fields_border_vel = (char *) "edpd_cv edpd_temp vest vest_temp"; - fields_exchange = (char *) "edpd_cv edpd_temp vest vest_temp"; - fields_restart = (char * ) "edpd_cv edpd_temp vest vest_temp"; - fields_create = (char *) "edpd_cv edpd_temp edpd_flux vest vest_temp"; - fields_data_atom = (char *) "id type edpd_temp edpd_cv x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"edpd_cv", "edpd_temp", "edpd_flux", "vest", "vest_temp"}; + fields_copy = {"edpd_cv", "edpd_temp", "edpd_flux", "vest", "vest_temp"}; + fields_comm = {"edpd_temp", "vest", "vest_temp"}; + fields_comm_vel = {"edpd_temp", "vest", "vest_temp"}; + fields_reverse = {"edpd_flux"}; + fields_border = {"edpd_cv", "edpd_temp", "vest", "vest_temp"}; + fields_border_vel = {"edpd_cv", "edpd_temp", "vest", "vest_temp"}; + fields_exchange = {"edpd_cv", "edpd_temp", "vest", "vest_temp"}; + fields_restart = {"edpd_cv", "edpd_temp", "vest", "vest_temp"}; + fields_create = {"edpd_cv", "edpd_temp", "edpd_flux", "vest", "vest_temp"}; + fields_data_atom = {"id", "type", "edpd_temp", "edpd_cv", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -60,8 +59,7 @@ void AtomVecEDPD::init() { AtomVec::init(); - if (strcmp(update->unit_style,"lj") != 0) - error->all(FLERR,"Atom style edpd requires lj units"); + if (strcmp(update->unit_style, "lj") != 0) error->all(FLERR, "Atom style edpd requires lj units"); } /* ---------------------------------------------------------------------- @@ -85,7 +83,7 @@ void AtomVecEDPD::grow_pointers() void AtomVecEDPD::force_clear(int n, size_t nbytes) { - memset(&edpd_flux[n],0,nbytes); + memset(&edpd_flux[n], 0, nbytes); } /* ---------------------------------------------------------------------- @@ -95,7 +93,7 @@ void AtomVecEDPD::force_clear(int n, size_t nbytes) void AtomVecEDPD::create_atom_post(int ilocal) { edpd_temp[ilocal] = 1.0; - edpd_cv[ilocal]= 1.0e5; + edpd_cv[ilocal] = 1.0e5; vest_temp[ilocal] = edpd_temp[ilocal]; } diff --git a/src/DPD-MESO/atom_vec_mdpd.cpp b/src/DPD-MESO/atom_vec_mdpd.cpp index 5a05d33b79..4b9b58b0d6 100644 --- a/src/DPD-MESO/atom_vec_mdpd.cpp +++ b/src/DPD-MESO/atom_vec_mdpd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,10 +12,12 @@ ------------------------------------------------------------------------- */ #include "atom_vec_mdpd.h" -#include + #include "atom.h" -#include "update.h" #include "error.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -36,18 +37,18 @@ AtomVecMDPD::AtomVecMDPD(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "rho drho vest"; - fields_copy = (char *) "rho drho vest"; - fields_comm = (char *) "rho vest"; - fields_comm_vel = (char *) "rho vest"; - fields_reverse = (char *) "drho"; - fields_border = (char *) "rho vest"; - fields_border_vel = (char *) "rho vest"; - fields_exchange = (char *) "rho vest"; - fields_restart = (char * ) "rho vest"; - fields_create = (char *) "rho drho vest"; - fields_data_atom = (char *) "id type rho x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"rho", "drho", "vest"}; + fields_copy = {"rho", "drho", "vest"}; + fields_comm = {"rho", "vest"}; + fields_comm_vel = {"rho", "vest"}; + fields_reverse = {"drho"}; + fields_border = {"rho", "vest"}; + fields_border_vel = {"rho", "vest"}; + fields_exchange = {"rho", "vest"}; + fields_restart = {"rho", "vest"}; + fields_create = {"rho", "drho", "vest"}; + fields_data_atom = {"id", "type", "rho", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -58,8 +59,7 @@ void AtomVecMDPD::init() { AtomVec::init(); - if (strcmp(update->unit_style,"lj") != 0) - error->all(FLERR,"Atom style mdpd requires lj units"); + if (strcmp(update->unit_style, "lj") != 0) error->all(FLERR, "Atom style mdpd requires lj units"); } /* ---------------------------------------------------------------------- @@ -81,7 +81,7 @@ void AtomVecMDPD::grow_pointers() void AtomVecMDPD::force_clear(int n, size_t nbytes) { - memset(&drho[n],0,nbytes); + memset(&drho[n], 0, nbytes); } /* ---------------------------------------------------------------------- @@ -102,10 +102,10 @@ void AtomVecMDPD::data_atom_post(int ilocal) return -1 if name is unknown to this atom style ------------------------------------------------------------------------- */ -int AtomVecMDPD::property_atom(char *name) +int AtomVecMDPD::property_atom(const std::string &name) { - if (strcmp(name,"rho") == 0) return 0; - if (strcmp(name,"drho") == 0) return 1; + if (name == "rho") return 0; + if (name == "drho") return 1; return -1; } @@ -114,8 +114,7 @@ int AtomVecMDPD::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecMDPD::pack_property_atom(int index, double *buf, - int nvalues, int groupbit) +void AtomVecMDPD::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -123,14 +122,18 @@ void AtomVecMDPD::pack_property_atom(int index, double *buf, int n = 0; if (index == 0) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = rho[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = rho[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 1) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = drho[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = drho[i]; + else + buf[n] = 0.0; n += nvalues; } } diff --git a/src/DPD-MESO/atom_vec_mdpd.h b/src/DPD-MESO/atom_vec_mdpd.h index 4e8aefeebe..1d7bc3db71 100644 --- a/src/DPD-MESO/atom_vec_mdpd.h +++ b/src/DPD-MESO/atom_vec_mdpd.h @@ -32,7 +32,7 @@ class AtomVecMDPD : public AtomVec { void grow_pointers() override; void force_clear(int, size_t) override; void data_atom_post(int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; private: diff --git a/src/DPD-MESO/atom_vec_tdpd.cpp b/src/DPD-MESO/atom_vec_tdpd.cpp index 8b558457ed..bbd6bc89bc 100644 --- a/src/DPD-MESO/atom_vec_tdpd.cpp +++ b/src/DPD-MESO/atom_vec_tdpd.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,11 +12,12 @@ ------------------------------------------------------------------------- */ #include "atom_vec_tdpd.h" -#include -#include "atom.h" -#include "update.h" -#include "error.h" +#include "atom.h" +#include "error.h" +#include "update.h" + +#include using namespace LAMMPS_NS; @@ -37,18 +37,18 @@ AtomVecTDPD::AtomVecTDPD(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "cc cc_flux vest"; - fields_copy = (char *) "cc vest"; - fields_comm = (char *) "cc vest"; - fields_comm_vel = (char *) "cc vest"; - fields_reverse = (char *) "cc_flux"; - fields_border = (char *) "cc vest"; - fields_border_vel = (char *) "cc vest"; - fields_exchange = (char *) "cc vest"; - fields_restart = (char * ) "cc vest"; - fields_create = (char *) "cc vest"; - fields_data_atom = (char *) "id type x cc"; - fields_data_vel = (char *) "id v"; + fields_grow = {"cc", "cc_flux", "vest"}; + fields_copy = {"cc", "vest"}; + fields_comm = {"cc", "vest"}; + fields_comm_vel = {"cc", "vest"}; + fields_reverse = {"cc_flux"}; + fields_border = {"cc", "vest"}; + fields_border_vel = {"cc", "vest"}; + fields_exchange = {"cc", "vest"}; + fields_restart = {"cc", "vest"}; + fields_create = {"cc", "vest"}; + fields_data_atom = {"id", "type", "x", "cc"}; + fields_data_vel = {"id", "v"}; } /* ---------------------------------------------------------------------- @@ -58,13 +58,13 @@ AtomVecTDPD::AtomVecTDPD(LAMMPS *lmp) : AtomVec(lmp) void AtomVecTDPD::process_args(int narg, char **arg) { - if (narg < 1) error->all(FLERR,"Invalid atom_style tdpd command"); + if (narg < 1) error->all(FLERR, "Invalid atom_style tdpd command"); - atom->cc_species = utils::inumeric(FLERR,arg[0],false,lmp); + atom->cc_species = utils::inumeric(FLERR, arg[0], false, lmp); cc_species = atom->cc_species; - atom->add_peratom_change_columns("cc",cc_species); - atom->add_peratom_change_columns("cc_flux",cc_species); + atom->add_peratom_change_columns("cc", cc_species); + atom->add_peratom_change_columns("cc_flux", cc_species); // delay setting up of fields until now @@ -77,8 +77,7 @@ void AtomVecTDPD::init() { AtomVec::init(); - if (strcmp(update->unit_style,"lj") != 0) - error->all(FLERR,"Atom style tdpd requires lj units"); + if (strcmp(update->unit_style, "lj") != 0) error->all(FLERR, "Atom style tdpd requires lj units"); } /* ---------------------------------------------------------------------- @@ -92,7 +91,6 @@ void AtomVecTDPD::grow_pointers() vest = atom->vest; } - /* ---------------------------------------------------------------------- clear extra forces starting at atom N nbytes = # of bytes to clear for a per-atom vector @@ -100,7 +98,7 @@ void AtomVecTDPD::grow_pointers() void AtomVecTDPD::force_clear(int n, size_t nbytes) { - memset(&cc_flux[n][0],0,cc_species*nbytes); + memset(&cc_flux[n][0], 0, cc_species * nbytes); } /* ---------------------------------------------------------------------- diff --git a/src/DPD-MESO/atom_vec_tdpd.h b/src/DPD-MESO/atom_vec_tdpd.h index 0ebffbe0de..1daea09628 100644 --- a/src/DPD-MESO/atom_vec_tdpd.h +++ b/src/DPD-MESO/atom_vec_tdpd.h @@ -45,16 +45,3 @@ class AtomVecTDPD : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/DPD-MESO/pair_edpd.h b/src/DPD-MESO/pair_edpd.h index da8cc37d11..055fdfdadc 100644 --- a/src/DPD-MESO/pair_edpd.h +++ b/src/DPD-MESO/pair_edpd.h @@ -60,26 +60,3 @@ class PairEDPD : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -W: Pair tdpd needs newton pair on for momentum conservation - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/DPD-MESO/pair_mdpd.h b/src/DPD-MESO/pair_mdpd.h index 56a6636d29..b95e257043 100644 --- a/src/DPD-MESO/pair_mdpd.h +++ b/src/DPD-MESO/pair_mdpd.h @@ -55,30 +55,3 @@ class PairMDPD : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dpd requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -W: Pair dpd needs newton pair on for momentum conservation - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/DPD-MESO/pair_tdpd.cpp b/src/DPD-MESO/pair_tdpd.cpp index 35f440426e..76f4b59108 100644 --- a/src/DPD-MESO/pair_tdpd.cpp +++ b/src/DPD-MESO/pair_tdpd.cpp @@ -279,9 +279,9 @@ void PairTDPD::coeff(int narg, char **arg) 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]; + auto kappa_one = new double[cc_species]; + auto epsilon_one = new double[cc_species]; + auto powercc_one = new double[cc_species]; for (int k=0; kone(FLERR,"Internal temperature in Atoms section of date file " - "must be > zero"); + error->one(FLERR, "Internal temperature in Atoms section of date file must be > zero"); } diff --git a/src/DPD-REACT/atom_vec_dpd.h b/src/DPD-REACT/atom_vec_dpd.h index da4387f553..8710d133ad 100644 --- a/src/DPD-REACT/atom_vec_dpd.h +++ b/src/DPD-REACT/atom_vec_dpd.h @@ -42,11 +42,3 @@ class AtomVecDPD : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Internal temperature in Atoms section of data file must be > zero - -All internal temperatures must be > zero - -*/ diff --git a/src/DPD-REACT/compute_dpd.h b/src/DPD-REACT/compute_dpd.h index 94c69d0a13..269c9919a0 100644 --- a/src/DPD-REACT/compute_dpd.h +++ b/src/DPD-REACT/compute_dpd.h @@ -39,17 +39,3 @@ class ComputeDpd : public Compute { #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 dpd requires atom_style with internal temperature and energies (e.g. dpd) - -Self-explanatory. - -*/ diff --git a/src/DPD-REACT/compute_dpd_atom.h b/src/DPD-REACT/compute_dpd_atom.h index 4889987052..817e8145c3 100644 --- a/src/DPD-REACT/compute_dpd_atom.h +++ b/src/DPD-REACT/compute_dpd_atom.h @@ -41,21 +41,3 @@ class ComputeDpdAtom : public Compute { #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 dpd requires atom_style with internal temperature and energies (e.g. dpd) - -Self-explanatory - -W: More than one compute dpd/atom command - -Self-explanatory - -*/ diff --git a/src/DPD-REACT/fix_dpd_energy.cpp b/src/DPD-REACT/fix_dpd_energy.cpp index f980e41157..79ff1cc231 100644 --- a/src/DPD-REACT/fix_dpd_energy.cpp +++ b/src/DPD-REACT/fix_dpd_energy.cpp @@ -30,9 +30,9 @@ FixDPDenergy::FixDPDenergy(LAMMPS *lmp, int narg, char **arg) : if (narg != 3 ) error->all(FLERR,"Illegal fix dpd/energy command"); pairDPDE = nullptr; - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); + pairDPDE = dynamic_cast( force->pair_match("dpd/fdt/energy",1)); if (pairDPDE == nullptr) - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); + pairDPDE = dynamic_cast( force->pair_match("dpd/fdt/energy/kk",1)); if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix dpd/energy"); diff --git a/src/DPD-REACT/fix_dpd_energy.h b/src/DPD-REACT/fix_dpd_energy.h index 3787b770cd..39236e1d36 100644 --- a/src/DPD-REACT/fix_dpd_energy.h +++ b/src/DPD-REACT/fix_dpd_energy.h @@ -39,13 +39,3 @@ class FixDPDenergy : public Fix { #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. - -*/ diff --git a/src/DPD-REACT/fix_eos_cv.h b/src/DPD-REACT/fix_eos_cv.h index b6b663029b..9795cc763e 100644 --- a/src/DPD-REACT/fix_eos_cv.h +++ b/src/DPD-REACT/fix_eos_cv.h @@ -40,25 +40,3 @@ class FixEOScv : public Fix { #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: FixEOScv requires atom_style with internal temperature and energies (e.g. dpd) - -Self-explanatory. - -E: EOS cv must be > 0.0 - -The constant volume heat capacity must be larger than zero. - -E: Internal temperature < zero - -Self-explanatory. EOS may not be valid under current simulation conditions. - -*/ diff --git a/src/DPD-REACT/fix_eos_table.cpp b/src/DPD-REACT/fix_eos_table.cpp index 61b4e7501a..17158e5a51 100644 --- a/src/DPD-REACT/fix_eos_table.cpp +++ b/src/DPD-REACT/fix_eos_table.cpp @@ -349,7 +349,7 @@ void FixEOStable::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/fix_eos_table.h b/src/DPD-REACT/fix_eos_table.h index 8d6a8c03db..882b9ba284 100644 --- a/src/DPD-REACT/fix_eos_table.h +++ b/src/DPD-REACT/fix_eos_table.h @@ -66,64 +66,3 @@ class FixEOStable : public Fix { #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: Unknown table style in fix eos/table - -Style of table is invalid for use with fix eos/table command. - -E: Illegal number of eos/table entries - -There must be at least 2 table entries. - -E: Invalid eos/table length - -Length of read-in fix eos/table is invalid - -E: eos/table values are not increasing - -The EOS must be a monotonically, increasing function - -E: FixEOStable requires atom_style with internal temperature and energies (e.g. dpd) - -Self-explanatory. - -E: Internal temperature < zero - -Self-explanatory. EOS may not be valid under current simulation conditions. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Did not find keyword in table file - -Keyword used in fix eos/table command was not found in table file. - -E: Invalid keyword in fix eos/table parameters - -Keyword used in list of table parameters is not recognized. - -E: fix eos/table parameters did not set N - -List of fix eos/table parameters must include N setting. - -E: Temperature is not within table cutoffs - -The internal temperature does not lie with the minimum -and maximum temperature cutoffs of the table - -E: Energy is not within table cutoffs - -The internal energy does not lie with the minimum -and maximum energy cutoffs of the table - -*/ diff --git a/src/DPD-REACT/fix_eos_table_rx.cpp b/src/DPD-REACT/fix_eos_table_rx.cpp index 26defddc45..a2f8893b82 100644 --- a/src/DPD-REACT/fix_eos_table_rx.cpp +++ b/src/DPD-REACT/fix_eos_table_rx.cpp @@ -301,7 +301,7 @@ void FixEOStableRX::read_file(char *file) { int min_params_per_line = 2; int max_params_per_line = 5; - char **words = new char*[max_params_per_line+1]; + auto words = new char*[max_params_per_line+1]; // open file on proc 0 @@ -641,7 +641,7 @@ void FixEOStableRX::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/fix_eos_table_rx.h b/src/DPD-REACT/fix_eos_table_rx.h index 3724923276..bd6c1a0653 100644 --- a/src/DPD-REACT/fix_eos_table_rx.h +++ b/src/DPD-REACT/fix_eos_table_rx.h @@ -82,81 +82,3 @@ class FixEOStableRX : public Fix { #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: FixEOStableRX requires a fix rx command. - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Invalid eos/table/rx length - -The eos/table/rx table must have more than one entry. - -E: eos/table/rx values are not increasing - -The equation-of-state must an increasing function - -E: FixEOStableRX requires atom_style with internal temperature and energies (e.g. dpd) - -Self-explanatory. - -E: Internal temperature <= zero. - -Self-explanatory. - -E: Cannot open eos table/rx potential file %s - -Self-explanatory. - -E: Incorrect format in eos table/rx file - -Self-explanatory. - -E: Cannot open file %s - -Self-explanatory. - -E: Did not find keyword in table file - -Self-explanatory. - -E: Illegal fix eos/table/rx command - -Incorrect number of arguments specified for the fix eos/table/rx command. - -E: Invalid keyword in fix eos/table/rx parameters - -Self-explanatory. - -E: The number of columns in fix eos/table/rx does not match the number of species. - -Self-explanatory. Check format for fix eos/table/rx file. - -E: fix eos/table/rx parameters did not set N - -The number of table entries was not set in the eos/table/rx file - -W: Secant solver did not converge because table bounds were exceeded - -The secant solver failed to converge, resulting in the lower or upper table bound temperature to be returned - -E: NaN detected in secant solver. - -Self-explanatory. - -E: Maxit exceeded in secant solver - -The maximum number of iterations was exceeded in the secant solver - -*/ diff --git a/src/DPD-REACT/fix_rx.cpp b/src/DPD-REACT/fix_rx.cpp index dd8eacccc7..9a32f39268 100644 --- a/src/DPD-REACT/fix_rx.cpp +++ b/src/DPD-REACT/fix_rx.cpp @@ -233,7 +233,7 @@ void FixRX::post_constructor() int nUniqueSpecies = 0; bool match; - char **tmpspecies = new char*[maxspecies]; + auto tmpspecies = new char*[maxspecies]; for (int jj=0; jj < maxspecies; jj++) tmpspecies[jj] = nullptr; @@ -319,9 +319,9 @@ void FixRX::post_constructor() newcmd1 += " ghost yes"; newcmd2 += " ghost yes"; - fix_species = (FixPropertyAtom *) modify->add_fix(newcmd1); + fix_species = dynamic_cast( modify->add_fix(newcmd1)); restartFlag = fix_species->restart_reset; - fix_species_old = (FixPropertyAtom *) modify->add_fix(newcmd2); + fix_species_old = dynamic_cast( modify->add_fix(newcmd2)); if (nspecies==0) error->all(FLERR,"There are no rx species specified."); @@ -579,9 +579,9 @@ int FixRX::setmask() void FixRX::init() { - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); + pairDPDE = dynamic_cast( force->pair_match("dpd/fdt/energy",1)); if (pairDPDE == nullptr) - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); + pairDPDE = dynamic_cast( force->pair_match("dpd/fdt/energy/kk",1)); if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); @@ -625,7 +625,7 @@ void FixRX::setup_pre_force(int /*vflag*/) userData.kFor = new double[nreactions]; userData.rxnRateLaw = new double[nreactions]; - double *rwork = new double[8*nspecies]; + auto rwork = new double[8*nspecies]; if (localTempFlag) { int count = nlocal + (newton_pair ? nghost : 0); @@ -695,7 +695,7 @@ void FixRX::pre_force(int /*vflag*/) } { - double *rwork = new double[8*nspecies]; + auto rwork = new double[8*nspecies]; UserRHSData userData; userData.kFor = new double[nreactions]; @@ -1575,7 +1575,7 @@ int FixRX::rhs(double t, const double *y, double *dydt, void *params) int FixRX::rhs_dense(double /*t*/, const double *y, double *dydt, void *params) { - UserRHSData *userData = (UserRHSData *) params; + auto userData = (UserRHSData *) params; double *rxnRateLaw = userData->rxnRateLaw; double *kFor = userData->kFor; @@ -1609,7 +1609,7 @@ int FixRX::rhs_dense(double /*t*/, const double *y, double *dydt, void *params) int FixRX::rhs_sparse(double /*t*/, const double *y, double *dydt, void *v_params) const { - UserRHSData *userData = (UserRHSData *) v_params; + auto userData = (UserRHSData *) v_params; const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; diff --git a/src/DPD-REACT/fix_rx.h b/src/DPD-REACT/fix_rx.h index d82eaa8419..d3e4545ed5 100644 --- a/src/DPD-REACT/fix_rx.h +++ b/src/DPD-REACT/fix_rx.h @@ -147,53 +147,3 @@ class FixRX : public Fix { #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: fix rx cannot be combined with fix property/atom - -Self-explanatory - -E: Cannot open rx file %s - -Self-explanatory - -E: Exceeded the maximum number of species permitted in fix rx - -Reduce the number of species in the fix rx reaction kinetics file - -E: There are no rx species specified. - -Self-explanatory - -E: Must use pair_style dpd/fdt/energy with fix rx. - -Self-explanatory - -E: fix rx requires fix eos/table/rx to be specified. - -Self-explanatory - -W: in FixRX::pre_force, ODE solver failed for %d atoms. - -Self-explanatory - -E: Missing parameters in reaction kinetic equation. - -Self-explanatory - -E: Potential file has duplicate entry. - -Self-explanatory - -E: Computed concentration in RK4 (RKF45) solver is < -1.0e-10. - -Self-explanatory: Adjust settings for the RK4 solver. - -*/ diff --git a/src/DPD-REACT/fix_shardlow.cpp b/src/DPD-REACT/fix_shardlow.cpp index 02a8af888e..7ab8c6f857 100644 --- a/src/DPD-REACT/fix_shardlow.cpp +++ b/src/DPD-REACT/fix_shardlow.cpp @@ -93,10 +93,10 @@ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : pairDPD = nullptr; pairDPDE = nullptr; - pairDPD = (PairDPDfdt *) force->pair_match("dpd/fdt",1); - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); + pairDPD = dynamic_cast( force->pair_match("dpd/fdt",1)); + pairDPDE = dynamic_cast( force->pair_match("dpd/fdt/energy",1)); if (pairDPDE == nullptr) - pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); + pairDPDE = dynamic_cast( force->pair_match("dpd/fdt/energy/kk",1)); maxRNG = 0; if (pairDPDE) { @@ -548,7 +548,7 @@ void FixShardlow::initial_integrate(int /*vflag*/) "Either reduce the number of processors requested, or change the cutoff/skin: " "rcut= {} bbx= {} bby= {} bbz= {}\n", rcut, bbx, bby, bbz); - NPairHalfBinNewtonSSA *np_ssa = dynamic_cast(list->np); + auto np_ssa = dynamic_cast(list->np); if (!np_ssa) error->one(FLERR, "NPair wasn't a NPairHalfBinNewtonSSA object"); int ssa_phaseCt = np_ssa->ssa_phaseCt; int *ssa_phaseLen = np_ssa->ssa_phaseLen; diff --git a/src/DPD-REACT/fix_shardlow.h b/src/DPD-REACT/fix_shardlow.h index a5481aea92..40cc22eec1 100644 --- a/src/DPD-REACT/fix_shardlow.h +++ b/src/DPD-REACT/fix_shardlow.h @@ -67,39 +67,3 @@ class FixShardlow : public Fix { #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: Must use dpd/fdt pair_style with fix shardlow - -Self-explanatory. - -E: Must use pair_style dpd/fdt or dpd/fdt/energy with fix shardlow - -E: A deterministic integrator must be specified after fix shardlow in input -file (e.g. fix nve or fix nph). - -Self-explanatory. - -E: Cannot use constant temperature integration routines with DPD - -Self-explanatory. Must use deterministic integrators such as nve or nph - -E: Fix shardlow does not yet support triclinic geometries - -Self-explanatory. - -E: Shardlow algorithm requires sub-domain length > 2*(rcut+skin). Either -reduce the number of processors requested, or change the cutoff/skin - -The Shardlow splitting algorithm requires the size of the sub-domain lengths -to be are larger than twice the cutoff+skin. Generally, the domain decomposition -is dependant on the number of processors requested. - -*/ diff --git a/src/DPD-REACT/nbin_ssa.h b/src/DPD-REACT/nbin_ssa.h index ca04ed4bd5..f6c60b1a79 100644 --- a/src/DPD-REACT/nbin_ssa.h +++ b/src/DPD-REACT/nbin_ssa.h @@ -95,7 +95,3 @@ class NBinSSA : public NBinStandard { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/DPD-REACT/npair_half_bin_newton_ssa.cpp b/src/DPD-REACT/npair_half_bin_newton_ssa.cpp index 1dfeaac6bb..2f36b467e0 100644 --- a/src/DPD-REACT/npair_half_bin_newton_ssa.cpp +++ b/src/DPD-REACT/npair_half_bin_newton_ssa.cpp @@ -97,12 +97,12 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - NStencilSSA *ns_ssa = dynamic_cast(ns); + auto ns_ssa = dynamic_cast(ns); if (!ns_ssa) error->one(FLERR, "NStencil wasn't a NStencilSSA object"); int *nstencil_ssa = &(ns_ssa->nstencil_ssa[0]); int nstencil_full = ns_ssa->nstencil; - NBinSSA *nb_ssa = dynamic_cast(nb); + auto nb_ssa = dynamic_cast(nb); if (!nb_ssa) error->one(FLERR, "NBin wasn't a NBinSSA object"); int *bins = nb_ssa->bins; int *binhead = nb_ssa->binhead; diff --git a/src/DPD-REACT/npair_half_bin_newton_ssa.h b/src/DPD-REACT/npair_half_bin_newton_ssa.h index 265087e7ed..dae45742f4 100644 --- a/src/DPD-REACT/npair_half_bin_newton_ssa.h +++ b/src/DPD-REACT/npair_half_bin_newton_ssa.h @@ -52,7 +52,3 @@ class NPairHalfBinNewtonSSA : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/DPD-REACT/nstencil_half_bin_2d_ssa.h b/src/DPD-REACT/nstencil_half_bin_2d_ssa.h index b53deb5e4d..52e3d645c1 100644 --- a/src/DPD-REACT/nstencil_half_bin_2d_ssa.h +++ b/src/DPD-REACT/nstencil_half_bin_2d_ssa.h @@ -36,7 +36,3 @@ class NStencilHalfBin2dSSA : public NStencilSSA { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/DPD-REACT/nstencil_half_bin_3d_ssa.h b/src/DPD-REACT/nstencil_half_bin_3d_ssa.h index 0d3cfd6a26..dcaaaa91e9 100644 --- a/src/DPD-REACT/nstencil_half_bin_3d_ssa.h +++ b/src/DPD-REACT/nstencil_half_bin_3d_ssa.h @@ -36,7 +36,3 @@ class NStencilHalfBin3dSSA : public NStencilSSA { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/DPD-REACT/nstencil_ssa.h b/src/DPD-REACT/nstencil_ssa.h index 237a9d982f..a1438f5dac 100644 --- a/src/DPD-REACT/nstencil_ssa.h +++ b/src/DPD-REACT/nstencil_ssa.h @@ -30,7 +30,3 @@ class NStencilSSA : public NStencil { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/DPD-REACT/pair_dpd_fdt.h b/src/DPD-REACT/pair_dpd_fdt.h index 29c8808768..6b488d0820 100644 --- a/src/DPD-REACT/pair_dpd_fdt.h +++ b/src/DPD-REACT/pair_dpd_fdt.h @@ -59,30 +59,3 @@ class PairDPDfdt : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dpd/fdt requires ghost atoms store velocity - -Use the communicate vel yes command to enable this. - -E: Pair dpd/fdt requires newton pair on - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/DPD-REACT/pair_dpd_fdt_energy.h b/src/DPD-REACT/pair_dpd_fdt_energy.h index 7868caa95e..dcebc2d683 100644 --- a/src/DPD-REACT/pair_dpd_fdt_energy.h +++ b/src/DPD-REACT/pair_dpd_fdt_energy.h @@ -61,30 +61,3 @@ class PairDPDfdtEnergy : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dpd/fdt/energy requires ghost atoms store velocity - -Use the communicate vel yes command to enable this. - -E: Pair dpd/fdt/energy requires newton pair on - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/DPD-REACT/pair_exp6_rx.cpp b/src/DPD-REACT/pair_exp6_rx.cpp index 313e9f2583..02d4e84e9e 100644 --- a/src/DPD-REACT/pair_exp6_rx.cpp +++ b/src/DPD-REACT/pair_exp6_rx.cpp @@ -705,7 +705,7 @@ double PairExp6rx::init_one(int i, int j) void PairExp6rx::read_file(char *file) { int params_per_line = 5; - char **words = new char*[params_per_line+1]; + auto words = new char*[params_per_line+1]; memory->sfree(params); params = nullptr; @@ -820,7 +820,7 @@ void PairExp6rx::read_file(char *file) void PairExp6rx::read_file2(char *file) { int params_per_line = 7; - char **words = new char*[params_per_line+1]; + auto words = new char*[params_per_line+1]; // open file on proc 0 diff --git a/src/DPD-REACT/pair_exp6_rx.h b/src/DPD-REACT/pair_exp6_rx.h index 8c254cd5aa..d965b8031e 100644 --- a/src/DPD-REACT/pair_exp6_rx.h +++ b/src/DPD-REACT/pair_exp6_rx.h @@ -84,65 +84,3 @@ class PairExp6rx : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: alpha_ij is 6.0 in pair exp6 - -Self-explanatory - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: PairExp6rx requires a fix rx command - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Site1 name not recognized in pair coefficients - -The site1 keyword does not match the species keywords specified throug the fix rx command - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open exp6/rx potential file %s - -Self-explanatory - -E: Incorrect format in exp6/rx potential file - -Self-explanatory - -E: Illegal exp6/rx parameters. Rm and Epsilon must be greater than zero. Alpha cannot be negative. - -Self-explanatory - -E: Illegal exp6/rx parameters. Interaction potential does not exist. - -Self-explanatory - -E: Potential file has duplicate entry. - -Self-explanatory - -E: The number of molecules in CG particle is less than 10*DBL_EPSILON. - -Self-explanatory. Check the species concentrations have been properly set -and check the reaction kinetic solver parameters in fix rx to more for -sufficient accuracy. - - -*/ diff --git a/src/DPD-REACT/pair_multi_lucy.cpp b/src/DPD-REACT/pair_multi_lucy.cpp index 41c9d9fb66..009ebfc21f 100644 --- a/src/DPD-REACT/pair_multi_lucy.cpp +++ b/src/DPD-REACT/pair_multi_lucy.cpp @@ -623,7 +623,7 @@ void PairMultiLucy::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/pair_multi_lucy.h b/src/DPD-REACT/pair_multi_lucy.h index 581310758d..a5ee9641fd 100644 --- a/src/DPD-REACT/pair_multi_lucy.h +++ b/src/DPD-REACT/pair_multi_lucy.h @@ -79,70 +79,3 @@ class PairMultiLucy : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair multi/lucy command requires atom_style with density (e.g. dpd, meso) - -Self-explanatory - -E: Density < table inner cutoff - -The local density inner is smaller than the inner cutoff - -E: Density > table inner cutoff - -The local density inner is greater than the inner cutoff - -E: Only LOOKUP and LINEAR table styles have been implemented for pair multi/lucy - -Self-explanatory - -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: Illegal number of pair table entries - -There must be at least 2 table entries. - -E: Illegal pair_coeff command - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Invalid pair table length - -Length of read-in pair table is invalid - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Invalid keyword in pair table parameters - -Keyword used in list of table parameters is not recognized. - -E: Pair table parameters did not set N - -List of pair table parameters must include N setting. - -E: Pair table cutoffs must all be equal to use with KSpace - -When using pair style table with a long-range KSpace solver, the -cutoffs for all atom type pairs must all be the same, since the -long-range solver starts at that cutoff. - -*/ diff --git a/src/DPD-REACT/pair_multi_lucy_rx.cpp b/src/DPD-REACT/pair_multi_lucy_rx.cpp index 8b348810fd..bd508707dd 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.cpp +++ b/src/DPD-REACT/pair_multi_lucy_rx.cpp @@ -763,7 +763,7 @@ void PairMultiLucyRX::spline(double *x, double *y, int n, { int i,k; double p,qn,sig,un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; else { diff --git a/src/DPD-REACT/pair_multi_lucy_rx.h b/src/DPD-REACT/pair_multi_lucy_rx.h index bfaf09b083..4179d5f4a8 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.h +++ b/src/DPD-REACT/pair_multi_lucy_rx.h @@ -85,76 +85,3 @@ class PairMultiLucyRX : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair multi/lucy/rx command requires atom_style with density (e.g. dpd, meso) - -Self-explanatory - -E: Density < table inner cutoff - -The local density inner is smaller than the inner cutoff - -E: Density > table inner cutoff - -The local density inner is greater than the inner cutoff - -E: Only LOOKUP and LINEAR table styles have been implemented for pair multi/lucy/rx - -Self-explanatory - -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: Unknown table style in pair_style command - -Self-explanatory - -E: Illegal number of pair table entries - -There must be at least 2 table entries. - -E: Illegal pair_coeff command - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: PairMultiLucyRX requires a fix rx command - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Invalid pair table length - -Length of read-in pair table is invalid - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Invalid keyword in pair table parameters - -Keyword used in list of table parameters is not recognized. - -E: Pair table parameters did not set N - -List of pair table parameters must include N setting. - -*/ diff --git a/src/DPD-REACT/pair_table_rx.h b/src/DPD-REACT/pair_table_rx.h index 1071c8822b..6a97125c19 100644 --- a/src/DPD-REACT/pair_table_rx.h +++ b/src/DPD-REACT/pair_table_rx.h @@ -46,93 +46,3 @@ class PairTableRX : public PairTable { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair distance < table inner cutoff - -Two atoms are closer together than the pairwise table allows. - -E: Pair distance > table outer cutoff - -Two atoms are further apart than the pairwise table allows. - -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: Unknown table style in pair_style command - -Style of table is invalid for use with pair_style table command. - -E: PairTableRX requires a fix rx command - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Site1 name not recognized in pair coefficients - -The site1 keyword does not match the species keywords specified throug the fix rx command - -E: Illegal number of pair table entries - -There must be at least 2 table entries. - -E: Invalid pair table length - -Length of read-in pair table is invalid - -E: Invalid pair table cutoff - -Cutoffs in pair_coeff command are not valid with read-in pair table. - -E: Bitmapped table in file does not match requested table - -Setting for bitmapped table in pair_coeff command must match table -in file exactly. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Bitmapped table is incorrect length in table file - -Number of table entries is not a correct power of 2. - -E: Invalid keyword in pair table parameters - -Keyword used in list of table parameters is not recognized. - -E: Pair table parameters did not set N - -List of pair table parameters must include N setting. - -E: Pair table cutoffs must all be equal to use with KSpace - -When using pair style table with a long-range KSpace solver, the -cutoffs for all atom type pairs must all be the same, since the -long-range solver starts at that cutoff. - -E: The number of molecules in CG particle is less than 10*DBL_EPSILON - -Self-explanatory. Check the species concentrations have been properly set -and check the reaction kinetic solver parameters in fix rx to more for -sufficient accuracy. - -*/ diff --git a/src/DPD-REACT/random_external_state.h b/src/DPD-REACT/random_external_state.h index 9a69392a3b..ce06a3c652 100644 --- a/src/DPD-REACT/random_external_state.h +++ b/src/DPD-REACT/random_external_state.h @@ -169,12 +169,3 @@ void es_genNextParallelState(es_RNG_t &serial_state, es_RNG_t &new_state) } // namespace random_external_state #endif - -/* ERROR/WARNING messages: - -E: Invalid seed for Marsaglia random # generator - -The initial seed for this random number generator must be a positive -integer less than or equal to 900 million. - -*/ diff --git a/src/DPD-SMOOTH/fix_meso_move.cpp b/src/DPD-SMOOTH/fix_meso_move.cpp index ba32962b3c..078274416d 100644 --- a/src/DPD-SMOOTH/fix_meso_move.cpp +++ b/src/DPD-SMOOTH/fix_meso_move.cpp @@ -818,7 +818,7 @@ void FixMesoMove::write_restart (FILE *fp) { void FixMesoMove::restart (char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; time_origin = static_cast (list[n++]); } diff --git a/src/DPD-SMOOTH/fix_meso_move.h b/src/DPD-SMOOTH/fix_meso_move.h index 5b05741fe5..2ad945bd5b 100644 --- a/src/DPD-SMOOTH/fix_meso_move.h +++ b/src/DPD-SMOOTH/fix_meso_move.h @@ -71,57 +71,3 @@ class FixMesoMove : public Fix { #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: Fix meso/move cannot set linear z motion for 2d problem - -Self-explanatory. - -E: Fix meso/move cannot set wiggle z motion for 2d problem - -Self-explanatory. - -E: Fix meso/move cannot rotate aroung non z-axis for 2d problem - -Self-explanatory. - -E: Fix meso/move cannot define z or vz variable for 2d problem - -Self-explanatory. - -W: Fix meso/move does not update angular momentum - -Atoms store this quantity, but fix meso/move does not (yet) update it. - -W: Fix meso/move does not update quaternions - -Atoms store this quantity, but fix meso/move does not (yet) update it. - -E: Zero length rotation vector with fix meso/move - -Self-explanatory. - -E: Variable name for fix meso/move does not exist - -Self-explanatory. - -E: Variable for fix meso/move is invalid style - -Only equal-style variables can be used. - -E: Cannot add atoms to fix meso/move variable - -Atoms can not be added afterwards to this fix option. - -E: Resetting timestep size is not allowed with fix meso/move - -This is because fix meso/move is moving atoms based on elapsed time. - -*/ diff --git a/src/DPD-SMOOTH/fix_rigid_meso.h b/src/DPD-SMOOTH/fix_rigid_meso.h index 3f44a81f03..5ef8aa7baf 100644 --- a/src/DPD-SMOOTH/fix_rigid_meso.h +++ b/src/DPD-SMOOTH/fix_rigid_meso.h @@ -45,25 +45,3 @@ class FixRigidMeso : public FixRigid { #endif #endif - -/* ERROR/WARNING messages: - -E: fix rigid/meso command requires atom_style with both energy and density - -You should use atom_style meso with this fix - -E: Can not use thermostat with fix rigid/meso - -Self-explanatory - -E: Can not use barostat with fix rigid/meso - -Self-explanatory - -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. - -*/ diff --git a/src/DRUDE/compute_temp_drude.cpp b/src/DRUDE/compute_temp_drude.cpp index 96344751a7..f5cfe35223 100644 --- a/src/DRUDE/compute_temp_drude.cpp +++ b/src/DRUDE/compute_temp_drude.cpp @@ -67,7 +67,7 @@ void ComputeTempDrude::init() for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; if (ifix == modify->nfix) error->all(FLERR, "compute temp/drude requires fix drude"); - fix_drude = (FixDrude *) modify->fix[ifix]; + fix_drude = dynamic_cast( modify->fix[ifix]); if (!comm->ghost_velocity) error->all(FLERR,"compute temp/drude requires ghost velocities. Use comm_modify vel yes"); diff --git a/src/DRUDE/compute_temp_drude.h b/src/DRUDE/compute_temp_drude.h index 7a16b208cc..16a9a46652 100644 --- a/src/DRUDE/compute_temp_drude.h +++ b/src/DRUDE/compute_temp_drude.h @@ -49,13 +49,3 @@ class ComputeTempDrude : public Compute { #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. - -*/ diff --git a/src/DRUDE/fix_drude.cpp b/src/DRUDE/fix_drude.cpp index 20d6749c8a..70b36a63ee 100644 --- a/src/DRUDE/fix_drude.cpp +++ b/src/DRUDE/fix_drude.cpp @@ -174,7 +174,7 @@ void FixDrude::build_drudeid() { ------------------------------------------------------------------------- */ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { // Search for the drude partner of my cores - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int *type = atom->type; @@ -182,7 +182,7 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { tagint *drudeid = fdptr->drudeid; int *drudetype = fdptr->drudetype; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::set drude_set(first, last); std::set::iterator it; @@ -204,11 +204,11 @@ void FixDrude::ring_search_drudeid(int size, char *cbuf, void *ptr) { ------------------------------------------------------------------------- */ void FixDrude::ring_build_partner(int size, char *cbuf, void *ptr) { // Add partners from incoming list - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; std::set *partner_set = fdptr->partner_set; - tagint *it = (tagint *) cbuf; + auto it = (tagint *) cbuf; tagint *last = it + size; while (it < last) { @@ -375,13 +375,13 @@ void FixDrude::rebuild_special() { ------------------------------------------------------------------------- */ void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr) { // Remove all drude particles from special list - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int **nspecial = atom->nspecial; tagint **special = atom->special; int *type = atom->type; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::set drude_set(first, last); int *drudetype = fdptr->drudetype; @@ -412,7 +412,7 @@ void FixDrude::ring_remove_drude(int size, char *cbuf, void *ptr) { void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr) { // Assume special array size is big enough // Add all particle just after their core in the special list - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int **nspecial = atom->nspecial; @@ -421,7 +421,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr) { tagint *drudeid = fdptr->drudeid; int *drudetype = fdptr->drudetype; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::map core_drude_map; @@ -468,7 +468,7 @@ void FixDrude::ring_add_drude(int size, char *cbuf, void *ptr) { ------------------------------------------------------------------------- */ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr) { // Copy special list of drude from its core (except itself) - FixDrude *fdptr = (FixDrude *) ptr; + auto fdptr = (FixDrude *) ptr; Atom *atom = fdptr->atom; int nlocal = atom->nlocal; int **nspecial = atom->nspecial; @@ -477,7 +477,7 @@ void FixDrude::ring_copy_drude(int size, char *cbuf, void *ptr) { tagint *drudeid = fdptr->drudeid; int *drudetype = fdptr->drudetype; - tagint *first = (tagint *) cbuf; + auto first = (tagint *) cbuf; tagint *last = first + size; std::map core_special_map; diff --git a/src/DRUDE/fix_drude_transform.cpp b/src/DRUDE/fix_drude_transform.cpp index 8f04578627..642f5aabf8 100644 --- a/src/DRUDE/fix_drude_transform.cpp +++ b/src/DRUDE/fix_drude_transform.cpp @@ -43,7 +43,7 @@ FixDrudeTransform::FixDrudeTransform(LAMMPS *lmp, int narg, char **arg) template FixDrudeTransform::~FixDrudeTransform() { - if (mcoeff) delete [] mcoeff; + delete[] mcoeff; } /* ---------------------------------------------------------------------- */ @@ -79,7 +79,7 @@ void FixDrudeTransform::setup(int) { if (!rmass) { if (!mcoeff) mcoeff = new double[ntypes+1]; - double *mcoeff_loc = new double[ntypes+1]; + auto mcoeff_loc = new double[ntypes+1]; for (int itype=0; itype<=ntypes; itype++) mcoeff_loc[itype] = 2.; // an impossible value: mcoeff is at most 1. for (int i=0; i); namespace LAMMPS_NS { -template class FixDrudeTransform: public Fix { +template class FixDrudeTransform : public Fix { public: FixDrudeTransform(class LAMMPS *, int, char **); ~FixDrudeTransform() override; diff --git a/src/DRUDE/fix_langevin_drude.cpp b/src/DRUDE/fix_langevin_drude.cpp index dea2f9ce62..54cc156d67 100644 --- a/src/DRUDE/fix_langevin_drude.cpp +++ b/src/DRUDE/fix_langevin_drude.cpp @@ -148,7 +148,7 @@ void FixLangevinDrude::init() for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; if (ifix == modify->nfix) error->all(FLERR, "fix langevin/drude requires fix drude"); - fix_drude = (FixDrude *) modify->fix[ifix]; + fix_drude = dynamic_cast( modify->fix[ifix]); } /* ---------------------------------------------------------------------- */ diff --git a/src/DRUDE/fix_tgnh_drude.cpp b/src/DRUDE/fix_tgnh_drude.cpp index 700f9669d8..d5de5bd67f 100644 --- a/src/DRUDE/fix_tgnh_drude.cpp +++ b/src/DRUDE/fix_tgnh_drude.cpp @@ -523,7 +523,7 @@ FixTGNHDrude::FixTGNHDrude(LAMMPS *lmp, int narg, char **arg) : for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; if (ifix == modify->nfix) error->all(FLERR, "fix tgnh/drude requires fix drude"); - fix_drude = (FixDrude *) modify->fix[ifix]; + fix_drude = dynamic_cast( modify->fix[ifix]); // make sure ghost atoms have velocity if (!comm->ghost_velocity) @@ -595,7 +595,7 @@ void FixTGNHDrude::init() if (pstat_flag) for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2]) || (p_flag[3] && dimflag[3]) || (p_flag[4] && dimflag[4]) || (p_flag[5] && dimflag[5])) @@ -664,8 +664,8 @@ void FixTGNHDrude::init() else kspace_flag = 0; if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - step_respa = ((Respa *) update->integrate)->step; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; dto = 0.5*step_respa[0]; } @@ -732,7 +732,7 @@ void FixTGNHDrude::setup_mol_mass_dof() { memory->create(v_mol_tmp, n_mol + 1, 3, "fix_tgnh_drude::v_mol_tmp"); memory->create(mass_mol, n_mol + 1, "fix_tgnh_drude::mass_mol"); - double *mass_tmp = new double[n_mol + 1]; + auto mass_tmp = new double[n_mol + 1]; memset(mass_tmp, 0, sizeof(double) * (n_mol + 1)); for (int i = 0; i < atom->nlocal; i++) { id_mol = molecule[i]; @@ -1364,7 +1364,7 @@ int FixTGNHDrude::pack_restart_data(double *list) void FixTGNHDrude::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); diff --git a/src/DRUDE/fix_tgnh_drude.h b/src/DRUDE/fix_tgnh_drude.h index c486c301f7..634a8a2cc1 100644 --- a/src/DRUDE/fix_tgnh_drude.h +++ b/src/DRUDE/fix_tgnh_drude.h @@ -160,136 +160,3 @@ class FixTGNHDrude : public Fix { } // namespace LAMMPS_NS #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: Target temperature for fix nvt/npt/nph cannot be 0.0 - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix nvt/npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix nvt/npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix nvt/npt/nph on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix nvt/npt/nph with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix nvt/npt/nph with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix nvt/npt/nph pressure settings - -Settings for coupled dimensions must be the same. - -E: Using update dipole flag requires atom style sphere - -Self-explanatory. - -E: Using update dipole flag requires atom attribute mu - -Self-explanatory. - -E: Fix nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix npt and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix nvt/npt does not exist - -Self-explanatory. - -E: Pressure ID for fix npt/nph does not exist - -Self-explanatory. - -E: Non-numeric pressure - simulation unstable - -UNDOCUMENTED - -E: Fix npt/nph has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -U: The dlm flag must be used with update dipole - -Self-explanatory. - -*/ diff --git a/src/DRUDE/fix_tgnpt_drude.h b/src/DRUDE/fix_tgnpt_drude.h index c777cc1134..19b44296c0 100644 --- a/src/DRUDE/fix_tgnpt_drude.h +++ b/src/DRUDE/fix_tgnpt_drude.h @@ -33,15 +33,3 @@ class FixTGNPTDrude : public FixTGNHDrude { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt - -Self-explanatory. - -E: Pressure control must be used with fix npt - -Self-explanatory. - -*/ diff --git a/src/DRUDE/fix_tgnvt_drude.h b/src/DRUDE/fix_tgnvt_drude.h index d192b2353c..836b2a3369 100644 --- a/src/DRUDE/fix_tgnvt_drude.h +++ b/src/DRUDE/fix_tgnvt_drude.h @@ -33,15 +33,3 @@ class FixTGNVTDrude : public FixTGNHDrude { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt - -Self-explanatory. - -E: Pressure control can not be used with fix nvt - -Self-explanatory. - -*/ diff --git a/src/DRUDE/pair_coul_tt.cpp b/src/DRUDE/pair_coul_tt.cpp index 1e3892c414..af8ed099c5 100644 --- a/src/DRUDE/pair_coul_tt.cpp +++ b/src/DRUDE/pair_coul_tt.cpp @@ -289,7 +289,7 @@ void PairCoulTT::init_style() for (ifix = 0; ifix < modify->nfix; ifix++) if (utils::strmatch(modify->fix[ifix]->style,"^drude")) break; if (ifix == modify->nfix) error->all(FLERR, "Pair coul/tt requires fix drude"); - fix_drude = (FixDrude *) modify->fix[ifix]; + fix_drude = dynamic_cast( modify->fix[ifix]); neighbor->add_request(this); } diff --git a/src/DRUDE/pair_coul_tt.h b/src/DRUDE/pair_coul_tt.h index bbd2163634..adb86c8129 100644 --- a/src/DRUDE/pair_coul_tt.h +++ b/src/DRUDE/pair_coul_tt.h @@ -55,21 +55,3 @@ class PairCoulTT : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style thole requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/DRUDE/pair_lj_cut_thole_long.cpp b/src/DRUDE/pair_lj_cut_thole_long.cpp index 53e95c087e..33e1e435fa 100644 --- a/src/DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/DRUDE/pair_lj_cut_thole_long.cpp @@ -364,7 +364,7 @@ void PairLJCutTholeLong::init_style() if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; if (ifix == modify->nfix) error->all(FLERR, "Pair style lj/cut/thole/long requires fix drude"); - fix_drude = (FixDrude *) modify->fix[ifix]; + fix_drude = dynamic_cast( modify->fix[ifix]); neighbor->add_request(this); diff --git a/src/DRUDE/pair_lj_cut_thole_long.h b/src/DRUDE/pair_lj_cut_thole_long.h index 3497a78730..3cacb6222d 100644 --- a/src/DRUDE/pair_lj_cut_thole_long.h +++ b/src/DRUDE/pair_lj_cut_thole_long.h @@ -64,30 +64,3 @@ class PairLJCutTholeLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/DRUDE/pair_thole.cpp b/src/DRUDE/pair_thole.cpp index 126e611fcf..a2f0b25e13 100644 --- a/src/DRUDE/pair_thole.cpp +++ b/src/DRUDE/pair_thole.cpp @@ -258,7 +258,7 @@ void PairThole::init_style() for (ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"drude") == 0) break; if (ifix == modify->nfix) error->all(FLERR, "Pair thole requires fix drude"); - fix_drude = (FixDrude *) modify->fix[ifix]; + fix_drude = dynamic_cast( modify->fix[ifix]); neighbor->add_request(this); } diff --git a/src/DRUDE/pair_thole.h b/src/DRUDE/pair_thole.h index 164fb4c398..ef4d493ce1 100644 --- a/src/DRUDE/pair_thole.h +++ b/src/DRUDE/pair_thole.h @@ -54,21 +54,3 @@ class PairThole : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style thole requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/Depend.sh b/src/Depend.sh index d6542e4b0b..65744494f5 100755 --- a/src/Depend.sh +++ b/src/Depend.sh @@ -101,6 +101,10 @@ if (test $1 = "GRANULAR") then depend OPENMP fi +if (test $1 = "INTERLAYER") then + depend OPT +fi + if (test $1 = "KSPACE") then depend CG-SDK depend CORESHELL diff --git a/src/EFF/atom_vec_electron.cpp b/src/EFF/atom_vec_electron.cpp index ca80f186a8..1f9d1f3e65 100644 --- a/src/EFF/atom_vec_electron.cpp +++ b/src/EFF/atom_vec_electron.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -21,20 +20,19 @@ #include "atom.h" #include "citeme.h" -#include - using namespace LAMMPS_NS; static const char cite_user_eff_package[] = - "EFF package:\n\n" - "@Article{Jaramillo-Botero11,\n" - " author = {A. Jaramillo-Botero, J. Su, A. Qi, W. A. Goddard III},\n" - " title = {Large-Scale, Long-Term Nonadiabatic Electron Molecular Dynamics for Describing Material Properties and Phenomena in Extreme Environments},\n" - " journal = {J.~Comp.~Chem.},\n" - " year = 2011,\n" - " volume = 32,\n" - " pages = {497--512}\n" - "}\n\n"; + "EFF package:\n\n" + "@Article{Jaramillo-Botero11,\n" + " author = {A. Jaramillo-Botero, J. Su, A. Qi, W. A. Goddard III},\n" + " title = {Large-Scale, Long-Term Nonadiabatic Electron Molecular Dynamics for Describing " + "Material Properties and Phenomena in Extreme Environments},\n" + " journal = {J.~Comp.~Chem.},\n" + " year = 2011,\n" + " volume = 32,\n" + " pages = {497--512}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -47,26 +45,25 @@ AtomVecElectron::AtomVecElectron(LAMMPS *lmp) : AtomVec(lmp) forceclearflag = 1; atom->electron_flag = 1; - atom->q_flag = atom->spin_flag = atom->eradius_flag = - atom->ervel_flag = atom->erforce_flag = 1; + atom->q_flag = atom->spin_flag = atom->eradius_flag = atom->ervel_flag = atom->erforce_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "q spin eradius ervel erforce"; - fields_copy = (char *) "q spin eradius ervel"; - fields_comm = (char *) "eradius"; - fields_comm_vel = (char *) "eradius"; - fields_reverse = (char *) "erforce"; - fields_border = (char *) "q spin eradius"; - fields_border_vel = (char *) "q spin eradius"; - fields_exchange = (char *) "q spin eradius ervel"; - fields_restart = (char *) "q spin eradius ervel"; - fields_create = (char *) "q spin eradius ervel"; - fields_data_atom = (char *) "id type q spin eradius x"; - fields_data_vel = (char *) "id v ervel"; + fields_grow = {"q", "spin", "eradius", "ervel", "erforce"}; + fields_copy = {"q", "spin", "eradius", "ervel"}; + fields_comm = {"eradius"}; + fields_comm_vel = {"eradius"}; + fields_reverse = {"erforce"}; + fields_border = {"q", "spin", "eradius"}; + fields_border_vel = {"q", "spin", "eradius"}; + fields_exchange = {"q", "spin", "eradius", "ervel"}; + fields_restart = {"q", "spin", "eradius", "ervel"}; + fields_create = {"q", "spin", "eradius", "ervel"}; + fields_data_atom = {"id", "type", "q", "spin", "eradius", "x"}; + fields_data_vel = {"id", "v", "ervel"}; setup_fields(); } @@ -91,7 +88,7 @@ void AtomVecElectron::grow_pointers() void AtomVecElectron::force_clear(int n, size_t nbytes) { - memset(&erforce[n],0,nbytes); + memset(&erforce[n], 0, nbytes); } /* ---------------------------------------------------------------------- @@ -119,12 +116,12 @@ void AtomVecElectron::data_atom_post(int ilocal) return -1 if name is unknown to this atom style ------------------------------------------------------------------------- */ -int AtomVecElectron::property_atom(char *name) +int AtomVecElectron::property_atom(const std::string &name) { - if (strcmp(name,"spin") == 0) return 0; - if (strcmp(name,"eradius") == 0) return 1; - if (strcmp(name,"ervel") == 0) return 2; - if (strcmp(name,"erforce") == 0) return 3; + if (name == "spin") return 0; + if (name == "eradius") return 1; + if (name == "ervel") return 2; + if (name == "erforce") return 3; return -1; } @@ -133,8 +130,7 @@ int AtomVecElectron::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecElectron::pack_property_atom(int index, double *buf, - int nvalues, int groupbit) +void AtomVecElectron::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -142,26 +138,34 @@ void AtomVecElectron::pack_property_atom(int index, double *buf, if (index == 0) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = spin[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = spin[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 1) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = eradius[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = eradius[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 2) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = ervel[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = ervel[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 3) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = erforce[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = erforce[i]; + else + buf[n] = 0.0; n += nvalues; } } diff --git a/src/EFF/atom_vec_electron.h b/src/EFF/atom_vec_electron.h index 6c9b11cccb..21015d56b0 100644 --- a/src/EFF/atom_vec_electron.h +++ b/src/EFF/atom_vec_electron.h @@ -32,7 +32,7 @@ class AtomVecElectron : public AtomVec { void force_clear(int, size_t) override; void create_atom_post(int) override; void data_atom_post(int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; private: diff --git a/src/EFF/compute_temp_deform_eff.cpp b/src/EFF/compute_temp_deform_eff.cpp index 6476c78039..292bf64d7b 100644 --- a/src/EFF/compute_temp_deform_eff.cpp +++ b/src/EFF/compute_temp_deform_eff.cpp @@ -74,7 +74,7 @@ void ComputeTempDeformEff::init() int i; for (i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - if (((FixDeform *) modify->fix[i])->remapflag == Domain::X_REMAP && + if ((dynamic_cast( modify->fix[i]))->remapflag == Domain::X_REMAP && comm->me == 0) error->warning(FLERR,"Using compute temp/deform/eff with inconsistent " "fix deform remap option"); diff --git a/src/EFF/compute_temp_region_eff.cpp b/src/EFF/compute_temp_region_eff.cpp index 3b5147b900..de61abc4b7 100644 --- a/src/EFF/compute_temp_region_eff.cpp +++ b/src/EFF/compute_temp_region_eff.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -16,7 +15,6 @@ Contributing author: Andres Jaramillo-Botero (Caltech) ------------------------------------------------------------------------- */ - #include "compute_temp_region_eff.h" #include "atom.h" @@ -33,16 +31,15 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg) + Compute(lmp, narg, arg), region(nullptr), idregion(nullptr) { if (!atom->electron_flag) - error->all(FLERR,"Compute temp/region/eff requires atom style electron"); + error->all(FLERR, "Compute temp/region/eff requires atom style electron"); - if (narg != 4) error->all(FLERR,"Illegal compute temp/region/eff command"); + if (narg != 4) error->all(FLERR, "Illegal compute temp/region/eff command"); - iregion = domain->find_region(arg[3]); - if (iregion == -1) - error->all(FLERR,"Region ID for compute temp/region/eff does not exist"); + region = domain->get_region_by_id(arg[3]); + if (!region) error->all(FLERR, "Region {} for compute temp/region/eff does not exist", arg[3]); idregion = utils::strdup(arg[3]); scalar_flag = vector_flag = 1; @@ -61,9 +58,9 @@ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) : ComputeTempRegionEff::~ComputeTempRegionEff() { - delete [] idregion; + delete[] idregion; memory->destroy(vbiasall); - delete [] vector; + delete[] vector; } /* ---------------------------------------------------------------------- */ @@ -72,9 +69,8 @@ void ComputeTempRegionEff::init() { // set index and check validity of region - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for compute temp/region/eff does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for compute temp/region/eff does not exist", idregion); } /* ---------------------------------------------------------------------- */ @@ -90,7 +86,7 @@ void ComputeTempRegionEff::setup() void ComputeTempRegionEff::dof_remove_pre() { - domain->regions[iregion]->prematch(); + region->prematch(); } /* ---------------------------------------------------------------------- */ @@ -98,7 +94,7 @@ void ComputeTempRegionEff::dof_remove_pre() int ComputeTempRegionEff::dof_remove(int i) { double *x = atom->x[i]; - if (domain->regions[iregion]->match(x[0],x[1],x[2])) return 0; + if (region->match(x[0], x[1], x[2])) return 0; return 1; } @@ -116,9 +112,8 @@ double ComputeTempRegionEff::compute_scalar() int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; - double mefactor = domain->dimension/4.0; + double mefactor = domain->dimension / 4.0; - Region *region = domain->regions[iregion]; region->prematch(); int count = 0; @@ -127,34 +122,35 @@ double ComputeTempRegionEff::compute_scalar() if (mass) { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { count++; - t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * - mass[type[i]]; - if (abs(spin[i])==1) { - t += mefactor*mass[type[i]]*ervel[i]*ervel[i]; + t += (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]) * mass[type[i]]; + if (abs(spin[i]) == 1) { + t += mefactor * mass[type[i]] * ervel[i] * ervel[i]; ecount++; } } } - double tarray[2],tarray_all[2]; + double tarray[2], tarray_all[2]; // Assume 3/2 k T per nucleus - tarray[0] = count-ecount; + tarray[0] = count - ecount; tarray[1] = t; - MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(tarray, tarray_all, 2, MPI_DOUBLE, MPI_SUM, world); dof = domain->dimension * tarray_all[0] - extra_dof; if (dof < 0.0 && tarray_all[0] > 0.0) - error->all(FLERR,"Temperature compute degrees of freedom < 0"); + error->all(FLERR, "Temperature compute degrees of freedom < 0"); int one = 0; for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { - if (abs(spin[i])==1) one++; + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { + if (abs(spin[i]) == 1) one++; } - if (dof > 0.0) scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); - else scalar = 0.0; + if (dof > 0.0) + scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); + else + scalar = 0.0; return scalar; } @@ -174,33 +170,32 @@ void ComputeTempRegionEff::compute_vector() int *type = atom->type; int *mask = atom->mask; int nlocal = atom->nlocal; - double mefactor = domain->dimension/4.0; + double mefactor = domain->dimension / 4.0; - Region *region = domain->regions[iregion]; region->prematch(); - double massone,t[6]; + double massone, t[6]; for (i = 0; i < 6; i++) t[i] = 0.0; for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { massone = mass[type[i]]; - t[0] += massone * v[i][0]*v[i][0]; - t[1] += massone * v[i][1]*v[i][1]; - t[2] += massone * v[i][2]*v[i][2]; - t[3] += massone * v[i][0]*v[i][1]; - t[4] += massone * v[i][0]*v[i][2]; - t[5] += massone * v[i][1]*v[i][2]; + t[0] += massone * v[i][0] * v[i][0]; + t[1] += massone * v[i][1] * v[i][1]; + t[2] += massone * v[i][2] * v[i][2]; + t[3] += massone * v[i][0] * v[i][1]; + t[4] += massone * v[i][0] * v[i][2]; + t[5] += massone * v[i][1] * v[i][2]; - if (abs(spin[i])==1) { - t[0] += mefactor * massone * ervel[i]*ervel[i]; - t[1] += mefactor * massone * ervel[i]*ervel[i]; - t[2] += mefactor * massone * ervel[i]*ervel[i]; + if (abs(spin[i]) == 1) { + t[0] += mefactor * massone * ervel[i] * ervel[i]; + t[1] += mefactor * massone * ervel[i] * ervel[i]; + t[2] += mefactor * massone * ervel[i] * ervel[i]; } } - MPI_Allreduce(t,vector,6,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(t, vector, 6, MPI_DOUBLE, MPI_SUM, world); for (i = 0; i < 6; i++) vector[i] *= force->mvv2e; } @@ -212,7 +207,7 @@ void ComputeTempRegionEff::compute_vector() void ComputeTempRegionEff::remove_bias(int i, double *v) { double *x = atom->x[i]; - if (domain->regions[iregion]->match(x[0],x[1],x[2])) + if (region->match(x[0], x[1], x[2])) vbias[0] = vbias[1] = vbias[2] = 0.0; else { vbias[0] = v[0]; @@ -236,14 +231,12 @@ void ComputeTempRegionEff::remove_bias_all() if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; - memory->create(vbiasall,maxbias,3,"temp/region:vbiasall"); + memory->create(vbiasall, maxbias, 3, "temp/region:vbiasall"); } - Region *region = domain->regions[iregion]; - for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region->match(x[i][0],x[i][1],x[i][2])) + if (region->match(x[i][0], x[i][1], x[i][2])) vbiasall[i][0] = vbiasall[i][1] = vbiasall[i][2] = 0.0; else { vbiasall[i][0] = v[i][0]; @@ -289,6 +282,6 @@ void ComputeTempRegionEff::restore_bias_all() double ComputeTempRegionEff::memory_usage() { - double bytes = (double)maxbias * sizeof(double); + double bytes = (double) maxbias * sizeof(double); return bytes; } diff --git a/src/EFF/compute_temp_region_eff.h b/src/EFF/compute_temp_region_eff.h index bc8f930374..a3dd7e5dd4 100644 --- a/src/EFF/compute_temp_region_eff.h +++ b/src/EFF/compute_temp_region_eff.h @@ -42,7 +42,7 @@ class ComputeTempRegionEff : public Compute { double memory_usage() override; protected: - int iregion; + class Region *region; char *idregion; }; diff --git a/src/EFF/fix_nve_eff.cpp b/src/EFF/fix_nve_eff.cpp index ed640990ca..6639197285 100644 --- a/src/EFF/fix_nve_eff.cpp +++ b/src/EFF/fix_nve_eff.cpp @@ -59,7 +59,7 @@ void FixNVEEff::init() dtf = 0.5 * update->dt * force->ftm2v; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } /* ---------------------------------------------------------------------- diff --git a/src/EFF/fix_nvt_sllod_eff.cpp b/src/EFF/fix_nvt_sllod_eff.cpp index 8e3f7cd72d..c4cc2de87f 100644 --- a/src/EFF/fix_nvt_sllod_eff.cpp +++ b/src/EFF/fix_nvt_sllod_eff.cpp @@ -70,7 +70,7 @@ void FixNVTSllodEff::init() int i; for (i = 0; i < modify->nfix; i++) if (strncmp(modify->fix[i]->style,"deform",6) == 0) { - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using fix nvt/sllod/eff with inconsistent fix deform " "remap option"); break; diff --git a/src/ELECTRODE/electrode_matrix.h b/src/ELECTRODE/electrode_matrix.h index 249420815b..b28b6d5fcf 100644 --- a/src/ELECTRODE/electrode_matrix.h +++ b/src/ELECTRODE/electrode_matrix.h @@ -53,42 +53,3 @@ class ElectrodeMatrix : protected Pointers { } // namespace LAMMPS_NS -/* 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 group/group group ID does not exist - -Self-explanatory. - -E: Compute group/group molecule requires molecule IDs - -UNDOCUMENTED - -E: No pair style defined for compute group/group - -Cannot calculate group interactions without a pair style defined. - -E: Pair style does not support compute group/group - -The pair_style does not have a single() function, so it cannot be -invoked by the compute group/group command. - -E: No KSpace style defined for compute group/group - -Self-explanatory. - -E: KSpace style does not support compute group/group - -Self-explanatory. - -W: Both groups in compute group/group have a net charge; the KSpace boundary -correction to energy will be non-zero - -Self-explanatory. - -*/ diff --git a/src/ELECTRODE/ewald_electrode.h b/src/ELECTRODE/ewald_electrode.h index 42a37be1e6..ae5cca4040 100644 --- a/src/ELECTRODE/ewald_electrode.h +++ b/src/ELECTRODE/ewald_electrode.h @@ -59,55 +59,3 @@ class EwaldElectrode : public Ewald, public ElectrodeKSpace { #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: Cannot use Ewald with 2d simulation - - The kspace style ewald cannot be used in 2d simulations. You can use - 2d Ewald in a 3d simulation; see the kspace_modify command. - - E: KSpace style requires atom attribute q - - The atom style defined does not have these attributes. - - E: Cannot use non-periodic boundaries with Ewald - - For kspace style ewald, all 3 dimensions must have periodic boundaries - unless you use the kspace_modify command to define a 2d slab with a - non-periodic z dimension. - - E: Incorrect boundaries with slab Ewald - - Must have periodic x,y dimensions and non-periodic z dimension to use - 2d slab option with Ewald. - - E: Cannot (yet) use Ewald with triclinic box and slab correction - - This feature is not yet supported. - - E: KSpace style is incompatible with Pair style - - Setting a kspace style requires that a pair style with matching - long-range Coulombic or dispersion components be used. - - E: KSpace accuracy must be > 0 - - The kspace accuracy designated in the input must be greater than zero. - - E: Must use 'kspace_modify gewald' for uncharged system - - UNDOCUMENTED - - E: Cannot (yet) use K-space slab correction with compute group/group for - triclinic systems - - This option is not yet supported. - - */ diff --git a/src/ELECTRODE/pppm_electrode.h b/src/ELECTRODE/pppm_electrode.h index f774ed7cb7..8aba681c18 100644 --- a/src/ELECTRODE/pppm_electrode.h +++ b/src/ELECTRODE/pppm_electrode.h @@ -125,148 +125,3 @@ class PPPMElectrode : public PPPM, public ElectrodeKSpace { #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: Must redefine kspace_style after changing to triclinic box - - UNDOCUMENTED - - E: Cannot (yet) use PPPM with triclinic box and kspace_modify diff ad - - This feature is not yet supported. - - E: Cannot (yet) use PPPM with triclinic box and slab correction - - This feature is not yet supported. - - E: Cannot use PPPM with 2d simulation - - The kspace style pppm cannot be used in 2d simulations. You can use - 2d PPPM in a 3d simulation; see the kspace_modify command. - - E: PPPM can only currently be used with comm_style brick - - This is a current restriction in LAMMPS. - - E: KSpace style requires atom attribute q - - The atom style defined does not have these attributes. - - E: Cannot use non-periodic boundaries with PPPM - - For kspace style pppm, all 3 dimensions must have periodic boundaries - unless you use the kspace_modify command to define a 2d slab with a - non-periodic z dimension. - - E: Incorrect boundaries with slab PPPM - - Must have periodic x,y dimensions and non-periodic z dimension to use - 2d slab option with PPPM. - - E: PPPM order cannot be < 2 or > than %d - - This is a limitation of the PPPM implementation in LAMMPS. - - E: KSpace style is incompatible with Pair style - - Setting a kspace style requires that a pair style with matching - long-range Coulombic or dispersion components be used. - - E: Pair style is incompatible with TIP4P KSpace style - - The pair style does not have the requires TIP4P settings. - - E: Bond and angle potentials must be defined for TIP4P - - Cannot use TIP4P pair potential unless bond and angle potentials - are defined. - - E: Bad TIP4P angle type for PPPM/TIP4P - - Specified angle type is not valid. - - E: Bad TIP4P bond type for PPPM/TIP4P - - Specified bond type is not valid. - - W: Reducing PPPM order b/c stencil extends beyond nearest neighbor processor - - This may lead to a larger grid than desired. See the kspace_modify overlap - command to prevent changing of the PPPM order. - - E: PPPM order < minimum allowed order - - The default minimum order is 2. This can be reset by the - kspace_modify minorder command. - - E: PPPM grid stencil extends beyond nearest neighbor processor - - This is not allowed if the kspace_modify overlap setting is no. - - E: KSpace accuracy must be > 0 - - The kspace accuracy designated in the input must be greater than zero. - - E: Must use kspace_modify gewald for uncharged system - - UNDOCUMENTED - - E: Could not compute grid size - - The code is unable to compute a grid size consistent with the desired - accuracy. This error should not occur for typical problems. Please - send an email to the developers. - - E: PPPM grid is too large - - The global PPPM grid is larger than OFFSET in one or more dimensions. - OFFSET is currently set to 4096. You likely need to decrease the - requested accuracy. - - E: Could not compute g_ewald - - The Newton-Raphson solver failed to converge to a good value for - g_ewald. This error should not occur for typical problems. Please - send an email to the developers. - - E: Non-numeric box dimensions - simulation unstable - - The box size has apparently blown up. - - E: Out of range atoms - cannot compute PPPM - - One or more atoms are attempting to map their charge to a PPPM grid - point that is not owned by a processor. This is likely for one of two - reasons, both of them bad. First, it may mean that an atom near the - boundary of a processor's sub-domain has moved more than 1/2 the - "neighbor skin distance"_neighbor.html without neighbor lists being - rebuilt and atoms being migrated to new processors. This also means - you may be missing pairwise interactions that need to be computed. - The solution is to change the re-neighboring criteria via the - "neigh_modify"_neigh_modify command. The safest settings are "delay 0 - every 1 check yes". Second, it may mean that an atom has moved far - outside a processor's sub-domain or even the entire simulation box. - This indicates bad physics, e.g. due to highly overlapping atoms, too - large a timestep, etc. - - E: Cannot (yet) use K-space slab correction with compute group/group for - triclinic systems - - This option is not yet supported. - - E: Cannot (yet) use kspace_modify diff ad with compute group/group - - This option is not yet supported. - - U: Cannot (yet) use PPPM with triclinic box and TIP4P - - This feature is not yet supported. - - */ diff --git a/src/EXTRA-COMPUTE/compute_adf.h b/src/EXTRA-COMPUTE/compute_adf.h index 817fbfa01e..e1d5fda90f 100644 --- a/src/EXTRA-COMPUTE/compute_adf.h +++ b/src/EXTRA-COMPUTE/compute_adf.h @@ -68,21 +68,3 @@ class ComputeADF : public Compute { #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 adf requires a pair style be defined or outer cutoff specified - -Self-explanatory. - -E: Compute adf cutoff exceeds ghost atom range - use comm_modify cutoff command - -Self-explanatary. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp index d65b5b1d38..07803aca20 100644 --- a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp @@ -30,14 +30,12 @@ using namespace LAMMPS_NS; using namespace MathConst; - /* ---------------------------------------------------------------------- */ ComputeAveSphereAtom::ComputeAveSphereAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - result(nullptr) + Compute(lmp, narg, arg), result(nullptr) { - if (narg < 3 || narg > 5) error->all(FLERR,"Illegal compute ave/sphere/atom command"); + if (narg < 3 || narg > 5) error->all(FLERR, "Illegal compute ave/sphere/atom command"); // process optional args @@ -45,12 +43,13 @@ ComputeAveSphereAtom::ComputeAveSphereAtom(LAMMPS *lmp, int narg, char **arg) : int iarg = 3; while (iarg < narg) { - if (strcmp(arg[iarg],"cutoff") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute ave/sphere/atom command"); - cutoff = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (cutoff <= 0.0) error->all(FLERR,"Illegal compute ave/sphere/atom command"); + if (strcmp(arg[iarg], "cutoff") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute ave/sphere/atom command"); + cutoff = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + if (cutoff <= 0.0) error->all(FLERR, "Illegal compute ave/sphere/atom command"); iarg += 2; - } else error->all(FLERR,"Illegal compute ave/sphere/atom command"); + } else + error->all(FLERR, "Illegal compute ave/sphere/atom command"); } peratom_flag = 1; @@ -74,32 +73,32 @@ ComputeAveSphereAtom::~ComputeAveSphereAtom() void ComputeAveSphereAtom::init() { if (!force->pair && cutoff == 0.0) - error->all(FLERR,"Compute ave/sphere/atom requires a cutoff be specified " + error->all(FLERR, + "Compute ave/sphere/atom requires a cutoff be specified " "or a pair style be defined"); double skin = neighbor->skin; if (cutoff != 0.0) { - double cutghost; // as computed by Neighbor and Comm + double cutghost; // as computed by Neighbor and Comm if (force->pair) - cutghost = MAX(force->pair->cutforce+skin,comm->cutghostuser); + cutghost = MAX(force->pair->cutforce + skin, comm->cutghostuser); else cutghost = comm->cutghostuser; if (cutoff > cutghost) - error->all(FLERR,"Compute ave/sphere/atom cutoff exceeds ghost atom range - " + error->all(FLERR, + "Compute ave/sphere/atom cutoff exceeds ghost atom range - " "use comm_modify cutoff command"); } int cutflag = 1; if (force->pair) { - if (cutoff == 0.0) { - cutoff = force->pair->cutforce; - } - if (cutoff <= force->pair->cutforce+skin) cutflag = 0; + if (cutoff == 0.0) { cutoff = force->pair->cutforce; } + if (cutoff <= force->pair->cutforce + skin) cutflag = 0; } - cutsq = cutoff*cutoff; - sphere_vol = 4.0/3.0*MY_PI*cutsq*cutoff; + cutsq = cutoff * cutoff; + sphere_vol = 4.0 / 3.0 * MY_PI * cutsq * cutoff; // need an occasional full neighbor list @@ -118,11 +117,11 @@ void ComputeAveSphereAtom::init_list(int /*id*/, NeighList *ptr) void ComputeAveSphereAtom::compute_peratom() { - int i,j,ii,jj,inum,jnum; - double xtmp,ytmp,ztmp,delx,dely,delz,rsq; - int *ilist,*jlist,*numneigh,**firstneigh; + int i, j, ii, jj, inum, jnum; + double xtmp, ytmp, ztmp, delx, dely, delz, rsq; + int *ilist, *jlist, *numneigh, **firstneigh; int count; - double vsum[3],vavg[3],vnet[3]; + double vsum[3], vavg[3], vnet[3]; invoked_peratom = update->ntimestep; @@ -131,7 +130,7 @@ void ComputeAveSphereAtom::compute_peratom() if (atom->nmax > nmax) { memory->destroy(result); nmax = atom->nmax; - memory->create(result,nmax,2,"ave/sphere/atom:result"); + memory->create(result, nmax, 2, "ave/sphere/atom:result"); array_atom = result; } @@ -179,7 +178,7 @@ void ComputeAveSphereAtom::compute_peratom() delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; if (rsq < cutsq) { count++; vsum[0] += v[j][0]; @@ -188,9 +187,9 @@ void ComputeAveSphereAtom::compute_peratom() } } - vavg[0] = vsum[0]/count; - vavg[1] = vsum[1]/count; - vavg[2] = vsum[2]/count; + vavg[0] = vsum[0] / count; + vavg[1] = vsum[1] / count; + vavg[2] = vsum[2] / count; // i atom contribution @@ -198,7 +197,7 @@ void ComputeAveSphereAtom::compute_peratom() vnet[0] = v[i][0] - vavg[0]; vnet[1] = v[i][1] - vavg[1]; vnet[2] = v[i][2] - vavg[2]; - double ke_sum = vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2]; + double ke_sum = vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -207,17 +206,17 @@ void ComputeAveSphereAtom::compute_peratom() delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; + rsq = delx * delx + dely * dely + delz * delz; if (rsq < cutsq) { count++; vnet[0] = v[j][0] - vavg[0]; vnet[1] = v[j][1] - vavg[1]; vnet[2] = v[j][2] - vavg[2]; - ke_sum += vnet[0]*vnet[0] + vnet[1]*vnet[1] + vnet[2]*vnet[2]; + ke_sum += vnet[0] * vnet[0] + vnet[1] * vnet[1] + vnet[2] * vnet[2]; } } - double density = count/sphere_vol; - double temp = ke_sum/3.0/count; + double density = count / sphere_vol; + double temp = ke_sum / 3.0 / count; result[i][0] = density; result[i][1] = temp; } @@ -226,12 +225,12 @@ void ComputeAveSphereAtom::compute_peratom() /* ---------------------------------------------------------------------- */ -int ComputeAveSphereAtom::pack_forward_comm(int n, int *list, double *buf, - int /*pbc_flag*/, int * /*pbc*/) +int ComputeAveSphereAtom::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, + int * /*pbc*/) { double **v = atom->v; - int i,m=0; + int i, m = 0; for (i = 0; i < n; ++i) { buf[m++] = v[list[i]][0]; buf[m++] = v[list[i]][1]; @@ -247,7 +246,7 @@ void ComputeAveSphereAtom::unpack_forward_comm(int n, int first, double *buf) { double **v = atom->v; - int i,last,m=0; + int i, last, m = 0; last = first + n; for (i = first; i < last; ++i) { v[i][0] = buf[m++]; @@ -262,6 +261,6 @@ void ComputeAveSphereAtom::unpack_forward_comm(int n, int first, double *buf) double ComputeAveSphereAtom::memory_usage() { - double bytes = (double)2*nmax * sizeof(double); + double bytes = (double) 2 * nmax * sizeof(double); return bytes; } diff --git a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h index 8e8ab0282d..ffed09bae5 100644 --- a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.h @@ -12,9 +12,9 @@ ------------------------------------------------------------------------- */ #ifdef COMPUTE_CLASS - -ComputeStyle(ave/sphere/atom,ComputeAveSphereAtom) - +// clang-format off +ComputeStyle(ave/sphere/atom,ComputeAveSphereAtom); +// clang-format on #else #ifndef LMP_COMPUTE_AVE_SPHERE_ATOM_H @@ -37,31 +37,13 @@ class ComputeAveSphereAtom : public Compute { protected: int nmax; - double cutoff,cutsq,sphere_vol; + double cutoff, cutsq, sphere_vol; class NeighList *list; double **result; }; -} +} // namespace LAMMPS_NS #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 ave/sphere/atom requires a cutoff be specified or a pair style be defined - -Self-explanatory. - -E: Compute ave/sphere/atom cutoff exceeds ghost atom range - use comm_modify cutoff command - -Self-explanatory. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_basal_atom.cpp b/src/EXTRA-COMPUTE/compute_basal_atom.cpp index aad949530e..a16c4f8330 100644 --- a/src/EXTRA-COMPUTE/compute_basal_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_basal_atom.cpp @@ -200,9 +200,9 @@ void ComputeBasalAtom::compute_peratom() chi[0] = chi[1] = chi[2] = chi[3] = chi[4] = chi[5] = chi[6] = chi[7] = 0; double x_ij, y_ij, z_ij, x_ik, y_ik, z_ik, xmean5, ymean5, zmean5, xmean6, ymean6, zmean6, xmean7, ymean7, zmean7; - double *x3 = new double[n0]; - double *y3 = new double[n0]; - double *z3 = new double[n0]; + auto x3 = new double[n0]; + auto y3 = new double[n0]; + auto z3 = new double[n0]; for (j = 0; j < n0; j++) { x_ij = x[i][0]-x[nearest_n0[j]][0]; y_ij = x[i][1]-x[nearest_n0[j]][1]; diff --git a/src/EXTRA-COMPUTE/compute_born_matrix.cpp b/src/EXTRA-COMPUTE/compute_born_matrix.cpp new file mode 100644 index 0000000000..f62c11d241 --- /dev/null +++ b/src/EXTRA-COMPUTE/compute_born_matrix.cpp @@ -0,0 +1,1188 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 : Germain Clavier (TUe), Aidan Thompson (Sandia) +------------------------------------------------------------------------- */ + +#include "compute_born_matrix.h" + +#include "angle.h" +#include "atom.h" +#include "atom_vec.h" +#include "bond.h" +#include "comm.h" +#include "compute.h" +#include "dihedral.h" +#include "domain.h" +#include "error.h" +#include "force.h" +#include "improper.h" +#include "kspace.h" +#include "memory.h" +#include "modify.h" +#include "molecule.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" +#include "pair.h" +#include "universe.h" +#include "update.h" + +#include +#include + +using namespace LAMMPS_NS; + +#define BIG 1000000000 +#define SMALL 1e-16 + +// this table is used to pick the 3d rij vector indices used to +// compute the 6 indices long Voigt stress vector + +static int constexpr sigma_albe[6][2] = { + {0, 0}, // s11 + {1, 1}, // s22 + {2, 2}, // s33 + {1, 2}, // s44 + {0, 2}, // s55 + {0, 1}, // s66 +}; + +// this table is used to pick the correct indices from the Voigt +// stress vector to compute the Cij matrix (21 terms, see doc) contribution + +static int constexpr C_albe[21][2] = { + {0, 0}, // C11 + {1, 1}, // C22 + {2, 2}, // C33 + {3, 3}, // C44 + {4, 4}, // C55 + {5, 5}, // C66 + {0, 1}, // C12 + {0, 2}, // C13 + {0, 3}, // C14 + {0, 4}, // C15 + {0, 5}, // C16 + {1, 2}, // C23 + {1, 3}, // C24 + {1, 4}, // C25 + {1, 5}, // C26 + {2, 3}, // C34 + {2, 4}, // C35 + {2, 5}, // C36 + {3, 4}, // C45 + {3, 5}, // C46 + {4, 5} // C56 +}; + +// this table is used to pick the 3d rij vector indices used to +// compute the 21 indices long Cij matrix + +static int constexpr albemunu[21][4] = { + {0, 0, 0, 0}, // C11 + {1, 1, 1, 1}, // C22 + {2, 2, 2, 2}, // C33 + {1, 2, 1, 2}, // C44 + {0, 2, 0, 2}, // C55 + {0, 1, 0, 1}, // C66 + {0, 0, 1, 1}, // C12 + {0, 0, 2, 2}, // C13 + {0, 0, 1, 2}, // C14 + {0, 0, 0, 2}, // C15 + {0, 0, 0, 1}, // C16 + {1, 1, 2, 2}, // C23 + {1, 1, 1, 2}, // C24 + {1, 1, 0, 2}, // C25 + {1, 1, 0, 1}, // C26 + {2, 2, 1, 2}, // C34 + {2, 2, 0, 2}, // C35 + {2, 2, 0, 1}, // C36 + {1, 2, 0, 2}, // C45 + {1, 2, 0, 1}, // C46 + {0, 1, 0, 2} // C56 +}; + +/* ---------------------------------------------------------------------- */ + +ComputeBornMatrix::ComputeBornMatrix(LAMMPS *lmp, int narg, char **arg) : + Compute(lmp, narg, arg), id_virial(nullptr), temp_x(nullptr), temp_f(nullptr) +{ + if (narg < 3) error->all(FLERR, "Illegal compute born/matrix command"); + + MPI_Comm_rank(world, &me); + + nvalues = 21; + + numflag = 0; + numdelta = 0.0; + + pairflag = bondflag = angleflag = dihedflag = impflag = 0; + if (narg == 3) { + pairflag = bondflag = angleflag = dihedflag = impflag = 1; + } else { + int iarg = 3; + while (iarg < narg) { + if (strcmp(arg[iarg], "numdiff") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal compute born/matrix command"); + numflag = 1; + numdelta = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + if (numdelta <= 0.0) error->all(FLERR, "Illegal compute born/matrix command"); + id_virial = utils::strdup(arg[iarg + 2]); + int icompute = modify->find_compute(id_virial); + if (icompute < 0) error->all(FLERR, "Could not find compute born/matrix pressure ID"); + compute_virial = modify->compute[icompute]; + if (compute_virial->pressflag == 0) + error->all(FLERR, "Compute born/matrix pressure ID does not compute pressure"); + iarg += 3; + } else if (strcmp(arg[iarg], "pair") == 0) { + pairflag = 1; + } else if (strcmp(arg[iarg], "bond") == 0) { + bondflag = 1; + } else if (strcmp(arg[iarg], "angle") == 0) { + angleflag = 1; + } else if (strcmp(arg[iarg], "dihedral") == 0) { + dihedflag = 1; + } else if (strcmp(arg[iarg], "improper") == 0) { + impflag = 1; + } else { + error->all(FLERR, "Illegal compute born/matrix command"); + } + ++iarg; + } + } + + if (pairflag) { + if (numflag) + error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags"); + if (force->pair) { + if (force->pair->born_matrix_enable == 0) + error->all(FLERR, "Pair style {} does not support compute born/matrix", force->pair_style); + } else { + pairflag = 0; + } + } + + if (bondflag) { + if (numflag) + error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags"); + if (force->bond) { + if (force->bond->born_matrix_enable == 0) + error->all(FLERR, "Bond style {} does not support compute born/matrix", force->bond_style); + } else { + bondflag = 0; + } + } + + if (angleflag) { + if (numflag) + error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags"); + if (force->angle) { + if (force->angle->born_matrix_enable == 0) + error->all(FLERR, "Angle style {} does not support compute born/matrix", + force->angle_style); + } else { + angleflag = 0; + } + } + + if (dihedflag) { + if (numflag) + error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags"); + if (force->dihedral) { + if (force->dihedral->born_matrix_enable == 0) + error->all(FLERR, "Dihedral style {} does not support compute born/matrix", + force->dihedral_style); + } else { + dihedflag = 0; + } + } + + if (impflag) { + if (numflag) + error->all(FLERR, "Illegal compute born/matrix command: cannot mix numflag and other flags"); + if (force->improper) { + if (force->improper->born_matrix_enable == 0) + error->all(FLERR, "Improper style {} does not support compute born/matrix", + force->improper_style); + } else { + impflag = 0; + } + } + + if (force->kspace) { + if (!numflag && (comm->me == 0)) + error->all(FLERR, "KSpace contribution not supported by compute born/matrix"); + } + + // Initialize some variables + + values_local = values_global = vector = nullptr; + + // this fix produces a global vector + + memory->create(vector, nvalues, "born_matrix:vector"); + memory->create(values_global, nvalues, "born_matrix:values_global"); + size_vector = nvalues; + + vector_flag = 1; + extvector = 0; + maxatom = 0; + + if (!numflag) { + memory->create(values_local, nvalues, "born_matrix:values_local"); + } else { + + reallocate(); + + // set fixed-point to default = center of cell + + fixedpoint[0] = 0.5 * (domain->boxlo[0] + domain->boxhi[0]); + fixedpoint[1] = 0.5 * (domain->boxlo[1] + domain->boxhi[1]); + fixedpoint[2] = 0.5 * (domain->boxlo[2] + domain->boxhi[2]); + + // define the cartesian indices for each strain (Voigt order) + + dirlist[0][0] = 0; + dirlist[0][1] = 0; + dirlist[1][0] = 1; + dirlist[1][1] = 1; + dirlist[2][0] = 2; + dirlist[2][1] = 2; + + dirlist[3][0] = 1; + dirlist[3][1] = 2; + dirlist[4][0] = 0; + dirlist[4][1] = 2; + dirlist[5][0] = 0; + dirlist[5][1] = 1; + } +} + +/* ---------------------------------------------------------------------- */ + +ComputeBornMatrix::~ComputeBornMatrix() +{ + memory->destroy(values_global); + memory->destroy(vector); + if (!numflag) { + memory->destroy(values_local); + } else { + memory->destroy(temp_x); + memory->destroy(temp_f); + delete[] id_virial; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeBornMatrix::init() +{ + dt = update->dt; + + if (!numflag) { + + // need an occasional half neighbor list + + neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); + + } else { + + // check for virial compute + + int icompute = modify->find_compute(id_virial); + if (icompute < 0) error->all(FLERR, "Virial compute ID for compute born/matrix does not exist"); + compute_virial = modify->compute[icompute]; + + // set up reverse index lookup + // This table is used for consistency between numdiff and analytical + // ordering of the terms. + + for (int m = 0; m < nvalues; m++) { + int a = C_albe[m][0]; + int b = C_albe[m][1]; + revalbe[a][b] = m; + revalbe[b][a] = m; + } + + // reorder LAMMPS virial vector to Voigt order + + virialVtoV[0] = 0; + virialVtoV[1] = 1; + virialVtoV[2] = 2; + virialVtoV[3] = 5; + virialVtoV[4] = 4; + virialVtoV[5] = 3; + } +} + +/* ---------------------------------------------------------------------- */ + +void ComputeBornMatrix::init_list(int /* id */, NeighList *ptr) +{ + list = ptr; +} + +/* ---------------------------------------------------------------------- + compute output vector +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::compute_vector() +{ + invoked_vector = update->ntimestep; + + if (!numflag) { + + // zero out arrays for one sample + + for (int m = 0; m < nvalues; m++) values_local[m] = 0.0; + + // compute Born contribution + + if (pairflag) compute_pairs(); + if (bondflag) compute_bonds(); + if (angleflag) compute_angles(); + if (dihedflag) compute_dihedrals(); + + // sum Born contributions over all procs + + MPI_Allreduce(values_local, values_global, nvalues, MPI_DOUBLE, MPI_SUM, world); + + } else { + + // calculate Born matrix using stress finite differences + + compute_numdiff(); + + // convert from pressure to energy units + + double inv_nktv2p = 1.0 / force->nktv2p; + double volume = domain->xprd * domain->yprd * domain->zprd; + for (int m = 0; m < nvalues; m++) { values_global[m] *= inv_nktv2p * volume; } + } + + for (int m = 0; m < nvalues; m++) vector[m] = values_global[m]; +} + +/* ---------------------------------------------------------------------- + compute Born contribution of local proc +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::compute_pairs() + +{ + int i, j, ii, jj, inum, jnum, itype, jtype; + double rsq, factor_coul, factor_lj; + double dupair, du2pair, rinv; + int *ilist, *jlist, *numneigh, **firstneigh; + + int *type = atom->type; + int *mask = atom->mask; + double *special_coul = force->special_coul; + double *special_lj = force->special_lj; + + // invoke half neighbor list (will copy or build if necessary) + neighbor->build_one(list); + + inum = list->inum; + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + Pair *pair = force->pair; + double **cutsq = force->pair->cutsq; + + // declares born values + + int a, b, c, d; + double xi1, xi2, xi3; + double xj1, xj2, xj3; + double rij[3]; + double pair_pref; + double r2inv; + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + if (!(mask[i] & groupbit)) continue; + + xi1 = atom->x[i][0]; + xi2 = atom->x[i][1]; + xi3 = atom->x[i][2]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + + if (!(mask[j] & groupbit)) continue; + + xj1 = atom->x[j][0]; + xj2 = atom->x[j][1]; + xj3 = atom->x[j][2]; + rij[0] = xj1 - xi1; + rij[1] = xj2 - xi2; + rij[2] = xj3 - xi3; + rsq = rij[0] * rij[0] + rij[1] * rij[1] + rij[2] * rij[2]; + r2inv = 1.0 / rsq; + rinv = sqrt(r2inv); + jtype = type[j]; + + if (rsq >= cutsq[itype][jtype]) continue; + + // Add contribution to Born tensor + + pair_pref = dupair = du2pair = 0.0; + pair->born_matrix(i, j, itype, jtype, rsq, factor_coul, factor_lj, dupair, du2pair); + pair_pref = 0.5 * du2pair - dupair * rinv; + + // See albemunu in compute_born_matrix.h for indices order. + + a = b = c = d = 0; + for (int m = 0; m < nvalues; m++) { + a = albemunu[m][0]; + b = albemunu[m][1]; + c = albemunu[m][2]; + d = albemunu[m][3]; + values_local[m] += pair_pref * rij[a] * rij[b] * rij[c] * rij[d] * r2inv; + } + } + } +} + +/* ---------------------------------------------------------------------- + compute Born matrix using virial stress finite differences +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::compute_numdiff() +{ + int vec_index; + + // grow arrays if necessary + + int nall = atom->nlocal + atom->nghost; + if (nall > maxatom) reallocate(); + + // store copy of current forces for owned and ghost atoms + + double **x = atom->x; + double **f = atom->f; + + for (int i = 0; i < nall; i++) + for (int k = 0; k < 3; k++) { + temp_x[i][k] = x[i][k]; + temp_f[i][k] = f[i][k]; + } + + // loop over 6 strain directions + // compute stress finite difference in each direction + + for (int idir = 0; idir < NDIR_VIRIAL; idir++) { + + // forward + + displace_atoms(nall, idir, 1.0); + force_clear(nall); + update_virial(); + for (int jdir = 0; jdir < NDIR_VIRIAL; jdir++) { + vec_index = revalbe[idir][jdir]; + values_global[vec_index] = compute_virial->vector[virialVtoV[jdir]]; + } + restore_atoms(nall, idir); + + // backward + + displace_atoms(nall, idir, -1.0); + force_clear(nall); + update_virial(); + for (int jdir = 0; jdir < NDIR_VIRIAL; jdir++) { + vec_index = revalbe[idir][jdir]; + values_global[vec_index] -= compute_virial->vector[virialVtoV[jdir]]; + } + restore_atoms(nall, idir); + } + + // apply derivative factor + + double denominator = -0.5 / numdelta; + for (int m = 0; m < nvalues; m++) values_global[m] *= denominator; + + // recompute virial so all virial and energy contributions are as before + // also needed for virial stress addon contributions to Born matrix + + update_virial(); + + // add on virial terms + + virial_addon(); + + // restore original forces for owned and ghost atoms + + for (int i = 0; i < nall; i++) + for (int k = 0; k < 3; k++) f[i][k] = temp_f[i][k]; +} + +/* ---------------------------------------------------------------------- + displace position of all owned and ghost atoms +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::displace_atoms(int nall, int idir, double magnitude) +{ + double **x = atom->x; + + // NOTE: virial_addon() expressions predicated on + // shear strain fields (l != k) being symmetric here + int k = dirlist[idir][0]; + int l = dirlist[idir][1]; + + // axial strain + + if (l == k) + for (int i = 0; i < nall; i++) + x[i][k] = temp_x[i][k] + numdelta * magnitude * (temp_x[i][l] - fixedpoint[l]); + + // symmetric shear strain + + else + for (int i = 0; i < nall; i++) { + x[i][k] = temp_x[i][k] + 0.5 * numdelta * magnitude * (temp_x[i][l] - fixedpoint[l]); + x[i][l] = temp_x[i][l] + 0.5 * numdelta * magnitude * (temp_x[i][k] - fixedpoint[k]); + } +} + +/* ---------------------------------------------------------------------- + restore position of all owned and ghost atoms +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::restore_atoms(int nall, int idir) +{ + + // reset only idir coord + + int k = dirlist[idir][0]; + int l = dirlist[idir][1]; + double **x = atom->x; + if (l == k) + for (int i = 0; i < nall; i++) x[i][k] = temp_x[i][k]; + else + for (int i = 0; i < nall; i++) { + x[i][l] = temp_x[i][l]; + x[i][k] = temp_x[i][k]; + } +} + +/* ---------------------------------------------------------------------- + evaluate potential forces and virial + same logic as in Verlet +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::update_virial() +{ + int eflag = 0; + + // this may not be completely general + // but it works for lj/cut and sw pair styles + // and compute stress/atom output is unaffected + + int vflag = VIRIAL_PAIR; + + if (force->pair) force->pair->compute(eflag, vflag); + + if (atom->molecular != Atom::ATOMIC) { + if (force->bond) force->bond->compute(eflag, vflag); + if (force->angle) force->angle->compute(eflag, vflag); + if (force->dihedral) force->dihedral->compute(eflag, vflag); + if (force->improper) force->improper->compute(eflag, vflag); + } + + if (force->kspace) force->kspace->compute(eflag, vflag); + + compute_virial->compute_vector(); +} + +/* ---------------------------------------------------------------------- + calculate virial stress addon terms to the Born matrix + this is based on original code of Dr. Yubao Zhen + described here: Comp. Phys. Comm. 183 (2012) 261-265 + as well as Yoshimoto et al., PRB, 71 (2005) 184108, Eq 15.and eq A3. +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::virial_addon() +{ + double *sigv = compute_virial->vector; + + // This way of doing is not very elegant but is correct. + // The complete Cijkl terms are the sum of symmetric terms + // computed in compute_numdiff and virial stress terms. + // The viral terms are not symmetric in the tensor computation. + // For example: + // C2323 = s33+D2323; C3232 = s22+D3232 etc... + // However there are two symmetry breaking when reducing + // the 4-rank tensor to a 2-rank tensor + // Cijkl = (Bijkl+Bjikl+Bijlk+Bjilk)/4. = (Bijkl+Bjilk)/2. + // and when computing only the 21 independant term. + + // these expressions have been verified + // correct to about 1e-7 compared + // to the analytic expressions for lj/cut, + // predicated on shear strain fields being + // symmetric in displace_atoms() + + values_global[0] += 2.0 * sigv[0]; + values_global[1] += 2.0 * sigv[1]; + values_global[2] += 2.0 * sigv[2]; + + values_global[3] += 0.5 * (sigv[1] + sigv[2]); + values_global[4] += 0.5 * (sigv[0] + sigv[2]); + values_global[5] += 0.5 * (sigv[0] + sigv[1]); + values_global[6] += 0.0; + values_global[7] += 0.0; + values_global[8] += 0.0; + values_global[9] += sigv[4]; + values_global[10] += sigv[3]; + values_global[11] += 0.0; + values_global[12] += sigv[5]; + values_global[13] += 0.0; + values_global[14] += sigv[3]; + values_global[15] += sigv[5]; + values_global[16] += sigv[4]; + values_global[17] += 0.0; + values_global[18] += 0.5 * sigv[3]; + values_global[19] += 0.5 * sigv[4]; + values_global[20] += 0.5 * sigv[5]; +} + +/* ---------------------------------------------------------------------- + clear forces needed +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::force_clear(int nall) +{ + double **forces = atom->f; + size_t nbytes = 3 * sizeof(double) * nall; + if (nbytes) memset(&forces[0][0], 0, nbytes); +} + +/* ---------------------------------------------------------------------- + reallocated local per-atoms arrays +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::reallocate() +{ + memory->destroy(temp_x); + memory->destroy(temp_f); + maxatom = atom->nmax; + memory->create(temp_x, maxatom, 3, "born/matrix:temp_x"); + memory->create(temp_f, maxatom, 3, "born/matrix:temp_f"); +} + +/* ---------------------------------------------------------------------- + memory usage of local atom-based arrays +------------------------------------------------------------------------- */ + +double ComputeBornMatrix::memory_usage() +{ + double bytes = 0.0; + bytes += (double) 2 * maxatom * 3 * sizeof(double); + return bytes; +} + +/* ---------------------------------------------------------------------- + Count bonds and compute bond info on this proc + only count bond once if newton_bond is off + all atoms in interaction must be in group + all atoms in interaction must be known to proc + if bond is deleted or turned off (type <= 0) + do not count or count contribution +---------------------------------------------------------------------- */ + +void ComputeBornMatrix::compute_bonds() +{ + int i, m, nb, atom1, atom2, imol, iatom, btype; + tagint tagprev; + double dx, dy, dz, rsq; + + double **x = atom->x; + tagint *tag = atom->tag; + int *num_bond = atom->num_bond; + tagint **bond_atom = atom->bond_atom; + int **bond_type = atom->bond_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int newton_bond = force->newton_bond; + int molecular = atom->molecular; + + Bond *bond = force->bond; + + int a, b, c, d; + double rij[3]; + double rinv, r2inv; + double pair_pref, dupair, du2pair; + + // loop over all atoms and their bonds + + for (atom1 = 0; atom1 < nlocal; atom1++) { + if (!(mask[atom1] & groupbit)) continue; + + if (molecular == 1) + nb = num_bond[atom1]; + else { + if (molindex[atom1] < 0) continue; + imol = molindex[atom1]; + iatom = molatom[atom1]; + nb = onemols[imol]->num_bond[iatom]; + } + + for (i = 0; i < nb; i++) { + if (molecular == 1) { + btype = bond_type[atom1][i]; + atom2 = atom->map(bond_atom[atom1][i]); + } else { + tagprev = tag[atom1] - iatom - 1; + btype = onemols[imol]->bond_type[iatom][i]; + atom2 = atom->map(onemols[imol]->bond_atom[iatom][i] + tagprev); + } + + if (atom2 < 0 || !(mask[atom2] & groupbit)) continue; + if (newton_bond == 0 && tag[atom1] > tag[atom2]) continue; + if (btype <= 0) continue; + + dx = x[atom2][0] - x[atom1][0]; + dy = x[atom2][1] - x[atom1][1]; + dz = x[atom2][2] - x[atom1][2]; + domain->minimum_image(dx, dy, dz); + rsq = dx * dx + dy * dy + dz * dz; + rij[0] = dx; + rij[1] = dy; + rij[2] = dz; + r2inv = 1.0 / rsq; + rinv = sqrt(r2inv); + + pair_pref = dupair = du2pair = 0.0; + bond->born_matrix(btype, rsq, atom1, atom2, dupair, du2pair); + pair_pref = du2pair - dupair * rinv; + + a = b = c = d = 0; + for (m = 0; m < 21; m++) { + a = albemunu[m][0]; + b = albemunu[m][1]; + c = albemunu[m][2]; + d = albemunu[m][3]; + values_local[m] += pair_pref * rij[a] * rij[b] * rij[c] * rij[d] * r2inv; + } + } + } +} + +/* ---------------------------------------------------------------------- + count angles and compute angle info on this proc + only count if 2nd atom is the one storing the angle + all atoms in interaction must be in group + all atoms in interaction must be known to proc + if bond is deleted or turned off (type <= 0) + do not count or count contribution +---------------------------------------------------------------------- */ + +void ComputeBornMatrix::compute_angles() +{ + int i, m, na, atom1, atom2, atom3, imol, iatom, atype; + tagint tagprev; + double delx1, dely1, delz1, delx2, dely2, delz2; + double rsq1, rsq2, r1, r2, cost; + double r1r2, r1r2inv; + double rsq1inv, rsq2inv, cinv; + + double **x = atom->x; + tagint *tag = atom->tag; + int *num_angle = atom->num_angle; + tagint **angle_atom1 = atom->angle_atom1; + tagint **angle_atom2 = atom->angle_atom2; + tagint **angle_atom3 = atom->angle_atom3; + int **angle_type = atom->angle_type; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int molecular = atom->molecular; + + // loop over all atoms and their angles + + Angle *angle = force->angle; + + int a, b, c, d, e, f; + double duang, du2ang; + double del1[3], del2[3]; + double dcos[6]; + double d2cos; + double d2lncos; + + // Initializing array for intermediate cos derivatives + // w regard to strain + for (i = 0; i < 6; i++) dcos[i] = 0; + + for (atom2 = 0; atom2 < nlocal; atom2++) { + if (!(mask[atom2] & groupbit)) continue; + + if (molecular == 1) + na = num_angle[atom2]; + else { + if (molindex[atom2] < 0) continue; + imol = molindex[atom2]; + iatom = molatom[atom2]; + na = onemols[imol]->num_angle[iatom]; + } + + for (i = 0; i < na; i++) { + if (molecular == 1) { + if (tag[atom2] != angle_atom2[atom2][i]) continue; + atype = angle_type[atom2][i]; + atom1 = atom->map(angle_atom1[atom2][i]); + atom3 = atom->map(angle_atom3[atom2][i]); + } else { + if (tag[atom2] != onemols[imol]->angle_atom2[atom2][i]) continue; + atype = onemols[imol]->angle_type[atom2][i]; + tagprev = tag[atom2] - iatom - 1; + atom1 = atom->map(onemols[imol]->angle_atom1[atom2][i] + tagprev); + atom3 = atom->map(onemols[imol]->angle_atom3[atom2][i] + tagprev); + } + + if (atom1 < 0 || !(mask[atom1] & groupbit)) continue; + if (atom3 < 0 || !(mask[atom3] & groupbit)) continue; + if (atype <= 0) continue; + + delx1 = x[atom1][0] - x[atom2][0]; + dely1 = x[atom1][1] - x[atom2][1]; + delz1 = x[atom1][2] - x[atom2][2]; + domain->minimum_image(delx1, dely1, delz1); + del1[0] = delx1; + del1[1] = dely1; + del1[2] = delz1; + + rsq1 = delx1 * delx1 + dely1 * dely1 + delz1 * delz1; + rsq1inv = 1.0 / rsq1; + r1 = sqrt(rsq1); + + delx2 = x[atom3][0] - x[atom2][0]; + dely2 = x[atom3][1] - x[atom2][1]; + delz2 = x[atom3][2] - x[atom2][2]; + domain->minimum_image(delx2, dely2, delz2); + del2[0] = delx2; + del2[1] = dely2; + del2[2] = delz2; + + rsq2 = delx2 * delx2 + dely2 * dely2 + delz2 * delz2; + rsq2inv = 1.0 / rsq2; + r2 = sqrt(rsq2); + + r1r2 = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; + r1r2inv = 0; + if (r1r2 == 0.) { + // Worst case scenario. A 0 cosine has an undefined logarithm. + // We then add a small amount of the third bond to the first one + // so they are not orthogonal anymore and recompute. + del1[0] += SMALL * del2[0]; + del1[1] += SMALL * del2[1]; + del1[2] += SMALL * del2[2]; + r1r2 = del1[0] * del2[0] + del1[1] * del2[1] + del1[2] * del2[2]; + r1r2inv = 1 / r1r2; + + // cost = cosine of angle + cost = r1r2 / (r1 * r2); + + } else { + r1r2inv = 1 / r1r2; + cost = r1r2 / (r1 * r2); + } + + if (cost > 1.0) cost = 1.0; + if (cost < -1.0) cost = -1.0; + cinv = 1.0 / cost; + + // The method must return derivative with regards + // to cos(theta)! + // Use the chain rule if needed: + // dU(t)/de = dt/dcos(t)*dU(t)/dt*dcos(t)/de + // with dt/dcos(t) = -1/sin(t) + angle->born_matrix(atype, atom1, atom2, atom3, duang, du2ang); + + // Voigt notation + // 1 = 11, 2 = 22, 3 = 33 + // 4 = 23, 5 = 13, 6 = 12 + a = b = c = d = 0; + // clang-format off + for (m = 0; m<6; m++) { + a = sigma_albe[m][0]; + b = sigma_albe[m][1]; + dcos[m] = cost*((del1[a]*del2[b]+del1[b]*del2[a])*r1r2inv - + del1[a]*del1[b]*rsq1inv - del2[a]*del2[b]*rsq2inv); + } + for (m = 0; m<21; m++) { + a = albemunu[m][0]; + b = albemunu[m][1]; + c = albemunu[m][2]; + d = albemunu[m][3]; + e = C_albe[m][0]; + f = C_albe[m][1]; + d2lncos = 2*(del1[a]*del1[b]*del1[c]*del1[d]*rsq1inv*rsq1inv + + del2[a]*del2[b]*del2[c]*del2[d]*rsq2inv*rsq2inv) - + (del1[a]*del2[b]+del1[b]*del2[a]) * + (del1[c]*del2[d]+del1[d]*del2[c]) * + r1r2inv*r1r2inv; + d2cos = cost*d2lncos + dcos[e]*dcos[f]*cinv; + values_local[m] += duang*d2cos + du2ang*dcos[e]*dcos[f]; + } + // clang-format on + } + } +} + +/* ---------------------------------------------------------------------- + count dihedrals on this proc + only count if 2nd atom is the one storing the dihedral + all atoms in interaction must be in group + all atoms in interaction must be known to proc + if flag is set, compute requested info about dihedral +------------------------------------------------------------------------- */ + +void ComputeBornMatrix::compute_dihedrals() +{ + int i, m, nd, atom1, atom2, atom3, atom4, imol, iatom; + tagint tagprev; + double vb1x, vb1y, vb1z, vb2x, vb2y, vb2z, vb3x, vb3y, vb3z; + double ax, ay, az, bx, by, bz, rasq, rbsq, dotab, ra2inv, rb2inv, dotabinv, rabinv; + double co; + + double **x = atom->x; + tagint *tag = atom->tag; + int *num_dihedral = atom->num_dihedral; + tagint **dihedral_atom1 = atom->dihedral_atom1; + tagint **dihedral_atom2 = atom->dihedral_atom2; + tagint **dihedral_atom3 = atom->dihedral_atom3; + tagint **dihedral_atom4 = atom->dihedral_atom4; + int *mask = atom->mask; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + + int nlocal = atom->nlocal; + int molecular = atom->molecular; + + // loop over all atoms and their dihedrals + + Dihedral *dihedral = force->dihedral; + + int al, be, mu, nu, e, f; + double dudih, du2dih, b1sq, b2sq, b3sq, b1b2, b1b3, b2b3; + double b1[3], b2[3], b3[3]; + + // 1st and 2nd order derivatives of the dot products + double dab[6], daa[6], dbb[6]; + double d2ab, d2aa, d2bb; + + double dcos[6], d2cos; + + for (i = 0; i < 6; i++) dab[i] = daa[i] = dbb[i] = dcos[i] = 0; + + for (atom2 = 0; atom2 < nlocal; atom2++) { + if (!(mask[atom2] & groupbit)) continue; + + // if (molecular == 1) + // nd = num_dihedral[atom2]; + if (molecular == Atom::MOLECULAR) + nd = num_dihedral[atom2]; + else { + if (molindex[atom2] < 0) continue; + imol = molindex[atom2]; + iatom = molatom[atom2]; + nd = onemols[imol]->num_dihedral[iatom]; + } + + for (i = 0; i < nd; i++) { + if (molecular == 1) { + if (tag[atom2] != dihedral_atom2[atom2][i]) continue; + atom1 = atom->map(dihedral_atom1[atom2][i]); + atom3 = atom->map(dihedral_atom3[atom2][i]); + atom4 = atom->map(dihedral_atom4[atom2][i]); + } else { + if (tag[atom2] != onemols[imol]->dihedral_atom2[atom2][i]) continue; + tagprev = tag[atom2] - iatom - 1; + atom1 = atom->map(onemols[imol]->dihedral_atom1[atom2][i] + tagprev); + atom3 = atom->map(onemols[imol]->dihedral_atom3[atom2][i] + tagprev); + atom4 = atom->map(onemols[imol]->dihedral_atom4[atom2][i] + tagprev); + } + + if (atom1 < 0 || !(mask[atom1] & groupbit)) continue; + if (atom3 < 0 || !(mask[atom3] & groupbit)) continue; + if (atom4 < 0 || !(mask[atom4] & groupbit)) continue; + + // phi calculation from dihedral style harmonic + + // The method must return derivative with regards + // to cos(phi)! + // Use the chain rule if needed: + // dU(t)/de = dt/dcos(t)*dU(t)/dt*dcos(t)/de + // with dt/dcos(t) = -1/sin(t) + + dihedral->born_matrix(i, atom1, atom2, atom3, atom4, dudih, du2dih); + + vb1x = x[atom2][0] - x[atom1][0]; + vb1y = x[atom2][1] - x[atom1][1]; + vb1z = x[atom2][2] - x[atom1][2]; + domain->minimum_image(vb1x, vb1y, vb1z); + b1[0] = vb1x; + b1[1] = vb1y; + b1[2] = vb1z; + b1sq = b1[0] * b1[0] + b1[1] * b1[1] + b1[2] * b1[2]; + + vb2x = x[atom3][0] - x[atom2][0]; + vb2y = x[atom3][1] - x[atom2][1]; + vb2z = x[atom3][2] - x[atom2][2]; + domain->minimum_image(vb2x, vb2y, vb2z); + b2[0] = vb2x; + b2[1] = vb2y; + b2[2] = vb2z; + b2sq = b2[0] * b2[0] + b2[1] * b2[1] + b2[2] * b2[2]; + + vb3x = x[atom4][0] - x[atom3][0]; + vb3y = x[atom4][1] - x[atom3][1]; + vb3z = x[atom4][2] - x[atom3][2]; + domain->minimum_image(vb3x, vb3y, vb3z); + b3[0] = vb3x; + b3[1] = vb3y; + b3[2] = vb3z; + b3sq = b3[0] * b3[0] + b3[1] * b3[1] + b3[2] * b3[2]; + + b1b2 = b1[0] * b2[0] + b1[1] * b2[1] + b1[2] * b2[2]; + b1b3 = b1[0] * b3[0] + b1[1] * b3[1] + b1[2] * b3[2]; + b2b3 = b2[0] * b3[0] + b2[1] * b3[1] + b2[2] * b3[2]; + + // a = b1xb2; b = b2xb3 + ax = vb1y * vb2z - vb1z * vb2y; + ay = vb1z * vb2x - vb1x * vb2z; + az = vb1x * vb2y - vb1y * vb2x; + bx = vb2y * vb3z - vb2z * vb3y; + by = vb2z * vb3x - vb2x * vb3z; + bz = vb2x * vb3y - vb2y * vb3x; + + rasq = ax * ax + ay * ay + az * az; + rbsq = bx * bx + by * by + bz * bz; + dotab = ax * bx + ay * by + az * bz; + + ra2inv = rb2inv = rabinv = dotabinv = 0.0; + if (rasq > 0) ra2inv = 1.0 / rasq; + if (rbsq > 0) rb2inv = 1.0 / rbsq; + if (dotab != 0.) dotabinv = 1.0 / dotab; + rabinv = sqrt(ra2inv * rb2inv); + + co = (ax * bx + ay * by + az * bz) * rabinv; + + if (co == 0.0) { + // Worst case scenario. A 0 cosine has an undefined logarithm. + // We then add a small amount of the third bond to the first one + // so they are not orthogonal anymore and recompute. + b1[0] += SMALL * b3[0]; + b1[1] += SMALL * b3[1]; + b1[2] += SMALL * b3[2]; + b1sq = b1[0] * b1[0] + b1[1] * b1[1] + b1[2] * b1[2]; + b3sq = b3[0] * b3[0] + b3[1] * b3[1] + b3[2] * b3[2]; + b1b2 = b1[0] * b2[0] + b1[1] * b2[1] + b1[2] * b2[2]; + b1b3 = b1[0] * b3[0] + b1[1] * b3[1] + b1[2] * b3[2]; + b2b3 = b2[0] * b3[0] + b2[1] * b3[1] + b2[2] * b3[2]; + ax = b1[1] * b2[2] - b1[2] * b2[1]; + ay = b1[2] * b2[0] - b1[0] * b2[2]; + az = b1[0] * b2[1] - b1[1] * b2[0]; + bx = b2[1] * b3[2] - b2[2] * b3[1]; + by = b2[2] * b3[0] - b2[0] * b3[2]; + bz = b2[0] * b3[1] - b2[1] * b3[0]; + rasq = ax * ax + ay * ay + az * az; + rbsq = bx * bx + by * by + bz * bz; + dotab = ax * bx + ay * by + az * bz; + ra2inv = rb2inv = rabinv = dotabinv = 0.0; + if (rasq > 0) ra2inv = 1.0 / rasq; + if (rbsq > 0) rb2inv = 1.0 / rbsq; + if (dotab != 0.) dotabinv = 1.0 / dotab; + rabinv = sqrt(ra2inv * rb2inv); + co = (ax * bx + ay * by + az * bz) * rabinv; + } + if (co > 1.0) co = 1.0; + if (co < -1.0) co = -1.0; + + al = be = mu = nu = e = f = 0; + // clang-format off + for (m = 0; m<6; m++) { + al = sigma_albe[m][0]; + be = sigma_albe[m][1]; + + daa[m] = 2*(b2sq*b1[al]*b1[be] + + b1sq*b2[al]*b2[be] + - b1b2*(b1[al]*b2[be]+b2[al]*b1[be])); + + dbb[m] = 2*(b2sq*b3[al]*b3[be] + + b3sq*b2[al]*b2[be] + - b2b3*(b3[al]*b2[be]+b2[al]*b3[be])); + + dab[m] = b1b2*(b2[al]*b3[be]+b3[al]*b2[be]) + + b2b3*(b1[al]*b2[be]+b2[al]*b1[be]) + - b1b3*(b2[al]*b2[be]+b2[al]*b2[be]) + - b2sq*(b1[al]*b3[be]+b3[al]*b1[be]); + + + dcos[m] = 0.5*co*(2*dotabinv*dab[m] - ra2inv*daa[m] - rb2inv*dbb[m]); + } + + for (m = 0; m<21; m++) { + al = albemunu[m][0]; + be = albemunu[m][1]; + mu = albemunu[m][2]; + nu = albemunu[m][3]; + e = C_albe[m][0]; + f = C_albe[m][1]; + + d2aa = 4*(b1[al]*b1[be]*b2[mu]*b2[nu] + b1[mu]*b1[nu]*b2[al]*b2[be]) + - 2*(b1[al]*b2[be]+b1[be]*b2[al])*(b1[mu]*b2[nu]+b1[nu]*b2[mu]); + + d2bb = 4*(b3[al]*b3[be]*b2[mu]*b2[nu] + b3[mu]*b3[nu]*b2[al]*b2[be]) + - 2*(b3[al]*b2[be]+b3[be]*b2[al])*(b3[mu]*b2[nu]+b3[nu]*b2[mu]); + + d2ab = (b1[al]*b2[be]+b2[al]*b1[be])*(b3[mu]*b2[nu]+b2[mu]*b3[nu]) + + (b3[al]*b2[be]+b2[al]*b3[be])*(b1[mu]*b2[nu]+b2[mu]*b1[nu]) + - (b1[al]*b3[be]+b3[al]*b1[be])*(b2[mu]*b2[nu]+b2[mu]*b2[nu]) + - (b2[al]*b2[be]+b2[al]*b2[be])*(b1[mu]*b3[nu]+b3[mu]*b1[nu]); + + d2cos = -2*dotabinv*dotabinv*dab[e]*dab[f] + 2*dotabinv*d2ab + + ra2inv*ra2inv*daa[e]*daa[f] - ra2inv*d2aa + + rb2inv*rb2inv*dbb[e]*dbb[f] - rb2inv*d2bb + + 2*dcos[e]*dcos[f]/co/co; + d2cos *= 0.5*co; + + values_local[m] += dudih*d2cos; + values_local[m] += du2dih*dcos[e]*dcos[f]; + } + // clang-format on + } + } +} diff --git a/src/EXTRA-COMPUTE/compute_born_matrix.h b/src/EXTRA-COMPUTE/compute_born_matrix.h new file mode 100644 index 0000000000..e77c18fe95 --- /dev/null +++ b/src/EXTRA-COMPUTE/compute_born_matrix.h @@ -0,0 +1,83 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://www.lammps.org/, 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 : Germain Clavier (TUe), Aidan Thompson (Sandia) + --------------------------------------------------------------------------*/ + +#ifdef COMPUTE_CLASS +// clang-format off +ComputeStyle(born/matrix,ComputeBornMatrix); +// clang-format on +#else + +#ifndef LMP_COMPUTE_BORN_MATRIX_H +#define LMP_COMPUTE_BORN_MATRIX_H + +#include "compute.h" + +namespace LAMMPS_NS { + +class ComputeBornMatrix : public Compute { + public: + ComputeBornMatrix(class LAMMPS *, int, char **); + ~ComputeBornMatrix() override; + void init() override; + void init_list(int, class NeighList *) override; + void compute_vector() override; + double memory_usage() override; + + private: + // Born matrix contributions + + void compute_pairs(); // pair and manybody + void compute_bonds(); // bonds + void compute_angles(); // angles + void compute_dihedrals(); // dihedrals + void compute_numdiff(); // stress virial finite differences + void displace_atoms(int, int, double); // displace atoms + void force_clear(int); // zero out force array + void update_virial(); // recalculate the virial + void restore_atoms(int, int); // restore atom positions + void virial_addon(); // restore atom positions + void reallocate(); // grow the atom arrays + + int me; // process rank + int nvalues; // length of elastic tensor + int numflag; // 1 if using finite differences + double numdelta; // size of finite strain + int maxatom; // allocated size of atom arrays + + int pairflag, bondflag, angleflag; + int dihedflag, impflag, kspaceflag; + + double *values_local, *values_global; + double pos, pos1, dt, nktv2p, ftm2v; + class NeighList *list; + + char *id_virial; // name of virial compute + class Compute *compute_virial; // pointer to virial compute + + static constexpr int NDIR_VIRIAL = 6; // dimension of virial and strain vectors + static constexpr int NXYZ_VIRIAL = 3; // number of Cartesian coordinates + int revalbe[NDIR_VIRIAL][NDIR_VIRIAL]; + int virialVtoV[NDIR_VIRIAL]; + double **temp_x; // original coords + double **temp_f; // original forces + double fixedpoint[NXYZ_VIRIAL]; // displacement field origin + int dirlist[NDIR_VIRIAL][2]; // strain cartesian indices +}; +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/EXTRA-COMPUTE/compute_cnp_atom.h b/src/EXTRA-COMPUTE/compute_cnp_atom.h index 050a1a7fb2..0c723faac3 100644 --- a/src/EXTRA-COMPUTE/compute_cnp_atom.h +++ b/src/EXTRA-COMPUTE/compute_cnp_atom.h @@ -53,40 +53,3 @@ class ComputeCNPAtom : public Compute { #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 cnp/atom requires a pair style be defined - -Self-explanatory. - -E: Compute cnp/atom cutoff is longer than pairwise cutoff - -Self-explanatory. - -W: Compute cnp/atom cutoff may be too large to find ghost atom neighbors - -The neighbor cutoff used may not encompass enough ghost atoms -to perform this operation correctly. - -W: More than one compute cnp/atom defined - -It is not efficient to use compute cnp/atom more than once. - -W: Too many neighbors in CNP for %d atoms - -More than the maximum # of neighbors was found multiple times. This -was unexpected. - -W: Too many common neighbors in CNP %d times - -More than the maximum # of neighbors was found multiple times. This -was unexpected. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_entropy_atom.cpp b/src/EXTRA-COMPUTE/compute_entropy_atom.cpp index 20de069d50..b2fcee7ae4 100644 --- a/src/EXTRA-COMPUTE/compute_entropy_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_entropy_atom.cpp @@ -150,8 +150,8 @@ void ComputeEntropyAtom::compute_peratom() int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; int *ilist,*jlist,*numneigh,**firstneigh; - double *rbin = new double[nbin]; - double *rbinsq = new double[nbin]; + auto rbin = new double[nbin]; + auto rbinsq = new double[nbin]; invoked_peratom = update->ntimestep; @@ -199,8 +199,8 @@ void ComputeEntropyAtom::compute_peratom() double **x = atom->x; int *mask = atom->mask; - double *gofr = new double[nbin]; - double *integrand = new double[nbin]; + auto gofr = new double[nbin]; + auto integrand = new double[nbin]; for (ii = 0; ii < inum; ii++) { i = ilist[ii]; diff --git a/src/EXTRA-COMPUTE/compute_entropy_atom.h b/src/EXTRA-COMPUTE/compute_entropy_atom.h index eaca1ee395..992d4dbf76 100644 --- a/src/EXTRA-COMPUTE/compute_entropy_atom.h +++ b/src/EXTRA-COMPUTE/compute_entropy_atom.h @@ -49,22 +49,3 @@ class ComputeEntropyAtom : public Compute { #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 entropy/atom requires a pair style be defined - -This is because the computation of the pair entropy values -uses a pairwise neighbor list. - -W: More than one compute entropy/atom - -It is not efficient to use compute entropy/atom more than once. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_gyration_shape.h b/src/EXTRA-COMPUTE/compute_gyration_shape.h index 60419d2324..45208055ca 100644 --- a/src/EXTRA-COMPUTE/compute_gyration_shape.h +++ b/src/EXTRA-COMPUTE/compute_gyration_shape.h @@ -41,20 +41,3 @@ class ComputeGyrationShape : public Compute { #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 gyration ID does not exist for compute gyration/shape - -Self-explanatory. Provide a valid compute ID - -E: Compute gyration/shape compute ID does not point to a gyration compute - -Self-explanatory. Provide an ID of a compute gyration command. -*/ diff --git a/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h b/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h index f6437873f3..ba38b615c5 100644 --- a/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h +++ b/src/EXTRA-COMPUTE/compute_gyration_shape_chunk.h @@ -51,24 +51,3 @@ class ComputeGyrationShapeChunk : public Compute { #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 gyration/chunk ID does not exist for compute gyration/shape/chunk - -Self-explanatory. Provide a valid compute ID - -E: Compute gyration/shape/chunk ID does not point to a gyration/chunk compute - -Self-explanatory. Provide an ID of a compute gyration/chunk command. - -E: Compute gyration/chunk does not compute gyration tensor - -Self-explanatory. Use keyword tensor in compute gyration/chunk command -*/ diff --git a/src/EXTRA-COMPUTE/compute_hexorder_atom.h b/src/EXTRA-COMPUTE/compute_hexorder_atom.h index ad1fd45e15..7728ab37d7 100644 --- a/src/EXTRA-COMPUTE/compute_hexorder_atom.h +++ b/src/EXTRA-COMPUTE/compute_hexorder_atom.h @@ -51,25 +51,3 @@ class ComputeHexOrderAtom : public Compute { #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 hexorder/atom requires a pair style be defined - -Self-explanatory. - -E: Compute hexorder/atom cutoff is longer than pairwise cutoff - -Cannot compute order parameter beyond cutoff. - -W: More than one compute hexorder/atom - -It is not efficient to use compute hexorder/atom more than once. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_hma.cpp b/src/EXTRA-COMPUTE/compute_hma.cpp index 23dbb07aa8..bb182de7af 100644 --- a/src/EXTRA-COMPUTE/compute_hma.cpp +++ b/src/EXTRA-COMPUTE/compute_hma.cpp @@ -90,8 +90,8 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : // our new fix's group = same as compute group id_fix = utils::strdup(std::string(id)+"_COMPUTE_STORE"); - fix = (FixStore *)modify->add_fix(fmt::format("{} {} STORE peratom 1 3", - id_fix, group->names[igroup])); + fix = dynamic_cast(modify->add_fix(fmt::format("{} {} STORE peratom 1 3", + id_fix, group->names[igroup]))); // calculate xu,yu,zu for fix store array // skip if reset from restart file @@ -190,7 +190,7 @@ void ComputeHMA::setup() int dummy=0; int ifix = modify->find_fix(id_temp); if (ifix < 0) error->all(FLERR,"Could not find compute hma temperature ID"); - double * temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); + auto temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); if (temperat==nullptr) error->all(FLERR,"Could not find compute hma temperature ID"); finaltemp = * temperat; @@ -198,7 +198,7 @@ void ComputeHMA::setup() int ifix2 = modify->find_fix(id_fix); if (ifix2 < 0) error->all(FLERR,"Could not find hma store fix ID"); - fix = (FixStore *) modify->fix[ifix2]; + fix = dynamic_cast( modify->fix[ifix2]); } /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-COMPUTE/compute_momentum.h b/src/EXTRA-COMPUTE/compute_momentum.h index 60d5616d53..fd8d07cffa 100644 --- a/src/EXTRA-COMPUTE/compute_momentum.h +++ b/src/EXTRA-COMPUTE/compute_momentum.h @@ -37,13 +37,3 @@ class ComputeMomentum : public Compute { #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. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_msd_nongauss.h b/src/EXTRA-COMPUTE/compute_msd_nongauss.h index 56edc90e3b..d3faf0e555 100644 --- a/src/EXTRA-COMPUTE/compute_msd_nongauss.h +++ b/src/EXTRA-COMPUTE/compute_msd_nongauss.h @@ -34,17 +34,3 @@ class ComputeMSDNonGauss : public ComputeMSD { #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: Could not find compute msd fix ID - -Self-explanatory. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 329d18901b..5a92f6c347 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -452,7 +452,8 @@ void ComputeStressCartesian::compute_pressure_1d(double fpair, double xi, double } void ComputeStressCartesian::compute_pressure_2d(double fpair, double xi, double yi, double /*xj*/, - double /*yj*/, double delx, double dely, double delz) + double /*yj*/, double delx, double dely, + double delz) { int bin1, bin2, next_bin1, next_bin2; double la = 0.0, lb = 0.0, l_sum = 0.0; diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.h b/src/EXTRA-COMPUTE/compute_stress_cartesian.h index aa44e82269..30ddc8e45e 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.h +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.h @@ -49,22 +49,3 @@ class ComputeStressCartesian : public Compute { #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: No pair style is defined for compute stress/cartesian - -Self-explanatory. - -E: Pair style does not support compute stress/cartesian - -The pair style does not have a single() function, so it can -not be invoked by compute stress/cartesian. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_stress_cylinder.h b/src/EXTRA-COMPUTE/compute_stress_cylinder.h index 76be8aff9a..40f7f9f551 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cylinder.h +++ b/src/EXTRA-COMPUTE/compute_stress_cylinder.h @@ -54,22 +54,3 @@ class ComputeStressCylinder : public Compute { #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: No pair style is defined for compute stress/cylinder - -Self-explanatory. - -E: Pair style does not support compute stress/cylinder - -The pair style does not have a single() function, so it can -not be invoked by compute stress/cylinder. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.h b/src/EXTRA-COMPUTE/compute_stress_mop.h index c247450019..220fc329cc 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop.h @@ -52,48 +52,3 @@ class ComputeStressMop : public Compute { #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 stress/mop incompatible with simulation dimension - - Compute stress/mop only works with 3D simulations. - - E: Compute stress/mop incompatible with triclinic simulation box - - Self-explanatory. - - E: Compute stress/mop requires a fixed simulation box - - Compute stress/mop is not compatible with any change of volume or shape - or boundary conditions of the simulation box. - - E: No pair style is defined for compute stress/mop - - Self-explanatory. Compute stress/mop requires the definition of a pair style. - - E: Pair style does not support compute stress/mop - - The pair style does not have a single() function, so it can - not be invoked by compute stress/mop. - - W: compute stress/mop does not account for bond potentials - - W: compute stress/mop does not account for angle potentials - - W: compute stress/mop does not account for dihedral potentials - - W: compute stress/mop does not account for improper potentials - - W: compute stress/mop does not account for kspace contributions - - Compute stress/mop only accounts for pairwise additive interactions for - the computation of local stress tensor components. - - */ diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h index f67448ca40..ba5509d717 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.h +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.h @@ -58,52 +58,3 @@ class ComputeStressMopProfile : public Compute { #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 stress/mop/profile incompatible with simulation dimension - - Compute stress/mop/profile only works with 3D simulations. - - E: Compute stress/mop/profile incompatible with triclinic simulation box - - Self-explanatory. - - E: Compute stress/mop/profile requires a fixed simulation box - - Compute stress/mop/profile is not compatible with any change of volume or shape - or boundary conditions of the simulation box. - - E: No pair style is defined for compute stress/mop/profile - - Self-explanatory. Compute stress/mop/profile requires the definition of a pair style. - - E: Pair style does not support compute stress/mop/profile - - The pair style does not have a single() function, so it can - not be invoked by compute stress/mop/profile. - - E: Origin of bins for compute stress/mop/profile is out of bounds - - Self-explanatory. - - W: compute stress/mop/profile does not account for bond potentials - - W: compute stress/mop/profile does not account for angle potentials - - W: compute stress/mop/profile does not account for dihedral potentials - - W: compute stress/mop/profile does not account for improper potentials - - W: compute stress/mop/profile does not account for kspace contributions - - Compute stress/mop/profile only accounts for pairwise additive interactions for - the computation of local stress tensor components. - -*/ diff --git a/src/EXTRA-COMPUTE/compute_stress_spherical.h b/src/EXTRA-COMPUTE/compute_stress_spherical.h index 61a32e3ff2..c4e626a40f 100644 --- a/src/EXTRA-COMPUTE/compute_stress_spherical.h +++ b/src/EXTRA-COMPUTE/compute_stress_spherical.h @@ -47,22 +47,3 @@ class ComputeStressSpherical : public Compute { #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: No pair style is defined for compute stress/spherical - -Self-explanatory. - -E: Pair style does not support compute stress/spherical - -The pair style does not have a single() function, so it can -not be invoked by compute stress/spherical - -*/ diff --git a/src/EXTRA-COMPUTE/compute_ti.h b/src/EXTRA-COMPUTE/compute_ti.h index e68decdceb..15a1e78667 100644 --- a/src/EXTRA-COMPUTE/compute_ti.h +++ b/src/EXTRA-COMPUTE/compute_ti.h @@ -45,39 +45,3 @@ class ComputeTI : public Compute { #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: Variable name for compute ti does not exist - -Self-explanatory. - -E: Variable for compute ti is invalid style - -Self-explanatory. - -E: Compute ti pair style does not exist - -Self-explanatory. - -E: Compute ti tail when pair style does not compute tail corrections - -Self-explanatory. - -E: Compute ti kspace style does not exist - -Self-explanatory. - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/EXTRA-DUMP/dump_dcd.h b/src/EXTRA-DUMP/dump_dcd.h index e6e7e3c766..79999f8b8e 100644 --- a/src/EXTRA-DUMP/dump_dcd.h +++ b/src/EXTRA-DUMP/dump_dcd.h @@ -52,48 +52,3 @@ class DumpDCD : public Dump { #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: Invalid dump dcd filename - -Filenames used with the dump dcd style cannot be binary or compressed -or cause multiple files to be written. - -E: Too many atoms for dump dcd - -The system size must fit in a 32-bit integer to use this dump -style. - -E: Dump dcd requires sorting by atom ID - -Use the dump_modify sort command to enable this. - -E: Cannot use variable every setting for dump dcd - -The format of DCD dump files requires snapshots be output -at a constant frequency. - -E: Cannot change dump_modify every for dump dcd - -The frequency of writing dump dcd snapshots cannot be changed. - -E: Cannot open dump file - -Self-explanatory. - -E: Dump dcd of non-matching # of atoms - -Every snapshot written by dump dcd must contain the same # of atoms. - -E: Too big a timestep for dump dcd - -The timestep must fit in a 32-bit integer to use this dump style. - -*/ diff --git a/src/EXTRA-DUMP/dump_xtc.h b/src/EXTRA-DUMP/dump_xtc.h index 4fd5ee57ff..1ffb2ba6bf 100644 --- a/src/EXTRA-DUMP/dump_xtc.h +++ b/src/EXTRA-DUMP/dump_xtc.h @@ -54,59 +54,3 @@ class DumpXTC : public Dump { #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: Invalid dump xtc filename - -Filenames used with the dump xtc style cannot be binary or compressed -or cause multiple files to be written. - -E: Too many atoms for dump xtc - -The system size must fit in a 32-bit integer to use this dump -style. - -W: No automatic unit conversion to XTC file format conventions possible for units lj - -This means no scaling will be performed. - -E: Dump xtc requires sorting by atom ID - -Use the dump_modify sort command to enable this. - -E: Cannot set dump_modify flush for dump xtc - -Self-explanatory. - -E: Cannot use variable every setting for dump xtc - -The format of this file requires snapshots at regular intervals. - -E: Cannot change dump_modify every for dump xtc - -The frequency of writing dump xtc snapshots cannot be changed. - -E: Cannot open dump file - -Self-explanatory. - -E: Too big a timestep for dump xtc - -The timestep must fit in a 32-bit integer to use this dump style. - -E: Illegal dump_modify sfactor value (must be > 0.0) - -Self-explanatory. - -E: Illegal dump_modify tfactor value (must be > 0.0) - -Self-explanatory. - -*/ diff --git a/src/EXTRA-DUMP/dump_yaml.h b/src/EXTRA-DUMP/dump_yaml.h index e9717ea0b3..bf621dcb51 100644 --- a/src/EXTRA-DUMP/dump_yaml.h +++ b/src/EXTRA-DUMP/dump_yaml.h @@ -28,7 +28,7 @@ class DumpYAML : public DumpCustom { public: DumpYAML(class LAMMPS *, int, char **); -protected: + protected: bool thermo; void init_style() override; @@ -43,47 +43,3 @@ protected: #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open dump file %s - -The output file for the dump command cannot be opened. Check that the -path and name are correct. - -E: Too much per-proc info for dump - -Number of local atoms times number of columns must fit in a 32-bit -integer for dump. - -E: Dump_modify format line is too short - -UNDOCUMENTED - -E: Could not find dump custom compute ID - -Self-explanatory. - -E: Could not find dump custom fix ID - -Self-explanatory. - -E: Dump custom and fix not computed at compatible times - -The fix must produce per-atom quantities on timesteps that dump custom -needs them. - -E: Could not find dump custom variable name - -Self-explanatory. - -E: Region ID for dump custom does not exist - -Self-explanatory. - -U: Dump_modify format string is too short - -There are more fields to be dumped in a line of output than your -format string specifies. - -*/ diff --git a/src/EXTRA-DUMP/xdr_compat.h b/src/EXTRA-DUMP/xdr_compat.h index 6557a60a53..d20365c77b 100644 --- a/src/EXTRA-DUMP/xdr_compat.h +++ b/src/EXTRA-DUMP/xdr_compat.h @@ -59,8 +59,8 @@ extern "C" { typedef int bool_t; -#if defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__) || \ - defined(__DragonFly__) || defined(__OpenBSD__) || defined(__NetBSD__) +#if defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || \ + defined(__OpenBSD__) || defined(__NetBSD__) typedef char *caddr_t; typedef unsigned int u_int; #endif @@ -203,7 +203,3 @@ extern void xdr_free(xdrproc_t __proc, char *__objp); #endif #endif /* XDR_COMPAT_H */ - -/* ERROR/WARNING messages: - -*/ diff --git a/src/EXTRA-FIX/fix_addtorque.cpp b/src/EXTRA-FIX/fix_addtorque.cpp index 7c8e832673..eb95db52b0 100644 --- a/src/EXTRA-FIX/fix_addtorque.cpp +++ b/src/EXTRA-FIX/fix_addtorque.cpp @@ -130,7 +130,7 @@ void FixAddTorque::init() else varflag = CONSTANT; if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -142,9 +142,9 @@ void FixAddTorque::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index 856cda90c2..3987449279 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -739,7 +739,7 @@ void FixAveCorrelateLong::write_restart(FILE *fp) { void FixAveCorrelateLong::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int npairin = static_cast (list[n++]); int numcorrelatorsin = static_cast (list[n++]); int pin = static_cast (list[n++]); diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.h b/src/EXTRA-FIX/fix_ave_correlate_long.h index 6c0ca63a39..0c540aa727 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.h +++ b/src/EXTRA-FIX/fix_ave_correlate_long.h @@ -83,68 +83,3 @@ class FixAveCorrelateLong : public Fix { #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: Cannot open fix ave/correlate/long file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Compute ID for fix ave/correlate/long does not exist - -Self-explanatory. - -E: Fix ave/correlate/long compute does not calculate a scalar - -Self-explanatory. - -E: Fix ave/correlate/long compute does not calculate a vector - -Self-explanatory. - -E: Fix ave/correlate/long compute vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix ID for fix ave/correlate/long does not exist - -Self-explanatory. - -E: Fix ave/correlate/long fix does not calculate a scalar - -Self-explanatory. - -E: Fix ave/correlate/long fix does not calculate a vector - -Self-explanatory. - -E: Fix ave/correlate/long fix vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix for fix ave/correlate/long not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/correlate/long -is requesting a value on a non-allowed timestep. - -E: Variable name for fix ave/correlate/long does not exist - -Self-explanatory. - -E: Fix ave/correlate/long variable is not equal-style variable - -Self-explanatory. - -E: Invalid timestep reset for fix ave/correlate/long - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -*/ diff --git a/src/EXTRA-FIX/fix_controller.h b/src/EXTRA-FIX/fix_controller.h index f8f7c826b3..d6a97b6dc7 100644 --- a/src/EXTRA-FIX/fix_controller.h +++ b/src/EXTRA-FIX/fix_controller.h @@ -52,47 +52,3 @@ class FixController : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Compute ID for fix controller does not exist - -UNDOCUMENTED - -E: Fix controller compute does not calculate a global scalar or vector - -UNDOCUMENTED - -E: Fix controller compute vector is accessed out-of-range - -UNDOCUMENTED - -E: Fix ID for fix controller does not exist - -UNDOCUMENTED - -E: Fix controller fix does not calculate a global scalar or vector - -UNDOCUMENTED - -E: Fix controller fix vector is accessed out-of-range - -UNDOCUMENTED - -E: Variable name for fix controller does not exist - -UNDOCUMENTED - -E: Fix controller variable is not equal-style variable - -UNDOCUMENTED - -E: Fix controller variable is not internal-style variable - -UNDOCUMENTED - -*/ diff --git a/src/EXTRA-FIX/fix_drag.cpp b/src/EXTRA-FIX/fix_drag.cpp index 69aa104d52..48977a0cd1 100644 --- a/src/EXTRA-FIX/fix_drag.cpp +++ b/src/EXTRA-FIX/fix_drag.cpp @@ -71,7 +71,7 @@ int FixDrag::setmask() void FixDrag::init() { if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -83,9 +83,9 @@ void FixDrag::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/EXTRA-FIX/fix_drag.h b/src/EXTRA-FIX/fix_drag.h index 9c2739cfe9..519e3f79d3 100644 --- a/src/EXTRA-FIX/fix_drag.h +++ b/src/EXTRA-FIX/fix_drag.h @@ -48,13 +48,3 @@ class FixDrag : public Fix { #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. - -*/ diff --git a/src/EXTRA-FIX/fix_electron_stopping.cpp b/src/EXTRA-FIX/fix_electron_stopping.cpp index a61cedcf27..e9cc501744 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -39,63 +38,53 @@ using namespace LAMMPS_NS; using namespace FixConst; -#define MAXLINE 1024 - /* ---------------------------------------------------------------------- */ FixElectronStopping::FixElectronStopping(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) + Fix(lmp, narg, arg), elstop_ranges(nullptr), idregion(nullptr), region(nullptr), list(nullptr) { - scalar_flag = 1; // Has compute_scalar - global_freq = 1; // SeLoss computed every step - extscalar = 0; // SeLoss compute_scalar is intensive - nevery = 1; // Run fix every step - + scalar_flag = 1; // Has compute_scalar + global_freq = 1; // SeLoss computed every step + extscalar = 0; // SeLoss compute_scalar is intensive + nevery = 1; // Run fix every step // args: 0 = fix ID, 1 = group ID, 2 = "electron/stopping" // 3 = Ecut, 4 = file path // optional rest: "region" // "minneigh" - if (narg < 5) error->all(FLERR, - "Illegal fix electron/stopping command: too few arguments"); + if (narg < 5) error->all(FLERR, "Illegal fix electron/stopping command: too few arguments"); - Ecut = utils::numeric(FLERR, arg[3],false,lmp); - if (Ecut <= 0.0) error->all(FLERR, - "Illegal fix electron/stopping command: Ecut <= 0"); + Ecut = utils::numeric(FLERR, arg[3], false, lmp); + if (Ecut <= 0.0) error->all(FLERR, "Illegal fix electron/stopping command: Ecut <= 0"); int iarg = 5; - iregion = -1; minneigh = 1; bool minneighflag = false; while (iarg < narg) { if (strcmp(arg[iarg], "region") == 0) { - if (iregion >= 0) error->all(FLERR, - "Illegal fix electron/stopping command: region given twice"); - if (iarg+2 > narg) error->all(FLERR, - "Illegal fix electron/stopping command: region name missing"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion < 0) error->all(FLERR, - "Region ID for fix electron/stopping does not exist"); + if (region) error->all(FLERR, "Illegal fix electron/stopping command: region given twice"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix electron/stopping command: region name missing"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) + error->all(FLERR, "Region {} for fix electron/stopping does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } - else if (strcmp(arg[iarg], "minneigh") == 0) { - if (minneighflag) error->all(FLERR, - "Illegal fix electron/stopping command: minneigh given twice"); + } else if (strcmp(arg[iarg], "minneigh") == 0) { + if (minneighflag) + error->all(FLERR, "Illegal fix electron/stopping command: minneigh given twice"); minneighflag = true; - if (iarg+2 > narg) error->all(FLERR, - "Illegal fix electron/stopping command: minneigh number missing"); - minneigh = utils::inumeric(FLERR, arg[iarg+1],false,lmp); - if (minneigh < 0) error->all(FLERR, - "Illegal fix electron/stopping command: minneigh < 0"); + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix electron/stopping command: minneigh number missing"); + minneigh = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + if (minneigh < 0) error->all(FLERR, "Illegal fix electron/stopping command: minneigh < 0"); iarg += 2; - } - else error->all(FLERR, - "Illegal fix electron/stopping command: unknown argument"); + } else + error->all(FLERR, "Illegal fix electron/stopping command: unknown argument"); } - // Read the input file for energy ranges and stopping powers. // First proc 0 reads the file, then bcast to others. const int ncol = atom->ntypes + 1; @@ -105,13 +94,12 @@ FixElectronStopping::FixElectronStopping(LAMMPS *lmp, int narg, char **arg) : read_table(arg[4]); } - MPI_Bcast(&maxlines, 1 , MPI_INT, 0, world); - MPI_Bcast(&table_entries, 1 , MPI_INT, 0, world); + MPI_Bcast(&maxlines, 1, MPI_INT, 0, world); + MPI_Bcast(&table_entries, 1, MPI_INT, 0, world); - if (comm->me != 0) - memory->create(elstop_ranges, ncol, maxlines, "electron/stopping:table"); + if (comm->me != 0) memory->create(elstop_ranges, ncol, maxlines, "electron/stopping:table"); - MPI_Bcast(&elstop_ranges[0][0], ncol*maxlines, MPI_DOUBLE, 0, world); + MPI_Bcast(&elstop_ranges[0][0], ncol * maxlines, MPI_DOUBLE, 0, world); } /* ---------------------------------------------------------------------- */ @@ -136,6 +124,10 @@ void FixElectronStopping::init() { SeLoss_sync_flag = 0; SeLoss = 0.0; + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix electron/stopping does not exist", idregion); + } // need an occasional full neighbor list neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); @@ -176,18 +168,17 @@ void FixElectronStopping::post_force(int /*vflag*/) int itype = type[i]; double massone = (atom->rmass) ? atom->rmass[i] : atom->mass[itype]; - double v2 = v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]; + double v2 = v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]; double energy = 0.5 * force->mvv2e * massone * v2; if (energy < Ecut) continue; if (energy < elstop_ranges[0][0]) continue; - if (energy > elstop_ranges[0][table_entries - 1]) error->one(FLERR, - "Atom kinetic energy too high for fix electron/stopping"); + if (energy > elstop_ranges[0][table_entries - 1]) + error->one(FLERR, "Atom kinetic energy too high for fix electron/stopping"); - if (iregion >= 0) { + if (region) { // Only apply in the given region - if (domain->regions[iregion]->match(x[i][0], x[i][1], x[i][2]) != 1) - continue; + if (region->match(x[i][0], x[i][1], x[i][2]) != 1) continue; } // Binary search to find correct energy range @@ -196,8 +187,10 @@ void FixElectronStopping::post_force(int /*vflag*/) while (true) { int ihalf = idown + (iup - idown) / 2; if (ihalf == idown) break; - if (elstop_ranges[0][ihalf] < energy) idown = ihalf; - else iup = ihalf; + if (elstop_ranges[0][ihalf] < energy) + idown = ihalf; + else + iup = ihalf; } double Se_lo = elstop_ranges[itype][idown]; @@ -215,7 +208,7 @@ void FixElectronStopping::post_force(int /*vflag*/) f[i][1] += v[i][1] * factor; f[i][2] += v[i][2] * factor; - SeLoss += Se * vabs * dt; // very rough approx + SeLoss += Se * vabs * dt; // very rough approx } } @@ -254,19 +247,17 @@ void FixElectronStopping::read_table(const char *file) ValueTokenizer values(line); elstop_ranges[0][nlines] = values.next_double(); if (elstop_ranges[0][nlines] <= oldvalue) - throw TokenizerException("energy values must be positive and in ascending order",line); + throw TokenizerException("energy values must be positive and in ascending order", line); oldvalue = elstop_ranges[0][nlines]; - for (int i = 1; i < ncol; ++i) - elstop_ranges[i][nlines] = values.next_double(); + for (int i = 1; i < ncol; ++i) elstop_ranges[i][nlines] = values.next_double(); ++nlines; } } catch (std::exception &e) { error->one(FLERR, "Problem parsing electron stopping data: {}", e.what()); } - if (nlines == 0) - error->one(FLERR, "Did not find any data in electron/stopping table file"); + if (nlines == 0) error->one(FLERR, "Did not find any data in electron/stopping table file"); table_entries = nlines; } @@ -281,8 +272,7 @@ void FixElectronStopping::grow_table() double **new_array; memory->create(new_array, ncol, new_maxlines, "electron/stopping:table"); - for (int i = 0; i < ncol; i++) - memcpy(new_array[i], elstop_ranges[i], maxlines*sizeof(double)); + for (int i = 0; i < ncol; i++) memcpy(new_array[i], elstop_ranges[i], maxlines * sizeof(double)); memory->destroy(elstop_ranges); elstop_ranges = new_array; diff --git a/src/EXTRA-FIX/fix_electron_stopping.h b/src/EXTRA-FIX/fix_electron_stopping.h index 015d444996..883854c1cb 100644 --- a/src/EXTRA-FIX/fix_electron_stopping.h +++ b/src/EXTRA-FIX/fix_electron_stopping.h @@ -52,8 +52,9 @@ class FixElectronStopping : public Fix { double **elstop_ranges; // [ 0][i]: energies // [>0][i]: stopping powers per type - int iregion; // region index if used, else -1 - int minneigh; // minimum number of neighbors + char *idregion; // region id + class Region *region; // region pointer if used, else NULL + int minneigh; // minimum number of neighbors class NeighList *list; }; @@ -62,43 +63,3 @@ class FixElectronStopping : public Fix { #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: Region ID for fix electron/stopping does not exist - -Self-explanatory. - -E: Atom kinetic energy too high for fix electron/stopping - -The group given in the fix electron/stopping command includes an atom -that has a kinetic energy higher than the largest energy in the stopping -table. Reconsider whether the table is physically applicable to your system. - -E: Cannot open stopping range table ... - -The file containing the electronic stopping table could not be opened. -Check the given path and the file's permissions. - -E: fix electron/stopping: Invalid table line - -A line in the stopping table file contained too many or too few columns. - -E: fix electron/stopping: Energies must be in ascending order - -The first column in the stopping table must be sorted from the smallest -energy to the largest. - -E: Did not find any data in electronic stopping table file - -Parsing the stopping table file produced no lines that were identifiable -as energies/stopping powers. Most likely the file is empty or contains -only comments. - -*/ diff --git a/src/EXTRA-FIX/fix_electron_stopping_fit.cpp b/src/EXTRA-FIX/fix_electron_stopping_fit.cpp index 35ead3397c..0e0ccc0ebb 100644 --- a/src/EXTRA-FIX/fix_electron_stopping_fit.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping_fit.cpp @@ -139,9 +139,9 @@ void FixElectronStoppingFit::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); }; }; diff --git a/src/EXTRA-FIX/fix_ffl.cpp b/src/EXTRA-FIX/fix_ffl.cpp index 9cc9d4e179..6e08ae6c79 100644 --- a/src/EXTRA-FIX/fix_ffl.cpp +++ b/src/EXTRA-FIX/fix_ffl.cpp @@ -158,8 +158,8 @@ void FixFFL::init() { } if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - step_respa = ((Respa *) update->integrate)->step; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; } init_ffl(); @@ -182,9 +182,9 @@ void FixFFL::setup(int vflag) { if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } diff --git a/src/EXTRA-FIX/fix_filter_corotate.cpp b/src/EXTRA-FIX/fix_filter_corotate.cpp index 1ffa03cca5..e2bd982617 100644 --- a/src/EXTRA-FIX/fix_filter_corotate.cpp +++ b/src/EXTRA-FIX/fix_filter_corotate.cpp @@ -279,7 +279,7 @@ void FixFilterCorotate::init() // set ptrs to rRESPA variables if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } else error->all(FLERR,"Fix filter/corotate requires rRESPA!"); @@ -656,9 +656,9 @@ void FixFilterCorotate::pre_neighbor() void FixFilterCorotate::setup(int vflag) { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } void FixFilterCorotate::setup_pre_force_respa(int vflag,int ilevel) { @@ -1275,7 +1275,7 @@ void FixFilterCorotate::find_clusters() void FixFilterCorotate::ring_bonds(int ndatum, char *cbuf, void *ptr) { - FixFilterCorotate *ffptr = (FixFilterCorotate *) ptr; + auto ffptr = (FixFilterCorotate *) ptr; Atom *atom = ffptr->atom; double *rmass = atom->rmass; double *mass = atom->mass; @@ -1284,7 +1284,7 @@ void FixFilterCorotate::ring_bonds(int ndatum, char *cbuf, void *ptr) int nlocal = atom->nlocal; int nmass = ffptr->nmass; - tagint *buf = (tagint *) cbuf; + auto buf = (tagint *) cbuf; int m,n; double massone; @@ -1313,13 +1313,13 @@ void FixFilterCorotate::ring_bonds(int ndatum, char *cbuf, void *ptr) void FixFilterCorotate::ring_nshake(int ndatum, char *cbuf, void *ptr) { - FixFilterCorotate *ffptr = (FixFilterCorotate *) ptr; + auto ffptr = (FixFilterCorotate *) ptr; Atom *atom = ffptr->atom; int nlocal = atom->nlocal; int *nshake = ffptr->nshake; - tagint *buf = (tagint *) cbuf; + auto buf = (tagint *) cbuf; int m; for (int i = 0; i < ndatum; i += 3) { @@ -1335,7 +1335,7 @@ void FixFilterCorotate::ring_nshake(int ndatum, char *cbuf, void *ptr) void FixFilterCorotate::ring_shake(int ndatum, char *cbuf, void *ptr) { - FixFilterCorotate *ffptr = (FixFilterCorotate *) ptr; + auto ffptr = (FixFilterCorotate *) ptr; Atom *atom = ffptr->atom; int nlocal = atom->nlocal; @@ -1343,7 +1343,7 @@ void FixFilterCorotate::ring_shake(int ndatum, char *cbuf, void *ptr) tagint **shake_atom = ffptr->shake_atom; int **shake_type = ffptr->shake_type; - tagint *buf = (tagint *) cbuf; + auto buf = (tagint *) cbuf; int m; for (int i = 0; i < ndatum; i += 11) { @@ -1399,9 +1399,9 @@ void FixFilterCorotate::general_cluster(int index, int index_in_list) int* list_cluster = new int[N]; // contains local IDs of cluster atoms, // 0 = center - double* m = new double[N]; //contains local mass - double *r = new double[N]; //contains r[i] = 1/||del[i]|| - double** del = new double*[N]; //contains del[i] = x_i-x_0 + auto m = new double[N]; //contains local mass + auto r = new double[N]; //contains r[i] = 1/||del[i]|| + auto del = new double*[N]; //contains del[i] = x_i-x_0 for (int i = 0; iintegrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -146,9 +146,9 @@ void FixFlowGauss::setup(int vflag) error->all(FLERR,"Invalid group mass in fix flow/gauss"); if (utils::strmatch(update->integrate_style,"^respa")) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } else post_force(vflag); diff --git a/src/EXTRA-FIX/fix_gld.cpp b/src/EXTRA-FIX/fix_gld.cpp index 41585e4fd0..b183526d65 100644 --- a/src/EXTRA-FIX/fix_gld.cpp +++ b/src/EXTRA-FIX/fix_gld.cpp @@ -197,7 +197,7 @@ void FixGLD::init() dtf = 0.5 * update->dt * force->ftm2v; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } /* ---------------------------------------------------------------------- diff --git a/src/EXTRA-FIX/fix_gld.h b/src/EXTRA-FIX/fix_gld.h index 538106939c..4f0a87fad3 100644 --- a/src/EXTRA-FIX/fix_gld.h +++ b/src/EXTRA-FIX/fix_gld.h @@ -69,45 +69,3 @@ class FixGLD : public Fix { #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: Fix gld series type must be pprony for now - -Self-explanatory. - -E: Fix gld prony terms must be > 0 - -Self-explanatory. - -E: Fix gld start temperature must be >= 0 - -Self-explanatory. - -E: Fix gld stop temperature must be >= 0 - -Self-explanatory. - -E: Fix gld needs more prony series coefficients - -Self-explanatory. - -E: Fix gld c coefficients must be >= 0 - -Self-explanatory. - -E: Fix gld tau coefficients must be > 0 - -Self-explanatory. - -E: Cannot zero gld force for zero atoms - -There are no atoms currently in the group. - -*/ diff --git a/src/EXTRA-FIX/fix_gle.cpp b/src/EXTRA-FIX/fix_gle.cpp index 0e19f6e58f..1d07b05d91 100644 --- a/src/EXTRA-FIX/fix_gle.cpp +++ b/src/EXTRA-FIX/fix_gle.cpp @@ -57,8 +57,8 @@ namespace GLE { //"stabilized" cholesky decomposition. does a LDL^t decomposition, then sets to zero the negative diagonal elements and gets MM^t void StabCholesky(int n, const double* MMt, double* M) { - double *L = new double[n*n]; - double *D = new double[n]; + auto L = new double[n*n]; + auto D = new double[n]; int i,j,k; for (i=0; iintegrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - step_respa = ((Respa *) update->integrate)->step; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; } init_gle(); @@ -369,8 +369,8 @@ void FixGLE::init_gle() { // compute Langevin terms - double *tmp1 = new double[ns1sq]; - double *tmp2 = new double[ns1sq]; + auto tmp1 = new double[ns1sq]; + auto tmp2 = new double[ns1sq]; for (int i=0; idt*0.5*gle_every; @@ -406,10 +406,10 @@ void FixGLE::init_gles() int *mask = atom->mask; int nlocal = atom->nlocal; - double *rootC = new double[ns1sq]; - double *rootCT = new double[ns1sq]; - double *newg = new double[3*(ns+1)*nlocal]; - double *news = new double[3*(ns+1)*nlocal]; + auto rootC = new double[ns1sq]; + auto rootCT = new double[ns1sq]; + auto newg = new double[3*(ns+1)*nlocal]; + auto news = new double[3*(ns+1)*nlocal]; GLE::StabCholesky(ns+1, C, rootC); GLE::MyTrans(ns+1,rootC,rootCT); @@ -444,9 +444,9 @@ void FixGLE::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } diff --git a/src/EXTRA-FIX/fix_momentum_chunk.cpp b/src/EXTRA-FIX/fix_momentum_chunk.cpp index 06d2137d84..2734a4565b 100644 --- a/src/EXTRA-FIX/fix_momentum_chunk.cpp +++ b/src/EXTRA-FIX/fix_momentum_chunk.cpp @@ -110,7 +110,7 @@ void FixMomentumChunk::init() int icompute = modify->find_compute(id_chunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for fix momentum/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Fix momentum/chunk does not use chunk/atom compute"); @@ -122,7 +122,7 @@ void FixMomentumChunk::init() auto cmd = fmt::format("{} {} com/chunk {}",id_com,group->names[igroup],id_chunk); modify->add_compute(cmd); icompute = modify->find_compute(id_com); - ccom = (ComputeCOMChunk *) modify->compute[icompute]; + ccom = dynamic_cast( modify->compute[icompute]); id_vcm = id + id_chunk + "_vcm"; icompute = modify->find_compute(id_vcm); diff --git a/src/EXTRA-FIX/fix_momentum_chunk.h b/src/EXTRA-FIX/fix_momentum_chunk.h index b3641a204a..b8272f0062 100644 --- a/src/EXTRA-FIX/fix_momentum_chunk.h +++ b/src/EXTRA-FIX/fix_momentum_chunk.h @@ -46,17 +46,3 @@ class FixMomentumChunk : public Fix { #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: Fix momentum group has no atoms - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_npt_cauchy.cpp b/src/EXTRA-FIX/fix_npt_cauchy.cpp index d9a0f850db..4a1e11d963 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.cpp +++ b/src/EXTRA-FIX/fix_npt_cauchy.cpp @@ -681,7 +681,7 @@ void FixNPTCauchy::init() if (pstat_flag) for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2]) || (p_flag[3] && dimflag[3]) || (p_flag[4] && dimflag[4]) || (p_flag[5] && dimflag[5])) @@ -754,8 +754,8 @@ void FixNPTCauchy::init() else kspace_flag = 0; if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - step_respa = ((Respa *) update->integrate)->step; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; dto = 0.5*step_respa[0]; } @@ -1374,7 +1374,7 @@ int FixNPTCauchy::pack_restart_data(double *list) void FixNPTCauchy::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); @@ -2466,7 +2466,7 @@ void FixNPTCauchy::CauchyStat_init() modify->add_fix(std::string(id_store) + " all STORE global 1 6"); restart_stored = modify->find_fix(id_store); } - init_store = (FixStore *)modify->fix[restart_stored]; + init_store = dynamic_cast(modify->fix[restart_stored]); initRUN = 0; initPK = 1; diff --git a/src/EXTRA-FIX/fix_npt_cauchy.h b/src/EXTRA-FIX/fix_npt_cauchy.h index 8150e59f6f..593520cd41 100644 --- a/src/EXTRA-FIX/fix_npt_cauchy.h +++ b/src/EXTRA-FIX/fix_npt_cauchy.h @@ -180,136 +180,3 @@ class FixNPTCauchy : public Fix { #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: Target temperature for fix npt/cauchy cannot be 0.0 - -Self-explanatory. - -E: Invalid fix npt/cauchy command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix npt/cauchy dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix npt/cauchy command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix npt/cauchy on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix npt/cauchy on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix npt/cauchy with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix npt/cauchy with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix npt/cauchy with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix npt/cauchy with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix npt/cauchy with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix npt/cauchy with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix npt/cauchy with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix npt/cauchy pressure settings - -Settings for coupled dimensions must be the same. - -E: Using update dipole flag requires atom style sphere - -Self-explanatory. - -E: Using update dipole flag requires atom attribute mu - -Self-explanatory. - -E: Fix npt/cauchy damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix npt/cauchy and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix npt/cauchy does not exist - -Self-explanatory. - -E: Pressure ID for fix npt/cauchy does not exist - -Self-explanatory. - -E: Non-numeric pressure - simulation unstable - -UNDOCUMENTED - -E: Fix npt/cauchy has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -U: The dlm flag must be used with update dipole - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_numdiff.cpp b/src/EXTRA-FIX/fix_numdiff.cpp index 7265ec0b79..472c7288ae 100644 --- a/src/EXTRA-FIX/fix_numdiff.cpp +++ b/src/EXTRA-FIX/fix_numdiff.cpp @@ -41,7 +41,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr), temp_f(nullptr) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), numdiff_forces(nullptr), temp_x(nullptr), + temp_f(nullptr) { if (narg < 5) error->all(FLERR, "Illegal fix numdiff command"); @@ -122,7 +123,7 @@ void FixNumDiff::init() kspace_compute_flag = 0; if (utils::strmatch(update->integrate_style, "^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; + ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } } @@ -134,9 +135,9 @@ void FixNumDiff::setup(int vflag) if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag, ilevel_respa, 0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/EXTRA-FIX/fix_numdiff.h b/src/EXTRA-FIX/fix_numdiff.h index 1f5fecf421..83d69406c4 100644 --- a/src/EXTRA-FIX/fix_numdiff.h +++ b/src/EXTRA-FIX/fix_numdiff.h @@ -64,27 +64,3 @@ class FixNumDiff : public Fix { #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: Fix numdiff requires an atom map, see atom_modify - -Self-explanatory. Efficient loop over all atoms for numerical difference -requires an atom map. - -E: Fix numdiff requires consecutive atom IDs - -Self-explanatory. Efficient loop over all atoms for numerical difference -requires consecutive atom IDs. - -E: Compute ID for fix numdiff does not exist - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_numdiff_virial.cpp b/src/EXTRA-FIX/fix_numdiff_virial.cpp index a87be67c89..fa854ab3b1 100644 --- a/src/EXTRA-FIX/fix_numdiff_virial.cpp +++ b/src/EXTRA-FIX/fix_numdiff_virial.cpp @@ -132,7 +132,7 @@ void FixNumDiffVirial::init() kspace_compute_flag = 0; if (utils::strmatch(update->integrate_style, "^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; + ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } } @@ -144,9 +144,9 @@ void FixNumDiffVirial::setup(int vflag) if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag, ilevel_respa, 0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/EXTRA-FIX/fix_numdiff_virial.h b/src/EXTRA-FIX/fix_numdiff_virial.h index 71910afc1c..5b50bbe5ec 100644 --- a/src/EXTRA-FIX/fix_numdiff_virial.h +++ b/src/EXTRA-FIX/fix_numdiff_virial.h @@ -68,22 +68,3 @@ class FixNumDiffVirial : public Fix { #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 numdiff/virial does not exist - -Self-explanatory. - -E: Fix numdiff/virial must use group all - -Virial contributions computed by this fix are -computed on all atoms. - -*/ diff --git a/src/EXTRA-FIX/fix_nvk.cpp b/src/EXTRA-FIX/fix_nvk.cpp index 1f4c76febc..168af71262 100644 --- a/src/EXTRA-FIX/fix_nvk.cpp +++ b/src/EXTRA-FIX/fix_nvk.cpp @@ -62,7 +62,7 @@ void FixNVK::init() if (utils::strmatch(update->integrate_style,"^respa")) { error->all(FLERR,"Fix nvk not yet enabled for RESPA"); - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } // compute initial kinetic energy diff --git a/src/EXTRA-FIX/fix_nvk.h b/src/EXTRA-FIX/fix_nvk.h index 67b2cb6916..d970f72ee7 100644 --- a/src/EXTRA-FIX/fix_nvk.h +++ b/src/EXTRA-FIX/fix_nvk.h @@ -47,21 +47,3 @@ class FixNVK : public Fix { #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: Fix nvk only supports group all - -Self-explanatory. - -E: Fix nvk not yet enabled for RESPA - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_oneway.cpp b/src/EXTRA-FIX/fix_oneway.cpp index 5ebc535c43..7a4a0a02e3 100644 --- a/src/EXTRA-FIX/fix_oneway.cpp +++ b/src/EXTRA-FIX/fix_oneway.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -28,35 +27,36 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{NONE=-1,X=0,Y=1,Z=2,XYZMASK=3,MINUS=4,PLUS=0}; +enum { NONE = -1, X = 0, Y = 1, Z = 2, XYZMASK = 3, MINUS = 4, PLUS = 0 }; /* ---------------------------------------------------------------------- */ -FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) +FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), region(nullptr), idregion(nullptr) { direction = NONE; - regionidx = 0; - regionstr = nullptr; - if (narg < 6) error->all(FLERR,"Illegal fix oneway command"); + if (narg < 6) error->all(FLERR, "Illegal fix oneway command"); - nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery < 1) error->all(FLERR,"Illegal fix oneway command"); + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + if (nevery < 1) error->all(FLERR, "Illegal fix oneway command"); - regionstr = utils::strdup(arg[4]); + idregion = utils::strdup(arg[4]); + if (!domain->get_region_by_id(idregion)) + error->all(FLERR, "Region {} for fix oneway does not exist", idregion); - if (strcmp(arg[5], "x") == 0) direction = X|PLUS; - if (strcmp(arg[5], "X") == 0) direction = X|PLUS; - if (strcmp(arg[5], "y") == 0) direction = Y|PLUS; - if (strcmp(arg[5], "Y") == 0) direction = Y|PLUS; - if (strcmp(arg[5], "z") == 0) direction = Z|PLUS; - if (strcmp(arg[5], "Z") == 0) direction = Z|PLUS; - if (strcmp(arg[5],"-x") == 0) direction = X|MINUS; - if (strcmp(arg[5],"-X") == 0) direction = X|MINUS; - if (strcmp(arg[5],"-y") == 0) direction = Y|MINUS; - if (strcmp(arg[5],"-Y") == 0) direction = Y|MINUS; - if (strcmp(arg[5],"-z") == 0) direction = Z|MINUS; - if (strcmp(arg[5],"-Z") == 0) direction = Z|MINUS; + if (strcmp(arg[5], "x") == 0) direction = X | PLUS; + if (strcmp(arg[5], "X") == 0) direction = X | PLUS; + if (strcmp(arg[5], "y") == 0) direction = Y | PLUS; + if (strcmp(arg[5], "Y") == 0) direction = Y | PLUS; + if (strcmp(arg[5], "z") == 0) direction = Z | PLUS; + if (strcmp(arg[5], "Z") == 0) direction = Z | PLUS; + if (strcmp(arg[5], "-x") == 0) direction = X | MINUS; + if (strcmp(arg[5], "-X") == 0) direction = X | MINUS; + if (strcmp(arg[5], "-y") == 0) direction = Y | MINUS; + if (strcmp(arg[5], "-Y") == 0) direction = Y | MINUS; + if (strcmp(arg[5], "-z") == 0) direction = Z | MINUS; + if (strcmp(arg[5], "-Z") == 0) direction = Z | MINUS; global_freq = nevery; } @@ -65,7 +65,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) FixOneWay::~FixOneWay() { - if (regionstr) delete[] regionstr; + delete[] idregion; } /* ---------------------------------------------------------------------- */ @@ -79,26 +79,24 @@ int FixOneWay::setmask() void FixOneWay::init() { - regionidx = domain->find_region(regionstr); - if (regionidx < 0) - error->all(FLERR,"Region for fix oneway does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix oneway does not exist", idregion); } /* ---------------------------------------------------------------------- */ void FixOneWay::end_of_step() { - Region *region = domain->regions[regionidx]; region->prematch(); const int idx = direction & XYZMASK; - const double * const * const x = atom->x; - double * const * const v = atom->v; + const double *const *const x = atom->x; + double *const *const v = atom->v; const int *mask = atom->mask; const int nlocal = atom->nlocal; for (int i = 0; i < nlocal; ++i) { - if ((mask[i] & groupbit) && region->match(x[i][0],x[i][1],x[i][2])) { + if ((mask[i] & groupbit) && region->match(x[i][0], x[i][1], x[i][2])) { if (direction & MINUS) { if (v[i][idx] > 0.0) v[i][idx] = -v[i][idx]; } else { @@ -107,4 +105,3 @@ void FixOneWay::end_of_step() } } } - diff --git a/src/EXTRA-FIX/fix_oneway.h b/src/EXTRA-FIX/fix_oneway.h index ad6a5dc106..2a4ecb37e1 100644 --- a/src/EXTRA-FIX/fix_oneway.h +++ b/src/EXTRA-FIX/fix_oneway.h @@ -34,25 +34,11 @@ class FixOneWay : public Fix { protected: int direction; - int regionidx; - char *regionstr; + class Region *region; + char *idregion; }; } // namespace LAMMPS_NS #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: Region for fix oneway does not exist - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_pafi.cpp b/src/EXTRA-FIX/fix_pafi.cpp index fbb6fb2971..d6ee4627c9 100644 --- a/src/EXTRA-FIX/fix_pafi.cpp +++ b/src/EXTRA-FIX/fix_pafi.cpp @@ -178,8 +178,8 @@ void FixPAFI::init() if (utils::strmatch(update->integrate_style,"^respa")) { - step_respa = ((Respa *) update->integrate)->step; // nve - nlevels_respa = ((Respa *) update->integrate)->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; // nve + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); else ilevel_respa = nlevels_respa-1; } @@ -192,9 +192,9 @@ void FixPAFI::setup(int vflag) post_force(vflag); else for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); post_force_respa(vflag,ilevel,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } } diff --git a/src/EXTRA-FIX/fix_pafi.h b/src/EXTRA-FIX/fix_pafi.h index 7cf0bb9856..84040dd279 100644 --- a/src/EXTRA-FIX/fix_pafi.h +++ b/src/EXTRA-FIX/fix_pafi.h @@ -71,29 +71,3 @@ class FixPAFI : public Fix { #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/EXTRA-FIX/fix_rhok.cpp b/src/EXTRA-FIX/fix_rhok.cpp index 5c49878998..9bdf940a7b 100644 --- a/src/EXTRA-FIX/fix_rhok.cpp +++ b/src/EXTRA-FIX/fix_rhok.cpp @@ -96,7 +96,7 @@ void FixRhok::init() { // RESPA boilerplate if (utils::strmatch(update->integrate_style,"^respa")) - mNLevelsRESPA = ((Respa *) update->integrate)->nlevels; + mNLevelsRESPA = (dynamic_cast( update->integrate))->nlevels; // Count the number of affected particles int nThisLocal = 0; @@ -121,9 +121,9 @@ void FixRhok::setup( int inVFlag ) post_force( inVFlag ); else { - ((Respa *) update->integrate)->copy_flevel_f( mNLevelsRESPA - 1 ); + (dynamic_cast( update->integrate))->copy_flevel_f( mNLevelsRESPA - 1 ); post_force_respa( inVFlag, mNLevelsRESPA - 1,0 ); - ((Respa *) update->integrate)->copy_f_flevel( mNLevelsRESPA - 1 ); + (dynamic_cast( update->integrate))->copy_f_flevel( mNLevelsRESPA - 1 ); } } diff --git a/src/EXTRA-FIX/fix_smd.cpp b/src/EXTRA-FIX/fix_smd.cpp index 047f40c2a3..4a0a9f040f 100644 --- a/src/EXTRA-FIX/fix_smd.cpp +++ b/src/EXTRA-FIX/fix_smd.cpp @@ -161,7 +161,7 @@ void FixSMD::init() } if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -173,9 +173,9 @@ void FixSMD::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } @@ -194,7 +194,7 @@ void FixSMD::post_force(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) r_old += v_smd * update->dt; else - r_old += v_smd * ((Respa *) update->integrate)->step[ilevel_respa]; + r_old += v_smd * (dynamic_cast( update->integrate))->step[ilevel_respa]; } } @@ -207,7 +207,7 @@ void FixSMD::smd_tether() double dt = update->dt; if (utils::strmatch(update->integrate_style,"^respa")) - dt = ((Respa *) update->integrate)->step[ilevel_respa]; + dt = (dynamic_cast( update->integrate))->step[ilevel_respa]; // fx,fy,fz = components of k * (r-r0) @@ -313,7 +313,7 @@ void FixSMD::smd_couple() double dt = update->dt; if (utils::strmatch(update->integrate_style,"^respa")) - dt = ((Respa *) update->integrate)->step[ilevel_respa]; + dt = (dynamic_cast( update->integrate))->step[ilevel_respa]; // renormalize direction of spring double dx,dy,dz,r,dr; @@ -451,7 +451,7 @@ void FixSMD::write_restart(FILE *fp) void FixSMD::restart(char *buf) { - double *list = (double *)buf; + auto list = (double *)buf; r_old = list[0]; xn=list[1]; yn=list[2]; diff --git a/src/EXTRA-FIX/fix_spring_rg.cpp b/src/EXTRA-FIX/fix_spring_rg.cpp index a6bdbd3631..b955716923 100644 --- a/src/EXTRA-FIX/fix_spring_rg.cpp +++ b/src/EXTRA-FIX/fix_spring_rg.cpp @@ -79,7 +79,7 @@ void FixSpringRG::init() } if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -91,9 +91,9 @@ void FixSpringRG::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } @@ -175,7 +175,7 @@ void FixSpringRG::write_restart(FILE *fp) void FixSpringRG::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; rg0 = list[n++]; rg0_flag = 0; diff --git a/src/EXTRA-FIX/fix_spring_rg.h b/src/EXTRA-FIX/fix_spring_rg.h index d0cb93e25e..76bd78526e 100644 --- a/src/EXTRA-FIX/fix_spring_rg.h +++ b/src/EXTRA-FIX/fix_spring_rg.h @@ -45,13 +45,3 @@ class FixSpringRG : public Fix { #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. - -*/ diff --git a/src/EXTRA-FIX/fix_temp_csld.cpp b/src/EXTRA-FIX/fix_temp_csld.cpp index f4da7a3c5b..e83eca424e 100644 --- a/src/EXTRA-FIX/fix_temp_csld.cpp +++ b/src/EXTRA-FIX/fix_temp_csld.cpp @@ -323,7 +323,7 @@ void FixTempCSLD::write_restart(FILE *fp) void FixTempCSLD::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; energy = list[0]; int nprocs = (int) list[1]; diff --git a/src/EXTRA-FIX/fix_temp_csld.h b/src/EXTRA-FIX/fix_temp_csld.h index f6a2970389..da2751fa5c 100644 --- a/src/EXTRA-FIX/fix_temp_csld.h +++ b/src/EXTRA-FIX/fix_temp_csld.h @@ -57,51 +57,3 @@ class FixTempCSLD : public Fix { #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: Fix temp/csld is not compatible with fix rattle or fix shake - -These two commands cannot currently be used together with fix temp/csld. - -E: Variable name for fix temp/csld does not exist - -Self-explanatory. - -E: Variable for fix temp/csld is invalid style - -Only equal-style variables can be used. - -E: Temperature ID for fix temp/csld does not exist - -Self-explanatory. - -W: Cannot thermostat atoms in rigid bodies - -UNDOCUMENTED - -E: Fix temp/csld variable returned negative temperature - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/EXTRA-FIX/fix_temp_csvr.cpp b/src/EXTRA-FIX/fix_temp_csvr.cpp index ca9e4b8684..0c4742018a 100644 --- a/src/EXTRA-FIX/fix_temp_csvr.cpp +++ b/src/EXTRA-FIX/fix_temp_csvr.cpp @@ -357,7 +357,7 @@ void FixTempCSVR::write_restart(FILE *fp) void FixTempCSVR::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; energy = list[0]; int nprocs = (int) list[1]; diff --git a/src/EXTRA-FIX/fix_temp_csvr.h b/src/EXTRA-FIX/fix_temp_csvr.h index c1b4dbfd93..6749bee872 100644 --- a/src/EXTRA-FIX/fix_temp_csvr.h +++ b/src/EXTRA-FIX/fix_temp_csvr.h @@ -61,43 +61,3 @@ class FixTempCSVR : public Fix { #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: Variable name for fix temp/csvr does not exist - -Self-explanatory. - -E: Variable for fix temp/csvr is invalid style - -Only equal-style variables can be used. - -E: Temperature ID for fix temp/csvr does not exist - -Self-explanatory. - -E: Fix temp/csvr variable returned negative temperature - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/EXTRA-FIX/fix_ti_spring.cpp b/src/EXTRA-FIX/fix_ti_spring.cpp index 231da9e8ee..b332c18148 100644 --- a/src/EXTRA-FIX/fix_ti_spring.cpp +++ b/src/EXTRA-FIX/fix_ti_spring.cpp @@ -143,7 +143,7 @@ int FixTISpring::setmask() void FixTISpring::init() { if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -153,9 +153,9 @@ void FixTISpring::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } diff --git a/src/EXTRA-FIX/fix_ti_spring.h b/src/EXTRA-FIX/fix_ti_spring.h index d2f02f8a3e..990c650f94 100644 --- a/src/EXTRA-FIX/fix_ti_spring.h +++ b/src/EXTRA-FIX/fix_ti_spring.h @@ -77,19 +77,3 @@ class FixTISpring : public Fix { #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: Illegal fix ti/spring switching function - -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. - -*/ diff --git a/src/EXTRA-FIX/fix_tmd.cpp b/src/EXTRA-FIX/fix_tmd.cpp index 8ee6e3e141..1404682cda 100644 --- a/src/EXTRA-FIX/fix_tmd.cpp +++ b/src/EXTRA-FIX/fix_tmd.cpp @@ -167,7 +167,7 @@ void FixTMD::init() dtv = update->dt; dtf = update->dt * force->ftm2v; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } /* ---------------------------------------------------------------------- */ @@ -389,7 +389,7 @@ void FixTMD::readfile(char *file) int *mask = atom->mask; int nlocal = atom->nlocal; - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; char *next,*bufptr; int i,m,nlines,imageflag,ix,iy,iz; tagint itag; diff --git a/src/EXTRA-FIX/fix_tmd.h b/src/EXTRA-FIX/fix_tmd.h index 9ba8ad6096..fa3c2e6665 100644 --- a/src/EXTRA-FIX/fix_tmd.h +++ b/src/EXTRA-FIX/fix_tmd.h @@ -59,59 +59,3 @@ class FixTMD : public Fix { #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: Cannot use fix TMD unless atom map exists - -Using this fix requires the ability to lookup an atom index, which is -provided by an atom map. An atom map does not exist (by default) for -non-molecular problems. Using the atom_modify map command will force -an atom map to be created. - -E: Cannot open fix tmd file %s - -The output file for the fix tmd command cannot be opened. Check that -the path and name are correct. - -E: Cannot use fix TMD on massless group - -UNDOCUMENTED - -E: Fix tmd must come after integration fixes - -Any fix tmd command must appear in the input script after all time -integration fixes (nve, nvt, npt). See the fix tmd documentation for -details. - -E: Incorrect format in TMD target file - -Format of file read by fix tmd command is incorrect. - -W: Ignoring empty or incorrectly formatted line in target file - -UNDOCUMENTED - -E: TMD target file did not list all group atoms - -The target file for the fix tmd command did not list all atoms in the -fix group. - -E: Cannot open gzipped file - -LAMMPS was compiled without support for reading and writing gzipped -files through a pipeline to the gzip program with -DLAMMPS_GZIP. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -*/ diff --git a/src/EXTRA-FIX/fix_ttm.cpp b/src/EXTRA-FIX/fix_ttm.cpp index 752610fd08..9184983bdb 100644 --- a/src/EXTRA-FIX/fix_ttm.cpp +++ b/src/EXTRA-FIX/fix_ttm.cpp @@ -241,7 +241,7 @@ void FixTTM::init() } if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -251,9 +251,9 @@ void FixTTM::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) { post_force_setup(vflag); } else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa_setup(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } @@ -597,7 +597,7 @@ void FixTTM::write_restart(FILE *fp) void FixTTM::restart(char *buf) { int n = 0; - double *rlist = (double *) buf; + auto rlist = (double *) buf; // check that restart grid size is same as current grid size diff --git a/src/EXTRA-FIX/fix_ttm.h b/src/EXTRA-FIX/fix_ttm.h index bbaf0b6429..57a3e0f2ac 100644 --- a/src/EXTRA-FIX/fix_ttm.h +++ b/src/EXTRA-FIX/fix_ttm.h @@ -82,84 +82,3 @@ class FixTTM : public Fix { #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: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -E: Cannot open fix ttm file %s - -The output file for the fix ttm command cannot be opened. Check that -the path and name are correct. - -E: Invalid random number seed in fix ttm command - -Random number seed must be > 0. - -E: Fix ttm electronic_specific_heat must be > 0.0 - -Self-explanatory. - -E: Fix ttm electronic_density must be > 0.0 - -Self-explanatory. - -E: Fix ttm electronic_thermal_conductivity must be >= 0.0 - -Self-explanatory. - -E: Fix ttm gamma_p must be > 0.0 - -Self-explanatory. - -E: Fix ttm gamma_s must be >= 0.0 - -Self-explanatory. - -E: Fix ttm v_0 must be >= 0.0 - -Self-explanatory. - -E: Fix ttm number of nodes must be > 0 - -Self-explanatory. - -E: Cannot use fix ttm with 2d simulation - -This is a current restriction of this fix due to the grid it creates. - -E: Cannot use non-periodic boundares with fix ttm - -This fix requires a fully periodic simulation box. - -E: Cannot use fix ttm with triclinic box - -This is a current restriction of this fix due to the grid it creates. - -E: Electronic temperature dropped below zero - -Something has gone wrong with the fix ttm electron temperature model. - -E: Fix ttm electron temperatures must be > 0.0 - -Self-explanatory. - -E: Initial temperatures not all set in fix ttm - -Self-explanatory. - -W: Too many inner timesteps in fix ttm - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_ttm_grid.cpp b/src/EXTRA-FIX/fix_ttm_grid.cpp index 8890750818..5e6022af58 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.cpp +++ b/src/EXTRA-FIX/fix_ttm_grid.cpp @@ -280,7 +280,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) // read electron temperature values from file, one chunk at a time - char *buffer = new char[CHUNK * MAXLINE]; + auto buffer = new char[CHUNK * MAXLINE]; bigint ntotal = (bigint) nxgrid * nygrid * nzgrid; bigint nread = 0; @@ -297,7 +297,7 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) try { ValueTokenizer values(utils::trim_comment(line)); if (values.count() == 0) { - ; // ignore comment only lines + ; // ignore comment only lines } else if (values.count() == 4) { ++nread; @@ -306,18 +306,18 @@ void FixTTMGrid::read_electron_temperatures(const std::string &filename) int iz = values.next_int(); if (ix < 0 || ix >= nxgrid || iy < 0 || iy >= nygrid || iz < 0 || iz >= nzgrid) - throw TokenizerException("Fix ttm/grid invalid grid index in input",""); + throw TokenizerException("Fix ttm/grid invalid grid index in input", ""); - if (ix >= nxlo_in && ix <= nxhi_in && iy >= nylo_in && iy <= nyhi_in - && iz >= nzlo_in && iz <= nzhi_in) { + if (ix >= nxlo_in && ix <= nxhi_in && iy >= nylo_in && iy <= nyhi_in && iz >= nzlo_in && + iz <= nzhi_in) { T_electron[iz][iy][ix] = values.next_double(); T_initial_set[iz][iy][ix] = 1; } } else { - throw TokenizerException("Incorrect format in fix ttm electron grid file",""); + throw TokenizerException("Incorrect format in fix ttm electron grid file", ""); } } catch (std::exception &e) { - error->one(FLERR,e.what()); + error->one(FLERR, e.what()); } } } @@ -356,9 +356,11 @@ void FixTTMGrid::write_electron_temperatures(const std::string &filename) FPout = fopen(filename.c_str(), "w"); if (!FPout) error->one(FLERR, "Fix ttm/grid could not open output file"); - fmt::print(FPout,"# DATE: {} UNITS: {} COMMENT: Electron temperature " - "{}x{}x{} grid at step {}. Created by fix {}\n", utils::current_date(), - update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, style); + fmt::print(FPout, + "# DATE: {} UNITS: {} COMMENT: Electron temperature " + "{}x{}x{} grid at step {}. Created by fix {}\n", + utils::current_date(), update->unit_style, nxgrid, nygrid, nzgrid, update->ntimestep, + style); } gc->gather(GridComm::FIX, this, 1, sizeof(double), 1, nullptr, MPI_DOUBLE); @@ -372,7 +374,7 @@ void FixTTMGrid::write_electron_temperatures(const std::string &filename) void FixTTMGrid::pack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *src = &T_electron[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) buf[i] = src[list[i]]; @@ -384,7 +386,7 @@ void FixTTMGrid::pack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *lis void FixTTMGrid::unpack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *dest = &T_electron[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) dest[list[i]] = buf[i]; @@ -396,7 +398,7 @@ void FixTTMGrid::unpack_forward_grid(int /*flag*/, void *vbuf, int nlist, int *l void FixTTMGrid::pack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *src = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) buf[i] = src[list[i]]; @@ -408,7 +410,7 @@ void FixTTMGrid::pack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *lis void FixTTMGrid::unpack_reverse_grid(int /*flag*/, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; double *dest = &net_energy_transfer[nzlo_out][nylo_out][nxlo_out]; for (int i = 0; i < nlist; i++) dest[list[i]] += buf[i]; @@ -535,7 +537,7 @@ void FixTTMGrid::restart(char *buf) int ix, iy, iz; int n = 0; - double *rlist = (double *) buf; + auto rlist = (double *) buf; // check that restart grid size is same as current grid size @@ -578,7 +580,7 @@ void FixTTMGrid::pack_gather_grid(int /*which*/, void *vbuf) { int ix, iy, iz; - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int m = 0; for (iz = nzlo_in; iz <= nzhi_in; iz++) @@ -596,8 +598,8 @@ void FixTTMGrid::unpack_gather_grid(int which, void *vbuf, void *vgbuf, int xlo, { int ix, iy, iz; - double *buf = (double *) vbuf; - double *gbuf = (double *) vgbuf; + auto buf = (double *) vbuf; + auto gbuf = (double *) vgbuf; if (which == 0) { int iglobal; diff --git a/src/EXTRA-FIX/fix_ttm_grid.h b/src/EXTRA-FIX/fix_ttm_grid.h index aeb1106e42..f6f467fce0 100644 --- a/src/EXTRA-FIX/fix_ttm_grid.h +++ b/src/EXTRA-FIX/fix_ttm_grid.h @@ -48,16 +48,16 @@ class FixTTMGrid : public FixTTM { double memory_usage() override; private: - int ngridmine,ngridout; - int nxlo_in,nxhi_in,nylo_in,nyhi_in,nzlo_in,nzhi_in; - int nxlo_out,nxhi_out,nylo_out,nyhi_out,nzlo_out,nzhi_out; - double delxinv,delyinv,delzinv; + int ngridmine, ngridout; + int nxlo_in, nxhi_in, nylo_in, nyhi_in, nzlo_in, nzhi_in; + int nxlo_out, nxhi_out, nylo_out, nyhi_out, nzlo_out, nzhi_out; + double delxinv, delyinv, delzinv; double skin_original; FILE *FPout; class GridComm *gc; - int ngc_buf1,ngc_buf2; - double *gc_buf1,*gc_buf2; + int ngc_buf1, ngc_buf2; + double *gc_buf1, *gc_buf2; void allocate_grid() override; void deallocate_grid() override; @@ -69,84 +69,3 @@ class FixTTMGrid : public FixTTM { #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: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -E: Cannot open fix ttm file %s - -The output file for the fix ttm command cannot be opened. Check that -the path and name are correct. - -E: Invalid random number seed in fix ttm command - -Random number seed must be > 0. - -E: Fix ttm electronic_specific_heat must be > 0.0 - -Self-explanatory. - -E: Fix ttm electronic_density must be > 0.0 - -Self-explanatory. - -E: Fix ttm electronic_thermal_conductivity must be >= 0.0 - -Self-explanatory. - -E: Fix ttm gamma_p must be > 0.0 - -Self-explanatory. - -E: Fix ttm gamma_s must be >= 0.0 - -Self-explanatory. - -E: Fix ttm v_0 must be >= 0.0 - -Self-explanatory. - -E: Fix ttm number of nodes must be > 0 - -Self-explanatory. - -E: Cannot use fix ttm with 2d simulation - -This is a current restriction of this fix due to the grid it creates. - -E: Cannot use non-periodic boundares with fix ttm - -This fix requires a fully periodic simulation box. - -E: Cannot use fix ttm with triclinic box - -This is a current restriction of this fix due to the grid it creates. - -E: Electronic temperature dropped below zero - -Something has gone wrong with the fix ttm electron temperature model. - -E: Fix ttm electron temperatures must be > 0.0 - -Self-explanatory. - -E: Initial temperatures not all set in fix ttm - -Self-explanatory. - -W: Too many inner timesteps in fix ttm - -Self-explanatory. - -*/ diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index a2c03db762..8979a30bf4 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -271,7 +271,7 @@ void FixTTMMod::init() net_energy_transfer_all[ix][iy][iz] = 0; if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -281,9 +281,9 @@ void FixTTMMod::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) { post_force_setup(vflag); } else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa_setup(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } @@ -435,121 +435,146 @@ void FixTTMMod::reset_dt() void FixTTMMod::read_parameters(const std::string &filename) { - try { - PotentialFileReader reader(lmp, filename, "ttm/mod parameter"); + if (comm->me == 0) { - // C0 (metal) + try { + PotentialFileReader reader(lmp, filename, "ttm/mod parameter"); - reader.next_line(); - esheat_0 = reader.next_values(1).next_double(); + // C0 (metal) - // C1 (metal*10^3) + reader.next_line(); + esheat_0 = reader.next_values(1).next_double(); - reader.next_line(); - esheat_1 = reader.next_values(1).next_double(); + // C1 (metal*10^3) - // C2 (metal*10^6) + reader.next_line(); + esheat_1 = reader.next_values(1).next_double(); - reader.next_line(); - esheat_2 = reader.next_values(1).next_double(); + // C2 (metal*10^6) - // C3 (metal*10^9) + reader.next_line(); + esheat_2 = reader.next_values(1).next_double(); - reader.next_line(); - esheat_3 = reader.next_values(1).next_double(); + // C3 (metal*10^9) - // C4 (metal*10^12) + reader.next_line(); + esheat_3 = reader.next_values(1).next_double(); - reader.next_line(); - esheat_4 = reader.next_values(1).next_double(); + // C4 (metal*10^12) - // C_limit + reader.next_line(); + esheat_4 = reader.next_values(1).next_double(); - reader.next_line(); - C_limit = reader.next_values(1).next_double(); + // C_limit - // Temperature damping factor + reader.next_line(); + C_limit = reader.next_values(1).next_double(); - reader.next_line(); - T_damp = reader.next_values(1).next_double(); + // Temperature damping factor - // rho_e + reader.next_line(); + T_damp = reader.next_values(1).next_double(); - reader.next_line(); - electronic_density = reader.next_values(1).next_double(); + // rho_e - // thermal_diffusion + reader.next_line(); + electronic_density = reader.next_values(1).next_double(); - reader.next_line(); - el_th_diff = reader.next_values(1).next_double(); + // thermal_diffusion - // gamma_p + reader.next_line(); + el_th_diff = reader.next_values(1).next_double(); - reader.next_line(); - gamma_p = reader.next_values(1).next_double(); + // gamma_p - // gamma_s + reader.next_line(); + gamma_p = reader.next_values(1).next_double(); - reader.next_line(); - gamma_s = reader.next_values(1).next_double(); + // gamma_s - // v0 + reader.next_line(); + gamma_s = reader.next_values(1).next_double(); - reader.next_line(); - v_0 = reader.next_values(1).next_double(); + // v0 - // average intensity of pulse (source of energy) (metal units) + reader.next_line(); + v_0 = reader.next_values(1).next_double(); - reader.next_line(); - intensity = reader.next_values(1).next_double(); + // average intensity of pulse (source of energy) (metal units) - // coordinate of 1st surface in x-direction (in box units) - constant + reader.next_line(); + intensity = reader.next_values(1).next_double(); - reader.next_line(); - surface_l = reader.next_values(1).next_int(); + // coordinate of 1st surface in x-direction (in box units) - constant - // coordinate of 2nd surface in x-direction (in box units) - constant + reader.next_line(); + surface_l = reader.next_values(1).next_int(); - reader.next_line(); - surface_r = reader.next_values(1).next_int(); + // coordinate of 2nd surface in x-direction (in box units) - constant - // skin_layer = intensity is reduced (I=I0*exp[-x/skin_layer]) + reader.next_line(); + surface_r = reader.next_values(1).next_int(); - reader.next_line(); - skin_layer = reader.next_values(1).next_int(); + // skin_layer = intensity is reduced (I=I0*exp[-x/skin_layer]) - // width of pulse (picoseconds) + reader.next_line(); + skin_layer = reader.next_values(1).next_int(); - reader.next_line(); - width = reader.next_values(1).next_double(); + // width of pulse (picoseconds) - // factor of electronic pressure (PF) Pe = PF*Ce*Te + reader.next_line(); + width = reader.next_values(1).next_double(); - reader.next_line(); - pres_factor = reader.next_values(1).next_double(); + // factor of electronic pressure (PF) Pe = PF*Ce*Te - // effective free path of electrons (angstrom) + reader.next_line(); + pres_factor = reader.next_values(1).next_double(); - reader.next_line(); - free_path = reader.next_values(1).next_double(); + // effective free path of electrons (angstrom) - // ionic density (ions*angstrom^{-3}) + reader.next_line(); + free_path = reader.next_values(1).next_double(); - reader.next_line(); - ionic_density = reader.next_values(1).next_double(); + // ionic density (ions*angstrom^{-3}) - // if movsur = 0: surface is frozen + reader.next_line(); + ionic_density = reader.next_values(1).next_double(); - reader.next_line(); - movsur = reader.next_values(1).next_int(); + // if movsur = 0: surface is frozen - // electron_temperature_min + reader.next_line(); + movsur = reader.next_values(1).next_int(); - reader.next_line(); - electron_temperature_min = reader.next_values(1).next_double(); - } catch (std::exception &e) { - error->one(FLERR,e.what()); + // electron_temperature_min + + reader.next_line(); + electron_temperature_min = reader.next_values(1).next_double(); + } catch (std::exception &e) { + error->one(FLERR,e.what()); + } } + MPI_Bcast(&esheat_0, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&esheat_1, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&esheat_2, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&esheat_3, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&esheat_4, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&C_limit, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&T_damp, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&electronic_density, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&el_th_diff, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma_p, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&gamma_s, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&v_0, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&intensity, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&surface_l, 1, MPI_INT, 0, world); + MPI_Bcast(&surface_r, 1, MPI_INT, 0, world); + MPI_Bcast(&skin_layer, 1, MPI_INT, 0, world); + MPI_Bcast(&width, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&pres_factor, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&free_path, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&ionic_density, 1, MPI_DOUBLE, 0, world); + MPI_Bcast(&movsur, 1, MPI_INT, 0, world); + MPI_Bcast(&electron_temperature_min, 1, MPI_DOUBLE, 0, world); } /* ---------------------------------------------------------------------- @@ -789,9 +814,9 @@ void FixTTMMod::end_of_step() if (left_x == -1) left_x = nxgrid - 1; if (left_y == -1) left_y = nygrid - 1; if (left_z == -1) left_z = nzgrid - 1; - double skin_layer_d = double(skin_layer); - double ix_d = double(ix); - double surface_d = double(t_surface_l); + auto skin_layer_d = double(skin_layer); + auto ix_d = double(ix); + auto surface_d = double(t_surface_l); mult_factor = 0.0; if (duration < width) { if (ix >= t_surface_l) mult_factor = (intensity/(dx*skin_layer_d))*exp((-1.0)*(ix_d - surface_d)/skin_layer_d); @@ -937,7 +962,7 @@ void FixTTMMod::write_restart(FILE *fp) void FixTTMMod::restart(char *buf) { int n = 0; - double *rlist = (double *) buf; + auto rlist = (double *) buf; // check that restart grid size is same as current grid size diff --git a/src/EXTRA-FIX/fix_viscosity.h b/src/EXTRA-FIX/fix_viscosity.h index e46dbafe84..9ff4ddf2de 100644 --- a/src/EXTRA-FIX/fix_viscosity.h +++ b/src/EXTRA-FIX/fix_viscosity.h @@ -51,30 +51,3 @@ class FixViscosity : public Fix { #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: Fix viscosity swap value must be positive - -Self-explanatory. - -E: Fix viscosity vtarget value must be positive - -Self-explanatory. - -W: Fix viscosity comes before fix ave/spatial - -The order of these 2 fixes in your input script is such that -fix viscosity comes first. If you are using fix ave/spatial -to measure the velocity profile induced by fix viscosity, then -this may cause a glitch in the profile since you are averaging -immediately after swaps have occurred. Flipping the order -of the 2 fixes typically helps. - -*/ diff --git a/src/EXTRA-FIX/fix_viscous_sphere.cpp b/src/EXTRA-FIX/fix_viscous_sphere.cpp index e0a4f910ed..771b6f1c10 100644 --- a/src/EXTRA-FIX/fix_viscous_sphere.cpp +++ b/src/EXTRA-FIX/fix_viscous_sphere.cpp @@ -114,7 +114,7 @@ void FixViscousSphere::init() int max_respa = 0; if (utils::strmatch(update->integrate_style, "^respa")) { - ilevel_respa = max_respa = ((Respa *) update->integrate)->nlevels - 1; + ilevel_respa = max_respa = (dynamic_cast(update->integrate))->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, max_respa); } @@ -135,9 +135,9 @@ void FixViscousSphere::setup(int vflag) if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag, ilevel_respa, 0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/EXTRA-FIX/fix_viscous_sphere.h b/src/EXTRA-FIX/fix_viscous_sphere.h index fc85deee86..e95ff3f74c 100644 --- a/src/EXTRA-FIX/fix_viscous_sphere.h +++ b/src/EXTRA-FIX/fix_viscous_sphere.h @@ -48,13 +48,3 @@ class FixViscousSphere : public Fix { #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. - -*/ diff --git a/src/EXTRA-FIX/fix_wall_ees.cpp b/src/EXTRA-FIX/fix_wall_ees.cpp index 26ed4f52f1..8b30e4a0be 100644 --- a/src/EXTRA-FIX/fix_wall_ees.cpp +++ b/src/EXTRA-FIX/fix_wall_ees.cpp @@ -50,7 +50,7 @@ void FixWallEES::precompute(int m) /* ---------------------------------------------------------------------- */ void FixWallEES::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Fix wall/ees requires atom style ellipsoid"); @@ -85,7 +85,7 @@ void FixWallEES::wall_particle(int m, int which, double coord) double **f = atom->f; double **tor = atom->torque; - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); AtomVecEllipsoid::Bonus *bonus = avec->bonus; int *ellipsoid = atom->ellipsoid; int *mask = atom->mask; diff --git a/src/EXTRA-FIX/fix_wall_ees.h b/src/EXTRA-FIX/fix_wall_ees.h index af235af13b..c6935605c2 100644 --- a/src/EXTRA-FIX/fix_wall_ees.h +++ b/src/EXTRA-FIX/fix_wall_ees.h @@ -40,12 +40,3 @@ class FixWallEES : public FixWall { #endif #endif - -/* ERROR/WARNING messages: - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/EXTRA-FIX/fix_wall_reflect_stochastic.h b/src/EXTRA-FIX/fix_wall_reflect_stochastic.h index e1794376cf..6abe194077 100644 --- a/src/EXTRA-FIX/fix_wall_reflect_stochastic.h +++ b/src/EXTRA-FIX/fix_wall_reflect_stochastic.h @@ -43,37 +43,3 @@ class FixWallReflectStochastic : public FixWallReflect { #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: Wall defined twice in fix wall/stochastic command - -Self-explanatory. - -E: Cannot use fix wall/stochastic in periodic dimension - -Self-explanatory. - -E: Cannot use fix wall/stochastic zlo/zhi for a 2d simulation - -Self-explanatory. - -E: Variable name for fix wall/stochastic does not exist - -Self-explanatory. - -E: Variable for fix wall/stochastic is invalid style - -Only equal-style variables can be used. - -W: Should not allow rigid bodies to bounce off relecting walls - -LAMMPS allows this, but their dynamics are not computed correctly. - -*/ diff --git a/src/EXTRA-FIX/fix_wall_region_ees.cpp b/src/EXTRA-FIX/fix_wall_region_ees.cpp index 261036333e..a9f6205373 100644 --- a/src/EXTRA-FIX/fix_wall_region_ees.cpp +++ b/src/EXTRA-FIX/fix_wall_region_ees.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -23,6 +22,7 @@ #include "domain.h" #include "error.h" #include "math_extra.h" +#include "math_special.h" #include "region.h" #include "respa.h" #include "update.h" @@ -31,13 +31,14 @@ using namespace LAMMPS_NS; using namespace FixConst; +using MathSpecial::powint; /* ---------------------------------------------------------------------- */ FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) + Fix(lmp, narg, arg), idregion(nullptr), region(nullptr) { - if (narg != 7) error->all(FLERR,"Illegal fix wall/region/ees command"); + if (narg != 7) error->all(FLERR, "Illegal fix wall/region/ees command"); scalar_flag = 1; vector_flag = 1; @@ -49,15 +50,14 @@ FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) : // parse args - iregion = domain->find_region(arg[3]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix wall/region/ees does not exist"); + region = domain->get_region_by_id(arg[3]); + if (!region) error->all(FLERR, "Region {} for fix wall/region/ees does not exist", arg[3]); idregion = utils::strdup(arg[3]); - epsilon = utils::numeric(FLERR,arg[4],false,lmp); - sigma = utils::numeric(FLERR,arg[5],false,lmp); - cutoff = utils::numeric(FLERR,arg[6],false,lmp); + 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"); + if (cutoff <= 0.0) error->all(FLERR, "Fix wall/region/ees cutoff <= 0.0"); eflag = 0; ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0; @@ -67,7 +67,7 @@ FixWallRegionEES::FixWallRegionEES(LAMMPS *lmp, int narg, char **arg) : FixWallRegionEES::~FixWallRegionEES() { - delete [] idregion; + delete[] idregion; } /* ---------------------------------------------------------------------- */ @@ -87,13 +87,11 @@ void FixWallRegionEES::init() { // set index and check validity of region - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix wall/region/ees does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix wall/region/ees does not exist", idregion); - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - if (!avec) - error->all(FLERR,"Fix wall/region/ees requires atom style ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); + if (!avec) error->all(FLERR, "Fix wall/region/ees requires atom style ellipsoid"); // check that all particles are finite-size ellipsoids // no point particles allowed, spherical is OK @@ -105,33 +103,33 @@ void FixWallRegionEES::init() for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) if (ellipsoid[i] < 0) - error->one(FLERR,"Fix wall/region/ees requires extended particles"); + error->one(FLERR, "Fix wall/region/ees requires only extended particles"); // setup coefficients - coeff1 = ( 2. / 4725. ) * epsilon * pow(sigma,12.0); - coeff2 = ( 1. / 24. ) * epsilon * pow(sigma,6.0); - coeff3 = ( 2. / 315. ) * epsilon * pow(sigma,12.0); - coeff4 = ( 1. / 3. ) * epsilon * pow(sigma,6.0); - coeff5 = ( 4. / 315. ) * epsilon * pow(sigma,12.0); - coeff6 = ( 1. / 12. ) * epsilon * pow(sigma,6.0); + coeff1 = (2.0 / 4725.0) * epsilon * powint(sigma, 12); + coeff2 = (1.0 / 24.0) * epsilon * powint(sigma, 6); + coeff3 = (2.0 / 315.0) * epsilon * powint(sigma, 12); + coeff4 = (1.0 / 3.0) * epsilon * powint(sigma, 6); + coeff5 = (4.0 / 315.0) * epsilon * powint(sigma, 12); + coeff6 = (1.0 / 12.0) * epsilon * powint(sigma, 6); offset = 0; - - if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + if (utils::strmatch(update->integrate_style, "^respa")) + nlevels_respa = (dynamic_cast(update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ void FixWallRegionEES::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(update->integrate_style, "^respa")) { + auto respa = dynamic_cast(update->integrate); + respa->copy_flevel_f(nlevels_respa - 1); + post_force_respa(vflag, nlevels_respa - 1, 0); + respa->copy_f_flevel(nlevels_respa - 1); + } else { post_force(vflag); - else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); - post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); } } @@ -139,7 +137,7 @@ void FixWallRegionEES::setup(int vflag) void FixWallRegionEES::min_setup(int vflag) { - post_force(vflag); + post_force(vflag); } /* ---------------------------------------------------------------------- */ @@ -149,8 +147,8 @@ void FixWallRegionEES::post_force(int /*vflag*/) //sth is needed here, but I dont know what //that is calculation of sn - int i,m,n; - double rinv,fx,fy,fz,sn,tooclose[3]; + int i, m, n; + double rinv, fx, fy, fz, sn, tooclose[3]; eflag = 0; ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0; @@ -165,7 +163,6 @@ void FixWallRegionEES::post_force(int /*vflag*/) int *mask = atom->mask; int nlocal = atom->nlocal; - Region *region = domain->regions[iregion]; region->prematch(); int onflag = 0; @@ -176,33 +173,34 @@ void FixWallRegionEES::post_force(int /*vflag*/) for (i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (!region->match(x[i][0],x[i][1],x[i][2])) { + if (!region->match(x[i][0], x[i][1], x[i][2])) { onflag = 1; continue; } - double A[3][3] = {{0,0,0},{0,0,0},{0,0,0}}; - double tempvec[3]= {0,0,0}; + double A[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; + double tempvec[3] = {0, 0, 0}; double sn2 = 0.0; - double nhat[3] = {0,0,0}; - double* shape = bonus[ellipsoid[i]].shape;; - MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); + double nhat[3] = {0, 0, 0}; + double *shape = bonus[ellipsoid[i]].shape; + ; + MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat, A); - for (int which = 0 ; which < 3; which ++) {//me - nhat[which]=1; - nhat[(which+1)%3] = 0 ; - nhat[(which+2)%3] = 0 ; - sn2 = 0 ; - MathExtra::transpose_matvec(A,nhat,tempvec); - for (int k = 0; k<3; k++) { + for (int which = 0; which < 3; which++) { //me + nhat[which] = 1; + nhat[(which + 1) % 3] = 0; + nhat[(which + 2) % 3] = 0; + sn2 = 0; + MathExtra::transpose_matvec(A, nhat, tempvec); + for (int k = 0; k < 3; k++) { tempvec[k] *= shape[k]; - sn2 += tempvec[k]*tempvec[k]; + sn2 += tempvec[k] * tempvec[k]; } sn = sqrt(sn2); tooclose[which] = sn; } - n = region->surface(x[i][0],x[i][1],x[i][2],cutoff); + n = region->surface(x[i][0], x[i][1], x[i][2], cutoff); for (m = 0; m < n; m++) { @@ -212,12 +210,13 @@ void FixWallRegionEES::post_force(int /*vflag*/) } else if (region->contact[m].dely != 0 && region->contact[m].r <= tooclose[1]) { onflag = 1; continue; - } else if (region->contact[m].delz !=0 && region->contact[m].r <= tooclose[2]) { + } else if (region->contact[m].delz != 0 && region->contact[m].r <= tooclose[2]) { onflag = 1; continue; - } else rinv = 1.0/region->contact[m].r; + } else + rinv = 1.0 / region->contact[m].r; - ees(m,i); + ees(m, i); ewall[0] += eng; fx = fwall * region->contact[m].delx * rinv; @@ -237,15 +236,15 @@ void FixWallRegionEES::post_force(int /*vflag*/) } } - if (onflag) error->one(FLERR,"Particle on or inside surface of region " - "used in fix wall/region/ees"); + if (onflag) + error->one(FLERR, "Particle on or inside surface of region used in fix wall/region/ees"); } /* ---------------------------------------------------------------------- */ void FixWallRegionEES::post_force_respa(int vflag, int ilevel, int /*iloop*/) { - if (ilevel == nlevels_respa-1) post_force(vflag); + if (ilevel == nlevels_respa - 1) post_force(vflag); } /* ---------------------------------------------------------------------- */ @@ -264,7 +263,7 @@ double FixWallRegionEES::compute_scalar() // only sum across procs one time if (eflag == 0) { - MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(ewall, ewall_all, 4, MPI_DOUBLE, MPI_SUM, world); eflag = 1; } return ewall_all[0]; @@ -279,10 +278,10 @@ double FixWallRegionEES::compute_vector(int n) // only sum across procs one time if (eflag == 0) { - MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(ewall, ewall_all, 4, MPI_DOUBLE, MPI_SUM, world); eflag = 1; } - return ewall_all[n+1]; + return ewall_all[n + 1]; } /* ---------------------------------------------------------------------- @@ -292,24 +291,23 @@ double FixWallRegionEES::compute_vector(int n) void FixWallRegionEES::ees(int m, int i) { - Region *region = domain->regions[iregion]; region->prematch(); double delta, delta2, delta3, delta4, delta5, delta6; - double sigman, sigman2 , sigman3, sigman4, sigman5, sigman6; - double hhss, hhss2, hhss4, hhss7, hhss8; //h^2 - s_n^2 - double hps; //h+s_n - double hms; //h-s_n + double sigman, sigman2, sigman3, sigman4, sigman5, sigman6; + double hhss, hhss2, hhss4, hhss7, hhss8; //h^2 - s_n^2 + double hps; //h+s_n + double hms; //h-s_n double twall; double A[3][3], nhat[3], SAn[3], that[3]; - double tempvec[3]= {0,0,0}; - double tempvec2[3]= {0,0,0}; + double tempvec[3] = {0, 0, 0}; + double tempvec2[3] = {0, 0, 0}; - double Lx[3][3] = {{0,0,0},{0,0,-1},{0,1,0}}; - double Ly[3][3] = {{0,0,1},{0,0,0},{-1,0,0}}; - double Lz[3][3] = {{0,-1,0},{1,0,0},{0,0,0}}; + double Lx[3][3] = {{0, 0, 0}, {0, 0, -1}, {0, 1, 0}}; + double Ly[3][3] = {{0, 0, 1}, {0, 0, 0}, {-1, 0, 0}}; + double Lz[3][3] = {{0, -1, 0}, {1, 0, 0}, {0, 0, 0}}; nhat[0] = region->contact[m].delx / region->contact[m].r; nhat[1] = region->contact[m].dely / region->contact[m].r; @@ -318,14 +316,15 @@ void FixWallRegionEES::ees(int m, int i) AtomVecEllipsoid::Bonus *bonus = avec->bonus; int *ellipsoid = atom->ellipsoid; - double* shape = bonus[ellipsoid[i]].shape;; - MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat,A); + double *shape = bonus[ellipsoid[i]].shape; + ; + MathExtra::quat_to_mat(bonus[ellipsoid[i]].quat, A); sigman2 = 0.0; - MathExtra::transpose_matvec(A,nhat,tempvec); - for (int k = 0; k<3; k++) { + MathExtra::transpose_matvec(A, nhat, tempvec); + for (int k = 0; k < 3; k++) { tempvec[k] *= shape[k]; - sigman2 += tempvec[k]*tempvec[k]; + sigman2 += tempvec[k] * tempvec[k]; SAn[k] = tempvec[k]; } @@ -337,14 +336,14 @@ void FixWallRegionEES::ees(int m, int i) sigman5 = sigman4 * sigman; sigman6 = sigman3 * sigman3; - delta2 = delta * delta; + delta2 = delta * delta; delta3 = delta2 * delta; delta4 = delta2 * delta2; delta5 = delta3 * delta2; delta6 = delta3 * delta3; hhss = delta2 - sigman2; - hhss2 = hhss * hhss; + hhss2 = hhss * hhss; hhss4 = hhss2 * hhss2; hhss8 = hhss4 * hhss4; hhss7 = hhss4 * hhss2 * hhss; @@ -352,31 +351,31 @@ void FixWallRegionEES::ees(int m, int i) hps = delta + sigman; hms = delta - sigman; - fwall = -1*coeff4/hhss2 + coeff3 - * (21*delta6 + 63*delta4*sigman2 + 27*delta2*sigman4 + sigman6) / hhss8; + fwall = -1 * coeff4 / hhss2 + + coeff3 * (21 * delta6 + 63 * delta4 * sigman2 + 27 * delta2 * sigman4 + sigman6) / hhss8; - eng = -1*coeff2 * (4*delta/sigman2/hhss + 2*log(hms/hps)/sigman3) + - coeff1 * (35*delta5 + 70*delta3*sigman2 + 15*delta*sigman4) / hhss7; + eng = -1 * coeff2 * (4 * delta / sigman2 / hhss + 2 * log(hms / hps) / sigman3) + + coeff1 * (35 * delta5 + 70 * delta3 * sigman2 + 15 * delta * sigman4) / hhss7; - twall = coeff6 * (6*delta3/sigman4/hhss2 - 10*delta/sigman2/hhss2 - + 3*log(hms/hps)/sigman5) - + coeff5 * (21.*delta5 + 30.*delta3*sigman2 + 5.*delta*sigman4) / hhss8; + twall = coeff6 * + (6 * delta3 / sigman4 / hhss2 - 10 * delta / sigman2 / hhss2 + + 3 * log(hms / hps) / sigman5) + + coeff5 * (21. * delta5 + 30. * delta3 * sigman2 + 5. * delta * sigman4) / hhss8; - MathExtra::matvec(Lx,nhat,tempvec); - MathExtra::transpose_matvec(A,tempvec,tempvec2); - for (int k = 0; k<3; k++) tempvec2[k] *= shape[k]; - that[0] = MathExtra::dot3(SAn,tempvec2); - - MathExtra::matvec(Ly,nhat,tempvec); - MathExtra::transpose_matvec(A,tempvec,tempvec2); - for (int k = 0; k<3; k++) tempvec2[k] *= shape[k]; - that[1] = MathExtra::dot3(SAn,tempvec2); - - MathExtra::matvec(Lz,nhat,tempvec); - MathExtra::transpose_matvec(A,tempvec,tempvec2); + MathExtra::matvec(Lx, nhat, tempvec); + MathExtra::transpose_matvec(A, tempvec, tempvec2); for (int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; - that[2] = MathExtra::dot3(SAn,tempvec2); + that[0] = MathExtra::dot3(SAn, tempvec2); - for (int j = 0; j<3 ; j++) - torque[j] = twall * that[j]; + MathExtra::matvec(Ly, nhat, tempvec); + MathExtra::transpose_matvec(A, tempvec, tempvec2); + for (int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; + that[1] = MathExtra::dot3(SAn, tempvec2); + + MathExtra::matvec(Lz, nhat, tempvec); + MathExtra::transpose_matvec(A, tempvec, tempvec2); + for (int k = 0; k < 3; k++) tempvec2[k] *= shape[k]; + that[2] = MathExtra::dot3(SAn, tempvec2); + + for (int j = 0; j < 3; j++) torque[j] = twall * that[j]; } diff --git a/src/EXTRA-FIX/fix_wall_region_ees.h b/src/EXTRA-FIX/fix_wall_region_ees.h index 5163d99e90..75ffac174a 100644 --- a/src/EXTRA-FIX/fix_wall_region_ees.h +++ b/src/EXTRA-FIX/fix_wall_region_ees.h @@ -41,12 +41,12 @@ class FixWallRegionEES : public Fix { private: class AtomVecEllipsoid *avec; - int iregion; double epsilon, sigma, cutoff; int eflag; double ewall[4], ewall_all[4]; int nlevels_respa; char *idregion; + class Region *region; double coeff1, coeff2, coeff3, coeff4, offset; double coeff5, coeff6; @@ -60,34 +60,3 @@ class FixWallRegionEES : public Fix { #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: Region ID for fix wall/region/ees does not exist - -Self-explanatory. - -E: Fix wall/region/ees cutoff <= 0.0 - -Self-explanatory. - -E: Fix wall/region/ees colloid requires atom style sphere - -Self-explanatory. - -E: Fix wall/region/ees colloid requires extended particles - -One of the particles has radius 0.0. - -E: Particle on or inside surface of region used in fix wall/region - -Particles must be "exterior" to the region surface in order for -energy/force to be calculated. - -*/ diff --git a/src/EXTRA-MOLECULE/angle_cosine_delta.h b/src/EXTRA-MOLECULE/angle_cosine_delta.h index fda3821beb..f9ec915fa8 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_delta.h +++ b/src/EXTRA-MOLECULE/angle_cosine_delta.h @@ -35,6 +35,3 @@ class AngleCosineDelta : public AngleCosineSquared { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/EXTRA-MOLECULE/angle_cosine_periodic.h b/src/EXTRA-MOLECULE/angle_cosine_periodic.h index 52404b885d..542147dffe 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_periodic.h +++ b/src/EXTRA-MOLECULE/angle_cosine_periodic.h @@ -47,11 +47,3 @@ class AngleCosinePeriodic : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-MOLECULE/angle_gaussian.h b/src/EXTRA-MOLECULE/angle_gaussian.h index 76c7552c31..367a810cf2 100644 --- a/src/EXTRA-MOLECULE/angle_gaussian.h +++ b/src/EXTRA-MOLECULE/angle_gaussian.h @@ -48,11 +48,3 @@ class AngleGaussian : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-MOLECULE/bond_fene_nm.cpp b/src/EXTRA-MOLECULE/bond_fene_nm.cpp index 839217df78..291c9bc465 100644 --- a/src/EXTRA-MOLECULE/bond_fene_nm.cpp +++ b/src/EXTRA-MOLECULE/bond_fene_nm.cpp @@ -89,7 +89,7 @@ void BondFENENM::compute(int eflag, int vflag) fbond = -k[type] / rlogarg; // force from n-m term - if (rsq < sigma[type]*sigma[type]) { + if (rsq < sigma[type] * sigma[type]) { r = sqrt(rsq); fbond += epsilon[type] * (nn[type] * mm[type] / (nn[type] - mm[type])) * (pow(sigma[type] / r, nn[type]) - pow(sigma[type] / r, mm[type])) / rsq; @@ -99,7 +99,7 @@ void BondFENENM::compute(int eflag, int vflag) if (eflag) { ebond = -0.5 * k[type] * r0sq * log(rlogarg); - if (rsq < sigma[type]*sigma[type]) + if (rsq < sigma[type] * sigma[type]) ebond += (epsilon[type] / (nn[type] - mm[type])) * (mm[type] * pow(sigma[type] / r, nn[type]) - nn[type] * pow(sigma[type] / r, mm[type])); } @@ -257,7 +257,7 @@ double BondFENENM::single(int type, double rsq, int /*i*/, int /*j*/, double &ff double eng = -0.5 * k[type] * r0sq * log(rlogarg); fforce = -k[type] / rlogarg; - if (rsq < sigma[type]*sigma[type]) { + if (rsq < sigma[type] * sigma[type]) { r = sqrt(rsq); fforce += epsilon[type] * (nn[type] * mm[type] / (nn[type] - mm[type])) * (pow(sigma[type] / r, nn[type]) - pow(sigma[type] / r, mm[type])) / rsq; @@ -273,7 +273,7 @@ double BondFENENM::single(int type, double rsq, int /*i*/, int /*j*/, double &ff void *BondFENENM::extract(const char *str, int &dim) { dim = 1; - if (strcmp(str, "kappa") == 0) return (void *) k; + if (strcmp(str, "k") == 0) return (void *) k; if (strcmp(str, "r0") == 0) return (void *) r0; return nullptr; } diff --git a/src/EXTRA-MOLECULE/bond_fene_nm.h b/src/EXTRA-MOLECULE/bond_fene_nm.h index 9a6beffc62..d68c937aa8 100644 --- a/src/EXTRA-MOLECULE/bond_fene_nm.h +++ b/src/EXTRA-MOLECULE/bond_fene_nm.h @@ -46,30 +46,3 @@ class BondFENENM : public BondFENE { #endif #endif - -/* ERROR/WARNING messages: - -W: FENE bond too long: %ld %d %d %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -W: Use special bonds = 0,1,1 with bond style fene - -Most FENE models need this setting for the special_bonds command. - -W: FENE bond too long: %ld %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -*/ diff --git a/src/EXTRA-MOLECULE/bond_gaussian.cpp b/src/EXTRA-MOLECULE/bond_gaussian.cpp index c2ab00dfde..76637dbd88 100644 --- a/src/EXTRA-MOLECULE/bond_gaussian.cpp +++ b/src/EXTRA-MOLECULE/bond_gaussian.cpp @@ -35,7 +35,6 @@ BondGaussian::BondGaussian(LAMMPS *lmp) : Bond(lmp), nterms(nullptr), bond_temperature(nullptr), alpha(nullptr), width(nullptr), r0(nullptr) { - reinitflag = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-MOLECULE/bond_gaussian.h b/src/EXTRA-MOLECULE/bond_gaussian.h index 4287a6a388..17ae23fb5f 100644 --- a/src/EXTRA-MOLECULE/bond_gaussian.h +++ b/src/EXTRA-MOLECULE/bond_gaussian.h @@ -48,11 +48,3 @@ class BondGaussian : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-MOLECULE/bond_nonlinear.h b/src/EXTRA-MOLECULE/bond_nonlinear.h index 63e6279462..ae2f6b6c6c 100644 --- a/src/EXTRA-MOLECULE/bond_nonlinear.h +++ b/src/EXTRA-MOLECULE/bond_nonlinear.h @@ -47,11 +47,3 @@ class BondNonlinear : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-MOLECULE/dihedral_helix.h b/src/EXTRA-MOLECULE/dihedral_helix.h index 729d1ec861..966696a427 100644 --- a/src/EXTRA-MOLECULE/dihedral_helix.h +++ b/src/EXTRA-MOLECULE/dihedral_helix.h @@ -44,16 +44,3 @@ class DihedralHelix : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp index 41a3d66ba6..9e3caa1393 100644 --- a/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp +++ b/src/EXTRA-MOLECULE/dihedral_nharmonic.cpp @@ -25,6 +25,7 @@ #include "force.h" #include "memory.h" #include "neighbor.h" +#include "domain.h" #include @@ -39,6 +40,7 @@ DihedralNHarmonic::DihedralNHarmonic(LAMMPS *lmp) : Dihedral(lmp) { writedata = 1; a = nullptr; + born_matrix_enable = 1; } /* ---------------------------------------------------------------------- */ @@ -336,3 +338,62 @@ void DihedralNHarmonic::write_data(FILE *fp) } } + +/* ----------------------------------------------------------------------*/ + +void DihedralNHarmonic::born_matrix(int nd, int i1, int i2, int i3, int i4, + double &dudih, double &du2dih) { + int i,type; + double vb1x,vb1y,vb1z,vb2x,vb2y,vb2z,vb3x,vb3y,vb3z,vb2xm,vb2ym,vb2zm; + double c,ax,ay,az,bx,by,bz,rasq,rbsq,ra2inv,rb2inv,rabinv; + + int **dihedrallist = neighbor->dihedrallist; + double **x = atom->x; + + type = dihedrallist[nd][4]; + + vb1x = x[i1][0] - x[i2][0]; + vb1y = x[i1][1] - x[i2][1]; + vb1z = x[i1][2] - x[i2][2]; + + vb2x = x[i3][0] - x[i2][0]; + vb2y = x[i3][1] - x[i2][1]; + vb2z = x[i3][2] - x[i2][2]; + + vb2xm = -vb2x; + vb2ym = -vb2y; + vb2zm = -vb2z; + + vb3x = x[i4][0] - x[i3][0]; + vb3y = x[i4][1] - x[i3][1]; + vb3z = x[i4][2] - x[i3][2]; + + // c,s calculation + + ax = vb1y*vb2zm - vb1z*vb2ym; + ay = vb1z*vb2xm - vb1x*vb2zm; + az = vb1x*vb2ym - vb1y*vb2xm; + bx = vb3y*vb2zm - vb3z*vb2ym; + by = vb3z*vb2xm - vb3x*vb2zm; + bz = vb3x*vb2ym - vb3y*vb2xm; + + rasq = ax*ax + ay*ay + az*az; + rbsq = bx*bx + by*by + bz*bz; + + ra2inv = rb2inv = 0.0; + if (rasq > 0) ra2inv = 1.0/rasq; + if (rbsq > 0) rb2inv = 1.0/rbsq; + rabinv = sqrt(ra2inv*rb2inv); + + c = (ax*bx + ay*by + az*bz)*rabinv; + + dudih = 0.0; + du2dih = 0.0; + for (i = 1; i < nterms[type]; i++) { + dudih += this->a[type][i]*i*pow(c,i-1); + } + + for (i = 2; i < nterms[type]; i++) { + du2dih += this->a[type][i]*i*(i-1)*pow(c, i-2); + } +} diff --git a/src/EXTRA-MOLECULE/dihedral_nharmonic.h b/src/EXTRA-MOLECULE/dihedral_nharmonic.h index 184cf1f740..28dd2e084e 100644 --- a/src/EXTRA-MOLECULE/dihedral_nharmonic.h +++ b/src/EXTRA-MOLECULE/dihedral_nharmonic.h @@ -33,6 +33,7 @@ class DihedralNHarmonic : public Dihedral { void write_restart(FILE *) override; void read_restart(FILE *) override; void write_data(FILE *) override; + void born_matrix(int /*dtype*/, int, int, int, int, double &, double &) override; protected: int *nterms; diff --git a/src/EXTRA-MOLECULE/dihedral_spherical.cpp b/src/EXTRA-MOLECULE/dihedral_spherical.cpp index 7671acc528..9918e92101 100644 --- a/src/EXTRA-MOLECULE/dihedral_spherical.cpp +++ b/src/EXTRA-MOLECULE/dihedral_spherical.cpp @@ -52,16 +52,16 @@ DihedralSpherical::~DihedralSpherical() memory->destroy(nterms); for (int i = 1; i <= atom->ndihedraltypes; i++) { - if (Ccoeff[i]) delete[] Ccoeff[i]; - if (phi_mult[i]) delete[] phi_mult[i]; - if (phi_shift[i]) delete[] phi_shift[i]; - if (phi_offset[i]) delete[] phi_offset[i]; - if (theta1_mult[i]) delete[] theta1_mult[i]; - if (theta1_shift[i]) delete[] theta1_shift[i]; - if (theta1_offset[i]) delete[] theta1_offset[i]; - if (theta2_mult[i]) delete[] theta2_mult[i]; - if (theta2_shift[i]) delete[] theta2_shift[i]; - if (theta2_offset[i]) delete[] theta2_offset[i]; + delete[] Ccoeff[i]; + delete[] phi_mult[i]; + delete[] phi_shift[i]; + delete[] phi_offset[i]; + delete[] theta1_mult[i]; + delete[] theta1_shift[i]; + delete[] theta1_offset[i]; + delete[] theta2_mult[i]; + delete[] theta2_shift[i]; + delete[] theta2_offset[i]; } delete[] Ccoeff; delete[] phi_mult; diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp index 522eff8626..5ac3ab6ebb 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp @@ -523,9 +523,9 @@ void DihedralTableCut::coeff(int narg, char **arg) // We also want the angles to be sorted in increasing order. // This messy code fixes these problems with the user's data: { - double *phifile_tmp = new double[tb->ninput]; //temporary arrays - double *ffile_tmp = new double[tb->ninput]; //used for sorting - double *efile_tmp = new double[tb->ninput]; + auto phifile_tmp = new double[tb->ninput]; //temporary arrays + auto ffile_tmp = new double[tb->ninput]; //used for sorting + auto efile_tmp = new double[tb->ninput]; // After re-imaging, does the range of angles cross the 0 or 2*PI boundary? // If so, find the discontinuity: diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.h b/src/EXTRA-MOLECULE/dihedral_table_cut.h index f713af1f72..5bdf0a6922 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.h +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.h @@ -41,16 +41,3 @@ class DihedralTableCut : public DihedralTable { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_beck.h b/src/EXTRA-PAIR/pair_beck.h index 889004a579..cca5f53cde 100644 --- a/src/EXTRA-PAIR/pair_beck.h +++ b/src/EXTRA-PAIR/pair_beck.h @@ -51,22 +51,3 @@ class PairBeck : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_born_coul_dsf.h b/src/EXTRA-PAIR/pair_born_coul_dsf.h index bba1fce560..8a271dffbc 100644 --- a/src/EXTRA-PAIR/pair_born_coul_dsf.h +++ b/src/EXTRA-PAIR/pair_born_coul_dsf.h @@ -56,26 +56,3 @@ class PairBornCoulDSF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style born/coul/dsf requires atom attribute q - -The atom style defined does not have this attribute. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_born_coul_wolf.h b/src/EXTRA-PAIR/pair_born_coul_wolf.h index 42d85c9b5c..6a1a3e52f3 100644 --- a/src/EXTRA-PAIR/pair_born_coul_wolf.h +++ b/src/EXTRA-PAIR/pair_born_coul_wolf.h @@ -55,26 +55,3 @@ class PairBornCoulWolf : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style born/coul/wolf requires atom attribute q - -The atom style defined does not have this attribute. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_buck_mdf.h b/src/EXTRA-PAIR/pair_buck_mdf.h index 4dda4f6c10..6eddb8c0c3 100644 --- a/src/EXTRA-PAIR/pair_buck_mdf.h +++ b/src/EXTRA-PAIR/pair_buck_mdf.h @@ -52,22 +52,3 @@ class PairBuckMDF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_cosine_squared.h b/src/EXTRA-PAIR/pair_cosine_squared.h index 2dc29daf10..0ae26817bb 100644 --- a/src/EXTRA-PAIR/pair_cosine_squared.h +++ b/src/EXTRA-PAIR/pair_cosine_squared.h @@ -65,35 +65,3 @@ class PairCosineSquared : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Mixing not supported in pair_style cosine/squared - -Self-explanatory. All coefficients need to be specified explicitly. - -E: pair_modify mix not supported for pair_style cosine/squared - -Same as above, only when calling "pair_modify" command - -W: pair_modify shift/tail is meaningless for pair_style cosine/squared - -This style by definition gets to zero at cutoff distance, so there is nothing -to shift and there is no tail contribution - -W: Cosine/squared set to WCA only (cutoff = sigma) - -If cutoff is equal to sigma (minimum) then this pair style basically -degenerates/reverts to only WCA. This is for convenience. - -*/ diff --git a/src/EXTRA-PAIR/pair_coul_cut_global.h b/src/EXTRA-PAIR/pair_coul_cut_global.h index 39e5e56d68..d35f7a2c2e 100644 --- a/src/EXTRA-PAIR/pair_coul_cut_global.h +++ b/src/EXTRA-PAIR/pair_coul_cut_global.h @@ -35,21 +35,3 @@ class PairCoulCutGlobal : public PairCoulCut { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/cut requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/EXTRA-PAIR/pair_coul_exclude.h b/src/EXTRA-PAIR/pair_coul_exclude.h index 69ec59f5ba..5d7db1edb0 100644 --- a/src/EXTRA-PAIR/pair_coul_exclude.h +++ b/src/EXTRA-PAIR/pair_coul_exclude.h @@ -52,21 +52,3 @@ class PairCoulExclude : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/cut requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/EXTRA-PAIR/pair_coul_slater_cut.h b/src/EXTRA-PAIR/pair_coul_slater_cut.h index 1d24f75c39..b8aaa41e03 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_cut.h +++ b/src/EXTRA-PAIR/pair_coul_slater_cut.h @@ -41,13 +41,3 @@ class PairCoulSlaterCut : public PairCoulCut { #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. - -*/ diff --git a/src/EXTRA-PAIR/pair_coul_slater_long.cpp b/src/EXTRA-PAIR/pair_coul_slater_long.cpp index d30d346fa0..65619f0f65 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_long.cpp +++ b/src/EXTRA-PAIR/pair_coul_slater_long.cpp @@ -45,7 +45,6 @@ using namespace LAMMPS_NS; PairCoulSlaterLong::PairCoulSlaterLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - //ftable = nullptr; qdist = 0.0; } @@ -117,7 +116,6 @@ void PairCoulSlaterLong::compute(int eflag, int vflag) if (rsq < cut_coulsq) { r2inv = 1.0/rsq; -// if (!ncoultablebits || rsq <= tabinnersq) { r = sqrt(rsq); grij = g_ewald * r; expm2 = exp(-grij*grij); @@ -127,22 +125,6 @@ void PairCoulSlaterLong::compute(int eflag, int vflag) prefactor = qqrd2e * scale[itype][jtype] * qtmp*q[j]/r; forcecoul = prefactor * (erfc + EWALD_F*grij*expm2 - slater_term); if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; -/* - } else { - union_int_float_t rsq_lookup; - rsq_lookup.f = rsq; - itable = rsq_lookup.i & ncoulmask; - itable >>= ncoulshiftbits; - fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; - table = ftable[itable] + fraction*dftable[itable]; - forcecoul = scale[itype][jtype] * qtmp*q[j] * table; - if (factor_coul < 1.0) { - table = ctable[itable] + fraction*dctable[itable]; - prefactor = scale[itype][jtype] * qtmp*q[j] * table; - forcecoul -= (1.0-factor_coul)*prefactor; - } - } -*/ fpair = forcecoul * r2inv; @@ -156,14 +138,7 @@ void PairCoulSlaterLong::compute(int eflag, int vflag) } if (eflag) { -// if (!ncoultablebits || rsq <= tabinnersq) ecoul = prefactor*(erfc - (1 + r/lamda)*exp(-2*r/lamda)); -/* - else { - table = etable[itable] + fraction*detable[itable]; - ecoul = scale[itype][jtype] * qtmp*q[j] * table; - } -*/ if (factor_coul < 1.0) ecoul -= (1.0-factor_coul)*prefactor; } @@ -296,10 +271,10 @@ void PairCoulSlaterLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + if (me == 0) utils::sfread(FLERR, &setflag[i][j],sizeof(int),1,fp, nullptr, error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) fread(&scale[i][j],sizeof(double),1,fp); + if (me == 0) utils::sfread(FLERR, &scale[i][j],sizeof(double),1,fp, nullptr, error); MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); } } @@ -315,8 +290,6 @@ void PairCoulSlaterLong::write_restart_settings(FILE *fp) fwrite(&lamda,sizeof(double),1,fp); fwrite(&offset_flag,sizeof(int),1,fp); fwrite(&mix_flag,sizeof(int),1,fp); - //fwrite(&ncoultablebits,sizeof(int),1,fp); - //fwrite(&tabinner,sizeof(double),1,fp); } /* ---------------------------------------------------------------------- @@ -326,71 +299,39 @@ void PairCoulSlaterLong::write_restart_settings(FILE *fp) void PairCoulSlaterLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - fread(&cut_coul,sizeof(double),1,fp); - fread(&lamda,sizeof(double),1,fp); - fread(&offset_flag,sizeof(int),1,fp); - fread(&mix_flag,sizeof(int),1,fp); - //fread(&ncoultablebits,sizeof(int),1,fp); - //fread(&tabinner,sizeof(double),1,fp); + utils::sfread(FLERR, &cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &lamda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); MPI_Bcast(&lamda,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); - //MPI_Bcast(&ncoultablebits,1,MPI_INT,0,world); - //MPI_Bcast(&tabinner,1,MPI_DOUBLE,0,world); } /* ---------------------------------------------------------------------- */ -double PairCoulSlaterLong::single(int i, int j, int /*itype*/, int /*jtype*/, - double rsq, - double factor_coul, double /*factor_lj*/, - double &fforce) +double PairCoulSlaterLong::single(int i, int j, int /*itype*/, int /*jtype*/, double rsq, + double factor_coul, double /*factor_lj*/, double &fforce) { double r2inv,r,grij,expm2,t,erfc,prefactor; double slater_term; -// double fraction,table; double forcecoul,phicoul; -// int itable; r2inv = 1.0/rsq; -// if (!ncoultablebits || rsq <= tabinnersq) { - r = sqrt(rsq); - grij = g_ewald * r; - expm2 = exp(-grij*grij); - t = 1.0 / (1.0 + EWALD_P*grij); - erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; - slater_term = exp(-2*r/lamda)*(1 + (2*r/lamda*(1+r/lamda))); - prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r; - forcecoul = prefactor * (erfc + EWALD_F*grij*expm2 - slater_term); - if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; -/* - } else { - union_int_float_t rsq_lookup; - rsq_lookup.f = rsq; - itable = rsq_lookup.i & ncoulmask; - itable >>= ncoulshiftbits; - fraction = (rsq_lookup.f - rtable[itable]) * drtable[itable]; - table = ftable[itable] + fraction*dftable[itable]; - forcecoul = atom->q[i]*atom->q[j] * table; - if (factor_coul < 1.0) { - table = ctable[itable] + fraction*dctable[itable]; - prefactor = atom->q[i]*atom->q[j] * table; - forcecoul -= (1.0-factor_coul)*prefactor; - } - } -*/ + r = sqrt(rsq); + grij = g_ewald * r; + expm2 = exp(-grij*grij); + t = 1.0 / (1.0 + EWALD_P*grij); + erfc = t * (A1+t*(A2+t*(A3+t*(A4+t*A5)))) * expm2; + slater_term = exp(-2*r/lamda)*(1 + (2*r/lamda*(1+r/lamda))); + prefactor = force->qqrd2e * atom->q[i]*atom->q[j]/r; + forcecoul = prefactor * (erfc + EWALD_F*grij*expm2 - slater_term); + if (factor_coul < 1.0) forcecoul -= (1.0-factor_coul)*prefactor; fforce = forcecoul * r2inv; -// if (!ncoultablebits || rsq <= tabinnersq) - phicoul = prefactor*(erfc - (1 + r/lamda)*exp(-2*r/lamda)); -/* - else { - table = etable[itable] + fraction*detable[itable]; - phicoul = atom->q[i]*atom->q[j] * table; - } -*/ + phicoul = prefactor*(erfc - (1 + r/lamda)*exp(-2*r/lamda)); if (factor_coul < 1.0) phicoul -= (1.0-factor_coul)*prefactor; return phicoul; diff --git a/src/EXTRA-PAIR/pair_coul_slater_long.h b/src/EXTRA-PAIR/pair_coul_slater_long.h index 66002ca2fa..7650ce5a92 100644 --- a/src/EXTRA-PAIR/pair_coul_slater_long.h +++ b/src/EXTRA-PAIR/pair_coul_slater_long.h @@ -43,7 +43,6 @@ class PairCoulSlaterLong : public Pair { protected: double cut_coul, cut_coulsq, qdist; double lamda; - //double *cut_respa; double g_ewald; double **scale; @@ -54,25 +53,3 @@ class PairCoulSlaterLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/slater/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/EXTRA-PAIR/pair_e3b.cpp b/src/EXTRA-PAIR/pair_e3b.cpp index f09a3bcae2..5011cc01e0 100644 --- a/src/EXTRA-PAIR/pair_e3b.cpp +++ b/src/EXTRA-PAIR/pair_e3b.cpp @@ -99,7 +99,7 @@ void PairE3B::compute(int eflag, int vflag) ev_init(eflag, vflag); //clear sumExp array - memset(sumExp, 0, sizeof(double)*maxID); + memset(sumExp, 0, sizeof(double) * maxID); evdwl = 0.0; pvector[0] = pvector[1] = pvector[2] = pvector[3] = 0.0; diff --git a/src/EXTRA-PAIR/pair_e3b.h b/src/EXTRA-PAIR/pair_e3b.h index 90fd48a8be..e887919ba6 100644 --- a/src/EXTRA-PAIR/pair_e3b.h +++ b/src/EXTRA-PAIR/pair_e3b.h @@ -49,8 +49,8 @@ class PairE3B : public Pair { int pairmax, pairPerAtom; // size of pair list int **pairO, ***pairH; // pair lists double ***exps, ****del3, ***fpair3, *sumExp; - int maxID; //size of global sumExp array - int natoms; //to make sure number of atoms is constant + int maxID; //size of global sumExp array + int natoms; //to make sure number of atoms is constant virtual void allocate(); void allocateE3B(); diff --git a/src/EXTRA-PAIR/pair_gauss.h b/src/EXTRA-PAIR/pair_gauss.h index 70a412c0c1..a20e810aa6 100644 --- a/src/EXTRA-PAIR/pair_gauss.h +++ b/src/EXTRA-PAIR/pair_gauss.h @@ -54,22 +54,3 @@ class PairGauss : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -U: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_harmonic_cut.h b/src/EXTRA-PAIR/pair_harmonic_cut.h index 369791747f..f044faedd0 100644 --- a/src/EXTRA-PAIR/pair_harmonic_cut.h +++ b/src/EXTRA-PAIR/pair_harmonic_cut.h @@ -51,22 +51,3 @@ class PairHarmonicCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/EXTRA-PAIR/pair_lennard_mdf.h b/src/EXTRA-PAIR/pair_lennard_mdf.h index e830b4f397..9453def779 100644 --- a/src/EXTRA-PAIR/pair_lennard_mdf.h +++ b/src/EXTRA-PAIR/pair_lennard_mdf.h @@ -55,17 +55,3 @@ class PairLennardMDF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj96_cut.cpp b/src/EXTRA-PAIR/pair_lj96_cut.cpp index 28038ea396..778dfbb562 100644 --- a/src/EXTRA-PAIR/pair_lj96_cut.cpp +++ b/src/EXTRA-PAIR/pair_lj96_cut.cpp @@ -487,7 +487,7 @@ void PairLJ96Cut::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -496,8 +496,8 @@ void PairLJ96Cut::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; } diff --git a/src/EXTRA-PAIR/pair_lj96_cut.h b/src/EXTRA-PAIR/pair_lj96_cut.h index d5084b9719..243e94bfed 100644 --- a/src/EXTRA-PAIR/pair_lj96_cut.h +++ b/src/EXTRA-PAIR/pair_lj96_cut.h @@ -60,22 +60,3 @@ class PairLJ96Cut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_cubic.h b/src/EXTRA-PAIR/pair_lj_cubic.h index d879020a05..b1f6028589 100644 --- a/src/EXTRA-PAIR/pair_lj_cubic.h +++ b/src/EXTRA-PAIR/pair_lj_cubic.h @@ -50,17 +50,3 @@ class PairLJCubic : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h b/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h index 208c626cfd..1845f0d5eb 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_debye.h @@ -42,13 +42,3 @@ class PairLJCutCoulDebye : public PairLJCutCoulCut { #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. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h b/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h index 2445c219db..642d32f58a 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.h @@ -57,21 +57,3 @@ class PairLJCutCoulDSF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/dsf requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h b/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h index 6ca4bb0166..115d171f27 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_wolf.h @@ -54,21 +54,3 @@ class PairLJCutCoulWolf : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/wolf requires atom attribute q - -UNDOCUMENTED - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_expand_coul_long.cpp b/src/EXTRA-PAIR/pair_lj_expand_coul_long.cpp index 5d5ceff1e5..a62aabf3a5 100644 --- a/src/EXTRA-PAIR/pair_lj_expand_coul_long.cpp +++ b/src/EXTRA-PAIR/pair_lj_expand_coul_long.cpp @@ -688,7 +688,7 @@ void PairLJExpandCoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -699,8 +699,8 @@ void PairLJExpandCoulLong::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald diff --git a/src/EXTRA-PAIR/pair_lj_expand_coul_long.h b/src/EXTRA-PAIR/pair_lj_expand_coul_long.h index e0f179ca10..7f8db4570c 100644 --- a/src/EXTRA-PAIR/pair_lj_expand_coul_long.h +++ b/src/EXTRA-PAIR/pair_lj_expand_coul_long.h @@ -64,30 +64,3 @@ class PairLJExpandCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_gromacs.h b/src/EXTRA-PAIR/pair_lj_gromacs.h index b0a6cdfd9e..3a5b92788e 100644 --- a/src/EXTRA-PAIR/pair_lj_gromacs.h +++ b/src/EXTRA-PAIR/pair_lj_gromacs.h @@ -54,17 +54,3 @@ class PairLJGromacs : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h b/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h index 71c8f0211c..d6c002861b 100644 --- a/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h +++ b/src/EXTRA-PAIR/pair_lj_gromacs_coul_gromacs.h @@ -56,21 +56,3 @@ class PairLJGromacsCoulGromacs : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/gromacs/coul/gromacs requires atom attribute q - -An atom_style with this attribute is needed. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_mdf.h b/src/EXTRA-PAIR/pair_lj_mdf.h index 423e8d2f9e..dbf35292a7 100644 --- a/src/EXTRA-PAIR/pair_lj_mdf.h +++ b/src/EXTRA-PAIR/pair_lj_mdf.h @@ -55,17 +55,3 @@ class PairLJMDF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_relres.h b/src/EXTRA-PAIR/pair_lj_relres.h index ed5ffa80d0..9851b13ae6 100644 --- a/src/EXTRA-PAIR/pair_lj_relres.h +++ b/src/EXTRA-PAIR/pair_lj_relres.h @@ -58,17 +58,3 @@ class PairLJRelRes : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_smooth.h b/src/EXTRA-PAIR/pair_lj_smooth.h index fd66ff0a24..0212ef812c 100644 --- a/src/EXTRA-PAIR/pair_lj_smooth.h +++ b/src/EXTRA-PAIR/pair_lj_smooth.h @@ -55,17 +55,3 @@ class PairLJSmooth : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_lj_smooth_linear.h b/src/EXTRA-PAIR/pair_lj_smooth_linear.h index 0b7d10ea48..6948933496 100644 --- a/src/EXTRA-PAIR/pair_lj_smooth_linear.h +++ b/src/EXTRA-PAIR/pair_lj_smooth_linear.h @@ -38,7 +38,8 @@ class PairLJSmoothLinear : public Pair { void write_restart_settings(FILE *) override; void read_restart_settings(FILE *) override; double single(int, int, int, int, double, double, double, double &) override; - double single_hessian(int, int, int, int, double, double[3], double, double, double &, double[6]) override; + double single_hessian(int, int, int, int, double, double[3], double, double, double &, + double[6]) override; protected: double cut_global; @@ -54,17 +55,3 @@ class PairLJSmoothLinear : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_mie_cut.cpp b/src/EXTRA-PAIR/pair_mie_cut.cpp index 729cac8ff8..dff41ce81b 100644 --- a/src/EXTRA-PAIR/pair_mie_cut.cpp +++ b/src/EXTRA-PAIR/pair_mie_cut.cpp @@ -499,7 +499,7 @@ void PairMIECut::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -508,8 +508,8 @@ void PairMIECut::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; } diff --git a/src/EXTRA-PAIR/pair_mie_cut.h b/src/EXTRA-PAIR/pair_mie_cut.h index f7fe1ff0d2..68a712d738 100644 --- a/src/EXTRA-PAIR/pair_mie_cut.h +++ b/src/EXTRA-PAIR/pair_mie_cut.h @@ -59,22 +59,3 @@ class PairMIECut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/EXTRA-PAIR/pair_momb.h b/src/EXTRA-PAIR/pair_momb.h index 3944390604..0f6d535f6d 100644 --- a/src/EXTRA-PAIR/pair_momb.h +++ b/src/EXTRA-PAIR/pair_momb.h @@ -56,22 +56,3 @@ class PairMomb : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_morse_smooth_linear.h b/src/EXTRA-PAIR/pair_morse_smooth_linear.h index 01d7c848ab..b2c10f0e18 100644 --- a/src/EXTRA-PAIR/pair_morse_smooth_linear.h +++ b/src/EXTRA-PAIR/pair_morse_smooth_linear.h @@ -59,22 +59,3 @@ class PairMorseSmoothLinear : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_nm_cut.h b/src/EXTRA-PAIR/pair_nm_cut.h index da3b6b837b..14078a81a4 100644 --- a/src/EXTRA-PAIR/pair_nm_cut.h +++ b/src/EXTRA-PAIR/pair_nm_cut.h @@ -55,22 +55,3 @@ class PairNMCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h b/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h index ba054ef849..9ae33df593 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h +++ b/src/EXTRA-PAIR/pair_nm_cut_coul_cut.h @@ -57,26 +57,3 @@ class PairNMCutCoulCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style nm/cut/coul/cut requires atom attribute q - -The atom style defined does not have this attribute. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_nm_cut_coul_long.h b/src/EXTRA-PAIR/pair_nm_cut_coul_long.h index e2d19d14a5..f9b7a434ba 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_coul_long.h +++ b/src/EXTRA-PAIR/pair_nm_cut_coul_long.h @@ -60,30 +60,3 @@ class PairNMCutCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style nm/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_nm_cut_split.h b/src/EXTRA-PAIR/pair_nm_cut_split.h index 68d4dad7de..4f548a5118 100644 --- a/src/EXTRA-PAIR/pair_nm_cut_split.h +++ b/src/EXTRA-PAIR/pair_nm_cut_split.h @@ -32,22 +32,3 @@ class PairNMCutSplit : public PairNMCut { } // namespace LAMMPS_NS #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/EXTRA-PAIR/pair_ufm.h b/src/EXTRA-PAIR/pair_ufm.h index d8091766a0..24f9c9dd2f 100644 --- a/src/EXTRA-PAIR/pair_ufm.h +++ b/src/EXTRA-PAIR/pair_ufm.h @@ -60,17 +60,3 @@ class PairUFM : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/EXTRA-PAIR/pair_wf_cut.cpp b/src/EXTRA-PAIR/pair_wf_cut.cpp index 2fb363a161..b25e519bcf 100644 --- a/src/EXTRA-PAIR/pair_wf_cut.cpp +++ b/src/EXTRA-PAIR/pair_wf_cut.cpp @@ -294,15 +294,15 @@ void PairWFCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp); + if (me == 0) utils::sfread(FLERR, &setflag[i][j],sizeof(int),1,fp, nullptr, error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - fread(&epsilon[i][j],sizeof(double),1,fp); - fread(&sigma[i][j],sizeof(double),1,fp); - fread(&nu[i][j],sizeof(int),1,fp); - fread(&mu[i][j],sizeof(int),1,fp); - fread(&cut[i][j],sizeof(double),1,fp); + utils::sfread(FLERR, &epsilon[i][j],sizeof(double),1,fp, nullptr, error); + utils::sfread(FLERR, &sigma[i][j],sizeof(double),1,fp, nullptr, error); + utils::sfread(FLERR, &nu[i][j],sizeof(int),1,fp, nullptr, error); + utils::sfread(FLERR, &mu[i][j],sizeof(int),1,fp, nullptr, error); + utils::sfread(FLERR, &cut[i][j],sizeof(double),1,fp, nullptr, error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -331,9 +331,9 @@ void PairWFCut::write_restart_settings(FILE *fp) void PairWFCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - fread(&cut_global,sizeof(double),1,fp); - fread(&offset_flag,sizeof(int),1,fp); - fread(&mix_flag,sizeof(int),1,fp); + utils::sfread(FLERR, &cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR, &offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR, &mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/EXTRA-PAIR/pair_wf_cut.h b/src/EXTRA-PAIR/pair_wf_cut.h index 61d930b12e..15d02448ed 100644 --- a/src/EXTRA-PAIR/pair_wf_cut.h +++ b/src/EXTRA-PAIR/pair_wf_cut.h @@ -56,22 +56,3 @@ class PairWFCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/FEP/compute_fep.cpp b/src/FEP/compute_fep.cpp index 70779d1cb2..7a813018ad 100644 --- a/src/FEP/compute_fep.cpp +++ b/src/FEP/compute_fep.cpp @@ -213,7 +213,7 @@ void ComputeFEP::init() if ((strcmp(force->pair_style, "hybrid") == 0 || strcmp(force->pair_style, "hybrid/overlay") == 0)) { - PairHybrid *pair = (PairHybrid *) force->pair; + auto pair = dynamic_cast(force->pair); for (i = pert->ilo; i <= pert->ihi; i++) for (j = MAX(pert->jlo, i); j <= pert->jhi; j++) if (!pair->check_ijtype(i, j, pert->pstyle)) @@ -238,8 +238,7 @@ void ComputeFEP::init() // detect if package gpu is present - int ifixgpu = modify->find_fix("package_gpu"); - if (ifixgpu >= 0) fixgpu = modify->fix[ifixgpu]; + fixgpu = modify->get_fix_by_id("package_gpu"); if (comm->me == 0) { auto mesg = fmt::format("FEP settings ...\n temperature = {:f}\n", temp_fep); diff --git a/src/FEP/compute_fep.h b/src/FEP/compute_fep.h index 8f576124e0..c586dae341 100644 --- a/src/FEP/compute_fep.h +++ b/src/FEP/compute_fep.h @@ -82,31 +82,3 @@ class ComputeFEP : public Compute { #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: Variable name for compute fep does not exist - -Self-explanatory. - -E: Variable for compute fep is invalid style - -Self-explanatory. - -E: Compute fep pair style does not exist - -Self-explanatory. - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/FEP/compute_fep_ta.cpp b/src/FEP/compute_fep_ta.cpp index 70fdb5c0b0..9ab848f6db 100644 --- a/src/FEP/compute_fep_ta.cpp +++ b/src/FEP/compute_fep_ta.cpp @@ -115,8 +115,6 @@ ComputeFEPTA::~ComputeFEPTA() void ComputeFEPTA::init() { - int i, j; - if (!fepinitflag) // avoid init to run entirely when called by write_data fepinitflag = 1; else @@ -135,15 +133,15 @@ void ComputeFEPTA::init() // detect if package gpu is present - int ifixgpu = modify->find_fix("package_gpu"); - if (ifixgpu >= 0) fixgpu = modify->fix[ifixgpu]; + fixgpu = modify->get_fix_by_id("package_gpu"); - if (comm->me == 0) { - auto mesg = fmt::format("FEP/TA settings ...\n temperature = {:f}\n", temp_fep); - mesg += fmt::format(" scale factor = {:f}\n", scale_factor); - mesg += fmt::format(" tail {}\n", (tailflag ? "yes" : "no")); - utils::logmesg(lmp, mesg); - } + if (comm->me == 0) + utils::logmesg(lmp, + "FEP/TA settings ...\n" + " temperature = {:f}\n" + " scale factor = {:f}\n" + " tail {}\n", + temp_fep, scale_factor, tailflag ? "yes" : "no"); } /* ---------------------------------------------------------------------- */ diff --git a/src/FEP/compute_fep_ta.h b/src/FEP/compute_fep_ta.h index b95266eb1a..ccbabc6295 100644 --- a/src/FEP/compute_fep_ta.h +++ b/src/FEP/compute_fep_ta.h @@ -30,7 +30,7 @@ namespace LAMMPS_NS { class ComputeFEPTA : public Compute { public: - ComputeFEPTA(class LAMMPS *, int, char **); // compute ID groupID fep/ta temp xy/xz/yz scale_factor + ComputeFEPTA(class LAMMPS *, int, char **); ~ComputeFEPTA() override; void init() override; void compute_vector() override; @@ -73,17 +73,3 @@ class ComputeFEPTA : public Compute { #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: Cannot compute fep/ta in 2d simulation - -Self-explanatory. - -*/ diff --git a/src/FEP/fix_adapt_fep.cpp b/src/FEP/fix_adapt_fep.cpp index d43c053b9a..090931ae31 100644 --- a/src/FEP/fix_adapt_fep.cpp +++ b/src/FEP/fix_adapt_fep.cpp @@ -211,7 +211,7 @@ void FixAdaptFEP::post_constructor() if (diamflag) { auto cmd = fmt::format("{}_FIX_STORE_DIAM {} STORE peratom 1 1", group->names[igroup]); - fix_diam = (FixStore *) modify->add_fix(cmd); + fix_diam = dynamic_cast( modify->add_fix(cmd)); if (fix_diam->restart_reset) fix_diam->restart_reset = 0; else { @@ -229,7 +229,7 @@ void FixAdaptFEP::post_constructor() if (chgflag) { auto cmd = fmt::format("{}_FIX_STORE_CHG {} STORE peratom 1 1", group->names[igroup]); - fix_chg = (FixStore *) modify->add_fix(cmd); + fix_chg = dynamic_cast( modify->add_fix(cmd)); if (fix_chg->restart_reset) fix_chg->restart_reset = 0; else { @@ -294,7 +294,7 @@ void FixAdaptFEP::init() if (ad->pdim == 2 && (strcmp(force->pair_style,"hybrid") == 0 || strcmp(force->pair_style,"hybrid/overlay") == 0)) { - PairHybrid *pair = (PairHybrid *) force->pair; + auto pair = dynamic_cast( force->pair); for (i = ad->ilo; i <= ad->ihi; i++) for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) if (!pair->check_ijtype(i,j,ad->pstyle)) @@ -335,16 +335,16 @@ void FixAdaptFEP::init() if (id_fix_diam) { int ifix = modify->find_fix(id_fix_diam); if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID"); - fix_diam = (FixStore *) modify->fix[ifix]; + fix_diam = dynamic_cast( modify->fix[ifix]); } if (id_fix_chg) { int ifix = modify->find_fix(id_fix_chg); if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID"); - fix_chg = (FixStore *) modify->fix[ifix]; + fix_chg = dynamic_cast( modify->fix[ifix]); } if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ diff --git a/src/FEP/fix_adapt_fep.h b/src/FEP/fix_adapt_fep.h index a7cfdad868..ca0255962c 100644 --- a/src/FEP/fix_adapt_fep.h +++ b/src/FEP/fix_adapt_fep.h @@ -70,45 +70,3 @@ class FixAdaptFEP : public Fix { #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: Variable name for fix adapt does not exist - -Self-explanatory. - -E: Variable for fix adapt is invalid style - -Only equal-style variables can be used. - -E: Fix adapt pair style does not exist - -Self-explanatory - -E: Fix adapt pair style param not supported - -The pair style does not know about the parameter you specified. - -E: Fix adapt type pair range is not valid for pair hybrid sub-style - -Self-explanatory. - -E: Fix adapt kspace style does not exist - -Self-explanatory. - -E: Fix adapt requires atom attribute diameter - -The atom style being used does not specify an atom diameter. - -E: Fix adapt requires atom attribute charge - -The atom style being used does not specify an atom charge. - -*/ diff --git a/src/FEP/pair_coul_cut_soft.h b/src/FEP/pair_coul_cut_soft.h index 862bafce8c..e327074f21 100644 --- a/src/FEP/pair_coul_cut_soft.h +++ b/src/FEP/pair_coul_cut_soft.h @@ -56,25 +56,3 @@ class PairCoulCutSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/cut/soft requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair coul/cut/soft different lambda values in mix - -The value of lambda has to be the same for I J pairs. - -*/ diff --git a/src/FEP/pair_coul_long_soft.h b/src/FEP/pair_coul_long_soft.h index 45afeef445..c5469148ad 100644 --- a/src/FEP/pair_coul_long_soft.h +++ b/src/FEP/pair_coul_long_soft.h @@ -56,25 +56,3 @@ class PairCoulLongSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/FEP/pair_lj_charmm_coul_long_soft.cpp b/src/FEP/pair_lj_charmm_coul_long_soft.cpp index 86681cf51f..119c545579 100644 --- a/src/FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/FEP/pair_lj_charmm_coul_long_soft.cpp @@ -692,7 +692,7 @@ void PairLJCharmmCoulLongSoft::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -714,8 +714,8 @@ void PairLJCharmmCoulLongSoft::init_style() // set & error check interior rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) { - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) { + cut_respa = (dynamic_cast( update->integrate))->cutoff; if (MIN(cut_lj,cut_coul) < cut_respa[3]) error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) diff --git a/src/FEP/pair_lj_charmm_coul_long_soft.h b/src/FEP/pair_lj_charmm_coul_long_soft.h index 8190a5109b..e1fab23fbf 100644 --- a/src/FEP/pair_lj_charmm_coul_long_soft.h +++ b/src/FEP/pair_lj_charmm_coul_long_soft.h @@ -68,39 +68,3 @@ class PairLJCharmmCoulLongSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/charmm/coul/long/soft requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair inner cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/FEP/pair_lj_class2_coul_cut_soft.h b/src/FEP/pair_lj_class2_coul_cut_soft.h index 3b50b21151..db8b76d443 100644 --- a/src/FEP/pair_lj_class2_coul_cut_soft.h +++ b/src/FEP/pair_lj_class2_coul_cut_soft.h @@ -57,25 +57,3 @@ class PairLJClass2CoulCutSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/class2/coul/cut/soft requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair lj/class2/coul/cut/soft different lambda values in mix - -The value of lambda has to be the same for I J pairs. - -*/ diff --git a/src/FEP/pair_lj_class2_coul_long_soft.h b/src/FEP/pair_lj_class2_coul_long_soft.h index 2d374a91f6..f125d02f27 100644 --- a/src/FEP/pair_lj_class2_coul_long_soft.h +++ b/src/FEP/pair_lj_class2_coul_long_soft.h @@ -58,25 +58,3 @@ class PairLJClass2CoulLongSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/class2/coul/long/soft requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/FEP/pair_lj_class2_soft.h b/src/FEP/pair_lj_class2_soft.h index 2a7a3a286f..75fff9107a 100644 --- a/src/FEP/pair_lj_class2_soft.h +++ b/src/FEP/pair_lj_class2_soft.h @@ -53,17 +53,3 @@ class PairLJClass2Soft : public Pair { #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: Incorrect args for pair coefficients -Self-explanatory. Check the input script or data file. - -E: Pair lj/cut/soft different lambda values in mix -The value of lambda has to be the same for I J pairs. - -*/ diff --git a/src/FEP/pair_lj_cut_coul_cut_soft.h b/src/FEP/pair_lj_cut_coul_cut_soft.h index b92e29ac44..0e621faf29 100644 --- a/src/FEP/pair_lj_cut_coul_cut_soft.h +++ b/src/FEP/pair_lj_cut_coul_cut_soft.h @@ -57,26 +57,3 @@ class PairLJCutCoulCutSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/cut/soft requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair lj/cut/coul/cut/soft different lambda values in mix - -The value of lambda has to be the same for I J pairs. - - -*/ diff --git a/src/FEP/pair_lj_cut_coul_long_soft.cpp b/src/FEP/pair_lj_cut_coul_long_soft.cpp index 7fdc431c61..d3e0ca8a88 100644 --- a/src/FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/FEP/pair_lj_cut_coul_long_soft.cpp @@ -635,7 +635,7 @@ void PairLJCutCoulLongSoft::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -646,8 +646,8 @@ void PairLJCutCoulLongSoft::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald diff --git a/src/FEP/pair_lj_cut_coul_long_soft.h b/src/FEP/pair_lj_cut_coul_long_soft.h index 04add045c8..cc5c39dabe 100644 --- a/src/FEP/pair_lj_cut_coul_long_soft.h +++ b/src/FEP/pair_lj_cut_coul_long_soft.h @@ -64,30 +64,3 @@ class PairLJCutCoulLongSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/FEP/pair_lj_cut_soft.cpp b/src/FEP/pair_lj_cut_soft.cpp index cf0a5df644..8cf61f013c 100644 --- a/src/FEP/pair_lj_cut_soft.cpp +++ b/src/FEP/pair_lj_cut_soft.cpp @@ -513,7 +513,7 @@ void PairLJCutSoft::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -522,8 +522,8 @@ void PairLJCutSoft::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; } diff --git a/src/FEP/pair_lj_cut_soft.h b/src/FEP/pair_lj_cut_soft.h index 9c86485ab2..77e4fc09a2 100644 --- a/src/FEP/pair_lj_cut_soft.h +++ b/src/FEP/pair_lj_cut_soft.h @@ -61,26 +61,3 @@ class PairLJCutSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair lj/cut/soft different lambda values in mix - -The value of lambda has to be the same for I J pairs. - -*/ diff --git a/src/FEP/pair_lj_cut_tip4p_long_soft.h b/src/FEP/pair_lj_cut_tip4p_long_soft.h index 9a6615c95c..47e6fc5959 100644 --- a/src/FEP/pair_lj_cut_tip4p_long_soft.h +++ b/src/FEP/pair_lj_cut_tip4p_long_soft.h @@ -54,52 +54,3 @@ class PairLJCutTIP4PLongSoft : public PairLJCutCoulLongSoft { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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: Pair style lj/cut/tip4p/long/soft requires atom IDs - -There are no atom IDs defined in the system and the TIP4P potential -requires them to find O,H atoms with a water molecule. - -E: Pair style lj/cut/tip4p/long/soft requires newton pair on - -This is because the computation of constraint forces within a water -molecule adds forces to atoms owned by other processors. - -E: Pair style lj/cut/tip4p/long/soft requires atom attribute q - -The atom style defined does not have these attributes. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -E: Water H epsilon must be 0.0 for pair style lj/cut/tip4p/long/soft - -This is because LAMMPS does not compute the Lennard-Jones interactions -with these particles for efficiency reasons. - -*/ diff --git a/src/FEP/pair_tip4p_long_soft.h b/src/FEP/pair_tip4p_long_soft.h index bed6f7f39c..06916d00f1 100644 --- a/src/FEP/pair_tip4p_long_soft.h +++ b/src/FEP/pair_tip4p_long_soft.h @@ -54,47 +54,3 @@ class PairTIP4PLongSoft : public PairCoulLongSoft { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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: Pair style tip4p/long/soft requires atom IDs - -There are no atom IDs defined in the system and the TIP4P potential -requires them to find O,H atoms with a water molecule. - -E: Pair style tip4p/long/soft requires newton pair on - -This is because the computation of constraint forces within a water -molecule adds forces to atoms owned by other processors. - -E: Pair style tip4p/long/soft requires atom attribute q - -The atom style defined does not have these attributes. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -*/ diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 808d435016..85b4f8e0e9 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -275,7 +275,7 @@ void FixGPU::init() // also disallow GPU neighbor lists for hybrid styles if (force->pair_match("^hybrid",0) != nullptr) { - PairHybrid *hybrid = (PairHybrid *) force->pair; + auto hybrid = dynamic_cast( force->pair); for (int i = 0; i < hybrid->nstyles; i++) if (!utils::strmatch(hybrid->keywords[i],"/gpu$")) force->pair->no_virial_fdotr_compute = 1; @@ -286,7 +286,7 @@ void FixGPU::init() // rRESPA support if (utils::strmatch(update->integrate_style,"^respa")) - _nlevels_respa = ((Respa *) update->integrate)->nlevels; + _nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -300,9 +300,9 @@ void FixGPU::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { // In setup only, all forces calculated on GPU are put in the outer level - ((Respa *) update->integrate)->copy_flevel_f(_nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(_nlevels_respa-1); post_force(vflag); - ((Respa *) update->integrate)->copy_f_flevel(_nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(_nlevels_respa-1); } } diff --git a/src/GPU/fix_gpu.h b/src/GPU/fix_gpu.h index c152c54fb3..9df789f6e5 100644 --- a/src/GPU/fix_gpu.h +++ b/src/GPU/fix_gpu.h @@ -51,42 +51,3 @@ class FixGPU : public Fix { #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: No OpenMP support compiled in - -An OpenMP flag is set, but LAMMPS was not built with -OpenMP support. - -E: GPU package does not (yet) work with atom_style template - -Self-explanatory. - -E: Cannot use package gpu neigh yes with triclinic box - -This is a current restriction in LAMMPS. - -W: Using package gpu without any pair style defined - -Self-explanatory. - -E: Cannot use neigh_modify exclude with GPU neighbor builds - -This is a current limitation of the GPU implementation -in LAMMPS. - -E: Too many neighbors on GPU. Use neigh_modify one to increase limit. - -The expected maximum number of neighbors is determined in the GPU package -automatically. This error means the actual number of neighbors is exceeding -the expected value. Use neigh_modify one command to increase GPU allocations -(e.g. doubling this value doubles the GPU allocation). - -*/ diff --git a/src/GPU/fix_nh_gpu.cpp b/src/GPU/fix_nh_gpu.cpp index fb09245fa4..9a24c79766 100644 --- a/src/GPU/fix_nh_gpu.cpp +++ b/src/GPU/fix_nh_gpu.cpp @@ -47,7 +47,7 @@ typedef struct { double x,y,z; } dbl3_t; FixNHGPU::FixNHGPU(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg) { - _dtfm = 0; + _dtfm = nullptr; _nlocal3 = 0; _nlocal_max = 0; } @@ -83,7 +83,7 @@ void FixNHGPU::remap() double oldlo,oldhi; double expfac; - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; int *mask = atom->mask; int nlocal = atom->nlocal; double *h = domain->h; @@ -420,7 +420,7 @@ void FixNHGPU::nh_v_press() return; } - dbl3_t * _noalias const v = (dbl3_t *)atom->v[0]; + auto * _noalias const v = (dbl3_t *)atom->v[0]; int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; diff --git a/src/GPU/fix_nh_gpu.h b/src/GPU/fix_nh_gpu.h index 7461b20d64..f8280517ba 100644 --- a/src/GPU/fix_nh_gpu.h +++ b/src/GPU/fix_nh_gpu.h @@ -45,120 +45,3 @@ class FixNHGPU : public FixNH { } // namespace LAMMPS_NS #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: Target temperature for fix nvt/npt/nph cannot be 0.0 - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix nvt/npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix nvt/npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix nvt/npt/nph on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix nvt/npt/nph with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix nvt/npt/nph with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix nvt/npt/nph pressure settings - -Settings for coupled dimensions must be the same. - -E: Fix nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix npt and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix nvt/npt does not exist - -Self-explanatory. - -E: Pressure ID for fix npt/nph does not exist - -Self-explanatory. - -E: Fix npt/nph has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/GPU/fix_npt_gpu.h b/src/GPU/fix_npt_gpu.h index 5068031132..aa35396422 100644 --- a/src/GPU/fix_npt_gpu.h +++ b/src/GPU/fix_npt_gpu.h @@ -37,15 +37,3 @@ class FixNPTGPU : public FixNHGPU { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt - -Self-explanatory. - -E: Pressure control must be used with fix npt - -Self-explanatory. - -*/ diff --git a/src/GPU/fix_nve_asphere_gpu.cpp b/src/GPU/fix_nve_asphere_gpu.cpp index 1323e8b054..1139c56272 100644 --- a/src/GPU/fix_nve_asphere_gpu.cpp +++ b/src/GPU/fix_nve_asphere_gpu.cpp @@ -154,18 +154,18 @@ using namespace FixConst; FixNVEAsphereGPU::FixNVEAsphereGPU(LAMMPS *lmp, int narg, char **arg) : FixNVE(lmp, narg, arg) { - _dtfm = 0; + _dtfm = nullptr; _nlocal_max = 0; - _inertia0 = 0; - _inertia1 = 0; - _inertia2 = 0; + _inertia0 = nullptr; + _inertia1 = nullptr; + _inertia2 = nullptr; } /* ---------------------------------------------------------------------- */ void FixNVEAsphereGPU::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Compute nve/asphere requires atom style ellipsoid"); diff --git a/src/GPU/fix_nve_asphere_gpu.h b/src/GPU/fix_nve_asphere_gpu.h index a0420d6577..f8ea6b3a5b 100644 --- a/src/GPU/fix_nve_asphere_gpu.h +++ b/src/GPU/fix_nve_asphere_gpu.h @@ -49,15 +49,3 @@ class FixNVEAsphereGPU : public FixNVE { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Compute nve/asphere requires atom style ellipsoid - -Self-explanatory. - -E: Fix nve/asphere requires extended particles - -This fix can only be used for particles with a shape setting. - -*/ diff --git a/src/GPU/fix_nve_gpu.h b/src/GPU/fix_nve_gpu.h index 30e805c770..f41f4f3dd6 100644 --- a/src/GPU/fix_nve_gpu.h +++ b/src/GPU/fix_nve_gpu.h @@ -48,13 +48,3 @@ class FixNVEGPU : public FixNVE { #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. - -*/ diff --git a/src/GPU/fix_nvt_gpu.h b/src/GPU/fix_nvt_gpu.h index 310eabdafa..96cca54148 100644 --- a/src/GPU/fix_nvt_gpu.h +++ b/src/GPU/fix_nvt_gpu.h @@ -37,15 +37,3 @@ class FixNVTGPU : public FixNHGPU { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt - -Self-explanatory. - -E: Pressure control can not be used with fix nvt - -Self-explanatory. - -*/ diff --git a/src/GPU/gpu_extra.h b/src/GPU/gpu_extra.h index c2d9931e0a..1ed9e8c45b 100644 --- a/src/GPU/gpu_extra.h +++ b/src/GPU/gpu_extra.h @@ -78,10 +78,12 @@ inline void check_flag(int error_flag, LAMMPS_NS::Error *error, MPI_Comm &world) else if (all_success == -13) error->all(FLERR, "Invalid device configuration."); else if (all_success == -15) - error->all(FLERR, "PPPM was compiled for double precision floating point " + error->all(FLERR, + "PPPM was compiled for double precision floating point " "but GPU device supports single precision only."); else if (all_success == -16) - error->all(FLERR, "GPU library was compiled for double or mixed precision " + error->all(FLERR, + "GPU library was compiled for double or mixed precision " "floating point but GPU device supports single precision only."); else error->all(FLERR, "Unknown error in GPU library"); @@ -96,78 +98,3 @@ inline void gpu_ready(LAMMPS_NS::Modify *modify, LAMMPS_NS::Error *error) } // namespace GPU_EXTRA #endif - -/* ERROR/WARNING messages: - -E: The package gpu command is required for gpu styles - -Self-explanatory. - -E: Could not find/initialize a specified accelerator device - -Could not initialize at least one of the devices specified for the gpu -package - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: GPU library not compiled for this accelerator - -Self-explanatory. - -E: Double precision is not supported on this accelerator - -Self-explanatory - -E: Unable to initialize accelerator for use - -There was a problem initializing an accelerator for the gpu package - -E: Accelerator sharing is not currently supported on system - -Multiple MPI processes cannot share the accelerator on your -system. For NVIDIA GPUs, see the nvidia-smi command to change this -setting. - -E: GPU particle split must be set to 1 for this pair style. - -For this pair style, you cannot run part of the force calculation on -the host. See the package command. - -E: CPU neighbor lists must be used for ellipsoid/sphere mix. - -When using Gay-Berne or RE-squared pair styles with both ellipsoidal and -spherical particles, the neighbor list must be built on the CPU - -E: Invalid threads_per_atom specified. - -For 3-body potentials on the GPU, the threads_per_atom setting cannot be -greater than 4 for NVIDIA GPUs. - -E: Invalid custom OpenCL parameter string. - -There are not enough or too many parameters in the custom string for package -GPU or the parameters do not meet required restrictions. - -E: Unknown error in GPU library - -Self-explanatory. - -E: Invalid device configuration. - -The specified GPU or accelerator does not support the specified device -configuration. Check the output of ocl_get_devices or nvd_get_devices to -verify the correct device IDs for the GPU package. - -E: P3M built for FP64 and GPU device is FP32 only - -Either turn off GPU acceleration for PPPM or build LAMMPS with -DFFT_SINGLE - -W: Increasing communication cutoff for GPU style - -The pair style has increased the communication cutoff to be consistent with -the communication cutoff requirements for this pair style when run on the GPU. - -*/ diff --git a/src/GPU/pair_beck_gpu.h b/src/GPU/pair_beck_gpu.h index 011f3b4177..b7ca8b2524 100644 --- a/src/GPU/pair_beck_gpu.h +++ b/src/GPU/pair_beck_gpu.h @@ -43,16 +43,3 @@ class PairBeckGPU : public PairBeck { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with beck/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_born_coul_long_cs_gpu.h b/src/GPU/pair_born_coul_long_cs_gpu.h index 34a7f41fc4..443cfb7439 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.h +++ b/src/GPU/pair_born_coul_long_cs_gpu.h @@ -43,24 +43,3 @@ class PairBornCoulLongCSGPU : public PairBornCoulLongCS { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style born/coul/long/cs/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with born/coul/long/cs/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_born_coul_long_gpu.h b/src/GPU/pair_born_coul_long_gpu.h index bbb0f24807..09934474f3 100644 --- a/src/GPU/pair_born_coul_long_gpu.h +++ b/src/GPU/pair_born_coul_long_gpu.h @@ -43,24 +43,3 @@ class PairBornCoulLongGPU : public PairBornCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style born/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with born/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_born_coul_wolf_cs_gpu.h b/src/GPU/pair_born_coul_wolf_cs_gpu.h index 21391c6588..df45f9be24 100644 --- a/src/GPU/pair_born_coul_wolf_cs_gpu.h +++ b/src/GPU/pair_born_coul_wolf_cs_gpu.h @@ -43,16 +43,3 @@ class PairBornCoulWolfCSGPU : public PairBornCoulWolfCS { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with born/coul/wolf/cs/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_born_coul_wolf_gpu.h b/src/GPU/pair_born_coul_wolf_gpu.h index 30d5fff383..6e35a8aec0 100644 --- a/src/GPU/pair_born_coul_wolf_gpu.h +++ b/src/GPU/pair_born_coul_wolf_gpu.h @@ -43,16 +43,3 @@ class PairBornCoulWolfGPU : public PairBornCoulWolf { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with born/coul/wolf/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_born_gpu.h b/src/GPU/pair_born_gpu.h index bab342b259..1e7760a57e 100644 --- a/src/GPU/pair_born_gpu.h +++ b/src/GPU/pair_born_gpu.h @@ -44,16 +44,3 @@ class PairBornGPU : public PairBorn { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with born/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_buck_coul_cut_gpu.h b/src/GPU/pair_buck_coul_cut_gpu.h index 56d69f00ba..d55d336802 100644 --- a/src/GPU/pair_buck_coul_cut_gpu.h +++ b/src/GPU/pair_buck_coul_cut_gpu.h @@ -43,16 +43,3 @@ class PairBuckCoulCutGPU : public PairBuckCoulCut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with buck/coul/cut/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_buck_coul_long_gpu.h b/src/GPU/pair_buck_coul_long_gpu.h index 3e3cb33112..c52fb95797 100644 --- a/src/GPU/pair_buck_coul_long_gpu.h +++ b/src/GPU/pair_buck_coul_long_gpu.h @@ -43,24 +43,3 @@ class PairBuckCoulLongGPU : public PairBuckCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style buck/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with buck/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_buck_gpu.h b/src/GPU/pair_buck_gpu.h index 99fe981d38..9241575abf 100644 --- a/src/GPU/pair_buck_gpu.h +++ b/src/GPU/pair_buck_gpu.h @@ -44,16 +44,3 @@ class PairBuckGPU : public PairBuck { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with buck/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_colloid_gpu.h b/src/GPU/pair_colloid_gpu.h index 5f1f068429..ebe5b08670 100644 --- a/src/GPU/pair_colloid_gpu.h +++ b/src/GPU/pair_colloid_gpu.h @@ -43,24 +43,3 @@ class PairColloidGPU : public PairColloid { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with colloid/gpu pair style - -Self-explanatory. - -E: Overlapping small/large in pair colloid - -This potential is infinite when there is an overlap. - -E: Overlapping large/large in pair colloid - -This potential is infinite when there is an overlap. - -*/ diff --git a/src/GPU/pair_coul_cut_gpu.h b/src/GPU/pair_coul_cut_gpu.h index 620f7185eb..992c16095f 100644 --- a/src/GPU/pair_coul_cut_gpu.h +++ b/src/GPU/pair_coul_cut_gpu.h @@ -44,20 +44,3 @@ class PairCoulCutGPU : public PairCoulCut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style coul/cut/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with coul/cut/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_coul_debye_gpu.h b/src/GPU/pair_coul_debye_gpu.h index 5efefd9a43..d587d82ba2 100644 --- a/src/GPU/pair_coul_debye_gpu.h +++ b/src/GPU/pair_coul_debye_gpu.h @@ -44,20 +44,3 @@ class PairCoulDebyeGPU : public PairCoulDebye { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style coul/debye/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with coul/debye/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_coul_dsf_gpu.h b/src/GPU/pair_coul_dsf_gpu.h index c6b8803400..a7ddcf9254 100644 --- a/src/GPU/pair_coul_dsf_gpu.h +++ b/src/GPU/pair_coul_dsf_gpu.h @@ -43,20 +43,3 @@ class PairCoulDSFGPU : public PairCoulDSF { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style coul/dsf/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with coul/dsf/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_coul_long_cs_gpu.h b/src/GPU/pair_coul_long_cs_gpu.h index 30ff080e3c..71180d61ab 100644 --- a/src/GPU/pair_coul_long_cs_gpu.h +++ b/src/GPU/pair_coul_long_cs_gpu.h @@ -44,24 +44,3 @@ class PairCoulLongCSGPU : public PairCoulLongCS { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style coul/long/cs/gpu requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use newton pair with coul/long/cs/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_coul_long_gpu.h b/src/GPU/pair_coul_long_gpu.h index 7012d489e1..b0eb0e83b1 100644 --- a/src/GPU/pair_coul_long_gpu.h +++ b/src/GPU/pair_coul_long_gpu.h @@ -44,24 +44,3 @@ class PairCoulLongGPU : public PairCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style coul/long/gpu requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use newton pair with coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_dpd_gpu.h b/src/GPU/pair_dpd_gpu.h index 843e2c179d..02819f35df 100644 --- a/src/GPU/pair_dpd_gpu.h +++ b/src/GPU/pair_dpd_gpu.h @@ -43,16 +43,3 @@ class PairDPDGPU : public PairDPD { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with dpd/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_dpd_tstat_gpu.h b/src/GPU/pair_dpd_tstat_gpu.h index 6b3da61696..ff05dc740a 100644 --- a/src/GPU/pair_dpd_tstat_gpu.h +++ b/src/GPU/pair_dpd_tstat_gpu.h @@ -43,16 +43,3 @@ class PairDPDTstatGPU : public PairDPDTstat { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with dpd/tstat/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index d3a22bf1cc..ef939f81fb 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -212,7 +212,7 @@ double PairEAMAlloyGPU::single(int i, int j, int itype, int jtype, double rsq, z2 = ((coeff[3] * p + coeff[4]) * p + coeff[5]) * p + coeff[6]; double fp_i, fp_j; - if (fp_single == false) { + if (!fp_single) { fp_i = ((double *) fp_pinned)[i]; fp_j = ((double *) fp_pinned)[j]; } else { @@ -239,13 +239,13 @@ int PairEAMAlloyGPU::pack_forward_comm(int n, int *list, double *buf, int /* pbc m = 0; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = static_cast(fp_ptr[j]); } } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = fp_ptr[j]; @@ -264,10 +264,10 @@ void PairEAMAlloyGPU::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } } diff --git a/src/GPU/pair_eam_alloy_gpu.h b/src/GPU/pair_eam_alloy_gpu.h index c2cd8a9732..a0c562753a 100644 --- a/src/GPU/pair_eam_alloy_gpu.h +++ b/src/GPU/pair_eam_alloy_gpu.h @@ -54,34 +54,3 @@ class PairEAMAlloyGPU : public PairEAM { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with eam/alloy/gpu pair style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -*/ diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index 09d2b03be4..f174243ced 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -212,7 +212,7 @@ double PairEAMFSGPU::single(int i, int j, int itype, int jtype, double rsq, z2 = ((coeff[3] * p + coeff[4]) * p + coeff[5]) * p + coeff[6]; double fp_i, fp_j; - if (fp_single == false) { + if (!fp_single) { fp_i = ((double *) fp_pinned)[i]; fp_j = ((double *) fp_pinned)[j]; } else { @@ -239,13 +239,13 @@ int PairEAMFSGPU::pack_forward_comm(int n, int *list, double *buf, int /* pbc_fl m = 0; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = static_cast(fp_ptr[j]); } } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = fp_ptr[j]; @@ -264,10 +264,10 @@ void PairEAMFSGPU::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } } diff --git a/src/GPU/pair_eam_fs_gpu.h b/src/GPU/pair_eam_fs_gpu.h index 9bb48d2ba5..9f7952406b 100644 --- a/src/GPU/pair_eam_fs_gpu.h +++ b/src/GPU/pair_eam_fs_gpu.h @@ -54,34 +54,3 @@ class PairEAMFSGPU : public PairEAM { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with eam/fs/gpu pair style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -*/ diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 1fbba6dd6b..c04418720c 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -209,7 +209,7 @@ double PairEAMGPU::single(int i, int j, int itype, int jtype, double rsq, double z2 = ((coeff[3] * p + coeff[4]) * p + coeff[5]) * p + coeff[6]; double fp_i, fp_j; - if (fp_single == false) { + if (!fp_single) { fp_i = ((double *) fp_pinned)[i]; fp_j = ((double *) fp_pinned)[j]; } else { @@ -236,13 +236,13 @@ int PairEAMGPU::pack_forward_comm(int n, int *list, double *buf, int /* pbc_flag m = 0; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = static_cast(fp_ptr[j]); } } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = fp_ptr[j]; @@ -261,10 +261,10 @@ void PairEAMGPU::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; if (fp_single) { - float *fp_ptr = (float *) fp_pinned; + auto fp_ptr = (float *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } else { - double *fp_ptr = (double *) fp_pinned; + auto fp_ptr = (double *) fp_pinned; for (i = first; i < last; i++) fp_ptr[i] = buf[m++]; } } diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index a3727051ba..cf7a165e4a 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -50,16 +50,3 @@ class PairEAMGPU : public PairEAM { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with eam/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_gauss_gpu.h b/src/GPU/pair_gauss_gpu.h index 5df3cce372..76f14f6e9d 100644 --- a/src/GPU/pair_gauss_gpu.h +++ b/src/GPU/pair_gauss_gpu.h @@ -44,16 +44,3 @@ class PairGaussGPU : public PairGauss { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with gauss/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 967817bc36..1d954bb66d 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -145,7 +145,7 @@ void PairGayBerneGPU::compute(int eflag, int vflag) void PairGayBerneGPU::init_style() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); if (!avec) error->all(FLERR, "Pair gayberne/gpu requires atom style ellipsoid"); if (!atom->ellipsoid_flag) error->all(FLERR, "Pair gayberne/gpu requires atom style ellipsoid"); diff --git a/src/GPU/pair_gayberne_gpu.h b/src/GPU/pair_gayberne_gpu.h index bcb9aea958..84defb9200 100644 --- a/src/GPU/pair_gayberne_gpu.h +++ b/src/GPU/pair_gayberne_gpu.h @@ -45,24 +45,3 @@ class PairGayBerneGPU : public PairGayBerne { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair gayberne/gpu requires atom style ellipsoid - -Self-explanatory. - -E: Cannot use newton pair with gayberne/gpu pair style - -Self-explanatory. - -E: Pair gayberne/gpu requires atoms with same type have same shape - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj96_cut_gpu.h b/src/GPU/pair_lj96_cut_gpu.h index a4ff23f7e7..5f83dcb972 100644 --- a/src/GPU/pair_lj96_cut_gpu.h +++ b/src/GPU/pair_lj96_cut_gpu.h @@ -43,16 +43,3 @@ class PairLJ96CutGPU : public PairLJ96Cut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj96/cut/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_charmm_coul_charmm_gpu.h b/src/GPU/pair_lj_charmm_coul_charmm_gpu.h index a9e3e6ab5c..eaaeb9392d 100644 --- a/src/GPU/pair_lj_charmm_coul_charmm_gpu.h +++ b/src/GPU/pair_lj_charmm_coul_charmm_gpu.h @@ -43,20 +43,3 @@ class PairLJCharmmCoulCharmmGPU : public PairLJCharmmCoulCharmm { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/charmm/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/charmm/coul/long/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.h b/src/GPU/pair_lj_charmm_coul_long_gpu.h index d0c2716346..7eeb7dfd84 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.h +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.h @@ -43,24 +43,3 @@ class PairLJCharmmCoulLongGPU : public PairLJCharmmCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/charmm/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/charmm/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.h b/src/GPU/pair_lj_class2_coul_long_gpu.h index 46e8751ba4..ffb168a877 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.h +++ b/src/GPU/pair_lj_class2_coul_long_gpu.h @@ -43,24 +43,3 @@ class PairLJClass2CoulLongGPU : public PairLJClass2CoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/class2/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/class2/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_lj_class2_gpu.h b/src/GPU/pair_lj_class2_gpu.h index 35627e5eea..f7016d078e 100644 --- a/src/GPU/pair_lj_class2_gpu.h +++ b/src/GPU/pair_lj_class2_gpu.h @@ -43,16 +43,3 @@ class PairLJClass2GPU : public PairLJClass2 { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/class2/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_cubic_gpu.h b/src/GPU/pair_lj_cubic_gpu.h index 293e86621e..26489b9f05 100644 --- a/src/GPU/pair_lj_cubic_gpu.h +++ b/src/GPU/pair_lj_cubic_gpu.h @@ -43,16 +43,3 @@ class PairLJCubicGPU : public PairLJCubic { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/cubic/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_cut_coul_cut_gpu.h b/src/GPU/pair_lj_cut_coul_cut_gpu.h index 0e78142594..c04cbb22cb 100644 --- a/src/GPU/pair_lj_cut_coul_cut_gpu.h +++ b/src/GPU/pair_lj_cut_coul_cut_gpu.h @@ -43,20 +43,3 @@ class PairLJCutCoulCutGPU : public PairLJCutCoulCut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/cut/coul/cut/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/cut/coul/cut/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_cut_coul_debye_gpu.h b/src/GPU/pair_lj_cut_coul_debye_gpu.h index 777369069b..87428b17be 100644 --- a/src/GPU/pair_lj_cut_coul_debye_gpu.h +++ b/src/GPU/pair_lj_cut_coul_debye_gpu.h @@ -43,20 +43,3 @@ class PairLJCutCoulDebyeGPU : public PairLJCutCoulDebye { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/cut/coul/debye/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/cut/coul/debye/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_cut_coul_dsf_gpu.h b/src/GPU/pair_lj_cut_coul_dsf_gpu.h index 900957de40..8c6af561a2 100644 --- a/src/GPU/pair_lj_cut_coul_dsf_gpu.h +++ b/src/GPU/pair_lj_cut_coul_dsf_gpu.h @@ -43,20 +43,3 @@ class PairLJCutCoulDSFGPU : public PairLJCutCoulDSF { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/cut/coul/dsf/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/cut/coul/dsf/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.h b/src/GPU/pair_lj_cut_coul_long_gpu.h index 6eee3d3d96..6d16a7b7ac 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.h +++ b/src/GPU/pair_lj_cut_coul_long_gpu.h @@ -44,24 +44,3 @@ class PairLJCutCoulLongGPU : public PairLJCutCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/cut/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/cut/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.h b/src/GPU/pair_lj_cut_coul_msm_gpu.h index ea40dd5d87..afcc4620ef 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.h +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.h @@ -43,20 +43,3 @@ class PairLJCutCoulMSMGPU : public PairLJCutCoulMSM { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/cut/coul/msm/gpu pair style - -Self-explanatory. - -E: Must use 'kspace_modify pressure/scalar no' with GPU MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with GPU MSM Pair styles. - -*/ diff --git a/src/GPU/pair_lj_cut_dipole_cut_gpu.h b/src/GPU/pair_lj_cut_dipole_cut_gpu.h index ae62abbf18..5fb980c3d8 100644 --- a/src/GPU/pair_lj_cut_dipole_cut_gpu.h +++ b/src/GPU/pair_lj_cut_dipole_cut_gpu.h @@ -43,24 +43,3 @@ class PairLJCutDipoleCutGPU : public PairLJCutDipoleCut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair dipole/cut/gpu requires atom attributes q, mu, torque - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with dipole/cut/gpu pair style - -Self-explanatory. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -*/ diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.h b/src/GPU/pair_lj_cut_dipole_long_gpu.h index cec97d55b6..c11440b7ab 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.h +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.h @@ -43,24 +43,3 @@ class PairLJCutDipoleLongGPU : public PairLJCutDipoleLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair lj/cutdipole/long/gpu requires atom attributes q, mu, torque - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/cutdipole/long/gpu pair style - -Self-explanatory. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -*/ diff --git a/src/GPU/pair_lj_cut_gpu.h b/src/GPU/pair_lj_cut_gpu.h index 151e12cf01..d8d0d8cf12 100644 --- a/src/GPU/pair_lj_cut_gpu.h +++ b/src/GPU/pair_lj_cut_gpu.h @@ -44,16 +44,3 @@ class PairLJCutGPU : public PairLJCut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/cut/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.h b/src/GPU/pair_lj_expand_coul_long_gpu.h index d44cc9c11c..8712f8c98c 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.h +++ b/src/GPU/pair_lj_expand_coul_long_gpu.h @@ -44,24 +44,3 @@ class PairLJExpandCoulLongGPU : public PairLJExpandCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/cut/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/cut/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/GPU/pair_lj_expand_gpu.h b/src/GPU/pair_lj_expand_gpu.h index dee3d25022..18af19d952 100644 --- a/src/GPU/pair_lj_expand_gpu.h +++ b/src/GPU/pair_lj_expand_gpu.h @@ -44,16 +44,3 @@ class PairLJExpandGPU : public PairLJExpand { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/expand/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_gromacs_gpu.h b/src/GPU/pair_lj_gromacs_gpu.h index ea7bbe81a7..3b797c1f8d 100644 --- a/src/GPU/pair_lj_gromacs_gpu.h +++ b/src/GPU/pair_lj_gromacs_gpu.h @@ -43,16 +43,3 @@ class PairLJGromacsGPU : public PairLJGromacs { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/gromacs/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.h b/src/GPU/pair_lj_sdk_coul_long_gpu.h index 0ee52af754..02cac49d0b 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.h +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.h @@ -43,25 +43,3 @@ class PairLJSDKCoulLongGPU : public PairLJSDKCoulLong { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style lj/sdk/coul/long/gpu requires atom attribute q - -The atom style defined does not have this attribute. - -E: Cannot use newton pair with lj/sdk/coul/long/gpu pair style - -Self-explanatory. - -E: Pair style is incompatible with KSpace style - -If a pair style with a long-range Coulombic component is selected, -then a kspace style must also be used. - -*/ diff --git a/src/GPU/pair_lj_sdk_gpu.h b/src/GPU/pair_lj_sdk_gpu.h index 8a70f81a64..529349ed0d 100644 --- a/src/GPU/pair_lj_sdk_gpu.h +++ b/src/GPU/pair_lj_sdk_gpu.h @@ -43,16 +43,3 @@ class PairLJSDKGPU : public PairLJSDK { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/sdk/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_lj_sf_dipole_sf_gpu.h b/src/GPU/pair_lj_sf_dipole_sf_gpu.h index 91bb07f244..b89a54c1a9 100644 --- a/src/GPU/pair_lj_sf_dipole_sf_gpu.h +++ b/src/GPU/pair_lj_sf_dipole_sf_gpu.h @@ -43,24 +43,3 @@ class PairLJSFDipoleSFGPU : public PairLJSFDipoleSF { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair dipole/sf/gpu requires atom attributes q, mu, torque - -The atom style defined does not one or more of these attributes. - -E: Cannot use newton pair with dipole/sf/gpu pair style - -Self-explanatory. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -*/ diff --git a/src/GPU/pair_lj_smooth_gpu.h b/src/GPU/pair_lj_smooth_gpu.h index 07d9284f56..2c4a2625bf 100644 --- a/src/GPU/pair_lj_smooth_gpu.h +++ b/src/GPU/pair_lj_smooth_gpu.h @@ -44,16 +44,3 @@ class PairLJSmoothGPU : public PairLJSmooth { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with lj/smooth/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_mie_cut_gpu.h b/src/GPU/pair_mie_cut_gpu.h index c6516eb01c..c364b35abb 100644 --- a/src/GPU/pair_mie_cut_gpu.h +++ b/src/GPU/pair_mie_cut_gpu.h @@ -43,16 +43,3 @@ class PairMIECutGPU : public PairMIECut { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with mie/cut/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_morse_gpu.h b/src/GPU/pair_morse_gpu.h index 4da208de23..6653cb13fb 100644 --- a/src/GPU/pair_morse_gpu.h +++ b/src/GPU/pair_morse_gpu.h @@ -43,16 +43,3 @@ class PairMorseGPU : public PairMorse { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with morse/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index cfe871be2b..2ee0da8f49 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -59,7 +59,7 @@ enum { SPHERE_SPHERE, SPHERE_ELLIPSE, ELLIPSE_SPHERE, ELLIPSE_ELLIPSE }; PairRESquaredGPU::PairRESquaredGPU(LAMMPS *lmp) : PairRESquared(lmp), gpu_mode(GPU_FORCE) { reinitflag = 0; - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); if (!avec) error->all(FLERR, "Pair resquared/gpu requires atom style ellipsoid"); quat_nmax = 0; quat = nullptr; diff --git a/src/GPU/pair_resquared_gpu.h b/src/GPU/pair_resquared_gpu.h index b808607af8..a4c924c935 100644 --- a/src/GPU/pair_resquared_gpu.h +++ b/src/GPU/pair_resquared_gpu.h @@ -45,24 +45,3 @@ class PairRESquaredGPU : public PairRESquared { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Pair resquared/gpu requires atom style ellipsoid - -Self-explanatory. - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with resquared/gpu pair style - -Self-explanatory. - -E: Pair resquared/gpu requires atoms with same type have same shape - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_soft_gpu.h b/src/GPU/pair_soft_gpu.h index 2f42a3a075..12220dd4aa 100644 --- a/src/GPU/pair_soft_gpu.h +++ b/src/GPU/pair_soft_gpu.h @@ -44,16 +44,3 @@ class PairSoftGPU : public PairSoft { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with soft/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_sw_gpu.h b/src/GPU/pair_sw_gpu.h index 4fe5d538b3..46feb1d179 100644 --- a/src/GPU/pair_sw_gpu.h +++ b/src/GPU/pair_sw_gpu.h @@ -45,25 +45,3 @@ class PairSWGPU : public PairSW { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style sw/gpu requires atom IDs - -This is a requirement to use this potential. - -E: Pair style sw/gpu requires newton pair off - -See the newton command. This is a restriction to use this potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/GPU/pair_table_gpu.h b/src/GPU/pair_table_gpu.h index 9653e65524..d36f9ee194 100644 --- a/src/GPU/pair_table_gpu.h +++ b/src/GPU/pair_table_gpu.h @@ -43,24 +43,3 @@ class PairTableGPU : public PairTable { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with table/gpu pair style - -Self-explanatory. - -E: Pair distance < table inner cutoff - -Two atoms are closer together than the pairwise table allows. - -E: Pair distance > table outer cutoff - -Two atoms are further apart than the pairwise table allows. - -*/ diff --git a/src/GPU/pair_tersoff_gpu.h b/src/GPU/pair_tersoff_gpu.h index 700b0b3284..0766c24b92 100644 --- a/src/GPU/pair_tersoff_gpu.h +++ b/src/GPU/pair_tersoff_gpu.h @@ -46,25 +46,3 @@ class PairTersoffGPU : public PairTersoff { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style tersoff/gpu requires atom IDs - -This is a requirement to use the tersoff/gpu potential. - -E: Pair style tersoff/gpu requires newton pair off - -See the newton command. This is a restriction to use this pair style. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/GPU/pair_tersoff_mod_gpu.h b/src/GPU/pair_tersoff_mod_gpu.h index e7a550b616..a5d002d129 100644 --- a/src/GPU/pair_tersoff_mod_gpu.h +++ b/src/GPU/pair_tersoff_mod_gpu.h @@ -46,29 +46,3 @@ class PairTersoffMODGPU : public PairTersoffMOD { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style tersoff/mod/gpu requires atom IDs - -UNDOCUMENTED - -E: Pair style tersoff/mod/gpu requires newton pair off - -UNDOCUMENTED - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -U: Pair style tersoff/gpu requires newton pair off - -See the newton command. This is a restriction to use this pair style. - -*/ diff --git a/src/GPU/pair_tersoff_zbl_gpu.h b/src/GPU/pair_tersoff_zbl_gpu.h index 566d3356b0..3dff093263 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.h +++ b/src/GPU/pair_tersoff_zbl_gpu.h @@ -46,29 +46,3 @@ class PairTersoffZBLGPU : public PairTersoffZBL { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style tersoff/zbl/gpu requires atom IDs - -UNDOCUMENTED - -E: Pair style tersoff/zbl/gpu requires newton pair off - -UNDOCUMENTED - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -U: Pair style tersoff/gpu requires newton pair off - -See the newton command. This is a restriction to use this pair style. - -*/ diff --git a/src/GPU/pair_ufm_gpu.h b/src/GPU/pair_ufm_gpu.h index 43104cb07d..030f719d6d 100644 --- a/src/GPU/pair_ufm_gpu.h +++ b/src/GPU/pair_ufm_gpu.h @@ -50,16 +50,3 @@ class PairUFMGPU : public PairUFM { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with ufm/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_vashishta_gpu.h b/src/GPU/pair_vashishta_gpu.h index 171f8b1b6d..a9fee5045b 100644 --- a/src/GPU/pair_vashishta_gpu.h +++ b/src/GPU/pair_vashishta_gpu.h @@ -45,25 +45,3 @@ class PairVashishtaGPU : public PairVashishta { #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair style vashishta/gpu requires atom IDs - -This is a requirement to use this potential. - -E: Pair style vashishta/gpu requires newton pair off - -See the newton command. This is a restriction to use this potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/GPU/pair_yukawa_colloid_gpu.h b/src/GPU/pair_yukawa_colloid_gpu.h index e9a2cff98c..78bad04566 100644 --- a/src/GPU/pair_yukawa_colloid_gpu.h +++ b/src/GPU/pair_yukawa_colloid_gpu.h @@ -43,20 +43,3 @@ class PairYukawaColloidGPU : public PairYukawaColloid { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Pair yukawa/colloid/gpu requires atom style sphere - -Self-explanatory. - -E: Cannot use newton pair with yukawa/colloid/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_yukawa_gpu.h b/src/GPU/pair_yukawa_gpu.h index b08376e528..61c4b0099c 100644 --- a/src/GPU/pair_yukawa_gpu.h +++ b/src/GPU/pair_yukawa_gpu.h @@ -43,16 +43,3 @@ class PairYukawaGPU : public PairYukawa { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with yukawa/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pair_zbl_gpu.h b/src/GPU/pair_zbl_gpu.h index 6fcfd82abd..d4812188a1 100644 --- a/src/GPU/pair_zbl_gpu.h +++ b/src/GPU/pair_zbl_gpu.h @@ -43,16 +43,3 @@ class PairZBLGPU : public PairZBL { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Cannot use newton pair with zbl/gpu pair style - -Self-explanatory. - -*/ diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index c388db4a2c..d0fd3e66ea 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -514,7 +514,7 @@ void PPPMGPU::poisson_ik() void PPPMGPU::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -574,7 +574,7 @@ void PPPMGPU::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMGPU::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -634,7 +634,7 @@ void PPPMGPU::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMGPU::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO_GPU) { FFT_SCALAR *src = &density_brick_gpu[nzlo_out][nylo_out][nxlo_out]; @@ -653,7 +653,7 @@ void PPPMGPU::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPMGPU::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO_GPU) { FFT_SCALAR *dest = &density_brick_gpu[nzlo_out][nylo_out][nxlo_out]; @@ -679,9 +679,9 @@ FFT_SCALAR ***PPPMGPU::create_3d_offset(int n1lo, int n1hi, int n2lo, int n2hi, int n2 = n2hi - n2lo + 1; int n3 = n3hi - n3lo + 1; - FFT_SCALAR **plane = (FFT_SCALAR **) + auto plane = (FFT_SCALAR **) memory->smalloc(n1*n2*sizeof(FFT_SCALAR *),name); - FFT_SCALAR ***array = (FFT_SCALAR ***) + auto array = (FFT_SCALAR ***) memory->smalloc(n1*sizeof(FFT_SCALAR **),name); int n = 0; diff --git a/src/GPU/pppm_gpu.h b/src/GPU/pppm_gpu.h index 7835a4ec30..84ce88590e 100644 --- a/src/GPU/pppm_gpu.h +++ b/src/GPU/pppm_gpu.h @@ -59,54 +59,3 @@ class PPPMGPU : public PPPM { #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: Cannot currently use pppm/gpu with fix balance. - -Self-explanatory. - -E: Cannot (yet) do analytic differentiation with pppm/gpu - -This is a current restriction of this command. - -E: Cannot use order greater than 8 with pppm/gpu. - -Self-explanatory. - -E: Insufficient memory on accelerator - -There is insufficient memory on one of the devices specified for the gpu -package - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -E: Cannot (yet) use K-space slab correction with compute group/group for triclinic systems - -UNDOCUMENTED - -E: Cannot (yet) use kspace_modify diff ad with compute group/group - -UNDOCUMENTED - -*/ diff --git a/src/GRANULAR/compute_contact_atom.h b/src/GRANULAR/compute_contact_atom.h index 784bff568f..f01815e666 100644 --- a/src/GRANULAR/compute_contact_atom.h +++ b/src/GRANULAR/compute_contact_atom.h @@ -45,25 +45,3 @@ class ComputeContactAtom : public Compute { #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 contact/atom requires atom style sphere - -Self-explanatory. - -E: Compute contact/atom requires a pair style be defined - -Self-explanatory. - -W: More than one compute contact/atom - -It is not efficient to use compute contact/atom more than once. - -*/ diff --git a/src/GRANULAR/compute_fabric.h b/src/GRANULAR/compute_fabric.h index b92f14bd2b..0cdc758a7f 100644 --- a/src/GRANULAR/compute_fabric.h +++ b/src/GRANULAR/compute_fabric.h @@ -47,33 +47,3 @@ class ComputeFabric : public Compute { #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 fabric radius style requires atom attribute radius - -Self-explanatory. - -E: No pair style is defined for compute fabric - -Self-explanatory. - -E: Pair style does not support compute fabric normal or tangential force - -Pair style must be single enabled to calculate the normal or tangential force tensors - -E: Pair style does not calculate tangential forces for compute fabric - -The tangential force tensor can only be calculated for granular pair styles with tangential forces - -E: Compute fabric does not support pair styles that extend beyond contact - -Granular pair styles that extend beyond contact such as JKR or DMT are not supported - -*/ diff --git a/src/GRANULAR/fix_damping_cundall.cpp b/src/GRANULAR/fix_damping_cundall.cpp index 0a2f27061b..6f2234d68f 100644 --- a/src/GRANULAR/fix_damping_cundall.cpp +++ b/src/GRANULAR/fix_damping_cundall.cpp @@ -115,7 +115,7 @@ void FixDampingCundall::init() int max_respa = 0; if (utils::strmatch(update->integrate_style, "^respa")) { - ilevel_respa = max_respa = ((Respa *) update->integrate)->nlevels - 1; + ilevel_respa = max_respa = (dynamic_cast(update->integrate))->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, max_respa); } @@ -143,9 +143,9 @@ void FixDampingCundall::setup(int vflag) if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag, ilevel_respa, 0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/GRANULAR/fix_damping_cundall.h b/src/GRANULAR/fix_damping_cundall.h index aed7e979cc..238d1370c1 100644 --- a/src/GRANULAR/fix_damping_cundall.h +++ b/src/GRANULAR/fix_damping_cundall.h @@ -48,13 +48,3 @@ class FixDampingCundall : public Fix { #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. - -*/ diff --git a/src/GRANULAR/fix_freeze.cpp b/src/GRANULAR/fix_freeze.cpp index 1e952ef132..d3ed4db921 100644 --- a/src/GRANULAR/fix_freeze.cpp +++ b/src/GRANULAR/fix_freeze.cpp @@ -73,11 +73,11 @@ void FixFreeze::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - int nlevels_respa = ((Respa *) update->integrate)->nlevels; + int nlevels_respa = (dynamic_cast( update->integrate))->nlevels; for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); post_force_respa(vflag,ilevel,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } } } diff --git a/src/GRANULAR/fix_freeze.h b/src/GRANULAR/fix_freeze.h index 23cdc7c305..24180051d7 100644 --- a/src/GRANULAR/fix_freeze.h +++ b/src/GRANULAR/fix_freeze.h @@ -43,22 +43,3 @@ class FixFreeze : public Fix { #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: Fix freeze requires atom attribute torque - -The atom style defined does not have this attribute. - -E: More than one fix freeze - -Only one of these fixes can be defined, since the granular pair -potentials access it. - -*/ diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 34963430e3..7a8bf630df 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -37,107 +36,101 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathConst; +using MathConst::MY_2PI; +using MathConst::MY_4PI3; +using MathConst::MY_PI; -enum{ATOM,MOLECULE}; -enum{ONE,RANGE,POLY}; +enum { ATOM, MOLECULE }; +enum { ONE, RANGE, POLY }; -#define EPSILON 0.001 -#define SMALL 1.0e-10 +static constexpr double EPSILON = 0.001; +static constexpr double SMALL = 1.0e-10; /* ---------------------------------------------------------------------- */ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), radius_poly(nullptr), frac_poly(nullptr), - idrigid(nullptr), idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), - imageflags(nullptr), fixrigid(nullptr), fixshake(nullptr), recvcounts(nullptr), - displs(nullptr), random(nullptr), random2(nullptr) + Fix(lmp, narg, arg), radius_poly(nullptr), frac_poly(nullptr), idrigid(nullptr), + idshake(nullptr), idregion(nullptr), region(nullptr), onemols(nullptr), molfrac(nullptr), + coords(nullptr), imageflags(nullptr), fixrigid(nullptr), fixshake(nullptr), recvcounts(nullptr), + displs(nullptr), random(nullptr), random2(nullptr) { - if (narg < 6) error->all(FLERR,"Illegal fix pour command"); + if (narg < 6) error->all(FLERR, "Illegal fix pour command"); - if (lmp->kokkos) - error->all(FLERR,"Cannot yet use fix pour with the KOKKOS package"); + if (lmp->kokkos) error->all(FLERR, "Cannot yet use fix pour with the KOKKOS package"); time_depend = 1; if (!atom->radius_flag || !atom->rmass_flag) - error->all(FLERR,"Fix pour requires atom attributes radius, rmass"); + error->all(FLERR, "Fix pour requires atom attributes radius, rmass"); // required args - ninsert = utils::inumeric(FLERR,arg[3],false,lmp); - ntype = utils::inumeric(FLERR,arg[4],false,lmp); - seed = utils::inumeric(FLERR,arg[5],false,lmp); + 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"); + if (seed <= 0) error->all(FLERR, "Illegal fix pour command"); // read options from end of input line - options(narg-6,&arg[6]); + options(narg - 6, &arg[6]); // error check on type if (mode == ATOM && (ntype <= 0 || ntype > atom->ntypes)) - error->all(FLERR,"Invalid atom type in fix pour command"); + error->all(FLERR, "Invalid atom type in fix pour command"); // error checks on region and its extent being inside simulation box - if (iregion == -1) error->all(FLERR,"Must specify a region in fix pour"); - if (domain->regions[iregion]->bboxflag == 0) - error->all(FLERR,"Fix pour region does not support a bounding box"); - if (domain->regions[iregion]->dynamic_check()) - error->all(FLERR,"Fix pour region cannot be dynamic"); + if (!region) error->all(FLERR, "Must specify a region in fix pour"); + if (region->bboxflag == 0) + error->all(FLERR, "Fix pour region {} does not support a bounding box", idregion); + if (region->dynamic_check()) error->all(FLERR, "Fix pour region {} cannot be dynamic", idregion); - if (strcmp(domain->regions[iregion]->style,"block") == 0) { + if (strcmp(region->style, "block") == 0) { + auto block = dynamic_cast(region); region_style = 1; - xlo = ((RegBlock *) domain->regions[iregion])->xlo; - xhi = ((RegBlock *) domain->regions[iregion])->xhi; - ylo = ((RegBlock *) domain->regions[iregion])->ylo; - yhi = ((RegBlock *) domain->regions[iregion])->yhi; - zlo = ((RegBlock *) domain->regions[iregion])->zlo; - zhi = ((RegBlock *) domain->regions[iregion])->zhi; - if (xlo < domain->boxlo[0] || xhi > domain->boxhi[0] || - ylo < domain->boxlo[1] || yhi > domain->boxhi[1] || - zlo < domain->boxlo[2] || zhi > domain->boxhi[2]) - error->all(FLERR,"Insertion region extends outside simulation box"); - } else if (strcmp(domain->regions[iregion]->style,"cylinder") == 0) { + xlo = block->xlo; + xhi = block->xhi; + ylo = block->ylo; + yhi = block->yhi; + zlo = block->zlo; + zhi = block->zhi; + if (xlo < domain->boxlo[0] || xhi > domain->boxhi[0] || ylo < domain->boxlo[1] || + yhi > domain->boxhi[1] || zlo < domain->boxlo[2] || zhi > domain->boxhi[2]) + error->all(FLERR, "Insertion region extends outside simulation box"); + } else if (strcmp(region->style, "cylinder") == 0) { + auto cylinder = dynamic_cast(region); region_style = 2; - char axis = ((RegCylinder *) domain->regions[iregion])->axis; - xc = ((RegCylinder *) domain->regions[iregion])->c1; - yc = ((RegCylinder *) domain->regions[iregion])->c2; - rc = ((RegCylinder *) domain->regions[iregion])->radius; - zlo = ((RegCylinder *) domain->regions[iregion])->lo; - zhi = ((RegCylinder *) domain->regions[iregion])->hi; - if (axis != 'z') - error->all(FLERR,"Must use a z-axis cylinder region with fix pour"); - if (xc-rc < domain->boxlo[0] || xc+rc > domain->boxhi[0] || - yc-rc < domain->boxlo[1] || yc+rc > domain->boxhi[1] || - zlo < domain->boxlo[2] || zhi > domain->boxhi[2]) - error->all(FLERR,"Insertion region extends outside simulation box"); - } else error->all(FLERR,"Must use a block or cylinder region with fix pour"); + char axis = cylinder->axis; + xc = cylinder->c1; + yc = cylinder->c2; + rc = cylinder->radius; + zlo = cylinder->lo; + zhi = cylinder->hi; + if (axis != 'z') error->all(FLERR, "Must use a z-axis cylinder region with fix pour"); + if (xc - rc < domain->boxlo[0] || xc + rc > domain->boxhi[0] || yc - rc < domain->boxlo[1] || + yc + rc > domain->boxhi[1] || zlo < domain->boxlo[2] || zhi > domain->boxhi[2]) + error->all(FLERR, "Insertion region extends outside simulation box"); + } else + error->all(FLERR, "Must use a block or cylinder region with fix pour"); if (region_style == 2 && domain->dimension == 2) - error->all(FLERR, - "Must use a block region with fix pour for 2d simulations"); + error->all(FLERR, "Must use a block region with fix pour for 2d simulations"); // error check and further setup for mode = MOLECULE - if (atom->tag_enable == 0) - error->all(FLERR,"Cannot use fix_pour unless atoms have IDs"); + if (atom->tag_enable == 0) error->all(FLERR, "Cannot use fix_pour unless atoms have IDs"); if (mode == MOLECULE) { for (int i = 0; i < nmol; i++) { - if (onemols[i]->xflag == 0) - error->all(FLERR,"Fix pour molecule must have coordinates"); - if (onemols[i]->typeflag == 0) - error->all(FLERR,"Fix pour molecule must have atom types"); - if (ntype+onemols[i]->ntypes <= 0 || - ntype+onemols[i]->ntypes > atom->ntypes) - error->all(FLERR,"Invalid atom type in fix pour mol command"); + if (onemols[i]->xflag == 0) error->all(FLERR, "Fix pour molecule must have coordinates"); + if (onemols[i]->typeflag == 0) error->all(FLERR, "Fix pour molecule must have atom types"); + if (ntype + onemols[i]->ntypes <= 0 || ntype + onemols[i]->ntypes > atom->ntypes) + error->all(FLERR, "Invalid atom type in fix pour mol command"); if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) - error->all(FLERR,"Fix pour molecule template ID must be same " - "as atom style template ID"); + error->all(FLERR, "Fix pour molecule template ID must be same as atom style template ID"); onemols[i]->check_attributes(0); // fix pour uses geoemetric center of molecule for insertion @@ -146,23 +139,20 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : } } - if (rigidflag && mode == ATOM) - error->all(FLERR,"Cannot use fix pour rigid and not molecule"); - if (shakeflag && mode == ATOM) - error->all(FLERR,"Cannot use fix pour shake and not molecule"); - if (rigidflag && shakeflag) - error->all(FLERR,"Cannot use fix pour rigid and shake"); + if (rigidflag && mode == ATOM) error->all(FLERR, "Cannot use fix pour rigid and not molecule"); + if (shakeflag && mode == ATOM) error->all(FLERR, "Cannot use fix pour shake and not molecule"); + if (rigidflag && shakeflag) error->all(FLERR, "Cannot use fix pour rigid and shake"); // setup of coords and imageflags array - if (mode == ATOM) natom_max = 1; + if (mode == ATOM) + natom_max = 1; else { natom_max = 0; - for (int i = 0; i < nmol; i++) - natom_max = MAX(natom_max,onemols[i]->natoms); + for (int i = 0; i < nmol; i++) natom_max = MAX(natom_max, onemols[i]->natoms); } - memory->create(coords,natom_max,4,"pour:coords"); - memory->create(imageflags,natom_max,"pour:imageflags"); + memory->create(coords, natom_max, 4, "pour:coords"); + memory->create(imageflags, natom_max, "pour:imageflags"); // find max atom and molecule IDs just once @@ -172,13 +162,13 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : // warm up the generator 30x to avoid correlations in first-particle // positions if runs are repeated with consecutive seeds - random = new RanPark(lmp,seed); - for (int ii=0; ii < 30; ii++) random->uniform(); + random = new RanPark(lmp, seed); + for (int ii = 0; ii < 30; ii++) random->uniform(); // allgather arrays - MPI_Comm_rank(world,&me); - MPI_Comm_size(world,&nprocs); + MPI_Comm_rank(world, &me); + MPI_Comm_size(world, &nprocs); recvcounts = new int[nprocs]; displs = new int[nprocs]; @@ -187,8 +177,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : auto fixlist = modify->get_fix_by_style("^gravity"); if (fixlist.size() != 1) - error->all(FLERR,"There must be exactly one fix gravity defined for fix pour"); - auto fixgrav = (FixGravity *)fixlist.front(); + error->all(FLERR, "There must be exactly one fix gravity defined for fix pour"); + auto fixgrav = dynamic_cast(fixlist.front()); grav = -fixgrav->magnitude * force->ftm2v; @@ -201,7 +191,7 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : // gives t = [-(vz-rate) - sqrt((vz-rate)^2 - 2*grav*(zhi-zlo))] / grav // where zhi-zlo > 0, grav < 0, and vz & rate can be either > 0 or < 0 - double v_relative,delta; + double v_relative, delta; if (domain->dimension == 3) { v_relative = vz - rate; delta = zhi - zlo; @@ -209,8 +199,8 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : v_relative = vy - rate; delta = yhi - ylo; } - double t = (-v_relative - sqrt(v_relative*v_relative - 2.0*grav*delta)) / grav; - nfreq = static_cast(t/update->dt + 0.5); + double t = (-v_relative - sqrt(v_relative * v_relative - 2.0 * grav * delta)) / grav; + nfreq = static_cast(t / update->dt + 0.5); // 1st insertion on next timestep @@ -225,52 +215,51 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : // volume_one = volume of inserted particle (with max possible radius) // in 3d, insure dy >= 1, for quasi-2d simulations - double volume,volume_one=1.0; + double volume, volume_one = 1.0; molradius_max = 0.0; if (mode == MOLECULE) { - for (int i = 0; i < nmol; i++) - molradius_max = MAX(molradius_max,onemols[i]->molradius); + for (int i = 0; i < nmol; i++) molradius_max = MAX(molradius_max, onemols[i]->molradius); } if (domain->dimension == 3) { if (region_style == 1) { double dy = yhi - ylo; if (dy < 1.0) dy = 1.0; - volume = (xhi-xlo) * dy * (zhi-zlo); - } else volume = MY_PI*rc*rc * (zhi-zlo); + volume = (xhi - xlo) * dy * (zhi - zlo); + } else + volume = MY_PI * rc * rc * (zhi - zlo); if (mode == MOLECULE) { - volume_one = 4.0/3.0 * MY_PI * molradius_max*molradius_max*molradius_max; + volume_one = MY_4PI3 * molradius_max * molradius_max * molradius_max; } else if (dstyle == ONE || dstyle == RANGE) { - volume_one = 4.0/3.0 * MY_PI * radius_max*radius_max*radius_max; + volume_one = MY_4PI3 * radius_max * radius_max * radius_max; } else if (dstyle == POLY) { volume_one = 0.0; for (int i = 0; i < npoly; i++) - volume_one += (4.0/3.0 * MY_PI * - radius_poly[i]*radius_poly[i]*radius_poly[i]) * frac_poly[i]; + volume_one += (MY_4PI3 * radius_poly[i] * radius_poly[i] * radius_poly[i]) * frac_poly[i]; } } else { - volume = (xhi-xlo) * (yhi-ylo); + volume = (xhi - xlo) * (yhi - ylo); if (mode == MOLECULE) { - volume_one = MY_PI * molradius_max*molradius_max; + volume_one = MY_PI * molradius_max * molradius_max; } else if (dstyle == ONE || dstyle == RANGE) { - volume_one = MY_PI * radius_max*radius_max; + volume_one = MY_PI * radius_max * radius_max; } else if (dstyle == POLY) { volume_one = 0.0; for (int i = 0; i < npoly; i++) - volume_one += (MY_PI * radius_poly[i]*radius_poly[i]) * frac_poly[i]; + volume_one += (MY_PI * radius_poly[i] * radius_poly[i]) * frac_poly[i]; } } - nper = static_cast (volfrac*volume/volume_one); - if (nper == 0) error->all(FLERR,"Fix pour insertion count per timestep is 0"); - int nfinal = update->ntimestep + 1 + ((bigint)ninsert-1)/nper * nfreq; + nper = static_cast(volfrac * volume / volume_one); + if (nper == 0) error->all(FLERR, "Fix pour insertion count per timestep is 0"); + int nfinal = update->ntimestep + 1 + ((bigint) ninsert - 1) / nper * nfreq; // print stats if (me == 0) - utils::logmesg(lmp, "Particle insertion: {} every {} steps, {} by step {}\n", - nper,nfreq,ninsert,nfinal); + utils::logmesg(lmp, "Particle insertion: {} every {} steps, {} by step {}\n", nper, nfreq, + ninsert, nfinal); } /* ---------------------------------------------------------------------- */ @@ -278,15 +267,15 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : FixPour::~FixPour() { delete random; - delete [] molfrac; - delete [] idrigid; - delete [] idshake; - delete [] radius_poly; - delete [] frac_poly; + delete[] molfrac; + delete[] idrigid; + delete[] idshake; + delete[] radius_poly; + delete[] frac_poly; memory->destroy(coords); memory->destroy(imageflags); - delete [] recvcounts; - delete [] displs; + delete[] recvcounts; + delete[] displs; } /* ---------------------------------------------------------------------- */ @@ -302,8 +291,10 @@ int FixPour::setmask() void FixPour::init() { - if (domain->triclinic) - error->all(FLERR,"Cannot use fix pour with triclinic box"); + if (domain->triclinic) error->all(FLERR, "Cannot use fix pour with triclinic box"); + + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Fix pour region {} does not exist", idregion); // insure gravity fix (still) exists // for 3d must point in -z, for 2d must point in -y @@ -311,37 +302,35 @@ void FixPour::init() auto fixlist = modify->get_fix_by_style("^gravity"); if (fixlist.size() != 1) - error->all(FLERR,"There must be exactly one fix gravity defined for fix pour"); - auto fixgrav = (FixGravity *)fixlist.front(); + error->all(FLERR, "There must be exactly one fix gravity defined for fix pour"); + auto fixgrav = dynamic_cast(fixlist.front()); if (fixgrav->varflag != FixGravity::CONSTANT) - error->all(FLERR,"Fix gravity for fix pour must be constant"); + error->all(FLERR, "Fix gravity for fix pour must be constant"); double xgrav = fixgrav->xgrav; double ygrav = fixgrav->ygrav; double zgrav = fixgrav->zgrav; if (domain->dimension == 3) { - if (fabs(xgrav) > EPSILON || fabs(ygrav) > EPSILON || - fabs(zgrav+1.0) > EPSILON) - error->all(FLERR,"Gravity must point in -z to use with fix pour in 3d"); + if (fabs(xgrav) > EPSILON || fabs(ygrav) > EPSILON || fabs(zgrav + 1.0) > EPSILON) + error->all(FLERR, "Gravity must point in -z to use with fix pour in 3d"); } else { - if (fabs(xgrav) > EPSILON || fabs(ygrav+1.0) > EPSILON || - fabs(zgrav) > EPSILON) - error->all(FLERR,"Gravity must point in -y to use with fix pour in 2d"); + if (fabs(xgrav) > EPSILON || fabs(ygrav + 1.0) > EPSILON || fabs(zgrav) > EPSILON) + error->all(FLERR, "Gravity must point in -y to use with fix pour in 2d"); } double gnew = -fixgrav->magnitude * force->ftm2v; - if (gnew != grav) error->all(FLERR,"Gravity changed since fix pour was created"); + if (gnew != grav) error->all(FLERR, "Gravity changed since fix pour was created"); // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one if (rigidflag) { fixrigid = modify->get_fix_by_id(idrigid); - if (!fixrigid) error->all(FLERR,"Fix pour rigid fix does not exist"); + if (!fixrigid) error->all(FLERR, "Fix pour rigid fix {} does not exist", idrigid); int tmp; - if (onemols != (Molecule **) fixrigid->extract("onemol",tmp)) - error->all(FLERR,"Fix pour and fix rigid/small not using same molecule template ID"); + if (onemols != (Molecule **) fixrigid->extract("onemol", tmp)) + error->all(FLERR, "Fix pour and fix rigid/small not using same molecule template ID"); } // if shakeflag defined, check for SHAKE fix @@ -349,10 +338,10 @@ void FixPour::init() if (shakeflag) { fixshake = modify->get_fix_by_id(idshake); - if (!fixshake) error->all(FLERR,"Fix pour shake fix does not exist"); + if (!fixshake) error->all(FLERR, "Fix pour shake fix {} does not exist", idshake); int tmp; - if (onemols != (Molecule **) fixshake->extract("onemol",tmp)) - error->all(FLERR,"Fix pour and fix shake not using same molecule template ID"); + if (onemols != (Molecule **) fixshake->extract("onemol", tmp)) + error->all(FLERR, "Fix pour and fix shake not using same molecule template ID"); } } @@ -360,8 +349,10 @@ void FixPour::init() void FixPour::setup_pre_exchange() { - if (ninserted < ninsert) next_reneighbor = update->ntimestep + 1; - else next_reneighbor = 0; + if (ninserted < ninsert) + next_reneighbor = update->ntimestep + 1; + else + next_reneighbor = 0; } /* ---------------------------------------------------------------------- @@ -370,8 +361,8 @@ void FixPour::setup_pre_exchange() void FixPour::pre_exchange() { - int i,m,flag,nlocalprev,imol,natom; - double r[3],rotmat[3][3],quat[4],vnew[3]; + int i, m, flag, nlocalprev, imol, natom; + double r[3], rotmat[3][3], quat[4], vnew[3]; double *newcoord; // just return if should not be called on this timestep @@ -415,24 +406,24 @@ void FixPour::pre_exchange() if (overlap(i)) ncount++; int nprevious; - MPI_Allreduce(&ncount,&nprevious,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&ncount, &nprevious, 1, MPI_INT, MPI_SUM, world); // xmine is for my atoms // xnear is for atoms from all procs + atoms to be inserted - double **xmine,**xnear; - memory->create(xmine,ncount,4,"fix_pour:xmine"); - memory->create(xnear,nprevious+nnew*natom_max,4,"fix_pour:xnear"); + double **xmine, **xnear; + memory->create(xmine, ncount, 4, "fix_pour:xmine"); + memory->create(xnear, nprevious + nnew * natom_max, 4, "fix_pour:xnear"); int nnear = nprevious; // setup for allgatherv - int n = 4*ncount; - MPI_Allgather(&n,1,MPI_INT,recvcounts,1,MPI_INT,world); + int n = 4 * ncount; + MPI_Allgather(&n, 1, MPI_INT, recvcounts, 1, MPI_INT, world); displs[0] = 0; for (int iproc = 1; iproc < nprocs; iproc++) - displs[iproc] = displs[iproc-1] + recvcounts[iproc-1]; + displs[iproc] = displs[iproc - 1] + recvcounts[iproc - 1]; // load up xmine array @@ -453,8 +444,7 @@ void FixPour::pre_exchange() double *ptr = nullptr; if (ncount) ptr = xmine[0]; - MPI_Allgatherv(ptr,4*ncount,MPI_DOUBLE, - xnear[0],recvcounts,displs,MPI_DOUBLE,world); + MPI_Allgatherv(ptr, 4 * ncount, MPI_DOUBLE, xnear[0], recvcounts, displs, MPI_DOUBLE, world); // insert new particles into xnear list, one by one // check against all nearby atoms and previously inserted ones @@ -469,7 +459,7 @@ void FixPour::pre_exchange() // store image flag modified due to PBC int success; - double radtmp,delx,dely,delz,rsq,radsum,rn,h; + double radtmp, delx, dely, delz, rsq, radsum, rn, h; double coord[3]; double denstmp; @@ -482,13 +472,13 @@ void FixPour::pre_exchange() while (nsuccess < nnew) { rn = random->uniform(); - h = hi_current - rn*rn * (hi_current-lo_current); + h = hi_current - rn * rn * (hi_current - lo_current); if (mode == ATOM) radtmp = radius_sample(); success = 0; while (attempt < maxiter) { attempt++; - xyz_random(h,coord); + xyz_random(h, coord); if (mode == ATOM) { natom = 1; @@ -496,8 +486,7 @@ void FixPour::pre_exchange() coords[0][1] = coord[1]; coords[0][2] = coord[2]; coords[0][3] = radtmp; - imageflags[0] = ((imageint) IMGMAX << IMG2BITS) | - ((imageint) IMGMAX << IMGBITS) | IMGMAX; + imageflags[0] = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; } else { double rng = random->uniform(); imol = 0; @@ -513,10 +502,10 @@ void FixPour::pre_exchange() } double theta = random->uniform() * MY_2PI; MathExtra::norm3(r); - MathExtra::axisangle_to_quat(r,theta,quat); - MathExtra::quat_to_mat(quat,rotmat); + MathExtra::axisangle_to_quat(r, theta, quat); + MathExtra::quat_to_mat(quat, rotmat); for (i = 0; i < natom; i++) { - MathExtra::matvec(rotmat,onemols[imol]->dx[i],coords[i]); + MathExtra::matvec(rotmat, onemols[imol]->dx[i], coords[i]); coords[i][0] += coord[0]; coords[i][1] += coord[1]; coords[i][2] += coord[2]; @@ -527,11 +516,11 @@ void FixPour::pre_exchange() if (onemols[imol]->radiusflag) coords[i][3] = onemols[imol]->radius[i]; - else coords[i][3] = 0.5; + else + coords[i][3] = 0.5; - imageflags[i] = ((imageint) IMGMAX << IMG2BITS) | - ((imageint) IMGMAX << IMGBITS) | IMGMAX; - domain->remap(coords[i],imageflags[i]); + imageflags[i] = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; + domain->remap(coords[i], imageflags[i]); } } @@ -543,10 +532,10 @@ void FixPour::pre_exchange() delx = coords[m][0] - xnear[i][0]; dely = coords[m][1] - xnear[i][1]; delz = coords[m][2] - xnear[i][2]; - domain->minimum_image(delx,dely,delz); - rsq = delx*delx + dely*dely + delz*delz; + domain->minimum_image(delx, dely, delz); + rsq = delx * delx + dely * dely + delz * delz; radsum = coords[m][3] + xnear[i][3]; - if (rsq <= radsum*radsum) break; + if (rsq <= radsum * radsum) break; } if (i < nnear) break; } @@ -583,12 +572,12 @@ void FixPour::pre_exchange() // coord[2] = hi_current + vz*t + 1/2 grav t^2 if (dimension == 3) { - vnew[0] = vxlo + random->uniform() * (vxhi-vxlo); - vnew[1] = vylo + random->uniform() * (vyhi-vylo); - vnew[2] = -sqrt(vz*vz + 2.0*grav*(coord[2]-hi_current)); + vnew[0] = vxlo + random->uniform() * (vxhi - vxlo); + vnew[1] = vylo + random->uniform() * (vyhi - vylo); + vnew[2] = -sqrt(vz * vz + 2.0 * grav * (coord[2] - hi_current)); } else { - vnew[0] = vxlo + random->uniform() * (vxhi-vxlo); - vnew[1] = -sqrt(vy*vy + 2.0*grav*(coord[1]-hi_current)); + vnew[0] = vxlo + random->uniform() * (vxhi - vxlo); + vnew[1] = -sqrt(vy * vy + 2.0 * grav * (coord[1] - hi_current)); vnew[2] = 0.0; } @@ -598,45 +587,47 @@ void FixPour::pre_exchange() // set group mask to "all" plus fix group for (m = 0; m < natom; m++) { - if (mode == ATOM) - denstmp = density_lo + random->uniform() * (density_hi-density_lo); + if (mode == ATOM) denstmp = density_lo + random->uniform() * (density_hi - density_lo); newcoord = coords[m]; flag = 0; - if (newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && - newcoord[1] >= sublo[1] && newcoord[1] < subhi[1] && - newcoord[2] >= sublo[2] && newcoord[2] < subhi[2]) flag = 1; + if (newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && newcoord[1] >= sublo[1] && + newcoord[1] < subhi[1] && newcoord[2] >= sublo[2] && newcoord[2] < subhi[2]) + flag = 1; else if (dimension == 3 && newcoord[2] >= domain->boxhi[2]) { if (comm->layout != Comm::LAYOUT_TILED) { - if (comm->myloc[2] == comm->procgrid[2]-1 && - newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && - newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1; + if (comm->myloc[2] == comm->procgrid[2] - 1 && newcoord[0] >= sublo[0] && + newcoord[0] < subhi[0] && newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) + flag = 1; } else { - if (comm->mysplit[2][1] == 1.0 && - newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && - newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) flag = 1; + if (comm->mysplit[2][1] == 1.0 && newcoord[0] >= sublo[0] && newcoord[0] < subhi[0] && + newcoord[1] >= sublo[1] && newcoord[1] < subhi[1]) + flag = 1; } } else if (dimension == 2 && newcoord[1] >= domain->boxhi[1]) { if (comm->layout != Comm::LAYOUT_TILED) { - if (comm->myloc[1] == comm->procgrid[1]-1 && - newcoord[0] >= sublo[0] && newcoord[0] < subhi[0]) flag = 1; + if (comm->myloc[1] == comm->procgrid[1] - 1 && newcoord[0] >= sublo[0] && + newcoord[0] < subhi[0]) + flag = 1; } else { - if (comm->mysplit[1][1] == 1.0 && - newcoord[0] >= sublo[0] && newcoord[0] < subhi[0]) flag = 1; + if (comm->mysplit[1][1] == 1.0 && newcoord[0] >= sublo[0] && newcoord[0] < subhi[0]) + flag = 1; } } if (flag) { - if (mode == ATOM) atom->avec->create_atom(ntype,coords[m]); - else atom->avec->create_atom(ntype+onemols[imol]->type[m],coords[m]); + if (mode == ATOM) + atom->avec->create_atom(ntype, coords[m]); + else + atom->avec->create_atom(ntype + onemols[imol]->type[m], coords[m]); int n = atom->nlocal - 1; - atom->tag[n] = maxtag_all + m+1; + atom->tag[n] = maxtag_all + m + 1; if (mode == MOLECULE) { if (atom->molecule_flag) { if (onemols[imol]->moleculeflag) { atom->molecule[n] = maxmol_all + onemols[imol]->molecule[m]; } else { - atom->molecule[n] = maxmol_all+1; + atom->molecule[n] = maxmol_all + 1; } } if (atom->molecular == Atom::TEMPLATE) { @@ -652,10 +643,10 @@ void FixPour::pre_exchange() if (mode == ATOM) { radtmp = newcoord[3]; atom->radius[n] = radtmp; - atom->rmass[n] = 4.0*MY_PI/3.0 * radtmp*radtmp*radtmp * denstmp; + atom->rmass[n] = 4.0 * MY_PI / 3.0 * radtmp * radtmp * radtmp * denstmp; } else { onemols[imol]->quat_external = quat; - atom->add_molecule_atom(onemols[imol],m,n,maxtag_all); + atom->add_molecule_atom(onemols[imol], m, n, maxtag_all); } modify->create_attribute(n); @@ -667,9 +658,9 @@ void FixPour::pre_exchange() // FixShake::set_molecule stores shake info for molecule if (rigidflag) - fixrigid->set_molecule(nlocalprev,maxtag_all,imol,coord,vnew,quat); + fixrigid->set_molecule(nlocalprev, maxtag_all, imol, coord, vnew, quat); else if (shakeflag) - fixshake->set_molecule(nlocalprev,maxtag_all,imol,coord,vnew,quat); + fixshake->set_molecule(nlocalprev, maxtag_all, imol, coord, vnew, quat); maxtag_all += natom; if (mode == MOLECULE && atom->molecule_flag) { @@ -686,8 +677,7 @@ void FixPour::pre_exchange() int ninserted_atoms = nnear - nprevious; int ninserted_mols = ninserted_atoms / natom; ninserted += ninserted_mols; - if (ninserted_mols < nnew && me == 0) - error->warning(FLERR,"Less insertions than requested"); + if (ninserted_mols < nnew && me == 0) error->warning(FLERR, "Less insertions than requested"); // reset global natoms,nbonds,etc // increment maxtag_all and maxmol_all if necessary @@ -697,16 +687,14 @@ void FixPour::pre_exchange() if (ninserted_atoms) { atom->natoms += ninserted_atoms; - if (atom->natoms < 0) - error->all(FLERR,"Too many total atoms"); + if (atom->natoms < 0) error->all(FLERR, "Too many total atoms"); if (mode == MOLECULE) { - atom->nbonds += (bigint)onemols[imol]->nbonds * ninserted_mols; - atom->nangles += (bigint)onemols[imol]->nangles * ninserted_mols; - atom->ndihedrals += (bigint)onemols[imol]->ndihedrals * ninserted_mols; - atom->nimpropers += (bigint)onemols[imol]->nimpropers * ninserted_mols; + atom->nbonds += (bigint) onemols[imol]->nbonds * ninserted_mols; + atom->nangles += (bigint) onemols[imol]->nangles * ninserted_mols; + atom->ndihedrals += (bigint) onemols[imol]->ndihedrals * ninserted_mols; + atom->nimpropers += (bigint) onemols[imol]->nimpropers * ninserted_mols; } - if (maxtag_all >= MAXTAGINT) - error->all(FLERR,"New atom IDs exceed maximum allowed ID"); + if (maxtag_all >= MAXTAGINT) error->all(FLERR, "New atom IDs exceed maximum allowed ID"); } // rebuild atom map @@ -723,8 +711,10 @@ void FixPour::pre_exchange() // next timestep to insert - if (ninserted < ninsert) next_reneighbor += nfreq; - else next_reneighbor = 0; + if (ninserted < ninsert) + next_reneighbor += nfreq; + else + next_reneighbor = 0; } /* ---------------------------------------------------------------------- @@ -739,13 +729,13 @@ void FixPour::find_maxid() int nlocal = atom->nlocal; tagint max = 0; - for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]); - MPI_Allreduce(&max,&maxtag_all,1,MPI_LMP_TAGINT,MPI_MAX,world); + for (int i = 0; i < nlocal; i++) max = MAX(max, tag[i]); + MPI_Allreduce(&max, &maxtag_all, 1, MPI_LMP_TAGINT, MPI_MAX, world); if (mode == MOLECULE && molecule) { max = 0; - for (int i = 0; i < nlocal; i++) max = MAX(max,molecule[i]); - MPI_Allreduce(&max,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); + for (int i = 0; i < nlocal; i++) max = MAX(max, molecule[i]); + MPI_Allreduce(&max, &maxmol_all, 1, MPI_LMP_TAGINT, MPI_MAX, world); } } @@ -767,29 +757,31 @@ int FixPour::overlap(int i) if (ignoretri && atom->tri[i] >= 0) return 0; } - if (mode == ATOM) delta = atom->radius[i] + radius_max; - else delta = atom->radius[i] + molradius_max; + if (mode == ATOM) + delta = atom->radius[i] + radius_max; + else + delta = atom->radius[i] + molradius_max; double *x = atom->x[i]; if (domain->dimension == 3) { if (region_style == 1) { - if (outside(0,x[0],xlo-delta,xhi+delta)) return 0; - if (outside(1,x[1],ylo-delta,yhi+delta)) return 0; - if (outside(2,x[2],lo_current-delta,hi_current+delta)) return 0; + if (outside(0, x[0], xlo - delta, xhi + delta)) return 0; + if (outside(1, x[1], ylo - delta, yhi + delta)) return 0; + if (outside(2, x[2], lo_current - delta, hi_current + delta)) return 0; } else { double delx = x[0] - xc; double dely = x[1] - yc; double delz = 0.0; - domain->minimum_image(delx,dely,delz); - double rsq = delx*delx + dely*dely; + domain->minimum_image(delx, dely, delz); + double rsq = delx * delx + dely * dely; double r = rc + delta; - if (rsq > r*r) return 0; - if (outside(2,x[2],lo_current-delta,hi_current+delta)) return 0; + if (rsq > r * r) return 0; + if (outside(2, x[2], lo_current - delta, hi_current + delta)) return 0; } } else { - if (outside(0,x[0],xlo-delta,xhi+delta)) return 0; - if (outside(1,x[1],lo_current-delta,hi_current+delta)) return 0; + if (outside(0, x[0], xlo - delta, xhi + delta)) return 0; + if (outside(1, x[1], lo_current - delta, hi_current + delta)) return 0; } return 1; @@ -837,22 +829,22 @@ void FixPour::xyz_random(double h, double *coord) { if (domain->dimension == 3) { if (region_style == 1) { - coord[0] = xlo + random->uniform() * (xhi-xlo); - coord[1] = ylo + random->uniform() * (yhi-ylo); + coord[0] = xlo + random->uniform() * (xhi - xlo); + coord[1] = ylo + random->uniform() * (yhi - ylo); coord[2] = h; } else { - double r1,r2; + double r1, r2; while (true) { r1 = random->uniform() - 0.5; r2 = random->uniform() - 0.5; - if (r1*r1 + r2*r2 < 0.25) break; + if (r1 * r1 + r2 * r2 < 0.25) break; } - coord[0] = xc + 2.0*r1*rc; - coord[1] = yc + 2.0*r2*rc; + coord[0] = xc + 2.0 * r1 * rc; + coord[1] = yc + 2.0 * r2 * rc; coord[2] = h; } } else { - coord[0] = xlo + random->uniform() * (xhi-xlo); + coord[0] = xlo + random->uniform() * (xhi - xlo); coord[1] = h; coord[2] = 0.0; } @@ -863,8 +855,7 @@ void FixPour::xyz_random(double h, double *coord) double FixPour::radius_sample() { if (dstyle == ONE) return radius_one; - if (dstyle == RANGE) return radius_lo + - random->uniform()*(radius_hi-radius_lo); + if (dstyle == RANGE) return radius_lo + random->uniform() * (radius_hi - radius_lo); double value = random->uniform(); @@ -874,7 +865,7 @@ double FixPour::radius_sample() sum += frac_poly[i]; i++; } - return radius_poly[i-1]; + return radius_poly[i - 1]; } /* ---------------------------------------------------------------------- @@ -885,18 +876,13 @@ void FixPour::options(int narg, char **arg) { // defaults - iregion = -1; mode = ATOM; - molfrac = nullptr; rigidflag = 0; - idrigid = nullptr; shakeflag = 0; - idshake = nullptr; idnext = 0; ignoreflag = ignoreline = ignoretri = 0; dstyle = ONE; radius_max = radius_one = 0.5; - radius_poly = frac_poly = nullptr; density_lo = density_hi = 1.0; volfrac = 0.25; maxattempt = 50; @@ -905,139 +891,141 @@ void FixPour::options(int narg, char **arg) int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) error->all(FLERR,"Fix pour region ID does not exist"); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Fix pour region {} does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - - } else if (strcmp(arg[iarg],"mol") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - int imol = atom->find_molecule(arg[iarg+1]); - if (imol == -1) - error->all(FLERR,"Molecule template ID for fix pour does not exist"); + } else if (strcmp(arg[iarg], "mol") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + int imol = atom->find_molecule(arg[iarg + 1]); + if (imol == -1) error->all(FLERR, "Molecule template ID for fix pour does not exist"); mode = MOLECULE; onemols = &atom->molecules[imol]; nmol = onemols[0]->nset; - delete [] molfrac; + delete[] molfrac; molfrac = new double[nmol]; - molfrac[0] = 1.0/nmol; - for (int i = 1; i < nmol-1; i++) molfrac[i] = molfrac[i-1] + 1.0/nmol; - molfrac[nmol-1] = 1.0; + molfrac[0] = 1.0 / nmol; + for (int i = 1; i < nmol - 1; i++) molfrac[i] = molfrac[i - 1] + 1.0 / nmol; + molfrac[nmol - 1] = 1.0; iarg += 2; - } 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] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + } 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] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); for (int i = 1; i < nmol; i++) - 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; - iarg += nmol+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; + iarg += nmol + 1; - } else if (strcmp(arg[iarg],"rigid") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - delete [] idrigid; - idrigid = utils::strdup(arg[iarg+1]); + } else if (strcmp(arg[iarg], "rigid") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + delete[] idrigid; + idrigid = utils::strdup(arg[iarg + 1]); rigidflag = 1; iarg += 2; - } else if (strcmp(arg[iarg],"shake") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - delete [] idshake; - idshake = utils::strdup(arg[iarg+1]); + } else if (strcmp(arg[iarg], "shake") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + delete[] idshake; + idshake = utils::strdup(arg[iarg + 1]); shakeflag = 1; iarg += 2; - } else if (strcmp(arg[iarg],"id") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - if (strcmp(arg[iarg+1],"max") == 0) idnext = 0; - else if (strcmp(arg[iarg+1],"next") == 0) idnext = 1; - else error->all(FLERR,"Illegal fix pour command"); + } else if (strcmp(arg[iarg], "id") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + if (strcmp(arg[iarg + 1], "max") == 0) + idnext = 0; + else if (strcmp(arg[iarg + 1], "next") == 0) + idnext = 1; + else + error->all(FLERR, "Illegal fix pour command"); iarg += 2; - } else if (strcmp(arg[iarg],"ignore") == 0) { + } else if (strcmp(arg[iarg], "ignore") == 0) { if (atom->line_flag) ignoreline = 1; if (atom->tri_flag) ignoretri = 1; if (ignoreline || ignoretri) ignoreflag = 1; iarg += 1; - } else if (strcmp(arg[iarg],"diam") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix pour command"); - if (strcmp(arg[iarg+1],"one") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); + } else if (strcmp(arg[iarg], "diam") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + if (strcmp(arg[iarg + 1], "one") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix pour command"); dstyle = ONE; - radius_one = 0.5 * utils::numeric(FLERR,arg[iarg+2],false,lmp); + 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"); + } 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 * 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_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"); + } else if (strcmp(arg[iarg + 1], "poly") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix pour command"); dstyle = POLY; - 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"); + 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"); radius_poly = new double[npoly]; frac_poly = new double[npoly]; iarg += 3; radius_max = 0.0; for (int i = 0; i < npoly; i++) { - radius_poly[i] = 0.5 * utils::numeric(FLERR,arg[iarg++],false,lmp); - frac_poly[i] = utils::numeric(FLERR,arg[iarg++],false,lmp); + 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]); + error->all(FLERR, "Illegal fix pour command"); + radius_max = MAX(radius_max, radius_poly[i]); } double sum = 0.0; for (int i = 0; i < npoly; i++) sum += frac_poly[i]; if (fabs(sum - 1.0) > SMALL) - error->all(FLERR,"Fix pour polydisperse fractions do not sum to 1.0"); - } else error->all(FLERR,"Illegal fix pour command"); + error->all(FLERR, "Fix pour polydisperse fractions do not sum to 1.0"); + } else + error->all(FLERR, "Illegal fix pour command"); - } else if (strcmp(arg[iarg],"dens") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix pour command"); - 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"); + } else if (strcmp(arg[iarg], "dens") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix pour command"); + 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 = utils::numeric(FLERR,arg[iarg+1],false,lmp); - maxattempt = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + } else if (strcmp(arg[iarg], "vol") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix pour command"); + 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 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "rate") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix pour command"); + rate = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"vel") == 0) { + } else if (strcmp(arg[iarg], "vel") == 0) { if (domain->dimension == 3) { - if (iarg+6 > narg) error->all(FLERR,"Illegal fix pour command"); - 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 = utils::numeric(FLERR,arg[iarg+5],false,lmp); + if (iarg + 6 > narg) error->all(FLERR, "Illegal fix pour command"); + 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 = utils::numeric(FLERR, arg[iarg + 5], false, lmp); iarg += 6; } else { - if (iarg+4 > narg) error->all(FLERR,"Illegal fix pour command"); - 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); + if (iarg + 4 > narg) error->all(FLERR, "Illegal fix pour command"); + 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"); + if (vxlo > vxhi) error->all(FLERR, "Illegal fix pour command"); iarg += 4; } - } else error->all(FLERR,"Illegal fix pour command"); + } else + error->all(FLERR, "Illegal fix pour command"); } } @@ -1045,7 +1033,7 @@ void FixPour::options(int narg, char **arg) void FixPour::reset_dt() { - error->all(FLERR,"Cannot change timestep with fix pour"); + error->all(FLERR, "Cannot change timestep with fix pour"); } /* ---------------------------------------------------------------------- @@ -1054,10 +1042,12 @@ void FixPour::reset_dt() void *FixPour::extract(const char *str, int &itype) { - if (strcmp(str,"radius") == 0) { + if (strcmp(str, "radius") == 0) { if (mode == ATOM) { - if (itype == ntype) oneradius = radius_max; - else oneradius = 0.0; + if (itype == ntype) + oneradius = radius_max; + else + oneradius = 0.0; } else { @@ -1066,7 +1056,7 @@ void *FixPour::extract(const char *str, int &itype) oneradius = 0.0; for (int i = 0; i < nmol; i++) { - if (itype > ntype+onemols[i]->ntypes) continue; + if (itype > ntype + onemols[i]->ntypes) continue; double *radius = onemols[i]->radius; int *type = onemols[i]->type; int natoms = onemols[i]->natoms; @@ -1076,9 +1066,11 @@ void *FixPour::extract(const char *str, int &itype) // same as atom->avec->create_atom(), invoked in pre_exchange() for (int i = 0; i < natoms; i++) - if (type[i]+ntype == itype) { - if (radius) oneradius = MAX(oneradius,radius[i]); - else oneradius = MAX(oneradius,0.5); + if (type[i] + ntype == itype) { + if (radius) + oneradius = MAX(oneradius, radius[i]); + else + oneradius = MAX(oneradius, 0.5); } } } diff --git a/src/GRANULAR/fix_pour.h b/src/GRANULAR/fix_pour.h index 16ef3b7f32..7fa48ee761 100644 --- a/src/GRANULAR/fix_pour.h +++ b/src/GRANULAR/fix_pour.h @@ -37,7 +37,7 @@ class FixPour : public Fix { private: int ninsert, ntype, seed; - int iregion, mode, idnext, dstyle, npoly, rigidflag, shakeflag; + int mode, idnext, dstyle, npoly, rigidflag, shakeflag; int ignoreflag, ignoreline, ignoretri; double radius_one, radius_max; double radius_lo, radius_hi; @@ -52,6 +52,8 @@ class FixPour : public Fix { double xc, yc, rc; double grav; char *idrigid, *idshake; + char *idregion; + class Region *region; class Molecule **onemols; int nmol, natom_max; @@ -82,160 +84,3 @@ class FixPour : public Fix { #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: Cannot yet use fix pour with the KOKKOS package - -This feature is not yet supported. - -E: Fix pour requires atom attributes radius, rmass - -The atom style defined does not have these attributes. - -E: Invalid atom type in fix pour command - -Self-explanatory. - -E: Must specify a region in fix pour - -Self-explanatory. - -E: Fix pour region does not support a bounding box - -Not all regions represent bounded volumes. You cannot use -such a region with the fix pour command. - -E: Fix pour region cannot be dynamic - -Only static regions can be used with fix pour. - -E: Insertion region extends outside simulation box - -Self-explanatory. - -E: Must use a z-axis cylinder region with fix pour - -Self-explanatory. - -E: Must use a block or cylinder region with fix pour - -Self-explanatory. - -E: Must use a block region with fix pour for 2d simulations - -Self-explanatory. - -E: Cannot use fix_pour unless atoms have IDs - -Self-explanatory. - -E: Fix pour molecule must have coordinates - -The defined molecule does not specify coordinates. - -E: Fix pour molecule must have atom types - -The defined molecule does not specify atom types. - -E: Invalid atom type in fix pour mol command - -The atom types in the defined molecule are added to the value -specified in the create_atoms command, as an offset. The final value -for each atom must be between 1 to N, where N is the number of atom -types. - -E: Fix pour molecule template ID must be same as atom style template ID - -When using atom_style template, you cannot pour molecules that are -not in that template. - -E: Cannot use fix pour rigid and not molecule - -Self-explanatory. - -E: Cannot use fix pour shake and not molecule - -Self-explanatory. - -E: Cannot use fix pour rigid and shake - -These two attributes are conflicting. - -E: No fix gravity defined for fix pour - -Gravity is required to use fix pour. - -E: Fix pour insertion count per timestep is 0 - -Self-explanatory. - -E: Cannot use fix pour with triclinic box - -This option is not yet supported. - -E: Gravity must point in -z to use with fix pour in 3d - -Self-explanatory. - -E: Gravity must point in -y to use with fix pour in 2d - -Self-explanatory. - -E: Gravity changed since fix pour was created - -The gravity vector defined by fix gravity must be static. - -E: Fix pour rigid fix does not exist - -Self-explanatory. - -E: Fix pour and fix rigid/small not using same molecule template ID - -Self-explanatory. - -E: Fix pour shake fix does not exist - -Self-explanatory. - -E: Fix pour and fix shake not using same molecule template ID - -Self-explanatory. - -W: Less insertions than requested - -The fix pour command was unsuccessful at finding open space -for as many particles as it tried to insert. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -E: New atom IDs exceed maximum allowed ID - -See the setting for tagint in the src/lmptype.h file. - -E: Fix pour region ID does not exist - -Self-explanatory. - -E: Molecule template ID for fix pour does not exist - -Self-explanatory. - -E: Fix pour polydisperse fractions do not sum to 1.0 - -Self-explanatory. - -E: Cannot change timestep with fix pour - -This is because fix pour pre-computes the time delay for particles to -fall out of the insertion volume due to gravity. - -*/ diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index 256f6d6611..da7af48e82 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -498,7 +498,7 @@ void FixWallGran::init() dt = update->dt; if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; // check for FixRigid so can extract rigid body masses @@ -550,9 +550,9 @@ void FixWallGran::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } @@ -577,7 +577,7 @@ void FixWallGran::post_force(int /*vflag*/) if (neighbor->ago == 0 && fix_rigid) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index f59a43ae3f..8c69be6e16 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -119,46 +119,3 @@ class FixWallGran : public Fix { #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: Fix wall/gran requires atom style sphere - -Self-explanatory. - -E: Invalid fix wall/gran interaction style - -UNDOCUMENTED - -E: Cannot use wall in periodic dimension - -Self-explanatory. - -E: Cannot wiggle and shear fix wall/gran - -Cannot specify both options at the same time. - -E: Invalid wiggle direction for fix wall/gran - -Self-explanatory. - -E: Invalid shear direction for fix wall/gran - -Self-explanatory. - -E: Cannot wiggle or shear with fix wall/gran/region - -UNDOCUMENTED - -U: Fix wall/gran is incompatible with Pair style - -Must use a granular pair style to define the parameters needed for -this fix. - -*/ diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 45905aea1c..6509c88a0b 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -35,21 +34,16 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : - FixWallGran(lmp, narg, arg), region(nullptr), region_style(nullptr), - ncontact(nullptr), - walls(nullptr), history_many(nullptr), c2r(nullptr) + FixWallGran(lmp, narg, arg), region(nullptr), ncontact(nullptr), walls(nullptr), + history_many(nullptr), c2r(nullptr) { restart_global = 1; motion_resetflag = 0; - int iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix wall/gran/region does not exist"); - region = domain->regions[iregion]; - region_style = utils::strdup(region->style); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix wall/gran/region does not exist", idregion); nregion = region->nregion; - - tmax = domain->regions[iregion]->tmax; + tmax = region->tmax; c2r = new int[tmax]; // re-allocate atom-based arrays with nshear @@ -67,8 +61,7 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : if (use_history) { int nlocal = atom->nlocal; - for (int i = 0; i < nlocal; i++) - ncontact[i] = 0; + for (int i = 0; i < nlocal; i++) ncontact[i] = 0; } } @@ -76,8 +69,7 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : FixWallGranRegion::~FixWallGranRegion() { - delete [] c2r; - delete [] region_style; + delete[] c2r; memory->destroy(ncontact); memory->destroy(walls); @@ -90,25 +82,32 @@ void FixWallGranRegion::init() { FixWallGran::init(); - int iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix wall/gran/region does not exist"); - region = domain->regions[iregion]; + auto newregion = domain->get_region_by_id(idregion); + if (!newregion) error->all(FLERR, "Region {} for fix wall/gran/region does not exist", idregion); // check if region properties changed between runs // reset if restart info was inconsistent - if ((strcmp(idregion,region->id) != 0) - || (strcmp(region_style,region->style) != 0) - || (nregion != region->nregion)) { - error->warning(FLERR,"Region properties for region {} changed between " - "runs, resetting its motion",idregion); + if (newregion != region) { + region = newregion; + if (comm->me == 0) + error->warning(FLERR, + "Region properties for region {} changed between runs, resetting its motion", + idregion); + nregion = region->nregion; + tmax = region->tmax; + delete[] c2r; + c2r = new int[tmax]; + region = newregion; region->reset_vel(); } if (motion_resetflag) { - error->warning(FLERR,"Region properties for region {} are inconsistent " - "with restart file, resetting its motion",idregion); + if (comm->me == 0) + error->warning(FLERR, + "Region properties for region {} are inconsistent with restart file, " + "resetting its motion", + idregion); region->reset_vel(); } } @@ -117,8 +116,8 @@ void FixWallGranRegion::init() void FixWallGranRegion::post_force(int /*vflag*/) { - int i,m,nc,iwall; - double dx,dy,dz,rsq,meff; + int i, m, nc, iwall; + double dx, dy, dz, rsq, meff; double vwall[3]; // do not update shear history during setup @@ -133,17 +132,19 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (neighbor->ago == 0 && fix_rigid) { int tmp; - int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + int *body = (int *) fix_rigid->extract("body", tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal", tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; - memory->create(mass_rigid,nmax,"wall/gran:mass_rigid"); + memory->create(mass_rigid, nmax, "wall/gran:mass_rigid"); } int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - if (body[i] >= 0) mass_rigid[i] = mass_body[body[i]]; - else mass_rigid[i] = 0.0; + if (body[i] >= 0) + mass_rigid[i] = mass_body[body[i]]; + else + mass_rigid[i] = 0.0; } } @@ -169,23 +170,18 @@ void FixWallGranRegion::post_force(int /*vflag*/) region->set_velocity(); } - if (peratom_flag) { - clear_stored_contacts(); - } + if (peratom_flag) { clear_stored_contacts(); } for (i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (!region->match(x[i][0],x[i][1],x[i][2])) continue; + if (!region->match(x[i][0], x[i][1], x[i][2])) continue; if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) { - nc = region->surface(x[i][0],x[i][1],x[i][2], - radius[i]+pulloff_distance(radius[i])); + nc = region->surface(x[i][0], x[i][1], x[i][2], radius[i] + pulloff_distance(radius[i])); + } else { + nc = region->surface(x[i][0], x[i][1], x[i][2], radius[i]); } - else{ - nc = region->surface(x[i][0],x[i][1],x[i][2],radius[i]); - } - if (nc > tmax) - error->one(FLERR,"Too many wall/gran/region contacts for one particle"); + if (nc > tmax) error->one(FLERR, "Too many wall/gran/region contacts for one particle"); // shear history maintenance // update ncontact,walls,shear2many for particle I @@ -204,11 +200,11 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (ncontact[i] == 0) { ncontact[i] = 1; walls[i][0] = iwall; - for (m = 0; m < size_history; m++) - history_many[i][0][m] = 0.0; + for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; } else if (ncontact[i] > 1 || iwall != walls[i][0]) - update_contacts(i,nc); - } else update_contacts(i,nc); + update_contacts(i, nc); + } else + update_contacts(i, nc); } // process current contacts @@ -217,12 +213,11 @@ void FixWallGranRegion::post_force(int /*vflag*/) // rsq = squared contact distance // xc = contact point - rsq = region->contact[ic].r*region->contact[ic].r; + rsq = region->contact[ic].r * region->contact[ic].r; if (pairstyle == FixWallGran::GRANULAR && normal_model == FixWallGran::JKR) { - if (history_many[i][c2r[ic]][0] == 0.0 && rsq > radius[i]*radius[i]) { - for (m = 0; m < size_history; m++) - history_many[i][0][m] = 0.0; + if (history_many[i][c2r[ic]][0] == 0.0 && rsq > radius[i] * radius[i]) { + for (m = 0; m < size_history; m++) history_many[i][0][m] = 0.0; continue; } } @@ -256,20 +251,16 @@ void FixWallGranRegion::post_force(int /*vflag*/) contact = nullptr; if (pairstyle == FixWallGran::HOOKE) - hooke(rsq,dx,dy,dz,vwall,v[i],f[i], - omega[i],torque[i],radius[i],meff, contact); + hooke(rsq, dx, dy, dz, vwall, v[i], f[i], omega[i], torque[i], radius[i], meff, contact); else if (pairstyle == FixWallGran::HOOKE_HISTORY) - hooke_history(rsq,dx,dy,dz,vwall,v[i],f[i], - omega[i],torque[i],radius[i],meff, - history_many[i][c2r[ic]], contact); + hooke_history(rsq, dx, dy, dz, vwall, v[i], f[i], omega[i], torque[i], radius[i], meff, + history_many[i][c2r[ic]], contact); else if (pairstyle == FixWallGran::HERTZ_HISTORY) - hertz_history(rsq,dx,dy,dz,vwall,region->contact[ic].radius, - v[i],f[i],omega[i],torque[i], - radius[i],meff,history_many[i][c2r[ic]], contact); + hertz_history(rsq, dx, dy, dz, vwall, region->contact[ic].radius, v[i], f[i], omega[i], + torque[i], radius[i], meff, history_many[i][c2r[ic]], contact); else if (pairstyle == FixWallGran::GRANULAR) - granular(rsq,dx,dy,dz,vwall,region->contact[ic].radius, - v[i],f[i],omega[i],torque[i], - radius[i],meff,history_many[i][c2r[ic]],contact); + granular(rsq, dx, dy, dz, vwall, region->contact[ic].radius, v[i], f[i], omega[i], + torque[i], radius[i], meff, history_many[i][c2r[ic]], contact); } } } @@ -285,7 +276,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) void FixWallGranRegion::update_contacts(int i, int nc) { - int j,m,iold,nold,ilast,inew,iadd,iwall; + int j, m, iold, nold, ilast, inew, iadd, iwall; // loop over old contacts // if not in new contact list: @@ -296,12 +287,12 @@ void FixWallGranRegion::update_contacts(int i, int nc) for (m = 0; m < nc; m++) if (region->contact[m].iwall == walls[i][iold]) break; if (m >= nc) { - ilast = ncontact[i]-1; - for (j = 0; j < size_history; j++) - history_many[i][iold][j] = history_many[i][ilast][j]; + ilast = ncontact[i] - 1; + for (j = 0; j < size_history; j++) history_many[i][iold][j] = history_many[i][ilast][j]; walls[i][iold] = walls[i][ilast]; ncontact[i]--; - } else iold++; + } else + iold++; } // loop over new contacts @@ -315,13 +306,13 @@ void FixWallGranRegion::update_contacts(int i, int nc) iwall = region->contact[inew].iwall; for (m = 0; m < nold; m++) if (walls[i][m] == iwall) break; - if (m < nold) c2r[m] = inew; + if (m < nold) + c2r[m] = inew; else { iadd = ncontact[i]; c2r[iadd] = inew; - for (j = 0; j < size_history; j++) - history_many[i][iadd][j] = 0.0; + for (j = 0; j < size_history; j++) history_many[i][iadd][j] = 0.0; walls[i][iadd] = iwall; ncontact[i]++; } @@ -336,12 +327,12 @@ double FixWallGranRegion::memory_usage() { int nmax = atom->nmax; double bytes = 0.0; - if (use_history) { // shear history - bytes += (double)nmax * sizeof(int); // ncontact - bytes += (double)nmax*tmax * sizeof(int); // walls - bytes += (double)nmax*tmax*size_history * sizeof(double); // history_many + if (use_history) { // shear history + bytes += (double) nmax * sizeof(int); // ncontact + bytes += (double) nmax * tmax * sizeof(int); // walls + bytes += (double) nmax * tmax * size_history * sizeof(double); // history_many } - if (fix_rigid) bytes += (double)nmax * sizeof(int); // mass_rigid + if (fix_rigid) bytes += (double) nmax * sizeof(int); // mass_rigid return bytes; } @@ -352,12 +343,11 @@ double FixWallGranRegion::memory_usage() void FixWallGranRegion::grow_arrays(int nmax) { if (use_history) { - memory->grow(ncontact,nmax,"fix_wall_gran:ncontact"); - memory->grow(walls,nmax,tmax,"fix_wall_gran:walls"); - memory->grow(history_many,nmax,tmax,size_history,"fix_wall_gran:history_many"); + memory->grow(ncontact, nmax, "fix_wall_gran:ncontact"); + memory->grow(walls, nmax, tmax, "fix_wall_gran:walls"); + memory->grow(history_many, nmax, tmax, size_history, "fix_wall_gran:history_many"); } - if (peratom_flag) - memory->grow(array_atom,nmax,size_peratom_cols,"fix_wall_gran:array_atom"); + if (peratom_flag) memory->grow(array_atom, nmax, size_peratom_cols, "fix_wall_gran:array_atom"); } /* ---------------------------------------------------------------------- @@ -366,21 +356,19 @@ void FixWallGranRegion::grow_arrays(int nmax) void FixWallGranRegion::copy_arrays(int i, int j, int /*delflag*/) { - int m,n,iwall; + int m, n, iwall; if (use_history) { n = ncontact[i]; for (iwall = 0; iwall < n; iwall++) { walls[j][iwall] = walls[i][iwall]; - for (m = 0; m < size_history; m++) - history_many[j][iwall][m] = history_many[i][iwall][m]; + for (m = 0; m < size_history; m++) history_many[j][iwall][m] = history_many[i][iwall][m]; } ncontact[j] = ncontact[i]; } if (peratom_flag) { - for (int m = 0; m < size_peratom_cols; m++) - array_atom[j][m] = array_atom[i][m]; + for (int m = 0; m < size_peratom_cols; m++) array_atom[j][m] = array_atom[i][m]; } } @@ -390,11 +378,9 @@ void FixWallGranRegion::copy_arrays(int i, int j, int /*delflag*/) void FixWallGranRegion::set_arrays(int i) { - if (use_history) - ncontact[i] = 0; + if (use_history) ncontact[i] = 0; if (peratom_flag) { - for (int m = 0; m < size_peratom_cols; m++) - array_atom[i][m] = 0; + for (int m = 0; m < size_peratom_cols; m++) array_atom[i][m] = 0; } } @@ -412,13 +398,11 @@ int FixWallGranRegion::pack_exchange(int i, double *buf) buf[n++] = ubuf(count).d; for (int iwall = 0; iwall < count; iwall++) { buf[n++] = ubuf(walls[i][iwall]).d; - for (m = 0; m < size_history; m++) - buf[n++] = history_many[i][iwall][m]; + for (m = 0; m < size_history; m++) buf[n++] = history_many[i][iwall][m]; } } if (peratom_flag) { - for (int m = 0; m < size_peratom_cols; m++) - buf[n++] = array_atom[i][m]; + for (int m = 0; m < size_peratom_cols; m++) buf[n++] = array_atom[i][m]; } return n; @@ -432,19 +416,16 @@ int FixWallGranRegion::unpack_exchange(int nlocal, double *buf) { int m; - int n = 0; if (use_history) { int count = ncontact[nlocal] = (int) ubuf(buf[n++]).i; for (int iwall = 0; iwall < count; iwall++) { walls[nlocal][iwall] = (int) ubuf(buf[n++]).i; - for (m = 0; m < size_history; m++) - history_many[nlocal][iwall][m] = buf[n++]; + for (m = 0; m < size_history; m++) history_many[nlocal][iwall][m] = buf[n++]; } } if (peratom_flag) { - for (int m = 0; m < size_peratom_cols; m++) - array_atom[nlocal][m] = buf[n++]; + for (int m = 0; m < size_peratom_cols; m++) array_atom[nlocal][m] = buf[n++]; } return n; @@ -466,8 +447,7 @@ int FixWallGranRegion::pack_restart(int i, double *buf) buf[n++] = ubuf(count).d; for (int iwall = 0; iwall < count; iwall++) { buf[n++] = ubuf(walls[i][iwall]).d; - for (m = 0; m < size_history; m++) - buf[n++] = history_many[i][iwall][m]; + for (m = 0; m < size_history; m++) buf[n++] = history_many[i][iwall][m]; } // pack buf[0] this way because other fixes unpack it buf[0] = n; @@ -490,14 +470,13 @@ void FixWallGranRegion::unpack_restart(int nlocal, int nth) // unpack the Nth first values this way because other fixes pack them int m = 0; - for (int i = 0; i < nth; i++) m += static_cast (extra[nlocal][m]); + for (int i = 0; i < nth; i++) m += static_cast(extra[nlocal][m]); m++; int count = ncontact[nlocal] = (int) ubuf(extra[nlocal][m++]).i; for (int iwall = 0; iwall < count; iwall++) { walls[nlocal][iwall] = (int) ubuf(extra[nlocal][m++]).i; - for (k = 0; k < size_history; k++) - history_many[nlocal][iwall][k] = extra[nlocal][m++]; + for (k = 0; k < size_history; k++) history_many[nlocal][iwall][k] = extra[nlocal][m++]; } } @@ -508,7 +487,7 @@ void FixWallGranRegion::unpack_restart(int nlocal, int nth) int FixWallGranRegion::maxsize_restart() { if (!use_history) return 0; - return 2 + tmax*(size_history+1); + return 2 + tmax * (size_history + 1); } /* ---------------------------------------------------------------------- @@ -518,7 +497,7 @@ int FixWallGranRegion::maxsize_restart() int FixWallGranRegion::size_restart(int nlocal) { if (!use_history) return 0; - return 2 + ncontact[nlocal]*(size_history+1); + return 2 + ncontact[nlocal] * (size_history + 1); } /* ---------------------------------------------------------------------- @@ -530,7 +509,7 @@ void FixWallGranRegion::write_restart(FILE *fp) if (comm->me) return; int len = 0; region->length_restart_string(len); - fwrite(&len, sizeof(int),1,fp); + fwrite(&len, sizeof(int), 1, fp); region->write_restart(fp); } @@ -541,5 +520,5 @@ void FixWallGranRegion::write_restart(FILE *fp) void FixWallGranRegion::restart(char *buf) { int n = 0; - if (!region->restart(buf,n)) motion_resetflag = 1; + if (!region->restart(buf, n)) motion_resetflag = 1; } diff --git a/src/GRANULAR/fix_wall_gran_region.h b/src/GRANULAR/fix_wall_gran_region.h index 6e95afeabc..18307e87e2 100644 --- a/src/GRANULAR/fix_wall_gran_region.h +++ b/src/GRANULAR/fix_wall_gran_region.h @@ -46,7 +46,6 @@ class FixWallGranRegion : public FixWallGran { private: class Region *region; - char *region_style; int nregion; // shear history for multiple contacts per particle @@ -68,54 +67,3 @@ class FixWallGranRegion : public FixWallGran { #endif #endif - -/* ERROR/WARNING messages: - -E: Region ID for fix wall/gran/region does not exist - -UNDOCUMENTED - -W: Region properties for region %s changed between runs, resetting its motion - -UNDOCUMENTED - -W: Region properties for region %s are inconsistent with restart file, resetting its motion - -UNDOCUMENTED - -E: Too many wall/gran/region contacts for one particle - -UNDOCUMENTED - -U: 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. - -U: Fix wall/gran requires atom style sphere - -Self-explanatory. - -U: Cannot use wall in periodic dimension - -Self-explanatory. - -U: Cannot wiggle and shear fix wall/gran - -Cannot specify both options at the same time. - -U: Invalid wiggle direction for fix wall/gran - -Self-explanatory. - -U: Invalid shear direction for fix wall/gran - -Self-explanatory. - -U: Fix wall/gran is incompatible with Pair style - -Must use a granular pair style to define the parameters needed for -this fix. - -*/ diff --git a/src/GRANULAR/pair_gran_hertz_history.cpp b/src/GRANULAR/pair_gran_hertz_history.cpp index 2320b7a8fb..04fc0cf6f0 100644 --- a/src/GRANULAR/pair_gran_hertz_history.cpp +++ b/src/GRANULAR/pair_gran_hertz_history.cpp @@ -45,7 +45,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz; - double radi,radj,radsum,rsq,r,rinv,rsqinv; + double radi,radj,radsum,rsq,r,rinv,rsqinv,factor_lj; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; double wr1,wr2,wr3; double vtr1,vtr2,vtr3,vrel; @@ -68,7 +68,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; @@ -91,6 +91,7 @@ void PairGranHertzHistory::compute(int eflag, int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; + double *special_lj = force->special_lj; inum = list->inum; ilist = list->ilist; @@ -114,8 +115,11 @@ void PairGranHertzHistory::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; + if (factor_lj == 0) continue; + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -247,6 +251,9 @@ void PairGranHertzHistory::compute(int eflag, int vflag) fx = delx*ccel + fs1; fy = dely*ccel + fs2; fz = delz*ccel + fs3; + fx *= factor_lj; + fy *= factor_lj; + fz *= factor_lj; f[i][0] += fx; f[i][1] += fy; f[i][2] += fz; @@ -254,6 +261,9 @@ void PairGranHertzHistory::compute(int eflag, int vflag) tor1 = rinv * (dely*fs3 - delz*fs2); tor2 = rinv * (delz*fs1 - delx*fs3); tor3 = rinv * (delx*fs2 - dely*fs1); + tor1 *= factor_lj; + tor2 *= factor_lj; + tor3 *= factor_lj; torque[i][0] -= radi*tor1; torque[i][1] -= radi*tor2; torque[i][2] -= radi*tor3; diff --git a/src/GRANULAR/pair_gran_hertz_history.h b/src/GRANULAR/pair_gran_hertz_history.h index cc8f79347c..511312921d 100644 --- a/src/GRANULAR/pair_gran_hertz_history.h +++ b/src/GRANULAR/pair_gran_hertz_history.h @@ -36,13 +36,3 @@ class PairGranHertzHistory : public PairGranHookeHistory { #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. - -*/ diff --git a/src/GRANULAR/pair_gran_hooke.cpp b/src/GRANULAR/pair_gran_hooke.cpp index 5d3724f668..12ce25f7b3 100644 --- a/src/GRANULAR/pair_gran_hooke.cpp +++ b/src/GRANULAR/pair_gran_hooke.cpp @@ -42,7 +42,7 @@ void PairGranHooke::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum; double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz; - double radi,radj,radsum,rsq,r,rinv,rsqinv; + double radi,radj,radsum,rsq,r,rinv,rsqinv,factor_lj; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; double wr1,wr2,wr3; double vtr1,vtr2,vtr3,vrel; @@ -59,7 +59,7 @@ void PairGranHooke::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; @@ -82,6 +82,7 @@ void PairGranHooke::compute(int eflag, int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; + double *special_lj = force->special_lj; inum = list->inum; ilist = list->ilist; @@ -101,8 +102,11 @@ void PairGranHooke::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; + if (factor_lj == 0) continue; + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -187,6 +191,9 @@ void PairGranHooke::compute(int eflag, int vflag) fx = delx*ccel + fs1; fy = dely*ccel + fs2; fz = delz*ccel + fs3; + fx *= factor_lj; + fy *= factor_lj; + fz *= factor_lj; f[i][0] += fx; f[i][1] += fy; f[i][2] += fz; @@ -194,6 +201,9 @@ void PairGranHooke::compute(int eflag, int vflag) tor1 = rinv * (dely*fs3 - delz*fs2); tor2 = rinv * (delz*fs1 - delx*fs3); tor3 = rinv * (delx*fs2 - dely*fs1); + tor1 *= factor_lj; + tor2 *= factor_lj; + tor3 *= factor_lj; torque[i][0] -= radi*tor1; torque[i][1] -= radi*tor2; torque[i][2] -= radi*tor3; diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 49eb1be89b..c43c975177 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -67,8 +67,8 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) // this is so final order of Modify:fix will conform to input script fix_history = nullptr; - fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) + - " all DUMMY"); + fix_dummy = dynamic_cast( + modify->add_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me) + " all DUMMY")); } /* ---------------------------------------------------------------------- */ @@ -103,7 +103,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) { int i, j, ii, jj, inum, jnum; double xtmp, ytmp, ztmp, delx, dely, delz, fx, fy, fz; - double radi, radj, radsum, rsq, r, rinv, rsqinv; + double radi, radj, radsum, rsq, r, rinv, rsqinv, factor_lj; double vr1, vr2, vr3, vnnr, vn1, vn2, vn3, vt1, vt2, vt3; double wr1, wr2, wr3; double vtr1, vtr2, vtr3, vrel; @@ -126,7 +126,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body", tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal", tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal", tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; @@ -151,6 +151,7 @@ void PairGranHookeHistory::compute(int eflag, int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; int newton_pair = force->newton_pair; + double *special_lj = force->special_lj; inum = list->inum; ilist = list->ilist; @@ -174,8 +175,11 @@ void PairGranHookeHistory::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; + if (factor_lj == 0) continue; + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -306,6 +310,9 @@ void PairGranHookeHistory::compute(int eflag, int vflag) fx = delx * ccel + fs1; fy = dely * ccel + fs2; fz = delz * ccel + fs3; + fx *= factor_lj; + fy *= factor_lj; + fz *= factor_lj; f[i][0] += fx; f[i][1] += fy; f[i][2] += fz; @@ -313,6 +320,9 @@ void PairGranHookeHistory::compute(int eflag, int vflag) tor1 = rinv * (dely * fs3 - delz * fs2); tor2 = rinv * (delz * fs1 - delx * fs3); tor3 = rinv * (delx * fs2 - dely * fs1); + tor1 *= factor_lj; + tor2 *= factor_lj; + tor3 *= factor_lj; torque[i][0] -= radi * tor1; torque[i][1] -= radi * tor2; torque[i][2] -= radi * tor3; @@ -433,8 +443,10 @@ void PairGranHookeHistory::init_style() // need a granular neighbor list - if (history) neighbor->add_request(this, NeighConst::REQ_SIZE|NeighConst::REQ_HISTORY); - else neighbor->add_request(this, NeighConst::REQ_SIZE); + if (history) + neighbor->add_request(this, NeighConst::REQ_SIZE | NeighConst::REQ_HISTORY); + else + neighbor->add_request(this, NeighConst::REQ_SIZE); dt = update->dt; @@ -444,8 +456,8 @@ void PairGranHookeHistory::init_style() if (history && (fix_history == nullptr)) { auto cmd = fmt::format("NEIGH_HISTORY_HH{} all NEIGH_HISTORY {}", instance_me, size_history); - fix_history = (FixNeighHistory *) modify->replace_fix( - "NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1); + fix_history = dynamic_cast( + modify->replace_fix("NEIGH_HISTORY_HH_DUMMY" + std::to_string(instance_me), cmd, 1)); fix_history->pair = this; } @@ -466,7 +478,8 @@ void PairGranHookeHistory::init_style() if (ifix->rigid_flag) { if (fix_rigid) error->all(FLERR, "Only one fix rigid command at a time allowed"); - else fix_rigid = ifix; + else + fix_rigid = ifix; } } @@ -511,8 +524,9 @@ void PairGranHookeHistory::init_style() // set fix which stores history info if (history) { - fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_HH" + std::to_string(instance_me)); - if (!fix_history) error->all(FLERR,"Could not find pair fix neigh history ID"); + fix_history = dynamic_cast( + modify->get_fix_by_id("NEIGH_HISTORY_HH" + std::to_string(instance_me))); + if (!fix_history) error->all(FLERR, "Could not find pair fix neigh history ID"); } } diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index e81e5c0939..35c4cf7606 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -75,39 +75,3 @@ class PairGranHookeHistory : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair granular requires atom attributes radius, rmass - -The atom style defined does not have these attributes. - -E: Pair granular requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Could not find pair fix neigh history ID - -UNDOCUMENTED - -U: Pair granular with shear history requires newton pair off - -This is a current restriction of the implementation of pair -granular styles with history. - -U: Could not find pair fix ID - -A fix is created internally by the pair style to store shear -history information. You cannot delete it. - -*/ diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index e1719853a4..a8e47bb9fc 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -102,7 +102,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) // this is so final order of Modify:fix will conform to input script fix_history = nullptr; - fix_dummy = (FixDummy *) modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY"); + fix_dummy = dynamic_cast( modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY")); } /* ---------------------------------------------------------------------- */ @@ -150,7 +150,7 @@ void PairGranular::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double xtmp,ytmp,ztmp,delx,dely,delz,fx,fy,fz,nx,ny,nz; - double radi,radj,radsum,rsq,r,rinv; + double radi,radj,radsum,rsq,r,rinv,factor_lj; double Reff, delta, dR, dR2, dist_to_contact; double vr1,vr2,vr3,vnnr,vn1,vn2,vn3,vt1,vt2,vt3; @@ -188,7 +188,7 @@ void PairGranular::compute(int eflag, int vflag) double *history,*allhistory,**firsthistory; bool touchflag = false; - const bool historyupdate = (update->setupflag) ? false : true; + const bool historyupdate = update->setupflag != 0; ev_init(eflag,vflag); @@ -199,7 +199,7 @@ void PairGranular::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; @@ -222,6 +222,7 @@ void PairGranular::compute(int eflag, int vflag) double *rmass = atom->rmass; int *mask = atom->mask; int nlocal = atom->nlocal; + double *special_lj = force->special_lj; inum = list->inum; ilist = list->ilist; @@ -249,8 +250,11 @@ void PairGranular::compute(int eflag, int vflag) for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; j &= NEIGHMASK; + if (factor_lj == 0) continue; + delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; @@ -651,6 +655,9 @@ void PairGranular::compute(int eflag, int vflag) fx = nx*Fntot + fs1; fy = ny*Fntot + fs2; fz = nz*Fntot + fs3; + fx *= factor_lj; + fy *= factor_lj; + fz *= factor_lj; f[i][0] += fx; f[i][1] += fy; @@ -659,6 +666,9 @@ void PairGranular::compute(int eflag, int vflag) tor1 = ny*fs3 - nz*fs2; tor2 = nz*fs1 - nx*fs3; tor3 = nx*fs2 - ny*fs1; + tor1 *= factor_lj; + tor2 *= factor_lj; + tor3 *= factor_lj; dist_to_contact = radi-0.5*delta; torque[i][0] -= dist_to_contact*tor1; @@ -666,9 +676,9 @@ void PairGranular::compute(int eflag, int vflag) torque[i][2] -= dist_to_contact*tor3; if (twist_model[itype][jtype] != TWIST_NONE) { - tortwist1 = magtortwist * nx; - tortwist2 = magtortwist * ny; - tortwist3 = magtortwist * nz; + tortwist1 = magtortwist * nx * factor_lj; + tortwist2 = magtortwist * ny * factor_lj; + tortwist3 = magtortwist * nz * factor_lj; torque[i][0] += tortwist1; torque[i][1] += tortwist2; @@ -676,9 +686,9 @@ void PairGranular::compute(int eflag, int vflag) } if (roll_model[itype][jtype] != ROLL_NONE) { - torroll1 = Reff*(ny*fr3 - nz*fr2); // n cross fr - torroll2 = Reff*(nz*fr1 - nx*fr3); - torroll3 = Reff*(nx*fr2 - ny*fr1); + torroll1 = Reff*(ny*fr3 - nz*fr2) * factor_lj; // n cross fr + torroll2 = Reff*(nz*fr1 - nx*fr3) * factor_lj; + torroll3 = Reff*(nx*fr2 - ny*fr1) * factor_lj; torque[i][0] += torroll1; torque[i][1] += torroll2; @@ -1120,10 +1130,10 @@ void PairGranular::init_style() // this is so its order in the fix list is preserved if (use_history && fix_history == nullptr) { - fix_history = (FixNeighHistory *) modify->replace_fix("NEIGH_HISTORY_GRANULAR_DUMMY", + fix_history = dynamic_cast( modify->replace_fix("NEIGH_HISTORY_GRANULAR_DUMMY", "NEIGH_HISTORY_GRANULAR" " all NEIGH_HISTORY " - + std::to_string(size_history),1); + + std::to_string(size_history),1)); fix_history->pair = this; } @@ -1189,7 +1199,7 @@ void PairGranular::init_style() // set fix which stores history info if (size_history > 0) { - fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_GRANULAR"); + fix_history = dynamic_cast( modify->get_fix_by_id("NEIGH_HISTORY_GRANULAR")); if (!fix_history) error->all(FLERR,"Could not find pair fix neigh history ID"); } } diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index 5961e28887..5c3edf30a2 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -106,13 +106,3 @@ class PairGranular : public Pair { #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. - -*/ diff --git a/src/H5MD/dump_h5md.h b/src/H5MD/dump_h5md.h index 7caf7f9583..04c0cd2e09 100644 --- a/src/H5MD/dump_h5md.h +++ b/src/H5MD/dump_h5md.h @@ -72,40 +72,3 @@ class DumpH5MD : public Dump { #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: Invalid number of arguments in dump h5md - -Make sure that each data item (position, etc.) is followed by a dump -interval. - -E: Dump h5md requires sorting by atom ID - -Use the dump_modify sort command to enable this. - -E: Too many atoms for dump h5md - -The system size must fit in a 32-bit integer to use this dump -style. - -E: Cannot use variable every setting for dump xtc - -The format of this file requires snapshots at regular intervals. - -E: Cannot change dump_modify every for dump xtc - -The frequency of writing dump xtc snapshots cannot be changed. - -E: Cannot set file_from in dump h5md after box or create_group - -The file_from option modifies the box and create_group options and -they must appear after file_from if used. - -*/ diff --git a/src/INTEL/angle_charmm_intel.h b/src/INTEL/angle_charmm_intel.h index 2a9400964d..5a28079a2b 100644 --- a/src/INTEL/angle_charmm_intel.h +++ b/src/INTEL/angle_charmm_intel.h @@ -77,11 +77,3 @@ class AngleCharmmIntel : public AngleCharmm { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/INTEL/angle_harmonic_intel.h b/src/INTEL/angle_harmonic_intel.h index 6d22f1af28..f0cca66244 100644 --- a/src/INTEL/angle_harmonic_intel.h +++ b/src/INTEL/angle_harmonic_intel.h @@ -77,7 +77,3 @@ class AngleHarmonicIntel : public AngleHarmonic { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/INTEL/bond_fene_intel.h b/src/INTEL/bond_fene_intel.h index 9c22cecb11..438ecd9fd8 100644 --- a/src/INTEL/bond_fene_intel.h +++ b/src/INTEL/bond_fene_intel.h @@ -77,11 +77,3 @@ class BondFENEIntel : public BondFENE { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/INTEL/bond_harmonic_intel.h b/src/INTEL/bond_harmonic_intel.h index cfed9d715c..e442c48613 100644 --- a/src/INTEL/bond_harmonic_intel.h +++ b/src/INTEL/bond_harmonic_intel.h @@ -77,11 +77,3 @@ class BondHarmonicIntel : public BondHarmonic { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/INTEL/dihedral_charmm_intel.cpp b/src/INTEL/dihedral_charmm_intel.cpp index fc416537fe..b36e5ab505 100644 --- a/src/INTEL/dihedral_charmm_intel.cpp +++ b/src/INTEL/dihedral_charmm_intel.cpp @@ -266,7 +266,7 @@ void DihedralCharmmIntel::eval(const int vflag, const flt_t tk = fc.fc[type].k; const int m = fc.fc[type].multiplicity; - flt_t p = (flt_t)1.0; + auto p = (flt_t)1.0; flt_t ddf1, df1; ddf1 = df1 = (flt_t)0.0; @@ -384,7 +384,7 @@ void DihedralCharmmIntel::eval(const int vflag, } if (EFLAG || VFLAG) { - flt_t ev_pre = (flt_t)0; + auto ev_pre = (flt_t)0; if (NEWTON_BOND || i1 < nlocal) ev_pre += (flt_t)0.5; if (NEWTON_BOND || i4 < nlocal) diff --git a/src/INTEL/dihedral_fourier_intel.cpp b/src/INTEL/dihedral_fourier_intel.cpp index ec15afe8e1..68e9fedd44 100644 --- a/src/INTEL/dihedral_fourier_intel.cpp +++ b/src/INTEL/dihedral_fourier_intel.cpp @@ -221,7 +221,7 @@ void DihedralFourierIntel::eval(const int vflag, if (c < (flt_t)-1.0) c = (flt_t)-1.0; flt_t deng; - flt_t df = (flt_t)0.0; + auto df = (flt_t)0.0; if (EFLAG) deng = (flt_t)0.0; for (int j = 0; j < nterms[type]; j++) { @@ -230,7 +230,7 @@ void DihedralFourierIntel::eval(const int vflag, const flt_t tk = fc.fc[j][type].k; const int m = fc.fc[j][type].multiplicity; - flt_t p = (flt_t)1.0; + auto p = (flt_t)1.0; flt_t ddf1, df1; ddf1 = df1 = (flt_t)0.0; diff --git a/src/INTEL/dihedral_harmonic_intel.cpp b/src/INTEL/dihedral_harmonic_intel.cpp index cb23d9dcaa..9b504be3ca 100644 --- a/src/INTEL/dihedral_harmonic_intel.cpp +++ b/src/INTEL/dihedral_harmonic_intel.cpp @@ -225,7 +225,7 @@ void DihedralHarmonicIntel::eval(const int vflag, const flt_t tk = fc.fc[type].k; const int m = fc.fc[type].multiplicity; - flt_t p = (flt_t)1.0; + auto p = (flt_t)1.0; flt_t ddf1, df1; ddf1 = df1 = (flt_t)0.0; diff --git a/src/INTEL/fix_intel.cpp b/src/INTEL/fix_intel.cpp index 933c90e9e8..4f81293e1b 100644 --- a/src/INTEL/fix_intel.cpp +++ b/src/INTEL/fix_intel.cpp @@ -71,11 +71,11 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _offload_threads = 0; _offload_tpc = 4; - _force_array_s = 0; - _force_array_m = 0; - _force_array_d = 0; - _ev_array_s = 0; - _ev_array_d = 0; + _force_array_s = nullptr; + _force_array_m = nullptr; + _force_array_d = nullptr; + _ev_array_s = nullptr; + _ev_array_d = nullptr; #ifdef _LMP_INTEL_OFFLOAD if (ncops < 0) error->all(FLERR,"Illegal package intel command"); @@ -375,7 +375,7 @@ void FixIntel::setup_pre_reverse(int eflag, int vflag) bool FixIntel::pair_hybrid_check() { - PairHybrid *ph = (PairHybrid *)force->pair; + auto ph = dynamic_cast(force->pair); bool has_intel = false; int nstyles = ph->nstyles; @@ -557,30 +557,30 @@ void FixIntel::_sync_main_arrays(const int prereverse) if (!prereverse) _zero_master = 1; int done_this_step = prereverse; if (_pair_hybrid_zero == 0) done_this_step = 1; - if (_force_array_m != 0) { + if (_force_array_m != nullptr) { if (_need_reduce) { reduce_results(&_force_array_m[0].x); _need_reduce = 0; } add_results(_force_array_m, _ev_array_d, _results_eatom, _results_vatom,0); - if (done_this_step) _force_array_m = 0; - else _ev_array_d = 0; - } else if (_force_array_d != 0) { + if (done_this_step) _force_array_m = nullptr; + else _ev_array_d = nullptr; + } else if (_force_array_d != nullptr) { if (_need_reduce) { reduce_results(&_force_array_d[0].x); _need_reduce = 0; } add_results(_force_array_d, _ev_array_d, _results_eatom, _results_vatom,0); - if (done_this_step) _force_array_d = 0; - else _ev_array_d = 0; - } else if (_force_array_s != 0) { + if (done_this_step) _force_array_d = nullptr; + else _ev_array_d = nullptr; + } else if (_force_array_s != nullptr) { if (_need_reduce) { reduce_results(&_force_array_s[0].x); _need_reduce = 0; } add_results(_force_array_s, _ev_array_s, _results_eatom, _results_vatom,0); - if (done_this_step) _force_array_s = 0; - else _ev_array_s = 0; + if (done_this_step) _force_array_s = nullptr; + else _ev_array_s = nullptr; } #ifdef _LMP_INTEL_OFFLOAD diff --git a/src/INTEL/fix_intel.h b/src/INTEL/fix_intel.h index 18d8563a1e..f7c0709171 100644 --- a/src/INTEL/fix_intel.h +++ b/src/INTEL/fix_intel.h @@ -466,126 +466,3 @@ void FixIntel::set_neighbor_host_sizes() #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -W: Could not set host affinity for offload tasks - -When using offload to a coprocessor, the application will try to set affinity -for host MPI tasks and OpenMP threads and will generate a warning if unable -to do so successfully. In the unsuccessful case, you might wish to set -affinity outside of the application and performance might suffer if -hyperthreading is disable on the CPU. - -E: Neighbor list overflow, boost neigh_modify one - -Increase the value for neigh_modify one to allow for larger allocations for -neighbor list builds. The value required can be different for the Intel -package in order to support offload to a coprocessor. - -E: Bad matrix inversion in mldivide3 - -This error should not occur unless the matrix is badly formed. - -E: Illegal package intel command - -The format for the package intel command is incorrect. Please see the -documentation. - -E: fix intel has to operate on group 'all' - -Self explanatory. - -E: Illegal package intel mode requested - -The format for the package intel command is incorrect. Please see the -documentation. - -E: Currently, neighbor style BIN must be used with Intel package. - -This is the only neighbor style that has been implemented for the Intel -package. - -E: Currently, cannot use neigh_modify exclude with Intel package offload. - -This is a current restriction of the Intel package when built for offload. - -W: Unknown Intel Compiler Version - -The compiler version used to build LAMMPS has not been tested with -offload to a coprocessor. - -W: Unsupported Intel Compiler - -The compiler version used to build LAMMPS is not supported when using -offload to a coprocessor. There could be performance or correctness -issues. Please use 14.0.1.106 or 15.1.133 or later. - -E: Currently, cannot offload more than one intel style with hybrid. - -Currently, when using offload, hybrid pair styles can only use the intel -suffix for one of the pair styles. - -E: Cannot yet use hybrid styles with Intel offload. - -The hybrid pair style configuration is not yet supported when using offload -within the Intel package. Support is limited to hybrid/overlay or a hybrid -style that does not require a skip list. - -W: Leaving a core/node free can improve performance for offload - -When each CPU is fully subscribed with MPI tasks and OpenMP threads, -context switching with threads used for offload can sometimes decrease -performance. If you see this warning, try using fewer MPI tasks/OpenMP threads -per node to leave a physical CPU core free on each node. - -E: MPI tasks per node must be multiple of offload_cards - -For offload to multiple coprocessors on a single node, the Intel package -requires that each coprocessor is used by the same number of MPI tasks. - -W: More MPI tasks/OpenMP threads than available cores - -Using more MPI tasks/OpenMP threads than available cores will typically -decrease performance. - -E: INTEL package requires same setting for newton bond and non-bond. - -The newton setting must be the same for both pairwise and bonded forces. - -E: Intel styles for bond/angle/dihedral/improper require intel pair style." - -You cannot use the INTEL package for bond calculations without a -INTEL supported pair style. - -E: Intel styles for kspace require intel pair style. - -You cannot use the INTEL package for kspace calculations without a -INTEL supported pair style. - -E: Cannot currently get per-atom virials with intel package. - -The Intel package does not yet support per-atom virial calculation. - -E: Too few atoms for load balancing offload. - -When using offload to a coprocessor, each MPI task must have at least 2 -atoms throughout the simulation. - -E: Intel package requires fdotr virial with newton on. - -This error can occur with a hybrid pair style that mixes styles that are -incompatible with the newton pair setting turned on. Try turning the -newton pair setting off. - -E: Add -DLMP_INTEL_NBOR_COMPAT to build for special_bond exclusions with Intel - -When using a manybody pair style, bonds/angles/dihedrals, and special_bond -exclusions, LAMMPS should be built with the above compile flag for compatible -results. - -*/ diff --git a/src/INTEL/fix_nh_intel.cpp b/src/INTEL/fix_nh_intel.cpp index 91709aa13f..ada9b4113c 100644 --- a/src/INTEL/fix_nh_intel.cpp +++ b/src/INTEL/fix_nh_intel.cpp @@ -46,7 +46,7 @@ typedef struct { double x,y,z; } dbl3_t; FixNHIntel::FixNHIntel(LAMMPS *lmp, int narg, char **arg) : FixNH(lmp, narg, arg) { - _dtfm = 0; + _dtfm = nullptr; _nlocal3 = 0; _nlocal_max = 0; } @@ -76,7 +76,7 @@ void FixNHIntel::remap() double oldlo,oldhi; double expfac; - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; int *mask = atom->mask; int nlocal = atom->nlocal; double *h = domain->h; @@ -416,7 +416,7 @@ void FixNHIntel::nh_v_press() return; } - dbl3_t * _noalias const v = (dbl3_t *)atom->v[0]; + auto * _noalias const v = (dbl3_t *)atom->v[0]; int *mask = atom->mask; int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; diff --git a/src/INTEL/fix_nh_intel.h b/src/INTEL/fix_nh_intel.h index 3893a206f8..141b567d94 100644 --- a/src/INTEL/fix_nh_intel.h +++ b/src/INTEL/fix_nh_intel.h @@ -46,119 +46,3 @@ class FixNHIntel : public FixNH { #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: Target temperature for fix nvt/npt/nph cannot be 0.0 - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix nvt/npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix nvt/npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix nvt/npt/nph on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix nvt/npt/nph with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix nvt/npt/nph with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix nvt/npt/nph pressure settings - -Settings for coupled dimensions must be the same. - -E: Fix nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix npt and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix nvt/npt does not exist - -Self-explanatory. - -E: Pressure ID for fix npt/nph does not exist - -Self-explanatory. - -E: Fix npt/nph has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/INTEL/fix_npt_intel.h b/src/INTEL/fix_npt_intel.h index 22179ec18e..376c7571ba 100644 --- a/src/INTEL/fix_npt_intel.h +++ b/src/INTEL/fix_npt_intel.h @@ -38,15 +38,3 @@ class FixNPTIntel : public FixNHIntel { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt - -Self-explanatory. - -E: Pressure control must be used with fix npt - -Self-explanatory. - -*/ diff --git a/src/INTEL/fix_nve_asphere_intel.cpp b/src/INTEL/fix_nve_asphere_intel.cpp index eda8b48a67..fa68c9bb4a 100644 --- a/src/INTEL/fix_nve_asphere_intel.cpp +++ b/src/INTEL/fix_nve_asphere_intel.cpp @@ -37,19 +37,19 @@ using namespace FixConst; FixNVEAsphereIntel::FixNVEAsphereIntel(LAMMPS *lmp, int narg, char **arg) : FixNVE(lmp, narg, arg) { - _dtfm = 0; + _dtfm = nullptr; _nlocal3 = 0; _nlocal_max = 0; - _inertia0 = 0; - _inertia1 = 0; - _inertia2 = 0; + _inertia0 = nullptr; + _inertia1 = nullptr; + _inertia2 = nullptr; } /* ---------------------------------------------------------------------- */ void FixNVEAsphereIntel::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Compute nve/asphere requires atom style ellipsoid"); diff --git a/src/INTEL/fix_nve_asphere_intel.h b/src/INTEL/fix_nve_asphere_intel.h index b2d00de8c0..4bc5305302 100644 --- a/src/INTEL/fix_nve_asphere_intel.h +++ b/src/INTEL/fix_nve_asphere_intel.h @@ -49,15 +49,3 @@ class FixNVEAsphereIntel : public FixNVE { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Compute nve/asphere requires atom style ellipsoid - -Self-explanatory. - -E: Fix nve/asphere requires extended particles - -This fix can only be used for particles with a shape setting. - -*/ diff --git a/src/INTEL/fix_nve_intel.cpp b/src/INTEL/fix_nve_intel.cpp index 9670af65c2..249e797713 100644 --- a/src/INTEL/fix_nve_intel.cpp +++ b/src/INTEL/fix_nve_intel.cpp @@ -32,7 +32,7 @@ using namespace FixConst; FixNVEIntel::FixNVEIntel(LAMMPS *lmp, int narg, char **arg) : FixNVE(lmp, narg, arg) { - _dtfm = 0; + _dtfm = nullptr; _nlocal3 = 0; _nlocal_max = 0; } diff --git a/src/INTEL/fix_nve_intel.h b/src/INTEL/fix_nve_intel.h index ff793e3f20..d7c48db81f 100644 --- a/src/INTEL/fix_nve_intel.h +++ b/src/INTEL/fix_nve_intel.h @@ -48,13 +48,3 @@ class FixNVEIntel : public FixNVE { #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. - -*/ diff --git a/src/INTEL/fix_nvt_intel.h b/src/INTEL/fix_nvt_intel.h index 585df9c542..4c840de9de 100644 --- a/src/INTEL/fix_nvt_intel.h +++ b/src/INTEL/fix_nvt_intel.h @@ -38,15 +38,3 @@ class FixNVTIntel : public FixNHIntel { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt - -Self-explanatory. - -E: Pressure control can not be used with fix nvt - -Self-explanatory. - -*/ diff --git a/src/INTEL/fix_nvt_sllod_intel.cpp b/src/INTEL/fix_nvt_sllod_intel.cpp index f704512c51..bc13d1d677 100644 --- a/src/INTEL/fix_nvt_sllod_intel.cpp +++ b/src/INTEL/fix_nvt_sllod_intel.cpp @@ -70,7 +70,7 @@ void FixNVTSllodIntel::init() int i; for (i = 0; i < modify->nfix; i++) if (strncmp(modify->fix[i]->style,"deform",6) == 0) { - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform " "remap option"); break; diff --git a/src/INTEL/fix_nvt_sllod_intel.h b/src/INTEL/fix_nvt_sllod_intel.h index aaa2f91a8e..dc7ee05977 100644 --- a/src/INTEL/fix_nvt_sllod_intel.h +++ b/src/INTEL/fix_nvt_sllod_intel.h @@ -44,28 +44,3 @@ class FixNVTSllodIntel : public FixNHIntel { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/sllod - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/sllod - -Self-explanatory. - -E: Temperature for fix nvt/sllod does not have a bias - -The specified compute must compute temperature with a bias. - -E: Using fix nvt/sllod with inconsistent fix deform remap option - -Fix nvt/sllod requires that deforming atoms have a velocity profile -provided by "remap v" as a fix deform option. - -E: Using fix nvt/sllod with no fix deform defined - -Self-explanatory. - -*/ diff --git a/src/INTEL/improper_cvff_intel.h b/src/INTEL/improper_cvff_intel.h index dc09fdeb9b..e799144dea 100644 --- a/src/INTEL/improper_cvff_intel.h +++ b/src/INTEL/improper_cvff_intel.h @@ -79,12 +79,3 @@ class ImproperCvffIntel : public ImproperCvff { #endif #endif - -/* ERROR/WARNING messages: - -W: Improper problem: %d %ld %d %d %d %d - -Conformation of the 4 listed improper atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/INTEL/improper_harmonic_intel.h b/src/INTEL/improper_harmonic_intel.h index 07a38a5770..d8b1cffa59 100644 --- a/src/INTEL/improper_harmonic_intel.h +++ b/src/INTEL/improper_harmonic_intel.h @@ -78,16 +78,3 @@ class ImproperHarmonicIntel : public ImproperHarmonic { #endif #endif - -/* ERROR/WARNING messages: - -W: Improper problem: %d %ld %d %d %d %d - -Conformation of the 4 listed improper atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for improper coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/INTEL/intel_buffers.cpp b/src/INTEL/intel_buffers.cpp index f84505955c..535fa5605e 100644 --- a/src/INTEL/intel_buffers.cpp +++ b/src/INTEL/intel_buffers.cpp @@ -26,18 +26,18 @@ using namespace LAMMPS_NS; template IntelBuffers::IntelBuffers(class LAMMPS *lmp_in) : - lmp(lmp_in), _x(0), _q(0), _quat(0), _f(0), _off_threads(0), + lmp(lmp_in), _x(nullptr), _q(nullptr), _quat(nullptr), _f(nullptr), _off_threads(0), _n_list_ptrs(1), _max_list_ptrs(4), _buf_size(0), _buf_local_size(0) { _neigh_list_ptrs = new IntelNeighListPtrs[_max_list_ptrs]; - _neigh_list_ptrs[0].cnumneigh = 0; + _neigh_list_ptrs[0].cnumneigh = nullptr; _list_alloc_atoms = 0; _ntypes = 0; _off_map_listlocal = 0; - _ccachex = 0; + _ccachex = nullptr; _ncache_alloc = 0; - _ncachetag = 0; - _cutneighsq = 0; - _cutneighghostsq = 0; + _ncachetag = nullptr; + _cutneighsq = nullptr; + _cutneighghostsq = nullptr; _need_tag = 0; #ifdef _LMP_INTEL_OFFLOAD _separate_buffers = 0; @@ -104,8 +104,8 @@ void IntelBuffers::free_buffers() #endif lmp->memory->destroy(x); - if (q != 0) lmp->memory->destroy(q); - if (quat != 0) lmp->memory->destroy(quat); + if (q != nullptr) lmp->memory->destroy(q); + if (quat != nullptr) lmp->memory->destroy(quat); lmp->memory->destroy(_f); _buf_size = _buf_local_size = 0; } @@ -251,7 +251,7 @@ void IntelBuffers::free_list_local() if (_off_map_listlocal > 0) { if (_neigh_list_ptrs[0].cnumneigh) { int * cnumneigh = _neigh_list_ptrs[0].cnumneigh; - _neigh_list_ptrs[0].cnumneigh = 0; + _neigh_list_ptrs[0].cnumneigh = nullptr; #ifdef _LMP_INTEL_OFFLOAD if (_off_map_ilist != nullptr) { #pragma offload_transfer target(mic:_cop) \ @@ -286,7 +286,7 @@ void IntelBuffers::free_list_ptrs() lmp->memory->destroy(_neigh_list_ptrs[list_num].numneighhalf); } _neigh_list_ptrs[list_num].size = 0; - _neigh_list_ptrs[list_num].list_ptr = 0; + _neigh_list_ptrs[list_num].list_ptr = nullptr; } _n_list_ptrs = 1; } @@ -303,7 +303,7 @@ void IntelBuffers::grow_data3(NeighList *list, int *&numneighhalf, if (list_num == _n_list_ptrs) { if (_n_list_ptrs == _max_list_ptrs) { _max_list_ptrs *= 2; - IntelNeighListPtrs *new_list = new IntelNeighListPtrs[_max_list_ptrs]; + auto new_list = new IntelNeighListPtrs[_max_list_ptrs]; for (int i = 0; i < _n_list_ptrs; i++) new_list[i] = _neigh_list_ptrs[i]; delete []_neigh_list_ptrs; _neigh_list_ptrs = new_list; @@ -447,7 +447,7 @@ void IntelBuffers::free_ccache() lmp->memory->destroy(ccachef); #endif - _ccachex = 0; + _ccachex = nullptr; } } @@ -546,7 +546,7 @@ void IntelBuffers::free_ncache() if (ncachetag) lmp->memory->destroy(ncachetag); _ncache_alloc = 0; - _ncachetag = 0; + _ncachetag = nullptr; } } @@ -563,7 +563,7 @@ void IntelBuffers::grow_ncache(const int off_flag, const int vsize = _ncache_stride * nt; if (_ncache_alloc) { - if (vsize > _ncache_alloc || (need_tag() && _ncachetag == 0)) + if (vsize > _ncache_alloc || (need_tag() && _ncachetag == nullptr)) free_ncache(); #ifdef _LMP_INTEL_OFFLOAD else if (off_flag && _off_ncache == 0) @@ -660,7 +660,7 @@ void IntelBuffers::set_ntypes(const int ntypes, } #endif lmp->memory->destroy(_cutneighsq); - if (_cutneighghostsq != 0) lmp->memory->destroy(_cutneighghostsq); + if (_cutneighghostsq != nullptr) lmp->memory->destroy(_cutneighghostsq); } if (ntypes > 0) { lmp->memory->create(_cutneighsq, ntypes, ntypes, "_cutneighsq"); diff --git a/src/INTEL/nbin_intel.h b/src/INTEL/nbin_intel.h index 8e4e387581..678189d08c 100644 --- a/src/INTEL/nbin_intel.h +++ b/src/INTEL/nbin_intel.h @@ -55,16 +55,3 @@ class NBinIntel : public NBinStandard { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -E: Intel package expects no atoms within cutoff of {1e15,1e15,1e15}. - -The Intel package can make use of dummy atoms for padding with a large position -that should not be within the cutoff. - -*/ diff --git a/src/INTEL/npair_full_bin_ghost_intel.cpp b/src/INTEL/npair_full_bin_ghost_intel.cpp index 1f4e41be49..b0c052d35b 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/INTEL/npair_full_bin_ghost_intel.cpp @@ -118,7 +118,7 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, const ATOM_T * _noalias const x = buffers->get_x(); int * _noalias const intel_list = buffers->intel_list(list); - int ** _noalias const firstneigh = list->firstneigh; + int ** _noalias const firstneigh = list->firstneigh; // NOLINT const int e_nall = nall_t; const int molecular = atom->molecular; diff --git a/src/INTEL/npair_full_bin_ghost_intel.h b/src/INTEL/npair_full_bin_ghost_intel.h index a14ac18909..6b70778f13 100644 --- a/src/INTEL/npair_full_bin_ghost_intel.h +++ b/src/INTEL/npair_full_bin_ghost_intel.h @@ -49,7 +49,3 @@ class NPairFullBinGhostIntel : public NPairIntel { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/INTEL/npair_full_bin_intel.h b/src/INTEL/npair_full_bin_intel.h index ce23b0d475..8649610b90 100644 --- a/src/INTEL/npair_full_bin_intel.h +++ b/src/INTEL/npair_full_bin_intel.h @@ -42,7 +42,3 @@ class NPairFullBinIntel : public NPairIntel { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/INTEL/npair_half_bin_newton_intel.h b/src/INTEL/npair_half_bin_newton_intel.h index 3830847954..0f7c86d993 100644 --- a/src/INTEL/npair_half_bin_newton_intel.h +++ b/src/INTEL/npair_half_bin_newton_intel.h @@ -41,7 +41,3 @@ class NPairHalfBinNewtonIntel : public NPairIntel { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/INTEL/npair_half_bin_newton_tri_intel.h b/src/INTEL/npair_half_bin_newton_tri_intel.h index e6e3c6ce16..8e486313ff 100644 --- a/src/INTEL/npair_half_bin_newton_tri_intel.h +++ b/src/INTEL/npair_half_bin_newton_tri_intel.h @@ -41,7 +41,3 @@ class NPairHalfBinNewtonTriIntel : public NPairIntel { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/INTEL/npair_halffull_newtoff_intel.h b/src/INTEL/npair_halffull_newtoff_intel.h index 5383808651..fbf52d89d5 100644 --- a/src/INTEL/npair_halffull_newtoff_intel.h +++ b/src/INTEL/npair_halffull_newtoff_intel.h @@ -42,7 +42,3 @@ NPairStyle(halffull/newtoff/skip/ghost/intel, NP_ORTHO | NP_TRI | NP_SKIP | NP_GHOST | NP_INTEL); // clang-format on #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/INTEL/npair_halffull_newton_intel.cpp b/src/INTEL/npair_halffull_newton_intel.cpp index fe2ddb375a..6755ffc799 100644 --- a/src/INTEL/npair_halffull_newton_intel.cpp +++ b/src/INTEL/npair_halffull_newton_intel.cpp @@ -54,8 +54,7 @@ void NPairHalffullNewtonIntel::build_t(NeighList *list, int ** _noalias const firstneigh = list->firstneigh; const int * _noalias const ilist_full = list->listfull->ilist; const int * _noalias const numneigh_full = list->listfull->numneigh; - const int ** _noalias const firstneigh_full = - (const int ** const)list->listfull->firstneigh; + const int ** _noalias const firstneigh_full = (const int ** const)list->listfull->firstneigh; // NOLINT #if defined(_OPENMP) #pragma omp parallel @@ -141,8 +140,7 @@ void NPairHalffullNewtonIntel::build_t3(NeighList *list, int *numhalf) int ** _noalias const firstneigh = list->firstneigh; const int * _noalias const ilist_full = list->listfull->ilist; const int * _noalias const numneigh_full = numhalf; - const int ** _noalias const firstneigh_full = - (const int ** const)list->listfull->firstneigh; + const int ** _noalias const firstneigh_full = (const int ** const)list->listfull->firstneigh; // NOLINT int packthreads = 1; if (comm->nthreads > INTEL_HTHREADS) packthreads = comm->nthreads; diff --git a/src/INTEL/npair_halffull_newton_intel.h b/src/INTEL/npair_halffull_newton_intel.h index 7514adbe25..8464c1385c 100644 --- a/src/INTEL/npair_halffull_newton_intel.h +++ b/src/INTEL/npair_halffull_newton_intel.h @@ -59,11 +59,3 @@ class NPairHalffullNewtonIntel : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self explanatory. - -*/ diff --git a/src/INTEL/npair_intel.h b/src/INTEL/npair_intel.h index a17733aed7..04093d5ca1 100644 --- a/src/INTEL/npair_intel.h +++ b/src/INTEL/npair_intel.h @@ -103,21 +103,4 @@ class NPairIntel : public NPair { #endif -/* ERROR/WARNING messages: - -E: Exclusion lists not yet supported for Intel offload - -Self explanatory. - -E: The 'package intel' command is required for /intel styles - -Self explanatory. - -E: Too many neighbor bins for INTEL package. - -The number of bins used in the stencil to check for neighboring atoms is too -high for the Intel package. Either increase the bin size in the input script -or recompile with a larger setting for INTEL_MAX_STENCIL in intel_preprocess.h. - -*/ diff --git a/src/INTEL/npair_skip_intel.cpp b/src/INTEL/npair_skip_intel.cpp index 1ebbe9c383..6f34463ac8 100644 --- a/src/INTEL/npair_skip_intel.cpp +++ b/src/INTEL/npair_skip_intel.cpp @@ -36,7 +36,7 @@ NPairSkipIntel::NPairSkipIntel(LAMMPS *lmp) : NPair(lmp) { if (!_fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); _inum_starts = new int[comm->nthreads]; _inum_counts = new int[comm->nthreads]; - _full_props = 0; + _full_props = nullptr; } /* ---------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ NPairSkipIntel::NPairSkipIntel(LAMMPS *lmp) : NPair(lmp) { NPairSkipIntel::~NPairSkipIntel() { delete []_inum_starts; delete []_inum_counts; - if (_full_props) delete []_full_props; + delete[] _full_props; } /* ---------------------------------------------------------------------- */ @@ -76,13 +76,12 @@ void NPairSkipIntel::build_t(NeighList *list, int *numhalf, int *cnumneigh, const int * _noalias const type = atom->type; int * _noalias const ilist = list->ilist; int * _noalias const numneigh = list->numneigh; - int ** _noalias const firstneigh = (int ** const)list->firstneigh; + int ** _noalias const firstneigh = (int ** const)list->firstneigh; // NOLINT const int * _noalias const ilist_skip = list->listskip->ilist; const int * _noalias const numneigh_skip = list->listskip->numneigh; - const int ** _noalias const firstneigh_skip = - (const int ** const)list->listskip->firstneigh; + const int ** _noalias const firstneigh_skip = (const int ** const)list->listskip->firstneigh; // NOLINT const int * _noalias const iskip = list->iskip; - const int ** _noalias const ijskip = (const int ** const)list->ijskip; + const int ** _noalias const ijskip = (const int ** const)list->ijskip; // NOLINT int num_skip = list->listskip->inum; if (list->ghost) num_skip += list->listskip->gnum; @@ -203,11 +202,11 @@ void NPairSkipIntel::build(NeighList *list) if (_fix->three_body_neighbor()==0 || _full_props[list->listskip->index] == 0) { if (_fix->precision() == FixIntel::PREC_MODE_MIXED) - build_t(list, 0, 0, 0); + build_t(list, nullptr, nullptr, nullptr); else if (_fix->precision() == FixIntel::PREC_MODE_DOUBLE) - build_t(list, 0, 0, 0); + build_t(list, nullptr, nullptr, nullptr); else - build_t(list, 0, 0, 0); + build_t(list, nullptr, nullptr, nullptr); } else { int *nhalf, *cnumneigh, *nhalf_skip, *u; if (_fix->precision() == FixIntel::PREC_MODE_MIXED) { diff --git a/src/INTEL/npair_skip_intel.h b/src/INTEL/npair_skip_intel.h index b7ca847eee..4f1763146e 100644 --- a/src/INTEL/npair_skip_intel.h +++ b/src/INTEL/npair_skip_intel.h @@ -59,11 +59,3 @@ class NPairSkipIntel : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self explanatory. - -*/ diff --git a/src/INTEL/pair_airebo_intel.cpp b/src/INTEL/pair_airebo_intel.cpp index 5b73ba99d2..939a1873a9 100644 --- a/src/INTEL/pair_airebo_intel.cpp +++ b/src/INTEL/pair_airebo_intel.cpp @@ -409,7 +409,7 @@ void PairAIREBOIntel::eval( ATOM_T * _noalias const x = buffers->get_x(offload); const int * _noalias const numneighhalf = buffers->get_atombin(); const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT tagint * const tag = atom->tag; const int ntypes = atom->ntypes + 1; @@ -570,7 +570,7 @@ void PairAIREBOIntel::eval( if (EVFLAG) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ @@ -919,7 +919,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, if (pass == 0) { sum_pij += wik * g * ex_lam; sum_dpij_dN += wik * dgdN * ex_lam; - flt_t cutN = Sp(Nki, Nmin, Nmax, nullptr); + auto cutN = Sp(Nki, Nmin, Nmax, nullptr); *sum_N += (1 - ktype) * wik * cutN; } else { flt_t tmp = -0.5 * pij * pij * pij; @@ -1501,17 +1501,17 @@ inline flt_t ref_lennard_jones_bondorder(KernelArgsAIREBOT * ka, flt_t Nji = ka->nH[j] + ka->nC[j] - wij; flt_t NconjtmpI; acc_t fijc[3] = {0}, fjic[3] = {0}; - flt_t pij = frebo_pij(ka, i, j, delx * scale, dely * scale, + auto pij = frebo_pij(ka, i, j, delx * scale, dely * scale, delz * scale, the_r, wij, 0.0, &NconjtmpI, fijc); flt_t NconjtmpJ; - flt_t pji = frebo_pij(ka, j, i, -delx * scale, -dely * scale, + auto pji = frebo_pij(ka, j, i, -delx * scale, -dely * scale, -delz * scale, the_r, wij, 0.0, &NconjtmpJ, fjic); flt_t Nijconj = 1.0 + (NconjtmpI * NconjtmpI) + (NconjtmpJ * NconjtmpJ); flt_t dN3_pi_rc[3]; - flt_t pi_rc = frebo_pi_rc(ka, itype, jtype, Nij, Nji, Nijconj, + auto pi_rc = frebo_pi_rc(ka, itype, jtype, Nij, Nji, Nijconj, dN3_pi_rc); flt_t dN3_Tij[3]; - flt_t Tij = frebo_Tij(ka, itype, jtype, Nij, Nji, Nijconj, + auto Tij = frebo_Tij(ka, itype, jtype, Nij, Nji, Nijconj, dN3_Tij); flt_t sum_omega = 0; if (fabs(Tij) > TOL) { @@ -1522,12 +1522,12 @@ inline flt_t ref_lennard_jones_bondorder(KernelArgsAIREBOT * ka, flt_t pi_dh = Tij * sum_omega; flt_t bij = 0.5 * (pij + pji) + pi_rc + pi_dh; flt_t dStb; - flt_t Stb = Sp2(bij, ka->params.bLJmin[itype][jtype], + auto Stb = Sp2(bij, ka->params.bLJmin[itype][jtype], ka->params.bLJmax[itype][jtype], &dStb); if (dStb != 0) { - flt_t pij_reverse = frebo_pij(ka, i, j, delx * scale, + auto pij_reverse = frebo_pij(ka, i, j, delx * scale, dely * scale, delz * scale, the_r, wij, VA * dStb, &NconjtmpI, fijc); - flt_t pji_reverse = frebo_pij(ka, j, i, -delx * scale, + auto pji_reverse = frebo_pij(ka, j, i, -delx * scale, -dely * scale, -delz * scale, the_r, wij, VA * dStb, &NconjtmpJ, fjic); fijc[0] -= fjic[0]; fijc[1] -= fjic[1]; @@ -1537,7 +1537,7 @@ inline flt_t ref_lennard_jones_bondorder(KernelArgsAIREBOT * ka, frebo_N_spline_force(ka, j, i, VA * dStb, dN3_pi_rc[1], dN3_pi_rc[2], NconjtmpJ); if (fabs(Tij) > TOL) { - flt_t sum_omega_reverse = frebo_sum_omega(ka, i, j, + auto sum_omega_reverse = frebo_sum_omega(ka, i, j, delx * scale, dely * scale, delz * scale, the_r, VA * dStb * Tij, fijc); frebo_N_spline_force(ka, i, j, VA * dStb * sum_omega, dN3_Tij[0], dN3_Tij[2], NconjtmpI); diff --git a/src/INTEL/pair_airebo_intel.h b/src/INTEL/pair_airebo_intel.h index 8cd504aadb..16d77a8a06 100644 --- a/src/INTEL/pair_airebo_intel.h +++ b/src/INTEL/pair_airebo_intel.h @@ -64,48 +64,3 @@ class PairAIREBOIntel : public PairAIREBO { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style AIREBO requires atom IDs - -This is a requirement to use the AIREBO potential. - -E: Pair style AIREBO requires newton pair on - -See the newton command. This is a restriction to use the AIREBO -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Neighbor list overflow, boost neigh_modify one - -There are too many neighbors of a single atom. Use the neigh_modify -command to increase the max number of neighbors allowed for one atom. -You may also want to boost the page size. - -E: Cannot open AIREBO potential file %s - -The specified AIREBO potential file cannot be opened. Check that the -path and name are correct. - -E: Cannot yet use airebo/intel with hybrid. - -Pair style airebo/intel cannot currently be used as part of a hybrid -pair style (with the exception of hybrid/overlay). - - -*/ diff --git a/src/INTEL/pair_buck_coul_cut_intel.cpp b/src/INTEL/pair_buck_coul_cut_intel.cpp index 934c5ec0b2..d113b913d1 100644 --- a/src/INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/INTEL/pair_buck_coul_cut_intel.cpp @@ -145,7 +145,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; @@ -401,7 +401,7 @@ void PairBuckCoulCutIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_buck_coul_long_intel.cpp b/src/INTEL/pair_buck_coul_long_intel.cpp index 563e3abafc..23ff301a81 100644 --- a/src/INTEL/pair_buck_coul_long_intel.cpp +++ b/src/INTEL/pair_buck_coul_long_intel.cpp @@ -146,7 +146,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; @@ -477,7 +477,7 @@ void PairBuckCoulLongIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_buck_intel.cpp b/src/INTEL/pair_buck_intel.cpp index 54a4cc0be3..4472e91793 100644 --- a/src/INTEL/pair_buck_intel.cpp +++ b/src/INTEL/pair_buck_intel.cpp @@ -141,7 +141,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_lj = fc.special_lj; const C_FORCE_T * _noalias const c_force = fc.c_force[0]; @@ -368,7 +368,7 @@ void PairBuckIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } void PairBuckIntel::init_style() diff --git a/src/INTEL/pair_dpd_intel.cpp b/src/INTEL/pair_dpd_intel.cpp index fe76e81a4e..06801b0ce0 100644 --- a/src/INTEL/pair_dpd_intel.cpp +++ b/src/INTEL/pair_dpd_intel.cpp @@ -179,12 +179,12 @@ void PairDPDIntel::eval(const int offload, const int vflag, ATOM_T * _noalias const x = buffers->get_x(offload); typedef struct { double x, y, z; } lmp_vt; - lmp_vt *v = (lmp_vt *)atom->v[0]; + auto *v = (lmp_vt *)atom->v[0]; const flt_t dtinvsqrt = 1.0/sqrt(update->dt); const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const FC_PACKED1_T * _noalias const param = fc.param[0]; const flt_t * _noalias const special_lj = fc.special_lj; int * _noalias const rngi_thread = fc.rngi; @@ -428,7 +428,7 @@ void PairDPDIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- diff --git a/src/INTEL/pair_dpd_intel.h b/src/INTEL/pair_dpd_intel.h index 52ba6c3ed3..08b7d29e34 100644 --- a/src/INTEL/pair_dpd_intel.h +++ b/src/INTEL/pair_dpd_intel.h @@ -100,11 +100,3 @@ class PairDPDIntel : public PairDPD { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -*/ diff --git a/src/INTEL/pair_eam_intel.cpp b/src/INTEL/pair_eam_intel.cpp index 56188028cf..2a491e66c9 100644 --- a/src/INTEL/pair_eam_intel.cpp +++ b/src/INTEL/pair_eam_intel.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; PairEAMIntel::PairEAMIntel(LAMMPS *lmp) : PairEAM(lmp) { suffix_flag |= Suffix::INTEL; - fp_float = 0; + fp_float = nullptr; } /* ---------------------------------------------------------------------- */ @@ -197,7 +197,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const FC_PACKED1_T * _noalias const rhor_spline_f = fc.rhor_spline_f; const FC_PACKED1_T * _noalias const rhor_spline_e = fc.rhor_spline_e; const FC_PACKED2_T * _noalias const z2r_spline_t = fc.z2r_spline_t; @@ -306,7 +306,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, const flt_t ytmp = x[i].y; const flt_t ztmp = x[i].z; - acc_t rhoi = (acc_t)0.0; + auto rhoi = (acc_t)0.0; int ej = 0; #if defined(LMP_SIMD_COMPILER) #pragma vector aligned @@ -656,7 +656,7 @@ void PairEAMIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- diff --git a/src/INTEL/pair_eam_intel.h b/src/INTEL/pair_eam_intel.h index 54f3da4271..3142b8a187 100644 --- a/src/INTEL/pair_eam_intel.h +++ b/src/INTEL/pair_eam_intel.h @@ -92,11 +92,3 @@ class PairEAMIntel : public PairEAM { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -*/ diff --git a/src/INTEL/pair_gayberne_intel.cpp b/src/INTEL/pair_gayberne_intel.cpp index 32f5f2fe78..c3ce8a8d43 100644 --- a/src/INTEL/pair_gayberne_intel.cpp +++ b/src/INTEL/pair_gayberne_intel.cpp @@ -235,7 +235,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_lj = fc.special_lj; const FC_PACKED1_T * _noalias const ijc = fc.ijc[0]; @@ -881,7 +881,7 @@ void PairGayBerneIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, 2); else - fix->add_result_array(f_start, 0, offload, 0, 0, 2); + fix->add_result_array(f_start, nullptr, offload, 0, 0, 2); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp index c5035d5f03..721108f8f1 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -145,7 +145,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; @@ -448,7 +448,7 @@ void PairLJCharmmCoulCharmmIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_lj_charmm_coul_charmm_intel.h b/src/INTEL/pair_lj_charmm_coul_charmm_intel.h index 4915a93dae..54aeafa89f 100644 --- a/src/INTEL/pair_lj_charmm_coul_charmm_intel.h +++ b/src/INTEL/pair_lj_charmm_coul_charmm_intel.h @@ -86,16 +86,3 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -E: Intel variant of lj/charmm/coul/charmm expects lj cutoff<=coulombic - -The intel accelerated version of the CHARMM style requires that the -Lennard-Jones cutoff is not greater than the coulombic cutoff. - -*/ diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp index 850429cd1b..e78797deb0 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -149,7 +149,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; @@ -513,7 +513,7 @@ void PairLJCharmmCoulLongIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_lj_charmm_coul_long_intel.h b/src/INTEL/pair_lj_charmm_coul_long_intel.h index e3a2065e27..15bcf206f6 100644 --- a/src/INTEL/pair_lj_charmm_coul_long_intel.h +++ b/src/INTEL/pair_lj_charmm_coul_long_intel.h @@ -91,16 +91,3 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -E: Intel variant of lj/charmm/coul/long expects lj cutoff<=coulombic - -The intel accelerated version of the CHARMM style requires that the -Lennard-Jones cutoff is not greater than the coulombic cutoff. - -*/ diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.cpp b/src/INTEL/pair_lj_cut_coul_long_intel.cpp index a13cfbc148..2ab2e35a56 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/INTEL/pair_lj_cut_coul_long_intel.cpp @@ -148,7 +148,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_coul = fc.special_coul; const flt_t * _noalias const special_lj = fc.special_lj; @@ -478,7 +478,7 @@ void PairLJCutCoulLongIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_lj_cut_coul_long_intel.h b/src/INTEL/pair_lj_cut_coul_long_intel.h index 903e60070b..7c4d5a9e62 100644 --- a/src/INTEL/pair_lj_cut_coul_long_intel.h +++ b/src/INTEL/pair_lj_cut_coul_long_intel.h @@ -96,11 +96,3 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -*/ diff --git a/src/INTEL/pair_lj_cut_intel.cpp b/src/INTEL/pair_lj_cut_intel.cpp index 50205cfc49..1f3169ab26 100644 --- a/src/INTEL/pair_lj_cut_intel.cpp +++ b/src/INTEL/pair_lj_cut_intel.cpp @@ -157,7 +157,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag, const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; - const int ** _noalias const firstneigh = (const int **)list->firstneigh; + const int ** _noalias const firstneigh = (const int **)list->firstneigh; // NOLINT const flt_t * _noalias const special_lj = fc.special_lj; const FC_PACKED1_T * _noalias const ljc12o = fc.ljc12o[0]; const FC_PACKED2_T * _noalias const lj34 = fc.lj34[0]; @@ -384,7 +384,7 @@ void PairLJCutIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } /* ---------------------------------------------------------------------- */ diff --git a/src/INTEL/pair_lj_cut_intel.h b/src/INTEL/pair_lj_cut_intel.h index e65fbf9865..84f786a02a 100644 --- a/src/INTEL/pair_lj_cut_intel.h +++ b/src/INTEL/pair_lj_cut_intel.h @@ -85,11 +85,3 @@ class PairLJCutIntel : public PairLJCut { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -*/ diff --git a/src/INTEL/pair_sw_intel.cpp b/src/INTEL/pair_sw_intel.cpp index f6cf90b1d1..1dbb7b10ac 100644 --- a/src/INTEL/pair_sw_intel.cpp +++ b/src/INTEL/pair_sw_intel.cpp @@ -573,7 +573,7 @@ void PairSWIntel::eval(const int offload, const int vflag, if (EFLAG || vflag) fix->add_result_array(f_start, ev_global, offload, eatom, 0, vflag); else - fix->add_result_array(f_start, 0, offload); + fix->add_result_array(f_start, nullptr, offload); } #else diff --git a/src/INTEL/pair_sw_intel.h b/src/INTEL/pair_sw_intel.h index b0ade4bb9d..e1f621cb93 100644 --- a/src/INTEL/pair_sw_intel.h +++ b/src/INTEL/pair_sw_intel.h @@ -102,19 +102,3 @@ class PairSWIntel : public PairSW { #endif #endif - -/* ERROR/WARNING messages: - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -E: The 'ghost no' option cannot be used with sw/intel. - -Self-explanatory. - -E: Intel compiler versions before 15 Update 1 not supported for sw/intel. - -Self-explanatory. - -*/ diff --git a/src/INTEL/pair_tersoff_intel.h b/src/INTEL/pair_tersoff_intel.h index 6748e4aa16..a813acf196 100644 --- a/src/INTEL/pair_tersoff_intel.h +++ b/src/INTEL/pair_tersoff_intel.h @@ -111,63 +111,3 @@ class PairTersoffIntel : public PairTersoff { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style Tersoff requires atom IDs - -This is a requirement to use the Tersoff potential. - -E: Pair style Tersoff requires newton pair on - -See the newton command. This is a restriction to use the Tersoff -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open Tersoff potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Tersoff potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Tersoff parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file for a SW or Tersoff potential has more than -one entry for the same 3 ordered elements. - -E: Potential file is missing an entry - -The potential file for a SW or Tersoff potential does not have a -needed entry. - -E: The 'package intel' command is required for /intel styles - -Self-explanatory. - -W: Tersoff/intel currently requires intel compiler. Using MANYBODY version. - -Self-explanatory - -*/ diff --git a/src/INTEL/pppm_intel.cpp b/src/INTEL/pppm_intel.cpp index e98d9d99e3..72c5791f75 100644 --- a/src/INTEL/pppm_intel.cpp +++ b/src/INTEL/pppm_intel.cpp @@ -1119,9 +1119,9 @@ FFT_SCALAR *** PPPMIntel::create3d_offset(FFT_SCALAR ***&array, int n1lo, bigint nbytes = ((bigint) sizeof(FFT_SCALAR)) * n1*n2*n3 + INTEL_P3M_ALIGNED_MAXORDER*2; - FFT_SCALAR *data = (FFT_SCALAR *) memory->smalloc(nbytes,name); + auto data = (FFT_SCALAR *) memory->smalloc(nbytes,name); nbytes = ((bigint) sizeof(FFT_SCALAR *)) * n1*n2; - FFT_SCALAR **plane = (FFT_SCALAR **) memory->smalloc(nbytes,name); + auto plane = (FFT_SCALAR **) memory->smalloc(nbytes,name); nbytes = ((bigint) sizeof(FFT_SCALAR **)) * n1; array = (FFT_SCALAR ***) memory->smalloc(nbytes,name); diff --git a/src/INTEL/pppm_intel.h b/src/INTEL/pppm_intel.h index 7679c8988f..bddd9a95a1 100644 --- a/src/INTEL/pppm_intel.h +++ b/src/INTEL/pppm_intel.h @@ -110,12 +110,3 @@ class PPPMIntel : public PPPM { #endif #endif - -/* ERROR/WARNING messages: - -E: PPPM order greater than supported by INTEL - -There is a compile time limit on the maximum order for PPPM -in the INTEL package that might be different from LAMMPS - -*/ diff --git a/src/INTEL/verlet_lrt_intel.cpp b/src/INTEL/verlet_lrt_intel.cpp index 0fd2aa354d..4102510c66 100644 --- a/src/INTEL/verlet_lrt_intel.cpp +++ b/src/INTEL/verlet_lrt_intel.cpp @@ -67,7 +67,7 @@ void VerletLRTIntel::init() { Verlet::init(); - _intel_kspace = (PPPMIntel*)(force->kspace_match("^pppm/intel", 0)); + _intel_kspace = dynamic_cast(force->kspace_match("^pppm/intel", 0)); #ifndef LMP_INTEL_USELRT error->all(FLERR, @@ -81,7 +81,7 @@ void VerletLRTIntel::init() void VerletLRTIntel::setup(int flag) { - if (_intel_kspace == 0) { + if (_intel_kspace == nullptr) { Verlet::setup(flag); return; } @@ -202,7 +202,7 @@ void VerletLRTIntel::setup(int flag) void VerletLRTIntel::run(int n) { - if (_intel_kspace == 0) { + if (_intel_kspace == nullptr) { Verlet::run(n); return; } @@ -215,7 +215,7 @@ void VerletLRTIntel::run(int n) int n_pre_neighbor = modify->n_pre_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; if (atom->sortfreq > 0) sortflag = 1; @@ -388,7 +388,7 @@ void VerletLRTIntel::run(int n) ------------------------------------------------------------------------- */ void * VerletLRTIntel::k_launch_loop(void *context) { - VerletLRTIntel * const c = (VerletLRTIntel *)context; + auto const c = (VerletLRTIntel *)context; if (c->kspace_compute_flag) c->_intel_kspace->compute_first(c->eflag, c->vflag); diff --git a/src/INTEL/verlet_lrt_intel.h b/src/INTEL/verlet_lrt_intel.h index c58d4916d2..c976656ae3 100644 --- a/src/INTEL/verlet_lrt_intel.h +++ b/src/INTEL/verlet_lrt_intel.h @@ -68,17 +68,3 @@ class VerletLRTIntel : public Verlet { #endif #endif - -/* ERROR/WARNING messages: - -E: LRT otion for Intel package disabled at compile time - -This option cannot be used with the Intel package because LAMMPS was not built -with support for it. - -W: No fixes defined, atoms won't move - -If you are not using a fix like nve, nvt, npt then atom velocities and -coordinates will not be updated during timestepping. - -*/ diff --git a/src/INTERLAYER/pair_drip.h b/src/INTERLAYER/pair_drip.h index feaa3df570..3678149776 100644 --- a/src/INTERLAYER/pair_drip.h +++ b/src/INTERLAYER/pair_drip.h @@ -95,27 +95,3 @@ class PairDRIP : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: No enough neighbors to construct normal - -Cannot find three neighbors within cutoff of the target atom. -Check the configuration. - -*/ diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index fc1289ff28..8e502a9f1f 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -41,7 +41,6 @@ using namespace LAMMPS_NS; using namespace InterLayer; -#define MAXLINE 1024 #define DELTA 4 #define PGDELTA 1 diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.h b/src/INTERLAYER/pair_ilp_graphene_hbn.h index 4bd7677737..de7bd3e02f 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.h +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.h @@ -88,22 +88,3 @@ class PairILPGrapheneHBN : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/INTERLAYER/pair_ilp_tmd.h b/src/INTERLAYER/pair_ilp_tmd.h index 5a633c8950..4fb536d971 100644 --- a/src/INTERLAYER/pair_ilp_tmd.h +++ b/src/INTERLAYER/pair_ilp_tmd.h @@ -49,22 +49,3 @@ class PairILPTMD : public PairILPGrapheneHBN { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index 3076242ee3..0c005d53a2 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -141,7 +141,8 @@ void PairKolmogorovCrespiFull::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR, "Illegal pair_style command"); if (!utils::strmatch(force->pair_style, "^hybrid/overlay")) - error->all(FLERR, "Pair style kolmogorov/crespi/full must be used as sub-style with hybrid/overlay"); + error->all(FLERR, + "Pair style kolmogorov/crespi/full must be used as sub-style with hybrid/overlay"); cut_global = utils::numeric(FLERR, arg[0], false, lmp); if (narg == 2) tap_flag = utils::numeric(FLERR, arg[1], false, lmp); diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.h b/src/INTERLAYER/pair_kolmogorov_crespi_full.h index 1176b13d52..51fd3d8270 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.h +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.h @@ -75,22 +75,3 @@ class PairKolmogorovCrespiFull : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_z.h b/src/INTERLAYER/pair_kolmogorov_crespi_z.h index 61e8dba7bd..2177b518e2 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_z.h +++ b/src/INTERLAYER/pair_kolmogorov_crespi_z.h @@ -55,22 +55,3 @@ class PairKolmogorovCrespiZ : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/INTERLAYER/pair_lebedeva_z.h b/src/INTERLAYER/pair_lebedeva_z.h index 8b59e0115f..4e4fa3f6e3 100644 --- a/src/INTERLAYER/pair_lebedeva_z.h +++ b/src/INTERLAYER/pair_lebedeva_z.h @@ -55,22 +55,3 @@ class PairLebedevaZ : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/INTERLAYER/pair_saip_metal.h b/src/INTERLAYER/pair_saip_metal.h index 7675b3cce5..0319a3379e 100644 --- a/src/INTERLAYER/pair_saip_metal.h +++ b/src/INTERLAYER/pair_saip_metal.h @@ -37,22 +37,3 @@ class PairSAIPMETAL : public PairILPGrapheneHBN { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/KIM/fix_store_kim.cpp b/src/KIM/fix_store_kim.cpp index 3d2306c654..e57f759e87 100644 --- a/src/KIM/fix_store_kim.cpp +++ b/src/KIM/fix_store_kim.cpp @@ -83,25 +83,25 @@ FixStoreKIM::~FixStoreKIM() // free associated storage if (simulator_model) { - KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; + auto sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); simulator_model = nullptr; } if (model_name) { - char *mn = (char *)model_name; + auto mn = (char *)model_name; delete[] mn; model_name = nullptr; } if (model_units) { - char *mu = (char *)model_units; + auto mu = (char *)model_units; delete[] mu; model_units = nullptr; } if (user_units) { - char *uu = (char *)user_units; + auto uu = (char *)user_units; delete[] uu; user_units = nullptr; } @@ -121,25 +121,25 @@ void FixStoreKIM::setptr(const std::string &name, void *ptr) { if (name == "simulator_model") { if (simulator_model) { - KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; + auto sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); } simulator_model = ptr; } else if (name == "model_name") { if (model_name) { - char *mn = (char *)model_name; + auto mn = (char *)model_name; delete[] mn; } model_name = ptr; } else if (name == "model_units") { if (model_units) { - char *mu = (char *)model_units; + auto mu = (char *)model_units; delete[] mu; } model_units = ptr; } else if (name == "user_units") { if (user_units) { - char *uu = (char *)user_units; + auto uu = (char *)user_units; delete[] uu; } user_units = ptr; diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index d1817ceda1..bc41f54390 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -88,13 +88,3 @@ class FixStoreKIM : public Fix { #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. - -*/ diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp index f0d320c21a..06b651e377 100644 --- a/src/KIM/kim_command.cpp +++ b/src/KIM/kim_command.cpp @@ -112,24 +112,24 @@ void KimCommand::command(int narg, char **arg) if (lmp->citeme) lmp->citeme->add(cite_openkim); if (subcmd == "init") { - KimInit *cmd = new KimInit(lmp); + auto cmd = new KimInit(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "interactions") { - KimInteractions *cmd = new KimInteractions(lmp); + auto cmd = new KimInteractions(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "param") { - KimParam *cmd = new KimParam(lmp); + auto cmd = new KimParam(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "property") { - KimProperty *cmd = new KimProperty(lmp); + auto cmd = new KimProperty(lmp); cmd->command(narg, arg); delete cmd; } else if (subcmd == "query") { if (lmp->citeme) lmp->citeme->add(cite_openkim_query); - KimQuery *cmd = new KimQuery(lmp); + auto cmd = new KimQuery(lmp); cmd->command(narg, arg); delete cmd; } else error->all(FLERR,"Unknown kim subcommand {}", subcmd); diff --git a/src/KIM/kim_command.h b/src/KIM/kim_command.h index 25611d4b50..1347aaea5f 100644 --- a/src/KIM/kim_command.h +++ b/src/KIM/kim_command.h @@ -76,8 +76,3 @@ class KimCommand : public Command { #endif #endif - -/* ERROR/WARNING messages: - - -*/ diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 2c8a19251f..7c3e4c2361 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -251,9 +251,10 @@ void KimInit::determine_model_type_and_units(char *model_name, char *user_units, return; } else if (unit_conversion_mode) { KIM_Model_Destroy(&pkim); - const char * unit_systems[] = {"metal", "real", "si", "cgs", "electron"}; + const char *unit_systems[] = {"metal", "real", "si", "cgs", "electron"}; for (auto units : unit_systems) { - get_kim_unit_names(units, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit, error); + get_kim_unit_names(units, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit, + error); kim_error = KIM_Model_Create(KIM_NUMBERING_zeroBased, lengthUnit, energyUnit, chargeUnit, temperatureUnit, timeUnit, model_name, &units_accepted, &pkim); if (units_accepted) { @@ -316,7 +317,7 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM modify->add_fix("KIM_MODEL_STORE all STORE/KIM"); ifix = modify->find_fix("KIM_MODEL_STORE"); - FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; + auto fix_store = dynamic_cast(modify->fix[ifix]); fix_store->setptr("model_name", (void *) model_name); fix_store->setptr("user_units", (void *) user_units); fix_store->setptr("model_units", (void *) model_units); diff --git a/src/KIM/kim_init.h b/src/KIM/kim_init.h index 56922533ab..9224f05ebe 100644 --- a/src/KIM/kim_init.h +++ b/src/KIM/kim_init.h @@ -82,49 +82,9 @@ class KimInit : protected Pointers { void do_init(char *, char *, char *, KIM_Model *&); void do_variables(const std::string &, const std::string &); - void print_dirs(struct KIM_Collections * const collections) const; + void print_dirs(struct KIM_Collections *const collections) const; }; } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal kim_init command - -Incorrect number or kind of arguments to kim_init. - -E: Must use 'kim_init' command before simulation box is defined - -Self-explanatory. - -E: KIM Model does not support the requested unit system - -Self-explanatory. - -E: KIM Model does not support any lammps unit system - -Self-explanatory. - -E: KIM model name not found - -Self-explanatory. - -E: Incompatible KIM Simulator Model - -The requested KIM Simulator Model was defined for a different MD code -and thus is not compatible with LAMMPS. - -E: Incompatible units for KIM Simulator Model - -The selected unit style is not compatible with the requested KIM -Simulator Model. - -E: KIM Simulator Model has no Model definition - -There is no model definition (key: model-defn) in the KIM Simulator -Model. Please contact the OpenKIM database maintainers to verify -and potentially correct this. - -*/ diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 74ac40198c..3427d6fb57 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -121,7 +121,7 @@ void KimInteractions::do_setup(int narg, char **arg) int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { - FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; + auto fix_store = dynamic_cast( modify->fix[ifix]); model_name = (char *)fix_store->getptr("model_name"); simulatorModel = (KIM_SimulatorModel *)fix_store->getptr("simulator_model"); } else error->all(FLERR, "Must use 'kim init' before 'kim interactions'"); diff --git a/src/KIM/kim_interactions.h b/src/KIM/kim_interactions.h index 719e04b433..34da625604 100644 --- a/src/KIM/kim_interactions.h +++ b/src/KIM/kim_interactions.h @@ -77,35 +77,3 @@ class KimInteractions : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal kim_interactions command - -Incorrect number or kind of arguments to kim_interactions. - -E: Must use 'kim_interactions' command after simulation box is defined - -Self-explanatory. - -E: Must use 'kim_init' command before 'kim_interactions' - -Self-explanatory. - -E: Species XXX is not supported by this KIM Simulator Model - -The kim_interactions command was referencing a species that is not -present in the requested KIM Simulator Model. - -E: Incompatible units for KIM Simulator Model - -The selected unit style is not compatible with the requested KIM -Simulator Model. - -E: KIM Simulator Model has no Model definition - -There is no model definition (key: model-defn) in the KIM Simulator -Model. Please contact the OpenKIM database maintainers to verify -and potentially correct this. - -*/ diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index d538ff3c8e..d4dfb0ead6 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -163,7 +163,7 @@ void KimParam::command(int narg, char **arg) int const ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { - FixStoreKIM *fix_store = reinterpret_cast(modify->fix[ifix]); + auto fix_store = reinterpret_cast(modify->fix[ifix]); KIM_SimulatorModel *simulatorModel = reinterpret_cast( @@ -181,20 +181,17 @@ void KimParam::command(int narg, char **arg) std::string atom_type_list; - bool isPairStyleAssigned = force->pair ? true : false; - if (isPairStyleAssigned) { + if (force->pair) { Pair *pair = force->pair_match("kim", 1, 0); if (pair) { - PairKIM *pairKIM = reinterpret_cast(pair); + auto pairKIM = reinterpret_cast(pair); pkim = pairKIM->get_kim_model(); - if (!pkim) - error->all(FLERR, "Unable to get the KIM Portable Model"); + if (!pkim) error->all(FLERR, "Unable to get the KIM Portable Model"); if (kim_param_get_set == "set") { atom_type_list = pairKIM->get_atom_type_list(); - if (atom_type_list.empty()) - error->all(FLERR, "The requested atom type list is empty"); + if (atom_type_list.empty()) error->all(FLERR, "The requested atom type list is empty"); } } else error->all(FLERR, "Pair style is defined, but there is " diff --git a/src/KIM/kim_param.h b/src/KIM/kim_param.h index 8a4b3f474a..409100f730 100644 --- a/src/KIM/kim_param.h +++ b/src/KIM/kim_param.h @@ -71,7 +71,3 @@ class KimParam : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/KIM/kim_property.h b/src/KIM/kim_property.h index 6d3cfe8966..11522186d0 100644 --- a/src/KIM/kim_property.h +++ b/src/KIM/kim_property.h @@ -69,7 +69,3 @@ class KimProperty : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/KIM/kim_query.cpp b/src/KIM/kim_query.cpp index 3e891468a6..e85df32755 100644 --- a/src/KIM/kim_query.cpp +++ b/src/KIM/kim_query.cpp @@ -158,7 +158,7 @@ void KimQuery::command(int narg, char **arg) // check if we had a kim init command by finding fix STORE/KIM const int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { - FixStoreKIM *fix_store = (FixStoreKIM *) modify->fix[ifix]; + auto fix_store = dynamic_cast( modify->fix[ifix]); char *model_name_c = (char *) fix_store->getptr("model_name"); model_name = model_name_c; } else { @@ -277,7 +277,7 @@ namespace { // copy data to the user provided data structure, optionally in increments size_t write_callback(void *data, size_t size, size_t nmemb, void *userp) { - WriteBuf *buf = (WriteBuf *) userp; + auto buf = (WriteBuf *) userp; // copy chunks into the buffer for as long as there is space left if (buf->sizeleft) { diff --git a/src/KIM/kim_query.h b/src/KIM/kim_query.h index 2d9def5735..1dd72a7a72 100644 --- a/src/KIM/kim_query.h +++ b/src/KIM/kim_query.h @@ -71,8 +71,3 @@ class KimQuery : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - - -*/ diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index d3e1c2ee9a..f3b53ac71f 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -774,8 +774,7 @@ int PairKIM::get_neigh(void const * const dataObject, int * const numberOfNeighbors, int const ** const neighborsOfParticle) { - PairKIM const * const Model - = reinterpret_cast(dataObject); + auto const Model = reinterpret_cast(dataObject); if (numberOfNeighborLists != Model->kim_number_of_neighbor_lists) return true; @@ -1058,19 +1057,16 @@ int PairKIM::check_for_routine_compatibility() pkim, modelRoutineName, &present, &required); if (error) return true; - if ((present == true) && (required == true)) { - if (!(KIM_ModelRoutineName_Equal(modelRoutineName, - KIM_MODEL_ROUTINE_NAME_Create) - || KIM_ModelRoutineName_Equal( - modelRoutineName, - KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate) + if (present && required) { + if (!(KIM_ModelRoutineName_Equal(modelRoutineName, KIM_MODEL_ROUTINE_NAME_Create) + || KIM_ModelRoutineName_Equal(modelRoutineName, + KIM_MODEL_ROUTINE_NAME_ComputeArgumentsCreate) || KIM_ModelRoutineName_Equal(modelRoutineName, KIM_MODEL_ROUTINE_NAME_Compute) || KIM_ModelRoutineName_Equal(modelRoutineName, KIM_MODEL_ROUTINE_NAME_Refresh) - || KIM_ModelRoutineName_Equal( - modelRoutineName, - KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy) + || KIM_ModelRoutineName_Equal(modelRoutineName, + KIM_MODEL_ROUTINE_NAME_ComputeArgumentsDestroy) || KIM_ModelRoutineName_Equal(modelRoutineName, KIM_MODEL_ROUTINE_NAME_Destroy))) { return true; diff --git a/src/KIM/pair_kim.h b/src/KIM/pair_kim.h index 8c7bcbb0ef..10c9c11a0e 100644 --- a/src/KIM/pair_kim.h +++ b/src/KIM/pair_kim.h @@ -176,98 +176,3 @@ class PairKIM : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Unable to set KIM particle species codes and/or contributing - -A low-level kim-api error has occurred. - -E: KIM Compute returned error - -The KIM model was unable, for some reason, to complete the computation. - -E: 'KIMvirial' or 'LAMMPSvirial' not supported with kim-api. - -"KIMvirial or "LAMMPSvirial" found on the pair_style line. These keys -are not supported kim-api. (The virial computation is always performed -by LAMMPS.) Please remove these keys, make sure the KIM model you are -using supports kim-api, and rerun. - -E: Illegal pair_style command - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. - -E: create_kim_particle_codes: symbol not found: XX - -The KIM model specified does not support the atomic species symbol - -E: PairKIM only works with 3D problems - -Self-explanatory. - -E: All pair coeffs are not set - -Self-explanatory. - -E: Unable to destroy Compute Arguments Object - -A low-level kim-api error has occurred. - -E: KIM ModelCreate failed - -The kim-api was not able to create a model object for the specified model. - -E: KIM Model did not accept the requested unit system - -The KIM Model does not support the specified LAMMPS unit system - -E: KIM ComputeArgumentsCreate failed - -A low-level kim-api error has occurred. - -E: Unable to register KIM pointers - -A low-level kim-api error has occurred. - -E: Unable to set KIM argument pointers - -A low-level kim-api error has occurred. - -E: pair_kim does not support hybrid - -Self-explanatory. - -E: LAMMPS unit_style lj not suppored by KIM models - -Self-explanatory. - -E: KIM Model requires unsupported compute argument: XXX - -A low-level kim-api error has occurred. - -W: KIM Model does not provide `partialEnergy'; Potential energy will be zero - -Self-explanatory. - -W: KIM Model does not provide `partialForce'; Forces will be zero - -Self-explanatory. - -W: KIM Model does not provide `partialParticleEnergy'; energy per atom will be zero - -Self-explanatory. - -W: KIM Model does not provide `partialParticleVirial'; virial per atom will be zero - -Self-explanatory. - -E: KIM Model requires unsupported compute callback - -A low-level kim-api error has occurred. - -*/ diff --git a/src/KOKKOS/angle_charmm_kokkos.h b/src/KOKKOS/angle_charmm_kokkos.h index 10ef9efaa4..e52cdb0bb2 100644 --- a/src/KOKKOS/angle_charmm_kokkos.h +++ b/src/KOKKOS/angle_charmm_kokkos.h @@ -90,6 +90,3 @@ class AngleCharmmKokkos : public AngleCharmm { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/angle_class2_kokkos.h b/src/KOKKOS/angle_class2_kokkos.h index e708b0ebad..9fb737187f 100644 --- a/src/KOKKOS/angle_class2_kokkos.h +++ b/src/KOKKOS/angle_class2_kokkos.h @@ -96,6 +96,3 @@ class AngleClass2Kokkos : public AngleClass2 { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/angle_cosine_kokkos.h b/src/KOKKOS/angle_cosine_kokkos.h index 0235c087b0..b4d074c05a 100644 --- a/src/KOKKOS/angle_cosine_kokkos.h +++ b/src/KOKKOS/angle_cosine_kokkos.h @@ -86,6 +86,3 @@ class AngleCosineKokkos : public AngleCosine { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/angle_harmonic_kokkos.h b/src/KOKKOS/angle_harmonic_kokkos.h index 1c1f0b1830..dc635a9be2 100644 --- a/src/KOKKOS/angle_harmonic_kokkos.h +++ b/src/KOKKOS/angle_harmonic_kokkos.h @@ -89,6 +89,3 @@ class AngleHarmonicKokkos : public AngleHarmonic { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/atom_kokkos.h b/src/KOKKOS/atom_kokkos.h index 624e6c05ff..89cf6c1d6e 100644 --- a/src/KOKKOS/atom_kokkos.h +++ b/src/KOKKOS/atom_kokkos.h @@ -162,10 +162,3 @@ struct SortFunctor { #endif -/* ERROR/WARNING messages: - -E: KOKKOS package requires a kokkos enabled atom_style - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/atom_vec_angle_kokkos.h b/src/KOKKOS/atom_vec_angle_kokkos.h index 8a315d666c..5dec05f9db 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.h +++ b/src/KOKKOS/atom_vec_angle_kokkos.h @@ -152,15 +152,3 @@ class AtomVecAngleKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_atomic_kokkos.h b/src/KOKKOS/atom_vec_atomic_kokkos.h index e0134f8952..bc4004d2c0 100644 --- a/src/KOKKOS/atom_vec_atomic_kokkos.h +++ b/src/KOKKOS/atom_vec_atomic_kokkos.h @@ -94,15 +94,3 @@ class AtomVecAtomicKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_bond_kokkos.h b/src/KOKKOS/atom_vec_bond_kokkos.h index 3daef1dbbe..eb3fca3130 100644 --- a/src/KOKKOS/atom_vec_bond_kokkos.h +++ b/src/KOKKOS/atom_vec_bond_kokkos.h @@ -122,15 +122,3 @@ class AtomVecBondKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_charge_kokkos.h b/src/KOKKOS/atom_vec_charge_kokkos.h index c2d85e4bd6..ceca4c8688 100644 --- a/src/KOKKOS/atom_vec_charge_kokkos.h +++ b/src/KOKKOS/atom_vec_charge_kokkos.h @@ -107,15 +107,3 @@ class AtomVecChargeKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_dpd_kokkos.h b/src/KOKKOS/atom_vec_dpd_kokkos.h index 4dfa2bfbe0..1a6b62f4af 100644 --- a/src/KOKKOS/atom_vec_dpd_kokkos.h +++ b/src/KOKKOS/atom_vec_dpd_kokkos.h @@ -121,15 +121,3 @@ class AtomVecDPDKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_full_kokkos.h b/src/KOKKOS/atom_vec_full_kokkos.h index 54671e47e3..c1fa9242f4 100644 --- a/src/KOKKOS/atom_vec_full_kokkos.h +++ b/src/KOKKOS/atom_vec_full_kokkos.h @@ -164,15 +164,3 @@ class AtomVecFullKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp index 22ce80478c..c733e5fe18 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.cpp +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.cpp @@ -1073,17 +1073,14 @@ void AtomVecHybridKokkos::write_data(FILE *fp, int n, double **buf) int k,m; for (int i = 0; i < n; i++) { - fprintf(fp,TAGINT_FORMAT " %d %-1.16e %-1.16e %-1.16e", - (tagint) ubuf(buf[i][0]).i,(int) ubuf(buf[i][1]).i, - buf[i][2],buf[i][3],buf[i][4]); + fmt::print(fp,"{} {} {:.16e} {:.16e} {:.16e}", ubuf(buf[i][0]).i, ubuf(buf[i][1]).i, + buf[i][2], buf[i][3], buf[i][4]); m = 5; for (k = 0; k < nstyles; k++) m += styles[k]->write_data_hybrid(fp,&buf[i][m]); - fprintf(fp," %d %d %d\n", - (int) ubuf(buf[i][m]).i,(int) ubuf(buf[i][m+1]).i, - (int) ubuf(buf[i][m+2]).i); + fmt::print(fp," {} {} {}\n", ubuf(buf[i][m]).i, ubuf(buf[i][m+1]).i, ubuf(buf[i][m+2]).i); } } @@ -1119,8 +1116,7 @@ void AtomVecHybridKokkos::write_vel(FILE *fp, int n, double **buf) int k,m; for (int i = 0; i < n; i++) { - fprintf(fp,TAGINT_FORMAT " %g %g %g", - (tagint) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3]); + fmt::print(fp,"{} {} {} {}", (tagint) ubuf(buf[i][0]).i,buf[i][1],buf[i][2],buf[i][3]); m = 4; for (k = 0; k < nstyles; k++) @@ -1136,7 +1132,7 @@ void AtomVecHybridKokkos::write_vel(FILE *fp, int n, double **buf) return -1 if name is unknown to any sub-styles ------------------------------------------------------------------------- */ -int AtomVecHybridKokkos::property_atom(char *name) +int AtomVecHybridKokkos::property_atom(const std::string &name) { for (int k = 0; k < nstyles; k++) { int index = styles[k]->property_atom(name); @@ -1150,8 +1146,7 @@ int AtomVecHybridKokkos::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecHybridKokkos::pack_property_atom(int multiindex, double *buf, - int nvalues, int groupbit) +void AtomVecHybridKokkos::pack_property_atom(int multiindex, double *buf, int nvalues, int groupbit) { int k = multiindex % nstyles; int index = multiindex/nstyles; diff --git a/src/KOKKOS/atom_vec_hybrid_kokkos.h b/src/KOKKOS/atom_vec_hybrid_kokkos.h index 29417f1e05..6578ecdb9e 100644 --- a/src/KOKKOS/atom_vec_hybrid_kokkos.h +++ b/src/KOKKOS/atom_vec_hybrid_kokkos.h @@ -64,7 +64,7 @@ class AtomVecHybridKokkos : public AtomVecKokkos { void write_data(FILE *, int, double **) override; void pack_vel(double **) override; void write_vel(FILE *, int, double **) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; double memory_usage() override; @@ -135,35 +135,3 @@ class AtomVecHybridKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Atom style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Atom style hybrid cannot use same atom style twice - -Self-explanatory. - -E: Cannot mix molecular and molecule template atom styles - -Self-explanatory. - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: AtomVecHybridKokkos doesn't yet support threaded comm - -UNDOCUMENTED - -E: Invalid atom h_type in Atoms section of data file - -UNDOCUMENTED - -U: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_kokkos.h b/src/KOKKOS/atom_vec_kokkos.h index 53a1b7ec30..969b4f7474 100644 --- a/src/KOKKOS/atom_vec_kokkos.h +++ b/src/KOKKOS/atom_vec_kokkos.h @@ -204,6 +204,3 @@ class AtomVecKokkos : public AtomVec { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/atom_vec_molecular_kokkos.h b/src/KOKKOS/atom_vec_molecular_kokkos.h index 82ad490abc..418d800c7b 100644 --- a/src/KOKKOS/atom_vec_molecular_kokkos.h +++ b/src/KOKKOS/atom_vec_molecular_kokkos.h @@ -177,15 +177,3 @@ class AtomVecMolecularKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/atom_vec_sphere_kokkos.h b/src/KOKKOS/atom_vec_sphere_kokkos.h index 26664484dc..05bfeb6eb4 100644 --- a/src/KOKKOS/atom_vec_sphere_kokkos.h +++ b/src/KOKKOS/atom_vec_sphere_kokkos.h @@ -148,23 +148,3 @@ class AtomVecSphereKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Invalid radius in Atoms section of data file - -Radius must be >= 0.0. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -*/ diff --git a/src/KOKKOS/atom_vec_spin_kokkos.h b/src/KOKKOS/atom_vec_spin_kokkos.h index 329e2bf9e6..ab0d14e08e 100644 --- a/src/KOKKOS/atom_vec_spin_kokkos.h +++ b/src/KOKKOS/atom_vec_spin_kokkos.h @@ -119,15 +119,3 @@ class AtomVecSpinKokkos : public AtomVecKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/KOKKOS/bond_class2_kokkos.h b/src/KOKKOS/bond_class2_kokkos.h index 8a4222ee0b..b6017c1c94 100644 --- a/src/KOKKOS/bond_class2_kokkos.h +++ b/src/KOKKOS/bond_class2_kokkos.h @@ -87,6 +87,3 @@ class BondClass2Kokkos : public BondClass2 { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/bond_fene_kokkos.h b/src/KOKKOS/bond_fene_kokkos.h index fbf1459dae..845ebd98da 100644 --- a/src/KOKKOS/bond_fene_kokkos.h +++ b/src/KOKKOS/bond_fene_kokkos.h @@ -100,16 +100,3 @@ class BondFENEKokkos : public BondFENE { #endif #endif -/* ERROR/WARNING messages: - -W: FENE bond too long - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -*/ diff --git a/src/KOKKOS/bond_harmonic_kokkos.h b/src/KOKKOS/bond_harmonic_kokkos.h index 301adf69d0..2f0e68933b 100644 --- a/src/KOKKOS/bond_harmonic_kokkos.h +++ b/src/KOKKOS/bond_harmonic_kokkos.h @@ -87,6 +87,3 @@ class BondHarmonicKokkos : public BondHarmonic { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/comm_kokkos.h b/src/KOKKOS/comm_kokkos.h index 4b002a42d4..668acb3974 100644 --- a/src/KOKKOS/comm_kokkos.h +++ b/src/KOKKOS/comm_kokkos.h @@ -98,24 +98,3 @@ class CommKokkos : public CommBrick { #endif -/* ERROR/WARNING messages: - -E: Ghost velocity forward comm not yet implemented with Kokkos - -This is a current restriction. - -W: Fixes cannot yet send data in Kokkos communication, switching to classic communication - -This is a current restriction with Kokkos. - -W: Required border comm not yet implemented in Kokkos communication, switching to classic communication - -There are various limitations in the communication options supported -by Kokkos. - -E: Required border comm not yet implemented with Kokkos - -There are various limitations in the communication options supported -by Kokkos. - -*/ diff --git a/src/KOKKOS/comm_tiled_kokkos.h b/src/KOKKOS/comm_tiled_kokkos.h index 578c4b0b26..825da4a578 100644 --- a/src/KOKKOS/comm_tiled_kokkos.h +++ b/src/KOKKOS/comm_tiled_kokkos.h @@ -55,6 +55,3 @@ class CommTiledKokkos : public CommTiled { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp b/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp index 0b890ae4e5..d2cb6682a7 100644 --- a/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp +++ b/src/KOKKOS/compute_ave_sphere_atom_kokkos.cpp @@ -25,14 +25,11 @@ #include "neighbor_kokkos.h" #include "pair.h" #include "update.h" -#include "math_const.h" #include #include using namespace LAMMPS_NS; -using namespace MathConst; - /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/compute_ave_sphere_atom_kokkos.h b/src/KOKKOS/compute_ave_sphere_atom_kokkos.h index e935dc6a94..75b5ca3aba 100644 --- a/src/KOKKOS/compute_ave_sphere_atom_kokkos.h +++ b/src/KOKKOS/compute_ave_sphere_atom_kokkos.h @@ -12,10 +12,11 @@ ------------------------------------------------------------------------- */ #ifdef COMPUTE_CLASS - -ComputeStyle(ave/sphere/atom/kk,ComputeAveSphereAtomKokkos) -ComputeStyle(ave/sphere/atom/kk/device,ComputeAveSphereAtomKokkos) -ComputeStyle(ave/sphere/atom/kk/host,ComputeAveSphereAtomKokkos) +// clang-format off +ComputeStyle(ave/sphere/atom/kk,ComputeAveSphereAtomKokkos); +ComputeStyle(ave/sphere/atom/kk/device,ComputeAveSphereAtomKokkos); +ComputeStyle(ave/sphere/atom/kk/host,ComputeAveSphereAtomKokkos); +// clang-format on #else @@ -27,10 +28,11 @@ ComputeStyle(ave/sphere/atom/kk/host,ComputeAveSphereAtomKokkos) namespace LAMMPS_NS { -struct TagComputeAveSphereAtom{}; +// clang-format off +struct TagComputeAveSphereAtom {}; +// clang-format on -template -class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom { +template class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom { public: typedef DeviceType device_type; typedef ArrayTypes AT; @@ -41,7 +43,7 @@ class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom { void compute_peratom() override; KOKKOS_INLINE_FUNCTION - void operator()(TagComputeAveSphereAtom, const int&) const; + void operator()(TagComputeAveSphereAtom, const int &) const; private: typename AT::t_x_array_randomread x; @@ -56,11 +58,7 @@ class ComputeAveSphereAtomKokkos : public ComputeAveSphereAtom { typename AT::t_float_2d d_result; }; -} +} // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/compute_coord_atom_kokkos.h b/src/KOKKOS/compute_coord_atom_kokkos.h index 1835bb6550..46a297cdf3 100644 --- a/src/KOKKOS/compute_coord_atom_kokkos.h +++ b/src/KOKKOS/compute_coord_atom_kokkos.h @@ -74,6 +74,3 @@ class ComputeCoordAtomKokkos : public ComputeCoordAtom { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/compute_orientorder_atom_kokkos.h b/src/KOKKOS/compute_orientorder_atom_kokkos.h index f5ff8b2af7..0f8db66d65 100644 --- a/src/KOKKOS/compute_orientorder_atom_kokkos.h +++ b/src/KOKKOS/compute_orientorder_atom_kokkos.h @@ -136,6 +136,3 @@ class ComputeOrientOrderAtomKokkos : public ComputeOrientOrderAtom { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/compute_temp_deform_kokkos.h b/src/KOKKOS/compute_temp_deform_kokkos.h index e4ccecfe4b..2327546f70 100644 --- a/src/KOKKOS/compute_temp_deform_kokkos.h +++ b/src/KOKKOS/compute_temp_deform_kokkos.h @@ -116,11 +116,3 @@ class ComputeTempDeformKokkos: public ComputeTempDeform { #endif #endif -/* ERROR/WARNING messages: - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/KOKKOS/compute_temp_kokkos.h b/src/KOKKOS/compute_temp_kokkos.h index 42954a360c..c54ee05b45 100644 --- a/src/KOKKOS/compute_temp_kokkos.h +++ b/src/KOKKOS/compute_temp_kokkos.h @@ -97,11 +97,3 @@ class ComputeTempKokkos : public ComputeTemp { #endif #endif -/* ERROR/WARNING messages: - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/KOKKOS/dihedral_charmm_kokkos.h b/src/KOKKOS/dihedral_charmm_kokkos.h index 09b979d02d..34d09d28ed 100644 --- a/src/KOKKOS/dihedral_charmm_kokkos.h +++ b/src/KOKKOS/dihedral_charmm_kokkos.h @@ -172,11 +172,3 @@ class DihedralCharmmKokkos : public DihedralCharmm { #endif #endif -/* ERROR/WARNING messages: - -W: Dihedral problem - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/KOKKOS/dihedral_class2_kokkos.h b/src/KOKKOS/dihedral_class2_kokkos.h index 0b7251edf5..600c5c05f3 100644 --- a/src/KOKKOS/dihedral_class2_kokkos.h +++ b/src/KOKKOS/dihedral_class2_kokkos.h @@ -112,11 +112,3 @@ class DihedralClass2Kokkos : public DihedralClass2 { #endif #endif -/* ERROR/WARNING messages: - -W: Dihedral problem - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/KOKKOS/dihedral_harmonic_kokkos.h b/src/KOKKOS/dihedral_harmonic_kokkos.h index 8e66f82add..5c329fc1a3 100644 --- a/src/KOKKOS/dihedral_harmonic_kokkos.h +++ b/src/KOKKOS/dihedral_harmonic_kokkos.h @@ -100,6 +100,3 @@ class DihedralHarmonicKokkos : public DihedralHarmonic { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/dihedral_opls_kokkos.h b/src/KOKKOS/dihedral_opls_kokkos.h index 6f01359650..fdad649d6a 100644 --- a/src/KOKKOS/dihedral_opls_kokkos.h +++ b/src/KOKKOS/dihedral_opls_kokkos.h @@ -98,11 +98,3 @@ class DihedralOPLSKokkos : public DihedralOPLS { #endif #endif -/* ERROR/WARNING messages: - -W: Dihedral problem - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/KOKKOS/domain_kokkos.cpp b/src/KOKKOS/domain_kokkos.cpp index 6a1decbed6..8408957ff9 100644 --- a/src/KOKKOS/domain_kokkos.cpp +++ b/src/KOKKOS/domain_kokkos.cpp @@ -56,6 +56,17 @@ public: dst.value[2][1] = dst.value[1][1] = dst.value[0][1] = -BIG; } + KOKKOS_INLINE_FUNCTION + void join(value_type &dst, + const value_type &src) const { + dst.value[0][0] = MIN(dst.value[0][0],src.value[0][0]); + dst.value[0][1] = MAX(dst.value[0][1],src.value[0][1]); + dst.value[1][0] = MIN(dst.value[1][0],src.value[1][0]); + dst.value[1][1] = MAX(dst.value[1][1],src.value[1][1]); + dst.value[2][0] = MIN(dst.value[2][0],src.value[2][0]); + dst.value[2][1] = MAX(dst.value[2][1],src.value[2][1]); + } + KOKKOS_INLINE_FUNCTION void join(volatile value_type &dst, const volatile value_type &src) const { diff --git a/src/KOKKOS/domain_kokkos.h b/src/KOKKOS/domain_kokkos.h index 60e7c1c550..28319c4197 100644 --- a/src/KOKKOS/domain_kokkos.h +++ b/src/KOKKOS/domain_kokkos.h @@ -92,10 +92,3 @@ Few DomainKokkos::unmap(Few prd, Few h, #endif -/* ERROR/WARNING messages: - -E: Illegal simulation box - -The lower bound of the simulation box is greater than the upper bound. - -*/ diff --git a/src/KOKKOS/dynamical_matrix_kokkos.cpp b/src/KOKKOS/dynamical_matrix_kokkos.cpp index dc180a1743..7b85a3766d 100644 --- a/src/KOKKOS/dynamical_matrix_kokkos.cpp +++ b/src/KOKKOS/dynamical_matrix_kokkos.cpp @@ -159,7 +159,7 @@ void DynamicalMatrixKokkos::update_force() { int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; lmp->kokkos->auto_sync = 0; diff --git a/src/KOKKOS/dynamical_matrix_kokkos.h b/src/KOKKOS/dynamical_matrix_kokkos.h index 996bda4211..b562baf019 100644 --- a/src/KOKKOS/dynamical_matrix_kokkos.h +++ b/src/KOKKOS/dynamical_matrix_kokkos.h @@ -35,18 +35,17 @@ class DynamicalMatrixKokkos : public DynamicalMatrix { void setup(); KOKKOS_INLINE_FUNCTION - void operator() (const int& i) const { - f(i,0) += f_merge_copy(i,0); - f(i,1) += f_merge_copy(i,1); - f(i,2) += f_merge_copy(i,2); + void operator()(const int &i) const + { + f(i, 0) += f_merge_copy(i, 0); + f(i, 1) += f_merge_copy(i, 1); + f(i, 2) += f_merge_copy(i, 2); } protected: void update_force() override; void force_clear() override; - DAT::t_f_array f_merge_copy,f; - - + DAT::t_f_array f_merge_copy, f; }; } // namespace LAMMPS_NS diff --git a/src/KOKKOS/fft3d_kokkos.h b/src/KOKKOS/fft3d_kokkos.h index 1cd6e9ced2..12f0f787d1 100644 --- a/src/KOKKOS/fft3d_kokkos.h +++ b/src/KOKKOS/fft3d_kokkos.h @@ -110,22 +110,3 @@ class FFT3dKokkos : protected Pointers { #endif -/* ERROR/WARNING messages: - -E: Could not create 3d FFT plan - -The FFT setup for the PPPM solver failed, typically due -to lack of memory. This is an unusual error. Check the -size of the FFT grid you are requesting. - -E: Cannot use the FFTW library with Kokkos CUDA on GPUs - -Kokkos CUDA doesn't support using the FFTW library to calculate FFTs for -PPPM on GPUs. - -E: Cannot use the cuFFT library with Kokkos CUDA on the host CPUs - -Kokkos CUDA doesn't support using the cuFFT library to calculate FFTs -for PPPM on the host CPUs, use KISS FFT instead. - -*/ diff --git a/src/KOKKOS/fix_deform_kokkos.h b/src/KOKKOS/fix_deform_kokkos.h index c57c493cb0..298260a8fa 100644 --- a/src/KOKKOS/fix_deform_kokkos.h +++ b/src/KOKKOS/fix_deform_kokkos.h @@ -44,10 +44,3 @@ class FixDeformKokkos : public FixDeform { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot (yet) use rigid bodies with fix deform and Kokkos - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_dpd_energy_kokkos.h b/src/KOKKOS/fix_dpd_energy_kokkos.h index 700089770a..9e52eab9cc 100644 --- a/src/KOKKOS/fix_dpd_energy_kokkos.h +++ b/src/KOKKOS/fix_dpd_energy_kokkos.h @@ -46,10 +46,3 @@ class FixDPDenergyKokkos : public FixDPDenergy { #endif #endif -/* ERROR/WARNING messages: - -E: Must use pair_style dpd/fdt/energy/kk with fix dpd/energy/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_enforce2d_kokkos.h b/src/KOKKOS/fix_enforce2d_kokkos.h index 195cc48974..33967f19f3 100644 --- a/src/KOKKOS/fix_enforce2d_kokkos.h +++ b/src/KOKKOS/fix_enforce2d_kokkos.h @@ -76,10 +76,3 @@ struct FixEnforce2DKokkosPostForceFunctor { #endif #endif -/* ERROR/WARNING messages: - -E: Flag in fix_enforce2d_kokkos outside of what it should be - -LAMMPS developer-only error. - -*/ diff --git a/src/KOKKOS/fix_eos_table_rx_kokkos.h b/src/KOKKOS/fix_eos_table_rx_kokkos.h index 68a854619b..84db3f0eb9 100644 --- a/src/KOKKOS/fix_eos_table_rx_kokkos.h +++ b/src/KOKKOS/fix_eos_table_rx_kokkos.h @@ -134,80 +134,3 @@ class FixEOStableRXKokkos : public FixEOStableRX { #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: FixEOStableRXKokkos requires a fix rx command. - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Invalid eos/table/rx length - -The eos/table/rx table must have more than one entry. - -E: eos/table/rx values are not increasing - -The equation-of-state must an increasing function - -E: FixEOStableRX requires atom_style with internal temperature and energies (e.g. dpd) - -Self-explanatory. - -E: Internal temperature <= zero. - -Self-explanatory. - -E: Cannot open eos table/rx potential file %s - -Self-explanatory. - -E: Incorrect format in eos table/rx file - -Self-explanatory. - -E: Cannot open file %s - -Self-explanatory. - -E: Did not find keyword in table file - -Self-explanatory. - -E: Illegal fix eos/table/rx command - -Incorrect number of arguments specified for the fix eos/table/rx command. - -E: Invalid keyword in fix eos/table/rx parameters - -Self-explanatory. - -E: The number of columns in fix eos/table/rx does not match the number of species. - -Self-explanatory. Check format for fix eos/table/rx file. - -E: fix eos/table/rx parameters did not set N - -The number of table entries was not set in the eos/table/rx file - -W: Secant solver did not converge because table bounds were exceeded - -The secant solver failed to converge, resulting in the lower or upper table bound temperature to be returned - -E: NaN detected in secant solver. - -Self-explanatory. - -E: Maxit exceeded in secant solver - -The maximum number of iterations was exceeded in the secant solver - -*/ diff --git a/src/KOKKOS/fix_langevin_kokkos.h b/src/KOKKOS/fix_langevin_kokkos.h index 96b61532e6..c570cb26cb 100644 --- a/src/KOKKOS/fix_langevin_kokkos.h +++ b/src/KOKKOS/fix_langevin_kokkos.h @@ -262,31 +262,3 @@ namespace LAMMPS_NS { #endif #endif -/* ERROR/WARNING messages: - -E: Fix langevin omega is not yet implemented with kokkos - -This option is not yet available. - -E: Fix langevin angmom is not yet implemented with kokkos - -This option is not yet available. - -E: Cannot zero Langevin force of 0 atoms - -The group has zero atoms, so you cannot request its force -be zeroed. - -E: Fix langevin variable returned negative temperature - -Self-explanatory. - -E: Fix langevin gjf with tbias is not yet implemented with kokkos - -This option is not yet available. - -W: Fix langevin gjf using random gaussians is not implemented with kokkos - -This will most likely cause errors in kinetic fluctuations. - -*/ diff --git a/src/KOKKOS/fix_minimize_kokkos.h b/src/KOKKOS/fix_minimize_kokkos.h index 00d37d5b80..af0f9c20f7 100644 --- a/src/KOKKOS/fix_minimize_kokkos.h +++ b/src/KOKKOS/fix_minimize_kokkos.h @@ -54,6 +54,3 @@ class FixMinimizeKokkos : public FixMinimize { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/fix_momentum_kokkos.h b/src/KOKKOS/fix_momentum_kokkos.h index eaf93e9756..bb68c52d97 100644 --- a/src/KOKKOS/fix_momentum_kokkos.h +++ b/src/KOKKOS/fix_momentum_kokkos.h @@ -42,6 +42,3 @@ class FixMomentumKokkos : public FixMomentum { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/fix_nh_kokkos.h b/src/KOKKOS/fix_nh_kokkos.h index 6155ba2dd3..02ab6efb93 100644 --- a/src/KOKKOS/fix_nh_kokkos.h +++ b/src/KOKKOS/fix_nh_kokkos.h @@ -82,15 +82,3 @@ class FixNHKokkos : public FixNH { #endif -/* ERROR/WARNING messages: - -E: Cannot (yet) use rigid bodies with fix nh and Kokkos - -Self-explanatory. - -E: Fix npt/nph has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -*/ diff --git a/src/KOKKOS/fix_nph_kokkos.h b/src/KOKKOS/fix_nph_kokkos.h index 06e689e3c8..e276ab0f43 100644 --- a/src/KOKKOS/fix_nph_kokkos.h +++ b/src/KOKKOS/fix_nph_kokkos.h @@ -38,14 +38,3 @@ class FixNPHKokkos : public FixNHKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph - -Self-explanatory. - -E: Pressure control must be used with fix nph - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_npt_kokkos.h b/src/KOKKOS/fix_npt_kokkos.h index 8cd50b8a54..b2b26c0742 100644 --- a/src/KOKKOS/fix_npt_kokkos.h +++ b/src/KOKKOS/fix_npt_kokkos.h @@ -38,14 +38,3 @@ class FixNPTKokkos : public FixNHKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt - -Self-explanatory. - -E: Pressure control must be used with fix npt - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_nve_kokkos.h b/src/KOKKOS/fix_nve_kokkos.h index fddfcd2bba..cb0e982aeb 100644 --- a/src/KOKKOS/fix_nve_kokkos.h +++ b/src/KOKKOS/fix_nve_kokkos.h @@ -101,12 +101,3 @@ struct FixNVEKokkosFinalIntegrateFunctor { #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. - -*/ diff --git a/src/KOKKOS/fix_nvt_kokkos.h b/src/KOKKOS/fix_nvt_kokkos.h index 72e12ea42f..ef6957bf72 100644 --- a/src/KOKKOS/fix_nvt_kokkos.h +++ b/src/KOKKOS/fix_nvt_kokkos.h @@ -38,14 +38,3 @@ class FixNVTKokkos : public FixNHKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt - -Self-explanatory. - -E: Pressure control can not be used with fix nvt - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_nvt_sllod_kokkos.h b/src/KOKKOS/fix_nvt_sllod_kokkos.h index ebac7b1563..1ae9a19729 100644 --- a/src/KOKKOS/fix_nvt_sllod_kokkos.h +++ b/src/KOKKOS/fix_nvt_sllod_kokkos.h @@ -74,27 +74,3 @@ class FixNVTSllodKokkos : public FixNHKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/sllod - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/sllod - -Self-explanatory. - -E: Temperature for fix nvt/sllod does not have a bias - -The specified compute must compute temperature with a bias. - -E: Using fix nvt/sllod with inconsistent fix deform remap option - -Fix nvt/sllod requires that deforming atoms have a velocity profile -provided by "remap v" as a fix deform option. - -E: Using fix nvt/sllod with no fix deform defined - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_property_atom_kokkos.h b/src/KOKKOS/fix_property_atom_kokkos.h index a90f672c8f..42de42093b 100644 --- a/src/KOKKOS/fix_property_atom_kokkos.h +++ b/src/KOKKOS/fix_property_atom_kokkos.h @@ -37,54 +37,3 @@ class FixPropertyAtomKokkos : public FixPropertyAtom { #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: Fix property/atom mol when atom_style already has molecule attribute - -Self-explanatory. - -E: Fix property/atom cannot specify mol twice - -Self-explanatory. - -E: Fix property/atom q when atom_style already has charge attribute - -Self-explanatory. - -E: Fix property/atom cannot specify q twice - -Self-explanatory. - -E: Fix property/atom vector name already exists - -The name for an integer or floating-point vector must be unique. - -W: Fix property/atom mol or charge w/out ghost communication - -A model typically needs these properties defined for ghost atoms. - -E: Atom style was redefined after using fix property/atom - -This is not allowed. - -E: Incorrect %s format in data file - -A section of the data file being read by fix property/atom does -not have the correct number of values per line. - -E: Too few lines in %s section of data file - -Self-explanatory. - -E: Invalid atom ID in %s section of data file - -An atom in a section of the data file being read by fix property/atom -has an invalid atom ID that is <= 0 or > the maximum existing atom ID. - -*/ diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index 3440de9885..28c27cacd5 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -277,6 +277,3 @@ class FixRxKokkos : public FixRX { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp index a2657569c5..3b8165670e 100644 --- a/src/KOKKOS/fix_setforce_kokkos.cpp +++ b/src/KOKKOS/fix_setforce_kokkos.cpp @@ -87,9 +87,7 @@ void FixSetForceKokkos::post_force(int /*vflag*/) // update region if necessary - region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; + if (region) { region->prematch(); DAT::tdual_int_1d k_match = DAT::tdual_int_1d("setforce:k_match",nlocal); KokkosBase* regionKKBase = dynamic_cast(region); diff --git a/src/KOKKOS/fix_setforce_kokkos.h b/src/KOKKOS/fix_setforce_kokkos.h index 5260ae3421..dc468aa415 100644 --- a/src/KOKKOS/fix_setforce_kokkos.h +++ b/src/KOKKOS/fix_setforce_kokkos.h @@ -81,8 +81,6 @@ class FixSetForceKokkos : public FixSetForce { typename AT::t_x_array_randomread x; typename AT::t_f_array f; typename AT::t_int_1d_randomread mask; - - class Region* region; }; } @@ -90,10 +88,3 @@ class FixSetForceKokkos : public FixSetForce { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot (yet) use respa with Kokkos - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/fix_shake_kokkos.h b/src/KOKKOS/fix_shake_kokkos.h index 205fc870e0..027b36b100 100644 --- a/src/KOKKOS/fix_shake_kokkos.h +++ b/src/KOKKOS/fix_shake_kokkos.h @@ -216,6 +216,3 @@ class FixShakeKokkos : public FixShake, public KokkosBase { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/fix_shardlow_kokkos.h b/src/KOKKOS/fix_shardlow_kokkos.h index 0770ef6f6f..7d3ace56c8 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.h +++ b/src/KOKKOS/fix_shardlow_kokkos.h @@ -152,38 +152,3 @@ class FixShardlowKokkos : public FixShardlow { #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: Must use dpd/fdt pair_style with fix shardlow - -Self-explanatory. - -E: Must use pair_style dpd/fdt or dpd/fdt/energy with fix shardlow - -E: A deterministic integrator must be specified after fix shardlow in input -file (e.g. fix nve or fix nph). - -Self-explanatory. - -E: Cannot use constant temperature integration routines with DPD - -Self-explanatory. Must use deterministic integrators such as nve or nph - -E: Fix shardlow does not yet support triclinic geometries - -Self-explanatory. - -E: Shardlow algorithm requires sub-domain length > 2*(rcut+skin). Either -reduce the number of processors requested, or change the cutoff/skin - -The Shardlow splitting algorithm requires the size of the sub-domain lengths -to be are larger than twice the cutoff+skin. Generally, the domain decomposition -is dependant on the number of processors requested. - -*/ diff --git a/src/KOKKOS/fix_wall_lj93_kokkos.h b/src/KOKKOS/fix_wall_lj93_kokkos.h index b4b10a1e13..d507f571a5 100644 --- a/src/KOKKOS/fix_wall_lj93_kokkos.h +++ b/src/KOKKOS/fix_wall_lj93_kokkos.h @@ -73,11 +73,3 @@ struct FixWallLJ93KokkosFunctor { #endif #endif -/* ERROR/WARNING messages: - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/KOKKOS/fix_wall_reflect_kokkos.h b/src/KOKKOS/fix_wall_reflect_kokkos.h index f4e6eee684..b6aba1fa02 100644 --- a/src/KOKKOS/fix_wall_reflect_kokkos.h +++ b/src/KOKKOS/fix_wall_reflect_kokkos.h @@ -56,6 +56,3 @@ class FixWallReflectKokkos : public FixWallReflect { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/improper_class2_kokkos.h b/src/KOKKOS/improper_class2_kokkos.h index 179a7b61a9..b0500c606d 100644 --- a/src/KOKKOS/improper_class2_kokkos.h +++ b/src/KOKKOS/improper_class2_kokkos.h @@ -107,15 +107,3 @@ class ImproperClass2Kokkos : public ImproperClass2 { #endif #endif -/* ERROR/WARNING messages: - -W: Improper problem - -UNDOCUMENTED - -U: Dihedral problem - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/KOKKOS/improper_harmonic_kokkos.h b/src/KOKKOS/improper_harmonic_kokkos.h index 02cbb9d15a..ae4cc26fe0 100644 --- a/src/KOKKOS/improper_harmonic_kokkos.h +++ b/src/KOKKOS/improper_harmonic_kokkos.h @@ -95,11 +95,3 @@ class ImproperHarmonicKokkos : public ImproperHarmonic { #endif #endif -/* ERROR/WARNING messages: - -W: Dihedral problem - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/KOKKOS/kokkos.h b/src/KOKKOS/kokkos.h index 669a773734..74710a43e3 100644 --- a/src/KOKKOS/kokkos.h +++ b/src/KOKKOS/kokkos.h @@ -82,54 +82,3 @@ class KokkosLMP : protected Pointers { #endif -/* ERROR/WARNING messages: - -E: Invalid Kokkos command-line args - -Self-explanatory. See Section 2.7 of the manual for details. - -E: Could not determine local MPI rank for multiple GPUs with Kokkos -because MPI library not recognized - -The local MPI rank was not found in one of four supported environment variables. - -E: Invalid number of threads requested for Kokkos: must be 1 or greater - -Self-explanatory. - -E: GPUs are requested but Kokkos has not been compiled using GPU-enabled backend - -Recompile Kokkos with GPU-enabled backend to use GPUs. - -E: Kokkos has been compiled with GPU-enabled backend but no GPUs are requested - -One or more GPUs must be used when Kokkos is compiled for CUDA/HIP/SYCL/OpenMPTarget. - -E: Multiple CPU threads are requested but Kokkos has not been compiled using a threading-enabled backend - -Must use the Kokkos OpenMP or Threads backend for multiple threads. - -W: When using a single thread, the Kokkos Serial backend (i.e. Makefile.kokkos_mpi_only) -gives better performance than the OpenMP backend - -Self-expanatory. - -W: Kokkos package already initalized, cannot reinitialize with different parameters - -Self-explanatory. - -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. - -U: Must use Kokkos half/thread or full neighbor list with threads or GPUs - -Using Kokkos half-neighbor lists with threading is not allowed. - -E: Must use KOKKOS package option 'neigh full' with 'neigh/thread on' - -The 'neigh/thread on' option requires a full neighbor list - -*/ diff --git a/src/KOKKOS/kokkos_base.h b/src/KOKKOS/kokkos_base.h index 8212ab70f4..f18d55eec2 100644 --- a/src/KOKKOS/kokkos_base.h +++ b/src/KOKKOS/kokkos_base.h @@ -44,6 +44,3 @@ class KokkosBase { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/kokkos_base_fft.h b/src/KOKKOS/kokkos_base_fft.h index 1bd8878821..669b60bc0b 100644 --- a/src/KOKKOS/kokkos_base_fft.h +++ b/src/KOKKOS/kokkos_base_fft.h @@ -34,6 +34,3 @@ class KokkosBaseFFT { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/min_kokkos.h b/src/KOKKOS/min_kokkos.h index 53e9e8c198..b8b1503b4f 100644 --- a/src/KOKKOS/min_kokkos.h +++ b/src/KOKKOS/min_kokkos.h @@ -55,6 +55,3 @@ class MinKokkos : public Min { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/modify_kokkos.h b/src/KOKKOS/modify_kokkos.h index c8f6ec567c..b6993552be 100644 --- a/src/KOKKOS/modify_kokkos.h +++ b/src/KOKKOS/modify_kokkos.h @@ -77,6 +77,3 @@ class ModifyKokkos : public Modify { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/nbin_kokkos.h b/src/KOKKOS/nbin_kokkos.h index 35bf50f48a..6000900062 100644 --- a/src/KOKKOS/nbin_kokkos.h +++ b/src/KOKKOS/nbin_kokkos.h @@ -151,6 +151,3 @@ struct NPairKokkosBinAtomsFunctor { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/nbin_ssa_kokkos.h b/src/KOKKOS/nbin_ssa_kokkos.h index a31c57d67c..2d10b74de4 100644 --- a/src/KOKKOS/nbin_ssa_kokkos.h +++ b/src/KOKKOS/nbin_ssa_kokkos.h @@ -242,6 +242,3 @@ struct NPairSSAKokkosBinIDGhostsFunctor { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/neigh_bond_kokkos.h b/src/KOKKOS/neigh_bond_kokkos.h index 17c87dd5dc..67439e59e2 100644 --- a/src/KOKKOS/neigh_bond_kokkos.h +++ b/src/KOKKOS/neigh_bond_kokkos.h @@ -171,82 +171,3 @@ class NeighBondKokkos : protected Pointers { #endif -/* ERROR/WARNING messages: - -E: Bond atoms missing on proc %d at step %ld - -The 2nd atom needed to compute a particular bond is missing on this -processor. Typically this is because the pairwise cutoff is set too -short or the bond has blown apart and an atom is too far away. - -W: Bond atoms missing at step %ld - -The 2nd atom needed to compute a particular bond is missing on this -processor. Typically this is because the pairwise cutoff is set too -short or the bond has blown apart and an atom is too far away. - -E: Cannot (yet) use molecular templates with Kokkos - -Self-explanatory. - -E: Bond extent > half of periodic box length - -This error was detected by the neigh_modify check yes setting. It is -an error because the bond atoms are so far apart it is ambiguous how -it should be defined. - -E: Angle atoms missing on proc %d at step %ld - -One or more of 3 atoms needed to compute a particular angle are -missing on this processor. Typically this is because the pairwise -cutoff is set too short or the angle has blown apart and an atom is -too far away. - -W: Angle atoms missing at step %ld - -One or more of 3 atoms needed to compute a particular angle are -missing on this processor. Typically this is because the pairwise -cutoff is set too short or the angle has blown apart and an atom is -too far away. - -E: Angle extent > half of periodic box length - -This error was detected by the neigh_modify check yes setting. It is -an error because the angle atoms are so far apart it is ambiguous how -it should be defined. - -E: Dihedral atoms missing on proc %d at step %ld - -One or more of 4 atoms needed to compute a particular dihedral are -missing on this processor. Typically this is because the pairwise -cutoff is set too short or the dihedral has blown apart and an atom is -too far away. - -W: Dihedral atoms missing at step %ld - -One or more of 4 atoms needed to compute a particular dihedral are -missing on this processor. Typically this is because the pairwise -cutoff is set too short or the dihedral has blown apart and an atom is -too far away. - -E: Dihedral/improper extent > half of periodic box length - -This error was detected by the neigh_modify check yes setting. It is -an error because the dihedral atoms are so far apart it is ambiguous -how it should be defined. - -E: Improper atoms missing on proc %d at step %ld - -One or more of 4 atoms needed to compute a particular improper are -missing on this processor. Typically this is because the pairwise -cutoff is set too short or the improper has blown apart and an atom is -too far away. - -W: Improper atoms missing at step %ld - -One or more of 4 atoms needed to compute a particular improper are -missing on this processor. Typically this is because the pairwise -cutoff is set too short or the improper has blown apart and an atom is -too far away. - -*/ diff --git a/src/KOKKOS/neighbor_kokkos.h b/src/KOKKOS/neighbor_kokkos.h index 16c0c5369a..8361461420 100644 --- a/src/KOKKOS/neighbor_kokkos.h +++ b/src/KOKKOS/neighbor_kokkos.h @@ -95,16 +95,3 @@ class NeighborKokkos : public Neighbor { #endif -/* ERROR/WARNING messages: - -E: KOKKOS package only supports 'bin' neighbor lists - -Self-explanatory. - -E: Too many local+ghost atoms for neighbor list - -The number of nlocal + nghost atoms on a processor -is limited by the size of a 32-bit integer with 2 bits -removed for masking 1-2, 1-3, 1-4 neighbors. - -*/ diff --git a/src/KOKKOS/npair_copy_kokkos.h b/src/KOKKOS/npair_copy_kokkos.h index af8e1962d8..7ba54d4007 100644 --- a/src/KOKKOS/npair_copy_kokkos.h +++ b/src/KOKKOS/npair_copy_kokkos.h @@ -46,6 +46,3 @@ class NPairCopyKokkos : public NPair { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/npair_halffull_kokkos.h b/src/KOKKOS/npair_halffull_kokkos.h index 2bd3daf365..6d4e722098 100644 --- a/src/KOKKOS/npair_halffull_kokkos.h +++ b/src/KOKKOS/npair_halffull_kokkos.h @@ -163,6 +163,3 @@ class NPairHalffullKokkos : public NPair { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/npair_kokkos.h b/src/KOKKOS/npair_kokkos.h index 4f237435db..3328936e7a 100644 --- a/src/KOKKOS/npair_kokkos.h +++ b/src/KOKKOS/npair_kokkos.h @@ -513,6 +513,3 @@ struct NPairKokkosBuildFunctorSize { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/npair_skip_kokkos.h b/src/KOKKOS/npair_skip_kokkos.h index 695641a8d6..c2aac9052b 100644 --- a/src/KOKKOS/npair_skip_kokkos.h +++ b/src/KOKKOS/npair_skip_kokkos.h @@ -97,6 +97,3 @@ class NPairSkipKokkos : public NPair { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/npair_ssa_kokkos.h b/src/KOKKOS/npair_ssa_kokkos.h index 4b17ae881a..73e6d0c534 100644 --- a/src/KOKKOS/npair_ssa_kokkos.h +++ b/src/KOKKOS/npair_ssa_kokkos.h @@ -354,6 +354,3 @@ class NPairSSAKokkosExecute #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.h b/src/KOKKOS/pair_buck_coul_cut_kokkos.h index 482ee8adf0..ecba0c1e1b 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.h @@ -132,20 +132,3 @@ class PairBuckCoulCutKokkos : public PairBuckCoulCut { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with buck/coul/cut/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.h b/src/KOKKOS/pair_buck_coul_long_kokkos.h index d3119a48bb..e7b7ded20d 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.h +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.h @@ -146,20 +146,3 @@ class PairBuckCoulLongKokkos : public PairBuckCoulLong { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with buck/coul/long/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_buck_kokkos.h b/src/KOKKOS/pair_buck_kokkos.h index a5b056978d..f68be6fa6f 100644 --- a/src/KOKKOS/pair_buck_kokkos.h +++ b/src/KOKKOS/pair_buck_kokkos.h @@ -110,14 +110,3 @@ class PairBuckKokkos : public PairBuck { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with buck/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_coul_cut_kokkos.h b/src/KOKKOS/pair_coul_cut_kokkos.h index 8f8da02db6..3c447539cc 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_coul_cut_kokkos.h @@ -132,16 +132,3 @@ class PairCoulCutKokkos : public PairCoulCut { #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: Cannot use chosen neighbor list style with coul/cut/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_coul_debye_kokkos.h b/src/KOKKOS/pair_coul_debye_kokkos.h index 963c42858d..382f6f9a16 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_coul_debye_kokkos.h @@ -132,20 +132,3 @@ class PairCoulDebyeKokkos : public PairCoulDebye { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with coul/debye/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.h b/src/KOKKOS/pair_coul_dsf_kokkos.h index fdd8556a0d..8dcbbaddcc 100644 --- a/src/KOKKOS/pair_coul_dsf_kokkos.h +++ b/src/KOKKOS/pair_coul_dsf_kokkos.h @@ -95,10 +95,3 @@ class PairCoulDSFKokkos : public PairCoulDSF { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with coul/dsf/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_coul_long_kokkos.h b/src/KOKKOS/pair_coul_long_kokkos.h index 5768bfb9bf..afc7b14cc0 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.h +++ b/src/KOKKOS/pair_coul_long_kokkos.h @@ -145,20 +145,3 @@ class PairCoulLongKokkos : public PairCoulLong { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with buck/coul/long/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_coul_wolf_kokkos.h b/src/KOKKOS/pair_coul_wolf_kokkos.h index dc30a8e08e..0c25cbe2a2 100644 --- a/src/KOKKOS/pair_coul_wolf_kokkos.h +++ b/src/KOKKOS/pair_coul_wolf_kokkos.h @@ -97,10 +97,3 @@ class PairCoulWolfKokkos : public PairCoulWolf { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with coul/wolf/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_dpd_ext_kokkos.h b/src/KOKKOS/pair_dpd_ext_kokkos.h index 1c04be6b01..b952513de1 100644 --- a/src/KOKKOS/pair_dpd_ext_kokkos.h +++ b/src/KOKKOS/pair_dpd_ext_kokkos.h @@ -16,7 +16,7 @@ PairStyle(dpd/ext/kk,PairDPDExtKokkos); PairStyle(dpd/ext/kk/device,PairDPDExtKokkos); PairStyle(dpd/ext/kk/host,PairDPDExtKokkos); -// clang-format on +// clang-format off #else #ifndef LMP_PAIR_DPD_EXT_KOKKOS_H diff --git a/src/KOKKOS/pair_dpd_ext_tstat_kokkos.h b/src/KOKKOS/pair_dpd_ext_tstat_kokkos.h index 03debe58af..4fce2f7305 100644 --- a/src/KOKKOS/pair_dpd_ext_tstat_kokkos.h +++ b/src/KOKKOS/pair_dpd_ext_tstat_kokkos.h @@ -16,7 +16,7 @@ PairStyle(dpd/ext/tstat/kk,PairDPDExtTstatKokkos); PairStyle(dpd/ext/tstat/kk/device,PairDPDExtTstatKokkos); PairStyle(dpd/ext/tstat/kk/host,PairDPDExtTstatKokkos); -// clang-format on +// clang-format off #else #ifndef LMP_PAIR_DPD_EXT_TSTAT_KOKKOS_H diff --git a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h index f89c6cfaad..5913e3ce2d 100644 --- a/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h +++ b/src/KOKKOS/pair_dpd_fdt_energy_kokkos.h @@ -155,29 +155,3 @@ class PairDPDfdtEnergyKokkos : public PairDPDfdtEnergy { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dpd/fdt/energy requires ghost atoms store velocity - -Use the communicate vel yes command to enable this. - -E: Pair dpd/fdt/energy requires newton pair on - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/KOKKOS/pair_dpd_kokkos.h b/src/KOKKOS/pair_dpd_kokkos.h index c492ffcfdd..f8d97556ce 100644 --- a/src/KOKKOS/pair_dpd_kokkos.h +++ b/src/KOKKOS/pair_dpd_kokkos.h @@ -16,7 +16,7 @@ PairStyle(dpd/kk,PairDPDKokkos); PairStyle(dpd/kk/device,PairDPDKokkos); PairStyle(dpd/kk/host,PairDPDKokkos); -// clang-format on +// clang-format off #else #ifndef LMP_PAIR_DPD_KOKKOS_H diff --git a/src/KOKKOS/pair_dpd_tstat_kokkos.h b/src/KOKKOS/pair_dpd_tstat_kokkos.h index ae21cd1a14..1654340850 100644 --- a/src/KOKKOS/pair_dpd_tstat_kokkos.h +++ b/src/KOKKOS/pair_dpd_tstat_kokkos.h @@ -16,7 +16,7 @@ PairStyle(dpd/tstat/kk,PairDPDTstatKokkos); PairStyle(dpd/tstat/kk/device,PairDPDTstatKokkos); PairStyle(dpd/tstat/kk/host,PairDPDTstatKokkos); -// clang-format on +// clang-format off #else #ifndef LMP_PAIR_DPD_TSTAT_KOKKOS_H diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index 0015a71448..06530abec9 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -192,28 +192,3 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with pair eam/kk/alloy - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -*/ diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 1edbbb91dd..9fd05e8e8f 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -191,28 +191,3 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with pair eam/kk/fs - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -*/ diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 9949c3071c..b2ab3a6ac2 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -187,10 +187,3 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with pair eam/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.h b/src/KOKKOS/pair_exp6_rx_kokkos.h index 66e4fb0e57..149c092faa 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.h +++ b/src/KOKKOS/pair_exp6_rx_kokkos.h @@ -209,64 +209,3 @@ class PairExp6rxKokkos : public PairExp6rx { #endif #endif -/* ERROR/WARNING messages: - -E: alpha_ij is 6.0 in pair exp6 - -Self-explanatory - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: PairExp6rxKokkos requires a fix rx command - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Site1 name not recognized in pair coefficients - -The site1 keyword does not match the species keywords specified throug the fix rx command - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open exp6/rx potential file %s - -Self-explanatory - -E: Incorrect format in exp6/rx potential file - -Self-explanatory - -E: Illegal exp6/rx parameters. Rm and Epsilon must be greater than zero. Alpha cannot be negative. - -Self-explanatory - -E: Illegal exp6/rx parameters. Interaction potential does not exist. - -Self-explanatory - -E: Potential file has duplicate entry. - -Self-explanatory - -E: The number of molecules in CG particle is less than 10*DBL_EPSILON. - -Self-explanatory. Check the species concentrations have been properly set -and check the reaction kinetic solver parameters in fix rx to more for -sufficient accuracy. - - -*/ diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.h b/src/KOKKOS/pair_gran_hooke_history_kokkos.h index 80693b33ac..88514e2233 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.h +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.h @@ -114,38 +114,3 @@ class PairGranHookeHistoryKokkos : public PairGranHookeHistory { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair granular requires atom attributes radius, rmass - -The atom style defined does not have these attributes. - -E: Pair granular requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Could not find pair fix neigh history ID - -UNDOCUMENTED - -U: Pair granular with shear history requires newton pair off - -This is a current restriction of the implementation of pair -granular styles with history. - -U: Could not find pair fix ID - -A fix is created internally by the pair style to store shear -history information. You cannot delete it. - -*/ diff --git a/src/KOKKOS/pair_hybrid_kokkos.h b/src/KOKKOS/pair_hybrid_kokkos.h index 9086f20fcc..9460497a7b 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.h +++ b/src/KOKKOS/pair_hybrid_kokkos.h @@ -52,67 +52,3 @@ class PairHybridKokkos : public PairHybrid { #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: Pair style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Pair style hybrid cannot have none as an argument - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair coeff for hybrid has invalid style - -Style in pair coeff must have been listed in pair_style command. - -E: Pair hybrid sub-style is not used - -No pair_coeff command used a sub-style specified in the pair_style -command. - -E: Pair_modify special setting for pair hybrid incompatible with global special_bonds setting - -Cannot override a setting of 0.0 or 1.0 or change a setting between -0.0 and 1.0. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Invoked pair single on pair style none - -A command (e.g. a dump) attempted to invoke the single() function on a -pair style none, which is illegal. You are probably attempting to -compute per-atom quantities with an undefined pair style. - -E: Pair hybrid sub-style does not support single call - -You are attempting to invoke a single() call on a pair style -that doesn't support it. - -E: Pair hybrid single calls do not support per sub-style special bond values - -Self-explanatory. - -E: Unknown pair_modify hybrid sub-style - -The choice of sub-style is unknown. - -E: Coulomb cutoffs of pair hybrid sub-styles do not match - -If using a Kspace solver, all Coulomb cutoffs of long pair styles must -be the same. - -*/ diff --git a/src/KOKKOS/pair_hybrid_overlay_kokkos.h b/src/KOKKOS/pair_hybrid_overlay_kokkos.h index 0b2ff38d4f..3b4327679a 100644 --- a/src/KOKKOS/pair_hybrid_overlay_kokkos.h +++ b/src/KOKKOS/pair_hybrid_overlay_kokkos.h @@ -39,14 +39,3 @@ class PairHybridOverlayKokkos : public PairHybridKokkos { #endif #endif -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair coeff for hybrid has invalid style - -Style in pair coeff must have been listed in pair_style command. - -*/ diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index af959ad63a..db7553c2e0 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -843,6 +843,3 @@ void pair_virial_fdotr_compute(PairStyle* fpair) { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h index e041afda7f..2fb861c4d1 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.h @@ -141,20 +141,3 @@ class PairLJCharmmCoulCharmmImplicitKokkos : public PairLJCharmmCoulCharmmImplic #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/charmm/coul/charmm/implicit/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h index bc14070a07..46b527257e 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.h @@ -139,20 +139,3 @@ class PairLJCharmmCoulCharmmKokkos : public PairLJCharmmCoulCharmm { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/charmm/coul/charmm/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h index 615a1ef9d0..fc0af13845 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.h @@ -137,14 +137,3 @@ class PairLJCharmmCoulLongKokkos : public PairLJCharmmCoulLong { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/charmm/coul/long/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h index c1d098b912..c55c487dd7 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.h @@ -124,20 +124,3 @@ class PairLJClass2CoulCutKokkos : public PairLJClass2CoulCut { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/class2/coul/cut/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h index c8aa009c55..0a10f9ffcd 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.h @@ -138,20 +138,3 @@ class PairLJClass2CoulLongKokkos : public PairLJClass2CoulLong { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/class2/coul/long/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_class2_kokkos.h b/src/KOKKOS/pair_lj_class2_kokkos.h index 7e4438d5d6..d5952655e9 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.h +++ b/src/KOKKOS/pair_lj_class2_kokkos.h @@ -115,20 +115,3 @@ class PairLJClass2Kokkos : public PairLJClass2 { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/class2/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h index 68365d8b86..4704bacd4c 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.h @@ -124,20 +124,3 @@ class PairLJCutCoulCutKokkos : public PairLJCutCoulCut { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/cut/coul/cut/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h index c967601459..8695930f68 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.h @@ -124,20 +124,3 @@ class PairLJCutCoulDebyeKokkos : public PairLJCutCoulDebye { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/cut/coul/debye/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h index 2fd7024e91..b390537e08 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.h @@ -121,14 +121,3 @@ class PairLJCutCoulDSFKokkos : public PairLJCutCoulDSF { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/cut/coul/cut/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h index c3010a108d..6ed46984e2 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.h @@ -138,20 +138,3 @@ class PairLJCutCoulLongKokkos : public PairLJCutCoulLong { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/cut/coul/long/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_lj_cut_kokkos.h b/src/KOKKOS/pair_lj_cut_kokkos.h index 96e228011e..17f1032855 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.h +++ b/src/KOKKOS/pair_lj_cut_kokkos.h @@ -111,20 +111,3 @@ class PairLJCutKokkos : public PairLJCut { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/cut/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_lj_expand_kokkos.h b/src/KOKKOS/pair_lj_expand_kokkos.h index 422ebd0a16..ab62ff1df2 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.h +++ b/src/KOKKOS/pair_lj_expand_kokkos.h @@ -116,20 +116,3 @@ class PairLJExpandKokkos : public PairLJExpand { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/expand/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h index 4d474159ed..33d2bfce97 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.h @@ -146,20 +146,3 @@ class PairLJGromacsCoulGromacsKokkos : public PairLJGromacsCoulGromacs { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/gromacs/coul/gromacs/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.h b/src/KOKKOS/pair_lj_gromacs_kokkos.h index 325931ba9c..94d5524b6b 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.h +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.h @@ -146,20 +146,3 @@ class PairLJGromacsKokkos : public PairLJGromacs { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/gromacs/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.h b/src/KOKKOS/pair_lj_sdk_kokkos.h index 95fd80326d..edc42c7f6a 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.h +++ b/src/KOKKOS/pair_lj_sdk_kokkos.h @@ -113,20 +113,3 @@ class PairLJSDKKokkos : public PairLJSDK { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with lj/sdk/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_morse_kokkos.h b/src/KOKKOS/pair_morse_kokkos.h index 32e057250b..2a1205a65d 100644 --- a/src/KOKKOS/pair_morse_kokkos.h +++ b/src/KOKKOS/pair_morse_kokkos.h @@ -111,20 +111,3 @@ class PairMorseKokkos : public PairMorse { #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: Cannot use Kokkos pair style with rRESPA inner/middle - -Self-explanatory. - -E: Cannot use chosen neighbor list style with morse/kk - -That style is not supported by Kokkos. - -*/ diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.h b/src/KOKKOS/pair_multi_lucy_rx_kokkos.h index b6d0ebd767..a6ef904417 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.h +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.h @@ -194,75 +194,3 @@ class PairMultiLucyRXKokkos : public PairMultiLucyRX, public KokkosBase { #endif #endif -/* ERROR/WARNING messages: - -E: Pair multi/lucy/rx command requires atom_style with density (e.g. dpd, meso) - -Self-explanatory - -E: Density < table inner cutoff - -The local density inner is smaller than the inner cutoff - -E: Density > table inner cutoff - -The local density inner is greater than the inner cutoff - -E: Only LOOKUP and LINEAR table styles have been implemented for pair multi/lucy/rx - -Self-explanatory - -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: Unknown table style in pair_style command - -Self-explanatory - -E: Illegal number of pair table entries - -There must be at least 2 table entries. - -E: Illegal pair_coeff command - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: PairMultiLucyRXKokkos requires a fix rx command - -The fix rx command must come before the pair style command in the input file - -E: There are no rx species specified - -There must be at least one species specified through the fix rx command - -E: Invalid pair table length - -Length of read-in pair table is invalid - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Invalid keyword in pair table parameters - -Keyword used in list of table parameters is not recognized. - -E: Pair table parameters did not set N - -List of pair table parameters must include N setting. - -*/ diff --git a/src/KOKKOS/pair_reaxff_kokkos.h b/src/KOKKOS/pair_reaxff_kokkos.h index e0da0d8819..64d9ced875 100644 --- a/src/KOKKOS/pair_reaxff_kokkos.h +++ b/src/KOKKOS/pair_reaxff_kokkos.h @@ -561,6 +561,3 @@ struct PairReaxKokkosPackBondBufferFunctor { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index f2d2058504..cae0aea0e8 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -78,8 +78,6 @@ void PairSWKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (neighflag == FULL) no_virial_fdotr_compute = 1; - ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary @@ -134,39 +132,27 @@ void PairSWKokkos::compute(int eflag_in, int vflag_in) int max_neighs = d_neighbors.extent(1); - if (((int) d_neighbors_short.extent(1) != max_neighs) || - ((int) d_neighbors_short.extent(0) != ignum)) { - d_neighbors_short = Kokkos::View("SW::neighbors_short",ignum,max_neighs); + if (((int) d_neighbors_short.extent(1) < max_neighs) || + ((int) d_neighbors_short.extent(0) < ignum)) { + d_neighbors_short = Kokkos::View("SW::neighbors_short",ignum*1.2,max_neighs); } - if ((int)d_numneigh_short.extent(0)!=ignum) - d_numneigh_short = Kokkos::View("SW::numneighs_short",ignum); - Kokkos::parallel_for(Kokkos::RangePolicy(0,neighflag==FULL?ignum:inum), *this); + if ((int)d_numneigh_short.extent(0) < ignum) + d_numneigh_short = Kokkos::View("SW::numneighs_short",ignum*1.2); + Kokkos::parallel_for(Kokkos::RangePolicy(0,inum), *this); // loop over neighbor list of my atoms if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - } else if (neighflag == FULL) { - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } @@ -216,6 +202,7 @@ template KOKKOS_INLINE_FUNCTION void PairSWKokkos::operator()(TagPairSWComputeShortNeigh, const int& ii) const { const int i = d_ilist[ii]; + const int itype = d_map[type[i]]; const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); const X_FLOAT ztmp = x(i,2); @@ -225,18 +212,20 @@ void PairSWKokkos::operator()(TagPairSWComputeShortNeigh, const int& for (int jj = 0; jj < jnum; jj++) { int j = d_neighbors(i,jj); j &= NEIGHMASK; + const int jtype = d_map[type[j]]; const X_FLOAT delx = xtmp - x(j,0); const X_FLOAT dely = ytmp - x(j,1); const X_FLOAT delz = ztmp - x(j,2); const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - if (rsq < cutmax*cutmax) { - d_neighbors_short(i,inside) = j; + const int ijparam = d_elem3param(itype,jtype,jtype); + if (rsq < d_params[ijparam].cutsq) { + d_neighbors_short(ii,inside) = j; inside++; } } - d_numneigh_short(i) = inside; + d_numneigh_short(ii) = inside; } /* ---------------------------------------------------------------------- */ @@ -244,7 +233,7 @@ void PairSWKokkos::operator()(TagPairSWComputeShortNeigh, const int& template template KOKKOS_INLINE_FUNCTION -void PairSWKokkos::operator()(TagPairSWComputeHalf, const int &ii, EV_FLOAT& ev) const { +void PairSWKokkos::operator()(TagPairSWCompute, const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -264,15 +253,14 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf // two-body interactions, skip half of them - const int jnum = d_numneigh_short[i]; + const int jnum = d_numneigh_short[ii]; F_FLOAT fxtmpi = 0.0; F_FLOAT fytmpi = 0.0; F_FLOAT fztmpi = 0.0; for (int jj = 0; jj < jnum; jj++) { - int j = d_neighbors_short(i,jj); - j &= NEIGHMASK; + int j = d_neighbors_short(ii,jj); const tagint jtag = tag[j]; if (itag > jtag) { @@ -293,7 +281,6 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; const int ijparam = d_elem3param(itype,jtype,jtype); - if (rsq >= d_params[ijparam].cutsq) continue; twobody(d_params[ijparam],rsq,fpair,eflag,evdwl); @@ -313,23 +300,20 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf const int jnumm1 = jnum - 1; for (int jj = 0; jj < jnumm1; jj++) { - int j = d_neighbors_short(i,jj); - j &= NEIGHMASK; + int j = d_neighbors_short(ii,jj); const int jtype = d_map[type[j]]; const int ijparam = d_elem3param(itype,jtype,jtype); delr1[0] = x(j,0) - xtmp; delr1[1] = x(j,1) - ytmp; delr1[2] = x(j,2) - ztmp; const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; - if (rsq1 >= d_params[ijparam].cutsq) continue; F_FLOAT fxtmpj = 0.0; F_FLOAT fytmpj = 0.0; F_FLOAT fztmpj = 0.0; for (int kk = jj+1; kk < jnum; kk++) { - int k = d_neighbors_short(i,kk); - k &= NEIGHMASK; + int k = d_neighbors_short(ii,kk); const int ktype = d_map[type[k]]; const int ikparam = d_elem3param(itype,ktype,ktype); const int ijkparam = d_elem3param(itype,jtype,ktype); @@ -339,8 +323,6 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf delr2[2] = x(k,2) - ztmp; const F_FLOAT rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; - if (rsq2 >= d_params[ikparam].cutsq) continue; - threebody_kk(d_params[ijparam],d_params[ikparam],d_params[ijkparam], rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl); @@ -373,203 +355,9 @@ void PairSWKokkos::operator()(TagPairSWComputeHalf template template KOKKOS_INLINE_FUNCTION -void PairSWKokkos::operator()(TagPairSWComputeHalf, const int &ii) const { +void PairSWKokkos::operator()(TagPairSWCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairSWComputeHalf(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairSWKokkos::operator()(TagPairSWComputeFullA, const int &ii, EV_FLOAT& ev) const { - - F_FLOAT delr1[3],delr2[3],fj[3],fk[3]; - F_FLOAT evdwl = 0.0; - F_FLOAT fpair = 0.0; - - const int i = d_ilist[ii]; - - const int itype = d_map[type[i]]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - - // two-body interactions - - const int jnum = d_numneigh_short[i]; - - F_FLOAT fxtmpi = 0.0; - F_FLOAT fytmpi = 0.0; - F_FLOAT fztmpi = 0.0; - - for (int jj = 0; jj < jnum; jj++) { - int j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - - const int jtype = d_map[type[j]]; - - const X_FLOAT delx = xtmp - x(j,0); - const X_FLOAT dely = ytmp - x(j,1); - const X_FLOAT delz = ztmp - x(j,2); - const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - - const int ijparam = d_elem3param(itype,jtype,jtype); - - if (rsq >= d_params[ijparam].cutsq) continue; - - twobody(d_params[ijparam],rsq,fpair,eflag,evdwl); - - fxtmpi += delx*fpair; - fytmpi += dely*fpair; - fztmpi += delz*fpair; - - if (EVFLAG) { - if (eflag) ev.evdwl += 0.5*evdwl; - if (vflag_either || eflag_atom) this->template ev_tally(ev,i,j,evdwl,fpair,delx,dely,delz); - } - } - - const int jnumm1 = jnum - 1; - - for (int jj = 0; jj < jnumm1; jj++) { - int j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - const int jtype = d_map[type[j]]; - const int ijparam = d_elem3param(itype,jtype,jtype); - delr1[0] = x(j,0) - xtmp; - delr1[1] = x(j,1) - ytmp; - delr1[2] = x(j,2) - ztmp; - const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; - - if (rsq1 >= d_params[ijparam].cutsq) continue; - - for (int kk = jj+1; kk < jnum; kk++) { - int k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - const int ktype = d_map[type[k]]; - const int ikparam = d_elem3param(itype,ktype,ktype); - const int ijkparam = d_elem3param(itype,jtype,ktype); - - delr2[0] = x(k,0) - xtmp; - delr2[1] = x(k,1) - ytmp; - delr2[2] = x(k,2) - ztmp; - const F_FLOAT rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; - - if (rsq2 >= d_params[ikparam].cutsq) continue; - - threebody_kk(d_params[ijparam],d_params[ikparam],d_params[ijkparam], - rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl); - - fxtmpi -= fj[0] + fk[0]; - fytmpi -= fj[1] + fk[1]; - fztmpi -= fj[2] + fk[2]; - - if (EVFLAG) { - if (eflag) ev.evdwl += evdwl; - if (vflag_either || eflag_atom) this->template ev_tally3(ev,i,j,k,evdwl,0.0,fj,fk,delr1,delr2); - } - } - } - - f(i,0) += fxtmpi; - f(i,1) += fytmpi; - f(i,2) += fztmpi; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairSWKokkos::operator()(TagPairSWComputeFullA, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairSWComputeFullA(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairSWKokkos::operator()(TagPairSWComputeFullB, const int &ii, EV_FLOAT& ev) const { - - F_FLOAT delr1[3],delr2[3],fj[3],fk[3]; - F_FLOAT evdwl = 0.0; - - const int i = d_ilist[ii]; - - const int itype = d_map[type[i]]; - const X_FLOAT xtmpi = x(i,0); - const X_FLOAT ytmpi = x(i,1); - const X_FLOAT ztmpi = x(i,2); - - const int jnum = d_numneigh_short[i]; - - F_FLOAT fxtmpi = 0.0; - F_FLOAT fytmpi = 0.0; - F_FLOAT fztmpi = 0.0; - - for (int jj = 0; jj < jnum; jj++) { - int j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - if (j >= nlocal) continue; - const int jtype = d_map[type[j]]; - const int jiparam = d_elem3param(jtype,itype,itype); - const X_FLOAT xtmpj = x(j,0); - const X_FLOAT ytmpj = x(j,1); - const X_FLOAT ztmpj = x(j,2); - - delr1[0] = xtmpi - xtmpj; - delr1[1] = ytmpi - ytmpj; - delr1[2] = ztmpi - ztmpj; - const F_FLOAT rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; - - if (rsq1 >= d_params[jiparam].cutsq) continue; - - const int j_jnum = d_numneigh_short[j]; - - for (int kk = 0; kk < j_jnum; kk++) { - int k = d_neighbors_short(j,kk); - k &= NEIGHMASK; - if (k == i) continue; - const int ktype = d_map[type[k]]; - const int jkparam = d_elem3param(jtype,ktype,ktype); - const int jikparam = d_elem3param(jtype,itype,ktype); - - delr2[0] = x(k,0) - xtmpj; - delr2[1] = x(k,1) - ytmpj; - delr2[2] = x(k,2) - ztmpj; - const F_FLOAT rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; - - if (rsq2 >= d_params[jkparam].cutsq) continue; - - if (vflag_atom) - threebody_kk(d_params[jiparam],d_params[jkparam],d_params[jikparam], - rsq1,rsq2,delr1,delr2,fj,fk,eflag,evdwl); - else - threebodyj(d_params[jiparam],d_params[jkparam],d_params[jikparam], - rsq1,rsq2,delr1,delr2,fj); - - fxtmpi += fj[0]; - fytmpi += fj[1]; - fztmpi += fj[2]; - - if (EVFLAG) - if (vflag_atom || eflag_atom) ev_tally3_atom(ev,i,evdwl,0.0,fj,fk,delr1,delr2); - } - } - - f(i,0) += fxtmpi; - f(i,1) += fytmpi; - f(i,2) += fztmpi; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairSWKokkos::operator()(TagPairSWComputeFullB, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairSWComputeFullB(), ii, ev); + this->template operator()(TagPairSWCompute(), ii, ev); } /* ---------------------------------------------------------------------- @@ -613,9 +401,9 @@ void PairSWKokkos::init_style() request->set_kokkos_host(std::is_same::value && !std::is_same::value); request->set_kokkos_device(std::is_same::value); - // always request a full neighbor list - request->enable_full(); - if (neighflag == FULL) request->enable_ghost(); + + if (neighflag == FULL) + error->all(FLERR,"Must use half neighbor list style with pair sw/kk"); } /* ---------------------------------------------------------------------- */ @@ -732,52 +520,6 @@ void PairSWKokkos::threebody_kk(const Param& paramij, const Param& p /* ---------------------------------------------------------------------- */ -template -KOKKOS_INLINE_FUNCTION -void PairSWKokkos::threebodyj(const Param& paramij, const Param& paramik, const Param& paramijk, - const F_FLOAT& rsq1, const F_FLOAT& rsq2, F_FLOAT *delr1, F_FLOAT *delr2, F_FLOAT *fj) const -{ - F_FLOAT r1,rinvsq1,rainv1,gsrainv1,gsrainvsq1,expgsrainv1; - F_FLOAT r2, rainv2, gsrainv2, expgsrainv2; - F_FLOAT rinv12,cs,delcs,delcssq,facexp,facrad,frad1; - F_FLOAT facang,facang12,csfacang,csfac1; - - r1 = sqrt(rsq1); - rinvsq1 = 1.0/rsq1; - rainv1 = 1.0/(r1 - paramij.cut); - gsrainv1 = paramij.sigma_gamma * rainv1; - gsrainvsq1 = gsrainv1*rainv1/r1; - expgsrainv1 = exp(gsrainv1); - - r2 = sqrt(rsq2); - rainv2 = 1.0/(r2 - paramik.cut); - gsrainv2 = paramik.sigma_gamma * rainv2; - expgsrainv2 = exp(gsrainv2); - - rinv12 = 1.0/(r1*r2); - cs = (delr1[0]*delr2[0] + delr1[1]*delr2[1] + delr1[2]*delr2[2]) * rinv12; - delcs = cs - paramijk.costheta; - delcssq = delcs*delcs; - - facexp = expgsrainv1*expgsrainv2; - - // facrad = sqrt(paramij.lambda_epsilon*paramik.lambda_epsilon) * - // facexp*delcssq; - - facrad = paramijk.lambda_epsilon * facexp*delcssq; - frad1 = facrad*gsrainvsq1; - facang = paramijk.lambda_epsilon2 * facexp*delcs; - facang12 = rinv12*facang; - csfacang = cs*facang; - csfac1 = rinvsq1*csfacang; - - fj[0] = delr1[0]*(frad1+csfac1)-delr2[0]*facang12; - fj[1] = delr1[1]*(frad1+csfac1)-delr2[1]*facang12; - fj[2] = delr1[2]*(frad1+csfac1)-delr2[2]*facang12; -} - -/* ---------------------------------------------------------------------- */ - template template KOKKOS_INLINE_FUNCTION @@ -785,7 +527,6 @@ void PairSWKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int &j const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const { - const int VFLAG = vflag_either; // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -798,11 +539,10 @@ void PairSWKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int &j if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; a_eatom[i] += epairhalf; - if (NEIGHFLAG != FULL) - a_eatom[j] += epairhalf; + a_eatom[j] += epairhalf; } - if (VFLAG) { + if (vflag_either) { const E_FLOAT v0 = delx*delx*fpair; const E_FLOAT v1 = dely*dely*fpair; const E_FLOAT v2 = delz*delz*fpair; @@ -811,21 +551,12 @@ void PairSWKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int &j const E_FLOAT v5 = dely*delz*fpair; if (vflag_global) { - if (NEIGHFLAG != FULL) { - ev.v[0] += v0; - ev.v[1] += v1; - ev.v[2] += v2; - ev.v[3] += v3; - ev.v[4] += v4; - ev.v[5] += v5; - } else { - ev.v[0] += 0.5*v0; - ev.v[1] += 0.5*v1; - ev.v[2] += 0.5*v2; - ev.v[3] += 0.5*v3; - ev.v[4] += 0.5*v4; - ev.v[5] += 0.5*v5; - } + ev.v[0] += v0; + ev.v[1] += v1; + ev.v[2] += v2; + ev.v[3] += v3; + ev.v[4] += v4; + ev.v[5] += v5; } if (vflag_atom) { @@ -836,14 +567,12 @@ void PairSWKokkos::ev_tally(EV_FLOAT &ev, const int &i, const int &j a_vatom(i,4) += 0.5*v4; a_vatom(i,5) += 0.5*v5; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += 0.5*v0; - a_vatom(j,1) += 0.5*v1; - a_vatom(j,2) += 0.5*v2; - a_vatom(j,3) += 0.5*v3; - a_vatom(j,4) += 0.5*v4; - a_vatom(j,5) += 0.5*v5; - } + a_vatom(j,0) += 0.5*v0; + a_vatom(j,1) += 0.5*v1; + a_vatom(j,2) += 0.5*v2; + a_vatom(j,3) += 0.5*v3; + a_vatom(j,4) += 0.5*v4; + a_vatom(j,5) += 0.5*v5; } } } @@ -863,8 +592,6 @@ void PairSWKokkos::ev_tally3(EV_FLOAT &ev, const int &i, const int & { F_FLOAT epairthird,v[6]; - const int VFLAG = vflag_either; - // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); @@ -876,13 +603,11 @@ void PairSWKokkos::ev_tally3(EV_FLOAT &ev, const int &i, const int & if (eflag_atom) { epairthird = THIRD * (evdwl + ecoul); a_eatom[i] += epairthird; - if (NEIGHFLAG != FULL) { - a_eatom[j] += epairthird; - a_eatom[k] += epairthird; - } + a_eatom[j] += epairthird; + a_eatom[k] += epairthird; } - if (VFLAG) { + if (vflag_either) { v[0] = drji[0]*fj[0] + drki[0]*fk[0]; v[1] = drji[1]*fj[1] + drki[1]*fk[1]; v[2] = drji[2]*fj[2] + drki[2]*fk[2]; @@ -904,15 +629,13 @@ void PairSWKokkos::ev_tally3(EV_FLOAT &ev, const int &i, const int & a_vatom(i,2) += THIRD*v[2]; a_vatom(i,3) += THIRD*v[3]; a_vatom(i,4) += THIRD*v[4]; a_vatom(i,5) += THIRD*v[5]; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += THIRD*v[0]; a_vatom(j,1) += THIRD*v[1]; - a_vatom(j,2) += THIRD*v[2]; a_vatom(j,3) += THIRD*v[3]; - a_vatom(j,4) += THIRD*v[4]; a_vatom(j,5) += THIRD*v[5]; + a_vatom(j,0) += THIRD*v[0]; a_vatom(j,1) += THIRD*v[1]; + a_vatom(j,2) += THIRD*v[2]; a_vatom(j,3) += THIRD*v[3]; + a_vatom(j,4) += THIRD*v[4]; a_vatom(j,5) += THIRD*v[5]; - a_vatom(k,0) += THIRD*v[0]; a_vatom(k,1) += THIRD*v[1]; - a_vatom(k,2) += THIRD*v[2]; a_vatom(k,3) += THIRD*v[3]; - a_vatom(k,4) += THIRD*v[4]; a_vatom(k,5) += THIRD*v[5]; - } + a_vatom(k,0) += THIRD*v[0]; a_vatom(k,1) += THIRD*v[1]; + a_vatom(k,2) += THIRD*v[2]; a_vatom(k,3) += THIRD*v[3]; + a_vatom(k,4) += THIRD*v[4]; a_vatom(k,5) += THIRD*v[5]; } } } @@ -931,14 +654,12 @@ void PairSWKokkos::ev_tally3_atom(EV_FLOAT & /*ev*/, const int &i, { F_FLOAT epairthird,v[6]; - const int VFLAG = vflag_either; - if (eflag_atom) { epairthird = THIRD * (evdwl + ecoul); d_eatom[i] += epairthird; } - if (VFLAG) { + if (vflag_either) { v[0] = drji[0]*fj[0] + drki[0]*fk[0]; v[1] = drji[1]*fj[1] + drki[1]*fk[1]; v[2] = drji[2]*fj[2] + drki[2]*fk[2]; diff --git a/src/KOKKOS/pair_sw_kokkos.h b/src/KOKKOS/pair_sw_kokkos.h index 1259ddf71e..06e4341b68 100644 --- a/src/KOKKOS/pair_sw_kokkos.h +++ b/src/KOKKOS/pair_sw_kokkos.h @@ -27,13 +27,7 @@ PairStyle(sw/kk/host,PairSWKokkos); #include "pair_kokkos.h" template -struct TagPairSWComputeHalf{}; - -template -struct TagPairSWComputeFullA{}; - -template -struct TagPairSWComputeFullB{}; +struct TagPairSWCompute{}; struct TagPairSWComputeShortNeigh{}; @@ -42,7 +36,7 @@ namespace LAMMPS_NS { template class PairSWKokkos : public PairSW { public: - enum {EnabledNeighFlags=FULL}; + enum {EnabledNeighFlags=HALF|HALFTHREAD}; enum {COUL_FLAG=0}; typedef DeviceType device_type; typedef ArrayTypes AT; @@ -56,27 +50,11 @@ class PairSWKokkos : public PairSW { template KOKKOS_INLINE_FUNCTION - void operator()(TagPairSWComputeHalf, const int&, EV_FLOAT&) const; + void operator()(TagPairSWCompute, const int&, EV_FLOAT&) const; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairSWComputeHalf, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairSWComputeFullA, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairSWComputeFullA, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairSWComputeFullB, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairSWComputeFullB, const int&) const; + void operator()(TagPairSWCompute, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(TagPairSWComputeShortNeigh, const int&) const; @@ -121,10 +99,6 @@ class PairSWKokkos : public PairSW { void threebody_kk(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *, F_FLOAT *, F_FLOAT *, const int&, F_FLOAT&) const; - KOKKOS_INLINE_FUNCTION - void threebodyj(const Param&, const Param&, const Param&, const F_FLOAT&, const F_FLOAT&, F_FLOAT *, F_FLOAT *, - F_FLOAT *) const; - typename AT::t_x_array_randomread x; typename AT::t_f_array f; typename AT::t_tagint_1d tag; @@ -178,10 +152,3 @@ class PairSWKokkos : public PairSW { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with pair sw/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_table_kokkos.h b/src/KOKKOS/pair_table_kokkos.h index 6574ce807f..ef34b83731 100644 --- a/src/KOKKOS/pair_table_kokkos.h +++ b/src/KOKKOS/pair_table_kokkos.h @@ -176,78 +176,3 @@ class PairTableKokkos : public PairTable { #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: Unknown table style in pair_style command - -Style of table is invalid for use with pair_style table command. - -E: Illegal number of pair table entries - -There must be at least 2 table entries. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot use chosen neighbor list style with lj/cut/kk - -That style is not supported by Kokkos. - -U: Pair distance < table inner cutoff - -Two atoms are closer together than the pairwise table allows. - -U: Pair distance > table outer cutoff - -Two atoms are further apart than the pairwise table allows. - -U: Invalid pair table length - -Length of read-in pair table is invalid - -U: Invalid pair table cutoff - -Cutoffs in pair_coeff command are not valid with read-in pair table. - -U: Bitmapped table in file does not match requested table - -Setting for bitmapped table in pair_coeff command must match table -in file exactly. - -U: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -U: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -U: Bitmapped table is incorrect length in table file - -Number of table entries is not a correct power of 2. - -U: Invalid keyword in pair table parameters - -Keyword used in list of table parameters is not recognized. - -U: Pair table parameters did not set N - -List of pair table parameters must include N setting. - -U: Pair table cutoffs must all be equal to use with KSpace - -When using pair style table with a long-range KSpace solver, the -cutoffs for all atom type pairs must all be the same, since the -long-range solver starts at that cutoff. - -*/ diff --git a/src/KOKKOS/pair_table_rx_kokkos.h b/src/KOKKOS/pair_table_rx_kokkos.h index 16915eaae0..fb4c653841 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.h +++ b/src/KOKKOS/pair_table_rx_kokkos.h @@ -117,6 +117,3 @@ class PairTableRXKokkos : public PairTable { #endif #endif -/* ERROR/WARNING messages: - - */ diff --git a/src/KOKKOS/pair_tersoff_kokkos.cpp b/src/KOKKOS/pair_tersoff_kokkos.cpp index 1bab686926..ce84496b95 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_kokkos.cpp @@ -19,7 +19,7 @@ - Reduced math overhead: enabled specialized calls (e.g., cbrt for a cube root instead of pow) and use power/exponential laws to reduce the number of exponentials evaluated, etc. - - Fused the jj loop in TagPairTersoffComputeHalf between the repulsive + - Fused the jj loop in TagPairTersoffCompute between the repulsive and attractive iterations - Merged "ters_fc_k" with "ters_dfc", "ters_bij_k" with "ters_dbij", "ters_gijk" with "ters_dgijk", and "ters_fa_k" with "ters_dfa" @@ -75,18 +75,29 @@ PairTersoffKokkos::~PairTersoffKokkos() } } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ template -void PairTersoffKokkos::allocate() +void PairTersoffKokkos::coeff(int narg, char **arg) { - PairTersoff::allocate(); + PairTersoff::coeff(narg,arg); + + // sync map int n = atom->ntypes; - k_params = Kokkos::DualView - ("PairTersoff::paramskk",n+1,n+1,n+1); - paramskk = k_params.template view(); + DAT::tdual_int_1d k_map = DAT::tdual_int_1d("pair:map",n+1); + HAT::t_int_1d h_map = k_map.h_view; + + for (int i = 1; i <= n; i++) + h_map[i] = map[i]; + + k_map.template modify(); + k_map.template sync(); + + d_map = k_map.template view(); } /* ---------------------------------------------------------------------- @@ -105,9 +116,9 @@ void PairTersoffKokkos::init_style() request->set_kokkos_host(std::is_same::value && !std::is_same::value); request->set_kokkos_device(std::is_same::value); - request->enable_full(); + if (neighflag == FULL) - error->all(FLERR,"Cannot (yet) use full neighbor list style with tersoff/kk"); + error->all(FLERR,"Must use half neighbor list style with pair tersoff/kk"); } /* ---------------------------------------------------------------------- */ @@ -117,35 +128,29 @@ void PairTersoffKokkos::setup_params() { PairTersoff::setup_params(); - int i,j,k,m; - int n = atom->ntypes; + // sync elem3param and params - for (i = 1; i <= n; i++) - for (j = 1; j <= n; j++) - for (k = 1; k <= n; k++) { - m = elem3param[map[i]][map[j]][map[k]]; - k_params.h_view(i,j,k).powerm = params[m].powerm; - k_params.h_view(i,j,k).gamma = params[m].gamma; - k_params.h_view(i,j,k).lam3 = params[m].lam3; - k_params.h_view(i,j,k).c = params[m].c; - k_params.h_view(i,j,k).d = params[m].d; - k_params.h_view(i,j,k).h = params[m].h; - k_params.h_view(i,j,k).powern = params[m].powern; - k_params.h_view(i,j,k).beta = params[m].beta; - k_params.h_view(i,j,k).lam2 = params[m].lam2; - k_params.h_view(i,j,k).bigb = params[m].bigb; - k_params.h_view(i,j,k).bigr = params[m].bigr; - k_params.h_view(i,j,k).bigd = params[m].bigd; - k_params.h_view(i,j,k).lam1 = params[m].lam1; - k_params.h_view(i,j,k).biga = params[m].biga; - k_params.h_view(i,j,k).cutsq = params[m].cutsq; - k_params.h_view(i,j,k).c1 = params[m].c1; - k_params.h_view(i,j,k).c2 = params[m].c2; - k_params.h_view(i,j,k).c3 = params[m].c3; - k_params.h_view(i,j,k).c4 = params[m].c4; - } + tdual_int_3d k_elem3param = tdual_int_3d("pair:elem3param",nelements,nelements,nelements); + t_host_int_3d h_elem3param = k_elem3param.h_view; - k_params.template modify(); + tdual_param_1d k_params = tdual_param_1d("pair:params",nparams); + t_host_param_1d h_params = k_params.h_view; + + for (int i = 0; i < nelements; i++) + for (int j = 0; j < nelements; j++) + for (int k = 0; k < nelements; k++) + h_elem3param(i,j,k) = elem3param[i][j][k]; + + for (int m = 0; m < nparams; m++) + h_params[m] = params[m]; + + k_elem3param.modify_host(); + k_elem3param.template sync(); + k_params.modify_host(); + k_params.template sync(); + + d_elem3param = k_elem3param.template view(); + d_params = k_params.template view(); } /* ---------------------------------------------------------------------- */ @@ -156,8 +161,6 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (neighflag == FULL) no_virial_fdotr_compute = 1; - ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary @@ -174,7 +177,6 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) } atomKK->sync(execution_space,datamask_read); - k_params.template sync(); if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); else atomKK->modified(execution_space,F_MASK); @@ -213,37 +215,25 @@ void PairTersoffKokkos::compute(int eflag_in, int vflag_in) int max_neighs = d_neighbors.extent(1); - if (((int)d_neighbors_short.extent(1) != max_neighs) || - ((int)d_neighbors_short.extent(0) != ignum)) { - d_neighbors_short = Kokkos::View("Tersoff::neighbors_short",ignum,max_neighs); + if (((int)d_neighbors_short.extent(1) < max_neighs) || + ((int)d_neighbors_short.extent(0) < ignum)) { + d_neighbors_short = Kokkos::View("Tersoff::neighbors_short",ignum*1.2,max_neighs); } - if ((int)d_numneigh_short.extent(0)!=ignum) - d_numneigh_short = Kokkos::View("Tersoff::numneighs_short",ignum); - Kokkos::parallel_for(Kokkos::RangePolicy(0,neighflag==FULL?ignum:inum), *this); + if ((int)d_numneigh_short.extent(0) < ignum) + d_numneigh_short = Kokkos::View("Tersoff::numneighs_short",ignum*1.2); + Kokkos::parallel_for(Kokkos::RangePolicy(0,inum), *this); if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - } else if (neighflag == FULL) { - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } @@ -309,11 +299,11 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeShortNeigh, const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; if (rsq < cutmax_sq) { - d_neighbors_short(i,inside) = j; + d_neighbors_short(ii,inside) = j; inside++; } } - d_numneigh_short(i) = inside; + d_numneigh_short(ii) = inside; } /* ---------------------------------------------------------------------- */ @@ -321,7 +311,7 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeShortNeigh, template template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf, const int &ii, EV_FLOAT& ev) const { +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -333,13 +323,13 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf::operator()(TagPairTersoffComputeHalf cutsq1) continue; @@ -366,26 +356,26 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf cutsq2) continue; const F_FLOAT rik = sqrt(rsq2); - bo_ij += bondorder(itype,jtype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); + bo_ij += bondorder(d_params(iparam_ijk),rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); } // attractive: pairwise potential and force F_FLOAT fa, dfa, bij, prefactor; - ters_fa_k_and_ters_dfa(itype,jtype,jtype,rij,fa,dfa); - ters_bij_k_and_ters_dbij(itype,jtype,jtype,bo_ij,bij,prefactor); + ters_fa_k_and_ters_dfa(d_params(iparam_ij),rij,fa,dfa); + ters_bij_k_and_ters_dbij(d_params(iparam_ij),bo_ij,bij,prefactor); const F_FLOAT fatt = -0.5*bij * dfa / rij; prefactor = 0.5*fa * prefactor; @@ -407,19 +397,19 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf cutsq2) continue; const F_FLOAT rik = sqrt(rsq2); - ters_dthb(itype,jtype,ktype,prefactor,rij,delx1,dely1,delz1, + ters_dthb(d_params(iparam_ijk),prefactor,rij,delx1,dely1,delz1, rik,delx2,dely2,delz2,fi,fj,fk); f_x += fi[0]; @@ -456,12 +446,12 @@ void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf::operator()(TagPairTersoffComputeHalf template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffComputeHalf, const int &ii) const { +void PairTersoffKokkos::operator()(TagPairTersoffCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairTersoffComputeHalf(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffComputeFullA, const int &ii, EV_FLOAT& ev) const { - - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); - const tagint itag = tag(i); - - int j,k,jj,kk,jtype,ktype; - F_FLOAT rsq1, cutsq1, rsq2, cutsq2, rij, rik, bo_ij; - F_FLOAT fi[3], fj[3], fk[3]; - X_FLOAT delx1, dely1, delz1, delx2, dely2, delz2; - - //const AtomNeighborsConst d_neighbors_i = k_list.get_neighbors_const(i); - const int jnum = d_numneigh_short[i]; - - F_FLOAT f_x = 0.0; - F_FLOAT f_y = 0.0; - F_FLOAT f_z = 0.0; - - // attractive: bond order - - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - jtype = type(j); - - delx1 = xtmp - x(j,0); - dely1 = ytmp - x(j,1); - delz1 = ztmp - x(j,2); - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - cutsq1 = paramskk(itype,jtype,jtype).cutsq; - - bo_ij = 0.0; - if (rsq1 > cutsq1) continue; - rij = sqrt(rsq1); - - for (kk = 0; kk < jnum; kk++) { - if (jj == kk) continue; - k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - ktype = type(k); - - delx2 = xtmp - x(k,0); - dely2 = ytmp - x(k,1); - delz2 = ztmp - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(itype,jtype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - bo_ij += bondorder(itype,jtype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); - } - - // attractive: pairwise potential and force - - F_FLOAT fa, dfa, bij, prefactor; - ters_fa_k_and_ters_dfa(itype,jtype,jtype,rij,fa,dfa); - ters_bij_k_and_ters_dbij(itype,jtype,jtype, bo_ij, bij, prefactor); - const F_FLOAT fatt = -0.5*bij * dfa / rij; - prefactor = 0.5*fa * prefactor; - const F_FLOAT eng = 0.5*bij * fa; - - f_x += delx1*fatt; - f_y += dely1*fatt; - f_z += delz1*fatt; - - if (EVFLAG) { - if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); - } - - // attractive: three-body force - - for (kk = 0; kk < jnum; kk++) { - if (jj == kk) continue; - k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - ktype = type(k); - - delx2 = xtmp - x(k,0); - dely2 = ytmp - x(k,1); - delz2 = ztmp - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(itype,jtype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - ters_dthb(itype,jtype,ktype,prefactor,rij,delx1,dely1,delz1, - rik,delx2,dely2,delz2,fi,fj,fk); - - f_x += fi[0]; - f_y += fi[1]; - f_z += fi[2]; - - if (vflag_either) { - F_FLOAT delrij[3], delrik[3]; - delrij[0] = -delx1; delrij[1] = -dely1; delrij[2] = -delz1; - delrik[0] = -delx2; delrik[1] = -dely2; delrik[2] = -delz2; - if (vflag_either) this->template v_tally3(ev,i,j,k,fj,fk,delrij,delrik); - } - } - - // repulsive - - const tagint jtag = tag(j); - bool continue_flag = false; - - if (itag > jtag) { - if ((itag+jtag) % 2 == 0) continue_flag = true; - } else if (itag < jtag) { - if ((itag+jtag) % 2 == 1) continue_flag = true; - } else { - if (x(j,2) < ztmp) continue_flag = true; - else if (x(j,2) == ztmp && x(j,1) < ytmp) continue_flag = true; - else if (x(j,2) == ztmp && x(j,1) == ytmp && x(j,0) < xtmp) continue_flag = true; - } - if (!continue_flag) { - F_FLOAT tmp_fce, tmp_fcd; - ters_fc_k_and_ters_dfc(itype,jtype,jtype,rij,tmp_fce,tmp_fcd); - - const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * rij); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * - (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / rij; - const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; - - f_x += delx1*frep; - f_y += dely1*frep; - f_z += delz1*frep; - - if (EVFLAG) { - if (eflag) ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) this->template ev_tally(ev,i,j,eng,frep,delx1,dely1,delz1); - } - } - } - f(i,0) += f_x; - f(i,1) += f_y; - f(i,2) += f_z; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffComputeFullA, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairTersoffComputeFullA(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffComputeFullB, const int &ii, EV_FLOAT& ev) const { - - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); - - int j,k,jj,kk,jtype,ktype,j_jnum; - F_FLOAT rsq1, cutsq1, rsq2, cutsq2, rij, rik, bo_ij; - F_FLOAT fj[3], fk[3]; - X_FLOAT delx1, dely1, delz1, delx2, dely2, delz2; - - const int jnum = d_numneigh_short[i]; - - F_FLOAT f_x = 0.0; - F_FLOAT f_y = 0.0; - F_FLOAT f_z = 0.0; - - // attractive: bond order - - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - if (j >= nlocal) continue; - jtype = type(j); - - delx1 = x(j,0) - xtmp; - dely1 = x(j,1) - ytmp; - delz1 = x(j,2) - ztmp; - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - cutsq1 = paramskk(jtype,itype,itype).cutsq; - - bo_ij = 0.0; - if (rsq1 > cutsq1) continue; - rij = sqrt(rsq1); - - j_jnum = d_numneigh_short[j]; - - for (kk = 0; kk < j_jnum; kk++) { - k = d_neighbors_short(j,kk); - if (k == i) continue; - k &= NEIGHMASK; - ktype = type(k); - - delx2 = x(j,0) - x(k,0); - dely2 = x(j,1) - x(k,1); - delz2 = x(j,2) - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(jtype,itype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - bo_ij += bondorder(jtype,itype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); - - } - - // attractive: pairwise potential and force - - F_FLOAT fa, dfa, bij, prefactor; - ters_fa_k_and_ters_dfa(itype,jtype,jtype,rij,fa,dfa); - ters_bij_k_and_ters_dbij(itype,jtype,jtype, bo_ij, bij, prefactor); - const F_FLOAT fatt = -0.5*bij * dfa / rij; - prefactor = 0.5*fa * prefactor; - const F_FLOAT eng = 0.5*bij * fa; - - f_x -= delx1*fatt; - f_y -= dely1*fatt; - f_z -= delz1*fatt; - - if (EVFLAG) { - if (eflag) - ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); - } - - // attractive: three-body force - - for (kk = 0; kk < j_jnum; kk++) { - k = d_neighbors_short(j,kk); - if (k == i) continue; - k &= NEIGHMASK; - ktype = type(k); - - delx2 = x(j,0) - x(k,0); - dely2 = x(j,1) - x(k,1); - delz2 = x(j,2) - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(jtype,itype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - ters_dthbj(jtype,itype,ktype,prefactor,rij,delx1,dely1,delz1, - rik,delx2,dely2,delz2,fj,fk); - f_x += fj[0]; - f_y += fj[1]; - f_z += fj[2]; - - if (vflag_either) { - F_FLOAT delrji[3], delrjk[3]; - delrji[0] = -delx1; delrji[1] = -dely1; delrji[2] = -delz1; - delrjk[0] = -delx2; delrjk[1] = -dely2; delrjk[2] = -delz2; - if (vflag_either) v_tally3_atom(ev,i,j,k,fj,fk,delrji,delrjk); - } - - const F_FLOAT fa_jk = ters_fa_k(jtype,ktype,itype,rik); - const F_FLOAT prefactor_jk = 0.5*fa_jk * ters_dbij(jtype,ktype,itype,bo_ij); - ters_dthbk(jtype,ktype,itype,prefactor_jk,rik,delx2,dely2,delz2, - rij,delx1,dely1,delz1,fk); - f_x += fk[0]; - f_y += fk[1]; - f_z += fk[2]; - } - } - f(i,0) += f_x; - f(i,1) += f_y; - f(i,2) += f_z; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::operator()(TagPairTersoffComputeFullB, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairTersoffComputeFullB(), ii, ev); + this->template operator()(TagPairTersoffCompute(), ii, ev); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::ters_fc_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffKokkos::ters_fc_k(const Param& param, const F_FLOAT &r) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) return 1.0; if (r > ters_R+ters_D) return 0.0; @@ -803,11 +503,10 @@ double PairTersoffKokkos::ters_fc_k(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffKokkos::ters_dfc(const Param& param, const F_FLOAT &r) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) return 0.0; if (r > ters_R+ters_D) return 0.0; @@ -818,11 +517,10 @@ double PairTersoffKokkos::ters_dfc(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::ters_fc_k_and_ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r, double& fc, double& dfc) const +void PairTersoffKokkos::ters_fc_k_and_ters_dfc(const Param& param, const F_FLOAT &r, double& fc, double& dfc) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) { fc = 1.0; @@ -848,7 +546,7 @@ void PairTersoffKokkos::ters_fc_k_and_ters_dfc(const int &i, const i template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::bondorder(const int &i, const int &j, const int &k, +double PairTersoffKokkos::bondorder(const Param& param, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const { @@ -856,15 +554,15 @@ double PairTersoffKokkos::bondorder(const int &i, const int &j, cons const F_FLOAT costheta = (dx1*dx2 + dy1*dy2 + dz1*dz2)/(rij*rik); - const F_FLOAT param = paramskk(i,j,k).lam3 * (rij-rik); - if (int(paramskk(i,j,k).powerm) == 3) arg = param*param*param;//pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else arg = param; + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) arg = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else arg = paramtmp; if (arg > 69.0776) ex_delr = 1.e30; else if (arg < -69.0776) ex_delr = 0.0; else ex_delr = exp(arg); - return ters_fc_k(i,j,k,rik) * ters_gijk(i,j,k,costheta) * ex_delr; + return ters_fc_k(param,rik) * ters_gijk(param,costheta) * ex_delr; } /* ---------------------------------------------------------------------- */ @@ -872,13 +570,13 @@ double PairTersoffKokkos::bondorder(const int &i, const int &j, cons template KOKKOS_INLINE_FUNCTION double PairTersoffKokkos:: - ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const + ters_gijk(const Param& param, const F_FLOAT &cos) const { - const F_FLOAT ters_c = paramskk(i,j,k).c * paramskk(i,j,k).c; - const F_FLOAT ters_d = paramskk(i,j,k).d * paramskk(i,j,k).d; - const F_FLOAT hcth = paramskk(i,j,k).h - cos; + const F_FLOAT ters_c = param.c * param.c; + const F_FLOAT ters_d = param.d * param.d; + const F_FLOAT hcth = param.h - cos; - return paramskk(i,j,k).gamma*(1.0 + ters_c/ters_d - ters_c/(ters_d+hcth*hcth)); + return param.gamma*(1.0 + ters_c/ters_d - ters_c/(ters_d+hcth*hcth)); } /* ---------------------------------------------------------------------- */ @@ -886,14 +584,14 @@ double PairTersoffKokkos:: template KOKKOS_INLINE_FUNCTION double PairTersoffKokkos:: - ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const + ters_dgijk(const Param& param, const F_FLOAT &cos) const { - const F_FLOAT ters_c = paramskk(i,j,k).c * paramskk(i,j,k).c; - const F_FLOAT ters_d = paramskk(i,j,k).d * paramskk(i,j,k).d; - const F_FLOAT hcth = paramskk(i,j,k).h - cos; + const F_FLOAT ters_c = param.c * param.c; + const F_FLOAT ters_d = param.d * param.d; + const F_FLOAT hcth = param.h - cos; const F_FLOAT numerator = -2.0 * ters_c * hcth; const F_FLOAT denominator = 1.0/(ters_d + hcth*hcth); - return paramskk(i,j,k).gamma * numerator * denominator * denominator; + return param.gamma * numerator * denominator * denominator; } /* ---------------------------------------------------------------------- */ @@ -901,59 +599,56 @@ double PairTersoffKokkos:: template KOKKOS_INLINE_FUNCTION void PairTersoffKokkos:: - ters_gijk_and_ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos, double &gijk, double &dgijk) const + ters_gijk_and_ters_dgijk(const Param& param, const F_FLOAT &cos, double &gijk, double &dgijk) const { - const F_FLOAT ters_c = paramskk(i,j,k).c * paramskk(i,j,k).c; - const F_FLOAT ters_d = paramskk(i,j,k).d * paramskk(i,j,k).d; - const F_FLOAT hcth = paramskk(i,j,k).h - cos; + const F_FLOAT ters_c = param.c * param.c; + const F_FLOAT ters_d = param.d * param.d; + const F_FLOAT hcth = param.h - cos; const F_FLOAT numerator = -2.0 * ters_c * hcth; const F_FLOAT denominator = 1.0/(ters_d + hcth*hcth); - gijk = paramskk(i,j,k).gamma*(1.0 + ters_c/ters_d - ters_c*denominator); - dgijk = paramskk(i,j,k).gamma * numerator * denominator * denominator; + gijk = param.gamma*(1.0 + ters_c/ters_d - ters_c*denominator); + dgijk = param.gamma * numerator * denominator * denominator; } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::ters_fa_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffKokkos::ters_fa_k(const Param& param, const F_FLOAT &r) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) - * ters_fc_k(i,j,k,r); + if (r > param.bigr + param.bigd) return 0.0; + return -param.bigb * exp(-param.lam2 * r) + * ters_fc_k(param,r); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffKokkos::ters_dfa(const Param& param, const F_FLOAT &r) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * - (paramskk(i,j,k).lam2 * ters_fc_k(i,j,k,r) - ters_dfc(i,j,k,r)); + if (r > param.bigr + param.bigd) return 0.0; + return param.bigb * exp(-param.lam2 * r) * + (param.lam2 * ters_fc_k(param,r) - ters_dfc(param,r)); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::ters_fa_k_and_ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r, double &fa, double &dfa) const +void PairTersoffKokkos::ters_fa_k_and_ters_dfa(const Param& param, const F_FLOAT &r, double &fa, double &dfa) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) { + if (r > param.bigr + param.bigd) { fa = 0.0; dfa = 0.0; } else { - double tmp1 = paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r); + double tmp1 = param.bigb * exp(-param.lam2 * r); F_FLOAT fc_k, dfc; - ters_fc_k_and_ters_dfc(i,j,k,r,fc_k,dfc); + ters_fc_k_and_ters_dfc(param,r,fc_k,dfc); fa = -tmp1 * fc_k; - dfa = tmp1 * (paramskk(i,j,k).lam2 * fc_k - dfc); + dfa = tmp1 * (param.lam2 * fc_k - dfc); } } @@ -961,82 +656,79 @@ void PairTersoffKokkos::ters_fa_k_and_ters_dfa(const int &i, const i template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::ters_bij_k(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const +double PairTersoffKokkos::ters_bij_k(const Param& param, const F_FLOAT &bo) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).c1) return 1.0/sqrt(tmp); - if (tmp > paramskk(i,j,k).c2) - return (1.0 - pow(tmp,-paramskk(i,j,k).powern) / (2.0*paramskk(i,j,k).powern))/sqrt(tmp); - if (tmp < paramskk(i,j,k).c4) return 1.0; - if (tmp < paramskk(i,j,k).c3) - return 1.0 - pow(tmp,paramskk(i,j,k).powern)/(2.0*paramskk(i,j,k).powern); - return pow(1.0 + pow(tmp,paramskk(i,j,k).powern), -1.0/(2.0*paramskk(i,j,k).powern)); + const F_FLOAT tmp = param.beta * bo; + if (tmp > param.c1) return 1.0/sqrt(tmp); + if (tmp > param.c2) + return (1.0 - pow(tmp,-param.powern) / (2.0*param.powern))/sqrt(tmp); + if (tmp < param.c4) return 1.0; + if (tmp < param.c3) + return 1.0 - pow(tmp,param.powern)/(2.0*param.powern); + return pow(1.0 + pow(tmp,param.powern), -1.0/(2.0*param.powern)); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffKokkos::ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const +double PairTersoffKokkos::ters_dbij(const Param& param, const F_FLOAT &bo) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; + const F_FLOAT tmp = param.beta * bo; const F_FLOAT factor = -0.5/sqrt(tmp*tmp*tmp); //pow(tmp,-1.5) - if (tmp > paramskk(i,j,k).c1) return paramskk(i,j,k).beta * factor; - if (tmp > paramskk(i,j,k).c2) - return paramskk(i,j,k).beta * (factor * + if (tmp > param.c1) return param.beta * factor; + if (tmp > param.c2) + return param.beta * (factor * // error in negligible 2nd term fixed 2/21/2022 - // (1.0 - 0.5*(1.0 + 1.0/(2.0*paramskk(i,j,k).powern)) * - (1.0 - (1.0 + 1.0/(2.0*paramskk(i,j,k).powern)) * - pow(tmp,-paramskk(i,j,k).powern))); - if (tmp < paramskk(i,j,k).c4) return 0.0; - if (tmp < paramskk(i,j,k).c3) - return -0.5*paramskk(i,j,k).beta * pow(tmp,paramskk(i,j,k).powern-1.0); + // (1.0 - 0.5*(1.0 + 1.0/(2.0*param.powern)) * + (1.0 - (1.0 + 1.0/(2.0*param.powern)) * + pow(tmp,-param.powern))); + if (tmp < param.c4) return 0.0; + if (tmp < param.c3) + return -0.5*param.beta * pow(tmp,param.powern-1.0); - const F_FLOAT tmp_n = pow(tmp,paramskk(i,j,k).powern); - return -0.5 * pow(1.0+tmp_n, -1.0-(1.0/(2.0*paramskk(i,j,k).powern)))*tmp_n / bo; + const F_FLOAT tmp_n = pow(tmp,param.powern); + return -0.5 * pow(1.0+tmp_n, -1.0-(1.0/(2.0*param.powern)))*tmp_n / bo; } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::ters_bij_k_and_ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo, double& bij, double& prefactor) const +void PairTersoffKokkos::ters_bij_k_and_ters_dbij(const Param& param, const F_FLOAT &bo, double& bij, double& prefactor) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; + const F_FLOAT tmp = param.beta * bo; const F_FLOAT factor = -0.5/sqrt(tmp*tmp*tmp); //pow(tmp,-1.5) - if (tmp > paramskk(i,j,k).c1) { + if (tmp > param.c1) { bij = 1.0/sqrt(tmp); - prefactor = paramskk(i,j,k).beta * factor; + prefactor = param.beta * factor; return; } - auto prm_ijk_pn = paramskk(i,j,k).powern; + auto prm_ijk_pn = param.powern; - if (tmp > paramskk(i,j,k).c2) { + if (tmp > param.c2) { auto tmp_pow_neg_prm_ijk_pn = pow(tmp,-prm_ijk_pn); bij = (1.0 - tmp_pow_neg_prm_ijk_pn / (2.0*prm_ijk_pn))/sqrt(tmp); - prefactor = paramskk(i,j,k).beta * (factor * + prefactor = param.beta * (factor * (1.0 - 0.5*(1.0 + 1.0/(2.0*prm_ijk_pn)) * tmp_pow_neg_prm_ijk_pn)); return; } - if (tmp < paramskk(i,j,k).c4) { + if (tmp < param.c4) { bij = 1.0; prefactor = 0.0; return; } - if (tmp < paramskk(i,j,k).c3) { + if (tmp < param.c3) { auto tmp_pow_prm_ijk_pn_less_one = pow(tmp,prm_ijk_pn-1.0); bij = 1.0 - tmp_pow_prm_ijk_pn_less_one*tmp/(2.0*prm_ijk_pn); - prefactor = -0.5*paramskk(i,j,k).beta * tmp_pow_prm_ijk_pn_less_one; + prefactor = -0.5*param.beta * tmp_pow_prm_ijk_pn_less_one; return; } - const F_FLOAT tmp_n = pow(tmp,paramskk(i,j,k).powern); + const F_FLOAT tmp_n = pow(tmp,param.powern); bij = pow(1.0 + tmp_n, -1.0/(2.0*prm_ijk_pn)); prefactor = -0.5 * pow(1.0+tmp_n, -1.0-(1.0/(2.0*prm_ijk_pn)))*tmp_n / bo; } @@ -1046,7 +738,7 @@ void PairTersoffKokkos::ters_bij_k_and_ters_dbij(const int &i, const template KOKKOS_INLINE_FUNCTION void PairTersoffKokkos::ters_dthb( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const @@ -1071,23 +763,23 @@ void PairTersoffKokkos::ters_dthb( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - ters_fc_k_and_ters_dfc(i,j,k,rik,fc,dfc); + ters_fc_k_and_ters_dfc(param,rik,fc,dfc); - const F_FLOAT param = paramskk(i,j,k).lam3 * (rij-rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = param*param*param;//pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = param; + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*param*param*paramskk(i,j,k).lam3*ex_delr;//pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - ters_gijk_and_ters_dgijk(i,j,k,cos,gijk,dgijk); + ters_gijk_and_ters_dgijk(param,cos,gijk,dgijk); // from PairTersoff::costheta_d vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); @@ -1119,7 +811,7 @@ void PairTersoffKokkos::ters_dthb( template KOKKOS_INLINE_FUNCTION void PairTersoffKokkos::ters_dthbj( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fj, F_FLOAT *fk) const @@ -1140,23 +832,23 @@ void PairTersoffKokkos::ters_dthbj( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - const F_FLOAT param = paramskk(i,j,k).lam3 * (rij-rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = param*param*param;//pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = param;//paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*param*param*paramskk(i,j,k).lam3*ex_delr;//pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(param.lam3,3.0) * pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); vec3_scale(rijinv,dcosfj,dcosfj); @@ -1181,7 +873,7 @@ void PairTersoffKokkos::ters_dthbj( template KOKKOS_INLINE_FUNCTION void PairTersoffKokkos::ters_dthbk( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fk) const @@ -1202,23 +894,23 @@ void PairTersoffKokkos::ters_dthbk( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - const F_FLOAT param = paramskk(i,j,k).lam3 * (rij-rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = param*param*param;//pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = param;//paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*param*param*paramskk(i,j,k).lam3*ex_delr;//pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(param.lam3,3.0) * pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); vec3_scale(rijinv,dcosfj,dcosfj); @@ -1242,8 +934,6 @@ void PairTersoffKokkos::ev_tally(EV_FLOAT &ev, const int &i, const i const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const { - const int VFLAG = vflag_either; - // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); @@ -1255,10 +945,10 @@ void PairTersoffKokkos::ev_tally(EV_FLOAT &ev, const int &i, const i if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; a_eatom[i] += epairhalf; - if (NEIGHFLAG != FULL) a_eatom[j] += epairhalf; + a_eatom[j] += epairhalf; } - if (VFLAG) { + if (vflag_either) { const E_FLOAT v0 = delx*delx*fpair; const E_FLOAT v1 = dely*dely*fpair; const E_FLOAT v2 = delz*delz*fpair; @@ -1267,21 +957,12 @@ void PairTersoffKokkos::ev_tally(EV_FLOAT &ev, const int &i, const i const E_FLOAT v5 = dely*delz*fpair; if (vflag_global) { - if (NEIGHFLAG != FULL) { - ev.v[0] += v0; - ev.v[1] += v1; - ev.v[2] += v2; - ev.v[3] += v3; - ev.v[4] += v4; - ev.v[5] += v5; - } else { - ev.v[0] += 0.5*v0; - ev.v[1] += 0.5*v1; - ev.v[2] += 0.5*v2; - ev.v[3] += 0.5*v3; - ev.v[4] += 0.5*v4; - ev.v[5] += 0.5*v5; - } + ev.v[0] += v0; + ev.v[1] += v1; + ev.v[2] += v2; + ev.v[3] += v3; + ev.v[4] += v4; + ev.v[5] += v5; } if (vflag_atom) { @@ -1292,14 +973,12 @@ void PairTersoffKokkos::ev_tally(EV_FLOAT &ev, const int &i, const i a_vatom(i,4) += 0.5*v4; a_vatom(i,5) += 0.5*v5; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += 0.5*v0; - a_vatom(j,1) += 0.5*v1; - a_vatom(j,2) += 0.5*v2; - a_vatom(j,3) += 0.5*v3; - a_vatom(j,4) += 0.5*v4; - a_vatom(j,5) += 0.5*v5; - } + a_vatom(j,0) += 0.5*v0; + a_vatom(j,1) += 0.5*v1; + a_vatom(j,2) += 0.5*v2; + a_vatom(j,3) += 0.5*v3; + a_vatom(j,4) += 0.5*v4; + a_vatom(j,5) += 0.5*v5; } } } @@ -1309,7 +988,8 @@ void PairTersoffKokkos::ev_tally(EV_FLOAT &ev, const int &i, const i template template KOKKOS_INLINE_FUNCTION -void PairTersoffKokkos::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, +void PairTersoffKokkos::v_tally3(EV_FLOAT &ev, + const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const { // The vatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -1345,12 +1025,12 @@ void PairTersoffKokkos::v_tally3(EV_FLOAT &ev, const int &i, const i a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += v[0]; a_vatom(j,1) += v[1]; a_vatom(j,2) += v[2]; - a_vatom(j,3) += v[3]; a_vatom(j,4) += v[4]; a_vatom(j,5) += v[5]; - a_vatom(k,0) += v[0]; a_vatom(k,1) += v[1]; a_vatom(k,2) += v[2]; - a_vatom(k,3) += v[3]; a_vatom(k,4) += v[4]; a_vatom(k,5) += v[5]; - } + + a_vatom(j,0) += v[0]; a_vatom(j,1) += v[1]; a_vatom(j,2) += v[2]; + a_vatom(j,3) += v[3]; a_vatom(j,4) += v[4]; a_vatom(j,5) += v[5]; + + a_vatom(k,0) += v[0]; a_vatom(k,1) += v[1]; a_vatom(k,2) += v[2]; + a_vatom(k,3) += v[3]; a_vatom(k,4) += v[4]; a_vatom(k,5) += v[5]; } } @@ -1359,7 +1039,8 @@ void PairTersoffKokkos::v_tally3(EV_FLOAT &ev, const int &i, const i template KOKKOS_INLINE_FUNCTION void PairTersoffKokkos::v_tally3_atom(EV_FLOAT &ev, const int &i, const int & /*j*/, - const int & /*k*/, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const + const int & /*k*/, F_FLOAT *fj, F_FLOAT *fk, + F_FLOAT *drji, F_FLOAT *drjk) const { F_FLOAT v[6]; diff --git a/src/KOKKOS/pair_tersoff_kokkos.h b/src/KOKKOS/pair_tersoff_kokkos.h index 3a7ef417d2..ecd54a77fa 100644 --- a/src/KOKKOS/pair_tersoff_kokkos.h +++ b/src/KOKKOS/pair_tersoff_kokkos.h @@ -30,20 +30,14 @@ PairStyle(tersoff/kk/host,PairTersoffKokkos); namespace LAMMPS_NS { template -struct TagPairTersoffComputeHalf{}; - -template -struct TagPairTersoffComputeFullA{}; - -template -struct TagPairTersoffComputeFullB{}; +struct TagPairTersoffCompute{}; struct TagPairTersoffComputeShortNeigh{}; template class PairTersoffKokkos : public PairTersoff { public: - enum {EnabledNeighFlags=FULL}; + enum {EnabledNeighFlags=HALF|HALFTHREAD}; enum {COUL_FLAG=0}; typedef DeviceType device_type; typedef ArrayTypes AT; @@ -52,90 +46,75 @@ class PairTersoffKokkos : public PairTersoff { PairTersoffKokkos(class LAMMPS *); ~PairTersoffKokkos() override; void compute(int, int) override; + void coeff(int, char **) override; void init_style() override; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffComputeHalf, const int&, EV_FLOAT&) const; + void operator()(TagPairTersoffCompute, const int&, EV_FLOAT&) const; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffComputeHalf, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffComputeFullA, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffComputeFullA, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffComputeFullB, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffComputeFullB, const int&) const; + void operator()(TagPairTersoffCompute, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffComputeShortNeigh, const int&) const; KOKKOS_INLINE_FUNCTION - double ters_fc_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_fc_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_dfc(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - void ters_fc_k_and_ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r, double &fc, double &dfc) const; + void ters_fc_k_and_ters_dfc(const Param& param, const F_FLOAT &r, double &fc, double &dfc) const; KOKKOS_INLINE_FUNCTION - double ters_fa_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_fa_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_dfa(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - void ters_fa_k_and_ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r, double &fa, double &dfa) const; + void ters_fa_k_and_ters_dfa(const Param& param, const F_FLOAT &r, double &fa, double &dfa) const; KOKKOS_INLINE_FUNCTION - double ters_bij_k(const int &i, const int &j, const int &k, const F_FLOAT &bo) const; + double ters_bij_k(const Param& param, const F_FLOAT &bo) const; KOKKOS_INLINE_FUNCTION - double ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo) const; + double ters_dbij(const Param& param, const F_FLOAT &bo) const; KOKKOS_INLINE_FUNCTION - void ters_bij_k_and_ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo, double &bij, double &prefactor) const; + void ters_bij_k_and_ters_dbij(const Param& param, const F_FLOAT &bo, double &bij, double &prefactor) const; KOKKOS_INLINE_FUNCTION - double bondorder(const int &i, const int &j, const int &k, + double bondorder(const Param& param, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const; KOKKOS_INLINE_FUNCTION - double ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const; + double ters_gijk(const Param& param, const F_FLOAT &cos) const; KOKKOS_INLINE_FUNCTION - double ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const; + double ters_dgijk(const Param& param, const F_FLOAT &cos) const; KOKKOS_INLINE_FUNCTION - void ters_gijk_and_ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos, double& gijk, double& dgijk) const; + void ters_gijk_and_ters_dgijk(const Param& param, const F_FLOAT &cos, double& gijk, double& dgijk) const; KOKKOS_INLINE_FUNCTION - void ters_dthb(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + void ters_dthb(const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION - void ters_dthbj(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + void ters_dthbj(const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fj, F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION - void ters_dthbk(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + void ters_dthbk(const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fk) const; @@ -163,17 +142,6 @@ class PairTersoffKokkos : public PairTersoff { KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const; - struct params_ters{ - KOKKOS_INLINE_FUNCTION - params_ters() {powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0; - bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;}; - KOKKOS_INLINE_FUNCTION - params_ters(int /*i*/) {powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0; - bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;}; - F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr, - bigd, lam1, biga, cutsq, c1, c2, c3, c4; - }; - template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -189,16 +157,21 @@ class PairTersoffKokkos : public PairTersoff { void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; - void allocate() override; void setup_params() override; protected: typedef Kokkos::DualView tdual_int_3d; - Kokkos::DualView k_params; - typename Kokkos::DualView::t_dev_const_um paramskk; - // hardwired to space for 12 atom types - //params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; + typedef typename tdual_int_3d::t_dev_const_randomread t_int_3d_randomread; + typedef typename tdual_int_3d::t_host t_host_int_3d; + + t_int_3d_randomread d_elem3param; + typename AT::t_int_1d_randomread d_map; + + typedef Kokkos::DualView tdual_param_1d; + typedef typename tdual_param_1d::t_dev t_param_1d; + typedef typename tdual_param_1d::t_host t_host_param_1d; + + t_param_1d d_params; int inum; typename AT::t_x_array_randomread x; @@ -252,14 +225,3 @@ class PairTersoffKokkos : public PairTersoff { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot (yet) use full neighbor list style with tersoff/kk - -Self-explanatory. - -E: Cannot use chosen neighbor list style with tersoff/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp index 2f354a93a9..203cfba134 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.cpp @@ -65,18 +65,29 @@ PairTersoffMODKokkos::~PairTersoffMODKokkos() } } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ template -void PairTersoffMODKokkos::allocate() +void PairTersoffMODKokkos::coeff(int narg, char **arg) { - PairTersoffMOD::allocate(); + PairTersoffMOD::coeff(narg,arg); + + // sync map int n = atom->ntypes; - k_params = Kokkos::DualView - ("PairTersoffMOD::paramskk",n+1,n+1,n+1); - paramskk = k_params.template view(); + DAT::tdual_int_1d k_map = DAT::tdual_int_1d("pair:map",n+1); + HAT::t_int_1d h_map = k_map.h_view; + + for (int i = 1; i <= n; i++) + h_map[i] = map[i]; + + k_map.template modify(); + k_map.template sync(); + + d_map = k_map.template view(); } /* ---------------------------------------------------------------------- @@ -95,8 +106,9 @@ void PairTersoffMODKokkos::init_style() request->set_kokkos_host(std::is_same::value && !std::is_same::value); request->set_kokkos_device(std::is_same::value); + if (neighflag == FULL) - error->all(FLERR,"Cannot (yet) use full neighbor list style with tersoff/mod/kk"); + error->all(FLERR,"Must use half neighbor list style with pair tersoff/kk"); } /* ---------------------------------------------------------------------- */ @@ -106,37 +118,29 @@ void PairTersoffMODKokkos::setup_params() { PairTersoffMOD::setup_params(); - int i,j,k,m; - int n = atom->ntypes; + // sync elem3param and params - for (i = 1; i <= n; i++) - for (j = 1; j <= n; j++) - for (k = 1; k <= n; k++) { - m = elem3param[map[i]][map[j]][map[k]]; - k_params.h_view(i,j,k).powerm = params[m].powerm; - k_params.h_view(i,j,k).lam3 = params[m].lam3; - k_params.h_view(i,j,k).h = params[m].h; - k_params.h_view(i,j,k).powern = params[m].powern; - k_params.h_view(i,j,k).beta = params[m].beta; - k_params.h_view(i,j,k).lam2 = params[m].lam2; - k_params.h_view(i,j,k).bigb = params[m].bigb; - k_params.h_view(i,j,k).bigr = params[m].bigr; - k_params.h_view(i,j,k).bigd = params[m].bigd; - k_params.h_view(i,j,k).lam1 = params[m].lam1; - k_params.h_view(i,j,k).biga = params[m].biga; - k_params.h_view(i,j,k).cutsq = params[m].cutsq; - k_params.h_view(i,j,k).c1 = params[m].c1; - k_params.h_view(i,j,k).c2 = params[m].c2; - k_params.h_view(i,j,k).c3 = params[m].c3; - k_params.h_view(i,j,k).c4 = params[m].c4; - k_params.h_view(i,j,k).c5 = params[m].c5; - k_params.h_view(i,j,k).ca1 = params[m].ca1; - k_params.h_view(i,j,k).ca4 = params[m].ca4; - k_params.h_view(i,j,k).powern_del = params[m].powern_del; - } + tdual_int_3d k_elem3param = tdual_int_3d("pair:elem3param",nelements,nelements,nelements); + t_host_int_3d h_elem3param = k_elem3param.h_view; - k_params.template modify(); + tdual_param_1d k_params = tdual_param_1d("pair:params",nparams); + t_host_param_1d h_params = k_params.h_view; + for (int i = 0; i < nelements; i++) + for (int j = 0; j < nelements; j++) + for (int k = 0; k < nelements; k++) + h_elem3param(i,j,k) = elem3param[i][j][k]; + + for (int m = 0; m < nparams; m++) + h_params[m] = params[m]; + + k_elem3param.modify_host(); + k_elem3param.template sync(); + k_params.modify_host(); + k_params.template sync(); + + d_elem3param = k_elem3param.template view(); + d_params = k_params.template view(); } /* ---------------------------------------------------------------------- */ @@ -147,8 +151,6 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (neighflag == FULL) no_virial_fdotr_compute = 1; - ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary @@ -165,7 +167,6 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) } atomKK->sync(execution_space,datamask_read); - k_params.template sync(); if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); else atomKK->modified(execution_space,F_MASK); @@ -204,37 +205,25 @@ void PairTersoffMODKokkos::compute(int eflag_in, int vflag_in) int max_neighs = d_neighbors.extent(1); - if (((int)d_neighbors_short.extent(1) != max_neighs) || - ((int)d_neighbors_short.extent(0) != ignum)) { - d_neighbors_short = Kokkos::View("Tersoff::neighbors_short",ignum,max_neighs); + if (((int)d_neighbors_short.extent(1) < max_neighs) || + ((int)d_neighbors_short.extent(0) < ignum)) { + d_neighbors_short = Kokkos::View("Tersoff::neighbors_short",ignum*1.2,max_neighs); } - if ((int)d_numneigh_short.extent(0)!=ignum) - d_numneigh_short = Kokkos::View("Tersoff::numneighs_short",ignum); - Kokkos::parallel_for(Kokkos::RangePolicy(0,neighflag==FULL?ignum:inum), *this); + if ((int)d_numneigh_short.extent(0) < ignum) + d_numneigh_short = Kokkos::View("Tersoff::numneighs_short",ignum*1.2); + Kokkos::parallel_for(Kokkos::RangePolicy(0,inum), *this); if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - } else if (neighflag == FULL) { - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } @@ -286,6 +275,7 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeShortN const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); const X_FLOAT ztmp = x(i,2); + const F_FLOAT cutmax_sq = cutmax*cutmax; const int jnum = d_numneigh[i]; int inside = 0; @@ -298,12 +288,12 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeShortN const X_FLOAT delz = ztmp - x(j,2); const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - if (rsq < cutmax*cutmax) { - d_neighbors_short(i,inside) = j; + if (rsq < cutmax_sq) { + d_neighbors_short(ii,inside) = j; inside++; } } - d_numneigh_short(i) = inside; + d_numneigh_short(ii) = inside; } /* ---------------------------------------------------------------------- */ @@ -311,25 +301,25 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeShortN template template KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf, const int &ii, EV_FLOAT& ev) const { +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access>(); + const auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + const auto a_f = v_f.template access>(); const int i = d_ilist[ii]; if (i >= nlocal) return; const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); const X_FLOAT ztmp = x(i,2); - const int itype = type(i); + const int itype = d_map(type(i)); const tagint itag = tag(i); F_FLOAT fi[3], fj[3], fk[3]; //const AtomNeighborsConst d_neighbors_i = k_list.get_neighbors_const(i); - const int jnum = d_numneigh_short[i]; + const int jnum = d_numneigh_short[ii]; // repulsive @@ -338,9 +328,8 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf jtag) { @@ -357,17 +346,18 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf cutsq) continue; + if (rsq >= cutsq) continue; const F_FLOAT r = sqrt(rsq); - const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); - const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); - const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * - (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / r; - const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; + const F_FLOAT tmp_fce = ters_fc_k(d_params(iparam_ij),r); + const F_FLOAT tmp_fcd = ters_dfc(d_params(iparam_ij),r); + const F_FLOAT tmp_exp = exp(-d_params(iparam_ij).lam1 * r); + const F_FLOAT frep = -d_params(iparam_ij).biga * tmp_exp * + (tmp_fcd - tmp_fce*d_params(iparam_ij).lam1) / r; + const F_FLOAT eng = tmp_fce * d_params(iparam_ij).biga * tmp_exp; f_x += delx*frep; f_y += dely*frep; @@ -385,15 +375,15 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf cutsq1) continue; @@ -401,28 +391,28 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf cutsq2) continue; const F_FLOAT rik = sqrt(rsq2); - bo_ij += bondorder(itype,jtype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); + bo_ij += bondorder(d_params(iparam_ijk),rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); } // attractive: pairwise potential and force - const F_FLOAT fa = ters_fa_k(itype,jtype,jtype,rij); - const F_FLOAT dfa = ters_dfa(itype,jtype,jtype,rij); - const F_FLOAT bij = ters_bij_k(itype,jtype,jtype,bo_ij); + const F_FLOAT fa = ters_fa_k(d_params(iparam_ij),rij); + const F_FLOAT dfa = ters_dfa(d_params(iparam_ij),rij); + const F_FLOAT bij = ters_bij_k(d_params(iparam_ij),bo_ij); const F_FLOAT fatt = -0.5*bij * dfa / rij; - const F_FLOAT prefactor = 0.5*fa * ters_dbij(itype,jtype,jtype,bo_ij); + const F_FLOAT prefactor = 0.5*fa * ters_dbij(d_params(iparam_ij),bo_ij); f_x += delx1*fatt; f_y += dely1*fatt; @@ -435,26 +425,26 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalftemplate ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); + this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); } // attractive: three-body force for (int kk = 0; kk < jnum; kk++) { if (jj == kk) continue; - int k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - const int ktype = type(k); + int k = d_neighbors_short(ii,kk); + const int ktype = d_map(type(k)); const F_FLOAT delx2 = xtmp - x(k,0); const F_FLOAT dely2 = ytmp - x(k,1); const F_FLOAT delz2 = ztmp - x(k,2); const F_FLOAT rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - const F_FLOAT cutsq2 = paramskk(itype,jtype,ktype).cutsq; + const int iparam_ijk = d_elem3param(itype,jtype,ktype); + const F_FLOAT cutsq2 = d_params(iparam_ijk).cutsq; if (rsq2 > cutsq2) continue; const F_FLOAT rik = sqrt(rsq2); - ters_dthb(itype,jtype,ktype,prefactor,rij,delx1,dely1,delz1, + ters_dthb(d_params(iparam_ijk),prefactor,rij,delx1,dely1,delz1, rik,delx2,dely2,delz2,fi,fj,fk); f_x += fi[0]; @@ -474,6 +464,7 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalftemplate v_tally3(ev,i,j,k,fj,fk,delrij,delrik); } } + a_f(j,0) += fj_x; a_f(j,1) += fj_y; a_f(j,2) += fj_z; @@ -486,309 +477,19 @@ void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf template KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeHalf, const int &ii) const { +void PairTersoffMODKokkos::operator()(TagPairTersoffMODCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairTersoffMODComputeHalf(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeFullA, const int &ii, EV_FLOAT& ev) const { - - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); - - int j,k,jj,kk,jtype,ktype; - F_FLOAT rsq1, cutsq1, rsq2, cutsq2, rij, rik, bo_ij; - F_FLOAT fi[3], fj[3], fk[3]; - X_FLOAT delx1, dely1, delz1, delx2, dely2, delz2; - - //const AtomNeighborsConst d_neighbors_i = k_list.get_neighbors_const(i); - const int jnum = d_numneigh_short[i]; - - // repulsive - - F_FLOAT f_x = 0.0; - F_FLOAT f_y = 0.0; - F_FLOAT f_z = 0.0; - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - const int jtype = type(j); - - const X_FLOAT delx = xtmp - x(j,0); - const X_FLOAT dely = ytmp - x(j,1); - const X_FLOAT delz = ztmp - x(j,2); - const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - const F_FLOAT cutsq = paramskk(itype,jtype,jtype).cutsq; - - if (rsq > cutsq) continue; - - const F_FLOAT r = sqrt(rsq); - const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); - const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); - const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep = -paramskk(itype,jtype,jtype).biga * tmp_exp * - (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1) / r; - const F_FLOAT eng = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; - - f_x += delx*frep; - f_y += dely*frep; - f_z += delz*frep; - - if (EVFLAG) { - if (eflag) - ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,frep,delx,dely,delz); - } - } - - // attractive: bond order - - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - jtype = type(j); - - delx1 = xtmp - x(j,0); - dely1 = ytmp - x(j,1); - delz1 = ztmp - x(j,2); - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - cutsq1 = paramskk(itype,jtype,jtype).cutsq; - - bo_ij = 0.0; - if (rsq1 > cutsq1) continue; - rij = sqrt(rsq1); - - for (kk = 0; kk < jnum; kk++) { - if (jj == kk) continue; - k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - ktype = type(k); - - delx2 = xtmp - x(k,0); - dely2 = ytmp - x(k,1); - delz2 = ztmp - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(itype,jtype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - bo_ij += bondorder(itype,jtype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); - } - - // attractive: pairwise potential and force - - const F_FLOAT fa = ters_fa_k(itype,jtype,jtype,rij); - const F_FLOAT dfa = ters_dfa(itype,jtype,jtype,rij); - const F_FLOAT bij = ters_bij_k(itype,jtype,jtype,bo_ij); - const F_FLOAT fatt = -0.5*bij * dfa / rij; - const F_FLOAT prefactor = 0.5*fa * ters_dbij(itype,jtype,jtype,bo_ij); - const F_FLOAT eng = 0.5*bij * fa; - - f_x += delx1*fatt; - f_y += dely1*fatt; - f_z += delz1*fatt; - - if (EVFLAG) { - if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); - } - - // attractive: three-body force - - for (kk = 0; kk < jnum; kk++) { - if (jj == kk) continue; - k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - ktype = type(k); - - delx2 = xtmp - x(k,0); - dely2 = ytmp - x(k,1); - delz2 = ztmp - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(itype,jtype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - ters_dthb(itype,jtype,ktype,prefactor,rij,delx1,dely1,delz1, - rik,delx2,dely2,delz2,fi,fj,fk); - - f_x += fi[0]; - f_y += fi[1]; - f_z += fi[2]; - - if (vflag_either) { - F_FLOAT delrij[3], delrik[3]; - delrij[0] = -delx1; delrij[1] = -dely1; delrij[2] = -delz1; - delrik[0] = -delx2; delrik[1] = -dely2; delrik[2] = -delz2; - if (vflag_either) this->template v_tally3(ev,i,j,k,fj,fk,delrij,delrik); - } - } - } - f(i,0) += f_x; - f(i,1) += f_y; - f(i,2) += f_z; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeFullA, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairTersoffMODComputeFullA(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeFullB, const int &ii, EV_FLOAT& ev) const { - - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); - - int j,k,jj,kk,jtype,ktype,j_jnum; - F_FLOAT rsq1, cutsq1, rsq2, cutsq2, rij, rik, bo_ij; - F_FLOAT fj[3], fk[3]; - X_FLOAT delx1, dely1, delz1, delx2, dely2, delz2; - - const int jnum = d_numneigh_short[i]; - - F_FLOAT f_x = 0.0; - F_FLOAT f_y = 0.0; - F_FLOAT f_z = 0.0; - - // attractive: bond order - - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - if (j >= nlocal) continue; - jtype = type(j); - - delx1 = x(j,0) - xtmp; - dely1 = x(j,1) - ytmp; - delz1 = x(j,2) - ztmp; - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - cutsq1 = paramskk(jtype,itype,itype).cutsq; - - bo_ij = 0.0; - if (rsq1 > cutsq1) continue; - rij = sqrt(rsq1); - - j_jnum = d_numneigh_short[j]; - - for (kk = 0; kk < j_jnum; kk++) { - k = d_neighbors_short(j,kk); - if (k == i) continue; - k &= NEIGHMASK; - ktype = type(k); - - delx2 = x(j,0) - x(k,0); - dely2 = x(j,1) - x(k,1); - delz2 = x(j,2) - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(jtype,itype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - bo_ij += bondorder(jtype,itype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); - - } - - // attractive: pairwise potential and force - - const F_FLOAT fa = ters_fa_k(jtype,itype,itype,rij); - const F_FLOAT dfa = ters_dfa(jtype,itype,itype,rij); - const F_FLOAT bij = ters_bij_k(jtype,itype,itype,bo_ij); - const F_FLOAT fatt = -0.5*bij * dfa / rij; - const F_FLOAT prefactor = 0.5*fa * ters_dbij(jtype,itype,itype,bo_ij); - const F_FLOAT eng = 0.5*bij * fa; - - f_x -= delx1*fatt; - f_y -= dely1*fatt; - f_z -= delz1*fatt; - - if (EVFLAG) { - if (eflag) - ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); - } - - // attractive: three-body force - - for (kk = 0; kk < j_jnum; kk++) { - k = d_neighbors_short(j,kk); - if (k == i) continue; - k &= NEIGHMASK; - ktype = type(k); - - delx2 = x(j,0) - x(k,0); - dely2 = x(j,1) - x(k,1); - delz2 = x(j,2) - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(jtype,itype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - ters_dthbj(jtype,itype,ktype,prefactor,rij,delx1,dely1,delz1, - rik,delx2,dely2,delz2,fj,fk); - f_x += fj[0]; - f_y += fj[1]; - f_z += fj[2]; - - if (vflag_either) { - F_FLOAT delrji[3], delrjk[3]; - delrji[0] = -delx1; delrji[1] = -dely1; delrji[2] = -delz1; - delrjk[0] = -delx2; delrjk[1] = -dely2; delrjk[2] = -delz2; - if (vflag_either) v_tally3_atom(ev,i,j,k,fj,fk,delrji,delrjk); - } - - const F_FLOAT fa_jk = ters_fa_k(jtype,ktype,itype,rik); - const F_FLOAT prefactor_jk = 0.5*fa_jk * ters_dbij(jtype,ktype,itype,bo_ij); - ters_dthbk(jtype,ktype,itype,prefactor_jk,rik,delx2,dely2,delz2, - rij,delx1,dely1,delz1,fk); - f_x += fk[0]; - f_y += fk[1]; - f_z += fk[2]; - } - } - f(i,0) += f_x; - f(i,1) += f_y; - f(i,2) += f_z; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffMODKokkos::operator()(TagPairTersoffMODComputeFullB, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairTersoffMODComputeFullB(), ii, ev); + this->template operator()(TagPairTersoffMODCompute(), ii, ev); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::ters_fc_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffMODKokkos::ters_fc_k(const Param& param, const F_FLOAT &r) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) return 1.0; if (r > ters_R+ters_D) return 0.0; @@ -800,11 +501,10 @@ double PairTersoffMODKokkos::ters_fc_k(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffMODKokkos::ters_dfc(const Param& param, const F_FLOAT &r) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) return 0.0; if (r > ters_R+ters_D) return 0.0; @@ -816,7 +516,7 @@ double PairTersoffMODKokkos::ters_dfc(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::bondorder(const int &i, const int &j, const int &k, +double PairTersoffMODKokkos::bondorder(const Param& param, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const { @@ -824,14 +524,15 @@ double PairTersoffMODKokkos::bondorder(const int &i, const int &j, c const F_FLOAT costheta = (dx1*dx2 + dy1*dy2 + dz1*dz2)/(rij*rik); - if (int(paramskk(i,j,k).powerm) == 3) arg = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else arg = paramskk(i,j,k).lam3 * (rij-rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) arg = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else arg = paramtmp; if (arg > 69.0776) ex_delr = 1.e30; else if (arg < -69.0776) ex_delr = 0.0; else ex_delr = exp(arg); - return ters_fc_k(i,j,k,rik) * ters_gijk(i,j,k,costheta) * ex_delr; + return ters_fc_k(param,rik) * ters_gijk(param,costheta) * ex_delr; } /* ---------------------------------------------------------------------- */ @@ -839,14 +540,14 @@ double PairTersoffMODKokkos::bondorder(const int &i, const int &j, c template KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos:: - ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const + ters_gijk(const Param& param, const F_FLOAT &cos) const { - const F_FLOAT ters_c1 = paramskk(i,j,k).c1; - const F_FLOAT ters_c2 = paramskk(i,j,k).c2; - const F_FLOAT ters_c3 = paramskk(i,j,k).c3; - const F_FLOAT ters_c4 = paramskk(i,j,k).c4; - const F_FLOAT ters_c5 = paramskk(i,j,k).c5; - const F_FLOAT tmp_h = (paramskk(i,j,k).h - cos)*(paramskk(i,j,k).h - cos); + const F_FLOAT ters_c1 = param.c1; + const F_FLOAT ters_c2 = param.c2; + const F_FLOAT ters_c3 = param.c3; + const F_FLOAT ters_c4 = param.c4; + const F_FLOAT ters_c5 = param.c5; + const F_FLOAT tmp_h = (param.h - cos)*(param.h - cos); return ters_c1 + (ters_c2*tmp_h/(ters_c3 + tmp_h)) * (1.0 + ters_c4*exp(-ters_c5*tmp_h)); @@ -858,17 +559,17 @@ double PairTersoffMODKokkos:: template KOKKOS_INLINE_FUNCTION double PairTersoffMODKokkos:: - ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const + ters_dgijk(const Param& param, const F_FLOAT &cos) const { - const F_FLOAT ters_c2 = paramskk(i,j,k).c2; - const F_FLOAT ters_c3 = paramskk(i,j,k).c3; - const F_FLOAT ters_c4 = paramskk(i,j,k).c4; - const F_FLOAT ters_c5 = paramskk(i,j,k).c5; - const F_FLOAT tmp_h = (paramskk(i,j,k).h - cos)*(paramskk(i,j,k).h - cos); - const F_FLOAT g1 = (paramskk(i,j,k).h - cos)/(ters_c3 + tmp_h); + const F_FLOAT ters_c2 = param.c2; + const F_FLOAT ters_c3 = param.c3; + const F_FLOAT ters_c4 = param.c4; + const F_FLOAT ters_c5 = param.c5; + const F_FLOAT tmp_h = (param.h - cos)*(param.h - cos); + const F_FLOAT g1 = (param.h - cos)/(ters_c3 + tmp_h); const F_FLOAT g2 = exp(-ters_c5*tmp_h); - return -2.0*ters_c2*g1*((1 + ters_c4*g2)*(1 + g1*(cos - paramskk(i,j,k).h)) - + return -2.0*ters_c2*g1*((1 + ters_c4*g2)*(1 + g1*(cos - param.h)) - tmp_h*ters_c4*ters_c5*g2); } @@ -876,58 +577,54 @@ double PairTersoffMODKokkos:: template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::ters_fa_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffMODKokkos::ters_fa_k(const Param& param, const F_FLOAT &r) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) - * ters_fc_k(i,j,k,r); + if (r > param.bigr + param.bigd) return 0.0; + return -param.bigb * exp(-param.lam2 * r) + * ters_fc_k(param,r); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffMODKokkos::ters_dfa(const Param& param, const F_FLOAT &r) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * - (paramskk(i,j,k).lam2 * ters_fc_k(i,j,k,r) - ters_dfc(i,j,k,r)); + if (r > param.bigr + param.bigd) return 0.0; + return param.bigb * exp(-param.lam2 * r) * + (param.lam2 * ters_fc_k(param,r) - ters_dfc(param,r)); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::ters_bij_k(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const +double PairTersoffMODKokkos::ters_bij_k(const Param& param, const F_FLOAT &bo) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).ca1) - return pow(tmp, -paramskk(i,j,k).powern/(2.0*paramskk(i,j,k).powern_del)); - if (tmp < paramskk(i,j,k).ca4) + const F_FLOAT tmp = param.beta * bo; + if (tmp > param.ca1) + return pow(tmp, -param.powern/(2.0*param.powern_del)); + if (tmp < param.ca4) return 1.0; - return pow(1.0 + pow(tmp,paramskk(i,j,k).powern), -1.0/(2.0*paramskk(i,j,k).powern_del)); + return pow(1.0 + pow(tmp,param.powern), -1.0/(2.0*param.powern_del)); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffMODKokkos::ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const +double PairTersoffMODKokkos::ters_dbij(const Param& param, const F_FLOAT &bo) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).ca1) - return -0.5*(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)* - pow(tmp,-0.5*(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)) / bo; - if (tmp < paramskk(i,j,k).ca4) + const F_FLOAT tmp = param.beta * bo; + if (tmp > param.ca1) + return -0.5*(param.powern/param.powern_del)* + pow(tmp,-0.5*(param.powern/param.powern_del)) / bo; + if (tmp < param.ca4) return 0.0; - const F_FLOAT tmp_n = pow(tmp,paramskk(i,j,k).powern); - return -0.5 *(paramskk(i,j,k).powern/paramskk(i,j,k).powern_del)* - pow(1.0+tmp_n, -1.0-(1.0/(2.0*paramskk(i,j,k).powern_del)))*tmp_n / bo; + const F_FLOAT tmp_n = pow(tmp,param.powern); + return -0.5 *(param.powern/param.powern_del)* + pow(1.0+tmp_n, -1.0-(1.0/(2.0*param.powern_del)))*tmp_n / bo; } /* ---------------------------------------------------------------------- */ @@ -935,7 +632,7 @@ double PairTersoffMODKokkos::ters_dbij(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION void PairTersoffMODKokkos::ters_dthb( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const @@ -960,22 +657,24 @@ void PairTersoffMODKokkos::ters_dthb( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); // from PairTersoffMOD::costheta_d vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); @@ -1007,7 +706,7 @@ void PairTersoffMODKokkos::ters_dthb( template KOKKOS_INLINE_FUNCTION void PairTersoffMODKokkos::ters_dthbj( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fj, F_FLOAT *fk) const @@ -1028,22 +727,23 @@ void PairTersoffMODKokkos::ters_dthbj( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(param.lam3,3.0) * pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); vec3_scale(rijinv,dcosfj,dcosfj); @@ -1068,7 +768,7 @@ void PairTersoffMODKokkos::ters_dthbj( template KOKKOS_INLINE_FUNCTION void PairTersoffMODKokkos::ters_dthbk( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fk) const @@ -1089,22 +789,23 @@ void PairTersoffMODKokkos::ters_dthbk( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(param.lam3,3.0) * pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); vec3_scale(rijinv,dcosfj,dcosfj); @@ -1117,7 +818,6 @@ void PairTersoffMODKokkos::ters_dthbk( vec3_scaleadd(fc*dgijk*ex_delr,dcosfk,fk,fk); vec3_scaleadd(-fc*gijk*dex_delr,rik_hat,fk,fk); vec3_scale(prefactor,fk,fk); - } /* ---------------------------------------------------------------------- */ @@ -1129,8 +829,6 @@ void PairTersoffMODKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const { - const int VFLAG = vflag_either; - // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); @@ -1142,10 +840,10 @@ void PairTersoffMODKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; a_eatom[i] += epairhalf; - if (NEIGHFLAG != FULL) a_eatom[j] += epairhalf; + a_eatom[j] += epairhalf; } - if (VFLAG) { + if (vflag_either) { const E_FLOAT v0 = delx*delx*fpair; const E_FLOAT v1 = dely*dely*fpair; const E_FLOAT v2 = delz*delz*fpair; @@ -1154,21 +852,12 @@ void PairTersoffMODKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons const E_FLOAT v5 = dely*delz*fpair; if (vflag_global) { - if (NEIGHFLAG != FULL) { - ev.v[0] += v0; - ev.v[1] += v1; - ev.v[2] += v2; - ev.v[3] += v3; - ev.v[4] += v4; - ev.v[5] += v5; - } else { - ev.v[0] += 0.5*v0; - ev.v[1] += 0.5*v1; - ev.v[2] += 0.5*v2; - ev.v[3] += 0.5*v3; - ev.v[4] += 0.5*v4; - ev.v[5] += 0.5*v5; - } + ev.v[0] += v0; + ev.v[1] += v1; + ev.v[2] += v2; + ev.v[3] += v3; + ev.v[4] += v4; + ev.v[5] += v5; } if (vflag_atom) { @@ -1179,14 +868,12 @@ void PairTersoffMODKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons a_vatom(i,4) += 0.5*v4; a_vatom(i,5) += 0.5*v5; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += 0.5*v0; - a_vatom(j,1) += 0.5*v1; - a_vatom(j,2) += 0.5*v2; - a_vatom(j,3) += 0.5*v3; - a_vatom(j,4) += 0.5*v4; - a_vatom(j,5) += 0.5*v5; - } + a_vatom(j,0) += 0.5*v0; + a_vatom(j,1) += 0.5*v1; + a_vatom(j,2) += 0.5*v2; + a_vatom(j,3) += 0.5*v3; + a_vatom(j,4) += 0.5*v4; + a_vatom(j,5) += 0.5*v5; } } } @@ -1232,14 +919,13 @@ void PairTersoffMODKokkos::v_tally3(EV_FLOAT &ev, const int &i, cons a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += v[0]; a_vatom(j,1) += v[1]; a_vatom(j,2) += v[2]; - a_vatom(j,3) += v[3]; a_vatom(j,4) += v[4]; a_vatom(j,5) += v[5]; - a_vatom(k,0) += v[0]; a_vatom(k,1) += v[1]; a_vatom(k,2) += v[2]; - a_vatom(k,3) += v[3]; a_vatom(k,4) += v[4]; a_vatom(k,5) += v[5]; - } - } + a_vatom(j,0) += v[0]; a_vatom(j,1) += v[1]; a_vatom(j,2) += v[2]; + a_vatom(j,3) += v[3]; a_vatom(j,4) += v[4]; a_vatom(j,5) += v[5]; + + a_vatom(k,0) += v[0]; a_vatom(k,1) += v[1]; a_vatom(k,2) += v[2]; + a_vatom(k,3) += v[3]; a_vatom(k,4) += v[4]; a_vatom(k,5) += v[5]; + } } /* ---------------------------------------------------------------------- */ @@ -1289,4 +975,3 @@ template class PairTersoffMODKokkos; template class PairTersoffMODKokkos; #endif } - diff --git a/src/KOKKOS/pair_tersoff_mod_kokkos.h b/src/KOKKOS/pair_tersoff_mod_kokkos.h index ec7eb1ce92..d0c2f61648 100644 --- a/src/KOKKOS/pair_tersoff_mod_kokkos.h +++ b/src/KOKKOS/pair_tersoff_mod_kokkos.h @@ -30,20 +30,14 @@ PairStyle(tersoff/mod/kk/host,PairTersoffMODKokkos); namespace LAMMPS_NS { template -struct TagPairTersoffMODComputeHalf{}; - -template -struct TagPairTersoffMODComputeFullA{}; - -template -struct TagPairTersoffMODComputeFullB{}; +struct TagPairTersoffMODCompute{}; struct TagPairTersoffMODComputeShortNeigh{}; template class PairTersoffMODKokkos : public PairTersoffMOD { public: - enum {EnabledNeighFlags=FULL}; + enum {EnabledNeighFlags=HALF|HALFTHREAD}; enum {COUL_FLAG=0}; typedef DeviceType device_type; typedef ArrayTypes AT; @@ -52,81 +46,66 @@ class PairTersoffMODKokkos : public PairTersoffMOD { PairTersoffMODKokkos(class LAMMPS *); ~PairTersoffMODKokkos() override; void compute(int, int) override; + void coeff(int, char **) override; void init_style() override; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffMODComputeHalf, const int&, EV_FLOAT&) const; + void operator()(TagPairTersoffMODCompute, const int&, EV_FLOAT&) const; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffMODComputeHalf, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffMODComputeFullA, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffMODComputeFullA, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffMODComputeFullB, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffMODComputeFullB, const int&) const; + void operator()(TagPairTersoffMODCompute, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffMODComputeShortNeigh, const int&) const; KOKKOS_INLINE_FUNCTION - double ters_fc_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_fc_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_dfc(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_fa_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_fa_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_dfa(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_bij_k(const int &i, const int &j, const int &k, const F_FLOAT &bo) const; + double ters_bij_k(const Param& param, const F_FLOAT &bo) const; KOKKOS_INLINE_FUNCTION - double ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo) const; + double ters_dbij(const Param& param, const F_FLOAT &bo) const; KOKKOS_INLINE_FUNCTION - double bondorder(const int &i, const int &j, const int &k, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const; + double bondorder(const Param& param, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const; KOKKOS_INLINE_FUNCTION - double ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const; + double ters_gijk(const Param& param, const F_FLOAT &cos) const; KOKKOS_INLINE_FUNCTION - double ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const; + double ters_dgijk(const Param& param, const F_FLOAT &cos) const; KOKKOS_INLINE_FUNCTION - void ters_dthb(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, - F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const; + void ters_dthb(const Param& param, const F_FLOAT &prefactor, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, + F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION - void ters_dthbj(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, - F_FLOAT *fj, F_FLOAT *fk) const; + void ters_dthbj(const Param& param, const F_FLOAT &prefactor, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, + F_FLOAT *fj, F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION - void ters_dthbk(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, - F_FLOAT *fk) const; + void ters_dthbk(const Param& param, const F_FLOAT &prefactor, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, + F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION double vec3_dot(const F_FLOAT x[3], const double y[3]) const { @@ -151,17 +130,6 @@ class PairTersoffMODKokkos : public PairTersoffMOD { KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const; - struct params_ters { - KOKKOS_INLINE_FUNCTION - params_ters() {powerm=0;lam3=0;h=0;powern=0;beta=0;lam2=0;bigb=0;bigr=0;bigd=0; - lam1=0;biga=0;powern_del=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;c5=0;ca1=0;ca4=0;}; - KOKKOS_INLINE_FUNCTION - params_ters(int /*i*/) {powerm=0;lam3=0;h=0;powern=0;beta=0;lam2=0;bigb=0;bigr=0;bigd=0; - lam1=0;biga=0;powern_del=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;c5=0;ca1=0;ca4=0;}; - F_FLOAT powerm, lam3, h, powern, beta, lam2, bigb, bigr, bigd, - lam1, biga, powern_del, cutsq, c1, c2, c3, c4, c5, ca1, ca4; - }; - template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -171,24 +139,27 @@ class PairTersoffMODKokkos : public PairTersoffMOD { template KOKKOS_INLINE_FUNCTION void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, - F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; + F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; KOKKOS_INLINE_FUNCTION void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, - F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; + F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; - void allocate() override; void setup_params() override; protected: - using KKDeviceType = typename KKDevice::value; - typedef Kokkos::DualView tdual_int_3d; - Kokkos::DualView k_params; - typename Kokkos::DualView::t_dev_const_um paramskk; - // hardwired to space for 12 atom types - //params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; + typedef typename tdual_int_3d::t_dev_const_randomread t_int_3d_randomread; + typedef typename tdual_int_3d::t_host t_host_int_3d; + + t_int_3d_randomread d_elem3param; + typename AT::t_int_1d_randomread d_map; + + typedef Kokkos::DualView tdual_param_1d; + typedef typename tdual_param_1d::t_dev t_param_1d; + typedef typename tdual_param_1d::t_host t_host_param_1d; + + t_param_1d d_params; int inum; typename AT::t_x_array_randomread x; @@ -203,6 +174,7 @@ class PairTersoffMODKokkos : public PairTersoffMOD { int need_dup; + using KKDeviceType = typename KKDevice::value; template using DupScatterView = KKScatterView; @@ -213,6 +185,7 @@ class PairTersoffMODKokkos : public PairTersoffMOD { DupScatterView dup_f; DupScatterView dup_eatom; DupScatterView dup_vatom; + NonDupScatterView ndup_f; NonDupScatterView ndup_eatom; NonDupScatterView ndup_vatom; @@ -240,14 +213,3 @@ class PairTersoffMODKokkos : public PairTersoffMOD { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot (yet) use full neighbor list style with tersoff/mod/kk - -Self-explanatory. - -E: Cannot use chosen neighbor list style with tersoff/mod/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp index 56c73cc3ce..4068f14f6d 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.cpp @@ -78,18 +78,29 @@ PairTersoffZBLKokkos::~PairTersoffZBLKokkos() } } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + set coeffs for one or more type pairs +------------------------------------------------------------------------- */ template -void PairTersoffZBLKokkos::allocate() +void PairTersoffZBLKokkos::coeff(int narg, char **arg) { - PairTersoffZBL::allocate(); + PairTersoffZBL::coeff(narg,arg); + + // sync map int n = atom->ntypes; - k_params = Kokkos::DualView - ("PairTersoffZBL::paramskk",n+1,n+1,n+1); - paramskk = k_params.template view(); + DAT::tdual_int_1d k_map = DAT::tdual_int_1d("pair:map",n+1); + HAT::t_int_1d h_map = k_map.h_view; + + for (int i = 1; i <= n; i++) + h_map[i] = map[i]; + + k_map.template modify(); + k_map.template sync(); + + d_map = k_map.template view(); } /* ---------------------------------------------------------------------- @@ -108,9 +119,9 @@ void PairTersoffZBLKokkos::init_style() request->set_kokkos_host(std::is_same::value && !std::is_same::value); request->set_kokkos_device(std::is_same::value); - request->enable_full(); + if (neighflag == FULL) - error->all(FLERR,"Cannot (yet) use full neighbor list style with tersoff/zbl/kk"); + error->all(FLERR,"Must use half neighbor list style with pair tersoff/kk"); } /* ---------------------------------------------------------------------- */ @@ -120,40 +131,29 @@ void PairTersoffZBLKokkos::setup_params() { PairTersoffZBL::setup_params(); - int i,j,k,m; - int n = atom->ntypes; + // sync elem3param and params - for (i = 1; i <= n; i++) - for (j = 1; j <= n; j++) - for (k = 1; k <= n; k++) { - m = elem3param[map[i]][map[j]][map[k]]; - k_params.h_view(i,j,k).powerm = params[m].powerm; - k_params.h_view(i,j,k).gamma = params[m].gamma; - k_params.h_view(i,j,k).lam3 = params[m].lam3; - k_params.h_view(i,j,k).c = params[m].c; - k_params.h_view(i,j,k).d = params[m].d; - k_params.h_view(i,j,k).h = params[m].h; - k_params.h_view(i,j,k).powern = params[m].powern; - k_params.h_view(i,j,k).beta = params[m].beta; - k_params.h_view(i,j,k).lam2 = params[m].lam2; - k_params.h_view(i,j,k).bigb = params[m].bigb; - k_params.h_view(i,j,k).bigr = params[m].bigr; - k_params.h_view(i,j,k).bigd = params[m].bigd; - k_params.h_view(i,j,k).lam1 = params[m].lam1; - k_params.h_view(i,j,k).biga = params[m].biga; - k_params.h_view(i,j,k).cutsq = params[m].cutsq; - k_params.h_view(i,j,k).c1 = params[m].c1; - k_params.h_view(i,j,k).c2 = params[m].c2; - k_params.h_view(i,j,k).c3 = params[m].c3; - k_params.h_view(i,j,k).c4 = params[m].c4; - k_params.h_view(i,j,k).Z_i = params[m].Z_i; - k_params.h_view(i,j,k).Z_j = params[m].Z_j; - k_params.h_view(i,j,k).ZBLcut = params[m].ZBLcut; - k_params.h_view(i,j,k).ZBLexpscale = params[m].ZBLexpscale; - } + tdual_int_3d k_elem3param = tdual_int_3d("pair:elem3param",nelements,nelements,nelements); + t_host_int_3d h_elem3param = k_elem3param.h_view; - k_params.template modify(); + tdual_param_1d k_params = tdual_param_1d("pair:params",nparams); + t_host_param_1d h_params = k_params.h_view; + for (int i = 0; i < nelements; i++) + for (int j = 0; j < nelements; j++) + for (int k = 0; k < nelements; k++) + h_elem3param(i,j,k) = elem3param[i][j][k]; + + for (int m = 0; m < nparams; m++) + h_params[m] = params[m]; + + k_elem3param.modify_host(); + k_elem3param.template sync(); + k_params.modify_host(); + k_params.template sync(); + + d_elem3param = k_elem3param.template view(); + d_params = k_params.template view(); } /* ---------------------------------------------------------------------- */ @@ -164,8 +164,6 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) eflag = eflag_in; vflag = vflag_in; - if (neighflag == FULL) no_virial_fdotr_compute = 1; - ev_init(eflag,vflag,0); // reallocate per-atom arrays if necessary @@ -182,7 +180,6 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) } atomKK->sync(execution_space,datamask_read); - k_params.template sync(); if (eflag || vflag) atomKK->modified(execution_space,datamask_modify); else atomKK->modified(execution_space,F_MASK); @@ -221,37 +218,25 @@ void PairTersoffZBLKokkos::compute(int eflag_in, int vflag_in) int max_neighs = d_neighbors.extent(1); - if (((int)d_neighbors_short.extent(1) != max_neighs) || - ((int)d_neighbors_short.extent(0) != ignum)) { - d_neighbors_short = Kokkos::View("Tersoff::neighbors_short",ignum,max_neighs); + if (((int)d_neighbors_short.extent(1) < max_neighs) || + ((int)d_neighbors_short.extent(0) < ignum)) { + d_neighbors_short = Kokkos::View("Tersoff::neighbors_short",ignum*1.2,max_neighs); } - if ((int)d_numneigh_short.extent(0)!=ignum) - d_numneigh_short = Kokkos::View("Tersoff::numneighs_short",ignum); - Kokkos::parallel_for(Kokkos::RangePolicy(0,neighflag==FULL?ignum:inum), *this); + if ((int)d_numneigh_short.extent(0) < ignum) + d_numneigh_short = Kokkos::View("Tersoff::numneighs_short",ignum*1.2); + Kokkos::parallel_for(Kokkos::RangePolicy(0,inum), *this); if (neighflag == HALF) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } else if (neighflag == HALFTHREAD) { if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); + Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - } else if (neighflag == FULL) { - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,inum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); - ev_all += ev; - - if (evflag) - Kokkos::parallel_reduce(Kokkos::RangePolicy >(0,ignum),*this,ev); - else - Kokkos::parallel_for(Kokkos::RangePolicy >(0,ignum),*this); + Kokkos::parallel_for(Kokkos::RangePolicy >(0,inum),*this); ev_all += ev; } @@ -303,6 +288,7 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeShortN const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); const X_FLOAT ztmp = x(i,2); + const F_FLOAT cutmax_sq = cutmax*cutmax; const int jnum = d_numneigh[i]; int inside = 0; @@ -315,12 +301,12 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeShortN const X_FLOAT delz = ztmp - x(j,2); const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - if (rsq < cutmax*cutmax) { - d_neighbors_short(i,inside) = j; + if (rsq < cutmax_sq) { + d_neighbors_short(ii,inside) = j; inside++; } } - d_numneigh_short(i) = inside; + d_numneigh_short(ii) = inside; } /* ---------------------------------------------------------------------- */ @@ -328,25 +314,25 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeShortN template template KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf, const int &ii, EV_FLOAT& ev) const { +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii, EV_FLOAT& ev) const { // The f array is duplicated for OpenMP, atomic for CUDA, and neither for Serial - auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); - auto a_f = v_f.template access>(); + const auto v_f = ScatterViewHelper,decltype(dup_f),decltype(ndup_f)>::get(dup_f,ndup_f); + const auto a_f = v_f.template access>(); const int i = d_ilist[ii]; if (i >= nlocal) return; const X_FLOAT xtmp = x(i,0); const X_FLOAT ytmp = x(i,1); const X_FLOAT ztmp = x(i,2); - const int itype = type(i); + const int itype = d_map(type(i)); const tagint itag = tag(i); F_FLOAT fi[3], fj[3], fk[3]; //const AtomNeighborsConst d_neighbors_i = k_list.get_neighbors_const(i); - const int jnum = d_numneigh_short[i]; + const int jnum = d_numneigh_short[ii]; // repulsive @@ -355,9 +341,8 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf jtag) { @@ -374,26 +359,27 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf cutsq) continue; // Tersoff repulsive portion const F_FLOAT r = sqrt(rsq); - const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); - const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); - const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep_t = paramskk(itype,jtype,jtype).biga * tmp_exp * - (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1); - const F_FLOAT eng_t = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; + const F_FLOAT tmp_fce = ters_fc_k(d_params(iparam_ij),r); + const F_FLOAT tmp_fcd = ters_dfc(d_params(iparam_ij),r); + const F_FLOAT tmp_exp = exp(-d_params(iparam_ij).lam1 * r); + const F_FLOAT frep_t = d_params(iparam_ij).biga * tmp_exp * + (tmp_fcd - tmp_fce*d_params(iparam_ij).lam1); + const F_FLOAT eng_t = tmp_fce * d_params(iparam_ij).biga * tmp_exp; // ZBL repulsive portion const F_FLOAT esq = pow(global_e,2.0); const F_FLOAT a_ij = (0.8854*global_a_0) / - (pow(paramskk(itype,jtype,jtype).Z_i,0.23) + pow(paramskk(itype,jtype,jtype).Z_j,0.23)); - const F_FLOAT premult = (paramskk(itype,jtype,jtype).Z_i * paramskk(itype,jtype,jtype).Z_j * esq)/ + (pow(d_params(iparam_ij).Z_i,0.23) + pow(d_params(iparam_ij).Z_j,0.23)); + const F_FLOAT premult = (d_params(iparam_ij).Z_i * d_params(iparam_ij).Z_j * esq)/ (4.0*MY_PI*global_epsilon_0); const F_FLOAT r_ov_a = r/a_ij; const F_FLOAT phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + @@ -408,13 +394,13 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf::operator()(TagPairTersoffZBLComputeHalf cutsq1) continue; @@ -448,28 +434,28 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf cutsq2) continue; const F_FLOAT rik = sqrt(rsq2); - bo_ij += bondorder(itype,jtype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); + bo_ij += bondorder(d_params(iparam_ijk),rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); } // attractive: pairwise potential and force - const F_FLOAT fa = ters_fa_k(itype,jtype,jtype,rij); - const F_FLOAT dfa = ters_dfa(itype,jtype,jtype,rij); - const F_FLOAT bij = ters_bij_k(itype,jtype,jtype,bo_ij); + const F_FLOAT fa = ters_fa_k(d_params(iparam_ij),rij); + const F_FLOAT dfa = ters_dfa(d_params(iparam_ij),rij); + const F_FLOAT bij = ters_bij_k(d_params(iparam_ij),bo_ij); const F_FLOAT fatt = -0.5*bij * dfa / rij; - const F_FLOAT prefactor = 0.5*fa * ters_dbij(itype,jtype,jtype,bo_ij); + const F_FLOAT prefactor = 0.5*fa * ters_dbij(d_params(iparam_ij),bo_ij); f_x += delx1*fatt; f_y += dely1*fatt; @@ -489,19 +475,19 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf cutsq2) continue; const F_FLOAT rik = sqrt(rsq2); - ters_dthb(itype,jtype,ktype,prefactor,rij,delx1,dely1,delz1, + ters_dthb(d_params(iparam_ijk),prefactor,rij,delx1,dely1,delz1, rik,delx2,dely2,delz2,fi,fj,fk); f_x += fi[0]; @@ -521,6 +507,7 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalftemplate v_tally3(ev,i,j,k,fj,fk,delrij,delrik); } } + a_f(j,0) += fj_x; a_f(j,1) += fj_y; a_f(j,2) += fj_z; @@ -533,339 +520,19 @@ void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf template KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeHalf, const int &ii) const { +void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLCompute, const int &ii) const { EV_FLOAT ev; - this->template operator()(TagPairTersoffZBLComputeHalf(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeFullA, const int &ii, EV_FLOAT& ev) const { - - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); - - int j,k,jj,kk,jtype,ktype; - F_FLOAT rsq1, cutsq1, rsq2, cutsq2, rij, rik, bo_ij; - F_FLOAT fi[3], fj[3], fk[3]; - X_FLOAT delx1, dely1, delz1, delx2, dely2, delz2; - - //const AtomNeighborsConst d_neighbors_i = k_list.get_neighbors_const(i); - const int jnum = d_numneigh[i]; - - // repulsive - - F_FLOAT f_x = 0.0; - F_FLOAT f_y = 0.0; - F_FLOAT f_z = 0.0; - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - const int jtype = type(j); - - const X_FLOAT delx = xtmp - x(j,0); - const X_FLOAT dely = ytmp - x(j,1); - const X_FLOAT delz = ztmp - x(j,2); - const F_FLOAT rsq = delx*delx + dely*dely + delz*delz; - const F_FLOAT cutsq = paramskk(itype,jtype,jtype).cutsq; - - if (rsq > cutsq) continue; - - // Tersoff repulsive portion - - const F_FLOAT r = sqrt(rsq); - const F_FLOAT tmp_fce = ters_fc_k(itype,jtype,jtype,r); - const F_FLOAT tmp_fcd = ters_dfc(itype,jtype,jtype,r); - const F_FLOAT tmp_exp = exp(-paramskk(itype,jtype,jtype).lam1 * r); - const F_FLOAT frep_t = paramskk(itype,jtype,jtype).biga * tmp_exp * - (tmp_fcd - tmp_fce*paramskk(itype,jtype,jtype).lam1); - const F_FLOAT eng_t = tmp_fce * paramskk(itype,jtype,jtype).biga * tmp_exp; - - // ZBL repulsive portion - - const F_FLOAT esq = pow(global_e,2.0); - const F_FLOAT a_ij = (0.8854*global_a_0) / - (pow(paramskk(itype,jtype,jtype).Z_i,0.23) + pow(paramskk(itype,jtype,jtype).Z_j,0.23)); - const F_FLOAT premult = (paramskk(itype,jtype,jtype).Z_i * paramskk(itype,jtype,jtype).Z_j * esq)/ - (4.0*MY_PI*global_epsilon_0); - const F_FLOAT r_ov_a = r/a_ij; - const F_FLOAT phi = 0.1818*exp(-3.2*r_ov_a) + 0.5099*exp(-0.9423*r_ov_a) + - 0.2802*exp(-0.4029*r_ov_a) + 0.02817*exp(-0.2016*r_ov_a); - const F_FLOAT dphi = (1.0/a_ij) * (-3.2*0.1818*exp(-3.2*r_ov_a) - - 0.9423*0.5099*exp(-0.9423*r_ov_a) - - 0.4029*0.2802*exp(-0.4029*r_ov_a) - - 0.2016*0.02817*exp(-0.2016*r_ov_a)); - const F_FLOAT frep_z = premult*-phi/rsq + premult*dphi/r; - const F_FLOAT eng_z = premult*(1.0/r)*phi; - - // combine two parts with smoothing by Fermi-like function - - F_FLOAT frep, eng; - frep = -(-fermi_d_k(itype,jtype,jtype,r) * eng_z + - (1.0 - fermi_k(itype,jtype,jtype,r))*frep_z + - fermi_d_k(itype,jtype,jtype,r)*eng_t + fermi_k(itype,jtype,jtype,r)*frep_t) / r; - - if (eflag) - eng = (1.0 - fermi_k(itype,jtype,jtype,r)) * eng_z + - fermi_k(itype,jtype,jtype,r) * eng_t; - - f_x += delx*frep; - f_y += dely*frep; - f_z += delz*frep; - - if (EVFLAG) { - if (eflag) - ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,frep,delx,dely,delz); - } - } - - // attractive: bond order - - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - jtype = type(j); - - delx1 = xtmp - x(j,0); - dely1 = ytmp - x(j,1); - delz1 = ztmp - x(j,2); - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - cutsq1 = paramskk(itype,jtype,jtype).cutsq; - - bo_ij = 0.0; - if (rsq1 > cutsq1) continue; - rij = sqrt(rsq1); - - for (kk = 0; kk < jnum; kk++) { - if (jj == kk) continue; - k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - ktype = type(k); - - delx2 = xtmp - x(k,0); - dely2 = ytmp - x(k,1); - delz2 = ztmp - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(itype,jtype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - bo_ij += bondorder(itype,jtype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); - } - - // attractive: pairwise potential and force - - const F_FLOAT fa = ters_fa_k(itype,jtype,jtype,rij); - const F_FLOAT dfa = ters_dfa(itype,jtype,jtype,rij); - const F_FLOAT bij = ters_bij_k(itype,jtype,jtype,bo_ij); - const F_FLOAT fatt = -0.5*bij * dfa / rij; - const F_FLOAT prefactor = 0.5*fa * ters_dbij(itype,jtype,jtype,bo_ij); - const F_FLOAT eng = 0.5*bij * fa; - - f_x += delx1*fatt; - f_y += dely1*fatt; - f_z += delz1*fatt; - - if (EVFLAG) { - if (eflag) ev.evdwl += 0.5*eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); - } - - // attractive: three-body force - - for (kk = 0; kk < jnum; kk++) { - if (jj == kk) continue; - k = d_neighbors_short(i,kk); - k &= NEIGHMASK; - ktype = type(k); - - delx2 = xtmp - x(k,0); - dely2 = ytmp - x(k,1); - delz2 = ztmp - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(itype,jtype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - ters_dthb(itype,jtype,ktype,prefactor,rij,delx1,dely1,delz1, - rik,delx2,dely2,delz2,fi,fj,fk); - - f_x += fi[0]; - f_y += fi[1]; - f_z += fi[2]; - - if (vflag_either) { - F_FLOAT delrij[3], delrik[3]; - delrij[0] = -delx1; delrij[1] = -dely1; delrij[2] = -delz1; - delrik[0] = -delx2; delrik[1] = -dely2; delrik[2] = -delz2; - if (vflag_either) this->template v_tally3(ev,i,j,k,fj,fk,delrij,delrik); - } - } - } - f(i,0) += f_x; - f(i,1) += f_y; - f(i,2) += f_z; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeFullA, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairTersoffZBLComputeFullA(), ii, ev); -} - -/* ---------------------------------------------------------------------- */ - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeFullB, const int &ii, EV_FLOAT& ev) const { - - const int i = d_ilist[ii]; - const X_FLOAT xtmp = x(i,0); - const X_FLOAT ytmp = x(i,1); - const X_FLOAT ztmp = x(i,2); - const int itype = type(i); - - int j,k,jj,kk,jtype,ktype,j_jnum; - F_FLOAT rsq1, cutsq1, rsq2, cutsq2, rij, rik, bo_ij; - F_FLOAT fj[3], fk[3]; - X_FLOAT delx1, dely1, delz1, delx2, dely2, delz2; - - const int jnum = d_numneigh_short[i]; - - F_FLOAT f_x = 0.0; - F_FLOAT f_y = 0.0; - F_FLOAT f_z = 0.0; - - // attractive: bond order - - for (jj = 0; jj < jnum; jj++) { - j = d_neighbors_short(i,jj); - j &= NEIGHMASK; - if (j >= nlocal) continue; - jtype = type(j); - - delx1 = x(j,0) - xtmp; - dely1 = x(j,1) - ytmp; - delz1 = x(j,2) - ztmp; - rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; - cutsq1 = paramskk(jtype,itype,itype).cutsq; - - bo_ij = 0.0; - if (rsq1 > cutsq1) continue; - rij = sqrt(rsq1); - - j_jnum = d_numneigh_short[j]; - - for (kk = 0; kk < j_jnum; kk++) { - k = d_neighbors_short(j,kk); - if (k == i) continue; - k &= NEIGHMASK; - ktype = type(k); - - delx2 = x(j,0) - x(k,0); - dely2 = x(j,1) - x(k,1); - delz2 = x(j,2) - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(jtype,itype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - bo_ij += bondorder(jtype,itype,ktype,rij,delx1,dely1,delz1,rik,delx2,dely2,delz2); - - } - - // attractive: pairwise potential and force - - const F_FLOAT fa = ters_fa_k(jtype,itype,itype,rij); - const F_FLOAT dfa = ters_dfa(jtype,itype,itype,rij); - const F_FLOAT bij = ters_bij_k(jtype,itype,itype,bo_ij); - const F_FLOAT fatt = -0.5*bij * dfa / rij; - const F_FLOAT prefactor = 0.5*fa * ters_dbij(jtype,itype,itype,bo_ij); - const F_FLOAT eng = 0.5*bij * fa; - - f_x -= delx1*fatt; - f_y -= dely1*fatt; - f_z -= delz1*fatt; - - if (EVFLAG) { - if (eflag) - ev.evdwl += 0.5 * eng; - if (vflag_either || eflag_atom) - this->template ev_tally(ev,i,j,eng,fatt,delx1,dely1,delz1); - } - - // attractive: three-body force - - for (kk = 0; kk < j_jnum; kk++) { - k = d_neighbors_short(j,kk); - if (k == i) continue; - k &= NEIGHMASK; - ktype = type(k); - - delx2 = x(j,0) - x(k,0); - dely2 = x(j,1) - x(k,1); - delz2 = x(j,2) - x(k,2); - rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; - cutsq2 = paramskk(jtype,itype,ktype).cutsq; - - if (rsq2 > cutsq2) continue; - rik = sqrt(rsq2); - ters_dthbj(jtype,itype,ktype,prefactor,rij,delx1,dely1,delz1, - rik,delx2,dely2,delz2,fj,fk); - f_x += fj[0]; - f_y += fj[1]; - f_z += fj[2]; - - if (vflag_either) { - F_FLOAT delrji[3], delrjk[3]; - delrji[0] = -delx1; delrji[1] = -dely1; delrji[2] = -delz1; - delrjk[0] = -delx2; delrjk[1] = -dely2; delrjk[2] = -delz2; - if (vflag_either) v_tally3_atom(ev,i,j,k,fj,fk,delrji,delrjk); - } - - const F_FLOAT fa_jk = ters_fa_k(jtype,ktype,itype,rik); - const F_FLOAT prefactor_jk = 0.5*fa_jk * ters_dbij(jtype,ktype,itype,bo_ij); - ters_dthbk(jtype,ktype,itype,prefactor_jk,rik,delx2,dely2,delz2, - rij,delx1,dely1,delz1,fk); - f_x += fk[0]; - f_y += fk[1]; - f_z += fk[2]; - } - } - f(i,0) += f_x; - f(i,1) += f_y; - f(i,2) += f_z; -} - -template -template -KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::operator()(TagPairTersoffZBLComputeFullB, const int &ii) const { - EV_FLOAT ev; - this->template operator()(TagPairTersoffZBLComputeFullB(), ii, ev); + this->template operator()(TagPairTersoffZBLCompute(), ii, ev); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::ters_fc_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffZBLKokkos::ters_fc_k(const Param& param, const F_FLOAT &r) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) return 1.0; if (r > ters_R+ters_D) return 0.0; @@ -876,11 +543,10 @@ double PairTersoffZBLKokkos::ters_fc_k(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::ters_dfc(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffZBLKokkos::ters_dfc(const Param& param, const F_FLOAT &r) const { - const F_FLOAT ters_R = paramskk(i,j,k).bigr; - const F_FLOAT ters_D = paramskk(i,j,k).bigd; + const F_FLOAT ters_R = param.bigr; + const F_FLOAT ters_D = param.bigd; if (r < ters_R-ters_D) return 0.0; if (r > ters_R+ters_D) return 0.0; @@ -891,7 +557,7 @@ double PairTersoffZBLKokkos::ters_dfc(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::bondorder(const int &i, const int &j, const int &k, +double PairTersoffZBLKokkos::bondorder(const Param& param, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const { @@ -899,14 +565,15 @@ double PairTersoffZBLKokkos::bondorder(const int &i, const int &j, c const F_FLOAT costheta = (dx1*dx2 + dy1*dy2 + dz1*dz2)/(rij*rik); - if (int(paramskk(i,j,k).powerm) == 3) arg = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else arg = paramskk(i,j,k).lam3 * (rij-rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) arg = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else arg = paramtmp; if (arg > 69.0776) ex_delr = 1.e30; else if (arg < -69.0776) ex_delr = 0.0; else ex_delr = exp(arg); - return ters_fc_k(i,j,k,rik) * ters_gijk(i,j,k,costheta) * ex_delr; + return ters_fc_k(param,rik) * ters_gijk(param,costheta) * ex_delr; } /* ---------------------------------------------------------------------- */ @@ -914,13 +581,13 @@ double PairTersoffZBLKokkos::bondorder(const int &i, const int &j, c template KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos:: - ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const + ters_gijk(const Param& param, const F_FLOAT &cos) const { - const F_FLOAT ters_c = paramskk(i,j,k).c * paramskk(i,j,k).c; - const F_FLOAT ters_d = paramskk(i,j,k).d * paramskk(i,j,k).d; - const F_FLOAT hcth = paramskk(i,j,k).h - cos; + const F_FLOAT ters_c = param.c * param.c; + const F_FLOAT ters_d = param.d * param.d; + const F_FLOAT hcth = param.h - cos; - return paramskk(i,j,k).gamma*(1.0 + ters_c/ters_d - ters_c/(ters_d+hcth*hcth)); + return param.gamma*(1.0 + ters_c/ters_d - ters_c/(ters_d+hcth*hcth)); } /* ---------------------------------------------------------------------- */ @@ -928,81 +595,77 @@ double PairTersoffZBLKokkos:: template KOKKOS_INLINE_FUNCTION double PairTersoffZBLKokkos:: - ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const + ters_dgijk(const Param& param, const F_FLOAT &cos) const { - - const F_FLOAT ters_c = paramskk(i,j,k).c * paramskk(i,j,k).c; - const F_FLOAT ters_d = paramskk(i,j,k).d * paramskk(i,j,k).d; - const F_FLOAT hcth = paramskk(i,j,k).h - cos; + const F_FLOAT ters_c = param.c * param.c; + const F_FLOAT ters_d = param.d * param.d; + const F_FLOAT hcth = param.h - cos; const F_FLOAT numerator = -2.0 * ters_c * hcth; const F_FLOAT denominator = 1.0/(ters_d + hcth*hcth); - return paramskk(i,j,k).gamma * numerator * denominator * denominator; + return param.gamma * numerator * denominator * denominator; } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::ters_fa_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffZBLKokkos::ters_fa_k(const Param& param, const F_FLOAT &r) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return -paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) - * ters_fc_k(i,j,k,r) * fermi_k(i,j,k,r); + if (r > param.bigr + param.bigd) return 0.0; + return -param.bigb * exp(-param.lam2 * r) + * ters_fc_k(param,r) * fermi_k(param,r); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::ters_dfa(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffZBLKokkos::ters_dfa(const Param& param, const F_FLOAT &r) const { - if (r > paramskk(i,j,k).bigr + paramskk(i,j,k).bigd) return 0.0; - return paramskk(i,j,k).bigb * exp(-paramskk(i,j,k).lam2 * r) * - (paramskk(i,j,k).lam2 * ters_fc_k(i,j,k,r) * fermi_k(i,j,k,r) - - ters_dfc(i,j,k,r) * fermi_k(i,j,k,r) - ters_fc_k(i,j,k,r) * - fermi_d_k(i,j,k,r)); + if (r > param.bigr + param.bigd) return 0.0; + return param.bigb * exp(-param.lam2 * r) * + (param.lam2 * ters_fc_k(param,r) * fermi_k(param,r) - + ters_dfc(param,r) * fermi_k(param,r) - ters_fc_k(param,r) * + fermi_d_k(param,r)); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::ters_bij_k(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const +double PairTersoffZBLKokkos::ters_bij_k(const Param& param, const F_FLOAT &bo) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).c1) return 1.0/sqrt(tmp); - if (tmp > paramskk(i,j,k).c2) - return (1.0 - pow(tmp,-paramskk(i,j,k).powern) / (2.0*paramskk(i,j,k).powern))/sqrt(tmp); - if (tmp < paramskk(i,j,k).c4) return 1.0; - if (tmp < paramskk(i,j,k).c3) - return 1.0 - pow(tmp,paramskk(i,j,k).powern)/(2.0*paramskk(i,j,k).powern); - return pow(1.0 + pow(tmp,paramskk(i,j,k).powern), -1.0/(2.0*paramskk(i,j,k).powern)); + const F_FLOAT tmp = param.beta * bo; + if (tmp > param.c1) return 1.0/sqrt(tmp); + if (tmp > param.c2) + return (1.0 - pow(tmp,-param.powern) / (2.0*param.powern))/sqrt(tmp); + if (tmp < param.c4) return 1.0; + if (tmp < param.c3) + return 1.0 - pow(tmp,param.powern)/(2.0*param.powern); + return pow(1.0 + pow(tmp,param.powern), -1.0/(2.0*param.powern)); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::ters_dbij(const int &i, const int &j, - const int &k, const F_FLOAT &bo) const +double PairTersoffZBLKokkos::ters_dbij(const Param& param, const F_FLOAT &bo) const { - const F_FLOAT tmp = paramskk(i,j,k).beta * bo; - if (tmp > paramskk(i,j,k).c1) return paramskk(i,j,k).beta * -0.5*pow(tmp,-1.5); - if (tmp > paramskk(i,j,k).c2) - return paramskk(i,j,k).beta * (-0.5*pow(tmp,-1.5) * + const F_FLOAT tmp = param.beta * bo; + const F_FLOAT factor = -0.5/sqrt(tmp*tmp*tmp); //pow(tmp,-1.5) + if (tmp > param.c1) return param.beta * factor; + if (tmp > param.c2) + return param.beta * (factor * // error in negligible 2nd term fixed 2/21/2022 - //(1.0 - 0.5*(1.0 + 1.0/(2.0*paramskk(i,j,k).powern)) * - (1.0 - (1.0 + 1.0/(2.0*paramskk(i,j,k).powern)) * - pow(tmp,-paramskk(i,j,k).powern))); - if (tmp < paramskk(i,j,k).c4) return 0.0; - if (tmp < paramskk(i,j,k).c3) - return -0.5*paramskk(i,j,k).beta * pow(tmp,paramskk(i,j,k).powern-1.0); + // (1.0 - 0.5*(1.0 + 1.0/(2.0*param.powern)) * + (1.0 - (1.0 + 1.0/(2.0*param.powern)) * + pow(tmp,-param.powern))); + if (tmp < param.c4) return 0.0; + if (tmp < param.c3) + return -0.5*param.beta * pow(tmp,param.powern-1.0); - const F_FLOAT tmp_n = pow(tmp,paramskk(i,j,k).powern); - return -0.5 * pow(1.0+tmp_n, -1.0-(1.0/(2.0*paramskk(i,j,k).powern)))*tmp_n / bo; + const F_FLOAT tmp_n = pow(tmp,param.powern); + return -0.5 * pow(1.0+tmp_n, -1.0-(1.0/(2.0*param.powern)))*tmp_n / bo; } /* ---------------------------------------------------------------------- */ @@ -1010,7 +673,7 @@ double PairTersoffZBLKokkos::ters_dbij(const int &i, const int &j, template KOKKOS_INLINE_FUNCTION void PairTersoffZBLKokkos::ters_dthb( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const @@ -1035,22 +698,24 @@ void PairTersoffZBLKokkos::ters_dthb( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); // from PairTersoffZBL::costheta_d vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); @@ -1082,7 +747,7 @@ void PairTersoffZBLKokkos::ters_dthb( template KOKKOS_INLINE_FUNCTION void PairTersoffZBLKokkos::ters_dthbj( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fj, F_FLOAT *fk) const @@ -1103,22 +768,23 @@ void PairTersoffZBLKokkos::ters_dthbj( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(param.lam3,3.0) * pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); vec3_scale(rijinv,dcosfj,dcosfj); @@ -1143,7 +809,7 @@ void PairTersoffZBLKokkos::ters_dthbj( template KOKKOS_INLINE_FUNCTION void PairTersoffZBLKokkos::ters_dthbk( - const int &i, const int &j, const int &k, const F_FLOAT &prefactor, + const Param& param, const F_FLOAT &prefactor, const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, F_FLOAT *fk) const @@ -1164,22 +830,23 @@ void PairTersoffZBLKokkos::ters_dthbk( F_FLOAT gijk,dgijk,ex_delr,dex_delr,fc,dfc,cos,tmp; F_FLOAT dcosfi[3],dcosfj[3],dcosfk[3]; - fc = ters_fc_k(i,j,k,rik); - dfc = ters_dfc(i,j,k,rik); - if (int(paramskk(i,j,k).powerm) == 3) tmp = pow(paramskk(i,j,k).lam3 * (rij-rik),3.0); - else tmp = paramskk(i,j,k).lam3 * (rij-rik); + fc = ters_fc_k(param,rik); + dfc = ters_dfc(param,rik); + const F_FLOAT paramtmp = param.lam3 * (rij-rik); + if (int(param.powerm) == 3) tmp = paramtmp*paramtmp*paramtmp;//pow(param.lam3 * (rij-rik),3.0); + else tmp = paramtmp; if (tmp > 69.0776) ex_delr = 1.e30; else if (tmp < -69.0776) ex_delr = 0.0; else ex_delr = exp(tmp); - if (int(paramskk(i,j,k).powerm) == 3) - dex_delr = 3.0*pow(paramskk(i,j,k).lam3,3.0) * pow(rij-rik,2.0)*ex_delr; - else dex_delr = paramskk(i,j,k).lam3 * ex_delr; + if (int(param.powerm) == 3) + dex_delr = 3.0*paramtmp*paramtmp*param.lam3*ex_delr;//pow(param.lam3,3.0) * pow(rij-rik,2.0)*ex_delr; + else dex_delr = param.lam3 * ex_delr; cos = vec3_dot(rij_hat,rik_hat); - gijk = ters_gijk(i,j,k,cos); - dgijk = ters_dgijk(i,j,k,cos); + gijk = ters_gijk(param,cos); + dgijk = ters_dgijk(param,cos); vec3_scaleadd(-cos,rij_hat,rik_hat,dcosfj); vec3_scale(rijinv,dcosfj,dcosfj); @@ -1199,24 +866,22 @@ void PairTersoffZBLKokkos::ters_dthbk( template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::fermi_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffZBLKokkos::fermi_k(const Param& param, const F_FLOAT &r) const { - return 1.0 / (1.0 + exp(-paramskk(i,j,k).ZBLexpscale * - (r - paramskk(i,j,k).ZBLcut))); + return 1.0 / (1.0 + exp(-param.ZBLexpscale * + (r - param.ZBLcut))); } /* ---------------------------------------------------------------------- */ template KOKKOS_INLINE_FUNCTION -double PairTersoffZBLKokkos::fermi_d_k(const int &i, const int &j, - const int &k, const F_FLOAT &r) const +double PairTersoffZBLKokkos::fermi_d_k(const Param& param, const F_FLOAT &r) const { - return paramskk(i,j,k).ZBLexpscale * exp(-paramskk(i,j,k).ZBLexpscale * - (r - paramskk(i,j,k).ZBLcut)) / - pow(1.0 + exp(-paramskk(i,j,k).ZBLexpscale * - (r - paramskk(i,j,k).ZBLcut)),2.0); + return param.ZBLexpscale * exp(-param.ZBLexpscale * + (r - param.ZBLcut)) / + pow(1.0 + exp(-param.ZBLexpscale * + (r - param.ZBLcut)),2.0); } /* ---------------------------------------------------------------------- */ @@ -1228,8 +893,6 @@ void PairTersoffZBLKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons const F_FLOAT &epair, const F_FLOAT &fpair, const F_FLOAT &delx, const F_FLOAT &dely, const F_FLOAT &delz) const { - const int VFLAG = vflag_either; - // The eatom and vatom arrays are duplicated for OpenMP, atomic for CUDA, and neither for Serial auto v_eatom = ScatterViewHelper,decltype(dup_eatom),decltype(ndup_eatom)>::get(dup_eatom,ndup_eatom); @@ -1241,10 +904,10 @@ void PairTersoffZBLKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons if (eflag_atom) { const E_FLOAT epairhalf = 0.5 * epair; a_eatom[i] += epairhalf; - if (NEIGHFLAG != FULL) a_eatom[j] += epairhalf; + a_eatom[j] += epairhalf; } - if (VFLAG) { + if (vflag_either) { const E_FLOAT v0 = delx*delx*fpair; const E_FLOAT v1 = dely*dely*fpair; const E_FLOAT v2 = delz*delz*fpair; @@ -1253,21 +916,12 @@ void PairTersoffZBLKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons const E_FLOAT v5 = dely*delz*fpair; if (vflag_global) { - if (NEIGHFLAG != FULL) { - ev.v[0] += v0; - ev.v[1] += v1; - ev.v[2] += v2; - ev.v[3] += v3; - ev.v[4] += v4; - ev.v[5] += v5; - } else { - ev.v[0] += 0.5*v0; - ev.v[1] += 0.5*v1; - ev.v[2] += 0.5*v2; - ev.v[3] += 0.5*v3; - ev.v[4] += 0.5*v4; - ev.v[5] += 0.5*v5; - } + ev.v[0] += v0; + ev.v[1] += v1; + ev.v[2] += v2; + ev.v[3] += v3; + ev.v[4] += v4; + ev.v[5] += v5; } if (vflag_atom) { @@ -1278,14 +932,12 @@ void PairTersoffZBLKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons a_vatom(i,4) += 0.5*v4; a_vatom(i,5) += 0.5*v5; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += 0.5*v0; - a_vatom(j,1) += 0.5*v1; - a_vatom(j,2) += 0.5*v2; - a_vatom(j,3) += 0.5*v3; - a_vatom(j,4) += 0.5*v4; - a_vatom(j,5) += 0.5*v5; - } + a_vatom(j,0) += 0.5*v0; + a_vatom(j,1) += 0.5*v1; + a_vatom(j,2) += 0.5*v2; + a_vatom(j,3) += 0.5*v3; + a_vatom(j,4) += 0.5*v4; + a_vatom(j,5) += 0.5*v5; } } } @@ -1295,7 +947,8 @@ void PairTersoffZBLKokkos::ev_tally(EV_FLOAT &ev, const int &i, cons template template KOKKOS_INLINE_FUNCTION -void PairTersoffZBLKokkos::v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, +void PairTersoffZBLKokkos::v_tally3(EV_FLOAT &ev, + const int &i, const int &j, const int &k, F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const { // The vatom array is duplicated for OpenMP, atomic for CUDA, and neither for Serial @@ -1331,14 +984,13 @@ void PairTersoffZBLKokkos::v_tally3(EV_FLOAT &ev, const int &i, cons a_vatom(i,0) += v[0]; a_vatom(i,1) += v[1]; a_vatom(i,2) += v[2]; a_vatom(i,3) += v[3]; a_vatom(i,4) += v[4]; a_vatom(i,5) += v[5]; - if (NEIGHFLAG != FULL) { - a_vatom(j,0) += v[0]; a_vatom(j,1) += v[1]; a_vatom(j,2) += v[2]; - a_vatom(j,3) += v[3]; a_vatom(j,4) += v[4]; a_vatom(j,5) += v[5]; - a_vatom(k,0) += v[0]; a_vatom(k,1) += v[1]; a_vatom(k,2) += v[2]; - a_vatom(k,3) += v[3]; a_vatom(k,4) += v[4]; a_vatom(k,5) += v[5]; - } - } + a_vatom(j,0) += v[0]; a_vatom(j,1) += v[1]; a_vatom(j,2) += v[2]; + a_vatom(j,3) += v[3]; a_vatom(j,4) += v[4]; a_vatom(j,5) += v[5]; + + a_vatom(k,0) += v[0]; a_vatom(k,1) += v[1]; a_vatom(k,2) += v[2]; + a_vatom(k,3) += v[3]; a_vatom(k,4) += v[4]; a_vatom(k,5) += v[5]; + } } /* ---------------------------------------------------------------------- */ @@ -1387,4 +1039,3 @@ template class PairTersoffZBLKokkos; template class PairTersoffZBLKokkos; #endif } - diff --git a/src/KOKKOS/pair_tersoff_zbl_kokkos.h b/src/KOKKOS/pair_tersoff_zbl_kokkos.h index 2cad44e200..bafdbc6023 100644 --- a/src/KOKKOS/pair_tersoff_zbl_kokkos.h +++ b/src/KOKKOS/pair_tersoff_zbl_kokkos.h @@ -30,20 +30,14 @@ PairStyle(tersoff/zbl/kk/host,PairTersoffZBLKokkos); namespace LAMMPS_NS { template -struct TagPairTersoffZBLComputeHalf{}; - -template -struct TagPairTersoffZBLComputeFullA{}; - -template -struct TagPairTersoffZBLComputeFullB{}; +struct TagPairTersoffZBLCompute{}; struct TagPairTersoffZBLComputeShortNeigh{}; template class PairTersoffZBLKokkos : public PairTersoffZBL { public: - enum {EnabledNeighFlags=FULL}; + enum {EnabledNeighFlags=HALF|HALFTHREAD}; enum {COUL_FLAG=0}; typedef DeviceType device_type; typedef ArrayTypes AT; @@ -52,80 +46,66 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { PairTersoffZBLKokkos(class LAMMPS *); ~PairTersoffZBLKokkos() override; void compute(int, int) override; + void coeff(int, char **) override; void init_style() override; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffZBLComputeHalf, const int&, EV_FLOAT&) const; + void operator()(TagPairTersoffZBLCompute, const int&, EV_FLOAT&) const; template KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffZBLComputeHalf, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffZBLComputeFullA, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffZBLComputeFullA, const int&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffZBLComputeFullB, const int&, EV_FLOAT&) const; - - template - KOKKOS_INLINE_FUNCTION - void operator()(TagPairTersoffZBLComputeFullB, const int&) const; + void operator()(TagPairTersoffZBLCompute, const int&) const; KOKKOS_INLINE_FUNCTION void operator()(TagPairTersoffZBLComputeShortNeigh, const int&) const; - KOKKOS_INLINE_FUNCTION - double ters_fc_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dfc(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_fc_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_fa_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_dfc(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dfa(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double ters_fa_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_bij_k(const int &i, const int &j, const int &k, const F_FLOAT &bo) const; + double ters_dfa(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double ters_dbij(const int &i, const int &j, const int &k, const F_FLOAT &bo) const; + double ters_bij_k(const Param& param, const F_FLOAT &bo) const; KOKKOS_INLINE_FUNCTION - double bondorder(const int &i, const int &j, const int &k, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const; + double ters_dbij(const Param& param, const F_FLOAT &bo) const; KOKKOS_INLINE_FUNCTION - double ters_gijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const; + double bondorder(const Param& param, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2) const; KOKKOS_INLINE_FUNCTION - double ters_dgijk(const int &i, const int &j, const int &k, const F_FLOAT &cos) const; + double ters_gijk(const Param& param, const F_FLOAT &cos) const; KOKKOS_INLINE_FUNCTION - void ters_dthb(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, - F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const; + double ters_dgijk(const Param& param, const F_FLOAT &cos) const; KOKKOS_INLINE_FUNCTION - void ters_dthbj(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, - F_FLOAT *fj, F_FLOAT *fk) const; + void ters_dthb(const Param& param, const F_FLOAT &prefactor, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, + F_FLOAT *fi, F_FLOAT *fj, F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION - void ters_dthbk(const int &i, const int &j, const int &k, const F_FLOAT &prefactor, - const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, - const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, - F_FLOAT *fk) const; + void ters_dthbj(const Param& param, const F_FLOAT &prefactor, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, + F_FLOAT *fj, F_FLOAT *fk) const; + + KOKKOS_INLINE_FUNCTION + void ters_dthbk(const Param& param, const F_FLOAT &prefactor, + const F_FLOAT &rij, const F_FLOAT &dx1, const F_FLOAT &dy1, const F_FLOAT &dz1, + const F_FLOAT &rik, const F_FLOAT &dx2, const F_FLOAT &dy2, const F_FLOAT &dz2, + F_FLOAT *fk) const; KOKKOS_INLINE_FUNCTION double vec3_dot(const F_FLOAT x[3], const double y[3]) const { @@ -150,17 +130,6 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const; - struct params_ters { - KOKKOS_INLINE_FUNCTION - params_ters() {powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0; - bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;Z_i=0;Z_j=0;ZBLcut=0;ZBLexpscale=0;}; - KOKKOS_INLINE_FUNCTION - params_ters(int /*i*/) {powerm=0;gamma=0;lam3=0;c=0;d=0;h=0;powern=0;beta=0;lam2=0;bigb=0; - bigr=0;bigd=0;lam1=0;biga=0;cutsq=0;c1=0;c2=0;c3=0;c4=0;Z_i=0;Z_j=0;ZBLcut=0;ZBLexpscale=0;}; - F_FLOAT powerm, gamma, lam3, c, d, h, powern, beta, lam2, bigb, bigr, - bigd, lam1, biga, cutsq, c1, c2, c3, c4, Z_i, Z_j, ZBLcut, ZBLexpscale; - }; - template KOKKOS_INLINE_FUNCTION void ev_tally(EV_FLOAT &ev, const int &i, const int &j, @@ -170,28 +139,33 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { template KOKKOS_INLINE_FUNCTION void v_tally3(EV_FLOAT &ev, const int &i, const int &j, const int &k, - F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; + F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drij, F_FLOAT *drik) const; KOKKOS_INLINE_FUNCTION void v_tally3_atom(EV_FLOAT &ev, const int &i, const int &j, const int &k, - F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; + F_FLOAT *fj, F_FLOAT *fk, F_FLOAT *drji, F_FLOAT *drjk) const; - void allocate() override; void setup_params() override; KOKKOS_INLINE_FUNCTION - double fermi_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double fermi_k(const Param& param, const F_FLOAT &r) const; KOKKOS_INLINE_FUNCTION - double fermi_d_k(const int &i, const int &j, const int &k, const F_FLOAT &r) const; + double fermi_d_k(const Param& param, const F_FLOAT &r) const; protected: typedef Kokkos::DualView tdual_int_3d; - Kokkos::DualView k_params; - typename Kokkos::DualView::t_dev_const_um paramskk; - // hardwired to space for 12 atom types - //params_ters m_params[MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1][MAX_TYPES_STACKPARAMS+1]; + typedef typename tdual_int_3d::t_dev_const_randomread t_int_3d_randomread; + typedef typename tdual_int_3d::t_host t_host_int_3d; + + t_int_3d_randomread d_elem3param; + typename AT::t_int_1d_randomread d_map; + + typedef Kokkos::DualView tdual_param_1d; + typedef typename tdual_param_1d::t_dev t_param_1d; + typedef typename tdual_param_1d::t_host t_host_param_1d; + + t_param_1d d_params; int inum; typename AT::t_x_array_randomread x; @@ -238,7 +212,7 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { Kokkos::View d_numneigh_short; // ZBL - F_FLOAT global_a_0; // Bohr radius for Coulomb repulsion + F_FLOAT global_a_0; // Bohr radius for Coulomb repulsion F_FLOAT global_epsilon_0; // permittivity of vacuum for Coulomb repulsion F_FLOAT global_e; // proton charge (negative of electron charge) @@ -250,18 +224,3 @@ class PairTersoffZBLKokkos : public PairTersoffZBL { #endif #endif -/* ERROR/WARNING messages: - -E: Pair tersoff/zbl/kk requires metal or real units - -This is a current restriction of this pair potential. - -E: Cannot (yet) use full neighbor list style with tersoff/zbl/kk - -Self-explanatory. - -E: Cannot use chosen neighbor list style with tersoff/zbl/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_vashishta_kokkos.h b/src/KOKKOS/pair_vashishta_kokkos.h index e9f9a426c7..ec0e4e2e7e 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.h +++ b/src/KOKKOS/pair_vashishta_kokkos.h @@ -160,10 +160,3 @@ class PairVashishtaKokkos : public PairVashishta { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use chosen neighbor list style with pair vashishta/kk - -Self-explanatory. - -*/ diff --git a/src/KOKKOS/pair_yukawa_kokkos.h b/src/KOKKOS/pair_yukawa_kokkos.h index 1671a06f14..481f4dabb2 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.h +++ b/src/KOKKOS/pair_yukawa_kokkos.h @@ -119,24 +119,3 @@ class PairYukawaKokkos : public PairYukawa { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use Kokkos pair style with rRESPA inner/middle - -UNDOCUMENTED - -E: Cannot use chosen neighbor list style with yukawa/kk - -That style is not supported by Kokkos. - -U: 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. - -U: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/KOKKOS/pair_zbl_kokkos.h b/src/KOKKOS/pair_zbl_kokkos.h index 507df93fba..376ad8f600 100644 --- a/src/KOKKOS/pair_zbl_kokkos.h +++ b/src/KOKKOS/pair_zbl_kokkos.h @@ -107,14 +107,3 @@ class PairZBLKokkos : public PairZBL { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use Kokkos pair style with rRESPA inner/middle - -UNDOCUMENTED - -E: Cannot use chosen neighbor list style with lj/cut/kk - -UNDOCUMENTED - -*/ diff --git a/src/KOKKOS/pppm_kokkos.h b/src/KOKKOS/pppm_kokkos.h index 1b9ec05535..a6df833a04 100644 --- a/src/KOKKOS/pppm_kokkos.h +++ b/src/KOKKOS/pppm_kokkos.h @@ -481,147 +481,4 @@ class PPPMKokkos : public PPPM, public KokkosBaseFFT { #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: Cannot (yet) use PPPM Kokkos with 'kspace_modify diff ad' - -UNDOCUMENTED - -E: Cannot (yet) use PPPM with triclinic box and slab correction - -This feature is not yet supported. - -E: Cannot use PPPM with 2d simulation - -The kspace style pppm cannot be used in 2d simulations. You can use -2d PPPM in a 3d simulation; see the kspace_modify command. - -E: PPPM can only currently be used with comm_style brick - -This is a current restriction in LAMMPS. - -E: Kspace style requires atomKK attribute q - -UNDOCUMENTED - -E: Cannot use non-periodic boundaries with PPPM - -For kspace style pppm, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab PPPM - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with PPPM. - -E: PPPM order cannot be < 2 or > than %d - -This is a limitation of the PPPM implementation in LAMMPS. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: Cannot (yet) use PPPM Kokkos TIP4P - -UNDOCUMENTED - -W: Reducing PPPM order b/c stencil extends beyond nearest neighbor processor - -This may lead to a larger grid than desired. See the kspace_modify overlap -command to prevent changing of the PPPM order. - -E: PPPM order < minimum allowed order - -The default minimum order is 2. This can be reset by the -kspace_modify minorder command. - -E: PPPM grid stencil extends beyond nearest neighbor processor - -This is not allowed if the kspace_modify overlap setting is no. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Must use 'kspace_modify gewald' for uncharged system - -UNDOCUMENTED - -E: PPPM grid is too large - -The global PPPM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 4096. You likely need to decrease the -requested accuracy. - -E: Could not compute g_ewald - -The Newton-Raphson solver failed to converge to a good value for -g_ewald. This error should not occur for typical problems. Please -send an email to the developers. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -U: Cannot (yet) use PPPM with triclinic box and kspace_modify diff ad - -This feature is not yet supported. - -U: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -U: Pair style is incompatible with TIP4P KSpace style - -The pair style does not have the requires TIP4P settings. - -U: Bond and angle potentials must be defined for TIP4P - -Cannot use TIP4P pair potential unless bond and angle potentials -are defined. - -U: Bad TIP4P angle type for PPPM/TIP4P - -Specified angle type is not valid. - -U: Bad TIP4P bond type for PPPM/TIP4P - -Specified bond type is not valid. - -U: Cannot (yet) use PPPM with triclinic box and TIP4P - -This feature is not yet supported. - -U: Could not compute grid size - -The code is unable to compute a grid size consistent with the desired -accuracy. This error should not occur for typical problems. Please -send an email to the developers. - -*/ diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.h b/src/KOKKOS/rand_pool_wrap_kokkos.h index d2a37ed1bd..767f3d99b8 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.h +++ b/src/KOKKOS/rand_pool_wrap_kokkos.h @@ -83,6 +83,3 @@ class RandPoolWrap : protected Pointers { #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KOKKOS/region_block_kokkos.h b/src/KOKKOS/region_block_kokkos.h index 720a266524..40ce71551b 100644 --- a/src/KOKKOS/region_block_kokkos.h +++ b/src/KOKKOS/region_block_kokkos.h @@ -69,17 +69,3 @@ class RegBlockKokkos : public RegBlock, public KokkosBase { #endif #endif -/* ERROR/WARNING messages: - -E: Cannot use region INF or EDGE when box does not exist - -Regions that extend to the box boundaries can only be used after the -create_box command has been used. - -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. - -*/ diff --git a/src/KOKKOS/remap_kokkos.h b/src/KOKKOS/remap_kokkos.h index eff85f9ebd..a2d3e274b6 100644 --- a/src/KOKKOS/remap_kokkos.h +++ b/src/KOKKOS/remap_kokkos.h @@ -82,10 +82,3 @@ class RemapKokkos : protected Pointers { #endif -/* ERROR/WARNING messages: - -E: Could not create 3d remap plan - -The FFT setup in pppm failed. - -*/ diff --git a/src/KOKKOS/sna_kokkos.h b/src/KOKKOS/sna_kokkos.h index c33f5e486e..b3389f2a33 100644 --- a/src/KOKKOS/sna_kokkos.h +++ b/src/KOKKOS/sna_kokkos.h @@ -337,11 +337,3 @@ inline #include "sna_kokkos_impl.h" #endif -/* ERROR/WARNING messages: - -E: Invalid argument to factorial %d - -N must be >= 0 and <= 167, otherwise the factorial result is too -large. - -*/ diff --git a/src/KOKKOS/third_order_kokkos.cpp b/src/KOKKOS/third_order_kokkos.cpp index 2aeb9152a1..56c9295e70 100644 --- a/src/KOKKOS/third_order_kokkos.cpp +++ b/src/KOKKOS/third_order_kokkos.cpp @@ -160,7 +160,7 @@ void ThirdOrderKokkos::update_force() { int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; lmp->kokkos->auto_sync = 0; diff --git a/src/KOKKOS/third_order_kokkos.h b/src/KOKKOS/third_order_kokkos.h index 182c1d536e..b6c5b121f0 100644 --- a/src/KOKKOS/third_order_kokkos.h +++ b/src/KOKKOS/third_order_kokkos.h @@ -22,8 +22,8 @@ CommandStyle(third_order/kk/host,ThirdOrderKokkos); #ifndef LMP_THIRD_ORDER_KOKKOS_H #define LMP_THIRD_ORDER_KOKKOS_H -#include "third_order.h" #include "kokkos_type.h" +#include "third_order.h" namespace LAMMPS_NS { @@ -35,18 +35,17 @@ class ThirdOrderKokkos : public ThirdOrder { void setup(); KOKKOS_INLINE_FUNCTION - void operator() (const int& i) const { - f(i,0) += f_merge_copy(i,0); - f(i,1) += f_merge_copy(i,1); - f(i,2) += f_merge_copy(i,2); + void operator()(const int &i) const + { + f(i, 0) += f_merge_copy(i, 0); + f(i, 1) += f_merge_copy(i, 1); + f(i, 2) += f_merge_copy(i, 2); } protected: void update_force() override; void force_clear() override; - DAT::t_f_array f_merge_copy,f; - - + DAT::t_f_array f_merge_copy, f; }; } // namespace LAMMPS_NS diff --git a/src/KOKKOS/transpose_helper_kokkos.h b/src/KOKKOS/transpose_helper_kokkos.h index 464bf04c4c..676b6da530 100644 --- a/src/KOKKOS/transpose_helper_kokkos.h +++ b/src/KOKKOS/transpose_helper_kokkos.h @@ -1,3 +1,4 @@ +// clang-format off /* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories diff --git a/src/KOKKOS/verlet_kokkos.cpp b/src/KOKKOS/verlet_kokkos.cpp index 2d142edd83..1816415b47 100644 --- a/src/KOKKOS/verlet_kokkos.cpp +++ b/src/KOKKOS/verlet_kokkos.cpp @@ -271,7 +271,7 @@ void VerletKokkos::run(int n) int n_post_neighbor = modify->n_post_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; lmp->kokkos->auto_sync = 0; diff --git a/src/KOKKOS/verlet_kokkos.h b/src/KOKKOS/verlet_kokkos.h index 5159ef00ef..0581068598 100644 --- a/src/KOKKOS/verlet_kokkos.h +++ b/src/KOKKOS/verlet_kokkos.h @@ -55,6 +55,3 @@ class VerletKokkos : public Verlet { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index fbdd24af1d..2f787c54fe 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -121,7 +121,7 @@ void Ewald::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald.h b/src/KSPACE/ewald.h index be89015173..59da5a742c 100644 --- a/src/KSPACE/ewald.h +++ b/src/KSPACE/ewald.h @@ -81,54 +81,3 @@ class Ewald : public KSpace { #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: Cannot use Ewald with 2d simulation - -The kspace style ewald cannot be used in 2d simulations. You can use -2d Ewald in a 3d simulation; see the kspace_modify command. - -E: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use non-periodic boundaries with Ewald - -For kspace style ewald, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab Ewald - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with Ewald. - -E: Cannot (yet) use Ewald with triclinic box and slab correction - -This feature is not yet supported. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Must use 'kspace_modify gewald' for uncharged system - -UNDOCUMENTED - -E: Cannot (yet) use K-space slab correction with compute group/group for triclinic systems - -This option is not yet supported. - -*/ diff --git a/src/KSPACE/ewald_const.h b/src/KSPACE/ewald_const.h new file mode 100644 index 0000000000..3562b93644 --- /dev/null +++ b/src/KSPACE/ewald_const.h @@ -0,0 +1,29 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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_EWALD_CONST_H +#define LMP_EWALD_CONST_H + +namespace LAMMPS_NS { +namespace EwaldConst { + static constexpr double EWALD_F = 1.12837917; + static constexpr double EWALD_P = 0.3275911; + static constexpr double A1 = 0.254829592; + static constexpr double A2 = -0.284496736; + static constexpr double A3 = 1.421413741; + static constexpr double A4 = -1.453152027; + static constexpr double A5 = 1.061405429; +} // namespace EwaldConst +} // namespace LAMMPS_NS + +#endif diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 5c7835bd51..2aeacd3609 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -112,7 +112,7 @@ void EwaldDipole::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole.h b/src/KSPACE/ewald_dipole.h index 7bf75eaf5b..a65aca2095 100644 --- a/src/KSPACE/ewald_dipole.h +++ b/src/KSPACE/ewald_dipole.h @@ -50,54 +50,3 @@ class EwaldDipole : public Ewald { #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: Cannot use EwaldDipole with 2d simulation - -The kspace style ewald cannot be used in 2d simulations. You can use -2d EwaldDipole in a 3d simulation; see the kspace_modify command. - -E: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use nonperiodic boundaries with EwaldDipole - -For kspace style ewald, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab EwaldDipole - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with EwaldDipole. - -E: Cannot (yet) use EwaldDipole with triclinic box and slab correction - -This feature is not yet supported. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Must use 'kspace_modify gewald' for uncharged system - -UNDOCUMENTED - -E: Cannot (yet) use K-space slab correction with compute group/group for triclinic systems - -This option is not yet supported. - -*/ diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index 1f08205f21..8bad7b87a0 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -96,7 +96,7 @@ void EwaldDipoleSpin::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole_spin.h b/src/KSPACE/ewald_dipole_spin.h index 61b24b9eb8..c6c2063650 100644 --- a/src/KSPACE/ewald_dipole_spin.h +++ b/src/KSPACE/ewald_dipole_spin.h @@ -48,54 +48,3 @@ class EwaldDipoleSpin : public EwaldDipole { #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: Cannot use EwaldDipoleSpin with 2d simulation - -The kspace style ewald cannot be used in 2d simulations. You can use -2d EwaldDipoleSpin in a 3d simulation; see the kspace_modify command. - -E: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use nonperiodic boundaries with EwaldDipoleSpin - -For kspace style ewald, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab EwaldDipoleSpin - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with EwaldDipoleSpin. - -E: Cannot (yet) use EwaldDipoleSpin with triclinic box and slab correction - -This feature is not yet supported. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Must use 'kspace_modify gewald' for uncharged system - -UNDOCUMENTED - -E: Cannot (yet) use K-space slab correction with compute group/group for triclinic systems - -This option is not yet supported. - -*/ diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 670da1610d..cff419de76 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -543,7 +543,7 @@ void EwaldDisp::init_coeffs() int n = atom->ntypes; if (function[1]) { // geometric 1/r^6 - double **b = (double **) force->pair->extract("B",tmp); + auto b = (double **) force->pair->extract("B",tmp); delete [] B; B = new double[n+1]; B[0] = 0.0; @@ -551,8 +551,8 @@ void EwaldDisp::init_coeffs() for (int i=1; i<=n; ++i) B[i] = sqrt(fabs(b[i][i])); } if (function[2]) { // arithmetic 1/r^6 - double **epsilon = (double **) force->pair->extract("epsilon",tmp); - double **sigma = (double **) force->pair->extract("sigma",tmp); + auto epsilon = (double **) force->pair->extract("epsilon",tmp); + auto sigma = (double **) force->pair->extract("sigma",tmp); delete [] B; double eps_i, sigma_i, sigma_n, *bi = B = new double[7*n+7]; double c[7] = { @@ -772,7 +772,7 @@ void EwaldDisp::compute_ek() int lbytes = (2*nbox+1)*sizeof(cvector); hvector *h = nullptr; kvector *k, *nk = kvec+nkvec; - cvector *z = new cvector[2*nbox+1]; + auto z = new cvector[2*nbox+1]; cvector z1, *zx, *zy, *zz, *zn = z+2*nbox; complex *cek, zxyz, zxy = COMPLEX_NULL, cx = COMPLEX_NULL; double mui[3]; diff --git a/src/KSPACE/ewald_disp.h b/src/KSPACE/ewald_disp.h index 04d76c0b94..05017e1c76 100644 --- a/src/KSPACE/ewald_disp.h +++ b/src/KSPACE/ewald_disp.h @@ -95,80 +95,3 @@ class EwaldDisp : public KSpace { #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: Cannot use EwaldDisp with 2d simulation - -This is a current restriction of this command. - -E: Cannot use non-periodic boundaries with EwaldDisp - -For kspace style ewald/disp, all 3 dimensions must have periodic -boundaries unless you use the kspace_modify command to define a 2d -slab with a non-periodic z dimension. - -E: Incorrect boundaries with slab EwaldDisp - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with Ewald. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: Unsupported mixing rule in kspace_style ewald/disp - -Only geometric mixing is supported. - -E: Unsupported order in kspace_style ewald/disp - -Only 1/r^6 dispersion or dipole terms are supported. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -E: Cannot use Ewald/disp solver on system with no charge, dipole, or LJ particles - -No atoms in system have a non-zero charge or dipole, or are LJ -particles. Change charges/dipoles or change options of the kspace -solver/pair style. - -W: System is not charge neutral, net charge = %g - -The total charge on all atoms on the system is not 0.0. -For some KSpace solvers this is only a warning. - -E: KSpace accuracy must be > 0 - -UNDOCUMENTED - -E: Must use 'kspace_modify gewald' for uncharged system - -UNDOCUMENTED - -W: Ewald/disp Newton solver failed, using old method to estimate g_ewald - -Self-explanatory. Choosing a different cutoff value may help. - -E: KSpace accuracy too low - -Requested accuracy must be less than 1.0. - -E: Epsilon or sigma reference not set by pair style in ewald/n - -The pair style is not providing the needed epsilon or sigma values. - -E: Cannot (yet) use kspace slab correction with long-range dipoles and non-neutral systems or per-atom energy - -This feature is not yet supported. - -*/ diff --git a/src/KSPACE/fft3d.h b/src/KSPACE/fft3d.h index 12f426a061..bd0a1d2472 100644 --- a/src/KSPACE/fft3d.h +++ b/src/KSPACE/fft3d.h @@ -153,7 +153,3 @@ void factor(int, int *, int *); void bifactor(int, int *, int *); void fft_1d_only(FFT_DATA *, int, int, struct fft_plan_3d *); } - -/* ERROR/WARNING messages: - -*/ diff --git a/src/KSPACE/fft3d_wrap.h b/src/KSPACE/fft3d_wrap.h index 351bf5713d..708d6354d2 100644 --- a/src/KSPACE/fft3d_wrap.h +++ b/src/KSPACE/fft3d_wrap.h @@ -14,7 +14,7 @@ #ifndef LMP_FFT3D_WRAP_H #define LMP_FFT3D_WRAP_H -#include "fft3d.h" // IWYU pragma: export +#include "fft3d.h" // IWYU pragma: export #include "pointers.h" namespace LAMMPS_NS { @@ -36,13 +36,3 @@ class FFT3d : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Could not create 3d FFT plan - -The FFT setup for the PPPM solver failed, typically due -to lack of memory. This is an unusual error. Check the -size of the FFT grid you are requesting. - -*/ diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 6b3b969a7f..e2e0e4d622 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -104,7 +104,7 @@ void FixTuneKspace::init() acc_str = std::to_string(old_acc); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); pair_cut_coul = *p_cutoff; } @@ -120,7 +120,7 @@ void FixTuneKspace::pre_exchange() if (next_reneighbor != update->ntimestep) return; next_reneighbor = update->ntimestep + nevery; - Info *info = new Info(lmp); + auto info = new Info(lmp); bool has_msm = info->has_style("pair", base_pair_style + "/msm"); delete info; @@ -230,7 +230,7 @@ void FixTuneKspace::update_pair_style(const std::string &new_pair_style, double pair_cut_coul) { int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); *p_cutoff = pair_cut_coul; // check to see if we need to change pair styles @@ -250,7 +250,7 @@ void FixTuneKspace::update_pair_style(const std::string &new_pair_style, // restore current pair settings from temporary file force->pair->read_restart(p_pair_settings_file); - double *pcutoff = (double *) force->pair->extract("cut_coul",itmp); + auto pcutoff = (double *) force->pair->extract("cut_coul",itmp); double current_cutoff = *pcutoff; if (comm->me == 0) utils::logmesg(lmp,"Coulomb cutoff for real space: {}\n",current_cutoff); @@ -268,7 +268,7 @@ void FixTuneKspace::update_kspace_style(const std::string &new_kspace_style, { // delete old kspace style and create new one - char *tmp_acc_str = (char *)new_acc_str.c_str(); + auto tmp_acc_str = (char *)new_acc_str.c_str(); force->create_kspace(new_kspace_style.c_str(),1); force->kspace->settings(1,&tmp_acc_str); force->kspace->differentiation_flag = old_differentiation_flag; @@ -305,7 +305,7 @@ void FixTuneKspace::adjust_rcut(double time) // get the current cutoff int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); double current_cutoff = *p_cutoff; if (comm->me == 0) utils::logmesg(lmp,"Old Coulomb cutoff for real space: {}\n",current_cutoff); @@ -376,7 +376,7 @@ void FixTuneKspace::adjust_rcut(double time) *p_cutoff = pair_cut_coul; // report the new cutoff - double *new_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto new_cutoff = (double *) force->pair->extract("cut_coul",itmp); current_cutoff = *new_cutoff; if (comm->me == 0) utils::logmesg(lmp,"Adjusted Coulomb cutoff for real space: {}\n", current_cutoff); diff --git a/src/KSPACE/fix_tune_kspace.h b/src/KSPACE/fix_tune_kspace.h index 1acf4fcc80..5bfacbac91 100644 --- a/src/KSPACE/fix_tune_kspace.h +++ b/src/KSPACE/fix_tune_kspace.h @@ -83,26 +83,3 @@ class FixTuneKspace : public Fix { #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: Cannot use fix tune/kspace without a kspace style - -Self-explanatory. - -E: Cannot use fix tune/kspace without a pair style - -This fix (tune/kspace) can only be used when a pair style has been specified. - -E: Bad real space Coulomb cutoff in fix tune/kspace - -Fix tune/kspace tried to find the optimal real space Coulomb cutoff using -the Newton-Rhaphson method, but found a non-positive or NaN cutoff - -*/ diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index a6bfba3e6f..b518d8efe1 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -150,7 +150,7 @@ void MSM::init() pair_check(); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -1064,7 +1064,7 @@ void MSM::set_grid_global() cutoff = pow(k*k*sum/3.0,1.0/(2.0*p)); int itmp; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); *p_cutoff = cutoff; if (me == 0) @@ -2506,7 +2506,7 @@ void MSM::grid_swap_reverse(int n, double*** &gridn) void MSM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; @@ -2552,7 +2552,7 @@ void MSM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void MSM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; @@ -2598,7 +2598,7 @@ void MSM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void MSM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; @@ -2644,7 +2644,7 @@ void MSM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void MSM::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - double *buf = (double *) vbuf; + auto buf = (double *) vbuf; int n = current_level; int k = 0; diff --git a/src/KSPACE/msm.h b/src/KSPACE/msm.h index 980d8182f8..c39988b13b 100644 --- a/src/KSPACE/msm.h +++ b/src/KSPACE/msm.h @@ -144,96 +144,3 @@ class MSM : public KSpace { #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: Cannot (yet) use MSM with 2d simulation - -This feature is not yet supported. - -E: MSM can only currently be used with comm_style brick - -This is a current restriction in LAMMPS. - -E: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -W: Slab correction not needed for MSM - -Slab correction is intended to be used with Ewald or PPPM and is not needed by MSM. - -E: MSM order must be 4, 6, 8, or 10 - -This is a limitation of the MSM implementation in LAMMPS: -the MSM order can only be 4, 6, 8, or 10. - -E: Cannot (yet) use single precision with MSM (remove -DFFT_SINGLE from Makefile and recompile) - -Single precision cannot be used with MSM. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -W: Number of MSM mesh points changed to be a multiple of 2 - -MSM requires that the number of grid points in each direction be a multiple -of two and the number of grid points in one or more directions have been -adjusted to meet this requirement. - -W: Adjusting Coulombic cutoff for MSM, new cutoff = %g - -The adjust/cutoff command is turned on and the Coulombic cutoff has been -adjusted to match the user-specified accuracy. - -E: Too many MSM grid levels - -The max number of MSM grid levels is hardwired to 10. - -W: MSM mesh too small, increasing to 2 points in each direction - -Self-explanatory. - -E: MSM grid is too large - -The global MSM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 16384. You likely need to decrease the -requested accuracy. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute MSM - -One or more atoms are attempting to map their charge to a MSM grid point -that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -*/ diff --git a/src/KSPACE/msm_cg.h b/src/KSPACE/msm_cg.h index 9ab78ba65d..ad5c4f2a67 100644 --- a/src/KSPACE/msm_cg.h +++ b/src/KSPACE/msm_cg.h @@ -48,37 +48,3 @@ class MSMCG : public MSM { #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: Must use 'kspace_modify pressure/scalar no' with kspace_style msm/cg - -The kspace scalar pressure option is not compatible with kspace_style msm/cg. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute MSM - -One or more atoms are attempting to map their charge to a MSM grid point -that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -*/ diff --git a/src/KSPACE/pair_born_coul_long.h b/src/KSPACE/pair_born_coul_long.h index f7f8b5db3e..9d6b821d0a 100644 --- a/src/KSPACE/pair_born_coul_long.h +++ b/src/KSPACE/pair_born_coul_long.h @@ -58,30 +58,3 @@ class PairBornCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style born/coul/long requires atom attribute q - -An atom style that defines this attribute must be used. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/KSPACE/pair_born_coul_msm.h b/src/KSPACE/pair_born_coul_msm.h index 8338286a65..2eebbb26ad 100644 --- a/src/KSPACE/pair_born_coul_msm.h +++ b/src/KSPACE/pair_born_coul_msm.h @@ -41,11 +41,3 @@ class PairBornCoulMSM : public PairBornCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -*/ diff --git a/src/KSPACE/pair_buck_coul_long.h b/src/KSPACE/pair_buck_coul_long.h index 62d2619d09..ae6b71a441 100644 --- a/src/KSPACE/pair_buck_coul_long.h +++ b/src/KSPACE/pair_buck_coul_long.h @@ -59,30 +59,3 @@ class PairBuckCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style buck/coul/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/KSPACE/pair_buck_coul_msm.h b/src/KSPACE/pair_buck_coul_msm.h index 006c9032c0..77ce4e205c 100644 --- a/src/KSPACE/pair_buck_coul_msm.h +++ b/src/KSPACE/pair_buck_coul_msm.h @@ -41,11 +41,3 @@ class PairBuckCoulMSM : public PairBuckCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -*/ diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index 1af0857668..b1717a891d 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -249,8 +249,8 @@ void PairBuckLongCoulLong::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; // setup force tables @@ -264,7 +264,7 @@ void PairBuckLongCoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } diff --git a/src/KSPACE/pair_buck_long_coul_long.h b/src/KSPACE/pair_buck_long_coul_long.h index 3bb1723b3d..7a2474c0f7 100644 --- a/src/KSPACE/pair_buck_long_coul_long.h +++ b/src/KSPACE/pair_buck_long_coul_long.h @@ -68,59 +68,3 @@ class PairBuckLongCoulLong : public Pair { #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. - -W: Using largest cutoff for buck/long/coul/long - -Self-explanatory. - -E: Cutoffs missing in pair_style buck/long/coul/long - -Self-explanatory. - -E: LJ6 off not supported in pair_style buck/long/coul/long - -Self-explanatory. - -E: Coulomb cut not supported in pair_style buck/long/coul/coul - -Must use long-range Coulombic interactions. - -E: Only one cutoff allowed when requesting all long - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Invoking coulombic in pair style buck/long/coul/long requires atom attribute q - -UNDOCUMENTED - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -U: Pair style buck/long/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/KSPACE/pair_coul_long.h b/src/KSPACE/pair_coul_long.h index b196c5c662..8629e80efb 100644 --- a/src/KSPACE/pair_coul_long.h +++ b/src/KSPACE/pair_coul_long.h @@ -53,25 +53,3 @@ class PairCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/KSPACE/pair_coul_msm.h b/src/KSPACE/pair_coul_msm.h index 734c852f65..ad0d1427d2 100644 --- a/src/KSPACE/pair_coul_msm.h +++ b/src/KSPACE/pair_coul_msm.h @@ -37,11 +37,3 @@ class PairCoulMSM : public PairCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -*/ diff --git a/src/KSPACE/pair_coul_streitz.h b/src/KSPACE/pair_coul_streitz.h index 6d5036e83c..eb1032aadd 100644 --- a/src/KSPACE/pair_coul_streitz.h +++ b/src/KSPACE/pair_coul_streitz.h @@ -77,52 +77,3 @@ class PairCoulStreitz : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/streitz requires atom attribute q - -Self-explanatory. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open coul/streitz potential file %s - -The specified coul/streitz potential file cannot be opened. Check -that the path and name are correct. - -E: Incorrect format in coul/streitz potential file - -Incorrect number of words per line in the potential file. - -E: Illegal coul/streitz parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 67e0a328e5..6e39a4f56f 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -690,7 +690,7 @@ void PairLJCharmmCoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -713,8 +713,8 @@ void PairLJCharmmCoulLong::init_style() // set & error check interior rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) { - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) { + cut_respa = (dynamic_cast( update->integrate))->cutoff; cut_in_off = cut_respa[0]; cut_in_on = cut_respa[1]; cut_out_on = cut_respa[2]; diff --git a/src/KSPACE/pair_lj_charmm_coul_long.h b/src/KSPACE/pair_lj_charmm_coul_long.h index 463e537f56..c67cfb8c36 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.h +++ b/src/KSPACE/pair_lj_charmm_coul_long.h @@ -71,39 +71,3 @@ class PairLJCharmmCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/charmm/coul/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair inner cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.h b/src/KSPACE/pair_lj_charmm_coul_msm.h index d90f58aa7e..b3409035e2 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.h +++ b/src/KSPACE/pair_lj_charmm_coul_msm.h @@ -42,15 +42,3 @@ class PairLJCharmmCoulMSM : public PairLJCharmmCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -E: Must use 'kspace_modify pressure/scalar no' for rRESPA with kspace_style MSM - -The kspace scalar pressure option cannot (yet) be used with rRESPA. - -*/ diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 1fb72a3108..a4741a56a2 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -741,7 +741,7 @@ void PairLJCharmmfswCoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -775,8 +775,8 @@ void PairLJCharmmfswCoulLong::init_style() // set & error check interior rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) { - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) { + cut_respa = (dynamic_cast( update->integrate))->cutoff; if (MIN(cut_lj,cut_coul) < cut_respa[3]) error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.h b/src/KSPACE/pair_lj_charmmfsw_coul_long.h index dd72027334..b077b84a56 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.h +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.h @@ -71,39 +71,3 @@ class PairLJCharmmfswCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/charmmfsw/coul/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair inner cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index 6a3597a0ae..0ffdde24de 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -658,7 +658,7 @@ void PairLJCutCoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -669,8 +669,8 @@ void PairLJCutCoulLong::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald diff --git a/src/KSPACE/pair_lj_cut_coul_long.h b/src/KSPACE/pair_lj_cut_coul_long.h index d5e3e6f7e0..6800f05fb6 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.h +++ b/src/KSPACE/pair_lj_cut_coul_long.h @@ -64,30 +64,3 @@ class PairLJCutCoulLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/KSPACE/pair_lj_cut_coul_msm.h b/src/KSPACE/pair_lj_cut_coul_msm.h index 2b5b7e1a85..4d3b326085 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.h +++ b/src/KSPACE/pair_lj_cut_coul_msm.h @@ -42,15 +42,3 @@ class PairLJCutCoulMSM : public PairLJCutCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' to obtain per-atom virial with kspace_style MSM - -The kspace scalar pressure option cannot be used to obtain per-atom virial. - -E: Must use 'kspace_modify pressure/scalar no' for rRESPA with kspace_style MSM - -The kspace scalar pressure option cannot (yet) be used with rRESPA. - -*/ diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.h b/src/KSPACE/pair_lj_cut_tip4p_long.h index 091cd42ab5..bf5deab14e 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.h +++ b/src/KSPACE/pair_lj_cut_tip4p_long.h @@ -54,52 +54,3 @@ class PairLJCutTIP4PLong : public PairLJCutCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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: Pair style lj/cut/tip4p/long requires atom IDs - -There are no atom IDs defined in the system and the TIP4P potential -requires them to find O,H atoms with a water molecule. - -E: Pair style lj/cut/tip4p/long requires newton pair on - -This is because the computation of constraint forces within a water -molecule adds forces to atoms owned by other processors. - -E: Pair style lj/cut/tip4p/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -E: Water H epsilon must be 0.0 for pair style lj/cut/tip4p/long - -This is because LAMMPS does not compute the Lennard-Jones interactions -with these particles for efficiency reasons. - -*/ diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index a7d4464094..742f424b95 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -242,8 +242,8 @@ void PairLJLongCoulLong::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style,"^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast( update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast( update->integrate))->cutoff; else cut_respa = nullptr; // setup force tables @@ -257,7 +257,7 @@ void PairLJLongCoulLong::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast( update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } diff --git a/src/KSPACE/pair_lj_long_coul_long.h b/src/KSPACE/pair_lj_long_coul_long.h index 5b66a949a9..dab24d0c53 100644 --- a/src/KSPACE/pair_lj_long_coul_long.h +++ b/src/KSPACE/pair_lj_long_coul_long.h @@ -68,50 +68,3 @@ class PairLJLongCoulLong : public Pair { #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. - -W: Using largest cutoff for lj/long/coul/long - -Self-explanatory. - -E: Cutoffs missing in pair_style lj/long/coul/long - -Self-explanatory. - -E: Coulomb cut not supported in pair_style lj/long/coul/long - -Must use long-range Coulombic interactions. - -E: Only one cutoff allowed when requesting all long - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Invoking coulombic in pair style lj/long/coul/long requires atom attribute q - -UNDOCUMENTED - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -U: Invoking coulombic in pair style lj/coul requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/KSPACE/pair_lj_long_tip4p_long.h b/src/KSPACE/pair_lj_long_tip4p_long.h index c8e0265c41..a7f1fac4d6 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.h +++ b/src/KSPACE/pair_lj_long_tip4p_long.h @@ -57,64 +57,3 @@ class PairLJLongTIP4PLong : public PairLJLongCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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. - -W: Mixing forced for lj coefficients - -Self-explanatory. - -W: Using largest cutoff for pair_style lj/long/tip4p/long - -Self-explanatory. - -E: Coulomb cut not supported in pair_style lj/long/tip4p/long - -Must use long-range Coulombic interactions. - -E: Pair style lj/long/tip4p/long requires atom IDs - -There are no atom IDs defined in the system and the TIP4P potential -requires them to find O,H atoms with a water molecule. - -E: Pair style lj/long/tip4p/long requires newton pair on - -This is because the computation of constraint forces within a water -molecule adds forces to atoms owned by other processors. - -E: Pair style lj/long/tip4p/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -E: Water H epsilon must be 0.0 for pair style lj/long/tip4p/long - -This is because LAMMPS does not compute the Lennard-Jones interactions -with these particles for efficiency reasons. - -*/ diff --git a/src/KSPACE/pair_tip4p_long.h b/src/KSPACE/pair_tip4p_long.h index 8272ec8428..b64a08bf3d 100644 --- a/src/KSPACE/pair_tip4p_long.h +++ b/src/KSPACE/pair_tip4p_long.h @@ -54,47 +54,3 @@ class PairTIP4PLong : public PairCoulLong { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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: Pair style tip4p/long requires atom IDs - -There are no atom IDs defined in the system and the TIP4P potential -requires them to find O,H atoms with a water molecule. - -E: Pair style tip4p/long requires newton pair on - -This is because the computation of constraint forces within a water -molecule adds forces to atoms owned by other processors. - -E: Pair style tip4p/long requires atom attribute q - -The atom style defined does not have these attributes. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -*/ diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index d531233a3a..e94193759f 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -227,7 +227,7 @@ void PPPM::init() pair_check(); int itmp = 0; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -240,7 +240,7 @@ void PPPM::init() if (tip4pflag) { if (me == 0) utils::logmesg(lmp," extracting TIP4P info from pair style\n"); - double *p_qdist = (double *) force->pair->extract("qdist",itmp); + auto p_qdist = (double *) force->pair->extract("qdist",itmp); int *p_typeO = (int *) force->pair->extract("typeO",itmp); int *p_typeH = (int *) force->pair->extract("typeH",itmp); int *p_typeA = (int *) force->pair->extract("typeA",itmp); @@ -319,8 +319,7 @@ void PPPM::init() if (order < minorder) error->all(FLERR,"PPPM order < minimum allowed order"); if (!overlap_allowed && !gctmp->ghost_adjacent()) - error->all(FLERR,"PPPM grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPM grid stencil extends beyond nearest neighbor processor"); if (gctmp) delete gctmp; // adjust g_ewald @@ -569,8 +568,7 @@ void PPPM::setup_grid() allocate(); if (!overlap_allowed && !gc->ghost_adjacent()) - error->all(FLERR,"PPPM grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPM grid stencil extends beyond nearest neighbor processor"); // pre-compute Green's function denomiator expansion // pre-compute 1d charge distribution coefficients @@ -2610,7 +2608,7 @@ void PPPM::fieldforce_peratom() void PPPM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2670,7 +2668,7 @@ void PPPM::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2730,7 +2728,7 @@ void PPPM::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO) { FFT_SCALAR *src = &density_brick[nzlo_out][nylo_out][nxlo_out]; @@ -2745,7 +2743,7 @@ void PPPM::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPM::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; if (flag == REVERSE_RHO) { FFT_SCALAR *dest = &density_brick[nzlo_out][nylo_out][nxlo_out]; diff --git a/src/KSPACE/pppm.h b/src/KSPACE/pppm.h index fac47b7b8b..136aa6ad10 100644 --- a/src/KSPACE/pppm.h +++ b/src/KSPACE/pppm.h @@ -213,147 +213,3 @@ class PPPM : public KSpace { #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: Must redefine kspace_style after changing to triclinic box - -UNDOCUMENTED - -E: Cannot (yet) use PPPM with triclinic box and kspace_modify diff ad - -This feature is not yet supported. - -E: Cannot (yet) use PPPM with triclinic box and slab correction - -This feature is not yet supported. - -E: Cannot use PPPM with 2d simulation - -The kspace style pppm cannot be used in 2d simulations. You can use -2d PPPM in a 3d simulation; see the kspace_modify command. - -E: PPPM can only currently be used with comm_style brick - -This is a current restriction in LAMMPS. - -E: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use non-periodic boundaries with PPPM - -For kspace style pppm, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab PPPM - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with PPPM. - -E: PPPM order cannot be < 2 or > than %d - -This is a limitation of the PPPM implementation in LAMMPS. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: Pair style is incompatible with TIP4P KSpace style - -The pair style does not have the requires TIP4P settings. - -E: Bond and angle potentials must be defined for TIP4P - -Cannot use TIP4P pair potential unless bond and angle potentials -are defined. - -E: Bad TIP4P angle type for PPPM/TIP4P - -Specified angle type is not valid. - -E: Bad TIP4P bond type for PPPM/TIP4P - -Specified bond type is not valid. - -W: Reducing PPPM order b/c stencil extends beyond nearest neighbor processor - -This may lead to a larger grid than desired. See the kspace_modify overlap -command to prevent changing of the PPPM order. - -E: PPPM order < minimum allowed order - -The default minimum order is 2. This can be reset by the -kspace_modify minorder command. - -E: PPPM grid stencil extends beyond nearest neighbor processor - -This is not allowed if the kspace_modify overlap setting is no. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Must use kspace_modify gewald for uncharged system - -UNDOCUMENTED - -E: Could not compute grid size - -The code is unable to compute a grid size consistent with the desired -accuracy. This error should not occur for typical problems. Please -send an email to the developers. - -E: PPPM grid is too large - -The global PPPM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 4096. You likely need to decrease the -requested accuracy. - -E: Could not compute g_ewald - -The Newton-Raphson solver failed to converge to a good value for -g_ewald. This error should not occur for typical problems. Please -send an email to the developers. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -E: Cannot (yet) use K-space slab correction with compute group/group for triclinic systems - -This option is not yet supported. - -E: Cannot (yet) use kspace_modify diff ad with compute group/group - -This option is not yet supported. - -U: Cannot (yet) use PPPM with triclinic box and TIP4P - -This feature is not yet supported. - -*/ diff --git a/src/KSPACE/pppm_cg.h b/src/KSPACE/pppm_cg.h index 83cd19536c..3f1c293415 100644 --- a/src/KSPACE/pppm_cg.h +++ b/src/KSPACE/pppm_cg.h @@ -50,33 +50,3 @@ class PPPMCG : public PPPM { #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: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -*/ diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index abadcc52be..aef14b0189 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -153,7 +153,7 @@ void PPPMDipole::init() pair_check(); int itmp = 0; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -216,8 +216,7 @@ void PPPMDipole::init() if (order < minorder) error->all(FLERR,"PPPMDipole order < minimum allowed order"); if (!overlap_allowed && !gctmp->ghost_adjacent()) - error->all(FLERR,"PPPMDipole grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPMDipole grid stencil extends beyond nearest neighbor processor"); if (gctmp) delete gctmp; // adjust g_ewald @@ -375,8 +374,7 @@ void PPPMDipole::setup_grid() allocate(); if (!overlap_allowed && !gc_dipole->ghost_adjacent()) - error->all(FLERR,"PPPMDipole grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPMDipole grid stencil extends beyond nearest neighbor processor"); // pre-compute Green's function denomiator expansion // pre-compute 1d charge distribution coefficients @@ -2190,7 +2188,7 @@ void PPPMDipole::fieldforce_peratom_dipole() void PPPMDipole::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2263,7 +2261,7 @@ void PPPMDipole::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDipole::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -2336,7 +2334,7 @@ void PPPMDipole::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDipole::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; if (flag == REVERSE_MU) { @@ -2357,7 +2355,7 @@ void PPPMDipole::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDipole::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; if (flag == REVERSE_MU) { diff --git a/src/KSPACE/pppm_dipole.h b/src/KSPACE/pppm_dipole.h index ae16047194..4415d4014e 100644 --- a/src/KSPACE/pppm_dipole.h +++ b/src/KSPACE/pppm_dipole.h @@ -95,124 +95,3 @@ class PPPMDipole : public PPPM { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot (yet) use charges with Kspace style PPPMDipole - -Charge-dipole interactions are not yet implemented in PPPMDipole so this -feature is not yet supported. - -E: Must redefine kspace_style after changing to triclinic box - -Self-explanatory. - -E: Kspace style requires atom attribute mu - -The atom style defined does not have this attribute. - -E: Cannot (yet) use kspace_modify diff ad with dipoles - -This feature is not yet supported. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -E: Cannot yet use triclinic cells with PPPMDipole - -This feature is not yet supported. - -E: Cannot yet use TIP4P with PPPMDipole - -This feature is not yet supported. - -E: Cannot use nonperiodic boundaries with PPPM - -For kspace style pppm, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab PPPM - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with PPPM. - -E: PPPM order cannot be < 2 or > than %d - -This is a limitation of the PPPM implementation in LAMMPS. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range dipole components be used. - -W: Reducing PPPM order b/c stencil extends beyond nearest neighbor processor - -This may lead to a larger grid than desired. See the kspace_modify overlap -command to prevent changing of the PPPM order. - -E: PPPM order < minimum allowed order - -The default minimum order is 2. This can be reset by the -kspace_modify minorder command. - -E: PPPM grid stencil extends beyond nearest neighbor processor - -This is not allowed if the kspace_modify overlap setting is no. - -E: Cannot (yet) compute per-atom virial with kspace style pppm/dipole - -This feature is not yet supported. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Could not compute grid size - -The code is unable to compute a grid size consistent with the desired -accuracy. This error should not occur for typical problems. Please -send an email to the developers. - -E: PPPM grid is too large - -The global PPPM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 4096. You likely need to decrease the -requested accuracy. - -E: Could not compute g_ewald - -The Newton-Raphson solver failed to converge to a good value for -g_ewald. This error should not occur for typical problems. Please -send an email to the developers. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -E: Using kspace solver PPPMDipole on system with no dipoles - -Must have non-zero dipoles with PPPMDipole. - -E: Must use kspace_modify gewald for system with no dipoles - -Self-explanatory. - -*/ diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 1692ae3ed7..148da52770 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -138,7 +138,7 @@ void PPPMDipoleSpin::init() pair_check(); int itmp = 0; - double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); + auto p_cutoff = (double *) force->pair->extract("cut_coul",itmp); // check the correct extract here if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); @@ -201,8 +201,7 @@ void PPPMDipoleSpin::init() if (order < minorder) error->all(FLERR,"PPPMDipoleSpin order < minimum allowed order"); if (!overlap_allowed && !gctmp->ghost_adjacent()) - error->all(FLERR,"PPPMDipoleSpin grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPMDipoleSpin grid stencil extends beyond nearest neighbor processor"); if (gctmp) delete gctmp; // adjust g_ewald diff --git a/src/KSPACE/pppm_dipole_spin.h b/src/KSPACE/pppm_dipole_spin.h index c0b0a635be..f70d157b8d 100644 --- a/src/KSPACE/pppm_dipole_spin.h +++ b/src/KSPACE/pppm_dipole_spin.h @@ -52,124 +52,3 @@ class PPPMDipoleSpin : public PPPMDipole { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot (yet) use charges with Kspace style PPPMDipoleSpin - -Charge-spin interactions are not yet implemented in PPPMDipoleSpin so this -feature is not yet supported. - -E: Must redefine kspace_style after changing to triclinic box - -Self-explanatory. - -E: Kspace style requires atom attribute mu - -The atom style defined does not have this attribute. - -E: Cannot (yet) use kspace_modify diff ad with spins - -This feature is not yet supported. - -E: Cannot (yet) use 'electron' units with spins - -This feature is not yet supported. - -E: Cannot yet use triclinic cells with PPPMDipoleSpin - -This feature is not yet supported. - -E: Cannot yet use TIP4P with PPPMDipoleSpin - -This feature is not yet supported. - -E: Cannot use nonperiodic boundaries with PPPM - -For kspace style pppm, all 3 dimensions must have periodic boundaries -unless you use the kspace_modify command to define a 2d slab with a -non-periodic z dimension. - -E: Incorrect boundaries with slab PPPM - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with PPPM. - -E: PPPM order cannot be < 2 or > than %d - -This is a limitation of the PPPM implementation in LAMMPS. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range spin components be used. - -W: Reducing PPPM order b/c stencil extends beyond nearest neighbor processor - -This may lead to a larger grid than desired. See the kspace_modify overlap -command to prevent changing of the PPPM order. - -E: PPPM order < minimum allowed order - -The default minimum order is 2. This can be reset by the -kspace_modify minorder command. - -E: PPPM grid stencil extends beyond nearest neighbor processor - -This is not allowed if the kspace_modify overlap setting is no. - -E: Cannot (yet) compute per-atom virial with kspace style pppm/dipole/spin - -This feature is not yet supported. - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -E: Could not compute grid size - -The code is unable to compute a grid size consistent with the desired -accuracy. This error should not occur for typical problems. Please -send an email to the developers. - -E: PPPM grid is too large - -The global PPPM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 4096. You likely need to decrease the -requested accuracy. - -E: Could not compute g_ewald - -The Newton-Raphson solver failed to converge to a good value for -g_ewald. This error should not occur for typical problems. Please -send an email to the developers. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -E: Using kspace solver PPPMDipoleSpin on system with no spins - -Must have non-zero spins with PPPMDipoleSpin. - -E: Must use kspace_modify gewald for system with no spins - -Self-explanatory. - -*/ diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index 85aceb8500..bd2e48aa5b 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -366,7 +366,7 @@ void PPPMDisp::init() if (tip4pflag) { int itmp; - double *p_qdist = (double *) force->pair->extract("qdist",itmp); + auto p_qdist = (double *) force->pair->extract("qdist",itmp); int *p_typeO = (int *) force->pair->extract("typeO",itmp); int *p_typeH = (int *) force->pair->extract("typeH",itmp); int *p_typeA = (int *) force->pair->extract("typeA",itmp); @@ -456,8 +456,7 @@ void PPPMDisp::init() if (order < minorder) error->all(FLERR,"Coulomb PPPMDisp order has been reduced below minorder"); if (!overlap_allowed && !gctmp->ghost_adjacent()) - error->all(FLERR,"PPPMDisp grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPMDisp grid stencil extends beyond nearest neighbor processor"); if (gctmp) delete gctmp; // adjust g_ewald @@ -538,8 +537,7 @@ void PPPMDisp::init() error->all(FLERR,"Dispersion PPPMDisp order has been " "reduced below minorder"); if (!overlap_allowed && !gctmp->ghost_adjacent()) - error->all(FLERR,"Dispersion PPPMDisp grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"Dispersion PPPMDisp grid stencil extends beyond nearest neighbor proc"); if (gctmp) delete gctmp; // adjust g_ewald_6 @@ -837,13 +835,11 @@ void PPPMDisp::setup_grid() if (function[0]) { if (!overlap_allowed && !gc->ghost_adjacent()) - error->all(FLERR,"PPPMDisp grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"PPPMDisp grid stencil extends beyond nearest neighbor processor"); } if (function[1] + function[2] + function[3]) { if (!overlap_allowed && !gc6->ghost_adjacent()) - error->all(FLERR,"Dispersion PPPMDisp grid stencil extends " - "beyond nearest neighbor processor"); + error->all(FLERR,"Dispersion PPPMDisp grid stencil extends beyond nearest neighbor proc"); } // pre-compute Green's function denomiator expansion @@ -1301,7 +1297,7 @@ void PPPMDisp::init_coeffs() double **Q=nullptr; if (n > 1) { // get dispersion coefficients - double **b = (double **) force->pair->extract("B",tmp); + auto b = (double **) force->pair->extract("B",tmp); memory->create(A,n,n,"pppm/disp:A"); memory->create(Q,n,n,"pppm/disp:Q"); // fill coefficients to matrix a @@ -1379,7 +1375,7 @@ void PPPMDisp::init_coeffs() // check if the function should preferably be [1] or [2] or [3] if (nsplit == 1) { - if (B) delete [] B; + delete[] B; function[3] = 0; function[2] = 0; function[1] = 1; @@ -1392,12 +1388,12 @@ void PPPMDisp::init_coeffs() utils::logmesg(lmp," Using {} instead of 7 structure factors\n",nsplit); //function[3] = 1; //function[2] = 0; - if (B) delete [] B; // remove this when un-comment previous 2 lines + delete[] B; // remove this when un-comment previous 2 lines } if (function[2] && (nsplit > 6)) { if (me == 0) utils::logmesg(lmp," Using 7 structure factors\n"); - if (B) delete [] B; + delete[] B; } if (function[3]) { @@ -1413,15 +1409,15 @@ void PPPMDisp::init_coeffs() } if (function[1]) { // geometric 1/r^6 - double **b = (double **) force->pair->extract("B",tmp); + auto b = (double **) force->pair->extract("B",tmp); B = new double[n+1]; B[0] = 0.0; for (int i=1; i<=n; ++i) B[i] = sqrt(fabs(b[i][i])); } if (function[2]) { // arithmetic 1/r^6 - double **epsilon = (double **) force->pair->extract("epsilon",tmp); - double **sigma = (double **) force->pair->extract("sigma",tmp); + auto epsilon = (double **) force->pair->extract("epsilon",tmp); + auto sigma = (double **) force->pair->extract("sigma",tmp); if (!(epsilon&&sigma)) error->all(FLERR,"Epsilon or sigma reference not set by pair style for PPPMDisp"); double eps_i,sigma_i,sigma_n; @@ -6820,7 +6816,7 @@ void PPPMDisp::fieldforce_none_peratom() void PPPMDisp::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -7333,7 +7329,7 @@ void PPPMDisp::pack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDisp::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -7846,7 +7842,7 @@ void PPPMDisp::unpack_forward_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDisp::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; @@ -7901,7 +7897,7 @@ void PPPMDisp::pack_reverse_grid(int flag, void *vbuf, int nlist, int *list) void PPPMDisp::unpack_reverse_grid(int flag, void *vbuf, int nlist, int *list) { - FFT_SCALAR *buf = (FFT_SCALAR *) vbuf; + auto buf = (FFT_SCALAR *) vbuf; int n = 0; diff --git a/src/KSPACE/pppm_disp.h b/src/KSPACE/pppm_disp.h index de05a2f551..533a3a2112 100644 --- a/src/KSPACE/pppm_disp.h +++ b/src/KSPACE/pppm_disp.h @@ -351,174 +351,3 @@ class PPPMDisp : public KSpace { #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: Cannot use PPPMDisp with 2d simulation - -The kspace style pppm/disp cannot be used in 2d simulations. You can -use 2d pppm/disp in a 3d simulation; see the kspace_modify command. - -E: PPPMDisp can only currently be used with comm_style brick - -This is a current restriction in LAMMPS. - -E: Cannot use non-periodic boundaries with PPPMDisp - -For kspace style pppm/disp, all 3 dimensions must have periodic -boundaries unless you use the kspace_modify command to define a 2d -slab with a non-periodic z dimension. - -E: Incorrect boundaries with slab PPPMDisp - -Must have periodic x,y dimensions and non-periodic z dimension to use -2d slab option with pppm/disp. - -E: PPPMDisp coulomb order cannot be greater than %d - -This is a limitation of the PPPM implementation in LAMMPS. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -E: Unsupported order in kspace_style pppm/disp, pair_style %s - -Only pair styles with 1/r and 1/r^6 dependence are currently supported. - -W: Charges are set, but coulombic solver is not used - -Self-explanatory. - -E: PPPMDisp used but no parameters set, for further information please see the pppm/disp documentation - -An efficient and accurate usage of the pppm/disp requires settings via the kspace_modify command. Please see the pppm/disp documentation for further instructions. - -E: Bond and angle potentials must be defined for TIP4P - -Cannot use TIP4P pair potential unless bond and angle potentials -are defined. - -E: Bad TIP4P angle type for PPPMDisp/TIP4P - -Specified angle type is not valid. - -E: Bad TIP4P bond type for PPPMDisp/TIP4P - -Specified bond type is not valid. - -W: Reducing PPPMDisp Coulomb order b/c stencil extends beyond neighbor processor - -This may lead to a larger grid than desired. See the kspace_modify overlap -command to prevent changing of the PPPM order. - -E: PPPMDisp Coulomb grid is too large - -The global PPPM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 4096. You likely need to decrease the -requested accuracy. - -E: Coulomb PPPMDisp order has been reduced below minorder - -The default minimum order is 2. This can be reset by the -kspace_modify minorder command. - -W: Reducing PPPMDisp dispersion order b/c stencil extends beyond neighbor processor - -This may lead to a larger grid than desired. See the kspace_modify overlap -command to prevent changing of the PPPM order. - -E: PPPMDisp Dispersion grid is too large - -The global PPPM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 4096. You likely need to decrease the -requested accuracy. - -E: Dispersion PPPMDisp order has been reduced below minorder - -The default minimum order is 2. This can be reset by the -kspace_modify minorder command. - -E: PPPM grid stencil extends beyond nearest neighbor processor - -This is not allowed if the kspace_modify overlap setting is no. - -E: Matrix factorization to split dispersion coefficients failed - -This should not normally happen. Contact the developers. - -W: Estimated error in splitting of dispersion coeffs is %g - -Error is greater than 0.0001 percent. - -W: Simulations might be very slow because of large number of structure factors - -Self-explanatory. - -E: Epsilon or sigma reference not set by pair style in PPPMDisp - -Self-explanatory. - -E: KSpace accuracy too large to estimate G vector - -Reduce the accuracy request or specify gewald explicitly -via the kspace_modify command. - -E: Could not compute grid size for Coulomb interaction - -The code is unable to compute a grid size consistent with the desired -accuracy. This error should not occur for typical problems. Please -send an email to the developers. - -E: Could not compute g_ewald - -The Newton-Raphson solver failed to converge to a good value for -g_ewald. This error should not occur for typical problems. Please -send an email to the developers. - -E: Could not adjust g_ewald_6 - -The Newton-Raphson solver failed to converge to a good value for -g_ewald. This error should not occur for typical problems. Please -send an email to the developers. - -E: Cannot compute initial g_ewald_disp - -LAMMPS failed to compute an initial guess for the PPPM_disp g_ewald_6 -factor that partitions the computation between real space and k-space -for Dispersion interactions. - -E: Could not compute grid size for Dispersion - -The code is unable to compute a grid size consistent with the desired -accuracy. This error should not occur for typical problems. Please -send an email to the developers. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPMDisp - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -*/ diff --git a/src/KSPACE/pppm_disp_tip4p.h b/src/KSPACE/pppm_disp_tip4p.h index dbc3fb98aa..a432a7eeeb 100644 --- a/src/KSPACE/pppm_disp_tip4p.h +++ b/src/KSPACE/pppm_disp_tip4p.h @@ -31,8 +31,8 @@ class PPPMDispTIP4P : public PPPMDisp { void init() override; protected: - void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, - int, int) override; + void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, int, + int) override; void make_rho_c() override; void fieldforce_c_ik() override; void fieldforce_c_ad() override; @@ -46,41 +46,3 @@ class PPPMDispTIP4P : public PPPMDisp { #endif #endif - -/* ERROR/WARNING messages: - -E: Kspace style pppm/disp/tip4p requires newton on - -Self-explanatory. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -*/ diff --git a/src/KSPACE/pppm_stagger.h b/src/KSPACE/pppm_stagger.h index 77b7478d42..92e05d39b1 100644 --- a/src/KSPACE/pppm_stagger.h +++ b/src/KSPACE/pppm_stagger.h @@ -77,37 +77,3 @@ class PPPMStagger : public PPPM { #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: Cannot (yet) use kspace_style pppm/stagger with triclinic systems - -This feature is not yet supported. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -*/ diff --git a/src/KSPACE/pppm_tip4p.h b/src/KSPACE/pppm_tip4p.h index 3087f895dd..cf63af0d81 100644 --- a/src/KSPACE/pppm_tip4p.h +++ b/src/KSPACE/pppm_tip4p.h @@ -44,41 +44,3 @@ class PPPMTIP4P : public PPPM { #endif #endif - -/* ERROR/WARNING messages: - -E: Kspace style pppm/tip4p requires newton on - -Self-explanatory. - -E: Non-numeric box dimensions - simulation unstable - -The box size has apparently blown up. - -E: Out of range atoms - cannot compute PPPM - -One or more atoms are attempting to map their charge to a PPPM grid -point that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -*/ diff --git a/src/KSPACE/remap.cpp b/src/KSPACE/remap.cpp index 9ca040aa64..c3e8fafdac 100644 --- a/src/KSPACE/remap.cpp +++ b/src/KSPACE/remap.cpp @@ -125,10 +125,8 @@ void remap_3d(FFT_SCALAR *in, FFT_SCALAR *out, FFT_SCALAR *buf, for (int i=0;inrecv;i++) recvBufferSize += plan->recv_size[i]; - FFT_SCALAR *packedSendBuffer - = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * sendBufferSize); - FFT_SCALAR *packedRecvBuffer - = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * recvBufferSize); + auto packedSendBuffer = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * sendBufferSize); + auto packedRecvBuffer = (FFT_SCALAR *) malloc(sizeof(FFT_SCALAR) * recvBufferSize); int *sendcnts = (int *) malloc(sizeof(int) * plan->commringlen); int *rcvcnts = (int *) malloc(sizeof(int) * plan->commringlen); diff --git a/src/KSPACE/remap_wrap.h b/src/KSPACE/remap_wrap.h index d5846bae76..dc59ad7402 100644 --- a/src/KSPACE/remap_wrap.h +++ b/src/KSPACE/remap_wrap.h @@ -33,11 +33,3 @@ class Remap : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Could not create 3d remap plan - -The FFT setup in pppm failed. - -*/ diff --git a/src/LATBOLTZ/fix_lb_fluid.cpp b/src/LATBOLTZ/fix_lb_fluid.cpp index 71e689b84e..078a38a593 100644 --- a/src/LATBOLTZ/fix_lb_fluid.cpp +++ b/src/LATBOLTZ/fix_lb_fluid.cpp @@ -2387,8 +2387,8 @@ void FixLbFluid::dump(const bigint step) " \n" " \n\n", dm_lb / (dx_lb * dx_lb * dx_lb), fluid_global_n0[2], fluid_global_n0[1], - fluid_global_n0[0], sizeof(double), offset, fluid_global_n0[2], - fluid_global_n0[1], fluid_global_n0[0], dump_file_name_raw.c_str()); + fluid_global_n0[0], sizeof(double), offset, fluid_global_n0[2], fluid_global_n0[1], + fluid_global_n0[0], dump_file_name_raw.c_str()); fmt::print(dump_file_handle_xdmf, " \n" " - using namespace LAMMPS_NS; #define NMAT_FULL 9 @@ -63,42 +60,33 @@ AtomVecSMD::AtomVecSMD(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "esph desph vfrac rmass x0 radius contact_radius molecule " - "smd_data_9 vest smd_stress " - "eff_plastic_strain eff_plastic_strain_rate damage"; - fields_copy = (char *) - "esph vfrac rmass x0 radius contact_radius molecule " - "eff_plastic_strain eff_plastic_strain_rate vest " - "smd_data_9 smd_stress damage"; - fields_comm = (char *) "radius vfrac vest esph"; - fields_comm_vel = (char *) "radius vfrac vest esph"; - fields_reverse = (char *) "desph"; - fields_border = (char *) - "x0 molecule radius rmass vfrac contact_radius esph " - "eff_plastic_strain smd_data_9 smd_stress"; - fields_border_vel = (char *) - "x0 molecule radius rmass vfrac contact_radius esph " - "eff_plastic_strain smd_data_9 smd_stress vest"; - fields_exchange = (char *) - "x0 molecule radius rmass vfrac contact_radius esph " - "eff_plastic_strain eff_plastic_strain_rate smd_data_9 smd_stress " - "vest damage"; - fields_restart = (char *) - "x0 molecule radius rmass vfrac contact_radius esph " - "eff_plastic_strain eff_plastic_strain_rate smd_data_9 smd_stress " - "vest damage"; - fields_create = (char *) - "x0 vest vfrac rmass radius contact_radius molecule esph " - "eff_plastic_strain eff_plastic_strain_rate smd_data_9 smd_stress damage"; - fields_data_atom = (char *) - "id type molecule vfrac rmass radius contact_radius x0 x"; - fields_data_vel = (char *) "id v"; + // clang-format off + fields_grow = {"esph", "desph", "vfrac", "rmass", "x0", "radius", "contact_radius", "molecule", + "smd_data_9", "vest", "smd_stress", "eff_plastic_strain", "eff_plastic_strain_rate", "damage"}; + fields_copy = {"esph", "vfrac", "rmass", "x0", "radius", "contact_radius", "molecule", + "eff_plastic_strain", "eff_plastic_strain_rate", "vest", "smd_data_9", "smd_stress", "damage"}; + fields_comm = {"radius", "vfrac", "vest", "esph"}; + fields_comm_vel = {"radius", "vfrac", "vest", "esph"}; + fields_reverse = {"desph"}; + fields_border = {"x0", "molecule", "radius", "rmass", "vfrac", "contact_radius", "esph", + "eff_plastic_strain", "smd_data_9", "smd_stress"}; + fields_border_vel = {"x0", "molecule", "radius", "rmass", "vfrac", "contact_radius", "esph", + "eff_plastic_strain", "smd_data_9", "smd_stress", "vest"}; + fields_exchange = {"x0", "molecule", "radius", "rmass", "vfrac", "contact_radius", "esph", + "eff_plastic_strain", "eff_plastic_strain_rate", "smd_data_9", "smd_stress", "vest", "damage"}; + fields_restart ={"x0", "molecule", "radius", "rmass", "vfrac", "contact_radius", "esph", + "eff_plastic_strain", "eff_plastic_strain_rate", "smd_data_9", "smd_stress", "vest", "damage"}; + fields_create = {"x0", "vest", "vfrac", "rmass", "radius", "contact_radius", "molecule", + "esph", "eff_plastic_strain", "eff_plastic_strain_rate", "smd_data_9", "smd_stress", "damage"}; + fields_data_atom = {"id", "type", "molecule", "vfrac", "rmass", "radius", "contact_radius", + "x0", "x"}; + fields_data_vel = {"id", "v"}; + // clang-format on // set these array sizes based on defines - atom->add_peratom_change_columns("smd_data_9",NMAT_FULL); - atom->add_peratom_change_columns("smd_stress",NMAT_SYMM); + atom->add_peratom_change_columns("smd_data_9", NMAT_FULL); + atom->add_peratom_change_columns("smd_stress", NMAT_SYMM); setup_fields(); } @@ -134,7 +122,7 @@ void AtomVecSMD::grow_pointers() void AtomVecSMD::force_clear(int n, size_t nbytes) { - memset(&desph[n],0,nbytes); + memset(&desph[n], 0, nbytes); } /* ---------------------------------------------------------------------- @@ -153,9 +141,9 @@ void AtomVecSMD::create_atom_post(int ilocal) contact_radius[ilocal] = 0.5; molecule[ilocal] = 1; - smd_data_9[ilocal][0] = 1.0; // xx - smd_data_9[ilocal][4] = 1.0; // yy - smd_data_9[ilocal][8] = 1.0; // zz + smd_data_9[ilocal][0] = 1.0; // xx + smd_data_9[ilocal][4] = 1.0; // yy + smd_data_9[ilocal][8] = 1.0; // zz } /* ---------------------------------------------------------------------- @@ -179,13 +167,11 @@ void AtomVecSMD::data_atom_post(int ilocal) eff_plastic_strain[ilocal] = 0.0; eff_plastic_strain_rate[ilocal] = 0.0; - for (int k = 0; k < NMAT_FULL; k++) - smd_data_9[ilocal][k] = 0.0; + for (int k = 0; k < NMAT_FULL; k++) smd_data_9[ilocal][k] = 0.0; - for (int k = 0; k < NMAT_SYMM; k++) - smd_stress[ilocal][k] = 0.0; + for (int k = 0; k < NMAT_SYMM; k++) smd_stress[ilocal][k] = 0.0; - smd_data_9[ilocal][0] = 1.0; // xx - smd_data_9[ilocal][4] = 1.0; // yy - smd_data_9[ilocal][8] = 1.0; // zz + smd_data_9[ilocal][0] = 1.0; // xx + smd_data_9[ilocal][4] = 1.0; // yy + smd_data_9[ilocal][8] = 1.0; // zz } diff --git a/src/MACHDYN/atom_vec_smd.h b/src/MACHDYN/atom_vec_smd.h index a1ed384f1d..bde5b4595d 100644 --- a/src/MACHDYN/atom_vec_smd.h +++ b/src/MACHDYN/atom_vec_smd.h @@ -55,24 +55,3 @@ class AtomVecSMD : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Invalid radius in Atoms section of data file - -Radius must be >= 0.0. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -*/ diff --git a/src/MACHDYN/compute_smd_hourglass_error.cpp b/src/MACHDYN/compute_smd_hourglass_error.cpp index b0d01d2b14..1e36c9d182 100644 --- a/src/MACHDYN/compute_smd_hourglass_error.cpp +++ b/src/MACHDYN/compute_smd_hourglass_error.cpp @@ -86,7 +86,7 @@ void ComputeSMDHourglassError::compute_peratom() { } int itmp = 0; - double *hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); + auto hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); if (hourglass_error == nullptr) { error->all(FLERR, "compute smd/hourglass_error failed to access hourglass_error array"); } diff --git a/src/MACHDYN/compute_smd_tlsph_dt.cpp b/src/MACHDYN/compute_smd_tlsph_dt.cpp index ca1973309f..44311fc4ce 100644 --- a/src/MACHDYN/compute_smd_tlsph_dt.cpp +++ b/src/MACHDYN/compute_smd_tlsph_dt.cpp @@ -87,7 +87,7 @@ void ComputeSMDTlsphDt::compute_peratom() { } int itmp = 0; - double *particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", + auto particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", itmp); if (particle_dt == nullptr) { error->all(FLERR, diff --git a/src/MACHDYN/compute_smd_tlsph_num_neighs.h b/src/MACHDYN/compute_smd_tlsph_num_neighs.h index 53efa059b6..5c0a1295e1 100644 --- a/src/MACHDYN/compute_smd_tlsph_num_neighs.h +++ b/src/MACHDYN/compute_smd_tlsph_num_neighs.h @@ -52,17 +52,3 @@ class ComputeSMDTLSPHNumNeighs : public Compute { #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. - -W: More than one compute ke/atom - -It is not efficient to use compute ke/atom more than once. - -*/ diff --git a/src/MACHDYN/compute_smd_tlsph_shape.cpp b/src/MACHDYN/compute_smd_tlsph_shape.cpp index 1887de683c..5e69c6650b 100644 --- a/src/MACHDYN/compute_smd_tlsph_shape.cpp +++ b/src/MACHDYN/compute_smd_tlsph_shape.cpp @@ -89,12 +89,12 @@ void ComputeSmdTlsphShape::compute_peratom() { } int itmp = 0; - Matrix3d *R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); + auto R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); if (R == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access rotation array"); } - Matrix3d *F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); + auto F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); if (F == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access deformation gradient array"); } diff --git a/src/MACHDYN/compute_smd_tlsph_strain.cpp b/src/MACHDYN/compute_smd_tlsph_strain.cpp index 30f158a3f1..bb71792442 100644 --- a/src/MACHDYN/compute_smd_tlsph_strain.cpp +++ b/src/MACHDYN/compute_smd_tlsph_strain.cpp @@ -92,7 +92,7 @@ void ComputeSMDTLSPHstrain::compute_peratom() { // copy data to output array int itmp = 0; - Matrix3d *Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); + auto Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); if (Fincr == nullptr) { error->all(FLERR, "compute smd/tlsph_strain failed to access Fincr array"); } diff --git a/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp b/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp index 1889cbcc0f..d6da2d2288 100644 --- a/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp +++ b/src/MACHDYN/compute_smd_tlsph_strain_rate.cpp @@ -89,7 +89,7 @@ void ComputeSMDTLSPHStrainRate::compute_peratom() { } int itmp = 0; - Matrix3d *D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); + auto D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); if (D == nullptr) { error->all(FLERR, "compute smd/tlsph_strain_rate could not access strain rate. Are the matching pair styles present?"); diff --git a/src/MACHDYN/compute_smd_tlsph_stress.cpp b/src/MACHDYN/compute_smd_tlsph_stress.cpp index 038e09a3c0..f8592fec8d 100644 --- a/src/MACHDYN/compute_smd_tlsph_stress.cpp +++ b/src/MACHDYN/compute_smd_tlsph_stress.cpp @@ -99,7 +99,7 @@ void ComputeSMDTLSPHStress::compute_peratom() { } int itmp = 0; - Matrix3d *T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); + auto T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); if (T == nullptr) { error->all(FLERR, "compute smd/tlsph_stress could not access stress tensors. Are the matching pair styles present?"); } diff --git a/src/MACHDYN/compute_smd_ulsph_effm.cpp b/src/MACHDYN/compute_smd_ulsph_effm.cpp index 24cae6b14e..35b0fe851d 100644 --- a/src/MACHDYN/compute_smd_ulsph_effm.cpp +++ b/src/MACHDYN/compute_smd_ulsph_effm.cpp @@ -23,16 +23,18 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include #include "compute_smd_ulsph_effm.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 using namespace LAMMPS_NS; @@ -87,12 +89,9 @@ void ComputeSMD_Ulsph_Effm::compute_peratom() { } int itmp = 0; - double *particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", - itmp); - if (particle_dt == nullptr) { - error->all(FLERR, - "compute smd/ulsph_effm failed to access particle_dt array"); - } + auto particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", itmp); + if (particle_dt == nullptr) + error->all(FLERR, "compute smd/ulsph_effm failed to access particle_dt array"); int *mask = atom->mask; int nlocal = atom->nlocal; diff --git a/src/MACHDYN/compute_smd_ulsph_num_neighs.h b/src/MACHDYN/compute_smd_ulsph_num_neighs.h index 29f98eac53..0d333e64c2 100644 --- a/src/MACHDYN/compute_smd_ulsph_num_neighs.h +++ b/src/MACHDYN/compute_smd_ulsph_num_neighs.h @@ -52,17 +52,3 @@ class ComputeSMDULSPHNumNeighs : public Compute { #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. - -W: More than one compute ke/atom - -It is not efficient to use compute ke/atom more than once. - -*/ diff --git a/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp b/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp index 9e2709eb0a..b690bfab88 100644 --- a/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp +++ b/src/MACHDYN/compute_smd_ulsph_strain_rate.cpp @@ -87,7 +87,7 @@ void ComputeSMDULSPHStrainRate::compute_peratom() { } int itmp = 0; - Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); + auto L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); if (L == nullptr) { error->all(FLERR, "compute smd/ulsph_strain_rate could not access any velocity gradients. Are the matching pair styles present?"); diff --git a/src/MACHDYN/compute_smd_ulsph_stress.cpp b/src/MACHDYN/compute_smd_ulsph_stress.cpp index 9aa75b76e8..b7bf3fd546 100644 --- a/src/MACHDYN/compute_smd_ulsph_stress.cpp +++ b/src/MACHDYN/compute_smd_ulsph_stress.cpp @@ -99,7 +99,7 @@ void ComputeSMDULSPHStress::compute_peratom() { } int itmp = 0; - Matrix3d *T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); + auto T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); if (T == nullptr) { error->all(FLERR, "compute smd/ulsph_stress could not access stress tensors. Are the matching pair styles present?"); } diff --git a/src/MACHDYN/fix_smd_adjust_dt.cpp b/src/MACHDYN/fix_smd_adjust_dt.cpp index f45364713a..0890527640 100644 --- a/src/MACHDYN/fix_smd_adjust_dt.cpp +++ b/src/MACHDYN/fix_smd_adjust_dt.cpp @@ -103,11 +103,11 @@ void FixSMDTlsphDtReset::end_of_step() { * extract minimum CFL timestep from TLSPH and ULSPH pair styles */ - double *dtCFL_TLSPH = (double *) force->pair->extract("smd/tlsph/dtCFL_ptr", itmp); - double *dtCFL_ULSPH = (double *) force->pair->extract("smd/ulsph/dtCFL_ptr", itmp); - double *dt_TRI = (double *) force->pair->extract("smd/tri_surface/stable_time_increment_ptr", itmp); - double *dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); - double *dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); + auto dtCFL_TLSPH = (double *) force->pair->extract("smd/tlsph/dtCFL_ptr", itmp); + auto dtCFL_ULSPH = (double *) force->pair->extract("smd/ulsph/dtCFL_ptr", itmp); + auto dt_TRI = (double *) force->pair->extract("smd/tri_surface/stable_time_increment_ptr", itmp); + auto dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); + auto dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); if ((dtCFL_TLSPH == nullptr) && (dtCFL_ULSPH == nullptr) && (dt_TRI == nullptr) && (dt_HERTZ == nullptr) && (dt_PERI_IPMB == nullptr)) { @@ -222,7 +222,7 @@ void FixSMDTlsphDtReset::write_restart(FILE *fp) { void FixSMDTlsphDtReset::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; t_elapsed = list[n++]; } diff --git a/src/MACHDYN/fix_smd_adjust_dt.h b/src/MACHDYN/fix_smd_adjust_dt.h index 24b642e603..afcac02e64 100644 --- a/src/MACHDYN/fix_smd_adjust_dt.h +++ b/src/MACHDYN/fix_smd_adjust_dt.h @@ -57,23 +57,3 @@ class FixSMDTlsphDtReset : public Fix { #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: Use of fix dt/reset with undefined lattice - - Must use lattice command with fix dt/reset command if units option is - set to lattice. - - W: Dump dcd/xtc timestamp may be wrong with fix dt/reset - - If the fix changes the timestep, the dump dcd file will not - reflect the change. - - */ diff --git a/src/MACHDYN/fix_smd_integrate_tlsph.cpp b/src/MACHDYN/fix_smd_integrate_tlsph.cpp index 8bde3b3d07..cb020d330d 100644 --- a/src/MACHDYN/fix_smd_integrate_tlsph.cpp +++ b/src/MACHDYN/fix_smd_integrate_tlsph.cpp @@ -137,7 +137,7 @@ void FixSMDIntegrateTlsph::initial_integrate(int /*vflag*/) { if (igroup == atom->firstgroup) nlocal = atom->nfirst; - Vector3d *smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); + auto smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); if (xsphFlag) { if (smoothVelDifference == nullptr) { diff --git a/src/MACHDYN/fix_smd_integrate_tlsph.h b/src/MACHDYN/fix_smd_integrate_tlsph.h index c2037ee606..d39f36f72a 100644 --- a/src/MACHDYN/fix_smd_integrate_tlsph.h +++ b/src/MACHDYN/fix_smd_integrate_tlsph.h @@ -60,13 +60,3 @@ class FixSMDIntegrateTlsph : public Fix { #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. - - */ diff --git a/src/MACHDYN/fix_smd_integrate_ulsph.cpp b/src/MACHDYN/fix_smd_integrate_ulsph.cpp index 967cf33095..2a082078a6 100644 --- a/src/MACHDYN/fix_smd_integrate_ulsph.cpp +++ b/src/MACHDYN/fix_smd_integrate_ulsph.cpp @@ -169,7 +169,7 @@ void FixSMDIntegrateUlsph::initial_integrate(int /*vflag*/) { * get smoothed velocities from ULSPH pair style */ - Vector3d *smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); + auto smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); if (xsphFlag) { if (smoothVel == nullptr) { @@ -264,7 +264,7 @@ void FixSMDIntegrateUlsph::final_integrate() { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss num_neighs array"); } - Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); + auto L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); if (L == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss velocityGradient array"); } diff --git a/src/MACHDYN/fix_smd_setvel.cpp b/src/MACHDYN/fix_smd_setvel.cpp index 7b76e08ec6..1b5578c7e0 100644 --- a/src/MACHDYN/fix_smd_setvel.cpp +++ b/src/MACHDYN/fix_smd_setvel.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- * * *** Smooth Mach Dynamics *** @@ -41,320 +40,297 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum { - NONE, CONSTANT, EQUAL, ATOM -}; +enum { NONE, CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg) { - if (narg < 6) - error->all(FLERR, "Illegal fix setvelocity command"); + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), + region(nullptr), sforce(nullptr) +{ + if (narg < 6) error->all(FLERR, "Illegal fix setvelocity command"); - dynamic_group_allow = 1; - vector_flag = 1; - size_vector = 3; - global_freq = 1; - extvector = 1; + dynamic_group_allow = 1; + vector_flag = 1; + size_vector = 3; + global_freq = 1; + extvector = 1; - xstr = ystr = zstr = nullptr; + if (strstr(arg[3], "v_") == arg[3]) { + xstr = utils::strdup(&arg[3][2]); + } else if (strcmp(arg[3], "NULL") == 0) { + xstyle = NONE; + } else { + xvalue = utils::numeric(FLERR, arg[3], false, lmp); + xstyle = CONSTANT; + } + if (strstr(arg[4], "v_") == arg[4]) { + ystr = utils::strdup(&arg[4][2]); + } else if (strcmp(arg[4], "NULL") == 0) { + ystyle = NONE; + } else { + yvalue = utils::numeric(FLERR, arg[4], false, lmp); + ystyle = CONSTANT; + } + if (strstr(arg[5], "v_") == arg[5]) { + zstr = utils::strdup(&arg[5][2]); + } else if (strcmp(arg[5], "NULL") == 0) { + zstyle = NONE; + } else { + zvalue = utils::numeric(FLERR, arg[5], false, lmp); + zstyle = CONSTANT; + } - if (strstr(arg[3], "v_") == arg[3]) { - xstr = utils::strdup( &arg[3][2]); - } else if (strcmp(arg[3], "NULL") == 0) { - xstyle = NONE; - } else { - xvalue = utils::numeric(FLERR, arg[3],false,lmp); - xstyle = CONSTANT; - } - if (strstr(arg[4], "v_") == arg[4]) { - ystr = utils::strdup( &arg[4][2]); - } else if (strcmp(arg[4], "NULL") == 0) { - ystyle = NONE; - } else { - yvalue = utils::numeric(FLERR, arg[4],false,lmp); - ystyle = CONSTANT; - } - if (strstr(arg[5], "v_") == arg[5]) { - zstr = utils::strdup( &arg[5][2]); - } else if (strcmp(arg[5], "NULL") == 0) { - zstyle = NONE; - } else { - zvalue = utils::numeric(FLERR, arg[5],false,lmp); - zstyle = CONSTANT; - } + // optional args - // optional args + int iarg = 6; + while (iarg < narg) { + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix setvelocity command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix setvelocity does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); + iarg += 2; + } else + error->all(FLERR, "Illegal fix setvelocity command"); + } - iregion = -1; - idregion = nullptr; + force_flag = 0; + foriginal[0] = foriginal[1] = foriginal[2] = 0.0; - int iarg = 6; - while (iarg < narg) { - if (strcmp(arg[iarg], "region") == 0) { - if (iarg + 2 > narg) - error->all(FLERR, "Illegal fix setvelocity command"); - iregion = domain->find_region(arg[iarg + 1]); - if (iregion == -1) - error->all(FLERR, "Region ID for fix setvelocity does not exist"); - idregion = utils::strdup( arg[iarg + 1]); - iarg += 2; - } else - error->all(FLERR, "Illegal fix setvelocity command"); - } - - force_flag = 0; - foriginal[0] = foriginal[1] = foriginal[2] = 0.0; - - maxatom = atom->nmax; - memory->create(sforce, maxatom, 3, "setvelocity:sforce"); + maxatom = atom->nmax; + memory->create(sforce, maxatom, 3, "setvelocity:sforce"); } /* ---------------------------------------------------------------------- */ -FixSMDSetVel::~FixSMDSetVel() { - delete[] xstr; - delete[] ystr; - delete[] zstr; - delete[] idregion; - memory->destroy(sforce); +FixSMDSetVel::~FixSMDSetVel() +{ + delete[] xstr; + delete[] ystr; + delete[] zstr; + delete[] idregion; + memory->destroy(sforce); } /* ---------------------------------------------------------------------- */ -int FixSMDSetVel::setmask() { - int mask = 0; - //mask |= INITIAL_INTEGRATE; - mask |= POST_FORCE; - return mask; +int FixSMDSetVel::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + return mask; } /* ---------------------------------------------------------------------- */ -void FixSMDSetVel::init() { - // check variables +void FixSMDSetVel::init() +{ + // check variables - if (xstr) { - xvar = input->variable->find(xstr); - if (xvar < 0) - error->all(FLERR, "Variable name for fix setvelocity does not exist"); - if (input->variable->equalstyle(xvar)) - xstyle = EQUAL; - else if (input->variable->atomstyle(xvar)) - xstyle = ATOM; - else - error->all(FLERR, "Variable for fix setvelocity is invalid style"); - } - if (ystr) { - yvar = input->variable->find(ystr); - if (yvar < 0) - error->all(FLERR, "Variable name for fix setvelocity does not exist"); - if (input->variable->equalstyle(yvar)) - ystyle = EQUAL; - else if (input->variable->atomstyle(yvar)) - ystyle = ATOM; - else - error->all(FLERR, "Variable for fix setvelocity is invalid style"); - } - if (zstr) { - zvar = input->variable->find(zstr); - if (zvar < 0) - error->all(FLERR, "Variable name for fix setvelocity does not exist"); - if (input->variable->equalstyle(zvar)) - zstyle = EQUAL; - else if (input->variable->atomstyle(zvar)) - zstyle = ATOM; - else - error->all(FLERR, "Variable for fix setvelocity is invalid style"); - } + if (xstr) { + xvar = input->variable->find(xstr); + if (xvar < 0) error->all(FLERR, "Variable name for fix setvelocity does not exist"); + if (input->variable->equalstyle(xvar)) + xstyle = EQUAL; + else if (input->variable->atomstyle(xvar)) + xstyle = ATOM; + else + error->all(FLERR, "Variable for fix setvelocity is invalid style"); + } + if (ystr) { + yvar = input->variable->find(ystr); + if (yvar < 0) error->all(FLERR, "Variable name for fix setvelocity does not exist"); + if (input->variable->equalstyle(yvar)) + ystyle = EQUAL; + else if (input->variable->atomstyle(yvar)) + ystyle = ATOM; + else + error->all(FLERR, "Variable for fix setvelocity is invalid style"); + } + if (zstr) { + zvar = input->variable->find(zstr); + if (zvar < 0) error->all(FLERR, "Variable name for fix setvelocity does not exist"); + if (input->variable->equalstyle(zvar)) + zstyle = EQUAL; + else if (input->variable->atomstyle(zvar)) + zstyle = ATOM; + else + error->all(FLERR, "Variable for fix setvelocity is invalid style"); + } - // set index and check validity of region + // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR, "Region ID for fix setvelocity does not exist"); - } + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix setvelocity does not exist", idregion); + } - if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) - varflag = ATOM; - else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) - varflag = EQUAL; - else - varflag = CONSTANT; + if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) + varflag = ATOM; + else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) + varflag = EQUAL; + else + varflag = CONSTANT; - // cannot use non-zero forces for a minimization since no energy is integrated - // use fix addforce instead + // cannot use non-zero forces for a minimization since no energy is integrated + // use fix addforce instead - int flag = 0; - if (update->whichflag == 2) { - if (xstyle == EQUAL || xstyle == ATOM) - flag = 1; - if (ystyle == EQUAL || ystyle == ATOM) - flag = 1; - if (zstyle == EQUAL || zstyle == ATOM) - flag = 1; - if (xstyle == CONSTANT && xvalue != 0.0) - flag = 1; - if (ystyle == CONSTANT && yvalue != 0.0) - flag = 1; - if (zstyle == CONSTANT && zvalue != 0.0) - flag = 1; - } - if (flag) - error->all(FLERR, "Cannot use non-zero forces in an energy minimization"); + int flag = 0; + if (update->whichflag == 2) { + if (xstyle == EQUAL || xstyle == ATOM) flag = 1; + if (ystyle == EQUAL || ystyle == ATOM) flag = 1; + if (zstyle == EQUAL || zstyle == ATOM) flag = 1; + if (xstyle == CONSTANT && xvalue != 0.0) flag = 1; + if (ystyle == CONSTANT && yvalue != 0.0) flag = 1; + if (zstyle == CONSTANT && zvalue != 0.0) flag = 1; + } + if (flag) error->all(FLERR, "Cannot use non-zero forces in an energy minimization"); } /* ---------------------------------------------------------------------- */ -void FixSMDSetVel::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) - post_force(vflag); - else - error->all(FLERR,"Fix smd/setvel does not support RESPA"); +void FixSMDSetVel::setup(int vflag) +{ + if (utils::strmatch(update->integrate_style, "^verlet")) + post_force(vflag); + else + error->all(FLERR, "Fix smd/setvel does not support RESPA"); } /* ---------------------------------------------------------------------- */ -void FixSMDSetVel::min_setup(int vflag) { - post_force(vflag); +void FixSMDSetVel::min_setup(int vflag) +{ + post_force(vflag); } /* ---------------------------------------------------------------------- */ -//void FixSMDSetVel::initial_integrate(int vflag) { -void FixSMDSetVel::post_force(int /*vflag*/) { - double **x = atom->x; - double **f = atom->f; - double **v = atom->v; - double **vest = atom->vest; - int *mask = atom->mask; - int nlocal = atom->nlocal; +void FixSMDSetVel::post_force(int /*vflag*/) +{ + double **x = atom->x; + double **f = atom->f; + double **v = atom->v; + double **vest = atom->vest; + int *mask = atom->mask; + int nlocal = atom->nlocal; - // update region if necessary + // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); + if (region) region->prematch(); + + // reallocate sforce array if necessary + + if (varflag == ATOM && atom->nmax > maxatom) { + maxatom = atom->nmax; + memory->destroy(sforce); + memory->create(sforce, maxatom, 3, "setvelocity:sforce"); + } + + foriginal[0] = foriginal[1] = foriginal[2] = 0.0; + force_flag = 0; + + if (varflag == CONSTANT) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + foriginal[0] += f[i][0]; + foriginal[1] += f[i][1]; + foriginal[2] += f[i][2]; + if (xstyle) { + v[i][0] = xvalue; + vest[i][0] = xvalue; + f[i][0] = 0.0; + } + if (ystyle) { + v[i][1] = yvalue; + vest[i][1] = yvalue; + f[i][1] = 0.0; + } + if (zstyle) { + v[i][2] = zvalue; + vest[i][2] = zvalue; + f[i][2] = 0.0; + } + } + + // variable force, wrap with clear/add + + } else { + + modify->clearstep_compute(); + + if (xstyle == EQUAL) + xvalue = input->variable->compute_equal(xvar); + else if (xstyle == ATOM) + input->variable->compute_atom(xvar, igroup, &sforce[0][0], 3, 0); + if (ystyle == EQUAL) + yvalue = input->variable->compute_equal(yvar); + else if (ystyle == ATOM) + input->variable->compute_atom(yvar, igroup, &sforce[0][1], 3, 0); + if (zstyle == EQUAL) + zvalue = input->variable->compute_equal(zvar); + else if (zstyle == ATOM) + input->variable->compute_atom(zvar, igroup, &sforce[0][2], 3, 0); + + modify->addstep_compute(update->ntimestep + 1); + + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + foriginal[0] += f[i][0]; + foriginal[1] += f[i][1]; + foriginal[2] += f[i][2]; + if (xstyle == ATOM) { + vest[i][0] = v[i][0] = sforce[i][0]; + f[i][0] = 0.0; + } else if (xstyle) { + vest[i][0] = v[i][0] = xvalue; + f[i][0] = 0.0; } - // reallocate sforce array if necessary - - if (varflag == ATOM && atom->nmax > maxatom) { - maxatom = atom->nmax; - memory->destroy(sforce); - memory->create(sforce, maxatom, 3, "setvelocity:sforce"); + if (ystyle == ATOM) { + vest[i][1] = v[i][1] = sforce[i][1]; + f[i][1] = 0.0; + } else if (ystyle) { + vest[i][1] = v[i][1] = yvalue; + f[i][1] = 0.0; } - foriginal[0] = foriginal[1] = foriginal[2] = 0.0; - force_flag = 0; - - if (varflag == CONSTANT) { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - if (region && !region->match(x[i][0], x[i][1], x[i][2])) - continue; - foriginal[0] += f[i][0]; - foriginal[1] += f[i][1]; - foriginal[2] += f[i][2]; - if (xstyle) { - v[i][0] = xvalue; - vest[i][0] = xvalue; - f[i][0] = 0.0; - } - if (ystyle) { - v[i][1] = yvalue; - vest[i][1] = yvalue; - f[i][1] = 0.0; - } - if (zstyle) { - v[i][2] = zvalue; - vest[i][2] = zvalue; - f[i][2] = 0.0; - } - } - - // variable force, wrap with clear/add - - } else { - - modify->clearstep_compute(); - - if (xstyle == EQUAL) - xvalue = input->variable->compute_equal(xvar); - else if (xstyle == ATOM) - input->variable->compute_atom(xvar, igroup, &sforce[0][0], 3, 0); - if (ystyle == EQUAL) - yvalue = input->variable->compute_equal(yvar); - else if (ystyle == ATOM) - input->variable->compute_atom(yvar, igroup, &sforce[0][1], 3, 0); - if (zstyle == EQUAL) - zvalue = input->variable->compute_equal(zvar); - else if (zstyle == ATOM) - input->variable->compute_atom(zvar, igroup, &sforce[0][2], 3, 0); - - modify->addstep_compute(update->ntimestep + 1); - - //printf("setting velocity at timestep %d\n", update->ntimestep); - - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - if (region && !region->match(x[i][0], x[i][1], x[i][2])) - continue; - foriginal[0] += f[i][0]; - foriginal[1] += f[i][1]; - foriginal[2] += f[i][2]; - if (xstyle == ATOM) { - vest[i][0] = v[i][0] = sforce[i][0]; - f[i][0] = 0.0; - } else if (xstyle) { - vest[i][0] = v[i][0] = xvalue; - f[i][0] = 0.0; - } - - if (ystyle == ATOM) { - vest[i][1] = v[i][1] = sforce[i][1]; - f[i][1] = 0.0; - } else if (ystyle) { - vest[i][1] = v[i][1] = yvalue; - f[i][1] = 0.0; - } - - if (zstyle == ATOM) { - vest[i][2] = v[i][2] = sforce[i][2]; - f[i][2] = 0.0; - } else if (zstyle) { - vest[i][2] = v[i][2] = zvalue; - f[i][2] = 0.0; - } - - } + if (zstyle == ATOM) { + vest[i][2] = v[i][2] = sforce[i][2]; + f[i][2] = 0.0; + } else if (zstyle) { + vest[i][2] = v[i][2] = zvalue; + f[i][2] = 0.0; } + } + } } /* ---------------------------------------------------------------------- return components of total force on fix group before force was changed ------------------------------------------------------------------------- */ -double FixSMDSetVel::compute_vector(int n) { -// only sum across procs one time +double FixSMDSetVel::compute_vector(int n) +{ + // only sum across procs one time - if (force_flag == 0) { - MPI_Allreduce(foriginal, foriginal_all, 3, MPI_DOUBLE, MPI_SUM, world); - force_flag = 1; - } - return foriginal_all[n]; + if (force_flag == 0) { + MPI_Allreduce(foriginal, foriginal_all, 3, MPI_DOUBLE, MPI_SUM, world); + force_flag = 1; + } + return foriginal_all[n]; } /* ---------------------------------------------------------------------- memory usage of local atom-based array ------------------------------------------------------------------------- */ -double FixSMDSetVel::memory_usage() { - double bytes = 0.0; - if (varflag == ATOM) - bytes = atom->nmax * 3 * sizeof(double); - return bytes; +double FixSMDSetVel::memory_usage() +{ + double bytes = 0.0; + if (varflag == ATOM) bytes = atom->nmax * 3 * sizeof(double); + return bytes; } diff --git a/src/MACHDYN/fix_smd_setvel.h b/src/MACHDYN/fix_smd_setvel.h index 30071d0875..df5f16a09f 100644 --- a/src/MACHDYN/fix_smd_setvel.h +++ b/src/MACHDYN/fix_smd_setvel.h @@ -50,9 +50,10 @@ class FixSMDSetVel : public Fix { private: double xvalue, yvalue, zvalue; - int varflag, iregion; + int varflag; char *xstr, *ystr, *zstr; char *idregion; + class Region *region; int xvar, yvar, zvar, xstyle, ystyle, zstyle; double foriginal[3], foriginal_all[3]; int force_flag; @@ -65,30 +66,3 @@ class FixSMDSetVel : public Fix { #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: Region ID for fix setforce does not exist - -Self-explanatory. - -E: Variable name for fix setforce does not exist - -Self-explanatory. - -E: Variable for fix setforce is invalid style - -Only equal-style variables can be used. - -E: Cannot use non-zero forces in an energy minimization - -Fix setforce cannot be used in this manner. Use fix addforce -instead. - -*/ diff --git a/src/MACHDYN/pair_smd_tlsph.cpp b/src/MACHDYN/pair_smd_tlsph.cpp index 323325aa30..ac1ccd7eb2 100644 --- a/src/MACHDYN/pair_smd_tlsph.cpp +++ b/src/MACHDYN/pair_smd_tlsph.cpp @@ -143,11 +143,11 @@ void PairTlsph::PreCompute() { int nlocal = atom->nlocal; int jnum, jj, i, j, itype, idim; - tagint **partner = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->partner; - int *npartner = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->npartner; - float **wfd_list = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->wfd_list; - float **wf_list = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->wf_list; - float **degradation_ij = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->degradation_ij; + tagint **partner = (dynamic_cast( modify->fix[ifix_tlsph]))->partner; + int *npartner = (dynamic_cast( modify->fix[ifix_tlsph]))->npartner; + float **wfd_list = (dynamic_cast( modify->fix[ifix_tlsph]))->wfd_list; + float **wf_list = (dynamic_cast( modify->fix[ifix_tlsph]))->wf_list; + float **degradation_ij = (dynamic_cast( modify->fix[ifix_tlsph]))->degradation_ij; double r0, r0Sq, wf, wfd, h, irad, voli, volj, scale, shepardWeight; Vector3d dx, dx0, dv, g; Matrix3d Ktmp, Ftmp, Fdottmp, L, U, eye; @@ -421,12 +421,12 @@ void PairTlsph::ComputeForces(int eflag, int vflag) { Vector3d xi, xj, vi, vj, f_visc, sumForces, f_spring; int periodic = (domain->xperiodic || domain->yperiodic || domain->zperiodic); - tagint **partner = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->partner; - int *npartner = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->npartner; - float **wfd_list = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->wfd_list; - float **wf_list = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->wf_list; - float **degradation_ij = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->degradation_ij; - float **energy_per_bond = ((FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[ifix_tlsph])->energy_per_bond; + tagint **partner = (dynamic_cast( modify->fix[ifix_tlsph]))->partner; + int *npartner = (dynamic_cast( modify->fix[ifix_tlsph]))->npartner; + float **wfd_list = (dynamic_cast( modify->fix[ifix_tlsph]))->wfd_list; + float **wf_list = (dynamic_cast( modify->fix[ifix_tlsph]))->wf_list; + float **degradation_ij = (dynamic_cast( modify->fix[ifix_tlsph]))->degradation_ij; + float **energy_per_bond = (dynamic_cast( modify->fix[ifix_tlsph]))->energy_per_bond; Matrix3d eye; eye.setIdentity(); @@ -1606,13 +1606,13 @@ void PairTlsph::init_style() { error->all(FLERR, "Pair style tlsph requires its particles to be part of a group named tlsph. This group does not exist."); if (fix_tlsph_reference_configuration == nullptr) { - char **fixarg = new char*[3]; + auto fixarg = new char*[3]; fixarg[0] = (char *) "SMD_TLSPH_NEIGHBORS"; fixarg[1] = (char *) "tlsph"; fixarg[2] = (char *) "SMD_TLSPH_NEIGHBORS"; modify->add_fix(3, fixarg); delete[] fixarg; - fix_tlsph_reference_configuration = (FixSMD_TLSPH_ReferenceConfiguration *) modify->fix[modify->nfix - 1]; + fix_tlsph_reference_configuration = dynamic_cast( modify->fix[modify->nfix - 1]); fix_tlsph_reference_configuration->pair = this; } diff --git a/src/MAKE/MACHINES/Makefile.summit_kokkos b/src/MAKE/MACHINES/Makefile.summit_kokkos index f22b27cc74..557ebd22b2 100644 --- a/src/MAKE/MACHINES/Makefile.summit_kokkos +++ b/src/MAKE/MACHINES/Makefile.summit_kokkos @@ -9,7 +9,7 @@ SHELL = /bin/sh KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) CC = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper -CCFLAGS = -g -O3 -DNDEBUG +CCFLAGS = -g -O3 -DNDEBUG -Xcudafe --diag_suppress=unrecognized_pragma SHFLAGS = -fPIC DEPFLAGS = -M diff --git a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi index 42a8236c7c..b73c441c71 100644 --- a/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi +++ b/src/MAKE/OPTIONS/Makefile.kokkos_cuda_mpi @@ -10,7 +10,7 @@ KOKKOS_ABSOLUTE_PATH = $(shell cd $(KOKKOS_PATH); pwd) export MPICH_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper export OMPI_CXX = $(KOKKOS_ABSOLUTE_PATH)/bin/nvcc_wrapper CC = mpicxx -CCFLAGS = -g -O3 -DNDEBUG +CCFLAGS = -g -O3 -DNDEBUG -Xcudafe --diag_suppress=unrecognized_pragma SHFLAGS = -fPIC DEPFLAGS = -M @@ -55,7 +55,7 @@ MPI_LIB = # PATH = path for FFT library # LIB = name of FFT library -FFT_INC = -DFFT_CUFFT +FFT_INC = -DFFT_CUFFT FFT_PATH = FFT_LIB = -lcufft diff --git a/src/MANIFOLD/fix_manifoldforce.cpp b/src/MANIFOLD/fix_manifoldforce.cpp index 2968361e43..7542205f8f 100644 --- a/src/MANIFOLD/fix_manifoldforce.cpp +++ b/src/MANIFOLD/fix_manifoldforce.cpp @@ -124,11 +124,11 @@ void FixManifoldForce::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - int nlevels_respa = ((Respa *) update->integrate)->nlevels; + int nlevels_respa = (dynamic_cast( update->integrate))->nlevels; for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); post_force_respa(vflag,ilevel,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } } } diff --git a/src/MANIFOLD/fix_manifoldforce.h b/src/MANIFOLD/fix_manifoldforce.h index 58822614a9..5756428cd7 100644 --- a/src/MANIFOLD/fix_manifoldforce.h +++ b/src/MANIFOLD/fix_manifoldforce.h @@ -71,13 +71,3 @@ class FixManifoldForce : public Fix { #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. - -*/ diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.cpp b/src/MANIFOLD/fix_nve_manifold_rattle.cpp index 9c59b5ceca..f9a728cb73 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nve_manifold_rattle.cpp @@ -165,8 +165,8 @@ FixNVEManifoldRattle::~FixNVEManifoldRattle() } if (tvars ) delete [] tvars; - if (tstyle) delete [] tstyle; - if (is_var) delete [] is_var; + delete[] tstyle; + delete[] is_var; } diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.h b/src/MANIFOLD/fix_nve_manifold_rattle.h index 91fb17aec1..2772b12f99 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.h +++ b/src/MANIFOLD/fix_nve_manifold_rattle.h @@ -111,58 +111,3 @@ class FixNVEManifoldRattle : public Fix { #endif // LMP_FIX_NVE_MANIFOLD_RATTLE_H #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: There is no manifold named ... - -Self-explanatory. You requested a manifold whose name was not -registered at the factory. - -E: Manifold pointer was nullptr for some reason! - -This indicates a bug. The factory was unable to properly create -the requested manifold even though it was registered. Send the -maintainer an e-mail. - -E: Manifold ... needs at least ... argument(s)! - -Self-explanatory. Provide enough arguments for the proper -creating of the requested manifold. - -E: Parameter pointer was nullptr! - -This indicates a bug. The array that contains the parameters -could not be allocated. Send the maintainer an e-mail. - -E: Could not allocate space for arg! - -One of the arguments provided was too long (it contained -too many characters) - -E: Option ... needs ... argument(s): - -Self-explanatory. Read the documentation of this fix properly. - - -E: Illegal fix nve/manifold/rattle command! Option ... not recognized! - -Self-explanatory. The given option(s) do not exist. - -E: Variable name for fix nve/manifold/rattle does not exist - -Self-explanatory. - -E: Variable for fix nve/manifold/rattle is invalid style - -fix nve/manifold/rattle only supports equal style variables. - - - -*/ diff --git a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp index 0dcc233b54..6dbd211042 100644 --- a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -159,13 +159,13 @@ FixNVTManifoldRattle::FixNVTManifoldRattle(LAMMPS *lmp, int narg, char **arg, FixNVTManifoldRattle::~FixNVTManifoldRattle() { // Deallocate heap-allocated objects. - if (eta) delete[] eta; - if (eta_dot) delete[] eta_dot; - if (eta_dotdot) delete[] eta_dotdot; - if (eta_mass) delete[] eta_mass; + delete[] eta; + delete[] eta_dot; + delete[] eta_dotdot; + delete[] eta_mass; modify->delete_compute(id_temp); - if (id_temp) delete[] id_temp; + delete[] id_temp; } int FixNVTManifoldRattle::setmask() diff --git a/src/MANIFOLD/fix_nvt_manifold_rattle.h b/src/MANIFOLD/fix_nvt_manifold_rattle.h index 6a4d9d7b33..4fd9e96ae6 100644 --- a/src/MANIFOLD/fix_nvt_manifold_rattle.h +++ b/src/MANIFOLD/fix_nvt_manifold_rattle.h @@ -89,58 +89,3 @@ class FixNVTManifoldRattle : public FixNVEManifoldRattle { #endif // LMP_FIX_NVE_MANIFOLD_RATTLE_H #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: There is no manifold named ... - -Self-explanatory. You requested a manifold whose name was not -registered at the factory. - -E: Manifold pointer was nullptr for some reason! - -This indicates a bug. The factory was unable to properly create -the requested manifold even though it was registered. Send the -maintainer an e-mail. - -E: Manifold ... needs at least ... argument(s)! - -Self-explanatory. Provide enough arguments for the proper -creating of the requested manifold. - -E: Parameter pointer was nullptr! - -This indicates a bug. The array that contains the parameters -could not be allocated. Send the maintainer an e-mail. - -E: Could not allocate space for arg! - -One of the arguments provided was too long (it contained -too many characters) - -E: Option ... needs ... argument(s): - -Self-explanatory. Read the documentation of this fix properly. - - -E: Illegal fix nve/manifold/rattle command! Option ... not recognized! - -Self-explanatory. The given option(s) do not exist. - -E: Variable name for fix nve/manifold/rattle does not exist - -Self-explanatory. - -E: Variable for fix nve/manifold/rattle is invalid style - -fix nve/manifold/rattle only supports equal style variables. - - - -*/ diff --git a/src/MANIFOLD/manifold_thylakoid.cpp b/src/MANIFOLD/manifold_thylakoid.cpp index ca50bfc881..a6cded49aa 100644 --- a/src/MANIFOLD/manifold_thylakoid.cpp +++ b/src/MANIFOLD/manifold_thylakoid.cpp @@ -447,7 +447,7 @@ thyla_part *manifold_thylakoid::make_plane_part (double a, double b, double c, args[3] = pt[0]; args[4] = pt[1]; args[5] = pt[2]; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_PLANE,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_PLANE,args,0,0,0,0,0,0); return p; } @@ -462,7 +462,7 @@ thyla_part *manifold_thylakoid::make_cyl_part (double a, double b, double c, args[4] = pt[1]; args[5] = pt[2]; args[6] = R; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_CYL,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_CYL,args,0,0,0,0,0,0); return p; } @@ -474,7 +474,7 @@ thyla_part *manifold_thylakoid::make_sphere_part(const std::vector &pt, args[1] = pt[0]; args[2] = pt[1]; args[3] = pt[2]; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_SPHERE,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_SPHERE,args,0,0,0,0,0,0); return p; } @@ -490,6 +490,6 @@ thyla_part *manifold_thylakoid::make_cyl_to_plane_part(double X0, double R0, dou args[4] = pt[1]; args[5] = pt[2]; args[6] = s; - thyla_part *p = new thyla_part(thyla_part::THYLA_TYPE_CYL_TO_PLANE,args,0,0,0,0,0,0); + auto p = new thyla_part(thyla_part::THYLA_TYPE_CYL_TO_PLANE,args,0,0,0,0,0,0); return p; } diff --git a/src/MANIFOLD/manifold_thylakoid.h b/src/MANIFOLD/manifold_thylakoid.h index 01b54ed108..5c30ccbdba 100644 --- a/src/MANIFOLD/manifold_thylakoid.h +++ b/src/MANIFOLD/manifold_thylakoid.h @@ -37,6 +37,7 @@ namespace user_manifold { int nparams() override { return NPARAMS; } void post_param_init() override; + private: void init_domains(); diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 16425d5d64..cf9441da1e 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -119,14 +119,14 @@ void FixQEQComb::init() if (!atom->q_flag) error->all(FLERR,"Fix qeq/comb requires atom attribute q"); - comb3 = (PairComb3 *) force->pair_match("^comb3",0); - if (!comb3) comb = (PairComb *) force->pair_match("^comb",0); + comb3 = dynamic_cast( force->pair_match("^comb3",0)); + if (!comb3) comb = dynamic_cast( force->pair_match("^comb",0)); if (comb == nullptr && comb3 == nullptr) error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb"); if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -154,9 +154,9 @@ void FixQEQComb::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } firstflag = 0; } diff --git a/src/MANYBODY/fix_qeq_comb.h b/src/MANYBODY/fix_qeq_comb.h index 554d5c847b..1b98d21d12 100644 --- a/src/MANYBODY/fix_qeq_comb.h +++ b/src/MANYBODY/fix_qeq_comb.h @@ -56,30 +56,3 @@ class FixQEQComb : public Fix { #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: Cannot open fix qeq/comb file %s - -The output file for the fix qeq/combs command cannot be opened. -Check that the path and name are correct. - -E: Fix qeq/comb requires atom attribute q - -An atom style with charge must be used to perform charge equilibration. - -E: Must use pair_style comb or comb3 with fix qeq/comb - -Self-explanatory. - -E: Fix qeq/comb group has no atoms - -Self-explanatory. - -*/ diff --git a/src/MANYBODY/pair_adp.h b/src/MANYBODY/pair_adp.h index 06db6ed5a3..416ad26fc3 100644 --- a/src/MANYBODY/pair_adp.h +++ b/src/MANYBODY/pair_adp.h @@ -89,31 +89,3 @@ class PairADP : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in ADP potential file - -The ADP potential file does not contain elements that match the -requested elements. - -E: Cannot open ADP potential file %s - -The specified ADP potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in ADP potential file - -The element names in the ADP file do not match those requested. - -*/ diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index 2063cf75c1..f0499e3788 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -185,42 +185,3 @@ class PairAIREBO : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style AIREBO requires atom IDs - -This is a requirement to use the AIREBO potential. - -E: Pair style AIREBO requires newton pair on - -See the newton command. This is a restriction to use the AIREBO -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Neighbor list overflow, boost neigh_modify one - -There are too many neighbors of a single atom. Use the neigh_modify -command to increase the max number of neighbors allowed for one atom. -You may also want to boost the page size. - -E: Cannot open AIREBO potential file %s - -The specified AIREBO potential file cannot be opened. Check that the -path and name are correct. - -*/ diff --git a/src/MANYBODY/pair_airebo_morse.h b/src/MANYBODY/pair_airebo_morse.h index d5662d8aa4..ed2deb0225 100644 --- a/src/MANYBODY/pair_airebo_morse.h +++ b/src/MANYBODY/pair_airebo_morse.h @@ -34,13 +34,3 @@ class PairAIREBOMorse : public PairAIREBO { #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. - -*/ diff --git a/src/MANYBODY/pair_atm.h b/src/MANYBODY/pair_atm.h index 20836751b6..7ce4fac12f 100644 --- a/src/MANYBODY/pair_atm.h +++ b/src/MANYBODY/pair_atm.h @@ -51,27 +51,3 @@ class PairATM : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal pair_style 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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style ATM requires newton pair on - -See the newton command. This is a restriction to use the ATM -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/MANYBODY/pair_bop.h b/src/MANYBODY/pair_bop.h index baffe74846..aa6da378ae 100644 --- a/src/MANYBODY/pair_bop.h +++ b/src/MANYBODY/pair_bop.h @@ -155,50 +155,3 @@ class PairBOP : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal pair_style command - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style BOP requires atom IDs - -This is a requirement to use the BOP potential. - -E: Pair style BOP requires newton pair on - -This is a restriction to use the BOP potential. - -E: Pair style bop requires a comm ghost cutoff of at least %lf - -Use the comm_modify cutoff to set this. See the pair bop doc page for -more details. - -E: All pair coeffs are not set - -Self-explanatory. - -E: Cannot open BOP potential file %s - -Self-explanatory. - -E: Incorrect table format check for element types - -Self-explanatory. - -E: Unsupported BOP potential file format - -Self-explanatory. - -E: Pair style bop requires system dimension of at least %g - -Self-explanatory. - -UNDOCUMENTED - -*/ diff --git a/src/MANYBODY/pair_comb.h b/src/MANYBODY/pair_comb.h index 6a456f6eb0..3b6cf221e4 100644 --- a/src/MANYBODY/pair_comb.h +++ b/src/MANYBODY/pair_comb.h @@ -149,71 +149,3 @@ class PairComb : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style COMB requires atom IDs - -This is a requirement to use the AIREBO potential. - -E: Pair style COMB requires newton pair on - -See the newton command. This is a restriction to use the COMB -potential. - -E: Pair style COMB requires atom attribute q - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open COMB potential file %s - -The specified COMB potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in COMB potential file - -Incorrect number of words per line in the potential file. - -E: Illegal COMB parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -W: Pair COMB charge %.10f with force %.10f hit min barrier - -Something is possibly wrong with your model. - -W: Pair COMB charge %.10f with force %.10f hit max barrier - -Something is possibly wrong with your model. - -E: Neighbor list overflow, boost neigh_modify one - -There are too many neighbors of a single atom. Use the neigh_modify -command to increase the max number of neighbors allowed for one atom. -You may also want to boost the page size. - -*/ diff --git a/src/MANYBODY/pair_comb3.h b/src/MANYBODY/pair_comb3.h index f7a8f1abac..6aed74edc0 100644 --- a/src/MANYBODY/pair_comb3.h +++ b/src/MANYBODY/pair_comb3.h @@ -230,73 +230,3 @@ class PairComb3 : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style COMB3 requires atom IDs - -This is a requirement to use the COMB3 potential. - -E: Pair style COMB3 requires newton pair on - -See the newton command. This is a restriction to use the COMB3 -potential. - -E: Pair style COMB3 requires atom attribute q - -Self-explanatory. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open COMB3 lib.comb3 file - -The COMB3 library file cannot be opened. Check that the path and name -are correct. - -E: Cannot open COMB3 potential file %s - -The specified COMB3 potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in COMB3 potential file - -Incorrect number of words per line in the potential file. - -E: Illegal COMB3 parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -E: Neighbor list overflow, boost neigh_modify one - -There are too many neighbors of a single atom. Use the neigh_modify -command to increase the max number of neighbors allowed for one atom. -You may also want to boost the page size. - -E: Error in vdw spline: inner radius > outer radius - -A pre-tabulated spline is invalid. Likely a problem with the -potential parameters. - -*/ diff --git a/src/MANYBODY/pair_eam.h b/src/MANYBODY/pair_eam.h index a3f5708273..3589ab4ab0 100644 --- a/src/MANYBODY/pair_eam.h +++ b/src/MANYBODY/pair_eam.h @@ -113,26 +113,3 @@ class PairEAM : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Invalid EAM potential file - -UNDOCUMENTED - -*/ diff --git a/src/MANYBODY/pair_eam_alloy.h b/src/MANYBODY/pair_eam_alloy.h index b8d53aac00..f39f989151 100644 --- a/src/MANYBODY/pair_eam_alloy.h +++ b/src/MANYBODY/pair_eam_alloy.h @@ -40,29 +40,3 @@ class PairEAMAlloy : virtual public PairEAM { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -E: Invalid EAM potential file - -UNDOCUMENTED - -*/ diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index 67ecc581f9..e575a6643b 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -503,7 +503,7 @@ void PairEAMCD::read_h_coeff(char *filename) error->one(FLERR,"Failure to seek to end-of-file for reading h(x) coeffs: {}", utils::getsyserror()); - char *buf = new char[MAXLINE+1]; + auto buf = new char[MAXLINE+1]; auto rv = fread(buf,1,MAXLINE,fptr); if (rv == 0) error->one(FLERR,"Failure to read h(x) coeffs: {}", utils::getsyserror()); buf[rv] = '\0'; // must 0-terminate buffer for string processing diff --git a/src/MANYBODY/pair_eam_fs.h b/src/MANYBODY/pair_eam_fs.h index 6b6fcb1905..17e0ae8f13 100644 --- a/src/MANYBODY/pair_eam_fs.h +++ b/src/MANYBODY/pair_eam_fs.h @@ -42,29 +42,3 @@ class PairEAMFS : virtual public PairEAM { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -E: Invalid EAM potential file - -UNDOCUMENTED - -*/ diff --git a/src/MANYBODY/pair_eam_he.h b/src/MANYBODY/pair_eam_he.h index 38f7fc3dbd..c6c0553f81 100644 --- a/src/MANYBODY/pair_eam_he.h +++ b/src/MANYBODY/pair_eam_he.h @@ -36,29 +36,3 @@ class PairEAMHE : public PairEAMFS { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: No matching element in EAM potential file - -The EAM potential file does not contain elements that match the -requested elements. - -E: Cannot open EAM potential file %s - -The specified EAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect element names in EAM potential file - -The element names in the EAM file do not match those requested. - -E: Invalid EAM potential file - -UNDOCUMENTED - -*/ diff --git a/src/MANYBODY/pair_edip.cpp b/src/MANYBODY/pair_edip.cpp index 23361e56cb..8becba670b 100644 --- a/src/MANYBODY/pair_edip.cpp +++ b/src/MANYBODY/pair_edip.cpp @@ -369,7 +369,7 @@ void PairEDIP::compute(int eflag, int vflag) directorCos_ik_z = invR_ik * dr_ik[2]; cosTeta = directorCos_ij_x * directorCos_ik_x + directorCos_ij_y * directorCos_ik_y + - directorCos_ij_z * directorCos_ik_z; + directorCos_ij_z * directorCos_ik_z; cosTetaDiff = cosTeta + tauFunction; cosTetaDiffCosTetaDiff = cosTetaDiff * cosTetaDiff; @@ -377,33 +377,33 @@ void PairEDIP::compute(int eflag, int vflag) expMinusQFunctionCosTetaDiffCosTetaDiff = exp(-qFunctionCosTetaDiffCosTetaDiff); potentia3B_factor = lambda * - ((1.0 - expMinusQFunctionCosTetaDiffCosTetaDiff) + - eta * qFunctionCosTetaDiffCosTetaDiff); + ((1.0 - expMinusQFunctionCosTetaDiffCosTetaDiff) + + eta * qFunctionCosTetaDiffCosTetaDiff); exp3B_ik = preExp3B_ij[neighbor_k]; exp3BDerived_ik = preExp3BDerived_ij[neighbor_k]; forceMod3B_factor1_ij = -exp3BDerived_ij * exp3B_ik * potentia3B_factor; forceMod3B_factor2 = 2.0 * lambda * exp3B_ij * exp3B_ik * qFunction * cosTetaDiff * - (eta + expMinusQFunctionCosTetaDiffCosTetaDiff); + (eta + expMinusQFunctionCosTetaDiffCosTetaDiff); forceMod3B_factor2_ij = forceMod3B_factor2 * invR_ij; f_ij[0] = forceMod3B_factor1_ij * directorCos_ij_x + - forceMod3B_factor2_ij * (cosTeta * directorCos_ij_x - directorCos_ik_x); + forceMod3B_factor2_ij * (cosTeta * directorCos_ij_x - directorCos_ik_x); f_ij[1] = forceMod3B_factor1_ij * directorCos_ij_y + - forceMod3B_factor2_ij * (cosTeta * directorCos_ij_y - directorCos_ik_y); + forceMod3B_factor2_ij * (cosTeta * directorCos_ij_y - directorCos_ik_y); f_ij[2] = forceMod3B_factor1_ij * directorCos_ij_z + - forceMod3B_factor2_ij * (cosTeta * directorCos_ij_z - directorCos_ik_z); + forceMod3B_factor2_ij * (cosTeta * directorCos_ij_z - directorCos_ik_z); forceMod3B_factor1_ik = -exp3BDerived_ik * exp3B_ij * potentia3B_factor; forceMod3B_factor2_ik = forceMod3B_factor2 * invR_ik; f_ik[0] = forceMod3B_factor1_ik * directorCos_ik_x + - forceMod3B_factor2_ik * (cosTeta * directorCos_ik_x - directorCos_ij_x); + forceMod3B_factor2_ik * (cosTeta * directorCos_ik_x - directorCos_ij_x); f_ik[1] = forceMod3B_factor1_ik * directorCos_ik_y + - forceMod3B_factor2_ik * (cosTeta * directorCos_ik_y - directorCos_ij_y); + forceMod3B_factor2_ik * (cosTeta * directorCos_ik_y - directorCos_ij_y); f_ik[2] = forceMod3B_factor1_ik * directorCos_ik_z + - forceMod3B_factor2_ik * (cosTeta * directorCos_ik_z - directorCos_ij_z); + forceMod3B_factor2_ik * (cosTeta * directorCos_ik_z - directorCos_ij_z); forceModCoord += (forceMod3B_factor2 * (tauFunctionDerived - 0.5 * mu * cosTetaDiff)); @@ -800,13 +800,12 @@ void PairEDIP::read_file(char *file) if (nparams == maxparam) { maxparam += DELTA; - params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), - "pair:params"); + params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); // make certain all addional allocated storage is initialized // to avoid false positives when checking with valgrind - memset(params + nparams, 0, DELTA*sizeof(Param)); + memset(params + nparams, 0, DELTA * sizeof(Param)); } params[nparams].ielement = ielement; @@ -847,9 +846,9 @@ void PairEDIP::read_file(char *file) MPI_Bcast(&maxparam, 1, MPI_INT, 0, world); if (comm->me != 0) - params = (Param *) memory->srealloc(params,maxparam*sizeof(Param), "pair:params"); + params = (Param *) memory->srealloc(params, maxparam * sizeof(Param), "pair:params"); - MPI_Bcast(params, maxparam*sizeof(Param), MPI_BYTE, 0, world); + MPI_Bcast(params, maxparam * sizeof(Param), MPI_BYTE, 0, world); } /* ---------------------------------------------------------------------- */ diff --git a/src/MANYBODY/pair_edip.h b/src/MANYBODY/pair_edip.h index 741f428c93..9ced9fa4de 100644 --- a/src/MANYBODY/pair_edip.h +++ b/src/MANYBODY/pair_edip.h @@ -50,7 +50,7 @@ class PairEDIP : public Pair { double mu, Q0; // coefficients for function Q(Z) double u1, u2, u3, u4; // coefficients for function tau(Z) double cutsq; - int ielement, jelement, kelement, dummy; // dummy added for better alignment + int ielement, jelement, kelement, dummy; // dummy added for better alignment }; double *preInvR_ij; diff --git a/src/MANYBODY/pair_edip_multi.h b/src/MANYBODY/pair_edip_multi.h index 862c63dbec..c30d91bd38 100644 --- a/src/MANYBODY/pair_edip_multi.h +++ b/src/MANYBODY/pair_edip_multi.h @@ -50,7 +50,7 @@ class PairEDIPMulti : public Pair { double mu, Q0; // coefficients for function Q(Z) double u1, u2, u3, u4; // coefficients for function tau(Z) double cutsq; - int ielement, jelement, kelement, dummy; // dummy added for better alignment + int ielement, jelement, kelement, dummy; // dummy added for better alignment }; double *preForceCoord; diff --git a/src/MANYBODY/pair_eim.h b/src/MANYBODY/pair_eim.h index 7c4931b7cf..cb30257b2e 100644 --- a/src/MANYBODY/pair_eim.h +++ b/src/MANYBODY/pair_eim.h @@ -149,34 +149,3 @@ class EIMPotentialFileReader : protected Pointers { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Cannot open EIM potential file %s - -The specified EIM potential file cannot be opened. Check that the -path and name are correct. - -E: Could not grab global entry from EIM potential file - -Self-explanatory. - -E: Could not grab element entry from EIM potential file - -Self-explanatory - -E: Could not grab pair entry from EIM potential file - -Self-explanatory. - -*/ diff --git a/src/MANYBODY/pair_extep.h b/src/MANYBODY/pair_extep.h index b17fda6b7e..282b190e6e 100644 --- a/src/MANYBODY/pair_extep.h +++ b/src/MANYBODY/pair_extep.h @@ -128,55 +128,3 @@ class PairExTeP : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style ExTeP requires atom IDs - -This is a requirement to use the ExTeP potential. - -E: Pair style ExTeP requires newton pair on - -See the newton command. This is a restriction to use the ExTeP -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open ExTeP potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in ExTeP potential file - -Incorrect number of words per line in the potential file. - -E: Illegal ExTeP parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file for a SW or ExTeP potential has more than -one entry for the same 3 ordered elements. - -E: Potential file is missing an entry - -The potential file for a SW or ExTeP potential does not have a -needed entry. - -*/ diff --git a/src/MANYBODY/pair_gw.h b/src/MANYBODY/pair_gw.h index c5698d331a..ca788226ed 100644 --- a/src/MANYBODY/pair_gw.h +++ b/src/MANYBODY/pair_gw.h @@ -114,53 +114,3 @@ class PairGW : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style GW requires atom IDs - -This is a requirement to use the GW potential. - -E: Pair style GW requires newton pair on - -See the newton command. This is a restriction to use the GW -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open GW potential file %s - -The specified GW potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in GW potential file - -Incorrect number of words per line in the potential file. - -E: Illegal GW parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_gw_zbl.h b/src/MANYBODY/pair_gw_zbl.h index 10c02c91f5..b8209a2a4f 100644 --- a/src/MANYBODY/pair_gw_zbl.h +++ b/src/MANYBODY/pair_gw_zbl.h @@ -49,29 +49,3 @@ class PairGWZBL : public PairGW { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair gw/zbl requires metal or real units - -UNDOCUMENTED - -E: Cannot open GW potential file %s - -The specified GW potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in GW potential file - -Incorrect number of words per line in the potential file. - -E: Illegal GW parameter - -One or more of the coefficients defined in the potential file is -invalid. - -U: Pair GW/zbl requires metal or real units - -This is a current restriction of this pair potential. - -*/ diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index e27d44a5f6..e000beba96 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -151,42 +151,3 @@ class PairLCBOP : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style LCBOP requires atom IDs - -This is a requirement to use the LCBOP potential. - -E: Pair style LCBOP requires newton pair on - -See the newton command. This is a restriction to use the Tersoff -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Neighbor list overflow, boost neigh_modify one - -There are too many neighbors of a single atom. Use the neigh_modify -command to increase the max number of neighbors allowed for one atom. -You may also want to boost the page size. - -E: Cannot open LCBOP potential file %s - -The specified LCBOP potential file cannot be opened. Check that the -path and name are correct. - -*/ diff --git a/src/MANYBODY/pair_meam_spline.cpp b/src/MANYBODY/pair_meam_spline.cpp index 033cce51b0..ab4f39bf15 100644 --- a/src/MANYBODY/pair_meam_spline.cpp +++ b/src/MANYBODY/pair_meam_spline.cpp @@ -665,7 +665,7 @@ void PairMEAMSpline::SplineFunction::prepareSpline() h = (xmax-xmin)/(N-1); hsq = h*h; - double* u = new double[N]; + auto u = new double[N]; Y2[0] = -0.5; u[0] = (3.0/(X[1]-X[0])) * ((Y[1]-Y[0])/(X[1]-X[0]) - deriv0); for (int i = 1; i <= N-2; i++) { diff --git a/src/MANYBODY/pair_meam_sw_spline.cpp b/src/MANYBODY/pair_meam_sw_spline.cpp index 164787a9a4..c744e8f002 100644 --- a/src/MANYBODY/pair_meam_sw_spline.cpp +++ b/src/MANYBODY/pair_meam_sw_spline.cpp @@ -546,7 +546,7 @@ void PairMEAMSWSpline::SplineFunction::prepareSpline() h = (xmax-xmin)/((double)(N-1)); hsq = h*h; - double* u = new double[N]; + auto u = new double[N]; Y2[0] = -0.5; u[0] = (3.0/(X[1]-X[0])) * ((Y[1]-Y[0])/(X[1]-X[0]) - deriv0); for (int i = 1; i <= N-2; i++) { diff --git a/src/MANYBODY/pair_nb3b_harmonic.h b/src/MANYBODY/pair_nb3b_harmonic.h index 48fe5cf3ca..c570a0186b 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.h +++ b/src/MANYBODY/pair_nb3b_harmonic.h @@ -58,52 +58,3 @@ class PairNb3bHarmonic : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style nb3b/harmonic requires atom IDs - -This is a requirement to use this potential. - -E: Pair style nb3b/harmonic requires newton pair on - -See the newton command. This is a restriction to use this potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open nb3b/harmonic potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in nb3b/harmonic potential file - -Incorrect number of words per line in the potential file. - -E: Illegal nb3b/harmonic parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 21aba6d6df..cb7b3fe361 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -635,7 +635,7 @@ void PairPolymorphic::read_file(char *file) MPI_Bcast(pairParameters, npair*sizeof(PairParameters), MPI_BYTE, 0, world); // start reading tabular functions - double * singletable = new double[nr]; + auto singletable = new double[nr]; for (int i = 0; i < npair; i++) { // U PairParameters &p = pairParameters[i]; if (comm->me == 0) reader->next_dvector(singletable, nr); diff --git a/src/MANYBODY/pair_polymorphic.h b/src/MANYBODY/pair_polymorphic.h index 5841d3f580..3c818955ec 100644 --- a/src/MANYBODY/pair_polymorphic.h +++ b/src/MANYBODY/pair_polymorphic.h @@ -93,52 +93,3 @@ class PairPolymorphic : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style polymorphic requires atom IDs - -This is a requirement to use the polymorphic potential. - -E: Pair style polymorphic requires newton pair on - -See the newton command. This is a restriction to use the polymorphic -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open polymorphic potential file %s - -The specified polymorphic potential file cannot be opened. Check that -the path and name are correct. - -E: Incorrect number of elements in potential file - -Self-explanatory. - -E: Element not defined in potential file - -The specified element is not in the potential file. - -E: Potential file incompatible with this pair style version - -UNDOCUMENTED - -E: Error reading potential file header - -UNDOCUMENTED - -*/ diff --git a/src/MANYBODY/pair_rebo.h b/src/MANYBODY/pair_rebo.h index b55ee87e76..430969c413 100644 --- a/src/MANYBODY/pair_rebo.h +++ b/src/MANYBODY/pair_rebo.h @@ -35,13 +35,3 @@ class PairREBO : public PairAIREBO { #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. - -*/ diff --git a/src/MANYBODY/pair_sw.h b/src/MANYBODY/pair_sw.h index 02389020a3..84088926b1 100644 --- a/src/MANYBODY/pair_sw.h +++ b/src/MANYBODY/pair_sw.h @@ -58,61 +58,11 @@ class PairSW : public Pair { void read_file(char *); virtual void setup_params(); void twobody(Param *, double, double &, int, double &); - virtual void threebody(Param *, Param *, Param *, double, double, double *, double *, double *, double *, - int, double &); + virtual void threebody(Param *, Param *, Param *, double, double, double *, double *, double *, + double *, int, double &); }; } // namespace LAMMPS_NS #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style Stillinger-Weber requires atom IDs - -This is a requirement to use the SW potential. - -E: Pair style Stillinger-Weber requires newton pair on - -See the newton command. This is a restriction to use the SW -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open Stillinger-Weber potential file %s - -The specified SW potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Stillinger-Weber potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Stillinger-Weber parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_sw_mod.h b/src/MANYBODY/pair_sw_mod.h index c8d306238b..0a5b1cdb4d 100644 --- a/src/MANYBODY/pair_sw_mod.h +++ b/src/MANYBODY/pair_sw_mod.h @@ -41,53 +41,3 @@ class PairSWMOD : public PairSW { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style Stillinger-Weber requires atom IDs - -This is a requirement to use the SW potential. - -E: Pair style Stillinger-Weber requires newton pair on - -See the newton command. This is a restriction to use the SW -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open Stillinger-Weber potential file %s - -The specified SW potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Stillinger-Weber potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Stillinger-Weber parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_tersoff.h b/src/MANYBODY/pair_tersoff.h index b246c8260d..88b529ff82 100644 --- a/src/MANYBODY/pair_tersoff.h +++ b/src/MANYBODY/pair_tersoff.h @@ -38,7 +38,6 @@ class PairTersoff : public Pair { static constexpr int NPARAMS_PER_LINE = 17; - protected: struct Param { double lam1, lam2, lam3; double c, d, h; @@ -56,6 +55,7 @@ class PairTersoff : public Pair { double c0; // added for TersoffMODC }; + protected: Param *params; // parameter set for an I-J-K interaction double cutmax; // max cutoff for all elements int maxshort; // size of short neighbor list array @@ -110,53 +110,3 @@ class PairTersoff : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style Tersoff requires atom IDs - -This is a requirement to use the Tersoff potential. - -E: Pair style Tersoff requires newton pair on - -See the newton command. This is a restriction to use the Tersoff -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open Tersoff potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Tersoff potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Tersoff parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_tersoff_mod.h b/src/MANYBODY/pair_tersoff_mod.h index bc14012e37..b866226992 100644 --- a/src/MANYBODY/pair_tersoff_mod.h +++ b/src/MANYBODY/pair_tersoff_mod.h @@ -79,29 +79,3 @@ class PairTersoffMOD : public PairTersoff { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open Tersoff potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Tersoff potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Tersoff parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_tersoff_mod_c.h b/src/MANYBODY/pair_tersoff_mod_c.h index e39c8e4340..162d262e2c 100644 --- a/src/MANYBODY/pair_tersoff_mod_c.h +++ b/src/MANYBODY/pair_tersoff_mod_c.h @@ -39,29 +39,3 @@ class PairTersoffMODC : public PairTersoffMOD { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open Tersoff potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Tersoff potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Tersoff parameter - -One or more of the coefficients defined in the potential file is -invalid. - -U: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -U: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_tersoff_zbl.h b/src/MANYBODY/pair_tersoff_zbl.h index f0b10e417a..7515311464 100644 --- a/src/MANYBODY/pair_tersoff_zbl.h +++ b/src/MANYBODY/pair_tersoff_zbl.h @@ -49,25 +49,3 @@ class PairTersoffZBL : public PairTersoff { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair tersoff/zbl requires metal or real units - -This is a current restriction of this pair potential. - -E: Cannot open Tersoff potential file %s - -The specified potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Tersoff potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Tersoff parameter - -One or more of the coefficients defined in the potential file is -invalid. - -*/ diff --git a/src/MANYBODY/pair_vashishta.h b/src/MANYBODY/pair_vashishta.h index e774e2165f..0b85266294 100644 --- a/src/MANYBODY/pair_vashishta.h +++ b/src/MANYBODY/pair_vashishta.h @@ -66,53 +66,3 @@ class PairVashishta : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style Vashishta requires atom IDs - -This is a requirement to use the Vashishta potential. - -E: Pair style Vashishta requires newton pair on - -See the newton command. This is a restriction to use the Vashishta -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open Vashishta potential file %s - -The specified Vashishta potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in Vashishta potential file - -Incorrect number of words per line in the potential file. - -E: Illegal Vashishta parameter - -One or more of the coefficients defined in the potential file is -invalid. - -E: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -E: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index a39f2b90ec..8a46af69da 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -198,7 +198,7 @@ void PairVashishtaTable::twobody_table(const Param ¶m, double rsq, // use analytic form if rsq is inside inner cutoff if (rsq < tabinnersq) { - Param *pparam = const_cast (¶m); + auto pparam = const_cast (¶m); PairVashishta::twobody(pparam,rsq,fforce,eflag,eng); return; } diff --git a/src/MANYBODY/pair_vashishta_table.h b/src/MANYBODY/pair_vashishta_table.h index 646529da56..460304ad91 100644 --- a/src/MANYBODY/pair_vashishta_table.h +++ b/src/MANYBODY/pair_vashishta_table.h @@ -48,57 +48,3 @@ class PairVashishtaTable : public PairVashishta { #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: Illegal inner cutoff for tabulation - -UNDOCUMENTED - -U: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -U: Pair style Vashishta requires atom IDs - -This is a requirement to use the Vashishta potential. - -U: Pair style Vashishta requires newton pair on - -See the newton command. This is a restriction to use the Vashishta -potential. - -U: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -U: Cannot open Vashishta potential file %s - -The specified Vashishta potential file cannot be opened. Check that the path -and name are correct. - -U: Incorrect format in Vashishta potential file - -Incorrect number of words per line in the potential file. - -U: Illegal Vashishta parameter - -One or more of the coefficients defined in the potential file is -invalid. - -U: Potential file has duplicate entry - -The potential file has more than one entry for the same element. - -U: Potential file is missing an entry - -The potential file does not have a needed entry. - -*/ diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index 9900f1aa26..a231a94990 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -40,9 +39,9 @@ #include "region.h" #include "update.h" -#include #include #include +#include #include using namespace LAMMPS_NS; @@ -51,13 +50,12 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - idregion(nullptr), type_list(nullptr), mu(nullptr), qtype(nullptr), - sqrt_mass_ratio(nullptr), local_swap_iatom_list(nullptr), - local_swap_jatom_list(nullptr), local_swap_atom_list(nullptr), - random_equal(nullptr), random_unequal(nullptr), c_pe(nullptr) + Fix(lmp, narg, arg), region(nullptr), idregion(nullptr), type_list(nullptr), mu(nullptr), + qtype(nullptr), sqrt_mass_ratio(nullptr), local_swap_iatom_list(nullptr), + local_swap_jatom_list(nullptr), local_swap_atom_list(nullptr), random_equal(nullptr), + random_unequal(nullptr), c_pe(nullptr) { - if (narg < 10) error->all(FLERR,"Illegal fix atom/swap command"); + if (narg < 10) error->all(FLERR, "Illegal fix atom/swap command"); dynamic_group_allow = 1; @@ -70,33 +68,33 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : // required args - 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); + 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); - if (nevery <= 0) error->all(FLERR,"Illegal fix atom/swap command"); - if (ncycles < 0) error->all(FLERR,"Illegal fix atom/swap command"); - if (seed <= 0) error->all(FLERR,"Illegal fix atom/swap command"); - if (temperature <= 0.0) error->all(FLERR,"Illegal fix atom/swap command"); + if (nevery <= 0) error->all(FLERR, "Illegal fix atom/swap command"); + if (ncycles < 0) error->all(FLERR, "Illegal fix atom/swap command"); + if (seed <= 0) error->all(FLERR, "Illegal fix atom/swap command"); + if (temperature <= 0.0) error->all(FLERR, "Illegal fix atom/swap command"); - beta = 1.0/(force->boltz*temperature); + beta = 1.0 / (force->boltz * temperature); - memory->create(type_list,atom->ntypes,"atom/swap:type_list"); - memory->create(mu,atom->ntypes+1,"atom/swap:mu"); + memory->create(type_list, atom->ntypes, "atom/swap:type_list"); + memory->create(mu, atom->ntypes + 1, "atom/swap:mu"); for (int i = 1; i <= atom->ntypes; i++) mu[i] = 0.0; // read options from end of input line - options(narg-7,&arg[7]); + options(narg - 7, &arg[7]); // random number generator, same for all procs - random_equal = new RanPark(lmp,seed); + random_equal = new RanPark(lmp, seed); // random number generator, not the same for all procs - random_unequal = new RanPark(lmp,seed); + random_unequal = new RanPark(lmp, seed); // set up reneighboring @@ -115,9 +113,10 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : // set comm size needed by this Fix - if (atom->q_flag) comm_forward = 2; - else comm_forward = 1; - + if (atom->q_flag) + comm_forward = 2; + else + comm_forward = 1; } /* ---------------------------------------------------------------------- */ @@ -130,7 +129,7 @@ FixAtomSwap::~FixAtomSwap() memory->destroy(sqrt_mass_ratio); memory->destroy(local_swap_iatom_list); memory->destroy(local_swap_jatom_list); - if (regionflag) delete [] idregion; + delete[] idregion; delete random_equal; delete random_unequal; } @@ -141,54 +140,51 @@ FixAtomSwap::~FixAtomSwap() void FixAtomSwap::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR,"Illegal fix atom/swap command"); + if (narg < 0) error->all(FLERR, "Illegal fix atom/swap command"); - regionflag = 0; ke_flag = 1; semi_grand_flag = 0; nswaptypes = 0; nmutypes = 0; - iregion = -1; int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix atom/swap command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix atom/swap does not exist"); - idregion = utils::strdup(arg[iarg+1]); - regionflag = 1; + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix atom/swap command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix atom/swap does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else if (strcmp(arg[iarg],"ke") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix atom/swap command"); - ke_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "ke") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix atom/swap command"); + ke_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"semi-grand") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix atom/swap command"); - semi_grand_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "semi-grand") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix atom/swap command"); + semi_grand_flag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"types") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix atom/swap command"); + } else if (strcmp(arg[iarg], "types") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix atom/swap command"); iarg++; while (iarg < narg) { if (isalpha(arg[iarg][0])) break; - if (nswaptypes >= atom->ntypes) error->all(FLERR,"Illegal fix atom/swap command"); - type_list[nswaptypes] = utils::numeric(FLERR,arg[iarg],false,lmp); + if (nswaptypes >= atom->ntypes) error->all(FLERR, "Illegal fix atom/swap command"); + type_list[nswaptypes] = utils::numeric(FLERR, arg[iarg], false, lmp); nswaptypes++; iarg++; } - } else if (strcmp(arg[iarg],"mu") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix atom/swap command"); + } else if (strcmp(arg[iarg], "mu") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix atom/swap command"); iarg++; while (iarg < narg) { if (isalpha(arg[iarg][0])) break; nmutypes++; - if (nmutypes > atom->ntypes) error->all(FLERR,"Illegal fix atom/swap command"); - mu[nmutypes] = utils::numeric(FLERR,arg[iarg],false,lmp); + if (nmutypes > atom->ntypes) error->all(FLERR, "Illegal fix atom/swap command"); + mu[nmutypes] = utils::numeric(FLERR, arg[iarg], false, lmp); iarg++; } - } else error->all(FLERR,"Illegal fix atom/swap command"); + } else + error->all(FLERR, "Illegal fix atom/swap command"); } } @@ -205,36 +201,40 @@ int FixAtomSwap::setmask() void FixAtomSwap::init() { - char *id_pe = (char *) "thermo_pe"; - int ipe = modify->find_compute(id_pe); - c_pe = modify->compute[ipe]; + c_pe = modify->get_compute_by_id("thermo_pe"); int *type = atom->type; - if (nswaptypes < 2) - error->all(FLERR,"Must specify at least 2 types in fix atom/swap command"); + if (nswaptypes < 2) error->all(FLERR, "Must specify at least 2 types in fix atom/swap command"); if (semi_grand_flag) { if (nswaptypes != nmutypes) - error->all(FLERR,"Need nswaptypes mu values in fix atom/swap command"); + error->all(FLERR, "Need nswaptypes mu values in fix atom/swap command"); } else { if (nswaptypes != 2) - error->all(FLERR,"Only 2 types allowed when not using semi-grand in fix atom/swap command"); + error->all(FLERR, "Only 2 types allowed when not using semi-grand in fix atom/swap command"); if (nmutypes != 0) - error->all(FLERR,"Mu not allowed when not using semi-grand in fix atom/swap command"); + error->all(FLERR, "Mu not allowed when not using semi-grand in fix atom/swap command"); + } + + // set index and check validity of region + + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix setforce does not exist", idregion); } for (int iswaptype = 0; iswaptype < nswaptypes; iswaptype++) if (type_list[iswaptype] <= 0 || type_list[iswaptype] > atom->ntypes) - error->all(FLERR,"Invalid atom type in fix atom/swap command"); + error->all(FLERR, "Invalid atom type in fix atom/swap command"); // this is only required for non-semi-grand // in which case, nswaptypes = 2 if (atom->q_flag && !semi_grand_flag) { - double qmax,qmin; - int firstall,first; - memory->create(qtype,nswaptypes,"atom/swap:qtype"); + double qmax, qmin; + int firstall, first; + memory->create(qtype, nswaptypes, "atom/swap:qtype"); for (int iswaptype = 0; iswaptype < nswaptypes; iswaptype++) { first = 1; for (int i = 0; i < atom->nlocal; i++) { @@ -244,24 +244,26 @@ void FixAtomSwap::init() qtype[iswaptype] = atom->q[i]; first = 0; } else if (qtype[iswaptype] != atom->q[i]) - error->one(FLERR,"All atoms of a swapped type must have the same charge."); + error->one(FLERR, "All atoms of a swapped type must have the same charge."); } } } - MPI_Allreduce(&first,&firstall,1,MPI_INT,MPI_MIN,world); - if (firstall) error->all(FLERR,"At least one atom of each swapped type must be present to define charges."); + MPI_Allreduce(&first, &firstall, 1, MPI_INT, MPI_MIN, world); + if (firstall) + error->all(FLERR, + "At least one atom of each swapped type must be present to define charges."); if (first) qtype[iswaptype] = -DBL_MAX; - MPI_Allreduce(&qtype[iswaptype],&qmax,1,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&qtype[iswaptype], &qmax, 1, MPI_DOUBLE, MPI_MAX, world); if (first) qtype[iswaptype] = DBL_MAX; - MPI_Allreduce(&qtype[iswaptype],&qmin,1,MPI_DOUBLE,MPI_MIN,world); - if (qmax != qmin) error->all(FLERR,"All atoms of a swapped type must have same charge."); + MPI_Allreduce(&qtype[iswaptype], &qmin, 1, MPI_DOUBLE, MPI_MIN, world); + if (qmax != qmin) error->all(FLERR, "All atoms of a swapped type must have same charge."); } } - memory->create(sqrt_mass_ratio,atom->ntypes+1,atom->ntypes+1,"atom/swap:sqrt_mass_ratio"); + memory->create(sqrt_mass_ratio, atom->ntypes + 1, atom->ntypes + 1, "atom/swap:sqrt_mass_ratio"); for (int itype = 1; itype <= atom->ntypes; itype++) for (int jtype = 1; jtype <= atom->ntypes; jtype++) - sqrt_mass_ratio[itype][jtype] = sqrt(atom->mass[itype]/atom->mass[jtype]); + sqrt_mass_ratio[itype][jtype] = sqrt(atom->mass[itype] / atom->mass[jtype]); // check to see if itype and jtype cutoffs are the same // if not, reneighboring will be needed between swaps @@ -286,10 +288,9 @@ void FixAtomSwap::init() if ((mask[i] == groupbit) && (mask[i] && firstgroupbit)) flag = 1; int flagall; - MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); - if (flagall) - error->all(FLERR,"Cannot do atom/swap on atoms in atom_modify first group"); + if (flagall) error->all(FLERR, "Cannot do atom/swap on atoms in atom_modify first group"); } } @@ -309,7 +310,7 @@ void FixAtomSwap::pre_exchange() domain->pbc(); comm->exchange(); comm->borders(); - if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); neighbor->build(1); @@ -353,14 +354,14 @@ int FixAtomSwap::attempt_semi_grand() // pick a random atom and perform swap - int itype,jtype,jswaptype; + int itype, jtype, jswaptype; int i = pick_semi_grand_atom(); if (i >= 0) { - jswaptype = static_cast (nswaptypes*random_unequal->uniform()); + jswaptype = static_cast(nswaptypes * random_unequal->uniform()); jtype = type_list[jswaptype]; itype = atom->type[i]; while (itype == jtype) { - jswaptype = static_cast (nswaptypes*random_unequal->uniform()); + jswaptype = static_cast(nswaptypes * random_unequal->uniform()); jtype = type_list[jswaptype]; } atom->type[i] = jtype; @@ -374,7 +375,7 @@ int FixAtomSwap::attempt_semi_grand() if (domain->triclinic) domain->x2lamda(atom->nlocal); comm->exchange(); comm->borders(); - if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); neighbor->build(1); } else { @@ -389,11 +390,11 @@ int FixAtomSwap::attempt_semi_grand() int success = 0; if (i >= 0) if (random_unequal->uniform() < - exp(beta*(energy_before - energy_after - + mu[jtype] - mu[itype]))) success = 1; + exp(beta * (energy_before - energy_after + mu[jtype] - mu[itype]))) + success = 1; int success_all = 0; - MPI_Allreduce(&success,&success_all,1,MPI_INT,MPI_MAX,world); + MPI_Allreduce(&success, &success_all, 1, MPI_INT, MPI_MAX, world); // swap accepted, return 1 @@ -460,7 +461,7 @@ int FixAtomSwap::attempt_swap() domain->pbc(); comm->exchange(); comm->borders(); - if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); + if (domain->triclinic) domain->lamda2x(atom->nlocal + atom->nghost); if (modify->n_pre_neighbor) modify->pre_neighbor(); neighbor->build(1); } else { @@ -474,8 +475,7 @@ int FixAtomSwap::attempt_swap() // swap accepted, return 1 // if ke_flag, rescale atom velocities - if (random_equal->uniform() < - exp(beta*(energy_before - energy_after))) { + if (random_equal->uniform() < exp(beta * (energy_before - energy_after))) { update_swap_atoms_list(); if (ke_flag) { if (i >= 0) { @@ -521,18 +521,18 @@ double FixAtomSwap::energy_full() if (modify->n_pre_force) modify->pre_force(vflag); - if (force->pair) force->pair->compute(eflag,vflag); + if (force->pair) force->pair->compute(eflag, vflag); if (atom->molecular != Atom::ATOMIC) { - if (force->bond) force->bond->compute(eflag,vflag); - if (force->angle) force->angle->compute(eflag,vflag); - if (force->dihedral) force->dihedral->compute(eflag,vflag); - if (force->improper) force->improper->compute(eflag,vflag); + if (force->bond) force->bond->compute(eflag, vflag); + if (force->angle) force->angle->compute(eflag, vflag); + if (force->dihedral) force->dihedral->compute(eflag, vflag); + if (force->improper) force->improper->compute(eflag, vflag); } - if (force->kspace) force->kspace->compute(eflag,vflag); + if (force->kspace) force->kspace->compute(eflag, vflag); - if (modify->n_post_force) modify->post_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); @@ -546,9 +546,8 @@ double FixAtomSwap::energy_full() int FixAtomSwap::pick_semi_grand_atom() { int i = -1; - int iwhichglobal = static_cast (nswap*random_equal->uniform()); - if ((iwhichglobal >= nswap_before) && - (iwhichglobal < nswap_before + nswap_local)) { + int iwhichglobal = static_cast(nswap * random_equal->uniform()); + if ((iwhichglobal >= nswap_before) && (iwhichglobal < nswap_before + nswap_local)) { int iwhichlocal = iwhichglobal - nswap_before; i = local_swap_atom_list[iwhichlocal]; } @@ -562,9 +561,8 @@ int FixAtomSwap::pick_semi_grand_atom() int FixAtomSwap::pick_i_swap_atom() { int i = -1; - int iwhichglobal = static_cast (niswap*random_equal->uniform()); - if ((iwhichglobal >= niswap_before) && - (iwhichglobal < niswap_before + niswap_local)) { + int iwhichglobal = static_cast(niswap * random_equal->uniform()); + if ((iwhichglobal >= niswap_before) && (iwhichglobal < niswap_before + niswap_local)) { int iwhichlocal = iwhichglobal - niswap_before; i = local_swap_iatom_list[iwhichlocal]; } @@ -578,9 +576,8 @@ int FixAtomSwap::pick_i_swap_atom() int FixAtomSwap::pick_j_swap_atom() { int j = -1; - int jwhichglobal = static_cast (njswap*random_equal->uniform()); - if ((jwhichglobal >= njswap_before) && - (jwhichglobal < njswap_before + njswap_local)) { + int jwhichglobal = static_cast(njswap * random_equal->uniform()); + if ((jwhichglobal >= njswap_before) && (jwhichglobal < njswap_before + njswap_local)) { int jwhichlocal = jwhichglobal - njswap_before; j = local_swap_jatom_list[jwhichlocal]; } @@ -600,16 +597,15 @@ void FixAtomSwap::update_semi_grand_atoms_list() if (atom->nmax > atom_swap_nmax) { memory->sfree(local_swap_atom_list); atom_swap_nmax = atom->nmax; - local_swap_atom_list = (int *) memory->smalloc(atom_swap_nmax*sizeof(int), - "MCSWAP:local_swap_atom_list"); + local_swap_atom_list = + (int *) memory->smalloc(atom_swap_nmax * sizeof(int), "MCSWAP:local_swap_atom_list"); } nswap_local = 0; - if (regionflag) { - + if (region) { for (int i = 0; i < nlocal; i++) { - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]) == 1) { + if (region->match(x[i][0], x[i][1], x[i][2]) == 1) { if (atom->mask[i] & groupbit) { int itype = atom->type[i]; int iswaptype; @@ -625,23 +621,22 @@ void FixAtomSwap::update_semi_grand_atoms_list() } else { for (int i = 0; i < nlocal; i++) { if (atom->mask[i] & groupbit) { - int itype = atom->type[i]; - int iswaptype; - for (iswaptype = 0; iswaptype < nswaptypes; iswaptype++) - if (itype == type_list[iswaptype]) break; - if (iswaptype == nswaptypes) continue; + int itype = atom->type[i]; + int iswaptype; + for (iswaptype = 0; iswaptype < nswaptypes; iswaptype++) + if (itype == type_list[iswaptype]) break; + if (iswaptype == nswaptypes) continue; local_swap_atom_list[nswap_local] = i; nswap_local++; } } } - MPI_Allreduce(&nswap_local,&nswap,1,MPI_INT,MPI_SUM,world); - MPI_Scan(&nswap_local,&nswap_before,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&nswap_local, &nswap, 1, MPI_INT, MPI_SUM, world); + MPI_Scan(&nswap_local, &nswap_before, 1, MPI_INT, MPI_SUM, world); nswap_before -= nswap_local; } - /* ---------------------------------------------------------------------- update the list of gas atoms ------------------------------------------------------------------------- */ @@ -656,24 +651,24 @@ void FixAtomSwap::update_swap_atoms_list() memory->sfree(local_swap_iatom_list); memory->sfree(local_swap_jatom_list); atom_swap_nmax = atom->nmax; - local_swap_iatom_list = (int *) memory->smalloc(atom_swap_nmax*sizeof(int), - "MCSWAP:local_swap_iatom_list"); - local_swap_jatom_list = (int *) memory->smalloc(atom_swap_nmax*sizeof(int), - "MCSWAP:local_swap_jatom_list"); + local_swap_iatom_list = + (int *) memory->smalloc(atom_swap_nmax * sizeof(int), "MCSWAP:local_swap_iatom_list"); + local_swap_jatom_list = + (int *) memory->smalloc(atom_swap_nmax * sizeof(int), "MCSWAP:local_swap_jatom_list"); } niswap_local = 0; njswap_local = 0; - if (regionflag) { + if (region) { for (int i = 0; i < nlocal; i++) { - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]) == 1) { + if (region->match(x[i][0], x[i][1], x[i][2]) == 1) { if (atom->mask[i] & groupbit) { - if (type[i] == type_list[0]) { + if (type[i] == type_list[0]) { local_swap_iatom_list[niswap_local] = i; niswap_local++; - } else if (type[i] == type_list[1]) { + } else if (type[i] == type_list[1]) { local_swap_jatom_list[njswap_local] = i; njswap_local++; } @@ -684,10 +679,10 @@ void FixAtomSwap::update_swap_atoms_list() } else { for (int i = 0; i < nlocal; i++) { if (atom->mask[i] & groupbit) { - if (type[i] == type_list[0]) { + if (type[i] == type_list[0]) { local_swap_iatom_list[niswap_local] = i; niswap_local++; - } else if (type[i] == type_list[1]) { + } else if (type[i] == type_list[1]) { local_swap_jatom_list[njswap_local] = i; njswap_local++; } @@ -695,12 +690,12 @@ void FixAtomSwap::update_swap_atoms_list() } } - MPI_Allreduce(&niswap_local,&niswap,1,MPI_INT,MPI_SUM,world); - MPI_Scan(&niswap_local,&niswap_before,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&niswap_local, &niswap, 1, MPI_INT, MPI_SUM, world); + MPI_Scan(&niswap_local, &niswap_before, 1, MPI_INT, MPI_SUM, world); niswap_before -= niswap_local; - MPI_Allreduce(&njswap_local,&njswap,1,MPI_INT,MPI_SUM,world); - MPI_Scan(&njswap_local,&njswap_before,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&njswap_local, &njswap, 1, MPI_INT, MPI_SUM, world); + MPI_Scan(&njswap_local, &njswap_before, 1, MPI_INT, MPI_SUM, world); njswap_before -= njswap_local; } @@ -708,7 +703,7 @@ void FixAtomSwap::update_swap_atoms_list() int FixAtomSwap::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { - int i,j,m; + int i, j, m; int *type = atom->type; double *q = atom->q; @@ -735,7 +730,7 @@ int FixAtomSwap::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag void FixAtomSwap::unpack_forward_comm(int n, int first, double *buf) { - int i,m,last; + int i, m, last; int *type = atom->type; double *q = atom->q; @@ -745,12 +740,11 @@ void FixAtomSwap::unpack_forward_comm(int n, int first, double *buf) if (atom->q_flag) { for (i = first; i < last; i++) { - type[i] = static_cast (buf[m++]); + type[i] = static_cast(buf[m++]); q[i] = buf[m++]; } } else { - for (i = first; i < last; i++) - type[i] = static_cast (buf[m++]); + for (i = first; i < last; i++) type[i] = static_cast(buf[m++]); } } @@ -771,7 +765,7 @@ double FixAtomSwap::compute_vector(int n) double FixAtomSwap::memory_usage() { - double bytes = (double)atom_swap_nmax * sizeof(int); + double bytes = (double) atom_swap_nmax * sizeof(int); return bytes; } @@ -792,8 +786,8 @@ void FixAtomSwap::write_restart(FILE *fp) if (comm->me == 0) { int size = n * sizeof(double); - fwrite(&size,sizeof(int),1,fp); - fwrite(list,sizeof(double),n,fp); + fwrite(&size, sizeof(int), 1, fp); + fwrite(list, sizeof(double), n, fp); } } @@ -804,12 +798,12 @@ void FixAtomSwap::write_restart(FILE *fp) void FixAtomSwap::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; - seed = static_cast (list[n++]); + seed = static_cast(list[n++]); random_equal->reset(seed); - seed = static_cast (list[n++]); + seed = static_cast(list[n++]); random_unequal->reset(seed); next_reneighbor = (bigint) ubuf(list[n++]).i; @@ -819,5 +813,5 @@ void FixAtomSwap::restart(char *buf) bigint ntimestep_restart = (bigint) ubuf(list[n++]).i; if (ntimestep_restart != update->ntimestep) - error->all(FLERR,"Must not reset timestep when restarting fix atom/swap"); + error->all(FLERR, "Must not reset timestep when restarting fix atom/swap"); } diff --git a/src/MC/fix_atom_swap.h b/src/MC/fix_atom_swap.h index 59145da84f..4eda3cfcf6 100644 --- a/src/MC/fix_atom_swap.h +++ b/src/MC/fix_atom_swap.h @@ -40,8 +40,8 @@ class FixAtomSwap : public Fix { private: int nevery, seed; - int ke_flag; // yes = conserve ke, no = do not conserve ke - int semi_grand_flag; // yes = semi-grand canonical, no = constant composition + int ke_flag; // yes = conserve ke, no = do not conserve ke + int semi_grand_flag; // yes = semi-grand canonical, no = constant composition int ncycles; int niswap, njswap; // # of i,j swap atoms on all procs int niswap_local, njswap_local; // # of swap atoms on this proc @@ -49,8 +49,7 @@ class FixAtomSwap : public Fix { int nswap; // # of swap atoms on all procs int nswap_local; // # of swap atoms on this proc int nswap_before; // # of swap atoms on procs < this proc - int regionflag; // 0 = anywhere in box, 1 = specific region - int iregion; // swap region + class Region *region; // swap region char *idregion; // swap region id int nswaptypes, nmutypes; @@ -91,54 +90,3 @@ class FixAtomSwap : public Fix { #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: Region ID for fix atom/swap does not exist - -Self-explanatory. - -E: Must specify at least 2 types in fix atom/swap command - -Self-explanatory. - -E: Need nswaptypes mu values in fix atom/swap command - -Self-explanatory. - -E: Only 2 types allowed when not using semi-grand in fix atom/swap command - -Self-explanatory. - -E: Mu not allowed when not using semi-grand in fix atom/swap command - -Self-explanatory. - -E: Invalid atom type in fix atom/swap command - -The atom type specified in the atom/swap command does not exist. - -E: All atoms of a swapped type must have the same charge. - -Self-explanatory. - -E: At least one atom of each swapped type must be present to define charges. - -Self-explanatory. - -E: All atoms of a swapped type must have same charge. - -Self-explanatory. - -E: Cannot do atom/swap on atoms in atom_modify first group - -This is a restriction due to the way atoms are organized in a list to -enable the atom_modify first command. - -*/ diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index f7199d95f6..71408d8aed 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -19,11 +19,14 @@ #include "error.h" #include "force.h" #include "memory.h" +#include "modify.h" #include "neighbor.h" #include "random_mars.h" #include "respa.h" #include "update.h" +#include "fix_bond_history.h" + #include using namespace LAMMPS_NS; @@ -146,7 +149,7 @@ int FixBondBreak::setmask() void FixBondBreak::init() { if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; // enable angle/dihedral/improper breaking if any defined @@ -258,6 +261,10 @@ void FixBondBreak::post_integrate() commflag = 1; comm->forward_comm(this,2); + // find instances of bond history to delete data + auto histories = modify->get_fix_by_style("BOND_HISTORY"); + int n_histories = histories.size(); + // break bonds // if both atoms list each other as winning bond partner // and probability constraint is satisfied @@ -292,7 +299,13 @@ void FixBondBreak::post_integrate() for (k = m; k < num_bond[i]-1; k++) { bond_atom[i][k] = bond_atom[i][k+1]; bond_type[i][k] = bond_type[i][k+1]; + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->shift_history(i,k,k+1); } + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(i,num_bond[i]-1); num_bond[i]--; break; } diff --git a/src/MC/fix_bond_break.h b/src/MC/fix_bond_break.h index 52b3c84725..afc9df6cc6 100644 --- a/src/MC/fix_bond_break.h +++ b/src/MC/fix_bond_break.h @@ -77,32 +77,3 @@ class FixBondBreak : public Fix { #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: Invalid bond type in fix bond/break command - -Self-explanatory. - -E: Cannot use fix bond/break with non-molecular systems - -Only systems with bonds that can be changed can be used. Atom_style -template does not qualify. - -E: Cannot yet use fix bond/break with this improper style - -This is a current restriction in LAMMPS. - -E: Fix bond/break needs ghost atoms from further away - -This is because the fix needs to walk bonds to a certain distance to -acquire needed info, The comm_modify cutoff command can be used to -extend the communication range. - -*/ diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 4317d4c162..2550e881d6 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -235,7 +235,7 @@ int FixBondCreate::setmask() void FixBondCreate::init() { if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; // check cutoff for iatomtype,jatomtype diff --git a/src/MC/fix_bond_create.h b/src/MC/fix_bond_create.h index 339094c8ef..929e656722 100644 --- a/src/MC/fix_bond_create.h +++ b/src/MC/fix_bond_create.h @@ -94,87 +94,3 @@ class FixBondCreate : public Fix { #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: Invalid atom type in fix bond/create command - -Self-explanatory. - -E: Invalid bond type in fix bond/create command - -Self-explanatory. - -E: Cannot use fix bond/create with non-molecular systems - -Only systems with bonds that can be changed can be used. Atom_style -template does not qualify. - -E: Inconsistent iparam/jparam values in fix bond/create command - -If itype and jtype are the same, then their maxbond and newtype -settings must also be the same. - -E: Fix bond/create cutoff is longer than pairwise cutoff - -This is not allowed because bond creation is done using the -pairwise neighbor list. - -E: Fix bond/create angle type is invalid - -Self-explanatory. - -E: Fix bond/create dihedral type is invalid - -Self-explanatory. - -E: Fix bond/create improper type is invalid - -Self-explanatory. - -E: Cannot yet use fix bond/create with this improper style - -This is a current restriction in LAMMPS. - -E: Fix bond/create needs ghost atoms from further away - -This is because the fix needs to walk bonds to a certain distance to -acquire needed info, The comm_modify cutoff command can be used to -extend the communication range. - -E: New bond exceeded bonds per atom in fix bond/create - -See the read_data command for info on setting the "extra bond per -atom" header value to allow for additional bonds to be formed. - -E: New bond exceeded special list size in fix bond/create - -See the special_bonds extra command for info on how to leave space in -the special bonds list to allow for additional bonds to be formed. - -E: Fix bond/create induced too many angles/dihedrals/impropers per atom - -See the read_data command for info on setting the "extra angle per -atom", etc header values to allow for additional angles, etc to be -formed. - -E: Special list size exceeded in fix bond/create - -See the read_data command for info on setting the "extra special per -atom" header value to allow for additional special values to be -stored. - -W: Fix bond/create is used multiple times or with fix bond/break - may not work as expected - -When using fix bond/create multiple times or in combination with -fix bond/break, the individual fix instances do not share information -about changes they made at the same time step and thus it may result -in unexpected behavior. - -*/ diff --git a/src/MC/fix_bond_create_angle.cpp b/src/MC/fix_bond_create_angle.cpp index 3ebda59f0d..f3014a4b07 100644 --- a/src/MC/fix_bond_create_angle.cpp +++ b/src/MC/fix_bond_create_angle.cpp @@ -17,21 +17,15 @@ ------------------------------------------------------------------------- */ #include "fix_bond_create_angle.h" + #include "atom.h" + #include using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -FixBondCreateAngle::FixBondCreateAngle(LAMMPS *lmp, int narg, char **arg) : - FixBondCreate(lmp, narg, arg) -{ - -} - -/* ---------------------------------------------------------------------- */ - int FixBondCreateAngle::constrain(int i, int j, double amin, double amax) { double **x = atom->x; diff --git a/src/MC/fix_bond_create_angle.h b/src/MC/fix_bond_create_angle.h index 6c74f0e6d7..ae3d6afa97 100644 --- a/src/MC/fix_bond_create_angle.h +++ b/src/MC/fix_bond_create_angle.h @@ -26,7 +26,7 @@ namespace LAMMPS_NS { class FixBondCreateAngle : public FixBondCreate { public: - FixBondCreateAngle(class LAMMPS *, int, char **); + FixBondCreateAngle(LAMMPS *_lmp, int narg, char **arg) : FixBondCreate(_lmp, narg, arg) {} private: int constrain(int, int, double, double) override; diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index c4abf31f16..59fabc8ffe 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -22,6 +22,7 @@ #include "compute.h" #include "domain.h" #include "error.h" +#include "fix_bond_history.h" #include "force.h" #include "memory.h" #include "modify.h" @@ -446,6 +447,10 @@ void FixBondSwap::post_integrate() if (!accept) return; naccept++; + // find instances of bond/history to reset history + auto histories = modify->get_fix_by_style("BOND_HISTORY"); + int n_histories = histories.size(); + // change bond partners of affected atoms // on atom i: bond i-inext changes to i-jnext // on atom j: bond j-jnext changes to j-inext @@ -453,13 +458,33 @@ void FixBondSwap::post_integrate() // on atom jnext: bond jnext-j changes to jnext-i for (ibond = 0; ibond < num_bond[i]; ibond++) - if (bond_atom[i][ibond] == tag[inext]) bond_atom[i][ibond] = tag[jnext]; + if (bond_atom[i][ibond] == tag[inext]) { + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(i,ibond); + bond_atom[i][ibond] = tag[jnext]; + } for (jbond = 0; jbond < num_bond[j]; jbond++) - if (bond_atom[j][jbond] == tag[jnext]) bond_atom[j][jbond] = tag[inext]; + if (bond_atom[j][jbond] == tag[jnext]) { + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(j,jbond); + bond_atom[j][jbond] = tag[inext]; + } for (ibond = 0; ibond < num_bond[inext]; ibond++) - if (bond_atom[inext][ibond] == tag[i]) bond_atom[inext][ibond] = tag[j]; + if (bond_atom[inext][ibond] == tag[i]) { + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(inext,ibond); + bond_atom[inext][ibond] = tag[j]; + } for (jbond = 0; jbond < num_bond[jnext]; jbond++) - if (bond_atom[jnext][jbond] == tag[j]) bond_atom[jnext][jbond] = tag[i]; + if (bond_atom[jnext][jbond] == tag[j]) { + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(jnext,jbond); + bond_atom[jnext][jbond] = tag[i]; + } // set global tags of 4 atoms in bonds diff --git a/src/MC/fix_bond_swap.h b/src/MC/fix_bond_swap.h index 526d35ae22..43cdfb74c0 100644 --- a/src/MC/fix_bond_swap.h +++ b/src/MC/fix_bond_swap.h @@ -60,62 +60,3 @@ class FixBondSwap : public Fix { #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: Cannot use fix bond/swap with non-molecular systems - -Only systems with bonds that can be changed can be used. Atom_style -template does not qualify. - -E: Must use atom style with molecule IDs with fix bond/swap - -Self-explanatory. - -E: Temperature ID for fix bond/swap does not exist - -Self-explanatory. - -E: Fix bond/swap requires pair and bond styles - -Self-explanatory. - -E: Pair style does not support fix bond/swap - -The pair style does not have a single() function, so it can -not be invoked by fix bond/swap. - -W: Fix bond/swap will ignore defined angles - -See the doc page for fix bond/swap for more info on this -restriction. - -E: Fix bond/swap cannot use dihedral or improper styles - -These styles cannot be defined when using this fix. - -E: Fix bond/swap requires special_bonds = 0,1,1 - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 344e950847..81f722bb6c 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -1129,7 +1129,7 @@ double FixChargeRegulation::energy_full() { if (force->kspace) force->kspace->compute(eflag, vflag); if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); - if (modify->n_post_force) modify->post_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); @@ -1232,7 +1232,7 @@ void FixChargeRegulation::write_restart(FILE *fp) void FixChargeRegulation::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MC/fix_charge_regulation.h b/src/MC/fix_charge_regulation.h index f3856ed067..21634ec95a 100644 --- a/src/MC/fix_charge_regulation.h +++ b/src/MC/fix_charge_regulation.h @@ -112,15 +112,3 @@ class FixChargeRegulation : public Fix { #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. - -Self-explanatory. - -*/ diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 1d411c19a7..835d049bc6 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -68,7 +68,7 @@ enum{NONE,MOVEATOM,MOVEMOL}; // movemode FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(nullptr), full_flag(false), ngroups(0), groupstrings(nullptr), ngrouptypes(0), + region(nullptr), idregion(nullptr), full_flag(false), groupstrings(nullptr), grouptypestrings(nullptr), grouptypebits(nullptr), grouptypes(nullptr), local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), random_equal(nullptr), random_unequal(nullptr), fixrigid(nullptr), fixshake(nullptr), idrigid(nullptr), idshake(nullptr) @@ -87,6 +87,9 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : restart_global = 1; time_depend = 1; + ngroups = 0; + ngrouptypes = 0; + // required args nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -122,18 +125,18 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : region_xlo = region_xhi = region_ylo = region_yhi = region_zlo = region_zhi = 0.0; - if (regionflag) { - if (domain->regions[iregion]->bboxflag == 0) + if (region) { + if (region->bboxflag == 0) error->all(FLERR,"Fix gcmc region does not support a bounding box"); - if (domain->regions[iregion]->dynamic_check()) + if (region->dynamic_check()) error->all(FLERR,"Fix gcmc region cannot be dynamic"); - region_xlo = domain->regions[iregion]->extent_xlo; - region_xhi = domain->regions[iregion]->extent_xhi; - region_ylo = domain->regions[iregion]->extent_ylo; - region_yhi = domain->regions[iregion]->extent_yhi; - region_zlo = domain->regions[iregion]->extent_zlo; - region_zhi = domain->regions[iregion]->extent_zhi; + region_xlo = region->extent_xlo; + region_xhi = region->extent_xhi; + region_ylo = region->extent_ylo; + region_yhi = region->extent_yhi; + region_zlo = region->extent_zlo; + region_zhi = region->extent_zhi; if (region_xlo < domain->boxlo[0] || region_xhi > domain->boxhi[0] || region_ylo < domain->boxlo[1] || region_yhi > domain->boxhi[1] || @@ -149,15 +152,14 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - if (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) != 0) + if (region->match(coord[0],coord[1],coord[2]) != 0) inside++; } - double max_region_volume = (region_xhi - region_xlo)* - (region_yhi - region_ylo)*(region_zhi - region_zlo); + double max_region_volume = (region_xhi - region_xlo) * + (region_yhi - region_ylo) * (region_zhi - region_zlo); - region_volume = max_region_volume*static_cast (inside)/ - static_cast (attempts); + region_volume = max_region_volume * static_cast(inside) / static_cast(attempts); } // error check and further setup for exchmode = EXCHMOL @@ -241,8 +243,6 @@ void FixGCMC::options(int narg, char **arg) pmolrotate = 0.0; pmctot = 0.0; max_rotation_angle = 10*MY_PI/180; - regionflag = 0; - iregion = -1; region_volume = 0; max_region_attempts = 1000; molecule_group = 0; @@ -300,11 +300,10 @@ void FixGCMC::options(int narg, char **arg) iarg += 4; } else if (strcmp(arg[iarg],"region") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix gcmc does not exist"); + region = domain->get_region_by_id(arg[iarg+1]); + if (!region) + error->all(FLERR,"Region {} for fix gcmc does not exist",arg[iarg+1]); idregion = utils::strdup(arg[iarg+1]); - regionflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"maxangle") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix gcmc command"); @@ -397,7 +396,7 @@ void FixGCMC::options(int narg, char **arg) FixGCMC::~FixGCMC() { - if (regionflag) delete [] idregion; + delete[] idregion; delete random_equal; delete random_unequal; @@ -406,12 +405,12 @@ FixGCMC::~FixGCMC() memory->destroy(molq); memory->destroy(molimage); - delete [] idrigid; - delete [] idshake; + delete[] idrigid; + delete[] idshake; if (ngroups > 0) { for (int igroup = 0; igroup < ngroups; igroup++) - delete [] groupstrings[igroup]; + delete[] groupstrings[igroup]; memory->sfree(groupstrings); } @@ -419,7 +418,7 @@ FixGCMC::~FixGCMC() memory->destroy(grouptypes); memory->destroy(grouptypebits); for (int igroup = 0; igroup < ngrouptypes; igroup++) - delete [] grouptypestrings[igroup]; + delete[] grouptypestrings[igroup]; memory->sfree(grouptypestrings); } if (full_flag && group) { @@ -443,6 +442,13 @@ int FixGCMC::setmask() void FixGCMC::init() { + // set index and check validity of region + + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix gcmc does not exist", idregion); + } + triclinic = domain->triclinic; // set probabilities for MC moves @@ -719,7 +725,7 @@ void FixGCMC::pre_exchange() subhi = domain->subhi; } - if (regionflag) volume = region_volume; + if (region) volume = region_volume; else volume = domain->xprd * domain->yprd * domain->zprd; if (triclinic) domain->x2lamda(atom->nlocal); @@ -801,8 +807,7 @@ void FixGCMC::attempt_atomic_translation() double **x = atom->x; double energy_before = energy(i,ngcmc_type,-1,x[i]); if (overlap_flag && energy_before > MAXENERGYTEST) - error->warning(FLERR,"Energy of old configuration in " - "fix gcmc is > MAXENERGYTEST."); + error->warning(FLERR,"Energy of old configuration in fix gcmc is > MAXENERGYTEST."); double rsq = 1.1; double rx,ry,rz; rx = ry = rz = 0.0; @@ -816,8 +821,8 @@ void FixGCMC::attempt_atomic_translation() coord[0] = x[i][0] + displace*rx; coord[1] = x[i][1] + displace*ry; coord[2] = x[i][2] + displace*rz; - if (regionflag) { - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + if (region) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { rsq = 1.1; while (rsq > 1.0) { rx = 2*random_unequal->uniform() - 1.0; @@ -913,12 +918,12 @@ void FixGCMC::attempt_atomic_insertion() // pick coordinates for insertion point double coord[3]; - if (regionflag) { + if (region) { int region_attempt = 0; coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); @@ -1043,7 +1048,7 @@ void FixGCMC::attempt_molecule_translation() com_displace[1] = displace*ry; com_displace[2] = displace*rz; - if (regionflag) { + if (region) { int *mask = atom->mask; for (int i = 0; i < atom->nlocal; i++) { if (atom->molecule[i] == translation_molecule) { @@ -1058,7 +1063,7 @@ void FixGCMC::attempt_molecule_translation() coord[0] = com[0] + displace*rx; coord[1] = com[1] + displace*ry; coord[2] = com[2] + displace*rz; - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { rsq = 1.1; while (rsq > 1.0) { rx = 2*random_equal->uniform() - 1.0; @@ -1266,7 +1271,7 @@ void FixGCMC::attempt_molecule_insertion() if (ngas >= max_ngas) return; double com_coord[3]; - if (regionflag) { + if (region) { int region_attempt = 0; com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -1274,7 +1279,7 @@ void FixGCMC::attempt_molecule_insertion() (region_yhi-region_ylo); com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(com_coord[0],com_coord[1], + while (region->match(com_coord[0],com_coord[1], com_coord[2]) == 0) { com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -1324,7 +1329,7 @@ void FixGCMC::attempt_molecule_insertion() MathExtra::quat_to_mat(quat,rotmat); double insertion_energy = 0.0; - bool *procflag = new bool[natoms_per_molecule]; + auto procflag = new bool[natoms_per_molecule]; for (int i = 0; i < natoms_per_molecule; i++) { MathExtra::matvec(rotmat,onemols[imol]->x[i],molcoords[i]); @@ -1485,8 +1490,8 @@ void FixGCMC::attempt_atomic_translation_full() coord[0] = x[i][0] + displace*rx; coord[1] = x[i][1] + displace*ry; coord[2] = x[i][2] + displace*rz; - if (regionflag) { - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + if (region) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { rsq = 1.1; while (rsq > 1.0) { rx = 2*random_unequal->uniform() - 1.0; @@ -1602,12 +1607,12 @@ void FixGCMC::attempt_atomic_insertion_full() double energy_before = energy_stored; double coord[3]; - if (regionflag) { + if (region) { int region_attempt = 0; coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); @@ -1726,7 +1731,7 @@ void FixGCMC::attempt_molecule_translation_full() com_displace[1] = displace*ry; com_displace[2] = displace*rz; - if (regionflag) { + if (region) { int *mask = atom->mask; for (int i = 0; i < atom->nlocal; i++) { if (atom->molecule[i] == translation_molecule) { @@ -1741,7 +1746,7 @@ void FixGCMC::attempt_molecule_translation_full() coord[0] = com[0] + displace*rx; coord[1] = com[1] + displace*ry; coord[2] = com[2] + displace*rz; - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { rsq = 1.1; while (rsq > 1.0) { rx = 2*random_equal->uniform() - 1.0; @@ -1998,7 +2003,7 @@ void FixGCMC::attempt_molecule_insertion_full() int nlocalprev = atom->nlocal; double com_coord[3]; - if (regionflag) { + if (region) { int region_attempt = 0; com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -2006,7 +2011,7 @@ void FixGCMC::attempt_molecule_insertion_full() (region_yhi-region_ylo); com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(com_coord[0],com_coord[1], + while (region->match(com_coord[0],com_coord[1], com_coord[2]) == 0) { com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -2316,7 +2321,7 @@ double FixGCMC::energy_full() // but Modify::pre_reverse() is needed for INTEL if (modify->n_pre_reverse) modify->pre_reverse(eflag,vflag); - if (modify->n_post_force) modify->post_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); // NOTE: all fixes with energy_global_flag set and which // operate at pre_force() or post_force() @@ -2408,7 +2413,7 @@ void FixGCMC::update_gas_atoms_list() ngas_local = 0; - if (regionflag) { + if (region) { if (exchmode == EXCHMOL || movemode == MOVEMOL) { @@ -2416,9 +2421,9 @@ void FixGCMC::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - double *comx = new double[maxmol_all]; - double *comy = new double[maxmol_all]; - double *comz = new double[maxmol_all]; + auto comx = new double[maxmol_all]; + auto comy = new double[maxmol_all]; + auto comz = new double[maxmol_all]; for (int imolecule = 0; imolecule < maxmol_all; imolecule++) { for (int i = 0; i < nlocal; i++) { if (molecule[i] == imolecule) { @@ -2441,7 +2446,7 @@ void FixGCMC::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (domain->regions[iregion]->match(comx[molecule[i]], + if (region->match(comx[molecule[i]], comy[molecule[i]],comz[molecule[i]]) == 1) { local_gas_list[ngas_local] = i; ngas_local++; @@ -2454,7 +2459,7 @@ void FixGCMC::update_gas_atoms_list() } else { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]) == 1) { + if (region->match(x[i][0],x[i][1],x[i][2]) == 1) { local_gas_list[ngas_local] = i; ngas_local++; } @@ -2538,7 +2543,7 @@ void FixGCMC::write_restart(FILE *fp) void FixGCMC::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MC/fix_gcmc.h b/src/MC/fix_gcmc.h index 79ce515b20..d945b82346 100644 --- a/src/MC/fix_gcmc.h +++ b/src/MC/fix_gcmc.h @@ -65,17 +65,16 @@ class FixGCMC : public Fix { int ngcmc_type, nevery, seed; int ncycles, nexchanges, nmcmoves; double patomtrans, pmoltrans, pmolrotate, pmctot; - int ngas; // # of gas atoms on all procs - int ngas_local; // # of gas atoms on this proc - int ngas_before; // # of gas atoms on procs < this proc - int exchmode; // exchange ATOM or MOLECULE - int movemode; // move ATOM or MOLECULE - int regionflag; // 0 = anywhere in box, 1 = specific region - int iregion; // gcmc region - char *idregion; // gcmc region id - bool pressure_flag; // true if user specified reservoir pressure - bool charge_flag; // true if user specified atomic charge - bool full_flag; // true if doing full system energy calculations + int ngas; // # of gas atoms on all procs + int ngas_local; // # of gas atoms on this proc + int ngas_before; // # of gas atoms on procs < this proc + int exchmode; // exchange ATOM or MOLECULE + int movemode; // move ATOM or MOLECULE + class Region *region; // gcmc region + char *idregion; // gcmc region id + bool pressure_flag; // true if user specified reservoir pressure + bool charge_flag; // true if user specified atomic charge + bool full_flag; // true if doing full system energy calculations int natoms_per_molecule; // number of atoms in each inserted molecule int nmaxmolatoms; // number of atoms allocated for molecule arrays @@ -147,198 +146,3 @@ class FixGCMC : public Fix { #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: Fix gcmc does not (yet) work with atom_style template - -Self-explanatory. - -E: Fix gcmc region does not support a bounding box - -Not all regions represent bounded volumes. You cannot use -such a region with the fix gcmc command. - -E: Fix gcmc region cannot be dynamic - -Only static regions can be used with fix gcmc. - -E: Fix gcmc region extends outside simulation box - -Self-explanatory. - -E: Fix gcmc molecule must have coordinates - -The defined molecule does not specify coordinates. - -E: Fix gcmc molecule must have atom types - -The defined molecule does not specify atom types. - -E: Atom type must be zero in fix gcmc mol command - -Self-explanatory. - -E: Fix gcmc molecule has charges, but atom style does not - -Self-explanatory. - -E: Fix gcmc molecule template ID must be same as atom_style template ID - -When using atom_style template, you cannot insert molecules that are -not in that template. - -E: Fix gcmc atom has charge, but atom style does not - -Self-explanatory. - -E: Cannot use fix gcmc rigid and not molecule - -UNDOCUMENTED - -E: Cannot use fix gcmc shake and not molecule - -Self-explanatory. - -E: Cannot use fix gcmc rigid and shake - -UNDOCUMENTED - -E: Cannot use fix gcmc rigid with MC moves - -UNDOCUMENTED - -E: Cannot use fix gcmc shake with MC moves - -UNDOCUMENTED - -E: Molecule template ID for fix gcmc does not exist - -Self-explanatory. - -W: Molecule template for fix gcmc has multiple molecules - -The fix gcmc command will only create molecules of a single type, -i.e. the first molecule in the template. - -E: Region ID for fix gcmc does not exist - -Self-explanatory. - -W: Fix gcmc using full_energy option - -Fix gcmc has automatically turned on the full_energy option since it -is required for systems like the one specified by the user. User input -included one or more of the following: kspace, a hybrid -pair style, an eam pair style, tail correction, -or no "single" function for the pair style. - -E: Invalid atom type in fix gcmc command - -The atom type specified in the gcmc command does not exist. - -E: Fix gcmc cannot exchange individual atoms belonging to a molecule - -This is an error since you should not delete only one atom of a -molecule. The user has specified atomic (non-molecular) gas -exchanges, but an atom belonging to a molecule could be deleted. - -E: All mol IDs should be set for fix gcmc group atoms - -The molecule flag is on, yet not all molecule ids in the fix group -have been set to non-zero positive values by the user. This is an -error since all atoms in the fix gcmc group are eligible for deletion, -rotation, and translation and therefore must have valid molecule ids. - -E: Fix gcmc molecule command requires that atoms have molecule attributes - -Should not choose the gcmc molecule feature if no molecules are being -simulated. The general molecule flag is off, but gcmc's molecule flag -is on. - -E: Fix gcmc rigid fix does not exist - -UNDOCUMENTED - -E: Fix gcmc and fix rigid/small not using same molecule template ID - -UNDOCUMENTED - -E: Fix gcmc shake fix does not exist - -Self-explanatory. - -E: Fix gcmc and fix shake not using same molecule template ID - -Self-explanatory. - -E: Cannot use fix gcmc in a 2d simulation - -Fix gcmc is set up to run in 3d only. No 2d simulations with fix gcmc -are allowed. - -E: Could not find fix gcmc exclusion group ID - -Self-explanatory. - -E: Could not find fix gcmc rotation group ID - -Self-explanatory. - -E: Illegal fix gcmc gas mass <= 0 - -The computed mass of the designated gas molecule or atom type was less -than or equal to zero. - -E: Cannot do GCMC on atoms in atom_modify first group - -This is a restriction due to the way atoms are organized in a list to -enable the atom_modify first command. - -W: Fix gcmc is being applied to the default group all - -This is allowed, but it will result in Monte Carlo moves -being performed on all the atoms in the system, which is -often not what is intended. - -E: Could not find specified fix gcmc group ID - -Self-explanatory. - -E: fix gcmc does currently not support full_energy option with molecule MC moves on more than 1 MPI process. - -It is still possible to do parallel molecule exchange without translation and rotation moves -by setting MC moves to zero and/or by using mcmoves keyword with Pmoltrans=Pmolrotate=0 - -W: Energy of old configuration in fix gcmc is > MAXENERGYTEST. - -This probably means that a pair of atoms are closer than the -overlap cutoff distance for keyword overlap_cutoff. - -E: Fix gcmc put atom outside box - -This should not normally happen. Contact the developers. - -E: Fix gcmc ran out of available molecule IDs - -See the setting for tagint in the src/lmptype.h file. - -E: Fix gcmc ran out of available atom IDs - -See the setting for tagint in the src/lmptype.h file. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -U: Fix gcmc can not currently be used with fix rigid or fix rigid/small - -Self-explanatory. - -*/ diff --git a/src/MC/fix_mol_swap.cpp b/src/MC/fix_mol_swap.cpp index a8c7b4ddb2..c23ceb7d36 100644 --- a/src/MC/fix_mol_swap.cpp +++ b/src/MC/fix_mol_swap.cpp @@ -138,7 +138,7 @@ void FixMolSwap::init() { // c_pe = compute used to calculate before/after potential energy - char *id_pe = (char *) "thermo_pe"; + auto id_pe = (char *) "thermo_pe"; int ipe = modify->find_compute(id_pe); c_pe = modify->compute[ipe]; @@ -390,7 +390,7 @@ double FixMolSwap::energy_full() if (force->kspace) force->kspace->compute(eflag,vflag); - if (modify->n_post_force) modify->post_force(vflag); + if (modify->n_post_force_any) modify->post_force(vflag); update->eflag_global = update->ntimestep; double total_energy = c_pe->compute_scalar(); @@ -487,7 +487,7 @@ void FixMolSwap::write_restart(FILE *fp) void FixMolSwap::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random->reset(seed); diff --git a/src/MC/fix_mol_swap.h b/src/MC/fix_mol_swap.h index 8962ea69a2..cf9f34c112 100644 --- a/src/MC/fix_mol_swap.h +++ b/src/MC/fix_mol_swap.h @@ -42,21 +42,21 @@ class FixMolSwap : public Fix { int itype, jtype; double temperature; - int ke_flag; // 1 if kinetic energy is also swapped - double i2j_vscale; // scale factors for velocity to keep KE constant + int ke_flag; // 1 if kinetic energy is also swapped + double i2j_vscale; // scale factors for velocity to keep KE constant double j2i_vscale; - int qflag; // 1 if charge is also swapped - double iq,jq; // charge values for all itype,jtype atoms + int qflag; // 1 if charge is also swapped + double iq, jq; // charge values for all itype,jtype atoms - bool unequal_cutoffs; // 1 if itype and jtype have any different cutoffs - tagint minmol,maxmol; // range of mol IDs selected for swaps + bool unequal_cutoffs; // 1 if itype and jtype have any different cutoffs + tagint minmol, maxmol; // range of mol IDs selected for swaps - double nswap_attempt; // cummulative stats on MC attempts and accepts + double nswap_attempt; // cummulative stats on MC attempts and accepts double nswap_accept; - double beta; // 1/kT - double energy_stored; // energy of current state as swaps are accepted + double beta; // 1/kT + double energy_stored; // energy of current state as swaps are accepted class RanPark *random; class Compute *c_pe; @@ -69,54 +69,3 @@ class FixMolSwap : public Fix { #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: Region ID for fix atom/swap does not exist - -Self-explanatory. - -E: Must specify at least 2 types in fix atom/swap command - -Self-explanatory. - -E: Need nswaptypes mu values in fix atom/swap command - -Self-explanatory. - -E: Only 2 types allowed when not using semi-grand in fix atom/swap command - -Self-explanatory. - -E: Mu not allowed when not using semi-grand in fix atom/swap command - -Self-explanatory. - -E: Invalid atom type in fix atom/swap command - -The atom type specified in the atom/swap command does not exist. - -E: All atoms of a swapped type must have the same charge. - -Self-explanatory. - -E: At least one atom of each swapped type must be present to define charges. - -Self-explanatory. - -E: All atoms of a swapped type must have same charge. - -Self-explanatory. - -E: Cannot do atom/swap on atoms in atom_modify first group - -This is a restriction due to the way atoms are organized in a list to -enable the atom_modify first command. - -*/ diff --git a/src/MC/fix_tfmc.h b/src/MC/fix_tfmc.h index 974cf2b4bf..3fb4177e9e 100644 --- a/src/MC/fix_tfmc.h +++ b/src/MC/fix_tfmc.h @@ -48,29 +48,3 @@ class FixTFMC : public Fix { #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: Fix tfmc displacement length must be > 0 - -Self-explanatory. - -E: Fix tfmc temperature must be > 0 - -Self-explanatory. - -E: Illegal fix tfmc random seed - -Seeds can only be nonzero positive integers. - -E: Fix tfmc is not compatible with fix shake - -These two commands cannot currently be used together. - -*/ diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index e2989f8981..0adabe5eae 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -46,7 +46,6 @@ #include #include -using namespace std; using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; @@ -59,8 +58,8 @@ enum{EXCHATOM,EXCHMOL}; // exchmode FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(nullptr), full_flag(false), local_gas_list(nullptr), molcoords(nullptr), - molq(nullptr), molimage(nullptr), random_equal(nullptr) + region(nullptr), idregion(nullptr), full_flag(false), local_gas_list(nullptr), + molcoords(nullptr),molq(nullptr), molimage(nullptr), random_equal(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix widom command"); @@ -76,8 +75,6 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : restart_global = 1; time_depend = 1; - //ave_widom_chemical_potential = 0; - // required args nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -104,18 +101,18 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : region_xlo = region_xhi = region_ylo = region_yhi = region_zlo = region_zhi = 0.0; - if (regionflag) { - if (domain->regions[iregion]->bboxflag == 0) + if (region) { + if (region->bboxflag == 0) error->all(FLERR,"Fix widom region does not support a bounding box"); - if (domain->regions[iregion]->dynamic_check()) + if (region->dynamic_check()) error->all(FLERR,"Fix widom region cannot be dynamic"); - region_xlo = domain->regions[iregion]->extent_xlo; - region_xhi = domain->regions[iregion]->extent_xhi; - region_ylo = domain->regions[iregion]->extent_ylo; - region_yhi = domain->regions[iregion]->extent_yhi; - region_zlo = domain->regions[iregion]->extent_zlo; - region_zhi = domain->regions[iregion]->extent_zhi; + region_xlo = region->extent_xlo; + region_xhi = region->extent_xhi; + region_ylo = region->extent_ylo; + region_yhi = region->extent_yhi; + region_zlo = region->extent_zlo; + region_zhi = region->extent_zhi; if (region_xlo < domain->boxlo[0] || region_xhi > domain->boxhi[0] || region_ylo < domain->boxlo[1] || region_yhi > domain->boxhi[1] || @@ -131,15 +128,14 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - if (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) != 0) + if (region->match(coord[0],coord[1],coord[2]) != 0) inside++; } - double max_region_volume = (region_xhi - region_xlo)* - (region_yhi - region_ylo)*(region_zhi - region_zlo); + double max_region_volume = (region_xhi - region_xlo) * + (region_yhi - region_ylo) * (region_zhi - region_zlo); - region_volume = max_region_volume*static_cast (inside)/ - static_cast (attempts); + region_volume = max_region_volume * static_cast(inside) / static_cast(attempts); } // error check and further setup for exchmode = EXCHMOL @@ -191,8 +187,6 @@ void FixWidom::options(int narg, char **arg) // defaults exchmode = EXCHATOM; - regionflag = 0; - iregion = -1; region_volume = 0; max_region_attempts = 1000; molecule_group = 0; @@ -221,11 +215,10 @@ void FixWidom::options(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg],"region") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix widom does not exist"); + region = domain->get_region_by_id(arg[iarg+1]); + if (!region) + error->all(FLERR,"Region {} for fix widom does not exist",arg[iarg+1]); idregion = utils::strdup(arg[iarg+1]); - regionflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command"); @@ -247,7 +240,7 @@ void FixWidom::options(int narg, char **arg) FixWidom::~FixWidom() { - if (regionflag) delete [] idregion; + delete[] idregion; delete random_equal; memory->destroy(local_gas_list); @@ -271,11 +264,18 @@ int FixWidom::setmask() void FixWidom::init() { + // set index and check validity of region + + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix widom does not exist", idregion); + } + triclinic = domain->triclinic; ave_widom_chemical_potential = 0; - if (regionflag) volume = region_volume; + if (region) volume = region_volume; else volume = domain->xprd * domain->yprd * domain->zprd; // decide whether to switch to the full_energy option @@ -283,8 +283,8 @@ void FixWidom::init() if ((force->kspace) || (force->pair == nullptr) || (force->pair->single_enable == 0) || - (force->pair_match("hybrid",0)) || - (force->pair_match("eam",0)) || + (force->pair_match("^hybrid",0)) || + (force->pair_match("^eam",0)) || (force->pair->tail_flag)) { full_flag = true; if (comm->me == 0) @@ -434,7 +434,7 @@ void FixWidom::pre_exchange() subhi = domain->subhi; } - if (regionflag) volume = region_volume; + if (region) volume = region_volume; else volume = domain->xprd * domain->yprd * domain->zprd; if (triclinic) domain->x2lamda(atom->nlocal); @@ -486,12 +486,12 @@ void FixWidom::attempt_atomic_insertion() // pick coordinates for insertion point - if (regionflag) { + if (region) { int region_attempt = 0; coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); @@ -562,7 +562,7 @@ void FixWidom::attempt_molecule_insertion() for (int imove = 0; imove < ninsertions; imove++) { - if (regionflag) { + if (region) { int region_attempt = 0; com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -570,7 +570,7 @@ void FixWidom::attempt_molecule_insertion() (region_yhi-region_ylo); com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(com_coord[0],com_coord[1], + while (region->match(com_coord[0],com_coord[1], com_coord[2]) == 0) { com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -619,7 +619,7 @@ void FixWidom::attempt_molecule_insertion() MathExtra::quat_to_mat(quat,rotmat); double insertion_energy = 0.0; - bool *procflag = new bool[natoms_per_molecule]; + auto procflag = new bool[natoms_per_molecule]; for (int i = 0; i < natoms_per_molecule; i++) { MathExtra::matvec(rotmat,onemols[imol]->x[i],molcoords[i]); @@ -688,12 +688,12 @@ void FixWidom::attempt_atomic_insertion_full() for (int imove = 0; imove < ninsertions; imove++) { - if (regionflag) { + if (region) { int region_attempt = 0; coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(coord[0],coord[1],coord[2]) == 0) { + while (region->match(coord[0],coord[1],coord[2]) == 0) { coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); coord[1] = region_ylo + random_equal->uniform() * (region_yhi-region_ylo); coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); @@ -801,7 +801,7 @@ void FixWidom::attempt_molecule_insertion_full() for (int imove = 0; imove < ninsertions; imove++) { double com_coord[3]; - if (regionflag) { + if (region) { int region_attempt = 0; com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -809,7 +809,7 @@ void FixWidom::attempt_molecule_insertion_full() (region_yhi-region_ylo); com_coord[2] = region_zlo + random_equal->uniform() * (region_zhi-region_zlo); - while (domain->regions[iregion]->match(com_coord[0],com_coord[1], + while (region->match(com_coord[0],com_coord[1], com_coord[2]) == 0) { com_coord[0] = region_xlo + random_equal->uniform() * (region_xhi-region_xlo); @@ -1081,7 +1081,7 @@ void FixWidom::update_gas_atoms_list() ngas_local = 0; - if (regionflag) { + if (region) { if (exchmode == EXCHMOL) { @@ -1089,9 +1089,9 @@ void FixWidom::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - double *comx = new double[maxmol_all]; - double *comy = new double[maxmol_all]; - double *comz = new double[maxmol_all]; + auto comx = new double[maxmol_all]; + auto comy = new double[maxmol_all]; + auto comz = new double[maxmol_all]; for (int imolecule = 0; imolecule < maxmol_all; imolecule++) { for (int i = 0; i < nlocal; i++) { if (molecule[i] == imolecule) { @@ -1114,7 +1114,7 @@ void FixWidom::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (domain->regions[iregion]->match(comx[molecule[i]], + if (region->match(comx[molecule[i]], comy[molecule[i]],comz[molecule[i]]) == 1) { local_gas_list[ngas_local] = i; ngas_local++; @@ -1127,7 +1127,7 @@ void FixWidom::update_gas_atoms_list() } else { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]) == 1) { + if (region->match(x[i][0],x[i][1],x[i][2]) == 1) { local_gas_list[ngas_local] = i; ngas_local++; } @@ -1195,7 +1195,7 @@ void FixWidom::write_restart(FILE *fp) void FixWidom::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast (list[n++]); random_equal->reset(seed); diff --git a/src/MC/fix_widom.h b/src/MC/fix_widom.h index d2240fd6c8..dd388ec8e5 100644 --- a/src/MC/fix_widom.h +++ b/src/MC/fix_widom.h @@ -53,15 +53,14 @@ class FixWidom : public Fix { int exclusion_group, exclusion_group_bit; int nwidom_type, nevery, seed; int ninsertions; - int ngas; // # of gas atoms on all procs - int ngas_local; // # of gas atoms on this proc - int exchmode; // exchange ATOM or MOLECULE - int movemode; // move ATOM or MOLECULE - int regionflag; // 0 = anywhere in box, 1 = specific region - int iregion; // widom region - char *idregion; // widom region id - bool charge_flag; // true if user specified atomic charge - bool full_flag; // true if doing full system energy calculations + int ngas; // # of gas atoms on all procs + int ngas_local; // # of gas atoms on this proc + int exchmode; // exchange ATOM or MOLECULE + int movemode; // move ATOM or MOLECULE + class Region *region; // widom region + char *idregion; // widom region id + bool charge_flag; // true if user specified atomic charge + bool full_flag; // true if doing full system energy calculations int natoms_per_molecule; // number of atoms in each inserted molecule int nmaxmolatoms; // number of atoms allocated for molecule arrays @@ -107,150 +106,3 @@ class FixWidom : public Fix { #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: Fix Widom does not (yet) work with atom_style template - -Self-explanatory. - -E: Fix Widom region does not support a bounding box - -Not all regions represent bounded volumes. You cannot use -such a region with the fix Widom command. - -E: Fix Widom region cannot be dynamic - -Only static regions can be used with fix Widom. - -E: Fix Widom region extends outside simulation box - -Self-explanatory. - -E: Fix Widom molecule must have coordinates - -The defined molecule does not specify coordinates. - -E: Fix Widom molecule must have atom types - -The defined molecule does not specify atom types. - -E: Atom type must be zero in fix Widom mol command - -Self-explanatory. - -E: Fix Widom molecule has charges, but atom style does not - -Self-explanatory. - -E: Fix Widom molecule template ID must be same as atom_style template ID - -When using atom_style template, you cannot insert molecules that are -not in that template. - -E: Fix Widom atom has charge, but atom style does not - -Self-explanatory. - -UNDOCUMENTED - -E: Molecule template ID for fix Widom does not exist - -Self-explanatory. - -W: Molecule template for fix Widom has multiple molecules - -The fix Widom command will only create molecules of a single type, -i.e. the first molecule in the template. - -E: Region ID for fix Widom does not exist - -Self-explanatory. - -W: Fix Widom using full_energy option - -Fix Widom has automatically turned on the full_energy option since it -is required for systems like the one specified by the user. User input -included one or more of the following: kspace, a hybrid -pair style, an eam pair style, tail correction, -or no "single" function for the pair style. - -E: Invalid atom type in fix Widom command - -The atom type specified in the Widom command does not exist. - -E: Fix Widom cannot exchange individual atoms belonging to a molecule - -This is an error since you should not delete only one atom of a -molecule. The user has specified atomic (non-molecular) gas -exchanges, but an atom belonging to a molecule could be deleted. - -E: All mol IDs should be set for fix Widom group atoms - -The molecule flag is on, yet not all molecule ids in the fix group -have been set to non-zero positive values by the user. This is an -error since all atoms in the fix Widom group are eligible for deletion, -rotation, and translation and therefore must have valid molecule ids. - -E: Fix Widom molecule command requires that atoms have molecule attributes - -Should not choose the Widom molecule feature if no molecules are being -simulated. The general molecule flag is off, but Widom's molecule flag -is on. - -E: Cannot use fix Widom in a 2d simulation - -Fix Widom is set up to run in 3d only. No 2d simulations with fix Widom -are allowed. - -E: Could not find fix Widom exclusion group ID - -Self-explanatory. - -E: Illegal fix Widom gas mass <= 0 - -The computed mass of the designated gas molecule or atom type was less -than or equal to zero. - -E: Cannot do Widom on atoms in atom_modify first group - -This is a restriction due to the way atoms are organized in a list to -enable the atom_modify first command. - -W: Fix Widom is being applied to the default group all - -This is allowed, but it will result in Monte Carlo moves -being performed on all the atoms in the system, which is -often not what is intended. - -E: Could not find specified fix Widom group ID - -Self-explanatory. - -E: fix Widom does currently not support full_energy option with molecules on more than 1 MPI process. - -UNDOCUMENTED - -E: Fix Widom put atom outside box - -This should not normally happen. Contact the developers. - -E: Fix Widom ran out of available molecule IDs - -See the setting for tagint in the src/lmptype.h file. - -E: Fix Widom ran out of available atom IDs - -See the setting for tagint in the src/lmptype.h file. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -*/ diff --git a/src/MC/pair_dsmc.h b/src/MC/pair_dsmc.h index 36ae8ea21b..71dd93e0f5 100644 --- a/src/MC/pair_dsmc.h +++ b/src/MC/pair_dsmc.h @@ -109,29 +109,3 @@ class PairDSMC : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -W: Pair dsmc: num_of_collisions > number_of_A - -Collision model in DSMC is breaking down. - -W: Pair dsmc: num_of_collisions > number_of_B - -Collision model in DSMC is breaking down. - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Tried to convert a double to int, but input_double > INT_MAX - -Self-explanatory. - -*/ diff --git a/src/MDI/fix_mdi_aimd.cpp b/src/MDI/fix_mdi_aimd.cpp index 52df86e3e0..c878d183d3 100644 --- a/src/MDI/fix_mdi_aimd.cpp +++ b/src/MDI/fix_mdi_aimd.cpp @@ -29,7 +29,7 @@ enum { NATIVE, REAL, METAL }; // LAMMPS units which MDI supports FixMDIAimd::FixMDIAimd(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg > 4) error->all(FLERR, "Illegal fix mdi/aimd command"); + if (narg != 3) error->all(FLERR, "Illegal fix mdi/aimd command"); scalar_flag = 1; global_freq = 1; @@ -38,16 +38,6 @@ FixMDIAimd::FixMDIAimd(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) virial_global_flag = 1; thermo_energy = thermo_virial = 1; - // check for plugin arg - - plugin = 0; - if (narg == 4) { - if (strcmp(arg[3], "plugin") == 0) - plugin = 1; - else - error->all(FLERR, "Illegal fix mdi/aimd command"); - } - // check requirements for LAMMPS to work with MDI as an engine if (atom->tag_enable == 0) error->all(FLERR, "Cannot use MDI engine without atom IDs"); @@ -62,6 +52,11 @@ FixMDIAimd::FixMDIAimd(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (role != MDI_DRIVER) error->all(FLERR, "Must invoke LAMMPS as an MDI driver to use fix mdi/aimd"); + // mdicomm will be one-time initialized in init() + // cannot be done here for a plugin library, b/c mdi plugin command is later + + mdicomm = MDI_COMM_NULL; + // storage for all atoms buf3 = buf3all = nullptr; @@ -78,13 +73,6 @@ FixMDIAimd::FixMDIAimd(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) unit_conversions(); - // connect to MDI engine, only if engine is stand-alone code - - if (!plugin) { - MDI_Accept_communicator(&mdicomm); - if (mdicomm <= 0) error->all(FLERR, "Unable to connect to MDI engine"); - } - nprocs = comm->nprocs; } @@ -92,7 +80,8 @@ FixMDIAimd::FixMDIAimd(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) FixMDIAimd::~FixMDIAimd() { - // send exit command to engine, only if engine is stand-alone code + // send exit command to engine if it is a stand-alone code + // for plugin, this happens in MDIPlugin::plugin_wrapper() if (!plugin) { int ierr = MDI_Send_command("EXIT", mdicomm); @@ -118,6 +107,30 @@ int FixMDIAimd::setmask() /* ---------------------------------------------------------------------- */ +void FixMDIAimd::init() +{ + if (mdicomm != MDI_COMM_NULL) return; + + // one-time auto-detect whether engine is stand-alone code or plugin library + // also initializes mdicomm + // plugin = 0/1 for engine = stand-alone code vs plugin library + + MDI_Get_communicator(&mdicomm, 0); + + if (mdicomm == MDI_COMM_NULL) { + plugin = 0; + MDI_Accept_communicator(&mdicomm); + if (mdicomm == MDI_COMM_NULL) error->all(FLERR, "MDI unable to connect to stand-alone engine"); + } else { + plugin = 1; + int method; + MDI_Get_method(&method, mdicomm); + if (method != MDI_PLUGIN) error->all(FLERR, "MDI internal error for plugin engine"); + } +} + +/* ---------------------------------------------------------------------- */ + void FixMDIAimd::setup(int vflag) { post_force(vflag); diff --git a/src/MDI/fix_mdi_aimd.h b/src/MDI/fix_mdi_aimd.h index 6ca886794f..cdb7977c37 100644 --- a/src/MDI/fix_mdi_aimd.h +++ b/src/MDI/fix_mdi_aimd.h @@ -27,14 +27,11 @@ namespace LAMMPS_NS { class FixMDIAimd : public Fix { public: - // MDI communicator, public so that LAMMPS can work with a plugin - - MDI_Comm mdicomm; - FixMDIAimd(class LAMMPS *, int, char **); ~FixMDIAimd(); int setmask(); + void init(); void setup(int); void setup_pre_reverse(int, int); void pre_reverse(int, int); @@ -46,6 +43,8 @@ class FixMDIAimd : public Fix { int nprocs; int plugin; + MDI_Comm mdicomm; + int eflag_caller; double engine_energy; int lmpunits; @@ -73,7 +72,3 @@ class FixMDIAimd : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MDI/fix_mdi_engine.h b/src/MDI/fix_mdi_engine.h index f594341c24..7dd8a724f2 100644 --- a/src/MDI/fix_mdi_engine.h +++ b/src/MDI/fix_mdi_engine.h @@ -44,38 +44,3 @@ class FixMDIEngine : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -Self-explanatory. - -E: Potential energy ID for fix mdi does not exist - -Self-explanatory. - -E: Cannot use MDI command without atom IDs - -Self-explanatory. - -E: MDI command requires consecutive atom IDs - -Self-explanatory. - -E: Unable to connect to driver - -Self-explanatory. - -E: Unable to ... driver - -Self-explanatory. - -E: Unknown command from driver - -The driver sent a command that is not supported by the LAMMPS -interface. In some cases this might be because a nonsensical -command was sent (i.e. "SCF"). In other cases, the LAMMPS -interface might benefit from being expanded. - -*/ diff --git a/src/MDI/library_mdi.cpp b/src/MDI/library_mdi.cpp index 445e42b7e4..ad2e995b4c 100644 --- a/src/MDI/library_mdi.cpp +++ b/src/MDI/library_mdi.cpp @@ -129,6 +129,6 @@ The function executes a single command from an external MDI driver. int lammps_execute_mdi_command(const char *command, MDI_Comm comm, void *class_obj) { - MDIEngine *mdi_engine = (MDIEngine *) class_obj; + auto mdi_engine = (MDIEngine *) class_obj; return mdi_engine->execute_command(command, comm); } diff --git a/src/MDI/mdi_command.h b/src/MDI/mdi_command.h index d944c66004..1bd2c7df6c 100644 --- a/src/MDI/mdi_command.h +++ b/src/MDI/mdi_command.h @@ -36,13 +36,3 @@ class MDICommand : public Command { #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. - -*/ diff --git a/src/MDI/mdi_engine.cpp b/src/MDI/mdi_engine.cpp index 9d13e1f1c6..f2b96cb69a 100644 --- a/src/MDI/mdi_engine.cpp +++ b/src/MDI/mdi_engine.cpp @@ -168,7 +168,7 @@ MDIEngine::MDIEngine(LAMMPS *_lmp, int narg, char ** /*arg*/) : Pointers(_lmp) node_match = true; exit_command = false; - while (1) { + while (true) { // top-level mdi engine only recognizes three nodes // DEFAULT, INIT_MD, INIT_OPTG @@ -601,7 +601,8 @@ void MDIEngine::mdi_md() // delete the instance before this method returns modify->add_fix("MDI_ENGINE_INTERNAL all MDI/ENGINE"); - FixMDIEngine *mdi_fix = (FixMDIEngine *) modify->get_fix_by_id("MDI_ENGINE_INTERNAL"); + FixMDIEngine *mdi_fix = + dynamic_cast(modify->get_fix_by_id("MDI_ENGINE_INTERNAL")); mdi_fix->mdi_engine = this; // initialize LAMMPS and setup() the simulation @@ -723,7 +724,8 @@ void MDIEngine::mdi_optg() // delete the instance before this method returns modify->add_fix("MDI_ENGINE_INTERNAL all MDI/ENGINE"); - FixMDIEngine *mdi_fix = (FixMDIEngine *) modify->get_fix_by_id("MDI_ENGINE_INTERNAL"); + FixMDIEngine *mdi_fix = + dynamic_cast(modify->get_fix_by_id("MDI_ENGINE_INTERNAL")); mdi_fix->mdi_engine = this; // initialize LAMMPS and setup() the simulation @@ -760,7 +762,7 @@ void MDIEngine::mdi_optg() timer->init(); timer->barrier_start(); - while (1) { + while (true) { update->minimize->run(1); if (strcmp(mdicmd, "@COORDS") != 0 && strcmp(mdicmd, "@FORCES") != 0) break; @@ -956,9 +958,10 @@ void MDIEngine::create_system() // optionally set charges if specified by ">CHARGES" if (flag_velocities) - lammps_create_atoms(lmp, sys_natoms, NULL, sys_types, sys_coords, sys_velocities, NULL, 1); + lammps_create_atoms(lmp, sys_natoms, nullptr, sys_types, sys_coords, sys_velocities, nullptr, + 1); else - lammps_create_atoms(lmp, sys_natoms, NULL, sys_types, sys_coords, NULL, NULL, 1); + lammps_create_atoms(lmp, sys_natoms, nullptr, sys_types, sys_coords, nullptr, nullptr, 1); if (flag_charges) lammps_scatter_atoms(lmp, (char *) "q", 1, 1, sys_charges); @@ -1349,7 +1352,7 @@ void MDIEngine::send_total_energy() void MDIEngine::send_labels() { - char *labels = new char[atom->natoms * MDI_LABEL_LENGTH]; + auto labels = new char[atom->natoms * MDI_LABEL_LENGTH]; memset(labels, ' ', atom->natoms * MDI_LABEL_LENGTH); memset(ibuf1, 0, atom->natoms * sizeof(int)); @@ -1579,7 +1582,7 @@ void MDIEngine::single_command() { if (nbytes < 0) error->all(FLERR, "MDI: COMMAND nbytes has not been set"); - char *cmd = new char[nbytes + 1]; + auto cmd = new char[nbytes + 1]; int ierr = MDI_Recv(cmd, nbytes + 1, MDI_CHAR, mdicomm); if (ierr) error->all(FLERR, "MDI: COMMAND data"); MPI_Bcast(cmd, nbytes + 1, MPI_CHAR, 0, world); @@ -1600,7 +1603,7 @@ void MDIEngine::many_commands() { if (nbytes < 0) error->all(FLERR, "MDI: COMMANDS nbytes has not been set"); - char *cmds = new char[nbytes + 1]; + auto cmds = new char[nbytes + 1]; int ierr = MDI_Recv(cmds, nbytes + 1, MDI_CHAR, mdicomm); if (ierr) error->all(FLERR, "MDI: COMMANDS data"); MPI_Bcast(cmds, nbytes + 1, MPI_CHAR, 0, world); @@ -1621,7 +1624,7 @@ void MDIEngine::infile() { if (nbytes < 0) error->all(FLERR, "MDI: INFILE nbytes has not been set"); - char *infile = new char[nbytes + 1]; + auto infile = new char[nbytes + 1]; int ierr = MDI_Recv(infile, nbytes + 1, MDI_CHAR, mdicomm); if (ierr) error->all(FLERR, "MDI: INFILE data for {}", infile); MPI_Bcast(infile, nbytes + 1, MPI_CHAR, 0, world); diff --git a/src/MDI/mdi_engine.h b/src/MDI/mdi_engine.h index 65207e50eb..ea840fba02 100644 --- a/src/MDI/mdi_engine.h +++ b/src/MDI/mdi_engine.h @@ -141,13 +141,3 @@ class MDIEngine : protected Pointers { } // namespace LAMMPS_NS #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. - -*/ diff --git a/src/MDI/mdi_plugin.cpp b/src/MDI/mdi_plugin.cpp index d1fcd2d941..3c8e38481d 100644 --- a/src/MDI/mdi_plugin.cpp +++ b/src/MDI/mdi_plugin.cpp @@ -81,7 +81,7 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp) // build full plugin_args string for args to plugin library int n = strlen(mdi_arg) + strlen(infile_arg) + strlen(extra_arg) + 16; - char *plugin_args = new char[n]; + auto plugin_args = new char[n]; plugin_args[0] = 0; strcat(plugin_args, "-mdi \""); strcat(plugin_args, mdi_arg); @@ -92,11 +92,6 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp) strcat(plugin_args, extra_arg); } - // find FixMDIAimd instance so can reset its mdicomm - // NOTE: this is a kludge - need better way to handle this - - fixptr = modify->get_fix_by_style("mdi/aimd")[0]; - // launch the MDI plugin library // path for lib was specified in -mdi command-line arg when LAMMPS started // this calls back to plugin_wrapper, which must issue MDI EXIT at end @@ -108,21 +103,15 @@ MDIPlugin::MDIPlugin(LAMMPS *_lmp, int narg, char **arg) : Pointers(_lmp) /* ---------------------------------------------------------------------- callback function from MDI_Launch_plugin() - this function must wrap entire interaction of LAMMPS as a driver - with the plugin + this function wraps entire interaction of LAMMPS driver with the plugin ---------------------------------------------------------------------- */ int MDIPlugin::plugin_wrapper(void * /*pmpicomm*/, MDI_Comm mdicomm, void *vptr) { - MDIPlugin *ptr = (MDIPlugin *) vptr; + auto ptr = (MDIPlugin *) vptr; LAMMPS *lammps = ptr->lmp; char *lammps_command = ptr->lammps_command; - // set FixMDIAimd mdicomm to driver's mdicomm passed to this callback - - FixMDIAimd *aimdptr = (FixMDIAimd *) (ptr->fixptr); - aimdptr->mdicomm = mdicomm; - // invoke the specified LAMMPS command // that operation will issue MDI commands to the plugin engine diff --git a/src/MDI/mdi_plugin.h b/src/MDI/mdi_plugin.h index c70a09975e..d5fc81f050 100644 --- a/src/MDI/mdi_plugin.h +++ b/src/MDI/mdi_plugin.h @@ -25,7 +25,6 @@ class MDIPlugin : protected Pointers { private: char *lammps_command; - class Fix *fixptr; static int plugin_wrapper(void *, MDI_Comm, void *); }; @@ -33,13 +32,3 @@ class MDIPlugin : protected Pointers { } // namespace LAMMPS_NS #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. - -*/ diff --git a/src/MEAM/pair_meam.h b/src/MEAM/pair_meam.h index e3e3767ba3..eea3893309 100644 --- a/src/MEAM/pair_meam.h +++ b/src/MEAM/pair_meam.h @@ -63,64 +63,3 @@ class PairMEAM : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: MEAM library error %d - -A call to the MEAM Fortran library returned an error. - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style MEAM requires newton pair on - -See the newton command. This is a restriction to use the MEAM -potential. - -E: Cannot open MEAM potential file %s - -The specified MEAM potential file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in MEAM library file - -Incorrect number of words per line in the potential file. - -E: Too many elements extracted from MEAM library. - -Increase 'maxelt' in meam.h and recompile. - -E: Unrecognized lattice type in MEAM library/parameter file - -The lattice type in an entry of the MEAM library/parameter file is not -valid. - -E: Unsupported parameter in MEAM library file: ... - -Self-explanatory. - -E: Mismatched parameter in MEAM library file: z!=lat - -The coordination number and lattice do not match, check that consistent values are given. - -E: Did not find all elements in MEAM library file - -Some requested elements were not found in the MEAM file. Check spelling etc. - -E: Keyword %s in MEAM parameter file not recognized - -Self-explanatory. - -E: Error in MEAM parameter file: keyword %s (further information) - -Self-explanatory. Check the parameter file. - -*/ diff --git a/src/MESONT/atom_vec_mesont.cpp b/src/MESONT/atom_vec_mesont.cpp index 5e57479b63..e3d03ff3e1 100644 --- a/src/MESONT/atom_vec_mesont.cpp +++ b/src/MESONT/atom_vec_mesont.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -33,18 +32,16 @@ AtomVecMesoNT::AtomVecMesoNT(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "rmass radius length buckling bond_nt molecule"; - fields_copy = (char *) "rmass radius length buckling bond_nt molecule"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "rmass radius length buckling bond_nt molecule"; - fields_border_vel = (char *) "rmass radius length buckling bond_nt molecule"; - fields_exchange = (char *) "rmass radius length buckling bond_nt molecule"; - fields_restart = (char *) "rmass radius length buckling bond_nt molecule"; - fields_create = (char *) "rmass radius length buckling bond_nt molecule"; - fields_data_atom = (char *) "id molecule type bond_nt rmass radius length buckling x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_copy = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_border = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_border_vel = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_exchange = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_restart = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_create = {"rmass", "radius", "length", "buckling", "bond_nt", "molecule"}; + fields_data_atom = {"id", "molecule", "type", "bond_nt", "rmass", + "radius", "length", "buckling", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } diff --git a/src/MESONT/atom_vec_mesont.h b/src/MESONT/atom_vec_mesont.h index 38bb815a0a..25f2a9d243 100644 --- a/src/MESONT/atom_vec_mesont.h +++ b/src/MESONT/atom_vec_mesont.h @@ -35,7 +35,3 @@ class AtomVecMesoNT : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MESONT/compute_mesont.h b/src/MESONT/compute_mesont.h index b1ed890139..b8b08f1b78 100644 --- a/src/MESONT/compute_mesont.h +++ b/src/MESONT/compute_mesont.h @@ -49,19 +49,3 @@ class ComputeMesoNT : public Compute { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal compute mesont command - -Incorrect argument list in the compute init. - -E: Per-atom energy was not tallied on needed timestep - -UNSPECIFIED. - -E: compute mesont is allowed only with mesont/tpm pair style - -Use mesont pair style. - -*/ diff --git a/src/MESONT/pair_mesocnt.cpp b/src/MESONT/pair_mesocnt.cpp index 9137b19e7c..11391e71bb 100644 --- a/src/MESONT/pair_mesocnt.cpp +++ b/src/MESONT/pair_mesocnt.cpp @@ -890,8 +890,8 @@ void PairMesoCNT::read_file(const char *file) MPI_Bcast(uinf_data, uinf_points, MPI_DOUBLE, 0, world); MPI_Bcast(gamma_data, gamma_points, MPI_DOUBLE, 0, world); - MPI_Bcast(&phi_data[0][0], phi_points*phi_points, MPI_DOUBLE, 0, world); - MPI_Bcast(&usemi_data[0][0], usemi_points*usemi_points, MPI_DOUBLE, 0, world); + MPI_Bcast(&phi_data[0][0], phi_points * phi_points, MPI_DOUBLE, 0, world); + MPI_Bcast(&usemi_data[0][0], usemi_points * usemi_points, MPI_DOUBLE, 0, world); } /* ---------------------------------------------------------------------- diff --git a/src/MESONT/pair_mesocnt.h b/src/MESONT/pair_mesocnt.h index 795b27f8ff..36e6728d7a 100644 --- a/src/MESONT/pair_mesocnt.h +++ b/src/MESONT/pair_mesocnt.h @@ -64,8 +64,7 @@ class PairMesoCNT : public Pair { void sort(int *, int); void read_file(const char *); void read_data(PotentialFileReader &, double *, double &, double &, int); - void read_data(PotentialFileReader &, double **, double &, double &, double &, double &, - int); + void read_data(PotentialFileReader &, double **, double &, double &, double &, double &, int); void spline_coeff(double *, double **, double, int); void spline_coeff(double **, double ****, double, double, int); @@ -118,61 +117,3 @@ class PairMesoCNT : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style mesocnt does not support lj units - -Self-explanatory. Specify different unit system using the units -command. - -E: Pair style mesocnt requires atom IDs - -Self-explanatory. Turn on atom IDs using the atom_modify command. - -E: Pair style mesocnt requires newton pair on - -Self-explanatory. Turn on Newton's third law with the newton command. - -E: Cannot open mesocnt file %s - -The specified mesocnt potential file cannot be opened. Check that the -path and name are correct. - -E: Premature end of file in pair table %s - -The specified mesocnt potential file is shorter than specified. Check -if the correct file is being used and the right number of data points -was specified in the pair_style - -W: %d of %d lines were incomplete or could not be parsed completely -in pair table %s - -A number of lines in the specified mesocnt potential file is incomplete -or in the wrong format. Check the file for errors and missing data. - -W: %d spacings in the first column were different from the first spacing -in the pair table %s - -The spacings between x coordinates in the first column of the specified -mesocnt potential file vary throughout the file. Use a potential file -with higher precision. - -W: %d spacings in second column were different from first -spacing in pair table %s - -The spacings between y coordinates in the second column of the specified -mesocnt potential file vary throughout the file. Use a potential file -with higher precision. - -*/ diff --git a/src/MESONT/pair_mesont_tpm.h b/src/MESONT/pair_mesont_tpm.h index edb5d320bf..86cd245d20 100644 --- a/src/MESONT/pair_mesont_tpm.h +++ b/src/MESONT/pair_mesont_tpm.h @@ -64,36 +64,3 @@ class PairMESONTTPM : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair style mesont/tpm requires newton pair on - -newton_pair must be set to on - -E: The selected cutoff is too small for the current system - -cutoff must be increased. - -E: Illegal pair_style command - -Incorrect argument list in the style init. - -E: Incorrect table path - -Incorrect path to the table files. - -E: Incorrect BendingMode - -Self-explanatory. - -E: Incorrect TPMType - -Self-explanatory. - -E: Inconsistent input and potential table - -The tube diameter is inconsistent with the chirality specified -during generation of the potential table. - -*/ diff --git a/src/MISC/bond_special.h b/src/MISC/bond_special.h index e510486271..b7c4d2eebe 100644 --- a/src/MISC/bond_special.h +++ b/src/MISC/bond_special.h @@ -49,29 +49,3 @@ class BondSpecial : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -E: Invalid 1-2 setting for bond style special. - -Bond style special must be used with zero factors for 1-2 special bonds. - -E: Invalid 1-3 setting for bond style special. - -Bond style special must be used with 1.0 factors for 1-3 special bonds or the -angle keyword set to yes. - -E: Invalid 1-4 setting for bond style special. - -Bond style special must be used with 1.0 factors for 1-4 special bonds or the -dihedral keyword set to yes. - -E: Bond style special is not compatible with long range Coulombic interactions. - -Self-explanatory. - -*/ diff --git a/src/MISC/compute_viscosity_cos.h b/src/MISC/compute_viscosity_cos.h index d30ff5c50a..8453de6f01 100644 --- a/src/MISC/compute_viscosity_cos.h +++ b/src/MISC/compute_viscosity_cos.h @@ -56,18 +56,3 @@ class ComputeViscosityCos : public Compute { #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: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/MISC/fix_accelerate_cos.h b/src/MISC/fix_accelerate_cos.h index 48d992b1a2..343f815f9d 100644 --- a/src/MISC/fix_accelerate_cos.h +++ b/src/MISC/fix_accelerate_cos.h @@ -45,17 +45,3 @@ class FixAccelerateCos : public Fix { #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: Fix accelerate/cos cannot be used with 2d systems - -Self-explanatory. - -*/ diff --git a/src/MISC/fix_imd.cpp b/src/MISC/fix_imd.cpp index 1e2160ef07..da2a110e4d 100644 --- a/src/MISC/fix_imd.cpp +++ b/src/MISC/fix_imd.cpp @@ -566,7 +566,7 @@ FixIMD::~FixIMD() } #endif - taginthash_t *hashtable = (taginthash_t *)idmap; + auto hashtable = (taginthash_t *)idmap; memory->destroy(comm_buf); memory->destroy(force_buf); taginthash_destroy(hashtable); @@ -595,7 +595,7 @@ int FixIMD::setmask() void FixIMD::init() { if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; return; } @@ -699,17 +699,17 @@ void FixIMD::setup(int) error->all(FLERR,"LAMMPS terminated on error in setting up IMD connection."); /* initialize and build hashtable. */ - taginthash_t *hashtable=new taginthash_t; + auto hashtable=new taginthash_t; taginthash_init(hashtable, num_coords); idmap = (void *)hashtable; int tmp, ndata; - struct commdata *buf = static_cast(comm_buf); + auto buf = static_cast(comm_buf); if (me == 0) { MPI_Status status; MPI_Request request; - tagint *taglist = new tagint[num_coords]; + auto taglist = new tagint[num_coords]; int numtag=0; /* counter to map atom tags to a 0-based consecutive index list */ for (i=0; i < nlocal; ++i) { @@ -899,15 +899,15 @@ void FixIMD::post_force(int /*vflag*/) } case IMD_FCOORDS: { - float *dummy_coords = new float[3*length]; + auto dummy_coords = new float[3*length]; imd_recv_fcoords(clientsock, length, dummy_coords); delete[] dummy_coords; break; } case IMD_MDCOMM: { - int32 *imd_tags = new int32[length]; - float *imd_fdat = new float[3*length]; + auto imd_tags = new int32[length]; + auto imd_fdat = new float[3*length]; imd_recv_mdcomm(clientsock, length, imd_tags, imd_fdat); if (imd_forces < length) { /* grow holding space for forces, if needed. */ @@ -1014,7 +1014,7 @@ void FixIMD::post_force(int /*vflag*/) msgdata = new char[msglen]; imd_fill_header((IMDheader *)msgdata, IMD_FCOORDS, num_coords); /* array pointer, to the offset where we receive the coordinates. */ - float *recvcoord = (float *) (msgdata+IMDHEADERSIZE); + auto recvcoord = (float *) (msgdata+IMDHEADERSIZE); /* add local data */ if (unwrap_flag) { @@ -1207,7 +1207,7 @@ void * imdsock_create() { } int imdsock_bind(void * v, int port) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; memset(&(s->addr), 0, sizeof(s->addr)); s->addr.sin_family = PF_INET; s->addr.sin_port = htons(port); @@ -1216,7 +1216,7 @@ int imdsock_bind(void * v, int port) { } int imdsock_listen(void * v) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; return listen(s->sd, 5); } @@ -1250,7 +1250,7 @@ void *imdsock_accept(void * v) { } int imdsock_write(void * v, const void *buf, int len) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; #if defined(_MSC_VER) || defined(__MINGW32__) return send(s->sd, (const char*) buf, len, 0); /* windows lacks the write() call */ #else @@ -1259,7 +1259,7 @@ int imdsock_write(void * v, const void *buf, int len) { } int imdsock_read(void * v, void *buf, int len) { - imdsocket *s = (imdsocket *) v; + auto s = (imdsocket *) v; #if defined(_MSC_VER) || defined(__MINGW32__) return recv(s->sd, (char*) buf, len, 0); /* windows lacks the read() call */ #else @@ -1269,7 +1269,7 @@ int imdsock_read(void * v, void *buf, int len) { } void imdsock_shutdown(void *v) { - imdsocket * s = (imdsocket *) v; + auto s = (imdsocket *) v; if (s == nullptr) return; @@ -1281,7 +1281,7 @@ void imdsock_shutdown(void *v) { } void imdsock_destroy(void * v) { - imdsocket * s = (imdsocket *) v; + auto s = (imdsocket *) v; if (s == nullptr) return; @@ -1294,7 +1294,7 @@ void imdsock_destroy(void * v) { } int imdsock_selread(void *v, int sec) { - imdsocket *s = (imdsocket *)v; + auto s = (imdsocket *)v; fd_set rfd; struct timeval tv; int rc; @@ -1313,7 +1313,7 @@ int imdsock_selread(void *v, int sec) { } int imdsock_selwrite(void *v, int sec) { - imdsocket *s = (imdsocket *)v; + auto s = (imdsocket *)v; fd_set wfd; struct timeval tv; int rc; diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp index b82339713e..290ce38c02 100644 --- a/src/MISC/fix_ipi.cpp +++ b/src/MISC/fix_ipi.cpp @@ -416,7 +416,7 @@ void FixIPI::final_integrate() int nat=bsize/3; double **f= atom->f; - double *lbuf = new double[bsize]; + auto lbuf = new double[bsize]; // reassembles the force vector from the local arrays int nlocal = atom->nlocal; diff --git a/src/MISC/fix_pair_tracker.cpp b/src/MISC/fix_pair_tracker.cpp deleted file mode 100644 index 3616855869..0000000000 --- a/src/MISC/fix_pair_tracker.cpp +++ /dev/null @@ -1,350 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/ 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 "fix_pair_tracker.h" - -#include "atom.h" -#include "error.h" -#include "memory.h" -#include "tokenizer.h" -#include "update.h" - -#include - -using namespace LAMMPS_NS; -using namespace FixConst; - -#define DELTA 1000 - -/* ---------------------------------------------------------------------- */ - -FixPairTracker::FixPairTracker(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), nvalues(0), vector(nullptr), array(nullptr), pack_choice(nullptr) -{ - if (narg < 3) error->all(FLERR, "Illegal fix pair/tracker command"); - local_flag = 1; - - nevery = utils::inumeric(FLERR, arg[3], false, lmp); - if (nevery <= 0) error->all(FLERR, "Illegal fix pair/tracker command"); - local_freq = nevery; - - // If optional arguments included, this will be oversized - nvalues = narg - 4; - pack_choice = new FnPtrPack[nvalues]; - - tmin = -1; - type_filter = nullptr; - int iarg = 4; - nvalues = 0; - while (iarg < narg) { - if (strcmp(arg[iarg], "id1") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_id1; - } else if (strcmp(arg[iarg], "id2") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_id2; - - } else if (strcmp(arg[iarg], "time/created") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_time_created; - } else if (strcmp(arg[iarg], "time/broken") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_time_broken; - } else if (strcmp(arg[iarg], "time/total") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_time_total; - - } else if (strcmp(arg[iarg], "x") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_x; - } else if (strcmp(arg[iarg], "y") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_y; - } else if (strcmp(arg[iarg], "z") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_z; - - } else if (strcmp(arg[iarg], "r/min") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_rmin; - } else if (strcmp(arg[iarg], "r/ave") == 0) { - pack_choice[nvalues++] = &FixPairTracker::pack_rave; - - } else if (strcmp(arg[iarg], "time/min") == 0) { - if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in fix pair/tracker command"); - tmin = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - iarg++; - - } else if (strcmp(arg[iarg], "type/include") == 0) { - if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in fix pair/tracker command"); - int ntypes = atom->ntypes; - int i, j, itype, jtype; - int inlo, inhi, jnlo, jnhi; - - if (!type_filter) { - memory->create(type_filter, ntypes + 1, ntypes + 1, "fix/pair/tracker:type_filter"); - - for (i = 0; i <= ntypes; i++) { - for (j = 0; j <= ntypes; j++) type_filter[i][j] = 0; - } - } - - auto iwords = Tokenizer(arg[iarg + 1], ",").as_vector(); - auto jwords = Tokenizer(arg[iarg + 2], ",").as_vector(); - - for (const auto &ifield : iwords) { - utils::bounds(FLERR, ifield, 1, ntypes, inlo, inhi, error); - for (const auto &jfield : jwords) { - utils::bounds(FLERR, jfield, 1, ntypes, jnlo, jnhi, error); - - for (itype = inlo; itype <= inhi; itype++) { - for (jtype = jnlo; jtype <= jnhi; jtype++) { - type_filter[itype][jtype] = 1; - type_filter[jtype][itype] = 1; - } - } - } - } - iarg += 2; - - } else - error->all(FLERR, "Invalid keyword in fix pair/tracker command"); - - iarg++; - } - - if (nvalues == 1) - size_local_cols = 0; - else - size_local_cols = nvalues; - - nmax = 0; - ncount = 0; - vector = nullptr; - array = nullptr; -} - -/* ---------------------------------------------------------------------- */ - -FixPairTracker::~FixPairTracker() -{ - delete[] pack_choice; - - memory->destroy(vector); - memory->destroy(array); - memory->destroy(type_filter); -} - -/* ---------------------------------------------------------------------- */ - -int FixPairTracker::setmask() -{ - int mask = 0; - mask |= POST_FORCE; - return mask; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::init() -{ - // Set size of array/vector - ncount = 0; - - if (ncount > nmax) reallocate(ncount); - - size_local_rows = ncount; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::lost_contact(int i, int j, double time_tmp, double nstep_tmp, double rsum_tmp, - double rmin_tmp) -{ - - double time = update->atime + (update->ntimestep - update->atimestep) * update->dt; - if ((time - time_tmp) < tmin) return; - - if (type_filter) { - int *type = atom->type; - if (type_filter[type[i]][type[j]] == 0) return; - } - - int *mask = atom->mask; - if (!(mask[i] & groupbit)) return; - if (!(mask[j] & groupbit)) return; - - if (ncount == nmax) reallocate(ncount); - - index_i = i; - index_j = j; - - rmin = rmin_tmp; - rsum = rsum_tmp; - time_initial = time_tmp; - nstep_initial = nstep_tmp; - - // fill vector or array with local values - if (nvalues == 1) { - (this->*pack_choice[0])(0); - } else { - for (int k = 0; k < nvalues; k++) { (this->*pack_choice[k])(k); } - } - - ncount += 1; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::post_force(int /*vflag*/) -{ - if (update->ntimestep % nevery == 0) { - size_local_rows = ncount; - ncount = 0; - } -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::reallocate(int n) -{ - // grow vector or array - while (nmax <= n) nmax += DELTA; - - if (nvalues == 1) { - memory->grow(vector, nmax, "fix_pair_tracker:vector"); - vector_local = vector; - } else { - memory->grow(array, nmax, nvalues, "fix_pair_tracker:array"); - array_local = array; - } -} - -/* ---------------------------------------------------------------------- - memory usage of local data -------------------------------------------------------------------------- */ - -double FixPairTracker::memory_usage() -{ - double bytes = nmax * (double) nvalues * sizeof(double); - bytes += nmax * 2 * sizeof(int); - return bytes; -} - -/* ---------------------------------------------------------------------- - one method for every keyword fix pair/tracker can output - the atom property is packed into a local vector or array -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_time_created(int n) -{ - if (nvalues == 1) - vector[ncount] = time_initial; - else - array[ncount][n] = time_initial; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_time_broken(int n) -{ - double time = update->atime + (update->ntimestep - update->atimestep) * update->dt; - if (nvalues == 1) - vector[ncount] = time; - else - array[ncount][n] = time; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_time_total(int n) -{ - double time = update->atime + (update->ntimestep - update->atimestep) * update->dt; - if (nvalues == 1) - vector[ncount] = time - time_initial; - else - array[ncount][n] = time - time_initial; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_id1(int n) -{ - tagint *tag = atom->tag; - - if (nvalues == 1) - vector[ncount] = tag[index_i]; - else - array[ncount][n] = tag[index_i]; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_id2(int n) -{ - tagint *tag = atom->tag; - - if (nvalues == 1) - vector[ncount] = tag[index_j]; - else - array[ncount][n] = tag[index_j]; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_x(int n) -{ - double **x = atom->x; - - if (nvalues == 1) - vector[ncount] = (x[index_i][0] + x[index_j][0]) / 2; - else - array[ncount][n] = (x[index_i][0] + x[index_j][0]) / 2; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_y(int n) -{ - double **x = atom->x; - - if (nvalues == 1) - vector[ncount] = (x[index_i][1] + x[index_j][1]) / 2; - else - array[ncount][n] = (x[index_i][1] + x[index_j][1]) / 2; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_z(int n) -{ - double **x = atom->x; - - if (nvalues == 1) - vector[ncount] = (x[index_i][2] + x[index_j][2]) / 2; - else - array[ncount][n] = (x[index_i][2] + x[index_j][2]) / 2; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_rmin(int n) -{ - if (nvalues == 1) - vector[ncount] = rmin; - else - array[ncount][n] = rmin; -} - -/* ---------------------------------------------------------------------- */ - -void FixPairTracker::pack_rave(int n) -{ - if (nvalues == 1) - vector[ncount] = rsum / (update->ntimestep - nstep_initial); - else - array[ncount][n] = rsum / (update->ntimestep - nstep_initial); -} diff --git a/src/MISC/fix_pair_tracker.h b/src/MISC/fix_pair_tracker.h deleted file mode 100644 index a9743b3b50..0000000000 --- a/src/MISC/fix_pair_tracker.h +++ /dev/null @@ -1,85 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/ 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 -// clang-format off -FixStyle(pair/tracker,FixPairTracker); -// clang-format on -#else - -#ifndef LMP_FIX_PAIR_TRACKING_H -#define LMP_FIX_PAIR_TRACKING_H - -#include "fix.h" - -namespace LAMMPS_NS { - -class FixPairTracker : public Fix { - public: - FixPairTracker(class LAMMPS *, int, char **); - ~FixPairTracker() override; - int setmask() override; - void init() override; - void post_force(int) override; - double memory_usage() override; - void lost_contact(int, int, double, double, double, double); - - private: - int nvalues, nmax; - int index_i, index_j; - double tmin, rmin, rsum, time_initial, nstep_initial; - - double *vector; - double **array; - int **type_filter; - - int ncount; - - void reallocate(int); - - typedef void (FixPairTracker::*FnPtrPack)(int); - FnPtrPack *pack_choice; // ptrs to pack functions - - void pack_id1(int); - void pack_id2(int); - - void pack_time_created(int); - void pack_time_broken(int); - void pack_time_total(int); - - void pack_x(int); - void pack_y(int); - void pack_z(int); - - void pack_rmin(int); - void pack_rave(int); -}; - -} // namespace LAMMPS_NS - -#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: Invalid keyword in fix pair/tracker command - -Self-explanatory. - -*/ diff --git a/src/MISC/fix_srp.cpp b/src/MISC/fix_srp.cpp index 393be42bb2..1fb15aafd3 100644 --- a/src/MISC/fix_srp.cpp +++ b/src/MISC/fix_srp.cpp @@ -607,7 +607,7 @@ void FixSRP::write_restart(FILE *fp) void FixSRP::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; comm->cutghostuser = static_cast (list[n++]); btype = static_cast (list[n++]); diff --git a/src/MISC/fix_srp.h b/src/MISC/fix_srp.h index e6049de893..d0e2da1483 100644 --- a/src/MISC/fix_srp.h +++ b/src/MISC/fix_srp.h @@ -63,7 +63,3 @@ class FixSRP : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MISC/pair_agni.h b/src/MISC/pair_agni.h index b324b5a98a..9f416ec292 100644 --- a/src/MISC/pair_agni.h +++ b/src/MISC/pair_agni.h @@ -55,27 +55,3 @@ class PairAGNI : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Cannot open AGNI potential file %s - -The specified AGNI potential file cannot be opened. Check that the path -and name are correct. - -E: Incorrect format in AGNI potential file - -The potential file is not compatible with the AGNI pair style -implementation in this LAMMPS version. - -*/ diff --git a/src/MISC/pair_list.cpp b/src/MISC/pair_list.cpp index d7d59e90d3..f6ac2e3190 100644 --- a/src/MISC/pair_list.cpp +++ b/src/MISC/pair_list.cpp @@ -89,7 +89,7 @@ void PairList::compute(int eflag, int vflag) const int nlocal = atom->nlocal; const int newton_pair = force->newton_pair; const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; // NOLINT double fpair,epair; int i,j; diff --git a/src/MISC/pair_list.h b/src/MISC/pair_list.h index 3528ad10f8..2828a08547 100644 --- a/src/MISC/pair_list.h +++ b/src/MISC/pair_list.h @@ -57,64 +57,21 @@ class PairList : public Pair { }; struct list_param { - int style; // potential style indicator - tagint id1, id2; // global atom ids - double cutsq; // cutoff**2 for this pair - double offset; // energy offset - union param_u param; // parameters for style + int style; // potential style indicator + tagint id1, id2; // global atom ids + double cutsq; // cutoff**2 for this pair + double offset; // energy offset + union param_u param; // parameters for style }; protected: - double cut_global; // global cutoff distance - list_param *params; // lisf of pair interaction parameters - int npairs; // # of atom pairs in global list - int check_flag; // 1 if checking for missing pairs + double cut_global; // global cutoff distance + list_param *params; // lisf of pair interaction parameters + int npairs; // # of atom pairs in global list + int check_flag; // 1 if checking for missing pairs }; } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Not all pairs processed in pair_style list - -Not all interacting pairs for which coefficients were found. This can be intentional -and then you need to set the 'nocheck' option. If not, it usually means that the -communication cutoff is too small. This can be ameliorated by either increasing -the cutoff in the pair_style command or the communication cutoff. - -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: Cannot open pair list file - -Self-explanatory. The file with the list of pairs cannot be open for reading. -Check the path and permissions. - -E: Incorrectly formatted ... - -Self-explanatory. The content of the pair list file does not match the documented -format. Please re-read the documentation and carefully compare it to your file. - -E: Unknown pair list potential style - -Self-explanatory. You requested a potential type that is not yet implemented or have a typo. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style list requires atom IDs - -Self-explanatory. The pairs in the list are identified via atom IDs, so they need to be present. - -E: Pair style list requires an atom map - -Self-explanatory. Atoms are looked up via an atom map. Create one using the atom_style map command. - -*/ diff --git a/src/MISC/pair_srp.cpp b/src/MISC/pair_srp.cpp index 84f7c330a8..3667d0a2c2 100644 --- a/src/MISC/pair_srp.cpp +++ b/src/MISC/pair_srp.cpp @@ -84,7 +84,7 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp), fix_id(nullptr) // will be invoked before other fixes that migrate atoms // this is checked for in FixSRP - f_srp = (FixSRP *) modify->add_fix(fmt::format("{:02d}_FIX_SRP all SRP",srp_instance)); + f_srp = dynamic_cast( modify->add_fix(fmt::format("{:02d}_FIX_SRP all SRP",srp_instance))); ++srp_instance; } diff --git a/src/MISC/pair_srp.h b/src/MISC/pair_srp.h index 5c6816e695..03e7248d69 100644 --- a/src/MISC/pair_srp.h +++ b/src/MISC/pair_srp.h @@ -63,7 +63,3 @@ class PairSRP : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MISC/pair_tracker.cpp b/src/MISC/pair_tracker.cpp index 502b04c49d..df49811a10 100644 --- a/src/MISC/pair_tracker.cpp +++ b/src/MISC/pair_tracker.cpp @@ -19,39 +19,41 @@ #include "fix.h" #include "fix_dummy.h" #include "fix_neigh_history.h" -#include "fix_pair_tracker.h" +#include "fix_store_local.h" #include "force.h" #include "memory.h" #include "modify.h" #include "neigh_list.h" #include "neighbor.h" +#include "tokenizer.h" #include "update.h" +#include "utils.h" -#include #include using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -PairTracker::PairTracker(LAMMPS *lmp) : Pair(lmp) +PairTracker::PairTracker(LAMMPS *lmp) : + Pair(lmp), onerad_dynamic(nullptr), onerad_frozen(nullptr), maxrad_dynamic(nullptr), + maxrad_frozen(nullptr), id_fix_store_local(nullptr), fix_dummy(nullptr), fix_history(nullptr), + fix_store_local(nullptr), type_filter(nullptr), output_data(nullptr), pack_choice(nullptr) { single_enable = 1; no_virial_fdotr_compute = 1; neighprev = 0; history = 1; - size_history = 4; + size_history = 3; nondefault_history_transfer = 1; finitecutflag = 0; + tmin = -1; // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - - fix_history = nullptr; - modify->add_fix("NEIGH_HISTORY_TRACK_DUMMY all DUMMY"); - fix_dummy = (FixDummy *) modify->fix[modify->nfix - 1]; + fix_dummy = dynamic_cast(modify->add_fix("NEIGH_HISTORY_TRACK_DUMMY all DUMMY")); } /* ---------------------------------------------------------------------- */ @@ -62,6 +64,7 @@ PairTracker::~PairTracker() modify->delete_fix("NEIGH_HISTORY_TRACK_DUMMY"); else modify->delete_fix("NEIGH_HISTORY_TRACK"); + if (id_fix_store_local) modify->delete_fix(id_fix_store_local); if (allocated) { memory->destroy(setflag); @@ -73,6 +76,12 @@ PairTracker::~PairTracker() delete[] maxrad_dynamic; delete[] maxrad_frozen; } + + delete[] pack_choice; + delete[] id_fix_store_local; + + memory->destroy(output_data); + memory->destroy(type_filter); } /* ---------------------------------------------------------------------- */ @@ -80,7 +89,7 @@ PairTracker::~PairTracker() void PairTracker::compute(int eflag, int vflag) { int i, j, ii, jj, inum, jnum, itype, jtype; - double xtmp, ytmp, ztmp, delx, dely, delz, time; + double xtmp, ytmp, ztmp, delx, dely, delz; double radi, radj, radsum, rsq, r; int *ilist, *jlist, *numneigh, **firstneigh; int *touch, **firsttouch; @@ -131,27 +140,23 @@ void PairTracker::compute(int eflag, int vflag) if (rsq >= radsum * radsum) { data = &alldata[size_history * jj]; - if (touch[jj] == 1) { - fix_pair_tracker->lost_contact(i, j, data[0], data[1], data[2], data[3]); - } + if (touch[jj] == 1) process_data(i, j, data); + touch[jj] = 0; - data[0] = 0.0; // initial time - data[1] = 0.0; // initial timestep - data[2] = 0.0; // sum of r, may overflow - data[3] = 0.0; // min of r + data[0] = 0.0; // initial timestep + data[1] = 0.0; // sum of r, may be inaccurate over long times + data[2] = 0.0; // min of r } else { data = &alldata[size_history * jj]; if (touch[jj] == 0) { - time = update->atime + (update->ntimestep - update->atimestep) * update->dt; - data[0] = time; - data[1] = (double) update->ntimestep; + data[0] = (double) update->ntimestep; + data[1] = r; data[2] = r; - data[3] = r; } else if (updateflag) { - data[2] += r; - if (data[3] > r) data[3] = r; + data[1] += r; + if (data[2] > r) data[2] = r; } touch[jj] = 1; } @@ -160,28 +165,23 @@ void PairTracker::compute(int eflag, int vflag) if (rsq >= cutsq[itype][jtype]) { data = &alldata[size_history * jj]; - if (touch[jj] == 1) { - fix_pair_tracker->lost_contact(i, j, data[0], data[1], data[2], data[3]); - } + if (touch[jj] == 1) process_data(i, j, data); touch[jj] = 0; - data[0] = 0.0; // initial time - data[1] = 0.0; // initial timestep - data[2] = 0.0; // sum of r, may overflow - data[3] = 0.0; // min of r + data[0] = 0.0; // initial timestep + data[1] = 0.0; // sum of r, may be inaccurate over long times + data[2] = 0.0; // min of r } else { data = &alldata[size_history * jj]; if (touch[jj] == 0) { - time = update->atime + (update->ntimestep - update->atimestep) * update->dt; - data[0] = time; - data[1] = (double) update->ntimestep; + data[0] = (double) update->ntimestep; + data[1] = r; data[2] = r; - data[3] = r; } else if (updateflag) { - data[2] += r; - if (data[3] > r) data[3] = r; + data[1] += r; + if (data[2] > r) data[2] = r; } touch[jj] = 1; } @@ -218,14 +218,89 @@ void PairTracker::allocate() void PairTracker::settings(int narg, char **arg) { - if (narg != 0 && narg != 1) error->all(FLERR, "Illegal pair_style command"); + if (narg < 2) error->all(FLERR, "Illegal pair_style command"); - if (narg == 1) { - if (strcmp(arg[0], "finite") == 0) + id_fix_store_local = utils::strdup(arg[0]); + store_local_freq = utils::inumeric(FLERR, arg[1], false, lmp); + + // If optional arguments included, this will be oversized + pack_choice = new FnPtrPack[narg - 1]; + + nvalues = 0; + int iarg = 2; + while (iarg < narg) { + if (strcmp(arg[iarg], "finite") == 0) { finitecutflag = 1; - else + } else if (strcmp(arg[iarg], "id1") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_id1; + } else if (strcmp(arg[iarg], "id2") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_id2; + } else if (strcmp(arg[iarg], "time/created") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_time_created; + } else if (strcmp(arg[iarg], "time/broken") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_time_broken; + } else if (strcmp(arg[iarg], "time/total") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_time_total; + } else if (strcmp(arg[iarg], "x") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_x; + } else if (strcmp(arg[iarg], "y") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_y; + } else if (strcmp(arg[iarg], "z") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_z; + } else if (strcmp(arg[iarg], "r/min") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_rmin; + } else if (strcmp(arg[iarg], "r/ave") == 0) { + pack_choice[nvalues++] = &PairTracker::pack_rave; + } else if (strcmp(arg[iarg], "time/min") == 0) { + if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in pair tracker command"); + tmin = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + iarg++; + + } else if (strcmp(arg[iarg], "type/include") == 0) { + if (iarg + 1 >= narg) error->all(FLERR, "Invalid keyword in pair tracker command"); + int ntypes = atom->ntypes; + int i, j, itype, jtype; + int inlo, inhi, jnlo, jnhi; + + if (!type_filter) { + memory->create(type_filter, ntypes + 1, ntypes + 1, "pair/tracker:type_filter"); + + for (i = 0; i <= ntypes; i++) { + for (j = 0; j <= ntypes; j++) type_filter[i][j] = 0; + } + } + + auto iwords = Tokenizer(arg[iarg + 1], ",").as_vector(); + auto jwords = Tokenizer(arg[iarg + 2], ",").as_vector(); + + for (const auto &ifield : iwords) { + utils::bounds(FLERR, ifield, 1, ntypes, inlo, inhi, error); + for (const auto &jfield : jwords) { + utils::bounds(FLERR, jfield, 1, ntypes, jnlo, jnhi, error); + + for (itype = inlo; itype <= inhi; itype++) { + for (jtype = jnlo; jtype <= jnhi; jtype++) { + type_filter[itype][jtype] = 1; + type_filter[jtype][itype] = 1; + } + } + } + } + iarg += 2; + + } else { error->all(FLERR, "Illegal pair_style command"); + } + iarg++; } + + if (nvalues == 0) error->all(FLERR, "Must request at least one value to output"); + memory->create(output_data, nvalues, "pair/tracker:output_data"); + + fix_store_local = dynamic_cast(modify->get_fix_by_id(id_fix_store_local)); + if (!fix_store_local) + fix_store_local = dynamic_cast(modify->add_fix( + fmt::format("{} all STORE_LOCAL {} {}", id_fix_store_local, store_local_freq, nvalues))); } /* ---------------------------------------------------------------------- @@ -263,8 +338,6 @@ void PairTracker::coeff(int narg, char **arg) void PairTracker::init_style() { - int i; - // error and warning checks if (!atom->radius_flag && finitecutflag) @@ -283,44 +356,49 @@ void PairTracker::init_style() if (fix_history == nullptr) { modify->replace_fix("NEIGH_HISTORY_TRACK_DUMMY", fmt::format("NEIGH_HISTORY_TRACK all NEIGH_HISTORY {}", size_history), 1); - fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_TRACK"); + fix_history = dynamic_cast(modify->get_fix_by_id("NEIGH_HISTORY_TRACK")); fix_history->pair = this; fix_history->use_bit_flag = 0; } else { - fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_TRACK"); + fix_history = dynamic_cast(modify->get_fix_by_id("NEIGH_HISTORY_TRACK")); if (!fix_history) error->all(FLERR, "Could not find pair fix neigh history ID"); } if (finitecutflag) { - if (force->pair->beyond_contact) error->all(FLERR, "Pair tracker incompatible with granular pairstyles that extend beyond contact"); + + // check for FixFreeze and set freeze_group_bit + + auto fixlist = modify->get_fix_by_style("^freeze"); + if (fixlist.size() == 0) + freeze_group_bit = 0; + else if (fixlist.size() > 1) + error->all(FLERR, "Only one fix freeze command at a time allowed"); + else + freeze_group_bit = fixlist.front()->groupbit; + // check for FixPour and FixDeposit so can extract particle radii - int ipour; - for (ipour = 0; ipour < modify->nfix; ipour++) - if (strcmp(modify->fix[ipour]->style, "pour") == 0) break; - if (ipour == modify->nfix) ipour = -1; - - int idep; - for (idep = 0; idep < modify->nfix; idep++) - if (strcmp(modify->fix[idep]->style, "deposit") == 0) break; - if (idep == modify->nfix) idep = -1; + auto pours = modify->get_fix_by_style("^pour"); + auto deps = modify->get_fix_by_style("^deposit"); // set maxrad_dynamic and maxrad_frozen for each type // include future FixPour and FixDeposit particles as dynamic - int itype; - for (i = 1; i <= atom->ntypes; i++) { + int itype = 0; + for (int i = 1; i <= atom->ntypes; i++) { onerad_dynamic[i] = onerad_frozen[i] = 0.0; - if (ipour >= 0) { + for (auto &ipour : pours) { itype = i; - onerad_dynamic[i] = *((double *) modify->fix[ipour]->extract("radius", itype)); + double maxrad = *((double *) ipour->extract("radius", itype)); + if (maxrad > 0.0) onerad_dynamic[i] = maxrad; } - if (idep >= 0) { + for (auto &idep : deps) { itype = i; - onerad_dynamic[i] = *((double *) modify->fix[idep]->extract("radius", itype)); + double maxrad = *((double *) idep->extract("radius", itype)); + if (maxrad > 0.0) onerad_dynamic[i] = maxrad; } } @@ -329,7 +407,7 @@ void PairTracker::init_style() int *type = atom->type; int nlocal = atom->nlocal; - for (i = 0; i < nlocal; i++) + for (int i = 0; i < nlocal; i++) if (mask[i] & freeze_group_bit) onerad_frozen[type[i]] = MAX(onerad_frozen[type[i]], radius[i]); else @@ -338,11 +416,6 @@ void PairTracker::init_style() MPI_Allreduce(&onerad_dynamic[1], &maxrad_dynamic[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world); MPI_Allreduce(&onerad_frozen[1], &maxrad_frozen[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world); } - - auto trackfixes = modify->get_fix_by_style("pair/tracker"); - if (trackfixes.size() != 1) - error->all(FLERR, "Must use exactly one fix pair/tracker command with pair style tracker"); - fix_pair_tracker = (FixPairTracker *) trackfixes.front(); } /* ---------------------------------------------------------------------- @@ -354,8 +427,7 @@ double PairTracker::init_one(int i, int j) if (!allocated) allocate(); // always mix prefactors geometrically - - if (setflag[i][j] == 0) { cut[i][j] = mix_distance(cut[i][i], cut[j][j]); } + if (setflag[i][j] == 0) cut[i][j] = mix_distance(cut[i][i], cut[j][j]); cut[j][i] = cut[i][j]; @@ -384,7 +456,7 @@ void PairTracker::write_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { fwrite(&setflag[i][j], sizeof(int), 1, fp); - if (setflag[i][j]) { fwrite(&cut[i][j], sizeof(double), 1, fp); } + if (setflag[i][j]) fwrite(&cut[i][j], sizeof(double), 1, fp); } } @@ -404,7 +476,7 @@ void PairTracker::read_restart(FILE *fp) if (me == 0) utils::sfread(FLERR, &setflag[i][j], sizeof(int), 1, fp, nullptr, error); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { - if (me == 0) { utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); } + if (me == 0) utils::sfread(FLERR, &cut[i][j], sizeof(double), 1, fp, nullptr, error); MPI_Bcast(&cut[i][j], 1, MPI_DOUBLE, 0, world); } } @@ -466,3 +538,91 @@ double PairTracker::radii2cut(double r1, double r2) double cut = r1 + r2; return cut; } + +/* ---------------------------------------------------------------------- */ + +void PairTracker::process_data(int i, int j, double *input_data) +{ + if ((update->ntimestep - input_data[0]) < tmin) return; + + if (type_filter) { + int *type = atom->type; + if (type_filter[type[i]][type[j]] == 0) return; + } + + for (int k = 0; k < nvalues; k++) (this->*pack_choice[k])(k, i, j, input_data); + fix_store_local->add_data(output_data, i, j); +} + +/* ---------------------------------------------------------------------- + one method for every keyword fix pair/tracker can output + the atom property is packed into a local vector or array +------------------------------------------------------------------------- */ + +void PairTracker::pack_time_created(int n, int /*i*/, int /*j*/, double *data) +{ + output_data[n] = data[0]; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_time_broken(int n, int /*i*/, int /*j*/, double * /*data*/) +{ + output_data[n] = update->ntimestep; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_time_total(int n, int /*i*/, int /*j*/, double *data) +{ + output_data[n] = update->ntimestep - data[0]; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_id1(int n, int i, int /*j*/, double * /*data*/) +{ + output_data[n] = atom->tag[i]; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_id2(int n, int /*i*/, int j, double * /*data*/) +{ + output_data[n] = atom->tag[j]; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_x(int n, int i, int j, double * /*data*/) +{ + output_data[n] = (atom->x[i][0] + atom->x[j][0]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_y(int n, int i, int j, double * /*data*/) +{ + output_data[n] = (atom->x[i][1] + atom->x[j][1]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_z(int n, int i, int j, double * /*data*/) +{ + output_data[n] = (atom->x[i][2] + atom->x[j][2]) * 0.5; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_rmin(int n, int /*i*/, int /*j*/, double *data) +{ + output_data[n] = data[2]; +} + +/* ---------------------------------------------------------------------- */ + +void PairTracker::pack_rave(int n, int /*i*/, int /*j*/, double *data) +{ + output_data[n] = data[1] / (update->ntimestep - data[0]); +} diff --git a/src/MISC/pair_tracker.h b/src/MISC/pair_tracker.h index 1942408659..e483590883 100644 --- a/src/MISC/pair_tracker.h +++ b/src/MISC/pair_tracker.h @@ -40,6 +40,7 @@ class PairTracker : public Pair { double single(int, int, int, int, double, double, double, double &) override; double atom2cut(int) override; double radii2cut(double, double) override; + void transfer_history(double *, double *) override; protected: int sizeflag; @@ -50,12 +51,33 @@ class PairTracker : public Pair { double *onerad_dynamic, *onerad_frozen; double *maxrad_dynamic, *maxrad_frozen; int freeze_group_bit; + int store_local_freq; + char *id_fix_store_local; class FixDummy *fix_dummy; class FixNeighHistory *fix_history; - class FixPairTracker *fix_pair_tracker; + class FixStoreLocal *fix_store_local; - void transfer_history(double *, double *) override; + int **type_filter; + double tmin; + + int nvalues, ncount; + double *output_data; + typedef void (PairTracker::*FnPtrPack)(int, int, int, double *); + FnPtrPack *pack_choice; // ptrs to pack functions + + void pack_id1(int, int, int, double *); + void pack_id2(int, int, int, double *); + void pack_time_created(int, int, int, double *); + void pack_time_broken(int, int, int, double *); + void pack_time_total(int, int, int, double *); + void pack_x(int, int, int, double *); + void pack_y(int, int, int, double *); + void pack_z(int, int, int, double *); + void pack_rmin(int, int, int, double *); + void pack_rave(int, int, int, double *); + + void process_data(int, int, double *); void allocate(); }; @@ -63,29 +85,3 @@ class PairTracker : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair tracker requires atom attribute radius for finite cutoffs - -The atom style defined does not have these attributes. - -E: Could not find pair fix neigh history ID - -The associated fix neigh/history is missing - -E: Cannot use pair tracker without fix pair/tracker - -This pairstyle requires one to define a pair/tracker fix - -*/ diff --git a/src/ML-HDNNP/pair_hdnnp.cpp b/src/ML-HDNNP/pair_hdnnp.cpp index 7522b301bf..f226bb601b 100644 --- a/src/ML-HDNNP/pair_hdnnp.cpp +++ b/src/ML-HDNNP/pair_hdnnp.cpp @@ -319,7 +319,7 @@ void PairHDNNP::handleExtrapolationWarnings() MPI_Status ms; // Get buffer size. MPI_Recv(&bs, 1, MPI_LONG, i, 0, world, &ms); - char *buf = new char[bs]; + auto buf = new char[bs]; // Receive buffer. MPI_Recv(buf, bs, MPI_BYTE, i, 0, world, &ms); interface->extractEWBuffer(buf, bs); @@ -331,7 +331,7 @@ void PairHDNNP::handleExtrapolationWarnings() // Get desired buffer length for all extrapolation warning entries. long bs = interface->getEWBufferSize(); // Allocate and fill buffer. - char *buf = new char[bs]; + auto buf = new char[bs]; interface->fillEWBuffer(buf, bs); // Send buffer size and buffer. MPI_Send(&bs, 1, MPI_LONG, 0, 0, world); diff --git a/src/ML-IAP/compute_mliap.h b/src/ML-IAP/compute_mliap.h index db1b6c0449..05e0b33d2f 100644 --- a/src/ML-IAP/compute_mliap.h +++ b/src/ML-IAP/compute_mliap.h @@ -60,25 +60,3 @@ class ComputeMLIAP : public Compute { #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 snap requires a pair style be defined - -Self-explanatory. - -E: Compute snap cutoff is longer than pairwise cutoff - -UNDOCUMENTED - -W: More than one compute snad/atom - -Self-explanatory. - -*/ diff --git a/src/ML-IAP/mliap_descriptor_snap.cpp b/src/ML-IAP/mliap_descriptor_snap.cpp index 7badf7b641..b2568d3a4d 100644 --- a/src/ML-IAP/mliap_descriptor_snap.cpp +++ b/src/ML-IAP/mliap_descriptor_snap.cpp @@ -416,7 +416,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) if ((keywd == "elems") || (keywd == "radelems") || (keywd == "welems") || (keywd == "rinnerelems") || (keywd == "drinnerelems")) { - if ((nelementsflag == 0) || ((int)words.count() != nelements + 1)) + if ((nelementsflag == 0) || ((int) words.count() != nelements + 1)) error->all(FLERR, "Incorrect SNAP parameter file"); if (comm->me == 0) utils::logmesg(lmp, "SNAP keyword {} \n", utils::trim(line)); diff --git a/src/ML-IAP/mliap_descriptor_snap.h b/src/ML-IAP/mliap_descriptor_snap.h index 2136eefc5e..0e217f82fa 100644 --- a/src/ML-IAP/mliap_descriptor_snap.h +++ b/src/ML-IAP/mliap_descriptor_snap.h @@ -42,8 +42,8 @@ class MLIAPDescriptorSNAP : public MLIAPDescriptor { int switchinnerflag; double rfac0, rmin0; - double* rinnerelem; - double* drinnerelem; + double *rinnerelem; + double *drinnerelem; }; } // namespace LAMMPS_NS diff --git a/src/ML-IAP/mliap_descriptor_so3.cpp b/src/ML-IAP/mliap_descriptor_so3.cpp index 48748d8565..21e1e5c5d0 100644 --- a/src/ML-IAP/mliap_descriptor_so3.cpp +++ b/src/ML-IAP/mliap_descriptor_so3.cpp @@ -125,7 +125,7 @@ void MLIAPDescriptorSO3::read_paramfile(char *paramfilename) // check for keywords with one value per element - if ((skeywd == "elems") || (skeywd == "radelems") || (skeywd == "welems")) { + if ((skeywd == "elems") || (skeywd == "radelems") || (skeywd == "welems")) { if (nelementsflag == 0 || nwords != nelements + 1) error->all(FLERR, "Incorrect SO3 parameter file"); @@ -137,7 +137,7 @@ void MLIAPDescriptorSO3::read_paramfile(char *paramfilename) } elementsflag = 1; - } else if (skeywd == "radelems") { + } else if (skeywd == "radelems") { for (int ielem = 0; ielem < nelements; ielem++) { radelem[ielem] = utils::numeric(FLERR, skeyval, false, lmp); if (ielem < nelements - 1) skeyval = p.next(); diff --git a/src/ML-IAP/mliap_model_python.cpp b/src/ML-IAP/mliap_model_python.cpp index 878d234c69..8f88fb319d 100644 --- a/src/ML-IAP/mliap_model_python.cpp +++ b/src/ML-IAP/mliap_model_python.cpp @@ -62,7 +62,9 @@ MLIAPModelPython::MLIAPModelPython(LAMMPS *lmp, char *coefffilename) : // if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well const char *potentials_path = getenv("LAMMPS_POTENTIALS"); - if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); } + if (potentials_path != nullptr) { + PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); + } PyGILState_Release(gstate); if (coefffilename) read_coeffs(coefffilename); diff --git a/src/ML-IAP/mliap_so3.cpp b/src/ML-IAP/mliap_so3.cpp index 0733ffa198..55418c9821 100644 --- a/src/ML-IAP/mliap_so3.cpp +++ b/src/ML-IAP/mliap_so3.cpp @@ -369,16 +369,16 @@ void MLIAP_SO3::compute_W(int nmax, double *arr) } int i, j, k, n = nmax; - double *outeig = new double[n]; - double *outeigvec = new double[n * n]; - double *arrinv = new double[n * n]; + auto outeig = new double[n]; + auto outeigvec = new double[n * n]; + auto arrinv = new double[n * n]; - double *sqrtD = new double[n * n]; - double *tempM = new double[n * n]; + auto sqrtD = new double[n * n]; + auto tempM = new double[n * n]; - double **temparr = new double *[n]; - double **tempvl = new double *[n]; - double *tempout = new double[n]; + auto temparr = new double *[n]; + auto tempvl = new double *[n]; + auto tempout = new double[n]; int info; diff --git a/src/ML-PACE/pair_pace.cpp b/src/ML-PACE/pair_pace.cpp index fca66fd328..11e8a659a5 100644 --- a/src/ML-PACE/pair_pace.cpp +++ b/src/ML-PACE/pair_pace.cpp @@ -221,7 +221,7 @@ void PairPACE::compute(int eflag, int vflag) // tally energy contribution if (eflag) { // evdwl = energy of atom I - evdwl = scale[itype][itype]*aceimpl->ace->e_atom; + evdwl = scale[itype][itype] * aceimpl->ace->e_atom; ev_tally_full(i, 2.0 * evdwl, 0.0, 0.0, 0.0, 0.0, 0.0); } } diff --git a/src/ML-RANN/rann_fingerprint_bondscreenedspin.h b/src/ML-RANN/rann_fingerprint_bondscreenedspin.h index 5d52a18926..227938a668 100644 --- a/src/ML-RANN/rann_fingerprint_bondscreenedspin.h +++ b/src/ML-RANN/rann_fingerprint_bondscreenedspin.h @@ -46,7 +46,8 @@ namespace RANN { void allocate() override; void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, - bool *, int, int, double *, double *, double *, int *, int, int *) override; + bool *, int, int, double *, double *, double *, int *, int, + int *) override; void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, bool *, int, diff --git a/src/ML-RANN/rann_fingerprint_bondspin.h b/src/ML-RANN/rann_fingerprint_bondspin.h index fb97893c8d..daa873a494 100644 --- a/src/ML-RANN/rann_fingerprint_bondspin.h +++ b/src/ML-RANN/rann_fingerprint_bondspin.h @@ -43,9 +43,9 @@ namespace RANN { void write_values(FILE *) override; void init(int *, int) override; void allocate() override; - void compute_fingerprint(double *, double *, double *, double *, double *, double *, - double *, int, int, double *, double *, double *, int *, int, - int *) override; //spin + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, + int, int, double *, double *, double *, int *, int, + int *) override; //spin void do3bodyfeatureset_doubleneighborloop(double *, double *, double *, double *, double *, double *, double *, int, int, double *, double *, double *, int *, int, int *); diff --git a/src/ML-RANN/rann_fingerprint_radialscreenedspin.h b/src/ML-RANN/rann_fingerprint_radialscreenedspin.h index 0ea498cf23..38f6ae5c6d 100644 --- a/src/ML-RANN/rann_fingerprint_radialscreenedspin.h +++ b/src/ML-RANN/rann_fingerprint_radialscreenedspin.h @@ -43,10 +43,10 @@ namespace RANN { void write_values(FILE *) override; void init(int *, int) override; void allocate() override; - void compute_fingerprint(double *, double *, double *, double *, double *, double *, - double *, double *, double *, double *, double *, double *, - double *, double *, bool *, int, int, double *, double *, - double *, int *, int, int *) override; //spin,screen + void compute_fingerprint(double *, double *, double *, double *, double *, double *, double *, + double *, double *, double *, double *, double *, double *, double *, + bool *, int, int, double *, double *, double *, int *, int, + int *) override; //spin,screen int get_length() override; double *radialtable; diff --git a/src/ML-SNAP/compute_sna_atom.h b/src/ML-SNAP/compute_sna_atom.h index 5e62fe47d9..ffb88d4df3 100644 --- a/src/ML-SNAP/compute_sna_atom.h +++ b/src/ML-SNAP/compute_sna_atom.h @@ -56,25 +56,3 @@ class ComputeSNAAtom : public Compute { #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 sna/atom requires a pair style be defined - -Self-explanatory. - -E: Compute sna/atom cutoff is longer than pairwise cutoff - -Self-explanatory. - -W: More than one compute sna/atom - -Self-explanatory. - -*/ diff --git a/src/ML-SNAP/compute_snad_atom.h b/src/ML-SNAP/compute_snad_atom.h index c03458446f..0951dabb0d 100644 --- a/src/ML-SNAP/compute_snad_atom.h +++ b/src/ML-SNAP/compute_snad_atom.h @@ -58,29 +58,3 @@ class ComputeSNADAtom : public Compute { #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 snad/atom requires a pair style be defined - -Self-explanatory. - -E: Compute sna/atom cutoff is longer than pairwise cutoff - -UNDOCUMENTED - -W: More than one compute snad/atom - -Self-explanatory. - -U: Compute snad/atom cutoff is longer than pairwise cutoff - -Self-explanatory. - -*/ diff --git a/src/ML-SNAP/compute_snap.h b/src/ML-SNAP/compute_snap.h index fa31de747d..562002dcf3 100644 --- a/src/ML-SNAP/compute_snap.h +++ b/src/ML-SNAP/compute_snap.h @@ -65,25 +65,3 @@ class ComputeSnap : public Compute { #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 snap requires a pair style be defined - -Self-explanatory. - -E: Compute snap cutoff is longer than pairwise cutoff - -UNDOCUMENTED - -W: More than one compute snad/atom - -Self-explanatory. - -*/ diff --git a/src/ML-SNAP/compute_snav_atom.h b/src/ML-SNAP/compute_snav_atom.h index be442f3a49..a261507601 100644 --- a/src/ML-SNAP/compute_snav_atom.h +++ b/src/ML-SNAP/compute_snav_atom.h @@ -57,25 +57,3 @@ class ComputeSNAVAtom : public Compute { #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 snav/atom requires a pair style be defined - -Self-explanatory. - -E: Compute snav/atom cutoff is longer than pairwise cutoff - -Self-explanatory. - -W: More than one compute snav/atom - -Self-explanatory. - -*/ diff --git a/src/ML-SNAP/pair_snap.cpp b/src/ML-SNAP/pair_snap.cpp index ed30bd714e..208857cd90 100644 --- a/src/ML-SNAP/pair_snap.cpp +++ b/src/ML-SNAP/pair_snap.cpp @@ -692,7 +692,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (keywd == "rinner" || keywd == "drinner") { - if (nwords != nelements+1) + if ((int)words.size() != nelements+1) error->all(FLERR,"Incorrect SNAP parameter file"); if (comm->me == 0) @@ -703,7 +703,6 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (keywd == "rinner") { keyval = words[iword]; for (int ielem = 0; ielem < nelements; ielem++) { - printf("rinnerelem = %p ielem = %d nelements = %d iword = %d nwords = %d\n",rinnerelem, ielem, nelements, iword, nwords); rinnerelem[ielem] = utils::numeric(FLERR,keyval,false,lmp); iword++; } diff --git a/src/ML-SNAP/pair_snap.h b/src/ML-SNAP/pair_snap.h index 77ceeabd4f..3ba492615b 100644 --- a/src/ML-SNAP/pair_snap.h +++ b/src/ML-SNAP/pair_snap.h @@ -62,7 +62,7 @@ class PairSNAP : public Pair { int switchinnerflag; // inner cutoff switch double *rinnerelem; // element inner cutoff double *drinnerelem; // element inner cutoff range - int chunksize,parallel_thresh; + int chunksize, parallel_thresh; double rfac0, rmin0, wj1, wj2; int rcutfacflag, twojmaxflag; // flags for required parameters int beta_max; // length of beta @@ -72,63 +72,3 @@ class PairSNAP : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Communication cutoff too small for SNAP micro load balancing - -This can happen if you change the neighbor skin after your pair_style -command or if your box dimensions grow during a run. You can set the -cutoff explicitly via the comm_modify cutoff command. - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect SNAP coeff file - -UNDOCUMENTED - -E: Incorrect SNAP parameter file - -The file cannot be parsed correctly, check its internal syntax. - -E: Pair style SNAP requires newton pair on - -See the newton command. This is a restriction to use the SNAP -potential. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open SNAP coefficient file %s - -The specified SNAP coefficient file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in SNAP coefficient file - -Incorrect number of words per line in the coefficient file. - -E: Cannot open SNAP parameter file %s - -The specified SNAP parameter file cannot be opened. Check that the -path and name are correct. - -E: Incorrect format in SNAP parameter file - -Incorrect number of words per line in the parameter file. - -E: Did not find all elements in SNAP coefficient file. - -One or more elements listed in the pair_coeff command were not found in the coefficient file. - -*/ diff --git a/src/ML-SNAP/sna.h b/src/ML-SNAP/sna.h index 03d77d52b4..b04e9dcade 100644 --- a/src/ML-SNAP/sna.h +++ b/src/ML-SNAP/sna.h @@ -71,21 +71,21 @@ class SNA : protected Pointers { // short neighbor list data void grow_rij(int); - int nmax; // allocated size of short lists + int nmax; // allocated size of short lists - double **rij; // short rij list - int *inside; // short neighbor list - double *wj; // short weight list - double *rcutij; // short cutoff list + double **rij; // short rij list + int *inside; // short neighbor list + double *wj; // short weight list + double *rcutij; // short cutoff list // only allocated for switch_inner_flag=1 - double *rinnerij; // short inner cutoff list - double *drinnerij;// short inner range list + double *rinnerij; // short inner cutoff list + double *drinnerij; // short inner range list // only allocated for chem_flag=1 - int *element; // short element list [0,nelements) + int *element; // short element list [0,nelements) private: double rmin0, rfac0; @@ -100,7 +100,7 @@ class SNA : protected Pointers { int ***idxcg_block; double *ulisttot_r, *ulisttot_i; - double **ulist_r_ij, **ulist_i_ij; // short u list + double **ulist_r_ij, **ulist_i_ij; // short u list int *idxu_block; double *zlist_r, *zlist_i; @@ -124,8 +124,7 @@ class SNA : protected Pointers { void compute_uarray(double, double, double, double, double, int); double deltacg(int, int, int); void compute_ncoeff(); - void compute_duarray(double, double, double, double, double, double, - double, double, int); + void compute_duarray(double, double, double, double, double, double, double, double, int); // Sets the style for the switching function // 0 = none @@ -153,12 +152,3 @@ class SNA : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid argument to factorial %d - -N must be >= 0 and <= 167, otherwise the factorial result is too -large. - -*/ diff --git a/src/MOFFF/angle_class2_p6.h b/src/MOFFF/angle_class2_p6.h index b4f2e9ff6a..eb1a11e22c 100644 --- a/src/MOFFF/angle_class2_p6.h +++ b/src/MOFFF/angle_class2_p6.h @@ -49,11 +49,3 @@ class AngleClass2P6 : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOFFF/angle_cosine_buck6d.h b/src/MOFFF/angle_cosine_buck6d.h index 268ae71141..9d14e2d556 100644 --- a/src/MOFFF/angle_cosine_buck6d.h +++ b/src/MOFFF/angle_cosine_buck6d.h @@ -51,11 +51,3 @@ class AngleCosineBuck6d : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOFFF/pair_buck6d_coul_gauss_dsf.h b/src/MOFFF/pair_buck6d_coul_gauss_dsf.h index 5d3a642180..bbedaadf2e 100644 --- a/src/MOFFF/pair_buck6d_coul_gauss_dsf.h +++ b/src/MOFFF/pair_buck6d_coul_gauss_dsf.h @@ -59,21 +59,3 @@ class PairBuck6dCoulGaussDSF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/dsf requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/MOFFF/pair_buck6d_coul_gauss_long.h b/src/MOFFF/pair_buck6d_coul_gauss_long.h index 28cc6e3bb7..621269b862 100644 --- a/src/MOFFF/pair_buck6d_coul_gauss_long.h +++ b/src/MOFFF/pair_buck6d_coul_gauss_long.h @@ -60,21 +60,3 @@ class PairBuck6dCoulGaussLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/dsf requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/MOLECULE/angle_charmm.h b/src/MOLECULE/angle_charmm.h index f864573ce7..dcfcbd001a 100644 --- a/src/MOLECULE/angle_charmm.h +++ b/src/MOLECULE/angle_charmm.h @@ -46,11 +46,3 @@ class AngleCharmm : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index d32dc4559d..7ef81ef808 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -29,7 +29,10 @@ using MathConst::MY_PI; /* ---------------------------------------------------------------------- */ -AngleCosine::AngleCosine(LAMMPS *_lmp) : Angle(_lmp) {} +AngleCosine::AngleCosine(LAMMPS *_lmp) : Angle(_lmp) +{ + born_matrix_enable = 1; +} /* ---------------------------------------------------------------------- */ @@ -234,3 +237,22 @@ double AngleCosine::single(int type, int i1, int i2, int i3) return k[type] * (1.0 + c); } + +/* ---------------------------------------------------------------------- */ + +void AngleCosine::born_matrix(int type, int /*i1*/, int /*i2*/, int /*i3*/, double &du, double &du2) +{ + du2 = 0; + du = k[type]; +} + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleCosine::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + return nullptr; +} diff --git a/src/MOLECULE/angle_cosine.h b/src/MOLECULE/angle_cosine.h index 19b6222c87..cbfbf47e91 100644 --- a/src/MOLECULE/angle_cosine.h +++ b/src/MOLECULE/angle_cosine.h @@ -35,6 +35,8 @@ class AngleCosine : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; + void *extract(const char *, int &) override; protected: double *k; @@ -46,11 +48,3 @@ class AngleCosine : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 262f345118..39238463df 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -38,6 +38,7 @@ AngleCosineSquared::AngleCosineSquared(LAMMPS *_lmp) : Angle(_lmp) { k = nullptr; theta0 = nullptr; + born_matrix_enable = 1; } /* ---------------------------------------------------------------------- */ @@ -262,3 +263,31 @@ double AngleCosineSquared::single(int type, int i1, int i2, int i3) double tk = k[type] * dcostheta; return tk * dcostheta; } + +/* ---------------------------------------------------------------------- */ + +void AngleCosineSquared::born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) +{ + double **x = atom->x; + + double delx1 = x[i1][0] - x[i2][0]; + double dely1 = x[i1][1] - x[i2][1]; + double delz1 = x[i1][2] - x[i2][2]; + domain->minimum_image(delx1, dely1, delz1); + double r1 = sqrt(delx1 * delx1 + dely1 * dely1 + delz1 * delz1); + + double delx2 = x[i3][0] - x[i2][0]; + double dely2 = x[i3][1] - x[i2][1]; + double delz2 = x[i3][2] - x[i2][2]; + domain->minimum_image(delx2, dely2, delz2); + double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); + + double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; + c /= r1 * r2; + if (c > 1.0) c = 1.0; + if (c < -1.0) c = -1.0; + + double dcostheta = c - cos(theta0[type]); + du2 = 2 * k[type]; + du = du2 * dcostheta; +} diff --git a/src/MOLECULE/angle_cosine_squared.h b/src/MOLECULE/angle_cosine_squared.h index d8f282ac47..a4529d550b 100644 --- a/src/MOLECULE/angle_cosine_squared.h +++ b/src/MOLECULE/angle_cosine_squared.h @@ -35,6 +35,7 @@ class AngleCosineSquared : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void born_matrix(int type, int i1, int i2, int i3, double &du, double &du2) override; protected: double *k, *theta0; @@ -46,11 +47,3 @@ class AngleCosineSquared : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index 261770d9a3..aa24fa27b4 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -264,3 +264,15 @@ double AngleHarmonic::single(int type, int i1, int i2, int i3) double tk = k[type] * dtheta; return tk * dtheta; } + +/* ---------------------------------------------------------------------- + return ptr to internal members upon request +------------------------------------------------------------------------ */ + +void *AngleHarmonic::extract(const char *str, int &dim) +{ + dim = 1; + if (strcmp(str, "k") == 0) return (void *) k; + if (strcmp(str, "theta0") == 0) return (void *) theta0; + return nullptr; +} diff --git a/src/MOLECULE/angle_harmonic.h b/src/MOLECULE/angle_harmonic.h index 718ac4bd0a..a27f26c53d 100644 --- a/src/MOLECULE/angle_harmonic.h +++ b/src/MOLECULE/angle_harmonic.h @@ -35,6 +35,7 @@ class AngleHarmonic : public Angle { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, int, int, int) override; + void *extract(const char *, int &) override; protected: double *k, *theta0; @@ -46,11 +47,3 @@ class AngleHarmonic : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 3ba430bb5c..eeb30c4d64 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -574,7 +574,7 @@ void AngleTable::spline(double *x, double *y, int n, double yp1, double ypn, dou { int i, k; double p, qn, sig, un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e300) y2[0] = u[0] = 0.0; diff --git a/src/MOLECULE/angle_table.h b/src/MOLECULE/angle_table.h index 83a53ecdd5..1917908015 100644 --- a/src/MOLECULE/angle_table.h +++ b/src/MOLECULE/angle_table.h @@ -75,51 +75,3 @@ class AngleTable : public Angle { #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: Unknown table style in angle style table - -Self-explanatory. - -E: Illegal number of angle table entries - -There must be at least 2 table entries. - -E: Invalid angle table length - -Length must be 2 or greater. - -E: Angle table must range from 0 to 180 degrees - -Self-explanatory. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Invalid keyword in angle table parameters - -Self-explanatory. - -E: Angle table parameters did not set N - -List of angle table parameters must include N setting. - -E: Illegal angle in angle style table - -UNDOCUMENTED - -*/ diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 06a4f441ca..366e1d1a9e 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -32,26 +31,22 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 nspecial special"; - fields_copy = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 nspecial special"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "molecule"; - fields_border_vel = (char *) "molecule"; - fields_exchange = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 nspecial special"; - fields_restart = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3"; - fields_create = (char *) "molecule num_bond num_angle nspecial"; - fields_data_atom = (char *) "id molecule type x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"molecule", "num_bond", "bond_type", "bond_atom", + "num_angle", "angle_type", "angle_atom1", "angle_atom2", + "angle_atom3", "nspecial", "special"}; + fields_copy = {"molecule", "num_bond", "bond_type", "bond_atom", + "num_angle", "angle_type", "angle_atom1", "angle_atom2", + "angle_atom3", "nspecial", "special"}; + fields_border = {"molecule"}; + fields_border_vel = {"molecule"}; + fields_exchange = {"molecule", "num_bond", "bond_type", "bond_atom", + "num_angle", "angle_type", "angle_atom1", "angle_atom2", + "angle_atom3", "nspecial", "special"}; + fields_restart = {"molecule", "num_bond", "bond_type", "bond_atom", "num_angle", + "angle_type", "angle_atom1", "angle_atom2", "angle_atom3"}; + fields_create = {"molecule", "num_bond", "num_angle", "nspecial"}; + fields_data_atom = {"id", "molecule", "type", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); @@ -63,8 +58,8 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp) AtomVecAngle::~AtomVecAngle() { - delete [] bond_negative; - delete [] angle_negative; + delete[] bond_negative; + delete[] angle_negative; } /* ---------------------------------------------------------------------- @@ -90,12 +85,12 @@ void AtomVecAngle::pack_restart_pre(int ilocal) // insure negative vectors are needed length if (bond_per_atom < atom->bond_per_atom) { - delete [] bond_negative; + delete[] bond_negative; bond_per_atom = atom->bond_per_atom; bond_negative = new int[bond_per_atom]; } if (angle_per_atom < atom->angle_per_atom) { - delete [] angle_negative; + delete[] angle_negative; angle_per_atom = atom->angle_per_atom; angle_negative = new int[angle_per_atom]; } @@ -108,7 +103,8 @@ void AtomVecAngle::pack_restart_pre(int ilocal) bond_negative[m] = 1; bond_type[ilocal][m] = -bond_type[ilocal][m]; any_bond_negative = 1; - } else bond_negative[m] = 0; + } else + bond_negative[m] = 0; } any_angle_negative = 0; @@ -117,7 +113,8 @@ void AtomVecAngle::pack_restart_pre(int ilocal) angle_negative[m] = 1; angle_type[ilocal][m] = -angle_type[ilocal][m]; any_angle_negative = 1; - } else angle_negative[m] = 0; + } else + angle_negative[m] = 0; } } diff --git a/src/MOLECULE/atom_vec_angle.h b/src/MOLECULE/atom_vec_angle.h index 89d810063f..f7b9bc453a 100644 --- a/src/MOLECULE/atom_vec_angle.h +++ b/src/MOLECULE/atom_vec_angle.h @@ -49,7 +49,3 @@ class AtomVecAngle : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index acd0bc9979..29a1a0f4e4 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -32,21 +31,15 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "molecule num_bond bond_type bond_atom nspecial special"; - fields_copy = (char *) - "molecule num_bond bond_type bond_atom nspecial special"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "molecule"; - fields_border_vel = (char *) "molecule"; - fields_exchange = (char *) - "molecule num_bond bond_type bond_atom nspecial special"; - fields_restart = (char *) "molecule num_bond bond_type bond_atom"; - fields_create = (char *) "molecule num_bond nspecial"; - fields_data_atom = (char *) "id molecule type x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"molecule", "num_bond", "bond_type", "bond_atom", "nspecial", "special"}; + fields_copy = {"molecule", "num_bond", "bond_type", "bond_atom", "nspecial", "special"}; + fields_border = {"molecule"}; + fields_border_vel = {"molecule"}; + fields_exchange = {"molecule", "num_bond", "bond_type", "bond_atom", "nspecial", "special"}; + fields_restart = {"molecule", "num_bond", "bond_type", "bond_atom"}; + fields_create = {"molecule", "num_bond", "nspecial"}; + fields_data_atom = {"id", "molecule", "type", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); @@ -58,7 +51,7 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp) AtomVecBond::~AtomVecBond() { - delete [] bond_negative; + delete[] bond_negative; } /* ---------------------------------------------------------------------- @@ -82,7 +75,7 @@ void AtomVecBond::pack_restart_pre(int ilocal) // insure bond_negative vector is needed length if (bond_per_atom < atom->bond_per_atom) { - delete [] bond_negative; + delete[] bond_negative; bond_per_atom = atom->bond_per_atom; bond_negative = new int[bond_per_atom]; } @@ -95,7 +88,8 @@ void AtomVecBond::pack_restart_pre(int ilocal) bond_negative[m] = 1; bond_type[ilocal][m] = -bond_type[ilocal][m]; any_bond_negative = 1; - } else bond_negative[m] = 0; + } else + bond_negative[m] = 0; } } diff --git a/src/MOLECULE/atom_vec_bond.h b/src/MOLECULE/atom_vec_bond.h index 3c9e429ada..98320dcab4 100644 --- a/src/MOLECULE/atom_vec_bond.h +++ b/src/MOLECULE/atom_vec_bond.h @@ -49,7 +49,3 @@ class AtomVecBond : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index e88c4d7a62..a78f3616a4 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -32,47 +31,31 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special"; - fields_copy = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "q molecule"; - fields_border_vel = (char *) "q molecule"; - fields_exchange = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special"; - fields_restart = (char *) - "q molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4"; - fields_create = (char *) - "q molecule num_bond num_angle num_dihedral num_improper nspecial"; - fields_data_atom = (char *) "id molecule type q x"; - fields_data_vel = (char *) "id v"; - + // clang-format off + fields_grow = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special"}; + fields_copy = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special"}; + fields_border = {"q", "molecule"}; + fields_border_vel = {"q", "molecule"}; + fields_exchange = {"q", "molecule", "num_bond", "bond_type", "bond_atom", + "num_angle", "angle_type", "angle_atom1", "angle_atom2", "angle_atom3", + "num_dihedral", "dihedral_type", "dihedral_atom1", "dihedral_atom2", + "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", "improper_atom1", + "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special"}; + fields_restart = {"q", "molecule", "num_bond", "bond_type", "bond_atom", "num_angle", + "angle_type", "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", + "dihedral_atom1", "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", + "improper_type", "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4"}; + fields_create = {"q", "molecule", "num_bond", "num_angle", + "num_dihedral", "num_improper", "nspecial"}; + fields_data_atom = {"id", "molecule", "type", "q", "x"}; + fields_data_vel = {"id", "v"}; + // clang-format on setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; @@ -83,10 +66,10 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp) AtomVecFull::~AtomVecFull() { - delete [] bond_negative; - delete [] angle_negative; - delete [] dihedral_negative; - delete [] improper_negative; + delete[] bond_negative; + delete[] angle_negative; + delete[] dihedral_negative; + delete[] improper_negative; } /* ---------------------------------------------------------------------- @@ -116,22 +99,22 @@ void AtomVecFull::pack_restart_pre(int ilocal) // insure negative vectors are needed length if (bond_per_atom < atom->bond_per_atom) { - delete [] bond_negative; + delete[] bond_negative; bond_per_atom = atom->bond_per_atom; bond_negative = new int[bond_per_atom]; } if (angle_per_atom < atom->angle_per_atom) { - delete [] angle_negative; + delete[] angle_negative; angle_per_atom = atom->angle_per_atom; angle_negative = new int[angle_per_atom]; } if (dihedral_per_atom < atom->dihedral_per_atom) { - delete [] dihedral_negative; + delete[] dihedral_negative; dihedral_per_atom = atom->dihedral_per_atom; dihedral_negative = new int[dihedral_per_atom]; } if (improper_per_atom < atom->improper_per_atom) { - delete [] improper_negative; + delete[] improper_negative; improper_per_atom = atom->improper_per_atom; improper_negative = new int[improper_per_atom]; } @@ -144,7 +127,8 @@ void AtomVecFull::pack_restart_pre(int ilocal) bond_negative[m] = 1; bond_type[ilocal][m] = -bond_type[ilocal][m]; any_bond_negative = 1; - } else bond_negative[m] = 0; + } else + bond_negative[m] = 0; } any_angle_negative = 0; @@ -153,7 +137,8 @@ void AtomVecFull::pack_restart_pre(int ilocal) angle_negative[m] = 1; angle_type[ilocal][m] = -angle_type[ilocal][m]; any_angle_negative = 1; - } else angle_negative[m] = 0; + } else + angle_negative[m] = 0; } any_dihedral_negative = 0; @@ -162,7 +147,8 @@ void AtomVecFull::pack_restart_pre(int ilocal) dihedral_negative[m] = 1; dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; any_dihedral_negative = 1; - } else dihedral_negative[m] = 0; + } else + dihedral_negative[m] = 0; } any_improper_negative = 0; @@ -171,7 +157,8 @@ void AtomVecFull::pack_restart_pre(int ilocal) improper_negative[m] = 1; improper_type[ilocal][m] = -improper_type[ilocal][m]; any_improper_negative = 1; - } else improper_negative[m] = 0; + } else + improper_negative[m] = 0; } } @@ -195,14 +182,12 @@ void AtomVecFull::pack_restart_post(int ilocal) if (any_dihedral_negative) { for (int m = 0; m < num_dihedral[ilocal]; m++) - if (dihedral_negative[m]) - dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; + if (dihedral_negative[m]) dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; } if (any_improper_negative) { for (int m = 0; m < num_improper[ilocal]; m++) - if (improper_negative[m]) - improper_type[ilocal][m] = -improper_type[ilocal][m]; + if (improper_negative[m]) improper_type[ilocal][m] = -improper_type[ilocal][m]; } } diff --git a/src/MOLECULE/atom_vec_full.h b/src/MOLECULE/atom_vec_full.h index a337ad3244..6acdb6faa9 100644 --- a/src/MOLECULE/atom_vec_full.h +++ b/src/MOLECULE/atom_vec_full.h @@ -49,7 +49,3 @@ class AtomVecFull : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 9cb3f53f5a..72f094d7c2 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -32,46 +31,29 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special"; - fields_copy = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "molecule"; - fields_border_vel = (char *) "molecule"; - fields_exchange = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4 " - "nspecial special"; - fields_restart = (char *) - "molecule num_bond bond_type bond_atom " - "num_angle angle_type angle_atom1 angle_atom2 angle_atom3 " - "num_dihedral dihedral_type dihedral_atom1 dihedral_atom2 " - "dihedral_atom3 dihedral_atom4 " - "num_improper improper_type improper_atom1 improper_atom2 " - "improper_atom3 improper_atom4"; - fields_create = (char *) - "molecule num_bond num_angle num_dihedral num_improper nspecial"; - fields_data_atom = (char *) "id molecule type x"; - fields_data_vel = (char *) "id v"; + // clang-format off + fields_grow = {"molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special"}; + fields_copy = {"molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special"}; + fields_border = {"molecule"}; + fields_border_vel = {"molecule"}; + fields_exchange = {"molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4", "nspecial", "special"}; + fields_restart = {"molecule", "num_bond", "bond_type", "bond_atom", "num_angle", "angle_type", + "angle_atom1", "angle_atom2", "angle_atom3", "num_dihedral", "dihedral_type", "dihedral_atom1", + "dihedral_atom2", "dihedral_atom3", "dihedral_atom4", "num_improper", "improper_type", + "improper_atom1", "improper_atom2", "improper_atom3", "improper_atom4"}; + fields_create = {"molecule", "num_bond", "num_angle", "num_dihedral", "num_improper", "nspecial"}; + fields_data_atom = {"id", "molecule", "type", "x"}; + fields_data_vel = {"id", "v"}; + // clang-format on setup_fields(); @@ -83,10 +65,10 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp) AtomVecMolecular::~AtomVecMolecular() { - delete [] bond_negative; - delete [] angle_negative; - delete [] dihedral_negative; - delete [] improper_negative; + delete[] bond_negative; + delete[] angle_negative; + delete[] dihedral_negative; + delete[] improper_negative; } /* ---------------------------------------------------------------------- @@ -116,22 +98,22 @@ void AtomVecMolecular::pack_restart_pre(int ilocal) // insure negative vectors are needed length if (bond_per_atom < atom->bond_per_atom) { - delete [] bond_negative; + delete[] bond_negative; bond_per_atom = atom->bond_per_atom; bond_negative = new int[bond_per_atom]; } if (angle_per_atom < atom->angle_per_atom) { - delete [] angle_negative; + delete[] angle_negative; angle_per_atom = atom->angle_per_atom; angle_negative = new int[angle_per_atom]; } if (dihedral_per_atom < atom->dihedral_per_atom) { - delete [] dihedral_negative; + delete[] dihedral_negative; dihedral_per_atom = atom->dihedral_per_atom; dihedral_negative = new int[dihedral_per_atom]; } if (improper_per_atom < atom->improper_per_atom) { - delete [] improper_negative; + delete[] improper_negative; improper_per_atom = atom->improper_per_atom; improper_negative = new int[improper_per_atom]; } @@ -144,7 +126,8 @@ void AtomVecMolecular::pack_restart_pre(int ilocal) bond_negative[m] = 1; bond_type[ilocal][m] = -bond_type[ilocal][m]; any_bond_negative = 1; - } else bond_negative[m] = 0; + } else + bond_negative[m] = 0; } any_angle_negative = 0; @@ -153,7 +136,8 @@ void AtomVecMolecular::pack_restart_pre(int ilocal) angle_negative[m] = 1; angle_type[ilocal][m] = -angle_type[ilocal][m]; any_angle_negative = 1; - } else angle_negative[m] = 0; + } else + angle_negative[m] = 0; } any_dihedral_negative = 0; @@ -162,7 +146,8 @@ void AtomVecMolecular::pack_restart_pre(int ilocal) dihedral_negative[m] = 1; dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; any_dihedral_negative = 1; - } else dihedral_negative[m] = 0; + } else + dihedral_negative[m] = 0; } any_improper_negative = 0; @@ -171,7 +156,8 @@ void AtomVecMolecular::pack_restart_pre(int ilocal) improper_negative[m] = 1; improper_type[ilocal][m] = -improper_type[ilocal][m]; any_improper_negative = 1; - } else improper_negative[m] = 0; + } else + improper_negative[m] = 0; } } @@ -195,14 +181,12 @@ void AtomVecMolecular::pack_restart_post(int ilocal) if (any_dihedral_negative) { for (int m = 0; m < num_dihedral[ilocal]; m++) - if (dihedral_negative[m]) - dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; + if (dihedral_negative[m]) dihedral_type[ilocal][m] = -dihedral_type[ilocal][m]; } if (any_improper_negative) { for (int m = 0; m < num_improper[ilocal]; m++) - if (improper_negative[m]) - improper_type[ilocal][m] = -improper_type[ilocal][m]; + if (improper_negative[m]) improper_type[ilocal][m] = -improper_type[ilocal][m]; } } diff --git a/src/MOLECULE/atom_vec_molecular.h b/src/MOLECULE/atom_vec_molecular.h index 9428a8491a..64e346e61f 100644 --- a/src/MOLECULE/atom_vec_molecular.h +++ b/src/MOLECULE/atom_vec_molecular.h @@ -49,7 +49,3 @@ class AtomVecMolecular : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/MOLECULE/atom_vec_template.cpp b/src/MOLECULE/atom_vec_template.cpp index 919f5c9aec..8202ea77f3 100644 --- a/src/MOLECULE/atom_vec_template.cpp +++ b/src/MOLECULE/atom_vec_template.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -36,18 +35,15 @@ AtomVecTemplate::AtomVecTemplate(LAMMPS *lmp) : AtomVec(lmp) // order of fields in the string does not matter // except fields_data_atom and fields_data_vel which must match data file - fields_grow = (char *) "molecule molindex molatom"; - fields_copy = (char *) "molecule molindex molatom"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "molecule molindex molatom"; - fields_border_vel = (char *) "molecule molindex molatom"; - fields_exchange = (char *) "molecule molindex molatom"; - fields_restart = (char *) "molecule molindex molatom"; - fields_create = (char *) "molecule molindex molatom"; - fields_data_atom = (char *) "id molecule molindex molatom type x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"molecule", "molindex", "molatom"}; + fields_copy = {"molecule", "molindex", "molatom"}; + fields_border = {"molecule", "molindex", "molatom"}; + fields_border_vel = {"molecule", "molindex", "molatom"}; + fields_exchange = {"molecule", "molindex", "molatom"}; + fields_restart = {"molecule", "molindex", "molatom"}; + fields_create = {"molecule", "molindex", "molatom"}; + fields_data_atom = {"id", "molecule", "molindex", "molatom", "type", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -58,11 +54,10 @@ AtomVecTemplate::AtomVecTemplate(LAMMPS *lmp) : AtomVec(lmp) void AtomVecTemplate::process_args(int narg, char **arg) { - if (narg != 1) error->all(FLERR,"Illegal atom_style template command"); + if (narg != 1) error->all(FLERR, "Illegal atom_style template command"); int imol = atom->find_molecule(arg[0]); - if (imol == -1) error->all(FLERR,"Molecule template ID for " - "atom_style template does not exist"); + if (imol == -1) error->all(FLERR, "Molecule template ID for atom_style template does not exist"); onemols = &atom->molecules[imol]; nset = atom->molecules[imol]->nset; @@ -81,10 +76,10 @@ void AtomVecTemplate::process_args(int narg, char **arg) // do this here b/c data file will typically not contain these settings for (int i = 0; i < nset; i++) { - atom->nbondtypes = MAX(atom->nbondtypes,onemols[i]->nbondtypes); - atom->nangletypes = MAX(atom->nangletypes,onemols[i]->nangletypes); - atom->ndihedraltypes = MAX(atom->ndihedraltypes,onemols[i]->ndihedraltypes); - atom->nimpropertypes = MAX(atom->nimpropertypes,onemols[i]->nimpropertypes); + atom->nbondtypes = MAX(atom->nbondtypes, onemols[i]->nbondtypes); + atom->nangletypes = MAX(atom->nangletypes, onemols[i]->nangletypes); + atom->ndihedraltypes = MAX(atom->ndihedraltypes, onemols[i]->ndihedraltypes); + atom->nimpropertypes = MAX(atom->nimpropertypes, onemols[i]->nimpropertypes); } } @@ -129,7 +124,6 @@ void AtomVecTemplate::pack_data_post(int ilocal) molatom[ilocal]--; } - /* ---------------------------------------------------------------------- modify what AtomVec::data_atom() just unpacked or initialize other atom quantities @@ -141,7 +135,7 @@ void AtomVecTemplate::data_atom_post(int ilocal) int molatom_one = --molatom[ilocal]; if ((molindex_one < -1) || (molindex_one >= nset)) - error->one(FLERR,"Invalid template index in Atoms section of data file"); + error->one(FLERR, "Invalid template index in Atoms section of data file"); if ((molatom_one < -1) || ((molindex_one >= 0) && (molatom_one >= onemols[molindex_one]->natoms))) - error->one(FLERR,"Invalid template atom in Atoms section of data file"); + error->one(FLERR, "Invalid template atom in Atoms section of data file"); } diff --git a/src/MOLECULE/atom_vec_template.h b/src/MOLECULE/atom_vec_template.h index 2d7a2e12ac..7653e12cc9 100644 --- a/src/MOLECULE/atom_vec_template.h +++ b/src/MOLECULE/atom_vec_template.h @@ -43,31 +43,3 @@ class AtomVecTemplate : public AtomVec { #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: Molecule template ID for atom_style template does not exist - -Self-explanatory. - -E: Atom style template molecule must have atom types - -The defined molecule(s) does not specify atom types. - -E: Invalid template index in Atoms section of data file - -The template indices must be between 1 to N, where N is the number of -molecules in the template. - -E: Invalid template atom in Atoms section of data file - -The atom indices must be between 1 to N, where N is the number of -atoms in the template molecule the atom belongs to. - -*/ diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index 8daf6e862c..2950d48ca6 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -265,7 +265,7 @@ double BondFENE::single(int type, double rsq, int /*i*/, int /*j*/, double &ffor void *BondFENE::extract(const char *str, int &dim) { dim = 1; - if (strcmp(str, "kappa") == 0) return (void *) k; + if (strcmp(str, "k") == 0) return (void *) k; if (strcmp(str, "r0") == 0) return (void *) r0; return nullptr; } diff --git a/src/MOLECULE/bond_fene.h b/src/MOLECULE/bond_fene.h index 4ff4d8b3f3..d205a0ef0f 100644 --- a/src/MOLECULE/bond_fene.h +++ b/src/MOLECULE/bond_fene.h @@ -48,30 +48,3 @@ class BondFENE : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -W: FENE bond too long: %ld %d %d %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -W: Use special bonds = 0,1,1 with bond style fene - -Most FENE models need this setting for the special_bonds command. - -W: FENE bond too long: %ld %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -*/ diff --git a/src/MOLECULE/bond_fene_expand.h b/src/MOLECULE/bond_fene_expand.h index cde62f1570..7e88da422c 100644 --- a/src/MOLECULE/bond_fene_expand.h +++ b/src/MOLECULE/bond_fene_expand.h @@ -47,30 +47,3 @@ class BondFENEExpand : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -W: FENE bond too long: %ld %d %d %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -E: Bad FENE bond - -Two atoms in a FENE bond have become so far apart that the bond cannot -be computed. - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -W: Use special bonds = 0,1,1 with bond style fene/expand - -Most FENE models need this setting for the special_bonds command. - -W: FENE bond too long: %ld %g - -A FENE bond has stretched dangerously far. It's interaction strength -will be truncated to attempt to prevent the bond from blowing up. - -*/ diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index adf3f91044..4572d2c900 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -30,10 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -BondGromos::BondGromos(LAMMPS *_lmp) : Bond(_lmp) -{ - reinitflag = 1; -} +BondGromos::BondGromos(LAMMPS *_lmp) : Bond(_lmp) {} /* ---------------------------------------------------------------------- */ @@ -200,7 +197,7 @@ double BondGromos::single(int type, double rsq, int /*i*/, int /*j*/, double &ff void *BondGromos::extract(const char *str, int &dim) { dim = 1; - if (strcmp(str, "kappa") == 0) return (void *) k; + if (strcmp(str, "k") == 0) return (void *) k; if (strcmp(str, "r0") == 0) return (void *) r0; return nullptr; } diff --git a/src/MOLECULE/bond_gromos.h b/src/MOLECULE/bond_gromos.h index bd73e11172..498e859769 100644 --- a/src/MOLECULE/bond_gromos.h +++ b/src/MOLECULE/bond_gromos.h @@ -47,11 +47,3 @@ class BondGromos : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index cff766aa3b..a55aa0f976 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; BondHarmonic::BondHarmonic(LAMMPS *_lmp) : Bond(_lmp) { - reinitflag = 1; + born_matrix_enable = 1; } /* ---------------------------------------------------------------------- */ @@ -200,13 +200,26 @@ double BondHarmonic::single(int type, double rsq, int /*i*/, int /*j*/, double & return rk * dr; } +/* ---------------------------------------------------------------------- */ + +void BondHarmonic::born_matrix(int type, double rsq, int /*i*/, int /*j*/, double &du, double &du2) +{ + double r = sqrt(rsq); + double dr = r - r0[type]; + du2 = 0.0; + du = 0.0; + du2 = 2 * k[type]; + if (r > 0.0) du = du2 * dr; +} + /* ---------------------------------------------------------------------- - Return ptr to internal members upon request. + return ptr to internal members upon request ------------------------------------------------------------------------ */ + void *BondHarmonic::extract(const char *str, int &dim) { dim = 1; - if (strcmp(str, "kappa") == 0) return (void *) k; + if (strcmp(str, "k") == 0) return (void *) k; if (strcmp(str, "r0") == 0) return (void *) r0; return nullptr; } diff --git a/src/MOLECULE/bond_harmonic.h b/src/MOLECULE/bond_harmonic.h index 443290aec1..e089388d30 100644 --- a/src/MOLECULE/bond_harmonic.h +++ b/src/MOLECULE/bond_harmonic.h @@ -35,6 +35,7 @@ class BondHarmonic : public Bond { void read_restart(FILE *) override; void write_data(FILE *) override; double single(int, double, int, int, double &) override; + void born_matrix(int, double, int, int, double &, double &) override; void *extract(const char *, int &) override; protected: @@ -47,11 +48,3 @@ class BondHarmonic : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/bond_morse.h b/src/MOLECULE/bond_morse.h index 26073cd449..8682a6bb13 100644 --- a/src/MOLECULE/bond_morse.h +++ b/src/MOLECULE/bond_morse.h @@ -47,11 +47,3 @@ class BondMorse : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index b0028c05e9..88effd6a05 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -36,6 +36,7 @@ using MathConst::MY_CUBEROOT2; BondQuartic::BondQuartic(LAMMPS *_lmp) : Bond(_lmp), k(nullptr), b1(nullptr), b2(nullptr), rc(nullptr), u0(nullptr) { + partial_flag = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/bond_quartic.h b/src/MOLECULE/bond_quartic.h index f2e88a3356..fdc9cc8707 100644 --- a/src/MOLECULE/bond_quartic.h +++ b/src/MOLECULE/bond_quartic.h @@ -47,30 +47,3 @@ class BondQuartic : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style does not support bond_style quartic - -The pair style does not have a single() function, so it can -not be invoked by bond_style quartic. - -E: Bond style quartic cannot be used with 3,4-body interactions - -No angle, dihedral, or improper styles can be defined when using -bond style quartic. - -E: Bond style quartic cannot be used with atom style template - -This bond style can change the bond topology which is not -allowed with this atom style. - -E: Bond style quartic requires special_bonds = 1,1,1 - -This is a restriction of the current bond quartic implementation. - -*/ diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 72e21e5210..e1eac7c4c2 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -538,7 +538,7 @@ void BondTable::spline(double *x, double *y, int n, double yp1, double ypn, doub { int i, k; double p, qn, sig, un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e300) y2[0] = u[0] = 0.0; diff --git a/src/MOLECULE/bond_table.h b/src/MOLECULE/bond_table.h index 205397516a..054c3e94bd 100644 --- a/src/MOLECULE/bond_table.h +++ b/src/MOLECULE/bond_table.h @@ -76,71 +76,3 @@ class BondTable : public Bond { #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: Unknown table style in bond style table - -Self-explanatory. - -E: Illegal number of bond table entries - -There must be at least 2 table entries. - -E: Invalid bond table length - -Length must be 2 or greater. - -E: Bond table values are not increasing - -The values in the tabulated file must be monotonically increasing. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Premature end of file in bond table - -UNDOCUMENTED - -W: %d of %d force values in table are inconsistent with -dE/dr.\n Should only be flagged at inflection points - -UNDOCUMENTED - -W: %d of %d lines in table were incomplete or could not be parsed completely - -UNDOCUMENTED - -E: Invalid keyword in bond table parameters - -Self-explanatory. - -E: Bond table parameters did not set N - -List of bond table parameters must include N setting. - -E: Illegal bond in bond style table - -UNDOCUMENTED - -E: Bond length < table inner cutoff: type %d length %g - -UNDOCUMENTED - -E: Bond length > table outer cutoff: type %d length %g - -UNDOCUMENTED - -*/ diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index ee053f4f12..bd783316cd 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -350,7 +350,7 @@ void DihedralCharmm::coeff(int narg, char **arg) void DihedralCharmm::init_style() { if (utils::strmatch(update->integrate_style, "^respa")) { - Respa *r = (Respa *) update->integrate; + auto r = dynamic_cast(update->integrate); if (r->level_pair >= 0 && (r->level_pair != r->level_dihedral)) error->all(FLERR, "Dihedral style charmm must be set to same r-RESPA level as 'pair'"); if (r->level_outer >= 0 && (r->level_outer != r->level_dihedral)) diff --git a/src/MOLECULE/dihedral_charmm.h b/src/MOLECULE/dihedral_charmm.h index 2f9f297a3b..1c59ed17e3 100644 --- a/src/MOLECULE/dihedral_charmm.h +++ b/src/MOLECULE/dihedral_charmm.h @@ -48,41 +48,3 @@ class DihedralCharmm : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect multiplicity arg for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect weight arg for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Dihedral style charmm must be set to same r-RESPA level as 'pair' - -UNDOCUMENTED - -E: Dihedral style charmm must be set to same r-RESPA level as 'outer' - -UNDOCUMENTED - -E: Must use 'special_bonds charmm' with dihedral style charmm for use with CHARMM pair styles - -UNDOCUMENTED - -E: Dihedral charmm is incompatible with Pair style - -Dihedral style charmm must be used with a pair style charmm -in order for the 1-4 epsilon/sigma parameters to be defined. - -*/ diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 4b7f0b04f3..cd94283842 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -369,7 +369,7 @@ void DihedralCharmmfsw::coeff(int narg, char **arg) void DihedralCharmmfsw::init_style() { if (utils::strmatch(update->integrate_style, "^respa")) { - Respa *r = (Respa *) update->integrate; + auto r = dynamic_cast(update->integrate); if (r->level_pair >= 0 && (r->level_pair != r->level_dihedral)) error->all(FLERR, "Dihedral style charmmfsw must be set to same r-RESPA level as 'pair'"); if (r->level_outer >= 0 && (r->level_outer != r->level_dihedral)) @@ -405,9 +405,9 @@ void DihedralCharmmfsw::init_style() int itmp; int *p_dihedflag = (int *) force->pair->extract("dihedflag", itmp); - double *p_cutljinner = (double *) force->pair->extract("cut_lj_inner", itmp); - double *p_cutlj = (double *) force->pair->extract("cut_lj", itmp); - double *p_cutcoul = (double *) force->pair->extract("cut_coul", itmp); + auto p_cutljinner = (double *) force->pair->extract("cut_lj_inner", itmp); + auto p_cutlj = (double *) force->pair->extract("cut_lj", itmp); + auto p_cutcoul = (double *) force->pair->extract("cut_coul", itmp); if (p_cutcoul == nullptr || p_cutljinner == nullptr || p_cutlj == nullptr || p_dihedflag == nullptr) diff --git a/src/MOLECULE/dihedral_charmmfsw.h b/src/MOLECULE/dihedral_charmmfsw.h index 01ee30c5d0..2775575362 100644 --- a/src/MOLECULE/dihedral_charmmfsw.h +++ b/src/MOLECULE/dihedral_charmmfsw.h @@ -52,41 +52,3 @@ class DihedralCharmmfsw : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect multiplicity arg for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect weight arg for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Dihedral style charmmfsw must be set to same r-RESPA level as 'pair' - -UNDOCUMENTED - -E: Dihedral style charmmfsw must be set to same r-RESPA level as 'outer' - -UNDOCUMENTED - -E: Must use 'special_bonds charmm' with dihedral style charmm for use with CHARMM pair styles - -UNDOCUMENTED - -E: Dihedral charmmfsw is incompatible with Pair style - -Dihedral style charmmfsw must be used with a pair style charmm -in order for the 1-4 epsilon/sigma parameters to be defined. - -*/ diff --git a/src/MOLECULE/dihedral_harmonic.h b/src/MOLECULE/dihedral_harmonic.h index a80ea4ee84..8535a2019b 100644 --- a/src/MOLECULE/dihedral_harmonic.h +++ b/src/MOLECULE/dihedral_harmonic.h @@ -45,24 +45,3 @@ class DihedralHarmonic : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect sign arg for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -E: Incorrect multiplicity arg for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/dihedral_multi_harmonic.h b/src/MOLECULE/dihedral_multi_harmonic.h index 4534f0c697..cbadaaf472 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.h +++ b/src/MOLECULE/dihedral_multi_harmonic.h @@ -44,16 +44,3 @@ class DihedralMultiHarmonic : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/dihedral_opls.h b/src/MOLECULE/dihedral_opls.h index ebd8b79ea5..b35d033cda 100644 --- a/src/MOLECULE/dihedral_opls.h +++ b/src/MOLECULE/dihedral_opls.h @@ -44,16 +44,3 @@ class DihedralOPLS : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -W: Dihedral problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for dihedral coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/dihedral_table.cpp b/src/MOLECULE/dihedral_table.cpp index dbca4a85c1..ea0b30cbd5 100644 --- a/src/MOLECULE/dihedral_table.cpp +++ b/src/MOLECULE/dihedral_table.cpp @@ -80,11 +80,11 @@ static int solve_cyc_tridiag( const double diag[], size_t d_stride, size_t N, bool warn) { int status = GSL_SUCCESS; - double * delta = (double *) malloc (N * sizeof (double)); - double * gamma = (double *) malloc (N * sizeof (double)); - double * alpha = (double *) malloc (N * sizeof (double)); - double * c = (double *) malloc (N * sizeof (double)); - double * z = (double *) malloc (N * sizeof (double)); + auto delta = (double *) malloc (N * sizeof (double)); + auto gamma = (double *) malloc (N * sizeof (double)); + auto alpha = (double *) malloc (N * sizeof (double)); + auto c = (double *) malloc (N * sizeof (double)); + auto z = (double *) malloc (N * sizeof (double)); if (delta == nullptr || gamma == nullptr || alpha == nullptr || c == nullptr || z == nullptr) { if (warn) @@ -193,9 +193,9 @@ static int cyc_spline(double const *xa, double const *ya, int n, double period, double *y2a, bool warn) { - double *diag = new double[n]; - double *offdiag = new double[n]; - double *rhs = new double[n]; + auto diag = new double[n]; + auto offdiag = new double[n]; + auto rhs = new double[n]; double xa_im1, xa_ip1; // In the cyclic case, there are n equations with n unknows. @@ -812,9 +812,9 @@ void DihedralTable::coeff(int narg, char **arg) // We also want the angles to be sorted in increasing order. // This messy code fixes these problems with the user's data: { - double *phifile_tmp = new double[tb->ninput]; //temporary arrays - double *ffile_tmp = new double[tb->ninput]; //used for sorting - double *efile_tmp = new double[tb->ninput]; + auto phifile_tmp = new double[tb->ninput]; //temporary arrays + auto ffile_tmp = new double[tb->ninput]; //used for sorting + auto efile_tmp = new double[tb->ninput]; // After re-imaging, does the range of angles cross the 0 or 2*PI boundary? // If so, find the discontinuity: diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 01231b4b0e..b384294a89 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -189,7 +189,7 @@ void FixCMAP::init() newton_bond = force->newton_bond; if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -203,9 +203,9 @@ void FixCMAP::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/MOLECULE/fix_cmap.h b/src/MOLECULE/fix_cmap.h index 944c311001..d07122d0d0 100644 --- a/src/MOLECULE/fix_cmap.h +++ b/src/MOLECULE/fix_cmap.h @@ -127,39 +127,3 @@ class FixCMAP : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: CMAP atoms %d %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -E: Invalid CMAP crossterm_type - -UNDOCUMENTED - -E: Cannot open fix cmap file %s - -UNDOCUMENTED - -E: CMAP: atan2 function cannot take 2 zero arguments - -UNDOCUMENTED - -E: Invalid read data header line for fix cmap - -UNDOCUMENTED - -E: Incorrect %s format in data file - -UNDOCUMENTED - -E: Too many CMAP crossterms for one atom - -UNDOCUMENTED - -*/ diff --git a/src/MOLECULE/improper_cvff.h b/src/MOLECULE/improper_cvff.h index 1e724bc84b..bcb6c5c486 100644 --- a/src/MOLECULE/improper_cvff.h +++ b/src/MOLECULE/improper_cvff.h @@ -45,16 +45,3 @@ class ImproperCvff : public Improper { #endif #endif - -/* ERROR/WARNING messages: - -W: Improper problem: %d %ld %d %d %d %d - -Conformation of the 4 listed improper atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for improper coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/improper_harmonic.h b/src/MOLECULE/improper_harmonic.h index 64966b477c..7b80389037 100644 --- a/src/MOLECULE/improper_harmonic.h +++ b/src/MOLECULE/improper_harmonic.h @@ -44,16 +44,3 @@ class ImproperHarmonic : public Improper { #endif #endif - -/* ERROR/WARNING messages: - -W: Improper problem: %d %ld %d %d %d %d - -Conformation of the 4 listed improper atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for improper coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/improper_umbrella.h b/src/MOLECULE/improper_umbrella.h index fb671646e7..fa54899807 100644 --- a/src/MOLECULE/improper_umbrella.h +++ b/src/MOLECULE/improper_umbrella.h @@ -44,16 +44,3 @@ class ImproperUmbrella : public Improper { #endif #endif - -/* ERROR/WARNING messages: - -W: Improper problem: %d %ld %d %d %d %d - -Conformation of the 4 listed improper atoms is extreme; you may want -to check your simulation geometry. - -E: Incorrect args for improper coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.h b/src/MOLECULE/pair_hbond_dreiding_lj.h index 5912282702..5bd8c56412 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.h +++ b/src/MOLECULE/pair_hbond_dreiding_lj.h @@ -64,41 +64,3 @@ class PairHbondDreidingLJ : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -E: Pair style hbond/dreiding requires molecular system - -Self-explanatory. - -E: Pair style hbond/dreiding requires atom IDs - -Self-explanatory. - -E: Pair style hbond/dreiding requires an atom map, see atom_modify - -Self-explanatory. - -E: Pair style hbond/dreiding requires newton pair on - -See the newton command for details. - -E: No pair hbond/dreiding coefficients set - -Self-explanatory. - -*/ diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.h b/src/MOLECULE/pair_hbond_dreiding_morse.h index fa9d9ac588..98c5ae0899 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.h +++ b/src/MOLECULE/pair_hbond_dreiding_morse.h @@ -38,35 +38,3 @@ class PairHbondDreidingMorse : public PairHbondDreidingLJ { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -E: Pair style hbond/dreiding requires molecular system - -Self-explanatory. - -E: Pair style hbond/dreiding requires atom IDs - -Self-explanatory. - -E: Pair style hbond/dreiding requires an atom map, see atom_modify - -Self-explanatory. - -E: Pair style hbond/dreiding requires newton pair on - -See the newton command for details. - -E: No pair hbond/dreiding coefficients set - -Self-explanatory. - -*/ diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.h b/src/MOLECULE/pair_lj_charmm_coul_charmm.h index 4f938f154b..941929055c 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.h +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.h @@ -58,25 +58,3 @@ class PairLJCharmmCoulCharmm : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/charmm/coul/charmm requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -*/ diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h index f9931055f4..03f576ea37 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.h @@ -63,29 +63,3 @@ class PairLJCharmmfswCoulCharmmfsh : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/charmmfsw/coul/charmmfsh requires atom attribute q - -The atom style defined does not have these attributes. - -E: Pair inner lj cutoff >= Pair outer lj cutoff - -UNDOCUMENTED - -U: Pair inner cutoff >= Pair outer cutoff - -The specified cutoffs for the pair style are inconsistent. - -*/ diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.h b/src/MOLECULE/pair_lj_cut_tip4p_cut.h index 83e180915e..03418a3ce5 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.h +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.h @@ -67,55 +67,3 @@ class PairLJCutTIP4PCut : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/tip4p/cut requires atom IDs - -This is a requirement to use this potential. - -E: Pair style lj/cut/tip4p/cut requires newton pair on - -See the newton command. This is a restriction to use this -potential. - -E: Pair style lj/cut/tip4p/cut requires atom attribute q - -The atom style defined does not have this attribute. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -E: Water H epsilon must be 0.0 for pair style lj/cut/tip4p/cut - -This is because LAMMPS does not compute the Lennard-Jones interactions -with these particles for efficiency reasons. - -*/ diff --git a/src/MOLECULE/pair_tip4p_cut.h b/src/MOLECULE/pair_tip4p_cut.h index eb5d0256b3..acf922fc94 100644 --- a/src/MOLECULE/pair_tip4p_cut.h +++ b/src/MOLECULE/pair_tip4p_cut.h @@ -61,49 +61,3 @@ class PairTIP4PCut : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style tip4p/cut requires atom IDs - -This is a requirement to use this potential. - -E: Pair style tip4p/cut requires newton pair on - -See the newton command. This is a restriction to use this potential. - -E: Pair style tip4p/cut requires atom attribute q - -The atom style defined does not have this attribute. - -E: Must use a bond style with TIP4P potential - -TIP4P potentials assume bond lengths in water are constrained -by a fix shake command. - -E: Must use an angle style with TIP4P potential - -TIP4P potentials assume angles in water are constrained by a fix shake -command. - -*/ diff --git a/src/MOLFILE/dump_molfile.cpp b/src/MOLFILE/dump_molfile.cpp index bb45680395..8cc28ab88e 100644 --- a/src/MOLFILE/dump_molfile.cpp +++ b/src/MOLFILE/dump_molfile.cpp @@ -98,7 +98,7 @@ DumpMolfile::DumpMolfile(LAMMPS *lmp, int narg, char **arg) mf = new MolfileInterface(arg[5],MFI::M_WRITE); - const char *path = (const char *) "."; + const char *path = (const char *) "."; // NOLINT if (narg > 6) path=arg[6]; diff --git a/src/MOLFILE/dump_molfile.h b/src/MOLFILE/dump_molfile.h index 3f627835e6..80f20a78f4 100644 --- a/src/MOLFILE/dump_molfile.h +++ b/src/MOLFILE/dump_molfile.h @@ -59,49 +59,3 @@ class DumpMolfile : public Dump { #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: Invalid dump dcd filename - -Filenames used with the dump dcd style cannot be binary or compressed -or cause multiple files to be written. - -E: Too many atoms for dump dcd - -The system size must fit in a 32-bit integer to use this dump -style. - -E: Dump dcd requires sorting by atom ID - -Use the dump_modify sort command to enable this. - -E: Cannot use variable every setting for dump dcd - -The format of Molfile dump files requires snapshots be output -at a constant frequency. - -E: Cannot change dump_modify every for dump dcd - -The frequency of writing dump dcd snapshots cannot be changed. - -E: Cannot open dump file - -The output file for the dump command cannot be opened. Check that the -path and name are correct. - -E: Dump dcd of non-matching # of atoms - -Every snapshot written by dump dcd must contain the same # of atoms. - -E: Too big a timestep for dump dcd - -The timestep must fit in a 32-bit integer to use this dump style. - -*/ diff --git a/src/MOLFILE/molfile_interface.cpp b/src/MOLFILE/molfile_interface.cpp index 5fd398570e..a83d8ed46c 100644 --- a/src/MOLFILE/molfile_interface.cpp +++ b/src/MOLFILE/molfile_interface.cpp @@ -47,7 +47,7 @@ extern "C" { // callback function for plugin registration. static int plugin_register_cb(void *v, vmdplugin_t *p) { - plugin_reginfo_t *r = static_cast(v); + auto r = static_cast(v); // make sure we have the proper plugin type (native reader) // for the desired file type (called "name" at this level) if ((strcmp(MOLFILE_PLUGIN_TYPE,p->type) == 0) @@ -214,7 +214,7 @@ MolfileInterface::~MolfileInterface() forget_plugin(); if (_info) { - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); delete[] a; _info = nullptr; } @@ -278,7 +278,7 @@ int MolfileInterface::load_plugin(const char *filename) ((regfunc)rfunc)(®info, plugin_register_cb); // make some checks to see if the plugin is suitable or not. - molfile_plugin_t *plugin = static_cast(reginfo.p); + auto plugin = static_cast(reginfo.p); // if the callback found a matching plugin and copied the struct, // its name element will point to a different location now. @@ -398,7 +398,7 @@ int MolfileInterface::open(const char *name, int *natoms) { if (!_plugin || !_dso || !natoms) return E_FILE; - molfile_plugin_t *p = static_cast(_plugin); + auto p = static_cast(_plugin); if (_mode & M_WRITE) _ptr = p->open_file_write(name,_type,*natoms); @@ -412,7 +412,7 @@ int MolfileInterface::open(const char *name, int *natoms) // we need to deal with structure information, // so we allocate and initialize storage for it. if (_mode & (M_RSTRUCT|M_WSTRUCT)) { - molfile_atom_t *a = new molfile_atom_t[_natoms]; + auto a = new molfile_atom_t[_natoms]; _info = a; memset(_info,0,_natoms*sizeof(molfile_atom_t)); for (int i=0; i < _natoms; ++i) { @@ -431,7 +431,7 @@ int MolfileInterface::structure() { if (!_plugin || !_dso) return E_FILE; - molfile_plugin_t *p = static_cast(_plugin); + auto p = static_cast(_plugin); int optflags = MOLFILE_NOOPTIONS; @@ -443,10 +443,10 @@ int MolfileInterface::structure() optflags |= (_props & P_RADS) ? MOLFILE_RADIUS : 0; optflags |= (_props & P_ATMN) ? MOLFILE_ATOMICNUMBER : 0; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); p->write_structure(_ptr,optflags,a); } else if (_mode & M_RSTRUCT) { - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); p->read_structure(_ptr,&optflags,a); // mandatory properties _props = P_NAME|P_TYPE|P_RESN|P_RESI|P_SEGN|P_CHAI; @@ -467,7 +467,7 @@ int MolfileInterface::close() if (!_plugin || !_dso || !_ptr) return E_FILE; - molfile_plugin_t *p = static_cast(_plugin); + auto p = static_cast(_plugin); if (_mode & M_WRITE) { p->close_file_write(_ptr); @@ -476,7 +476,7 @@ int MolfileInterface::close() } if (_info) { - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); delete[] a; _info = nullptr; } @@ -494,8 +494,8 @@ int MolfileInterface::timestep(float *coords, float *vels, if (!_plugin || !_dso || !_ptr) return 1; - molfile_plugin_t *p = static_cast(_plugin); - molfile_timestep_t *t = new molfile_timestep_t; + auto p = static_cast(_plugin); + auto t = new molfile_timestep_t; int rv; if (_mode & M_WRITE) { @@ -710,7 +710,7 @@ int MolfileInterface::property(int propid, int idx, float *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) _props |= write_atom_property(a[idx], propid, *prop); @@ -727,7 +727,7 @@ int MolfileInterface::property(int propid, int *types, float *prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -747,7 +747,7 @@ int MolfileInterface::property(int propid, float *prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -768,7 +768,7 @@ int MolfileInterface::property(int propid, int idx, double *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) return write_atom_property(a[idx], propid, *prop); @@ -785,7 +785,7 @@ int MolfileInterface::property(int propid, int *types, double *prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -805,7 +805,7 @@ int MolfileInterface::property(int propid, double *prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) @@ -840,7 +840,7 @@ int MolfileInterface::property(int propid, int idx, int *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { char buf[64]; @@ -865,7 +865,7 @@ int MolfileInterface::property(int propid, int *types, int *prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { char buf[64]; @@ -894,7 +894,7 @@ int MolfileInterface::property(int propid, int *prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { char buf[64]; @@ -925,7 +925,7 @@ int MolfileInterface::property(int propid, int idx, char *prop) if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { _props |= write_atom_property(a[idx], propid, prop); @@ -943,7 +943,7 @@ int MolfileInterface::property(int propid, int *types, char **prop) if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) { @@ -964,7 +964,7 @@ int MolfileInterface::property(int propid, char **prop) if ((_info == nullptr) || (prop == nullptr)) return P_NONE; - molfile_atom_t *a = static_cast(_info); + auto a = static_cast(_info); if (_mode & M_WSTRUCT) { for (int i=0; i < _natoms; ++i) { diff --git a/src/MOLFILE/reader_molfile.cpp b/src/MOLFILE/reader_molfile.cpp index 5f75ae50f5..7b12678329 100644 --- a/src/MOLFILE/reader_molfile.cpp +++ b/src/MOLFILE/reader_molfile.cpp @@ -78,7 +78,7 @@ void ReaderMolfile::settings(int narg, char **arg) if (me == 0) { mf = new MolfileInterface(arg[0],MFI::M_READ); - const char *path = (const char *) "."; + const char *path = (const char *) "."; // NOLINT if (narg > 1) path=arg[1]; @@ -220,12 +220,12 @@ bigint ReaderMolfile::read_header(double box[3][3], int &boxinfo, int &triclinic triclinic = 1; - const double la = static_cast(cell[0]); - const double lb = static_cast(cell[1]); - const double lc = static_cast(cell[2]); - const double alpha = static_cast(cell[3]); - const double beta = static_cast(cell[4]); - const double gamma = static_cast(cell[5]); + const auto la = static_cast(cell[0]); + const auto lb = static_cast(cell[1]); + const auto lc = static_cast(cell[2]); + const auto alpha = static_cast(cell[3]); + const auto beta = static_cast(cell[4]); + const auto gamma = static_cast(cell[5]); const double lx = la; const double xy = lb * cos(gamma/90.0*MY_PI2); diff --git a/src/MOLFILE/reader_molfile.h b/src/MOLFILE/reader_molfile.h index 946ea66b03..df193c43e7 100644 --- a/src/MOLFILE/reader_molfile.h +++ b/src/MOLFILE/reader_molfile.h @@ -35,8 +35,8 @@ class ReaderMolfile : public Reader { int read_time(bigint &) override; void skip() override; - bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, - int &, int &, int &) override; + bigint read_header(double[3][3], int &, int &, int, int, int *, char **, int, int, int &, int &, + int &, int &) override; void read_atoms(int, int, double **) override; void open_file(const std::string &) override; diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index b3933cec36..3035e3a106 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -38,11 +38,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -DumpAtomMPIIO::DumpAtomMPIIO(LAMMPS *lmp, int narg, char **arg) - : DumpAtom(lmp, narg, arg) +DumpAtomMPIIO::DumpAtomMPIIO(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { if (me == 0) - error->warning(FLERR,"MPI-IO output is unmaintained and unreliable. Use with caution."); + error->warning(FLERR, "MPI-IO output is unmaintained and unreliable. Use with caution."); } /* ---------------------------------------------------------------------- */ @@ -86,8 +85,8 @@ void DumpAtomMPIIO::openfile() } if (append_flag) { // append open - int err = MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | - MPI_MODE_WRONLY, MPI_INFO_NULL, &mpifh); + int err = MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY, + MPI_INFO_NULL, &mpifh); if (err != MPI_SUCCESS) error->one(FLERR, "Cannot open dump file {}: {}", filecurrent, utils::getsyserror()); @@ -100,8 +99,8 @@ void DumpAtomMPIIO::openfile() } else { // replace open - int err = MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY, - MPI_INFO_NULL, &mpifh); + int err = + MPI_File_open(world, filecurrent, MPI_MODE_CREATE | MPI_MODE_WRONLY, MPI_INFO_NULL, &mpifh); if (err != MPI_SUCCESS) error->one(FLERR, "Cannot open dump file {}: {}", filecurrent, utils::getsyserror()); @@ -214,8 +213,10 @@ void DumpAtomMPIIO::init_style() if (format_line_user) { format = utils::strdup(std::string(format_line_user) + "\n"); } else { - if (image_flag == 0) format = utils::strdup(TAGINT_FORMAT " %d %g %g %g\n"); - else format = utils::strdup(TAGINT_FORMAT " %d %g %g %g %d %d %d\n"); + if (image_flag == 0) + format = utils::strdup(TAGINT_FORMAT " %d %g %g %g\n"); + else + format = utils::strdup(TAGINT_FORMAT " %d %g %g %g %d %d %d\n"); } // setup boundary string @@ -239,8 +240,10 @@ void DumpAtomMPIIO::init_style() columns.clear(); for (auto item : utils::split_words(default_columns)) { if (columns.size()) columns += " "; - if (keyword_user[icol].size()) columns += keyword_user[icol]; - else columns += item; + if (keyword_user[icol].size()) + columns += keyword_user[icol]; + else + columns += item; ++icol; } diff --git a/src/MPIIO/dump_atom_mpiio.h b/src/MPIIO/dump_atom_mpiio.h index 9e0942d86f..8946034b8b 100644 --- a/src/MPIIO/dump_atom_mpiio.h +++ b/src/MPIIO/dump_atom_mpiio.h @@ -70,17 +70,3 @@ class DumpAtomMPIIO : public DumpAtom { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open dump file %s - -The output file for the dump command cannot be opened. Check that the -path and name are correct. - -E: Too much per-proc info for dump - -Number of local atoms times number of columns must fit in a 32-bit -integer for dump. - -*/ diff --git a/src/MPIIO/dump_cfg_mpiio.h b/src/MPIIO/dump_cfg_mpiio.h index b6b17fb908..289e5baf72 100644 --- a/src/MPIIO/dump_cfg_mpiio.h +++ b/src/MPIIO/dump_cfg_mpiio.h @@ -58,21 +58,3 @@ class DumpCFGMPIIO : public DumpCFG { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open dump file %s - -The output file for the dump command cannot be opened. Check that the -path and name are correct. - -E: Too much per-proc info for dump - -Number of local atoms times number of columns must fit in a 32-bit -integer for dump. - -E: Dump cfg requires one snapshot per file - -Use the wildcard "*" character in the filename. - -*/ diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index a911ea1149..34306db122 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -41,11 +41,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -DumpCustomMPIIO::DumpCustomMPIIO(LAMMPS *lmp, int narg, char **arg) - : DumpCustom(lmp, narg, arg) +DumpCustomMPIIO::DumpCustomMPIIO(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg) { if (me == 0) - error->warning(FLERR,"MPI-IO output is unmaintained and unreliable. Use with caution."); + error->warning(FLERR, "MPI-IO output is unmaintained and unreliable. Use with caution."); } /* ---------------------------------------------------------------------- */ @@ -59,7 +58,7 @@ DumpCustomMPIIO::~DumpCustomMPIIO() void DumpCustomMPIIO::openfile() { - if (singlefile_opened) { // single file already opened, so just return after resetting filesize + if (singlefile_opened) { // single file already opened, so just return after resetting filesize mpifo = currentFileSize; MPI_File_set_size(mpifh, mpifo + headerSize + sumFileSize); currentFileSize = mpifo + headerSize + sumFileSize; @@ -212,8 +211,10 @@ void DumpCustomMPIIO::init_style() int icol = 0; for (auto item : utils::split_words(columns_default)) { if (combined.size()) combined += " "; - if (keyword_user[icol].size()) combined += keyword_user[icol]; - else combined += item; + if (keyword_user[icol].size()) + combined += keyword_user[icol]; + else + combined += item; ++icol; } columns = utils::strdup(combined); @@ -221,8 +222,10 @@ void DumpCustomMPIIO::init_style() // format = copy of default or user-specified line format delete[] format; - if (format_line_user) format = utils::strdup(format_line_user); - else format = utils::strdup(format_default); + if (format_line_user) + format = utils::strdup(format_line_user); + else + format = utils::strdup(format_default); // tokenize the format string and add space at end of each format element // if user-specified int/float format exists, use it instead @@ -230,10 +233,9 @@ void DumpCustomMPIIO::init_style() // lo priority = line, medium priority = int/float, hi priority = column auto words = utils::split_words(format); - if ((int) words.size() < nfield) - error->all(FLERR,"Dump_modify format line is too short"); + if ((int) words.size() < nfield) error->all(FLERR, "Dump_modify format line is too short"); - int i=0; + int i = 0; for (const auto &word : words) { delete[] vformat[i]; @@ -245,10 +247,11 @@ void DumpCustomMPIIO::init_style() vformat[i] = utils::strdup(std::string(format_float_user) + " "); else if (vtype[i] == Dump::BIGINT && format_bigint_user) vformat[i] = utils::strdup(std::string(format_bigint_user) + " "); - else vformat[i] = utils::strdup(word + " "); + else + vformat[i] = utils::strdup(word + " "); // remove trailing blank on last column's format - if (i == nfield-1) vformat[i][strlen(vformat[i])-1] = '\0'; + if (i == nfield - 1) vformat[i][strlen(vformat[i]) - 1] = '\0'; ++i; } @@ -278,29 +281,28 @@ void DumpCustomMPIIO::init_style() for (i = 0; i < ncompute; i++) { compute[i] = modify->get_compute_by_id(id_compute[i]); - if (!compute[i]) error->all(FLERR,"Could not find dump custom compute ID {}",id_compute[i]); + if (!compute[i]) + error->all(FLERR, "Could not find dump custom/mpiio compute ID {}", id_compute[i]); } for (i = 0; i < nfix; i++) { fix[i] = modify->get_fix_by_id(id_fix[i]); - if (!fix[i]) error->all(FLERR,"Could not find dump custom fix ID {}", id_fix[i]); + if (!fix[i]) error->all(FLERR, "Could not find dump custom/mpiio fix ID {}", id_fix[i]); if (nevery % fix[i]->peratom_freq) - error->all(FLERR,"Dump custom and fix not computed at compatible times"); + error->all(FLERR, "dump custom/mpiio and fix not computed at compatible times"); } for (i = 0; i < nvariable; i++) { int ivariable = input->variable->find(id_variable[i]); if (ivariable < 0) - error->all(FLERR,"Could not find dump custom variable name {}", id_variable[i]); + error->all(FLERR, "Could not find dump custom/mpiio variable name {}", id_variable[i]); variable[i] = ivariable; } // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) error->all(FLERR, "Region ID for dump custom does not exist"); - } + if (idregion && !domain->get_region_by_id(idregion)) + error->all(FLERR, "Region {} for dump custom/mpiio does not exist", idregion); } /* ---------------------------------------------------------------------- */ diff --git a/src/MPIIO/dump_custom_mpiio.h b/src/MPIIO/dump_custom_mpiio.h index af125dae6e..79169f5a2c 100644 --- a/src/MPIIO/dump_custom_mpiio.h +++ b/src/MPIIO/dump_custom_mpiio.h @@ -66,47 +66,3 @@ class DumpCustomMPIIO : public DumpCustom { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open dump file %s - -The output file for the dump command cannot be opened. Check that the -path and name are correct. - -E: Too much per-proc info for dump - -Number of local atoms times number of columns must fit in a 32-bit -integer for dump. - -E: Dump_modify format line is too short - -UNDOCUMENTED - -E: Could not find dump custom compute ID - -Self-explanatory. - -E: Could not find dump custom fix ID - -Self-explanatory. - -E: Dump custom and fix not computed at compatible times - -The fix must produce per-atom quantities on timesteps that dump custom -needs them. - -E: Could not find dump custom variable name - -Self-explanatory. - -E: Region ID for dump custom does not exist - -Self-explanatory. - -U: Dump_modify format string is too short - -There are more fields to be dumped in a line of output than your -format string specifies. - -*/ diff --git a/src/MPIIO/dump_xyz_mpiio.h b/src/MPIIO/dump_xyz_mpiio.h index 8475bd03d1..dcbb15c82a 100644 --- a/src/MPIIO/dump_xyz_mpiio.h +++ b/src/MPIIO/dump_xyz_mpiio.h @@ -59,17 +59,3 @@ class DumpXYZMPIIO : public DumpXYZ { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot open dump file %s - -The output file for the dump command cannot be opened. Check that the -path and name are correct. - -E: Too much per-proc info for dump - -Number of local atoms times number of columns must fit in a 32-bit -integer for dump. - -*/ diff --git a/src/MPIIO/restart_mpiio.h b/src/MPIIO/restart_mpiio.h index 09f7c76fb0..6bf34841f4 100644 --- a/src/MPIIO/restart_mpiio.h +++ b/src/MPIIO/restart_mpiio.h @@ -38,37 +38,3 @@ class RestartMPIIO : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Cannot open restart file for reading - MPI error: %s - -This error was generated by MPI when reading/writing an MPI-IO restart -file. - -E: Cannot open restart file for writing - MPI error: %s - -This error was generated by MPI when reading/writing an MPI-IO restart -file. - -E: Cannot set restart file size - MPI error: %s - -This error was generated by MPI when reading/writing an MPI-IO restart -file. - -E: Cannot write to restart file - MPI error: %s - -This error was generated by MPI when reading/writing an MPI-IO restart -file. - -E: Cannot read from restart file - MPI error: %s - -This error was generated by MPI when reading/writing an MPI-IO restart -file. - -E: Cannot close restart file - MPI error: %s - -This error was generated by MPI when reading/writing an MPI-IO restart -file. - -*/ diff --git a/src/MSCG/fix_mscg.h b/src/MSCG/fix_mscg.h index 972a48c1e0..ae1109e14d 100644 --- a/src/MSCG/fix_mscg.h +++ b/src/MSCG/fix_mscg.h @@ -50,61 +50,3 @@ class FixMSCG : public Fix { #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: Fix mscg does not yet support parallel use via MPI - -UNDOCUMENTED - -E: Fix mscg must be used with 32-bit atom IDs - -UNDOCUMENTED - -E: Fix mscg does not yet support triclinic geometries - -Self-explanatory. - -E: Bond list overflow, boost fix_mscg max - -UNDOCUMENTED - -E: Angle list overflow, boost fix_mscg max - -UNDOCUMENTED - -E: Dihedral list overflow, boost fix_mscg max - -UNDOCUMENTED - -W: Fix mscg n_frames is inconsistent with control.in - -The control.in file read by the MSCG lib has a parameter n_frames -that should be equal to the number of frames processed by the -fix mscg command. If not equal, the fix will still run, but the -calculated residuals may be normalized incorrectly. - -W: Fix mscg n_frames is not divisible by block_size in control.in - -The control.in file read by the MSCG lib has a parameter block_size -that should be a divisor of the number of frames processed by the -fix mscg command. If not, the fix will still run, but some frames may -not be included in the MSCG calculations. - -U: Fix mscg does not yet support mpi - -Self-explanatory. - -U: Bond/Angle/Dihedral list overflow, boost fix_mscg max - -A site has more bond/angle/dihedral partners that the maximum and -has overflowed the bond/angle/dihedral partners list. Increase the -corresponding fix_mscg max arg. - -*/ diff --git a/src/Makefile b/src/Makefile index 8f6074e3eb..bedce0c2c4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -54,6 +54,7 @@ PACKAGE = \ awpmd \ bocs \ body \ + bpm \ brownian \ cg-dna \ cg-sdk \ @@ -148,7 +149,8 @@ PACKMOST = \ asphere \ bocs \ body \ - brownian \ + bpm \ + brownian \ cg-dna \ cg-sdk \ class2 \ @@ -472,6 +474,8 @@ tar: @cd STUBS; $(MAKE) @echo "Created $(ROOT)_src.tar.gz" +check: check-whitespace check-permissions check-homepage check-errordocs + check-whitespace: $(PYTHON) ../tools/coding_standard/whitespace.py .. @@ -490,6 +494,12 @@ check-homepage: fix-homepage: $(PYTHON) ../tools/coding_standard/homepage.py .. -f +check-errordocs: + $(PYTHON) ../tools/coding_standard/errordocs.py .. + +fix-errordocs: + $(PYTHON) ../tools/coding_standard/errordocs.py .. -f + format-src: clang-format -i --verbose --style=file *.cpp *.h */*.cpp */*.h diff --git a/src/OPENMP/angle_charmm_omp.cpp b/src/OPENMP/angle_charmm_omp.cpp index 1c84828c63..2994cfad13 100644 --- a/src/OPENMP/angle_charmm_omp.cpp +++ b/src/OPENMP/angle_charmm_omp.cpp @@ -88,8 +88,8 @@ void AngleCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double delxUB,delyUB,delzUB,rsqUB,rUB,dr,rk,forceUB; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_class2_omp.cpp b/src/OPENMP/angle_class2_omp.cpp index 54aa062d44..239b373004 100644 --- a/src/OPENMP/angle_class2_omp.cpp +++ b/src/OPENMP/angle_class2_omp.cpp @@ -89,8 +89,8 @@ void AngleClass2OMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22,b1,b2; double vx11,vx12,vy11,vy12,vz11,vz12,vx21,vx22,vy21,vy22,vz21,vz22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_delta_omp.cpp b/src/OPENMP/angle_cosine_delta_omp.cpp index e60d0748df..48330a5087 100644 --- a/src/OPENMP/angle_cosine_delta_omp.cpp +++ b/src/OPENMP/angle_cosine_delta_omp.cpp @@ -86,8 +86,8 @@ void AngleCosineDeltaOMP::eval(int nfrom, int nto, ThrData * const thr) double eangle,f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,a,cot,a11,a12,a22,b11,b12,b22,c0,s0,s; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_omp.cpp b/src/OPENMP/angle_cosine_omp.cpp index d0c27dfab0..cd5a9fab58 100644 --- a/src/OPENMP/angle_cosine_omp.cpp +++ b/src/OPENMP/angle_cosine_omp.cpp @@ -86,8 +86,8 @@ void AngleCosineOMP::eval(int nfrom, int nto, ThrData * const thr) double eangle,f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_periodic_omp.cpp b/src/OPENMP/angle_cosine_periodic_omp.cpp index 58db02d6f7..a97a9d7e89 100644 --- a/src/OPENMP/angle_cosine_periodic_omp.cpp +++ b/src/OPENMP/angle_cosine_periodic_omp.cpp @@ -89,8 +89,8 @@ void AngleCosinePeriodicOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; double tn,tn_1,tn_2,un,un_1,un_2; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_shift_exp_omp.cpp b/src/OPENMP/angle_cosine_shift_exp_omp.cpp index f2abf1f1b0..1f9b150a57 100644 --- a/src/OPENMP/angle_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/angle_cosine_shift_exp_omp.cpp @@ -87,8 +87,8 @@ void AngleCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a11,a12,a22; double exp2,aa,uumin,cccpsss,cssmscc; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_shift_omp.cpp b/src/OPENMP/angle_cosine_shift_omp.cpp index 4d6e1ab81a..08649f01e2 100644 --- a/src/OPENMP/angle_cosine_shift_omp.cpp +++ b/src/OPENMP/angle_cosine_shift_omp.cpp @@ -86,8 +86,8 @@ void AngleCosineShiftOMP::eval(int nfrom, int nto, ThrData * const thr) double f1[3],f3[3]; double rsq1,rsq2,r1,r2,c,s,cps,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; double eangle = 0.0; diff --git a/src/OPENMP/angle_cosine_squared_omp.cpp b/src/OPENMP/angle_cosine_squared_omp.cpp index 65b73216c7..6755426b71 100644 --- a/src/OPENMP/angle_cosine_squared_omp.cpp +++ b/src/OPENMP/angle_cosine_squared_omp.cpp @@ -87,8 +87,8 @@ void AngleCosineSquaredOMP::eval(int nfrom, int nto, ThrData * const thr) double dcostheta,tk; double rsq1,rsq2,r1,r2,c,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_fourier_omp.cpp b/src/OPENMP/angle_fourier_omp.cpp index d7a05f6850..b1e4cf1f0a 100644 --- a/src/OPENMP/angle_fourier_omp.cpp +++ b/src/OPENMP/angle_fourier_omp.cpp @@ -87,8 +87,8 @@ void AngleFourierOMP::eval(int nfrom, int nto, ThrData * const thr) double term; double rsq1,rsq2,r1,r2,c,c2,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_fourier_simple_omp.cpp b/src/OPENMP/angle_fourier_simple_omp.cpp index 670f8cfc83..b76e9c875e 100644 --- a/src/OPENMP/angle_fourier_simple_omp.cpp +++ b/src/OPENMP/angle_fourier_simple_omp.cpp @@ -93,8 +93,8 @@ void AngleFourierSimpleOMP::eval(int nfrom, int nto, ThrData *const thr) double term, sgn; double rsq1, rsq2, r1, r2, c, cn, th, nth, a, a11, a12, a22; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t *_noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_harmonic_omp.cpp b/src/OPENMP/angle_harmonic_omp.cpp index 2d1a34570d..a67f784624 100644 --- a/src/OPENMP/angle_harmonic_omp.cpp +++ b/src/OPENMP/angle_harmonic_omp.cpp @@ -87,8 +87,8 @@ void AngleHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,tk; double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_quartic_omp.cpp b/src/OPENMP/angle_quartic_omp.cpp index 3770319323..6592584c99 100644 --- a/src/OPENMP/angle_quartic_omp.cpp +++ b/src/OPENMP/angle_quartic_omp.cpp @@ -87,8 +87,8 @@ void AngleQuarticOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,dtheta2,dtheta3,dtheta4,tk; double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_sdk_omp.cpp b/src/OPENMP/angle_sdk_omp.cpp index 8fcfb3df08..e82121959b 100644 --- a/src/OPENMP/angle_sdk_omp.cpp +++ b/src/OPENMP/angle_sdk_omp.cpp @@ -89,8 +89,8 @@ void AngleSDKOMP::eval(int nfrom, int nto, ThrData * const thr) double dtheta,tk; double rsq1,rsq2,rsq3,r1,r2,c,s,a,a11,a12,a22; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/angle_table_omp.cpp b/src/OPENMP/angle_table_omp.cpp index cca34a67f7..d796ac23e3 100644 --- a/src/OPENMP/angle_table_omp.cpp +++ b/src/OPENMP/angle_table_omp.cpp @@ -88,8 +88,8 @@ void AngleTableOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq1,rsq2,r1,r2,c,s,a,a11,a12,a22; double theta,u,mdu; //mdu: minus du, -du/dx=f - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int4_t * _noalias const anglelist = (int4_t *) neighbor->anglelist[0]; const int nlocal = atom->nlocal; eangle = 0.0; diff --git a/src/OPENMP/bond_class2_omp.cpp b/src/OPENMP/bond_class2_omp.cpp index 170e97d13d..9b7ed7169f 100644 --- a/src/OPENMP/bond_class2_omp.cpp +++ b/src/OPENMP/bond_class2_omp.cpp @@ -85,8 +85,8 @@ void BondClass2OMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,dr2,dr3,dr4,de_bond; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_fene_expand_omp.cpp b/src/OPENMP/bond_fene_expand_omp.cpp index 56ea5b52a0..30c6f154b7 100644 --- a/src/OPENMP/bond_fene_expand_omp.cpp +++ b/src/OPENMP/bond_fene_expand_omp.cpp @@ -89,8 +89,8 @@ void BondFENEExpandOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq,r0sq,rlogarg,sr2,sr6; double r,rshift,rshiftsq; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/bond_fene_omp.cpp b/src/OPENMP/bond_fene_omp.cpp index 57afe43a18..ef1343ec90 100644 --- a/src/OPENMP/bond_fene_omp.cpp +++ b/src/OPENMP/bond_fene_omp.cpp @@ -88,8 +88,8 @@ void BondFENEOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r0sq,rlogarg,sr2,sr6; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/bond_gromos_omp.cpp b/src/OPENMP/bond_gromos_omp.cpp index bba8f15230..6089290386 100644 --- a/src/OPENMP/bond_gromos_omp.cpp +++ b/src/OPENMP/bond_gromos_omp.cpp @@ -81,8 +81,8 @@ void BondGromosOMP::eval(int nfrom, int nto, ThrData * const thr) int i1,i2,n,type; double delx,dely,delz,ebond,fbond; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_harmonic_omp.cpp b/src/OPENMP/bond_harmonic_omp.cpp index 5ad816bf1b..cc9bbea5da 100644 --- a/src/OPENMP/bond_harmonic_omp.cpp +++ b/src/OPENMP/bond_harmonic_omp.cpp @@ -84,8 +84,8 @@ void BondHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_harmonic_shift_cut_omp.cpp b/src/OPENMP/bond_harmonic_shift_cut_omp.cpp index 3d462a8305..702eae64d0 100644 --- a/src/OPENMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/OPENMP/bond_harmonic_shift_cut_omp.cpp @@ -84,8 +84,8 @@ void BondHarmonicShiftCutOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_harmonic_shift_omp.cpp b/src/OPENMP/bond_harmonic_shift_omp.cpp index 567287bcc7..375de2eff7 100644 --- a/src/OPENMP/bond_harmonic_shift_omp.cpp +++ b/src/OPENMP/bond_harmonic_shift_omp.cpp @@ -84,8 +84,8 @@ void BondHarmonicShiftOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,rk; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_morse_omp.cpp b/src/OPENMP/bond_morse_omp.cpp index 3e9c5a9b5b..b1938b926f 100644 --- a/src/OPENMP/bond_morse_omp.cpp +++ b/src/OPENMP/bond_morse_omp.cpp @@ -84,8 +84,8 @@ void BondMorseOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,ralpha; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_nonlinear_omp.cpp b/src/OPENMP/bond_nonlinear_omp.cpp index 4a011a1f8a..209c7d4719 100644 --- a/src/OPENMP/bond_nonlinear_omp.cpp +++ b/src/OPENMP/bond_nonlinear_omp.cpp @@ -84,8 +84,8 @@ void BondNonlinearOMP::eval(int nfrom, int nto, ThrData * const thr) double delx,dely,delz,ebond,fbond; double rsq,r,dr,drsq,lamdasq,denom,denomsq; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/bond_table_omp.cpp b/src/OPENMP/bond_table_omp.cpp index dcc13c85c9..011ba5cc49 100644 --- a/src/OPENMP/bond_table_omp.cpp +++ b/src/OPENMP/bond_table_omp.cpp @@ -85,8 +85,8 @@ void BondTableOMP::eval(int nfrom, int nto, ThrData * const thr) double rsq,r; double u,mdu; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int3_t * _noalias const bondlist = (int3_t *) neighbor->bondlist[0]; const int nlocal = atom->nlocal; ebond = 0.0; diff --git a/src/OPENMP/dihedral_charmm_omp.cpp b/src/OPENMP/dihedral_charmm_omp.cpp index 7efd6d367b..72d6a93a64 100644 --- a/src/OPENMP/dihedral_charmm_omp.cpp +++ b/src/OPENMP/dihedral_charmm_omp.cpp @@ -103,8 +103,8 @@ void DihedralCharmmOMP::eval(int nfrom, int nto, ThrData * const thr) ecoul = evdwl = edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * const atomtype = atom->type; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; diff --git a/src/OPENMP/dihedral_class2_omp.cpp b/src/OPENMP/dihedral_class2_omp.cpp index f843def3ec..e2bcfaa990 100644 --- a/src/OPENMP/dihedral_class2_omp.cpp +++ b/src/OPENMP/dihedral_class2_omp.cpp @@ -99,8 +99,8 @@ void DihedralClass2OMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp index 9da2a5b8b5..45ca6ee84f 100644 --- a/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp +++ b/src/OPENMP/dihedral_cosine_shift_exp_omp.cpp @@ -95,8 +95,8 @@ void DihedralCosineShiftExpOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_fourier_omp.cpp b/src/OPENMP/dihedral_fourier_omp.cpp index a7c5264fa5..594cd3e922 100644 --- a/src/OPENMP/dihedral_fourier_omp.cpp +++ b/src/OPENMP/dihedral_fourier_omp.cpp @@ -92,8 +92,8 @@ void DihedralFourierOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_harmonic_omp.cpp b/src/OPENMP/dihedral_harmonic_omp.cpp index 6bbfd6ff12..dd93cfd126 100644 --- a/src/OPENMP/dihedral_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_harmonic_omp.cpp @@ -94,8 +94,8 @@ void DihedralHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_helix_omp.cpp b/src/OPENMP/dihedral_helix_omp.cpp index c73622ed9d..d33f7fb4d0 100644 --- a/src/OPENMP/dihedral_helix_omp.cpp +++ b/src/OPENMP/dihedral_helix_omp.cpp @@ -97,8 +97,8 @@ void DihedralHelixOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_multi_harmonic_omp.cpp b/src/OPENMP/dihedral_multi_harmonic_omp.cpp index cf7e991c9d..d8de18e3c3 100644 --- a/src/OPENMP/dihedral_multi_harmonic_omp.cpp +++ b/src/OPENMP/dihedral_multi_harmonic_omp.cpp @@ -95,8 +95,8 @@ void DihedralMultiHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_nharmonic_omp.cpp b/src/OPENMP/dihedral_nharmonic_omp.cpp index f2ec46190e..11c0839529 100644 --- a/src/OPENMP/dihedral_nharmonic_omp.cpp +++ b/src/OPENMP/dihedral_nharmonic_omp.cpp @@ -94,8 +94,8 @@ void DihedralNHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_opls_omp.cpp b/src/OPENMP/dihedral_opls_omp.cpp index 543485aa0f..b3b5ea9178 100644 --- a/src/OPENMP/dihedral_opls_omp.cpp +++ b/src/OPENMP/dihedral_opls_omp.cpp @@ -96,8 +96,8 @@ void DihedralOPLSOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/dihedral_quadratic_omp.cpp b/src/OPENMP/dihedral_quadratic_omp.cpp index f6582d3bc0..2c08dd4505 100644 --- a/src/OPENMP/dihedral_quadratic_omp.cpp +++ b/src/OPENMP/dihedral_quadratic_omp.cpp @@ -97,8 +97,8 @@ void DihedralQuadraticOMP::eval(int nfrom, int nto, ThrData * const thr) edihedral = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const dihedrallist = (int5_t *) neighbor->dihedrallist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/domain_omp.cpp b/src/OPENMP/domain_omp.cpp index af4d41a585..acc4be204f 100644 --- a/src/OPENMP/domain_omp.cpp +++ b/src/OPENMP/domain_omp.cpp @@ -47,7 +47,7 @@ void DomainOMP::pbc() // verify owned atoms have valid numerical coords // may not if computed pairwise force between 2 atoms at same location - const double *_noalias const coord = &atom->x[0][0]; + const double *_noalias const coord = atom->x[0]; // NOLINT const int n3 = 3 * nlocal; int flag = 0; #if defined(_OPENMP) // clang-format off @@ -57,8 +57,8 @@ void DomainOMP::pbc() if (!std::isfinite(coord[i])) flag = 1; if (flag) error->one(FLERR, "Non-numeric atom coords - simulation unstable"); - dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; - dbl3_t *_noalias const v = (dbl3_t *) &atom->v[0][0]; + auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const v = (dbl3_t *) atom->v[0]; const double *_noalias const lo = (triclinic == 0) ? boxlo : boxlo_lamda; const double *_noalias const hi = (triclinic == 0) ? boxhi : boxhi_lamda; const double *_noalias const period = (triclinic == 0) ? prd : prd_lamda; @@ -162,7 +162,7 @@ void DomainOMP::lamda2x(int n) { const int num = n; if (!n) return; - dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; + auto *_noalias const x = (dbl3_t *) atom->x[0]; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) @@ -183,7 +183,7 @@ void DomainOMP::x2lamda(int n) { const int num = n; if (!n) return; - dbl3_t *_noalias const x = (dbl3_t *) &atom->x[0][0]; + auto *_noalias const x = (dbl3_t *) atom->x[0]; #if defined(_OPENMP) #pragma omp parallel for LMP_DEFAULT_NONE schedule(static) diff --git a/src/OPENMP/fix_neigh_history_omp.cpp b/src/OPENMP/fix_neigh_history_omp.cpp index 4db6678721..ec101709c9 100644 --- a/src/OPENMP/fix_neigh_history_omp.cpp +++ b/src/OPENMP/fix_neigh_history_omp.cpp @@ -578,7 +578,7 @@ void FixNeighHistoryOMP::post_neighbor() for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; - rflag = sbmask(j); + rflag = histmask(j); j &= NEIGHMASK; jlist[jj] = j; diff --git a/src/OPENMP/fix_nh_asphere_omp.cpp b/src/OPENMP/fix_nh_asphere_omp.cpp index 9325038790..554a0d52b6 100644 --- a/src/OPENMP/fix_nh_asphere_omp.cpp +++ b/src/OPENMP/fix_nh_asphere_omp.cpp @@ -43,7 +43,7 @@ FixNHAsphereOMP::FixNHAsphereOMP(LAMMPS *lmp, int narg, char **arg) : void FixNHAsphereOMP::init() { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Compute nvt/nph/npt asphere requires atom style ellipsoid"); @@ -68,10 +68,10 @@ void FixNHAsphereOMP::init() void FixNHAsphereOMP::nve_v() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; - const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const torque = (dbl3_t *) atom->torque[0]; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -101,9 +101,9 @@ void FixNHAsphereOMP::nve_v() void FixNHAsphereOMP::nve_x() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const angmom = (dbl3_t *) atom->angmom[0]; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; AtomVecEllipsoid::Bonus * _noalias const bonus = avec->bonus; @@ -154,8 +154,8 @@ void FixNHAsphereOMP::nve_x() void FixNHAsphereOMP::nh_v_temp() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const angmom = (dbl3_t *) atom->angmom[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const angmom = (dbl3_t *) atom->angmom[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nh_asphere_omp.h b/src/OPENMP/fix_nh_asphere_omp.h index fd39e3dce6..55eee148c6 100644 --- a/src/OPENMP/fix_nh_asphere_omp.h +++ b/src/OPENMP/fix_nh_asphere_omp.h @@ -36,16 +36,3 @@ class FixNHAsphereOMP : public FixNHOMP { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Compute nvt/nph/npt asphere requires atom style ellipsoid - -Self-explanatory. - -E: Fix nvt/nph/npt asphere requires extended particles - -The shape setting for a particle in the fix group has shape = 0.0, -which means it is a point particle. - -*/ diff --git a/src/OPENMP/fix_nh_omp.cpp b/src/OPENMP/fix_nh_omp.cpp index c2601c1b22..29186af629 100644 --- a/src/OPENMP/fix_nh_omp.cpp +++ b/src/OPENMP/fix_nh_omp.cpp @@ -16,15 +16,17 @@ Contributing authors: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_nh_omp.h" -#include + #include "atom.h" #include "compute.h" #include "domain.h" #include "error.h" #include "modify.h" +#include + +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -231,7 +233,7 @@ void FixNHOMP::nh_v_press() const double factor0 = exp(-dt4*(omega_dot[0]+mtk_term2)); const double factor1 = exp(-dt4*(omega_dot[1]+mtk_term2)); const double factor2 = exp(-dt4*(omega_dot[2]+mtk_term2)); - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -283,8 +285,8 @@ void FixNHOMP::nh_v_press() void FixNHOMP::nve_v() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -324,8 +326,8 @@ void FixNHOMP::nve_v() void FixNHOMP::nve_x() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -348,7 +350,7 @@ void FixNHOMP::nve_x() void FixNHOMP::nh_v_temp() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nh_omp.h b/src/OPENMP/fix_nh_omp.h index f95bcf3e54..cd6db0736f 100644 --- a/src/OPENMP/fix_nh_omp.h +++ b/src/OPENMP/fix_nh_omp.h @@ -33,120 +33,3 @@ class FixNHOMP : public FixNH { } // namespace LAMMPS_NS #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: Target temperature for fix nvt/npt/nph cannot be 0.0 - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix nvt/npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix nvt/npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix nvt/npt/nph on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix nvt/npt/nph with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix nvt/npt/nph with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix nvt/npt/nph pressure settings - -Settings for coupled dimensions must be the same. - -E: Fix nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix npt and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix nvt/nph/npt does not exist - -Self-explanatory. - -E: Pressure ID for fix npt/nph does not exist - -Self-explanatory. - -E: Fix npt/nph has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/OPENMP/fix_nh_sphere_omp.cpp b/src/OPENMP/fix_nh_sphere_omp.cpp index 2c00a8ffb7..788db2b6ee 100644 --- a/src/OPENMP/fix_nh_sphere_omp.cpp +++ b/src/OPENMP/fix_nh_sphere_omp.cpp @@ -16,12 +16,13 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "fix_nh_sphere_omp.h" + #include "atom.h" #include "compute.h" #include "error.h" +#include "omp_compat.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -65,10 +66,10 @@ void FixNHSphereOMP::init() void FixNHSphereOMP::nve_v() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; - const dbl3_t * _noalias const torque = (dbl3_t *) atom->torque[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const omega = (dbl3_t *) atom->omega[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const torque = (dbl3_t *) atom->torque[0]; const double * _noalias const radius = atom->radius; const double * _noalias const rmass = atom->rmass; const int * _noalias const mask = atom->mask; @@ -110,8 +111,8 @@ void FixNHSphereOMP::nve_v() void FixNHSphereOMP::nh_v_temp() { - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const omega = (dbl3_t *) atom->omega[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const omega = (dbl3_t *) atom->omega[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nh_sphere_omp.h b/src/OPENMP/fix_nh_sphere_omp.h index 3cc716450a..3d799f9c2d 100644 --- a/src/OPENMP/fix_nh_sphere_omp.h +++ b/src/OPENMP/fix_nh_sphere_omp.h @@ -32,15 +32,3 @@ class FixNHSphereOMP : public FixNHOMP { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Fix nvt/nph/npt sphere requires atom style sphere - -Self-explanatory. - -E: Fix nvt/sphere requires extended particles - -This fix can only be used for particles of a finite size. - -*/ diff --git a/src/OPENMP/fix_nph_asphere_omp.h b/src/OPENMP/fix_nph_asphere_omp.h index e2b297e26f..28604b3bc0 100644 --- a/src/OPENMP/fix_nph_asphere_omp.h +++ b/src/OPENMP/fix_nph_asphere_omp.h @@ -33,15 +33,3 @@ class FixNPHAsphereOMP : public FixNHAsphereOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph/asphere - -Self-explanatory. - -E: Pressure control must be used with fix nph/asphere - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_nph_omp.h b/src/OPENMP/fix_nph_omp.h index f494a0e487..3590f969e7 100644 --- a/src/OPENMP/fix_nph_omp.h +++ b/src/OPENMP/fix_nph_omp.h @@ -33,15 +33,3 @@ class FixNPHOMP : public FixNHOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph - -Self-explanatory. - -E: Pressure control must be used with fix nph - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_nph_sphere_omp.h b/src/OPENMP/fix_nph_sphere_omp.h index 26ec718abb..45576b533f 100644 --- a/src/OPENMP/fix_nph_sphere_omp.h +++ b/src/OPENMP/fix_nph_sphere_omp.h @@ -33,15 +33,3 @@ class FixNPHSphereOMP : public FixNHSphereOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph/sphere - -Self-explanatory. - -E: Pressure control must be used with fix nph/sphere - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_npt_asphere_omp.h b/src/OPENMP/fix_npt_asphere_omp.h index e125d7d707..d989a87da8 100644 --- a/src/OPENMP/fix_npt_asphere_omp.h +++ b/src/OPENMP/fix_npt_asphere_omp.h @@ -33,15 +33,3 @@ class FixNPTAsphereOMP : public FixNHAsphereOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt/asphere - -Self-explanatory. - -E: Pressure control must be used with fix npt/asphere - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_npt_omp.h b/src/OPENMP/fix_npt_omp.h index a726f12313..68c3d58d71 100644 --- a/src/OPENMP/fix_npt_omp.h +++ b/src/OPENMP/fix_npt_omp.h @@ -33,15 +33,3 @@ class FixNPTOMP : public FixNHOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt - -Self-explanatory. - -E: Pressure control must be used with fix npt - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_npt_sphere_omp.h b/src/OPENMP/fix_npt_sphere_omp.h index d806b9ccaf..28cf26da0a 100644 --- a/src/OPENMP/fix_npt_sphere_omp.h +++ b/src/OPENMP/fix_npt_sphere_omp.h @@ -33,15 +33,3 @@ class FixNPTSphereOMP : public FixNHSphereOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt/sphere - -Self-explanatory. - -E: Pressure control must be used with fix npt/sphere - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_nve_omp.cpp b/src/OPENMP/fix_nve_omp.cpp index 1380d4ea18..6562e90270 100644 --- a/src/OPENMP/fix_nve_omp.cpp +++ b/src/OPENMP/fix_nve_omp.cpp @@ -34,9 +34,9 @@ void FixNVEOMP::initial_integrate(int /* vflag */) { // update v and x of atoms in group - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const int * const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; @@ -81,8 +81,8 @@ void FixNVEOMP::final_integrate() { // update v of atoms in group - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const int * const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nve_omp.h b/src/OPENMP/fix_nve_omp.h index 47722f0078..fa5300d741 100644 --- a/src/OPENMP/fix_nve_omp.h +++ b/src/OPENMP/fix_nve_omp.h @@ -36,13 +36,3 @@ class FixNVEOMP : public FixNVE { #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. - -*/ diff --git a/src/OPENMP/fix_nvt_asphere_omp.h b/src/OPENMP/fix_nvt_asphere_omp.h index 78104e9800..e63a669d3f 100644 --- a/src/OPENMP/fix_nvt_asphere_omp.h +++ b/src/OPENMP/fix_nvt_asphere_omp.h @@ -33,15 +33,3 @@ class FixNVTAsphereOMP : public FixNHAsphereOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/asphere - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/asphere - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_nvt_omp.h b/src/OPENMP/fix_nvt_omp.h index 4b67a52c3d..b89cba9e73 100644 --- a/src/OPENMP/fix_nvt_omp.h +++ b/src/OPENMP/fix_nvt_omp.h @@ -33,15 +33,3 @@ class FixNVTOMP : public FixNHOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt - -Self-explanatory. - -E: Pressure control can not be used with fix nvt - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_nvt_sllod_omp.cpp b/src/OPENMP/fix_nvt_sllod_omp.cpp index 3a36b0eff5..c9ee6c153f 100644 --- a/src/OPENMP/fix_nvt_sllod_omp.cpp +++ b/src/OPENMP/fix_nvt_sllod_omp.cpp @@ -78,7 +78,7 @@ void FixNVTSllodOMP::init() int i; for (i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^deform")) { - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix " "deform remap option"); break; @@ -100,7 +100,7 @@ void FixNVTSllodOMP::nh_v_temp() // calculate temperature since some computes require temp // computed on current nlocal atoms to remove bias - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; const int * _noalias const mask = atom->mask; const int nlocal = (igroup == atom->firstgroup) ? atom->nfirst : atom->nlocal; diff --git a/src/OPENMP/fix_nvt_sllod_omp.h b/src/OPENMP/fix_nvt_sllod_omp.h index d93941a9a9..c78564aba8 100644 --- a/src/OPENMP/fix_nvt_sllod_omp.h +++ b/src/OPENMP/fix_nvt_sllod_omp.h @@ -39,28 +39,3 @@ class FixNVTSllodOMP : public FixNHOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/sllod - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/sllod - -Self-explanatory. - -E: Temperature for fix nvt/sllod does not have a bias - -The specified compute must compute temperature with a bias. - -E: Using fix nvt/sllod with inconsistent fix deform remap option - -Fix nvt/sllod requires that deforming atoms have a velocity profile -provided by "remap v" as a fix deform option. - -E: Using fix nvt/sllod with no fix deform defined - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_nvt_sphere_omp.h b/src/OPENMP/fix_nvt_sphere_omp.h index d436017507..4b12d9093b 100644 --- a/src/OPENMP/fix_nvt_sphere_omp.h +++ b/src/OPENMP/fix_nvt_sphere_omp.h @@ -33,15 +33,3 @@ class FixNVTSphereOMP : public FixNHSphereOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/sphere - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/sphere - -Self-explanatory. - -*/ diff --git a/src/OPENMP/fix_omp.cpp b/src/OPENMP/fix_omp.cpp index 6be7f7c1fc..4f5e990fcc 100644 --- a/src/OPENMP/fix_omp.cpp +++ b/src/OPENMP/fix_omp.cpp @@ -130,7 +130,7 @@ FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) #endif { const int tid = get_tid(); - Timer *t = new Timer(lmp); + auto t = new Timer(lmp); thr[tid] = new ThrData(tid,t); } } @@ -182,7 +182,7 @@ void FixOMP::init() #endif { const int tid = get_tid(); - Timer *t = new Timer(lmp); + auto t = new Timer(lmp); thr[tid] = new ThrData(tid,t); } } @@ -198,10 +198,8 @@ void FixOMP::init() && !utils::strmatch(update->integrate_style,"^respa/omp")) error->all(FLERR,"Must use respa/omp for r-RESPA with /omp styles"); - if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; - else _pair_compute_flag = false; - if (force->kspace && force->kspace->compute_flag) _kspace_compute_flag = true; - else _kspace_compute_flag = false; + _pair_compute_flag = force->pair && force->pair->compute_flag; + _kspace_compute_flag = force->kspace && force->kspace->compute_flag; int check_hybrid, kspace_split; last_pair_hybrid = nullptr; diff --git a/src/OPENMP/fix_qeq_comb_omp.cpp b/src/OPENMP/fix_qeq_comb_omp.cpp index 18f579ad3a..a0d622401c 100644 --- a/src/OPENMP/fix_qeq_comb_omp.cpp +++ b/src/OPENMP/fix_qeq_comb_omp.cpp @@ -49,13 +49,13 @@ void FixQEQCombOMP::init() if (nullptr != force->pair_match("comb3", 0)) error->all(FLERR, "No support for comb3 currently available in OPENMP"); - comb = (PairComb *) force->pair_match("comb/omp", 1); - if (comb == nullptr) comb = (PairComb *) force->pair_match("comb", 1); + comb = dynamic_cast(force->pair_match("comb/omp", 1)); + if (comb == nullptr) comb = dynamic_cast(force->pair_match("comb", 1)); if (comb == nullptr) error->all(FLERR, "Must use pair_style comb or comb/omp with fix qeq/comb/omp"); if (utils::strmatch(update->integrate_style, "^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; + ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } diff --git a/src/OPENMP/fix_qeq_reaxff_omp.cpp b/src/OPENMP/fix_qeq_reaxff_omp.cpp index 63dd28aa77..27a4ed037b 100644 --- a/src/OPENMP/fix_qeq_reaxff_omp.cpp +++ b/src/OPENMP/fix_qeq_reaxff_omp.cpp @@ -118,7 +118,7 @@ void FixQEqReaxFFOMP::init() memory->create(aspc_b, aspc_order_max+2, "qeq/reaxff/aspc_b"); // Calculate damping factor - double o = double(aspc_order); + auto o = double(aspc_order); aspc_omega = (o+2.0) / (2*o+3.0); // Calculate B coefficients diff --git a/src/OPENMP/fix_rigid_nh_omp.cpp b/src/OPENMP/fix_rigid_nh_omp.cpp index 4e73eaa89b..ce13bf3c37 100644 --- a/src/OPENMP/fix_rigid_nh_omp.cpp +++ b/src/OPENMP/fix_rigid_nh_omp.cpp @@ -236,7 +236,7 @@ void FixRigidNHOMP::initial_integrate(int vflag) void FixRigidNHOMP::compute_forces_and_torques() { double * const * _noalias const x = atom->x; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; const int nlocal = atom->nlocal; @@ -606,9 +606,9 @@ void FixRigidNHOMP::remap() template void FixRigidNHOMP::set_xv_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -633,9 +633,9 @@ void FixRigidNHOMP::set_xv_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &xcmi = * ((dbl3_t *) xcm[ibody]); - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &xcmi = * ((dbl3_t *) xcm[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); const int xbox = (xcmimage[i] & IMGMASK) - IMGMAX; const int ybox = (xcmimage[i] >> IMGBITS & IMGMASK) - IMGMAX; @@ -806,9 +806,9 @@ void FixRigidNHOMP::set_xv_thr() template void FixRigidNHOMP::set_v_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -833,8 +833,8 @@ void FixRigidNHOMP::set_v_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); double delta[3],vx,vy,vz; MathExtra::matvec(ex_space[ibody],ey_space[ibody], diff --git a/src/OPENMP/fix_rigid_nh_omp.h b/src/OPENMP/fix_rigid_nh_omp.h index ce6309213b..03ec6766a4 100644 --- a/src/OPENMP/fix_rigid_nh_omp.h +++ b/src/OPENMP/fix_rigid_nh_omp.h @@ -36,80 +36,3 @@ class FixRigidNHOMP : public FixRigidNH { } // namespace LAMMPS_NS #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: Target temperature for fix rigid nvt/npt cannot be 0.0 - -Self-explanatory. - -E: Invalid fix rigid npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix rigid npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix rigid npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix rigid npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Invalid fix rigid npt/nph pressure settings - -Settings for coupled dimensions must be the same. - -E: Fix rigid nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix rigid npt/nph and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix rigid npt/nph does not exist - -Self-explanatory. - -E: Pressure ID for fix rigid npt/nph does not exist - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/OPENMP/fix_rigid_omp.cpp b/src/OPENMP/fix_rigid_omp.cpp index 97a2b50827..b5d73fe18a 100644 --- a/src/OPENMP/fix_rigid_omp.cpp +++ b/src/OPENMP/fix_rigid_omp.cpp @@ -109,7 +109,7 @@ void FixRigidOMP::initial_integrate(int vflag) void FixRigidOMP::compute_forces_and_torques() { double * const * _noalias const x = atom->x; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; const int nlocal = atom->nlocal; @@ -326,9 +326,9 @@ void FixRigidOMP::final_integrate() template void FixRigidOMP::set_xv_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -353,9 +353,9 @@ void FixRigidOMP::set_xv_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &xcmi = * ((dbl3_t *) xcm[ibody]); - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &xcmi = * ((dbl3_t *) xcm[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); const int xbox = (xcmimage[i] & IMGMASK) - IMGMAX; const int ybox = (xcmimage[i] >> IMGBITS & IMGMASK) - IMGMAX; @@ -526,9 +526,9 @@ void FixRigidOMP::set_xv_thr() template void FixRigidOMP::set_v_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -553,8 +553,8 @@ void FixRigidOMP::set_v_thr() const int ibody = body[i]; if (ibody < 0) continue; - const dbl3_t &vcmi = * ((dbl3_t *) vcm[ibody]); - const dbl3_t &omegai = * ((dbl3_t *) omega[ibody]); + const auto &vcmi = * ((dbl3_t *) vcm[ibody]); + const auto &omegai = * ((dbl3_t *) omega[ibody]); double delta[3],vx,vy,vz; MathExtra::matvec(ex_space[ibody],ey_space[ibody], diff --git a/src/OPENMP/fix_rigid_small_omp.cpp b/src/OPENMP/fix_rigid_small_omp.cpp index 896bfdff38..62235b84a7 100644 --- a/src/OPENMP/fix_rigid_small_omp.cpp +++ b/src/OPENMP/fix_rigid_small_omp.cpp @@ -111,7 +111,7 @@ void FixRigidSmallOMP::initial_integrate(int vflag) void FixRigidSmallOMP::compute_forces_and_torques() { double * const * _noalias const x = atom->x; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * const * const torque_one = atom->torque; const int nlocal = atom->nlocal; const int nthreads=comm->nthreads; @@ -273,9 +273,9 @@ void FixRigidSmallOMP::final_integrate() template void FixRigidSmallOMP::set_xv_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; @@ -468,9 +468,9 @@ void FixRigidSmallOMP::set_xv_thr() template void FixRigidSmallOMP::set_v_thr() { - dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - const dbl3_t * _noalias const f = (dbl3_t *) atom->f[0]; + auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const v = (dbl3_t *) atom->v[0]; + const auto * _noalias const f = (dbl3_t *) atom->f[0]; const double * _noalias const rmass = atom->rmass; const double * _noalias const mass = atom->mass; const int * _noalias const type = atom->type; diff --git a/src/OPENMP/fix_rigid_small_omp.h b/src/OPENMP/fix_rigid_small_omp.h index f318f6cf21..335a070296 100644 --- a/src/OPENMP/fix_rigid_small_omp.h +++ b/src/OPENMP/fix_rigid_small_omp.h @@ -47,93 +47,3 @@ class FixRigidSmallOMP : public FixRigidSmall { #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: Fix rigid molecule requires atom attribute molecule - -Self-explanatory. - -E: Could not find fix rigid group ID - -A group ID used in the fix rigid command does not exist. - -E: One or more atoms belong to multiple rigid bodies - -Two or more rigid bodies defined by the fix rigid command cannot -contain the same atom. - -E: No rigid bodies defined - -The fix specification did not end up defining any rigid bodies. - -E: Fix rigid z force cannot be on for 2d simulation - -Self-explanatory. - -E: Fix rigid xy torque cannot be on for 2d simulation - -Self-explanatory. - -E: Fix rigid langevin period must be > 0.0 - -Self-explanatory. - -E: One or zero atoms in rigid body - -Any rigid body defined by the fix rigid command must contain 2 or more -atoms. - -W: More than one fix rigid - -It is not efficient to use fix rigid more than once. - -E: Rigid fix must come before NPT/NPH fix - -NPT/NPH fix must be defined in input script after all rigid fixes, -else the rigid fix contribution to the pressure virial is -incorrect. - -W: Computing temperature of portions of rigid bodies - -The group defined by the temperature compute does not encompass all -the atoms in one or more rigid bodies, so the change in -degrees-of-freedom for the atoms in those partial rigid bodies will -not be accounted for. - -E: Fix rigid atom has non-zero image flag in a non-periodic dimension - -You cannot set image flags for non-periodic dimensions. - -E: Insufficient Jacobi rotations for rigid body - -Eigensolve for rigid body was not sufficiently accurate. - -E: Fix rigid: Bad principal moments - -The principal moments of inertia computed for a rigid body -are not within the required tolerances. - -E: Cannot open fix rigid infile %s - -UNDOCUMENTED - -E: Unexpected end of fix rigid file - -UNDOCUMENTED - -E: Incorrect rigid body format in fix rigid file - -UNDOCUMENTED - -E: Invalid rigid body ID in fix rigid file - -UNDOCUMENTED - -*/ diff --git a/src/OPENMP/improper_class2_omp.cpp b/src/OPENMP/improper_class2_omp.cpp index ad53ecd735..9474b696f5 100644 --- a/src/OPENMP/improper_class2_omp.cpp +++ b/src/OPENMP/improper_class2_omp.cpp @@ -106,8 +106,8 @@ void ImproperClass2OMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; @@ -506,8 +506,8 @@ void ImproperClass2OMP::angleangle_thr(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_cossq_omp.cpp b/src/OPENMP/improper_cossq_omp.cpp index 24d7919995..acb6cd0d46 100644 --- a/src/OPENMP/improper_cossq_omp.cpp +++ b/src/OPENMP/improper_cossq_omp.cpp @@ -91,8 +91,8 @@ void ImproperCossqOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_cvff_omp.cpp b/src/OPENMP/improper_cvff_omp.cpp index 3cceb856a9..47b9b930e1 100644 --- a/src/OPENMP/improper_cvff_omp.cpp +++ b/src/OPENMP/improper_cvff_omp.cpp @@ -93,8 +93,8 @@ void ImproperCvffOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_harmonic_omp.cpp b/src/OPENMP/improper_harmonic_omp.cpp index 97d8ad174d..9d341febff 100644 --- a/src/OPENMP/improper_harmonic_omp.cpp +++ b/src/OPENMP/improper_harmonic_omp.cpp @@ -92,8 +92,8 @@ void ImproperHarmonicOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/improper_umbrella_omp.cpp b/src/OPENMP/improper_umbrella_omp.cpp index 91c9237826..a07ac6a73f 100644 --- a/src/OPENMP/improper_umbrella_omp.cpp +++ b/src/OPENMP/improper_umbrella_omp.cpp @@ -91,8 +91,8 @@ void ImproperUmbrellaOMP::eval(int nfrom, int nto, ThrData * const thr) eimproper = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int5_t * _noalias const improperlist = (int5_t *) neighbor->improperlist[0]; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/msm_cg_omp.h b/src/OPENMP/msm_cg_omp.h index 7ad12c8123..910b40c678 100644 --- a/src/OPENMP/msm_cg_omp.h +++ b/src/OPENMP/msm_cg_omp.h @@ -48,99 +48,3 @@ class MSMCGOMP : public MSMOMP { #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: Must use 'kspace_modify pressure/scalar no' with kspace_style msm/cg/omp - -The kspace scalar pressure option is not compatible with kspace_style msm/cg/omp. - -E: Cannot (yet) use MSM with triclinic box - -This feature is not yet supported. - -E: Cannot (yet) use MSM with 2d simulation - -This feature is not yet supported. - -E: Kspace style requires atom attribute q - -The atom style defined does not have these attributes. - -E: Cannot use slab correction with MSM - -Slab correction can only be used with Ewald and PPPM, not MSM. - -E: MSM order must be 4, 6, 8, or 10 - -This is a limitation of the MSM implementation in LAMMPS: -the MSM order can only be 4, 6, 8, or 10. - -E: Cannot (yet) use single precision with MSM (remove -DFFT_SINGLE from Makefile and recompile) - -Single precision cannot be used with MSM. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with a long-range -Coulombic component be selected that is compatible with MSM. Note -that TIP4P is not (yet) supported by MSM. - -E: Cannot use kspace solver on system with no charge - -No atoms in system have a non-zero charge. - -E: System is not charge neutral, net charge = %g - -The total charge on all atoms on the system is not 0.0, which -is not valid for MSM. - -E: MSM grid is too large - -The global MSM grid is larger than OFFSET in one or more dimensions. -OFFSET is currently set to 16384. You likely need to decrease the -requested accuracy. - -W: MSM mesh too small, increasing to 2 points in each direction - -The global MSM grid is too small, so the number of grid points has been -increased - -E: KSpace accuracy must be > 0 - -The kspace accuracy designated in the input must be greater than zero. - -W: Number of MSM mesh points increased to be a multiple of 2 - -MSM requires that the number of grid points in each direction be a multiple -of two and the number of grid points in one or more directions have been -adjusted to meet this requirement. - -W: Adjusting Coulombic cutoff for MSM, new cutoff = %g - -The adjust/cutoff command is turned on and the Coulombic cutoff has been -adjusted to match the user-specified accuracy. - -E: Out of range atoms - cannot compute MSM - -One or more atoms are attempting to map their charge to a MSM grid point -that is not owned by a processor. This is likely for one of two -reasons, both of them bad. First, it may mean that an atom near the -boundary of a processor's sub-domain has moved more than 1/2 the -"neighbor skin distance"_neighbor.html without neighbor lists being -rebuilt and atoms being migrated to new processors. This also means -you may be missing pairwise interactions that need to be computed. -The solution is to change the re-neighboring criteria via the -"neigh_modify"_neigh_modify command. The safest settings are "delay 0 -every 1 check yes". Second, it may mean that an atom has moved far -outside a processor's sub-domain or even the entire simulation box. -This indicates bad physics, e.g. due to highly overlapping atoms, too -large a timestep, etc. - -*/ diff --git a/src/OPENMP/msm_omp.h b/src/OPENMP/msm_omp.h index 2925a21688..2bad9d0db8 100644 --- a/src/OPENMP/msm_omp.h +++ b/src/OPENMP/msm_omp.h @@ -42,11 +42,3 @@ class MSMOMP : public MSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with kspace_style msm/omp - -The kspace scalar pressure option is not compatible with kspace_style msm/omp. - -*/ diff --git a/src/OPENMP/npair_full_bin_atomonly_omp.h b/src/OPENMP/npair_full_bin_atomonly_omp.h index 0b17edd6ec..1ccb6a84d0 100644 --- a/src/OPENMP/npair_full_bin_atomonly_omp.h +++ b/src/OPENMP/npair_full_bin_atomonly_omp.h @@ -37,7 +37,3 @@ class NPairFullBinAtomonlyOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_full_bin_ghost_omp.h b/src/OPENMP/npair_full_bin_ghost_omp.h index e53b4f6a8e..cfc83a37a7 100644 --- a/src/OPENMP/npair_full_bin_ghost_omp.h +++ b/src/OPENMP/npair_full_bin_ghost_omp.h @@ -37,7 +37,3 @@ class NPairFullBinGhostOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_full_bin_omp.h b/src/OPENMP/npair_full_bin_omp.h index 1ce8a70e13..8a1ef7ae1a 100644 --- a/src/OPENMP/npair_full_bin_omp.h +++ b/src/OPENMP/npair_full_bin_omp.h @@ -37,7 +37,3 @@ class NPairFullBinOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_full_multi_old_omp.h b/src/OPENMP/npair_full_multi_old_omp.h index e8430623e1..ee8bf9024b 100644 --- a/src/OPENMP/npair_full_multi_old_omp.h +++ b/src/OPENMP/npair_full_multi_old_omp.h @@ -37,7 +37,3 @@ class NPairFullMultiOldOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_full_multi_omp.h b/src/OPENMP/npair_full_multi_omp.h index 9d0067703f..6272a94c2a 100644 --- a/src/OPENMP/npair_full_multi_omp.h +++ b/src/OPENMP/npair_full_multi_omp.h @@ -37,7 +37,3 @@ class NPairFullMultiOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_full_nsq_ghost_omp.h b/src/OPENMP/npair_full_nsq_ghost_omp.h index c19f7c5a0a..c68e90b7a7 100644 --- a/src/OPENMP/npair_full_nsq_ghost_omp.h +++ b/src/OPENMP/npair_full_nsq_ghost_omp.h @@ -37,7 +37,3 @@ class NPairFullNsqGhostOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_full_nsq_omp.h b/src/OPENMP/npair_full_nsq_omp.h index bb0849e8a6..684a81be8e 100644 --- a/src/OPENMP/npair_full_nsq_omp.h +++ b/src/OPENMP/npair_full_nsq_omp.h @@ -37,7 +37,3 @@ class NPairFullNsqOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_bin_atomonly_newton_omp.h b/src/OPENMP/npair_half_bin_atomonly_newton_omp.h index 42d92b6e16..a74af6cd9a 100644 --- a/src/OPENMP/npair_half_bin_atomonly_newton_omp.h +++ b/src/OPENMP/npair_half_bin_atomonly_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfBinAtomonlyNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h index 319fac9b35..264b8bba73 100644 --- a/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h +++ b/src/OPENMP/npair_half_bin_newtoff_ghost_omp.h @@ -37,7 +37,3 @@ class NPairHalfBinNewtoffGhostOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_bin_newtoff_omp.h b/src/OPENMP/npair_half_bin_newtoff_omp.h index 83dd355b2a..d8520e58ab 100644 --- a/src/OPENMP/npair_half_bin_newtoff_omp.h +++ b/src/OPENMP/npair_half_bin_newtoff_omp.h @@ -36,7 +36,3 @@ class NPairHalfBinNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_bin_newton_omp.h b/src/OPENMP/npair_half_bin_newton_omp.h index f80df43b22..4f2567b4a6 100644 --- a/src/OPENMP/npair_half_bin_newton_omp.h +++ b/src/OPENMP/npair_half_bin_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfBinNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_bin_newton_tri_omp.h b/src/OPENMP/npair_half_bin_newton_tri_omp.h index 6b40d6b95f..a6605b6b25 100644 --- a/src/OPENMP/npair_half_bin_newton_tri_omp.h +++ b/src/OPENMP/npair_half_bin_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfBinNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_multi_newtoff_omp.h b/src/OPENMP/npair_half_multi_newtoff_omp.h index c166c34ce0..46e3556b5b 100644 --- a/src/OPENMP/npair_half_multi_newtoff_omp.h +++ b/src/OPENMP/npair_half_multi_newtoff_omp.h @@ -36,7 +36,3 @@ class NPairHalfMultiNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_multi_newton_omp.h b/src/OPENMP/npair_half_multi_newton_omp.h index c1684bb282..cd0b033de0 100644 --- a/src/OPENMP/npair_half_multi_newton_omp.h +++ b/src/OPENMP/npair_half_multi_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfMultiNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_multi_newton_tri_omp.h b/src/OPENMP/npair_half_multi_newton_tri_omp.h index 44aed7a09c..431b24a557 100644 --- a/src/OPENMP/npair_half_multi_newton_tri_omp.h +++ b/src/OPENMP/npair_half_multi_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfMultiNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_multi_old_newtoff_omp.h b/src/OPENMP/npair_half_multi_old_newtoff_omp.h index 7964e53a88..587997cf8e 100644 --- a/src/OPENMP/npair_half_multi_old_newtoff_omp.h +++ b/src/OPENMP/npair_half_multi_old_newtoff_omp.h @@ -36,7 +36,3 @@ class NPairHalfMultiOldNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_multi_old_newton_omp.h b/src/OPENMP/npair_half_multi_old_newton_omp.h index 3486712933..7c78d50946 100644 --- a/src/OPENMP/npair_half_multi_old_newton_omp.h +++ b/src/OPENMP/npair_half_multi_old_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfMultiOldNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_multi_old_newton_tri_omp.h b/src/OPENMP/npair_half_multi_old_newton_tri_omp.h index 007c936c33..7ddb75efc3 100644 --- a/src/OPENMP/npair_half_multi_old_newton_tri_omp.h +++ b/src/OPENMP/npair_half_multi_old_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfMultiOldNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h index f3ee492dec..0234c420dc 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h +++ b/src/OPENMP/npair_half_nsq_newtoff_ghost_omp.h @@ -37,7 +37,3 @@ class NPairHalfNsqNewtoffGhostOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_nsq_newtoff_omp.h b/src/OPENMP/npair_half_nsq_newtoff_omp.h index 80b56188f2..364c9deb9a 100644 --- a/src/OPENMP/npair_half_nsq_newtoff_omp.h +++ b/src/OPENMP/npair_half_nsq_newtoff_omp.h @@ -36,7 +36,3 @@ class NPairHalfNsqNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_nsq_newton_omp.h b/src/OPENMP/npair_half_nsq_newton_omp.h index 5905af9b26..f34558d98a 100644 --- a/src/OPENMP/npair_half_nsq_newton_omp.h +++ b/src/OPENMP/npair_half_nsq_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfNsqNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_respa_bin_newtoff_omp.h b/src/OPENMP/npair_half_respa_bin_newtoff_omp.h index c9fae76f58..3a488b68b8 100644 --- a/src/OPENMP/npair_half_respa_bin_newtoff_omp.h +++ b/src/OPENMP/npair_half_respa_bin_newtoff_omp.h @@ -37,7 +37,3 @@ class NPairHalfRespaBinNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_respa_bin_newton_omp.h b/src/OPENMP/npair_half_respa_bin_newton_omp.h index 56c6b3bf1e..5c7d397453 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_omp.h +++ b/src/OPENMP/npair_half_respa_bin_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfRespaBinNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h index e43a9ecddc..9120239d2d 100644 --- a/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h +++ b/src/OPENMP/npair_half_respa_bin_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfRespaBinNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h index 4d1b524b7c..b8439f2988 100644 --- a/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h +++ b/src/OPENMP/npair_half_respa_nsq_newtoff_omp.h @@ -37,7 +37,3 @@ class NPairHalfRespaNsqNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_respa_nsq_newton_omp.h b/src/OPENMP/npair_half_respa_nsq_newton_omp.h index b9a879c134..6e334ea2dc 100644 --- a/src/OPENMP/npair_half_respa_nsq_newton_omp.h +++ b/src/OPENMP/npair_half_respa_nsq_newton_omp.h @@ -37,7 +37,3 @@ class NPairHalfRespaNsqNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp b/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp index 445c2ff286..07082868f6 100644 --- a/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newtoff_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_bin_newtoff_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -40,8 +43,10 @@ NPairHalfSizeBinNewtoffOmp::NPairHalfSizeBinNewtoffOmp(LAMMPS *lmp) : void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; @@ -50,7 +55,8 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,ibin; + int i,j,jh,k,n,ibin,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -61,7 +67,14 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -81,6 +94,11 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) ztmp = x[i][2]; radi = radius[i]; ibin = atom2bin[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in surrounding bins in stencil including self // only store pair if i < j @@ -100,10 +118,23 @@ void NPairHalfSizeBinNewtoffOmp::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/OPENMP/npair_half_size_bin_newtoff_omp.h b/src/OPENMP/npair_half_size_bin_newtoff_omp.h index ac226a798a..7853c5ca00 100644 --- a/src/OPENMP/npair_half_size_bin_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_bin_newtoff_omp.h @@ -37,7 +37,3 @@ class NPairHalfSizeBinNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_bin_newton_omp.cpp b/src/OPENMP/npair_half_size_bin_newton_omp.cpp index be110f07e0..42a74f13aa 100644 --- a/src/OPENMP/npair_half_size_bin_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newton_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_bin_newton_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -39,8 +42,10 @@ NPairHalfSizeBinNewtonOmp::NPairHalfSizeBinNewtonOmp(LAMMPS *lmp) : void NPairHalfSizeBinNewtonOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; @@ -49,7 +54,8 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,ibin; + int i,j,jh,k,n,ibin,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -58,7 +64,14 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -77,6 +90,11 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over rest of atoms in i's bin, ghosts are at end of linked list // if j is owned atom, store it, since j is beyond i in linked list @@ -101,10 +119,23 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } @@ -123,10 +154,23 @@ void NPairHalfSizeBinNewtonOmp::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/OPENMP/npair_half_size_bin_newton_omp.h b/src/OPENMP/npair_half_size_bin_newton_omp.h index 03143e3353..708ae2a18a 100644 --- a/src/OPENMP/npair_half_size_bin_newton_omp.h +++ b/src/OPENMP/npair_half_size_bin_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeBinNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp index bc3bda1181..5a77de0796 100644 --- a/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_bin_newton_tri_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_bin_newton_tri_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -39,8 +42,10 @@ NPairHalfSizeBinNewtonTriOmp::NPairHalfSizeBinNewtonTriOmp(LAMMPS *lmp) : void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -48,7 +53,8 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,ibin; + int i,j,jh,k,n,ibin,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -59,7 +65,14 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -78,6 +91,11 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in bins in stencil // pairs for atoms j "below" i are excluded @@ -107,10 +125,23 @@ void NPairHalfSizeBinNewtonTriOmp::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/OPENMP/npair_half_size_bin_newton_tri_omp.h b/src/OPENMP/npair_half_size_bin_newton_tri_omp.h index 4924f4d157..ec2b2db476 100644 --- a/src/OPENMP/npair_half_size_bin_newton_tri_omp.h +++ b/src/OPENMP/npair_half_size_bin_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeBinNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp index da2d7a7590..d58d250209 100644 --- a/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_newtoff_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" @@ -41,8 +44,10 @@ NPairHalfSizeMultiNewtoffOmp::NPairHalfSizeMultiNewtoffOmp(LAMMPS *lmp) : NPair( void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -50,7 +55,9 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -63,7 +70,14 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -84,6 +98,11 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } ibin = atom2bin[i]; @@ -104,27 +123,40 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list) ns = nstencil_multi[icollection][jcollection]; for (k = 0; k < ns; k++) { - js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >=0; j = bins[j]) { - if (j <= i) continue; + js = binhead_multi[jcollection][jbin + s[k]]; + for (j = js; j >=0; j = bins[j]) { + if (j <= i) continue; jtype = type[j]; - if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; + if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } - } + if (rsq <= cutdistsq) { + jh = j; + if (history && rsq < radsum*radsum) + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; + } + } } } diff --git a/src/OPENMP/npair_half_size_multi_newtoff_omp.h b/src/OPENMP/npair_half_size_multi_newtoff_omp.h index 29e5945454..59c175382d 100644 --- a/src/OPENMP/npair_half_size_multi_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_multi_newtoff_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeMultiNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_multi_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_newton_omp.cpp index bcf87d385c..3190131442 100644 --- a/src/OPENMP/npair_half_size_multi_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newton_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_newton_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" @@ -40,8 +43,10 @@ NPairHalfSizeMultiNewtonOmp::NPairHalfSizeMultiNewtonOmp(LAMMPS *lmp) : NPair(lm void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -49,7 +54,9 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -62,7 +69,14 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -83,6 +97,11 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } ibin = atom2bin[i]; @@ -107,7 +126,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) // if j is owned atom, store it if j > i // if j is ghost, only store if j coords are "above and to the right" of i - for (j = js; j >= 0; j = bins[j]) { + for (j = js; j >= 0; j = bins[j]) { if(icollection != jcollection && j < i) continue; if (j >= nlocal) { @@ -121,19 +140,32 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } + if (rsq <= cutdistsq) { + jh = j; + if (history && rsq < radsum*radsum) + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; + } } } @@ -142,31 +174,43 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list) // stencil is half if i same size as j // stencil is full if i smaller than j - s = stencil_multi[icollection][jcollection]; - ns = nstencil_multi[icollection][jcollection]; + s = stencil_multi[icollection][jcollection]; + ns = nstencil_multi[icollection][jcollection]; - for (k = 0; k < ns; k++) { - js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >= 0; j = bins[j]) { + for (k = 0; k < ns; k++) { + js = binhead_multi[jcollection][jbin + s[k]]; + for (j = js; j >= 0; j = bins[j]) { jtype = type[j]; - if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; + if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } - } + if (rsq <= cutdistsq) { + if (history && rsq < radsum*radsum) + j = j ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = j; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = j; + else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); + } else neighptr[n++] = j; } + } + } } ilist[i] = i; diff --git a/src/OPENMP/npair_half_size_multi_newton_omp.h b/src/OPENMP/npair_half_size_multi_newton_omp.h index e3200d094e..b235fd2d28 100644 --- a/src/OPENMP/npair_half_size_multi_newton_omp.h +++ b/src/OPENMP/npair_half_size_multi_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeMultiNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp index d38e52fe18..717e023f4a 100644 --- a/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_newton_tri_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_newton_tri_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" @@ -41,8 +44,10 @@ NPairHalfSizeMultiNewtonTriOmp::NPairHalfSizeMultiNewtonTriOmp(LAMMPS *lmp) : void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -50,7 +55,9 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -63,7 +70,14 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -84,6 +98,11 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } ibin = atom2bin[i]; @@ -104,12 +123,12 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) // (equal zyx and j <= i) // latter excludes self-self interaction but allows superposed atoms - s = stencil_multi[icollection][jcollection]; - ns = nstencil_multi[icollection][jcollection]; + s = stencil_multi[icollection][jcollection]; + ns = nstencil_multi[icollection][jcollection]; - for (k = 0; k < ns; k++) { - js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >= 0; j = bins[j]) { + for (k = 0; k < ns; k++) { + js = binhead_multi[jcollection][jbin + s[k]]; + for (j = js; j >= 0; j = bins[j]) { // if same size (same collection), use half stencil if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){ @@ -126,21 +145,34 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list) jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } - } + if (rsq <= cutdistsq) { + jh = j; + if (history && rsq < radsum*radsum) + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } + } + } } ilist[i] = i; diff --git a/src/OPENMP/npair_half_size_multi_newton_tri_omp.h b/src/OPENMP/npair_half_size_multi_newton_tri_omp.h index 8eee91e055..117acb2a04 100644 --- a/src/OPENMP/npair_half_size_multi_newton_tri_omp.h +++ b/src/OPENMP/npair_half_size_multi_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeMultiNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp index 65fca6ed17..37dbe9cc53 100644 --- a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.cpp @@ -13,8 +13,12 @@ ------------------------------------------------------------------------- */ #include "npair_half_size_multi_old_newtoff_omp.h" + #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -39,8 +43,10 @@ NPairHalfSizeMultiOldNewtoffOmp::NPairHalfSizeMultiOldNewtoffOmp(LAMMPS *lmp) : void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -48,7 +54,8 @@ void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,itype,jtype,ibin,ns; + int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -58,7 +65,14 @@ void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -78,6 +92,11 @@ void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in other bins in stencil including self // only store pair if i < j @@ -106,10 +125,23 @@ void NPairHalfSizeMultiOldNewtoffOmp::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h index 2ace70c519..7dc8028643 100644 --- a/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_multi_old_newtoff_omp.h @@ -37,7 +37,3 @@ class NPairHalfSizeMultiOldNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp index 907ce7dca8..789ed33e6b 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_old_newton_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -39,8 +42,10 @@ NPairHalfSizeMultiOldNewtonOmp::NPairHalfSizeMultiOldNewtonOmp(LAMMPS *lmp) : void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -48,7 +53,8 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,itype,jtype,ibin,ns; + int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -58,7 +64,14 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -78,6 +91,11 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over rest of atoms in i's bin, ghosts are at end of linked list // if j is owned atom, store it, since j is beyond i in linked list @@ -102,10 +120,23 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } @@ -132,10 +163,23 @@ void NPairHalfSizeMultiOldNewtonOmp::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/OPENMP/npair_half_size_multi_old_newton_omp.h b/src/OPENMP/npair_half_size_multi_old_newton_omp.h index b6df50980c..5644b34dbe 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_omp.h +++ b/src/OPENMP/npair_half_size_multi_old_newton_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeMultiOldNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp index a2bbf9cae0..8302d9fab2 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp +++ b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_old_newton_tri_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -39,8 +42,10 @@ NPairHalfSizeMultiOldNewtonTriOmp::NPairHalfSizeMultiOldNewtonTriOmp(LAMMPS *lmp void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -48,7 +53,8 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,k,n,itype,jtype,ibin,ns; + int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -58,7 +64,14 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; int *ilist = list->ilist; int *numneigh = list->numneigh; @@ -78,6 +91,11 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in bins, including self, in stencil // skip if i,j neighbor cutoff is less than bin distance @@ -115,10 +133,23 @@ void NPairHalfSizeMultiOldNewtonTriOmp::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h index e9635de08a..124e72c8e6 100644 --- a/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h +++ b/src/OPENMP/npair_half_size_multi_old_newton_tri_omp.h @@ -36,7 +36,3 @@ class NPairHalfSizeMultiOldNewtonTriOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp b/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp index f182492efe..7f4b22e729 100644 --- a/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newtoff_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_nsq_newtoff_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "group.h" #include "my_page.h" #include "neigh_list.h" @@ -42,8 +45,10 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; const int bitmask = (includegroup) ? group->bitmask[includegroup] : 0; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; @@ -52,7 +57,8 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,n; + int i,j,jh,n,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -61,9 +67,17 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + int nall = atom->nlocal + atom->nghost; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; @@ -81,6 +95,11 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over remaining atoms, owned and ghost @@ -96,10 +115,23 @@ void NPairHalfSizeNsqNewtoffOmp::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } diff --git a/src/OPENMP/npair_half_size_nsq_newtoff_omp.h b/src/OPENMP/npair_half_size_nsq_newtoff_omp.h index bc6f2ebf8c..ee022b0cf5 100644 --- a/src/OPENMP/npair_half_size_nsq_newtoff_omp.h +++ b/src/OPENMP/npair_half_size_nsq_newtoff_omp.h @@ -37,7 +37,3 @@ class NPairHalfSizeNsqNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp index fdea8f4468..9262b869af 100644 --- a/src/OPENMP/npair_half_size_nsq_newton_omp.cpp +++ b/src/OPENMP/npair_half_size_nsq_newton_omp.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_nsq_newton_omp.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "group.h" #include "my_page.h" #include "neigh_list.h" @@ -42,9 +45,11 @@ NPairHalfSizeNsqNewtonOmp::NPairHalfSizeNsqNewtonOmp(LAMMPS *lmp) : void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) { const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal; - const int bitmask = (includegroup) ? group->bitmask[includegroup] : 0;; + const int bitmask = (includegroup) ? group->bitmask[includegroup] : 0; + const int molecular = atom->molecular; + const int moltemplate = (molecular == Atom::TEMPLATE) ? 1 : 0; const int history = list->history; - const int mask_history = 3 << SBBITS; + const int mask_history = 1 << HISTBITS; NPAIR_OMP_INIT; @@ -53,7 +58,8 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) #endif NPAIR_OMP_SETUP(nlocal); - int i,j,n,itag,jtag; + int i,j,jh,n,itag,jtag,which,imol,iatom; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -64,6 +70,13 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; + + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + int nall = atom->nlocal + atom->nghost; int *ilist = list->ilist; @@ -84,6 +97,11 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over remaining atoms, owned and ghost @@ -115,10 +133,23 @@ void NPairHalfSizeNsqNewtonOmp::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >=0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } diff --git a/src/OPENMP/npair_half_size_nsq_newton_omp.h b/src/OPENMP/npair_half_size_nsq_newton_omp.h index 19b16afc30..5929a8ec49 100644 --- a/src/OPENMP/npair_half_size_nsq_newton_omp.h +++ b/src/OPENMP/npair_half_size_nsq_newton_omp.h @@ -37,7 +37,3 @@ class NPairHalfSizeNsqNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_halffull_newtoff_omp.h b/src/OPENMP/npair_halffull_newtoff_omp.h index 272fb8f570..a9b89814a4 100644 --- a/src/OPENMP/npair_halffull_newtoff_omp.h +++ b/src/OPENMP/npair_halffull_newtoff_omp.h @@ -42,7 +42,3 @@ class NPairHalffullNewtoffOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_halffull_newton_omp.h b/src/OPENMP/npair_halffull_newton_omp.h index bd54ec03fe..9a6339b934 100644 --- a/src/OPENMP/npair_halffull_newton_omp.h +++ b/src/OPENMP/npair_halffull_newton_omp.h @@ -42,7 +42,3 @@ class NPairHalffullNewtonOmp : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/npair_skip_omp.h b/src/OPENMP/npair_skip_omp.h index fcc930dc2c..7f5daa6791 100644 --- a/src/OPENMP/npair_skip_omp.h +++ b/src/OPENMP/npair_skip_omp.h @@ -53,6 +53,3 @@ NPairStyle(skip/ghost/omp, // clang-format off #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/OPENMP/pair_adp_omp.cpp b/src/OPENMP/pair_adp_omp.cpp index cf9514e4d6..93a0fa1215 100644 --- a/src/OPENMP/pair_adp_omp.cpp +++ b/src/OPENMP/pair_adp_omp.cpp @@ -112,8 +112,8 @@ void PairADPOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); double * const * const mu_t = thr->get_mu(); double * const * const lambda_t = thr->get_lambda(); diff --git a/src/OPENMP/pair_agni_omp.cpp b/src/OPENMP/pair_agni_omp.cpp index 814845108f..4719d7e4a4 100644 --- a/src/OPENMP/pair_agni_omp.cpp +++ b/src/OPENMP/pair_agni_omp.cpp @@ -80,8 +80,8 @@ void PairAGNIOMP::eval(int iifrom, int iito, ThrData * const thr) double rsq; int *ilist,*jlist,*numneigh,**firstneigh; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; ilist = list->ilist; diff --git a/src/OPENMP/pair_beck_omp.cpp b/src/OPENMP/pair_beck_omp.cpp index 5f9a9efa8a..dae9decc0e 100644 --- a/src/OPENMP/pair_beck_omp.cpp +++ b/src/OPENMP/pair_beck_omp.cpp @@ -88,8 +88,8 @@ void PairBeckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_born_coul_long_omp.cpp b/src/OPENMP/pair_born_coul_long_omp.cpp index 99851bb943..9d52b6cc8c 100644 --- a/src/OPENMP/pair_born_coul_long_omp.cpp +++ b/src/OPENMP/pair_born_coul_long_omp.cpp @@ -95,8 +95,8 @@ void PairBornCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_born_coul_msm_omp.cpp b/src/OPENMP/pair_born_coul_msm_omp.cpp index 0fe1456ec7..ec6cb989c3 100644 --- a/src/OPENMP/pair_born_coul_msm_omp.cpp +++ b/src/OPENMP/pair_born_coul_msm_omp.cpp @@ -93,8 +93,8 @@ void PairBornCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_born_coul_msm_omp.h b/src/OPENMP/pair_born_coul_msm_omp.h index c1e52006c6..34f81b2eac 100644 --- a/src/OPENMP/pair_born_coul_msm_omp.h +++ b/src/OPENMP/pair_born_coul_msm_omp.h @@ -46,11 +46,3 @@ class PairBornCoulMSMOMP : public PairBornCoulMSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with OMP MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with OMP MSM Pair styles. - -*/ diff --git a/src/OPENMP/pair_born_coul_wolf_omp.cpp b/src/OPENMP/pair_born_coul_wolf_omp.cpp index 32d7830faf..af6771fd9c 100644 --- a/src/OPENMP/pair_born_coul_wolf_omp.cpp +++ b/src/OPENMP/pair_born_coul_wolf_omp.cpp @@ -90,8 +90,8 @@ void PairBornCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_born_omp.cpp b/src/OPENMP/pair_born_omp.cpp index ea6d64fc33..673136b00b 100644 --- a/src/OPENMP/pair_born_omp.cpp +++ b/src/OPENMP/pair_born_omp.cpp @@ -83,8 +83,8 @@ void PairBornOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_buck_coul_cut_omp.cpp b/src/OPENMP/pair_buck_coul_cut_omp.cpp index 0df45126bf..4f086932db 100644 --- a/src/OPENMP/pair_buck_coul_cut_omp.cpp +++ b/src/OPENMP/pair_buck_coul_cut_omp.cpp @@ -85,8 +85,8 @@ void PairBuckCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_buck_coul_long_omp.cpp b/src/OPENMP/pair_buck_coul_long_omp.cpp index 396b4edd3c..0b4f26bf52 100644 --- a/src/OPENMP/pair_buck_coul_long_omp.cpp +++ b/src/OPENMP/pair_buck_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairBuckCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_buck_coul_msm_omp.cpp b/src/OPENMP/pair_buck_coul_msm_omp.cpp index 6442f45eac..e859a0e284 100644 --- a/src/OPENMP/pair_buck_coul_msm_omp.cpp +++ b/src/OPENMP/pair_buck_coul_msm_omp.cpp @@ -94,8 +94,8 @@ void PairBuckCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; int *type = atom->type; int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_buck_coul_msm_omp.h b/src/OPENMP/pair_buck_coul_msm_omp.h index 8928234007..a04f7a3f95 100644 --- a/src/OPENMP/pair_buck_coul_msm_omp.h +++ b/src/OPENMP/pair_buck_coul_msm_omp.h @@ -46,11 +46,3 @@ class PairBuckCoulMSMOMP : public PairBuckCoulMSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with OMP MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with OMP MSM Pair styles. - -*/ diff --git a/src/OPENMP/pair_buck_long_coul_long_omp.h b/src/OPENMP/pair_buck_long_coul_long_omp.h index 3681e6e48e..98425350ad 100644 --- a/src/OPENMP/pair_buck_long_coul_long_omp.h +++ b/src/OPENMP/pair_buck_long_coul_long_omp.h @@ -52,59 +52,3 @@ class PairBuckLongCoulLongOMP : public PairBuckLongCoulLong, public ThrOMP { #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. - -W: Geometric mixing assumed for 1/r^6 coefficients - -Self-explanatory. - -W: Using largest cutoff for buck/long/coul/long - -Self-explanatory. - -E: Cutoffs missing in pair_style buck/long/coul/long - -Self-explanatory. - -E: LJ6 off not supported in pair_style buck/long/coul/long - -Self-explanatory. - -E: Coulomb cut not supported in pair_style buck/long/coul/coul - -Must use long-range Coulombic interactions. - -E: Only one cutoff allowed when requesting all long - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style buck/long/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/OPENMP/pair_buck_omp.cpp b/src/OPENMP/pair_buck_omp.cpp index 88314f912a..285e2fadde 100644 --- a/src/OPENMP/pair_buck_omp.cpp +++ b/src/OPENMP/pair_buck_omp.cpp @@ -83,8 +83,8 @@ void PairBuckOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; int *type = atom->type; int nlocal = atom->nlocal; double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_colloid_omp.cpp b/src/OPENMP/pair_colloid_omp.cpp index ecd560bb8e..64a7d06322 100644 --- a/src/OPENMP/pair_colloid_omp.cpp +++ b/src/OPENMP/pair_colloid_omp.cpp @@ -88,8 +88,8 @@ void PairColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_coul_cut_global_omp.h b/src/OPENMP/pair_coul_cut_global_omp.h index 811c2fe913..f71d6afe21 100644 --- a/src/OPENMP/pair_coul_cut_global_omp.h +++ b/src/OPENMP/pair_coul_cut_global_omp.h @@ -35,21 +35,3 @@ class PairCoulCutGlobalOMP : public PairCoulCutOMP { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/cut requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/OPENMP/pair_coul_cut_omp.cpp b/src/OPENMP/pair_coul_cut_omp.cpp index c1d672e637..884fe532be 100644 --- a/src/OPENMP/pair_coul_cut_omp.cpp +++ b/src/OPENMP/pair_coul_cut_omp.cpp @@ -85,8 +85,8 @@ void PairCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_cut_soft_omp.cpp b/src/OPENMP/pair_coul_cut_soft_omp.cpp index d5669b200a..6b16d71442 100644 --- a/src/OPENMP/pair_coul_cut_soft_omp.cpp +++ b/src/OPENMP/pair_coul_cut_soft_omp.cpp @@ -86,8 +86,8 @@ void PairCoulCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_debye_omp.cpp b/src/OPENMP/pair_coul_debye_omp.cpp index 757b7ec66e..622a84da95 100644 --- a/src/OPENMP/pair_coul_debye_omp.cpp +++ b/src/OPENMP/pair_coul_debye_omp.cpp @@ -85,8 +85,8 @@ void PairCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_diel_omp.cpp b/src/OPENMP/pair_coul_diel_omp.cpp index be2f771e67..4de5b69f7e 100644 --- a/src/OPENMP/pair_coul_diel_omp.cpp +++ b/src/OPENMP/pair_coul_diel_omp.cpp @@ -86,8 +86,8 @@ void PairCoulDielOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_dsf_omp.cpp b/src/OPENMP/pair_coul_dsf_omp.cpp index 6df673ee80..e36c12172f 100644 --- a/src/OPENMP/pair_coul_dsf_omp.cpp +++ b/src/OPENMP/pair_coul_dsf_omp.cpp @@ -95,8 +95,8 @@ void PairCoulDSFOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int nlocal = atom->nlocal; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_coul_long_omp.cpp b/src/OPENMP/pair_coul_long_omp.cpp index 9c15243f87..a54dc8c966 100644 --- a/src/OPENMP/pair_coul_long_omp.cpp +++ b/src/OPENMP/pair_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_long_soft_omp.cpp b/src/OPENMP/pair_coul_long_soft_omp.cpp index 0c31d8020e..b7d9cfc2fa 100644 --- a/src/OPENMP/pair_coul_long_soft_omp.cpp +++ b/src/OPENMP/pair_coul_long_soft_omp.cpp @@ -96,8 +96,8 @@ void PairCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_msm_omp.cpp b/src/OPENMP/pair_coul_msm_omp.cpp index 5165797fd6..bf18009117 100644 --- a/src/OPENMP/pair_coul_msm_omp.cpp +++ b/src/OPENMP/pair_coul_msm_omp.cpp @@ -95,8 +95,8 @@ void PairCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_coul_msm_omp.h b/src/OPENMP/pair_coul_msm_omp.h index f825a57956..65ac5d320b 100644 --- a/src/OPENMP/pair_coul_msm_omp.h +++ b/src/OPENMP/pair_coul_msm_omp.h @@ -46,11 +46,3 @@ class PairCoulMSMOMP : public PairCoulMSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with OMP MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with OMP MSM Pair styles. - -*/ diff --git a/src/OPENMP/pair_coul_wolf_omp.cpp b/src/OPENMP/pair_coul_wolf_omp.cpp index 99d320353d..520fe790b7 100644 --- a/src/OPENMP/pair_coul_wolf_omp.cpp +++ b/src/OPENMP/pair_coul_wolf_omp.cpp @@ -90,8 +90,8 @@ void PairCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int nlocal = atom->nlocal; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_dpd_omp.cpp b/src/OPENMP/pair_dpd_omp.cpp index db03581762..8d47a6d8b6 100644 --- a/src/OPENMP/pair_dpd_omp.cpp +++ b/src/OPENMP/pair_dpd_omp.cpp @@ -127,9 +127,9 @@ void PairDPDOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_dpd_tstat_omp.cpp b/src/OPENMP/pair_dpd_tstat_omp.cpp index 8a329321a8..7909a1b8c1 100644 --- a/src/OPENMP/pair_dpd_tstat_omp.cpp +++ b/src/OPENMP/pair_dpd_tstat_omp.cpp @@ -125,9 +125,9 @@ void PairDPDTstatOMP::eval(int iifrom, int iito, ThrData * const thr) double rsq,r,rinv,dot,wd,randnum,factor_dpd; int *ilist,*jlist,*numneigh,**firstneigh; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const dbl3_t * _noalias const v = (dbl3_t *) atom->v[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const v = (dbl3_t *) atom->v[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double *special_lj = force->special_lj; diff --git a/src/OPENMP/pair_eam_omp.cpp b/src/OPENMP/pair_eam_omp.cpp index 2653cfba63..b3c963c3df 100644 --- a/src/OPENMP/pair_eam_omp.cpp +++ b/src/OPENMP/pair_eam_omp.cpp @@ -104,8 +104,8 @@ void PairEAMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); const int tid = thr->get_tid(); const int nthreads = comm->nthreads; diff --git a/src/OPENMP/pair_edip_omp.cpp b/src/OPENMP/pair_edip_omp.cpp index da025d75d5..15619c277a 100644 --- a/src/OPENMP/pair_edip_omp.cpp +++ b/src/OPENMP/pair_edip_omp.cpp @@ -151,8 +151,8 @@ void PairEDIPOMP::eval(int iifrom, int iito, ThrData *const thr) double *pre_thrPow2B_ij = prePow2B_ij + tid * leadDimInteractionList; double *pre_thrForceCoord = preForceCoord + tid * leadDimInteractionList; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const int *_noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_eim_omp.cpp b/src/OPENMP/pair_eim_omp.cpp index 8c7b69c41b..aa6d2532f5 100644 --- a/src/OPENMP/pair_eim_omp.cpp +++ b/src/OPENMP/pair_eim_omp.cpp @@ -103,8 +103,8 @@ void PairEIMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const rho_t = thr->get_rho(); double * const fp_t = thr->get_fp(); const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_gauss_cut_omp.cpp b/src/OPENMP/pair_gauss_cut_omp.cpp index a36cb7c981..2460d66334 100644 --- a/src/OPENMP/pair_gauss_cut_omp.cpp +++ b/src/OPENMP/pair_gauss_cut_omp.cpp @@ -84,8 +84,8 @@ void PairGaussCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_gauss_omp.cpp b/src/OPENMP/pair_gauss_omp.cpp index eb8630d12c..3cdbb360e7 100644 --- a/src/OPENMP/pair_gauss_omp.cpp +++ b/src/OPENMP/pair_gauss_omp.cpp @@ -88,8 +88,8 @@ double PairGaussOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; double fxtmp,fytmp,fztmp; diff --git a/src/OPENMP/pair_gayberne_omp.cpp b/src/OPENMP/pair_gayberne_omp.cpp index 2476243305..e756e580a7 100644 --- a/src/OPENMP/pair_gayberne_omp.cpp +++ b/src/OPENMP/pair_gayberne_omp.cpp @@ -84,9 +84,9 @@ void PairGayBerneOMP::eval(int iifrom, int iito, ThrData * const thr) int *ilist,*jlist,*numneigh,**firstneigh; double *iquat,*jquat; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; - dbl3_t * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_gran_hertz_history_omp.cpp b/src/OPENMP/pair_gran_hertz_history_omp.cpp index 2ee0921688..66be06020f 100644 --- a/src/OPENMP/pair_gran_hertz_history_omp.cpp +++ b/src/OPENMP/pair_gran_hertz_history_omp.cpp @@ -57,7 +57,7 @@ void PairGranHertzHistoryOMP::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/OPENMP/pair_gran_hooke_history_omp.cpp b/src/OPENMP/pair_gran_hooke_history_omp.cpp index 64482fd634..8dad7f463a 100644 --- a/src/OPENMP/pair_gran_hooke_history_omp.cpp +++ b/src/OPENMP/pair_gran_hooke_history_omp.cpp @@ -54,7 +54,7 @@ void PairGranHookeHistoryOMP::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/OPENMP/pair_gran_hooke_omp.cpp b/src/OPENMP/pair_gran_hooke_omp.cpp index 85277f0719..bfe91b63da 100644 --- a/src/OPENMP/pair_gran_hooke_omp.cpp +++ b/src/OPENMP/pair_gran_hooke_omp.cpp @@ -53,7 +53,7 @@ void PairGranHookeOMP::compute(int eflag, int vflag) if (fix_rigid && neighbor->ago == 0) { int tmp; int *body = (int *) fix_rigid->extract("body",tmp); - double *mass_body = (double *) fix_rigid->extract("masstotal",tmp); + auto mass_body = (double *) fix_rigid->extract("masstotal",tmp); if (atom->nmax > nmax) { memory->destroy(mass_rigid); nmax = atom->nmax; diff --git a/src/OPENMP/pair_harmonic_cut_omp.cpp b/src/OPENMP/pair_harmonic_cut_omp.cpp index 4412a72bc3..d7540d7c11 100644 --- a/src/OPENMP/pair_harmonic_cut_omp.cpp +++ b/src/OPENMP/pair_harmonic_cut_omp.cpp @@ -79,8 +79,8 @@ void PairHarmonicCutOMP::compute(int eflag, int vflag) template void PairHarmonicCutOMP::eval(int iifrom, int iito, ThrData *const thr) { - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const int *_noalias const type = atom->type; const double *_noalias const special_lj = force->special_lj; const int *_noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp index 6d2fc10a3a..66f1a85c39 100644 --- a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp @@ -130,8 +130,8 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const molindex = atom->molindex; const int * _noalias const molatom = atom->molatom; diff --git a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp index badefcd985..f7cecda03a 100644 --- a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp @@ -129,8 +129,8 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int * _noalias const molindex = atom->molindex; diff --git a/src/OPENMP/pair_lj96_cut_omp.cpp b/src/OPENMP/pair_lj96_cut_omp.cpp index 177edcd00f..7ffa4f6a97 100644 --- a/src/OPENMP/pair_lj96_cut_omp.cpp +++ b/src/OPENMP/pair_lj96_cut_omp.cpp @@ -85,8 +85,8 @@ void PairLJ96CutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 8f7152b97d..5addcd167a 100644 --- a/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -85,8 +85,8 @@ void PairLJCharmmCoulCharmmImplicitOMP::eval(int iifrom, int iito, ThrData * con evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp index 0ccb471760..7a14e76ea2 100644 --- a/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -87,8 +87,8 @@ void PairLJCharmmCoulCharmmOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp index 5fabdf7b1a..64cfb69882 100644 --- a/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_long_omp.cpp @@ -81,8 +81,8 @@ template void PairLJCharmmCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp index 7f65e405f2..9e127120a9 100644 --- a/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -81,8 +81,8 @@ template void PairLJCharmmCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp b/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp index ee46f92e31..6bbb4040e3 100644 --- a/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/OPENMP/pair_lj_charmm_coul_msm_omp.cpp @@ -87,8 +87,8 @@ template void PairLJCharmmCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_charmm_coul_msm_omp.h b/src/OPENMP/pair_lj_charmm_coul_msm_omp.h index b91c8faef6..42acac59aa 100644 --- a/src/OPENMP/pair_lj_charmm_coul_msm_omp.h +++ b/src/OPENMP/pair_lj_charmm_coul_msm_omp.h @@ -46,11 +46,3 @@ class PairLJCharmmCoulMSMOMP : public PairLJCharmmCoulMSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with OMP MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with OMP MSM Pair styles. - -*/ diff --git a/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp b/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp index 1fc2abf8ba..e9086f27e3 100644 --- a/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/OPENMP/pair_lj_class2_coul_cut_omp.cpp @@ -87,8 +87,8 @@ void PairLJClass2CoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_class2_coul_long_omp.cpp b/src/OPENMP/pair_lj_class2_coul_long_omp.cpp index 01115c6cb2..eaa6ac4366 100644 --- a/src/OPENMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_class2_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairLJClass2CoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_class2_omp.cpp b/src/OPENMP/pair_lj_class2_omp.cpp index 758cd8fae0..4cc9801357 100644 --- a/src/OPENMP/pair_lj_class2_omp.cpp +++ b/src/OPENMP/pair_lj_class2_omp.cpp @@ -84,8 +84,8 @@ void PairLJClass2OMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_cubic_omp.cpp b/src/OPENMP/pair_lj_cubic_omp.cpp index e6e72096c9..d89e6cb711 100644 --- a/src/OPENMP/pair_lj_cubic_omp.cpp +++ b/src/OPENMP/pair_lj_cubic_omp.cpp @@ -88,8 +88,8 @@ void PairLJCubicOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp index 6d013c5f7c..a2bc25f4af 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.cpp @@ -28,14 +28,14 @@ #include "omp_compat.h" using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PIS; -#define EPSILON 1e-6 +static constexpr double EPSILON = 1.0e-6; /* ---------------------------------------------------------------------- */ -PairLJCutCoulCutDielectricOMP::PairLJCutCoulCutDielectricOMP(LAMMPS *lmp) : - PairLJCutCoulCutDielectric(lmp), ThrOMP(lmp, THR_PAIR) +PairLJCutCoulCutDielectricOMP::PairLJCutCoulCutDielectricOMP(LAMMPS *_lmp) : + PairLJCutCoulCutDielectric(_lmp), ThrOMP(_lmp, THR_PAIR) { } @@ -106,11 +106,11 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th evdwl = ecoul = 0.0; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const double *_noalias const q = atom->q; const double *_noalias const eps = atom->epsilon; - const dbl3_t *_noalias const norm = (dbl3_t *) atom->mu[0]; + const auto *_noalias const norm = (dbl3_t *) atom->mu[0]; const double *_noalias const curvature = atom->curvature; const double *_noalias const area = atom->area; const int *_noalias const type = atom->type; @@ -169,8 +169,8 @@ void PairLJCutCoulCutDielectricOMP::eval(int iifrom, int iito, ThrData *const th r2inv = 1.0 / rsq; if (rsq < cut_coulsq[itype][jtype] && rsq > EPSILON) { - efield_i = q[j] * sqrt(r2inv); - forcecoul = qqrd2e * qtmp * efield_i; + efield_i = qqrd2e * q[j] * sqrt(r2inv); + forcecoul = qtmp * efield_i; epot_i = efield_i; } else epot_i = efield_i = forcecoul = 0.0; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h index 527309909e..debb07744b 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_cut_dielectric_omp.h @@ -40,21 +40,3 @@ class PairLJCutCoulCutDielectricOMP : public PairLJCutCoulCutDielectric, public #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/cut/dielectric requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp index e86bd88936..0df235b626 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_omp.cpp @@ -86,8 +86,8 @@ void PairLJCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp index b44d56d6f3..b1afa96bf5 100644 --- a/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -87,8 +87,8 @@ void PairLJCutCoulCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.cpp new file mode 100644 index 0000000000..032a2b4c3c --- /dev/null +++ b/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.cpp @@ -0,0 +1,231 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/ 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: Trung Nguyen (U Chicago) +------------------------------------------------------------------------- */ + +#include "pair_lj_cut_coul_debye_dielectric_omp.h" + +#include "atom.h" +#include "comm.h" +#include "force.h" +#include "math_const.h" +#include "memory.h" +#include "neigh_list.h" + +#include + +#include "omp_compat.h" +using namespace LAMMPS_NS; +using MathConst::MY_PIS; + +static constexpr double EPSILON = 1.0e-6; + +/* ---------------------------------------------------------------------- */ + +PairLJCutCoulDebyeDielectricOMP::PairLJCutCoulDebyeDielectricOMP(LAMMPS *_lmp) : + PairLJCutCoulDebyeDielectric(_lmp), ThrOMP(_lmp, THR_PAIR) +{ +} + +/* ---------------------------------------------------------------------- */ + +void PairLJCutCoulDebyeDielectricOMP::compute(int eflag, int vflag) +{ + ev_init(eflag, vflag); + + if (atom->nmax > nmax) { + memory->destroy(efield); + memory->destroy(epot); + nmax = atom->nmax; + memory->create(efield, nmax, 3, "pair:efield"); + memory->create(epot, nmax, "pair:epot"); + } + + const int nall = atom->nlocal + atom->nghost; + const int nthreads = comm->nthreads; + const int inum = list->inum; + +#if defined(_OPENMP) +#pragma omp parallel LMP_DEFAULT_NONE LMP_SHARED(eflag, vflag) +#endif + { + int ifrom, ito, tid; + + loop_setup_thr(ifrom, ito, tid, inum, nthreads); + ThrData *thr = fix->get_thr(tid); + thr->timer(Timer::START); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); + + if (evflag) { + if (eflag) { + if (force->newton_pair) + eval<1, 1, 1>(ifrom, ito, thr); + else + eval<1, 1, 0>(ifrom, ito, thr); + } else { + if (force->newton_pair) + eval<1, 0, 1>(ifrom, ito, thr); + else + eval<1, 0, 0>(ifrom, ito, thr); + } + } else { + if (force->newton_pair) + eval<0, 0, 1>(ifrom, ito, thr); + else + eval<0, 0, 0>(ifrom, ito, thr); + } + + thr->timer(Timer::PAIR); + reduce_thr(this, eflag, vflag, thr); + } // end of omp parallel region +} + +/* ---------------------------------------------------------------------- */ + +template +void PairLJCutCoulDebyeDielectricOMP::eval(int iifrom, int iito, ThrData *const thr) +{ + int i, j, ii, jj, jnum, itype, jtype; + double qtmp, etmp, xtmp, ytmp, ztmp, delx, dely, delz, evdwl, ecoul; + double fpair_i, fpair_j; + double rsq, r2inv, r6inv, forcecoul, forcelj, factor_coul, factor_lj, efield_i, epot_i; + double r, rinv, screening; + int *ilist, *jlist, *numneigh, **firstneigh; + + evdwl = ecoul = 0.0; + + const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; + dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const double *_noalias const q = atom->q; + const double *_noalias const eps = atom->epsilon; + const dbl3_t *_noalias const norm = (dbl3_t *) atom->mu[0]; + const double *_noalias const curvature = atom->curvature; + const double *_noalias const area = atom->area; + const int *_noalias const type = atom->type; + const int nlocal = atom->nlocal; + const double *_noalias const special_coul = force->special_coul; + const double *_noalias const special_lj = force->special_lj; + const double qqrd2e = force->qqrd2e; + double fxtmp, fytmp, fztmp, extmp, eytmp, eztmp; + + ilist = list->ilist; + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // loop over neighbors of my atoms + + for (ii = iifrom; ii < iito; ++ii) { + + i = ilist[ii]; + qtmp = q[i]; + xtmp = x[i].x; + ytmp = x[i].y; + ztmp = x[i].z; + etmp = eps[i]; + itype = type[i]; + jlist = firstneigh[i]; + jnum = numneigh[i]; + fxtmp = fytmp = fztmp = 0.0; + extmp = eytmp = eztmp = 0.0; + + // self term Eq. (55) for I_{ii} and Eq. (52) and in Barros et al + double curvature_threshold = sqrt(area[i]); + if (curvature[i] < curvature_threshold) { + double sf = curvature[i] / (4.0 * MY_PIS * curvature_threshold) * area[i] * q[i]; + efield[i][0] = sf * norm[i].x; + efield[i][1] = sf * norm[i].y; + efield[i][2] = sf * norm[i].z; + } else { + efield[i][0] = efield[i][1] = efield[i][2] = 0; + } + + epot[i] = 0; + + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + factor_lj = special_lj[sbmask(j)]; + factor_coul = special_coul[sbmask(j)]; + j &= NEIGHMASK; + + delx = xtmp - x[j].x; + dely = ytmp - x[j].y; + delz = ztmp - x[j].z; + rsq = delx * delx + dely * dely + delz * delz; + jtype = type[j]; + + if (rsq < cutsq[itype][jtype]) { + r2inv = 1.0 / rsq; + + if (rsq < cut_coulsq[itype][jtype] && rsq > EPSILON) { + r = sqrt(rsq); + rinv = 1.0 / r; + screening = exp(-kappa * r); + efield_i = qqrd2e * q[j] * screening * (kappa + rinv); + forcecoul = qtmp * efield_i; + epot_i = efield_i; + } else + epot_i = efield_i = forcecoul = 0.0; + + if (rsq < cut_ljsq[itype][jtype]) { + r6inv = r2inv * r2inv * r2inv; + forcelj = r6inv * (lj1[itype][jtype] * r6inv - lj2[itype][jtype]); + } else + forcelj = 0.0; + + fpair_i = (factor_coul * etmp * forcecoul + factor_lj * forcelj) * r2inv; + + fxtmp += delx * fpair_i; + fytmp += dely * fpair_i; + fztmp += delz * fpair_i; + + efield_i *= (factor_coul * etmp * r2inv); + extmp += delx * efield_i; + eytmp += dely * efield_i; + eztmp += delz * efield_i; + epot[i] += epot_i; + + if (NEWTON_PAIR || j >= nlocal) { + fpair_j = (factor_coul * eps[j] * forcecoul + factor_lj * forcelj) * r2inv; + f[j].x -= delx * fpair_j; + f[j].y -= dely * fpair_j; + f[j].z -= delz * fpair_j; + } + + if (EFLAG) { + if (rsq < cut_coulsq[itype][jtype]) { + ecoul = factor_coul * qqrd2e * qtmp * q[j] * (etmp + eps[j]) * rinv * screening; + } else + ecoul = 0.0; + ecoul *= 0.5; + if (rsq < cut_ljsq[itype][jtype]) { + evdwl = r6inv * (lj3[itype][jtype] * r6inv - lj4[itype][jtype]) - offset[itype][jtype]; + evdwl *= factor_lj; + } else + evdwl = 0.0; + } + + if (EVFLAG) + ev_tally_thr(this, i, j, nlocal, NEWTON_PAIR, evdwl, ecoul, fpair_i, delx, dely, delz, + thr); + } + } + f[i].x += fxtmp; + f[i].y += fytmp; + f[i].z += fztmp; + efield[i][0] += extmp; + efield[i][1] += eytmp; + efield[i][2] += eztmp; + } +} diff --git a/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h new file mode 100644 index 0000000000..e1232406f5 --- /dev/null +++ b/src/OPENMP/pair_lj_cut_coul_debye_dielectric_omp.h @@ -0,0 +1,42 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/ 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 PAIR_CLASS +// clang-format off +PairStyle(lj/cut/coul/debye/dielectric/omp,PairLJCutCoulDebyeDielectricOMP); +// clang-format on +#else + +#ifndef LMP_PAIR_LJ_CUT_COUL_DEBYE_DIELECTRIC_OMP_H +#define LMP_PAIR_LJ_CUT_COUL_DEBYE_DIELECTRIC_OMP_H + +#include "pair_lj_cut_coul_debye_dielectric.h" +#include "thr_omp.h" + +namespace LAMMPS_NS { + +class PairLJCutCoulDebyeDielectricOMP : public PairLJCutCoulDebyeDielectric, public ThrOMP { + public: + PairLJCutCoulDebyeDielectricOMP(class LAMMPS *); + ~PairLJCutCoulDebyeDielectricOMP() override = default; + void compute(int, int) override; + + protected: + template + void eval(int ifrom, int ito, ThrData *const thr); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp b/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp index 9996149e58..7797d938b7 100644 --- a/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_debye_omp.cpp @@ -87,8 +87,8 @@ void PairLJCutCoulDebyeOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp b/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp index 59cd3e7467..e305c1caf9 100644 --- a/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp @@ -97,8 +97,8 @@ void PairLJCutCoulDSFOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp index c076501d68..8e3880810c 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.cpp @@ -19,6 +19,7 @@ #include "atom.h" #include "comm.h" +#include "ewald_const.h" #include "force.h" #include "math_const.h" #include "memory.h" @@ -28,20 +29,13 @@ #include "omp_compat.h" using namespace LAMMPS_NS; -using namespace MathConst; - -#define EWALD_F 1.12837917 -#define EWALD_P 0.3275911 -#define A1 0.254829592 -#define A2 -0.284496736 -#define A3 1.421413741 -#define A4 -1.453152027 -#define A5 1.061405429 +using namespace EwaldConst; +using MathConst::MY_PIS; /* ---------------------------------------------------------------------- */ -PairLJCutCoulLongDielectricOMP::PairLJCutCoulLongDielectricOMP(LAMMPS *lmp) : - PairLJCutCoulLongDielectric(lmp), ThrOMP(lmp, THR_PAIR) +PairLJCutCoulLongDielectricOMP::PairLJCutCoulLongDielectricOMP(LAMMPS *_lmp) : + PairLJCutCoulLongDielectric(_lmp), ThrOMP(_lmp, THR_PAIR) { } @@ -112,11 +106,11 @@ void PairLJCutCoulLongDielectricOMP::eval(int iifrom, int iito, ThrData *const t evdwl = ecoul = 0.0; - const dbl3_t *_noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t *_noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto *_noalias const x = (dbl3_t *) atom->x[0]; + auto *_noalias const f = (dbl3_t *) thr->get_f()[0]; const double *_noalias const q = atom->q; const double *_noalias const eps = atom->epsilon; - const dbl3_t *_noalias const norm = (dbl3_t *) atom->mu[0]; + const auto *_noalias const norm = (dbl3_t *) atom->mu[0]; const double *_noalias const curvature = atom->curvature; const double *_noalias const area = atom->area; const int *_noalias const type = atom->type; @@ -184,7 +178,7 @@ void PairLJCutCoulLongDielectricOMP::eval(int iifrom, int iito, ThrData *const t forcecoul = prefactor * (erfc + EWALD_F * grij * expm2); if (factor_coul < 1.0) forcecoul -= (1.0 - factor_coul) * prefactor; - prefactorE = q[j] / r; + prefactorE = qqrd2e * q[j] / r; efield_i = prefactorE * (erfc + EWALD_F * grij * expm2); if (factor_coul < 1.0) efield_i -= (1.0 - factor_coul) * prefactorE; epot_i = efield_i; @@ -203,7 +197,7 @@ void PairLJCutCoulLongDielectricOMP::eval(int iifrom, int iito, ThrData *const t prefactor = qtmp * q[j] * table; forcecoul -= (1.0 - factor_coul) * prefactor; - prefactorE = q[j] * table / qqrd2e; + prefactorE = q[j] * table; efield_i -= (1.0 - factor_coul) * prefactorE; } epot_i = efield_i; diff --git a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h index 4aa7e70ee6..2dcc7c97e7 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_long_dielectric_omp.h @@ -41,30 +41,3 @@ class PairLJCutCoulLongDielectricOMP : public PairLJCutCoulLongDielectric, publi #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long/dielectric requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/OPENMP/pair_lj_cut_coul_long_omp.cpp b/src/OPENMP/pair_lj_cut_coul_long_omp.cpp index c66ccb40cc..af551017b2 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairLJCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp index 5911f38072..3ceb40b262 100644 --- a/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -97,8 +97,8 @@ void PairLJCutCoulLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp b/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp index ccc92489b4..d573a349c1 100644 --- a/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_msm_omp.cpp @@ -95,8 +95,8 @@ void PairLJCutCoulMSMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_coul_msm_omp.h b/src/OPENMP/pair_lj_cut_coul_msm_omp.h index 8f9892903a..fa07edc79e 100644 --- a/src/OPENMP/pair_lj_cut_coul_msm_omp.h +++ b/src/OPENMP/pair_lj_cut_coul_msm_omp.h @@ -46,11 +46,3 @@ class PairLJCutCoulMSMOMP : public PairLJCutCoulMSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with OMP MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with OMP MSM Pair styles. - -*/ diff --git a/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp b/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp index 5c00a88702..55c2bc6c11 100644 --- a/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_wolf_omp.cpp @@ -89,8 +89,8 @@ void PairLJCutCoulWolfOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp b/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp index 3da8e9f59c..1cecb1c7c4 100644 --- a/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_dipole_cut_omp.cpp @@ -88,8 +88,8 @@ void PairLJCutDipoleCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const * const torque = thr->get_torque(); const double * _noalias const q = atom->q; const dbl4_t * _noalias const mu = (dbl4_t *) atom->mu[0]; diff --git a/src/OPENMP/pair_lj_cut_omp.cpp b/src/OPENMP/pair_lj_cut_omp.cpp index e62c422e15..96ecd959e2 100644 --- a/src/OPENMP/pair_lj_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_omp.cpp @@ -75,8 +75,8 @@ void PairLJCutOMP::compute(int eflag, int vflag) template void PairLJCutOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; const int * _noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_lj_cut_soft_omp.cpp b/src/OPENMP/pair_lj_cut_soft_omp.cpp index ac39009ebe..c9b1a4bc42 100644 --- a/src/OPENMP/pair_lj_cut_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_soft_omp.cpp @@ -75,8 +75,8 @@ void PairLJCutSoftOMP::compute(int eflag, int vflag) template void PairLJCutSoftOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; const int * _noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_lj_cut_thole_long_omp.cpp b/src/OPENMP/pair_lj_cut_thole_long_omp.cpp index e81dfbe242..1034e8e0e5 100644 --- a/src/OPENMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_thole_long_omp.cpp @@ -98,8 +98,8 @@ void PairLJCutTholeLongOMP::compute(int eflag, int vflag) template void PairLJCutTholeLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_cut_thole_long_omp.h b/src/OPENMP/pair_lj_cut_thole_long_omp.h index ea17517487..4ef1321eeb 100644 --- a/src/OPENMP/pair_lj_cut_thole_long_omp.h +++ b/src/OPENMP/pair_lj_cut_thole_long_omp.h @@ -40,30 +40,3 @@ class PairLJCutTholeLongOMP : public PairLJCutTholeLong, public ThrOMP { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp index 3c02a5898f..be6f77f7f5 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -139,8 +139,8 @@ void PairLJCutTIP4PCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp index 06858a7b52..b6948f0c8b 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp @@ -153,8 +153,8 @@ void PairLJCutTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp index 8ba108e3a4..49e76992f7 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -141,8 +141,8 @@ void PairLJCutTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_expand_omp.cpp b/src/OPENMP/pair_lj_expand_omp.cpp index e22c773f97..35d23aadc4 100644 --- a/src/OPENMP/pair_lj_expand_omp.cpp +++ b/src/OPENMP/pair_lj_expand_omp.cpp @@ -85,8 +85,8 @@ void PairLJExpandOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp index ad75760f2b..096f60b1ec 100644 --- a/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/OPENMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -87,8 +87,8 @@ void PairLJGromacsCoulGromacsOMP::eval(int iifrom, int iito, ThrData * const thr evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_lj_gromacs_omp.cpp b/src/OPENMP/pair_lj_gromacs_omp.cpp index fd1001e30b..f450d83705 100644 --- a/src/OPENMP/pair_lj_gromacs_omp.cpp +++ b/src/OPENMP/pair_lj_gromacs_omp.cpp @@ -85,8 +85,8 @@ void PairLJGromacsOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp b/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp index 606e57188a..b0fdf3a393 100644 --- a/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_lj_long_tip4p_long_omp.cpp @@ -718,8 +718,8 @@ template < const int EVFLAG, const int EFLAG, const int NEWTON_PAIR, const int CTABLE, const int LJTABLE, const int ORDER1, const int ORDER6 > void PairLJLongTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; @@ -1095,8 +1095,8 @@ void PairLJLongTIP4PLongOMP::eval_inner(int iifrom, int iito, ThrData * const th { double rsq, r2inv, forcecoul = 0.0, forcelj, cforce; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; @@ -1352,8 +1352,8 @@ void PairLJLongTIP4PLongOMP::eval_middle(int iifrom, int iito, ThrData * const t { double rsq, r2inv, forcecoul,forcelj, cforce; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; @@ -1622,8 +1622,8 @@ void PairLJLongTIP4PLongOMP::eval_outer(int iifrom, int iito, ThrData * const th double v[6]; dbl3_t x1,x2,xH1,xH2; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const tagint * _noalias const tag = atom->tag; diff --git a/src/OPENMP/pair_lj_relres_omp.cpp b/src/OPENMP/pair_lj_relres_omp.cpp index 250710cfa1..159b22bbb1 100644 --- a/src/OPENMP/pair_lj_relres_omp.cpp +++ b/src/OPENMP/pair_lj_relres_omp.cpp @@ -85,8 +85,8 @@ void PairLJRelResOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp b/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp index 747aa88fa6..fff5d17b13 100644 --- a/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/OPENMP/pair_lj_sdk_coul_long_omp.cpp @@ -81,8 +81,8 @@ template void PairLJSDKCoulLongOMP::eval_thr(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_lj_sdk_coul_msm_omp.h b/src/OPENMP/pair_lj_sdk_coul_msm_omp.h index a1c881f4d0..9bcde691d0 100644 --- a/src/OPENMP/pair_lj_sdk_coul_msm_omp.h +++ b/src/OPENMP/pair_lj_sdk_coul_msm_omp.h @@ -46,11 +46,3 @@ class PairLJSDKCoulMSMOMP : public PairLJSDKCoulMSM, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Must use 'kspace_modify pressure/scalar no' with OMP MSM Pair styles - -The kspace scalar pressure option is not (yet) compatible with OMP MSM Pair styles. - -*/ diff --git a/src/OPENMP/pair_lj_sdk_omp.cpp b/src/OPENMP/pair_lj_sdk_omp.cpp index 05a7bac568..909bb73fc8 100644 --- a/src/OPENMP/pair_lj_sdk_omp.cpp +++ b/src/OPENMP/pair_lj_sdk_omp.cpp @@ -88,8 +88,8 @@ void PairLJSDKOMP::eval_thr(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp b/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp index 70ce7e5a23..36ac61a14c 100644 --- a/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/OPENMP/pair_lj_sf_dipole_sf_omp.cpp @@ -92,8 +92,8 @@ void PairLJSFDipoleSFOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; double * const * const torque = thr->get_torque(); const double * _noalias const q = atom->q; const dbl4_t * _noalias const mu = (dbl4_t *) atom->mu[0]; diff --git a/src/OPENMP/pair_lj_smooth_linear_omp.cpp b/src/OPENMP/pair_lj_smooth_linear_omp.cpp index 21589a7480..49768a8641 100644 --- a/src/OPENMP/pair_lj_smooth_linear_omp.cpp +++ b/src/OPENMP/pair_lj_smooth_linear_omp.cpp @@ -85,8 +85,8 @@ void PairLJSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_lj_smooth_omp.cpp b/src/OPENMP/pair_lj_smooth_omp.cpp index 6831459c7c..f142fb7930 100644 --- a/src/OPENMP/pair_lj_smooth_omp.cpp +++ b/src/OPENMP/pair_lj_smooth_omp.cpp @@ -85,8 +85,8 @@ void PairLJSmoothOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_meam_spline_omp.cpp b/src/OPENMP/pair_meam_spline_omp.cpp index 19da4c90ec..d704b9c19c 100644 --- a/src/OPENMP/pair_meam_spline_omp.cpp +++ b/src/OPENMP/pair_meam_spline_omp.cpp @@ -100,7 +100,7 @@ void PairMEAMSplineOMP::eval(int iifrom, int iito, ThrData * const thr) } // Allocate array for temporary bond info. - MEAM2Body *myTwoBodyInfo = new MEAM2Body[myMaxNeighbors]; + auto myTwoBodyInfo = new MEAM2Body[myMaxNeighbors]; const double * const * const x = atom->x; double * const * const forces = thr->get_f(); diff --git a/src/OPENMP/pair_morse_omp.cpp b/src/OPENMP/pair_morse_omp.cpp index 7078ffee30..76026e7598 100644 --- a/src/OPENMP/pair_morse_omp.cpp +++ b/src/OPENMP/pair_morse_omp.cpp @@ -84,8 +84,8 @@ void PairMorseOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_morse_smooth_linear_omp.cpp b/src/OPENMP/pair_morse_smooth_linear_omp.cpp index 85088dc30f..448a094993 100644 --- a/src/OPENMP/pair_morse_smooth_linear_omp.cpp +++ b/src/OPENMP/pair_morse_smooth_linear_omp.cpp @@ -86,8 +86,8 @@ void PairMorseSmoothLinearOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_morse_smooth_linear_omp.h b/src/OPENMP/pair_morse_smooth_linear_omp.h index ecddb473dd..40aa62ee9e 100644 --- a/src/OPENMP/pair_morse_smooth_linear_omp.h +++ b/src/OPENMP/pair_morse_smooth_linear_omp.h @@ -41,22 +41,3 @@ class PairMorseSmoothLinearOMP : public PairMorseSmoothLinear, public ThrOMP { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp b/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp index b888dbdb82..0dc2d7f094 100644 --- a/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/OPENMP/pair_nm_cut_coul_cut_omp.cpp @@ -86,8 +86,8 @@ void PairNMCutCoulCutOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_nm_cut_coul_long_omp.cpp b/src/OPENMP/pair_nm_cut_coul_long_omp.cpp index bacf06a06a..9f09258ce8 100644 --- a/src/OPENMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/OPENMP/pair_nm_cut_coul_long_omp.cpp @@ -97,8 +97,8 @@ void PairNMCutCoulLongOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_nm_cut_omp.cpp b/src/OPENMP/pair_nm_cut_omp.cpp index 6c4765023a..6fe77934f1 100644 --- a/src/OPENMP/pair_nm_cut_omp.cpp +++ b/src/OPENMP/pair_nm_cut_omp.cpp @@ -76,8 +76,8 @@ void PairNMCutOMP::compute(int eflag, int vflag) template void PairNMCutOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const double * _noalias const special_lj = force->special_lj; const int * _noalias const ilist = list->ilist; diff --git a/src/OPENMP/pair_reaxff_omp.cpp b/src/OPENMP/pair_reaxff_omp.cpp index 6d613abf60..f10f5885bd 100644 --- a/src/OPENMP/pair_reaxff_omp.cpp +++ b/src/OPENMP/pair_reaxff_omp.cpp @@ -134,7 +134,7 @@ void PairReaxFFOMP::init_style() "increased neighbor list skin."); if (fix_reaxff == nullptr) - fix_reaxff = (FixReaxFF *) modify->add_fix(fmt::format("{} all REAXFF",fix_id)); + fix_reaxff = dynamic_cast( modify->add_fix(fmt::format("{} all REAXFF",fix_id))); api->control->nthreads = comm->nthreads; } diff --git a/src/OPENMP/pair_reaxff_omp.h b/src/OPENMP/pair_reaxff_omp.h index d2ec2fb6bb..e8497d8321 100644 --- a/src/OPENMP/pair_reaxff_omp.h +++ b/src/OPENMP/pair_reaxff_omp.h @@ -22,7 +22,7 @@ PairStyle(reax/c/omp,PairReaxFFOMP); #define LMP_PAIR_REAXFF_OMP_H #include "pair_reaxff.h" -#include "thr_omp.h" // IWYU pragma: export +#include "thr_omp.h" // IWYU pragma: export namespace LAMMPS_NS { @@ -113,13 +113,3 @@ class PairReaxFFOMP : public PairReaxFF, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Too many ghost atoms - -Number of ghost atoms has increased too much during simulation and has exceeded -the size of reaxff arrays. Increase safe_zone and min_cap in pair_style reaxff -command - -*/ diff --git a/src/OPENMP/pair_resquared_omp.cpp b/src/OPENMP/pair_resquared_omp.cpp index af75e8b161..a02427f09f 100644 --- a/src/OPENMP/pair_resquared_omp.cpp +++ b/src/OPENMP/pair_resquared_omp.cpp @@ -82,9 +82,9 @@ void PairRESquaredOMP::eval(int iifrom, int iito, ThrData * const thr) int *ilist,*jlist,*numneigh,**firstneigh; RE2Vars wi,wj; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; - dbl3_t * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const tor = (dbl3_t *) thr->get_torque()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_soft_omp.cpp b/src/OPENMP/pair_soft_omp.cpp index b524d8a371..277810a60e 100644 --- a/src/OPENMP/pair_soft_omp.cpp +++ b/src/OPENMP/pair_soft_omp.cpp @@ -88,8 +88,8 @@ void PairSoftOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_sw_omp.cpp b/src/OPENMP/pair_sw_omp.cpp index 22cf2b4dba..f6d615b2a1 100644 --- a/src/OPENMP/pair_sw_omp.cpp +++ b/src/OPENMP/pair_sw_omp.cpp @@ -80,8 +80,8 @@ void PairSWOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_table_omp.cpp b/src/OPENMP/pair_table_omp.cpp index 72d5ecd4de..d60dfb58f1 100644 --- a/src/OPENMP/pair_table_omp.cpp +++ b/src/OPENMP/pair_table_omp.cpp @@ -86,8 +86,8 @@ void PairTableOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_tersoff_mod_c_omp.cpp b/src/OPENMP/pair_tersoff_mod_c_omp.cpp index cd59e06673..bfd55f3b0e 100644 --- a/src/OPENMP/pair_tersoff_mod_c_omp.cpp +++ b/src/OPENMP/pair_tersoff_mod_c_omp.cpp @@ -101,8 +101,8 @@ void PairTersoffMODCOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_tersoff_mod_omp.cpp b/src/OPENMP/pair_tersoff_mod_omp.cpp index de19aa3872..d7c64002c5 100644 --- a/src/OPENMP/pair_tersoff_mod_omp.cpp +++ b/src/OPENMP/pair_tersoff_mod_omp.cpp @@ -101,8 +101,8 @@ void PairTersoffMODOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_tersoff_omp.cpp b/src/OPENMP/pair_tersoff_omp.cpp index 2a3cfb5d54..50c002a01b 100644 --- a/src/OPENMP/pair_tersoff_omp.cpp +++ b/src/OPENMP/pair_tersoff_omp.cpp @@ -104,8 +104,8 @@ void PairTersoffOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_tersoff_table_omp.cpp b/src/OPENMP/pair_tersoff_table_omp.cpp index 94f9e72c3d..010a3f5610 100644 --- a/src/OPENMP/pair_tersoff_table_omp.cpp +++ b/src/OPENMP/pair_tersoff_table_omp.cpp @@ -112,8 +112,8 @@ void PairTersoffTableOMP::eval(int iifrom, int iito, ThrData * const thr) double evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const int tid = thr->get_tid(); diff --git a/src/OPENMP/pair_tip4p_cut_omp.cpp b/src/OPENMP/pair_tip4p_cut_omp.cpp index fb3e907761..91d0063a01 100644 --- a/src/OPENMP/pair_tip4p_cut_omp.cpp +++ b/src/OPENMP/pair_tip4p_cut_omp.cpp @@ -138,8 +138,8 @@ void PairTIP4PCutOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_tip4p_long_omp.cpp b/src/OPENMP/pair_tip4p_long_omp.cpp index 2f08746db5..21d4484e99 100644 --- a/src/OPENMP/pair_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_tip4p_long_omp.cpp @@ -153,8 +153,8 @@ void PairTIP4PLongOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_tip4p_long_soft_omp.cpp b/src/OPENMP/pair_tip4p_long_soft_omp.cpp index 3bbb0717ab..e2d8023d4b 100644 --- a/src/OPENMP/pair_tip4p_long_soft_omp.cpp +++ b/src/OPENMP/pair_tip4p_long_soft_omp.cpp @@ -140,8 +140,8 @@ void PairTIP4PLongSoftOMP::eval(int iifrom, int iito, ThrData * const thr) ecoul = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const q = atom->q; const int * _noalias const type = atom->type; const double * _noalias const special_coul = force->special_coul; diff --git a/src/OPENMP/pair_ufm_omp.cpp b/src/OPENMP/pair_ufm_omp.cpp index 2140de5546..aa7a7ed3ea 100644 --- a/src/OPENMP/pair_ufm_omp.cpp +++ b/src/OPENMP/pair_ufm_omp.cpp @@ -86,8 +86,8 @@ void PairUFMOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_vashishta_omp.cpp b/src/OPENMP/pair_vashishta_omp.cpp index 3e5a13ae06..e867e58a6d 100644 --- a/src/OPENMP/pair_vashishta_omp.cpp +++ b/src/OPENMP/pair_vashishta_omp.cpp @@ -80,8 +80,8 @@ void PairVashishtaOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_vashishta_table_omp.cpp b/src/OPENMP/pair_vashishta_table_omp.cpp index c40259af88..eb9e80b7a3 100644 --- a/src/OPENMP/pair_vashishta_table_omp.cpp +++ b/src/OPENMP/pair_vashishta_table_omp.cpp @@ -80,8 +80,8 @@ void PairVashishtaTableOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const tagint * _noalias const tag = atom->tag; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_yukawa_colloid_omp.cpp b/src/OPENMP/pair_yukawa_colloid_omp.cpp index a6fea6f0d4..f879eeddf9 100644 --- a/src/OPENMP/pair_yukawa_colloid_omp.cpp +++ b/src/OPENMP/pair_yukawa_colloid_omp.cpp @@ -84,8 +84,8 @@ void PairYukawaColloidOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const double * _noalias const radius = atom->radius; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; diff --git a/src/OPENMP/pair_yukawa_omp.cpp b/src/OPENMP/pair_yukawa_omp.cpp index ac7b2302ad..efaa42fb50 100644 --- a/src/OPENMP/pair_yukawa_omp.cpp +++ b/src/OPENMP/pair_yukawa_omp.cpp @@ -84,8 +84,8 @@ void PairYukawaOMP::eval(int iifrom, int iito, ThrData * const thr) evdwl = 0.0; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int nlocal = atom->nlocal; const double * _noalias const special_lj = force->special_lj; diff --git a/src/OPENMP/pair_zbl_omp.cpp b/src/OPENMP/pair_zbl_omp.cpp index 1ce0200b99..a1083e0658 100644 --- a/src/OPENMP/pair_zbl_omp.cpp +++ b/src/OPENMP/pair_zbl_omp.cpp @@ -76,8 +76,8 @@ void PairZBLOMP::compute(int eflag, int vflag) template void PairZBLOMP::eval(int iifrom, int iito, ThrData * const thr) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; const int * _noalias const type = atom->type; const int * _noalias const ilist = list->ilist; const int * _noalias const numneigh = list->numneigh; diff --git a/src/OPENMP/pppm_cg_omp.cpp b/src/OPENMP/pppm_cg_omp.cpp index 1a245b1323..5dd78770f5 100644 --- a/src/OPENMP/pppm_cg_omp.cpp +++ b/src/OPENMP/pppm_cg_omp.cpp @@ -359,8 +359,8 @@ void PPPMCGOMP::make_rho() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -441,7 +441,7 @@ void PPPMCGOMP::fieldforce_ik() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const double qqrd2e = force->qqrd2e; const int nthreads = comm->nthreads; @@ -458,7 +458,7 @@ void PPPMCGOMP::fieldforce_ik() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (int j = ifrom; j < ito; ++j) { @@ -522,7 +522,7 @@ void PPPMCGOMP::fieldforce_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const double qqrd2e = force->qqrd2e; const int nthreads = comm->nthreads; @@ -540,7 +540,7 @@ void PPPMCGOMP::fieldforce_ad() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -616,7 +616,7 @@ void PPPMCGOMP::fieldforce_peratom() // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; const int nthreads = comm->nthreads; diff --git a/src/OPENMP/pppm_disp_omp.cpp b/src/OPENMP/pppm_disp_omp.cpp index 3c9767e85d..e4937002a6 100644 --- a/src/OPENMP/pppm_disp_omp.cpp +++ b/src/OPENMP/pppm_disp_omp.cpp @@ -344,8 +344,8 @@ void PPPMDispOMP::particle_map(double dxinv, double dyinv, int nxhi_o, int nyhi_o, int nzhi_o) { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -426,8 +426,8 @@ void PPPMDispOMP::make_rho_c() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -515,8 +515,8 @@ void PPPMDispOMP::make_rho_g() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -619,8 +619,8 @@ void PPPMDispOMP::make_rho_a() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; diff --git a/src/OPENMP/pppm_disp_omp.h b/src/OPENMP/pppm_disp_omp.h index bc463e60b4..731cdbfcbd 100644 --- a/src/OPENMP/pppm_disp_omp.h +++ b/src/OPENMP/pppm_disp_omp.h @@ -37,8 +37,8 @@ class PPPMDispOMP : public PPPMDisp, public ThrOMP { virtual void compute_gf(); virtual void compute_gf_6(); - void particle_map(double, double, double, double, int **, int, int, int, int, int, int, - int, int) override; + void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int, + int) override; void fieldforce_c_ik() override; void fieldforce_c_ad() override; diff --git a/src/OPENMP/pppm_disp_tip4p_omp.cpp b/src/OPENMP/pppm_disp_tip4p_omp.cpp index 083577f16f..56f3f14c2c 100644 --- a/src/OPENMP/pppm_disp_tip4p_omp.cpp +++ b/src/OPENMP/pppm_disp_tip4p_omp.cpp @@ -338,8 +338,8 @@ void PPPMDispTIP4POMP::particle_map_c(double dxinv, double dyinv, if (atom->nlocal == 0) return; const int * _noalias const type = atom->type; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -417,8 +417,8 @@ void PPPMDispTIP4POMP::particle_map(double dxinv, double dyinv, // no local atoms => nothing to do if (atom->nlocal == 0) return; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -496,8 +496,8 @@ void PPPMDispTIP4POMP::make_rho_c() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; dbl3_t xM; @@ -590,8 +590,8 @@ void PPPMDispTIP4POMP::make_rho_g() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -692,8 +692,8 @@ void PPPMDispTIP4POMP::make_rho_a() #pragma omp parallel LMP_DEFAULT_NONE #endif { - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid_6[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid_6[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -789,9 +789,9 @@ void PPPMDispTIP4POMP::fieldforce_c_ik() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -811,7 +811,7 @@ void PPPMDispTIP4POMP::fieldforce_c_ik() // get per thread data ThrData *thr = fix->get_thr(tid); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { @@ -897,9 +897,9 @@ void PPPMDispTIP4POMP::fieldforce_c_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -920,7 +920,7 @@ void PPPMDispTIP4POMP::fieldforce_c_ad() // get per thread data ThrData *thr = fix->get_thr(tid); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -1856,7 +1856,7 @@ void PPPMDispTIP4POMP::find_M_thr(int i, int &iH1, int &iH2, dbl3_t &xM) iH1 = domain->closest_image(i,iH1); iH2 = domain->closest_image(i,iH2); - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; double delx1 = x[iH1].x - x[i].x; double dely1 = x[iH1].y - x[i].y; diff --git a/src/OPENMP/pppm_disp_tip4p_omp.h b/src/OPENMP/pppm_disp_tip4p_omp.h index 9b08f5966e..ec432e3122 100644 --- a/src/OPENMP/pppm_disp_tip4p_omp.h +++ b/src/OPENMP/pppm_disp_tip4p_omp.h @@ -38,10 +38,10 @@ class PPPMDispTIP4POMP : public PPPMDispTIP4P, public ThrOMP { void compute(int, int) override; - void particle_map(double, double, double, double, int **, int, int, int, int, int, int, - int, int) override; - void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, - int, int) override; + void particle_map(double, double, double, double, int **, int, int, int, int, int, int, int, + int) override; + void particle_map_c(double, double, double, double, int **, int, int, int, int, int, int, int, + int) override; void make_rho_c() override; // XXX: not (yet) multi-threaded void make_rho_g() override; void make_rho_a() override; @@ -68,11 +68,3 @@ class PPPMDispTIP4POMP : public PPPMDispTIP4P, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Kspace style pppm/tip4p/omp requires newton on - -Self-explanatory. - -*/ diff --git a/src/OPENMP/pppm_omp.cpp b/src/OPENMP/pppm_omp.cpp index e82a6b0b13..221f0be836 100644 --- a/src/OPENMP/pppm_omp.cpp +++ b/src/OPENMP/pppm_omp.cpp @@ -358,8 +358,8 @@ void PPPMOMP::make_rho() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -441,9 +441,9 @@ void PPPMOMP::fieldforce_ik() if (nlocal == 0) return; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double qqrd2e = force->qqrd2e; const double boxlox = boxlo[0]; @@ -462,7 +462,7 @@ void PPPMOMP::fieldforce_ik() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { @@ -527,9 +527,9 @@ void PPPMOMP::fieldforce_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const double qqrd2e = force->qqrd2e; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; @@ -548,7 +548,7 @@ void PPPMOMP::fieldforce_ad() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -625,7 +625,7 @@ void PPPMOMP::fieldforce_peratom() // (dx,dy,dz) = distance to "lower left" grid pt // (mx,my,mz) = global coords of moving stencil pt - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; #if defined(_OPENMP) diff --git a/src/OPENMP/pppm_tip4p_omp.cpp b/src/OPENMP/pppm_tip4p_omp.cpp index 9d8832681e..b9902df398 100644 --- a/src/OPENMP/pppm_tip4p_omp.cpp +++ b/src/OPENMP/pppm_tip4p_omp.cpp @@ -346,8 +346,8 @@ void PPPMTIP4POMP::particle_map() if (atom->nlocal == 0) return; const int * _noalias const type = atom->type; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + auto * _noalias const p2g = (int3_t *) part2grid[0]; const double boxlox = boxlo[0]; const double boxloy = boxlo[1]; const double boxloz = boxlo[2]; @@ -423,8 +423,8 @@ void PPPMTIP4POMP::make_rho() #endif { const double * _noalias const q = atom->q; - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; dbl3_t xM; @@ -513,9 +513,9 @@ void PPPMTIP4POMP::fieldforce_ik() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -536,7 +536,7 @@ void PPPMTIP4POMP::fieldforce_ik() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); for (i = ifrom; i < ito; ++i) { @@ -624,9 +624,9 @@ void PPPMTIP4POMP::fieldforce_ad() // (mx,my,mz) = global coords of moving stencil pt // ek = 3 components of E-field on particle - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; const double * _noalias const q = atom->q; - const int3_t * _noalias const p2g = (int3_t *) part2grid[0]; + const auto * _noalias const p2g = (int3_t *) part2grid[0]; const int * _noalias const type = atom->type; const double qqrd2e = force->qqrd2e; @@ -648,7 +648,7 @@ void PPPMTIP4POMP::fieldforce_ad() // get per thread data ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - dbl3_t * _noalias const f = (dbl3_t *) thr->get_f()[0]; + auto * _noalias const f = (dbl3_t *) thr->get_f()[0]; FFT_SCALAR * const * const r1d = static_cast(thr->get_rho1d()); FFT_SCALAR * const * const d1d = static_cast(thr->get_drho1d()); @@ -837,7 +837,7 @@ void PPPMTIP4POMP::find_M_thr(int i, int &iH1, int &iH2, dbl3_t &xM) iH1 = domain->closest_image(i,iH1); iH2 = domain->closest_image(i,iH2); - const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0]; + const auto * _noalias const x = (dbl3_t *) atom->x[0]; double delx1 = x[iH1].x - x[i].x; double dely1 = x[iH1].y - x[i].y; diff --git a/src/OPENMP/pppm_tip4p_omp.h b/src/OPENMP/pppm_tip4p_omp.h index bcb5890269..68662e5975 100644 --- a/src/OPENMP/pppm_tip4p_omp.h +++ b/src/OPENMP/pppm_tip4p_omp.h @@ -59,11 +59,3 @@ class PPPMTIP4POMP : public PPPMTIP4P, public ThrOMP { #endif #endif - -/* ERROR/WARNING messages: - -E: Kspace style pppm/tip4p/omp requires newton on - -Self-explanatory. - -*/ diff --git a/src/OPENMP/reaxff_bond_orders_omp.cpp b/src/OPENMP/reaxff_bond_orders_omp.cpp index 38901807c2..258f207927 100644 --- a/src/OPENMP/reaxff_bond_orders_omp.cpp +++ b/src/OPENMP/reaxff_bond_orders_omp.cpp @@ -44,7 +44,7 @@ namespace ReaxFF { dbond_coefficients coef; int pk, k, j; - PairReaxFFOMP *pair_reax_ptr = static_cast(system->pair_ptr); + auto pair_reax_ptr = static_cast(system->pair_ptr); int tid = get_tid(); ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); diff --git a/src/OPENMP/respa_omp.cpp b/src/OPENMP/respa_omp.cpp index c6500185ad..93eb3c41ef 100644 --- a/src/OPENMP/respa_omp.cpp +++ b/src/OPENMP/respa_omp.cpp @@ -77,7 +77,7 @@ void RespaOMP::setup(int flag) mesg += fmt::format(" {}:{}", ilevel + 1, step[ilevel]); mesg += "\n r-RESPA fixes :"; - for (int l = 0; l < modify->n_post_force_respa; ++l) { + for (int l = 0; l < modify->n_post_force_respa_any; ++l) { Fix *f = modify->get_fix_by_index(modify->list_post_force_respa[l]); if (f->respa_level >= 0) mesg += fmt::format(" {}:{}[{}]", MIN(f->respa_level + 1, nlevels), f->style, f->id); @@ -420,7 +420,7 @@ void RespaOMP::recurse(int ilevel) timer->stamp(Timer::COMM); } timer->stamp(); - if (modify->n_post_force_respa) + if (modify->n_post_force_respa_any) modify->post_force_respa(vflag,ilevel,iloop); modify->final_integrate_respa(ilevel,iloop); timer->stamp(Timer::MODIFY); diff --git a/src/OPENMP/respa_omp.h b/src/OPENMP/respa_omp.h index 5e6af71102..b6f256604f 100644 --- a/src/OPENMP/respa_omp.h +++ b/src/OPENMP/respa_omp.h @@ -41,71 +41,3 @@ class RespaOMP : public Respa, public ThrOMP { #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: Respa levels must be >= 1 - -Self-explanatory. - -E: Cannot set both respa pair and inner/middle/outer - -In the rRESPA integrator, you must compute pairwise potentials either -all together (pair), or in pieces (inner/middle/outer). You can't do -both. - -E: Must set both respa inner and outer - -Cannot use just the inner or outer option with respa without using the -other. - -E: Cannot set respa middle without inner/outer - -In the rRESPA integrator, you must define both a inner and outer -setting in order to use a middle setting. - -E: Invalid order of forces within respa levels - -For respa, ordering of force computations within respa levels must -obey certain rules. E.g. bonds cannot be compute less frequently than -angles, pairwise forces cannot be computed less frequently than -kspace, etc. - -W: One or more respa levels compute no forces - -This is computationally inefficient. - -E: Respa inner cutoffs are invalid - -The first cutoff must be <= the second cutoff. - -E: Respa middle cutoffs are invalid - -The first cutoff must be <= the second cutoff. - -W: No fixes defined, atoms won't move - -If you are not using a fix like nve, nvt, npt then atom velocities and -coordinates will not be updated during timestepping. - -W: Fix shake with rRESPA computes invalid pressures - -This is a known bug in LAMMPS that has not yet been fixed. If you use -SHAKE with rRESPA and perform a constant volume simulation (e.g. using -fix npt) this only affects the output pressure, not the dynamics of -the simulation. If you use SHAKE with rRESPA and perform a constant -pressure simulation (e.g. using fix npt) then you will be -equilibrating to the wrong volume. - -E: Pair style does not support rRESPA inner/middle/outer - -You are attempting to use rRESPA options with a pair style that -does not support them. - -*/ diff --git a/src/OPENMP/thr_omp.cpp b/src/OPENMP/thr_omp.cpp index 73a5f97ca2..01f12ed17d 100644 --- a/src/OPENMP/thr_omp.cpp +++ b/src/OPENMP/thr_omp.cpp @@ -210,7 +210,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, } if (evflag) { - Pair * const pair = (Pair *)style; + auto const pair = (Pair *)style; #if defined(_OPENMP) #pragma omp critical diff --git a/src/OPT/Install.sh b/src/OPT/Install.sh index 0423df143d..fe81431403 100755 --- a/src/OPT/Install.sh +++ b/src/OPT/Install.sh @@ -48,3 +48,5 @@ action pair_morse_opt.cpp action pair_morse_opt.h action pair_ufm_opt.cpp pair_ufm.cpp action pair_ufm_opt.h pair_ufm.h +action pair_ilp_graphene_hbn_opt.cpp pair_ilp_graphene_hbn.cpp +action pair_ilp_graphene_hbn_opt.h pair_ilp_graphene_hbn.h diff --git a/src/OPT/pair_eam_opt.cpp b/src/OPT/pair_eam_opt.cpp index 0fa145c6c5..24ebdd8b4c 100644 --- a/src/OPT/pair_eam_opt.cpp +++ b/src/OPT/pair_eam_opt.cpp @@ -96,8 +96,8 @@ void PairEAMOpt::eval() int* _noalias type = atom->type; int nlocal = atom->nlocal; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; double tmp_cutforcesq = cutforcesq; double tmp_rdr = rdr; @@ -112,10 +112,10 @@ void PairEAMOpt::eval() int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc((size_t)ntypes2*(nr+1)*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { - fast_alpha_t* _noalias tab = &fast_alpha[i*ntypes*nr+j*nr]; + auto * _noalias tab = &fast_alpha[i*ntypes*nr+j*nr]; if (type2rhor[i+1][j+1] >= 0) { for (int m = 1; m <= nr; m++) { tab[m].rhor0i = rhor_spline[type2rhor[i+1][j+1]][m][6]; @@ -133,12 +133,12 @@ void PairEAMOpt::eval() } } } - fast_alpha_t* _noalias tabeight = fast_alpha; + auto * _noalias tabeight = fast_alpha; - fast_gamma_t* _noalias fast_gamma = + auto * _noalias fast_gamma = (fast_gamma_t*) malloc((size_t)ntypes2*(nr+1)*sizeof(fast_gamma_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { - fast_gamma_t* _noalias tab = &fast_gamma[i*ntypes*nr+j*nr]; + auto * _noalias tab = &fast_gamma[i*ntypes*nr+j*nr]; if (type2rhor[i+1][j+1] >= 0) { for (int m = 1; m <= nr; m++) { tab[m].rhor4i = rhor_spline[type2rhor[i+1][j+1]][m][2]; @@ -166,7 +166,7 @@ void PairEAMOpt::eval() } } } - fast_gamma_t* _noalias tabss = fast_gamma; + auto * _noalias tabss = fast_gamma; // zero out density @@ -188,7 +188,7 @@ void PairEAMOpt::eval() jnum = numneigh[i]; double tmprho = rho[i]; - fast_alpha_t* _noalias tabeighti = &tabeight[itype*ntypes*nr]; + auto * _noalias tabeighti = &tabeight[itype*ntypes*nr]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; @@ -271,7 +271,7 @@ void PairEAMOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_gamma_t* _noalias tabssi = &tabss[itype1*ntypes*nr]; + auto * _noalias tabssi = &tabss[itype1*ntypes*nr]; double* _noalias scale_i = scale[itype1+1]+1; numforce[i] = 0; diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp new file mode 100644 index 0000000000..5b1357f4b1 --- /dev/null +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -0,0 +1,776 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Optimization author1: Ping Gao (National Supercomputing Center in Wuxi, China) + e-mail: qdgaoping at gmail dot com + Optimization author2: Xiaohui Duan (National Supercomputing Center in Wuxi, China) + e-mail: sunrise_duan at 126 dot com + + Provides some bugfixes and performance optimizations in this potential. +*/ + +#include "pair_ilp_graphene_hbn_opt.h" + +#include "atom.h" +#include "citeme.h" +#include "comm.h" +#include "error.h" +#include "force.h" +#include "interlayer_taper.h" +#include "memory.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace InterLayer; + +static const char cite_ilp_cur[] = + "ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137\n" + "@inproceedings{gao2021lmff\n" + " author = {Gao, Ping and Duan, Xiaohui and Others},\n" + " title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous " + "Many-Core Processors},\n" + " year = {2021},\n" + " isbn = {9781450384421},\n" + " publisher = {Association for Computing Machinery},\n" + " address = {New York, NY, USA},\n" + " url = {https://doi.org/10.1145/3458817.3476137},\n" + " doi = {10.1145/3458817.3476137},\n" + " booktitle = {Proceedings of the International Conference for High Performance Computing, " + "Networking, Storage and Analysis},\n" + " articleno = {42},\n" + " numpages = {14},\n" + " location = {St. Louis, Missouri},\n" + " series = {SC'21},\n" + "}\n\n"; + +static bool check_vdw(tagint itag, tagint jtag, double *xi, double *xj); + +/* ---------------------------------------------------------------------- */ + +PairILPGrapheneHBNOpt::PairILPGrapheneHBNOpt(LAMMPS *lmp) : + PairILPGrapheneHBN(lmp), layered_neigh(nullptr), first_layered_neigh(nullptr), + num_intra(nullptr), num_inter(nullptr), num_vdw(nullptr) +{ + if (lmp->citeme) lmp->citeme->add(cite_ilp_cur); + + single_enable = 0; + inum_max = 0; + jnum_max = 0; +} + +/* ---------------------------------------------------------------------- */ + +PairILPGrapheneHBNOpt::~PairILPGrapheneHBNOpt() +{ + memory->destroy(layered_neigh); + memory->sfree(first_layered_neigh); + memory->destroy(num_intra); + memory->destroy(num_inter); + memory->destroy(num_vdw); +} + +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairILPGrapheneHBNOpt::init_style() +{ + if (force->newton_pair == 0) + error->all(FLERR, "Pair style ilp/graphene/hbn requires newton pair on"); + if (!atom->molecule_flag) + error->all(FLERR, "Pair style ilp/graphene/hbn requires atom attribute molecule"); + + // It seems that ghost neighbors is required for some historical reason, and it is not needed now + + neighbor->add_request(this, NeighConst::REQ_FULL); +} + +/* ---------------------------------------------------------------------- */ + +void PairILPGrapheneHBNOpt::compute(int eflag, int vflag) +{ + ev_init(eflag, vflag); + pvector[0] = pvector[1] = 0.0; + + if (neighbor->ago == 0) update_internal_list(); + + if (eflag_global || eflag_atom) { + if (vflag_either) { + if (tap_flag) { + eval<1, 1, 1>(); + } else { + eval<1, 1, 0>(); + } + } else { + if (tap_flag) { + eval<1, 0, 1>(); + } else { + eval<1, 0, 0>(); + } + } + } else { + if (vflag_either) { + if (tap_flag) { + eval<0, 1, 1>(); + } else { + eval<0, 1, 0>(); + } + } else { + if (tap_flag) { + eval<0, 0, 1>(); + } else { + eval<0, 0, 0>(); + } + } + } + + if (vflag_fdotr) virial_fdotr_compute(); +} + +/* ---------------------------------------------------------------------- */ + +template void PairILPGrapheneHBNOpt::eval() +{ + constexpr int EVFLAG = EFLAG || VFLAG_EITHER; + int i, j, ii, jj, inum, itype, itype_map, jtype, k, kk; + double prodnorm1, fkcx, fkcy, fkcz; + double xtmp, ytmp, ztmp, delx, dely, delz, evdwl, fpair, fpair1; + double rsq, r, Rcut, rhosq1, exp0, exp1, Tap, dTap, Vilp; + double frho1, Erep, fsum, rdsq1; + int *ilist; + evdwl = 0.0; + + double **x = atom->x; + double **f = atom->f; + int *type = atom->type; + int nlocal = atom->nlocal; + int newton_pair = force->newton_pair; + double fp1[3] = {0.0, 0.0, 0.0}; + double delki[3] = {0.0, 0.0, 0.0}; + double fk[3] = {0.0, 0.0, 0.0}; + double dproddni[3] = {0.0, 0.0, 0.0}; + double cij; + + inum = list->inum; + ilist = list->ilist; + + for (ii = 0; ii < inum; ii++) { + i = ilist[ii]; + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + itype = type[i]; + itype_map = map[type[i]]; + int *jlist_intra = first_layered_neigh[i]; + int *jlist_inter = first_layered_neigh[i] + num_intra[i]; + int jnum_intra = num_intra[i]; + int jnum_inter = num_inter[i]; + int jnum_vdw = num_vdw[i]; + int ILP_neigh[3]; + int ILP_nneigh = 0; + for (jj = 0; jj < jnum_intra; jj++) { + j = jlist_intra[jj]; + + jtype = map[type[j]]; + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + if (rsq < cutILPsq[itype_map][jtype]) { + if (ILP_nneigh >= 3) + error->one(FLERR, "There are too many neighbors for calculating normals"); + ILP_neigh[ILP_nneigh++] = j; + } + } // loop over jj + + dproddni[0] = 0.0; + dproddni[1] = 0.0; + dproddni[2] = 0.0; + + double norm[3], dnormdxi[3][3], dnormdxk[3][3][3]; + calc_single_normal(i, ILP_neigh, ILP_nneigh, norm, dnormdxi, dnormdxk); + + for (jj = 0; jj < jnum_inter; jj++) { + j = jlist_inter[jj]; + jtype = type[j]; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + + // only include the interaction between different layers + if (rsq < cutsq[itype][jtype]) { + + int iparam_ij = elem2param[map[itype]][map[jtype]]; + Param &p = params[iparam_ij]; + + r = sqrt(rsq); + double r2inv = 1.0 / rsq; + double rinv = r * r2inv; + // turn on/off taper function + if (TAP_FLAG) { + Rcut = sqrt(cutsq[itype][jtype]); + Tap = calc_Tap(r, Rcut); + dTap = calc_dTap(r, Rcut); + } else { + Tap = 1.0; + dTap = 0.0; + } + + // Calculate the transverse distance + prodnorm1 = norm[0] * delx + norm[1] * dely + norm[2] * delz; + rhosq1 = rsq - prodnorm1 * prodnorm1; // rho_ij + rdsq1 = rhosq1 * p.delta2inv; // (rho_ij/delta)^2 + + // store exponents + exp0 = exp(-p.lambda * (r - p.z0)); + exp1 = exp(-rdsq1); + + frho1 = exp1 * p.C; + Erep = 0.5 * p.epsilon + frho1; + + Vilp = exp0 * Erep; + + // derivatives + fpair = p.lambda * exp0 * rinv * Erep; + fpair1 = 2.0 * exp0 * frho1 * p.delta2inv; + fsum = fpair + fpair1; + // derivatives of the product of rij and ni, the result is a vector + + fp1[0] = prodnorm1 * norm[0] * fpair1; + fp1[1] = prodnorm1 * norm[1] * fpair1; + fp1[2] = prodnorm1 * norm[2] * fpair1; + + fkcx = (delx * fsum - fp1[0]) * Tap - Vilp * dTap * delx * rinv; + fkcy = (dely * fsum - fp1[1]) * Tap - Vilp * dTap * dely * rinv; + fkcz = (delz * fsum - fp1[2]) * Tap - Vilp * dTap * delz * rinv; + + f[i][0] += fkcx; + f[i][1] += fkcy; + f[i][2] += fkcz; + f[j][0] -= fkcx; + f[j][1] -= fkcy; + f[j][2] -= fkcz; + + cij = -prodnorm1 * fpair1 * Tap; + dproddni[0] += cij * delx; + dproddni[1] += cij * dely; + dproddni[2] += cij * delz; + + if (EFLAG) pvector[1] += evdwl = Tap * Vilp; + if (EVFLAG) + ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0.0, fkcx, fkcy, fkcz, delx, dely, delz); + + /* ---------------------------------------------------------------------- + van der Waals forces and energy + ------------------------------------------------------------------------- */ + if (jj >= jnum_vdw) continue; + double r6inv = r2inv * r2inv * r2inv; + double r8inv = r6inv * r2inv; + + //double TSvdw = 1.0 + exp(-p.d * (r * p.seffinv - 1.0)); + double TSvdw = 1.0 + exp(-p.d * (r * 1.0 / p.seff - 1.0)); + double TSvdwinv = 1.0 / TSvdw; + double TSvdw2inv = TSvdwinv * TSvdwinv; //pow(TSvdw, -2.0); + Vilp = -p.C6 * r6inv * TSvdwinv; + + fpair = -6.0 * p.C6 * r8inv * TSvdwinv + + p.C6 * p.d * 1.0 / p.seff * (TSvdw - 1.0) * TSvdw2inv * r8inv * r; + //p.C6 * p.d * p.seffinv * (TSvdw - 1.0) * TSvdw2inv * r8inv * r; + fsum = fpair * Tap - Vilp * dTap * rinv; + + double fvdwx = fsum * delx; + double fvdwy = fsum * dely; + double fvdwz = fsum * delz; + + f[i][0] += fvdwx; + f[i][1] += fvdwy; + f[i][2] += fvdwz; + f[j][0] -= fvdwx; + f[j][1] -= fvdwy; + f[j][2] -= fvdwz; + + if (EFLAG) pvector[0] += evdwl = Tap * Vilp; + if (EVFLAG) + ev_tally_xyz(i, j, nlocal, newton_pair, evdwl, 0.0, fvdwx, fvdwy, fvdwz, delx, dely, + delz); + } + } // loop over jj + + for (kk = 0; kk < ILP_nneigh; kk++) { + k = ILP_neigh[kk]; + if (k == i) continue; + // derivatives of the product of rij and ni respect to rk, k=0,1,2, where atom k is the neighbors of atom i + fk[0] = dnormdxk[0][0][kk] * dproddni[0] + dnormdxk[1][0][kk] * dproddni[1] + + dnormdxk[2][0][kk] * dproddni[2]; + fk[1] = dnormdxk[0][1][kk] * dproddni[0] + dnormdxk[1][1][kk] * dproddni[1] + + dnormdxk[2][1][kk] * dproddni[2]; + fk[2] = dnormdxk[0][2][kk] * dproddni[0] + dnormdxk[1][2][kk] * dproddni[1] + + dnormdxk[2][2][kk] * dproddni[2]; + + f[k][0] += fk[0]; + f[k][1] += fk[1]; + f[k][2] += fk[2]; + + delki[0] = x[k][0] - x[i][0]; + delki[1] = x[k][1] - x[i][1]; + delki[2] = x[k][2] - x[i][2]; + + if (VFLAG_EITHER) { + ev_tally_xyz(k, i, nlocal, newton_pair, 0.0, 0.0, fk[0], fk[1], fk[2], delki[0], delki[1], + delki[2]); + } + } + f[i][0] += + dnormdxi[0][0] * dproddni[0] + dnormdxi[1][0] * dproddni[1] + dnormdxi[2][0] * dproddni[2]; + f[i][1] += + dnormdxi[0][1] * dproddni[0] + dnormdxi[1][1] * dproddni[1] + dnormdxi[2][1] * dproddni[2]; + f[i][2] += + dnormdxi[0][2] * dproddni[0] + dnormdxi[1][2] * dproddni[1] + dnormdxi[2][2] * dproddni[2]; + } // loop over ii +} + +/* ---------------------------------------------------------------------- + Calculate the normals for one atom +------------------------------------------------------------------------- */ +void PairILPGrapheneHBNOpt::calc_single_normal(int i, int *ILP_neigh, int nneigh, double *normal, + double (*dnormdri)[3], double (*dnormdrk)[3][3]) +{ + int cont, id, ip, m; + double nn, delx, dely, delz, nn2; + double pv12[3], pv31[3], pv23[3], n1[3], dni[3], dnn[3][3], vet[3][3], dpvdri[3][3]; + double dn1[3][3][3], dpv12[3][3][3], dpv23[3][3][3], dpv31[3][3][3]; + + double **x = atom->x; + + for (id = 0; id < 3; id++) { + pv12[id] = 0.0; + pv31[id] = 0.0; + pv23[id] = 0.0; + n1[id] = 0.0; + dni[id] = 0.0; + normal[id] = 0.0; + for (ip = 0; ip < 3; ip++) { + vet[ip][id] = 0.0; + dnn[ip][id] = 0.0; + dpvdri[ip][id] = 0.0; + dnormdri[ip][id] = 0.0; + for (m = 0; m < 3; m++) { + dpv12[ip][id][m] = 0.0; + dpv31[ip][id][m] = 0.0; + dpv23[ip][id][m] = 0.0; + dn1[ip][id][m] = 0.0; + dnormdrk[ip][id][m] = 0.0; + } + } + } + + const double xtp = x[i][0]; + const double ytp = x[i][1]; + const double ztp = x[i][2]; + + cont = 0; + int j, *jlist = ILP_neigh; + const int jnum = nneigh; + for (int jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= NEIGHMASK; + + delx = x[j][0] - xtp; + dely = x[j][1] - ytp; + delz = x[j][2] - ztp; + vet[cont][0] = delx; + vet[cont][1] = dely; + vet[cont][2] = delz; + cont++; + } + + if (cont <= 1) { + normal[0] = 0.0; + normal[1] = 0.0; + normal[2] = 1.0; + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[id][ip] = 0.0; + for (m = 0; m < 3; m++) { dnormdrk[id][ip][m] = 0.0; } + } + } + } else if (cont == 2) { + pv12[0] = vet[0][1] * vet[1][2] - vet[1][1] * vet[0][2]; + pv12[1] = vet[0][2] * vet[1][0] - vet[1][2] * vet[0][0]; + pv12[2] = vet[0][0] * vet[1][1] - vet[1][0] * vet[0][1]; + + // derivatives of pv12[0] to ri + + dpvdri[0][0] = 0.0; + dpvdri[0][1] = vet[0][2] - vet[1][2]; + dpvdri[0][2] = vet[1][1] - vet[0][1]; + + // derivatives of pv12[1] to ri + + dpvdri[1][0] = vet[1][2] - vet[0][2]; + dpvdri[1][1] = 0.0; + dpvdri[1][2] = vet[0][0] - vet[1][0]; + + // derivatives of pv12[2] to ri + + dpvdri[2][0] = vet[0][1] - vet[1][1]; + dpvdri[2][1] = vet[1][0] - vet[0][0]; + dpvdri[2][2] = 0.0; + + dpv12[0][0][0] = 0.0; + dpv12[0][1][0] = vet[1][2]; + dpv12[0][2][0] = -vet[1][1]; + dpv12[1][0][0] = -vet[1][2]; + dpv12[1][1][0] = 0.0; + dpv12[1][2][0] = vet[1][0]; + dpv12[2][0][0] = vet[1][1]; + dpv12[2][1][0] = -vet[1][0]; + dpv12[2][2][0] = 0.0; + + // derivatives respect to the second neighbor, atom l + + dpv12[0][0][1] = 0.0; + dpv12[0][1][1] = -vet[0][2]; + dpv12[0][2][1] = vet[0][1]; + dpv12[1][0][1] = vet[0][2]; + dpv12[1][1][1] = 0.0; + dpv12[1][2][1] = -vet[0][0]; + dpv12[2][0][1] = -vet[0][1]; + dpv12[2][1][1] = vet[0][0]; + dpv12[2][2][1] = 0.0; + + // derivatives respect to the third neighbor, atom n + // derivatives of pv12 to rn is zero + + for (id = 0; id < 3; id++) + for (ip = 0; ip < 3; ip++) dpv12[id][ip][2] = 0.0; + + n1[0] = pv12[0]; + n1[1] = pv12[1]; + n1[2] = pv12[2]; + + // the magnitude of the normal vector + nn2 = n1[0] * n1[0] + n1[1] * n1[1] + n1[2] * n1[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + + // the unit normal vector + + normal[0] = n1[0] / nn; + normal[1] = n1[1] / nn; + normal[2] = n1[2] / nn; + + // derivatives of nn, dnn:3x1 vector + + dni[0] = (n1[0] * dpvdri[0][0] + n1[1] * dpvdri[1][0] + n1[2] * dpvdri[2][0]) / nn; + dni[1] = (n1[0] * dpvdri[0][1] + n1[1] * dpvdri[1][1] + n1[2] * dpvdri[2][1]) / nn; + dni[2] = (n1[0] * dpvdri[0][2] + n1[1] * dpvdri[1][2] + n1[2] * dpvdri[2][2]) / nn; + + // derivatives of unit vector ni respect to ri, the result is 3x3 matrix + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + dnormdri[id][ip] = dpvdri[id][ip] / nn - n1[id] * dni[ip] / nn2; + } + } + + // derivatives of non-normalized normal vector, dn1:3x3x3 array + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < 3; m++) dn1[id][ip][m] = dpv12[id][ip][m]; + } + } + + // derivatives of nn, dnn:3x3 vector + // dnn[id][m]: the derivative of nn respect to r[id][m], id,m=0,1,2 + // r[id][m]: the id's component of atom m + + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) + dnn[id][m] = (n1[0] * dn1[0][id][m] + n1[1] * dn1[1][id][m] + n1[2] * dn1[2][id][m]) / nn; + } + + // dnormdrk[id][ip][m][i]: the derivative of normal[id] respect to r[ip][m], id,ip=0,1,2 + // for atom m, which is a neighbor atom of atom i, m=0,jnum-1 + + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) + dnormdrk[id][ip][m] = dn1[id][ip][m] / nn - n1[id] * dnn[ip][m] / nn2; + } + } + } + + //############################################################################################## + + else if (cont == 3) { + pv12[0] = vet[0][1] * vet[1][2] - vet[1][1] * vet[0][2]; + pv12[1] = vet[0][2] * vet[1][0] - vet[1][2] * vet[0][0]; + pv12[2] = vet[0][0] * vet[1][1] - vet[1][0] * vet[0][1]; + + // derivatives respect to the first neighbor, atom k + + dpv12[0][0][0] = 0.0; + dpv12[0][1][0] = vet[1][2]; + dpv12[0][2][0] = -vet[1][1]; + dpv12[1][0][0] = -vet[1][2]; + dpv12[1][1][0] = 0.0; + dpv12[1][2][0] = vet[1][0]; + dpv12[2][0][0] = vet[1][1]; + dpv12[2][1][0] = -vet[1][0]; + dpv12[2][2][0] = 0.0; + + // derivatives respect to the second neighbor, atom l + + dpv12[0][0][1] = 0.0; + dpv12[0][1][1] = -vet[0][2]; + dpv12[0][2][1] = vet[0][1]; + dpv12[1][0][1] = vet[0][2]; + dpv12[1][1][1] = 0.0; + dpv12[1][2][1] = -vet[0][0]; + dpv12[2][0][1] = -vet[0][1]; + dpv12[2][1][1] = vet[0][0]; + dpv12[2][2][1] = 0.0; + + // derivatives respect to the third neighbor, atom n + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) dpv12[id][ip][2] = 0.0; + } + + pv31[0] = vet[2][1] * vet[0][2] - vet[0][1] * vet[2][2]; + pv31[1] = vet[2][2] * vet[0][0] - vet[0][2] * vet[2][0]; + pv31[2] = vet[2][0] * vet[0][1] - vet[0][0] * vet[2][1]; + + // derivatives respect to the first neighbor, atom k + + dpv31[0][0][0] = 0.0; + dpv31[0][1][0] = -vet[2][2]; + dpv31[0][2][0] = vet[2][1]; + dpv31[1][0][0] = vet[2][2]; + dpv31[1][1][0] = 0.0; + dpv31[1][2][0] = -vet[2][0]; + dpv31[2][0][0] = -vet[2][1]; + dpv31[2][1][0] = vet[2][0]; + dpv31[2][2][0] = 0.0; + + // derivatives respect to the third neighbor, atom n + + dpv31[0][0][2] = 0.0; + dpv31[0][1][2] = vet[0][2]; + dpv31[0][2][2] = -vet[0][1]; + dpv31[1][0][2] = -vet[0][2]; + dpv31[1][1][2] = 0.0; + dpv31[1][2][2] = vet[0][0]; + dpv31[2][0][2] = vet[0][1]; + dpv31[2][1][2] = -vet[0][0]; + dpv31[2][2][2] = 0.0; + + // derivatives respect to the second neighbor, atom l + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) dpv31[id][ip][1] = 0.0; + } + + pv23[0] = vet[1][1] * vet[2][2] - vet[2][1] * vet[1][2]; + pv23[1] = vet[1][2] * vet[2][0] - vet[2][2] * vet[1][0]; + pv23[2] = vet[1][0] * vet[2][1] - vet[2][0] * vet[1][1]; + + // derivatives respect to the second neighbor, atom k + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { dpv23[id][ip][0] = 0.0; } + } + + // derivatives respect to the second neighbor, atom l + + dpv23[0][0][1] = 0.0; + dpv23[0][1][1] = vet[2][2]; + dpv23[0][2][1] = -vet[2][1]; + dpv23[1][0][1] = -vet[2][2]; + dpv23[1][1][1] = 0.0; + dpv23[1][2][1] = vet[2][0]; + dpv23[2][0][1] = vet[2][1]; + dpv23[2][1][1] = -vet[2][0]; + dpv23[2][2][1] = 0.0; + + // derivatives respect to the third neighbor, atom n + + dpv23[0][0][2] = 0.0; + dpv23[0][1][2] = -vet[1][2]; + dpv23[0][2][2] = vet[1][1]; + dpv23[1][0][2] = vet[1][2]; + dpv23[1][1][2] = 0.0; + dpv23[1][2][2] = -vet[1][0]; + dpv23[2][0][2] = -vet[1][1]; + dpv23[2][1][2] = vet[1][0]; + dpv23[2][2][2] = 0.0; + + //############################################################################################ + // average the normal vectors by using the 3 neighboring planes + + n1[0] = (pv12[0] + pv31[0] + pv23[0]) / cont; + n1[1] = (pv12[1] + pv31[1] + pv23[1]) / cont; + n1[2] = (pv12[2] + pv31[2] + pv23[2]) / cont; + + // the magnitude of the normal vector + + nn2 = n1[0] * n1[0] + n1[1] * n1[1] + n1[2] * n1[2]; + nn = sqrt(nn2); + if (nn == 0) error->one(FLERR, "The magnitude of the normal vector is zero"); + + // the unit normal vector + + normal[0] = n1[0] / nn; + normal[1] = n1[1] / nn; + normal[2] = n1[2] / nn; + + // for the central atoms, dnormdri is always zero + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) dnormdri[id][ip] = 0.0; + } + + // derivatives of non-normalized normal vector, dn1:3x3x3 array + + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) { + for (m = 0; m < 3; m++) + dn1[id][ip][m] = (dpv12[id][ip][m] + dpv23[id][ip][m] + dpv31[id][ip][m]) / cont; + } + } + + // derivatives of nn, dnn:3x3 vector + // dnn[id][m]: the derivative of nn respect to r[id][m], id,m=0,1,2 + // r[id][m]: the id's component of atom m + + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) + dnn[id][m] = (n1[0] * dn1[0][id][m] + n1[1] * dn1[1][id][m] + n1[2] * dn1[2][id][m]) / nn; + } + + // dnormdrk[id][ip][m][i]: the derivative of normal[id] respect to r[ip][m], id,ip=0,1,2 + // for atom m, which is a neighbor atom of atom i, m=0,jnum-1 + + for (m = 0; m < 3; m++) { + for (id = 0; id < 3; id++) { + for (ip = 0; ip < 3; ip++) + dnormdrk[id][ip][m] = dn1[id][ip][m] / nn - n1[id] * dnn[ip][m] / nn2; + } + } + } else { + error->one(FLERR, "There are too many neighbors for calculating normals"); + } +} + +/* ------------------------------------------------------------------------ */ + +bool check_vdw(tagint itag, tagint jtag, double *xi, double *xj) +{ + if (itag > jtag) { + if ((itag + jtag) % 2 == 0) return false; + } else if (itag < jtag) { + if ((itag + jtag) % 2 == 1) return false; + } else { + if (xj[2] < xi[2]) return false; + if (xj[2] == xi[2] && xj[1] < xi[1]) return false; + if (xj[2] == xi[2] && xj[1] == xi[1] && xj[0] < xi[0]) return false; + } + return true; +} + +/* ------------------------------------------------------------------------ */ + +void PairILPGrapheneHBNOpt::update_internal_list() +{ + int jnum_sum = 0; + int inum = list->inum; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + tagint *tag = atom->tag; + double **x = atom->x; + for (int ii = 0; ii < inum; ii++) { jnum_sum += numneigh[ilist[ii]]; } + if (inum > inum_max) { + memory->destroy(num_intra); + memory->destroy(num_inter); + memory->destroy(num_vdw); + memory->sfree(first_layered_neigh); + //golden ratio grow + inum_max = (int) ceil(inum / 0.618); + memory->create(num_intra, inum_max, "PairILPGrapheneHBN:intra_layer_count"); + memory->create(num_inter, inum_max, "PairILPGrapheneHBN:inter_layer_count"); + memory->create(num_vdw, inum_max, "PairILPGrapheneHBN:vdw_count"); + first_layered_neigh = (int **) memory->smalloc(inum_max * sizeof(int *), + "PairILPGrapheneHBN:first_layered_neigh"); + } + if (jnum_sum > jnum_max) { + memory->destroy(layered_neigh); + jnum_max = (int) ceil(jnum_sum / 0.618); + memory->create(layered_neigh, jnum_max, "PairILPGrapheneHBN:layered_neigh"); + } + + double cut_intra = 0; + for (int i = 0; i < nparams; i++) + if (params[i].rcut > cut_intra) { cut_intra = params[i].rcut; } + + double cut_intra_listsq = (cut_intra + neighbor->skin) * (cut_intra + neighbor->skin); + + int total_neigh = 0; + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; + tagint itag = tag[i]; + int jnum = numneigh[i]; + int *jlist = firstneigh[i]; + int *jlist_layered = first_layered_neigh[i] = layered_neigh + total_neigh; + int ninter = 0, nintra = 0; + + for (int jj = 0; jj < jnum; jj++) { + int j = jlist[jj] & NEIGHMASK; + if (atom->molecule[j] == atom->molecule[i]) { + double delx = x[i][0] - x[j][0]; + double dely = x[i][1] - x[j][1]; + double delz = x[i][2] - x[j][2]; + double rsq = delx * delx + dely * dely + delz * delz; + if (rsq < cut_intra_listsq) jlist_layered[nintra++] = j; + } + } + for (int jj = 0; jj < jnum; jj++) { + int j = jlist[jj] & NEIGHMASK; + tagint jtag = tag[j]; + if (atom->molecule[j] != atom->molecule[i]) { + if (check_vdw(itag, jtag, x[i], x[j])) jlist_layered[nintra + ninter++] = j; + } + } + num_vdw[i] = ninter; + for (int jj = 0; jj < jnum; jj++) { + int j = jlist[jj] & NEIGHMASK; + tagint jtag = tag[j]; + if (atom->molecule[j] != atom->molecule[i]) { + if (!check_vdw(itag, jtag, x[i], x[j])) jlist_layered[nintra + ninter++] = j; + } + } + num_intra[i] = nintra; + num_inter[i] = ninter; + total_neigh += nintra + ninter; + } +} diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.h b/src/OPT/pair_ilp_graphene_hbn_opt.h new file mode 100644 index 0000000000..935468dc91 --- /dev/null +++ b/src/OPT/pair_ilp_graphene_hbn_opt.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 PAIR_CLASS +// clang-format off +PairStyle(ilp/graphene/hbn/opt,PairILPGrapheneHBNOpt); +// clang-format on +#else + +#ifndef LMP_PAIR_ILP_GRAPHENE_HBN_OPT_H +#define LMP_PAIR_ILP_GRAPHENE_HBN_OPT_H + +#include "pair_ilp_graphene_hbn.h" + +namespace LAMMPS_NS { + +class PairILPGrapheneHBNOpt : virtual public PairILPGrapheneHBN { + public: + PairILPGrapheneHBNOpt(class LAMMPS *); + ~PairILPGrapheneHBNOpt() override; + + void compute(int, int) override; + void init_style() override; + + protected: + void calc_single_normal(int i, int *ILP_neigh, int nneigh, double *normal, double (*dnormdri)[3], + double (*dnormdrk)[3][3]); + void update_internal_list(); + template void eval(); + int *layered_neigh; + int **first_layered_neigh; + int *num_intra, *num_inter, *num_vdw; + int inum_max, jnum_max; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/OPT/pair_lj_charmm_coul_long_opt.cpp b/src/OPT/pair_lj_charmm_coul_long_opt.cpp index 186172035c..bfc904b853 100644 --- a/src/OPT/pair_lj_charmm_coul_long_opt.cpp +++ b/src/OPT/pair_lj_charmm_coul_long_opt.cpp @@ -98,8 +98,8 @@ void PairLJCharmmCoulLongOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; @@ -107,7 +107,7 @@ void PairLJCharmmCoulLongOpt::eval() double tmp_coef1 = 1.0/denom_lj; double tmp_coef2 = cut_ljsq - 3.0*cut_lj_innersq; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*)malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -117,7 +117,7 @@ void PairLJCharmmCoulLongOpt::eval() a.lj3 = lj3[i+1][j+1]; a.lj4 = lj4[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -135,7 +135,7 @@ void PairLJCharmmCoulLongOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*) &tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*) &tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/OPT/pair_lj_cut_opt.cpp b/src/OPT/pair_lj_cut_opt.cpp index f272e6fc78..9fbddd492a 100644 --- a/src/OPT/pair_lj_cut_opt.cpp +++ b/src/OPT/pair_lj_cut_opt.cpp @@ -78,13 +78,13 @@ void PairLJCutOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -95,7 +95,7 @@ void PairLJCutOpt::eval() a.lj4 = lj4[i+1][j+1]; a.offset = offset[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -112,7 +112,7 @@ void PairLJCutOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/OPT/pair_lj_cut_tip4p_long_opt.h b/src/OPT/pair_lj_cut_tip4p_long_opt.h index a86fcd3298..613aa28532 100644 --- a/src/OPT/pair_lj_cut_tip4p_long_opt.h +++ b/src/OPT/pair_lj_cut_tip4p_long_opt.h @@ -40,17 +40,3 @@ class PairLJCutTIP4PLongOpt : public PairLJCutTIP4PLong { #endif #endif - -/* ERROR/WARNING messages: - -E: TIP4P hydrogen is missing - -The TIP4P pairwise computation failed to find the correct H atom -within a water molecule. - -E: TIP4P hydrogen has incorrect atom type - -The TIP4P pairwise computation found an H atom whose type does not -agree with the specified H type. - -*/ diff --git a/src/OPT/pair_morse_opt.cpp b/src/OPT/pair_morse_opt.cpp index 04aace0d43..2c256073a2 100644 --- a/src/OPT/pair_morse_opt.cpp +++ b/src/OPT/pair_morse_opt.cpp @@ -79,13 +79,13 @@ void PairMorseOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -96,7 +96,7 @@ void PairMorseOpt::eval() a.d0 = d0[i+1][j+1]; a.offset = offset[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -113,7 +113,7 @@ void PairMorseOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/OPT/pair_ufm_opt.cpp b/src/OPT/pair_ufm_opt.cpp index 3502dfda6c..6809420f8a 100644 --- a/src/OPT/pair_ufm_opt.cpp +++ b/src/OPT/pair_ufm_opt.cpp @@ -78,13 +78,13 @@ void PairUFMOpt::eval() int** _noalias firstneigh = list->firstneigh; int* _noalias numneigh = list->numneigh; - vec3_t* _noalias xx = (vec3_t*)x[0]; - vec3_t* _noalias ff = (vec3_t*)f[0]; + auto * _noalias xx = (vec3_t*)x[0]; + auto * _noalias ff = (vec3_t*)f[0]; int ntypes = atom->ntypes; int ntypes2 = ntypes*ntypes; - fast_alpha_t* _noalias fast_alpha = + auto * _noalias fast_alpha = (fast_alpha_t*) malloc(ntypes2*sizeof(fast_alpha_t)); for (i = 0; i < ntypes; i++) for (j = 0; j < ntypes; j++) { fast_alpha_t& a = fast_alpha[i*ntypes+j]; @@ -95,7 +95,7 @@ void PairUFMOpt::eval() a.scale = scale[i+1][j+1]; a.offset = offset[i+1][j+1]; } - fast_alpha_t* _noalias tabsix = fast_alpha; + auto * _noalias tabsix = fast_alpha; // loop over neighbors of my atoms @@ -112,7 +112,7 @@ void PairUFMOpt::eval() double tmpfy = 0.0; double tmpfz = 0.0; - fast_alpha_t* _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; + auto * _noalias tabsixi = (fast_alpha_t*)&tabsix[itype*ntypes]; for (jj = 0; jj < jnum; jj++) { j = jlist[jj]; diff --git a/src/ORIENT/fix_orient_bcc.cpp b/src/ORIENT/fix_orient_bcc.cpp index 9449f5bcd8..919927ea07 100644 --- a/src/ORIENT/fix_orient_bcc.cpp +++ b/src/ORIENT/fix_orient_bcc.cpp @@ -201,7 +201,7 @@ int FixOrientBCC::setmask() void FixOrientBCC::init() { if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -224,9 +224,9 @@ void FixOrientBCC::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } @@ -566,8 +566,8 @@ void FixOrientBCC::find_best_ref(double *displs, int which_crystal, int FixOrientBCC::compare(const void *pi, const void *pj) { - FixOrientBCC::Sort *ineigh = (FixOrientBCC::Sort *) pi; - FixOrientBCC::Sort *jneigh = (FixOrientBCC::Sort *) pj; + auto ineigh = (FixOrientBCC::Sort *) pi; + auto jneigh = (FixOrientBCC::Sort *) pj; if (ineigh->rsq < jneigh->rsq) return -1; else if (ineigh->rsq > jneigh->rsq) return 1; diff --git a/src/ORIENT/fix_orient_bcc.h b/src/ORIENT/fix_orient_bcc.h index 82d9829397..ead626141f 100644 --- a/src/ORIENT/fix_orient_bcc.h +++ b/src/ORIENT/fix_orient_bcc.h @@ -70,7 +70,8 @@ class FixOrientBCC : public Fix { bool use_xismooth; static constexpr int half_bcc_nn = 4; - double Rxi[half_bcc_nn][3] = {}, Rchi[half_bcc_nn][3] = {}, half_xi_chi_vec[2][half_bcc_nn][3] = {}; + double Rxi[half_bcc_nn][3] = {}, Rchi[half_bcc_nn][3] = {}, + half_xi_chi_vec[2][half_bcc_nn][3] = {}; double xiid, xi0, xi1, xicutoffsq, cutsq, added_energy; int nmax; // expose 2 per-atom quantities @@ -88,28 +89,3 @@ class FixOrientBCC : public Fix { #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: Fix orient/bcc file open failed - -The fix orient/bcc command could not open a specified file. - -E: Fix orient/bcc file read failed - -The fix orient/bcc command could not read the needed parameters from a -specified file. - -E: Fix orient/bcc found self twice - -The neighbor lists used by fix orient/bcc are messed up. If this -error occurs, it is likely a bug, so send an email to the -"developers"_https://www.lammps.org/authors.html. - -*/ diff --git a/src/ORIENT/fix_orient_eco.cpp b/src/ORIENT/fix_orient_eco.cpp index 6f633316cf..7c8ff1f6aa 100644 --- a/src/ORIENT/fix_orient_eco.cpp +++ b/src/ORIENT/fix_orient_eco.cpp @@ -176,7 +176,7 @@ void FixOrientECO::init() { MPI_Bcast(&inv_norm_fac, 1, MPI_DOUBLE, 0, world); if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels - 1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels - 1; if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } @@ -197,9 +197,9 @@ void FixOrientECO::setup(int vflag) { if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa, 0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/ORIENT/fix_orient_fcc.cpp b/src/ORIENT/fix_orient_fcc.cpp index d631ca9bd8..f64889d141 100644 --- a/src/ORIENT/fix_orient_fcc.cpp +++ b/src/ORIENT/fix_orient_fcc.cpp @@ -199,7 +199,7 @@ int FixOrientFCC::setmask() void FixOrientFCC::init() { if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -222,9 +222,9 @@ void FixOrientFCC::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } @@ -564,8 +564,8 @@ void FixOrientFCC::find_best_ref(double *displs, int which_crystal, int FixOrientFCC::compare(const void *pi, const void *pj) { - FixOrientFCC::Sort *ineigh = (FixOrientFCC::Sort *) pi; - FixOrientFCC::Sort *jneigh = (FixOrientFCC::Sort *) pj; + auto ineigh = (FixOrientFCC::Sort *) pi; + auto jneigh = (FixOrientFCC::Sort *) pj; if (ineigh->rsq < jneigh->rsq) return -1; else if (ineigh->rsq > jneigh->rsq) return 1; diff --git a/src/ORIENT/fix_orient_fcc.h b/src/ORIENT/fix_orient_fcc.h index dd36a89547..5d50a8e300 100644 --- a/src/ORIENT/fix_orient_fcc.h +++ b/src/ORIENT/fix_orient_fcc.h @@ -70,7 +70,8 @@ class FixOrientFCC : public Fix { bool use_xismooth; static constexpr int half_fcc_nn = 6; - double Rxi[half_fcc_nn][3] = {}, Rchi[half_fcc_nn][3] = {}, half_xi_chi_vec[2][half_fcc_nn][3] = {}; + double Rxi[half_fcc_nn][3] = {}, Rchi[half_fcc_nn][3] = {}, + half_xi_chi_vec[2][half_fcc_nn][3] = {}; double xiid, xi0, xi1, xicutoffsq, cutsq, added_energy; int nmax; // expose 2 per-atom quantities @@ -88,28 +89,3 @@ class FixOrientFCC : public Fix { #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: Fix orient/fcc file open failed - -The fix orient/fcc command could not open a specified file. - -E: Fix orient/fcc file read failed - -The fix orient/fcc command could not read the needed parameters from a -specified file. - -E: Fix orient/fcc found self twice - -The neighbor lists used by fix orient/fcc are messed up. If this -error occurs, it is likely a bug, so send an email to the -"developers"_https://www.lammps.org/authors.html. - -*/ diff --git a/src/PERI/atom_vec_peri.cpp b/src/PERI/atom_vec_peri.cpp index a0483efb4d..fd6b47990a 100644 --- a/src/PERI/atom_vec_peri.cpp +++ b/src/PERI/atom_vec_peri.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -23,20 +22,19 @@ #include "error.h" #include -#include using namespace LAMMPS_NS; static const char cite_peri_package[] = - "PERI package for Peridynamics:\n\n" - "@Article{Parks08,\n" - " author = {M. L. Parks, R. B. Lehoucq, S. J. Plimpton, S. A. Silling},\n" - " title = {Implementing peridynamics within a molecular dynamics code},\n" - " journal = {Comp.~Phys.~Comm.},\n" - " year = 2008,\n" - " volume = 179,\n" - " pages = {777--783}\n" - "}\n\n"; + "PERI package for Peridynamics:\n\n" + "@Article{Parks08,\n" + " author = {M. L. Parks, R. B. Lehoucq, S. J. Plimpton, S. A. Silling},\n" + " title = {Implementing peridynamics within a molecular dynamics code},\n" + " journal = {Comp.~Phys.~Comm.},\n" + " year = 2008,\n" + " volume = 179,\n" + " pages = {777--783}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -55,18 +53,17 @@ AtomVecPeri::AtomVecPeri(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "rmass vfrac s0 x0"; - fields_copy = (char *) "rmass vfrac s0 x0"; - fields_comm = (char *) "s0"; - fields_comm_vel = (char *) "s0"; - fields_reverse = (char *) ""; - fields_border = (char *) "rmass vfrac s0 x0"; - fields_border_vel = (char *) "rmass vfrac s0 x0"; - fields_exchange = (char *) "rmass vfrac s0 x0"; - fields_restart = (char *) "rmass vfrac s0 x0"; - fields_create = (char *) "rmass vfrac s0 x0"; - fields_data_atom = (char *) "id type vfrac rmass x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"rmass", "vfrac", "s0", "x0"}; + fields_copy = {"rmass", "vfrac", "s0", "x0"}; + fields_comm = {"s0"}; + fields_comm_vel = {"s0"}; + fields_border = {"rmass", "vfrac", "s0", "x0"}; + fields_border_vel = {"rmass", "vfrac", "s0", "x0"}; + fields_exchange = {"rmass", "vfrac", "s0", "x0"}; + fields_restart = {"rmass", "vfrac", "s0", "x0"}; + fields_create = {"rmass", "vfrac", "s0", "x0"}; + fields_data_atom = {"id", "type", "vfrac", "rmass", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -110,8 +107,7 @@ void AtomVecPeri::data_atom_post(int ilocal) x0[ilocal][1] = x[ilocal][1]; x0[ilocal][2] = x[ilocal][2]; - if (rmass[ilocal] <= 0.0) - error->one(FLERR,"Invalid mass in Atoms section of data file"); + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid mass in Atoms section of data file"); } /* ---------------------------------------------------------------------- @@ -119,10 +115,10 @@ void AtomVecPeri::data_atom_post(int ilocal) return -1 if name is unknown to this atom style ------------------------------------------------------------------------- */ -int AtomVecPeri::property_atom(char *name) +int AtomVecPeri::property_atom(const std::string &name) { - if (strcmp(name,"vfrac") == 0) return 0; - if (strcmp(name,"s0") == 0) return 1; + if (name == "vfrac") return 0; + if (name == "s0") return 1; return -1; } @@ -131,8 +127,7 @@ int AtomVecPeri::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecPeri::pack_property_atom(int index, double *buf, - int nvalues, int groupbit) +void AtomVecPeri::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -140,14 +135,18 @@ void AtomVecPeri::pack_property_atom(int index, double *buf, if (index == 0) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = vfrac[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = vfrac[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 1) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = s0[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = s0[i]; + else + buf[n] = 0.0; n += nvalues; } } diff --git a/src/PERI/atom_vec_peri.h b/src/PERI/atom_vec_peri.h index 0d37138b36..8faaf0931e 100644 --- a/src/PERI/atom_vec_peri.h +++ b/src/PERI/atom_vec_peri.h @@ -31,7 +31,7 @@ class AtomVecPeri : public AtomVec { void grow_pointers() override; void create_atom_post(int) override; void data_atom_post(int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; private: @@ -43,7 +43,3 @@ class AtomVecPeri : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/PERI/compute_damage_atom.cpp b/src/PERI/compute_damage_atom.cpp index 80aff909ae..1e08e534c6 100644 --- a/src/PERI/compute_damage_atom.cpp +++ b/src/PERI/compute_damage_atom.cpp @@ -60,7 +60,7 @@ void ComputeDamageAtom::init() auto fixes = modify->get_fix_by_style("PERI_NEIGH"); if (fixes.size() == 0) error->all(FLERR,"Compute damage/atom requires a peridynamic potential"); - else fix_peri_neigh = (FixPeriNeigh *)fixes.front(); + else fix_peri_neigh = dynamic_cast(fixes.front()); } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_damage_atom.h b/src/PERI/compute_damage_atom.h index 3195977101..f51ed30782 100644 --- a/src/PERI/compute_damage_atom.h +++ b/src/PERI/compute_damage_atom.h @@ -42,22 +42,3 @@ class ComputeDamageAtom : public Compute { #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. - -W: More than one compute damage/atom - -It is not efficient to use compute ke/atom more than once. - -E: Compute damage/atom requires peridynamic potential - -Damage is a Peridynamic-specific metric. It requires you -to be running a Peridynamics simulation. - -*/ diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index 7bf2679443..9d44602756 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -83,7 +83,7 @@ void ComputeDilatationAtom::compute_peratom() int tmp; auto anypair = force->pair_match("^peri",0); - double *theta = (double *)anypair->extract("theta",tmp); + auto theta = (double *)anypair->extract("theta",tmp); int *mask = atom->mask; int nlocal = atom->nlocal; diff --git a/src/PERI/compute_dilatation_atom.h b/src/PERI/compute_dilatation_atom.h index b035c79255..50f4404b06 100644 --- a/src/PERI/compute_dilatation_atom.h +++ b/src/PERI/compute_dilatation_atom.h @@ -41,25 +41,3 @@ class ComputeDilatationAtom : public Compute { #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. - -W: More than one compute dilatation/atom - -Self-explanatory. - -E: Compute dilatation/atom cannot be used with this pair style - -Self-explanatory. - -E: Compute dilatation/atom requires Peridynamic pair style - -Self-explanatory. - -*/ diff --git a/src/PERI/compute_plasticity_atom.cpp b/src/PERI/compute_plasticity_atom.cpp index e22c8765b4..425f6379e0 100644 --- a/src/PERI/compute_plasticity_atom.cpp +++ b/src/PERI/compute_plasticity_atom.cpp @@ -66,7 +66,7 @@ void ComputePlasticityAtom::init() auto fixes = modify->get_fix_by_style("PERI_NEIGH"); if (fixes.size() == 0) error->all(FLERR,"Compute plasticity/atom requires a peridynamic potential"); - else fix_peri_neigh = (FixPeriNeigh *)fixes.front(); + else fix_peri_neigh = dynamic_cast(fixes.front()); } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_plasticity_atom.h b/src/PERI/compute_plasticity_atom.h index ba0e04a48c..53abe86332 100644 --- a/src/PERI/compute_plasticity_atom.h +++ b/src/PERI/compute_plasticity_atom.h @@ -42,25 +42,3 @@ class ComputePlasticityAtom : public Compute { #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 plasticity/atom cannot be used with this pair style - -Self-explanatory. - -W: More than one compute plasticity/atom - -Self-explanatory. - -E: Compute plasticity/atom requires Peridynamic pair style - -Self-explanatory. - -*/ diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 1d1c0d1c5e..51b8adf741 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -561,7 +561,7 @@ void FixPeriNeigh::write_restart(FILE *fp) void FixPeriNeigh::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; first = static_cast (list[n++]); maxpartner = static_cast (list[n++]); diff --git a/src/PERI/fix_peri_neigh.h b/src/PERI/fix_peri_neigh.h index 1ead6a0f97..348e6393cb 100644 --- a/src/PERI/fix_peri_neigh.h +++ b/src/PERI/fix_peri_neigh.h @@ -81,12 +81,3 @@ class FixPeriNeigh : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Duplicate particle in PeriDynamic bond - simulation box is too small - -This is likely because your box length is shorter than 2 times -the bond length. - -*/ diff --git a/src/PERI/pair_peri.cpp b/src/PERI/pair_peri.cpp index 4ed281489b..f80de4c7b5 100644 --- a/src/PERI/pair_peri.cpp +++ b/src/PERI/pair_peri.cpp @@ -104,9 +104,9 @@ double PairPeri::memory_usage() global settings ------------------------------------------------------------------------- */ -void PairPeri::settings(int narg, char **/*arg*/) +void PairPeri::settings(int narg, char ** /*arg*/) { - if (narg) error->all(FLERR,"Illegal pair_style command"); + if (narg) error->all(FLERR, "Illegal pair_style command"); } /* ---------------------------------------------------------------------- @@ -130,7 +130,7 @@ void PairPeri::init_style() // if first init, create Fix needed for storing fixed neighbors if (!fix_peri_neigh) - fix_peri_neigh = (FixPeriNeigh *) modify->add_fix("PERI_NEIGH all PERI_NEIGH"); + fix_peri_neigh = dynamic_cast(modify->add_fix("PERI_NEIGH all PERI_NEIGH")); neighbor->add_request(this); } diff --git a/src/PERI/pair_peri_eps.h b/src/PERI/pair_peri_eps.h index b135537d97..260d1ceb97 100644 --- a/src/PERI/pair_peri_eps.h +++ b/src/PERI/pair_peri_eps.h @@ -42,43 +42,3 @@ class PairPeriEPS : public PairPeri { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style peri requires atom style peri - -Self-explanatory. - -E: Pair peri requires an atom map, see atom_modify - -Even for atomic systems, an atom map is required to find Peridynamic -bonds. Use the atom_modify command to define one. - -E: Pair peri requires a lattice be defined - -Use the lattice command for this purpose. - -E: Pair peri lattice is not identical in x, y, and z - -The lattice defined by the lattice command must be cubic. - -E: Fix peri neigh does not exist - -Somehow a fix that the pair style defines has been deleted. - -*/ diff --git a/src/PERI/pair_peri_lps.h b/src/PERI/pair_peri_lps.h index 13afdef06c..29e5f0fbfb 100644 --- a/src/PERI/pair_peri_lps.h +++ b/src/PERI/pair_peri_lps.h @@ -25,7 +25,7 @@ PairStyle(peri/lps,PairPeriLPS); namespace LAMMPS_NS { class PairPeriLPS : public PairPeri { -public: + public: PairPeriLPS(class LAMMPS *); void compute(int, int) override; @@ -41,39 +41,3 @@ public: #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style peri requires atom style peri - -Self-explanatory. - -E: Pair peri requires an atom map, see atom_modify - -Even for atomic systems, an atom map is required to find Peridynamic -bonds. Use the atom_modify command to define one. - -E: Pair peri lattice is not identical in x, y, and z - -The lattice defined by the lattice command must be cubic. - -E: Fix peri neigh does not exist - -Somehow a fix that the pair style defines has been deleted. - -*/ diff --git a/src/PERI/pair_peri_pmb.h b/src/PERI/pair_peri_pmb.h index a028c43aa3..f8756c2448 100644 --- a/src/PERI/pair_peri_pmb.h +++ b/src/PERI/pair_peri_pmb.h @@ -44,39 +44,3 @@ class PairPeriPMB : public PairPeri { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style peri requires atom style peri - -Self-explanatory. - -E: Pair peri requires an atom map, see atom_modify - -Even for atomic systems, an atom map is required to find Peridynamic -bonds. Use the atom_modify command to define one. - -E: Pair peri lattice is not identical in x, y, and z - -The lattice defined by the lattice command must be cubic. - -E: Fix peri neigh does not exist - -Somehow a fix that the pair style defines has been deleted. - -*/ diff --git a/src/PERI/pair_peri_ves.h b/src/PERI/pair_peri_ves.h index 330ee7ef02..9210dcfdb5 100644 --- a/src/PERI/pair_peri_ves.h +++ b/src/PERI/pair_peri_ves.h @@ -41,43 +41,3 @@ class PairPeriVES : public PairPeri { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Pair style peri requires atom style peri - -Self-explanatory. - -E: Pair peri requires an atom map, see atom_modify - -Even for atomic systems, an atom map is required to find Peridynamic -bonds. Use the atom_modify command to define one. - -E: Pair peri requires a lattice be defined - -Use the lattice command for this purpose. - -E: Pair peri lattice is not identical in x, y, and z - -The lattice defined by the lattice command must be cubic. - -E: Fix peri neigh does not exist - -Somehow a fix that the pair style defines has been deleted. - -*/ diff --git a/src/PHONON/dynamical_matrix.cpp b/src/PHONON/dynamical_matrix.cpp index 57b82fbe64..8f667f51f2 100644 --- a/src/PHONON/dynamical_matrix.cpp +++ b/src/PHONON/dynamical_matrix.cpp @@ -269,11 +269,11 @@ void DynamicalMatrix::calculateMatrix() double *m = atom->mass; double **f = atom->f; - double **dynmat = new double*[3]; + auto dynmat = new double*[3]; for (int i=0; i<3; i++) dynmat[i] = new double[dynlenb]; - double **fdynmat = new double*[3]; + auto fdynmat = new double*[3]; for (int i=0; i<3; i++) fdynmat[i] = new double[dynlenb]; @@ -427,12 +427,11 @@ void DynamicalMatrix::displace_atom(int local_idx, int direction, int magnitude) void DynamicalMatrix::update_force() { neighbor->ago = 0; - if ((modify->get_fix_by_id("package_intel")) ? true : false) - neighbor->decide(); + if (modify->get_fix_by_id("package_intel")) neighbor->decide(); force_clear(); int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; if (n_pre_force) { modify->pre_force(vflag); @@ -575,7 +574,7 @@ void DynamicalMatrix::create_groupmap() bigint natoms = atom->natoms; int *recv = new int[comm->nprocs]; int *displs = new int[comm->nprocs]; - bigint *temp_groupmap = new bigint[natoms]; + auto temp_groupmap = new bigint[natoms]; //find number of local atoms in the group (final_gid) for (bigint i=1; i<=natoms; i++) { @@ -584,7 +583,7 @@ void DynamicalMatrix::create_groupmap() gid += 1; // gid at the end of loop is final_Gid } //create an array of length final_gid - bigint *sub_groupmap = new bigint[gid]; + auto sub_groupmap = new bigint[gid]; gid = 0; //create a map between global atom id and group atom id for each proc diff --git a/src/PHONON/dynamical_matrix.h b/src/PHONON/dynamical_matrix.h index 4a08420381..55448b6934 100644 --- a/src/PHONON/dynamical_matrix.h +++ b/src/PHONON/dynamical_matrix.h @@ -52,9 +52,9 @@ class DynamicalMatrix : public Command { double conv_mass; double del; int igroup, groupbit; - bigint gcount; // number of atoms in group - bigint dynlen; // rank of dynamical matrix - bigint dynlenb; // new dynlen if folded + bigint gcount; // number of atoms in group + bigint dynlen; // rank of dynamical matrix + bigint dynlenb; // new dynlen if folded int scaleflag; int me; bigint *groupmap; diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp index b85337e5db..37361be26a 100644 --- a/src/PHONON/fix_phonon.cpp +++ b/src/PHONON/fix_phonon.cpp @@ -671,7 +671,7 @@ void FixPhonon::postprocess( ) // to get Phi = KT.G^-1; normalization of FFTW data is done here double boltz = force->boltz, TempAve = 0.; - double *kbtsqrt = new double[sysdim]; + auto kbtsqrt = new double[sysdim]; double TempFac = inv_neval * inv_nTemp; double NormFac = TempFac * double(ntotal); @@ -695,7 +695,7 @@ void FixPhonon::postprocess( ) MPI_Gatherv(Phi_q[0],mynq*fft_dim2*2,MPI_DOUBLE,Phi_all[0],recvcnts,displs,MPI_DOUBLE,0,world); // to collect all basis info and averaged it on root - double *basis_root = new double[fft_dim]; + auto basis_root = new double[fft_dim]; if (fft_dim > sysdim) MPI_Reduce(&basis[1][0], &basis_root[sysdim], fft_dim-sysdim, MPI_DOUBLE, MPI_SUM, 0, world); if (me == 0) { // output dynamic matrix by root diff --git a/src/PHONON/fix_phonon.h b/src/PHONON/fix_phonon.h index d61a9d2e03..db878a787a 100644 --- a/src/PHONON/fix_phonon.h +++ b/src/PHONON/fix_phonon.h @@ -122,72 +122,3 @@ class FixPhonon : public Fix { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix phonon 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: No atom found for fix phonon! - -Self-explanatory. Number of atoms in the group that was passed to -fix-phonon is less than 1. - -E: Can not open output file %s" - -Self-explanatory. - -E: Illegal fix_modify command - -Self-explanatory. - -E: Could not find fix_modify temp ID - -Self-explanatory. - -E: Fix_modify temp ID does not compute temperature - -Self-explanatory. - -E: Cannot open input map file %s - -Self-explanatory. - -E: Error while reading header of mapping file! - -Self-explanatory. The first line of the map file is expected to -contain 4 positive integer numbers. - -E: FFT mesh and number of atoms in group mismatch! - -Self-explanatory. The product of the 4 numbers should be exactly the -total number of atoms in the group that was passed to fix-phonon. - -E: Error while reading comment of mapping file! - -Self-explanatory. The second line of the map file should be a comment line. - -E: The mapping is incomplete! - -Self-explanatory. - -E: Error while reading mapping file! - -Self-explanatory. - -E: The mapping info read is incorrect! - -Self-explanatory. - -E: Singular matrix in complex GaussJordan! - -Self-explanatory. - -W: More than one fix phonon defined - -Self-explanatory. Just to warn that more than one fix-phonon is defined, but allowed. - -*/ diff --git a/src/PHONON/third_order.cpp b/src/PHONON/third_order.cpp index 3bcff07ea7..bbd6818b95 100644 --- a/src/PHONON/third_order.cpp +++ b/src/PHONON/third_order.cpp @@ -164,8 +164,8 @@ void ThirdOrder::command(int narg, char **arg) folded = 0; // set Neigborlist attributes to NULL - ijnum = NULL; - neighbortags = NULL; + ijnum = nullptr; + neighbortags = nullptr; // read options from end of input line if (style == REGULAR) options(narg-3,&arg[3]); @@ -287,8 +287,8 @@ void ThirdOrder::calculateMatrix() bigint j; bigint *firstneigh; - double *dynmat = new double[dynlenb]; - double *fdynmat = new double[dynlenb]; + auto dynmat = new double[dynlenb]; + auto fdynmat = new double[dynlenb]; memset(&dynmat[0],0,dynlenb*sizeof(double)); memset(&fdynmat[0],0,dynlenb*sizeof(double)); @@ -485,10 +485,9 @@ void ThirdOrder::displace_atom(int local_idx, int direction, int magnitude) void ThirdOrder::update_force() { neighbor->ago = 0; - if ((modify->get_fix_by_id("package_intel")) ? true : false) - neighbor->decide(); + if (modify->get_fix_by_id("package_intel")) neighbor->decide(); force_clear(); - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; @@ -620,7 +619,7 @@ void ThirdOrder::create_groupmap() bigint natoms = atom->natoms; int *recv = new int[comm->nprocs]; int *displs = new int[comm->nprocs]; - bigint *temp_groupmap = new bigint[natoms]; + auto temp_groupmap = new bigint[natoms]; //find number of local atoms in the group (final_gid) for (bigint i=1; i<=natoms; i++) { @@ -629,7 +628,7 @@ void ThirdOrder::create_groupmap() gid += 1; // gid at the end of loop is final_Gid } //create an array of length final_gid - bigint *sub_groupmap = new bigint[gid]; + auto sub_groupmap = new bigint[gid]; gid = 0; //create a map between global atom id and group atom id for each proc @@ -717,8 +716,8 @@ void ThirdOrder::getNeighbortags() { } bigint nbytes = ((bigint) sizeof(bigint)) * sum; - bigint *data = (bigint *) memory->smalloc(nbytes, "thirdorder:firsttags"); - bigint *datarecv = (bigint *) memory->smalloc(nbytes, "thirdorder:neighbortags"); + auto data = (bigint *) memory->smalloc(nbytes, "thirdorder:firsttags"); + auto datarecv = (bigint *) memory->smalloc(nbytes, "thirdorder:neighbortags"); nbytes = ((bigint) sizeof(bigint *)) * natoms; firsttags = (bigint **) memory->smalloc(nbytes, "thirdorder:firsttags"); neighbortags = (bigint **) memory->smalloc(nbytes, "thirdorder:neighbortags"); diff --git a/src/PHONON/third_order.h b/src/PHONON/third_order.h index e3d2cdc16e..8b706c78c8 100644 --- a/src/PHONON/third_order.h +++ b/src/PHONON/third_order.h @@ -23,9 +23,8 @@ class ThirdOrder : public Command { void setup(); protected: - int eflag,vflag; // flags for energy/virial computation - int external_force_clear; // clear forces locally or externally - + int eflag, vflag; // flags for energy/virial computation + int external_force_clear; // clear forces locally or externally int triclinic; // 0 if domain is orthog, 1 if triclinic int pairflag; @@ -37,8 +36,7 @@ class ThirdOrder : public Command { virtual void update_force(); virtual void force_clear(); - virtual void openfile(const char* filename); - + virtual void openfile(const char *filename); protected: void options(int, char **); @@ -54,7 +52,7 @@ class ThirdOrder : public Command { double conv_distance; double conv_mass; double del; - int igroup,groupbit; + int igroup, groupbit; bigint dynlen; bigint dynlenb; int scaleflag; diff --git a/src/PLUGIN/plugin.cpp b/src/PLUGIN/plugin.cpp index d651a16760..6b11ac269f 100644 --- a/src/PLUGIN/plugin.cpp +++ b/src/PLUGIN/plugin.cpp @@ -135,7 +135,7 @@ int plugin_load(const char *file, LAMMPS *lmp) void plugin_register(lammpsplugin_t *plugin, void *ptr) { #if defined(LMP_PLUGIN) - LAMMPS *lmp = (LAMMPS *) ptr; + auto lmp = (LAMMPS *) ptr; int me = lmp->comm->me; if (plugin == nullptr) return; @@ -388,8 +388,7 @@ void plugin_unload(const char *style, const char *name, LAMMPS *lmp) auto found = region_map->find(name); if (found != region_map->end()) region_map->erase(name); - for (auto iregion : lmp->domain->get_region_by_style(name)) - lmp->domain->delete_region(iregion->id); + for (auto iregion : lmp->domain->get_region_by_style(name)) lmp->domain->delete_region(iregion); } else if (pstyle == "command") { diff --git a/src/PLUGIN/plugin.h b/src/PLUGIN/plugin.h index 0fd2cd5042..8cfabc9ef2 100644 --- a/src/PLUGIN/plugin.h +++ b/src/PLUGIN/plugin.h @@ -21,7 +21,7 @@ CommandStyle(plugin,Plugin); #define LMP_PLUGIN_H #include "command.h" -#include "lammpsplugin.h" // IWYU pragma: export +#include "lammpsplugin.h" // IWYU pragma: export namespace LAMMPS_NS { diff --git a/src/PLUMED/fix_plumed.cpp b/src/PLUMED/fix_plumed.cpp index dcf82a4374..85bf2df3bc 100644 --- a/src/PLUMED/fix_plumed.cpp +++ b/src/PLUMED/fix_plumed.cpp @@ -321,9 +321,9 @@ void FixPlumed::post_force(int /* vflag */) if (nlocal != atom->nlocal) { - if (charges) delete [] charges; - if (masses) delete [] masses; - if (gatindex) delete [] gatindex; + delete[] charges; + delete[] masses; + delete[] gatindex; nlocal=atom->nlocal; gatindex=new int [nlocal]; diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 7ac3570f2f..20e0b7cc6b 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -357,8 +357,8 @@ void FixPOEMS::init() if (utils::strmatch(ifix->style, "^poems")) pflag = true; if (pflag && (ifix->setmask() & POST_FORCE) && !ifix->rigid_flag) if (comm->me == 0) - error->warning(FLERR,"Fix {} with ID {} alters forces after fix poems", - ifix->style, ifix->id); + error->warning(FLERR, "Fix {} with ID {} alters forces after fix poems", ifix->style, + ifix->id); } } diff --git a/src/POEMS/fix_poems.h b/src/POEMS/fix_poems.h index cb12a46fb0..c57832a7f3 100644 --- a/src/POEMS/fix_poems.h +++ b/src/POEMS/fix_poems.h @@ -113,85 +113,3 @@ class FixPOEMS : public Fix { #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: Could not find fix poems group ID - -A group ID used in the fix poems command does not exist. - -E: Must use a molecular atom style with fix poems molecule - -Self-explanatory. - -E: Too many molecules for fix poems - -The limit is 2^31 = ~2 billion molecules. - -E: No rigid bodies defined - -The fix specification did not end up defining any rigid bodies. - -E: Atom in too many rigid bodies - boost MAXBODY - -Fix poems has a parameter MAXBODY (in fix_poems.cpp) which determines -the maximum number of rigid bodies a single atom can belong to (i.e. a -multibody joint). The bodies you have defined exceed this limit. - -E: One or zero atoms in rigid body - -Any rigid body defined by the fix rigid command must contain 2 or more -atoms. - -W: More than one fix poems - -It is not efficient to use fix poems more than once. - -E: POEMS fix must come before NPT/NPH fix - -NPT/NPH fix must be defined in input script after all poems fixes, -else the fix contribution to the pressure virial is incorrect. - -E: Insufficient Jacobi rotations for POEMS body - -Eigensolve for rigid body was not sufficiently accurate. - -E: Rigid body has degenerate moment of inertia - -Fix poems will only work with bodies (collections of atoms) that have -non-zero principal moments of inertia. This means they must be 3 or -more non-collinear atoms, even with joint atoms removed. - -E: Bad principal moments - -Fix rigid did not compute the principal moments of inertia of a rigid -group of atoms correctly. - -E: Cannot open fix poems file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -W: No joints between rigid bodies, use fix rigid instead - -The bodies defined by fix poems are not connected by joints. POEMS -will integrate the body motion, but it would be more efficient to use -fix rigid. - -E: Cyclic loop in joint connections - -Fix poems cannot (yet) work with coupled bodies whose joints connect -the bodies in a ring (or cycle). - -E: Tree structure in joint connections - -Fix poems cannot (yet) work with coupled bodies whose joints connect -the bodies in a tree structure. - -*/ diff --git a/src/PTM/compute_ptm_atom.cpp b/src/PTM/compute_ptm_atom.cpp index e024d45012..10341d3cd0 100644 --- a/src/PTM/compute_ptm_atom.cpp +++ b/src/PTM/compute_ptm_atom.cpp @@ -126,7 +126,7 @@ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg) if (rmsd_threshold == 0) rmsd_threshold = INFINITY; - char* group_name = (char *)"all"; + auto group_name = (char *)"all"; if (narg > 5) { group_name = arg[5]; } @@ -192,7 +192,7 @@ static bool sorthelper_compare(ptmnbr_t const &a, ptmnbr_t const &b) { static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, int num, size_t* nbr_indices, int32_t* numbers, double (*nbr_pos)[3]) { - ptmnbrdata_t* data = (ptmnbrdata_t*)vdata; + auto data = (ptmnbrdata_t*)vdata; int *mask = data->mask; int group2bit = data->group2bit; diff --git a/src/PTM/ptm_neighbour_ordering.cpp b/src/PTM/ptm_neighbour_ordering.cpp index cae938a7bb..bc95c33cb0 100644 --- a/src/PTM/ptm_neighbour_ordering.cpp +++ b/src/PTM/ptm_neighbour_ordering.cpp @@ -179,7 +179,7 @@ static int _calculate_neighbour_ordering(void* _voronoi_handle, int num_points, { assert(num_points <= PTM_MAX_INPUT_POINTS); - ptm_voro::voronoicell_neighbor* voronoi_handle = (ptm_voro::voronoicell_neighbor*)_voronoi_handle; + auto voronoi_handle = (ptm_voro::voronoicell_neighbor*)_voronoi_handle; double max_norm = 0; double points[PTM_MAX_INPUT_POINTS][3]; @@ -277,13 +277,13 @@ static int find_diamond_neighbours(void* _voronoi_handle, int num_points, double void* voronoi_initialize_local() { - ptm_voro::voronoicell_neighbor* ptr = new ptm_voro::voronoicell_neighbor; + auto ptr = new ptm_voro::voronoicell_neighbor; return (void*)ptr; } void voronoi_uninitialize_local(void* _ptr) { - ptm_voro::voronoicell_neighbor* ptr = (ptm_voro::voronoicell_neighbor*)_ptr; + auto ptr = (ptm_voro::voronoicell_neighbor*)_ptr; delete ptr; } diff --git a/src/PYTHON/fix_python_invoke.h b/src/PYTHON/fix_python_invoke.h index 3396fe05d8..0a50f6859d 100644 --- a/src/PYTHON/fix_python_invoke.h +++ b/src/PYTHON/fix_python_invoke.h @@ -43,25 +43,3 @@ class FixPythonInvoke : public Fix { #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: Unsupported callback name for fix python/invoke - -UNDOCUMENTED - -E: Could not initialize embedded Python - -UNDOCUMENTED - -E: Could not find Python function - -UNDOCUMENTED - -*/ diff --git a/src/PYTHON/fix_python_move.h b/src/PYTHON/fix_python_move.h index d861e98801..d975dc79c5 100644 --- a/src/PYTHON/fix_python_move.h +++ b/src/PYTHON/fix_python_move.h @@ -55,53 +55,3 @@ class FixPythonMove : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Fix python/integrate requires fully qualified class name - -UNDOCUMENTED - -E: Loading python integrator module failure - -UNDOCUMENTED - -E: Could not find integrator class in module' - -UNDOCUMENTED - -E: Could not instantiate instance of integrator class' - -UNDOCUMENTED - -E: Could not find 'init' method' - -UNDOCUMENTED - -E: Could not find 'initial_integrate' method' - -UNDOCUMENTED - -E: Could not find 'final_integrate' method' - -UNDOCUMENTED - -E: Could not find 'initial_integrate_respa' method' - -UNDOCUMENTED - -E: Could not find 'final_integrate_respa' method' - -UNDOCUMENTED - -E: Could not find 'reset_dt' method' - -UNDOCUMENTED - -U: 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. - -*/ diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 43b6f9ea6c..9bf7066a0d 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -106,7 +106,7 @@ void PairPython::compute(int eflag, int vflag) // prepare access to compute_force and compute_energy functions PyUtils::GIL lock; - PyObject *py_pair_instance = (PyObject *) py_potential; + auto py_pair_instance = (PyObject *) py_potential; PyObject *py_compute_force = PyObject_GetAttrString(py_pair_instance,"compute_force"); if (!py_compute_force) { PyUtils::Print_Errors(); @@ -347,8 +347,8 @@ double PairPython::single(int /* i */, int /* j */, int itype, int jtype, // prepare access to compute_force and compute_energy functions PyUtils::GIL lock; - PyObject *py_compute_force = (PyObject *) get_member_function("compute_force"); - PyObject *py_compute_energy = (PyObject *) get_member_function("compute_energy"); + auto py_compute_force = (PyObject *) get_member_function("compute_force"); + auto py_compute_energy = (PyObject *) get_member_function("compute_energy"); PyObject *py_compute_args = Py_BuildValue("(dii)", rsq, itype, jtype); if (!py_compute_args) { @@ -383,7 +383,7 @@ double PairPython::single(int /* i */, int /* j */, int itype, int jtype, void * PairPython::get_member_function(const char * name) { PyUtils::GIL lock; - PyObject *py_pair_instance = (PyObject *) py_potential; + auto py_pair_instance = (PyObject *) py_potential; PyObject * py_mfunc = PyObject_GetAttrString(py_pair_instance, name); if (!py_mfunc) { PyUtils::Print_Errors(); diff --git a/src/PYTHON/pair_python.h b/src/PYTHON/pair_python.h index d2366620c8..13c732aaf4 100644 --- a/src/PYTHON/pair_python.h +++ b/src/PYTHON/pair_python.h @@ -57,98 +57,3 @@ class PairPython : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Could not find 'compute_force' method' - -UNDOCUMENTED - -E: Python 'compute_force' is not callable - -UNDOCUMENTED - -E: Could not find 'compute_energy' method' - -UNDOCUMENTED - -E: Python 'compute_energy' is not callable - -UNDOCUMENTED - -E: Could not create tuple for 'compute' function arguments - -UNDOCUMENTED - -E: Calling 'compute_force' function failed - -UNDOCUMENTED - -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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Python pair style requires fully qualified class name - -UNDOCUMENTED - -E: Loading python pair style module failure - -UNDOCUMENTED - -E: Could not find pair style class in module' - -UNDOCUMENTED - -E: Could not instantiate instance of pair style class' - -UNDOCUMENTED - -E: Could not find 'check_units' method' - -UNDOCUMENTED - -E: Python 'check_units' is not callable - -UNDOCUMENTED - -E: Could not create tuple for 'check_units' function arguments - -UNDOCUMENTED - -E: Calling 'check_units' function failed - -UNDOCUMENTED - -E: Could not find 'map_coeff' method' - -UNDOCUMENTED - -E: Python 'map_coeff' is not callable - -UNDOCUMENTED - -E: Could not create tuple for 'map_coeff' function arguments - -UNDOCUMENTED - -E: Calling 'map_coeff' function failed - -UNDOCUMENTED - -E: Calling 'compute_energy' function failed - -UNDOCUMENTED - -U: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index bc593d5b8a..5a7098814b 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -238,7 +238,7 @@ void PythonImpl::command(int narg, char **arg) // pFunc = function object for requested function - PyObject *pModule = (PyObject *) pyMain; + auto pModule = (PyObject *) pyMain; PyObject *pFunc = PyObject_GetAttrString(pModule, pfuncs[ifunc].name); if (!pFunc) { @@ -268,7 +268,7 @@ void PythonImpl::invoke_function(int ifunc, char *result) PyObject *pValue; char *str; - PyObject *pFunc = (PyObject *) pfuncs[ifunc].pFunc; + auto pFunc = (PyObject *) pfuncs[ifunc].pFunc; // create Python tuple of input arguments diff --git a/src/PYTHON/python_impl.h b/src/PYTHON/python_impl.h index 90726023c0..37f084156e 100644 --- a/src/PYTHON/python_impl.h +++ b/src/PYTHON/python_impl.h @@ -61,83 +61,3 @@ class PythonImpl : protected Pointers, public PythonInterface { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Could not initialize embedded Python - -The main module in Python was not accessible. - -E: Invalid python 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: Python invoke of undefined function - -Cannot invoke a function that has not been previously defined. - -E: Python variable does not match Python function - -This matching is defined by the python-style variable and the python -command. - -E: Could not process Python source command - -UNDOCUMENTED - -E: Could not open Python file - -The specified file of Python code cannot be opened. Check that the -path and name are correct. - -E: Could not process Python file - -The Python code in the specified file was not run successfully by -Python, probably due to errors in the Python code. - -E: Could not process Python string - -The Python code in the here string was not run successfully by Python, -probably due to errors in the Python code. - -E: Could not find Python function - -The provided Python code was run successfully, but it not -define a callable function with the required name. - -E: Python function is not callable - -The provided Python code was run successfully, but it not -define a callable function with the required name. - -E: Could not create Python function arguments - -This is an internal Python error, possibly because the number -of inputs to the function is too large. - -E: Could not evaluate Python function input variable - -Self-explanatory. - -E: Unsupported variable type - -UNDOCUMENTED - -E: Python function evaluation failed - -The Python function did not run successfully and/or did not return a -value (if it is supposed to return a value). This is probably due to -some error condition in the function. - -E: Python command length keyword cannot be used unless output is a string - -UNDOCUMENTED - -U: Cannot embed Python when also extending Python with LAMMPS - -When running LAMMPS via Python through the LAMMPS library interface -you cannot also user the input script python command. - -*/ diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 20b7b90eee..b586ecb9d9 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -308,7 +308,7 @@ void FixQEq::init() error->warning(FLERR,"Fix efield is ignored during charge equilibration"); if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; // compute net charge and print warning if too large diff --git a/src/QEQ/fix_qeq.h b/src/QEQ/fix_qeq.h index cf1d40ae13..d381a61ba8 100644 --- a/src/QEQ/fix_qeq.h +++ b/src/QEQ/fix_qeq.h @@ -132,30 +132,3 @@ class FixQEq : public Fix { } // namespace LAMMPS_NS #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: QEQ with 'newton pair off' not supported - -See the newton command. This is a restriction to use the QEQ fixes. - -W: Fix qeq CG convergence failed (%g) after %d iterations at %ld step - -Self-explanatory. - -E: Cannot open fix qeq parameter file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Invalid fix qeq parameter file - -Element index > number of atom types. - -*/ diff --git a/src/QEQ/fix_qeq_dynamic.h b/src/QEQ/fix_qeq_dynamic.h index 3a28d10af3..771a4365c9 100644 --- a/src/QEQ/fix_qeq_dynamic.h +++ b/src/QEQ/fix_qeq_dynamic.h @@ -44,29 +44,3 @@ class FixQEqDynamic : public FixQEq { #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: Fix qeq/dynamic requires atom attribute q - -Self-explanatory. - -E: Fix qeq/dynamic group has no atoms - -Self-explanatory. - -W: Fix qeq/dynamic tolerance may be too small for damped dynamics - -Self-explanatory. - -W: Charges did not converge at step %ld: %lg - -Self-explanatory. - -*/ diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 219106b702..d4dc68ace2 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -81,8 +81,8 @@ void FixQEqFire::init() if (comm->me == 0) error->warning(FLERR,"Fix qeq/fire tolerance may be too small for damped fires"); - comb3 = (PairComb3 *) force->pair_match("^comb3",0); - if (!comb3) comb = (PairComb *) force->pair_match("^comb",0); + comb3 = dynamic_cast( force->pair_match("^comb3",0)); + if (!comb3) comb = dynamic_cast( force->pair_match("^comb",0)); } /* ---------------------------------------------------------------------- */ diff --git a/src/QEQ/fix_qeq_fire.h b/src/QEQ/fix_qeq_fire.h index f331100c15..0af318bfa8 100644 --- a/src/QEQ/fix_qeq_fire.h +++ b/src/QEQ/fix_qeq_fire.h @@ -47,29 +47,3 @@ class FixQEqFire : public FixQEq { #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: Fix qeq/fire requires atom attribute q - -Self-explanatory. - -E: Fix qeq/fire group has no atoms - -Self-explanatory. - -W: Fix qeq/fire tolerance may be too small for damped fires - -Self-explanatory. - -W: Charges did not converge at step %ld: %lg - -Self-explanatory. - -*/ diff --git a/src/QEQ/fix_qeq_point.h b/src/QEQ/fix_qeq_point.h index 2576c6c164..849ecbf7ca 100644 --- a/src/QEQ/fix_qeq_point.h +++ b/src/QEQ/fix_qeq_point.h @@ -38,25 +38,3 @@ class FixQEqPoint : public FixQEq { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Fix qeq/point requires atom attribute q - -Self-explanatory. - -E: Fix qeq/point group has no atoms - -Self-explanatory. - -W: H matrix size has been exceeded: m_fill=%d H.m=%d\n - -This is the size of the matrix. - -E: Fix qeq/point has insufficient QEq matrix size - -Occurs when number of neighbor atoms for an atom increased too much -during a run. Increase SAFE_ZONE and MIN_CAP in fix_qeq.h and -recompile. - -*/ diff --git a/src/QEQ/fix_qeq_shielded.h b/src/QEQ/fix_qeq_shielded.h index 5a676370e1..a29ca0041e 100644 --- a/src/QEQ/fix_qeq_shielded.h +++ b/src/QEQ/fix_qeq_shielded.h @@ -41,41 +41,3 @@ class FixQEqShielded : public FixQEq { } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Fix qeq/shielded requires atom attribute q - -Self-explanatory. - -E: Fix qeq/shielded group has no atoms - -Self-explanatory. - -E: Invalid param file for fix qeq/shielded - -Invalid value of gamma. - -W: Fix qeq has non-zero lower Taper radius cutoff - -Absolute value must be <= 0.01. - -E: Fix qeq has negative upper Taper radius cutoff - -Self-explanatory. - -W: Fix qeq has very low Taper radius cutoff - -Value should typically be >= 5.0. - -W: H matrix size has been exceeded: m_fill=%d H.m=%d\n - -This is the size of the matrix. - -E: Fix qeq/shielded has insufficient QEq matrix size - -Occurs when number of neighbor atoms for an atom increased too much -during a run. Increase SAFE_ZONE and MIN_CAP in fix_qeq.h and -recompile. - -*/ diff --git a/src/QEQ/fix_qeq_slater.h b/src/QEQ/fix_qeq_slater.h index 6dd9f10e41..a1898e30e7 100644 --- a/src/QEQ/fix_qeq_slater.h +++ b/src/QEQ/fix_qeq_slater.h @@ -44,43 +44,3 @@ class FixQEqSlater : public FixQEq { } // namespace LAMMPS_NS #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: Fix qeq/slater requires atom attribute q - -Self-explanatory. - -E: Fix qeq/slater group has no atoms - -Self-explanatory. - -E: Invalid param file for fix qeq/slater - -Zeta value is 0.0. - -E: No pair coul/streitz for fix qeq/slater - -These commands must be used together. - -E: Fix qeq/slater could not extract params from pair coul/streitz - -This should not happen unless pair coul/streitz has been altered. - -W: H matrix size has been exceeded: m_fill=%d H.m=%d\n - -This is the size of the matrix. - -E: Fix qeq/slater has insufficient QEq matrix size - -Occurs when number of neighbor atoms for an atom increased too much -during a run. Increase SAFE_ZONE and MIN_CAP in fix_qeq.h and -recompile. - -*/ diff --git a/src/QMMM/fix_qmmm.cpp b/src/QMMM/fix_qmmm.cpp index d0cfe2ed95..df1a45ebcb 100644 --- a/src/QMMM/fix_qmmm.cpp +++ b/src/QMMM/fix_qmmm.cpp @@ -781,7 +781,7 @@ void FixQMMM::setup(int) /* ---------------------------------------------------------------------- */ -void FixQMMM::post_force(int vflag) +void FixQMMM::post_force(int /*vflag*/) { exchange_forces(); } diff --git a/src/QTB/fix_qbmsst.cpp b/src/QTB/fix_qbmsst.cpp index 88588f6c01..8ce7b616b1 100644 --- a/src/QTB/fix_qbmsst.cpp +++ b/src/QTB/fix_qbmsst.cpp @@ -846,7 +846,7 @@ void FixQBMSST::write_restart(FILE *fp) void FixQBMSST::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; omega[direction] = list[n++]; e0 = list[n++]; v0 = list[n++]; diff --git a/src/QTB/fix_qtb.cpp b/src/QTB/fix_qtb.cpp index ab82759e79..f9faf2475c 100644 --- a/src/QTB/fix_qtb.cpp +++ b/src/QTB/fix_qtb.cpp @@ -218,7 +218,7 @@ void FixQTB::init() // respa if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- @@ -229,9 +229,9 @@ void FixQTB::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index dd56e96e81..c05ad4f8b3 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -24,6 +24,7 @@ Contributing Author: Jacob Gissinger (jacob.r.gissinger@gmail.com) #include "comm.h" #include "domain.h" #include "error.h" +#include "fix_bond_history.h" #include "force.h" #include "group.h" #include "input.h" @@ -792,7 +793,7 @@ void FixBondReact::init() { if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; // check cutoff for iatomtype,jatomtype for (int i = 0; i < nreacts; i++) { @@ -3093,6 +3094,10 @@ void FixBondReact::update_everything() // next let's update bond info // cool thing is, newton_bond issues are already taken care of in templates // same with class2 improper issues, which is why this fix started in the first place + // also need to find any instances of bond history to update histories + auto histories = modify->get_fix_by_style("BOND_HISTORY"); + int n_histories = histories.size(); + for (int i = 0; i < update_num_mega; i++) { rxnID = update_mega_glove[0][i]; twomol = atom->molecules[reacted_mol[rxnID]]; @@ -3102,6 +3107,14 @@ void FixBondReact::update_everything() if (atom->map(update_mega_glove[jj+1][i]) < nlocal && atom->map(update_mega_glove[jj+1][i]) >= 0) { if (landlocked_atoms[j][rxnID] == 1) { delta_bonds -= num_bond[atom->map(update_mega_glove[jj+1][i])]; + // If deleting all bonds, first cache then remove all histories + if (n_histories > 0) + for (auto &ihistory: histories) { + for (int n = 0; n < num_bond[atom->map(update_mega_glove[jj+1][i])]; n++) + dynamic_cast(ihistory)->cache_history(atom->map(update_mega_glove[jj+1][i]), n); + for (int n = 0; n < num_bond[atom->map(update_mega_glove[jj+1][i])]; n++) + dynamic_cast(ihistory)->delete_history(atom->map(update_mega_glove[jj+1][i]), 0); + } num_bond[atom->map(update_mega_glove[jj+1][i])] = 0; } if (landlocked_atoms[j][rxnID] == 0) { @@ -3109,10 +3122,21 @@ void FixBondReact::update_everything() for (int n = 0; n < twomol->natoms; n++) { int nn = equivalences[n][1][rxnID]-1; if (n!=j && bond_atom[atom->map(update_mega_glove[jj+1][i])][p] == update_mega_glove[nn+1][i] && landlocked_atoms[n][rxnID] == 1) { + // Cache history information, shift history, then delete final element + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->cache_history(atom->map(update_mega_glove[jj+1][i]), p); for (int m = p; m < num_bond[atom->map(update_mega_glove[jj+1][i])]-1; m++) { bond_type[atom->map(update_mega_glove[jj+1][i])][m] = bond_type[atom->map(update_mega_glove[jj+1][i])][m+1]; bond_atom[atom->map(update_mega_glove[jj+1][i])][m] = bond_atom[atom->map(update_mega_glove[jj+1][i])][m+1]; + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->shift_history(atom->map(update_mega_glove[jj+1][i]),m,m+1); } + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->delete_history(atom->map(update_mega_glove[jj+1][i]), + num_bond[atom->map(update_mega_glove[jj+1][i])]-1); num_bond[atom->map(update_mega_glove[jj+1][i])]--; delta_bonds--; } @@ -3131,6 +3155,10 @@ void FixBondReact::update_everything() for (int p = 0; p < twomol->num_bond[j]; p++) { bond_type[atom->map(update_mega_glove[jj+1][i])][p] = twomol->bond_type[j][p]; bond_atom[atom->map(update_mega_glove[jj+1][i])][p] = update_mega_glove[equivalences[twomol->bond_atom[j][p]-1][1][rxnID]][i]; + // Check cached history data to see if bond regenerated + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->check_cache(atom->map(update_mega_glove[jj+1][i]), p); } } if (landlocked_atoms[j][rxnID] == 0) { @@ -3139,6 +3167,10 @@ void FixBondReact::update_everything() insert_num = num_bond[atom->map(update_mega_glove[jj+1][i])]; bond_type[atom->map(update_mega_glove[jj+1][i])][insert_num] = twomol->bond_type[j][p]; bond_atom[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->bond_atom[j][p]-1][1][rxnID]][i]; + // Check cached history data to see if bond regenerated + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->check_cache(atom->map(update_mega_glove[jj+1][i]), insert_num); num_bond[atom->map(update_mega_glove[jj+1][i])]++; if (num_bond[atom->map(update_mega_glove[jj+1][i])] > atom->bond_per_atom) error->one(FLERR,"Bond/react topology/atom exceed system topology/atom"); @@ -3150,6 +3182,10 @@ void FixBondReact::update_everything() } } + if (n_histories > 0) + for (auto &ihistory: histories) + dynamic_cast(ihistory)->clear_cache(); + // Angles! First let's delete all angle info: if (force->angle && twomol->angleflag) { int *num_angle = atom->num_angle; @@ -3938,7 +3974,7 @@ void FixBondReact::ReadConstraints(char *line, int myrxn) double tmp[MAXCONARGS]; char **strargs,*ptr,*lptr; memory->create(strargs,MAXCONARGS,MAXLINE,"bond/react:strargs"); - char *constraint_type = new char[MAXLINE]; + auto constraint_type = new char[MAXLINE]; strcpy(constraintstr[myrxn],"("); // string for boolean constraint logic for (int i = 0; i < nconstraints[myrxn]; i++) { readline(line); diff --git a/src/REACTION/fix_bond_react.h b/src/REACTION/fix_bond_react.h index 93a6f76f62..503438ced6 100644 --- a/src/REACTION/fix_bond_react.h +++ b/src/REACTION/fix_bond_react.h @@ -149,13 +149,16 @@ class FixBondReact : public Fix { // for all mega_gloves and global_mega_glove: first row is the ID of bond/react tagint **local_mega_glove; // consolidation local of reaction instances tagint **ghostly_mega_glove; // consolidation nonlocal of reaction instances - tagint **global_mega_glove; // consolidation (inter-processor) of gloves containing nonlocal atoms - int *localsendlist; // indicates ghosts of other procs - int local_num_mega; // num of local reaction instances - int ghostly_num_mega; // num of ghostly reaction instances - int global_megasize; // num of reaction instances in global_mega_glove - int *pioneers; // during Superimpose Algorithm, atoms which have been assigned, but whose first neighbors haven't - int glove_counter; // used to determine when to terminate Superimpose Algorithm + tagint **global_mega_glove; // consolidation (inter-processor) of gloves + // containing nonlocal atoms + + int *localsendlist; // indicates ghosts of other procs + int local_num_mega; // num of local reaction instances + int ghostly_num_mega; // num of ghostly reaction instances + int global_megasize; // num of reaction instances in global_mega_glove + int *pioneers; // during Superimpose Algorithm, atoms which have been assigned, + // but whose first neighbors haven't + int glove_counter; // used to determine when to terminate Superimpose Algorithm void read(int); void EdgeIDs(char *, int); @@ -176,10 +179,10 @@ class FixBondReact : public Fix { int check_constraints(); void get_IDcoords(int, int, double *); double get_temperature(tagint **, int, int); - void customvarnames(); // get per-atom variables names used by custom constraint - void get_customvars(); // evaluate local values for variables names used by custom constraint - double custom_constraint(std::string); // evaulate expression for custom constraint - double rxnfunction(std::string, std::string, std::string); // eval rxn_sum and rxn_ave + void customvarnames(); // get per-atom variables names used by custom constraint + void get_customvars(); // evaluate local values for variables names used by custom constraint + double custom_constraint(std::string); // evaulate expression for custom constraint + double rxnfunction(std::string, std::string, std::string); // eval rxn_sum and rxn_ave int get_chirality(double[12]); // get handedness given an ordered set of coordinates void open(char *); @@ -229,98 +232,3 @@ class FixBondReact : public Fix { #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: Bond/react: Cannot use fix bond/react with non-molecular systems - -Only systems with bonds that can be changed can be used. Atom_style -template does not qualify. - -E: Bond/react: Rmax cutoff is longer than pairwise cutoff - -This is not allowed because bond creation is done using the pairwise -neighbor list. - -E: Bond/react: Molecule template ID for fix bond/react does not exist - -A valid molecule template must have been created with the molecule -command. - -E: Bond/react: Reaction templates must contain the same number of atoms - -There should be a one-to-one correspondence between atoms in the -pre-reacted and post-reacted templates, as specified by the map file. - -E: Bond/react: Unknown section in map file - -Please ensure reaction map files are properly formatted. - -E: Bond/react: Invalid template atom ID in map file - -Atom IDs in molecule templates range from 1 to the number of atoms in the template. - -E or W: Bond/react: Atom affected by reaction %s too close to template edge - Bond/react: Atom type affected by reaction %s too close to template edge - Bond/react: Bond type affected by reaction %s too close to template edge - -This means an atom (or bond) that changes type or connectivity during the -reaction is too close to an 'edge' atom defined in the map file. This -could cause incorrect assignment of bonds, angle, etc. Generally, this -means you must include more atoms in your templates, such that there -are at least two atoms between each atom involved in the reaction and -an edge atom. - -E: Bond/react: Fix bond/react needs ghost atoms from farther away - -This is because a processor needs to map the entire unreacted molecule -template onto simulation atoms it knows about. The comm_modify cutoff -command can be used to extend the communication range. - -E: Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted - -Self-explanatory. - -E: Bond/react: First neighbors of chiral atoms must be of mutually different types - -Self-explanatory. - -E: Bond/react: Chiral atoms must have exactly four first neighbors - -Self-explanatory. - -E: Bond/react: Molecule template 'Coords' section required for chiralIDs keyword - -The coordinates of atoms in the pre-reacted template are used to determine chirality. - -E: Bond/react special bond generation overflow - -The number of special bonds per-atom created by a reaction exceeds the -system setting. See the read_data or create_box command for how to -specify this value. - -E: Bond/react topology/atom exceed system topology/atom - -The number of bonds, angles etc per-atom created by a reaction exceeds -the system setting. See the read_data or create_box command for how to -specify this value. - -E: Bond/react: Variable name does not exist - -Self-explanatory. - -E: Bond/react: Variable is not equal-style - -Self-explanatory. - -E: Bond/react: Molecule fragment does not exist - -Self-explanatory. - -*/ diff --git a/src/REAXFF/compute_spec_atom.cpp b/src/REAXFF/compute_spec_atom.cpp index 66886cd1e2..1df4ae559b 100644 --- a/src/REAXFF/compute_spec_atom.cpp +++ b/src/REAXFF/compute_spec_atom.cpp @@ -40,7 +40,7 @@ ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : else size_peratom_cols = nvalues; // get reference to ReaxFF pair style - reaxff = (PairReaxFF *) force->pair_match("^reax..",0); + reaxff = dynamic_cast( force->pair_match("^reax..",0)); pack_choice = new FnPtrPack[nvalues]; diff --git a/src/REAXFF/compute_spec_atom.h b/src/REAXFF/compute_spec_atom.h index 40f184e3ed..de3c0efb22 100644 --- a/src/REAXFF/compute_spec_atom.h +++ b/src/REAXFF/compute_spec_atom.h @@ -82,21 +82,3 @@ class ComputeSpecAtom : public Compute { #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 reaxc/atom for atom reaxc that isn't allocated - -Self-explanatory. - -E: Invalid keyword in compute reaxc/atom command - -Self-explanatory. - -*/ diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index 26b1d00203..bd93dec0b7 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -134,7 +134,7 @@ void FixACKS2ReaxFF::pertype_parameters(char *arg) eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); bcut_acks2 = (double *) pair->extract("bcut_acks2",tmp); - double* bond_softness_ptr = (double *) pair->extract("bond_softness",tmp); + auto bond_softness_ptr = (double *) pair->extract("bond_softness",tmp); if (chi == nullptr || eta == nullptr || gamma == nullptr || bcut_acks2 == nullptr || bond_softness_ptr == nullptr) diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index b6c53aa977..aeeee7b71a 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -141,7 +141,7 @@ FixQEqReaxFF::FixQEqReaxFF(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - reaxff = (PairReaxFF *) force->pair_match("^reax..",0); + reaxff = dynamic_cast( force->pair_match("^reax..",0)); s_hist = t_hist = nullptr; atom->add_callback(Atom::GROW); @@ -395,7 +395,7 @@ void FixQEqReaxFF::init() efield = nullptr; auto fixes = modify->get_fix_by_style("^efield"); - if (fixes.size() == 1) efield = (FixEfield *) fixes.front(); + if (fixes.size() == 1) efield = dynamic_cast( fixes.front()); else if (fixes.size() > 1) error->all(FLERR, "There may be only one fix efield instance used with fix {}", style); @@ -423,7 +423,7 @@ void FixQEqReaxFF::init() init_taper(); if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -1088,7 +1088,7 @@ void FixQEqReaxFF::get_chi_field() memset(&chi_field[0],0,atom->nmax*sizeof(double)); if (!efield) return; - const double * const *x = (const double * const *)atom->x; + const auto x = (const double * const *)atom->x; const int *mask = atom->mask; const imageint *image = atom->image; const int nlocal = atom->nlocal; @@ -1096,11 +1096,8 @@ void FixQEqReaxFF::get_chi_field() // update electric field region if necessary - Region *region = nullptr; - if (efield->iregion >= 0) { - region = domain->regions[efield->iregion]; - region->prematch(); - } + Region *region = efield->region; + if (region) region->prematch(); // efield energy is in real units of kcal/mol/angstrom, need to convert to eV diff --git a/src/REAXFF/fix_reaxff_bonds.cpp b/src/REAXFF/fix_reaxff_bonds.cpp index 80cd8c7c85..4b96cb21a1 100644 --- a/src/REAXFF/fix_reaxff_bonds.cpp +++ b/src/REAXFF/fix_reaxff_bonds.cpp @@ -101,7 +101,7 @@ void FixReaxFFBonds::setup(int /*vflag*/) void FixReaxFFBonds::init() { - reaxff = (PairReaxFF *) force->pair_match("^reax..",0); + reaxff = dynamic_cast( force->pair_match("^reax..",0)); if (reaxff == nullptr) error->all(FLERR,"Cannot use fix reaxff/bonds without " "pair_style reaxff, reaxff/kk, or reaxff/omp"); } @@ -240,10 +240,10 @@ void FixReaxFFBonds::RecvBuffer(double *buf, int nbuf, int nbuf_local, { int i, j, k, itype; int inode, nlocal_tmp, numbonds; - tagint itag,jtag; + tagint itag; int nlocal = atom->nlocal; bigint ntimestep = update->ntimestep; - double sbotmp, nlptmp, avqtmp, abotmp; + double sbotmp, nlptmp, avqtmp; double cutof3 = reaxff->api->control->bg_cut; MPI_Request irequest, irequest2; diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 692758052e..80460147ed 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -232,7 +232,7 @@ FixReaxFFSpecies::~FixReaxFFSpecies() memory->destroy(MolType); memory->destroy(MolName); - if (filepos) delete[] filepos; + delete[] filepos; if (me == 0) { if (compressed) @@ -275,7 +275,7 @@ void FixReaxFFSpecies::init() if (atom->tag_enable == 0) error->all(FLERR, "Cannot use fix reaxff/species unless atoms have IDs"); - reaxff = (PairReaxFF *) force->pair_match("^reax..", 0); + reaxff = dynamic_cast(force->pair_match("^reax..", 0)); if (reaxff == nullptr) error->all(FLERR, "Cannot use fix reaxff/species without " @@ -297,7 +297,7 @@ void FixReaxFFSpecies::init() // create a fix to point to fix_ave_atom for averaging stored properties auto fixcmd = fmt::format("SPECBOND_{} all ave/atom {} {} {}", id, nevery, nrepeat, nfreq); for (int i = 1; i < 32; ++i) fixcmd += fmt::format(" c_SPECATOM_{}[{}]", id, i); - f_SPECBOND = (FixAveAtom *) modify->add_fix(fixcmd); + f_SPECBOND = dynamic_cast(modify->add_fix(fixcmd)); setupflag = 1; } } diff --git a/src/REAXFF/pair_reaxff.cpp b/src/REAXFF/pair_reaxff.cpp index 94646fd8a7..e78edea9a9 100644 --- a/src/REAXFF/pair_reaxff.cpp +++ b/src/REAXFF/pair_reaxff.cpp @@ -351,7 +351,7 @@ void PairReaxFF::init_style() api->system->acks2_flag = acks2_fixes.size(); if (api->system->acks2_flag) - api->workspace->s = ((FixACKS2ReaxFF *)acks2_fixes.front())->get_s(); + api->workspace->s = (dynamic_cast(acks2_fixes.front()))->get_s(); api->system->n = atom->nlocal; // my atoms api->system->N = atom->nlocal + atom->nghost; // mine + ghosts @@ -373,7 +373,7 @@ void PairReaxFF::init_style() "increased neighbor list skin."); if (fix_reaxff == nullptr) - fix_reaxff = (FixReaxFF *) modify->add_fix(fmt::format("{} all REAXFF",fix_id)); + fix_reaxff = dynamic_cast( modify->add_fix(fmt::format("{} all REAXFF",fix_id))); } /* ---------------------------------------------------------------------- */ @@ -467,7 +467,7 @@ void PairReaxFF::compute(int eflag, int vflag) if (api->system->acks2_flag) { auto ifix = modify->get_fix_by_style("^acks2/reax").front(); - api->workspace->s = ((FixACKS2ReaxFF*) ifix)->get_s(); + api->workspace->s = (dynamic_cast( ifix))->get_s(); } // setup data structures diff --git a/src/REAXFF/pair_reaxff.h b/src/REAXFF/pair_reaxff.h index 92eb5ca68b..68d4588f6e 100644 --- a/src/REAXFF/pair_reaxff.h +++ b/src/REAXFF/pair_reaxff.h @@ -89,13 +89,3 @@ class PairReaxFF : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Too many ghost atoms - -Number of ghost atoms has increased too much during simulation and has exceeded -the size of reaxff arrays. Increase safe_zone and min_cap in pair_style reaxff -command - -*/ diff --git a/src/REAXFF/reaxff_api.h b/src/REAXFF/reaxff_api.h index 33436304f1..52ee3df603 100644 --- a/src/REAXFF/reaxff_api.h +++ b/src/REAXFF/reaxff_api.h @@ -21,7 +21,7 @@ #ifndef LMP_REAXFF_API_H #define LMP_REAXFF_API_H -#include "reaxff_types.h" // IWYU pragma: export +#include "reaxff_types.h" // IWYU pragma: export #include diff --git a/src/REAXFF/reaxff_types.h b/src/REAXFF/reaxff_types.h index 94818f6ebf..7b090c79ce 100644 --- a/src/REAXFF/reaxff_types.h +++ b/src/REAXFF/reaxff_types.h @@ -23,8 +23,8 @@ #include "lmptype.h" -#include "reaxff_defs.h" // IWYU pragma: export -#include "reaxff_inline.h" // IWYU pragma: export +#include "reaxff_defs.h" // IWYU pragma: export +#include "reaxff_inline.h" // IWYU pragma: export // forward declarations namespace LAMMPS_NS { @@ -77,7 +77,7 @@ struct single_body_parameters { double b_o_131; double b_o_132; double b_o_133; - double bcut_acks2; // ACKS2 bond cutoff + double bcut_acks2; // ACKS2 bond cutoff /* Line four in the field file */ double p_ovun2; diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index cfb6307e63..6a8791de71 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -69,7 +69,7 @@ void ComputeEventDisplace::init() int ifix = modify->find_fix(id_event); if (ifix < 0) error->all(FLERR, "Could not find compute event/displace fix ID"); - fix_event = (FixEvent*) modify->fix[ifix]; + fix_event = dynamic_cast( modify->fix[ifix]); if (strcmp(fix_event->style,"EVENT/PRD") != 0 && strcmp(fix_event->style,"EVENT/TAD") != 0 && diff --git a/src/REPLICA/compute_event_displace.h b/src/REPLICA/compute_event_displace.h index d4ee68a092..990847194d 100644 --- a/src/REPLICA/compute_event_displace.h +++ b/src/REPLICA/compute_event_displace.h @@ -45,26 +45,3 @@ class ComputeEventDisplace : public Compute { #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: Distance must be > 0 for compute event/displace - -Self-explanatory. - -E: Could not find compute event/displace fix ID - -Self-explanatory. - -E: Compute event/displace has invalid fix event assigned - -This is an internal LAMMPS error. Please report it to the -developers. - -*/ diff --git a/src/REPLICA/compute_pressure_grem.h b/src/REPLICA/compute_pressure_grem.h index 8fa62965ee..cf11ed2e17 100644 --- a/src/REPLICA/compute_pressure_grem.h +++ b/src/REPLICA/compute_pressure_grem.h @@ -42,50 +42,3 @@ class ComputePressureGrem : public ComputePressure { #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 pressure must use group all - -Virial contributions computed by potentials (pair, bond, etc) are -computed on all atoms. - -E: Could not find compute pressure temperature ID - -The compute ID for calculating temperature does not exist. - -E: Compute pressure temperature ID does not compute temperature - -The compute ID assigned to a pressure computation must compute -temperature. - -E: Compute pressure requires temperature ID to include kinetic energy - -The keflag cannot be used unless a temperature compute is provided. - -E: Virial was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied the virial, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -E: Must use 'kspace_modify pressure/scalar no' for tensor components with kspace_style msm - -Otherwise MSM will compute only a scalar pressure. See the kspace_modify -command for details on this setting. - -E: Fix grem ID for compute PRESSURE/GREM does not exist - -Compute PRESSURE/GREM was passed an invalid fix id - -E: Cannot extract gREM scale factor from fix grem - -The fix id passed to compute PRESSURE/GREM refers to an incompatible fix - -*/ diff --git a/src/REPLICA/fix_event.h b/src/REPLICA/fix_event.h index d131d7eed2..1eb2d75f84 100644 --- a/src/REPLICA/fix_event.h +++ b/src/REPLICA/fix_event.h @@ -54,13 +54,3 @@ class FixEvent : public Fix { } // namespace LAMMPS_NS #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. - -*/ diff --git a/src/REPLICA/fix_event_hyper.cpp b/src/REPLICA/fix_event_hyper.cpp index 5f68506db5..9cdb881d06 100644 --- a/src/REPLICA/fix_event_hyper.cpp +++ b/src/REPLICA/fix_event_hyper.cpp @@ -79,7 +79,7 @@ void FixEventHyper::write_restart(FILE *fp) void FixEventHyper::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; event_number = (int) ubuf(list[n++]).i; event_timestep = (bigint) ubuf(list[n++]).i; diff --git a/src/REPLICA/fix_event_hyper.h b/src/REPLICA/fix_event_hyper.h index 2bcb6a8218..8c65ef1c79 100644 --- a/src/REPLICA/fix_event_hyper.h +++ b/src/REPLICA/fix_event_hyper.h @@ -47,13 +47,3 @@ class FixEventHyper : public FixEvent { #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. - -*/ diff --git a/src/REPLICA/fix_event_prd.cpp b/src/REPLICA/fix_event_prd.cpp index 3256d01923..9e1aee90e6 100644 --- a/src/REPLICA/fix_event_prd.cpp +++ b/src/REPLICA/fix_event_prd.cpp @@ -82,7 +82,7 @@ void FixEventPRD::write_restart(FILE *fp) void FixEventPRD::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; event_number = static_cast (list[n++]); event_timestep = static_cast (list[n++]); diff --git a/src/REPLICA/fix_event_prd.h b/src/REPLICA/fix_event_prd.h index 6ed8521a81..57ce9ede64 100644 --- a/src/REPLICA/fix_event_prd.h +++ b/src/REPLICA/fix_event_prd.h @@ -49,13 +49,3 @@ class FixEventPRD : public FixEvent { #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. - -*/ diff --git a/src/REPLICA/fix_event_tad.cpp b/src/REPLICA/fix_event_tad.cpp index f51401fae1..1ab34d3eed 100644 --- a/src/REPLICA/fix_event_tad.cpp +++ b/src/REPLICA/fix_event_tad.cpp @@ -78,7 +78,7 @@ void FixEventTAD::write_restart(FILE *fp) void FixEventTAD::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; event_number = static_cast (list[n++]); event_timestep = static_cast (list[n++]); diff --git a/src/REPLICA/fix_event_tad.h b/src/REPLICA/fix_event_tad.h index 2b44ce45f0..5523df7107 100644 --- a/src/REPLICA/fix_event_tad.h +++ b/src/REPLICA/fix_event_tad.h @@ -47,13 +47,3 @@ class FixEventTAD : public FixEvent { #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. - -*/ diff --git a/src/REPLICA/fix_grem.cpp b/src/REPLICA/fix_grem.cpp index 743d31fe96..1d0dceda96 100644 --- a/src/REPLICA/fix_grem.cpp +++ b/src/REPLICA/fix_grem.cpp @@ -166,8 +166,8 @@ void FixGrem::init() error->all(FLERR,"Fix id for nvt or npt fix does not exist"); Fix *nh = modify->fix[ifix]; - double *t_start = (double *)nh->extract("t_start",ifix); - double *t_stop = (double *)nh->extract("t_stop",ifix); + auto t_start = (double *)nh->extract("t_start",ifix); + auto t_stop = (double *)nh->extract("t_stop",ifix); if ((t_start != nullptr) && (t_stop != nullptr) && (ifix == 0)) { tbath = *t_start; if (*t_start != *t_stop) @@ -178,8 +178,8 @@ void FixGrem::init() pressref = 0.0; if (pressflag) { int *p_flag = (int *)nh->extract("p_flag",ifix); - double *p_start = (double *) nh->extract("p_start",ifix); - double *p_stop = (double *) nh->extract("p_stop",ifix); + auto p_start = (double *) nh->extract("p_start",ifix); + auto p_stop = (double *) nh->extract("p_stop",ifix); if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr) && (ifix == 1)) { ifix = 0; diff --git a/src/REPLICA/fix_grem.h b/src/REPLICA/fix_grem.h index cd7f0b35b3..a1ffae353a 100644 --- a/src/REPLICA/fix_grem.h +++ b/src/REPLICA/fix_grem.h @@ -50,35 +50,3 @@ class FixGrem : public Fix { #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: Region ID for fix grem does not exist - -Self-explanatory. - -E: Variable name for fix grem does not exist - -Self-explanatory. - -E: Variable for fix grem is invalid style - -Self-explanatory. - -E: Cannot use variable energy with constant force in fix grem - -This is because for constant force, LAMMPS can compute the change -in energy directly. - -E: Must use variable energy with fix grem - -Must define an energy variable when applying a dynamic -force during minimization. - -*/ diff --git a/src/REPLICA/fix_hyper.h b/src/REPLICA/fix_hyper.h index b6b35ff031..9d646f9927 100644 --- a/src/REPLICA/fix_hyper.h +++ b/src/REPLICA/fix_hyper.h @@ -38,7 +38,3 @@ class FixHyper : public Fix { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/REPLICA/fix_hyper_global.h b/src/REPLICA/fix_hyper_global.h index 0273c4ce63..89e17b5ef0 100644 --- a/src/REPLICA/fix_hyper_global.h +++ b/src/REPLICA/fix_hyper_global.h @@ -103,13 +103,3 @@ class FixHyperGlobal : public FixHyper { #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. - -*/ diff --git a/src/REPLICA/fix_hyper_local.h b/src/REPLICA/fix_hyper_local.h index ace74c7eec..ea7b3e3dfe 100644 --- a/src/REPLICA/fix_hyper_local.h +++ b/src/REPLICA/fix_hyper_local.h @@ -204,13 +204,3 @@ class FixHyperLocal : public FixHyper { #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. - -*/ diff --git a/src/REPLICA/fix_neb.h b/src/REPLICA/fix_neb.h index 5c9930d73f..80ffc130d9 100644 --- a/src/REPLICA/fix_neb.h +++ b/src/REPLICA/fix_neb.h @@ -75,29 +75,3 @@ class FixNEB : public Fix { #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: Potential energy ID for fix neb does not exist - -Self-explanatory. - -E: Too many active NEB atoms - -UNDOCUMENTED - -E: Too many atoms for NEB - -UNDOCUMENTED - -U: Atom count changed in fix neb - -This is not allowed in a NEB calculation. - -*/ diff --git a/src/REPLICA/fix_pimd.cpp b/src/REPLICA/fix_pimd.cpp index b84558acdb..32c468765e 100644 --- a/src/REPLICA/fix_pimd.cpp +++ b/src/REPLICA/fix_pimd.cpp @@ -614,8 +614,7 @@ void FixPIMD::comm_init() } if (buf_beads) { - for (int i = 0; i < np; i++) - if (buf_beads[i]) delete[] buf_beads[i]; + for (int i = 0; i < np; i++) delete[] buf_beads[i]; delete[] buf_beads; } @@ -678,8 +677,8 @@ void FixPIMD::comm_exec(double **ptr) if (index < 0) { auto mesg = fmt::format("Atom {} is missing at world [{}] rank [{}] " "required by rank [{}] ({}, {}, {}).\n", - tag_send[i], universe->iworld, comm->me, - plan_recv[iplan], atom->tag[0], atom->tag[1], atom->tag[2]); + tag_send[i], universe->iworld, comm->me, plan_recv[iplan], + atom->tag[0], atom->tag[1], atom->tag[2]); error->universe_one(FLERR, mesg); } diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index d391604530..9fa4910473 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -60,10 +60,10 @@ void Hyper::command(int narg, char **arg) 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]; + auto id_fix = new char[strlen(arg[2])+1]; strcpy(id_fix,arg[2]); - char *id_compute = new char[strlen(arg[3])+1]; + auto id_compute = new char[strlen(arg[3])+1]; strcpy(id_compute,arg[3]); options(narg-4,&arg[4]); @@ -89,7 +89,7 @@ void Hyper::command(int narg, char **arg) } else { int ifix = modify->find_fix(id_fix); if (ifix < 0) error->all(FLERR,"Could not find fix ID for hyper"); - fix_hyper = (FixHyper *) modify->fix[ifix]; + fix_hyper = dynamic_cast( modify->fix[ifix]); int dim; int *hyperflag = (int *) fix_hyper->extract("hyperflag",dim); if (hyperflag == nullptr || *hyperflag == 0) @@ -101,7 +101,7 @@ void Hyper::command(int narg, char **arg) // create FixEventHyper class to store event and pre-quench states - fix_event = (FixEventHyper *) modify->add_fix("hyper_event all EVENT/HYPER"); + fix_event = dynamic_cast( modify->add_fix("hyper_event all EVENT/HYPER")); // create Finish for timing output @@ -112,7 +112,7 @@ void Hyper::command(int narg, char **arg) int icompute = modify->find_compute(id_compute); if (icompute < 0) error->all(FLERR,"Could not find compute ID for hyper"); - compute_event = (ComputeEventDisplace *) modify->compute[icompute]; + compute_event = dynamic_cast( modify->compute[icompute]); compute_event->reset_extra_compute_fix("hyper_event"); // reset reneighboring criteria since will perform minimizations @@ -155,12 +155,11 @@ void Hyper::command(int narg, char **arg) // cannot use hyper with time-dependent fixes or regions - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->time_depend) - error->all(FLERR,"Cannot use hyper with a time-dependent fix defined"); + for (auto ifix : modify->get_fix_list()) + if (ifix->time_depend) error->all(FLERR,"Cannot use hyper with a time-dependent fix defined"); - for (int i = 0; i < domain->nregion; i++) - if (domain->regions[i]->dynamic_check()) + for (auto reg : domain->get_region_list()) + if (reg->dynamic_check()) error->all(FLERR,"Cannot use hyper with a time-dependent region defined"); // perform hyperdynamics simulation diff --git a/src/REPLICA/hyper.h b/src/REPLICA/hyper.h index 8d20439c1c..1ea7fa0327 100644 --- a/src/REPLICA/hyper.h +++ b/src/REPLICA/hyper.h @@ -59,7 +59,3 @@ class Hyper : public Command { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index f7e6c68b31..a811dabfd5 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -178,7 +178,7 @@ void NEB::run() if (fixes.size() != 1) error->all(FLERR,"NEB requires use of exactly one fix neb instance"); - fneb = (FixNEB *) fixes[0]; + fneb = dynamic_cast( fixes[0]); if (verbose) numall =7; else numall = 4; memory->create(all,nreplica,numall,"neb:all"); @@ -423,7 +423,7 @@ void NEB::readfile(char *file, int flag) error->all(FLERR,"Incorrectly formatted NEB file"); } - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; double fraction = ireplica/(nreplica-1.0); double **x = atom->x; int nlocal = atom->nlocal; diff --git a/src/REPLICA/neb.h b/src/REPLICA/neb.h index c99ab60904..9bbd6966e6 100644 --- a/src/REPLICA/neb.h +++ b/src/REPLICA/neb.h @@ -30,7 +30,7 @@ class NEB : public Command { NEB(class LAMMPS *, double, double, int, int, int, double *, double *); ~NEB() override; void command(int, char **) override; // process neb command - void run(); // run NEB + void run(); // run NEB double ebf, ebr; // forward and reverse energy barriers @@ -64,73 +64,3 @@ class NEB : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: NEB command before simulation box is defined - -Self-explanatory. - -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: Cannot use NEB with a single replica - -Self-explanatory. - -E: Cannot use NEB unless atom map exists - -Use the atom_modify command to create an atom map. - -E: NEB requires use of fix neb - -Self-explanatory. - -E: NEB requires damped dynamics minimizer - -Use a different minimization style. - -E: Too many timesteps for NEB - -You must use a number of timesteps that fit in a 32-bit integer -for NEB. - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -E: Unexpected end of neb file - -A read operation from the file failed. - -E: Incorrect atom format in neb file - -The number of fields per line is not what expected. - -E: Invalid atom IDs in neb file - -An ID in the file was not found in the system. - -E: Cannot open gzipped file - -LAMMPS was compiled without support for reading and writing gzipped -files through a pipeline to the gzip program with -DLAMMPS_GZIP. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -U: Can only use NEB with 1-processor replicas - -This is current restriction for NEB as implemented in LAMMPS. - -U: Cannot use NEB with atom_modify sort enabled - -This is current restriction for NEB implemented in LAMMPS. - -*/ diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index ced3f6d0e7..79d09080ec 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -167,7 +167,7 @@ void PRD::command(int narg, char **arg) // create FixEventPRD class to store event and pre-quench states - fix_event = (FixEventPRD *) modify->add_fix("prd_event all EVENT/PRD"); + fix_event = dynamic_cast( modify->add_fix("prd_event all EVENT/PRD")); // create Finish for timing output @@ -229,12 +229,11 @@ void PRD::command(int narg, char **arg) // cannot use PRD with time-dependent fixes or regions - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->time_depend) - error->all(FLERR,"Cannot use PRD with a time-dependent fix defined"); + for (auto ifix : modify->get_fix_list()) + if (ifix->time_depend) error->all(FLERR,"Cannot use PRD with a time-dependent fix defined"); - for (int i = 0; i < domain->nregion; i++) - if (domain->regions[i]->dynamic_check()) + for (auto reg : domain->get_region_list()) + if (reg->dynamic_check()) error->all(FLERR,"Cannot use PRD with a time-dependent region defined"); // perform PRD simulation diff --git a/src/REPLICA/prd.h b/src/REPLICA/prd.h index 81582ec3d4..2284b93aaa 100644 --- a/src/REPLICA/prd.h +++ b/src/REPLICA/prd.h @@ -75,75 +75,3 @@ class PRD : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: PRD command before simulation box is defined - -The prd command cannot be used before a read_data, -read_restart, or create_box command. - -E: Cannot use PRD with multi-processor replicas unless atom map exists - -Use the atom_modify command to create an atom map. - -W: Running PRD with only one replica - -This is allowed, but you will get no parallel speed-up. - -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: Invalid t_event in prd command - -Self-explanatory. - -E: PRD nsteps must be multiple of t_event - -Self-explanatory. - -E: PRD t_corr must be multiple of t_event - -Self-explanatory. - -E: Could not find compute ID for PRD - -Self-explanatory. - -W: Resetting reneighboring criteria during PRD - -A PRD simulation requires that neigh_modify settings be delay = 0, -every = 1, check = yes. Since these settings were not in place, -LAMMPS changed them and will restore them to their original values -after the PRD simulation. - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -E: Cannot use PRD with a changing box - -The current box dimensions are not copied between replicas - -E: Cannot use PRD with a time-dependent fix defined - -PRD alters the timestep in ways that will mess up these fixes. - -E: Cannot use PRD with a time-dependent region defined - -PRD alters the timestep in ways that will mess up these regions. - -E: Too many iterations - -You must use a number of iterations that fit in a 32-bit integer -for minimization. - -U: Cannot use PRD with atom_modify sort enabled - -This is a current restriction of PRD. You must turn off sorting, -which is enabled by default, via the atom_modify command. - -*/ diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index f98c63d1ff..91ea2a0a29 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -131,11 +131,11 @@ void TAD::command(int narg, char **arg) // create FixEventTAD object to store last event - fix_event = (FixEventTAD *) modify->add_fix("tad_event all EVENT/TAD"); + fix_event = dynamic_cast( modify->add_fix("tad_event all EVENT/TAD")); // create FixStore object to store revert state - fix_revert = (FixStore *) modify->add_fix("tad_revert all STORE peratom 0 7"); + fix_revert = dynamic_cast( modify->add_fix("tad_revert all STORE peratom 0 7")); // create Finish for timing output @@ -844,7 +844,7 @@ void TAD::add_event() int ievent = n_event_list++; fix_event_list[ievent] - = (FixEventTAD *) modify->add_fix(fmt::format("tad_event_{} all EVENT/TAD", ievent)); + = dynamic_cast( modify->add_fix(fmt::format("tad_event_{} all EVENT/TAD", ievent))); // store quenched state for new event @@ -872,7 +872,7 @@ void TAD::compute_tlo(int ievent) // update first event - char* statstr = (char *) "D "; + auto statstr = (char *) "D "; if (ievent == 0) { deltfirst = deltlo; diff --git a/src/REPLICA/tad.h b/src/REPLICA/tad.h index e0432db9fd..b16477096c 100644 --- a/src/REPLICA/tad.h +++ b/src/REPLICA/tad.h @@ -87,69 +87,3 @@ class TAD : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Tad command before simulation box is defined - -Self-explanatory. - -E: Cannot use TAD with a single replica for NEB - -NEB requires multiple replicas. - -E: Can only use TAD with 1-processor replicas for NEB - -This is current restriction for NEB as implemented in LAMMPS. - -E: Cannot use TAD with atom_modify sort enabled for NEB - -This is a current restriction of NEB. - -E: Cannot use TAD unless atom map exists for NEB - -See atom_modify map command to set this. - -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: Invalid t_event in tad command - -The value must be greater than 0. - -E: TAD nsteps must be multiple of t_event - -Self-explanatory. - -E: Invalid delta_conf in tad command - -The value must be between 0 and 1 inclusive. - -E: Invalid tmax in tad command - -The value must be greater than 0.0. - -E: Could not find compute ID for TAD - -Self-explanatory. - -W: Resetting reneighboring criteria during TAD - -A TAD simulation requires that neigh_modify settings be delay = 0, -every = 1, check = yes. Since these settings were not in place, -LAMMPS changed them and will restore them to their original values -after the PRD simulation. - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -E: Too many iterations - -You must use a number of iterations that fit in a 32-bit integer -for minimization. - -*/ diff --git a/src/REPLICA/temper.h b/src/REPLICA/temper.h index 0bce33a5f8..39e4661fcd 100644 --- a/src/REPLICA/temper.h +++ b/src/REPLICA/temper.h @@ -57,58 +57,3 @@ class Temper : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Must have more than one processor partition to temper - -Cannot use the temper command with only one processor partition. Use -the -partition command-line option. - -E: Temper command before simulation box is defined - -The temper command cannot be used before a read_data, read_restart, or -create_box command. - -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: Tempering fix ID is not defined - -The fix ID specified by the temper command does not exist. - -E: Illegal temperature index - -UNDOCUMENTED - -E: Invalid frequency in temper command - -Nevery must be > 0. - -E: Non integer # of swaps in temper command - -Swap frequency in temper command must evenly divide the total # of -timesteps. - -E: Tempering temperature fix is not supported - -UNDOCUMENTED - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -E: Tempering could not find thermo_pe compute - -This compute is created by the thermo command. It must have been -explicitly deleted by a uncompute command. - -U: Tempering temperature fix is not valid - -The fix specified by the temper command is not one that controls -temperature (nvt or langevin). - -*/ diff --git a/src/REPLICA/temper_grem.cpp b/src/REPLICA/temper_grem.cpp index 43d8ebe1d9..72dd331491 100644 --- a/src/REPLICA/temper_grem.cpp +++ b/src/REPLICA/temper_grem.cpp @@ -82,7 +82,7 @@ void TemperGrem::command(int narg, char **arg) if (strcmp(arg[3],modify->fix[whichfix]->id) == 0) break; if (whichfix == modify->nfix) error->universe_all(FLERR,"Tempering fix ID is not defined"); - fix_grem = (FixGrem*)(modify->fix[whichfix]); + fix_grem = dynamic_cast(modify->fix[whichfix]); // Check input values lambdas should be equal, assign other gREM values if (lambda != fix_grem->lambda) @@ -103,7 +103,7 @@ void TemperGrem::command(int narg, char **arg) int pressflag = fix_grem->pressflag; // fix_grem does all the checking... if (pressflag) { - double *p_start = (double *) nh->extract("p_start",ifix); + auto p_start = (double *) nh->extract("p_start",ifix); pressref = p_start[0]; } diff --git a/src/REPLICA/temper_grem.h b/src/REPLICA/temper_grem.h index 2aea1e1414..f372a75feb 100644 --- a/src/REPLICA/temper_grem.h +++ b/src/REPLICA/temper_grem.h @@ -62,50 +62,3 @@ class TemperGrem : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Must have more than one processor partition to grem - -Cannot use the grem command with only one processor partition. Use -the -partition command-line option. - -E: Grem command before simulation box is defined - -The grem command cannot be used before a read_data, read_restart, or -create_box command. - -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: Tempering fix ID is not defined - -The fix ID specified by the grem command does not exist. - -E: Invalid frequency in grem command - -Nevery must be > 0. - -E: Non integer # of swaps in grem command - -Swap frequency in grem command must evenly divide the total # of -timesteps. - -E: Grem temperature fix is not valid - -The fix specified by the grem command is not one that controls -temperature (nvt or npt). - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -E: Grem could not find thermo_pe compute - -This compute is created by the thermo command. It must have been -explicitly deleted by a uncompute command. - -*/ diff --git a/src/REPLICA/temper_npt.h b/src/REPLICA/temper_npt.h index b6f37ea8c1..b6e92f7d83 100644 --- a/src/REPLICA/temper_npt.h +++ b/src/REPLICA/temper_npt.h @@ -59,50 +59,3 @@ class TemperNPT : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Must have more than one processor partition to temper - -Cannot use the temper command with only one processor partition. Use -the -partition command-line option. - -E: temper/npt command before simulation box is defined - -The temper/npt command cannot be used before a read_data, read_restart, -or create_box command. - -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: Tempering fix ID is not defined - -The fix ID specified by the temper/npt command does not exist. - -E: Invalid frequency in temper/npt command - -Nevery must be > 0. - -E: Non integer # of swaps in temper/npt command - -Swap frequency in temper/npt command must evenly divide the total -# of timesteps. - -E: Tempering temperature fix is not valid - -The fix specified by the temper command is not one that controls -temperature and pressure (npt). - -E: Too many timesteps - -The cummulative timesteps must fit in a 64-bit integer. - -E: Tempering could not find thermo_pe compute - -This compute is created by the thermo command. It must have been -explicitly deleted by a uncompute command. - -*/ diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index 95cd54119c..661b86129c 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -300,7 +300,7 @@ void VerletSplit::run(int n) int n_pre_neighbor = modify->n_pre_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; if (atom->sortfreq > 0) sortflag = 1; diff --git a/src/REPLICA/verlet_split.h b/src/REPLICA/verlet_split.h index f7adeaf536..2ab679472b 100644 --- a/src/REPLICA/verlet_split.h +++ b/src/REPLICA/verlet_split.h @@ -54,33 +54,3 @@ class VerletSplit : public Verlet { #endif #endif - -/* ERROR/WARNING messages: - -E: Verlet/split requires 2 partitions - -See the -partition command-line switch. - -E: Verlet/split requires Rspace partition size be multiple of Kspace partition size - -This is so there is an equal number of Rspace processors for every -Kspace processor. - -E: Verlet/split can only currently be used with comm_style brick - -This is a current restriction in LAMMPS. - -E: Verlet/split requires Rspace partition layout be multiple of Kspace partition layout in each dim - -This is controlled by the processors command. - -W: No Kspace calculation with verlet/split - -The 2nd partition performs a kspace calculation so the kspace_style -command must be used. - -E: Verlet/split does not yet support TIP4P - -This is a current limitation. - -*/ diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp index 4217aa8e0a..6e51e4853f 100644 --- a/src/RIGID/compute_erotate_rigid.cpp +++ b/src/RIGID/compute_erotate_rigid.cpp @@ -66,8 +66,8 @@ double ComputeERotateRigid::compute_scalar() if (strncmp(modify->fix[irfix]->style,"rigid",5) == 0) { if (strstr(modify->fix[irfix]->style,"/small")) { - scalar = ((FixRigidSmall *) modify->fix[irfix])->extract_erotational(); - } else scalar = ((FixRigid *) modify->fix[irfix])->extract_erotational(); + scalar = (dynamic_cast( modify->fix[irfix]))->extract_erotational(); + } else scalar = (dynamic_cast( modify->fix[irfix]))->extract_erotational(); } scalar *= force->mvv2e; return scalar; diff --git a/src/RIGID/compute_erotate_rigid.h b/src/RIGID/compute_erotate_rigid.h index 3005df8493..ea160df17f 100644 --- a/src/RIGID/compute_erotate_rigid.h +++ b/src/RIGID/compute_erotate_rigid.h @@ -40,21 +40,3 @@ class ComputeERotateRigid : public Compute { #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: Fix ID for compute erotate/rigid does not exist - -Self-explanatory. - -E: Compute erotate/rigid with non-rigid fix-ID - -Self-explanatory. - -*/ diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp index 48f04e9cff..1b858dea15 100644 --- a/src/RIGID/compute_ke_rigid.cpp +++ b/src/RIGID/compute_ke_rigid.cpp @@ -65,8 +65,8 @@ double ComputeKERigid::compute_scalar() if (strncmp(modify->fix[irfix]->style,"rigid",5) == 0) { if (strstr(modify->fix[irfix]->style,"/small")) { - scalar = ((FixRigidSmall *) modify->fix[irfix])->extract_ke(); - } else scalar = ((FixRigid *) modify->fix[irfix])->extract_ke(); + scalar = (dynamic_cast( modify->fix[irfix]))->extract_ke(); + } else scalar = (dynamic_cast( modify->fix[irfix]))->extract_ke(); } scalar *= force->mvv2e; return scalar; diff --git a/src/RIGID/compute_ke_rigid.h b/src/RIGID/compute_ke_rigid.h index dfdd4d2e21..71fecb0d09 100644 --- a/src/RIGID/compute_ke_rigid.h +++ b/src/RIGID/compute_ke_rigid.h @@ -40,21 +40,3 @@ class ComputeKERigid : public Compute { #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: Fix ID for compute ke/rigid does not exist - -Self-explanatory. - -E: Compute ke/rigid with non-rigid fix-ID - -Self-explanatory. - -*/ diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index 44708c7730..21b232fdfe 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -111,7 +111,7 @@ void ComputeRigidLocal::init() int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"FixRigidSmall ID for compute rigid/local does not exist"); - fixrigid = (FixRigidSmall *) modify->fix[ifix]; + fixrigid = dynamic_cast( modify->fix[ifix]); int flag = 0; if (strstr(fixrigid->style,"rigid/") == nullptr) flag = 1; diff --git a/src/RIGID/compute_rigid_local.h b/src/RIGID/compute_rigid_local.h index 1d07f835b2..3314307f2c 100644 --- a/src/RIGID/compute_rigid_local.h +++ b/src/RIGID/compute_rigid_local.h @@ -52,37 +52,3 @@ class ComputeRigidLocal : public Compute { #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: Invalid keyword in compute rigid/local command - -UNDOCUMENTED - -E: FixRigidSmall ID for compute rigid/local does not exist - -UNDOCUMENTED - -E: Compute rigid/local does not use fix rigid/small fix - -UNDOCUMENTED - -U: Compute bond/local used when bonds are not allowed - -The atom style does not support bonds. - -U: Invalid keyword in compute bond/local command - -Self-explanatory. - -U: No bond style is defined for compute bond/local - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index 866d5b81b7..1962578691 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -43,18 +42,18 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{CONSTANT,EQUAL,ATOM}; +enum { CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ -FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(nullptr), x(nullptr), f(nullptr), v(nullptr), - mass(nullptr), rmass(nullptr), type(nullptr), scalingmask(nullptr) +FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), region(nullptr), idregion(nullptr), x(nullptr), f(nullptr), v(nullptr), + mass(nullptr), rmass(nullptr), type(nullptr), scalingmask(nullptr) { MPI_Comm_rank(world, &me); // check - if (narg < 4) error->all(FLERR,"Illegal fix ehex command: wrong number of parameters "); + if (narg < 4) error->all(FLERR, "Illegal fix ehex command: wrong number of parameters "); scalar_flag = 1; global_freq = 1; @@ -62,18 +61,16 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), // apply fix every nevery timesteps - nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nevery = utils::inumeric(FLERR, arg[3], false, lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix ehex command"); + if (nevery <= 0) error->all(FLERR, "Illegal fix ehex command"); // heat flux into the reservoir - heat_input = utils::numeric(FLERR,arg[4],false,lmp); + heat_input = utils::numeric(FLERR, arg[4], false, lmp); // optional args - iregion = -1; - // NOTE: constraints are deactivated by default constraints = 0; @@ -89,12 +86,12 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), int iarg = 5; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix ehex command: wrong number of parameters "); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix ehex does not exist"); - idregion = utils::strdup(arg[iarg+1]); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) + error->all(FLERR, "Illegal fix ehex command: wrong number of parameters "); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix ehex does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; } @@ -115,10 +112,9 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), // don't apply a coordinate correction if this keyword is specified else if (strcmp(arg[iarg], "hex") == 0) { - hex = 1; - iarg+= 1; - } - else + hex = 1; + iarg += 1; + } else error->all(FLERR, "Illegal fix ehex keyword "); } @@ -128,28 +124,25 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), error->all(FLERR, "You can only use the keyword 'com' together with the keyword 'constrain' "); scale = 1.0; - scalingmask = nullptr; + scalingmask = nullptr; FixEHEX::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); - } - /* ---------------------------------------------------------------------- */ -void FixEHEX::grow_arrays(int nmax) { - memory->grow(scalingmask, nmax,"ehex:scalingmask"); +void FixEHEX::grow_arrays(int nmax) +{ + memory->grow(scalingmask, nmax, "ehex:scalingmask"); } - /* ---------------------------------------------------------------------- */ FixEHEX::~FixEHEX() { - atom->delete_callback(id,Atom::GROW); - delete [] idregion; + atom->delete_callback(id, Atom::GROW); + delete[] idregion; memory->destroy(scalingmask); - } /* ---------------------------------------------------------------------- */ @@ -167,16 +160,14 @@ void FixEHEX::init() { // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix ehex does not exist"); + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix ehex does not exist", idregion); } // cannot have 0 atoms in group - if (group->count(igroup) == 0) - error->all(FLERR,"Fix ehex group has no atoms"); + if (group->count(igroup) == 0) error->all(FLERR, "Fix ehex group has no atoms"); fshake = nullptr; if (constraints) { @@ -194,30 +185,29 @@ void FixEHEX::init() } if (cnt_shake > 1) - error->all(FLERR,"Multiple instances of fix shake/rattle detected (not supported yet)"); - else if (cnt_shake == 1) { - fshake = ((FixShake*) modify->fix[id_shake]); - } - else if (cnt_shake == 0) - error->all(FLERR, "Fix ehex was configured with keyword constrain, but shake/rattle was not defined"); + error->all(FLERR, "Multiple instances of fix shake/rattle detected (not supported yet)"); + else if (cnt_shake == 1) { + fshake = (dynamic_cast(modify->fix[id_shake])); + } else if (cnt_shake == 0) + error->all( + FLERR, + "Fix ehex was configured with keyword constrain, but shake/rattle was not defined"); } } - - /* ---------------------------------------------------------------------- */ - -void FixEHEX::end_of_step() { +void FixEHEX::end_of_step() +{ // store local pointers - x = atom->x; - f = atom->f; - v = atom->v; - mass = atom->mass; - rmass = atom->rmass; - type = atom->type; - nlocal = atom->nlocal; + x = atom->x; + f = atom->f; + v = atom->v; + mass = atom->mass; + rmass = atom->rmass; + type = atom->type; + nlocal = atom->nlocal; // determine which sites are to be rescaled @@ -229,20 +219,18 @@ void FixEHEX::end_of_step() { // if required use shake/rattle to correct coordinates and velocities - if (constraints && fshake) - fshake->shake_end_of_step(0); + if (constraints && fshake) fshake->shake_end_of_step(0); } - - /* ---------------------------------------------------------------------- Iterate over all atoms, rescale the velocities and apply coordinate corrections. ------------------------------------------------------------------------- */ -void FixEHEX::rescale() { +void FixEHEX::rescale() +{ double Kr, Ke, escale; - double vsub[3],vcm[3], sfr[3]; + double vsub[3], vcm[3], sfr[3]; double mi; double dt; double F, mr, epsr_ik, sfvr, eta_ik; @@ -255,54 +243,54 @@ void FixEHEX::rescale() { // heat flux into the reservoir - F = heat_input * force->ftm2v * nevery; + F = heat_input * force->ftm2v * nevery; // total mass - mr = masstotal; + mr = masstotal; // energy scaling factor - escale = 1. + (F*dt)/Kr; + escale = 1. + (F * dt) / Kr; // safety check for kinetic energy - if (escale < 0.0) error->all(FLERR,"Fix ehex kinetic energy went negative"); + if (escale < 0.0) error->all(FLERR, "Fix ehex kinetic energy went negative"); scale = sqrt(escale); - vsub[0] = (scale-1.0) * vcm[0]; - vsub[1] = (scale-1.0) * vcm[1]; - vsub[2] = (scale-1.0) * vcm[2]; + vsub[0] = (scale - 1.0) * vcm[0]; + vsub[1] = (scale - 1.0) * vcm[1]; + vsub[2] = (scale - 1.0) * vcm[2]; for (int i = 0; i < nlocal; i++) { if (scalingmask[i]) { - mi = (rmass) ? rmass[i] : mass[type[i]]; + mi = (rmass) ? rmass[i] : mass[type[i]]; - for (int k=0; k<3; k++) { + for (int k = 0; k < 3; k++) { // apply coordinate correction unless running in hex mode if (!hex) { - // epsr_ik implements Eq. (20) in the paper + // epsr_ik implements Eq. (20) in the paper - eta_ik = mi * F/(2.*Kr) * (v[i][k] - vcm[k]); - epsr_ik = eta_ik / (mi*Kr) * (F/48. + sfvr/6.*force->ftm2v) - F/(12.*Kr) * (f[i][k]/mi - sfr[k]/mr)*force->ftm2v; + eta_ik = mi * F / (2. * Kr) * (v[i][k] - vcm[k]); + epsr_ik = eta_ik / (mi * Kr) * (F / 48. + sfvr / 6. * force->ftm2v) - + F / (12. * Kr) * (f[i][k] / mi - sfr[k] / mr) * force->ftm2v; - x[i][k] -= dt*dt*dt * epsr_ik; + x[i][k] -= dt * dt * dt * epsr_ik; } // rescale the velocity - v[i][k] = scale*v[i][k] - vsub[k]; + v[i][k] = scale * v[i][k] - vsub[k]; } } } } - /* ---------------------------------------------------------------------- */ double FixEHEX::compute_scalar() @@ -317,17 +305,17 @@ double FixEHEX::compute_scalar() double FixEHEX::memory_usage() { double bytes = 0.0; - bytes += (double)atom->nmax * sizeof(double); + bytes += (double) atom->nmax * sizeof(double); return bytes; } - /* ---------------------------------------------------------------------- Update the array scalingmask depending on which individual atoms will be rescaled or not. ------------------------------------------------------------------------- */ -void FixEHEX::update_scalingmask() { +void FixEHEX::update_scalingmask() +{ int m; int lid; bool stat; @@ -335,11 +323,7 @@ void FixEHEX::update_scalingmask() { // prematch region - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // only rescale molecules whose center of mass if fully contained in the region @@ -347,28 +331,33 @@ void FixEHEX::update_scalingmask() { // loop over all clusters - for (int i=0; i < fshake->nlist; i++) { + for (int i = 0; i < fshake->nlist; i++) { // cluster id - m = fshake->list[i]; + m = fshake->list[i]; // check if the centre of mass of the cluster is inside the region // if region == nullptr, just check the group information of all sites - if (fshake->shake_flag[m] == 1) nsites = 3; - else if (fshake->shake_flag[m] == 2) nsites = 2; - else if (fshake->shake_flag[m] == 3) nsites = 3; - else if (fshake->shake_flag[m] == 4) nsites = 4; - else nsites = 0; + if (fshake->shake_flag[m] == 1) + nsites = 3; + else if (fshake->shake_flag[m] == 2) + nsites = 2; + else if (fshake->shake_flag[m] == 3) + nsites = 3; + else if (fshake->shake_flag[m] == 4) + nsites = 4; + else + nsites = 0; if (nsites == 0) { - error->all(FLERR,"Internal error: shake_flag[m] has to be between 1 and 4 for m in nlist"); + error->all(FLERR, "Internal error: shake_flag[m] has to be between 1 and 4 for m in nlist"); } stat = check_cluster(fshake->shake_atom[m], nsites, region); - for (int l=0; l < nsites; l++) { + for (int l = 0; l < nsites; l++) { lid = atom->map(fshake->shake_atom[m][l]); scalingmask[lid] = stat; } @@ -376,9 +365,8 @@ void FixEHEX::update_scalingmask() { // check atoms that do not belong to any cluster - for (int i=0; inlocal; i++) { - if (fshake->shake_flag[i] == 0) - scalingmask[i] = rescale_atom(i,region); + for (int i = 0; i < atom->nlocal; i++) { + if (fshake->shake_flag[i] == 0) scalingmask[i] = rescale_atom(i, region); } } @@ -386,41 +374,39 @@ void FixEHEX::update_scalingmask() { // no clusters, just individual sites (e.g. monatomic system or flexible molecules) else { - for (int i=0; inlocal; i++) - scalingmask[i] = rescale_atom(i,region); + for (int i = 0; i < atom->nlocal; i++) scalingmask[i] = rescale_atom(i, region); } - } - /* ---------------------------------------------------------------------- Check if the centre of mass of the cluster to be constrained is inside the region. ------------------------------------------------------------------------- */ -bool FixEHEX::check_cluster(tagint *shake_atom, int n, Region * region) { +bool FixEHEX::check_cluster(tagint *shake_atom, int n, Region *region) +{ // IMPORTANT NOTE: If any site of the cluster belongs to a group // which should not be rescaled than all of the sites // will be ignored! - double **x = atom->x; - double * rmass = atom->rmass; - double * mass = atom->mass; - int * type = atom->type; - int * mask = atom->mask; - double xcom[3], xtemp[3]; - double mcluster, mi; - bool stat; - int lid[4]; + double **x = atom->x; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + double xcom[3], xtemp[3]; + double mcluster, mi; + bool stat; + int lid[4]; // accumulate mass and centre of mass position - stat = true; - xcom[0] = 0.; - xcom[1] = 0.; - xcom[2] = 0.; - mcluster = 0; + stat = true; + xcom[0] = 0.; + xcom[1] = 0.; + xcom[2] = 0.; + mcluster = 0; for (int i = 0; i < n; i++) { @@ -432,26 +418,24 @@ bool FixEHEX::check_cluster(tagint *shake_atom, int n, Region * region) { stat = stat && (mask[lid[i]] & groupbit); - if (region && stat) { + if (region && stat) { // check if reduced mass is used - mi = (rmass) ? rmass[lid[i]] : mass[type[lid[i]]]; + mi = (rmass) ? rmass[lid[i]] : mass[type[lid[i]]]; mcluster += mi; // accumulate centre of mass // NOTE: you can either use unwrapped coordinates or take site x[lid[0]] as reference, // i.e. reconstruct the molecule around this site and calculate the com. - for (int k=0; k<3; k++) - xtemp[k] = x[lid[i]][k] - x[lid[0]][k]; + for (int k = 0; k < 3; k++) xtemp[k] = x[lid[i]][k] - x[lid[0]][k]; // take into account pbc domain->minimum_image(xtemp); - for (int k=0; k<3; k++) - xcom[k] += mi * (x[lid[0]][k] + xtemp[k]) ; + for (int k = 0; k < 3; k++) xcom[k] += mi * (x[lid[0]][k] + xtemp[k]); } } @@ -461,14 +445,11 @@ bool FixEHEX::check_cluster(tagint *shake_atom, int n, Region * region) { // check mass - if (mcluster < 1.e-14) { - error->all(FLERR, "Fix ehex shake cluster has almost zero mass."); - } + if (mcluster < 1.e-14) { error->all(FLERR, "Fix ehex shake cluster has almost zero mass."); } // divide by total mass - for (int k=0; k<3; k++) - xcom[k] = xcom[k]/mcluster; + for (int k = 0; k < 3; k++) xcom[k] = xcom[k] / mcluster; // apply periodic boundary conditions (centre of mass could be outside the box) // and check if molecule is inside the region @@ -480,12 +461,12 @@ bool FixEHEX::check_cluster(tagint *shake_atom, int n, Region * region) { return stat; } - /* ---------------------------------------------------------------------- Check if atom i has the correct group and is inside the region. ------------------------------------------------------------------------- */ -bool FixEHEX::rescale_atom(int i, Region*region) { +bool FixEHEX::rescale_atom(int i, Region *region) +{ bool stat; double x_r[3]; @@ -505,7 +486,7 @@ bool FixEHEX::rescale_atom(int i, Region*region) { // check if the atom is in the group/region - stat = stat && region->match(x_r[0],x_r[1],x_r[2]); + stat = stat && region->match(x_r[0], x_r[1], x_r[2]); } return stat; @@ -516,102 +497,101 @@ bool FixEHEX::rescale_atom(int i, Region*region) { (e.g. com velocity, kinetic energy, total mass,...) ------------------------------------------------------------------------- */ -void FixEHEX::com_properties(double * vr, double * sfr, double *sfvr, double *K, double *Kr, double *mr) { - double ** f = atom->f; - double ** v = atom->v; - int nlocal = atom->nlocal; - double *rmass= atom->rmass; - double *mass = atom->mass; - int *type = atom->type; - double l_vr[3]; - double l_mr; - double l_sfr[3]; - double l_sfvr; - double l_K; - double mi; - double l_buf[9]; - double buf[9]; +void FixEHEX::com_properties(double *vr, double *sfr, double *sfvr, double *K, double *Kr, + double *mr) +{ + double **f = atom->f; + double **v = atom->v; + int nlocal = atom->nlocal; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + double l_vr[3]; + double l_mr; + double l_sfr[3]; + double l_sfvr; + double l_K; + double mi; + double l_buf[9]; + double buf[9]; - // calculate partial sums + // calculate partial sums - l_vr[0] = l_vr[1] = l_vr[2] = 0; - l_sfr[0] = l_sfr[1] = l_sfr[2] = 0; - l_sfvr = 0; - l_mr = 0; - l_K = 0; + l_vr[0] = l_vr[1] = l_vr[2] = 0; + l_sfr[0] = l_sfr[1] = l_sfr[2] = 0; + l_sfvr = 0; + l_mr = 0; + l_K = 0; - for (int i = 0; i < nlocal; i++) { - if (scalingmask[i]) { + for (int i = 0; i < nlocal; i++) { + if (scalingmask[i]) { - // check if reduced mass is used + // check if reduced mass is used - mi = (rmass) ? rmass[i] : mass[type[i]]; + mi = (rmass) ? rmass[i] : mass[type[i]]; - // accumulate total mass + // accumulate total mass - l_mr += mi; + l_mr += mi; - // accumulate kinetic energy + // accumulate kinetic energy - l_K += mi/2. * (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]); + l_K += mi / 2. * (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]); - // sum_j f_j * v_j + // sum_j f_j * v_j - l_sfvr += f[i][0]*v[i][0] + f[i][1]*v[i][1] + f[i][2]*v[i][2]; + l_sfvr += f[i][0] * v[i][0] + f[i][1] * v[i][1] + f[i][2] * v[i][2]; - // accumulate com velocity and sum of forces + // accumulate com velocity and sum of forces - for (int k=0; k<3; k++) { - l_vr[k] += mi * v[i][k]; - l_sfr[k]+= f[i][k]; - } - } - } + for (int k = 0; k < 3; k++) { + l_vr[k] += mi * v[i][k]; + l_sfr[k] += f[i][k]; + } + } + } - // reduce sums + // reduce sums - l_buf[0] = l_vr[0]; - l_buf[1] = l_vr[1]; - l_buf[2] = l_vr[2]; - l_buf[3] = l_K; - l_buf[4] = l_mr; - l_buf[5] = l_sfr[0]; - l_buf[6] = l_sfr[1]; - l_buf[7] = l_sfr[2]; - l_buf[8] = l_sfvr; + l_buf[0] = l_vr[0]; + l_buf[1] = l_vr[1]; + l_buf[2] = l_vr[2]; + l_buf[3] = l_K; + l_buf[4] = l_mr; + l_buf[5] = l_sfr[0]; + l_buf[6] = l_sfr[1]; + l_buf[7] = l_sfr[2]; + l_buf[8] = l_sfvr; - MPI_Allreduce(l_buf, buf, 9, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(l_buf, buf, 9, MPI_DOUBLE, MPI_SUM, world); - // total mass of region + // total mass of region - *mr = buf[4]; + *mr = buf[4]; - if (*mr < 1.e-14) { - error->all(FLERR, "Fix ehex error mass of region is close to zero"); - } + if (*mr < 1.e-14) { error->all(FLERR, "Fix ehex error mass of region is close to zero"); } - // total kinetic energy of region + // total kinetic energy of region - *K = buf[3]; + *K = buf[3]; - // centre of mass velocity of region + // centre of mass velocity of region - vr[0] = buf[0]/(*mr); - vr[1] = buf[1]/(*mr); - vr[2] = buf[2]/(*mr); + vr[0] = buf[0] / (*mr); + vr[1] = buf[1] / (*mr); + vr[2] = buf[2] / (*mr); - // sum of forces + // sum of forces - sfr[0] = buf[5]; - sfr[1] = buf[6]; - sfr[2] = buf[7]; + sfr[0] = buf[5]; + sfr[1] = buf[6]; + sfr[2] = buf[7]; - // calculate non-translational kinetic energy + // calculate non-translational kinetic energy - *Kr = *K - 0.5* (*mr) * (vr[0]*vr[0]+vr[1]*vr[1]+vr[2]*vr[2]); + *Kr = *K - 0.5 * (*mr) * (vr[0] * vr[0] + vr[1] * vr[1] + vr[2] * vr[2]); - // calculate sum_j f_j * (v_j - v_r) = sum_j f_j * v_j - v_r * sum_j f_j + // calculate sum_j f_j * (v_j - v_r) = sum_j f_j * v_j - v_r * sum_j f_j - *sfvr = buf[8] - (vr[0]*sfr[0] + vr[1]*sfr[1] + vr[2]*sfr[2]); + *sfvr = buf[8] - (vr[0] * sfr[0] + vr[1] * sfr[1] + vr[2] * sfr[2]); } - diff --git a/src/RIGID/fix_ehex.h b/src/RIGID/fix_ehex.h index f4ea872533..bbaddd5118 100644 --- a/src/RIGID/fix_ehex.h +++ b/src/RIGID/fix_ehex.h @@ -43,10 +43,10 @@ class FixEHEX : public Fix { bool check_cluster(tagint *shake_atom, int n, class Region *region); private: - int iregion; double heat_input; double masstotal; double scale; + class Region *region; char *idregion; int me; @@ -69,83 +69,3 @@ class FixEHEX : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix ehex command: wrong number of parameters - -UNDOCUMENTED - -E: Illegal ... command - -UNDOCUMENTED - -E: Region ID for fix ehex does not exist - -Self-explanatory. - -E: Illegal fix ehex keyword - -UNDOCUMENTED - -E: You can only use the keyword 'com' together with the keyword 'constrain' - -UNDOCUMENTED - -E: Fix ehex group has no atoms - -Self-explanatory. - -E: Multiple instances of fix shake/rattle detected (not supported yet) - -You can only have one instance of fix rattle/shake at the moment. - -E: Fix ehex was configured with keyword constrain, but shake/rattle was not defined - -The option constrain requires either fix shake or fix rattle which is missing in the input script. - -E: Fix ehex kinetic energy went negative - -UNDOCUMENTED - -E: Internal error: shake_flag[m] has to be between 1 and 4 for m in nlist - -Contact developers. - -E: Fix ehex shake cluster has almost zero mass. - -UNDOCUMENTED - -E: Fix ehex error mass of region is close to zero - -Check your configuration. - -U: Illegal fix ehex command: wrong number of parameters - -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. - -U: Illegal fix ehex command: integer value expected - -Self-explanatory. Check the value for nevery. - -U: You can only use the keyword 'com' together with the keyword 'constrain' . - -Self-explanatory. - -U: Illegal fix ehex keyword - -Self-explanatory. - -U: Fix heat kinetic energy went negative - -This will cause the velocity rescaling about to be performed by fix -heat to be invalid. - -U: Fix heat kinetic energy of an atom went negative - -This will cause the velocity rescaling about to be performed by fix -heat to be invalid. - -*/ diff --git a/src/RIGID/fix_rattle.h b/src/RIGID/fix_rattle.h index 937a2e1233..3e96e41efd 100644 --- a/src/RIGID/fix_rattle.h +++ b/src/RIGID/fix_rattle.h @@ -75,51 +75,3 @@ class FixRattle : public FixShake { #endif #endif - -/* ERROR/WARNING messages: - -W: Fix rattle should come after all other integration fixes - -UNDOCUMENTED - -E: Rattle determinant = 0.0 - -The determinant of the matrix being solved for a single cluster -specified by the fix rattle command is numerically invalid. - -E: Rattle failed - -UNDOCUMENTED - -E: Coordinate constraints are not satisfied up to desired tolerance - -UNDOCUMENTED - -E: Velocity constraints are not satisfied up to desired tolerance - -UNDOCUMENTED - -E: Velocity constraints are not satisfied up to desired tolerance! - -UNDOCUMENTED - -U: Fix rattle should come after all other integration fixes - -This fix is designed to work after all other integration fixes change -atom positions. Thus it should be the last integration fix specified. -If not, it will not satisfy the desired constraints as well as it -otherwise would. - -U: Rattle failed - -Certain constraints were not satisfied. - -U: Coordinate constraints are not satisfied up to desired tolerance - -Self-explanatory. - -U: Rattle velocity constraints are not satisfied up to desired tolerance - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 780dbd66f5..f21d46d576 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -156,7 +156,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Variable {} for fix rigid/small custom does not exist", arg[4]+2); if (input->variable->atomstyle(ivariable) == 0) error->all(FLERR,"Fix rigid custom variable {} is not atom-style variable", arg[4]+2); - double *value = new double[nlocal]; + auto value = new double[nlocal]; input->variable->compute_atom(ivariable,0,value,1,0); int minval = INT_MAX; for (i = 0; i < nlocal; i++) @@ -676,9 +676,9 @@ void FixRigid::init() // atom style pointers to particles that store extra info - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_line = (AtomVecLine *) atom->style_match("line"); - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_line = dynamic_cast( atom->style_match("line")); + avec_tri = dynamic_cast( atom->style_match("tri")); // warn if more than one rigid fix // if earlyflag, warn if any post-force fixes come after a rigid fix @@ -737,7 +737,7 @@ void FixRigid::init() dtq = 0.5 * update->dt; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; // setup rigid bodies, using current atom info. if reinitflag is not set, // do the initialization only once, b/c properties may not be re-computable @@ -2288,7 +2288,7 @@ void FixRigid::readfile(int which, double *vec, double **array1, double **array2 if (nlines == 0) return; else if (nlines < 0) error->all(FLERR,"Fix rigid infile has incorrect format"); - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; int nread = 0; while (nread < nlines) { nchunk = MIN(nlines-nread,CHUNK); diff --git a/src/RIGID/fix_rigid.h b/src/RIGID/fix_rigid.h index 36ab138868..027c3eb59c 100644 --- a/src/RIGID/fix_rigid.h +++ b/src/RIGID/fix_rigid.h @@ -154,137 +154,3 @@ class FixRigid : public Fix { #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: Fix rigid custom requires previously defined property/atom - -UNDOCUMENTED - -E: Fix rigid custom requires integer-valued property/atom - -UNDOCUMENTED - -E: Variable name for fix rigid custom does not exist - -UNDOCUMENTED - -E: Fix rigid custom variable is no atom-style variable - -UNDOCUMENTED - -E: Unsupported fix rigid custom property - -UNDOCUMENTED - -E: Fix rigid molecule requires atom attribute molecule - -Self-explanatory. - -E: Too many molecules for fix rigid - -The limit is 2^31 = ~2 billion molecules. - -E: Could not find fix rigid group ID - -A group ID used in the fix rigid command does not exist. - -E: One or more atoms belong to multiple rigid bodies - -Two or more rigid bodies defined by the fix rigid command cannot -contain the same atom. - -E: No rigid bodies defined - -The fix specification did not end up defining any rigid bodies. - -E: Fix rigid z force cannot be on for 2d simulation - -Self-explanatory. - -E: Fix rigid xy torque cannot be on for 2d simulation - -Self-explanatory. - -E: Fix rigid langevin period must be > 0.0 - -Self-explanatory. - -E: Fix rigid npt/nph dilate group ID does not exist - -Self-explanatory. - -E: One or zero atoms in rigid body - -Any rigid body defined by the fix rigid command must contain 2 or more -atoms. - -W: More than one fix rigid - -It is not efficient to use fix rigid more than once. - -E: Rigid fix must come before NPT/NPH fix - -NPT/NPH fix must be defined in input script after all rigid fixes, -else the rigid fix contribution to the pressure virial is -incorrect. - -W: Cannot count rigid body degrees-of-freedom before bodies are initialized - -This means the temperature associated with the rigid bodies may be -incorrect on this timestep. - -W: Computing temperature of portions of rigid bodies - -The group defined by the temperature compute does not encompass all -the atoms in one or more rigid bodies, so the change in -degrees-of-freedom for the atoms in those partial rigid bodies will -not be accounted for. - -E: Fix rigid atom has non-zero image flag in a non-periodic dimension - -Image flags for non-periodic dimensions should not be set. - -E: Insufficient Jacobi rotations for rigid body - -Eigensolve for rigid body was not sufficiently accurate. - -E: Fix rigid: Bad principal moments - -The principal moments of inertia computed for a rigid body -are not within the required tolerances. - -E: Cannot open fix rigid inpfile %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Unexpected end of fix rigid file - -A read operation from the file failed. - -E: Fix rigid file has no lines - -Self-explanatory. - -E: Incorrect rigid body format in fix rigid file - -The number of fields per line is not what expected. - -E: Invalid rigid body ID in fix rigid file - -The ID does not match the number of an existing ID of rigid bodies -that are defined by the fix rigid command. - -E: Cannot open fix rigid restart file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -*/ diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 943d7225ba..622a2f86b0 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -172,7 +172,7 @@ FixRigidNH::~FixRigidNH() deallocate_order(); } - if (rfix) delete [] rfix; + delete[] rfix; if (tcomputeflag) modify->delete_compute(id_temp); delete [] id_temp; @@ -270,7 +270,7 @@ void FixRigidNH::init() for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2])) error->all(FLERR,"Cannot use fix rigid npt/nph and fix deform on " @@ -303,7 +303,7 @@ void FixRigidNH::init() // rfix[] = indices to each fix rigid // this will include self - if (rfix) delete [] rfix; + delete[] rfix; nrigidfix = 0; rfix = nullptr; @@ -1162,7 +1162,7 @@ void FixRigidNH::write_restart(FILE *fp) void FixRigidNH::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { diff --git a/src/RIGID/fix_rigid_nh.h b/src/RIGID/fix_rigid_nh.h index 88f27126ef..ea628355dc 100644 --- a/src/RIGID/fix_rigid_nh.h +++ b/src/RIGID/fix_rigid_nh.h @@ -98,80 +98,3 @@ inline double FixRigidNH::maclaurin_series(double x) } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Fix rigid npt/nph period must be > 0.0 - -Self-explanatory. - -E: Invalid fix rigid npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Invalid fix rigid npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix rigid npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Fix rigid nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Fix rigid npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Temperature ID for fix rigid nvt/npt/nph does not exist - -Self-explanatory. - -E: Fix rigid npt/nph does not yet allow triclinic box - -This is a current restriction in LAMMPS. - -E: Cannot use fix rigid npt/nph and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Pressure ID for fix rigid npt/nph does not exist - -Self-explanatory. - -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: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index 8b773a30ea..bd8db90827 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -184,7 +184,7 @@ FixRigidNHSmall::~FixRigidNHSmall() deallocate_order(); } - if (rfix) delete [] rfix; + delete[] rfix; if (tcomputeflag) modify->delete_compute(id_temp); delete [] id_temp; @@ -268,7 +268,7 @@ void FixRigidNHSmall::init() for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2])) error->all(FLERR,"Cannot use fix rigid npt/nph and fix deform on " @@ -301,7 +301,7 @@ void FixRigidNHSmall::init() // rfix[] = indices to each fix rigid // this will include self - if (rfix) delete [] rfix; + delete[] rfix; nrigidfix = 0; rfix = nullptr; @@ -1272,7 +1272,7 @@ void FixRigidNHSmall::write_restart(FILE *fp) void FixRigidNHSmall::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { diff --git a/src/RIGID/fix_rigid_nh_small.h b/src/RIGID/fix_rigid_nh_small.h index b52797f194..edc7f7694b 100644 --- a/src/RIGID/fix_rigid_nh_small.h +++ b/src/RIGID/fix_rigid_nh_small.h @@ -99,80 +99,3 @@ inline double FixRigidNHSmall::maclaurin_series(double x) } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Fix rigid/small npt/nph period must be > 0.0 - -Self-explanatory. - -E: Invalid fix rigid/small npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Invalid fix rigid/small npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix rigid/small npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Fix rigid/small nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Fix rigid npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Temperature ID for fix rigid nvt/npt/nph does not exist - -Self-explanatory. - -E: Fix rigid npt/nph does not yet allow triclinic box - -This is a current restriction in LAMMPS. - -E: Cannot use fix rigid npt/nph and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Pressure ID for fix rigid npt/nph does not exist - -Self-explanatory. - -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: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/RIGID/fix_rigid_nph.h b/src/RIGID/fix_rigid_nph.h index 0d9de7edc3..0d0e22c2f6 100644 --- a/src/RIGID/fix_rigid_nph.h +++ b/src/RIGID/fix_rigid_nph.h @@ -33,15 +33,3 @@ class FixRigidNPH : public FixRigidNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Did not set pressure for fix rigid/nph - -The press keyword must be specified. - -E: Cannot set temperature for fix rigid/nph - -The temp keyword cannot be specified. - -*/ diff --git a/src/RIGID/fix_rigid_nph_small.h b/src/RIGID/fix_rigid_nph_small.h index 3c7245ceae..f6e99db2a7 100644 --- a/src/RIGID/fix_rigid_nph_small.h +++ b/src/RIGID/fix_rigid_nph_small.h @@ -33,19 +33,3 @@ class FixRigidNPHSmall : public FixRigidNHSmall { #endif #endif - -/* ERROR/WARNING messages: - -E: Pressure control must be used with fix nph/small - -Self-explanatory. - -E: Temperature control must not be used with fix nph/small - -Self-explanatory. - -E: Target pressure for fix rigid/nph cannot be < 0.0 - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_rigid_npt.h b/src/RIGID/fix_rigid_npt.h index a0ba26a06d..c079751012 100644 --- a/src/RIGID/fix_rigid_npt.h +++ b/src/RIGID/fix_rigid_npt.h @@ -33,29 +33,3 @@ class FixRigidNPT : public FixRigidNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Did not set temperature or pressure for fix rigid/npt - -The temp and press keywords must be specified. - -E: Target temperature for fix rigid/npt cannot be 0.0 - -Self-explanatory. - -E: Fix rigid/npt period must be > 0.0 - -Self-explanatory. - -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: Fix rigid/npt temperature order must be 3 or 5 - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_rigid_npt_small.h b/src/RIGID/fix_rigid_npt_small.h index 1d02688bab..77a74f2265 100644 --- a/src/RIGID/fix_rigid_npt_small.h +++ b/src/RIGID/fix_rigid_npt_small.h @@ -33,31 +33,3 @@ class FixRigidNPTSmall : public FixRigidNHSmall { #endif #endif - -/* ERROR/WARNING messages: - -E: Did not set temp or press for fix rigid/npt/small - -Self-explanatory. - -E: Target temperature for fix rigid/npt/small cannot be 0.0 - -Self-explanatory. - -E: Target pressure for fix rigid/npt/small cannot be < 0.0 - -Self-explanatory. - -E: Fix rigid/npt/small period must be > 0.0 - -Self-explanatory. - -E: Fix rigid npt/small t_chain should not be less than 1 - -Self-explanatory. - -E: Fix rigid npt/small t_order must be 3 or 5 - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_rigid_nvt.h b/src/RIGID/fix_rigid_nvt.h index 7e6bb54937..be01a3c72b 100644 --- a/src/RIGID/fix_rigid_nvt.h +++ b/src/RIGID/fix_rigid_nvt.h @@ -33,29 +33,3 @@ class FixRigidNVT : public FixRigidNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Did not set temperature for fix rigid/nvt - -The temp keyword must be specified. - -E: Target temperature for fix rigid/nvt cannot be 0.0 - -Self-explanatory. - -E: Fix rigid/nvt period must be > 0.0 - -Self-explanatory. - -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: Fix rigid/nvt temperature order must be 3 or 5 - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_rigid_nvt_small.h b/src/RIGID/fix_rigid_nvt_small.h index 0138a3a561..89b71a1470 100644 --- a/src/RIGID/fix_rigid_nvt_small.h +++ b/src/RIGID/fix_rigid_nvt_small.h @@ -33,31 +33,3 @@ class FixRigidNVTSmall : public FixRigidNHSmall { #endif #endif - -/* ERROR/WARNING messages: - -E: Did not set temp for fix rigid/nvt/small - -Self-explanatory. - -E: Target temperature for fix rigid/nvt/small cannot be 0.0 - -Self-explanatory. - -E: Fix rigid/nvt/small period must be > 0.0 - -Self-explanatory. - -E: Fix rigid nvt/small t_chain should not be less than 1 - -Self-explanatory. - -E: Fix rigid nvt/small t_iter should not be less than 1 - -Self-explanatory. - -E: Fix rigid nvt/small t_order must be 3 or 5 - -Self-explanatory. - -*/ diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 45aadd845f..ec3e58d5f5 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -139,7 +139,7 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : if (input->variable->atomstyle(ivariable) == 0) error->all(FLERR,"Fix rigid/small custom variable {} is not atom-style variable", arg[4]+2); - double *value = new double[nlocal]; + auto value = new double[nlocal]; input->variable->compute_atom(ivariable,0,value,1,0); int minval = INT_MAX; for (i = 0; i < nlocal; i++) @@ -432,9 +432,9 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // atom style pointers to particles that store extra info - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_line = (AtomVecLine *) atom->style_match("line"); - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_line = dynamic_cast( atom->style_match("line")); + avec_tri = dynamic_cast( atom->style_match("tri")); // compute per body forces and torques inside final_integrate() by default @@ -582,7 +582,7 @@ void FixRigidSmall::init() dtq = 0.5 * update->dt; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } /* ---------------------------------------------------------------------- @@ -1573,8 +1573,7 @@ void FixRigidSmall::create_bodies(tagint *bodyID) int *proclist; memory->create(proclist,ncount,"rigid/small:proclist"); - InRvous *inbuf = (InRvous *) - memory->smalloc(ncount*sizeof(InRvous),"rigid/small:inbuf"); + auto inbuf = (InRvous *) memory->smalloc(ncount*sizeof(InRvous),"rigid/small:inbuf"); // setup buf to pass to rendezvous comm // one BodyMsg datum for each constituent atom @@ -1607,7 +1606,7 @@ void FixRigidSmall::create_bodies(tagint *bodyID) 0,proclist, rendezvous_body,0,buf,sizeof(OutRvous), (void *) this); - OutRvous *outbuf = (OutRvous *) buf; + auto outbuf = (OutRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1649,7 +1648,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf, double *x,*xown,*rsqclose; double **bbox,**ctr; - FixRigidSmall *frsptr = (FixRigidSmall *) ptr; + auto frsptr = (FixRigidSmall *) ptr; Memory *memory = frsptr->memory; Error *error = frsptr->error; MPI_Comm world = frsptr->world; @@ -1661,7 +1660,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf, // key = body ID // value = index into Ncount-length data structure - InRvous *in = (InRvous *) inbuf; + auto in = (InRvous *) inbuf; std::map hash; tagint id; @@ -1756,8 +1755,7 @@ int FixRigidSmall::rendezvous_body(int n, char *inbuf, int nout = n; memory->create(proclist,nout,"rigid/small:proclist"); - OutRvous *out = (OutRvous *) - memory->smalloc(nout*sizeof(OutRvous),"rigid/small:out"); + auto out = (OutRvous *) memory->smalloc(nout*sizeof(OutRvous),"rigid/small:out"); for (i = 0; i < nout; i++) { proclist[i] = in[i].me; @@ -2499,7 +2497,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (nlines == 0) return; else if (nlines < 0) error->all(FLERR,"Fix rigid infile has incorrect format"); - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; int nread = 0; while (nread < nlines) { nchunk = MIN(nlines-nread,CHUNK); diff --git a/src/RIGID/fix_rigid_small.h b/src/RIGID/fix_rigid_small.h index 1a5f224d58..e669867e1b 100644 --- a/src/RIGID/fix_rigid_small.h +++ b/src/RIGID/fix_rigid_small.h @@ -220,136 +220,3 @@ class FixRigidSmall : public Fix { #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: Fix rigid/small requires atom attribute molecule - -Self-explanatory. - -E: Fix rigid/small custom requires previously defined property/atom - -UNDOCUMENTED - -E: Fix rigid/small custom requires integer-valued property/atom - -UNDOCUMENTED - -E: Variable name for fix rigid/small custom does not exist - -UNDOCUMENTED - -E: Fix rigid/small custom variable is no atom-style variable - -UNDOCUMENTED - -E: Unsupported fix rigid custom property - -UNDOCUMENTED - -E: Fix rigid/small requires an atom map, see atom_modify - -Self-explanatory. - -E: Fix rigid/small langevin period must be > 0.0 - -Self-explanatory. - -E: Molecule template ID for fix rigid/small does not exist - -Self-explanatory. - -E: Fix rigid/small nvt/npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Fix rigid/small molecule must have coordinates - -The defined molecule does not specify coordinates. - -E: Fix rigid/small molecule must have atom types - -The defined molecule does not specify atom types. - -W: More than one fix rigid - -It is not efficient to use fix rigid more than once. - -E: Rigid fix must come before NPT/NPH fix - -NPT/NPH fix must be defined in input script after all rigid fixes, -else the rigid fix contribution to the pressure virial is -incorrect. - -W: Cannot count rigid body degrees-of-freedom before bodies are fully initialized - -This means the temperature associated with the rigid bodies may be -incorrect on this timestep. - -W: Computing temperature of portions of rigid bodies - -The group defined by the temperature compute does not encompass all -the atoms in one or more rigid bodies, so the change in -degrees-of-freedom for the atoms in those partial rigid bodies will -not be accounted for. - -E: Fix rigid/small atom has non-zero image flag in a non-periodic dimension - -Image flags for non-periodic dimensions should not be set. - -E: One or more rigid bodies are a single particle - -Self-explanatory. - -E: Inconsistent use of finite-size particles by molecule template molecules - -Not all of the molecules define a radius for their constituent -particles. - -E: Insufficient Jacobi rotations for rigid body - -Eigensolve for rigid body was not sufficiently accurate. - -E: Fix rigid: Bad principal moments - -The principal moments of inertia computed for a rigid body -are not within the required tolerances. - -E: Cannot open fix rigid/small inpfile %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Unexpected end of fix rigid/small file - -A read operation from the file failed. - -E: Incorrect rigid body format in fix rigid/small file - -The number of fields per line is not what expected. - -E: Invalid rigid body ID in fix rigid/small file - -The ID does not match the number of an existing ID of rigid bodies -that are defined by the fix rigid/small command. - -E: Cannot open fix rigid restart file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Rigid body atoms %d %d missing on proc %d at step %ld - -This means that an atom cannot find the atom that owns the rigid body -it is part of, or vice versa. The solution is to use the communicate -cutoff command to insure ghost atoms are acquired from far enough away -to encompass the max distance printed when the fix rigid/small command -was invoked. - -*/ diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index f012789414..d74f72fb69 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -367,10 +367,10 @@ void FixShake::init() if (utils::strmatch(update->integrate_style,"^respa")) { if (update->whichflag > 0) { auto fixes = modify->get_fix_by_style("^RESPA"); - if (fixes.size() > 0) fix_respa = (FixRespa *) fixes.front(); + if (fixes.size() > 0) fix_respa = dynamic_cast( fixes.front()); else error->all(FLERR,"Run style respa did not create fix RESPA"); } - Respa *respa_style = (Respa *) update->integrate; + auto respa_style = dynamic_cast( update->integrate); nlevels_respa = respa_style->nlevels; loop_respa = respa_style->loop; step_respa = respa_style->step; @@ -1035,8 +1035,7 @@ void FixShake::atom_owners() int *proclist; memory->create(proclist,nlocal,"shake:proclist"); - IDRvous *idbuf = (IDRvous *) - memory->smalloc((bigint) nlocal*sizeof(IDRvous),"shake:idbuf"); + auto idbuf = (IDRvous *) memory->smalloc((bigint) nlocal*sizeof(IDRvous),"shake:idbuf"); // setup input buf to rendezvous comm // input datums = pairs of bonded atoms @@ -1085,8 +1084,7 @@ void FixShake::partner_info(int *npartner, tagint **partner_tag, int *proclist; memory->create(proclist,nsend,"special:proclist"); - PartnerInfo *inbuf = (PartnerInfo *) - memory->smalloc((bigint) nsend*sizeof(PartnerInfo),"special:inbuf"); + auto inbuf = (PartnerInfo *) memory->smalloc((bigint) nsend*sizeof(PartnerInfo),"special:inbuf"); // set values in 4 partner arrays for all partner atoms I own // also setup input buf to rendezvous comm @@ -1164,7 +1162,7 @@ void FixShake::partner_info(int *npartner, tagint **partner_tag, rendezvous_partners_info, 0,buf,sizeof(PartnerInfo), (void *) this); - PartnerInfo *outbuf = (PartnerInfo *) buf; + auto outbuf = (PartnerInfo *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1214,8 +1212,7 @@ void FixShake::nshake_info(int *npartner, tagint **partner_tag, int *proclist; memory->create(proclist,nsend,"special:proclist"); - NShakeInfo *inbuf = (NShakeInfo *) - memory->smalloc((bigint) nsend*sizeof(NShakeInfo),"special:inbuf"); + auto inbuf = (NShakeInfo *) memory->smalloc((bigint) nsend*sizeof(NShakeInfo),"special:inbuf"); // set partner_nshake for all partner atoms I own // also setup input buf to rendezvous comm @@ -1252,7 +1249,7 @@ void FixShake::nshake_info(int *npartner, tagint **partner_tag, 0,proclist, rendezvous_nshake,0,buf,sizeof(NShakeInfo), (void *) this); - NShakeInfo *outbuf = (NShakeInfo *) buf; + auto outbuf = (NShakeInfo *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1293,8 +1290,7 @@ void FixShake::shake_info(int *npartner, tagint **partner_tag, int *proclist; memory->create(proclist,nsend,"special:proclist"); - ShakeInfo *inbuf = (ShakeInfo *) - memory->smalloc((bigint) nsend*sizeof(ShakeInfo),"special:inbuf"); + auto inbuf = (ShakeInfo *) memory->smalloc((bigint) nsend*sizeof(ShakeInfo),"special:inbuf"); // set 3 shake arrays for all partner atoms I own // also setup input buf to rendezvous comm @@ -1345,7 +1341,7 @@ void FixShake::shake_info(int *npartner, tagint **partner_tag, 0,proclist, rendezvous_shake,0,buf,sizeof(ShakeInfo), (void *) this); - ShakeInfo *outbuf = (ShakeInfo *) buf; + auto outbuf = (ShakeInfo *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1377,7 +1373,7 @@ int FixShake::rendezvous_ids(int n, char *inbuf, int &flag, int *& /*proclist*/, char *& /*outbuf*/, void *ptr) { - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Memory *memory = fsptr->memory; tagint *atomIDs; @@ -1386,7 +1382,7 @@ int FixShake::rendezvous_ids(int n, char *inbuf, memory->create(atomIDs,n,"special:atomIDs"); memory->create(procowner,n,"special:procowner"); - IDRvous *in = (IDRvous *) inbuf; + auto in = (IDRvous *) inbuf; for (int i = 0; i < n; i++) { atomIDs[i] = in[i].atomID; @@ -1417,7 +1413,7 @@ int FixShake::rendezvous_partners_info(int n, char *inbuf, { int i,m; - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Atom *atom = fsptr->atom; Memory *memory = fsptr->memory; @@ -1437,7 +1433,7 @@ int FixShake::rendezvous_partners_info(int n, char *inbuf, // proclist = owner of atomID in caller decomposition // outbuf = info about owned atomID = 4 values - PartnerInfo *in = (PartnerInfo *) inbuf; + auto in = (PartnerInfo *) inbuf; int *procowner = fsptr->procowner; memory->create(proclist,n,"shake:proclist"); @@ -1472,7 +1468,7 @@ int FixShake::rendezvous_nshake(int n, char *inbuf, { int i,m; - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Atom *atom = fsptr->atom; Memory *memory = fsptr->memory; @@ -1492,7 +1488,7 @@ int FixShake::rendezvous_nshake(int n, char *inbuf, // proclist = owner of atomID in caller decomposition // outbuf = info about owned atomID - NShakeInfo *in = (NShakeInfo *) inbuf; + auto in = (NShakeInfo *) inbuf; int *procowner = fsptr->procowner; memory->create(proclist,n,"shake:proclist"); @@ -1526,7 +1522,7 @@ int FixShake::rendezvous_shake(int n, char *inbuf, { int i,m; - FixShake *fsptr = (FixShake *) ptr; + auto fsptr = (FixShake *) ptr; Atom *atom = fsptr->atom; Memory *memory = fsptr->memory; @@ -1546,7 +1542,7 @@ int FixShake::rendezvous_shake(int n, char *inbuf, // proclist = owner of atomID in caller decomposition // outbuf = info about owned atomID - ShakeInfo *in = (ShakeInfo *) inbuf; + auto in = (ShakeInfo *) inbuf; int *procowner = fsptr->procowner; memory->create(proclist,n,"shake:proclist"); @@ -2564,8 +2560,7 @@ void FixShake::stats() if (me == 0) { const int width = log10((MAX(MAX(1,nb),na)))+2; - auto mesg = fmt::format("SHAKE stats (type/ave/delta/count) on step {}\n", - update->ntimestep); + auto mesg = fmt::format("SHAKE stats (type/ave/delta/count) on step {}\n", update->ntimestep); for (i = 1; i < nb; i++) { const auto bcnt = b_count_all[i]; if (bcnt) @@ -3031,9 +3026,9 @@ void FixShake::shake_end_of_step(int vflag) { // apply correction to all rRESPA levels for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); FixShake::post_force_respa(vflag,ilevel,loop_respa[ilevel]-1); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } if (!rattle) dtf_inner = step_respa[0] * force->ftm2v; } diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index 677cdfa942..12e24fb350 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -108,10 +108,11 @@ class FixShake : public Fix { int nlist, maxlist; // size and max-size of list // stat quantities - int *b_count, *b_count_all, *b_atom, *b_atom_all; // counts for each bond type, atoms in bond cluster - double *b_ave, *b_max, *b_min; // ave/max/min dist for each bond type - double *b_ave_all, *b_max_all, *b_min_all; // MPI summing arrays - int *a_count, *a_count_all; // ditto for angle types + int *b_count, *b_count_all, *b_atom, + *b_atom_all; // counts for each bond type, atoms in bond cluster + double *b_ave, *b_max, *b_min; // ave/max/min dist for each bond type + double *b_ave_all, *b_max_all, *b_min_all; // MPI summing arrays + int *a_count, *a_count_all; // ditto for angle types double *a_ave, *a_max, *a_min; double *a_ave_all, *a_max_all, *a_min_all; @@ -176,125 +177,3 @@ class FixShake : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot use fix shake with non-molecular system - -Your choice of atom style does not have bonds. - -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: Invalid bond type index for fix shake - -Self-explanatory. Check the fix shake command in the input script. - -E: Invalid angle type index for fix shake - -Self-explanatory. - -E: Invalid atom type index for fix shake - -Atom types must range from 1 to Ntypes inclusive. - -E: Invalid atom mass for fix shake - -Mass specified in fix shake command must be > 0.0. - -E: Too many masses for fix shake - -The fix shake command cannot list more masses than there are atom -types. - -E: Molecule template ID for fix shake does not exist - -Self-explanatory. - -W: Molecule template for fix shake has multiple molecules - -The fix shake command will only recognize molecules of a single -type, i.e. the first molecule in the template. - -E: Fix shake molecule template must have shake info - -The defined molecule does not specify SHAKE information. - -E: More than one fix shake - -Only one fix shake can be defined. - -E: Fix shake cannot be used with minimization - -Cannot use fix shake while doing an energy minimization since -it turns off bonds that should contribute to the energy. - -E: Shake fix must come before NPT/NPH fix - -NPT fix must be defined in input script after SHAKE fix, else the -SHAKE fix contribution to the pressure virial is incorrect. - -E: Bond potential must be defined for SHAKE - -Cannot use fix shake unless bond potential is defined. - -E: Angle potential must be defined for SHAKE - -When shaking angles, an angle_style potential must be used. - -E: Shake angles have different bond types - -All 3-atom angle-constrained SHAKE clusters specified by the fix shake -command that are the same angle type, must also have the same bond -types for the 2 bonds in the angle. - -E: Shake atoms %d %d missing on proc %d at step %ld - -The 2 atoms in a single shake cluster specified by the fix shake -command are not all accessible to a processor. This probably means -an atom has moved too far. - -E: Shake atoms %d %d %d missing on proc %d at step %ld - -The 3 atoms in a single shake cluster specified by the fix shake -command are not all accessible to a processor. This probably means -an atom has moved too far. - -E: Shake atoms %d %d %d %d missing on proc %d at step %ld - -The 4 atoms in a single shake cluster specified by the fix shake -command are not all accessible to a processor. This probably means -an atom has moved too far. - -E: Did not find fix shake partner info - -Could not find bond partners implied by fix shake command. This error -can be triggered if the delete_bonds command was used before fix -shake, and it removed bonds without resetting the 1-2, 1-3, 1-4 -weighting list via the special keyword. - -E: Shake cluster of more than 4 atoms - -A single cluster specified by the fix shake command can have no more -than 4 atoms. - -E: Shake clusters are connected - -A single cluster specified by the fix shake command must have a single -central atom with up to 3 other atoms bonded to it. - -W: Shake determinant < 0.0 - -The determinant of the quadratic equation being solved for a single -cluster specified by the fix shake command is numerically suspect. LAMMPS -will set it to 0.0 and continue. - -E: Shake determinant = 0.0 - -The determinant of the matrix being solved for a single cluster -specified by the fix shake command is numerically invalid. - -*/ diff --git a/src/SCAFACOS/scafacos.h b/src/SCAFACOS/scafacos.h index 0ea0008c19..2d6cf0b1d4 100644 --- a/src/SCAFACOS/scafacos.h +++ b/src/SCAFACOS/scafacos.h @@ -68,7 +68,3 @@ class Scafacos : public KSpace { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 38bba33adf..63a3d8c839 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -264,8 +264,8 @@ int FixAppendAtoms::get_spatial() else failed = 0; count++; } - double *pos = new double[count-2]; - double *val = new double[count-2]; + auto pos = new double[count-2]; + auto val = new double[count-2]; for (int loop=0; loop < count-2; loop++) { pos[loop] = fix->compute_vector(2*loop); val[loop] = fix->compute_vector(2*loop+1); diff --git a/src/SHOCK/fix_append_atoms.h b/src/SHOCK/fix_append_atoms.h index 41c14a2c20..d2118c1975 100644 --- a/src/SHOCK/fix_append_atoms.h +++ b/src/SHOCK/fix_append_atoms.h @@ -55,54 +55,3 @@ class FixAppendAtoms : public Fix { #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: Fix append/atoms requires a lattice be defined - -Use the lattice command for this purpose. - -E: Only zhi currently implemented for fix append/atoms - -Self-explanatory. - -E: Append boundary must be shrink/minimum - -The boundary style of the face where atoms are added -must be of type m (shrink/minimum). - -E: Bad fix ID in fix append/atoms command - -The value of the fix_id for keyword spatial must start with 'f_'. - -E: Invalid basis setting in fix append/atoms command - -The basis index must be between 1 to N where N is the number of basis -atoms in the lattice. The type index must be between 1 to N where N -is the number of atom types. - -E: Cannot use append/atoms in periodic dimension - -The boundary style of the face where atoms are added can not be of -type p (periodic). - -E: Cannot append atoms to a triclinic box - -The simulation box must be defined with edges aligned with the -Cartesian axes. - -E: Fix ID for fix ave/spatial does not exist - -Self-explanatory. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -*/ diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index ae1d0f4cd5..35010fc31c 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -302,7 +302,7 @@ void FixMSST::init() if (dftb) { for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^external$")) - fix_external = (FixExternal *) modify->fix[i]; + fix_external = dynamic_cast( modify->fix[i]); if (fix_external == nullptr) error->all(FLERR,"Fix msst dftb cannot be used w/out fix external"); } @@ -815,7 +815,7 @@ void FixMSST::write_restart(FILE *fp) void FixMSST::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; omega[direction] = list[n++]; e0 = list[n++]; v0 = list[n++]; diff --git a/src/SHOCK/fix_msst.h b/src/SHOCK/fix_msst.h index 98b47c60f6..96cf8e0e96 100644 --- a/src/SHOCK/fix_msst.h +++ b/src/SHOCK/fix_msst.h @@ -112,68 +112,3 @@ class FixMSST : public Fix { #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: Fix msst tscale must satisfy 0 <= tscale < 1 - -Self-explanatory. - -E: Fix msst requires a periodic box - -Self-explanatory. - -E: Cannot use fix msst without per-type mass defined - -Self-explanatory. - -E: Could not find fix msst compute ID - -Self-explanatory. - -E: Fix msst compute ID does not compute temperature - -Self-explanatory. - -E: Fix msst compute ID does not compute pressure - -Self-explanatory. - -E: Fix msst compute ID does not compute potential energy - -Self-explanatory. - -E: Fix msst dftb cannot be used w/out fix external - -UNDOCUMENTED - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for MSST is not for group all - -User-assigned temperature to MSST fix does not compute temperature for -all atoms. Since MSST computes a global pressure, the kinetic energy -contribution from the temperature is assumed to also be for all atoms. -Thus the pressure used by MSST could be inaccurate. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index ff1025c840..46a3ccf0ef 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -395,7 +395,7 @@ int FixNPHug::size_restart_global() void FixNPHug::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; e0 = list[n++]; v0 = list[n++]; p0 = list[n++]; diff --git a/src/SHOCK/fix_nphug.h b/src/SHOCK/fix_nphug.h index 9c67b070d3..80972b5aa2 100644 --- a/src/SHOCK/fix_nphug.h +++ b/src/SHOCK/fix_nphug.h @@ -59,39 +59,3 @@ class FixNPHug : public FixNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Pstart and Pstop must have the same value - -Self-explanatory. - -E: Specified target stress must be uniaxial or hydrostatic - -Self-explanatory. - -E: For triclinic deformation, specified target stress must be hydrostatic - -Triclinic pressure control is allowed using the tri keyword, but -non-hydrostatic pressure control can not be used in this case. - -E: Temperature control must be used with fix nphug - -The temp keyword must be provided. - -E: Pressure control must be used with fix nphug - -A pressure control keyword (iso, aniso, tri, x, y, or z) must be -provided. - -E: Potential energy ID for fix nvt/nph/npt does not exist - -A compute for potential energy must be defined. - -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. - -*/ diff --git a/src/SHOCK/fix_wall_piston.h b/src/SHOCK/fix_wall_piston.h index 3e9f73fd94..3c6908840a 100644 --- a/src/SHOCK/fix_wall_piston.h +++ b/src/SHOCK/fix_wall_piston.h @@ -47,34 +47,3 @@ class FixWallPiston : public Fix { #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: Fix wall/piston command only available at zlo - -The face keyword must be zlo. - -E: Must shrink-wrap piston boundary - -The boundary style of the face where the piston is applied must be of -type s (shrink-wrapped). - -E: Illegal fix wall/piston velocity - -The piston velocity must be positive. - -E: Cannot use wall in periodic dimension - -Self-explanatory. - -E: NL ramp in wall/piston only implemented in zlo for now - -The ramp keyword can only be used for piston applied to face zlo. - -*/ diff --git a/src/SPH/atom_vec_sph.cpp b/src/SPH/atom_vec_sph.cpp index 46f9d828e8..a26967a57b 100644 --- a/src/SPH/atom_vec_sph.cpp +++ b/src/SPH/atom_vec_sph.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -16,8 +15,6 @@ #include "atom.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -38,18 +35,18 @@ AtomVecSPH::AtomVecSPH(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "rho drho esph desph cv vest"; - fields_copy = (char *) "rho drho esph desph cv vest"; - fields_comm = (char *) "rho esph vest"; - fields_comm_vel = (char *) "rho esph vest"; - fields_reverse = (char *) "drho desph"; - fields_border = (char *) "rho esph cv vest"; - fields_border_vel = (char *) "rho esph cv vest"; - fields_exchange = (char *) "rho esph cv vest"; - fields_restart = (char * ) "rho esph cv vest"; - fields_create = (char *) "rho esph cv vest desph drho"; - fields_data_atom = (char *) "id type rho esph cv x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"rho", "drho", "esph", "desph", "cv", "vest"}; + fields_copy = {"rho", "drho", "esph", "desph", "cv", "vest"}; + fields_comm = {"rho", "esph", "vest"}; + fields_comm_vel = {"rho", "esph", "vest"}; + fields_reverse = {"drho", "desph"}; + fields_border = {"rho", "esph", "cv", "vest"}; + fields_border_vel = {"rho", "esph", "cv", "vest"}; + fields_exchange = {"rho", "esph", "cv", "vest"}; + fields_restart = {"rho", "esph", "cv", "vest"}; + fields_create = {"rho", "esph", "cv", "vest", "desph", "drho"}; + fields_data_atom = {"id", "type", "rho", "esph", "cv", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -76,8 +73,8 @@ void AtomVecSPH::grow_pointers() void AtomVecSPH::force_clear(int n, size_t nbytes) { - memset(&desph[n],0,nbytes); - memset(&drho[n],0,nbytes); + memset(&desph[n], 0, nbytes); + memset(&drho[n], 0, nbytes); } /* ---------------------------------------------------------------------- @@ -108,13 +105,13 @@ void AtomVecSPH::data_atom_post(int ilocal) return -1 if name is unknown to this atom style ------------------------------------------------------------------------- */ -int AtomVecSPH::property_atom(char *name) +int AtomVecSPH::property_atom(const std::string &name) { - if (strcmp(name,"rho") == 0) return 0; - if (strcmp(name,"drho") == 0) return 1; - if (strcmp(name,"esph") == 0) return 2; - if (strcmp(name,"desph") == 0) return 3; - if (strcmp(name,"cv") == 0) return 4; + if (name == "rho") return 0; + if (name == "drho") return 1; + if (name == "esph") return 2; + if (name == "desph") return 3; + if (name == "cv") return 4; return -1; } @@ -123,8 +120,7 @@ int AtomVecSPH::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecSPH::pack_property_atom(int index, double *buf, - int nvalues, int groupbit) +void AtomVecSPH::pack_property_atom(int index, double *buf, int nvalues, int groupbit) { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -132,32 +128,42 @@ void AtomVecSPH::pack_property_atom(int index, double *buf, if (index == 0) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = rho[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = rho[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 1) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = drho[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = drho[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 2) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = esph[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = esph[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 3) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = desph[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = desph[i]; + else + buf[n] = 0.0; n += nvalues; } } else if (index == 4) { for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) buf[n] = cv[i]; - else buf[n] = 0.0; + if (mask[i] & groupbit) + buf[n] = cv[i]; + else + buf[n] = 0.0; n += nvalues; } } diff --git a/src/SPH/atom_vec_sph.h b/src/SPH/atom_vec_sph.h index 8af3ac2fc3..18d82d76de 100644 --- a/src/SPH/atom_vec_sph.h +++ b/src/SPH/atom_vec_sph.h @@ -32,7 +32,7 @@ class AtomVecSPH : public AtomVec { void force_clear(int, size_t) override; void create_atom_post(int) override; void data_atom_post(int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; private: diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 4f3d0a3aab..209704fef8 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator @@ -25,10 +24,11 @@ ------------------------------------------------------------------------- */ #include "atom_vec_spin.h" -#include -#include + #include "atom.h" +#include + using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -46,18 +46,18 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "sp fm fm_long"; - fields_copy = (char *) "sp"; - fields_comm = (char *) "sp"; - fields_comm_vel = (char *) "sp"; - fields_reverse = (char *) "fm fm_long"; - fields_border = (char *) "sp"; - fields_border_vel = (char *) "sp"; - fields_exchange = (char *) "sp"; - fields_restart = (char *) "sp"; - fields_create = (char *) "sp"; - fields_data_atom = (char *) "id type x sp"; - fields_data_vel = (char *) "id v"; + fields_grow = {"sp", "fm", "fm_long"}; + fields_copy = {"sp"}; + fields_comm = {"sp"}; + fields_comm_vel = {"sp"}; + fields_reverse = {"fm", "fm_long"}; + fields_border = {"sp"}; + fields_border_vel = {"sp"}; + fields_exchange = {"sp"}; + fields_restart = {"sp"}; + fields_create = {"sp"}; + fields_data_atom = {"id", "type", "x", "sp"}; + fields_data_vel = {"id", "v"}; setup_fields(); } @@ -82,8 +82,8 @@ void AtomVecSpin::grow_pointers() void AtomVecSpin::force_clear(int n, size_t nbytes) { - memset(&fm[n][0],0,3*nbytes); - memset(&fm_long[n][0],0,3*nbytes); + memset(&fm[n][0], 0, 3 * nbytes); + memset(&fm_long[n][0], 0, 3 * nbytes); } /* ---------------------------------------------------------------------- @@ -94,8 +94,7 @@ void AtomVecSpin::force_clear(int n, size_t nbytes) void AtomVecSpin::data_atom_post(int ilocal) { double *sp_one = sp[ilocal]; - double norm = - 1.0/sqrt(sp_one[0]*sp_one[0] + sp_one[1]*sp_one[1] + sp_one[2]*sp_one[2]); + double norm = 1.0 / sqrt(sp_one[0] * sp_one[0] + sp_one[1] * sp_one[1] + sp_one[2] * sp_one[2]); sp_one[0] *= norm; sp_one[1] *= norm; sp_one[2] *= norm; diff --git a/src/SPIN/atom_vec_spin.h b/src/SPIN/atom_vec_spin.h index de376475ea..c6ce33a10e 100644 --- a/src/SPIN/atom_vec_spin.h +++ b/src/SPIN/atom_vec_spin.h @@ -40,7 +40,3 @@ class AtomVecSpin : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 174cec7d59..a6dfdf79d2 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -84,7 +84,7 @@ void ComputeSpin::init() // loop 1: obtain # of Pairs, and # of Pair/Spin styles - PairHybrid *hybrid = (PairHybrid *)force->pair_match("^hybrid",0); + PairHybrid *hybrid = dynamic_cast(force->pair_match("^hybrid",0)); if (force->pair_match("^spin",0,0)) { // only one Pair/Spin style pair = force->pair_match("^spin",0,0); if (hybrid == nullptr) npairs = 1; @@ -112,11 +112,11 @@ void ComputeSpin::init() int count = 0; if (npairspin == 1) { count = 1; - spin_pairs[0] = (PairSpin *) force->pair_match("^spin",0,0); + spin_pairs[0] = dynamic_cast( force->pair_match("^spin",0,0)); } else if (npairspin > 1) { for (int i = 0; ipair_match("^spin",0,i)) { - spin_pairs[count] = (PairSpin *) force->pair_match("^spin",0,i); + spin_pairs[count] = dynamic_cast( force->pair_match("^spin",0,i)); count++; } } @@ -141,7 +141,7 @@ void ComputeSpin::init() for (iforce = 0; iforce < modify->nfix; iforce++) { if (utils::strmatch(modify->fix[iforce]->style,"^precession/spin")) { precession_spin_flag = 1; - lockprecessionspin = (FixPrecessionSpin *) modify->fix[iforce]; + lockprecessionspin = dynamic_cast( modify->fix[iforce]); } } } diff --git a/src/SPIN/compute_spin.h b/src/SPIN/compute_spin.h index 7f85053c0c..1bcebfec67 100644 --- a/src/SPIN/compute_spin.h +++ b/src/SPIN/compute_spin.h @@ -55,21 +55,3 @@ class ComputeSpin : public Compute { #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: Chunk/atom compute does not exist for compute compute/spin - -Self-explanatory. - -E: Compute compute/spin does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 7d9af83d12..a29ce8aa2c 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -119,9 +119,9 @@ void FixLangevinSpin::init() void FixLangevinSpin::setup(int vflag) { if (utils::strmatch(update->integrate_style,"^respa")) { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } else post_force(vflag); } diff --git a/src/SPIN/fix_langevin_spin.h b/src/SPIN/fix_langevin_spin.h index d5262fae64..478ad09c94 100644 --- a/src/SPIN/fix_langevin_spin.h +++ b/src/SPIN/fix_langevin_spin.h @@ -53,52 +53,3 @@ class FixLangevinSpin : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal langevin/spin 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: Fix langevin period must be > 0.0 - -The time window for temperature relaxation must be > 0 - -W: Energy tally does not account for 'zero yes' - -The energy removed by using the 'zero yes' flag is not accounted -for in the energy tally and thus energy conservation cannot be -monitored in this case. - - -E: Variable for fix langevin is invalid style - -It must be an equal-style variable. - - -E: Cannot zero Langevin force of 0 atoms - -The group has zero atoms, so you cannot request its force -be zeroed. - -E: Fix langevin variable returned negative temperature - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/SPIN/fix_neb_spin.h b/src/SPIN/fix_neb_spin.h index 79fbdf454d..86e633b3b2 100644 --- a/src/SPIN/fix_neb_spin.h +++ b/src/SPIN/fix_neb_spin.h @@ -83,29 +83,3 @@ class FixNEBSpin : public Fix { #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: Potential energy ID for fix neb does not exist - -Self-explanatory. - -E: Too many active GNEB atoms - -UNDOCUMENTED - -E: Too many atoms for GNEB - -UNDOCUMENTED - -U: Atom count changed in fix neb - -This is not allowed in a GNEB calculation. - -*/ diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 970af9c4fb..062f3c1b00 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -178,7 +178,7 @@ void FixNVESpin::init() // loop 1: obtain # of Pairs, and # of Pair/Spin styles npairspin = 0; - PairHybrid *hybrid = (PairHybrid *)force->pair_match("^hybrid",0); + PairHybrid *hybrid = dynamic_cast(force->pair_match("^hybrid",0)); if (force->pair_match("^spin",0,0)) { // only one Pair/Spin style pair = force->pair_match("^spin",0,0); if (hybrid == nullptr) npairs = 1; @@ -206,11 +206,11 @@ void FixNVESpin::init() int count1 = 0; if (npairspin == 1) { count1 = 1; - spin_pairs[0] = (PairSpin *) force->pair_match("^spin",0,0); + spin_pairs[0] = dynamic_cast( force->pair_match("^spin",0,0)); } else if (npairspin > 1) { for (int i = 0; ipair_match("^spin",0,i)) { - spin_pairs[count1] = (PairSpin *) force->pair_match("^spin",0,i); + spin_pairs[count1] = dynamic_cast( force->pair_match("^spin",0,i)); count1++; } } @@ -254,7 +254,7 @@ void FixNVESpin::init() for (iforce = 0; iforce < modify->nfix; iforce++) { if (utils::strmatch(modify->fix[iforce]->style,"^precession/spin")) { precession_spin_flag = 1; - lockprecessionspin[count2] = (FixPrecessionSpin *) modify->fix[iforce]; + lockprecessionspin[count2] = dynamic_cast( modify->fix[iforce]); count2++; } } @@ -287,7 +287,7 @@ void FixNVESpin::init() for (iforce = 0; iforce < modify->nfix; iforce++) { if (utils::strmatch(modify->fix[iforce]->style,"^langevin/spin")) { maglangevin_flag = 1; - locklangevinspin[count2] = (FixLangevinSpin *) modify->fix[iforce]; + locklangevinspin[count2] = dynamic_cast( modify->fix[iforce]); count2++; } } @@ -301,7 +301,7 @@ void FixNVESpin::init() for (iforce = 0; iforce < modify->nfix; iforce++) { if (utils::strmatch(modify->fix[iforce]->style,"^setforce/spin")) { setforce_spin_flag = 1; - locksetforcespin = (FixSetForceSpin *) modify->fix[iforce]; + locksetforcespin = dynamic_cast( modify->fix[iforce]); } } diff --git a/src/SPIN/fix_nve_spin.h b/src/SPIN/fix_nve_spin.h index b468f60fc0..d1b03b2518 100644 --- a/src/SPIN/fix_nve_spin.h +++ b/src/SPIN/fix_nve_spin.h @@ -100,22 +100,3 @@ class FixNVESpin : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal fix NVE/spin 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: Pair spin requires atom attribute spin - -An atom/spin style with this attribute is needed. - -E: Illegal sectoring operation - -The number of processes does not match the size of the system. -See the documentation of the sectoring method. - -*/ diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index 44cb6e1071..6f4bc10b87 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -273,7 +273,7 @@ void FixPrecessionSpin::init() K6h = K6/hbar; if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -305,9 +305,9 @@ void FixPrecessionSpin::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/SPIN/fix_precession_spin.h b/src/SPIN/fix_precession_spin.h index 96c369b43a..cd891f8670 100644 --- a/src/SPIN/fix_precession_spin.h +++ b/src/SPIN/fix_precession_spin.h @@ -128,16 +128,3 @@ class FixPrecessionSpin : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal precession/spin 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. - -precession/spin fix command has 7 arguments: -fix ID group precession/spin magnitude (T or eV) style (zeeman or anisotropy) -direction (3 cartesian coordinates) -*/ diff --git a/src/SPIN/fix_setforce_spin.cpp b/src/SPIN/fix_setforce_spin.cpp index 73acb45920..a88a84f0bb 100644 --- a/src/SPIN/fix_setforce_spin.cpp +++ b/src/SPIN/fix_setforce_spin.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -23,24 +22,26 @@ ------------------------------------------------------------------------- */ #include "fix_setforce_spin.h" + #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 "modify.h" +#include "region.h" +#include "update.h" +#include "variable.h" using namespace LAMMPS_NS; using namespace FixConst; -enum{NONE,CONSTANT,EQUAL,ATOM}; +enum { NONE, CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ -FixSetForceSpin::FixSetForceSpin(LAMMPS *lmp, int narg, char **arg) : - FixSetForce(lmp, narg, arg) {} +FixSetForceSpin::FixSetForceSpin(LAMMPS *_lmp, int narg, char **arg) : FixSetForce(_lmp, narg, arg) +{ +} /* ---------------------------------------------------------------------- */ @@ -53,18 +54,14 @@ void FixSetForceSpin::post_force(int /*vflag*/) // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // reallocate sforce array if necessary if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); - memory->create(sforce,maxatom,3,"setforce:sforce"); + memory->create(sforce, maxatom, 3, "setforce:sforce"); } foriginal[0] = foriginal[1] = foriginal[2] = 0.0; @@ -73,7 +70,7 @@ void FixSetForceSpin::post_force(int /*vflag*/) if (varflag == CONSTANT) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal[0] += fm[i][0]; foriginal[1] += fm[i][1]; foriginal[2] += fm[i][2]; @@ -82,36 +79,45 @@ void FixSetForceSpin::post_force(int /*vflag*/) if (zstyle) fm[i][2] = zvalue; } - // variable force, wrap with clear/add + // variable force, wrap with clear/add } else { modify->clearstep_compute(); - if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar); + if (xstyle == EQUAL) + xvalue = input->variable->compute_equal(xvar); else if (xstyle == ATOM) - input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0); - if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar); + input->variable->compute_atom(xvar, igroup, &sforce[0][0], 3, 0); + if (ystyle == EQUAL) + yvalue = input->variable->compute_equal(yvar); else if (ystyle == ATOM) - input->variable->compute_atom(yvar,igroup,&sforce[0][1],3,0); - if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar); + input->variable->compute_atom(yvar, igroup, &sforce[0][1], 3, 0); + if (zstyle == EQUAL) + zvalue = input->variable->compute_equal(zvar); else if (zstyle == ATOM) - input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0); + input->variable->compute_atom(zvar, igroup, &sforce[0][2], 3, 0); modify->addstep_compute(update->ntimestep + 1); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal[0] += fm[i][0]; foriginal[1] += fm[i][1]; foriginal[2] += fm[i][2]; - if (xstyle == ATOM) fm[i][0] = sforce[i][0]; - else if (xstyle) fm[i][0] = xvalue; - if (ystyle == ATOM) fm[i][1] = sforce[i][1]; - else if (ystyle) fm[i][1] = yvalue; - if (zstyle == ATOM) fm[i][2] = sforce[i][2]; - else if (zstyle) fm[i][2] = zvalue; + if (xstyle == ATOM) + fm[i][0] = sforce[i][0]; + else if (xstyle) + fm[i][0] = xvalue; + if (ystyle == ATOM) + fm[i][1] = sforce[i][1]; + else if (ystyle) + fm[i][1] = yvalue; + if (zstyle == ATOM) + fm[i][2] = sforce[i][2]; + else if (zstyle) + fm[i][2] = zvalue; } } } @@ -125,18 +131,14 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3]) // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // reallocate sforce array if necessary if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); - memory->create(sforce,maxatom,3,"setforce:sforce"); + memory->create(sforce, maxatom, 3, "setforce:sforce"); } foriginal[0] = foriginal[1] = foriginal[2] = 0.0; @@ -146,7 +148,7 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3]) if (varflag == CONSTANT) { if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) return; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) return; foriginal[0] += fmi[0]; foriginal[1] += fmi[1]; foriginal[2] += fmi[2]; @@ -155,35 +157,44 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3]) if (zstyle) fmi[2] = zvalue; } - // variable force, wrap with clear/add + // variable force, wrap with clear/add } else { modify->clearstep_compute(); - if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar); + if (xstyle == EQUAL) + xvalue = input->variable->compute_equal(xvar); else if (xstyle == ATOM) - input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0); - if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar); + input->variable->compute_atom(xvar, igroup, &sforce[0][0], 3, 0); + if (ystyle == EQUAL) + yvalue = input->variable->compute_equal(yvar); else if (ystyle == ATOM) - input->variable->compute_atom(yvar,igroup,&sforce[0][1],3,0); - if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar); + input->variable->compute_atom(yvar, igroup, &sforce[0][1], 3, 0); + if (zstyle == EQUAL) + zvalue = input->variable->compute_equal(zvar); else if (zstyle == ATOM) - input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0); + input->variable->compute_atom(zvar, igroup, &sforce[0][2], 3, 0); modify->addstep_compute(update->ntimestep + 1); if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) return; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) return; foriginal[0] += fmi[0]; foriginal[1] += fmi[1]; foriginal[2] += fmi[2]; - if (xstyle == ATOM) fmi[0] = sforce[i][0]; - else if (xstyle) fmi[0] = xvalue; - if (ystyle == ATOM) fmi[1] = sforce[i][1]; - else if (ystyle) fmi[1] = yvalue; - if (zstyle == ATOM) fmi[2] = sforce[i][2]; - else if (zstyle) fmi[2] = zvalue; + if (xstyle == ATOM) + fmi[0] = sforce[i][0]; + else if (xstyle) + fmi[0] = xvalue; + if (ystyle == ATOM) + fmi[1] = sforce[i][1]; + else if (ystyle) + fmi[1] = yvalue; + if (zstyle == ATOM) + fmi[2] = sforce[i][2]; + else if (zstyle) + fmi[2] = zvalue; } } } @@ -194,13 +205,10 @@ void FixSetForceSpin::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); + if (ilevel == ilevel_respa) + post_force(vflag); else { - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); double **x = atom->x; double **fm = atom->fm; @@ -209,7 +217,7 @@ void FixSetForceSpin::post_force_respa(int vflag, int ilevel, int /*iloop*/) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; if (xstyle) fm[i][0] = 0.0; if (ystyle) fm[i][1] = 0.0; if (zstyle) fm[i][2] = 0.0; diff --git a/src/SPIN/fix_setforce_spin.h b/src/SPIN/fix_setforce_spin.h index bc018e02e5..b927d1bee3 100644 --- a/src/SPIN/fix_setforce_spin.h +++ b/src/SPIN/fix_setforce_spin.h @@ -36,30 +36,3 @@ class FixSetForceSpin : public FixSetForce { #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: Region ID for fix setforce does not exist - -Self-explanatory. - -E: Variable name for fix setforce does not exist - -Self-explanatory. - -E: Variable for fix setforce is invalid style - -Only equal-style variables can be used. - -E: Cannot use non-zero forces in an energy minimization - -Fix setforce cannot be used in this manner. Use fix addforce -instead. - -*/ diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 1fee0ace0d..692883fc0a 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -172,7 +172,7 @@ void NEBSpin::run() if (fixes.size() != 1) error->all(FLERR,"NEBSpin requires use of exactly one fix neb/spin instance"); - fneb = (FixNEBSpin *) fixes[0]; + fneb = dynamic_cast( fixes[0]); if (verbose) numall =7; else numall = 4; memory->create(all,nreplica,numall,"neb:all"); @@ -418,7 +418,7 @@ void NEBSpin::readfile(char *file, int flag) error->all(FLERR,"Incorrectly formatted NEB file"); } - char *buffer = new char[CHUNK*MAXLINE]; + auto buffer = new char[CHUNK*MAXLINE]; double fraction = ireplica/(nreplica-1.0); double **x = atom->x; double **sp = atom->sp; diff --git a/src/SPIN/neb_spin.h b/src/SPIN/neb_spin.h index b667215520..544d2c7c63 100644 --- a/src/SPIN/neb_spin.h +++ b/src/SPIN/neb_spin.h @@ -29,7 +29,7 @@ class NEBSpin : public Command { NEBSpin(class LAMMPS *); ~NEBSpin() override; void command(int, char **) override; // process neb/spin command - void run(); // run NEBSpin + void run(); // run NEBSpin double ebf, ebr; // forward and reverse energy barriers @@ -64,73 +64,3 @@ class NEBSpin : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: NEBSpin command before simulation box is defined - -Self-explanatory. - -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: Cannot use NEBSpin with a single replica - -Self-explanatory. - -E: Cannot use NEBSpin unless atom map exists - -Use the atom_modify command to create an atom map. - -E: NEBSpin requires use of fix neb - -Self-explanatory. - -E: NEBSpin requires damped dynamics minimizer - -Use a different minimization style. - -E: Too many timesteps for NEBSpin - -You must use a number of timesteps that fit in a 32-bit integer -for NEBSpin. - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -E: Unexpected end of neb/spin file - -A read operation from the file failed. - -E: Incorrect atom format in neb/spin file - -The number of fields per line is not what expected. - -E: Invalid atom IDs in neb/spin file - -An ID in the file was not found in the system. - -E: Cannot open gzipped file - -LAMMPS was compiled without support for reading and writing gzipped -files through a pipeline to the gzip program with -DLAMMPS_GZIP. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -U: Can only use NEBSpin with 1-processor replicas - -This is current restriction for NEBSpin as implemented in LAMMPS. - -U: Cannot use NEBSpin with atom_modify sort enabled - -This is current restriction for NEBSpin implemented in LAMMPS. - -*/ diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index c2fb771def..d236e910c7 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -96,7 +96,7 @@ void PairSpin::init_style() auto fixes = modify->get_fix_by_style("^nve/spin"); if (fixes.size() == 1) - lattice_flag = ((FixNVESpin *) fixes.front())->lattice_flag; + lattice_flag = (dynamic_cast( fixes.front()))->lattice_flag; else if (fixes.size() > 1) error->warning(FLERR,"Using multiple instances of fix nve/spin or neb/spin"); diff --git a/src/SPIN/pair_spin.h b/src/SPIN/pair_spin.h index 598d114ebd..03756236be 100644 --- a/src/SPIN/pair_spin.h +++ b/src/SPIN/pair_spin.h @@ -48,23 +48,3 @@ class PairSpin : public Pair { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_spin command - -Self-explanatory. - -E: Spin simulations require metal unit style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair spin requires atom attribute spin - -The atom style defined does not have these attributes. - -*/ diff --git a/src/SPIN/pair_spin_dipole_cut.h b/src/SPIN/pair_spin_dipole_cut.h index 2fe443e71e..dd21d68374 100644 --- a/src/SPIN/pair_spin_dipole_cut.h +++ b/src/SPIN/pair_spin_dipole_cut.h @@ -68,27 +68,3 @@ class PairSpinDipoleCut : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_style command - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dipole/long requires atom attributes q, mu, torque - -The atom style defined does not have these attributes. - -E: Cannot (yet) use 'electron' units with dipoles - -This feature is not yet supported. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/SPIN/pair_spin_dipole_long.h b/src/SPIN/pair_spin_dipole_long.h index 7a0560f7d8..c3337327ff 100644 --- a/src/SPIN/pair_spin_dipole_long.h +++ b/src/SPIN/pair_spin_dipole_long.h @@ -69,27 +69,3 @@ class PairSpinDipoleLong : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_style command - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair dipole/long requires atom attributes q, mu, torque - -The atom style defined does not have these attributes. - -E: Can only use 'metal' units with spins - -This feature is not yet supported. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -*/ diff --git a/src/SPIN/pair_spin_dmi.h b/src/SPIN/pair_spin_dmi.h index 9462afae58..bddb1ea652 100644 --- a/src/SPIN/pair_spin_dmi.h +++ b/src/SPIN/pair_spin_dmi.h @@ -59,23 +59,3 @@ class PairSpinDmi : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_spin command - -Self-explanatory. - -E: Spin simulations require metal unit style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair spin requires atom attribute spin - -The atom style defined does not have these attributes. - -*/ diff --git a/src/SPIN/pair_spin_exchange.h b/src/SPIN/pair_spin_exchange.h index 485157d49e..1631cdd7f9 100644 --- a/src/SPIN/pair_spin_exchange.h +++ b/src/SPIN/pair_spin_exchange.h @@ -61,23 +61,3 @@ class PairSpinExchange : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_spin command - -Self-explanatory. - -E: Spin simulations require metal unit style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair spin requires atom attribute spin - -The atom style defined does not have these attributes. - -*/ diff --git a/src/SPIN/pair_spin_exchange_biquadratic.h b/src/SPIN/pair_spin_exchange_biquadratic.h index 0a0b7be5ba..b14cc4c11b 100644 --- a/src/SPIN/pair_spin_exchange_biquadratic.h +++ b/src/SPIN/pair_spin_exchange_biquadratic.h @@ -64,23 +64,3 @@ class PairSpinExchangeBiquadratic : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_spin command - -Self-explanatory. - -E: Spin simulations require metal unit style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair spin requires atom attribute spin - -The atom style defined does not have these attributes. - -*/ diff --git a/src/SPIN/pair_spin_magelec.h b/src/SPIN/pair_spin_magelec.h index ece4534d0b..0041e9e4a5 100644 --- a/src/SPIN/pair_spin_magelec.h +++ b/src/SPIN/pair_spin_magelec.h @@ -58,23 +58,3 @@ class PairSpinMagelec : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_spin command - -Self-explanatory. - -E: Spin simulations require metal unit style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair spin requires atom attribute spin - -The atom style defined does not have these attributes. - -*/ diff --git a/src/SPIN/pair_spin_neel.h b/src/SPIN/pair_spin_neel.h index 192a6e5129..7be0f718a3 100644 --- a/src/SPIN/pair_spin_neel.h +++ b/src/SPIN/pair_spin_neel.h @@ -63,23 +63,3 @@ class PairSpinNeel : public PairSpin { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args in pair_spin command - -Self-explanatory. - -E: Spin simulations require metal unit style - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair spin requires atom attribute spin - -The atom style defined does not have these attributes. - -*/ diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index f4bcbec0b5..76c5237f2d 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -142,7 +142,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg], "overlap") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix srd command"); - overlap = utils::logical(FLERR,arg[iarg+1],false,lmp); + overlap = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "inside") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix srd command"); @@ -157,7 +157,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg], "exact") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix srd command"); - exactflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + exactflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "radius") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix srd command"); @@ -196,7 +196,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : iarg += 3; } else if (strcmp(arg[iarg], "tstat") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix srd command"); - tstat = utils::logical(FLERR,arg[iarg+1],false,lmp); + tstat = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "rescale") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix srd command"); @@ -289,9 +289,9 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : // atom style pointers to particles that store bonus info - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_line = (AtomVecLine *) atom->style_match("line"); - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_ellipsoid = dynamic_cast(atom->style_match("ellipsoid")); + avec_line = dynamic_cast(atom->style_match("line")); + avec_tri = dynamic_cast(atom->style_match("tri")); // fix parameters @@ -369,7 +369,7 @@ void FixSRD::init() if (strcmp(modify->fix[m]->style, "wall/srd") == 0) { if (wallexist) error->all(FLERR, "Cannot use fix wall/srd more than once"); wallexist = 1; - wallfix = (FixWallSRD *) modify->fix[m]; + wallfix = dynamic_cast(modify->fix[m]); nwall = wallfix->nwall; wallvarflag = wallfix->varflag; wallwhich = wallfix->wallwhich; @@ -394,7 +394,7 @@ void FixSRD::init() if (fixes[i]->box_change & BOX_CHANGE_SHAPE) change_shape = 1; if (strcmp(fixes[i]->style, "deform") == 0) { deformflag = 1; - FixDeform *deform = (FixDeform *) modify->fix[i]; + auto deform = dynamic_cast(modify->fix[i]); if ((deform->box_change & BOX_CHANGE_SHAPE) && deform->remapflag != Domain::V_REMAP) error->all(FLERR, "Using fix srd with inconsistent fix deform remap option"); } diff --git a/src/SRD/fix_srd.h b/src/SRD/fix_srd.h index e6a203cba4..9088999f3e 100644 --- a/src/SRD/fix_srd.h +++ b/src/SRD/fix_srd.h @@ -250,178 +250,3 @@ class FixSRD : public Fix { #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: Could not find fix srd group ID - -Self-explanatory. - -E: Fix srd requires newton pair on - -Self-explanatory. - -E: Fix srd requires ghost atoms store velocity - -Use the comm_modify vel yes command to enable this. - -E: Fix srd no-slip requires atom attribute torque - -This is because the SRD collisions will impart torque to the solute -particles. - -E: Cannot change timestep once fix srd is setup - -This is because various SRD properties depend on the timestep -size. - -E: Fix srd can only currently be used with comm_style brick - -This is a current restriction in LAMMPS. - -E: Cannot use fix wall/srd more than once - -Nor is their a need to since multiple walls can be specified -in one command. - -W: Fix SRD walls overlap but fix srd overlap not set - -You likely want to set this in your input script. - -E: Using fix srd with inconsistent fix deform remap option - -When shearing the box in an SRD simulation, the remap v option for fix -deform needs to be used. - -W: Using fix srd with box deformation but no SRD thermostat - -The deformation will heat the SRD particles so this can -be dangerous. - -W: Fix srd SRD moves may trigger frequent reneighboring - -This is because the SRD particles may move long distances. - -E: Fix SRD: bad search bin assignment - -Something has gone wrong in your SRD model; try using more -conservative settings. - -E: Fix SRD: bad stencil bin for big particle - -Something has gone wrong in your SRD model; try using more -conservative settings. - -E: Fix SRD: too many big particles in bin - -Reset the ATOMPERBIN parameter at the top of fix_srd.cpp -to a larger value, and re-compile the code. - -E: Fix SRD: too many walls in bin - -This should not happen unless your system has been setup incorrectly. - -E: Fix SRD: bad bin assignment for SRD advection - -Something has gone wrong in your SRD model; try using more -conservative settings. - -E: SRD particle %d started inside big particle %d on step %ld bounce %d - -See the inside keyword if you want this message to be an error vs -warning. - -W: SRD particle %d started inside big particle %d on step %ld bounce %d - -See the inside keyword if you want this message to be an error vs -warning. - -E: SRD particle %d started inside wall %d on step %ld bounce %d - -See the inside keyword if you want this message to be an error vs -warning. - -W: SRD particle %d started inside wall %d on step %ld bounce %d - -See the inside keyword if you want this message to be an error vs -warning. - -E: Bad quadratic solve for particle/line collision - -This is an internal error. It should normally not occur. - -E: Bad quadratic solve for particle/tri collision - -This is an internal error. It should normally not occur. - -W: Fix srd particle moved outside valid domain - -This may indicate a problem with your simulation parameters. - -E: Big particle in fix srd cannot be point particle - -Big particles must be extended spheroids or ellipsoids. - -E: Cannot use lines with fix srd unless overlap is set - -This is because line segments are connected to each other. - -E: Cannot use tris with fix srd unless overlap is set - -This is because triangles are connected to each other. - -E: Fix srd requires SRD particles all have same mass - -Self-explanatory. - -E: Fewer SRD bins than processors in some dimension - -This is not allowed. Make your SRD bin size smaller. - -E: SRD bins for fix srd are not cubic enough - -The bin shape is not within tolerance of cubic. See the cubic -keyword if you want this message to be an error vs warning. - -W: SRD bins for fix srd are not cubic enough - -The bin shape is not within tolerance of cubic. See the cubic -keyword if you want this message to be an error vs warning. - -E: SRD bin size for fix srd differs from user request - -Fix SRD had to adjust the bin size to fit the simulation box. See the -cubic keyword if you want this message to be an error vs warning. - -W: SRD bin size for fix srd differs from user request - -Fix SRD had to adjust the bin size to fit the simulation box. See the -cubic keyword if you want this message to be an error vs warning. - -E: Fix srd lamda must be >= 0.6 of SRD grid size - -This is a requirement for accuracy reasons. - -W: SRD bin shifting turned on due to small lamda - -This is done to try to preserve accuracy. - -W: Fix srd grid size > 1/4 of big particle diameter - -This may cause accuracy problems. - -W: Fix srd viscosity < 0.0 due to low SRD density - -This may cause accuracy problems. - -W: Fix srd particles may move > big particle diameter - -This may cause accuracy problems. - -*/ diff --git a/src/SRD/fix_wall_srd.h b/src/SRD/fix_wall_srd.h index ecd16c6e6d..e93f6920a1 100644 --- a/src/SRD/fix_wall_srd.h +++ b/src/SRD/fix_wall_srd.h @@ -57,37 +57,3 @@ class FixWallSRD : public Fix { #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: Wall defined twice in fix wall/srd command - -Self-explanatory. - -E: Cannot use fix wall/srd in periodic dimension - -Self-explanatory. - -E: Cannot use fix wall/srd zlo/zhi for a 2d simulation - -Self-explanatory. - -E: Cannot use fix wall/srd without fix srd - -Self-explanatory. - -E: Variable name for fix wall/srd does not exist - -Self-explanatory. - -E: Variable for fix wall/srd is invalid style - -Only equal-style variables can be used. - -*/ diff --git a/src/STUBS/mpi.cpp b/src/STUBS/mpi.cpp index 13d0446e0b..e914063889 100644 --- a/src/STUBS/mpi.cpp +++ b/src/STUBS/mpi.cpp @@ -429,8 +429,7 @@ int MPI_Group_incl(MPI_Group group, int n, int *ranks, MPI_Group *newgroup) int MPI_Group_free(MPI_Group *group) { - if (group) - *group = MPI_GROUP_NULL; + if (group) *group = MPI_GROUP_NULL; return 0; } diff --git a/src/TALLY/compute_force_tally.h b/src/TALLY/compute_force_tally.h index a46e074103..9cddb6ed15 100644 --- a/src/TALLY/compute_force_tally.h +++ b/src/TALLY/compute_force_tally.h @@ -40,7 +40,8 @@ class ComputeForceTally : public Compute { double memory_usage() override; void pair_setup_callback(int, int) override; - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, + double) override; private: bigint did_setup; @@ -53,13 +54,3 @@ class ComputeForceTally : public Compute { #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. - -*/ diff --git a/src/TALLY/compute_heat_flux_tally.h b/src/TALLY/compute_heat_flux_tally.h index 8110ad6fc7..d7296e36d7 100644 --- a/src/TALLY/compute_heat_flux_tally.h +++ b/src/TALLY/compute_heat_flux_tally.h @@ -39,7 +39,8 @@ class ComputeHeatFluxTally : public Compute { double memory_usage() override; void pair_setup_callback(int, int) override; - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, + double) override; private: bigint did_setup; @@ -52,13 +53,3 @@ class ComputeHeatFluxTally : public Compute { #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. - -*/ diff --git a/src/TALLY/compute_heat_flux_virial_tally.h b/src/TALLY/compute_heat_flux_virial_tally.h index 1d664ce560..d4e9064791 100644 --- a/src/TALLY/compute_heat_flux_virial_tally.h +++ b/src/TALLY/compute_heat_flux_virial_tally.h @@ -40,7 +40,8 @@ class ComputeHeatFluxVirialTally : public Compute { double memory_usage() override; void pair_setup_callback(int, int) override; - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, + double) override; private: bigint did_setup; @@ -52,13 +53,3 @@ class ComputeHeatFluxVirialTally : public Compute { #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. - -*/ diff --git a/src/TALLY/compute_pe_mol_tally.h b/src/TALLY/compute_pe_mol_tally.h index b123d7cf78..73e188088e 100644 --- a/src/TALLY/compute_pe_mol_tally.h +++ b/src/TALLY/compute_pe_mol_tally.h @@ -34,7 +34,8 @@ class ComputePEMolTally : public Compute { void compute_vector() override; void pair_setup_callback(int, int) override; - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, + double) override; private: bigint did_setup; @@ -46,13 +47,3 @@ class ComputePEMolTally : public Compute { #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. - -*/ diff --git a/src/TALLY/compute_pe_tally.h b/src/TALLY/compute_pe_tally.h index dfccce5f7e..ad7658e0f2 100644 --- a/src/TALLY/compute_pe_tally.h +++ b/src/TALLY/compute_pe_tally.h @@ -40,7 +40,8 @@ class ComputePETally : public Compute { double memory_usage() override; void pair_setup_callback(int, int) override; - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, + double) override; private: bigint did_setup; @@ -53,13 +54,3 @@ class ComputePETally : public Compute { #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. - -*/ diff --git a/src/TALLY/compute_stress_tally.h b/src/TALLY/compute_stress_tally.h index 9910667df3..4bf29dfd42 100644 --- a/src/TALLY/compute_stress_tally.h +++ b/src/TALLY/compute_stress_tally.h @@ -40,7 +40,8 @@ class ComputeStressTally : public Compute { double memory_usage() override; void pair_setup_callback(int, int) override; - void pair_tally_callback(int, int, int, int, double, double, double, double, double, double) override; + void pair_tally_callback(int, int, int, int, double, double, double, double, double, + double) override; private: bigint did_setup; @@ -53,13 +54,3 @@ class ComputeStressTally : public Compute { #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. - -*/ diff --git a/src/UEF/compute_pressure_uef.cpp b/src/UEF/compute_pressure_uef.cpp index 5105a58ddf..da35b7635d 100644 --- a/src/UEF/compute_pressure_uef.cpp +++ b/src/UEF/compute_pressure_uef.cpp @@ -57,7 +57,7 @@ void ComputePressureUef::init() if (i==modify->nfix) error->all(FLERR,"Can't use compute pressure/uef without defining a fix nvt/npt/uef"); ifix_uef=i; - ((FixNHUef*) modify->fix[ifix_uef])->get_ext_flags(ext_flags); + (dynamic_cast( modify->fix[ifix_uef]))->get_ext_flags(ext_flags); if (strcmp(temperature->style,"temp/uef") != 0) error->warning(FLERR,"The temperature used in compute pressure/ued is not of style temp/uef"); @@ -127,7 +127,7 @@ void ComputePressureUef::compute_vector() else { double r[3][3]; - ( (FixNHUef*) modify->fix[ifix_uef])->get_rot(r); + ( dynamic_cast( modify->fix[ifix_uef]))->get_rot(r); virial_rot(virial,r); } if (keflag) { @@ -158,7 +158,7 @@ void ComputePressureUef::compute_vector() ------------------------------------------------------------------------- */ void ComputePressureUef::update_rot() { - ( (FixNHUef*) modify->fix[ifix_uef])->get_rot(rot); + ( dynamic_cast( modify->fix[ifix_uef]))->get_rot(rot); } /* ---------------------------------------------------------------------- diff --git a/src/UEF/compute_pressure_uef.h b/src/UEF/compute_pressure_uef.h index d969f2f7ad..391fd60f9b 100644 --- a/src/UEF/compute_pressure_uef.h +++ b/src/UEF/compute_pressure_uef.h @@ -47,18 +47,3 @@ class ComputePressureUef : public ComputePressure { #endif #endif - -/* ERROR/WARNING messages: - -This class inherits most of the warnings from ComputePressure. The -only additions are: - -E: Can't use compute pressure/uef without defining a fix nvt/npt/uef - -Self-explanatory. - -W: The temperature used in compute pressure/uef is not of style temp/uef - -Self-explanatory. - -*/ diff --git a/src/UEF/compute_temp_uef.cpp b/src/UEF/compute_temp_uef.cpp index 23536330c0..8d02317267 100644 --- a/src/UEF/compute_temp_uef.cpp +++ b/src/UEF/compute_temp_uef.cpp @@ -61,7 +61,7 @@ void ComputeTempUef::compute_vector() ComputeTemp::compute_vector(); if (rot_flag) { double rot[3][3]; - ( (FixNHUef*) modify->fix[ifix_uef])->get_rot(rot); + ( dynamic_cast( modify->fix[ifix_uef]))->get_rot(rot); virial_rot(vector,rot); } diff --git a/src/UEF/compute_temp_uef.h b/src/UEF/compute_temp_uef.h index eb5bdac37d..3bee5e9f3c 100644 --- a/src/UEF/compute_temp_uef.h +++ b/src/UEF/compute_temp_uef.h @@ -45,14 +45,3 @@ class ComputeTempUef : public ComputeTemp { #endif #endif - -/* ERROR/WARNING messages: - -This class inherits most of the warnings from ComputePressure. The -only addition is: - -E: Can't use compute temp/uef without defining a fix nvt/npt/uef - -Self-explanatory. - -*/ diff --git a/src/UEF/dump_cfg_uef.cpp b/src/UEF/dump_cfg_uef.cpp index f055ac3f7d..c87e1632ef 100644 --- a/src/UEF/dump_cfg_uef.cpp +++ b/src/UEF/dump_cfg_uef.cpp @@ -68,8 +68,8 @@ void DumpCFGUef::write_header(bigint n) // so molecules are not split across periodic box boundaries double box[3][3],rot[3][3]; - ((FixNHUef*) modify->fix[ifix_uef])->get_box(box); - ((FixNHUef*) modify->fix[ifix_uef])->get_rot(rot); + (dynamic_cast( modify->fix[ifix_uef]))->get_box(box); + (dynamic_cast( modify->fix[ifix_uef]))->get_rot(rot); // rot goes from "lab frame" to "upper triangular frame" // it's transpose takes the simulation box to the flow frame for (int i=0;i<3;i++) diff --git a/src/UEF/dump_cfg_uef.h b/src/UEF/dump_cfg_uef.h index d4fa3bfc02..20fbab5d7e 100644 --- a/src/UEF/dump_cfg_uef.h +++ b/src/UEF/dump_cfg_uef.h @@ -40,11 +40,3 @@ class DumpCFGUef : public DumpCFG { #endif #endif - -/* ERROR/WARNING messages: - -E: Can't use dump cfg/uef without defining a fix nvt/npt/uef - -Self-explanatory. - -*/ diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp index a88b389611..e1342adc17 100644 --- a/src/UEF/fix_nh_uef.cpp +++ b/src/UEF/fix_nh_uef.cpp @@ -272,9 +272,9 @@ void FixNHUef::setup(int j) error->all(FLERR,"Initial box is not close enough to the expected uef box"); uefbox->get_rot(rot); - ((ComputeTempUef*) temperature)->yes_rot(); - ((ComputePressureUef*) pressure)->in_fix = true; - ((ComputePressureUef*) pressure)->update_rot(); + (dynamic_cast( temperature))->yes_rot(); + (dynamic_cast( pressure))->in_fix = true; + (dynamic_cast( pressure))->update_rot(); FixNH::setup(j); } @@ -286,12 +286,12 @@ void FixNHUef::initial_integrate(int vflag) inv_rotate_x(rot); inv_rotate_v(rot); inv_rotate_f(rot); - ((ComputeTempUef*) temperature)->no_rot(); + (dynamic_cast( temperature))->no_rot(); FixNH::initial_integrate(vflag); rotate_x(rot); rotate_v(rot); rotate_f(rot); - ((ComputeTempUef*) temperature)->yes_rot(); + (dynamic_cast( temperature))->yes_rot(); } /* ---------------------------------------------------------------------- @@ -302,12 +302,12 @@ void FixNHUef::initial_integrate_respa(int vflag, int ilevel, int iloop) inv_rotate_x(rot); inv_rotate_v(rot); inv_rotate_f(rot); - ((ComputeTempUef*) temperature)->no_rot(); + (dynamic_cast( temperature))->no_rot(); FixNH::initial_integrate_respa(vflag,ilevel,iloop); rotate_x(rot); rotate_v(rot); rotate_f(rot); - ((ComputeTempUef*) temperature)->yes_rot(); + (dynamic_cast( temperature))->yes_rot(); } /* ---------------------------------------------------------------------- @@ -316,14 +316,14 @@ void FixNHUef::initial_integrate_respa(int vflag, int ilevel, int iloop) void FixNHUef::final_integrate() { // update rot here since it must directly follow the virial calculation - ((ComputePressureUef*) pressure)->update_rot(); + (dynamic_cast( pressure))->update_rot(); inv_rotate_v(rot); inv_rotate_f(rot); - ((ComputeTempUef*) temperature)->no_rot(); + (dynamic_cast( temperature))->no_rot(); FixNH::final_integrate(); rotate_v(rot); rotate_f(rot); - ((ComputeTempUef*) temperature)->yes_rot(); + (dynamic_cast( temperature))->yes_rot(); } /* ---------------------------------------------------------------------- @@ -708,7 +708,7 @@ void FixNHUef::restart(char *buf) { int n = size_restart_global(); FixNH::restart(buf); - double *list = (double *) buf; + auto list = (double *) buf; strain[0] = list[n-2]; strain[1] = list[n-1]; uefbox->set_strain(strain[0],strain[1]); diff --git a/src/UEF/fix_nh_uef.h b/src/UEF/fix_nh_uef.h index 8f74de7bbb..02e9fd05e8 100644 --- a/src/UEF/fix_nh_uef.h +++ b/src/UEF/fix_nh_uef.h @@ -71,57 +71,3 @@ class FixNHUef : public FixNH { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -This is a base class for FixNH so it will inherit most of its error/warning messages along with the following: - -E: Illegal fix nvt/npt/uef command - -Self-explanatory - -E: Keyword erate must be set for fix nvt/npt/uef command - -Self-explanatory. - -E: Simulation box must be triclinic for fix/nvt/npt/uef - -Self-explanatory. - -E: Only normal stresses can be controlled with fix/nvt/npt/uef - -The keywords xy xz and yz cannot be used for pressure control - -E: The ext keyword may only be used with iso pressure control - -Self-explanatory - -E: All controlled stresses must have the same value in fix/nvt/npt/uef - -Stress control is only possible when the stress specified for each dimension is the same - -E: Dimensions with controlled stresses must have same strain rate in fix/nvt/npt/uef - -Stress-controlled dimensions with the same strain rate must have the same target stress. - -E: Can't use another fix which changes box shape with fix/nvt/npt/uef - -The fix npt/nvt/uef command must have full control over the box shape. You cannot use a simultaneous fix deform command, for example. - -E: Pressure ID for fix/nvt/uef doesn't exist - -The compute pressure introduced via fix_modify does not exist - -E: Using fix nvt/npt/uef without a compute pressure/uef - -Self-explanatory. - -E: Using fix nvt/npt/uef without a compute temp/uef - -Self-explanatory. - -E: Initial box is not close enough to the expected uef box - -The initial box does not correspond to the shape required by the value of the strain keyword. If the default strain value of zero was used, the initial box is not cubic. - -*/ diff --git a/src/UEF/fix_npt_uef.h b/src/UEF/fix_npt_uef.h index 565e12e19b..665c96f06e 100644 --- a/src/UEF/fix_npt_uef.h +++ b/src/UEF/fix_npt_uef.h @@ -35,15 +35,3 @@ class FixNPTUef : public FixNHUef { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt uef - -Self-explanatory. - -E: Pressure control must be used with fix npt uef - -Self-explanatory. - -*/ diff --git a/src/UEF/fix_nvt_uef.h b/src/UEF/fix_nvt_uef.h index f1e7031054..9dd26a8905 100644 --- a/src/UEF/fix_nvt_uef.h +++ b/src/UEF/fix_nvt_uef.h @@ -35,15 +35,3 @@ class FixNVTUef : public FixNHUef { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt uef - -Self-explanatory. - -E: Pressure control must be used with fix npt uef - -Self-explanatory. - -*/ diff --git a/src/VORONOI/compute_voronoi_atom.h b/src/VORONOI/compute_voronoi_atom.h index 960a3d703a..0a60b5b224 100644 --- a/src/VORONOI/compute_voronoi_atom.h +++ b/src/VORONOI/compute_voronoi_atom.h @@ -70,41 +70,3 @@ class ComputeVoronoi : public Compute { #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: Could not find compute/voronoi surface group ID - -Self-explanatory. - -E: Illegal compute voronoi/atom command (occupation and (surface or edges)) - -Self-explanatory. - -E: Compute voronoi/atom occupation requires an atom map, see atom_modify - -UNDOCUMENTED - -E: Compute voronoi/atom occupation requires atom IDs - -UNDOCUMENTED - -E: Variable name for voronoi radius does not exist - -Self-explanatory. - -E: Variable for voronoi radius is not atom style - -Self-explanatory. - -E: Voro++ error: narea and neigh have a different size - -This error is returned by the Voro++ library. - -*/ diff --git a/src/VTK/dump_vtk.cpp b/src/VTK/dump_vtk.cpp index fd7f4b2c2b..51c6632b78 100644 --- a/src/VTK/dump_vtk.cpp +++ b/src/VTK/dump_vtk.cpp @@ -246,12 +246,11 @@ void DumpVTK::init_style() else if (flag && cols) custom_flag[i] = DARRAY; } - // set index and check validity of region + // check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for dump vtk does not exist"); + if (idregion) { + if (!domain->get_region_by_id(idregion)) + error->all(FLERR,"Region {} for dump vtk does not exist",idregion); } } @@ -335,8 +334,8 @@ int DumpVTK::count() // un-choose if not in region - if (iregion >= 0) { - Region *region = domain->regions[iregion]; + auto region = domain->get_region_by_id(idregion); + if (region) { region->prematch(); double **x = atom->x; for (i = 0; i < nlocal; i++) @@ -2054,11 +2053,12 @@ int DumpVTK::modify_param(int narg, char **arg) { if (strcmp(arg[0],"region") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strcmp(arg[1],"none") == 0) iregion = -1; - else { - iregion = domain->find_region(arg[1]); - if (iregion == -1) - error->all(FLERR,"Dump_modify region ID {} does not exist",arg[1]); + if (strcmp(arg[1],"none") == 0) { + delete[] idregion; + idregion = nullptr; + } else { + if (!domain->get_region_by_id(arg[1])) + error->all(FLERR,"Dump_modify region {} does not exist",arg[1]); delete[] idregion; idregion = utils::strdup(arg[1]); } diff --git a/src/VTK/dump_vtk.h b/src/VTK/dump_vtk.h index 92886dc2ec..264becfff6 100644 --- a/src/VTK/dump_vtk.h +++ b/src/VTK/dump_vtk.h @@ -138,184 +138,3 @@ class DumpVTK : public DumpCustom { #endif #endif - -/* ERROR/WARNING messages: - -E: No dump custom arguments specified - -The dump custom command requires that atom quantities be specified to -output to dump file. - -E: Invalid attribute in dump custom command - -Self-explanatory. - -E: Dump_modify format string is too short - -There are more fields to be dumped in a line of output than your -format string specifies. - -E: Could not find dump custom compute ID - -Self-explanatory. - -E: Could not find dump custom fix ID - -Self-explanatory. - -E: Dump custom and fix not computed at compatible times - -The fix must produce per-atom quantities on timesteps that dump custom -needs them. - -E: Could not find dump custom variable name - -Self-explanatory. - -E: Could not find custom per-atom property ID - -Self-explanatory. - -E: Region ID for dump custom does not exist - -Self-explanatory. - -E: Compute used in dump between runs is not current - -The compute was not invoked on the current timestep, therefore it -cannot be used in a dump between runs. - -E: Threshold for an atom property that isn't allocated - -A dump threshold has been requested on a quantity that is -not defined by the atom style used in this simulation. - -E: Dumping an atom property that isn't allocated - -The chosen atom style does not define the per-atom quantity being -dumped. - -E: Dump custom compute does not compute per-atom info - -Self-explanatory. - -E: Dump custom compute does not calculate per-atom vector - -Self-explanatory. - -E: Dump custom compute does not calculate per-atom array - -Self-explanatory. - -E: Dump custom compute vector is accessed out-of-range - -Self-explanatory. - -E: Dump custom fix does not compute per-atom info - -Self-explanatory. - -E: Dump custom fix does not compute per-atom vector - -Self-explanatory. - -E: Dump custom fix does not compute per-atom array - -Self-explanatory. - -E: Dump custom fix vector is accessed out-of-range - -Self-explanatory. - -E: Dump custom variable is not atom-style variable - -Only atom-style variables generate per-atom quantities, needed for -dump output. - -E: Custom per-atom property ID is not floating point - -Self-explanatory. - -E: Custom per-atom property ID is not integer - -Self-explanatory. - -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: Dump_modify region ID does not exist - -Self-explanatory. - -E: Dump modify element names do not match atom types - -Number of element names must equal number of atom types. - -E: Invalid attribute in dump modify command - -Self-explanatory. - -E: Could not find dump modify compute ID - -Self-explanatory. - -E: Dump modify compute ID does not compute per-atom info - -Self-explanatory. - -E: Dump modify compute ID does not compute per-atom vector - -Self-explanatory. - -E: Dump modify compute ID does not compute per-atom array - -Self-explanatory. - -E: Dump modify compute ID vector is not large enough - -Self-explanatory. - -E: Could not find dump modify fix ID - -Self-explanatory. - -E: Dump modify fix ID does not compute per-atom info - -Self-explanatory. - -E: Dump modify fix ID does not compute per-atom vector - -Self-explanatory. - -E: Dump modify fix ID does not compute per-atom array - -Self-explanatory. - -E: Dump modify fix ID vector is not large enough - -Self-explanatory. - -E: Could not find dump modify variable name - -Self-explanatory. - -E: Dump modify variable is not atom-style variable - -Self-explanatory. - -E: Could not find dump modify custom atom floating point property ID - -Self-explanatory. - -E: Could not find dump modify custom atom integer property ID - -Self-explanatory. - -E: Invalid dump_modify threshold operator - -Operator keyword used for threshold specification in not recognized. - -*/ diff --git a/src/YAFF/angle_cross.h b/src/YAFF/angle_cross.h index c2cb07b143..b371e525a9 100644 --- a/src/YAFF/angle_cross.h +++ b/src/YAFF/angle_cross.h @@ -46,11 +46,3 @@ class AngleCross : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/YAFF/angle_mm3.h b/src/YAFF/angle_mm3.h index 18ff0a59fc..ef9d88d4c9 100644 --- a/src/YAFF/angle_mm3.h +++ b/src/YAFF/angle_mm3.h @@ -46,11 +46,3 @@ class AngleMM3 : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/YAFF/bond_mm3.h b/src/YAFF/bond_mm3.h index 799677d360..48ab6d28cc 100644 --- a/src/YAFF/bond_mm3.h +++ b/src/YAFF/bond_mm3.h @@ -46,11 +46,3 @@ class BondMM3 : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/YAFF/pair_lj_switch3_coulgauss_long.h b/src/YAFF/pair_lj_switch3_coulgauss_long.h index 3591f4eeb1..cb831ed021 100644 --- a/src/YAFF/pair_lj_switch3_coulgauss_long.h +++ b/src/YAFF/pair_lj_switch3_coulgauss_long.h @@ -62,30 +62,3 @@ class PairLJSwitch3CoulGaussLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/switch3/coulgauss/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/YAFF/pair_mm3_switch3_coulgauss_long.h b/src/YAFF/pair_mm3_switch3_coulgauss_long.h index 14d16b8ec8..3c6d1f019c 100644 --- a/src/YAFF/pair_mm3_switch3_coulgauss_long.h +++ b/src/YAFF/pair_mm3_switch3_coulgauss_long.h @@ -62,30 +62,3 @@ class PairMM3Switch3CoulGaussLong : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style mm3/switch3/coulgauss/long requires atom attribute q - -The atom style defined does not have this attribute. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/angle.cpp b/src/angle.cpp index 52d92b72b2..6fdb9307cb 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -34,6 +34,7 @@ Angle::Angle(LAMMPS *_lmp) : Pointers(_lmp) allocated = 0; suffix_flag = Suffix::NONE; + born_matrix_enable = 0; maxeatom = maxvatom = maxcvatom = 0; eatom = nullptr; @@ -353,3 +354,14 @@ double Angle::memory_usage() bytes += (double) comm->nthreads * maxcvatom * 9 * sizeof(double); return bytes; } + +/* ----------------------------------------------------------------------- + reset all type-based angle params via init() +-------------------------------------------------------------------------- */ + +void Angle::reinit() +{ + if (!reinitflag) error->all(FLERR, "Fix adapt interface to this angle style not supported"); + + init(); +} diff --git a/src/angle.h b/src/angle.h index 12443fa4f3..f7d66a1202 100644 --- a/src/angle.h +++ b/src/angle.h @@ -25,7 +25,8 @@ class Angle : protected Pointers { public: int allocated; int *setflag; - int writedata; // 1 if writes coeffs to data file + int writedata; // 1 if writes coeffs to data file + int born_matrix_enable; double energy; // accumulated energies double virial[6]; // accumulated virial: xx,yy,zz,xy,xz,yz double *eatom, **vatom; // accumulated per-atom energy/virial @@ -36,6 +37,9 @@ class Angle : protected Pointers { // CENTROID_AVAIL = different and implemented // CENTROID_NOTAVAIL = different, not yet implemented + int reinitflag; // 0 if not compatible with fix adapt + // extract() method may still need to be added + // KOKKOS host/device flag and data masks ExecutionSpace execution_space; @@ -56,7 +60,15 @@ class Angle : protected Pointers { virtual void read_restart_settings(FILE *){}; virtual void write_data(FILE *) {} virtual double single(int, int, int, int) = 0; + virtual void born_matrix(int /*atype*/, int /*at1*/, int /*at2*/, int /*at3*/, double &du, + double &du2) + { + du = 0.0; + du2 = 0.0; + } virtual double memory_usage(); + virtual void *extract(const char *, int &) { return nullptr; } + void reinit(); protected: int suffix_flag; // suffix compatibility flag @@ -82,17 +94,3 @@ class Angle : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Angle coeffs are not set - -No angle coefficients have been assigned in the data file or via the -angle_coeff command. - -E: All angle coeffs are not set - -All angle coefficients must be set in the data file or by the -angle_coeff command before running a simulation. - -*/ diff --git a/src/angle_deprecated.cpp b/src/angle_deprecated.cpp index 9a4ca8c877..55e1651b94 100644 --- a/src/angle_deprecated.cpp +++ b/src/angle_deprecated.cpp @@ -34,7 +34,7 @@ void AngleDeprecated::settings(int, char **) // called, our style was just added at the end of the list of substyles if (utils::strmatch(my_style,"^hybrid")) { - AngleHybrid *hybrid = (AngleHybrid *)force->angle; + auto hybrid = dynamic_cast(force->angle); my_style = hybrid->keywords[hybrid->nstyles]; } diff --git a/src/angle_deprecated.h b/src/angle_deprecated.h index 70e834bf9e..51c5cdc0ab 100644 --- a/src/angle_deprecated.h +++ b/src/angle_deprecated.h @@ -41,7 +41,3 @@ class AngleDeprecated : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/angle_hybrid.h b/src/angle_hybrid.h index 1deb9a6a14..c66952208b 100644 --- a/src/angle_hybrid.h +++ b/src/angle_hybrid.h @@ -56,47 +56,3 @@ class AngleHybrid : public Angle { #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: Angle style hybrid cannot use same angle style twice - -Self-explanatory. - -E: Angle style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Angle style hybrid cannot have none as an argument - -Self-explanatory. - -E: BondAngle coeff for hybrid angle has invalid format - -No "ba" field should appear in data file entry. - -E: BondBond coeff for hybrid angle has invalid format - -No "bb" field should appear in data file entry. - -E: Angle coeff for hybrid has invalid style - -Angle style hybrid uses another angle style as one of its -coefficients. The angle style used in the angle_coeff command or read -from a restart file is not recognized. - -E: Invoked angle equil angle on angle style none - -Self-explanatory. - -E: Invoked angle single on angle style none - -Self-explanatory. - -*/ diff --git a/src/angle_zero.h b/src/angle_zero.h index 47bc4aac4f..2306fd4085 100644 --- a/src/angle_zero.h +++ b/src/angle_zero.h @@ -50,15 +50,3 @@ class AngleZero : public Angle { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Incorrect args for angle coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/arg_info.cpp b/src/arg_info.cpp index 4bdbfc8c92..86becc1da5 100644 --- a/src/arg_info.cpp +++ b/src/arg_info.cpp @@ -103,7 +103,7 @@ ArgInfo::ArgInfo(const std::string &arg, int allowed) : type(NONE), dim(0), inde char *ArgInfo::copy_name() { - char *dest = new char[name.size() + 1]; + auto dest = new char[name.size() + 1]; strcpy(dest, name.c_str()); // NOLINT return dest; } diff --git a/src/atom.cpp b/src/atom.cpp index 00b9701689..8283dbfee6 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -47,7 +47,6 @@ using namespace LAMMPS_NS; using namespace MathConst; #define DELTA 1 -#define DELTA_PERATOM 64 #define EPSILON 1.0e-6 /* ---------------------------------------------------------------------- @@ -105,11 +104,6 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) binhead = nullptr; next = permute = nullptr; - // data structure with info on per-atom vectors/arrays - - nperatom = maxperatom = 0; - peratom = nullptr; - // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variables @@ -128,6 +122,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) omega = angmom = torque = nullptr; radius = rmass = nullptr; ellipsoid = line = tri = body = nullptr; + quat = nullptr; // molecular systems @@ -285,11 +280,11 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) Atom::~Atom() { - delete [] atom_style; + delete[] atom_style; delete avec; delete avec_map; - delete [] firstgroupname; + delete[] firstgroupname; memory->destroy(binhead); memory->destroy(next); memory->destroy(permute); @@ -302,29 +297,23 @@ Atom::~Atom() memory->destroy(v); memory->destroy(f); - // delete peratom data struct - - for (int i = 0; i < nperatom; i++) - delete [] peratom[i].name; - memory->sfree(peratom); - // delete custom atom arrays for (int i = 0; i < nivector; i++) { - delete [] ivname[i]; + delete[] ivname[i]; memory->destroy(ivector[i]); } for (int i = 0; i < ndvector; i++) { - delete [] dvname[i]; + delete[] dvname[i]; if (dvector) // (needed for Kokkos) memory->destroy(dvector[i]); } for (int i = 0; i < niarray; i++) { - delete [] ianame[i]; + delete[] ianame[i]; memory->destroy(iarray[i]); } for (int i = 0; i < ndarray; i++) { - delete [] daname[i]; + delete[] daname[i]; memory->destroy(darray[i]); } @@ -346,8 +335,8 @@ Atom::~Atom() // delete per-type arrays - delete [] mass; - delete [] mass_setflag; + delete[] mass; + delete[] mass_setflag; // delete extra arrays @@ -384,12 +373,7 @@ void Atom::settings(Atom *old) void Atom::peratom_create() { - for (int i = 0; i < nperatom; i++) - delete [] peratom[i].name; - memory->sfree(peratom); - - peratom = nullptr; - nperatom = maxperatom = 0; + peratom.clear(); // -------------------------------------------------------------------- // 2nd customization section: add peratom variables here, order does not matter @@ -426,6 +410,10 @@ void Atom::peratom_create() add_peratom("tri",&tri,INT,0); add_peratom("body",&body,INT,0); + // BPM package + + add_peratom("quat",&quat,DOUBLE,4); + // MOLECULE package add_peratom("molecule",&molecule,tagintsize,0); @@ -566,23 +554,11 @@ void Atom::peratom_create() use add_peratom_vary() when column count varies per atom ------------------------------------------------------------------------- */ -void Atom::add_peratom(const char *name, void *address, +void Atom::add_peratom(const std::string &name, void *address, int datatype, int cols, int threadflag) { - if (nperatom == maxperatom) { - maxperatom += DELTA_PERATOM; - peratom = (PerAtom *) - memory->srealloc(peratom,maxperatom*sizeof(PerAtom),"atom:peratom"); - } - - peratom[nperatom].name = utils::strdup(name); - peratom[nperatom].address = address; - peratom[nperatom].datatype = datatype; - peratom[nperatom].cols = cols; - peratom[nperatom].threadflag = threadflag; - peratom[nperatom].address_length = nullptr; - - nperatom++; + PerAtom item = {name, address, nullptr, nullptr, datatype, cols, 0, threadflag}; + peratom.push_back(item); } /* ---------------------------------------------------------------------- @@ -591,15 +567,13 @@ void Atom::add_peratom(const char *name, void *address, see atom_style tdpd as an example ------------------------------------------------------------------------- */ -void Atom::add_peratom_change_columns(const char *name, int cols) +void Atom::add_peratom_change_columns(const std::string &name, int cols) { - for (int i = 0; i < nperatom; i++) { - if (strcmp(name,peratom[i].name) == 0) { - peratom[i].cols = cols; - return; - } - } - error->all(FLERR,"Could not find name of peratom array for column change"); + auto match = std::find_if(peratom.begin(), peratom.end(), + [&name] (const PerAtom &p) { return p.name == name; }); + + if (match != peratom.end()) (*match).cols = cols; + else error->all(FLERR,"Could not find per-atom array name {} for column change", name); } /* ---------------------------------------------------------------------- @@ -614,25 +588,11 @@ void Atom::add_peratom_change_columns(const char *name, int cols) e.g. nspecial ------------------------------------------------------------------------- */ -void Atom::add_peratom_vary(const char *name, void *address, +void Atom::add_peratom_vary(const std::string &name, void *address, int datatype, int *cols, void *length, int collength) { - if (nperatom == maxperatom) { - maxperatom += DELTA_PERATOM; - peratom = (PerAtom *) - memory->srealloc(peratom,maxperatom*sizeof(PerAtom),"atom:peratom"); - } - - peratom[nperatom].name = utils::strdup(name); - peratom[nperatom].address = address; - peratom[nperatom].datatype = datatype; - peratom[nperatom].cols = -1; - peratom[nperatom].threadflag = 0; - peratom[nperatom].address_maxcols = cols; - peratom[nperatom].address_length = length; - peratom[nperatom].collength = collength; - - nperatom++; + PerAtom item = {name, address, length, cols, datatype, -1, collength, 0}; + peratom.push_back(item); } /* ---------------------------------------------------------------------- @@ -646,6 +606,7 @@ void Atom::set_atomflag_defaults() // identical list as 2nd customization in atom.h sphere_flag = ellipsoid_flag = line_flag = tri_flag = body_flag = 0; + quat_flag = 0; peri_flag = electron_flag = 0; wavepacket_flag = sph_flag = 0; molecule_flag = molindex_flag = molatom_flag = 0; @@ -769,7 +730,7 @@ void Atom::init() if (firstgroupname) { firstgroup = group->find(firstgroupname); if (firstgroup < 0) - error->all(FLERR,"Could not find atom_modify first group ID"); + error->all(FLERR,"Could not find atom_modify first group ID {}", firstgroupname); } else firstgroup = -1; // init AtomVec @@ -796,7 +757,7 @@ AtomVec *Atom::style_match(const char *style) { if (strcmp(atom_style,style) == 0) return avec; else if (strcmp(atom_style,"hybrid") == 0) { - auto avec_hybrid = (AtomVecHybrid *) avec; + auto avec_hybrid = dynamic_cast( avec); for (int i = 0; i < avec_hybrid->nstyles; i++) if (strcmp(avec_hybrid->keywords[i],style) == 0) return avec_hybrid->styles[i]; @@ -812,30 +773,30 @@ AtomVec *Atom::style_match(const char *style) void Atom::modify_params(int narg, char **arg) { - if (narg == 0) error->all(FLERR,"Illegal atom_modify command"); + if (narg == 0) utils::missing_cmd_args(FLERR, "atom_modify", error); int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg],"id") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify id", error); if (domain->box_exist) error->all(FLERR,"Atom_modify id command after simulation box is defined"); tag_enable = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"map") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify map", error); if (domain->box_exist) error->all(FLERR,"Atom_modify map command after simulation box is defined"); if (strcmp(arg[iarg+1],"array") == 0) map_user = 1; else if (strcmp(arg[iarg+1],"hash") == 0) map_user = 2; else if (strcmp(arg[iarg+1],"yes") == 0) map_user = 3; - else error->all(FLERR,"Illegal atom_modify command"); + else error->all(FLERR,"Illegal atom_modify map command argument {}", arg[iarg+1]); map_style = map_user; iarg += 2; } else if (strcmp(arg[iarg],"first") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "atom_modify first", error); if (strcmp(arg[iarg+1],"all") == 0) { - delete [] firstgroupname; + delete[] firstgroupname; firstgroupname = nullptr; } else { firstgroupname = utils::strdup(arg[iarg+1]); @@ -843,16 +804,15 @@ 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"); + if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "atom_modify sort", error); 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) - error->all(FLERR,"Atom_modify sort and first options " - "cannot be used together"); + if (sortfreq < 0) error->all(FLERR,"Illegal atom_modify sort frequency {}", sortfreq); + if (userbinsize < 0.0) error->all(FLERR,"Illegal atom_modify sort bin size {}", userbinsize); + if ((sortfreq >= 0) && firstgroupname) + error->all(FLERR,"Atom_modify sort and first options cannot be used together"); iarg += 3; - } else error->all(FLERR,"Illegal atom_modify command"); + } else error->all(FLERR,"Illegal atom_modify command argument: {}", arg[iarg]); } } @@ -923,7 +883,7 @@ void Atom::tag_extend() bigint notag_total; MPI_Allreduce(¬ag,¬ag_total,1,MPI_LMP_BIGINT,MPI_SUM,world); if (notag_total >= MAXTAGINT) - error->all(FLERR,"New atom IDs exceed maximum allowed ID"); + error->all(FLERR,"New atom IDs exceed maximum allowed ID {}", MAXTAGINT); bigint notag_sum; MPI_Scan(¬ag,¬ag_sum,1,MPI_LMP_BIGINT,MPI_SUM,world); @@ -1055,12 +1015,13 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, // use the first line to detect and validate the number of words/tokens per line next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Atoms section of data file"); *next = '\0'; int nwords = utils::trim_and_count_words(buf); *next = '\n'; - if (nwords != avec->size_data_atom && nwords != avec->size_data_atom + 3) - error->all(FLERR,"Incorrect atom format in data file"); + if ((nwords != avec->size_data_atom) && (nwords != avec->size_data_atom + 3)) + error->all(FLERR,"Incorrect atom format in data file: {}", utils::trim(buf)); // set bounds for my proc // if periodic and I am lo/hi proc, adjust bounds by EPSILON @@ -1132,54 +1093,57 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Atoms section of data file"); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - if ((int)values.size() != nwords) + if (values.size() == 0) { + // skip over empty or comment lines + } else if ((int)values.size() != nwords) { error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf)); - - int imx = 0, imy = 0, imz = 0; - if (imageflag) { - imx = utils::inumeric(FLERR,values[iptr],false,lmp); - imy = utils::inumeric(FLERR,values[iptr+1],false,lmp); - imz = utils::inumeric(FLERR,values[iptr+2],false,lmp); - if ((domain->dimension == 2) && (imz != 0)) - error->all(FLERR,"Z-direction image flag must be 0 for 2d-systems"); - if ((!domain->xperiodic) && (imx != 0)) { reset_image_flag[0] = true; imx = 0; } - if ((!domain->yperiodic) && (imy != 0)) { reset_image_flag[1] = true; imy = 0; } - if ((!domain->zperiodic) && (imz != 0)) { reset_image_flag[2] = true; imz = 0; } - } - imagedata = ((imageint) (imx + IMGMAX) & IMGMASK) | + } else { + int imx = 0, imy = 0, imz = 0; + if (imageflag) { + imx = utils::inumeric(FLERR,values[iptr],false,lmp); + imy = utils::inumeric(FLERR,values[iptr+1],false,lmp); + imz = utils::inumeric(FLERR,values[iptr+2],false,lmp); + if ((domain->dimension == 2) && (imz != 0)) + error->all(FLERR,"Z-direction image flag must be 0 for 2d-systems"); + if ((!domain->xperiodic) && (imx != 0)) { reset_image_flag[0] = true; imx = 0; } + if ((!domain->yperiodic) && (imy != 0)) { reset_image_flag[1] = true; imy = 0; } + if ((!domain->zperiodic) && (imz != 0)) { reset_image_flag[2] = true; imz = 0; } + } + imagedata = ((imageint) (imx + IMGMAX) & IMGMASK) | (((imageint) (imy + IMGMAX) & IMGMASK) << IMGBITS) | (((imageint) (imz + IMGMAX) & IMGMASK) << IMG2BITS); - xdata[0] = utils::numeric(FLERR,values[xptr],false,lmp); - xdata[1] = utils::numeric(FLERR,values[xptr+1],false,lmp); - xdata[2] = utils::numeric(FLERR,values[xptr+2],false,lmp); - if (shiftflag) { - xdata[0] += shift[0]; - xdata[1] += shift[1]; - xdata[2] += shift[2]; - } + xdata[0] = utils::numeric(FLERR,values[xptr],false,lmp); + xdata[1] = utils::numeric(FLERR,values[xptr+1],false,lmp); + xdata[2] = utils::numeric(FLERR,values[xptr+2],false,lmp); + if (shiftflag) { + xdata[0] += shift[0]; + xdata[1] += shift[1]; + xdata[2] += shift[2]; + } - domain->remap(xdata,imagedata); - if (triclinic) { - domain->x2lamda(xdata,lamda); - coord = lamda; - } else coord = xdata; + domain->remap(xdata,imagedata); + if (triclinic) { + domain->x2lamda(xdata,lamda); + coord = lamda; + } else coord = xdata; - if (coord[0] >= sublo[0] && coord[0] < subhi[0] && - coord[1] >= sublo[1] && coord[1] < subhi[1] && - coord[2] >= sublo[2] && coord[2] < subhi[2]) { - avec->data_atom(xdata,imagedata,values); - if (id_offset) tag[nlocal-1] += id_offset; - if (mol_offset) molecule[nlocal-1] += mol_offset; - if (type_offset) { - type[nlocal-1] += type_offset; - if (type[nlocal-1] > ntypes) - error->one(FLERR,"Invalid atom type in Atoms section of data file"); + if (coord[0] >= sublo[0] && coord[0] < subhi[0] && + coord[1] >= sublo[1] && coord[1] < subhi[1] && + coord[2] >= sublo[2] && coord[2] < subhi[2]) { + avec->data_atom(xdata,imagedata,values); + if (id_offset) tag[nlocal-1] += id_offset; + if (mol_offset) molecule[nlocal-1] += mol_offset; + if (type_offset) { + type[nlocal-1] += type_offset; + if (type[nlocal-1] > ntypes) + error->one(FLERR,"Invalid atom type in Atoms section of data file"); + } } } - buf = next + 1; } } @@ -1195,30 +1159,25 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) int m; char *next; - next = strchr(buf,'\n'); - *next = '\0'; - int nwords = utils::trim_and_count_words(buf); - *next = '\n'; - - if (nwords != avec->size_data_vel) - error->all(FLERR,"Incorrect velocity format in data file"); - // loop over lines of atom velocities // tokenize the line into values // if I own atom tag, unpack its values for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Velocities section of data file"); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - if ((int)values.size() != nwords) - error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf)); - - tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; - if (tagdata <= 0 || tagdata > map_tag_max) - error->one(FLERR,"Invalid atom ID in Velocities section of data file"); - if ((m = map(tagdata)) >= 0) avec->data_vel(m,values); - + if (values.size() == 0) { + // skip over empty or comment lines + } else if ((int)values.size() != avec->size_data_vel) { + error->all(FLERR, "Incorrect velocity format in data file: {}", utils::trim(buf)); + } else { + tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; + if (tagdata <= 0 || tagdata > map_tag_max) + error->one(FLERR,"Invalid atom ID {} in Velocities section of data file: {}", tagdata, buf); + if ((m = map(tagdata)) >= 0) avec->data_vel(m,values); + } buf = next + 1; } } @@ -1241,47 +1200,51 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Bonds section of data file"); *next = '\0'; - try { - ValueTokenizer values(utils::trim_comment(buf)); - values.next_int(); - itype = values.next_int(); - atom1 = values.next_tagint(); - atom2 = values.next_tagint(); - if (values.has_next()) throw TokenizerException("Too many tokens",""); - } catch (TokenizerException &e) { - error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); - } - if (id_offset) { - atom1 += id_offset; - atom2 += id_offset; - } - itype += type_offset; - - if ((atom1 <= 0) || (atom1 > map_tag_max) || - (atom2 <= 0) || (atom2 > map_tag_max) || (atom1 == atom2)) - error->one(FLERR,"Invalid atom ID in {}: {}", location, utils::trim(buf)); - if (itype <= 0 || itype > nbondtypes) - error->one(FLERR,"Invalid bond type in {}: {}", location, utils::trim(buf)); - if ((m = map(atom1)) >= 0) { - if (count) count[m]++; - else { - bond_type[m][num_bond[m]] = itype; - bond_atom[m][num_bond[m]] = atom2; - num_bond[m]++; - avec->data_bonds_post(m, num_bond[m], atom1, atom2, id_offset); + ValueTokenizer values(utils::trim_comment(buf)); + // skip over empty of comment lines + if (values.has_next()) { + try { + values.next_int(); + itype = values.next_int(); + atom1 = values.next_tagint(); + atom2 = values.next_tagint(); + if (values.has_next()) throw TokenizerException("Too many tokens",""); + } catch (TokenizerException &e) { + error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); } - } - if (newton_bond == 0) { - if ((m = map(atom2)) >= 0) { + if (id_offset) { + atom1 += id_offset; + atom2 += id_offset; + } + itype += type_offset; + + if ((atom1 <= 0) || (atom1 > map_tag_max) || + (atom2 <= 0) || (atom2 > map_tag_max) || (atom1 == atom2)) + error->one(FLERR,"Invalid atom ID in {}: {}", location, utils::trim(buf)); + if (itype <= 0 || itype > nbondtypes) + error->one(FLERR,"Invalid bond type in {}: {}", location, utils::trim(buf)); + if ((m = map(atom1)) >= 0) { if (count) count[m]++; else { bond_type[m][num_bond[m]] = itype; - bond_atom[m][num_bond[m]] = atom1; + bond_atom[m][num_bond[m]] = atom2; num_bond[m]++; avec->data_bonds_post(m, num_bond[m], atom1, atom2, id_offset); } } + if (newton_bond == 0) { + if ((m = map(atom2)) >= 0) { + if (count) count[m]++; + else { + bond_type[m][num_bond[m]] = itype; + bond_atom[m][num_bond[m]] = atom1; + num_bond[m]++; + avec->data_bonds_post(m, num_bond[m], atom1, atom2, id_offset); + } + } + } } buf = next + 1; } @@ -1305,44 +1268,36 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Angles section of data file"); *next = '\0'; - try { - ValueTokenizer values(utils::trim_comment(buf)); - values.next_int(); - itype = values.next_int(); - atom1 = values.next_tagint(); - atom2 = values.next_tagint(); - atom3 = values.next_tagint(); - if (values.has_next()) throw TokenizerException("Too many tokens",""); - } catch (TokenizerException &e) { - error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); - } - if (id_offset) { - atom1 += id_offset; - atom2 += id_offset; - atom3 += id_offset; - } - itype += type_offset; - - if ((atom1 <= 0) || (atom1 > map_tag_max) || - (atom2 <= 0) || (atom2 > map_tag_max) || - (atom3 <= 0) || (atom3 > map_tag_max) || - (atom1 == atom2) || (atom1 == atom3) || (atom2 == atom3)) - error->one(FLERR,"Invalid atom ID in {}: {}", location, utils::trim(buf)); - if (itype <= 0 || itype > nangletypes) - error->one(FLERR,"Invalid angle type in {}: {}", location, utils::trim(buf)); - if ((m = map(atom2)) >= 0) { - if (count) count[m]++; - else { - angle_type[m][num_angle[m]] = itype; - angle_atom1[m][num_angle[m]] = atom1; - angle_atom2[m][num_angle[m]] = atom2; - angle_atom3[m][num_angle[m]] = atom3; - num_angle[m]++; + ValueTokenizer values(utils::trim_comment(buf)); + // skip over empty or comment lines + if (values.has_next()) { + try { + values.next_int(); + itype = values.next_int(); + atom1 = values.next_tagint(); + atom2 = values.next_tagint(); + atom3 = values.next_tagint(); + if (values.has_next()) throw TokenizerException("Too many tokens",""); + } catch (TokenizerException &e) { + error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); } - } - if (newton_bond == 0) { - if ((m = map(atom1)) >= 0) { + if (id_offset) { + atom1 += id_offset; + atom2 += id_offset; + atom3 += id_offset; + } + itype += type_offset; + + if ((atom1 <= 0) || (atom1 > map_tag_max) || + (atom2 <= 0) || (atom2 > map_tag_max) || + (atom3 <= 0) || (atom3 > map_tag_max) || + (atom1 == atom2) || (atom1 == atom3) || (atom2 == atom3)) + error->one(FLERR,"Invalid atom ID in {}: {}", location, utils::trim(buf)); + if (itype <= 0 || itype > nangletypes) + error->one(FLERR,"Invalid angle type in {}: {}", location, utils::trim(buf)); + if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { angle_type[m][num_angle[m]] = itype; @@ -1352,14 +1307,26 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, num_angle[m]++; } } - if ((m = map(atom3)) >= 0) { - if (count) count[m]++; - else { - angle_type[m][num_angle[m]] = itype; - angle_atom1[m][num_angle[m]] = atom1; - angle_atom2[m][num_angle[m]] = atom2; - angle_atom3[m][num_angle[m]] = atom3; - num_angle[m]++; + if (newton_bond == 0) { + if ((m = map(atom1)) >= 0) { + if (count) count[m]++; + else { + angle_type[m][num_angle[m]] = itype; + angle_atom1[m][num_angle[m]] = atom1; + angle_atom2[m][num_angle[m]] = atom2; + angle_atom3[m][num_angle[m]] = atom3; + num_angle[m]++; + } + } + if ((m = map(atom3)) >= 0) { + if (count) count[m]++; + else { + angle_type[m][num_angle[m]] = itype; + angle_atom1[m][num_angle[m]] = atom1; + angle_atom2[m][num_angle[m]] = atom2; + angle_atom3[m][num_angle[m]] = atom3; + num_angle[m]++; + } } } } @@ -1385,49 +1352,40 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Dihedrals section of data file"); *next = '\0'; - try { - ValueTokenizer values(utils::trim_comment(buf)); - values.next_int(); - itype = values.next_int(); - atom1 = values.next_tagint(); - atom2 = values.next_tagint(); - atom3 = values.next_tagint(); - atom4 = values.next_tagint(); - if (values.has_next()) throw TokenizerException("Too many tokens",""); - } catch (TokenizerException &e) { - error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); - } - if (id_offset) { - atom1 += id_offset; - atom2 += id_offset; - atom3 += id_offset; - atom4 += id_offset; - } - itype += type_offset; + ValueTokenizer values(utils::trim_comment(buf)); + // skip over empty or comment lines + if (values.has_next()) { + try { + values.next_int(); + itype = values.next_int(); + atom1 = values.next_tagint(); + atom2 = values.next_tagint(); + atom3 = values.next_tagint(); + atom4 = values.next_tagint(); + if (values.has_next()) throw TokenizerException("Too many tokens",""); + } catch (TokenizerException &e) { + error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); + } + if (id_offset) { + atom1 += id_offset; + atom2 += id_offset; + atom3 += id_offset; + atom4 += id_offset; + } + itype += type_offset; - if ((atom1 <= 0) || (atom1 > map_tag_max) || - (atom2 <= 0) || (atom2 > map_tag_max) || - (atom3 <= 0) || (atom3 > map_tag_max) || - (atom4 <= 0) || (atom4 > map_tag_max) || - (atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) || - (atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4)) - error->one(FLERR, "Invalid atom ID in {}: {}", location, utils::trim(buf)); - if (itype <= 0 || itype > ndihedraltypes) - error->one(FLERR, "Invalid dihedral type in {}: {}", location, utils::trim(buf)); - if ((m = map(atom2)) >= 0) { - if (count) count[m]++; - else { - dihedral_type[m][num_dihedral[m]] = itype; - dihedral_atom1[m][num_dihedral[m]] = atom1; - dihedral_atom2[m][num_dihedral[m]] = atom2; - dihedral_atom3[m][num_dihedral[m]] = atom3; - dihedral_atom4[m][num_dihedral[m]] = atom4; - num_dihedral[m]++; - } - } - if (newton_bond == 0) { - if ((m = map(atom1)) >= 0) { + if ((atom1 <= 0) || (atom1 > map_tag_max) || + (atom2 <= 0) || (atom2 > map_tag_max) || + (atom3 <= 0) || (atom3 > map_tag_max) || + (atom4 <= 0) || (atom4 > map_tag_max) || + (atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) || + (atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4)) + error->one(FLERR, "Invalid atom ID in {}: {}", location, utils::trim(buf)); + if (itype <= 0 || itype > ndihedraltypes) + error->one(FLERR, "Invalid dihedral type in {}: {}", location, utils::trim(buf)); + if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { dihedral_type[m][num_dihedral[m]] = itype; @@ -1438,26 +1396,39 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, num_dihedral[m]++; } } - if ((m = map(atom3)) >= 0) { - if (count) count[m]++; - else { - dihedral_type[m][num_dihedral[m]] = itype; - dihedral_atom1[m][num_dihedral[m]] = atom1; - dihedral_atom2[m][num_dihedral[m]] = atom2; - dihedral_atom3[m][num_dihedral[m]] = atom3; - dihedral_atom4[m][num_dihedral[m]] = atom4; - num_dihedral[m]++; + if (newton_bond == 0) { + if ((m = map(atom1)) >= 0) { + if (count) count[m]++; + else { + dihedral_type[m][num_dihedral[m]] = itype; + dihedral_atom1[m][num_dihedral[m]] = atom1; + dihedral_atom2[m][num_dihedral[m]] = atom2; + dihedral_atom3[m][num_dihedral[m]] = atom3; + dihedral_atom4[m][num_dihedral[m]] = atom4; + num_dihedral[m]++; + } } - } - if ((m = map(atom4)) >= 0) { - if (count) count[m]++; - else { - dihedral_type[m][num_dihedral[m]] = itype; - dihedral_atom1[m][num_dihedral[m]] = atom1; - dihedral_atom2[m][num_dihedral[m]] = atom2; - dihedral_atom3[m][num_dihedral[m]] = atom3; - dihedral_atom4[m][num_dihedral[m]] = atom4; - num_dihedral[m]++; + if ((m = map(atom3)) >= 0) { + if (count) count[m]++; + else { + dihedral_type[m][num_dihedral[m]] = itype; + dihedral_atom1[m][num_dihedral[m]] = atom1; + dihedral_atom2[m][num_dihedral[m]] = atom2; + dihedral_atom3[m][num_dihedral[m]] = atom3; + dihedral_atom4[m][num_dihedral[m]] = atom4; + num_dihedral[m]++; + } + } + if ((m = map(atom4)) >= 0) { + if (count) count[m]++; + else { + dihedral_type[m][num_dihedral[m]] = itype; + dihedral_atom1[m][num_dihedral[m]] = atom1; + dihedral_atom2[m][num_dihedral[m]] = atom2; + dihedral_atom3[m][num_dihedral[m]] = atom3; + dihedral_atom4[m][num_dihedral[m]] = atom4; + num_dihedral[m]++; + } } } } @@ -1483,49 +1454,40 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset, for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Impropers section of data file"); *next = '\0'; - try { - ValueTokenizer values(utils::trim_comment(buf)); - values.next_int(); - itype = values.next_int(); - atom1 = values.next_tagint(); - atom2 = values.next_tagint(); - atom3 = values.next_tagint(); - atom4 = values.next_tagint(); - if (values.has_next()) throw TokenizerException("Too many tokens",""); - } catch (TokenizerException &e) { - error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); - } - if (id_offset) { - atom1 += id_offset; - atom2 += id_offset; - atom3 += id_offset; - atom4 += id_offset; - } - itype += type_offset; + ValueTokenizer values(utils::trim_comment(buf)); + // skip over empty or comment lines + if (values.has_next()) { + try { + values.next_int(); + itype = values.next_int(); + atom1 = values.next_tagint(); + atom2 = values.next_tagint(); + atom3 = values.next_tagint(); + atom4 = values.next_tagint(); + if (values.has_next()) throw TokenizerException("Too many tokens",""); + } catch (TokenizerException &e) { + error->one(FLERR,"{} in {}: {}", e.what(), location, utils::trim(buf)); + } + if (id_offset) { + atom1 += id_offset; + atom2 += id_offset; + atom3 += id_offset; + atom4 += id_offset; + } + itype += type_offset; - if ((atom1 <= 0) || (atom1 > map_tag_max) || - (atom2 <= 0) || (atom2 > map_tag_max) || - (atom3 <= 0) || (atom3 > map_tag_max) || - (atom4 <= 0) || (atom4 > map_tag_max) || - (atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) || - (atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4)) - error->one(FLERR, "Invalid atom ID in {}: {}", location, utils::trim(buf)); - if (itype <= 0 || itype > nimpropertypes) - error->one(FLERR, "Invalid improper type in {}: {}", location, utils::trim(buf)); - if ((m = map(atom2)) >= 0) { - if (count) count[m]++; - else { - improper_type[m][num_improper[m]] = itype; - improper_atom1[m][num_improper[m]] = atom1; - improper_atom2[m][num_improper[m]] = atom2; - improper_atom3[m][num_improper[m]] = atom3; - improper_atom4[m][num_improper[m]] = atom4; - num_improper[m]++; - } - } - if (newton_bond == 0) { - if ((m = map(atom1)) >= 0) { + if ((atom1 <= 0) || (atom1 > map_tag_max) || + (atom2 <= 0) || (atom2 > map_tag_max) || + (atom3 <= 0) || (atom3 > map_tag_max) || + (atom4 <= 0) || (atom4 > map_tag_max) || + (atom1 == atom2) || (atom1 == atom3) || (atom1 == atom4) || + (atom2 == atom3) || (atom2 == atom4) || (atom3 == atom4)) + error->one(FLERR, "Invalid atom ID in {}: {}", location, utils::trim(buf)); + if (itype <= 0 || itype > nimpropertypes) + error->one(FLERR, "Invalid improper type in {}: {}", location, utils::trim(buf)); + if ((m = map(atom2)) >= 0) { if (count) count[m]++; else { improper_type[m][num_improper[m]] = itype; @@ -1536,26 +1498,39 @@ void Atom::data_impropers(int n, char *buf, int *count, tagint id_offset, num_improper[m]++; } } - if ((m = map(atom3)) >= 0) { - if (count) count[m]++; - else { - improper_type[m][num_improper[m]] = itype; - improper_atom1[m][num_improper[m]] = atom1; - improper_atom2[m][num_improper[m]] = atom2; - improper_atom3[m][num_improper[m]] = atom3; - improper_atom4[m][num_improper[m]] = atom4; - num_improper[m]++; + if (newton_bond == 0) { + if ((m = map(atom1)) >= 0) { + if (count) count[m]++; + else { + improper_type[m][num_improper[m]] = itype; + improper_atom1[m][num_improper[m]] = atom1; + improper_atom2[m][num_improper[m]] = atom2; + improper_atom3[m][num_improper[m]] = atom3; + improper_atom4[m][num_improper[m]] = atom4; + num_improper[m]++; + } } - } - if ((m = map(atom4)) >= 0) { - if (count) count[m]++; - else { - improper_type[m][num_improper[m]] = itype; - improper_atom1[m][num_improper[m]] = atom1; - improper_atom2[m][num_improper[m]] = atom2; - improper_atom3[m][num_improper[m]] = atom3; - improper_atom4[m][num_improper[m]] = atom4; - num_improper[m]++; + if ((m = map(atom3)) >= 0) { + if (count) count[m]++; + else { + improper_type[m][num_improper[m]] = itype; + improper_atom1[m][num_improper[m]] = atom1; + improper_atom2[m][num_improper[m]] = atom2; + improper_atom3[m][num_improper[m]] = atom3; + improper_atom4[m][num_improper[m]] = atom4; + num_improper[m]++; + } + } + if ((m = map(atom4)) >= 0) { + if (count) count[m]++; + else { + improper_type[m][num_improper[m]] = itype; + improper_atom1[m][num_improper[m]] = atom1; + improper_atom2[m][num_improper[m]] = atom2; + improper_atom3[m][num_improper[m]] = atom3; + improper_atom4[m][num_improper[m]] = atom4; + num_improper[m]++; + } } } } @@ -1574,34 +1549,29 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) int m; char *next; - next = strchr(buf,'\n'); - *next = '\0'; - int nwords = utils::trim_and_count_words(buf); - *next = '\n'; - - if (nwords != avec_bonus->size_data_bonus) - error->all(FLERR,"Incorrect bonus data format in data file"); - // loop over lines of bonus atom data // tokenize the line into values // if I own atom tag, unpack its values for (int i = 0; i < n; i++) { next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Bonus section of data file"); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - if ((int)values.size() != nwords) - error->all(FLERR, "Incorrect atom format in data file: {}", utils::trim(buf)); + if (values.size() == 0) { + // skip over empty or comment lines + } else if ((int)values.size() != avec_bonus->size_data_bonus) { + error->all(FLERR, "Incorrect bonus data format in data file: {}", utils::trim(buf)); + } else { + tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; + if (tagdata <= 0 || tagdata > map_tag_max) + error->one(FLERR,"Invalid atom ID in Bonus section of data file"); - tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; - if (tagdata <= 0 || tagdata > map_tag_max) - error->one(FLERR,"Invalid atom ID in Bonus section of data file"); - - // ok to call child's data_atom_bonus() method thru parent avec_bonus, - // since data_bonus() was called with child ptr, and method is virtual - - if ((m = map(tagdata)) >= 0) avec_bonus->data_atom_bonus(m,values); + // ok to call child's data_atom_bonus() method thru parent avec_bonus, + // since data_bonus() was called with child ptr, and method is virtual + if ((m = map(tagdata)) >= 0) avec_bonus->data_atom_bonus(m,values); + } buf = next + 1; } } @@ -1626,46 +1596,49 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) for (int i = 0; i < n; i++) { char *next = strchr(buf,'\n'); + if (!next) error->all(FLERR, "Missing data in Bodies section of data file"); *next = '\0'; auto values = Tokenizer(utils::trim_comment(buf)).as_vector(); - tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; - int ninteger = utils::inumeric(FLERR,values[1],false,lmp); - int ndouble = utils::inumeric(FLERR,values[2],false,lmp); + if (values.size()) { + tagint tagdata = utils::tnumeric(FLERR,values[0],false,lmp) + id_offset; + int ninteger = utils::inumeric(FLERR,values[1],false,lmp); + int ndouble = utils::inumeric(FLERR,values[2],false,lmp); - if (unique_tags->find(tagdata) == unique_tags->end()) - unique_tags->insert(tagdata); - else - error->one(FLERR,"Duplicate atom ID in Bodies section of data file"); + if (unique_tags->find(tagdata) == unique_tags->end()) + unique_tags->insert(tagdata); + else + error->one(FLERR,"Duplicate atom ID {} in Bodies section of data file", tagdata); - buf = next + 1; - int m = map(tagdata); - if (m >= 0) { - ivalues.resize(ninteger); - dvalues.resize(ndouble); + buf = next + 1; + int m = map(tagdata); + if (m >= 0) { + ivalues.resize(ninteger); + dvalues.resize(ndouble); - for (int j = 0; j < ninteger; j++) { - buf += strspn(buf," \t\n\r\f"); - buf[strcspn(buf," \t\n\r\f")] = '\0'; - ivalues[j] = utils::inumeric(FLERR,buf,false,lmp); - buf += strlen(buf)+1; - } + for (int j = 0; j < ninteger; j++) { + buf += strspn(buf," \t\n\r\f"); + buf[strcspn(buf," \t\n\r\f")] = '\0'; + ivalues[j] = utils::inumeric(FLERR,buf,false,lmp); + buf += strlen(buf)+1; + } - for (int j = 0; j < ndouble; j++) { - buf += strspn(buf," \t\n\r\f"); - buf[strcspn(buf," \t\n\r\f")] = '\0'; - dvalues[j] = utils::numeric(FLERR,buf,false,lmp); - buf += strlen(buf)+1; - } + for (int j = 0; j < ndouble; j++) { + buf += strspn(buf," \t\n\r\f"); + buf[strcspn(buf," \t\n\r\f")] = '\0'; + dvalues[j] = utils::numeric(FLERR,buf,false,lmp); + buf += strlen(buf)+1; + } - avec_body->data_body(m,ninteger,ndouble,ivalues.data(),dvalues.data()); + avec_body->data_body(m,ninteger,ndouble,ivalues.data(),dvalues.data()); - } else { - int nvalues = ninteger + ndouble; // number of values to skip - for (int j = 0; j < nvalues; j++) { - buf += strspn(buf," \t\n\r\f"); - buf[strcspn(buf," \t\n\r\f")] = '\0'; - buf += strlen(buf)+1; + } else { + int nvalues = ninteger + ndouble; // number of values to skip + for (int j = 0; j < nvalues; j++) { + buf += strspn(buf," \t\n\r\f"); + buf[strcspn(buf," \t\n\r\f")] = '\0'; + buf += strlen(buf)+1; + } } } buf += strspn(buf," \t\n\r\f"); @@ -1720,24 +1693,26 @@ void Atom::allocate_type_arrays() void Atom::set_mass(const char *file, int line, const char *str, int type_offset) { - if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for atom style {}", atom_style); int itype; double mass_one; - try { - ValueTokenizer values(utils::trim_comment(str)); - itype = values.next_int() + type_offset; - mass_one = values.next_double(); - if (values.has_next()) throw TokenizerException("Too many tokens", ""); + ValueTokenizer values(utils::trim_comment(str)); + if (values.has_next()) { + try { + itype = values.next_int() + type_offset; + mass_one = values.next_double(); + if (values.has_next()) throw TokenizerException("Too many tokens", ""); - if (itype < 1 || itype > ntypes) throw TokenizerException("Invalid atom type", ""); - if (mass_one <= 0.0) throw TokenizerException("Invalid mass value", ""); - } catch (TokenizerException &e) { - error->all(file,line,"{} in Masses section of data file: {}", e.what(), utils::trim(str)); + if (itype < 1 || itype > ntypes) throw TokenizerException("Invalid atom type", ""); + if (mass_one <= 0.0) throw TokenizerException("Invalid mass value", ""); + } catch (TokenizerException &e) { + error->all(file,line,"{} in Masses section of data file: {}", e.what(), utils::trim(str)); + } + + mass[itype] = mass_one; + mass_setflag[itype] = 1; } - - mass[itype] = mass_one; - mass_setflag[itype] = 1; } /* ---------------------------------------------------------------------- @@ -1747,14 +1722,13 @@ void Atom::set_mass(const char *file, int line, const char *str, int type_offset void Atom::set_mass(const char *file, int line, int itype, double value) { - if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for atom style {}", atom_style); if (itype < 1 || itype > ntypes) - error->all(file,line,"Invalid type for mass set"); + error->all(file,line,"Invalid type {} for atom mass {}", itype, value); + if (value <= 0.0) error->all(file,line,"Invalid atom mass value {}", value); mass[itype] = value; mass_setflag[itype] = 1; - - if (mass[itype] <= 0.0) error->all(file,line,"Invalid mass value"); } /* ---------------------------------------------------------------------- @@ -1764,17 +1738,19 @@ void Atom::set_mass(const char *file, int line, int itype, double value) void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) { - if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set atom mass for atom style", atom_style); int 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"); + if ((lo < 1) || (hi > ntypes)) + error->all(file,line,"Invalid type {} for atom mass {}", arg[1]); + + const double value = utils::numeric(FLERR,arg[1],false,lmp); + if (value <= 0.0) error->all(file,line,"Invalid atom mass value {}", value); for (int itype = lo; itype <= hi; itype++) { - mass[itype] = utils::numeric(FLERR,arg[1],false,lmp); + mass[itype] = value; mass_setflag[itype] = 1; - - if (mass[itype] <= 0.0) error->all(file,line,"Invalid mass value"); } } @@ -1801,7 +1777,7 @@ void Atom::check_mass(const char *file, int line) if (rmass_flag) return; for (int itype = 1; itype <= ntypes; itype++) if (mass_setflag[itype] == 0) - error->all(file,line,"Not all per-type masses are set"); + error->all(file,line,"Not all per-type masses are set. Type {} is missing.", itype); } /* ---------------------------------------------------------------------- @@ -1834,14 +1810,13 @@ int Atom::radius_consistency(int itype, double &rad) also return the 3 shape params for itype ------------------------------------------------------------------------- */ -int Atom::shape_consistency(int itype, - double &shapex, double &shapey, double &shapez) +int Atom::shape_consistency(int itype, double &shapex, double &shapey, double &shapez) { double zero[3] = {0.0, 0.0, 0.0}; double one[3] = {-1.0, -1.0, -1.0}; double *shape; - auto avec_ellipsoid = (AtomVecEllipsoid *) style_match("ellipsoid"); + auto avec_ellipsoid = dynamic_cast( style_match("ellipsoid")); auto bonus = avec_ellipsoid->bonus; int flag = 0; @@ -1854,7 +1829,7 @@ int Atom::shape_consistency(int itype, one[0] = shape[0]; one[1] = shape[1]; one[2] = shape[2]; - } else if (one[0] != shape[0] || one[1] != shape[1] || one[2] != shape[2]) + } else if ((one[0] != shape[0]) || (one[1] != shape[1]) || (one[2] != shape[2])) flag = 1; } @@ -1876,10 +1851,10 @@ int Atom::shape_consistency(int itype, void Atom::add_molecule(int narg, char **arg) { - if (narg < 1) error->all(FLERR,"Illegal molecule command"); + if (narg < 1) utils::missing_cmd_args(FLERR, "molecule", error); if (find_molecule(arg[0]) >= 0) - error->all(FLERR,"Reuse of molecule template ID"); + error->all(FLERR,"Reuse of molecule template ID {}", arg[0]); // 1st molecule in set stores nset = # of mols, others store nset = 0 // ifile = count of molecules in set @@ -1889,8 +1864,7 @@ void Atom::add_molecule(int narg, char **arg) int index = 1; while (true) { molecules = (Molecule **) - memory->srealloc(molecules,(nmolecule+1)*sizeof(Molecule *), - "atom::molecules"); + memory->srealloc(molecules,(nmolecule+1)*sizeof(Molecule *), "atom::molecules"); molecules[nmolecule] = new Molecule(lmp,narg,arg,index); molecules[nmolecule]->nset = 0; molecules[nmolecule-ifile+1]->nset++; @@ -1920,8 +1894,7 @@ int Atom::find_molecule(char *id) called by fixes and commands that add molecules ------------------------------------------------------------------------- */ -void Atom::add_molecule_atom(Molecule *onemol, int iatom, - int ilocal, tagint offset) +void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint offset) { if (onemol->qflag && q_flag) q[ilocal] = onemol->q[iatom]; if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom]; @@ -1936,6 +1909,19 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, onemol->avec_body->set_quat(ilocal,onemol->quat_external); } + // initialize custom per-atom properties to zero if present + + for (int i = 0; i < nivector; ++i) + ivector[i][ilocal] = 0; + for (int i = 0; i < ndvector; ++i) + dvector[i][ilocal] = 0.0; + for (int i = 0; i < niarray; ++i) + for (int j = 0; j < icols[i]; ++j) + iarray[i][ilocal][j] = 0; + for (int i = 0; i < ndarray; ++i) + for (int j = 0; j < dcols[i]; ++j) + darray[i][ilocal][j] = 0.0; + if (molecular != Atom::MOLECULAR) return; // add bond topology info @@ -2138,8 +2124,7 @@ void Atom::setup_sort_bins() if ((binsize == 0.0) && (sortfreq > 0)) { sortfreq = 0; if (comm->me == 0) - error->warning(FLERR,"No pairwise cutoff or binsize set. " - "Atom sorting therefore disabled."); + error->warning(FLERR,"No pairwise cutoff or binsize set. Atom sorting therefore disabled."); return; } @@ -2216,7 +2201,7 @@ void Atom::setup_sort_bins() #ifdef LMP_GPU if (userbinsize == 0.0) { - FixGPU *fix = (FixGPU *)modify->get_fix_by_id("package_gpu"); + FixGPU *fix = dynamic_cast(modify->get_fix_by_id("package_gpu")); if (fix) { const double subx = domain->subhi[0] - domain->sublo[0]; const double suby = domain->subhi[1] - domain->sublo[1]; @@ -2241,8 +2226,7 @@ void Atom::setup_sort_bins() } #endif - if (1.0*nbinx*nbiny*nbinz > INT_MAX) - error->one(FLERR,"Too many atom sorting bins"); + if (1.0*nbinx*nbiny*nbinz > INT_MAX) error->one(FLERR,"Too many atom sorting bins"); nbins = nbinx*nbiny*nbinz; @@ -2487,25 +2471,25 @@ void Atom::remove_custom(int index, int flag, int cols) if (flag == 0 && cols == 0) { memory->destroy(ivector[index]); ivector[index] = nullptr; - delete [] ivname[index]; + delete[] ivname[index]; ivname[index] = nullptr; } else if (flag == 1 && cols == 0) { memory->destroy(dvector[index]); dvector[index] = nullptr; - delete [] dvname[index]; + delete[] dvname[index]; dvname[index] = nullptr; } else if (flag == 0 && cols) { memory->destroy(iarray[index]); iarray[index] = nullptr; - delete [] ianame[index]; + delete[] ianame[index]; ianame[index] = nullptr; } else if (flag == 1 && cols) { memory->destroy(darray[index]); darray[index] = nullptr; - delete [] daname[index]; + delete[] daname[index]; daname[index] = nullptr; } } @@ -2614,6 +2598,10 @@ length of the data area, and a short description. - int - 1 - 1 if the particle is a body particle, 0 if not + * - quat + - double + - 4 + - four quaternion components of the particles * - i_name - int - 1 @@ -2669,6 +2657,7 @@ void *Atom::extract(const char *name) 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,"quat") == 0) return (void *) quat; if (strcmp(name,"vfrac") == 0) return (void *) vfrac; if (strcmp(name,"s0") == 0) return (void *) s0; @@ -2791,6 +2780,7 @@ int Atom::extract_datatype(const char *name) if (strcmp(name,"line") == 0) return LAMMPS_INT; if (strcmp(name,"tri") == 0) return LAMMPS_INT; if (strcmp(name,"body") == 0) return LAMMPS_INT; + if (strcmp(name,"quat") == 0) return LAMMPS_DOUBLE_2D; if (strcmp(name,"vfrac") == 0) return LAMMPS_DOUBLE; if (strcmp(name,"s0") == 0) return LAMMPS_DOUBLE; @@ -2894,4 +2884,3 @@ double Atom::memory_usage() return bytes; } - diff --git a/src/atom.h b/src/atom.h index 2c1acb7805..499e5f0d0f 100644 --- a/src/atom.h +++ b/src/atom.h @@ -79,6 +79,7 @@ class Atom : protected Pointers { double *radius; double **omega, **angmom, **torque; int *ellipsoid, *line, *tri, *body; + double **quat; // molecular systems @@ -180,7 +181,7 @@ class Atom : protected Pointers { int molecule_flag, molindex_flag, molatom_flag; int q_flag, mu_flag; - int rmass_flag, radius_flag, omega_flag, torque_flag, angmom_flag; + int rmass_flag, radius_flag, omega_flag, torque_flag, angmom_flag, quat_flag; int vfrac_flag, spin_flag, eradius_flag, ervel_flag, erforce_flag; int cs_flag, csforce_flag, vforce_flag, ervelforce_flag, etag_flag; int rho_flag, esph_flag, cv_flag, vest_flag; @@ -202,13 +203,17 @@ class Atom : protected Pointers { double pdscale; + // DIELECTRIC package + + int dielectric_flag; + // end of customization section // -------------------------------------------------------------------- // per-atom data struct describing all per-atom vectors/arrays struct PerAtom { - char *name; + std::string name; void *address; void *address_length; int *address_maxcols; @@ -218,8 +223,7 @@ class Atom : protected Pointers { int threadflag; }; - PerAtom *peratom; - int nperatom, maxperatom; + std::vector peratom; // custom vectors and arrays used by fix property/atom @@ -288,9 +292,9 @@ class Atom : protected Pointers { void settings(class Atom *); void peratom_create(); - void add_peratom(const char *, void *, int, int, int threadflag = 0); - void add_peratom_change_columns(const char *, int); - void add_peratom_vary(const char *, void *, int, int *, void *, int collength = 0); + void add_peratom(const std::string &, void *, int, int, int threadflag = 0); + void add_peratom_change_columns(const std::string &, int); + void add_peratom_vary(const std::string &, void *, int, int *, void *, int collength = 0); void create_avec(const std::string &, int, char **, int); virtual AtomVec *new_avec(const std::string &, int, int &); @@ -421,187 +425,3 @@ class Atom : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Atom IDs must be used for molecular systems - -Atom IDs are used to identify and find partner atoms in bonds. - -E: Unrecognized atom style - -The choice of atom style is unknown. - -E: Could not find atom_modify first group ID - -Self-explanatory. - -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: Atom_modify id command after simulation box is defined - -The atom_modify id command cannot be used after a read_data, -read_restart, or create_box command. - -E: Atom_modify map command after simulation box is defined - -The atom_modify map command cannot be used after a read_data, -read_restart, or create_box command. - -E: Atom_modify sort and first options cannot be used together - -Self-explanatory. - -E: One or more Atom IDs is negative - -Atom IDs must be positive integers. - -E: One or more atom IDs is too big - -The limit on atom IDs is set by the SMALLBIG, BIGBIG, SMALLSMALL -setting in your Makefile. See Section_start 2.2 of the manual for -more details. - -E: One or more atom IDs is zero - -Either all atoms IDs must be zero or none of them. - -E: Non-zero atom IDs with atom_modify id = no - -Self-explanatory. - -E: All atom IDs = 0 but atom_modify id = yes - -Self-explanatory. - -E: Duplicate atom IDs exist - -Self-explanatory. - -E: New atom IDs exceed maximum allowed ID - -See the setting for tagint in the src/lmptype.h file. - -E: Incorrect atom format in data file - -Number of values per atom line in the data file is not consistent with -the atom style. - -E: Incorrect format of ... section in data file - -Number or type of values per line in the given section of the data file -is not consistent with the requirements for this section. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Incorrect velocity format in data file - -Each atom style defines a format for the Velocity section -of the data file. The read-in lines do not match. - -E: Invalid atom ID in Velocities section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Invalid atom ID in Bonds section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Invalid bond type in Bonds section of data file - -Bond type must be positive integer and within range of specified bond -types. - -E: Invalid atom ID in Angles section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Invalid angle type in Angles section of data file - -Angle type must be positive integer and within range of specified angle -types. - -E: Invalid atom ID in Dihedrals section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Invalid dihedral type in Dihedrals section of data file - -Dihedral type must be positive integer and within range of specified -dihedral types. - -E: Invalid atom ID in Impropers section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Invalid improper type in Impropers section of data file - -Improper type must be positive integer and within range of specified -improper types. - -E: Incorrect bonus data format in data file - -See the read_data doc page for a description of how various kinds of -bonus data must be formatted for certain atom styles. - -E: Invalid atom ID in Bonus section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Invalid atom ID in Bodies section of data file - -Atom IDs must be positive integers and within range of defined -atoms. - -E: Reuse of molecule template ID - -The template IDs must be unique. - -E: Atom sort did not operate correctly - -This is an internal LAMMPS error. Please report it to the -developers. - -E: Too many atom sorting bins - -This is likely due to an immense simulation box that has blown up -to a large size. - -U: Cannot set mass for this atom style - -This atom style does not support mass settings for each atom type. -Instead they are defined on a per-atom basis in the data file. - -U: Invalid mass line in data file - -Self-explanatory. - -U: Invalid type for mass set - -Mass command must set a type from 1-N where N is the number of atom -types. - -U: Invalid mass value - -Self-explanatory. - -U: All masses are not set - -For atom styles that define masses for each atom type, all masses must -be set in the data file or by the mass command before running a -simulation. They must also be set before using the velocity -command. - -*/ diff --git a/src/atom_map.h b/src/atom_map.h index 73f824b43b..1a1bf3fe84 100644 --- a/src/atom_map.h +++ b/src/atom_map.h @@ -10,11 +10,3 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ - -/* ERROR/WARNING messages: - -E: Cannot create an atom map unless atoms have IDs - -UNDOCUMENTED - -*/ diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index aa646ecabb..deff0cfd58 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -28,7 +27,24 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; + +// peratom variables that are auto-included in corresponding child style field lists +// these fields cannot be specified in the fields strings + +const std::vector AtomVec::default_grow = {"id", "type", "mask", "image", + "x", "v", "f"}; +const std::vector AtomVec::default_copy = {"id", "type", "mask", "image", "x", "v"}; +const std::vector AtomVec::default_comm = {"x"}; +const std::vector AtomVec::default_comm_vel = {"x", "v"}; +const std::vector AtomVec::default_reverse = {"f"}; +const std::vector AtomVec::default_border = {"id", "type", "mask", "x"}; +const std::vector AtomVec::default_border_vel = {"id", "type", "mask", "x", "v"}; +const std::vector AtomVec::default_exchange = {"id", "type", "mask", + "image", "x", "v"}; +const std::vector AtomVec::default_restart = {"id", "type", "mask", "image", "x", "v"}; +const std::vector AtomVec::default_create = {"id", "type", "mask", "image", "x", "v"}; +const std::vector AtomVec::default_data_atom = {}; +const std::vector AtomVec::default_data_vel = {}; /* ---------------------------------------------------------------------- */ @@ -56,33 +72,17 @@ AtomVec::AtomVec(LAMMPS *lmp) : Pointers(lmp) x = v = f = nullptr; threads = nullptr; - - // peratom variables auto-included in corresponding child style fields string - // these fields cannot be specified in the fields string - - default_grow = "id type mask image x v f"; - default_copy = "id type mask image x v"; - default_comm = "x"; - default_comm_vel = "x v"; - default_reverse = "f"; - default_border = "id type mask x"; - default_border_vel = "id type mask x v"; - default_exchange = "id type mask image x v"; - default_restart = "id type mask image x v"; - default_create = "id type mask image x v"; - default_data_atom = ""; - default_data_vel = ""; } /* ---------------------------------------------------------------------- */ AtomVec::~AtomVec() { - int datatype,cols; + int datatype, cols; void *pdata; - for (int i = 0; i < nargcopy; i++) delete [] argcopy[i]; - delete [] argcopy; + for (int i = 0; i < nargcopy; i++) delete[] argcopy[i]; + delete[] argcopy; for (int i = 0; i < ngrow; i++) { pdata = mgrow.pdata[i]; @@ -115,7 +115,7 @@ AtomVec::~AtomVec() } } - delete [] threads; + delete[] threads; } /* ---------------------------------------------------------------------- @@ -125,10 +125,11 @@ AtomVec::~AtomVec() void AtomVec::store_args(int narg, char **arg) { nargcopy = narg; - if (nargcopy) argcopy = new char*[nargcopy]; - else argcopy = nullptr; - for (int i = 0; i < nargcopy; i++) - argcopy[i] = utils::strdup(arg[i]); + if (nargcopy) + argcopy = new char *[nargcopy]; + else + argcopy = nullptr; + for (int i = 0; i < nargcopy; i++) argcopy[i] = utils::strdup(arg[i]); } /* ---------------------------------------------------------------------- @@ -137,7 +138,7 @@ void AtomVec::store_args(int narg, char **arg) void AtomVec::process_args(int narg, char ** /*arg*/) { - if (narg) error->all(FLERR,"Invalid atom_style command"); + if (narg) error->all(FLERR, "Invalid atom_style command"); } /* ---------------------------------------------------------------------- @@ -152,10 +153,10 @@ void AtomVec::init() h_rate = domain->h_rate; if (lmp->kokkos != nullptr && !kokkosable) - error->all(FLERR,"KOKKOS package requires a kokkos enabled atom_style"); + error->all(FLERR, "KOKKOS package requires a kokkos enabled atom_style"); } -static constexpr bigint DELTA=16384; +static constexpr bigint DELTA = 16384; /* ---------------------------------------------------------------------- roundup N so it is a multiple of DELTA @@ -164,9 +165,8 @@ static constexpr bigint DELTA=16384; bigint AtomVec::roundup(bigint n) { - if (n % DELTA) n = n/DELTA * DELTA + DELTA; - if (n > MAXSMALLINT) - error->one(FLERR,"Too many atoms created on one or more procs"); + if (n % DELTA) n = n / DELTA * DELTA + DELTA; + if (n > MAXSMALLINT) error->one(FLERR, "Too many atoms created on one or more procs"); return n; } @@ -176,11 +176,11 @@ bigint AtomVec::roundup(bigint n) void AtomVec::grow_nmax() { - nmax = nmax/DELTA * DELTA; + nmax = nmax / DELTA * DELTA; nmax += DELTA; } -static constexpr bigint DELTA_BONUS=8192; +static constexpr bigint DELTA_BONUS = 8192; /* ---------------------------------------------------------------------- grow nmax_bonus so it is a multiple of DELTA_BONUS @@ -188,7 +188,7 @@ static constexpr bigint DELTA_BONUS=8192; int AtomVec::grow_nmax_bonus(int nmax_bonus) { - nmax_bonus = nmax_bonus/DELTA_BONUS * DELTA_BONUS; + nmax_bonus = nmax_bonus / DELTA_BONUS * DELTA_BONUS; nmax_bonus += DELTA_BONUS; return nmax_bonus; } @@ -201,22 +201,23 @@ int AtomVec::grow_nmax_bonus(int nmax_bonus) void AtomVec::grow(int n) { - int datatype,cols,maxcols; + int datatype, cols, maxcols; void *pdata; - if (n == 0) grow_nmax(); - else nmax = n; + if (n == 0) + grow_nmax(); + else + nmax = n; atom->nmax = nmax; - if (nmax < 0 || nmax > MAXSMALLINT) - error->one(FLERR,"Per-processor system is too big"); + if (nmax < 0 || nmax > MAXSMALLINT) error->one(FLERR, "Per-processor system is too big"); - tag = memory->grow(atom->tag,nmax,"atom:tag"); - type = memory->grow(atom->type,nmax,"atom:type"); - mask = memory->grow(atom->mask,nmax,"atom:mask"); - image = memory->grow(atom->image,nmax,"atom:image"); - x = memory->grow(atom->x,nmax,3,"atom:x"); - v = memory->grow(atom->v,nmax,3,"atom:v"); - f = memory->grow(atom->f,nmax*comm->nthreads,3,"atom:f"); + tag = memory->grow(atom->tag, nmax, "atom:tag"); + type = memory->grow(atom->type, nmax, "atom:type"); + mask = memory->grow(atom->mask, nmax, "atom:mask"); + image = memory->grow(atom->image, nmax, "atom:image"); + x = memory->grow(atom->x, nmax, 3, "atom:x"); + v = memory->grow(atom->v, nmax, 3, "atom:v"); + f = memory->grow(atom->f, nmax * comm->nthreads, 3, "atom:f"); for (int i = 0; i < ngrow; i++) { pdata = mgrow.pdata[i]; @@ -225,30 +226,30 @@ void AtomVec::grow(int n) const int nthreads = threads[i] ? comm->nthreads : 1; if (datatype == Atom::DOUBLE) { if (cols == 0) - memory->grow(*((double **) pdata),nmax*nthreads,"atom:dvec"); + memory->grow(*((double **) pdata), nmax * nthreads, "atom:dvec"); else if (cols > 0) - memory->grow(*((double ***) pdata),nmax*nthreads,cols,"atom:darray"); + memory->grow(*((double ***) pdata), nmax * nthreads, cols, "atom:darray"); else { maxcols = *(mgrow.maxcols[i]); - memory->grow(*((double ***) pdata),nmax*nthreads,maxcols,"atom:darray"); + memory->grow(*((double ***) pdata), nmax * nthreads, maxcols, "atom:darray"); } } else if (datatype == Atom::INT) { if (cols == 0) - memory->grow(*((int **) pdata),nmax*nthreads,"atom:ivec"); + memory->grow(*((int **) pdata), nmax * nthreads, "atom:ivec"); else if (cols > 0) - memory->grow(*((int ***) pdata),nmax*nthreads,cols,"atom:iarray"); + memory->grow(*((int ***) pdata), nmax * nthreads, cols, "atom:iarray"); else { maxcols = *(mgrow.maxcols[i]); - memory->grow(*((int ***) pdata),nmax*nthreads,maxcols,"atom:iarray"); + memory->grow(*((int ***) pdata), nmax * nthreads, maxcols, "atom:iarray"); } } else if (datatype == Atom::BIGINT) { if (cols == 0) - memory->grow(*((bigint **) pdata),nmax*nthreads,"atom:bvec"); + memory->grow(*((bigint **) pdata), nmax * nthreads, "atom:bvec"); else if (cols > 0) - memory->grow(*((bigint ***) pdata),nmax*nthreads,cols,"atom:barray"); + memory->grow(*((bigint ***) pdata), nmax * nthreads, cols, "atom:barray"); else { maxcols = *(mgrow.maxcols[i]); - memory->grow(*((bigint ***) pdata),nmax*nthreads,maxcols,"atom:barray"); + memory->grow(*((bigint ***) pdata), nmax * nthreads, maxcols, "atom:barray"); } } } @@ -265,8 +266,8 @@ void AtomVec::grow(int n) void AtomVec::copy(int i, int j, int delflag) { - int m,n,datatype,cols,collength,ncols; - void *pdata,*plength; + int m, n, datatype, cols, collength, ncols; + void *pdata, *plength; tag[j] = tag[i]; type[j] = type[i]; @@ -290,33 +291,33 @@ void AtomVec::copy(int i, int j, int delflag) vec[j] = vec[i]; } else if (cols > 0) { double **array = *((double ***) pdata); - for (m = 0; m < cols; m++) - array[j][m] = array[i][m]; + for (m = 0; m < cols; m++) array[j][m] = array[i][m]; } else { double **array = *((double ***) pdata); collength = mcopy.collength[n]; plength = mcopy.plength[n]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (m = 0; m < ncols; m++) - array[j][m] = array[i][m]; - } + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (m = 0; m < ncols; m++) array[j][m] = array[i][m]; + } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); vec[j] = vec[i]; } else if (cols > 0) { int **array = *((int ***) pdata); - for (m = 0; m < cols; m++) - array[j][m] = array[i][m]; + for (m = 0; m < cols; m++) array[j][m] = array[i][m]; } else { int **array = *((int ***) pdata); collength = mcopy.collength[n]; plength = mcopy.plength[n]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (m = 0; m < ncols; m++) - array[j][m] = array[i][m]; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (m = 0; m < ncols; m++) array[j][m] = array[i][m]; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -324,35 +325,34 @@ void AtomVec::copy(int i, int j, int delflag) vec[j] = vec[i]; } else if (cols > 0) { bigint **array = *((bigint ***) pdata); - for (m = 0; m < cols; m++) - array[j][m] = array[i][m]; + for (m = 0; m < cols; m++) array[j][m] = array[i][m]; } else { bigint **array = *((bigint ***) pdata); collength = mcopy.collength[n]; plength = mcopy.plength[n]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (m = 0; m < ncols; m++) - array[j][m] = array[i][m]; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (m = 0; m < ncols; m++) array[j][m] = array[i][m]; } } } } - if (bonus_flag) copy_bonus(i,j,delflag); + if (bonus_flag) copy_bonus(i, j, delflag); if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - modify->fix[atom->extra_grow[iextra]]->copy_arrays(i,j,delflag); + modify->fix[atom->extra_grow[iextra]]->copy_arrays(i, j, delflag); } /* ---------------------------------------------------------------------- */ -int AtomVec::pack_comm(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int AtomVec::pack_comm(int n, int *list, double *buf, int pbc_flag, int *pbc) { - int i,j,m,mm,nn,datatype,cols; - double dx,dy,dz; + int i, j, m, mm, nn, datatype, cols; + double dx, dy, dz; void *pdata; m = 0; @@ -365,13 +365,13 @@ int AtomVec::pack_comm(int n, int *list, double *buf, } } else { if (domain->triclinic == 0) { - dx = pbc[0]*domain->xprd; - dy = pbc[1]*domain->yprd; - dz = pbc[2]*domain->zprd; + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; } else { - dx = pbc[0]*domain->xprd + pbc[5]*domain->xy + pbc[4]*domain->xz; - dy = pbc[1]*domain->yprd + pbc[3]*domain->yz; - dz = pbc[2]*domain->zprd; + dx = pbc[0] * domain->xprd + pbc[5] * domain->xy + pbc[4] * domain->xz; + dy = pbc[1] * domain->yprd + pbc[3] * domain->yz; + dz = pbc[2] * domain->zprd; } for (i = 0; i < n; i++) { j = list[i]; @@ -397,8 +397,7 @@ int AtomVec::pack_comm(int n, int *list, double *buf, double **array = *((double ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = array[j][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[j][mm]; } } } else if (datatype == Atom::INT) { @@ -412,8 +411,7 @@ int AtomVec::pack_comm(int n, int *list, double *buf, int **array = *((int ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } else if (datatype == Atom::BIGINT) { @@ -427,26 +425,24 @@ int AtomVec::pack_comm(int n, int *list, double *buf, bigint **array = *((bigint ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } } } - if (bonus_flag) m += pack_comm_bonus(n,list,&buf[m]); + if (bonus_flag) m += pack_comm_bonus(n, list, &buf[m]); return m; } /* ---------------------------------------------------------------------- */ -int AtomVec::pack_comm_vel(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int AtomVec::pack_comm_vel(int n, int *list, double *buf, int pbc_flag, int *pbc) { - int i,j,m,mm,nn,datatype,cols; - double dx,dy,dz,dvx,dvy,dvz; + int i, j, m, mm, nn, datatype, cols; + double dx, dy, dz, dvx, dvy, dvz; void *pdata; m = 0; @@ -462,13 +458,13 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf, } } else { if (domain->triclinic == 0) { - dx = pbc[0]*domain->xprd; - dy = pbc[1]*domain->yprd; - dz = pbc[2]*domain->zprd; + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; } else { - dx = pbc[0]*domain->xprd + pbc[5]*domain->xy + pbc[4]*domain->xz; - dy = pbc[1]*domain->yprd + pbc[3]*domain->yz; - dz = pbc[2]*domain->zprd; + dx = pbc[0] * domain->xprd + pbc[5] * domain->xy + pbc[4] * domain->xz; + dy = pbc[1] * domain->yprd + pbc[3] * domain->yz; + dz = pbc[2] * domain->zprd; } if (!deform_vremap) { for (i = 0; i < n; i++) { @@ -481,9 +477,9 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf, buf[m++] = v[j][2]; } } else { - dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; - dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; - dvz = pbc[2]*h_rate[2]; + dvx = pbc[0] * h_rate[0] + pbc[5] * h_rate[5] + pbc[4] * h_rate[4]; + dvy = pbc[1] * h_rate[1] + pbc[3] * h_rate[3]; + dvz = pbc[2] * h_rate[2]; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = x[j][0] + dx; @@ -518,8 +514,7 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf, double **array = *((double ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = array[j][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[j][mm]; } } } else if (datatype == Atom::INT) { @@ -533,8 +528,7 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf, int **array = *((int ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } else if (datatype == Atom::BIGINT) { @@ -548,15 +542,14 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf, bigint **array = *((bigint ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } } } - if (bonus_flag) m += pack_comm_bonus(n,list,&buf[m]); + if (bonus_flag) m += pack_comm_bonus(n, list, &buf[m]); return m; } @@ -565,7 +558,7 @@ int AtomVec::pack_comm_vel(int n, int *list, double *buf, void AtomVec::unpack_comm(int n, int first, double *buf) { - int i,m,last,mm,nn,datatype,cols; + int i, m, last, mm, nn, datatype, cols; void *pdata; m = 0; @@ -584,48 +577,42 @@ void AtomVec::unpack_comm(int n, int first, double *buf) if (datatype == Atom::DOUBLE) { if (cols == 0) { double *vec = *((double **) pdata); - for (i = first; i < last; i++) - vec[i] = buf[m++]; + for (i = first; i < last; i++) vec[i] = buf[m++]; } else { double **array = *((double ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = buf[m++]; + for (mm = 0; mm < cols; mm++) array[i][mm] = buf[m++]; } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - for (i = first; i < last; i++) - vec[i] = (int) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (int) ubuf(buf[m++]).i; } else { int **array = *((int ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (int) ubuf(buf[m++]).i; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - for (i = first; i < last; i++) - vec[i] = (bigint) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (bigint) ubuf(buf[m++]).i; } else { bigint **array = *((bigint ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (bigint) ubuf(buf[m++]).i; } } } } - if (bonus_flag) unpack_comm_bonus(n,first,&buf[m]); + if (bonus_flag) unpack_comm_bonus(n, first, &buf[m]); } /* ---------------------------------------------------------------------- */ void AtomVec::unpack_comm_vel(int n, int first, double *buf) { - int i,m,last,mm,nn,datatype,cols; + int i, m, last, mm, nn, datatype, cols; void *pdata; m = 0; @@ -647,48 +634,42 @@ void AtomVec::unpack_comm_vel(int n, int first, double *buf) if (datatype == Atom::DOUBLE) { if (cols == 0) { double *vec = *((double **) pdata); - for (i = first; i < last; i++) - vec[i] = buf[m++]; + for (i = first; i < last; i++) vec[i] = buf[m++]; } else { double **array = *((double ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = buf[m++]; + for (mm = 0; mm < cols; mm++) array[i][mm] = buf[m++]; } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - for (i = first; i < last; i++) - vec[i] = (int) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (int) ubuf(buf[m++]).i; } else { int **array = *((int ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (int) ubuf(buf[m++]).i; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - for (i = first; i < last; i++) - vec[i] = (bigint) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (bigint) ubuf(buf[m++]).i; } else { bigint **array = *((bigint ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (bigint) ubuf(buf[m++]).i; } } } } - if (bonus_flag) unpack_comm_bonus(n,first,&buf[m]); + if (bonus_flag) unpack_comm_bonus(n, first, &buf[m]); } /* ---------------------------------------------------------------------- */ int AtomVec::pack_reverse(int n, int first, double *buf) { - int i,m,last,mm,nn,datatype,cols; + int i, m, last, mm, nn, datatype, cols; void *pdata; m = 0; @@ -707,40 +688,31 @@ int AtomVec::pack_reverse(int n, int first, double *buf) if (datatype == Atom::DOUBLE) { if (cols == 0) { double *vec = *((double **) pdata); - for (i = first; i < last; i++) { - buf[m++] = vec[i]; - } + for (i = first; i < last; i++) { buf[m++] = vec[i]; } } else { double **array = *((double ***) pdata); for (i = first; i < last; i++) { - for (mm = 0; mm < cols; mm++) - buf[m++] = array[i][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[i][mm]; } } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - for (i = first; i < last; i++) { - buf[m++] = ubuf(vec[i]).d; - } + for (i = first; i < last; i++) { buf[m++] = ubuf(vec[i]).d; } } else { int **array = *((int ***) pdata); for (i = first; i < last; i++) { - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[i][mm]).d; } } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - for (i = first; i < last; i++) { - buf[m++] = ubuf(vec[i]).d; - } + for (i = first; i < last; i++) { buf[m++] = ubuf(vec[i]).d; } } else { bigint **array = *((bigint ***) pdata); for (i = first; i < last; i++) { - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[i][mm]).d; } } } @@ -754,7 +726,7 @@ int AtomVec::pack_reverse(int n, int first, double *buf) void AtomVec::unpack_reverse(int n, int *list, double *buf) { - int i,j,m,mm,nn,datatype,cols; + int i, j, m, mm, nn, datatype, cols; void *pdata; m = 0; @@ -781,8 +753,7 @@ void AtomVec::unpack_reverse(int n, int *list, double *buf) double **array = *((double ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - array[j][mm] += buf[m++]; + for (mm = 0; mm < cols; mm++) array[j][mm] += buf[m++]; } } } else if (datatype == Atom::INT) { @@ -796,8 +767,7 @@ void AtomVec::unpack_reverse(int n, int *list, double *buf) int **array = *((int ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - array[j][mm] += (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[j][mm] += (int) ubuf(buf[m++]).i; } } } else if (datatype == Atom::BIGINT) { @@ -811,8 +781,7 @@ void AtomVec::unpack_reverse(int n, int *list, double *buf) bigint **array = *((bigint ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - array[j][mm] += (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[j][mm] += (bigint) ubuf(buf[m++]).i; } } } @@ -824,8 +793,8 @@ void AtomVec::unpack_reverse(int n, int *list, double *buf) int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc) { - int i,j,m,mm,nn,datatype,cols; - double dx,dy,dz; + int i, j, m, mm, nn, datatype, cols; + double dx, dy, dz; void *pdata; m = 0; @@ -841,9 +810,9 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc) } } else { if (domain->triclinic == 0) { - dx = pbc[0]*domain->xprd; - dy = pbc[1]*domain->yprd; - dz = pbc[2]*domain->zprd; + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; } else { dx = pbc[0]; dy = pbc[1]; @@ -876,8 +845,7 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc) double **array = *((double ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = array[j][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[j][mm]; } } } else if (datatype == Atom::INT) { @@ -891,8 +859,7 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc) int **array = *((int ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } else if (datatype == Atom::BIGINT) { @@ -906,30 +873,28 @@ int AtomVec::pack_border(int n, int *list, double *buf, int pbc_flag, int *pbc) bigint **array = *((bigint ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } } } - if (bonus_flag) m += pack_border_bonus(n,list,&buf[m]); + if (bonus_flag) m += pack_border_bonus(n, list, &buf[m]); if (atom->nextra_border) for (int iextra = 0; iextra < atom->nextra_border; iextra++) - m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + m += modify->fix[atom->extra_border[iextra]]->pack_border(n, list, &buf[m]); return m; } /* ---------------------------------------------------------------------- */ -int AtomVec::pack_border_vel(int n, int *list, double *buf, - int pbc_flag, int *pbc) +int AtomVec::pack_border_vel(int n, int *list, double *buf, int pbc_flag, int *pbc) { - int i,j,m,mm,nn,datatype,cols; - double dx,dy,dz,dvx,dvy,dvz; + int i, j, m, mm, nn, datatype, cols; + double dx, dy, dz, dvx, dvy, dvz; void *pdata; m = 0; @@ -948,9 +913,9 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf, } } else { if (domain->triclinic == 0) { - dx = pbc[0]*domain->xprd; - dy = pbc[1]*domain->yprd; - dz = pbc[2]*domain->zprd; + dx = pbc[0] * domain->xprd; + dy = pbc[1] * domain->yprd; + dz = pbc[2] * domain->zprd; } else { dx = pbc[0]; dy = pbc[1]; @@ -970,9 +935,9 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf, buf[m++] = v[j][2]; } } else { - dvx = pbc[0]*h_rate[0] + pbc[5]*h_rate[5] + pbc[4]*h_rate[4]; - dvy = pbc[1]*h_rate[1] + pbc[3]*h_rate[3]; - dvz = pbc[2]*h_rate[2]; + dvx = pbc[0] * h_rate[0] + pbc[5] * h_rate[5] + pbc[4] * h_rate[4]; + dvy = pbc[1] * h_rate[1] + pbc[3] * h_rate[3]; + dvz = pbc[2] * h_rate[2]; for (i = 0; i < n; i++) { j = list[i]; buf[m++] = x[j][0] + dx; @@ -1010,8 +975,7 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf, double **array = *((double ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = array[j][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[j][mm]; } } } else if (datatype == Atom::INT) { @@ -1025,8 +989,7 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf, int **array = *((int ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } else if (datatype == Atom::BIGINT) { @@ -1040,19 +1003,18 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf, bigint **array = *((bigint ***) pdata); for (i = 0; i < n; i++) { j = list[i]; - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[j][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[j][mm]).d; } } } } } - if (bonus_flag) m += pack_border_bonus(n,list,&buf[m]); + if (bonus_flag) m += pack_border_bonus(n, list, &buf[m]); if (atom->nextra_border) for (int iextra = 0; iextra < atom->nextra_border; iextra++) - m += modify->fix[atom->extra_border[iextra]]->pack_border(n,list,&buf[m]); + m += modify->fix[atom->extra_border[iextra]]->pack_border(n, list, &buf[m]); return m; } @@ -1061,7 +1023,7 @@ int AtomVec::pack_border_vel(int n, int *list, double *buf, void AtomVec::unpack_border(int n, int first, double *buf) { - int i,m,last,mm,nn,datatype,cols; + int i, m, last, mm, nn, datatype, cols; void *pdata; m = 0; @@ -1085,53 +1047,46 @@ void AtomVec::unpack_border(int n, int first, double *buf) if (datatype == Atom::DOUBLE) { if (cols == 0) { double *vec = *((double **) pdata); - for (i = first; i < last; i++) - vec[i] = buf[m++]; + for (i = first; i < last; i++) vec[i] = buf[m++]; } else { double **array = *((double ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = buf[m++]; + for (mm = 0; mm < cols; mm++) array[i][mm] = buf[m++]; } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - for (i = first; i < last; i++) - vec[i] = (int) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (int) ubuf(buf[m++]).i; } else { int **array = *((int ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (int) ubuf(buf[m++]).i; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - for (i = first; i < last; i++) - vec[i] = (bigint) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (bigint) ubuf(buf[m++]).i; } else { bigint **array = *((bigint ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (bigint) ubuf(buf[m++]).i; } } } } - if (bonus_flag) m += unpack_border_bonus(n,first,&buf[m]); + if (bonus_flag) m += unpack_border_bonus(n, first, &buf[m]); if (atom->nextra_border) for (int iextra = 0; iextra < atom->nextra_border; iextra++) - m += modify->fix[atom->extra_border[iextra]]-> - unpack_border(n,first,&buf[m]); + m += modify->fix[atom->extra_border[iextra]]->unpack_border(n, first, &buf[m]); } /* ---------------------------------------------------------------------- */ void AtomVec::unpack_border_vel(int n, int first, double *buf) { - int i,m,last,mm,nn,datatype,cols; + int i, m, last, mm, nn, datatype, cols; void *pdata; m = 0; @@ -1158,46 +1113,39 @@ void AtomVec::unpack_border_vel(int n, int first, double *buf) if (datatype == Atom::DOUBLE) { if (cols == 0) { double *vec = *((double **) pdata); - for (i = first; i < last; i++) - vec[i] = buf[m++]; + for (i = first; i < last; i++) vec[i] = buf[m++]; } else { double **array = *((double ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = buf[m++]; + for (mm = 0; mm < cols; mm++) array[i][mm] = buf[m++]; } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - for (i = first; i < last; i++) - vec[i] = (int) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (int) ubuf(buf[m++]).i; } else { int **array = *((int ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (int) ubuf(buf[m++]).i; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - for (i = first; i < last; i++) - vec[i] = (bigint) ubuf(buf[m++]).i; + for (i = first; i < last; i++) vec[i] = (bigint) ubuf(buf[m++]).i; } else { bigint **array = *((bigint ***) pdata); for (i = first; i < last; i++) - for (mm = 0; mm < cols; mm++) - array[i][mm] = (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[i][mm] = (bigint) ubuf(buf[m++]).i; } } } } - if (bonus_flag) m += unpack_border_bonus(n,first,&buf[m]); + if (bonus_flag) m += unpack_border_bonus(n, first, &buf[m]); if (atom->nextra_border) for (int iextra = 0; iextra < atom->nextra_border; iextra++) - m += modify->fix[atom->extra_border[iextra]]-> - unpack_border(n,first,&buf[m]); + m += modify->fix[atom->extra_border[iextra]]->unpack_border(n, first, &buf[m]); } /* ---------------------------------------------------------------------- @@ -1207,8 +1155,8 @@ void AtomVec::unpack_border_vel(int n, int first, double *buf) int AtomVec::pack_exchange(int i, double *buf) { - int mm,nn,datatype,cols,collength,ncols; - void *pdata,*plength; + int mm, nn, datatype, cols, collength, ncols; + void *pdata, *plength; int m = 1; buf[m++] = x[i][0]; @@ -1233,60 +1181,62 @@ int AtomVec::pack_exchange(int i, double *buf) buf[m++] = vec[i]; } else if (cols > 0) { double **array = *((double ***) pdata); - for (mm = 0; mm < cols; mm++) - buf[m++] = array[i][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[i][mm]; } else { double **array = *((double ***) pdata); collength = mexchange.collength[nn]; plength = mexchange.plength[nn]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (mm = 0; mm < ncols; mm++) - buf[m++] = array[i][mm]; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (mm = 0; mm < ncols; mm++) buf[m++] = array[i][mm]; } - } if (datatype == Atom::INT) { + } + if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); buf[m++] = ubuf(vec[i]).d; } else if (cols > 0) { int **array = *((int ***) pdata); - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[i][mm]).d; } else { int **array = *((int ***) pdata); collength = mexchange.collength[nn]; plength = mexchange.plength[nn]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (mm = 0; mm < ncols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (mm = 0; mm < ncols; mm++) buf[m++] = ubuf(array[i][mm]).d; } - } if (datatype == Atom::BIGINT) { + } + if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); buf[m++] = ubuf(vec[i]).d; } else if (cols > 0) { bigint **array = *((bigint ***) pdata); - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[i][mm]).d; } else { bigint **array = *((bigint ***) pdata); collength = mexchange.collength[nn]; plength = mexchange.plength[nn]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (mm = 0; mm < ncols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (mm = 0; mm < ncols; mm++) buf[m++] = ubuf(array[i][mm]).d; } } } } - if (bonus_flag) m += pack_exchange_bonus(i,&buf[m]); + if (bonus_flag) m += pack_exchange_bonus(i, &buf[m]); if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i,&buf[m]); + m += modify->fix[atom->extra_grow[iextra]]->pack_exchange(i, &buf[m]); buf[0] = m; return m; @@ -1296,8 +1246,8 @@ int AtomVec::pack_exchange(int i, double *buf) int AtomVec::unpack_exchange(double *buf) { - int mm,nn,datatype,cols,collength,ncols; - void *pdata,*plength; + int mm, nn, datatype, cols, collength, ncols; + void *pdata, *plength; int nlocal = atom->nlocal; if (nlocal == nmax) grow(0); @@ -1325,16 +1275,16 @@ int AtomVec::unpack_exchange(double *buf) vec[nlocal] = buf[m++]; } else if (cols > 0) { double **array = *((double ***) pdata); - for (mm = 0; mm < cols; mm++) - array[nlocal][mm] = buf[m++]; + for (mm = 0; mm < cols; mm++) array[nlocal][mm] = buf[m++]; } else { double **array = *((double ***) pdata); collength = mexchange.collength[nn]; plength = mexchange.plength[nn]; - if (collength) ncols = (*((int ***) plength))[nlocal][collength-1]; - else ncols = (*((int **) plength))[nlocal]; - for (mm = 0; mm < ncols; mm++) - array[nlocal][mm] = buf[m++]; + if (collength) + ncols = (*((int ***) plength))[nlocal][collength - 1]; + else + ncols = (*((int **) plength))[nlocal]; + for (mm = 0; mm < ncols; mm++) array[nlocal][mm] = buf[m++]; } } else if (datatype == Atom::INT) { if (cols == 0) { @@ -1342,16 +1292,16 @@ int AtomVec::unpack_exchange(double *buf) vec[nlocal] = (int) ubuf(buf[m++]).i; } else if (cols > 0) { int **array = *((int ***) pdata); - for (mm = 0; mm < cols; mm++) - array[nlocal][mm] = (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[nlocal][mm] = (int) ubuf(buf[m++]).i; } else { int **array = *((int ***) pdata); collength = mexchange.collength[nn]; plength = mexchange.plength[nn]; - if (collength) ncols = (*((int ***) plength))[nlocal][collength-1]; - else ncols = (*((int **) plength))[nlocal]; - for (mm = 0; mm < ncols; mm++) - array[nlocal][mm] = (int) ubuf(buf[m++]).i; + if (collength) + ncols = (*((int ***) plength))[nlocal][collength - 1]; + else + ncols = (*((int **) plength))[nlocal]; + for (mm = 0; mm < ncols; mm++) array[nlocal][mm] = (int) ubuf(buf[m++]).i; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -1359,27 +1309,26 @@ int AtomVec::unpack_exchange(double *buf) vec[nlocal] = (bigint) ubuf(buf[m++]).i; } else if (cols > 0) { bigint **array = *((bigint ***) pdata); - for (mm = 0; mm < cols; mm++) - array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; } else { bigint **array = *((bigint ***) pdata); collength = mexchange.collength[nn]; plength = mexchange.plength[nn]; - if (collength) ncols = (*((int ***) plength))[nlocal][collength-1]; - else ncols = (*((int **) plength))[nlocal]; - for (mm = 0; mm < ncols; mm++) - array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; + if (collength) + ncols = (*((int ***) plength))[nlocal][collength - 1]; + else + ncols = (*((int **) plength))[nlocal]; + for (mm = 0; mm < ncols; mm++) array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; } } } } - if (bonus_flag) m += unpack_exchange_bonus(nlocal,&buf[m]); + if (bonus_flag) m += unpack_exchange_bonus(nlocal, &buf[m]); if (atom->nextra_grow) for (int iextra = 0; iextra < atom->nextra_grow; iextra++) - m += modify->fix[atom->extra_grow[iextra]]-> - unpack_exchange(nlocal,&buf[m]); + m += modify->fix[atom->extra_grow[iextra]]->unpack_exchange(nlocal, &buf[m]); atom->nlocal++; return m; @@ -1392,7 +1341,7 @@ int AtomVec::unpack_exchange(double *buf) int AtomVec::size_restart() { - int i,nn,cols,collength,ncols; + int i, nn, cols, collength, ncols; void *plength; // NOTE: need to worry about overflow of returned int N @@ -1406,14 +1355,18 @@ int AtomVec::size_restart() if (nrestart) { for (nn = 0; nn < nrestart; nn++) { cols = mrestart.cols[nn]; - if (cols == 0) n += nlocal; - else if (cols > 0) n += cols*nlocal; + if (cols == 0) + n += nlocal; + else if (cols > 0) + n += cols * nlocal; else { collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; for (i = 0; i < nlocal; i++) { - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; n += ncols; } } @@ -1424,8 +1377,7 @@ int AtomVec::size_restart() if (atom->nextra_restart) for (int iextra = 0; iextra < atom->nextra_restart; iextra++) - for (i = 0; i < nlocal; i++) - n += modify->fix[atom->extra_restart[iextra]]->size_restart(i); + for (i = 0; i < nlocal; i++) n += modify->fix[atom->extra_restart[iextra]]->size_restart(i); return n; } @@ -1438,8 +1390,8 @@ int AtomVec::size_restart() int AtomVec::pack_restart(int i, double *buf) { - int mm,nn,datatype,cols,collength,ncols; - void *pdata,*plength; + int mm, nn, datatype, cols, collength, ncols; + void *pdata, *plength; // if needed, change values before packing @@ -1467,16 +1419,16 @@ int AtomVec::pack_restart(int i, double *buf) buf[m++] = vec[i]; } else if (cols > 0) { double **array = *((double ***) pdata); - for (mm = 0; mm < cols; mm++) - buf[m++] = array[i][mm]; + for (mm = 0; mm < cols; mm++) buf[m++] = array[i][mm]; } else { double **array = *((double ***) pdata); collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (mm = 0; mm < ncols; mm++) - buf[m++] = array[i][mm]; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (mm = 0; mm < ncols; mm++) buf[m++] = array[i][mm]; } } else if (datatype == Atom::INT) { if (cols == 0) { @@ -1484,16 +1436,16 @@ int AtomVec::pack_restart(int i, double *buf) buf[m++] = ubuf(vec[i]).d; } else if (cols > 0) { int **array = *((int ***) pdata); - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[i][mm]).d; } else { int **array = *((int ***) pdata); collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (mm = 0; mm < ncols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (mm = 0; mm < ncols; mm++) buf[m++] = ubuf(array[i][mm]).d; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -1501,21 +1453,21 @@ int AtomVec::pack_restart(int i, double *buf) buf[m++] = ubuf(vec[i]).d; } else if (cols > 0) { bigint **array = *((bigint ***) pdata); - for (mm = 0; mm < cols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + for (mm = 0; mm < cols; mm++) buf[m++] = ubuf(array[i][mm]).d; } else { bigint **array = *((bigint ***) pdata); collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; - if (collength) ncols = (*((int ***) plength))[i][collength-1]; - else ncols = (*((int **) plength))[i]; - for (mm = 0; mm < ncols; mm++) - buf[m++] = ubuf(array[i][mm]).d; + if (collength) + ncols = (*((int ***) plength))[i][collength - 1]; + else + ncols = (*((int **) plength))[i]; + for (mm = 0; mm < ncols; mm++) buf[m++] = ubuf(array[i][mm]).d; } } } - if (bonus_flag) m += pack_restart_bonus(i,&buf[m]); + if (bonus_flag) m += pack_restart_bonus(i, &buf[m]); // if needed, restore values after packing @@ -1524,7 +1476,7 @@ int AtomVec::pack_restart(int i, double *buf) // invoke fixes which store peratom restart info for (int iextra = 0; iextra < atom->nextra_restart; iextra++) - m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i,&buf[m]); + m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i, &buf[m]); buf[0] = m; return m; @@ -1536,14 +1488,13 @@ int AtomVec::pack_restart(int i, double *buf) int AtomVec::unpack_restart(double *buf) { - int mm,nn,datatype,cols,collength,ncols; - void *pdata,*plength; + int mm, nn, datatype, cols, collength, ncols; + void *pdata, *plength; int nlocal = atom->nlocal; if (nlocal == nmax) { grow(0); - if (atom->nextra_store) - memory->grow(atom->extra,nmax,atom->nextra_store,"atom:extra"); + if (atom->nextra_store) memory->grow(atom->extra, nmax, atom->nextra_store, "atom:extra"); } int m = 1; @@ -1568,16 +1519,16 @@ int AtomVec::unpack_restart(double *buf) vec[nlocal] = buf[m++]; } else if (cols > 0) { double **array = *((double ***) pdata); - for (mm = 0; mm < cols; mm++) - array[nlocal][mm] = buf[m++]; + for (mm = 0; mm < cols; mm++) array[nlocal][mm] = buf[m++]; } else { double **array = *((double ***) pdata); collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; - if (collength) ncols = (*((int ***) plength))[nlocal][collength-1]; - else ncols = (*((int **) plength))[nlocal]; - for (mm = 0; mm < ncols; mm++) - array[nlocal][mm] = buf[m++]; + if (collength) + ncols = (*((int ***) plength))[nlocal][collength - 1]; + else + ncols = (*((int **) plength))[nlocal]; + for (mm = 0; mm < ncols; mm++) array[nlocal][mm] = buf[m++]; } } else if (datatype == Atom::INT) { if (cols == 0) { @@ -1585,16 +1536,16 @@ int AtomVec::unpack_restart(double *buf) vec[nlocal] = (int) ubuf(buf[m++]).i; } else if (cols > 0) { int **array = *((int ***) pdata); - for (mm = 0; mm < cols; mm++) - array[nlocal][mm] = (int) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[nlocal][mm] = (int) ubuf(buf[m++]).i; } else { int **array = *((int ***) pdata); collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; - if (collength) ncols = (*((int ***) plength))[nlocal][collength-1]; - else ncols = (*((int **) plength))[nlocal]; - for (mm = 0; mm < ncols; mm++) - array[nlocal][mm] = (int) ubuf(buf[m++]).i; + if (collength) + ncols = (*((int ***) plength))[nlocal][collength - 1]; + else + ncols = (*((int **) plength))[nlocal]; + for (mm = 0; mm < ncols; mm++) array[nlocal][mm] = (int) ubuf(buf[m++]).i; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -1602,21 +1553,21 @@ int AtomVec::unpack_restart(double *buf) vec[nlocal] = (bigint) ubuf(buf[m++]).i; } else if (cols > 0) { bigint **array = *((bigint ***) pdata); - for (mm = 0; mm < cols; mm++) - array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; + for (mm = 0; mm < cols; mm++) array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; } else { bigint **array = *((bigint ***) pdata); collength = mrestart.collength[nn]; plength = mrestart.plength[nn]; - if (collength) ncols = (*((int ***) plength))[nlocal][collength-1]; - else ncols = (*((int **) plength))[nlocal]; - for (mm = 0; mm < ncols; mm++) - array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; + if (collength) + ncols = (*((int ***) plength))[nlocal][collength - 1]; + else + ncols = (*((int **) plength))[nlocal]; + for (mm = 0; mm < ncols; mm++) array[nlocal][mm] = (bigint) ubuf(buf[m++]).i; } } } - if (bonus_flag) m += unpack_restart_bonus(nlocal,&buf[m]); + if (bonus_flag) m += unpack_restart_bonus(nlocal, &buf[m]); // if needed, initialize other peratom values @@ -1626,7 +1577,7 @@ int AtomVec::unpack_restart(double *buf) double **extra = atom->extra; if (atom->nextra_store) { - int size = static_cast (buf[0]) - m; + int size = static_cast(buf[0]) - m; for (int i = 0; i < size; i++) extra[nlocal][i] = buf[m++]; } @@ -1641,7 +1592,7 @@ int AtomVec::unpack_restart(double *buf) void AtomVec::create_atom(int itype, double *coord) { - int m,n,datatype,cols; + int m, n, datatype, cols; void *pdata; int nlocal = atom->nlocal; @@ -1653,8 +1604,7 @@ void AtomVec::create_atom(int itype, double *coord) x[nlocal][1] = coord[1]; x[nlocal][2] = coord[2]; mask[nlocal] = 1; - image[nlocal] = ((imageint) IMGMAX << IMG2BITS) | - ((imageint) IMGMAX << IMGBITS) | IMGMAX; + image[nlocal] = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; v[nlocal][0] = 0.0; v[nlocal][1] = 0.0; v[nlocal][2] = 0.0; @@ -1671,8 +1621,7 @@ void AtomVec::create_atom(int itype, double *coord) vec[nlocal] = 0.0; } else { double **array = *((double ***) pdata); - for (m = 0; m < cols; m++) - array[nlocal][m] = 0.0; + for (m = 0; m < cols; m++) array[nlocal][m] = 0.0; } } else if (datatype == Atom::INT) { if (cols == 0) { @@ -1680,8 +1629,7 @@ void AtomVec::create_atom(int itype, double *coord) vec[nlocal] = 0; } else { int **array = *((int ***) pdata); - for (m = 0; m < cols; m++) - array[nlocal][m] = 0; + for (m = 0; m < cols; m++) array[nlocal][m] = 0; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -1689,8 +1637,7 @@ void AtomVec::create_atom(int itype, double *coord) vec[nlocal] = 0; } else { bigint **array = *((bigint ***) pdata); - for (m = 0; m < cols; m++) - array[nlocal][m] = 0; + for (m = 0; m < cols; m++) array[nlocal][m] = 0; } } } @@ -1709,7 +1656,7 @@ void AtomVec::create_atom(int itype, double *coord) void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vector &values) { - int m,n,datatype,cols; + int m, n, datatype, cols; void *pdata; int nlocal = atom->nlocal; @@ -1732,43 +1679,42 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vectorx) { // x was already set by coord arg + if (array == atom->x) { // x was already set by coord arg ivalue += cols; continue; } for (m = 0; m < cols; m++) - array[nlocal][m] = utils::numeric(FLERR,values[ivalue++],true,lmp); + array[nlocal][m] = utils::numeric(FLERR, values[ivalue++], true, lmp); } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - vec[nlocal] = utils::inumeric(FLERR,values[ivalue++],true,lmp); + vec[nlocal] = utils::inumeric(FLERR, values[ivalue++], true, lmp); } else { int **array = *((int ***) pdata); for (m = 0; m < cols; m++) - array[nlocal][m] = utils::inumeric(FLERR,values[ivalue++],true,lmp); + array[nlocal][m] = utils::inumeric(FLERR, values[ivalue++], true, lmp); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - vec[nlocal] = utils::bnumeric(FLERR,values[ivalue++],true,lmp); + vec[nlocal] = utils::bnumeric(FLERR, values[ivalue++], true, lmp); } else { bigint **array = *((bigint ***) pdata); for (m = 0; m < cols; m++) - array[nlocal][m] = utils::bnumeric(FLERR,values[ivalue++],true,lmp); + array[nlocal][m] = utils::bnumeric(FLERR, values[ivalue++], true, lmp); } } } // error checks applicable to all styles - if (tag[nlocal] <= 0) - error->one(FLERR,"Invalid atom ID in Atoms section of data file"); + if (tag[nlocal] <= 0) error->one(FLERR, "Invalid atom ID in Atoms section of data file"); if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes) - error->one(FLERR,"Invalid atom type in Atoms section of data file"); + error->one(FLERR, "Invalid atom type in Atoms section of data file"); // if needed, modify unpacked values or initialize other peratom values @@ -1783,7 +1729,7 @@ void AtomVec::data_atom(double *coord, imageint imagetmp, const std::vectornlocal; @@ -1805,8 +1751,7 @@ void AtomVec::pack_data(double **buf) buf[i][j++] = vec[i]; } else { double **array = *((double ***) pdata); - for (m = 0; m < cols; m++) - buf[i][j++] = array[i][m]; + for (m = 0; m < cols; m++) buf[i][j++] = array[i][m]; } } else if (datatype == Atom::INT) { if (cols == 0) { @@ -1814,8 +1759,7 @@ void AtomVec::pack_data(double **buf) buf[i][j++] = ubuf(vec[i]).d; } else { int **array = *((int ***) pdata); - for (m = 0; m < cols; m++) - buf[i][j++] = ubuf(array[i][m]).d; + for (m = 0; m < cols; m++) buf[i][j++] = ubuf(array[i][m]).d; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -1823,8 +1767,7 @@ void AtomVec::pack_data(double **buf) buf[i][j++] = ubuf(vec[i]).d; } else { bigint **array = *((bigint ***) pdata); - for (m = 0; m < cols; m++) - buf[i][j++] = ubuf(array[i][m]).d; + for (m = 0; m < cols; m++) buf[i][j++] = ubuf(array[i][m]).d; } } } @@ -1846,10 +1789,10 @@ void AtomVec::pack_data(double **buf) void AtomVec::write_data(FILE *fp, int n, double **buf) { - int i,j,m,nn,datatype,cols; + int i, j, m, nn, datatype, cols; for (i = 0; i < n; i++) { - fmt::print(fp,"{}",ubuf(buf[i][0]).i); + fmt::print(fp, "{}", ubuf(buf[i][0]).i); j = 1; for (nn = 1; nn < ndata_atom; nn++) { @@ -1857,32 +1800,26 @@ void AtomVec::write_data(FILE *fp, int n, double **buf) cols = mdata_atom.cols[nn]; if (datatype == Atom::DOUBLE) { if (cols == 0) { - fmt::print(fp," {}",buf[i][j++]); + fmt::print(fp, " {:.16}", buf[i][j++]); } else { - for (m = 0; m < cols; m++) - fmt::print(fp," {}",buf[i][j++]); + for (m = 0; m < cols; m++) fmt::print(fp, " {}", buf[i][j++]); } } else if (datatype == Atom::INT) { if (cols == 0) { - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } } } - fmt::print(fp," {} {} {}\n", - (int) ubuf(buf[i][j]).i, - (int) ubuf(buf[i][j+1]).i, - (int) ubuf(buf[i][j+2]).i); + fmt::print(fp, " {} {} {}\n", ubuf(buf[i][j]).i, ubuf(buf[i][j + 1]).i, ubuf(buf[i][j + 2]).i); } } @@ -1892,14 +1829,14 @@ void AtomVec::write_data(FILE *fp, int n, double **buf) void AtomVec::data_vel(int ilocal, const std::vector &values) { - int m,n,datatype,cols; + int m, n, datatype, cols; void *pdata; double **v = atom->v; int ivalue = 1; - v[ilocal][0] = utils::numeric(FLERR,values[ivalue++],true,lmp); - v[ilocal][1] = utils::numeric(FLERR,values[ivalue++],true,lmp); - v[ilocal][2] = utils::numeric(FLERR,values[ivalue++],true,lmp); + v[ilocal][0] = utils::numeric(FLERR, values[ivalue++], true, lmp); + v[ilocal][1] = utils::numeric(FLERR, values[ivalue++], true, lmp); + v[ilocal][2] = utils::numeric(FLERR, values[ivalue++], true, lmp); if (ndata_vel > 2) { for (n = 2; n < ndata_vel; n++) { @@ -1909,29 +1846,29 @@ void AtomVec::data_vel(int ilocal, const std::vector &values) if (datatype == Atom::DOUBLE) { if (cols == 0) { double *vec = *((double **) pdata); - vec[ilocal] = utils::numeric(FLERR,values[ivalue++],true,lmp); + vec[ilocal] = utils::numeric(FLERR, values[ivalue++], true, lmp); } else { double **array = *((double ***) pdata); for (m = 0; m < cols; m++) - array[ilocal][m] = utils::numeric(FLERR,values[ivalue++],true,lmp); + array[ilocal][m] = utils::numeric(FLERR, values[ivalue++], true, lmp); } } else if (datatype == Atom::INT) { if (cols == 0) { int *vec = *((int **) pdata); - vec[ilocal] = utils::inumeric(FLERR,values[ivalue++],true,lmp); + vec[ilocal] = utils::inumeric(FLERR, values[ivalue++], true, lmp); } else { int **array = *((int ***) pdata); for (m = 0; m < cols; m++) - array[ilocal][m] = utils::inumeric(FLERR,values[ivalue++],true,lmp); + array[ilocal][m] = utils::inumeric(FLERR, values[ivalue++], true, lmp); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { bigint *vec = *((bigint **) pdata); - vec[ilocal] = utils::bnumeric(FLERR,values[ivalue++],true,lmp); + vec[ilocal] = utils::bnumeric(FLERR, values[ivalue++], true, lmp); } else { bigint **array = *((bigint ***) pdata); for (m = 0; m < cols; m++) - array[ilocal][m] = utils::bnumeric(FLERR,values[ivalue++],true,lmp); + array[ilocal][m] = utils::bnumeric(FLERR, values[ivalue++], true, lmp); } } } @@ -1944,7 +1881,7 @@ void AtomVec::data_vel(int ilocal, const std::vector &values) void AtomVec::pack_vel(double **buf) { - int i,j,m,n,datatype,cols; + int i, j, m, n, datatype, cols; void *pdata; int nlocal = atom->nlocal; @@ -1961,8 +1898,7 @@ void AtomVec::pack_vel(double **buf) buf[i][j++] = vec[i]; } else { double **array = *((double ***) pdata); - for (m = 0; m < cols; m++) - buf[i][j++] = array[i][m]; + for (m = 0; m < cols; m++) buf[i][j++] = array[i][m]; } } else if (datatype == Atom::INT) { if (cols == 0) { @@ -1970,8 +1906,7 @@ void AtomVec::pack_vel(double **buf) buf[i][j++] = ubuf(vec[i]).d; } else { int **array = *((int ***) pdata); - for (m = 0; m < cols; m++) - buf[i][j++] = ubuf(array[i][m]).d; + for (m = 0; m < cols; m++) buf[i][j++] = ubuf(array[i][m]).d; } } else if (datatype == Atom::BIGINT) { if (cols == 0) { @@ -1979,8 +1914,7 @@ void AtomVec::pack_vel(double **buf) buf[i][j++] = ubuf(vec[i]).d; } else { bigint **array = *((bigint ***) pdata); - for (m = 0; m < cols; m++) - buf[i][j++] = ubuf(array[i][m]).d; + for (m = 0; m < cols; m++) buf[i][j++] = ubuf(array[i][m]).d; } } } @@ -1994,10 +1928,10 @@ void AtomVec::pack_vel(double **buf) void AtomVec::write_vel(FILE *fp, int n, double **buf) { - int i,j,m,nn,datatype,cols; + int i, j, m, nn, datatype, cols; for (i = 0; i < n; i++) { - fmt::print(fp,"{}",ubuf(buf[i][0]).i); + fmt::print(fp, "{}", ubuf(buf[i][0]).i); j = 1; for (nn = 1; nn < ndata_vel; nn++) { @@ -2005,28 +1939,25 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) cols = mdata_vel.cols[nn]; if (datatype == Atom::DOUBLE) { if (cols == 0) { - fmt::print(fp," {}",buf[i][j++]); + fmt::print(fp, " {}", buf[i][j++]); } else { - for (m = 0; m < cols; m++) - fmt::print(fp," {}",buf[i][j++]); + for (m = 0; m < cols; m++) fmt::print(fp, " {}", buf[i][j++]); } } else if (datatype == Atom::INT) { if (cols == 0) { - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } else { - for (m = 0; m < cols; m++) - fmt::print(fp," {}",ubuf(buf[i][j++]).i); + for (m = 0; m < cols; m++) fmt::print(fp, " {}", ubuf(buf[i][j++]).i); } } } - fputs("\n",fp); + fputs("\n", fp); } } @@ -2046,14 +1977,14 @@ int AtomVec::pack_bond(tagint **buf) int nlocal = atom->nlocal; int newton_bond = force->newton_bond; - int i,j; + int i, j; int m = 0; if (newton_bond) { for (i = 0; i < nlocal; i++) for (j = 0; j < num_bond[i]; j++) { if (bond_type[i][j] == 0) continue; if (buf) { - buf[m][0] = MAX(bond_type[i][j],-bond_type[i][j]); + buf[m][0] = MAX(bond_type[i][j], -bond_type[i][j]); buf[m][1] = tag[i]; buf[m][2] = bond_atom[i][j]; } @@ -2065,7 +1996,7 @@ int AtomVec::pack_bond(tagint **buf) if (tag[i] < bond_atom[i][j]) { if (bond_type[i][j] == 0) continue; if (buf) { - buf[m][0] = MAX(bond_type[i][j],-bond_type[i][j]); + buf[m][0] = MAX(bond_type[i][j], -bond_type[i][j]); buf[m][1] = tag[i]; buf[m][2] = bond_atom[i][j]; } @@ -2083,7 +2014,7 @@ int AtomVec::pack_bond(tagint **buf) void AtomVec::write_bond(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fmt::print(fp,"{} {} {} {}\n",index,buf[i][0],buf[i][1],buf[i][2]); + fmt::print(fp, "{} {} {} {}\n", index, buf[i][0], buf[i][1], buf[i][2]); index++; } } @@ -2106,14 +2037,14 @@ int AtomVec::pack_angle(tagint **buf) int nlocal = atom->nlocal; int newton_bond = force->newton_bond; - int i,j; + int i, j; int m = 0; if (newton_bond) { for (i = 0; i < nlocal; i++) for (j = 0; j < num_angle[i]; j++) { if (angle_type[i][j] == 0) continue; if (buf) { - buf[m][0] = MAX(angle_type[i][j],-angle_type[i][j]); + buf[m][0] = MAX(angle_type[i][j], -angle_type[i][j]); buf[m][1] = angle_atom1[i][j]; buf[m][2] = angle_atom2[i][j]; buf[m][3] = angle_atom3[i][j]; @@ -2126,7 +2057,7 @@ int AtomVec::pack_angle(tagint **buf) if (tag[i] == angle_atom2[i][j]) { if (angle_type[i][j] == 0) continue; if (buf) { - buf[m][0] = MAX(angle_type[i][j],-angle_type[i][j]); + buf[m][0] = MAX(angle_type[i][j], -angle_type[i][j]); buf[m][1] = angle_atom1[i][j]; buf[m][2] = angle_atom2[i][j]; buf[m][3] = angle_atom3[i][j]; @@ -2145,8 +2076,7 @@ int AtomVec::pack_angle(tagint **buf) void AtomVec::write_angle(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fmt::print(fp,"{} {} {} {} {}\n",index, - buf[i][0],buf[i][1],buf[i][2],buf[i][3]); + fmt::print(fp, "{} {} {} {} {}\n", index, buf[i][0], buf[i][1], buf[i][2], buf[i][3]); index++; } } @@ -2167,13 +2097,13 @@ int AtomVec::pack_dihedral(tagint **buf) int nlocal = atom->nlocal; int newton_bond = force->newton_bond; - int i,j; + int i, j; int m = 0; if (newton_bond) { for (i = 0; i < nlocal; i++) for (j = 0; j < num_dihedral[i]; j++) { if (buf) { - buf[m][0] = MAX(dihedral_type[i][j],-dihedral_type[i][j]); + buf[m][0] = MAX(dihedral_type[i][j], -dihedral_type[i][j]); buf[m][1] = dihedral_atom1[i][j]; buf[m][2] = dihedral_atom2[i][j]; buf[m][3] = dihedral_atom3[i][j]; @@ -2186,7 +2116,7 @@ int AtomVec::pack_dihedral(tagint **buf) for (j = 0; j < num_dihedral[i]; j++) if (tag[i] == dihedral_atom2[i][j]) { if (buf) { - buf[m][0] = MAX(dihedral_type[i][j],-dihedral_type[i][j]); + buf[m][0] = MAX(dihedral_type[i][j], -dihedral_type[i][j]); buf[m][1] = dihedral_atom1[i][j]; buf[m][2] = dihedral_atom2[i][j]; buf[m][3] = dihedral_atom3[i][j]; @@ -2206,8 +2136,8 @@ int AtomVec::pack_dihedral(tagint **buf) void AtomVec::write_dihedral(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fmt::print(fp,"{} {} {} {} {} {}\n",index,buf[i][0], - buf[i][1],buf[i][2],buf[i][3],buf[i][4]); + fmt::print(fp, "{} {} {} {} {} {}\n", index, buf[i][0], buf[i][1], buf[i][2], buf[i][3], + buf[i][4]); index++; } } @@ -2228,13 +2158,13 @@ int AtomVec::pack_improper(tagint **buf) int nlocal = atom->nlocal; int newton_bond = force->newton_bond; - int i,j; + int i, j; int m = 0; if (newton_bond) { for (i = 0; i < nlocal; i++) for (j = 0; j < num_improper[i]; j++) { if (buf) { - buf[m][0] = MAX(improper_type[i][j],-improper_type[i][j]); + buf[m][0] = MAX(improper_type[i][j], -improper_type[i][j]); buf[m][1] = improper_atom1[i][j]; buf[m][2] = improper_atom2[i][j]; buf[m][3] = improper_atom3[i][j]; @@ -2247,7 +2177,7 @@ int AtomVec::pack_improper(tagint **buf) for (j = 0; j < num_improper[i]; j++) if (tag[i] == improper_atom2[i][j]) { if (buf) { - buf[m][0] = MAX(improper_type[i][j],-improper_type[i][j]); + buf[m][0] = MAX(improper_type[i][j], -improper_type[i][j]); buf[m][1] = improper_atom1[i][j]; buf[m][2] = improper_atom2[i][j]; buf[m][3] = improper_atom3[i][j]; @@ -2267,8 +2197,8 @@ int AtomVec::pack_improper(tagint **buf) void AtomVec::write_improper(FILE *fp, int n, tagint **buf, int index) { for (int i = 0; i < n; i++) { - fmt::print(fp,"{} {} {} {} {} {}\n",index,buf[i][0], - buf[i][1],buf[i][2],buf[i][3],buf[i][4]); + fmt::print(fp, "{} {} {} {} {} {}\n", index, buf[i][0], buf[i][1], buf[i][2], buf[i][3], + buf[i][4]); index++; } } @@ -2279,18 +2209,18 @@ void AtomVec::write_improper(FILE *fp, int n, tagint **buf, int index) double AtomVec::memory_usage() { - int datatype,cols,maxcols; + int datatype, cols, maxcols; void *pdata; double bytes = 0; - bytes += memory->usage(tag,nmax); - bytes += memory->usage(type,nmax); - bytes += memory->usage(mask,nmax); - bytes += memory->usage(image,nmax); - bytes += memory->usage(x,nmax,3); - bytes += memory->usage(v,nmax,3); - bytes += memory->usage(f,nmax*comm->nthreads,3); + bytes += memory->usage(tag, nmax); + bytes += memory->usage(type, nmax); + bytes += memory->usage(mask, nmax); + bytes += memory->usage(image, nmax); + bytes += memory->usage(x, nmax, 3); + bytes += memory->usage(v, nmax, 3); + bytes += memory->usage(f, nmax * comm->nthreads, 3); for (int i = 0; i < ngrow; i++) { pdata = mgrow.pdata[i]; @@ -2299,30 +2229,30 @@ double AtomVec::memory_usage() const int nthreads = threads[i] ? comm->nthreads : 1; if (datatype == Atom::DOUBLE) { if (cols == 0) { - bytes += memory->usage(*((double **) pdata),nmax*nthreads); + bytes += memory->usage(*((double **) pdata), nmax * nthreads); } else if (cols > 0) { - bytes += memory->usage(*((double ***) pdata),nmax*nthreads,cols); + bytes += memory->usage(*((double ***) pdata), nmax * nthreads, cols); } else { maxcols = *(mgrow.maxcols[i]); - bytes += memory->usage(*((double ***) pdata),nmax*nthreads,maxcols); + bytes += memory->usage(*((double ***) pdata), nmax * nthreads, maxcols); } } else if (datatype == Atom::INT) { if (cols == 0) { - bytes += memory->usage(*((int **) pdata),nmax*nthreads); + bytes += memory->usage(*((int **) pdata), nmax * nthreads); } else if (cols > 0) { - bytes += memory->usage(*((int ***) pdata),nmax*nthreads,cols); + bytes += memory->usage(*((int ***) pdata), nmax * nthreads, cols); } else { maxcols = *(mgrow.maxcols[i]); - bytes += memory->usage(*((int ***) pdata),nmax*nthreads,maxcols); + bytes += memory->usage(*((int ***) pdata), nmax * nthreads, maxcols); } } else if (datatype == Atom::BIGINT) { if (cols == 0) { - bytes += memory->usage(*((bigint **) pdata),nmax*nthreads); + bytes += memory->usage(*((bigint **) pdata), nmax * nthreads); } else if (cols > 0) { - bytes += memory->usage(*((bigint ***) pdata),nmax*nthreads,cols); + bytes += memory->usage(*((bigint ***) pdata), nmax * nthreads, cols); } else { maxcols = *(mgrow.maxcols[i]); - bytes += memory->usage(*((bigint ***) pdata),nmax*nthreads,maxcols); + bytes += memory->usage(*((bigint ***) pdata), nmax * nthreads, maxcols); } } } @@ -2342,52 +2272,53 @@ double AtomVec::memory_usage() void AtomVec::setup_fields() { - int n,cols; + int n, cols; - if (!utils::strmatch(fields_data_atom,"^id ")) - error->all(FLERR,"Atom style fields_data_atom must have id as first field"); - if (!utils::strmatch(fields_data_vel,"^id v")) - error->all(FLERR,"Atom style fields_data_vel must have " - "'id v' as first fields"); + if ((fields_data_atom.size() < 1) || (fields_data_atom[0] != "id")) + error->all(FLERR, "Atom style fields_data_atom must have 'id' as first field"); + if ((fields_data_vel.size() < 2) || (fields_data_vel[0] != "id") || (fields_data_vel[1] != "v")) + error->all(FLERR, "Atom style fields_data_vel must have 'id' and 'v' as first two fields"); // process field strings - // return # of fields and matching index into atom->peratom (in Method struct) + // return # of fields and matching index into atom.peratom (in Method struct) - ngrow = process_fields(fields_grow,default_grow,&mgrow); - ncopy = process_fields(fields_copy,default_copy,&mcopy); - ncomm = process_fields(fields_comm,default_comm,&mcomm); - ncomm_vel = process_fields(fields_comm_vel,default_comm_vel,&mcomm_vel); - nreverse = process_fields(fields_reverse,default_reverse,&mreverse); - nborder = process_fields(fields_border,default_border,&mborder); - nborder_vel = process_fields(fields_border_vel,default_border_vel,&mborder_vel); - nexchange = process_fields(fields_exchange,default_exchange,&mexchange); - nrestart = process_fields(fields_restart,default_restart,&mrestart); - ncreate = process_fields(fields_create,default_create,&mcreate); - ndata_atom = process_fields(fields_data_atom,default_data_atom,&mdata_atom); - ndata_vel = process_fields(fields_data_vel,default_data_vel,&mdata_vel); + ngrow = process_fields(fields_grow, default_grow, &mgrow); + ncopy = process_fields(fields_copy, default_copy, &mcopy); + ncomm = process_fields(fields_comm, default_comm, &mcomm); + ncomm_vel = process_fields(fields_comm_vel, default_comm_vel, &mcomm_vel); + nreverse = process_fields(fields_reverse, default_reverse, &mreverse); + nborder = process_fields(fields_border, default_border, &mborder); + nborder_vel = process_fields(fields_border_vel, default_border_vel, &mborder_vel); + nexchange = process_fields(fields_exchange, default_exchange, &mexchange); + nrestart = process_fields(fields_restart, default_restart, &mrestart); + ncreate = process_fields(fields_create, default_create, &mcreate); + ndata_atom = process_fields(fields_data_atom, default_data_atom, &mdata_atom); + ndata_vel = process_fields(fields_data_vel, default_data_vel, &mdata_vel); // populate field-based data struct for each method to use - init_method(ngrow,&mgrow); - init_method(ncopy,&mcopy); - init_method(ncomm,&mcomm); - init_method(ncomm_vel,&mcomm_vel); - init_method(nreverse,&mreverse); - init_method(nborder,&mborder); - init_method(nborder_vel,&mborder_vel); - init_method(nexchange,&mexchange); - init_method(nrestart,&mrestart); - init_method(ncreate,&mcreate); - init_method(ndata_atom,&mdata_atom); - init_method(ndata_vel,&mdata_vel); + init_method(ngrow, &mgrow); + init_method(ncopy, &mcopy); + init_method(ncomm, &mcomm); + init_method(ncomm_vel, &mcomm_vel); + init_method(nreverse, &mreverse); + init_method(nborder, &mborder); + init_method(nborder_vel, &mborder_vel); + init_method(nexchange, &mexchange); + init_method(nrestart, &mrestart); + init_method(ncreate, &mcreate); + init_method(ndata_atom, &mdata_atom); + init_method(ndata_vel, &mdata_vel); // create threads data struct for grow and memory_usage to use - if (ngrow) threads = new bool[ngrow]; - else threads = nullptr; + if (ngrow) + threads = new bool[ngrow]; + else + threads = nullptr; for (int i = 0; i < ngrow; i++) { - Atom::PerAtom *field = &atom->peratom[mgrow.index[i]]; - threads[i] = (field->threadflag) ? true : false; + const auto &field = atom->peratom[mgrow.index[i]]; + threads[i] = field.threadflag == 1; } // set style-specific sizes @@ -2396,53 +2327,66 @@ void AtomVec::setup_fields() if (ncomm) comm_x_only = 0; if (bonus_flag && size_forward_bonus) comm_x_only = 0; - if (nreverse == 0) comm_f_only = 1; - else comm_f_only = 0; + if (nreverse == 0) + comm_f_only = 1; + else + comm_f_only = 0; size_forward = 3; for (n = 0; n < ncomm; n++) { cols = mcomm.cols[n]; - if (cols == 0) size_forward++; - else size_forward += cols; + if (cols == 0) + size_forward++; + else + size_forward += cols; } if (bonus_flag) size_forward += size_forward_bonus; size_reverse = 3; for (n = 0; n < nreverse; n++) { cols = mreverse.cols[n]; - if (cols == 0) size_reverse++; - else size_reverse += cols; + if (cols == 0) + size_reverse++; + else + size_reverse += cols; } size_border = 6; for (n = 0; n < nborder; n++) { cols = mborder.cols[n]; - if (cols == 0) size_border++; - else size_border += cols; + if (cols == 0) + size_border++; + else + size_border += cols; } if (bonus_flag) size_border += size_border_bonus; size_velocity = 3; for (n = 0; n < ncomm_vel; n++) { cols = mcomm_vel.cols[n]; - if (cols == 0) size_velocity++; - else size_velocity += cols; + if (cols == 0) + size_velocity++; + else + size_velocity += cols; } size_data_atom = 0; for (n = 0; n < ndata_atom; n++) { cols = mdata_atom.cols[n]; - if (strcmp(atom->peratom[mdata_atom.index[n]].name,"x") == 0) - xcol_data = size_data_atom + 1; - if (cols == 0) size_data_atom++; - else size_data_atom += cols; + if (atom->peratom[mdata_atom.index[n]].name == "x") xcol_data = size_data_atom + 1; + if (cols == 0) + size_data_atom++; + else + size_data_atom += cols; } size_data_vel = 0; for (n = 0; n < ndata_vel; n++) { cols = mdata_vel.cols[n]; - if (cols == 0) size_data_vel++; - else size_data_vel += cols; + if (cols == 0) + size_data_vel++; + else + size_data_vel += cols; } } @@ -2450,52 +2394,42 @@ void AtomVec::setup_fields() process a single field string ------------------------------------------------------------------------- */ -int AtomVec::process_fields(char *str, const char *default_str, Method *method) +int AtomVec::process_fields(const std::vector &words, + const std::vector &def_words, Method *method) { - if (str == nullptr) { - return 0; - } - - // tokenize words in both strings - std::vector words = Tokenizer(str, " ").as_vector(); - std::vector def_words = Tokenizer(default_str, " ").as_vector(); - int nfield = words.size(); - int ndef = def_words.size(); + int ndef = def_words.size(); // process fields one by one, add to index vector - Atom::PerAtom *peratom = atom->peratom; - int nperatom = atom->nperatom; + const auto &peratom = atom->peratom; + const int nperatom = peratom.size(); // allocate memory in method method->resize(nfield); - std::vector & index = method->index; + std::vector &index = method->index; int match; for (int i = 0; i < nfield; i++) { - const std::string & field = words[i]; + const std::string &field = words[i]; // find field in master Atom::peratom list for (match = 0; match < nperatom; match++) if (field == peratom[match].name) break; - if (match == nperatom) - error->all(FLERR,"Peratom field {} not recognized", field); + if (match == nperatom) error->all(FLERR, "Peratom field {} not recognized", field); index[i] = match; // error if field appears multiple times for (match = 0; match < i; match++) - if (index[i] == index[match]) - error->all(FLERR,"Peratom field {} is repeated", field); + if (index[i] == index[match]) error->all(FLERR, "Peratom field {} is repeated", field); // error if field is in default str for (match = 0; match < ndef; match++) - if (field == def_words[match]) - error->all(FLERR,"Peratom field {} is a default", field); + if (field == def_words[match]) error->all(FLERR, "Peratom field {} is a default", field); } return nfield; @@ -2508,14 +2442,14 @@ int AtomVec::process_fields(char *str, const char *default_str, Method *method) void AtomVec::init_method(int nfield, Method *method) { for (int i = 0; i < nfield; i++) { - Atom::PerAtom *field = &atom->peratom[method->index[i]]; - method->pdata[i] = (void *) field->address; - method->datatype[i] = field->datatype; - method->cols[i] = field->cols; + const auto &field = atom->peratom[method->index[i]]; + method->pdata[i] = (void *) field.address; + method->datatype[i] = field.datatype; + method->cols[i] = field.cols; if (method->cols[i] < 0) { - method->maxcols[i] = field->address_maxcols; - method->collength[i] = field->collength; - method->plength[i] = field->address_length; + method->maxcols[i] = field.address_maxcols; + method->collength[i] = field.collength; + method->plength[i] = field.address_length; } } } @@ -2524,7 +2458,8 @@ void AtomVec::init_method(int nfield, Method *method) Method class members ------------------------------------------------------------------------- */ -void AtomVec::Method::resize(int nfield) { +void AtomVec::Method::resize(int nfield) +{ pdata.resize(nfield); datatype.resize(nfield); cols.resize(nfield); diff --git a/src/atom_vec.h b/src/atom_vec.h index ad1c7f3315..b8f6202e78 100644 --- a/src/atom_vec.h +++ b/src/atom_vec.h @@ -59,11 +59,10 @@ class AtomVec : protected Pointers { // additional list of peratom fields operated on by different methods // set or created by child styles - char *fields_grow, *fields_copy; - char *fields_comm, *fields_comm_vel, *fields_reverse; - char *fields_border, *fields_border_vel; - char *fields_exchange, *fields_restart; - char *fields_create, *fields_data_atom, *fields_data_vel; + std::vector fields_grow, fields_copy, fields_comm, fields_comm_vel; + std::vector fields_reverse, fields_border, fields_border_vel; + std::vector fields_exchange, fields_restart, fields_create; + std::vector fields_data_atom, fields_data_vel; // methods @@ -152,7 +151,7 @@ class AtomVec : protected Pointers { virtual int pack_data_bonus(double *, int) { return 0; } virtual void write_data_bonus(FILE *, int, double *, int) {} - virtual int property_atom(char *) { return -1; } + virtual int property_atom(const std::string &) { return -1; } virtual void pack_property_atom(int, double *, int, int) {} virtual double memory_usage(); @@ -187,11 +186,10 @@ class AtomVec : protected Pointers { // standard list of peratom fields always operated on by different methods // common to all styles, so not listed in field strings - const char *default_grow, *default_copy; - const char *default_comm, *default_comm_vel, *default_reverse; - const char *default_border, *default_border_vel; - const char *default_exchange, *default_restart; - const char *default_create, *default_data_atom, *default_data_vel; + static const std::vector default_grow, default_copy, default_comm, default_comm_vel; + static const std::vector default_reverse, default_border, default_border_vel; + static const std::vector default_exchange, default_restart, default_create; + static const std::vector default_data_atom, default_data_vel; struct Method { std::vector pdata; @@ -223,31 +221,10 @@ class AtomVec : protected Pointers { void grow_nmax(); int grow_nmax_bonus(int); void setup_fields(); - int process_fields(char *, const char *, Method *); + int process_fields(const std::vector &, const std::vector &, Method *); void init_method(int, Method *); }; } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid atom_style command - -Self-explanatory. - -E: KOKKOS package requires a kokkos enabled atom_style - -Self-explanatory. - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/atom_vec_atomic.cpp b/src/atom_vec_atomic.cpp index 88584981f5..44fb7d2fee 100644 --- a/src/atom_vec_atomic.cpp +++ b/src/atom_vec_atomic.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -30,18 +29,8 @@ AtomVecAtomic::AtomVecAtomic(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) ""; - fields_copy = (char *) ""; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) ""; - fields_border_vel = (char *) ""; - fields_exchange = (char *) ""; - fields_restart = (char *) ""; - fields_create = (char *) ""; - fields_data_atom = (char *) "id type x"; - fields_data_vel = (char *) "id v"; + fields_data_atom = {"id", "type", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } diff --git a/src/atom_vec_atomic.h b/src/atom_vec_atomic.h index 28d773a30a..cba25e11ec 100644 --- a/src/atom_vec_atomic.h +++ b/src/atom_vec_atomic.h @@ -33,7 +33,3 @@ class AtomVecAtomic : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 6308153be6..f2eef1d207 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -23,8 +22,6 @@ #include "modify.h" #include "my_pool_chunk.h" -#include - using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ @@ -54,27 +51,29 @@ AtomVecBody::AtomVecBody(LAMMPS *lmp) : AtomVec(lmp) bptr = nullptr; - if (sizeof(double) == sizeof(int)) intdoubleratio = 1; - else if (sizeof(double) == 2*sizeof(int)) intdoubleratio = 2; - else error->all(FLERR,"Internal error in atom_style body"); + if (sizeof(double) == sizeof(int)) + intdoubleratio = 1; + else if (sizeof(double) == 2 * sizeof(int)) + intdoubleratio = 2; + else + error->all(FLERR, "Internal error in atom_style body"); // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "radius rmass angmom torque body"; - fields_copy = (char *) "radius rmass angmom"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) "angmom"; - fields_reverse = (char *) "torque"; - fields_border = (char *) "radius rmass"; - fields_border_vel = (char *) "radius rmass angmom"; - fields_exchange = (char *) "radius rmass angmom"; - fields_restart = (char *) "radius rmass angmom"; - fields_create = (char *) "radius rmass angmom body"; - fields_data_atom = (char *) "id type body rmass x"; - fields_data_vel = (char *) "id v angmom"; + fields_grow = {"radius", "rmass", "angmom", "torque", "body"}; + fields_copy = {"radius", "rmass", "angmom"}; + fields_comm_vel = {"angmom"}; + fields_reverse = {"torque"}; + fields_border = {"radius", "rmass"}; + fields_border_vel = {"radius", "rmass", "angmom"}; + fields_exchange = {"radius", "rmass", "angmom"}; + fields_restart = {"radius", "rmass", "angmom"}; + fields_create = {"radius", "rmass", "angmom", "body"}; + fields_data_atom = {"id", "type", "body", "rmass", "x"}; + fields_data_vel = {"id", "v", "angmom"}; } /* ---------------------------------------------------------------------- */ @@ -101,23 +100,25 @@ void AtomVecBody::process_args(int narg, char **arg) { // suppress unused parameter warning dependent on style_body.h - (void)(arg); + (void) (arg); - if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); + if (narg < 1) error->all(FLERR, "Invalid atom_style body command"); - if (false) { + if (false) { // NOLINT bptr = nullptr; #define BODY_CLASS -#define BodyStyle(key,Class) \ - } else if (strcmp(arg[0],#key) == 0) { \ - bptr = new Class(lmp,narg,arg); -#include "style_body.h" // IWYU pragma: keep +#define BodyStyle(key, Class) \ + } \ + else if (strcmp(arg[0], #key) == 0) \ + { \ + bptr = new Class(lmp, narg, arg); +#include "style_body.h" // IWYU pragma: keep #undef BodyStyle #undef BODY_CLASS - } else error->all(FLERR,utils:: - check_packages_for_style("body",arg[0],lmp).c_str()); + } else + error->all(FLERR, utils::check_packages_for_style("body", arg[0], lmp).c_str()); bptr->avec = this; icp = bptr->icp; @@ -153,11 +154,9 @@ void AtomVecBody::grow_pointers() void AtomVecBody::grow_bonus() { nmax_bonus = grow_nmax_bonus(nmax_bonus); - if (nmax_bonus < 0) - error->one(FLERR,"Per-processor system is too big"); + if (nmax_bonus < 0) error->one(FLERR, "Per-processor system is too big"); - bonus = (Bonus *) memory->srealloc(bonus,nmax_bonus*sizeof(Bonus), - "atom:bonus"); + bonus = (Bonus *) memory->srealloc(bonus, nmax_bonus * sizeof(Bonus), "atom:bonus"); } /* ---------------------------------------------------------------------- @@ -173,7 +172,7 @@ void AtomVecBody::copy_bonus(int i, int j, int delflag) int k = body[j]; icp->put(bonus[k].iindex); dcp->put(bonus[k].dindex); - copy_bonus_all(nlocal_bonus-1,k); + copy_bonus_all(nlocal_bonus - 1, k); nlocal_bonus--; } @@ -192,7 +191,7 @@ void AtomVecBody::copy_bonus(int i, int j, int delflag) void AtomVecBody::copy_bonus_all(int i, int j) { body[bonus[i].ilocal] = j; - memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); + memcpy(&bonus[j], &bonus[i], sizeof(Bonus)); } /* ---------------------------------------------------------------------- @@ -218,7 +217,7 @@ void AtomVecBody::clear_bonus() int AtomVecBody::pack_comm_bonus(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; double *quat; m = 0; @@ -230,7 +229,7 @@ int AtomVecBody::pack_comm_bonus(int n, int *list, double *buf) buf[m++] = quat[1]; buf[m++] = quat[2]; buf[m++] = quat[3]; - m += bptr->pack_comm_body(&bonus[body[j]],&buf[m]); + m += bptr->pack_comm_body(&bonus[body[j]], &buf[m]); } } @@ -241,7 +240,7 @@ int AtomVecBody::pack_comm_bonus(int n, int *list, double *buf) void AtomVecBody::unpack_comm_bonus(int n, int first, double *buf) { - int i,m,last; + int i, m, last; double *quat; m = 0; @@ -253,7 +252,7 @@ void AtomVecBody::unpack_comm_bonus(int n, int first, double *buf) quat[1] = buf[m++]; quat[2] = buf[m++]; quat[3] = buf[m++]; - m += bptr->unpack_comm_body(&bonus[body[i]],&buf[m]); + m += bptr->unpack_comm_body(&bonus[body[i]], &buf[m]); } } } @@ -262,13 +261,14 @@ void AtomVecBody::unpack_comm_bonus(int n, int first, double *buf) int AtomVecBody::pack_border_bonus(int n, int *list, double *buf) { - int i,j,m; - double *quat,*inertia; + int i, j, m; + double *quat, *inertia; m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (body[j] < 0) buf[m++] = ubuf(0).d; + if (body[j] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; quat = bonus[body[j]].quat; @@ -282,7 +282,7 @@ int AtomVecBody::pack_border_bonus(int n, int *list, double *buf) buf[m++] = inertia[2]; buf[m++] = ubuf(bonus[body[j]].ninteger).d; buf[m++] = ubuf(bonus[body[j]].ndouble).d; - m += bptr->pack_border_body(&bonus[body[j]],&buf[m]); + m += bptr->pack_border_body(&bonus[body[j]], &buf[m]); } } @@ -293,14 +293,15 @@ int AtomVecBody::pack_border_bonus(int n, int *list, double *buf) int AtomVecBody::unpack_border_bonus(int n, int first, double *buf) { - int i,j,m,last; - double *quat,*inertia; + int i, j, m, last; + double *quat, *inertia; m = 0; last = first + n; for (i = first; i < last; i++) { body[i] = (int) ubuf(buf[m++]).i; - if (body[i] == 0) body[i] = -1; + if (body[i] == 0) + body[i] = -1; else { j = nlocal_bonus + nghost_bonus; if (j == nmax_bonus) grow_bonus(); @@ -316,9 +317,9 @@ int AtomVecBody::unpack_border_bonus(int n, int first, double *buf) bonus[j].ninteger = (int) ubuf(buf[m++]).i; bonus[j].ndouble = (int) ubuf(buf[m++]).i; // corresponding put() calls are in clear_bonus() - bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); - bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); - m += bptr->unpack_border_body(&bonus[j],&buf[m]); + bonus[j].ivalue = icp->get(bonus[j].ninteger, bonus[j].iindex); + bonus[j].dvalue = dcp->get(bonus[j].ndouble, bonus[j].dindex); + m += bptr->unpack_border_body(&bonus[j], &buf[m]); bonus[j].ilocal = i; body[i] = j; nghost_bonus++; @@ -337,7 +338,8 @@ int AtomVecBody::pack_exchange_bonus(int i, double *buf) { int m = 0; - if (body[i] < 0) buf[m++] = ubuf(0).d; + if (body[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = body[i]; @@ -352,10 +354,12 @@ int AtomVecBody::pack_exchange_bonus(int i, double *buf) buf[m++] = inertia[2]; buf[m++] = ubuf(bonus[j].ninteger).d; buf[m++] = ubuf(bonus[j].ndouble).d; - memcpy(&buf[m],bonus[j].ivalue,bonus[j].ninteger*sizeof(int)); - if (intdoubleratio == 1) m += bonus[j].ninteger; - else m += (bonus[j].ninteger+1)/2; - memcpy(&buf[m],bonus[j].dvalue,bonus[j].ndouble*sizeof(double)); + memcpy(&buf[m], bonus[j].ivalue, bonus[j].ninteger * sizeof(int)); + if (intdoubleratio == 1) + m += bonus[j].ninteger; + else + m += (bonus[j].ninteger + 1) / 2; + memcpy(&buf[m], bonus[j].dvalue, bonus[j].ndouble * sizeof(double)); m += bonus[j].ndouble; } @@ -369,7 +373,8 @@ int AtomVecBody::unpack_exchange_bonus(int ilocal, double *buf) int m = 0; body[ilocal] = (int) ubuf(buf[m++]).i; - if (body[ilocal] == 0) body[ilocal] = -1; + if (body[ilocal] == 0) + body[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); double *quat = bonus[nlocal_bonus].quat; @@ -384,16 +389,14 @@ int AtomVecBody::unpack_exchange_bonus(int ilocal, double *buf) bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i; bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i; // corresponding put() calls are in copy() - bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, - bonus[nlocal_bonus].iindex); - bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, - bonus[nlocal_bonus].dindex); - memcpy(bonus[nlocal_bonus].ivalue,&buf[m], - bonus[nlocal_bonus].ninteger*sizeof(int)); - if (intdoubleratio == 1) m += bonus[nlocal_bonus].ninteger; - else m += (bonus[nlocal_bonus].ninteger+1)/2; - memcpy(bonus[nlocal_bonus].dvalue,&buf[m], - bonus[nlocal_bonus].ndouble*sizeof(double)); + bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, bonus[nlocal_bonus].iindex); + bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, bonus[nlocal_bonus].dindex); + memcpy(bonus[nlocal_bonus].ivalue, &buf[m], bonus[nlocal_bonus].ninteger * sizeof(int)); + if (intdoubleratio == 1) + m += bonus[nlocal_bonus].ninteger; + else + m += (bonus[nlocal_bonus].ninteger + 1) / 2; + memcpy(bonus[nlocal_bonus].dvalue, &buf[m], bonus[nlocal_bonus].ndouble * sizeof(double)); m += bonus[nlocal_bonus].ndouble; bonus[nlocal_bonus].ilocal = ilocal; @@ -416,10 +419,13 @@ int AtomVecBody::size_restart_bonus() for (i = 0; i < nlocal; i++) { if (body[i] >= 0) { n += size_restart_bonus_one; - if (intdoubleratio == 1) n += bonus[body[i]].ninteger; - else n += (bonus[body[i]].ninteger+1)/2; + if (intdoubleratio == 1) + n += bonus[body[i]].ninteger; + else + n += (bonus[body[i]].ninteger + 1) / 2; n += bonus[body[i]].ndouble; - } else n++; + } else + n++; } return n; @@ -435,7 +441,8 @@ int AtomVecBody::pack_restart_bonus(int i, double *buf) { int m = 0; - if (body[i] < 0) buf[m++] = ubuf(0).d; + if (body[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = body[i]; @@ -450,10 +457,12 @@ int AtomVecBody::pack_restart_bonus(int i, double *buf) buf[m++] = inertia[2]; buf[m++] = ubuf(bonus[j].ninteger).d; buf[m++] = ubuf(bonus[j].ndouble).d; - memcpy(&buf[m],bonus[j].ivalue,bonus[j].ninteger*sizeof(int)); - if (intdoubleratio == 1) m += bonus[j].ninteger; - else m += (bonus[j].ninteger+1)/2; - memcpy(&buf[m],bonus[j].dvalue,bonus[j].ndouble*sizeof(double)); + memcpy(&buf[m], bonus[j].ivalue, bonus[j].ninteger * sizeof(int)); + if (intdoubleratio == 1) + m += bonus[j].ninteger; + else + m += (bonus[j].ninteger + 1) / 2; + memcpy(&buf[m], bonus[j].dvalue, bonus[j].ndouble * sizeof(double)); m += bonus[j].ndouble; } @@ -469,7 +478,8 @@ int AtomVecBody::unpack_restart_bonus(int ilocal, double *buf) int m = 0; body[ilocal] = (int) ubuf(buf[m++]).i; - if (body[ilocal] == 0) body[ilocal] = -1; + if (body[ilocal] == 0) + body[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); double *quat = bonus[nlocal_bonus].quat; @@ -483,16 +493,14 @@ int AtomVecBody::unpack_restart_bonus(int ilocal, double *buf) inertia[2] = buf[m++]; bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i; bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i; - bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, - bonus[nlocal_bonus].iindex); - bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, - bonus[nlocal_bonus].dindex); - memcpy(bonus[nlocal_bonus].ivalue,&buf[m], - bonus[nlocal_bonus].ninteger*sizeof(int)); - if (intdoubleratio == 1) m += bonus[nlocal_bonus].ninteger; - else m += (bonus[nlocal_bonus].ninteger+1)/2; - memcpy(bonus[nlocal_bonus].dvalue,&buf[m], - bonus[nlocal_bonus].ndouble*sizeof(double)); + bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, bonus[nlocal_bonus].iindex); + bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, bonus[nlocal_bonus].dindex); + memcpy(bonus[nlocal_bonus].ivalue, &buf[m], bonus[nlocal_bonus].ninteger * sizeof(int)); + if (intdoubleratio == 1) + m += bonus[nlocal_bonus].ninteger; + else + m += (bonus[nlocal_bonus].ninteger + 1) / 2; + memcpy(bonus[nlocal_bonus].dvalue, &buf[m], bonus[nlocal_bonus].ndouble * sizeof(double)); m += bonus[nlocal_bonus].ndouble; bonus[nlocal_bonus].ilocal = ilocal; body[ilocal] = nlocal_bonus++; @@ -521,13 +529,15 @@ void AtomVecBody::create_atom_post(int ilocal) void AtomVecBody::data_atom_post(int ilocal) { body_flag = body[ilocal]; - if (body_flag == 0) body_flag = -1; - else if (body_flag == 1) body_flag = 0; - else error->one(FLERR,"Invalid body flag in Atoms section of data file"); + if (body_flag == 0) + body_flag = -1; + else if (body_flag == 1) + body_flag = 0; + else + error->one(FLERR, "Invalid body flag in Atoms section of data file"); body[ilocal] = body_flag; - if (rmass[ilocal] <= 0.0) - error->one(FLERR,"Invalid density in Atoms section of data file"); + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); radius[ilocal] = 0.5; angmom[ilocal][0] = 0.0; @@ -539,14 +549,12 @@ void AtomVecBody::data_atom_post(int ilocal) unpack one body from Bodies section of data file ------------------------------------------------------------------------- */ -void AtomVecBody::data_body(int m, int ninteger, int ndouble, - int *ivalues, double *dvalues) +void AtomVecBody::data_body(int m, int ninteger, int ndouble, int *ivalues, double *dvalues) { - if (body[m]) - error->one(FLERR,"Assigning body parameters to non-body atom"); + if (body[m]) error->one(FLERR, "Assigning body parameters to non-body atom"); if (nlocal_bonus == nmax_bonus) grow_bonus(); bonus[nlocal_bonus].ilocal = m; - bptr->data_body(nlocal_bonus,ninteger,ndouble,ivalues,dvalues); + bptr->data_body(nlocal_bonus, ninteger, ndouble, ivalues, dvalues); body[m] = nlocal_bonus++; } @@ -557,14 +565,14 @@ void AtomVecBody::data_body(int m, int ninteger, int ndouble, double AtomVecBody::memory_usage_bonus() { double bytes = 0; - bytes += (double)nmax_bonus*sizeof(Bonus); + bytes += (double) nmax_bonus * sizeof(Bonus); bytes += icp->size() + dcp->size(); int nall = nlocal_bonus + nghost_bonus; for (int i = 0; i < nall; i++) { if (body[i] >= 0) { - bytes += (double)bonus[body[i]].ninteger * sizeof(int); - bytes += (double)bonus[body[i]].ndouble * sizeof(double); + bytes += (double) bonus[body[i]].ninteger * sizeof(int); + bytes += (double) bonus[body[i]].ndouble * sizeof(double); } } @@ -579,8 +587,10 @@ void AtomVecBody::pack_data_pre(int ilocal) { body_flag = body[ilocal]; - if (body_flag < 0) body[ilocal] = 0; - else body[ilocal] = 1; + if (body_flag < 0) + body[ilocal] = 0; + else + body[ilocal] = 1; } /* ---------------------------------------------------------------------- @@ -598,7 +608,7 @@ int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/) int m = 0; for (i = 0; i < nlocal; i++) { if (body[i] < 0) continue; - int n = bptr->pack_data_body(tag[i],body[i],buf); + int n = bptr->pack_data_body(tag[i], body[i], buf); m += n; if (buf) buf += n; } @@ -613,9 +623,7 @@ int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/) void AtomVecBody::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/) { int i = 0; - while (i < n) { - i += bptr->write_data_body(fp,&buf[i]); - } + while (i < n) { i += bptr->write_data_body(fp, &buf[i]); } } /* ---------------------------------------------------------------------- @@ -631,10 +639,9 @@ void AtomVecBody::pack_data_post(int ilocal) body computes its size based on ivalues/dvalues and returns it ------------------------------------------------------------------------- */ -double AtomVecBody::radius_body(int ninteger, int ndouble, - int *ivalues, double *dvalues) +double AtomVecBody::radius_body(int ninteger, int ndouble, int *ivalues, double *dvalues) { - return bptr->radius_body(ninteger,ndouble,ivalues,dvalues); + return bptr->radius_body(ninteger, ndouble, ivalues, dvalues); } /* ---------------------------------------------------------------------- @@ -644,10 +651,12 @@ double AtomVecBody::radius_body(int ninteger, int ndouble, void AtomVecBody::set_quat(int m, double *quat_external) { - if (body[m] < 0) error->one(FLERR,"Assigning quat to non-body atom"); + if (body[m] < 0) error->one(FLERR, "Assigning quat to non-body atom"); double *quat = bonus[body[m]].quat; - quat[0] = quat_external[0]; quat[1] = quat_external[1]; - quat[2] = quat_external[2]; quat[3] = quat_external[3]; + quat[0] = quat_external[0]; + quat[1] = quat_external[1]; + quat[2] = quat_external[2]; + quat[3] = quat_external[3]; } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_body.h b/src/atom_vec_body.h index 89137cc2b6..f9a4df9a31 100644 --- a/src/atom_vec_body.h +++ b/src/atom_vec_body.h @@ -94,40 +94,3 @@ class AtomVecBody : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Internal error in atom_style body - -This error should not occur. Contact the developers. - -E: Invalid atom_style body command - -No body style argument was provided. - -E: Unrecognized body style - -The choice of body style is unknown. - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -E: Assigning body parameters to non-body atom - -Self-explanatory. - -E: Assigning quat to non-body atom - -Self-explanatory. - -*/ diff --git a/src/atom_vec_charge.cpp b/src/atom_vec_charge.cpp index ca66048558..73164b6273 100644 --- a/src/atom_vec_charge.cpp +++ b/src/atom_vec_charge.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -31,18 +30,15 @@ AtomVecCharge::AtomVecCharge(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "q"; - fields_copy = (char *) "q"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) ""; - fields_reverse = (char *) ""; - fields_border = (char *) "q"; - fields_border_vel = (char *) "q"; - fields_exchange = (char *) "q"; - fields_restart = (char *) "q"; - fields_create = (char *) "q"; - fields_data_atom = (char *) "id type q x"; - fields_data_vel = (char *) "id v"; + fields_grow = {"q"}; + fields_copy = {"q"}; + fields_border = {"q"}; + fields_border_vel = {"q"}; + fields_exchange = {"q"}; + fields_restart = {"q"}; + fields_create = {"q"}; + fields_data_atom = {"id", "type", "q", "x"}; + fields_data_vel = {"id", "v"}; setup_fields(); } diff --git a/src/atom_vec_charge.h b/src/atom_vec_charge.h index 750c03e493..40bfb5622c 100644 --- a/src/atom_vec_charge.h +++ b/src/atom_vec_charge.h @@ -33,7 +33,3 @@ class AtomVecCharge : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index 6c39e4cfaf..cae0d1bc11 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,10 +25,8 @@ #include "memory.h" #include "modify.h" -#include - using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PI; /* ---------------------------------------------------------------------- */ @@ -54,18 +51,17 @@ AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "rmass angmom torque ellipsoid"; - fields_copy = (char *) "rmass angmom"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) "angmom"; - fields_reverse = (char *) "torque"; - fields_border = (char *) "rmass"; - fields_border_vel = (char *) "rmass angmom"; - fields_exchange = (char *) "rmass angmom"; - fields_restart = (char *) "rmass angmom"; - fields_create = (char *) "rmass angmom ellipsoid"; - fields_data_atom = (char *) "id type ellipsoid rmass x"; - fields_data_vel = (char *) "id v angmom"; + fields_grow = {"rmass", "angmom", "torque", "ellipsoid"}; + fields_copy = {"rmass", "angmom"}; + fields_comm_vel = {"angmom"}; + fields_reverse = {"torque"}; + fields_border = {"rmass"}; + fields_border_vel = {"rmass", "angmom"}; + fields_exchange = {"rmass", "angmom"}; + fields_restart = {"rmass", "angmom"}; + fields_create = {"rmass", "angmom", "ellipsoid"}; + fields_data_atom = {"id", "type", "ellipsoid", "rmass", "x"}; + fields_data_vel = {"id", "v", "angmom"}; setup_fields(); } @@ -96,11 +92,9 @@ void AtomVecEllipsoid::grow_pointers() void AtomVecEllipsoid::grow_bonus() { nmax_bonus = grow_nmax_bonus(nmax_bonus); - if (nmax_bonus < 0) - error->one(FLERR,"Per-processor system is too big"); + if (nmax_bonus < 0) error->one(FLERR, "Per-processor system is too big"); - bonus = (Bonus *) memory->srealloc(bonus,nmax_bonus*sizeof(Bonus), - "atom:bonus"); + bonus = (Bonus *) memory->srealloc(bonus, nmax_bonus * sizeof(Bonus), "atom:bonus"); } /* ---------------------------------------------------------------------- @@ -112,7 +106,7 @@ void AtomVecEllipsoid::copy_bonus(int i, int j, int delflag) // if deleting atom J via delflag and J has bonus data, then delete it if (delflag && ellipsoid[j] >= 0) { - copy_bonus_all(nlocal_bonus-1,ellipsoid[j]); + copy_bonus_all(nlocal_bonus - 1, ellipsoid[j]); nlocal_bonus--; } @@ -131,7 +125,7 @@ void AtomVecEllipsoid::copy_bonus(int i, int j, int delflag) void AtomVecEllipsoid::copy_bonus_all(int i, int j) { ellipsoid[bonus[i].ilocal] = j; - memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); + memcpy(&bonus[j], &bonus[i], sizeof(Bonus)); } /* ---------------------------------------------------------------------- @@ -152,7 +146,7 @@ void AtomVecEllipsoid::clear_bonus() int AtomVecEllipsoid::pack_comm_bonus(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; double *quat; m = 0; @@ -174,7 +168,7 @@ int AtomVecEllipsoid::pack_comm_bonus(int n, int *list, double *buf) void AtomVecEllipsoid::unpack_comm_bonus(int n, int first, double *buf) { - int i,m,last; + int i, m, last; double *quat; m = 0; @@ -194,13 +188,14 @@ void AtomVecEllipsoid::unpack_comm_bonus(int n, int first, double *buf) int AtomVecEllipsoid::pack_border_bonus(int n, int *list, double *buf) { - int i,j,m; - double *shape,*quat; + int i, j, m; + double *shape, *quat; m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (ellipsoid[j] < 0) buf[m++] = ubuf(0).d; + if (ellipsoid[j] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; shape = bonus[ellipsoid[j]].shape; @@ -222,14 +217,15 @@ int AtomVecEllipsoid::pack_border_bonus(int n, int *list, double *buf) int AtomVecEllipsoid::unpack_border_bonus(int n, int first, double *buf) { - int i,j,m,last; - double *shape,*quat; + int i, j, m, last; + double *shape, *quat; m = 0; last = first + n; for (i = first; i < last; i++) { ellipsoid[i] = (int) ubuf(buf[m++]).i; - if (ellipsoid[i] == 0) ellipsoid[i] = -1; + if (ellipsoid[i] == 0) + ellipsoid[i] = -1; else { j = nlocal_bonus + nghost_bonus; if (j == nmax_bonus) grow_bonus(); @@ -260,7 +256,8 @@ int AtomVecEllipsoid::pack_exchange_bonus(int i, double *buf) { int m = 0; - if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d; + if (ellipsoid[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = ellipsoid[i]; @@ -285,7 +282,8 @@ int AtomVecEllipsoid::unpack_exchange_bonus(int ilocal, double *buf) int m = 0; ellipsoid[ilocal] = (int) ubuf(buf[m++]).i; - if (ellipsoid[ilocal] == 0) ellipsoid[ilocal] = -1; + if (ellipsoid[ilocal] == 0) + ellipsoid[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); double *shape = bonus[nlocal_bonus].shape; @@ -316,8 +314,10 @@ int AtomVecEllipsoid::size_restart_bonus() int n = 0; int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - if (ellipsoid[i] >= 0) n += size_restart_bonus_one; - else n++; + if (ellipsoid[i] >= 0) + n += size_restart_bonus_one; + else + n++; } return n; @@ -333,7 +333,8 @@ int AtomVecEllipsoid::pack_restart_bonus(int i, double *buf) { int m = 0; - if (ellipsoid[i] < 0) buf[m++] = ubuf(0).d; + if (ellipsoid[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = ellipsoid[i]; @@ -358,7 +359,8 @@ int AtomVecEllipsoid::unpack_restart_bonus(int ilocal, double *buf) int m = 0; ellipsoid[ilocal] = (int) ubuf(buf[m++]).i; - if (ellipsoid[ilocal] == 0) ellipsoid[ilocal] = -1; + if (ellipsoid[ilocal] == 0) + ellipsoid[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); double *shape = bonus[nlocal_bonus].shape; @@ -381,32 +383,31 @@ int AtomVecEllipsoid::unpack_restart_bonus(int ilocal, double *buf) unpack one line from Ellipsoids section of data file ------------------------------------------------------------------------- */ -void AtomVecEllipsoid::data_atom_bonus(int m, const std::vector & values) +void AtomVecEllipsoid::data_atom_bonus(int m, const std::vector &values) { - if (ellipsoid[m]) - error->one(FLERR,"Assigning ellipsoid parameters to non-ellipsoid atom"); + if (ellipsoid[m]) error->one(FLERR, "Assigning ellipsoid parameters to non-ellipsoid atom"); if (nlocal_bonus == nmax_bonus) grow_bonus(); double *shape = bonus[nlocal_bonus].shape; int ivalue = 1; - shape[0] = 0.5 * utils::numeric(FLERR,values[ivalue++],true,lmp); - shape[1] = 0.5 * utils::numeric(FLERR,values[ivalue++],true,lmp); - shape[2] = 0.5 * utils::numeric(FLERR,values[ivalue++],true,lmp); + shape[0] = 0.5 * utils::numeric(FLERR, values[ivalue++], true, lmp); + shape[1] = 0.5 * utils::numeric(FLERR, values[ivalue++], true, lmp); + shape[2] = 0.5 * utils::numeric(FLERR, values[ivalue++], true, lmp); if (shape[0] <= 0.0 || shape[1] <= 0.0 || shape[2] <= 0.0) - error->one(FLERR,"Invalid shape in Ellipsoids section of data file"); + error->one(FLERR, "Invalid shape in Ellipsoids section of data file"); double *quat = bonus[nlocal_bonus].quat; - quat[0] = utils::numeric(FLERR,values[ivalue++],true,lmp); - quat[1] = utils::numeric(FLERR,values[ivalue++],true,lmp); - quat[2] = utils::numeric(FLERR,values[ivalue++],true,lmp); - quat[3] = utils::numeric(FLERR,values[ivalue++],true,lmp); + quat[0] = utils::numeric(FLERR, values[ivalue++], true, lmp); + quat[1] = utils::numeric(FLERR, values[ivalue++], true, lmp); + quat[2] = utils::numeric(FLERR, values[ivalue++], true, lmp); + quat[3] = utils::numeric(FLERR, values[ivalue++], true, lmp); MathExtra::qnormalize(quat); // reset ellipsoid mass // previously stored density in rmass - rmass[m] *= 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2]; + rmass[m] *= 4.0 * MY_PI / 3.0 * shape[0] * shape[1] * shape[2]; bonus[nlocal_bonus].ilocal = m; ellipsoid[m] = nlocal_bonus++; @@ -419,7 +420,7 @@ void AtomVecEllipsoid::data_atom_bonus(int m, const std::vector & v double AtomVecEllipsoid::memory_usage_bonus() { double bytes = 0; - bytes += nmax_bonus*sizeof(Bonus); + bytes += nmax_bonus * sizeof(Bonus); return bytes; } @@ -441,13 +442,15 @@ void AtomVecEllipsoid::create_atom_post(int ilocal) void AtomVecEllipsoid::data_atom_post(int ilocal) { ellipsoid_flag = ellipsoid[ilocal]; - if (ellipsoid_flag == 0) ellipsoid_flag = -1; - else if (ellipsoid_flag == 1) ellipsoid_flag = 0; - else error->one(FLERR,"Invalid ellipsoid flag in Atoms section of data file"); + if (ellipsoid_flag == 0) + ellipsoid_flag = -1; + else if (ellipsoid_flag == 1) + ellipsoid_flag = 0; + else + error->one(FLERR, "Invalid ellipsoid flag in Atoms section of data file"); ellipsoid[ilocal] = ellipsoid_flag; - if (rmass[ilocal] <= 0.0) - error->one(FLERR,"Invalid density in Atoms section of data file"); + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); angmom[ilocal][0] = 0.0; angmom[ilocal][1] = 0.0; @@ -465,12 +468,14 @@ void AtomVecEllipsoid::pack_data_pre(int ilocal) ellipsoid_flag = atom->ellipsoid[ilocal]; rmass_one = atom->rmass[ilocal]; - if (ellipsoid_flag < 0) ellipsoid[ilocal] = 0; - else ellipsoid[ilocal] = 1; + if (ellipsoid_flag < 0) + ellipsoid[ilocal] = 0; + else + ellipsoid[ilocal] = 1; if (ellipsoid_flag >= 0) { shape = bonus[ellipsoid_flag].shape; - rmass[ilocal] /= 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2]; + rmass[ilocal] /= 4.0 * MY_PI / 3.0 * shape[0] * shape[1] * shape[2]; } } @@ -491,7 +496,7 @@ void AtomVecEllipsoid::pack_data_post(int ilocal) int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/) { - int i,j; + int i, j; tagint *tag = atom->tag; int nlocal = atom->nlocal; @@ -502,14 +507,15 @@ int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/) if (buf) { buf[m++] = ubuf(tag[i]).d; j = ellipsoid[i]; - buf[m++] = 2.0*bonus[j].shape[0]; - buf[m++] = 2.0*bonus[j].shape[1]; - buf[m++] = 2.0*bonus[j].shape[2]; + buf[m++] = 2.0 * bonus[j].shape[0]; + buf[m++] = 2.0 * bonus[j].shape[1]; + buf[m++] = 2.0 * bonus[j].shape[2]; buf[m++] = bonus[j].quat[0]; buf[m++] = bonus[j].quat[1]; buf[m++] = bonus[j].quat[2]; buf[m++] = bonus[j].quat[3]; - } else m += size_data_bonus; + } else + m += size_data_bonus; } return m; @@ -523,8 +529,8 @@ void AtomVecEllipsoid::write_data_bonus(FILE *fp, int n, double *buf, int /*flag { int i = 0; while (i < n) { - fmt::print(fp,"{} {} {} {} {} {} {} {}\n",ubuf(buf[i]).i, - buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6],buf[i+7]); + fmt::print(fp, "{} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], + buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7]); i += size_data_bonus; } } @@ -552,7 +558,7 @@ void AtomVecEllipsoid::set_shape(int i, double shapex, double shapey, double sha bonus[nlocal_bonus].ilocal = i; ellipsoid[i] = nlocal_bonus++; } else if (shapex == 0.0 && shapey == 0.0 && shapez == 0.0) { - copy_bonus_all(nlocal_bonus-1,ellipsoid[i]); + copy_bonus_all(nlocal_bonus - 1, ellipsoid[i]); nlocal_bonus--; ellipsoid[i] = -1; } else { diff --git a/src/atom_vec_ellipsoid.h b/src/atom_vec_ellipsoid.h index 1d344b8b60..0fb3ac2f71 100644 --- a/src/atom_vec_ellipsoid.h +++ b/src/atom_vec_ellipsoid.h @@ -82,28 +82,3 @@ class AtomVecEllipsoid : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -E: Assigning ellipsoid parameters to non-ellipsoid atom - -Self-explanatory. - -E: Invalid shape in Ellipsoids section of data file - -Self-explanatory. - -*/ diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 87d42403e6..0d24486c86 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,12 +18,12 @@ #include "error.h" #include "tokenizer.h" +#include #include using namespace LAMMPS_NS; -#define NFIELDSTRINGS 12 // # of field strings -enum{ELLIPSOID,LINE,TRIANGLE,BODY}; // also in WriteData +enum { ELLIPSOID, LINE, TRIANGLE, BODY }; // also in WriteData /* ---------------------------------------------------------------------- */ @@ -33,22 +32,16 @@ AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp) nstyles = 0; styles = nullptr; keywords = nullptr; - fieldstrings = nullptr; bonus_flag = 0; nstyles_bonus = 0; styles_bonus = nullptr; - // these strings will be concatenated from sub-style strings + // field strings will be concatenated from sub-style strings // fields_data_atom & fields_data_vel start with fields common to all styles - fields_grow = fields_copy = fields_comm = fields_comm_vel = (char *) ""; - fields_reverse = fields_border = fields_border_vel = (char *) ""; - fields_exchange = fields_restart = fields_create = (char *) ""; - fields_data_atom = (char *) "id type x"; - fields_data_vel = (char *) "id v"; - - fields_allocated = 0; + fields_data_atom = {"id", "type", "x"}; + fields_data_vel = {"id", "v"}; } /* ---------------------------------------------------------------------- */ @@ -56,28 +49,10 @@ AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp) AtomVecHybrid::~AtomVecHybrid() { for (int k = 0; k < nstyles; k++) delete styles[k]; - delete [] styles; - for (int k = 0; k < nstyles; k++) delete [] keywords[k]; - delete [] keywords; - delete [] styles_bonus; - - if (!fields_allocated) return; - - delete [] fields_grow; - delete [] fields_copy; - delete [] fields_comm; - delete [] fields_comm_vel; - delete [] fields_reverse; - delete [] fields_border; - delete [] fields_border_vel; - delete [] fields_exchange; - delete [] fields_restart; - delete [] fields_create; - delete [] fields_data_atom; - delete [] fields_data_vel; - - for (int k = 0; k < nstyles; k++) delete [] fieldstrings[k].fstr; - delete [] fieldstrings; + delete[] styles; + for (int k = 0; k < nstyles; k++) delete[] keywords[k]; + delete[] keywords; + delete[] styles_bonus; } /* ---------------------------------------------------------------------- @@ -92,28 +67,27 @@ void AtomVecHybrid::process_args(int narg, char **arg) // allocate list of sub-styles as big as possibly needed if no extra args - styles = new AtomVec*[narg]; - keywords = new char*[narg]; + styles = new AtomVec *[narg]; + keywords = new char *[narg]; // allocate each sub-style // call process_args() with set of args that are not atom style names // use known_style() to determine which args these are - int i,k,jarg,dummy; - + int dummy; int iarg = 0; nstyles = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"hybrid") == 0) - error->all(FLERR,"Atom style hybrid cannot have hybrid as an argument"); - for (i = 0; i < nstyles; i++) - if (strcmp(arg[iarg],keywords[i]) == 0) - error->all(FLERR,"Atom style hybrid cannot use same atom style twice"); - styles[nstyles] = atom->new_avec(arg[iarg],1,dummy); + if (strcmp(arg[iarg], "hybrid") == 0) + error->all(FLERR, "Atom style hybrid cannot have hybrid as an argument"); + for (int i = 0; i < nstyles; i++) + if (strcmp(arg[iarg], keywords[i]) == 0) + error->all(FLERR, "Atom style hybrid cannot use same atom style twice"); + styles[nstyles] = atom->new_avec(arg[iarg], 1, dummy); keywords[nstyles] = utils::strdup(arg[iarg]); - jarg = iarg + 1; + int jarg = iarg + 1; while (jarg < narg && !known_style(arg[jarg])) jarg++; - styles[nstyles]->process_args(jarg-iarg-1,&arg[iarg+1]); + styles[nstyles]->process_args(jarg - iarg - 1, &arg[iarg + 1]); iarg = jarg; nstyles++; } @@ -124,20 +98,19 @@ void AtomVecHybrid::process_args(int narg, char **arg) molecular = Atom::ATOMIC; maxexchange = 0; - for (k = 0; k < nstyles; k++) { + for (int k = 0; k < nstyles; k++) { if ((styles[k]->molecular == Atom::MOLECULAR && molecular == Atom::TEMPLATE) || (styles[k]->molecular == Atom::TEMPLATE && molecular == Atom::MOLECULAR)) - error->all(FLERR, - "Cannot mix molecular and molecule template atom styles"); - molecular = MAX(molecular,styles[k]->molecular); + error->all(FLERR, "Cannot mix molecular and molecule template atom styles"); + molecular = MAX(molecular, styles[k]->molecular); - bonds_allow = MAX(bonds_allow,styles[k]->bonds_allow); - angles_allow = MAX(angles_allow,styles[k]->angles_allow); - dihedrals_allow = MAX(dihedrals_allow,styles[k]->dihedrals_allow); - impropers_allow = MAX(impropers_allow,styles[k]->impropers_allow); - mass_type = MAX(mass_type,styles[k]->mass_type); - dipole_type = MAX(dipole_type,styles[k]->dipole_type); - forceclearflag = MAX(forceclearflag,styles[k]->forceclearflag); + bonds_allow = MAX(bonds_allow, styles[k]->bonds_allow); + angles_allow = MAX(angles_allow, styles[k]->angles_allow); + dihedrals_allow = MAX(dihedrals_allow, styles[k]->dihedrals_allow); + impropers_allow = MAX(impropers_allow, styles[k]->impropers_allow); + mass_type = MAX(mass_type, styles[k]->mass_type); + dipole_type = MAX(dipole_type, styles[k]->dipole_type); + forceclearflag = MAX(forceclearflag, styles[k]->forceclearflag); maxexchange += styles[k]->maxexchange; if (styles[k]->molecular == Atom::TEMPLATE) onemols = styles[k]->onemols; @@ -148,95 +121,71 @@ void AtomVecHybrid::process_args(int narg, char **arg) int mass_pertype = 0; int mass_peratom = 0; - for (k = 0; k < nstyles; k++) { + for (int k = 0; k < nstyles; k++) { if (styles[k]->mass_type == 0) mass_peratom = 1; if (styles[k]->mass_type == 1) mass_pertype = 1; } if (mass_pertype && mass_peratom && comm->me == 0) - error->warning(FLERR, "Atom style hybrid defines both, per-type " + error->warning(FLERR, + "Atom style hybrid defines both, per-type " "and per-atom masses; both must be set, but only " "per-atom masses will be used"); // free allstyles created by build_styles() - for (i = 0; i < nallstyles; i++) delete [] allstyles[i]; - delete [] allstyles; - - // set field strings from all substyles - - fieldstrings = new FieldStrings[nstyles]; - - for (k = 0; k < nstyles; k++) { - fieldstrings[k].fstr = new char*[NFIELDSTRINGS]; - fieldstrings[k].fstr[0] = styles[k]->fields_grow; - fieldstrings[k].fstr[1] = styles[k]->fields_copy; - fieldstrings[k].fstr[2] = styles[k]->fields_comm; - fieldstrings[k].fstr[3] = styles[k]->fields_comm_vel; - fieldstrings[k].fstr[4] = styles[k]->fields_reverse; - fieldstrings[k].fstr[5] = styles[k]->fields_border; - fieldstrings[k].fstr[6] = styles[k]->fields_border_vel; - fieldstrings[k].fstr[7] = styles[k]->fields_exchange; - fieldstrings[k].fstr[8] = styles[k]->fields_restart; - fieldstrings[k].fstr[9] = styles[k]->fields_create; - fieldstrings[k].fstr[10] = styles[k]->fields_data_atom; - fieldstrings[k].fstr[11] = styles[k]->fields_data_vel; - } + for (int i = 0; i < nallstyles; i++) delete[] allstyles[i]; + delete[] allstyles; // merge field strings from all sub-styles // save concat_grow to check for duplicates of special-case fields - char *concat_grow;; - char *dummyptr = nullptr; + std::vector concat_grow; + std::vector concat_dummy; - fields_grow = merge_fields(0,fields_grow,1,concat_grow); - fields_copy = merge_fields(1,fields_copy,0,dummyptr); - fields_comm = merge_fields(2,fields_comm,0,dummyptr); - fields_comm_vel = merge_fields(3,fields_comm_vel,0,dummyptr); - fields_reverse = merge_fields(4,fields_reverse,0,dummyptr); - fields_border = merge_fields(5,fields_border,0,dummyptr); - fields_border_vel = merge_fields(6,fields_border_vel,0,dummyptr); - fields_exchange = merge_fields(7,fields_exchange,0,dummyptr); - fields_restart = merge_fields(8,fields_restart,0,dummyptr); - fields_create = merge_fields(9,fields_create,0,dummyptr); - fields_data_atom = merge_fields(10,fields_data_atom,0,dummyptr); - fields_data_vel = merge_fields(11,fields_data_vel,0,dummyptr); - - fields_allocated = 1; + for (int k = 0; k < nstyles; k++) { + merge_fields(fields_grow, styles[k]->fields_grow, 1, concat_grow); + merge_fields(fields_copy, styles[k]->fields_copy, 0, concat_dummy); + merge_fields(fields_comm, styles[k]->fields_comm, 0, concat_dummy); + merge_fields(fields_comm_vel, styles[k]->fields_comm_vel, 0, concat_dummy); + merge_fields(fields_reverse, styles[k]->fields_reverse, 0, concat_dummy); + merge_fields(fields_border, styles[k]->fields_border, 0, concat_dummy); + merge_fields(fields_border_vel, styles[k]->fields_border_vel, 0, concat_dummy); + merge_fields(fields_exchange, styles[k]->fields_exchange, 0, concat_dummy); + merge_fields(fields_restart, styles[k]->fields_restart, 0, concat_dummy); + merge_fields(fields_create, styles[k]->fields_create, 0, concat_dummy); + merge_fields(fields_data_atom, styles[k]->fields_data_atom, 0, concat_dummy); + merge_fields(fields_data_vel, styles[k]->fields_data_vel, 0, concat_dummy); + } // check concat_grow for multiple special-case fields // may cause issues with style-specific create_atom() and data_atom() methods // issue warnings if appear in multiple sub-styles - const char *dupfield[] = {"radius","rmass"}; - int ndupfield = 2; - char *ptr; + std::vector dupfield = {"radius", "rmass"}; - for (int idup = 0; idup < ndupfield; idup++) { - char *dup = (char *) dupfield[idup]; - ptr = strstr(concat_grow,dup); - if ((ptr && strstr(ptr+1,dup)) && (comm->me == 0)) - error->warning(FLERR,fmt::format("Per-atom {} is used in multiple sub-" - "styles; must be used consistently",dup)); + for (const auto &idup : dupfield) { + if ((comm->me == 0) && (std::count(concat_grow.begin(), concat_grow.end(), idup) > 1)) + error->warning(FLERR, + "Per-atom field {} is used in multiple sub-styles; must be used consistently", + idup); } - delete [] concat_grow; - // set bonus_flag if any substyle has bonus data // set nstyles_bonus & styles_bonus // sum two sizes over contributions from each substyle with bonus data. nstyles_bonus = 0; - for (k = 0; k < nstyles; k++) + for (int k = 0; k < nstyles; k++) if (styles[k]->bonus_flag) nstyles_bonus++; if (nstyles_bonus) { bonus_flag = 1; - styles_bonus = new AtomVec*[nstyles_bonus]; + styles_bonus = new AtomVec *[nstyles_bonus]; nstyles_bonus = 0; size_forward_bonus = 0; size_border_bonus = 0; - for (k = 0; k < nstyles; k++) { + for (int k = 0; k < nstyles; k++) { if (styles[k]->bonus_flag) { styles_bonus[nstyles_bonus++] = styles[k]; size_forward_bonus += styles[k]->size_forward_bonus; @@ -270,23 +219,21 @@ void AtomVecHybrid::grow_pointers() void AtomVecHybrid::force_clear(int n, size_t nbytes) { for (int k = 0; k < nstyles; k++) - if (styles[k]->forceclearflag) styles[k]->force_clear(n,nbytes); + if (styles[k]->forceclearflag) styles[k]->force_clear(n, nbytes); } /* ---------------------------------------------------------------------- */ void AtomVecHybrid::copy_bonus(int i, int j, int delflag) { - for (int k = 0; k < nstyles_bonus; k++) - styles_bonus[k]->copy_bonus(i,j,delflag); + for (int k = 0; k < nstyles_bonus; k++) styles_bonus[k]->copy_bonus(i, j, delflag); } /* ---------------------------------------------------------------------- */ void AtomVecHybrid::clear_bonus() { - for (int k = 0; k < nstyles_bonus; k++) - styles_bonus[k]->clear_bonus(); + for (int k = 0; k < nstyles_bonus; k++) styles_bonus[k]->clear_bonus(); } /* ---------------------------------------------------------------------- */ @@ -294,8 +241,7 @@ void AtomVecHybrid::clear_bonus() int AtomVecHybrid::pack_comm_bonus(int n, int *list, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->pack_comm_bonus(n,list,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->pack_comm_bonus(n, list, buf); return m; } @@ -303,8 +249,7 @@ int AtomVecHybrid::pack_comm_bonus(int n, int *list, double *buf) void AtomVecHybrid::unpack_comm_bonus(int n, int first, double *buf) { - for (int k = 0; k < nstyles_bonus; k++) - styles_bonus[k]->unpack_comm_bonus(n,first,buf); + for (int k = 0; k < nstyles_bonus; k++) styles_bonus[k]->unpack_comm_bonus(n, first, buf); } /* ---------------------------------------------------------------------- */ @@ -312,8 +257,7 @@ void AtomVecHybrid::unpack_comm_bonus(int n, int first, double *buf) int AtomVecHybrid::pack_border_bonus(int n, int *list, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->pack_border_bonus(n,list,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->pack_border_bonus(n, list, buf); return m; } @@ -322,8 +266,7 @@ int AtomVecHybrid::pack_border_bonus(int n, int *list, double *buf) int AtomVecHybrid::unpack_border_bonus(int n, int first, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->unpack_border_bonus(n,first,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->unpack_border_bonus(n, first, buf); return m; } @@ -332,8 +275,7 @@ int AtomVecHybrid::unpack_border_bonus(int n, int first, double *buf) int AtomVecHybrid::pack_exchange_bonus(int i, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->pack_exchange_bonus(i,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->pack_exchange_bonus(i, buf); return m; } @@ -342,8 +284,7 @@ int AtomVecHybrid::pack_exchange_bonus(int i, double *buf) int AtomVecHybrid::unpack_exchange_bonus(int ilocal, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->unpack_exchange_bonus(ilocal,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->unpack_exchange_bonus(ilocal, buf); return m; } @@ -352,8 +293,7 @@ int AtomVecHybrid::unpack_exchange_bonus(int ilocal, double *buf) int AtomVecHybrid::size_restart_bonus() { int n = 0; - for (int k = 0; k < nstyles_bonus; k++) - n += styles_bonus[k]->size_restart_bonus(); + for (int k = 0; k < nstyles_bonus; k++) n += styles_bonus[k]->size_restart_bonus(); return n; } @@ -362,8 +302,7 @@ int AtomVecHybrid::size_restart_bonus() int AtomVecHybrid::pack_restart_bonus(int i, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->pack_restart_bonus(i,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->pack_restart_bonus(i, buf); return m; } @@ -372,8 +311,7 @@ int AtomVecHybrid::pack_restart_bonus(int i, double *buf) int AtomVecHybrid::unpack_restart_bonus(int ilocal, double *buf) { int m = 0; - for (int k = 0; k < nstyles_bonus; k++) - m += styles_bonus[k]->unpack_restart_bonus(ilocal,buf); + for (int k = 0; k < nstyles_bonus; k++) m += styles_bonus[k]->unpack_restart_bonus(ilocal, buf); return m; } @@ -382,8 +320,7 @@ int AtomVecHybrid::unpack_restart_bonus(int ilocal, double *buf) double AtomVecHybrid::memory_usage_bonus() { double bytes = 0; - for (int k = 0; k < nstyles_bonus; k++) - bytes += styles_bonus[k]->memory_usage_bonus(); + for (int k = 0; k < nstyles_bonus; k++) bytes += styles_bonus[k]->memory_usage_bonus(); return bytes; } @@ -393,8 +330,7 @@ double AtomVecHybrid::memory_usage_bonus() void AtomVecHybrid::pack_restart_pre(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->pack_restart_pre(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->pack_restart_pre(ilocal); } /* ---------------------------------------------------------------------- @@ -403,8 +339,7 @@ void AtomVecHybrid::pack_restart_pre(int ilocal) void AtomVecHybrid::pack_restart_post(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->pack_restart_post(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->pack_restart_post(ilocal); } /* ---------------------------------------------------------------------- @@ -413,8 +348,7 @@ void AtomVecHybrid::pack_restart_post(int ilocal) void AtomVecHybrid::unpack_restart_init(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->unpack_restart_init(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->unpack_restart_init(ilocal); } /* ---------------------------------------------------------------------- @@ -423,8 +357,7 @@ void AtomVecHybrid::unpack_restart_init(int ilocal) void AtomVecHybrid::create_atom_post(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->create_atom_post(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->create_atom_post(ilocal); } /* ---------------------------------------------------------------------- @@ -434,16 +367,15 @@ void AtomVecHybrid::create_atom_post(int ilocal) void AtomVecHybrid::data_atom_post(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->data_atom_post(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->data_atom_post(ilocal); } /* ---------------------------------------------------------------------- modify what AtomVec::data_bonds() just unpacked or initialize other bond quantities ------------------------------------------------------------------------- */ -void AtomVecHybrid::data_bonds_post(int m, int num_bond, tagint atom1, - tagint atom2, tagint id_offset) +void AtomVecHybrid::data_bonds_post(int m, int num_bond, tagint atom1, tagint atom2, + tagint id_offset) { for (int k = 0; k < nstyles; k++) styles[k]->data_bonds_post(m, num_bond, atom1, atom2, id_offset); @@ -455,8 +387,7 @@ void AtomVecHybrid::data_bonds_post(int m, int num_bond, tagint atom1, void AtomVecHybrid::pack_data_pre(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->pack_data_pre(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->pack_data_pre(ilocal); } /* ---------------------------------------------------------------------- @@ -465,8 +396,7 @@ void AtomVecHybrid::pack_data_pre(int ilocal) void AtomVecHybrid::pack_data_post(int ilocal) { - for (int k = 0; k < nstyles; k++) - styles[k]->pack_data_post(ilocal); + for (int k = 0; k < nstyles; k++) styles[k]->pack_data_post(ilocal); } /* ---------------------------------------------------------------------- @@ -476,12 +406,12 @@ void AtomVecHybrid::pack_data_post(int ilocal) int AtomVecHybrid::pack_data_bonus(double *buf, int flag) { for (int k = 0; k < nstyles; k++) { - if (flag == ELLIPSOID && strcmp(keywords[k],"ellipsoid") != 0) continue; - if (flag == LINE && strcmp(keywords[k],"line") != 0) continue; - if (flag == TRIANGLE && strcmp(keywords[k],"tri") != 0) continue; - if (flag == BODY && strcmp(keywords[k],"body") != 0) continue; + if (flag == ELLIPSOID && strcmp(keywords[k], "ellipsoid") != 0) continue; + if (flag == LINE && strcmp(keywords[k], "line") != 0) continue; + if (flag == TRIANGLE && strcmp(keywords[k], "tri") != 0) continue; + if (flag == BODY && strcmp(keywords[k], "body") != 0) continue; - return styles[k]->pack_data_bonus(buf,flag); + return styles[k]->pack_data_bonus(buf, flag); } return 0; } @@ -493,12 +423,12 @@ int AtomVecHybrid::pack_data_bonus(double *buf, int flag) void AtomVecHybrid::write_data_bonus(FILE *fp, int n, double *buf, int flag) { for (int k = 0; k < nstyles; k++) { - if (flag == ELLIPSOID && strcmp(keywords[k],"ellipsoid") != 0) continue; - if (flag == LINE && strcmp(keywords[k],"line") != 0) continue; - if (flag == TRIANGLE && strcmp(keywords[k],"tri") != 0) continue; - if (flag == BODY && strcmp(keywords[k],"body") != 0) continue; + if (flag == ELLIPSOID && strcmp(keywords[k], "ellipsoid") != 0) continue; + if (flag == LINE && strcmp(keywords[k], "line") != 0) continue; + if (flag == TRIANGLE && strcmp(keywords[k], "tri") != 0) continue; + if (flag == BODY && strcmp(keywords[k], "body") != 0) continue; - styles[k]->write_data_bonus(fp,n,buf,flag); + styles[k]->write_data_bonus(fp, n, buf, flag); } } @@ -508,11 +438,11 @@ void AtomVecHybrid::write_data_bonus(FILE *fp, int n, double *buf, int flag) return -1 if name is unknown to any sub-styles ------------------------------------------------------------------------- */ -int AtomVecHybrid::property_atom(char *name) +int AtomVecHybrid::property_atom(const std::string &name) { for (int k = 0; k < nstyles; k++) { int index = styles[k]->property_atom(name); - if (index >= 0) return index*nstyles + k; + if (index >= 0) return index * nstyles + k; } return -1; } @@ -522,12 +452,11 @@ int AtomVecHybrid::property_atom(char *name) index maps to data specific to this atom style ------------------------------------------------------------------------- */ -void AtomVecHybrid::pack_property_atom(int multiindex, double *buf, - int nvalues, int groupbit) +void AtomVecHybrid::pack_property_atom(int multiindex, double *buf, int nvalues, int groupbit) { int k = multiindex % nstyles; - int index = multiindex/nstyles; - styles[k]->pack_property_atom(index,buf,nvalues,groupbit); + int index = multiindex / nstyles; + styles[k]->pack_property_atom(index, buf, nvalues, groupbit); } // ---------------------------------------------------------------------- @@ -535,48 +464,21 @@ void AtomVecHybrid::pack_property_atom(int multiindex, double *buf, // ---------------------------------------------------------------------- /* ---------------------------------------------------------------------- - merge fields and remove duplicate fields - concat = root + Inum fields string from all substyles - return dedup = concat with duplicate fields removed + merge fields into root vector and remove duplicate fields if concat_flag set, also return concat (w/ duplicates) - so caller can check for problematic fields, call will free it + so caller can check for problematic fields ------------------------------------------------------------------------- */ -char *AtomVecHybrid::merge_fields(int inum, char *root, - int concat_flag, char *&concat_str) +void AtomVecHybrid::merge_fields(std::vector &root, + const std::vector &fields, int concat_flag, + std::vector &concat) { - // create vector with all words combined + // grow vector with all words combined with dedup and - std::string concat; - if (root) concat += root; - for (int k = 0; k < nstyles; k++) { - if (concat.size() > 0) concat += " "; - concat += fieldstrings[k].fstr[inum]; + for (const auto &field : fields) { + if (concat_flag) concat.push_back(field); + if (std::find(root.begin(), root.end(), field) == root.end()) root.push_back(field); } - if (concat_flag) concat_str = utils::strdup(concat); - - // remove duplicate words without changing the order - - auto words = Tokenizer(concat, " ").as_vector(); - std::vector dedup; - for (auto &w : words) { - bool found = false; - for (auto &d : dedup) { - if (w == d) found = true; - } - if (!found) dedup.push_back(w); - } - - // create final concatenated, deduped string - concat.clear(); - for (auto &d : dedup) { - concat += d; - concat += " "; - } - - // remove trailing blank - if (concat.size() > 0) concat.pop_back(); - return utils::strdup(concat); } /* ---------------------------------------------------------------------- @@ -587,19 +489,19 @@ void AtomVecHybrid::build_styles() { nallstyles = 0; #define ATOM_CLASS -#define AtomStyle(key,Class) nallstyles++; -#include "style_atom.h" // IWYU pragma: keep +#define AtomStyle(key, Class) nallstyles++; +#include "style_atom.h" // IWYU pragma: keep #undef AtomStyle #undef ATOM_CLASS - allstyles = new char*[nallstyles]; + allstyles = new char *[nallstyles]; nallstyles = 0; #define ATOM_CLASS -#define AtomStyle(key,Class) \ +#define AtomStyle(key, Class) \ allstyles[nallstyles] = utils::strdup(#key); \ nallstyles++; -#include "style_atom.h" // IWYU pragma: keep +#include "style_atom.h" // IWYU pragma: keep #undef AtomStyle #undef ATOM_CLASS } @@ -611,6 +513,6 @@ void AtomVecHybrid::build_styles() int AtomVecHybrid::known_style(char *str) { for (int i = 0; i < nallstyles; i++) - if (strcmp(str,allstyles[i]) == 0) return 1; + if (strcmp(str, allstyles[i]) == 0) return 1; return 0; } diff --git a/src/atom_vec_hybrid.h b/src/atom_vec_hybrid.h index 8d1a791044..5438d1626e 100644 --- a/src/atom_vec_hybrid.h +++ b/src/atom_vec_hybrid.h @@ -64,23 +64,18 @@ class AtomVecHybrid : public AtomVec { int pack_data_bonus(double *, int) override; void write_data_bonus(FILE *, int, double *, int) override; - int property_atom(char *) override; + int property_atom(const std::string &) override; void pack_property_atom(int, double *, int, int) override; private: int nallstyles; char **allstyles; - int fields_allocated; - - struct FieldStrings { - char **fstr; - }; - FieldStrings *fieldstrings; int nstyles_bonus; class AtomVec **styles_bonus; - char *merge_fields(int, char *, int, char *&); + void merge_fields(std::vector &, const std::vector &, int, + std::vector &); void build_styles(); int known_style(char *); }; @@ -89,28 +84,3 @@ class AtomVecHybrid : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Atom style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Atom style hybrid cannot use same atom style twice - -Self-explanatory. - -E: Cannot mix molecular and molecule template atom styles - -Self-explanatory. - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -*/ diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index e15bc61f2f..2f05684c69 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -23,12 +22,11 @@ #include "modify.h" #include -#include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PI; -#define EPSILON 0.001 +static constexpr double EPSILON = 0.001; /* ---------------------------------------------------------------------- */ @@ -55,18 +53,17 @@ AtomVecLine::AtomVecLine(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "molecule radius rmass omega torque line"; - fields_copy = (char *) "molecule radius rmass omega"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) "omega"; - fields_reverse = (char *) "torque"; - fields_border = (char *) "molecule radius rmass"; - fields_border_vel = (char *) "molecule radius rmass omega"; - fields_exchange = (char *) "molecule radius rmass omega"; - fields_restart = (char *) "molecule radius rmass omega"; - fields_create = (char *) "molecule radius rmass omega line"; - fields_data_atom = (char *) "id molecule type line rmass x"; - fields_data_vel = (char *) "id v omega"; + fields_grow = {"molecule", "radius", "rmass", "omega", "torque", "line"}; + fields_copy = {"molecule", "radius", "rmass", "omega"}; + fields_comm_vel = {"omega"}; + fields_reverse = {"torque"}; + fields_border = {"molecule", "radius", "rmass"}; + fields_border_vel = {"molecule", "radius", "rmass", "omega"}; + fields_exchange = {"molecule", "radius", "rmass", "omega"}; + fields_restart = {"molecule", "radius", "rmass", "omega"}; + fields_create = {"molecule", "radius", "rmass", "omega", "line"}; + fields_data_atom = {"id", "molecule", "type", "line", "rmass", "x"}; + fields_data_vel = {"id", "v", "omega"}; setup_fields(); } @@ -85,7 +82,7 @@ void AtomVecLine::init() AtomVec::init(); if (domain->dimension != 2) - error->all(FLERR,"Atom_style line can only be used in 2d simulations"); + error->all(FLERR, "Atom_style line can only be used in 2d simulations"); } /* ---------------------------------------------------------------------- @@ -108,11 +105,9 @@ void AtomVecLine::grow_pointers() void AtomVecLine::grow_bonus() { nmax_bonus = grow_nmax_bonus(nmax_bonus); - if (nmax_bonus < 0) - error->one(FLERR,"Per-processor system is too big"); + if (nmax_bonus < 0) error->one(FLERR, "Per-processor system is too big"); - bonus = (Bonus *) memory->srealloc(bonus,nmax_bonus*sizeof(Bonus), - "atom:bonus"); + bonus = (Bonus *) memory->srealloc(bonus, nmax_bonus * sizeof(Bonus), "atom:bonus"); } /* ---------------------------------------------------------------------- @@ -124,7 +119,7 @@ void AtomVecLine::copy_bonus(int i, int j, int delflag) // if deleting atom J via delflag and J has bonus data, then delete it if (delflag && line[j] >= 0) { - copy_bonus_all(nlocal_bonus-1,line[j]); + copy_bonus_all(nlocal_bonus - 1, line[j]); nlocal_bonus--; } @@ -143,7 +138,7 @@ void AtomVecLine::copy_bonus(int i, int j, int delflag) void AtomVecLine::copy_bonus_all(int i, int j) { line[bonus[i].ilocal] = j; - memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); + memcpy(&bonus[j], &bonus[i], sizeof(Bonus)); } /* ---------------------------------------------------------------------- @@ -164,7 +159,7 @@ void AtomVecLine::clear_bonus() int AtomVecLine::pack_comm_bonus(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; m = 0; for (i = 0; i < n; i++) { @@ -179,7 +174,7 @@ int AtomVecLine::pack_comm_bonus(int n, int *list, double *buf) void AtomVecLine::unpack_comm_bonus(int n, int first, double *buf) { - int i,m,last; + int i, m, last; m = 0; last = first + n; @@ -192,12 +187,13 @@ void AtomVecLine::unpack_comm_bonus(int n, int first, double *buf) int AtomVecLine::pack_border_bonus(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (line[j] < 0) buf[m++] = ubuf(0).d; + if (line[j] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; buf[m++] = bonus[line[j]].length; @@ -212,13 +208,14 @@ int AtomVecLine::pack_border_bonus(int n, int *list, double *buf) int AtomVecLine::unpack_border_bonus(int n, int first, double *buf) { - int i,j,m,last; + int i, j, m, last; m = 0; last = first + n; for (i = first; i < last; i++) { line[i] = (int) ubuf(buf[m++]).i; - if (line[i] == 0) line[i] = -1; + if (line[i] == 0) + line[i] = -1; else { j = nlocal_bonus + nghost_bonus; if (j == nmax_bonus) grow_bonus(); @@ -242,7 +239,8 @@ int AtomVecLine::pack_exchange_bonus(int i, double *buf) { int m = 0; - if (line[i] < 0) buf[m++] = ubuf(0).d; + if (line[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = line[i]; @@ -260,7 +258,8 @@ int AtomVecLine::unpack_exchange_bonus(int ilocal, double *buf) int m = 0; line[ilocal] = (int) ubuf(buf[m++]).i; - if (line[ilocal] == 0) line[ilocal] = -1; + if (line[ilocal] == 0) + line[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); bonus[nlocal_bonus].length = buf[m++]; @@ -284,8 +283,10 @@ int AtomVecLine::size_restart_bonus() int n = 0; int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - if (line[i] >= 0) n += size_restart_bonus_one; - else n++; + if (line[i] >= 0) + n += size_restart_bonus_one; + else + n++; } return n; @@ -301,7 +302,8 @@ int AtomVecLine::pack_restart_bonus(int i, double *buf) { int m = 0; - if (line[i] < 0) buf[m++] = ubuf(0).d; + if (line[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = line[i]; @@ -321,7 +323,8 @@ int AtomVecLine::unpack_restart_bonus(int ilocal, double *buf) int m = 0; line[ilocal] = (int) ubuf(buf[m++]).i; - if (line[ilocal] == 0) line[ilocal] = -1; + if (line[ilocal] == 0) + line[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); bonus[nlocal_bonus].length = buf[m++]; @@ -339,31 +342,32 @@ int AtomVecLine::unpack_restart_bonus(int ilocal, double *buf) void AtomVecLine::data_atom_bonus(int m, const std::vector &values) { - if (line[m]) error->one(FLERR,"Assigning line parameters to non-line atom"); + if (line[m]) error->one(FLERR, "Assigning line parameters to non-line atom"); if (nlocal_bonus == nmax_bonus) grow_bonus(); int ivalue = 1; - double x1 = utils::numeric(FLERR,values[ivalue++],true,lmp); - double y1 = utils::numeric(FLERR,values[ivalue++],true,lmp); - double x2 = utils::numeric(FLERR,values[ivalue++],true,lmp); - double y2 = utils::numeric(FLERR,values[ivalue++],true,lmp); + double x1 = utils::numeric(FLERR, values[ivalue++], true, lmp); + double y1 = utils::numeric(FLERR, values[ivalue++], true, lmp); + double x2 = utils::numeric(FLERR, values[ivalue++], true, lmp); + double y2 = utils::numeric(FLERR, values[ivalue++], true, lmp); double dx = x2 - x1; double dy = y2 - y1; - double length = sqrt(dx*dx + dy*dy); + double length = sqrt(dx * dx + dy * dy); bonus[nlocal_bonus].length = length; - if (dy >= 0.0) bonus[nlocal_bonus].theta = acos(dx/length); - else bonus[nlocal_bonus].theta = -acos(dx/length); + if (dy >= 0.0) + bonus[nlocal_bonus].theta = acos(dx / length); + else + bonus[nlocal_bonus].theta = -acos(dx / length); - double xc = 0.5*(x1+x2); - double yc = 0.5*(y1+y2); + double xc = 0.5 * (x1 + x2); + double yc = 0.5 * (y1 + y2); dx = xc - x[m][0]; dy = yc - x[m][1]; - double delta = sqrt(dx*dx + dy*dy); + double delta = sqrt(dx * dx + dy * dy); - if (delta/length > EPSILON) - error->one(FLERR,"Inconsistent line segment in data file"); + if (delta / length > EPSILON) error->one(FLERR, "Inconsistent line segment in data file"); x[m][0] = xc; x[m][1] = yc; @@ -385,7 +389,7 @@ void AtomVecLine::data_atom_bonus(int m, const std::vector &values) double AtomVecLine::memory_usage_bonus() { double bytes = 0; - bytes += (double)nmax_bonus*sizeof(Bonus); + bytes += (double) nmax_bonus * sizeof(Bonus); return bytes; } @@ -398,7 +402,7 @@ void AtomVecLine::create_atom_post(int ilocal) { double radius_one = 0.5; radius[ilocal] = radius_one; - rmass[ilocal] = 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; + rmass[ilocal] = 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; line[ilocal] = -1; } @@ -410,19 +414,22 @@ void AtomVecLine::create_atom_post(int ilocal) void AtomVecLine::data_atom_post(int ilocal) { line_flag = line[ilocal]; - if (line_flag == 0) line_flag = -1; - else if (line_flag == 1) line_flag = 0; - else error->one(FLERR,"Invalid line flag in Atoms section of data file"); + if (line_flag == 0) + line_flag = -1; + else if (line_flag == 1) + line_flag = 0; + else + error->one(FLERR, "Invalid line flag in Atoms section of data file"); line[ilocal] = line_flag; - if (rmass[ilocal] <= 0.0) - error->one(FLERR,"Invalid density in Atoms section of data file"); + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); if (line_flag < 0) { double radius_one = 0.5; radius[ilocal] = radius_one; - rmass[ilocal] *= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; - } else radius[ilocal] = 0.0; + rmass[ilocal] *= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; + } else + radius[ilocal] = 0.0; omega[ilocal][0] = 0.0; omega[ilocal][1] = 0.0; @@ -438,13 +445,16 @@ void AtomVecLine::pack_data_pre(int ilocal) line_flag = line[ilocal]; rmass_one = rmass[ilocal]; - if (line_flag < 0) line[ilocal] = 0; - else line[ilocal] = 1; + if (line_flag < 0) + line[ilocal] = 0; + else + line[ilocal] = 1; if (line_flag < 0) { double radius_one = radius[ilocal]; - rmass[ilocal] /= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; - } else rmass[ilocal] /= bonus[line_flag].length; + rmass[ilocal] /= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; + } else + rmass[ilocal] /= bonus[line_flag].length; } /* ---------------------------------------------------------------------- @@ -464,9 +474,9 @@ void AtomVecLine::pack_data_post(int ilocal) int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) { - int i,j; - double length,theta; - double xc,yc,x1,x2,y1,y2; + int i, j; + double length, theta; + double xc, yc, x1, x2, y1, y2; double **x = atom->x; tagint *tag = atom->tag; @@ -482,15 +492,16 @@ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) theta = bonus[j].theta; xc = x[i][0]; yc = x[i][1]; - x1 = xc - 0.5*cos(theta)*length; - y1 = yc - 0.5*sin(theta)*length; - x2 = xc + 0.5*cos(theta)*length; - y2 = yc + 0.5*sin(theta)*length; + x1 = xc - 0.5 * cos(theta) * length; + y1 = yc - 0.5 * sin(theta) * length; + x2 = xc + 0.5 * cos(theta) * length; + y2 = yc + 0.5 * sin(theta) * length; buf[m++] = x1; buf[m++] = y1; buf[m++] = x2; buf[m++] = y2; - } else m += size_data_bonus; + } else + m += size_data_bonus; } return m; } @@ -503,8 +514,8 @@ void AtomVecLine::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/) { int i = 0; while (i < n) { - fmt::print(fp,"{} {} {} {} {}\n",ubuf(buf[i]).i, - buf[i+1],buf[i+2],buf[i+3],buf[i+4]); + fmt::print(fp, "{} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], buf[i + 3], + buf[i + 4]); i += size_data_bonus; } } @@ -525,10 +536,11 @@ void AtomVecLine::set_length(int i, double value) bonus[nlocal_bonus].ilocal = i; line[i] = nlocal_bonus++; } else if (value == 0.0) { - copy_bonus_all(nlocal_bonus-1,line[i]); + copy_bonus_all(nlocal_bonus - 1, line[i]); nlocal_bonus--; line[i] = -1; - } else bonus[line[i]].length = value; + } else + bonus[line[i]].length = value; // also set radius = half of length // unless value = 0.0, then set diameter = 1.0 @@ -536,40 +548,3 @@ void AtomVecLine::set_length(int i, double value) radius[i] = 0.5 * value; if (value == 0.0) radius[i] = 0.5; } - -/* ---------------------------------------------------------------------- - check consistency of internal Bonus data structure - n = # of atoms in regular structure to check against -------------------------------------------------------------------------- */ - -/* -void AtomVecLine::consistency_check(int n, char *str) -{ - int iflag = 0; - int count = 0; - for (int i = 0; i < n; i++) { - - if (line[i] >= 0) { - count++; - if (line[i] >= nlocal_bonus) iflag++; - if (bonus[line[i]].ilocal != i) iflag++; - //if (comm->me == 1 && update->ntimestep == 873) - // printf("CCHK %s: %d %d: %d %d: %d %d\n", - // str,i,n,line[i],nlocal_bonus,bonus[line[i]].ilocal,iflag); - } - } - - if (iflag) { - printf("BAD vecline ptrs: %s: %d %d: %d\n",str,comm->me, - update->ntimestep,iflag); - MPI_Abort(world,1); - } - - if (count != nlocal_bonus) { - char msg[128]; - printf("BAD vecline count: %s: %d %d: %d %d\n", - str,comm->me,update->ntimestep,count,nlocal_bonus); - MPI_Abort(world,1); - } -} -*/ diff --git a/src/atom_vec_line.h b/src/atom_vec_line.h index 1af2f7ee2d..2d4969b1bf 100644 --- a/src/atom_vec_line.h +++ b/src/atom_vec_line.h @@ -83,33 +83,3 @@ class AtomVecLine : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Atom_style line can only be used in 2d simulations - -Self-explanatory. - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -E: Assigning line parameters to non-line atom - -Self-explanatory. - -E: Inconsistent line segment in data file - -The end points of the line segment are not equal distances from the -center point which is the atom coordinate. - -*/ diff --git a/src/atom_vec_sphere.cpp b/src/atom_vec_sphere.cpp index 5a69944501..2a3c58e77e 100644 --- a/src/atom_vec_sphere.cpp +++ b/src/atom_vec_sphere.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -6,7 +5,7 @@ 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 distributead under + 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. @@ -21,8 +20,6 @@ #include "math_const.h" #include "modify.h" -#include - using namespace LAMMPS_NS; using namespace MathConst; @@ -34,26 +31,24 @@ AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp) molecular = Atom::ATOMIC; atom->sphere_flag = 1; - atom->radius_flag = atom->rmass_flag = atom->omega_flag = - atom->torque_flag = 1; + atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "radius rmass omega torque"; - fields_copy = (char *) "radius rmass omega"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) "omega"; - fields_reverse = (char *) "torque"; - fields_border = (char *) "radius rmass"; - fields_border_vel = (char *) "radius rmass omega"; - fields_exchange = (char *) "radius rmass omega"; - fields_restart = (char *) "radius rmass omega"; - fields_create = (char *) "radius rmass omega"; - fields_data_atom = (char *) "id type radius rmass x"; - fields_data_vel = (char *) "id v omega"; + fields_grow = {"radius", "rmass", "omega", "torque"}; + fields_copy = {"radius", "rmass", "omega"}; + fields_comm_vel = {"omega"}; + fields_reverse = {"torque"}; + fields_border = {"radius", "rmass"}; + fields_border_vel = {"radius", "rmass", "omega"}; + fields_exchange = {"radius", "rmass", "omega"}; + fields_restart = {"radius", "rmass", "omega"}; + fields_create = {"radius", "rmass", "omega"}; + fields_data_atom = {"id", "type", "radius", "rmass", "x"}; + fields_data_vel = {"id", "v", "omega"}; } /* ---------------------------------------------------------------------- @@ -63,21 +58,19 @@ AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp) void AtomVecSphere::process_args(int narg, char **arg) { - if (narg != 0 && narg != 1) - error->all(FLERR,"Illegal atom_style sphere command"); + if (narg != 0 && narg != 1) error->all(FLERR, "Illegal atom_style sphere command"); radvary = 0; if (narg == 1) { - radvary = utils::numeric(FLERR,arg[0],true,lmp); - if (radvary < 0 || radvary > 1) - error->all(FLERR,"Illegal atom_style sphere command"); + radvary = utils::numeric(FLERR, arg[0], true, lmp); + if (radvary < 0 || radvary > 1) error->all(FLERR, "Illegal atom_style sphere command"); } // dynamic particle radius and mass must be communicated every step if (radvary) { - fields_comm = (char *) "radius rmass"; - fields_comm_vel = (char *) "radius rmass omega"; + fields_comm = {"radius", "rmass"}; + fields_comm_vel = {"radius", "rmass", "omega"}; } // delay setting up of fields until now @@ -94,11 +87,10 @@ void AtomVecSphere::init() // check if optional radvary setting should have been set to 1 for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"adapt") == 0) { - FixAdapt *fix = (FixAdapt *) modify->fix[i]; + if (strcmp(modify->fix[i]->style, "adapt") == 0) { + auto fix = dynamic_cast(modify->fix[i]); if (fix->diamflag && radvary == 0) - error->all(FLERR,"Fix adapt changes particle radii " - "but atom_style sphere is not dynamic"); + error->all(FLERR, "Fix adapt changes particle radii but atom_style sphere is not dynamic"); } } @@ -121,7 +113,7 @@ void AtomVecSphere::grow_pointers() void AtomVecSphere::create_atom_post(int ilocal) { radius[ilocal] = 0.5; - rmass[ilocal] = 4.0*MY_PI/3.0 * 0.5*0.5*0.5; + rmass[ilocal] = 4.0 * MY_PI / 3.0 * 0.5 * 0.5 * 0.5; } /* ---------------------------------------------------------------------- @@ -133,11 +125,9 @@ void AtomVecSphere::data_atom_post(int ilocal) { radius_one = 0.5 * atom->radius[ilocal]; radius[ilocal] = radius_one; - if (radius_one > 0.0) - rmass[ilocal] *= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; + if (radius_one > 0.0) rmass[ilocal] *= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; - if (rmass[ilocal] <= 0.0) - error->one(FLERR,"Invalid density in Atoms section of data file"); + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); omega[ilocal][0] = 0.0; omega[ilocal][1] = 0.0; @@ -154,9 +144,8 @@ void AtomVecSphere::pack_data_pre(int ilocal) rmass_one = rmass[ilocal]; radius[ilocal] *= 2.0; - if (radius_one!= 0.0) - rmass[ilocal] = - rmass_one / (4.0*MY_PI/3.0 * radius_one*radius_one*radius_one); + if (radius_one != 0.0) + rmass[ilocal] = rmass_one / (4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one); } /* ---------------------------------------------------------------------- diff --git a/src/atom_vec_sphere.h b/src/atom_vec_sphere.h index 2c3fdd84bc..619c1f6851 100644 --- a/src/atom_vec_sphere.h +++ b/src/atom_vec_sphere.h @@ -48,15 +48,3 @@ class AtomVecSphere : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid radius in Atoms section of data file - -Radius must be >= 0.0. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -*/ diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 4b1ee0d921..4dbd0dd677 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -19,18 +18,17 @@ #include "error.h" #include "fix.h" #include "math_const.h" -#include "math_extra.h" #include "math_eigen.h" +#include "math_extra.h" #include "memory.h" #include "modify.h" #include -#include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PI; -#define EPSILON 0.001 +static constexpr double EPSILON = 0.001; /* ---------------------------------------------------------------------- */ @@ -58,18 +56,17 @@ AtomVecTri::AtomVecTri(LAMMPS *lmp) : AtomVec(lmp) // order of fields in a string does not matter // except: fields_data_atom & fields_data_vel must match data file - fields_grow = (char *) "molecule radius rmass omega angmom torque tri"; - fields_copy = (char *) "molecule radius rmass omega angmom"; - fields_comm = (char *) ""; - fields_comm_vel = (char *) "omega angmom"; - fields_reverse = (char *) "torque"; - fields_border = (char *) "molecule radius rmass"; - fields_border_vel = (char *) "molecule radius rmass omega"; - fields_exchange = (char *) "molecule radius rmass omega angmom"; - fields_restart = (char *) "molecule radius rmass omega angmom"; - fields_create = (char *) "molecule radius rmass omega angmom tri"; - fields_data_atom = (char *) "id molecule type tri rmass x"; - fields_data_vel = (char *) "id v omega angmom"; + fields_grow = {"molecule", "radius", "rmass", "omega", "angmom", "torque", "tri"}; + fields_copy = {"molecule", "radius", "rmass", "omega", "angmom"}; + fields_comm_vel = {"omega", "angmom"}; + fields_reverse = {"torque"}; + fields_border = {"molecule", "radius", "rmass"}; + fields_border_vel = {"molecule", "radius", "rmass", "omega"}; + fields_exchange = {"molecule", "radius", "rmass", "omega", "angmom"}; + fields_restart = {"molecule", "radius", "rmass", "omega", "angmom"}; + fields_create = {"molecule", "radius", "rmass", "omega", "angmom", "tri"}; + fields_data_atom = {"id", "molecule", "type", "tri", "rmass", "x"}; + fields_data_vel = {"id", "v", "omega", "angmom"}; setup_fields(); } @@ -88,7 +85,7 @@ void AtomVecTri::init() AtomVec::init(); if (domain->dimension != 3) - error->all(FLERR,"Atom_style tri can only be used in 3d simulations"); + error->all(FLERR, "Atom_style tri can only be used in 3d simulations"); } /* ---------------------------------------------------------------------- @@ -112,11 +109,9 @@ void AtomVecTri::grow_pointers() void AtomVecTri::grow_bonus() { nmax_bonus = grow_nmax_bonus(nmax_bonus); - if (nmax_bonus < 0) - error->one(FLERR,"Per-processor system is too big"); + if (nmax_bonus < 0) error->one(FLERR, "Per-processor system is too big"); - bonus = (Bonus *) memory->srealloc(bonus,nmax_bonus*sizeof(Bonus), - "atom:bonus"); + bonus = (Bonus *) memory->srealloc(bonus, nmax_bonus * sizeof(Bonus), "atom:bonus"); } /* ---------------------------------------------------------------------- @@ -129,7 +124,7 @@ void AtomVecTri::copy_bonus(int i, int j, int delflag) // if deleting atom J via delflag and J has bonus data, then delete it if (delflag && tri[j] >= 0) { - copy_bonus_all(nlocal_bonus-1,tri[j]); + copy_bonus_all(nlocal_bonus - 1, tri[j]); nlocal_bonus--; } @@ -148,7 +143,7 @@ void AtomVecTri::copy_bonus(int i, int j, int delflag) void AtomVecTri::copy_bonus_all(int i, int j) { tri[bonus[i].ilocal] = j; - memcpy(&bonus[j],&bonus[i],sizeof(Bonus)); + memcpy(&bonus[j], &bonus[i], sizeof(Bonus)); } /* ---------------------------------------------------------------------- @@ -169,7 +164,7 @@ void AtomVecTri::clear_bonus() int AtomVecTri::pack_comm_bonus(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; double *quat; m = 0; @@ -191,7 +186,7 @@ int AtomVecTri::pack_comm_bonus(int n, int *list, double *buf) void AtomVecTri::unpack_comm_bonus(int n, int first, double *buf) { - int i,m,last; + int i, m, last; double *quat; m = 0; @@ -211,13 +206,14 @@ void AtomVecTri::unpack_comm_bonus(int n, int first, double *buf) int AtomVecTri::pack_border_bonus(int n, int *list, double *buf) { - int i,j,m; - double *quat,*c1,*c2,*c3,*inertia; + int i, j, m; + double *quat, *c1, *c2, *c3, *inertia; m = 0; for (i = 0; i < n; i++) { j = list[i]; - if (tri[j] < 0) buf[m++] = ubuf(0).d; + if (tri[j] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; quat = bonus[tri[j]].quat; @@ -251,14 +247,15 @@ int AtomVecTri::pack_border_bonus(int n, int *list, double *buf) int AtomVecTri::unpack_border_bonus(int n, int first, double *buf) { - int i,j,m,last; - double *quat,*c1,*c2,*c3,*inertia; + int i, j, m, last; + double *quat, *c1, *c2, *c3, *inertia; m = 0; last = first + n; for (i = first; i < last; i++) { tri[i] = (int) ubuf(buf[m++]).i; - if (tri[i] == 0) tri[i] = -1; + if (tri[i] == 0) + tri[i] = -1; else { j = nlocal_bonus + nghost_bonus; if (j == nmax_bonus) grow_bonus(); @@ -301,7 +298,8 @@ int AtomVecTri::pack_exchange_bonus(int i, double *buf) { int m = 0; - if (tri[i] < 0) buf[m++] = ubuf(0).d; + if (tri[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = tri[i]; @@ -338,7 +336,8 @@ int AtomVecTri::unpack_exchange_bonus(int ilocal, double *buf) int m = 0; tri[ilocal] = (int) ubuf(buf[m++]).i; - if (tri[ilocal] == 0) tri[ilocal] = -1; + if (tri[ilocal] == 0) + tri[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); double *quat = bonus[nlocal_bonus].quat; @@ -381,8 +380,10 @@ int AtomVecTri::size_restart_bonus() int n = 0; int nlocal = atom->nlocal; for (i = 0; i < nlocal; i++) { - if (tri[i] >= 0) n += size_restart_bonus_one; - else n++; + if (tri[i] >= 0) + n += size_restart_bonus_one; + else + n++; } return n; @@ -396,7 +397,8 @@ int AtomVecTri::pack_restart_bonus(int i, double *buf) { int m = 0; - if (tri[i] < 0) buf[m++] = ubuf(0).d; + if (tri[i] < 0) + buf[m++] = ubuf(0).d; else { buf[m++] = ubuf(1).d; int j = tri[i]; @@ -435,7 +437,8 @@ int AtomVecTri::unpack_restart_bonus(int ilocal, double *buf) int m = 0; tri[ilocal] = (int) ubuf(buf[m++]).i; - if (tri[ilocal] == 0) tri[ilocal] = -1; + if (tri[ilocal] == 0) + tri[ilocal] = -1; else { if (nlocal_bonus == nmax_bonus) grow_bonus(); double *quat = bonus[nlocal_bonus].quat; @@ -472,52 +475,51 @@ int AtomVecTri::unpack_restart_bonus(int ilocal, double *buf) void AtomVecTri::data_atom_bonus(int m, const std::vector &values) { - if (tri[m]) error->one(FLERR,"Assigning tri parameters to non-tri atom"); + if (tri[m]) error->one(FLERR, "Assigning tri parameters to non-tri atom"); if (nlocal_bonus == nmax_bonus) grow_bonus(); - double c1[3],c2[3],c3[3]; + double c1[3], c2[3], c3[3]; int ivalue = 1; - c1[0] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c1[1] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c1[2] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c2[0] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c2[1] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c2[2] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c3[0] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c3[1] = utils::numeric(FLERR,values[ivalue++],true,lmp); - c3[2] = utils::numeric(FLERR,values[ivalue++],true,lmp); + c1[0] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c1[1] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c1[2] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c2[0] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c2[1] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c2[2] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c3[0] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c3[1] = utils::numeric(FLERR, values[ivalue++], true, lmp); + c3[2] = utils::numeric(FLERR, values[ivalue++], true, lmp); // check for duplicate points if (c1[0] == c2[0] && c1[1] == c2[1] && c1[2] == c2[2]) - error->one(FLERR,"Invalid shape in Triangles section of data file"); + error->one(FLERR, "Invalid shape in Triangles section of data file"); if (c1[0] == c3[0] && c1[1] == c3[1] && c1[2] == c3[2]) - error->one(FLERR,"Invalid shape in Triangles section of data file"); + error->one(FLERR, "Invalid shape in Triangles section of data file"); if (c2[0] == c3[0] && c2[1] == c3[1] && c2[2] == c3[2]) - error->one(FLERR,"Invalid shape in Triangles section of data file"); + error->one(FLERR, "Invalid shape in Triangles section of data file"); // size = length of one edge - double c2mc1[3],c3mc1[3]; - MathExtra::sub3(c2,c1,c2mc1); - MathExtra::sub3(c3,c1,c3mc1); - double size = MAX(MathExtra::len3(c2mc1),MathExtra::len3(c3mc1)); + double c2mc1[3], c3mc1[3]; + MathExtra::sub3(c2, c1, c2mc1); + MathExtra::sub3(c3, c1, c3mc1); + double size = MAX(MathExtra::len3(c2mc1), MathExtra::len3(c3mc1)); // centroid = 1/3 of sum of vertices double centroid[3]; - centroid[0] = (c1[0]+c2[0]+c3[0]) / 3.0; - centroid[1] = (c1[1]+c2[1]+c3[1]) / 3.0; - centroid[2] = (c1[2]+c2[2]+c3[2]) / 3.0; + centroid[0] = (c1[0] + c2[0] + c3[0]) / 3.0; + centroid[1] = (c1[1] + c2[1] + c3[1]) / 3.0; + centroid[2] = (c1[2] + c2[2] + c3[2]) / 3.0; double dx = centroid[0] - x[m][0]; double dy = centroid[1] - x[m][1]; double dz = centroid[2] - x[m][2]; - double delta = sqrt(dx*dx + dy*dy + dz*dz); + double delta = sqrt(dx * dx + dy * dy + dz * dz); - if (delta/size > EPSILON) - error->one(FLERR,"Inconsistent triangle in data file"); + if (delta / size > EPSILON) error->one(FLERR, "Inconsistent triangle in data file"); x[m][0] = centroid[0]; x[m][1] = centroid[1]; @@ -528,29 +530,29 @@ void AtomVecTri::data_atom_bonus(int m, const std::vector &values) // tri area = 0.5 len(U x V), where U,V are edge vectors from one vertex double c4[3]; - MathExtra::sub3(c1,centroid,c4); + MathExtra::sub3(c1, centroid, c4); radius[m] = MathExtra::lensq3(c4); - MathExtra::sub3(c2,centroid,c4); - radius[m] = MAX(radius[m],MathExtra::lensq3(c4)); - MathExtra::sub3(c3,centroid,c4); - radius[m] = MAX(radius[m],MathExtra::lensq3(c4)); + MathExtra::sub3(c2, centroid, c4); + radius[m] = MAX(radius[m], MathExtra::lensq3(c4)); + MathExtra::sub3(c3, centroid, c4); + radius[m] = MAX(radius[m], MathExtra::lensq3(c4)); radius[m] = sqrt(radius[m]); double norm[3]; - MathExtra::cross3(c2mc1,c3mc1,norm); + MathExtra::cross3(c2mc1, c3mc1, norm); double area = 0.5 * MathExtra::len3(norm); rmass[m] *= area; // inertia = inertia tensor of triangle as 6-vector in Voigt ordering double inertia[6]; - MathExtra::inertia_triangle(c1,c2,c3,rmass[m],inertia); + MathExtra::inertia_triangle(c1, c2, c3, rmass[m], inertia); // diagonalize inertia tensor via Jacobi rotations // bonus[].inertia = 3 eigenvalues = principal moments of inertia // evectors and exzy_space = 3 evectors = principal axes of triangle - double tensor[3][3],evectors[3][3]; + double tensor[3][3], evectors[3][3]; tensor[0][0] = inertia[0]; tensor[1][1] = inertia[1]; tensor[2][2] = inertia[2]; @@ -558,10 +560,10 @@ void AtomVecTri::data_atom_bonus(int m, const std::vector &values) tensor[0][2] = tensor[2][0] = inertia[4]; tensor[0][1] = tensor[1][0] = inertia[5]; - int ierror = MathEigen::jacobi3(tensor,bonus[nlocal_bonus].inertia,evectors); - if (ierror) error->one(FLERR,"Insufficient Jacobi rotations for triangle"); + int ierror = MathEigen::jacobi3(tensor, bonus[nlocal_bonus].inertia, evectors); + if (ierror) error->one(FLERR, "Insufficient Jacobi rotations for triangle"); - double ex_space[3],ey_space[3],ez_space[3]; + double ex_space[3], ey_space[3], ez_space[3]; ex_space[0] = evectors[0][0]; ex_space[1] = evectors[1][0]; ex_space[2] = evectors[2][0]; @@ -575,26 +577,23 @@ void AtomVecTri::data_atom_bonus(int m, const std::vector &values) // enforce 3 orthogonal vectors as a right-handed coordinate system // flip 3rd vector if needed - MathExtra::cross3(ex_space,ey_space,norm); - if (MathExtra::dot3(norm,ez_space) < 0.0) MathExtra::negate3(ez_space); + MathExtra::cross3(ex_space, ey_space, norm); + if (MathExtra::dot3(norm, ez_space) < 0.0) MathExtra::negate3(ez_space); // create initial quaternion - MathExtra::exyz_to_q(ex_space,ey_space,ez_space,bonus[nlocal_bonus].quat); + MathExtra::exyz_to_q(ex_space, ey_space, ez_space, bonus[nlocal_bonus].quat); // bonus c1,c2,c3 = displacement of c1,c2,c3 from centroid // in basis of principal axes double disp[3]; - MathExtra::sub3(c1,centroid,disp); - MathExtra::transpose_matvec(ex_space,ey_space,ez_space, - disp,bonus[nlocal_bonus].c1); - MathExtra::sub3(c2,centroid,disp); - MathExtra::transpose_matvec(ex_space,ey_space,ez_space, - disp,bonus[nlocal_bonus].c2); - MathExtra::sub3(c3,centroid,disp); - MathExtra::transpose_matvec(ex_space,ey_space,ez_space, - disp,bonus[nlocal_bonus].c3); + MathExtra::sub3(c1, centroid, disp); + MathExtra::transpose_matvec(ex_space, ey_space, ez_space, disp, bonus[nlocal_bonus].c1); + MathExtra::sub3(c2, centroid, disp); + MathExtra::transpose_matvec(ex_space, ey_space, ez_space, disp, bonus[nlocal_bonus].c2); + MathExtra::sub3(c3, centroid, disp); + MathExtra::transpose_matvec(ex_space, ey_space, ez_space, disp, bonus[nlocal_bonus].c3); bonus[nlocal_bonus].ilocal = m; tri[m] = nlocal_bonus++; @@ -607,7 +606,7 @@ void AtomVecTri::data_atom_bonus(int m, const std::vector &values) double AtomVecTri::memory_usage_bonus() { double bytes = 0; - bytes += (double)nmax_bonus*sizeof(Bonus); + bytes += (double) nmax_bonus * sizeof(Bonus); return bytes; } @@ -620,7 +619,7 @@ void AtomVecTri::create_atom_post(int ilocal) { double radius_one = 0.5; radius[ilocal] = radius_one; - rmass[ilocal] = 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; + rmass[ilocal] = 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; tri[ilocal] = -1; } @@ -632,19 +631,22 @@ void AtomVecTri::create_atom_post(int ilocal) void AtomVecTri::data_atom_post(int ilocal) { tri_flag = tri[ilocal]; - if (tri_flag == 0) tri_flag = -1; - else if (tri_flag == 1) tri_flag = 0; - else error->one(FLERR,"Invalid tri flag in Atoms section of data file"); + if (tri_flag == 0) + tri_flag = -1; + else if (tri_flag == 1) + tri_flag = 0; + else + error->one(FLERR, "Invalid tri flag in Atoms section of data file"); tri[ilocal] = tri_flag; - if (rmass[ilocal] <= 0.0) - error->one(FLERR,"Invalid density in Atoms section of data file"); + if (rmass[ilocal] <= 0.0) error->one(FLERR, "Invalid density in Atoms section of data file"); if (tri_flag < 0) { double radius_one = 0.5; radius[ilocal] = radius_one; - rmass[ilocal] *= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; - } else radius[ilocal] = 0.0; + rmass[ilocal] *= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; + } else + radius[ilocal] = 0.0; omega[ilocal][0] = 0.0; omega[ilocal][1] = 0.0; @@ -663,17 +665,19 @@ void AtomVecTri::pack_data_pre(int ilocal) tri_flag = tri[ilocal]; rmass_one = rmass[ilocal]; - if (tri_flag < 0) tri[ilocal] = 0; - else tri[ilocal] = 1; + if (tri_flag < 0) + tri[ilocal] = 0; + else + tri[ilocal] = 1; if (tri_flag < 0) { double radius_one = radius[ilocal]; - rmass[ilocal] /= 4.0*MY_PI/3.0 * radius_one*radius_one*radius_one; + rmass[ilocal] /= 4.0 * MY_PI / 3.0 * radius_one * radius_one * radius_one; } else { - double c2mc1[3],c3mc1[3],norm[3]; - MathExtra::sub3(bonus[tri_flag].c2,bonus[tri_flag].c1,c2mc1); - MathExtra::sub3(bonus[tri_flag].c3,bonus[tri_flag].c1,c3mc1); - MathExtra::cross3(c2mc1,c3mc1,norm); + double c2mc1[3], c3mc1[3], norm[3]; + MathExtra::sub3(bonus[tri_flag].c2, bonus[tri_flag].c1, c2mc1); + MathExtra::sub3(bonus[tri_flag].c3, bonus[tri_flag].c1, c3mc1); + MathExtra::cross3(c2mc1, c3mc1, norm); double area = 0.5 * MathExtra::len3(norm); rmass[ilocal] /= area; } @@ -696,9 +700,9 @@ void AtomVecTri::pack_data_post(int ilocal) int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) { - int i,j; - double xc,yc,zc; - double dc1[3],dc2[3],dc3[3]; + int i, j; + double xc, yc, zc; + double dc1[3], dc2[3], dc3[3]; double p[3][3]; double **x = atom->x; @@ -711,10 +715,10 @@ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) if (buf) { buf[m++] = ubuf(tag[i]).d; j = tri[i]; - MathExtra::quat_to_mat(bonus[j].quat,p); - MathExtra::matvec(p,bonus[j].c1,dc1); - MathExtra::matvec(p,bonus[j].c2,dc2); - MathExtra::matvec(p,bonus[j].c3,dc3); + MathExtra::quat_to_mat(bonus[j].quat, p); + MathExtra::matvec(p, bonus[j].c1, dc1); + MathExtra::matvec(p, bonus[j].c2, dc2); + MathExtra::matvec(p, bonus[j].c3, dc3); xc = x[i][0]; yc = x[i][1]; zc = x[i][2]; @@ -727,7 +731,8 @@ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) buf[m++] = xc + dc3[0]; buf[m++] = yc + dc3[1]; buf[m++] = zc + dc3[2]; - } else m += size_data_bonus; + } else + m += size_data_bonus; } return m; } @@ -740,9 +745,8 @@ void AtomVecTri::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/) { int i = 0; while (i < n) { - fmt::print(fp,"{} {} {} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, - buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6], - buf[i+7],buf[i+8],buf[i+9]); + fmt::print(fp, "{} {} {} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i, buf[i + 1], buf[i + 2], + buf[i + 3], buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7], buf[i + 8], buf[i + 9]); i += size_data_bonus; } } @@ -770,24 +774,24 @@ void AtomVecTri::set_equilateral(int i, double size) quat[1] = 0.0; quat[2] = 0.0; quat[3] = 0.0; - c1[0] = -size/2.0; - c1[1] = -sqrt(3.0)/2.0 * size / 3.0; + c1[0] = -size / 2.0; + c1[1] = -sqrt(3.0) / 2.0 * size / 3.0; c1[2] = 0.0; - c2[0] = size/2.0; - c2[1] = -sqrt(3.0)/2.0 * size / 3.0; + c2[0] = size / 2.0; + c2[1] = -sqrt(3.0) / 2.0 * size / 3.0; c2[2] = 0.0; c3[0] = 0.0; - c3[1] = sqrt(3.0)/2.0 * size * 2.0/3.0; + c3[1] = sqrt(3.0) / 2.0 * size * 2.0 / 3.0; c3[2] = 0.0; - inertia[0] = sqrt(3.0)/96.0 * size*size*size*size; - inertia[1] = sqrt(3.0)/96.0 * size*size*size*size; - inertia[2] = sqrt(3.0)/48.0 * size*size*size*size; + inertia[0] = sqrt(3.0) / 96.0 * size * size * size * size; + inertia[1] = sqrt(3.0) / 96.0 * size * size * size * size; + inertia[2] = sqrt(3.0) / 48.0 * size * size * size * size; radius[i] = MathExtra::len3(c1); bonus[nlocal_bonus].ilocal = i; tri[i] = nlocal_bonus++; } else if (size == 0.0) { radius[i] = 0.5; - copy_bonus_all(nlocal_bonus-1,tri[i]); + copy_bonus_all(nlocal_bonus - 1, tri[i]); nlocal_bonus--; tri[i] = -1; } else { @@ -795,18 +799,18 @@ void AtomVecTri::set_equilateral(int i, double size) double *c2 = bonus[tri[i]].c2; double *c3 = bonus[tri[i]].c3; double *inertia = bonus[tri[i]].inertia; - c1[0] = -size/2.0; - c1[1] = -sqrt(3.0)/2.0 * size / 3.0; + c1[0] = -size / 2.0; + c1[1] = -sqrt(3.0) / 2.0 * size / 3.0; c1[2] = 0.0; - c2[0] = size/2.0; - c2[1] = -sqrt(3.0)/2.0 * size / 3.0; + c2[0] = size / 2.0; + c2[1] = -sqrt(3.0) / 2.0 * size / 3.0; c2[2] = 0.0; c3[0] = 0.0; - c3[1] = sqrt(3.0)/2.0 * size * 2.0/3.0; + c3[1] = sqrt(3.0) / 2.0 * size * 2.0 / 3.0; c3[2] = 0.0; - inertia[0] = sqrt(3.0)/96.0 * size*size*size*size; - inertia[1] = sqrt(3.0)/96.0 * size*size*size*size; - inertia[2] = sqrt(3.0)/48.0 * size*size*size*size; + inertia[0] = sqrt(3.0) / 96.0 * size * size * size * size; + inertia[1] = sqrt(3.0) / 96.0 * size * size * size * size; + inertia[2] = sqrt(3.0) / 48.0 * size * size * size * size; radius[i] = MathExtra::len3(c1); } } diff --git a/src/atom_vec_tri.h b/src/atom_vec_tri.h index 76f0d29207..d9e56f438f 100644 --- a/src/atom_vec_tri.h +++ b/src/atom_vec_tri.h @@ -84,42 +84,3 @@ class AtomVecTri : public AtomVec { #endif #endif - -/* ERROR/WARNING messages: - -E: Atom_style tri can only be used in 3d simulations - -Self-explanatory. - -E: Per-processor system is too big - -The number of owned atoms plus ghost atoms on a single -processor must fit in 32-bit integer. - -E: Invalid atom type in Atoms section of data file - -Atom types must range from 1 to specified # of types. - -E: Invalid density in Atoms section of data file - -Density value cannot be <= 0.0. - -E: Assigning tri parameters to non-tri atom - -Self-explanatory. - -E: Invalid shape in Triangles section of data file - -Two or more of the triangle corners are duplicate points. - -E: Inconsistent triangle in data file - -The centroid of the triangle as defined by the corner points is not -the atom coordinate. - -E: Insufficient Jacobi rotations for triangle - -The calculation of the inertia tensor of the triangle failed. This -should not happen if it is a reasonably shaped triangle. - -*/ diff --git a/src/balance.cpp b/src/balance.cpp index f2fcda2712..c2f3ee2d5c 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -355,7 +355,7 @@ void Balance::command(int narg, char **arg) // set disable = 0, so weights migrate with atoms for imbfinal calculation if (domain->triclinic) domain->x2lamda(atom->nlocal); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); if (wtflag) fixstore->disable = 0; if (style == BISECTION) irregular->migrate_atoms(1,1,rcb->sendproc); else irregular->migrate_atoms(1); @@ -496,8 +496,8 @@ void Balance::weight_storage(char *prefix) if (prefix) cmd = prefix; cmd += "IMBALANCE_WEIGHTS"; - fixstore = (FixStore *) modify->get_fix_by_id(cmd); - if (!fixstore) fixstore = (FixStore *) modify->add_fix(cmd + " all STORE peratom 0 1"); + fixstore = dynamic_cast( modify->get_fix_by_id(cmd)); + if (!fixstore) fixstore = dynamic_cast( modify->add_fix(cmd + " all STORE peratom 0 1")); // do not carry weights with atoms during normal atom migration diff --git a/src/balance.h b/src/balance.h index f7a3c60df5..252960743b 100644 --- a/src/balance.h +++ b/src/balance.h @@ -46,6 +46,7 @@ class Balance : public Command { void dumpout(bigint); static constexpr int BSTR_SIZE = 3; + private: int me, nprocs; @@ -57,7 +58,7 @@ class Balance : public Command { int nitermax; // params for shift LB double stopthresh; - char bstr[BSTR_SIZE+1]; + char bstr[BSTR_SIZE + 1]; int shift_allocate; // 1 if SHIFT vectors have been allocated int ndim; // length of balance string bstr @@ -94,52 +95,3 @@ class Balance : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Balance command before simulation box is defined - -The balance command cannot be used before a read_data, read_restart, -or create_box command. - -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: Cannot balance in z dimension for 2d simulation - -Self-explanatory. - -E: Balance shift string is invalid - -The string can only contain the characters "x", "y", or "z". - -E: Balance rcb cannot be used with comm_style brick - -Comm_style tiled must be used instead. - -E: Lost atoms via balance: original %ld current %ld - -This should not occur. Report the problem to the developers. - -E: Unknown (fix) balance weight method - -UNDOCUMENTED - -E: Cannot open (fix) balance output file - -UNDOCUMENTED - -E: Balance produced bad splits - -This should not occur. It means two or more cutting plane locations -are on top of each other or out of order. Report the problem to the -developers. - -U: Cannot open balance output file - -Self-explanatory. - -*/ diff --git a/src/body.h b/src/body.h index b2cbbee345..9911c425ff 100644 --- a/src/body.h +++ b/src/body.h @@ -56,13 +56,3 @@ class Body : protected Pointers { } // namespace LAMMPS_NS #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. - -*/ diff --git a/src/bond.cpp b/src/bond.cpp index 332e65de9f..18cdaf8c6d 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -27,6 +27,10 @@ using namespace LAMMPS_NS; enum { NONE, LINEAR, SPLINE }; +// allocate space for static class instance variable and initialize it + +int Bond::instance_total = 0; + /* ----------------------------------------------------------------------- set bond contribution to Vdwl energy to 0.0 a particular bond style can override this @@ -34,12 +38,19 @@ enum { NONE, LINEAR, SPLINE }; Bond::Bond(LAMMPS *_lmp) : Pointers(_lmp) { + instance_me = instance_total++; + energy = 0.0; virial[0] = virial[1] = virial[2] = virial[3] = virial[4] = virial[5] = 0.0; writedata = 1; + reinitflag = 1; + + comm_forward = comm_reverse = comm_reverse_off = 0; allocated = 0; suffix_flag = Suffix::NONE; + born_matrix_enable = 0; + partial_flag = 0; maxeatom = maxvatom = 0; eatom = nullptr; @@ -327,8 +338,9 @@ double Bond::memory_usage() } /* ----------------------------------------------------------------------- - Reset all type-based bond params via init. + reset all type-based bond params via init() -------------------------------------------------------------------------- */ + void Bond::reinit() { if (!reinitflag) error->all(FLERR, "Fix adapt interface to this bond style not supported"); diff --git a/src/bond.h b/src/bond.h index 9b9f35180a..a2dc4c24ce 100644 --- a/src/bond.h +++ b/src/bond.h @@ -23,14 +23,24 @@ class Bond : protected Pointers { friend class FixOMP; public: + static int instance_total; // # of Bond classes ever instantiated + int allocated; int *setflag; + int partial_flag; // 1 if bond type can be set to 0 and deleted int writedata; // 1 if writes coeffs to data file double energy; // accumulated energies double virial[6]; // accumulated virial: xx,yy,zz,xy,xz,yz double *eatom, **vatom; // accumulated per-atom energy/virial - int reinitflag; // 1 if compatible with fix adapt and alike + int born_matrix_enable; + + int comm_forward; // size of forward communication (0 if none) + int comm_reverse; // size of reverse communication (0 if none) + int comm_reverse_off; // size of reverse comm even if newton off + + int reinitflag; // 0 if not compatible with fix adapt + // extract() method may still need to be added // KOKKOS host/device flag and data masks @@ -56,9 +66,22 @@ class Bond : protected Pointers { virtual void *extract(const char *, int &) { return nullptr; } virtual void reinit(); + virtual int pack_forward_comm(int, int *, double *, int, int *) { return 0; } + virtual void unpack_forward_comm(int, int, double *) {} + virtual int pack_reverse_comm(int, int, double *) { return 0; } + virtual void unpack_reverse_comm(int, int *, double *) {} + + virtual void born_matrix(int /*btype*/, double /*rsq*/, int /*at1*/, int /*at2*/, double &du, + double &du2) + { + du = 0.0; + du2 = 0.0; + } + void write_file(int, char **); protected: + int instance_me; // which Bond class instantiation I am int suffix_flag; // suffix compatibility flag int evflag; @@ -81,37 +104,3 @@ class Bond : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Bond coeffs are not set - -No bond coefficients have been assigned in the data file or via the -bond_coeff command. - -E: All bond coeffs are not set - -All bond coefficients must be set in the data file or by the -bond_coeff command before running a simulation. - -E: Illegal ... command - -UNDOCUMENTED - -E: Invalid atom types in bond_write command - -UNDOCUMENTED - -E: Invalid rlo/rhi values in bond_write command - -UNDOCUMENTED - -E: Cannot open bond_write file - -UNDOCUMENTED - -E: Fix adapt interface to this bond style not supported - -UNDOCUMENTED - -*/ diff --git a/src/bond_deprecated.cpp b/src/bond_deprecated.cpp index 4f5ec58071..98bf6ea9ae 100644 --- a/src/bond_deprecated.cpp +++ b/src/bond_deprecated.cpp @@ -35,7 +35,7 @@ void BondDeprecated::settings(int, char **) // called, our style was just added at the end of the list of substyles if (utils::strmatch(my_style,"^hybrid")) { - BondHybrid *hybrid = (BondHybrid *)force->bond; + auto hybrid = dynamic_cast(force->bond); my_style = hybrid->keywords[hybrid->nstyles]; } diff --git a/src/bond_deprecated.h b/src/bond_deprecated.h index cfc770cf20..2d348b1190 100644 --- a/src/bond_deprecated.h +++ b/src/bond_deprecated.h @@ -41,7 +41,3 @@ class BondDeprecated : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/bond_hybrid.h b/src/bond_hybrid.h index ba795c2867..6288772836 100644 --- a/src/bond_hybrid.h +++ b/src/bond_hybrid.h @@ -58,39 +58,3 @@ class BondHybrid : public Bond { #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: Bond style hybrid cannot use same bond style twice - -Self-explanatory. - -E: Bond style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Bond style hybrid cannot have none as an argument - -Self-explanatory. - -E: Bond coeff for hybrid has invalid style - -Bond style hybrid uses another bond style as one of its coefficients. -The bond style used in the bond_coeff command or read from a restart -file is not recognized. - -E: Invoked bond equil distance on bond style none - -Self-explanatory. - -E: Invoked bond single on bond style none - -Self-explanatory. - -*/ diff --git a/src/bond_zero.h b/src/bond_zero.h index 050b4f1a9b..67fc4b63cb 100644 --- a/src/bond_zero.h +++ b/src/bond_zero.h @@ -51,15 +51,3 @@ class BondZero : public Bond { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Incorrect args for bond coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/change_box.cpp b/src/change_box.cpp index bbac78ab3d..08af5f11c9 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -372,7 +372,7 @@ void ChangeBox::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/change_box.h b/src/change_box.h index 772a8150e5..85b4b302fa 100644 --- a/src/change_box.h +++ b/src/change_box.h @@ -56,73 +56,3 @@ class ChangeBox : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Change_box command before simulation box is defined - -Self-explanatory. - -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: Cannot change_box after reading restart file with per-atom info - -This is because the restart file info cannot be migrated with the -atoms. You can get around this by performing a 0-timestep run which -will assign the restart file info to actual atoms. - -E: Could not find change_box group ID - -Group ID used in the change_box command does not exist. - -E: Cannot change_box in z dimension for 2d simulation - -Self-explanatory. - -E: Change_box volume used incorrectly - -The "dim volume" option must be used immediately following one or two -settings for "dim1 ..." (and optionally "dim2 ...") and must be for a -different dimension, i.e. dim != dim1 and dim != dim2. - -E: Cannot change_box in xz or yz for 2d simulation - -Self-explanatory. - -E: Cannot change box tilt factors for orthogonal box - -Cannot use tilt factors unless the simulation box is non-orthogonal. - -E: Cannot change box z boundary to non-periodic for a 2d simulation - -Self-explanatory. - -E: Cannot change box to orthogonal when tilt is non-zero - -Self-explanatory. - -E: Cannot change box ortho/triclinic with dumps defined - -This is because some dumps store the shape of the box. You need to -use undump to discard the dump, change the box, then redefine a new -dump. - -E: Cannot change box ortho/triclinic with certain fixes defined - -This is because those fixes store the shape of the box. You need to -use unfix to discard the fix, change the box, then redefine a new -fix. - -W: Attempting to remap atoms in rigid bodies - -UNDOCUMENTED - -W: Lost atoms via change_box: original %ld current %ld - -The command options you have used caused atoms to be lost. - -*/ diff --git a/src/citeme.h b/src/citeme.h index 0d9f40f57f..7a8b456eb8 100644 --- a/src/citeme.h +++ b/src/citeme.h @@ -40,14 +40,3 @@ class CiteMe : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Cannot open citation file - -This file is created when you use some LAMMPS features, to indicate -what paper you should cite on behalf of those who implemented -the feature. Check that you have write privileges in the directory -you are running in. - -*/ diff --git a/src/comm.cpp b/src/comm.cpp index 7e88144efe..9f46031185 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -218,6 +218,9 @@ void Comm::init() if (force->pair) maxforward = MAX(maxforward,force->pair->comm_forward); if (force->pair) maxreverse = MAX(maxreverse,force->pair->comm_reverse); + if (force->bond) maxforward = MAX(maxforward,force->bond->comm_forward); + if (force->bond) maxreverse = MAX(maxreverse,force->bond->comm_reverse); + for (const auto &fix : fix_list) { maxforward = MAX(maxforward,fix->comm_forward); maxreverse = MAX(maxreverse,fix->comm_reverse); @@ -235,6 +238,7 @@ void Comm::init() if (force->newton == 0) maxreverse = 0; if (force->pair) maxreverse = MAX(maxreverse,force->pair->comm_reverse_off); + if (force->bond) maxreverse = MAX(maxreverse,force->bond->comm_reverse_off); // maxexchange_atom = size of an exchanged atom, set by AtomVec // only needs to be set if size > BUFEXTRA @@ -550,7 +554,7 @@ void Comm::set_proc_grid(int outflag) // create ProcMap class to create 3d grid and map procs to it - ProcMap *pmap = new ProcMap(lmp); + auto pmap = new ProcMap(lmp); // create 3d grid of processors // produces procgrid and coregrid (if relevant) @@ -1011,7 +1015,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, { // irregular comm of inbuf from caller decomp to rendezvous decomp - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); int nrvous; if (inorder) nrvous = irregular->create_data_grouped(n,procs); @@ -1019,8 +1023,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, - "rendezvous:inbuf"); + auto inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); irregular->exchange_data(inbuf,insize,inbuf_rvous); bigint irregular1_bytes = irregular->memory_usage(); @@ -1033,14 +1036,12 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, int flag; int *procs_rvous; char *outbuf_rvous; - int nrvous_out = callback(nrvous,inbuf_rvous,flag, - procs_rvous,outbuf_rvous,ptr); + int nrvous_out = callback(nrvous,inbuf_rvous,flag, procs_rvous,outbuf_rvous,ptr); if (flag != 1) memory->sfree(inbuf_rvous); // outbuf_rvous = inbuf_vous if (flag == 0) { if (statflag) rendezvous_stats(n,0,nrvous,nrvous_out,insize,outsize, - (bigint) nrvous_out*sizeof(int) + - irregular1_bytes); + (bigint) nrvous_out*sizeof(int) + irregular1_bytes); return 0; // all nout_rvous are 0, no 2nd comm stage } @@ -1050,14 +1051,12 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, irregular = new Irregular(lmp); int nout; - if (outorder) - nout = irregular->create_data_grouped(nrvous_out,procs_rvous); + if (outorder) nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, - "rendezvous:outbuf"); + outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); irregular->exchange_data(outbuf_rvous,outsize,outbuf); bigint irregular2_bytes = irregular->memory_usage(); @@ -1164,8 +1163,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of inbuf from caller decomp to rendezvous decomp // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, - "rendezvous:inbuf"); + auto inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); memset(inbuf_rvous,0,(bigint) nrvous*insize*sizeof(char)); MPI_Alltoallv(inbuf_a2a,sendcount,sdispls,MPI_CHAR, @@ -1184,8 +1182,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, int *procs_rvous; char *outbuf_rvous; - int nrvous_out = callback(nrvous,inbuf_rvous,flag, - procs_rvous,outbuf_rvous,ptr); + int nrvous_out = callback(nrvous,inbuf_rvous,flag, procs_rvous,outbuf_rvous,ptr); if (flag != 1) memory->sfree(inbuf_rvous); // outbuf_rvous = inbuf_vous if (flag == 0) { @@ -1206,8 +1203,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer - outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, - "rendezvous:outbuf"); + outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); memory->create(offsets,nprocs,"rendezvous:offsets"); for (int i = 0; i < nprocs; i++) procs_a2a[i] = 0; @@ -1225,8 +1221,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, offset += outsize; } - all2all2_bytes = nprocs*sizeof(int) + nprocs*sizeof(bigint) + - (bigint)nrvous_out*outsize; + all2all2_bytes = nprocs*sizeof(int) + nprocs*sizeof(bigint) + (bigint)nrvous_out*outsize; } else { procs_a2a = procs_rvous; diff --git a/src/comm.h b/src/comm.h index 3d8d217136..43fabb1b67 100644 --- a/src/comm.h +++ b/src/comm.h @@ -80,10 +80,12 @@ class Comm : protected Pointers { virtual void exchange() = 0; // move atoms to new procs virtual void borders() = 0; // setup list of atoms to comm - // forward/reverse comm from a Pair, Fix, Compute, Dump + // forward/reverse comm from a Pair, Bond, Fix, Compute, Dump virtual void forward_comm(class Pair *) = 0; virtual void reverse_comm(class Pair *) = 0; + virtual void forward_comm(class Bond *) = 0; + virtual void reverse_comm(class Bond *) = 0; virtual void forward_comm(class Fix *, int size = 0) = 0; virtual void reverse_comm(class Fix *, int size = 0) = 0; virtual void reverse_comm_variable(class Fix *) = 0; @@ -172,119 +174,3 @@ class Comm : protected Pointers { } // namespace LAMMPS_NS #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: Invalid group in comm_modify command - -Self-explanatory. - -E: Comm_modify group != atom_modify first group - -Self-explanatory. - -E: Use cutoff/multi keyword to set cutoff in multi mode - -Mode is multi so cutoff keyword cannot be used. - -E: Invalid cutoff in comm_modify command - -Specified cutoff must be >= 0.0. - -E: Use cutoff keyword to set cutoff in single mode - -Mode is single so cutoff/multi keyword cannot be used. - -E: Use cutoff/bytype in mode multi only - -Mode is single so cutoff/bytype keyword cannot be used. - -E: Cannot set cutoff/multi before simulation box is defined - -Self-explanatory. - -E: Specified processors != physical processors - -The 3d grid of processors defined by the processors command does not -match the number of processors LAMMPS is being run on. - -E: Cannot use processors part command without using partitions - -See the command-line -partition switch. - -E: Invalid partitions in processors part command - -Valid partitions are numbered 1 to N and the sender and receiver -cannot be the same partition. - -E: Sending partition in processors part command is already a sender - -Cannot specify a partition to be a sender twice. - -E: Receiving partition in processors part command is already a receiver - -Cannot specify a partition to be a receiver twice. - -E: Processors grid numa and map style are incompatible - -Using numa for gstyle in the processors command requires using -cart for the map option. - -E: Processors part option and grid style are incompatible - -Cannot use gstyle numa or custom with the part option. - -E: Bad grid of processors - -The 3d grid of processors defined by the processors command does not -match the number of processors LAMMPS is being run on. - -E: Processor count in z must be 1 for 2d simulation - -Self-explanatory. - -E: Cannot use multi/tiered communication with Newton off - -Self-explanatory. - -E: Cannot put data on ring from nullptr pointer - -W: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. - -The communication cutoff defaults to the maximum of what is inferred from pair and -bond styles (will be zero, if none are defined) and what is specified via -"comm_modify cutoff" (defaults to 0.0). If this results to 0.0, no ghost atoms will -be generated and LAMMPS may lose atoms or use incorrect periodic images of atoms in -interaction lists. To avoid, either define pair style zero with a suitable cutoff -or use comm_modify cutoff. - -W: Communication cutoff is shorter than a bond length based estimate. This may lead to errors. - -Since LAMMPS stores topology data with individual atoms, all atoms comprising -a bond, angle, dihedral or improper must be present on any sub-domain that -"owns" the atom with the information, either as a local or a ghost atom. The -communication cutoff is what determines up to what distance from a sub-domain -boundary ghost atoms are created. The communication cutoff is by default the -largest non-bonded cutoff plus the neighbor skin distance, but for short or -non-bonded cutoffs and/or long bonds, this may not be sufficient. This warning -indicates that there is an increased risk of a simulation stopping unexpectedly -because of Bond/Angle/Dihedral/Improper atoms missing. It can be silenced by -manually setting the communication cutoff via comm_modify cutoff. However, -since the heuristic used to determine the estimate is not always accurate, it -is not changed automatically and the warning may be ignored depending on the -specific system being simulated. - -UNDOCUMENTED - -U: OMP_NUM_THREADS environment is not set. - -This environment variable must be set appropriately to use the -OPENMP package. - -*/ diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index c2ff19ec74..b4a0cddda8 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "atom_vec.h" +#include "bond.h" #include "compute.h" #include "domain.h" #include "dump.h" @@ -490,8 +491,7 @@ void CommBrick::setup() return how many procs away are needed to encompass cutghost away from loc ------------------------------------------------------------------------- */ -int CommBrick::updown(int dim, int dir, int loc, - double prd, int periodicity, double *split) +int CommBrick::updown(int dim, int dir, int loc, double prd, int periodicity, double *split) { int index,count; double frac,delta; @@ -552,19 +552,15 @@ void CommBrick::forward_comm(int /*dummy*/) if (comm_x_only) { if (size_forward_recv[iswap]) { buf = x[firstrecv[iswap]]; - MPI_Irecv(buf,size_forward_recv[iswap],MPI_DOUBLE, - recvproc[iswap],0,world,&request); + MPI_Irecv(buf,size_forward_recv[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); } - n = avec->pack_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = avec->pack_comm(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); if (n) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (size_forward_recv[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); } else if (ghost_velocity) { if (size_forward_recv[iswap]) - MPI_Irecv(buf_recv,size_forward_recv[iswap],MPI_DOUBLE, - recvproc[iswap],0,world,&request); - n = avec->pack_comm_vel(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + MPI_Irecv(buf_recv,size_forward_recv[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); + n = avec->pack_comm_vel(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); if (n) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (size_forward_recv[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); avec->unpack_comm_vel(recvnum[iswap],firstrecv[iswap],buf_recv); @@ -572,8 +568,7 @@ void CommBrick::forward_comm(int /*dummy*/) if (size_forward_recv[iswap]) MPI_Irecv(buf_recv,size_forward_recv[iswap],MPI_DOUBLE, recvproc[iswap],0,world,&request); - n = avec->pack_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = avec->pack_comm(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); if (n) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (size_forward_recv[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); avec->unpack_comm(recvnum[iswap],firstrecv[iswap],buf_recv); @@ -585,12 +580,10 @@ void CommBrick::forward_comm(int /*dummy*/) avec->pack_comm(sendnum[iswap],sendlist[iswap], x[firstrecv[iswap]],pbc_flag[iswap],pbc[iswap]); } else if (ghost_velocity) { - avec->pack_comm_vel(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + avec->pack_comm_vel(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); avec->unpack_comm_vel(recvnum[iswap],firstrecv[iswap],buf_send); } else { - avec->pack_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + avec->pack_comm(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); avec->unpack_comm(recvnum[iswap],firstrecv[iswap],buf_send); } } @@ -618,18 +611,15 @@ void CommBrick::reverse_comm() if (sendproc[iswap] != me) { if (comm_f_only) { if (size_reverse_recv[iswap]) - MPI_Irecv(buf_recv,size_reverse_recv[iswap],MPI_DOUBLE, - sendproc[iswap],0,world,&request); + MPI_Irecv(buf_recv,size_reverse_recv[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); if (size_reverse_send[iswap]) { buf = f[firstrecv[iswap]]; - MPI_Send(buf,size_reverse_send[iswap],MPI_DOUBLE, - recvproc[iswap],0,world); + MPI_Send(buf,size_reverse_send[iswap],MPI_DOUBLE,recvproc[iswap],0,world); } if (size_reverse_recv[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); } else { if (size_reverse_recv[iswap]) - MPI_Irecv(buf_recv,size_reverse_recv[iswap],MPI_DOUBLE, - sendproc[iswap],0,world,&request); + MPI_Irecv(buf_recv,size_reverse_recv[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); n = avec->pack_reverse(recvnum[iswap],firstrecv[iswap],buf_send); if (n) MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (size_reverse_recv[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -639,8 +629,7 @@ void CommBrick::reverse_comm() } else { if (comm_f_only) { if (sendnum[iswap]) - avec->unpack_reverse(sendnum[iswap],sendlist[iswap], - f[firstrecv[iswap]]); + avec->unpack_reverse(sendnum[iswap],sendlist[iswap],f[firstrecv[iswap]]); } else { avec->pack_reverse(recvnum[iswap],firstrecv[iswap],buf_send); avec->unpack_reverse(sendnum[iswap],sendlist[iswap],buf_send); @@ -733,25 +722,21 @@ void CommBrick::exchange() if (procgrid[dim] == 1) nrecv = 0; else { MPI_Sendrecv(&nsend,1,MPI_INT,procneigh[dim][0],0, - &nrecv1,1,MPI_INT,procneigh[dim][1],0,world, - MPI_STATUS_IGNORE); + &nrecv1,1,MPI_INT,procneigh[dim][1],0,world,MPI_STATUS_IGNORE); nrecv = nrecv1; if (procgrid[dim] > 2) { MPI_Sendrecv(&nsend,1,MPI_INT,procneigh[dim][1],0, - &nrecv2,1,MPI_INT,procneigh[dim][0],0,world, - MPI_STATUS_IGNORE); + &nrecv2,1,MPI_INT,procneigh[dim][0],0,world,MPI_STATUS_IGNORE); nrecv += nrecv2; } if (nrecv > maxrecv) grow_recv(nrecv); - MPI_Irecv(buf_recv,nrecv1,MPI_DOUBLE,procneigh[dim][1],0, - world,&request); + MPI_Irecv(buf_recv,nrecv1,MPI_DOUBLE,procneigh[dim][1],0,world,&request); MPI_Send(buf_send,nsend,MPI_DOUBLE,procneigh[dim][0],0,world); MPI_Wait(&request,MPI_STATUS_IGNORE); if (procgrid[dim] > 2) { - MPI_Irecv(&buf_recv[nrecv1],nrecv2,MPI_DOUBLE,procneigh[dim][0],0, - world,&request); + MPI_Irecv(&buf_recv[nrecv1],nrecv2,MPI_DOUBLE,procneigh[dim][0],0,world,&request); MPI_Send(buf_send,nsend,MPI_DOUBLE,procneigh[dim][1],0,world); MPI_Wait(&request,MPI_STATUS_IGNORE); } @@ -925,11 +910,9 @@ void CommBrick::borders() if (nsend*size_border > maxsend) grow_send(nsend*size_border,0); if (ghost_velocity) - n = avec->pack_border_vel(nsend,sendlist[iswap],buf_send, - pbc_flag[iswap],pbc[iswap]); + n = avec->pack_border_vel(nsend,sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); else - n = avec->pack_border(nsend,sendlist[iswap],buf_send, - pbc_flag[iswap],pbc[iswap]); + n = avec->pack_border(nsend,sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); // swap atoms with other proc // no MPI calls except SendRecv if nsend/nrecv = 0 @@ -938,8 +921,7 @@ void CommBrick::borders() if (sendproc[iswap] != me) { MPI_Sendrecv(&nsend,1,MPI_INT,sendproc[iswap],0, - &nrecv,1,MPI_INT,recvproc[iswap],0,world, - MPI_STATUS_IGNORE); + &nrecv,1,MPI_INT,recvproc[iswap],0,world,MPI_STATUS_IGNORE); if (nrecv*size_border > maxrecv) grow_recv(nrecv*size_border); if (nrecv) MPI_Irecv(buf_recv,nrecv*size_border,MPI_DOUBLE, recvproc[iswap],0,world,&request); @@ -1013,16 +995,14 @@ void CommBrick::forward_comm(Pair *pair) // pack buffer - n = pair->pack_forward_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = pair->pack_forward_comm(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); // exchange with another proc // if self, set recv buffer to send buffer if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE, - recvproc[iswap],0,world,&request); + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); if (sendnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1059,8 +1039,7 @@ void CommBrick::reverse_comm(Pair *pair) if (sendproc[iswap] != me) { if (sendnum[iswap]) - MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); if (recvnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1073,6 +1052,80 @@ void CommBrick::reverse_comm(Pair *pair) } } +/* ---------------------------------------------------------------------- + forward communication invoked by a Bond + nsize used only to set recv buffer limit +------------------------------------------------------------------------- */ + +void CommBrick::forward_comm(Bond *bond) +{ + int iswap,n; + double *buf; + MPI_Request request; + + int nsize = bond->comm_forward; + + for (iswap = 0; iswap < nswap; iswap++) { + + // pack buffer + + n = bond->pack_forward_comm(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); + + // exchange with another proc + // if self, set recv buffer to send buffer + + if (sendproc[iswap] != me) { + if (recvnum[iswap]) + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); + if (sendnum[iswap]) + MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); + if (recvnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); + buf = buf_recv; + } else buf = buf_send; + + // unpack buffer + + bond->unpack_forward_comm(recvnum[iswap],firstrecv[iswap],buf); + } +} + +/* ---------------------------------------------------------------------- + reverse communication invoked by a Bond + nsize used only to set recv buffer limit +------------------------------------------------------------------------- */ + +void CommBrick::reverse_comm(Bond *bond) +{ + int iswap,n; + double *buf; + MPI_Request request; + + int nsize = MAX(bond->comm_reverse,bond->comm_reverse_off); + + for (iswap = nswap-1; iswap >= 0; iswap--) { + + // pack buffer + + n = bond->pack_reverse_comm(recvnum[iswap],firstrecv[iswap],buf_send); + + // exchange with another proc + // if self, set recv buffer to send buffer + + if (sendproc[iswap] != me) { + if (sendnum[iswap]) + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); + if (recvnum[iswap]) + MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); + if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); + buf = buf_recv; + } else buf = buf_send; + + // unpack buffer + + bond->unpack_reverse_comm(sendnum[iswap],sendlist[iswap],buf); + } +} + /* ---------------------------------------------------------------------- forward communication invoked by a Fix size/nsize used only to set recv buffer limit @@ -1095,16 +1148,14 @@ void CommBrick::forward_comm(Fix *fix, int size) // pack buffer - n = fix->pack_forward_comm(sendnum[iswap],sendlist[iswap], - buf_send,pbc_flag[iswap],pbc[iswap]); + n = fix->pack_forward_comm(sendnum[iswap],sendlist[iswap],buf_send,pbc_flag[iswap],pbc[iswap]); // exchange with another proc // if self, set recv buffer to send buffer if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); if (sendnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1146,8 +1197,7 @@ void CommBrick::reverse_comm(Fix *fix, int size) if (sendproc[iswap] != me) { if (sendnum[iswap]) - MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); if (recvnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1185,13 +1235,11 @@ void CommBrick::reverse_comm_variable(Fix *fix) if (sendproc[iswap] != me) { MPI_Sendrecv(&nsend,1,MPI_INT,recvproc[iswap],0, - &nrecv,1,MPI_INT,sendproc[iswap],0,world, - MPI_STATUS_IGNORE); + &nrecv,1,MPI_INT,sendproc[iswap],0,world,MPI_STATUS_IGNORE); if (sendnum[iswap]) { if (nrecv > maxrecv) grow_recv(nrecv); - MPI_Irecv(buf_recv,maxrecv,MPI_DOUBLE,sendproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,maxrecv,MPI_DOUBLE,sendproc[iswap],0,world,&request); } if (recvnum[iswap]) MPI_Send(buf_send,nsend,MPI_DOUBLE,recvproc[iswap],0,world); @@ -1230,8 +1278,7 @@ void CommBrick::forward_comm(Compute *compute) if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); if (sendnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1268,8 +1315,7 @@ void CommBrick::reverse_comm(Compute *compute) if (sendproc[iswap] != me) { if (sendnum[iswap]) - MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); if (recvnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1307,8 +1353,7 @@ void CommBrick::forward_comm(Dump *dump) if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); if (sendnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1345,8 +1390,7 @@ void CommBrick::reverse_comm(Dump *dump) if (sendproc[iswap] != me) { if (sendnum[iswap]) - MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world,&request); if (recvnum[iswap]) MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap],0,world); if (sendnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); @@ -1394,11 +1438,9 @@ void CommBrick::forward_comm_array(int nsize, double **array) if (sendproc[iswap] != me) { if (recvnum[iswap]) - MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0, - world,&request); + MPI_Irecv(buf_recv,nsize*recvnum[iswap],MPI_DOUBLE,recvproc[iswap],0,world,&request); if (sendnum[iswap]) - MPI_Send(buf_send,nsize*sendnum[iswap],MPI_DOUBLE, - sendproc[iswap],0,world); + MPI_Send(buf_send,nsize*sendnum[iswap],MPI_DOUBLE,sendproc[iswap],0,world); if (recvnum[iswap]) MPI_Wait(&request,MPI_STATUS_IGNORE); buf = buf_recv; } else buf = buf_send; @@ -1444,21 +1486,18 @@ int CommBrick::exchange_variable(int n, double *inbuf, double *&outbuf) nrecv += nrecv1; if (procgrid[dim] > 2) { MPI_Sendrecv(&nsend,1,MPI_INT,procneigh[dim][1],0, - &nrecv2,1,MPI_INT,procneigh[dim][0],0,world, - MPI_STATUS_IGNORE); + &nrecv2,1,MPI_INT,procneigh[dim][0],0,world,MPI_STATUS_IGNORE); nrecv += nrecv2; } else nrecv2 = 0; if (nrecv > maxrecv) grow_recv(nrecv); - MPI_Irecv(&buf_recv[nsend],nrecv1,MPI_DOUBLE,procneigh[dim][1],0, - world,&request); + MPI_Irecv(&buf_recv[nsend],nrecv1,MPI_DOUBLE,procneigh[dim][1],0,world,&request); MPI_Send(buf_recv,nsend,MPI_DOUBLE,procneigh[dim][0],0,world); MPI_Wait(&request,MPI_STATUS_IGNORE); if (procgrid[dim] > 2) { - MPI_Irecv(&buf_recv[nsend+nrecv1],nrecv2,MPI_DOUBLE,procneigh[dim][0],0, - world,&request); + MPI_Irecv(&buf_recv[nsend+nrecv1],nrecv2,MPI_DOUBLE,procneigh[dim][0],0,world,&request); MPI_Send(buf_recv,nsend,MPI_DOUBLE,procneigh[dim][1],0,world); MPI_Wait(&request,MPI_STATUS_IGNORE); } diff --git a/src/comm_brick.h b/src/comm_brick.h index c641ba7e7b..cbd08126b4 100644 --- a/src/comm_brick.h +++ b/src/comm_brick.h @@ -22,6 +22,7 @@ class CommBrick : public Comm { public: CommBrick(class LAMMPS *); CommBrick(class LAMMPS *, class Comm *); + ~CommBrick() override; void init() override; @@ -33,6 +34,8 @@ class CommBrick : public Comm { void forward_comm(class Pair *) override; // forward comm from a Pair void reverse_comm(class Pair *) override; // reverse comm from a Pair + void forward_comm(class Bond *) override; // forward comm from a Bond + void reverse_comm(class Bond *) override; // reverse comm from a Bond void forward_comm(class Fix *, int size = 0) override; // forward comm from a Fix void reverse_comm(class Fix *, int size = 0) override; // reverse comm from a Fix void reverse_comm_variable(class Fix *) override; // variable size reverse comm from a Fix @@ -95,11 +98,3 @@ class CommBrick : public Comm { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Cannot change to comm_style brick from tiled layout - -Self-explanatory. - -*/ diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index a7af454a8e..8088ada44b 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -21,6 +21,7 @@ #include "atom.h" #include "atom_vec.h" +#include "bond.h" #include "compute.h" #include "domain.h" #include "dump.h" @@ -512,16 +513,14 @@ void CommTiled::setup() MIN(sbox_multi[3+idim]+cutghostmulti[icollection][idim],subhi[idim]); else sbox_multi[3+idim] = - MIN(sbox_multi[3+idim]-prd[idim]+cutghostmulti[icollection][idim], - subhi[idim]); + MIN(sbox_multi[3+idim]-prd[idim]+cutghostmulti[icollection][idim],subhi[idim]); } else { if (i < noverlap1) sbox_multi[idim] = MAX(sbox_multi[idim]-cutghostmulti[icollection][idim],sublo[idim]); else sbox_multi[idim] = - MAX(sbox_multi[idim]+prd[idim]-cutghostmulti[icollection][idim], - sublo[idim]); + MAX(sbox_multi[idim]+prd[idim]-cutghostmulti[icollection][idim],sublo[idim]); sbox_multi[3+idim] = subhi[idim]; } @@ -588,16 +587,14 @@ void CommTiled::setup() MIN(sbox_multiold[3+idim]+cutghostmultiold[itype][idim],subhi[idim]); else sbox_multiold[3+idim] = - MIN(sbox_multiold[3+idim]-prd[idim]+cutghostmultiold[itype][idim], - subhi[idim]); + MIN(sbox_multiold[3+idim]-prd[idim]+cutghostmultiold[itype][idim],subhi[idim]); } else { if (i < noverlap1) sbox_multiold[idim] = MAX(sbox_multiold[idim]-cutghostmultiold[itype][idim],sublo[idim]); else sbox_multiold[idim] = - MAX(sbox_multiold[idim]+prd[idim]-cutghostmultiold[itype][idim], - sublo[idim]); + MAX(sbox_multiold[idim]+prd[idim]-cutghostmultiold[itype][idim],sublo[idim]); sbox_multiold[3+idim] = subhi[idim]; } @@ -747,8 +744,7 @@ void CommTiled::forward_comm(int /*dummy*/) } if (sendself[iswap]) { avec->pack_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - x[firstrecv[iswap][nrecv]],pbc_flag[iswap][nsend], - pbc[iswap][nsend]); + x[firstrecv[iswap][nrecv]],pbc_flag[iswap][nsend],pbc[iswap][nsend]); } if (recvother[iswap]) MPI_Waitall(nrecv,requests,MPI_STATUS_IGNORE); @@ -756,8 +752,7 @@ void CommTiled::forward_comm(int /*dummy*/) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[size_forward*forward_recv_offset[iswap][i]], - size_forward_recv[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + size_forward_recv[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { @@ -769,15 +764,13 @@ void CommTiled::forward_comm(int /*dummy*/) if (sendself[iswap]) { avec->pack_comm_vel(sendnum[iswap][nsend],sendlist[iswap][nsend], buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); - avec->unpack_comm_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + avec->unpack_comm_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); avec->unpack_comm_vel(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[size_forward* - forward_recv_offset[iswap][irecv]]); + &buf_recv[size_forward*forward_recv_offset[iswap][irecv]]); } } @@ -785,8 +778,7 @@ void CommTiled::forward_comm(int /*dummy*/) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[size_forward*forward_recv_offset[iswap][i]], - size_forward_recv[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + size_forward_recv[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { @@ -798,15 +790,13 @@ void CommTiled::forward_comm(int /*dummy*/) if (sendself[iswap]) { avec->pack_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); - avec->unpack_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + avec->unpack_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); avec->unpack_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[size_forward* - forward_recv_offset[iswap][irecv]]); + &buf_recv[size_forward*forward_recv_offset[iswap][irecv]]); } } } @@ -839,8 +829,7 @@ void CommTiled::reverse_comm() if (sendother[iswap]) { for (i = 0; i < nsend; i++) { MPI_Irecv(&buf_recv[size_reverse*reverse_recv_offset[iswap][i]], - size_reverse_recv[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world,&requests[i]); + size_reverse_recv[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); } } if (recvother[iswap]) { @@ -856,8 +845,7 @@ void CommTiled::reverse_comm() for (i = 0; i < nsend; i++) { MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); avec->unpack_reverse(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[size_reverse* - reverse_recv_offset[iswap][irecv]]); + &buf_recv[size_reverse*reverse_recv_offset[iswap][irecv]]); } } @@ -865,28 +853,23 @@ void CommTiled::reverse_comm() if (sendother[iswap]) { for (i = 0; i < nsend; i++) MPI_Irecv(&buf_recv[size_reverse*reverse_recv_offset[iswap][i]], - size_reverse_recv[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world,&requests[i]); + size_reverse_recv[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { - n = avec->pack_reverse(recvnum[iswap][i],firstrecv[iswap][i], - buf_send); + n = avec->pack_reverse(recvnum[iswap][i],firstrecv[iswap][i],buf_send); MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); } } if (sendself[iswap]) { - avec->pack_reverse(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); - avec->unpack_reverse(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send); + avec->pack_reverse(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + avec->unpack_reverse(sendnum[iswap][nsend],sendlist[iswap][nsend],buf_send); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); avec->unpack_reverse(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[size_reverse* - reverse_recv_offset[iswap][irecv]]); + &buf_recv[size_reverse*reverse_recv_offset[iswap][irecv]]); } } } @@ -989,8 +972,7 @@ void CommTiled::exchange() if (!nexch) continue; for (m = 0; m < nexch; m++) - MPI_Irecv(&exchnum[dim][m],1,MPI_INT, - exchproc[dim][m],0,world,&requests[m]); + MPI_Irecv(&exchnum[dim][m],1,MPI_INT,exchproc[dim][m],0,world,&requests[m]); for (m = 0; m < nexch; m++) MPI_Send(&nsend,1,MPI_INT,exchproc[dim][m],0,world); MPI_Waitall(nexch,requests,MPI_STATUS_IGNORE); @@ -1001,8 +983,7 @@ void CommTiled::exchange() offset = 0; for (m = 0; m < nexch; m++) { - MPI_Irecv(&buf_recv[offset],exchnum[dim][m], - MPI_DOUBLE,exchproc[dim][m],0,world,&requests[m]); + MPI_Irecv(&buf_recv[offset],exchnum[dim][m],MPI_DOUBLE,exchproc[dim][m],0,world,&requests[m]); offset += exchnum[dim][m]; } for (m = 0; m < nexch; m++) @@ -1233,8 +1214,7 @@ void CommTiled::borders() if (recvother[iswap]) for (m = 0; m < nrecv; m++) - MPI_Irecv(&recvnum[iswap][m],1,MPI_INT, - recvproc[iswap][m],0,world,&requests[m]); + MPI_Irecv(&recvnum[iswap][m],1,MPI_INT,recvproc[iswap][m],0,world,&requests[m]); if (sendother[iswap]) for (m = 0; m < nsend; m++) MPI_Send(&sendnum[iswap][m],1,MPI_INT,sendproc[iswap][m],0,world); @@ -1294,17 +1274,14 @@ void CommTiled::borders() } if (sendself[iswap]) { avec->pack_border_vel(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send,pbc_flag[iswap][nsend], - pbc[iswap][nsend]); - avec->unpack_border_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); + avec->unpack_border_vel(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&m,MPI_STATUS_IGNORE); avec->unpack_border_vel(recvnum[iswap][m],firstrecv[iswap][m], - &buf_recv[size_border* - forward_recv_offset[iswap][m]]); + &buf_recv[size_border*forward_recv_offset[iswap][m]]); } } @@ -1325,15 +1302,13 @@ void CommTiled::borders() if (sendself[iswap]) { avec->pack_border(sendnum[iswap][nsend],sendlist[iswap][nsend], buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); - avec->unpack_border(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + avec->unpack_border(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&m,MPI_STATUS_IGNORE); avec->unpack_border(recvnum[iswap][m],firstrecv[iswap][m], - &buf_recv[size_border* - forward_recv_offset[iswap][m]]); + &buf_recv[size_border*forward_recv_offset[iswap][m]]); } } } @@ -1351,10 +1326,8 @@ void CommTiled::borders() // For molecular systems we lose some bits for local atom indices due // to encoding of special pairs in neighbor lists. Check for overflows. - if ((atom->molecular != Atom::ATOMIC) - && ((atom->nlocal + atom->nghost) > NEIGHMASK)) - error->one(FLERR,"Per-processor number of atoms is too large for " - "molecular neighbor lists"); + if ((atom->molecular != Atom::ATOMIC) && ((atom->nlocal + atom->nghost) > NEIGHMASK)) + error->one(FLERR,"Per-processor number of atoms is too large for molecular neighbor lists"); // insure send/recv buffers are long enough for all forward & reverse comm // send buf is for one forward or reverse sends to one proc @@ -1388,8 +1361,7 @@ void CommTiled::forward_comm(Pair *pair) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], - nsize*recvnum[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + nsize*recvnum[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { @@ -1402,17 +1374,14 @@ void CommTiled::forward_comm(Pair *pair) if (sendself[iswap]) { pair->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send,pbc_flag[iswap][nsend], - pbc[iswap][nsend]); - pair->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); + pair->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); pair->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[nsize* - forward_recv_offset[iswap][irecv]]); + &buf_recv[nsize*forward_recv_offset[iswap][irecv]]); } } } @@ -1436,28 +1405,107 @@ void CommTiled::reverse_comm(Pair *pair) if (sendother[iswap]) { for (i = 0; i < nsend; i++) MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]], - nsize*sendnum[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world,&requests[i]); + nsize*sendnum[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { - n = pair->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i], - buf_send); + n = pair->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i],buf_send); MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); } } if (sendself[iswap]) { - pair->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); - pair->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send); + pair->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + pair->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],buf_send); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); pair->unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[nsize* - reverse_recv_offset[iswap][irecv]]); + &buf_recv[nsize*reverse_recv_offset[iswap][irecv]]); + } + } + } +} + +/* ---------------------------------------------------------------------- + forward communication invoked by a Bond + nsize used only to set recv buffer limit +------------------------------------------------------------------------- */ + +void CommTiled::forward_comm(Bond *bond) +{ + int i,irecv,n,nsend,nrecv; + + int nsize = bond->comm_forward; + + for (int iswap = 0; iswap < nswap; iswap++) { + nsend = nsendproc[iswap] - sendself[iswap]; + nrecv = nrecvproc[iswap] - sendself[iswap]; + + if (recvother[iswap]) { + for (i = 0; i < nrecv; i++) + MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], + nsize*recvnum[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + } + + if (sendother[iswap]) { + for (i = 0; i < nsend; i++) { + n = bond->pack_forward_comm(sendnum[iswap][i],sendlist[iswap][i], + buf_send,pbc_flag[iswap][i],pbc[iswap][i]); + MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][i],0,world); + } + } + + if (sendself[iswap]) { + bond->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], + buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); + bond->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + } + if (recvother[iswap]) { + for (i = 0; i < nrecv; i++) { + MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); + bond->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], + &buf_recv[nsize*forward_recv_offset[iswap][irecv]]); + } + } + } +} + +/* ---------------------------------------------------------------------- + reverse communication invoked by a Bond + nsize used only to set recv buffer limit +------------------------------------------------------------------------- */ + +void CommTiled::reverse_comm(Bond *bond) +{ + int i,irecv,n,nsend,nrecv; + + int nsize = MAX(bond->comm_reverse,bond->comm_reverse_off); + + for (int iswap = nswap-1; iswap >= 0; iswap--) { + nsend = nsendproc[iswap] - sendself[iswap]; + nrecv = nrecvproc[iswap] - sendself[iswap]; + + if (sendother[iswap]) { + for (i = 0; i < nsend; i++) + MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]], + nsize*sendnum[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); + } + if (recvother[iswap]) { + for (i = 0; i < nrecv; i++) { + n = bond->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i],buf_send); + MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); + } + } + if (sendself[iswap]) { + bond->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + bond->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],buf_send); + } + if (sendother[iswap]) { + for (i = 0; i < nsend; i++) { + MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); + bond->unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv], + &buf_recv[nsize*reverse_recv_offset[iswap][irecv]]); } } } @@ -1486,8 +1534,7 @@ void CommTiled::forward_comm(Fix *fix, int size) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], - nsize*recvnum[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + nsize*recvnum[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { @@ -1498,17 +1545,14 @@ void CommTiled::forward_comm(Fix *fix, int size) } if (sendself[iswap]) { fix->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send,pbc_flag[iswap][nsend], - pbc[iswap][nsend]); - fix->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); + buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); + fix->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); fix->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[nsize* - forward_recv_offset[iswap][irecv]]); + &buf_recv[nsize*forward_recv_offset[iswap][irecv]]); } } } @@ -1537,28 +1581,23 @@ void CommTiled::reverse_comm(Fix *fix, int size) if (sendother[iswap]) { for (i = 0; i < nsend; i++) MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]], - nsize*sendnum[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world,&requests[i]); + nsize*sendnum[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { - n = fix->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i], - buf_send); + n = fix->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i],buf_send); MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); } } if (sendself[iswap]) { - fix->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); - fix->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send); + fix->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + fix->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],buf_send); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); fix->unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[nsize* - reverse_recv_offset[iswap][irecv]]); + &buf_recv[nsize*reverse_recv_offset[iswap][irecv]]); } } } @@ -1594,31 +1633,26 @@ void CommTiled::forward_comm(Compute *compute) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], - nsize*recvnum[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + nsize*recvnum[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { n = compute->pack_forward_comm(sendnum[iswap][i],sendlist[iswap][i], - buf_send,pbc_flag[iswap][i], - pbc[iswap][i]); + buf_send,pbc_flag[iswap][i],pbc[iswap][i]); MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][i],0,world); } } if (sendself[iswap]) { compute->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send,pbc_flag[iswap][nsend], - pbc[iswap][nsend]); - compute->unpack_forward_comm(recvnum[iswap][nrecv], - firstrecv[iswap][nrecv],buf_send); + buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); + compute->unpack_forward_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); compute-> unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[nsize* - forward_recv_offset[iswap][irecv]]); + &buf_recv[nsize*forward_recv_offset[iswap][irecv]]); } } } @@ -1642,29 +1676,24 @@ void CommTiled::reverse_comm(Compute *compute) if (sendother[iswap]) { for (i = 0; i < nsend; i++) MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]], - nsize*sendnum[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world,&requests[i]); + nsize*sendnum[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { - n = compute->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i], - buf_send); + n = compute->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i],buf_send); MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); } } if (sendself[iswap]) { - compute->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); - compute->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send); + compute->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + compute->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],buf_send); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); compute-> unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[nsize* - reverse_recv_offset[iswap][irecv]]); + &buf_recv[nsize*reverse_recv_offset[iswap][irecv]]); } } } @@ -1688,21 +1717,18 @@ void CommTiled::forward_comm(Dump *dump) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], - nsize*recvnum[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + nsize*recvnum[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { n = dump->pack_forward_comm(sendnum[iswap][i],sendlist[iswap][i], - buf_send,pbc_flag[iswap][i], - pbc[iswap][i]); + buf_send,pbc_flag[iswap][i],pbc[iswap][i]); MPI_Send(buf_send,n,MPI_DOUBLE,sendproc[iswap][i],0,world); } } if (sendself[iswap]) { dump->pack_forward_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send,pbc_flag[iswap][nsend], - pbc[iswap][nsend]); + buf_send,pbc_flag[iswap][nsend],pbc[iswap][nsend]); dump->unpack_forward_comm(recvnum[iswap][nrecv], firstrecv[iswap][nrecv],buf_send); } @@ -1710,8 +1736,7 @@ void CommTiled::forward_comm(Dump *dump) for (i = 0; i < nrecv; i++) { MPI_Waitany(nrecv,requests,&irecv,MPI_STATUS_IGNORE); dump->unpack_forward_comm(recvnum[iswap][irecv],firstrecv[iswap][irecv], - &buf_recv[nsize* - forward_recv_offset[iswap][irecv]]); + &buf_recv[nsize*forward_recv_offset[iswap][irecv]]); } } } @@ -1735,28 +1760,23 @@ void CommTiled::reverse_comm(Dump *dump) if (sendother[iswap]) { for (i = 0; i < nsend; i++) MPI_Irecv(&buf_recv[nsize*reverse_recv_offset[iswap][i]], - nsize*sendnum[iswap][i],MPI_DOUBLE, - sendproc[iswap][i],0,world,&requests[i]); + nsize*sendnum[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world,&requests[i]); } if (recvother[iswap]) { for (i = 0; i < nrecv; i++) { - n = dump->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i], - buf_send); + n = dump->pack_reverse_comm(recvnum[iswap][i],firstrecv[iswap][i],buf_send); MPI_Send(buf_send,n,MPI_DOUBLE,recvproc[iswap][i],0,world); } } if (sendself[iswap]) { - dump->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv], - buf_send); - dump->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend], - buf_send); + dump->pack_reverse_comm(recvnum[iswap][nrecv],firstrecv[iswap][nrecv],buf_send); + dump->unpack_reverse_comm(sendnum[iswap][nsend],sendlist[iswap][nsend],buf_send); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { MPI_Waitany(nsend,requests,&irecv,MPI_STATUS_IGNORE); dump->unpack_reverse_comm(sendnum[iswap][irecv],sendlist[iswap][irecv], - &buf_recv[nsize* - reverse_recv_offset[iswap][irecv]]); + &buf_recv[nsize*reverse_recv_offset[iswap][irecv]]); } } } @@ -1788,8 +1808,7 @@ void CommTiled::forward_comm_array(int nsize, double **array) if (recvother[iswap]) { for (i = 0; i < nrecv; i++) MPI_Irecv(&buf_recv[nsize*forward_recv_offset[iswap][i]], - nsize*recvnum[iswap][i], - MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); + nsize*recvnum[iswap][i],MPI_DOUBLE,recvproc[iswap][i],0,world,&requests[i]); } if (sendother[iswap]) { for (i = 0; i < nsend; i++) { @@ -1799,8 +1818,7 @@ void CommTiled::forward_comm_array(int nsize, double **array) for (k = 0; k < nsize; k++) buf_send[m++] = array[j][k]; } - MPI_Send(buf_send,nsize*sendnum[iswap][i], - MPI_DOUBLE,sendproc[iswap][i],0,world); + MPI_Send(buf_send,nsize*sendnum[iswap][i],MPI_DOUBLE,sendproc[iswap][i],0,world); } } if (sendself[iswap]) { @@ -1919,8 +1937,7 @@ void CommTiled::box_drop_tiled(int /*idim*/, double *lo, double *hi, int &indexm box_drop_tiled_recurse(lo,hi,0,nprocs-1,indexme); } -void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, - int proclower, int procupper, +void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, int proclower, int procupper, int &indexme) { // end recursion when partition is a single proc @@ -1958,8 +1975,7 @@ void CommTiled::box_drop_tiled_recurse(double *lo, double *hi, return other box owned by proc as lo/hi corner pts ------------------------------------------------------------------------- */ -void CommTiled::box_other_brick(int idim, int idir, - int proc, double *lo, double *hi) +void CommTiled::box_other_brick(int idim, int idir, int proc, double *lo, double *hi) { lo[0] = sublo[0]; lo[1] = sublo[1]; lo[2] = sublo[2]; hi[0] = subhi[0]; hi[1] = subhi[1]; hi[2] = subhi[2]; @@ -2006,8 +2022,7 @@ void CommTiled::box_other_brick(int idim, int idir, return other box owned by proc as lo/hi corner pts ------------------------------------------------------------------------- */ -void CommTiled::box_other_tiled(int /*idim*/, int /*idir*/, - int proc, double *lo, double *hi) +void CommTiled::box_other_tiled(int /*idim*/, int /*idir*/, int proc, double *lo, double *hi) { double (*split)[2] = rcbinfo[proc].mysplit; @@ -2136,8 +2151,7 @@ int CommTiled::point_drop_tiled(int idim, double *x) recursive point drop thru RCB tree ------------------------------------------------------------------------- */ -int CommTiled::point_drop_tiled_recurse(double *x, - int proclower, int procupper) +int CommTiled::point_drop_tiled_recurse(double *x, int proclower, int procupper) { // end recursion when partition is a single proc // return proc @@ -2195,8 +2209,7 @@ void CommTiled::coord2proc_setup() memcpy(&rcbone.mysplit[0][0],&mysplit[0][0],6*sizeof(double)); rcbone.cutfrac = rcbcutfrac; rcbone.dim = rcbcutdim; - MPI_Allgather(&rcbone,sizeof(RCBinfo),MPI_CHAR, - rcbinfo,sizeof(RCBinfo),MPI_CHAR,world); + MPI_Allgather(&rcbone,sizeof(RCBinfo),MPI_CHAR,rcbinfo,sizeof(RCBinfo),MPI_CHAR,world); } /* ---------------------------------------------------------------------- diff --git a/src/comm_tiled.h b/src/comm_tiled.h index 270130844b..0339991331 100644 --- a/src/comm_tiled.h +++ b/src/comm_tiled.h @@ -22,6 +22,7 @@ class CommTiled : public Comm { public: CommTiled(class LAMMPS *); CommTiled(class LAMMPS *, class Comm *); + ~CommTiled() override; void init() override; @@ -33,6 +34,8 @@ class CommTiled : public Comm { void forward_comm(class Pair *) override; // forward comm from a Pair void reverse_comm(class Pair *) override; // reverse comm from a Pair + void forward_comm(class Bond *) override; // forward comm from a Bond + void reverse_comm(class Bond *) override; // reverse comm from a Bond void forward_comm(class Fix *, int size = 0) override; // forward comm from a Fix void reverse_comm(class Fix *, int size = 0) override; // reverse comm from a Fix void reverse_comm_variable(class Fix *) override; // variable size reverse comm from a Fix @@ -156,33 +159,3 @@ class CommTiled : public Comm { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Cannot yet use comm_style tiled with triclinic box - -Self-explanatory. - -E: Communication cutoff for comm_style tiled cannot exceed periodic box length - -Self-explanatory. - -E: Reverse comm fix variable not yet supported by CommTiled - -UNDOCUMENTED - -E: Comm tiled mis-match in box drop brick - -Internal error check in comm_style tiled which should not occur. -Contact the developers. - -E: Comm tiled invalid index in box drop brick - -Internal error check in comm_style tiled which should not occur. -Contact the developers. - -U: KOKKOS package does not yet support comm_style tiled - -Self-explanatory. - -*/ diff --git a/src/command.h b/src/command.h index f1e754325e..fb0d9dc415 100644 --- a/src/command.h +++ b/src/command.h @@ -14,7 +14,7 @@ #ifndef LMP_COMMAND_H #define LMP_COMMAND_H -#include "pointers.h" // IWYU pragma: keep +#include "pointers.h" // IWYU pragma: keep namespace LAMMPS_NS { diff --git a/src/compute.h b/src/compute.h index 3d6323b3d1..90b88c7d1d 100644 --- a/src/compute.h +++ b/src/compute.h @@ -108,7 +108,7 @@ class Compute : protected Pointers { Compute(class LAMMPS *, int, char **); ~Compute() override; void modify_params(int, char **); - void reset_extra_dof(); + virtual void reset_extra_dof(); virtual void init() = 0; virtual void init_list(int, class NeighList *) {} @@ -180,26 +180,3 @@ class Compute : protected Pointers { } // namespace LAMMPS_NS #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 must be alphanumeric or underscore characters - -Self-explanatory. - -E: Could not find compute group ID - -Self-explanatory. - -E: Compute does not allow an extra compute or fix to be reset - -This is an internal LAMMPS error. Please report it to the -developers. - -*/ diff --git a/src/compute_aggregate_atom.h b/src/compute_aggregate_atom.h index dc044c0b1a..253c1aa24b 100644 --- a/src/compute_aggregate_atom.h +++ b/src/compute_aggregate_atom.h @@ -48,37 +48,3 @@ class ComputeAggregateAtom : public Compute { #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 aggregate/atom used when bonds are not allowed - -UNDOCUMENTED - -E: Cannot use compute aggregate/atom unless atoms have IDs - -Atom IDs are used to identify aggregates. - -E: Compute aggregate/atom requires a bond style to be defined - -This is so that a bond list is generated which is used to find aggregates. - -E: Compute cluster/atom requires a pair style to be defined - -UNDOCUMENTED - -E: Compute cluster/atom cutoff is longer than pairwise cutoff - -UNDOCUMENTED - -W: More than one compute aggregate/atom - -It is not efficient to use compute aggregate/atom more than once. - -*/ diff --git a/src/compute_angle.cpp b/src/compute_angle.cpp index a7980c3885..e4db464f28 100644 --- a/src/compute_angle.cpp +++ b/src/compute_angle.cpp @@ -37,7 +37,7 @@ ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) : // check if bond style hybrid exists - angle = (AngleHybrid *) force->angle_match("hybrid"); + angle = dynamic_cast( force->angle_match("hybrid")); if (!angle) error->all(FLERR,"Angle style for compute angle command is not hybrid"); size_vector = nsub = angle->nstyles; @@ -60,7 +60,7 @@ void ComputeAngle::init() { // recheck angle style in case it has been changed - angle = (AngleHybrid *) force->angle_match("hybrid"); + angle = dynamic_cast( force->angle_match("hybrid")); if (!angle) error->all(FLERR,"Angle style for compute angle command is not hybrid"); if (angle->nstyles != nsub) diff --git a/src/compute_angle.h b/src/compute_angle.h index 62a5ea1fdf..fc5b8e21ce 100644 --- a/src/compute_angle.h +++ b/src/compute_angle.h @@ -41,35 +41,3 @@ class ComputeAngle : public Compute { #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: Angle style for compute angle command is not hybrid - -UNDOCUMENTED - -E: Angle style for compute angle command has changed - -UNDOCUMENTED - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -U: Compute bond must use group all - -Bond styles accumulate energy on all atoms. - -U: Unrecognized bond style in compute bond command - -Self-explanatory. - -*/ diff --git a/src/compute_angle_local.h b/src/compute_angle_local.h index bea7b0c682..c9d71c3ce6 100644 --- a/src/compute_angle_local.h +++ b/src/compute_angle_local.h @@ -52,25 +52,3 @@ class ComputeAngleLocal : public Compute { #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 angle/local used when angles are not allowed - -The atom style does not support angles. - -E: Invalid keyword in compute angle/local command - -Self-explanatory. - -E: No angle style is defined for compute angle/local - -Self-explanatory. - -*/ diff --git a/src/compute_angmom_chunk.cpp b/src/compute_angmom_chunk.cpp index 1351d379b7..226e0cd646 100644 --- a/src/compute_angmom_chunk.cpp +++ b/src/compute_angmom_chunk.cpp @@ -69,7 +69,7 @@ ComputeAngmomChunk::~ComputeAngmomChunk() void ComputeAngmomChunk::init() { - cchunk = (ComputeChunkAtom *) modify->get_compute_by_id(idchunk); + cchunk = dynamic_cast(modify->get_compute_by_id(idchunk)); if (!cchunk) error->all(FLERR, "Chunk/atom compute does not exist for compute angmom/chunk"); if (strcmp(cchunk->style, "chunk/atom") != 0) error->all(FLERR, "Compute angmom/chunk does not use chunk/atom compute"); @@ -187,7 +187,7 @@ void ComputeAngmomChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast(modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_angmom_chunk.h b/src/compute_angmom_chunk.h index f401b8abd0..ca8867dd45 100644 --- a/src/compute_angmom_chunk.h +++ b/src/compute_angmom_chunk.h @@ -55,21 +55,3 @@ class ComputeAngmomChunk : public Compute { #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: Chunk/atom compute does not exist for compute angmom/chunk - -Self-explanatory. - -E: Compute angmom/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_bond.cpp b/src/compute_bond.cpp index 90d451c9f8..38f15211e0 100644 --- a/src/compute_bond.cpp +++ b/src/compute_bond.cpp @@ -37,7 +37,7 @@ ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) : // check if bond style hybrid exists - bond = (BondHybrid *) force->bond_match("hybrid"); + bond = dynamic_cast( force->bond_match("hybrid")); if (!bond) error->all(FLERR,"Bond style for compute bond command is not hybrid"); size_vector = nsub = bond->nstyles; @@ -60,7 +60,7 @@ void ComputeBond::init() { // recheck bond style in case it has been changed - bond = (BondHybrid *) force->bond_match("hybrid"); + bond = dynamic_cast( force->bond_match("hybrid")); if (!bond) error->all(FLERR,"Bond style for compute bond command is not hybrid"); if (bond->nstyles != nsub) diff --git a/src/compute_bond.h b/src/compute_bond.h index 4981782972..51a6c1bc5f 100644 --- a/src/compute_bond.h +++ b/src/compute_bond.h @@ -41,35 +41,3 @@ class ComputeBond : public Compute { #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: Bond style for compute bond command is not hybrid - -UNDOCUMENTED - -E: Bond style for compute bond command has changed - -UNDOCUMENTED - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -U: Compute bond must use group all - -Bond styles accumulate energy on all atoms. - -U: Unrecognized bond style in compute bond command - -Self-explanatory. - -*/ diff --git a/src/compute_bond_local.h b/src/compute_bond_local.h index 0f028f05e8..0e52ba50ab 100644 --- a/src/compute_bond_local.h +++ b/src/compute_bond_local.h @@ -55,29 +55,3 @@ class ComputeBondLocal : public Compute { #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 bond/local used when bonds are not allowed - -The atom style does not support bonds. - -E: Invalid keyword in compute bond/local command - -Self-explanatory. - -E: No bond style is defined for compute bond/local - -Self-explanatory. - -E: Sanity check on 3 energy components failed - -UNDOCUMENTED - -*/ diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index 535720c575..446e306675 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -151,7 +151,7 @@ void ComputeCentroAtom::compute_peratom() int nhalf = nnn / 2; int npairs = nnn * (nnn - 1) / 2; - double *pairs = new double[npairs]; + auto pairs = new double[npairs]; // compute centro-symmetry parameter for each atom in group // use full neighbor list diff --git a/src/compute_centro_atom.h b/src/compute_centro_atom.h index 8eb1df696b..30e28b376a 100644 --- a/src/compute_centro_atom.h +++ b/src/compute_centro_atom.h @@ -49,34 +49,3 @@ class ComputeCentroAtom : public Compute { #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: Illegal compute centro/atom command3 - -UNDOCUMENTED - -E: Illegal compute centro/atom command2 - -UNDOCUMENTED - -E: Illegal compute centro/atom command1 - -UNDOCUMENTED - -E: Compute centro/atom requires a pair style be defined - -This is because the computation of the centro-symmetry values -uses a pairwise neighbor list. - -W: More than one compute centro/atom - -It is not efficient to use compute centro/atom more than once. - -*/ diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 4ad9a4467c..ee362927cf 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -162,7 +162,7 @@ void ComputeCentroidStressAtom::init() if (id_temp) { temperature = modify->get_compute_by_id(id_temp); if (!temperature) - error->all(FLERR, "Could not find compute centroid/stress/atom temperature ID {}",id_temp); + error->all(FLERR, "Could not find compute centroid/stress/atom temperature ID {}", id_temp); if (temperature->tempbias) biasflag = BIAS; else diff --git a/src/compute_centroid_stress_atom.h b/src/compute_centroid_stress_atom.h index 429d565419..16de7f3713 100644 --- a/src/compute_centroid_stress_atom.h +++ b/src/compute_centroid_stress_atom.h @@ -48,27 +48,3 @@ class ComputeCentroidStressAtom : public Compute { #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: Could not find compute centroid/stress/atom temperature ID - -Self-explanatory. - -E: Compute centroid/stress/atom temperature ID does not compute temperature - -The specified compute must compute temperature. - -E: Per-atom virial was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to have -tallied the virial, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index daa8fc64e7..b63ab23739 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -41,24 +40,23 @@ using namespace LAMMPS_NS; using namespace MathConst; -enum{LOWER,CENTER,UPPER,COORD}; -enum{BOX,LATTICE,REDUCED}; -enum{NODISCARD,MIXED,YESDISCARD}; -enum{ONCE,NFREQ,EVERY}; // used in several files -enum{LIMITMAX,LIMITEXACT}; +enum { LOWER, CENTER, UPPER, COORD }; +enum { BOX, LATTICE, REDUCED }; +enum { NODISCARD, MIXED, YESDISCARD }; +enum { ONCE, NFREQ, EVERY }; // used in several files +enum { LIMITMAX, LIMITEXACT }; -#define IDMAX 1024*1024 +#define IDMAX 1024 * 1024 /* ---------------------------------------------------------------------- */ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - chunk_volume_vec(nullptr), coord(nullptr), ichunk(nullptr), chunkID(nullptr), - cfvid(nullptr), idregion(nullptr), region(nullptr), cchunk(nullptr), fchunk(nullptr), - varatom(nullptr), id_fix(nullptr), fixstore(nullptr), lockfix(nullptr), chunk(nullptr), - exclude(nullptr), hash(nullptr) + Compute(lmp, narg, arg), chunk_volume_vec(nullptr), coord(nullptr), ichunk(nullptr), + chunkID(nullptr), cfvid(nullptr), idregion(nullptr), region(nullptr), cchunk(nullptr), + fchunk(nullptr), varatom(nullptr), id_fix(nullptr), fixstore(nullptr), lockfix(nullptr), + chunk(nullptr), exclude(nullptr), hash(nullptr) { - if (narg < 4) error->all(FLERR,"Illegal compute chunk/atom command"); + if (narg < 4) error->all(FLERR, "Illegal compute chunk/atom command"); peratom_flag = 1; scalar_flag = 1; @@ -72,52 +70,51 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : binflag = 0; ncoord = 0; - cfvid = nullptr; - if (strcmp(arg[3],"bin/1d") == 0) { + if (strcmp(arg[3], "bin/1d") == 0) { binflag = 1; which = ArgInfo::BIN1D; ncoord = 1; iarg = 4; - readdim(narg,arg,iarg,0); + readdim(narg, arg, iarg, 0); iarg += 3; - } else if (strcmp(arg[3],"bin/2d") == 0) { + } else if (strcmp(arg[3], "bin/2d") == 0) { binflag = 1; which = ArgInfo::BIN2D; ncoord = 2; iarg = 4; - readdim(narg,arg,iarg,0); - readdim(narg,arg,iarg+3,1); + readdim(narg, arg, iarg, 0); + readdim(narg, arg, iarg + 3, 1); iarg += 6; - } else if (strcmp(arg[3],"bin/3d") == 0) { + } else if (strcmp(arg[3], "bin/3d") == 0) { binflag = 1; which = ArgInfo::BIN3D; ncoord = 3; iarg = 4; - readdim(narg,arg,iarg,0); - readdim(narg,arg,iarg+3,1); - readdim(narg,arg,iarg+6,2); + readdim(narg, arg, iarg, 0); + readdim(narg, arg, iarg + 3, 1); + readdim(narg, arg, iarg + 6, 2); iarg += 9; - } else if (strcmp(arg[3],"bin/sphere") == 0) { + } else if (strcmp(arg[3], "bin/sphere") == 0) { binflag = 1; which = ArgInfo::BINSPHERE; ncoord = 1; iarg = 4; - if (iarg+6 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - 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); + if (iarg + 6 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + 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) { + } else if (strcmp(arg[3], "bin/cylinder") == 0) { binflag = 1; which = ArgInfo::BINCYLINDER; ncoord = 2; iarg = 4; - readdim(narg,arg,iarg,0); + readdim(narg, arg, iarg, 0); iarg += 3; if (dim[0] == 0) { cdim1 = 1; @@ -129,20 +126,20 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : cdim1 = 0; cdim2 = 1; } - if (iarg+5 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); + if (iarg + 5 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); corigin_user[dim[0]] = 0.0; - 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); + 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 = utils::inumeric(FLERR,arg[iarg+4],false,lmp); + ncbin = utils::inumeric(FLERR, arg[iarg + 4], false, lmp); iarg += 5; - } else if (strcmp(arg[3],"type") == 0) { + } else if (strcmp(arg[3], "type") == 0) { which = ArgInfo::TYPE; iarg = 4; - } else if (strcmp(arg[3],"molecule") == 0) { + } else if (strcmp(arg[3], "molecule") == 0) { which = ArgInfo::MOLECULE; iarg = 4; @@ -153,16 +150,14 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : argindex = argi.get_index1(); cfvid = argi.copy_name(); - if ((which == ArgInfo::UNKNOWN) || (which == ArgInfo::NONE) - || (argi.get_dim() > 1)) - error->all(FLERR,"Illegal compute chunk/atom command"); + if ((which == ArgInfo::UNKNOWN) || (which == ArgInfo::NONE) || (argi.get_dim() > 1)) + error->all(FLERR, "Illegal compute chunk/atom command"); iarg = 4; } // optional args regionflag = 0; - idregion = nullptr; nchunksetflag = 0; nchunkflag = EVERY; limit = 0; @@ -182,80 +177,105 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : pbcflag = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - int iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for compute chunk/atom does not exist"); - idregion = utils::strdup(arg[iarg+1]); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + if (!domain->get_region_by_id(arg[iarg + 1])) + error->all(FLERR, "Region {} for compute chunk/atom does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); regionflag = 1; iarg += 2; - } else if (strcmp(arg[iarg],"nchunk") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - if (strcmp(arg[iarg+1],"once") == 0) nchunkflag = ONCE; - else if (strcmp(arg[iarg+1],"every") == 0) nchunkflag = EVERY; - else error->all(FLERR,"Illegal compute chunk/atom command"); + } else if (strcmp(arg[iarg], "nchunk") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + if (strcmp(arg[iarg + 1], "once") == 0) + nchunkflag = ONCE; + else if (strcmp(arg[iarg + 1], "every") == 0) + nchunkflag = EVERY; + else + error->all(FLERR, "Illegal compute chunk/atom command"); nchunksetflag = 1; iarg += 2; - } else if (strcmp(arg[iarg],"limit") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - limit = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (limit < 0) error->all(FLERR,"Illegal compute chunk/atom command"); + } else if (strcmp(arg[iarg], "limit") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + 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; if (limit) { - if (iarg > narg) - error->all(FLERR,"Illegal compute chunk/atom command"); - if (strcmp(arg[iarg],"max") == 0) limitstyle = LIMITMAX; - else if (strcmp(arg[iarg],"exact") == 0) limitstyle = LIMITEXACT; - else error->all(FLERR,"Illegal compute chunk/atom command"); + if (iarg > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + if (strcmp(arg[iarg], "max") == 0) + limitstyle = LIMITMAX; + else if (strcmp(arg[iarg], "exact") == 0) + limitstyle = LIMITEXACT; + else + error->all(FLERR, "Illegal compute chunk/atom command"); iarg++; } - } else if (strcmp(arg[iarg],"ids") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - if (strcmp(arg[iarg+1],"once") == 0) idsflag = ONCE; - else if (strcmp(arg[iarg+1],"nfreq") == 0) idsflag = NFREQ; - else if (strcmp(arg[iarg+1],"every") == 0) idsflag = EVERY; - else error->all(FLERR,"Illegal compute chunk/atom command"); + } else if (strcmp(arg[iarg], "ids") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + if (strcmp(arg[iarg + 1], "once") == 0) + idsflag = ONCE; + else if (strcmp(arg[iarg + 1], "nfreq") == 0) + idsflag = NFREQ; + else if (strcmp(arg[iarg + 1], "every") == 0) + idsflag = EVERY; + else + error->all(FLERR, "Illegal compute chunk/atom command"); iarg += 2; - } else if (strcmp(arg[iarg],"compress") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - compress = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "compress") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + compress = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"discard") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - if (strcmp(arg[iarg+1],"mixed") == 0) discard = MIXED; - else if (strcmp(arg[iarg+1],"no") == 0) discard = NODISCARD; - else if (strcmp(arg[iarg+1],"yes") == 0) discard = YESDISCARD; - else error->all(FLERR,"Illegal compute chunk/atom command"); + } else if (strcmp(arg[iarg], "discard") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + if (strcmp(arg[iarg + 1], "mixed") == 0) + discard = MIXED; + else if (strcmp(arg[iarg + 1], "no") == 0) + discard = NODISCARD; + else if (strcmp(arg[iarg + 1], "yes") == 0) + discard = YESDISCARD; + else + error->all(FLERR, "Illegal compute chunk/atom command"); discardsetflag = 1; iarg += 2; - } else if (strcmp(arg[iarg],"bound") == 0) { - if (iarg+4 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); + } else if (strcmp(arg[iarg], "bound") == 0) { + if (iarg + 4 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); int idim = 0; - if (strcmp(arg[iarg+1],"x") == 0) idim = 0; - else if (strcmp(arg[iarg+1],"y") == 0) idim = 1; - else if (strcmp(arg[iarg+1],"z") == 0) idim = 2; - else error->all(FLERR,"Illegal compute chunk/atom command"); + if (strcmp(arg[iarg + 1], "x") == 0) + idim = 0; + else if (strcmp(arg[iarg + 1], "y") == 0) + idim = 1; + else if (strcmp(arg[iarg + 1], "z") == 0) + idim = 2; + else + error->all(FLERR, "Illegal compute chunk/atom command"); minflag[idim] = COORD; - if (strcmp(arg[iarg+2],"lower") == 0) minflag[idim] = LOWER; - else minvalue[idim] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (strcmp(arg[iarg + 2], "lower") == 0) + minflag[idim] = LOWER; + else + minvalue[idim] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); maxflag[idim] = COORD; - if (strcmp(arg[iarg+3],"upper") == 0) maxflag[idim] = UPPER; - else maxvalue[idim] = utils::numeric(FLERR,arg[iarg+3],false,lmp); + if (strcmp(arg[iarg + 3], "upper") == 0) + maxflag[idim] = UPPER; + else + maxvalue[idim] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); iarg += 4; - } else if (strcmp(arg[iarg],"units") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - if (strcmp(arg[iarg+1],"box") == 0) scaleflag = BOX; - else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = LATTICE; - else if (strcmp(arg[iarg+1],"reduced") == 0) scaleflag = REDUCED; - else error->all(FLERR,"Illegal compute chunk/atom command"); + } else if (strcmp(arg[iarg], "units") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + if (strcmp(arg[iarg + 1], "box") == 0) + scaleflag = BOX; + else if (strcmp(arg[iarg + 1], "lattice") == 0) + scaleflag = LATTICE; + else if (strcmp(arg[iarg + 1], "reduced") == 0) + scaleflag = REDUCED; + else + error->all(FLERR, "Illegal compute chunk/atom command"); iarg += 2; - } else if (strcmp(arg[iarg],"pbc") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal compute chunk/atom command"); - pbcflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "pbc") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal compute chunk/atom command"); + pbcflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal compute chunk/atom command"); + } else + error->all(FLERR, "Illegal compute chunk/atom command"); } // set nchunkflag and discard to default values if not explicitly set @@ -264,121 +284,126 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : if (!nchunksetflag) { if (binflag) { - if (scaleflag == REDUCED) nchunkflag = ONCE; - else nchunkflag = EVERY; + if (scaleflag == REDUCED) + nchunkflag = ONCE; + else + nchunkflag = EVERY; } if (which == ArgInfo::TYPE) nchunkflag = ONCE; if (which == ArgInfo::MOLECULE) { - if (regionflag) nchunkflag = EVERY; - else nchunkflag = ONCE; + if (regionflag) + nchunkflag = EVERY; + else + nchunkflag = ONCE; } if (compress) nchunkflag = EVERY; } if (!discardsetflag) { - if (binflag) discard = MIXED; - else discard = YESDISCARD; + if (binflag) + discard = MIXED; + else + discard = YESDISCARD; } // error checks if (which == ArgInfo::MOLECULE && !atom->molecule_flag) - error->all(FLERR,"Compute chunk/atom molecule for non-molecular system"); + error->all(FLERR, "Compute chunk/atom molecule for non-molecular system"); if (!binflag && discard == MIXED) - error->all(FLERR,"Compute chunk/atom without bins " + error->all(FLERR, + "Compute chunk/atom without bins " "cannot use discard mixed"); if (which == ArgInfo::BIN1D && delta[0] <= 0.0) - error->all(FLERR,"Illegal compute chunk/atom command"); + error->all(FLERR, "Illegal compute chunk/atom command"); if (which == ArgInfo::BIN2D && (delta[0] <= 0.0 || delta[1] <= 0.0)) - error->all(FLERR,"Illegal compute chunk/atom command"); + error->all(FLERR, "Illegal compute chunk/atom command"); if (which == ArgInfo::BIN2D && (dim[0] == dim[1])) - error->all(FLERR,"Illegal compute chunk/atom command"); - if (which == ArgInfo::BIN3D && - (delta[0] <= 0.0 || delta[1] <= 0.0 || delta[2] <= 0.0)) - error->all(FLERR,"Illegal compute chunk/atom command"); - if (which == ArgInfo::BIN3D && - (dim[0] == dim[1] || dim[1] == dim[2] || dim[0] == dim[2])) - error->all(FLERR,"Illegal compute chunk/atom command"); + error->all(FLERR, "Illegal compute chunk/atom command"); + if (which == ArgInfo::BIN3D && (delta[0] <= 0.0 || delta[1] <= 0.0 || delta[2] <= 0.0)) + error->all(FLERR, "Illegal compute chunk/atom command"); + if (which == ArgInfo::BIN3D && (dim[0] == dim[1] || dim[1] == dim[2] || dim[0] == dim[2])) + error->all(FLERR, "Illegal compute chunk/atom command"); if (which == ArgInfo::BINSPHERE) { if (domain->dimension == 2 && sorigin_user[2] != 0.0) - error->all(FLERR,"Compute chunk/atom sphere z origin must be 0.0 for 2d"); + error->all(FLERR, "Compute chunk/atom sphere z origin must be 0.0 for 2d"); if (sradmin_user < 0.0 || sradmin_user >= sradmax_user || nsbin < 1) - error->all(FLERR,"Illegal compute chunk/atom command"); + error->all(FLERR, "Illegal compute chunk/atom command"); } if (which == ArgInfo::BINCYLINDER) { - if (delta[0] <= 0.0) - error->all(FLERR,"Illegal compute chunk/atom command"); + if (delta[0] <= 0.0) error->all(FLERR, "Illegal compute chunk/atom command"); if (domain->dimension == 2 && dim[0] != 2) - error->all(FLERR,"Compute chunk/atom cylinder axis must be z for 2d"); + error->all(FLERR, "Compute chunk/atom cylinder axis must be z for 2d"); if (cradmin_user < 0.0 || cradmin_user >= cradmax_user || ncbin < 1) - error->all(FLERR,"Illegal compute chunk/atom command"); + error->all(FLERR, "Illegal compute chunk/atom command"); } if (which == ArgInfo::COMPUTE) { cchunk = modify->get_compute_by_id(cfvid); - if (!cchunk) - error->all(FLERR,"Compute ID {} for compute chunk /atom does not exist",cfvid); + if (!cchunk) error->all(FLERR, "Compute ID {} for compute chunk /atom does not exist", cfvid); if (cchunk->peratom_flag == 0) - error->all(FLERR,"Compute chunk/atom compute does not calculate per-atom values"); + error->all(FLERR, "Compute chunk/atom compute does not calculate per-atom values"); if ((argindex == 0) && (cchunk->size_peratom_cols != 0)) - error->all(FLERR,"Compute chunk/atom compute does not calculate a per-atom vector"); + error->all(FLERR, "Compute chunk/atom compute does not calculate a per-atom vector"); if (argindex && (cchunk->size_peratom_cols == 0)) - error->all(FLERR,"Compute chunk/atom compute does not calculate a per-atom array"); + error->all(FLERR, "Compute chunk/atom compute does not calculate a per-atom array"); if (argindex && argindex > cchunk->size_peratom_cols) - error->all(FLERR,"Compute chunk/atom compute array is accessed out-of-range"); + error->all(FLERR, "Compute chunk/atom compute array is accessed out-of-range"); } if (which == ArgInfo::FIX) { fchunk = modify->get_fix_by_id(cfvid); - if (!fchunk) - error->all(FLERR,"Fix ID {} for compute chunk/atom does not exist",cfvid); + if (!fchunk) error->all(FLERR, "Fix ID {} for compute chunk/atom does not exist", cfvid); if (fchunk->peratom_flag == 0) - error->all(FLERR,"Compute chunk/atom fix does not calculate per-atom values"); + error->all(FLERR, "Compute chunk/atom fix does not calculate per-atom values"); if (argindex == 0 && fchunk->size_peratom_cols != 0) - error->all(FLERR,"Compute chunk/atom fix does not calculate a per-atom vector"); + error->all(FLERR, "Compute chunk/atom fix does not calculate a per-atom vector"); if (argindex && fchunk->size_peratom_cols == 0) - error->all(FLERR,"Compute chunk/atom fix does not calculate a per-atom array"); + error->all(FLERR, "Compute chunk/atom fix does not calculate a per-atom array"); if (argindex && argindex > fchunk->size_peratom_cols) - error->all(FLERR,"Compute chunk/atom fix array is accessed out-of-range"); + error->all(FLERR, "Compute chunk/atom fix array is accessed out-of-range"); } if (which == ArgInfo::VARIABLE) { int ivariable = input->variable->find(cfvid); - if (ivariable < 0) - error->all(FLERR,"Variable name for compute chunk/atom does not exist"); + if (ivariable < 0) error->all(FLERR, "Variable name for compute chunk/atom does not exist"); if (input->variable->atomstyle(ivariable) == 0) - error->all(FLERR,"Compute chunk/atom variable is not atom-style variable"); + error->all(FLERR, "Compute chunk/atom variable is not atom-style variable"); } // setup scaling if (binflag) { if (domain->triclinic == 1 && scaleflag != REDUCED) - error->all(FLERR,"Compute chunk/atom for triclinic boxes requires units reduced"); + error->all(FLERR, "Compute chunk/atom for triclinic boxes requires units reduced"); } if (scaleflag == LATTICE) { xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; zscale = domain->lattice->zlattice; - } else xscale = yscale = zscale = 1.0; + } else + xscale = yscale = zscale = 1.0; // apply scaling factors and cylinder dims orthogonal to axis if (binflag) { double scale = 1.0; - if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D - || which == ArgInfo::BIN3D || which == ArgInfo::BINCYLINDER) { + if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D || which == ArgInfo::BIN3D || + which == ArgInfo::BINCYLINDER) { if (which == ArgInfo::BIN1D || which == ArgInfo::BINCYLINDER) ndim = 1; if (which == ArgInfo::BIN2D) ndim = 2; if (which == ArgInfo::BIN3D) ndim = 3; for (int idim = 0; idim < ndim; idim++) { - if (dim[idim] == 0) scale = xscale; - else if (dim[idim] == 1) scale = yscale; - else if (dim[idim] == 2) scale = zscale; + if (dim[idim] == 0) + scale = xscale; + else if (dim[idim] == 1) + scale = yscale; + else if (dim[idim] == 2) + scale = zscale; delta[idim] *= scale; - invdelta[idim] = 1.0/delta[idim]; + invdelta[idim] = 1.0 / delta[idim]; if (originflag[idim] == COORD) origin[idim] *= scale; if (minflag[idim] == COORD) minvalue[idim] *= scale; if (maxflag[idim] == COORD) maxvalue[idim] *= scale; @@ -387,13 +412,13 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : sorigin_user[0] *= xscale; sorigin_user[1] *= yscale; sorigin_user[2] *= zscale; - sradmin_user *= xscale; // radii are scaled by xscale + sradmin_user *= xscale; // radii are scaled by xscale sradmax_user *= xscale; } else if (which == ArgInfo::BINCYLINDER) { if (dim[0] == 0) { corigin_user[cdim1] *= yscale; corigin_user[cdim2] *= zscale; - cradmin_user *= yscale; // radii are scaled by first non-axis dim + cradmin_user *= yscale; // radii are scaled by first non-axis dim cradmax_user *= yscale; } else if (dim[0] == 1) { corigin_user[cdim1] *= xscale; @@ -426,8 +451,10 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // computeflag = 1 if this compute might invoke another compute // during assign_chunk_ids() - if (which == ArgInfo::COMPUTE || which == ArgInfo::FIX || which == ArgInfo::VARIABLE) computeflag = 1; - else computeflag = 0; + if (which == ArgInfo::COMPUTE || which == ArgInfo::FIX || which == ArgInfo::VARIABLE) + computeflag = 1; + else + computeflag = 0; // other initializations @@ -437,8 +464,10 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : id_fix = nullptr; fixstore = nullptr; - if (compress) hash = new std::map(); - else hash = nullptr; + if (compress) + hash = new std::map(); + else + hash = nullptr; maxvar = 0; varatom = nullptr; @@ -446,8 +475,10 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : lockcount = 0; lockfix = nullptr; - if (which == ArgInfo::MOLECULE) molcheck = 1; - else molcheck = 0; + if (which == ArgInfo::MOLECULE) + molcheck = 1; + else + molcheck = 0; } /* ---------------------------------------------------------------------- */ @@ -457,7 +488,7 @@ ComputeChunkAtom::~ComputeChunkAtom() // check nfix in case all fixes have already been deleted if (id_fix && modify->nfix) modify->delete_fix(id_fix); - delete [] id_fix; + delete[] id_fix; memory->destroy(chunk); memory->destroy(ichunk); @@ -466,8 +497,8 @@ ComputeChunkAtom::~ComputeChunkAtom() memory->destroy(coord); memory->destroy(chunkID); - delete [] idregion; - delete [] cfvid; + delete[] idregion; + delete[] cfvid; delete hash; memory->destroy(varatom); @@ -480,26 +511,21 @@ void ComputeChunkAtom::init() // set and check validity of region if (regionflag) { - int iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for compute chunk/atom does not exist"); - region = domain->regions[iregion]; + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for compute chunk/atom does not exist", idregion); } // set compute,fix,variable if (which == ArgInfo::COMPUTE) { cchunk = modify->get_compute_by_id(cfvid); - if (!cchunk) - error->all(FLERR,"Compute ID {} for compute chunk/atom does not exist",cfvid); + if (!cchunk) error->all(FLERR, "Compute ID {} for compute chunk/atom does not exist", cfvid); } else if (which == ArgInfo::FIX) { fchunk = modify->get_fix_by_id(cfvid); - if (!fchunk) - error->all(FLERR,"Fix ID {} for compute chunk/atom does not exist",cfvid); + if (!fchunk) error->all(FLERR, "Fix ID {} for compute chunk/atom does not exist", cfvid); } else if (which == ArgInfo::VARIABLE) { int ivariable = input->variable->find(cfvid); - if (ivariable < 0) - error->all(FLERR,"Variable name for compute chunk/atom does not exist"); + if (ivariable < 0) error->all(FLERR, "Variable name for compute chunk/atom does not exist"); vchunk = ivariable; } @@ -513,9 +539,8 @@ void ComputeChunkAtom::init() for (int i = 0; i < nlocal; i++) if (molecule[i] > maxone) maxone = molecule[i]; tagint maxall; - MPI_Allreduce(&maxone,&maxall,1,MPI_LMP_TAGINT,MPI_MAX,world); - if (maxall > MAXSMALLINT) - error->all(FLERR,"Molecule IDs too large for compute chunk/atom"); + MPI_Allreduce(&maxone, &maxall, 1, MPI_LMP_TAGINT, MPI_MAX, world); + if (maxall > MAXSMALLINT) error->all(FLERR, "Molecule IDs too large for compute chunk/atom"); } // for binning, if nchunkflag not already set, set it to ONCE or EVERY @@ -526,7 +551,8 @@ void ComputeChunkAtom::init() if (domain->box_change_size == 0) { if (nchunkflag == EVERY && invoked_setup >= 0) invoked_setup = -1; nchunkflag = ONCE; - } else nchunkflag = EVERY; + } else + nchunkflag = EVERY; } // require nchunkflag = ONCE if idsflag = ONCE @@ -534,7 +560,7 @@ void ComputeChunkAtom::init() // can't check until now since nchunkflag may have been adjusted in init() if (idsflag == ONCE && nchunkflag != ONCE) - error->all(FLERR,"Compute chunk/atom ids once but nchunk is not once"); + error->all(FLERR, "Compute chunk/atom ids once but nchunk is not once"); // create/destroy fix STORE for persistent chunk IDs as needed // need to do this if idsflag = ONCE or locks will be used by other commands @@ -545,8 +571,8 @@ void ComputeChunkAtom::init() if ((idsflag == ONCE || lockcount) && !fixstore) { id_fix = utils::strdup(id + std::string("_COMPUTE_STORE")); - fixstore = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 1", - id_fix, group->names[igroup])); + fixstore = dynamic_cast( + modify->add_fix(fmt::format("{} {} STORE peratom 1 1", id_fix, group->names[igroup]))); } if ((idsflag != ONCE && !lockcount) && fixstore) { @@ -564,8 +590,10 @@ void ComputeChunkAtom::init() void ComputeChunkAtom::setup() { if (nchunkflag == ONCE) setup_chunks(); - if (idsflag == ONCE) compute_ichunk(); - else invoked_ichunk = -1; + if (idsflag == ONCE) + compute_ichunk(); + else + invoked_ichunk = -1; } /* ---------------------------------------------------------------------- @@ -584,7 +612,7 @@ void ComputeChunkAtom::compute_peratom() if (atom->nmax > nmax) { memory->destroy(chunk); nmax = atom->nmax; - memory->create(chunk,nmax,"chunk/atom:chunk"); + memory->create(chunk, nmax, "chunk/atom:chunk"); vector_atom = chunk; } @@ -597,15 +625,13 @@ void ComputeChunkAtom::compute_peratom() for (int i = 0; i < nlocal; i++) chunk[i] = ichunk[i]; } - /* ---------------------------------------------------------------------- to return the number of chunks, we first need to make certain that compute_peratom() has been called. ------------------------------------------------------------------------- */ double ComputeChunkAtom::compute_scalar() { - if (invoked_peratom != update->ntimestep) - compute_peratom(); + if (invoked_peratom != update->ntimestep) compute_peratom(); invoked_scalar = update->ntimestep; return (scalar = nchunk); @@ -631,7 +657,8 @@ void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) } if (startstep != lockstart || stopstep != lockstop) - error->all(FLERR,"Two fix commands using " + error->all(FLERR, + "Two fix commands using " "same compute chunk/atom command in incompatible ways"); // set lock to last calling Fix, since it will be last to unlock() @@ -675,7 +702,7 @@ void ComputeChunkAtom::compute_ichunk() if (restore) { invoked_ichunk = update->ntimestep; double *vstore = fixstore->vstore; - for (i = 0; i < nlocal; i++) ichunk[i] = static_cast (vstore[i]); + for (i = 0; i < nlocal; i++) ichunk[i] = static_cast(vstore[i]); return; } @@ -695,30 +722,37 @@ void ComputeChunkAtom::compute_ichunk() if (binflag) { for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - if (hash->find(ichunk[i]) == hash->end()) exclude[i] = 1; - else ichunk[i] = hash->find(ichunk[i])->second; + if (hash->find(ichunk[i]) == hash->end()) + exclude[i] = 1; + else + ichunk[i] = hash->find(ichunk[i])->second; } } else if (discard == NODISCARD) { for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - if (hash->find(ichunk[i]) == hash->end()) ichunk[i] = nchunk; - else ichunk[i] = hash->find(ichunk[i])->second; + if (hash->find(ichunk[i]) == hash->end()) + ichunk[i] = nchunk; + else + ichunk[i] = hash->find(ichunk[i])->second; } } else { for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - if (hash->find(ichunk[i]) == hash->end()) exclude[i] = 1; - else ichunk[i] = hash->find(ichunk[i])->second; + if (hash->find(ichunk[i]) == hash->end()) + exclude[i] = 1; + else + ichunk[i] = hash->find(ichunk[i])->second; } } - // else if no compression apply discard rule by itself + // else if no compression apply discard rule by itself } else { if (discard == NODISCARD) { for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - if (ichunk[i] < 1 || ichunk[i] > nchunk) ichunk[i] = nchunk;; + if (ichunk[i] < 1 || ichunk[i] > nchunk) ichunk[i] = nchunk; + ; } } else { for (i = 0; i < nlocal; i++) { @@ -776,8 +810,7 @@ int ComputeChunkAtom::setup_chunks() if (nchunkflag == ONCE && invoked_setup >= 0) flag = 1; if (flag) { - if (binflag && scaleflag == REDUCED && domain->box_change_size) - bin_volumes(); + if (binflag && scaleflag == REDUCED && domain->box_change_size) bin_volumes(); return nchunk; } @@ -790,11 +823,12 @@ int ComputeChunkAtom::setup_chunks() // IDs are needed to scan for max ID and for compress() if (binflag) { - if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D - || which == ArgInfo::BIN3D) + if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D || which == ArgInfo::BIN3D) nchunk = setup_xyz_bins(); - else if (which == ArgInfo::BINSPHERE) nchunk = setup_sphere_bins(); - else if (which == ArgInfo::BINCYLINDER) nchunk = setup_cylinder_bins(); + else if (which == ArgInfo::BINSPHERE) + nchunk = setup_sphere_bins(); + else if (which == ArgInfo::BINCYLINDER) + nchunk = setup_cylinder_bins(); bin_volumes(); } else { chunk_volume_scalar = domain->xprd * domain->yprd; @@ -806,7 +840,8 @@ int ComputeChunkAtom::setup_chunks() // set nchunk for chunk styles other than binning // for styles other than TYPE, scan for max ID - if (which == ArgInfo::TYPE) nchunk = atom->ntypes; + if (which == ArgInfo::TYPE) + nchunk = atom->ntypes; else if (!binflag) { int nlocal = atom->nlocal; @@ -816,7 +851,7 @@ int ComputeChunkAtom::setup_chunks() if (ichunk[i] > hi) hi = ichunk[i]; } - MPI_Allreduce(&hi,&nchunk,1,MPI_INT,MPI_MAX,world); + MPI_Allreduce(&hi, &nchunk, 1, MPI_INT, MPI_MAX, world); if (nchunk <= 0) nchunk = 1; } @@ -826,18 +861,22 @@ int ComputeChunkAtom::setup_chunks() if (limit && !binflag) { if (!compress) { - if (limitstyle == LIMITMAX) nchunk = MIN(nchunk,limit); - else if (limitstyle == LIMITEXACT) nchunk = limit; + if (limitstyle == LIMITMAX) + nchunk = MIN(nchunk, limit); + else if (limitstyle == LIMITEXACT) + nchunk = limit; } else if (limitfirst) { - nchunk = MIN(nchunk,limit); + nchunk = MIN(nchunk, limit); } } if (compress) compress_chunk_ids(); if (limit && !binflag && compress) { - if (limitstyle == LIMITMAX) nchunk = MIN(nchunk,limit); - else if (limitstyle == LIMITEXACT) nchunk = limit; + if (limitstyle == LIMITMAX) + nchunk = MIN(nchunk, limit); + else if (limitstyle == LIMITEXACT) + nchunk = limit; } return nchunk; @@ -861,8 +900,8 @@ void ComputeChunkAtom::assign_chunk_ids() memory->destroy(ichunk); memory->destroy(exclude); nmaxint = atom->nmax; - memory->create(ichunk,nmaxint,"chunk/atom:ichunk"); - memory->create(exclude,nmaxint,"chunk/atom:exclude"); + memory->create(ichunk, nmaxint, "chunk/atom:ichunk"); + memory->create(exclude, nmaxint, "chunk/atom:exclude"); } // update region if necessary @@ -878,14 +917,17 @@ void ComputeChunkAtom::assign_chunk_ids() if (regionflag) { for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit && - region->match(x[i][0],x[i][1],x[i][2])) exclude[i] = 0; - else exclude[i] = 1; + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + exclude[i] = 0; + else + exclude[i] = 1; } } else { for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) exclude[i] = 0; - else exclude[i] = 1; + if (mask[i] & groupbit) + exclude[i] = 0; + else + exclude[i] = 1; } } @@ -893,11 +935,16 @@ void ComputeChunkAtom::assign_chunk_ids() // binning styles apply discard rule, others do not yet if (binflag) { - if (which == ArgInfo::BIN1D) atom2bin1d(); - else if (which == ArgInfo::BIN2D) atom2bin2d(); - else if (which == ArgInfo::BIN3D) atom2bin3d(); - else if (which == ArgInfo::BINSPHERE) atom2binsphere(); - else if (which == ArgInfo::BINCYLINDER) atom2bincylinder(); + if (which == ArgInfo::BIN1D) + atom2bin1d(); + else if (which == ArgInfo::BIN2D) + atom2bin2d(); + else if (which == ArgInfo::BIN3D) + atom2bin3d(); + else if (which == ArgInfo::BINSPHERE) + atom2binsphere(); + else if (which == ArgInfo::BINCYLINDER) + atom2bincylinder(); } else if (which == ArgInfo::TYPE) { int *type = atom->type; @@ -910,7 +957,7 @@ void ComputeChunkAtom::assign_chunk_ids() tagint *molecule = atom->molecule; for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - ichunk[i] = static_cast (molecule[i]); + ichunk[i] = static_cast(molecule[i]); } } else if (which == ArgInfo::COMPUTE) { @@ -923,34 +970,35 @@ void ComputeChunkAtom::assign_chunk_ids() double *vec = cchunk->vector_atom; for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - ichunk[i] = static_cast (vec[i]); + ichunk[i] = static_cast(vec[i]); } } else { double **array = cchunk->array_atom; int argm1 = argindex - 1; for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - ichunk[i] = static_cast (array[i][argm1]); + ichunk[i] = static_cast(array[i][argm1]); } } } else if (which == ArgInfo::FIX) { if (update->ntimestep % fchunk->peratom_freq) - error->all(FLERR,"Fix used in compute chunk/atom not " + error->all(FLERR, + "Fix used in compute chunk/atom not " "computed at compatible time"); if (argindex == 0) { double *vec = fchunk->vector_atom; for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - ichunk[i] = static_cast (vec[i]); + ichunk[i] = static_cast(vec[i]); } } else { double **array = fchunk->array_atom; int argm1 = argindex - 1; for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - ichunk[i] = static_cast (array[i][argm1]); + ichunk[i] = static_cast(array[i][argm1]); } } @@ -958,13 +1006,13 @@ void ComputeChunkAtom::assign_chunk_ids() if (atom->nmax > maxvar) { maxvar = atom->nmax; memory->destroy(varatom); - memory->create(varatom,maxvar,"chunk/atom:varatom"); + memory->create(varatom, maxvar, "chunk/atom:varatom"); } - input->variable->compute_atom(vchunk,igroup,varatom,1,0); + input->variable->compute_atom(vchunk, igroup, varatom, 1, 0); for (i = 0; i < nlocal; i++) { if (exclude[i]) continue; - ichunk[i] = static_cast (varatom[i]); + ichunk[i] = static_cast(varatom[i]); } } } @@ -1001,17 +1049,16 @@ void ComputeChunkAtom::compress_chunk_ids() int n = hash->size(); bigint nbone = n; bigint nball; - MPI_Allreduce(&nbone,&nball,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nbone, &nball, 1, MPI_LMP_BIGINT, MPI_SUM, world); // create my list of populated IDs int *list = nullptr; - memory->create(list,n,"chunk/atom:list"); + memory->create(list, n, "chunk/atom:list"); n = 0; - std::map::iterator pos; - for (pos = hash->begin(); pos != hash->end(); ++pos) - list[n++] = pos->first; + std::map::iterator pos; + for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; // if nall < 1M, just allgather all ID lists on every proc // else perform ring comm @@ -1023,20 +1070,20 @@ void ComputeChunkAtom::compress_chunk_ids() int nprocs = comm->nprocs; int nall = nball; - int *recvcounts,*displs,*listall; - memory->create(recvcounts,nprocs,"chunk/atom:recvcounts"); - memory->create(displs,nprocs,"chunk/atom:displs"); - memory->create(listall,nall,"chunk/atom:listall"); + int *recvcounts, *displs, *listall; + memory->create(recvcounts, nprocs, "chunk/atom:recvcounts"); + memory->create(displs, nprocs, "chunk/atom:displs"); + memory->create(listall, nall, "chunk/atom:listall"); - MPI_Allgather(&n,1,MPI_INT,recvcounts,1,MPI_INT,world); + MPI_Allgather(&n, 1, MPI_INT, recvcounts, 1, MPI_INT, world); displs[0] = 0; for (int iproc = 1; iproc < nprocs; iproc++) - displs[iproc] = displs[iproc-1] + recvcounts[iproc-1]; + displs[iproc] = displs[iproc - 1] + recvcounts[iproc - 1]; // allgatherv acquires list of populated IDs from all procs - MPI_Allgatherv(list,n,MPI_INT,listall,recvcounts,displs,MPI_INT,world); + MPI_Allgatherv(list, n, MPI_INT, listall, recvcounts, displs, MPI_INT, world); // add all unique IDs in listall to my hash @@ -1050,7 +1097,7 @@ void ComputeChunkAtom::compress_chunk_ids() memory->destroy(listall); } else { - comm->ring(n,sizeof(int),list,1,idring,nullptr,(void *)this,0); + comm->ring(n, sizeof(int), list, 1, idring, nullptr, (void *) this, 0); } memory->destroy(list); @@ -1066,7 +1113,7 @@ void ComputeChunkAtom::compress_chunk_ids() // used by fix ave/chunk and compute property/chunk memory->destroy(chunkID); - memory->create(chunkID,nchunk,"chunk/atom:chunkID"); + memory->create(chunkID, nchunk, "chunk/atom:chunkID"); n = 0; for (pos = hash->begin(); pos != hash->end(); ++pos) { @@ -1084,9 +1131,9 @@ void ComputeChunkAtom::compress_chunk_ids() void ComputeChunkAtom::idring(int n, char *cbuf, void *ptr) { - ComputeChunkAtom *cptr = (ComputeChunkAtom *)ptr; - tagint *list = (tagint *) cbuf; - std::map *hash = cptr->hash; + auto cptr = (ComputeChunkAtom *) ptr; + auto list = (tagint *) cbuf; + std::map *hash = cptr->hash; for (int i = 0; i < n; i++) (*hash)[list[i]] = 0; } @@ -1109,22 +1156,20 @@ void ComputeChunkAtom::check_molecules() if (!compress) { for (int i = 0; i < nlocal; i++) { - if (molecule[i] > 0 && molecule[i] <= nchunk && - ichunk[i] == 0) flag = 1; + if (molecule[i] > 0 && molecule[i] <= nchunk && ichunk[i] == 0) flag = 1; } } else { int molid; for (int i = 0; i < nlocal; i++) { - molid = static_cast (molecule[i]); + molid = static_cast(molecule[i]); if (hash->find(molid) != hash->end() && ichunk[i] == 0) flag = 1; } } int flagall; - MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); if (flagall && comm->me == 0) - error->warning(FLERR, - "One or more chunks do not contain all atoms in molecule"); + error->warning(FLERR, "One or more chunks do not contain all atoms in molecule"); } /* ---------------------------------------------------------------------- @@ -1135,14 +1180,14 @@ void ComputeChunkAtom::check_molecules() int ComputeChunkAtom::setup_xyz_bins() { - int i,j,k,m,n,idim; - double lo,hi,coord1,coord2; + int i, j, k, m, n, idim; + double lo, hi, coord1, coord2; // lo = bin boundary immediately below boxlo or minvalue // hi = bin boundary immediately above boxhi or maxvalue // allocate and initialize arrays based on new bin count - double binlo[3],binhi[3]; + double binlo[3], binhi[3]; if (scaleflag == REDUCED) { binlo[0] = domain->boxlo_lamda[0]; binlo[1] = domain->boxlo_lamda[1]; @@ -1170,63 +1215,64 @@ int ComputeChunkAtom::setup_xyz_bins() for (m = 0; m < ndim; m++) { idim = dim[m]; - if (originflag[m] == LOWER) origin[m] = binlo[idim]; - else if (originflag[m] == UPPER) origin[m] = binhi[idim]; + if (originflag[m] == LOWER) + origin[m] = binlo[idim]; + else if (originflag[m] == UPPER) + origin[m] = binhi[idim]; else if (originflag[m] == CENTER) origin[m] = 0.5 * (binlo[idim] + binhi[idim]); if (origin[m] < binlo[idim]) { - n = static_cast ((binlo[idim] - origin[m]) * invdelta[m]); - lo = origin[m] + n*delta[m]; + n = static_cast((binlo[idim] - origin[m]) * invdelta[m]); + lo = origin[m] + n * delta[m]; } else { - n = static_cast ((origin[m] - binlo[idim]) * invdelta[m]); - lo = origin[m] - n*delta[m]; + n = static_cast((origin[m] - binlo[idim]) * invdelta[m]); + lo = origin[m] - n * delta[m]; if (lo > binlo[idim]) lo -= delta[m]; } if (origin[m] < binhi[idim]) { - n = static_cast ((binhi[idim] - origin[m]) * invdelta[m]); - hi = origin[m] + n*delta[m]; + n = static_cast((binhi[idim] - origin[m]) * invdelta[m]); + hi = origin[m] + n * delta[m]; if (hi < binhi[idim]) hi += delta[m]; } else { - n = static_cast ((origin[m] - binhi[idim]) * invdelta[m]); - hi = origin[m] - n*delta[m]; + n = static_cast((origin[m] - binhi[idim]) * invdelta[m]); + hi = origin[m] - n * delta[m]; } - if (lo > hi) error->all(FLERR,"Invalid bin bounds in compute chunk/atom"); + if (lo > hi) error->all(FLERR, "Invalid bin bounds in compute chunk/atom"); offset[m] = lo; - nlayers[m] = static_cast ((hi-lo) * invdelta[m] + 0.5); + nlayers[m] = static_cast((hi - lo) * invdelta[m] + 0.5); nbins *= nlayers[m]; } // allocate and set bin coordinates memory->destroy(coord); - memory->create(coord,nbins,ndim,"chunk/atom:coord"); + memory->create(coord, nbins, ndim, "chunk/atom:coord"); if (ndim == 1) { - for (i = 0; i < nlayers[0]; i++) - coord[i][0] = offset[0] + (i+0.5)*delta[0]; + for (i = 0; i < nlayers[0]; i++) coord[i][0] = offset[0] + (i + 0.5) * delta[0]; } else if (ndim == 2) { m = 0; for (i = 0; i < nlayers[0]; i++) { - coord1 = offset[0] + (i+0.5)*delta[0]; + coord1 = offset[0] + (i + 0.5) * delta[0]; for (j = 0; j < nlayers[1]; j++) { coord[m][0] = coord1; - coord[m][1] = offset[1] + (j+0.5)*delta[1]; + coord[m][1] = offset[1] + (j + 0.5) * delta[1]; m++; } } } else if (ndim == 3) { m = 0; for (i = 0; i < nlayers[0]; i++) { - coord1 = offset[0] + (i+0.5)*delta[0]; + coord1 = offset[0] + (i + 0.5) * delta[0]; for (j = 0; j < nlayers[1]; j++) { - coord2 = offset[1] + (j+0.5)*delta[1]; + coord2 = offset[1] + (j + 0.5) * delta[1]; for (k = 0; k < nlayers[2]; k++) { coord[m][0] = coord1; coord[m][1] = coord2; - coord[m][2] = offset[2] + (k+0.5)*delta[2]; + coord[m][2] = offset[2] + (k + 0.5) * delta[2]; m++; } } @@ -1249,9 +1295,9 @@ int ComputeChunkAtom::setup_sphere_bins() // lamda2x works for either orthogonal or triclinic if (scaleflag == REDUCED) { - domain->lamda2x(sorigin_user,sorigin); - sradmin = sradmin_user * (domain->boxhi[0]-domain->boxlo[0]); - sradmax = sradmax_user * (domain->boxhi[0]-domain->boxlo[0]); + domain->lamda2x(sorigin_user, sorigin); + sradmin = sradmin_user * (domain->boxhi[0] - domain->boxlo[0]); + sradmax = sradmax_user * (domain->boxhi[0] - domain->boxlo[0]); } else { sorigin[0] = sorigin_user[0]; sorigin[1] = sorigin_user[1]; @@ -1270,28 +1316,28 @@ int ComputeChunkAtom::setup_sphere_bins() int flag = 0; if (periodicity[0] && sradmax > prd_half[0]) flag = 1; if (periodicity[1] && sradmax > prd_half[1]) flag = 1; - if (domain->dimension == 3 && - periodicity[2] && sradmax > prd_half[2]) flag = 1; + if (domain->dimension == 3 && periodicity[2] && sradmax > prd_half[2]) flag = 1; if (flag) - error->all(FLERR,"Compute chunk/atom bin/sphere radius " + error->all(FLERR, + "Compute chunk/atom bin/sphere radius " "is too large for periodic box"); } - sinvrad = nsbin / (sradmax-sradmin); + sinvrad = nsbin / (sradmax - sradmin); // allocate and set bin coordinates // coord = midpt of radii for a spherical shell memory->destroy(coord); - memory->create(coord,nsbin,1,"chunk/atom:coord"); + memory->create(coord, nsbin, 1, "chunk/atom:coord"); - double rlo,rhi; + double rlo, rhi; for (int i = 0; i < nsbin; i++) { - rlo = sradmin + i * (sradmax-sradmin) / nsbin; - rhi = sradmin + (i+1) * (sradmax-sradmin) / nsbin; - if (i == nsbin-1) rhi = sradmax; - coord[i][0] = 0.5 * (rlo+rhi); + rlo = sradmin + i * (sradmax - sradmin) / nsbin; + rhi = sradmin + (i + 1) * (sradmax - sradmin) / nsbin; + if (i == nsbin - 1) rhi = sradmax; + coord[i][0] = 0.5 * (rlo + rhi); } return nsbin; @@ -1315,9 +1361,9 @@ int ComputeChunkAtom::setup_cylinder_bins() // lamda2x works for either orthogonal or triclinic if (scaleflag == REDUCED) { - domain->lamda2x(corigin_user,corigin); - cradmin = cradmin_user * (domain->boxhi[cdim1]-domain->boxlo[cdim1]); - cradmax = cradmax_user * (domain->boxhi[cdim1]-domain->boxlo[cdim1]); + domain->lamda2x(corigin_user, corigin); + cradmin = cradmin_user * (domain->boxhi[cdim1] - domain->boxlo[cdim1]); + cradmax = cradmax_user * (domain->boxhi[cdim1] - domain->boxlo[cdim1]); } else { corigin[cdim1] = corigin_user[cdim1]; corigin[cdim2] = corigin_user[cdim2]; @@ -1336,11 +1382,12 @@ int ComputeChunkAtom::setup_cylinder_bins() if (periodicity[cdim1] && sradmax > prd_half[cdim1]) flag = 1; if (periodicity[cdim2] && sradmax > prd_half[cdim2]) flag = 1; if (flag) - error->all(FLERR,"Compute chunk/atom bin/cylinder radius " + error->all(FLERR, + "Compute chunk/atom bin/cylinder radius " "is too large for periodic box"); } - cinvrad = ncbin / (cradmax-cradmin); + cinvrad = ncbin / (cradmax - cradmin); // allocate and set radial bin coordinates // radial coord = midpt of radii for a cylindrical shell @@ -1348,21 +1395,21 @@ int ComputeChunkAtom::setup_cylinder_bins() // radcoord = saved bin coords in radial direction double **axiscoord = coord; - memory->create(coord,ncbin,1,"chunk/atom:coord"); + memory->create(coord, ncbin, 1, "chunk/atom:coord"); double **radcoord = coord; - double rlo,rhi; + double rlo, rhi; for (int i = 0; i < ncbin; i++) { - rlo = cradmin + i * (cradmax-cradmin) / ncbin; - rhi = cradmin + (i+1) * (cradmax-cradmin) / ncbin; - if (i == ncbin-1) rhi = cradmax; - coord[i][0] = 0.5 * (rlo+rhi); + rlo = cradmin + i * (cradmax - cradmin) / ncbin; + rhi = cradmin + (i + 1) * (cradmax - cradmin) / ncbin; + if (i == ncbin - 1) rhi = cradmax; + coord[i][0] = 0.5 * (rlo + rhi); } // create array of combined coords for all bins - memory->create(coord,ncbin*ncplane,2,"chunk/atom:coord"); + memory->create(coord, ncbin * ncplane, 2, "chunk/atom:coord"); int m = 0; for (int i = 0; i < ncbin; i++) for (int j = 0; j < ncplane; j++) { @@ -1373,7 +1420,7 @@ int ComputeChunkAtom::setup_cylinder_bins() memory->destroy(axiscoord); memory->destroy(radcoord); - return ncbin*ncplane; + return ncbin * ncplane; } /* ---------------------------------------------------------------------- @@ -1384,53 +1431,56 @@ int ComputeChunkAtom::setup_cylinder_bins() void ComputeChunkAtom::bin_volumes() { - if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D - || which == ArgInfo::BIN3D) { + if (which == ArgInfo::BIN1D || which == ArgInfo::BIN2D || which == ArgInfo::BIN3D) { if (domain->dimension == 3) chunk_volume_scalar = domain->xprd * domain->yprd * domain->zprd; - else chunk_volume_scalar = domain->xprd * domain->yprd; + else + chunk_volume_scalar = domain->xprd * domain->yprd; double *prd; - if (scaleflag == REDUCED) prd = domain->prd_lamda; - else prd = domain->prd; - for (int m = 0; m < ndim; m++) - chunk_volume_scalar *= delta[m]/prd[dim[m]]; + if (scaleflag == REDUCED) + prd = domain->prd_lamda; + else + prd = domain->prd; + for (int m = 0; m < ndim; m++) chunk_volume_scalar *= delta[m] / prd[dim[m]]; } else if (which == ArgInfo::BINSPHERE) { memory->destroy(chunk_volume_vec); - memory->create(chunk_volume_vec,nchunk,"chunk/atom:chunk_volume_vec"); - double rlo,rhi,vollo,volhi; + memory->create(chunk_volume_vec, nchunk, "chunk/atom:chunk_volume_vec"); + double rlo, rhi, vollo, volhi; for (int i = 0; i < nchunk; i++) { - rlo = sradmin + i * (sradmax-sradmin) / nsbin; - rhi = sradmin + (i+1) * (sradmax-sradmin) / nsbin; - if (i == nchunk-1) rhi = sradmax; - vollo = 4.0/3.0 * MY_PI * rlo*rlo*rlo; - volhi = 4.0/3.0 * MY_PI * rhi*rhi*rhi; + rlo = sradmin + i * (sradmax - sradmin) / nsbin; + rhi = sradmin + (i + 1) * (sradmax - sradmin) / nsbin; + if (i == nchunk - 1) rhi = sradmax; + vollo = 4.0 / 3.0 * MY_PI * rlo * rlo * rlo; + volhi = 4.0 / 3.0 * MY_PI * rhi * rhi * rhi; chunk_volume_vec[i] = volhi - vollo; } } else if (which == ArgInfo::BINCYLINDER) { memory->destroy(chunk_volume_vec); - memory->create(chunk_volume_vec,nchunk,"chunk/atom:chunk_volume_vec"); + memory->create(chunk_volume_vec, nchunk, "chunk/atom:chunk_volume_vec"); // slabthick = delta of bins along cylinder axis double *prd; - if (scaleflag == REDUCED) prd = domain->prd_lamda; - else prd = domain->prd; - double slabthick = domain->prd[dim[0]] * delta[0]/prd[dim[0]]; + if (scaleflag == REDUCED) + prd = domain->prd_lamda; + else + prd = domain->prd; + double slabthick = domain->prd[dim[0]] * delta[0] / prd[dim[0]]; // area lo/hi of concentric circles in radial direction int iradbin; - double rlo,rhi,arealo,areahi; + double rlo, rhi, arealo, areahi; for (int i = 0; i < nchunk; i++) { iradbin = i / ncplane; - rlo = cradmin + iradbin * (cradmax-cradmin) / ncbin; - rhi = cradmin + (iradbin+1) * (cradmax-cradmin) / ncbin; - if (iradbin == ncbin-1) rhi = cradmax; - arealo = MY_PI * rlo*rlo; - areahi = MY_PI * rhi*rhi; - chunk_volume_vec[i] = (areahi-arealo) * slabthick; + rlo = cradmin + iradbin * (cradmax - cradmin) / ncbin; + rhi = cradmin + (iradbin + 1) * (cradmax - cradmin) / ncbin; + if (iradbin == ncbin - 1) rhi = cradmax; + arealo = MY_PI * rlo * rlo; + areahi = MY_PI * rhi * rhi; + chunk_volume_vec[i] = (areahi - arealo) * slabthick; } } } @@ -1441,8 +1491,8 @@ void ComputeChunkAtom::bin_volumes() void ComputeChunkAtom::atom2bin1d() { - int i,ibin; - double *boxlo,*boxhi,*prd; + int i, ibin; + double *boxlo, *boxhi, *prd; double xremap; double **x = atom->x; @@ -1479,29 +1529,31 @@ void ComputeChunkAtom::atom2bin1d() if (xremap >= boxhi[idim]) xremap -= prd[idim]; } - ibin = static_cast ((xremap - offset[0]) * invdelta[0]); + ibin = static_cast((xremap - offset[0]) * invdelta[0]); if (xremap < offset[0]) ibin--; if (discard == MIXED) { - if (!minflag[idim]) ibin = MAX(ibin,0); + if (!minflag[idim]) + ibin = MAX(ibin, 0); else if (ibin < 0) { exclude[i] = 1; continue; } - if (!maxflag[idim]) ibin = MIN(ibin,nlayer1m1); + if (!maxflag[idim]) + ibin = MIN(ibin, nlayer1m1); else if (ibin > nlayer1m1) { exclude[i] = 1; continue; } } else if (discard == NODISCARD) { - ibin = MAX(ibin,0); - ibin = MIN(ibin,nlayer1m1); + ibin = MAX(ibin, 0); + ibin = MIN(ibin, nlayer1m1); } else if (ibin < 0 || ibin > nlayer1m1) { exclude[i] = 1; continue; } - ichunk[i] = ibin+1; + ichunk[i] = ibin + 1; } if (scaleflag == REDUCED) domain->lamda2x(nlocal); @@ -1513,9 +1565,9 @@ void ComputeChunkAtom::atom2bin1d() void ComputeChunkAtom::atom2bin2d() { - int i,ibin,i1bin,i2bin; - double *boxlo,*boxhi,*prd; - double xremap,yremap; + int i, ibin, i1bin, i2bin; + double *boxlo, *boxhi, *prd; + double xremap, yremap; double **x = atom->x; int nlocal = atom->nlocal; @@ -1553,23 +1605,25 @@ void ComputeChunkAtom::atom2bin2d() if (xremap >= boxhi[idim]) xremap -= prd[idim]; } - i1bin = static_cast ((xremap - offset[0]) * invdelta[0]); + i1bin = static_cast((xremap - offset[0]) * invdelta[0]); if (xremap < offset[0]) i1bin--; if (discard == MIXED) { - if (!minflag[idim]) i1bin = MAX(i1bin,0); + if (!minflag[idim]) + i1bin = MAX(i1bin, 0); else if (i1bin < 0) { exclude[i] = 1; continue; } - if (!maxflag[idim]) i1bin = MIN(i1bin,nlayer1m1); + if (!maxflag[idim]) + i1bin = MIN(i1bin, nlayer1m1); else if (i1bin > nlayer1m1) { exclude[i] = 1; continue; } } else if (discard == NODISCARD) { - i1bin = MAX(i1bin,0); - i1bin = MIN(i1bin,nlayer1m1); + i1bin = MAX(i1bin, 0); + i1bin = MIN(i1bin, nlayer1m1); } else if (i1bin < 0 || i1bin > nlayer1m1) { exclude[i] = 1; continue; @@ -1581,30 +1635,32 @@ void ComputeChunkAtom::atom2bin2d() if (yremap >= boxhi[jdim]) yremap -= prd[jdim]; } - i2bin = static_cast ((yremap - offset[1]) * invdelta[1]); + i2bin = static_cast((yremap - offset[1]) * invdelta[1]); if (yremap < offset[1]) i2bin--; if (discard == MIXED) { - if (!minflag[jdim]) i2bin = MAX(i2bin,0); + if (!minflag[jdim]) + i2bin = MAX(i2bin, 0); else if (i2bin < 0) { exclude[i] = 1; continue; } - if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1); + if (!maxflag[jdim]) + i2bin = MIN(i2bin, nlayer2m1); else if (i2bin > nlayer2m1) { exclude[i] = 1; continue; } } else if (discard == NODISCARD) { - i2bin = MAX(i2bin,0); - i2bin = MIN(i2bin,nlayer2m1); + i2bin = MAX(i2bin, 0); + i2bin = MIN(i2bin, nlayer2m1); } else if (i2bin < 0 || i2bin > nlayer2m1) { exclude[i] = 1; continue; } - ibin = i1bin*nlayers[1] + i2bin; - ichunk[i] = ibin+1; + ibin = i1bin * nlayers[1] + i2bin; + ichunk[i] = ibin + 1; } if (scaleflag == REDUCED) domain->lamda2x(nlocal); @@ -1616,9 +1672,9 @@ void ComputeChunkAtom::atom2bin2d() void ComputeChunkAtom::atom2bin3d() { - int i,ibin,i1bin,i2bin,i3bin; - double *boxlo,*boxhi,*prd; - double xremap,yremap,zremap; + int i, ibin, i1bin, i2bin, i3bin; + double *boxlo, *boxhi, *prd; + double xremap, yremap, zremap; double **x = atom->x; int nlocal = atom->nlocal; @@ -1658,23 +1714,25 @@ void ComputeChunkAtom::atom2bin3d() if (xremap >= boxhi[idim]) xremap -= prd[idim]; } - i1bin = static_cast ((xremap - offset[0]) * invdelta[0]); + i1bin = static_cast((xremap - offset[0]) * invdelta[0]); if (xremap < offset[0]) i1bin--; if (discard == MIXED) { - if (!minflag[idim]) i1bin = MAX(i1bin,0); + if (!minflag[idim]) + i1bin = MAX(i1bin, 0); else if (i1bin < 0) { exclude[i] = 1; continue; } - if (!maxflag[idim]) i1bin = MIN(i1bin,nlayer1m1); + if (!maxflag[idim]) + i1bin = MIN(i1bin, nlayer1m1); else if (i1bin > nlayer1m1) { exclude[i] = 1; continue; } } else if (discard == NODISCARD) { - i1bin = MAX(i1bin,0); - i1bin = MIN(i1bin,nlayer1m1); + i1bin = MAX(i1bin, 0); + i1bin = MIN(i1bin, nlayer1m1); } else if (i1bin < 0 || i1bin > nlayer1m1) { exclude[i] = 1; continue; @@ -1686,23 +1744,25 @@ void ComputeChunkAtom::atom2bin3d() if (yremap >= boxhi[jdim]) yremap -= prd[jdim]; } - i2bin = static_cast ((yremap - offset[1]) * invdelta[1]); + i2bin = static_cast((yremap - offset[1]) * invdelta[1]); if (yremap < offset[1]) i2bin--; if (discard == MIXED) { - if (!minflag[jdim]) i2bin = MAX(i2bin,0); + if (!minflag[jdim]) + i2bin = MAX(i2bin, 0); else if (i2bin < 0) { exclude[i] = 1; continue; } - if (!maxflag[jdim]) i2bin = MIN(i2bin,nlayer2m1); + if (!maxflag[jdim]) + i2bin = MIN(i2bin, nlayer2m1); else if (i2bin > nlayer2m1) { exclude[i] = 1; continue; } } else if (discard == NODISCARD) { - i2bin = MAX(i2bin,0); - i2bin = MIN(i2bin,nlayer2m1); + i2bin = MAX(i2bin, 0); + i2bin = MIN(i2bin, nlayer2m1); } else if (i2bin < 0 || i2bin > nlayer2m1) { exclude[i] = 1; continue; @@ -1714,30 +1774,32 @@ void ComputeChunkAtom::atom2bin3d() if (zremap >= boxhi[kdim]) zremap -= prd[kdim]; } - i3bin = static_cast ((zremap - offset[2]) * invdelta[2]); + i3bin = static_cast((zremap - offset[2]) * invdelta[2]); if (zremap < offset[2]) i3bin--; if (discard == MIXED) { - if (!minflag[kdim]) i3bin = MAX(i3bin,0); + if (!minflag[kdim]) + i3bin = MAX(i3bin, 0); else if (i3bin < 0) { exclude[i] = 1; continue; } - if (!maxflag[kdim]) i3bin = MIN(i3bin,nlayer3m1); + if (!maxflag[kdim]) + i3bin = MIN(i3bin, nlayer3m1); else if (i3bin > nlayer3m1) { exclude[i] = 1; continue; } } else if (discard == NODISCARD) { - i3bin = MAX(i3bin,0); - i3bin = MIN(i3bin,nlayer3m1); + i3bin = MAX(i3bin, 0); + i3bin = MIN(i3bin, nlayer3m1); } else if (i3bin < 0 || i3bin > nlayer3m1) { exclude[i] = 1; continue; } - ibin = i1bin*nlayers[1]*nlayers[2] + i2bin*nlayers[2] + i3bin; - ichunk[i] = ibin+1; + ibin = i1bin * nlayers[1] * nlayers[2] + i2bin * nlayers[2] + i3bin; + ichunk[i] = ibin + 1; } if (scaleflag == REDUCED) domain->lamda2x(nlocal); @@ -1749,9 +1811,9 @@ void ComputeChunkAtom::atom2bin3d() void ComputeChunkAtom::atom2binsphere() { - int i,ibin; - double dx,dy,dz,r; - double xremap,yremap,zremap; + int i, ibin; + double dx, dy, dz, r; + double xremap, yremap, zremap; double *boxlo = domain->boxlo; double *boxhi = domain->boxhi; @@ -1770,18 +1832,18 @@ void ComputeChunkAtom::atom2binsphere() xremap = x[i][0]; if (periodicity[0]) { - while (xremap < boxlo[0]) {xremap += prd[0];} - while (xremap >= boxhi[0]) {xremap -= prd[0];} + while (xremap < boxlo[0]) { xremap += prd[0]; } + while (xremap >= boxhi[0]) { xremap -= prd[0]; } } yremap = x[i][1]; if (periodicity[1]) { - while (yremap < boxlo[1]) {yremap += prd[1];} - while (yremap >= boxhi[1]) {yremap -= prd[1];} + while (yremap < boxlo[1]) { yremap += prd[1]; } + while (yremap >= boxhi[1]) { yremap -= prd[1]; } } zremap = x[i][2]; if (periodicity[2]) { - while (zremap < boxlo[2]) {zremap += prd[2];} - while (zremap >= boxhi[2]) {zremap -= prd[2];} + while (zremap < boxlo[2]) { zremap += prd[2]; } + while (zremap >= boxhi[2]) { zremap -= prd[2]; } } dx = xremap - sorigin[0]; @@ -1796,38 +1858,44 @@ void ComputeChunkAtom::atom2binsphere() if (pbcflag) { if (periodicity[0]) { while (fabs(dx) > prd_half[0]) { - if (dx < 0.0) dx += prd[0]; - else dx -= prd[0]; + if (dx < 0.0) + dx += prd[0]; + else + dx -= prd[0]; } } if (periodicity[1]) { while (fabs(dy) > prd_half[1]) { - if (dy < 0.0) dy += prd[1]; - else dy -= prd[1]; + if (dy < 0.0) + dy += prd[1]; + else + dy -= prd[1]; } } if (periodicity[2]) { while (fabs(dz) > prd_half[2]) { - if (dz < 0.0) dz += prd[2]; - else dz -= prd[2]; + if (dz < 0.0) + dz += prd[2]; + else + dz -= prd[2]; } } } - r = sqrt(dx*dx + dy*dy + dz*dz); + r = sqrt(dx * dx + dy * dy + dz * dz); - ibin = static_cast ((r - sradmin) * sinvrad); + ibin = static_cast((r - sradmin) * sinvrad); if (r < sradmin) ibin--; if (discard == MIXED || discard == NODISCARD) { - ibin = MAX(ibin,0); - ibin = MIN(ibin,nchunk-1); + ibin = MAX(ibin, 0); + ibin = MIN(ibin, nchunk - 1); } else if (ibin < 0 || ibin >= nchunk) { exclude[i] = 1; continue; } - ichunk[i] = ibin+1; + ichunk[i] = ibin + 1; } } @@ -1837,9 +1905,9 @@ void ComputeChunkAtom::atom2binsphere() void ComputeChunkAtom::atom2bincylinder() { - int i,rbin,kbin; - double d1,d2,r; - double remap1,remap2; + int i, rbin, kbin; + double d1, d2, r; + double remap1, remap2; // first use atom2bin1d() to bin all atoms along cylinder axis @@ -1886,26 +1954,30 @@ void ComputeChunkAtom::atom2bincylinder() if (pbcflag) { if (periodicity[cdim1]) { if (fabs(d1) > prd_half[cdim1]) { - if (d1 < 0.0) d1 += prd[cdim1]; - else d1 -= prd[cdim1]; + if (d1 < 0.0) + d1 += prd[cdim1]; + else + d1 -= prd[cdim1]; } } if (periodicity[cdim2]) { if (fabs(d2) > prd_half[cdim2]) { - if (d2 < 0.0) d2 += prd[cdim2]; - else d2 -= prd[cdim2]; + if (d2 < 0.0) + d2 += prd[cdim2]; + else + d2 -= prd[cdim2]; } } } - r = sqrt(d1*d1 + d2*d2); + r = sqrt(d1 * d1 + d2 * d2); - rbin = static_cast ((r - cradmin) * cinvrad); + rbin = static_cast((r - cradmin) * cinvrad); if (r < cradmin) rbin--; if (discard == MIXED || discard == NODISCARD) { - rbin = MAX(rbin,0); - rbin = MIN(rbin,ncbin-1); + rbin = MAX(rbin, 0); + rbin = MIN(rbin, ncbin - 1); } else if (rbin < 0 || rbin >= ncbin) { exclude[i] = 1; continue; @@ -1913,7 +1985,7 @@ void ComputeChunkAtom::atom2bincylinder() // combine axis and radial bin indices to set ichunk - ichunk[i] = rbin*ncplane + kbin + 1; + ichunk[i] = rbin * ncplane + kbin + 1; } } @@ -1924,23 +1996,30 @@ void ComputeChunkAtom::atom2bincylinder() void ComputeChunkAtom::readdim(int narg, char **arg, int iarg, int idim) { - if (narg < iarg+3) error->all(FLERR,"Illegal compute chunk/atom command"); - if (strcmp(arg[iarg],"x") == 0) dim[idim] = 0; - else if (strcmp(arg[iarg],"y") == 0) dim[idim] = 1; - else if (strcmp(arg[iarg],"z") == 0) dim[idim] = 2; - else error->all(FLERR,"Illegal compute chunk/atom command"); + if (narg < iarg + 3) error->all(FLERR, "Illegal compute chunk/atom command"); + if (strcmp(arg[iarg], "x") == 0) + dim[idim] = 0; + else if (strcmp(arg[iarg], "y") == 0) + dim[idim] = 1; + else if (strcmp(arg[iarg], "z") == 0) + dim[idim] = 2; + else + error->all(FLERR, "Illegal compute chunk/atom command"); if (dim[idim] == 2 && domain->dimension == 2) - error->all(FLERR,"Cannot use compute chunk/atom bin z for 2d model"); + error->all(FLERR, "Cannot use compute chunk/atom bin z for 2d model"); - if (strcmp(arg[iarg+1],"lower") == 0) originflag[idim] = LOWER; - else if (strcmp(arg[iarg+1],"center") == 0) originflag[idim] = CENTER; - else if (strcmp(arg[iarg+1],"upper") == 0) originflag[idim] = UPPER; - else originflag[idim] = COORD; - if (originflag[idim] == COORD) - origin[idim] = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg + 1], "lower") == 0) + originflag[idim] = LOWER; + else if (strcmp(arg[iarg + 1], "center") == 0) + originflag[idim] = CENTER; + else if (strcmp(arg[iarg + 1], "upper") == 0) + originflag[idim] = UPPER; + else + originflag[idim] = COORD; + if (originflag[idim] == COORD) origin[idim] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - delta[idim] = utils::numeric(FLERR,arg[iarg+2],false,lmp); + delta[idim] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); } /* ---------------------------------------------------------------------- @@ -1962,9 +2041,9 @@ void ComputeChunkAtom::set_arrays(int i) double ComputeChunkAtom::memory_usage() { - double bytes = 2*MAX(nmaxint,0) * sizeof(int); // ichunk,exclude - bytes += (double)nmax * sizeof(double); // chunk - bytes += (double)ncoord*nchunk * sizeof(double); // coord - if (compress) bytes += (double)nchunk * sizeof(int); // chunkID + double bytes = 2 * MAX(nmaxint, 0) * sizeof(int); // ichunk,exclude + bytes += (double) nmax * sizeof(double); // chunk + bytes += (double) ncoord * nchunk * sizeof(double); // coord + if (compress) bytes += (double) nchunk * sizeof(int); // chunkID return bytes; } diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index 528829f9a5..a52d1c5445 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -131,134 +131,3 @@ class ComputeChunkAtom : public Compute { #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: Region ID for compute chunk/atom does not exist - -Self-explanatory. - -E: Compute chunk/atom molecule for non-molecular system - -Self-explanatory. - -E: Compute chunk/atom without bins cannot use discard mixed - -That discard option only applies to the binning styles. - -E: Compute chunk/atom sphere z origin must be 0.0 for 2d - -Self-explanatory. - -E: Compute chunk/atom cylinder axis must be z for 2d - -Self-explanatory. - -E: Compute ID for compute chunk /atom does not exist - -Self-explanatory. - -E: Compute chunk/atom compute does not calculate per-atom values - -Self-explanatory. - -E: Compute chunk/atom compute does not calculate a per-atom vector - -Self-explanatory. - -E: Compute chunk/atom compute does not calculate a per-atom array - -Self-explanatory. - -E: Compute chunk/atom compute array is accessed out-of-range - -The index for the array is out of bounds. - -E: Fix ID for compute chunk/atom does not exist - -Self-explanatory. - -E: Compute chunk/atom fix does not calculate per-atom values - -Self-explanatory. - -E: Compute chunk/atom fix does not calculate a per-atom vector - -Self-explanatory. - -E: Compute chunk/atom fix does not calculate a per-atom array - -Self-explanatory. - -E: Compute chunk/atom fix array is accessed out-of-range - -the index for the array is out of bounds. - -E: Variable name for compute chunk/atom does not exist - -Self-explanatory. - -E: Compute chunk/atom variable is not atom-style variable - -Self-explanatory. - -E: Compute chunk/atom for triclinic boxes requires units reduced - -Self-explanatory. - -E: Compute ID for compute chunk/atom does not exist - -Self-explanatory. - -E: Molecule IDs too large for compute chunk/atom - -The IDs must not be larger than can be stored in a 32-bit integer -since chunk IDs are 32-bit integers. - -E: Compute chunk/atom ids once but nchunk is not once - -You cannot assign chunks IDs to atom permanently if the number of -chunks may change. - -E: Two fix commands using same compute chunk/atom command in incompatible ways - -UNDOCUMENTED - -E: Fix used in compute chunk/atom not computed at compatible time - -The chunk/atom compute cannot query the output of the fix on a timestep -it is needed. - -W: One or more chunks do not contain all atoms in molecule - -This may not be what you intended. - -E: Invalid bin bounds in compute chunk/atom - -The lo/hi values are inconsistent. - -E: Compute chunk/atom bin/sphere radius is too large for periodic box - -Radius cannot be bigger than 1/2 of any periodic dimension. - -E: Compute chunk/atom bin/cylinder radius is too large for periodic box - -Radius cannot be bigger than 1/2 of a non-axis periodic dimension. - -E: Cannot use compute chunk/atom bin z for 2d model - -Self-explanatory. - -U: Two fix ave commands using same compute chunk/atom command in incompatible ways - -They are both attempting to "lock" the chunk/atom command so that the -chunk assignments persist for some number of timesteps, but are doing -it in different ways. - -*/ diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 0bcfa3265c..3781e83aa7 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -184,7 +184,7 @@ void ComputeChunkSpreadAtom::init_chunk() int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for compute chunk/spread/atom"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute chunk/spread/atom does not use chunk/atom compute"); } diff --git a/src/compute_chunk_spread_atom.h b/src/compute_chunk_spread_atom.h index e1e2a2a584..926c5650b5 100644 --- a/src/compute_chunk_spread_atom.h +++ b/src/compute_chunk_spread_atom.h @@ -48,13 +48,3 @@ class ComputeChunkSpreadAtom : public Compute { #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. - -*/ diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 07a0c700ee..c2cb2816d3 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -30,8 +30,6 @@ using namespace LAMMPS_NS; -enum { CLUSTER, MASK, COORDS }; - /* ---------------------------------------------------------------------- */ ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : @@ -44,7 +42,7 @@ ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; size_peratom_cols = 0; - comm_forward = 3; + comm_forward = 1; nmax = 0; } @@ -117,22 +115,6 @@ void ComputeClusterAtom::compute_peratom() numneigh = list->numneigh; firstneigh = list->firstneigh; - // if update->post_integrate set: - // a dynamic group in FixGroup is invoking a variable with this compute - // thus ghost atom coords need to be up-to-date after initial_integrate() - - if (update->post_integrate) { - commflag = COORDS; - comm->forward_comm(this); - } - - // if group is dynamic, insure ghost atom masks are current - - if (group->dynamic[igroup]) { - commflag = MASK; - comm->forward_comm(this); - } - // every atom starts in its own cluster, with clusterID = atomID tagint *tag = atom->tag; @@ -153,7 +135,6 @@ void ComputeClusterAtom::compute_peratom() // iterate until no changes in my atoms // then check if any proc made changes - commflag = CLUSTER; double **x = atom->x; int change, done, anychange; @@ -209,25 +190,9 @@ int ComputeClusterAtom::pack_forward_comm(int n, int *list, double *buf, int /*p int i, j, m; m = 0; - if (commflag == CLUSTER) { - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = clusterID[j]; - } - } else if (commflag == MASK) { - int *mask = atom->mask; - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = ubuf(mask[j]).d; - } - } else if (commflag == COORDS) { - double **x = atom->x; - for (i = 0; i < n; i++) { - j = list[i]; - buf[m++] = x[j][0]; - buf[m++] = x[j][1]; - buf[m++] = x[j][2]; - } + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = clusterID[j]; } return m; @@ -241,19 +206,7 @@ void ComputeClusterAtom::unpack_forward_comm(int n, int first, double *buf) m = 0; last = first + n; - if (commflag == CLUSTER) { - for (i = first; i < last; i++) clusterID[i] = buf[m++]; - } else if (commflag == MASK) { - int *mask = atom->mask; - for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i; - } else if (commflag == COORDS) { - double **x = atom->x; - for (i = first; i < last; i++) { - x[i][0] = buf[m++]; - x[i][1] = buf[m++]; - x[i][2] = buf[m++]; - } - } + for (i = first; i < last; i++) clusterID[i] = buf[m++]; } /* ---------------------------------------------------------------------- diff --git a/src/compute_cluster_atom.h b/src/compute_cluster_atom.h index 1d5c03277d..ebd1de0c40 100644 --- a/src/compute_cluster_atom.h +++ b/src/compute_cluster_atom.h @@ -46,30 +46,3 @@ class ComputeClusterAtom : public Compute { #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: Cannot use compute cluster/atom unless atoms have IDs - -Atom IDs are used to identify clusters. - -E: Compute cluster/atom requires a pair style to be defined - -This is so that the pair style defines a cutoff distance which -is used to find clusters. - -E: Compute cluster/atom cutoff is longer than pairwise cutoff - -Cannot identify clusters beyond cutoff. - -W: More than one compute cluster/atom - -It is not efficient to use compute cluster/atom more than once. - -*/ diff --git a/src/compute_cna_atom.h b/src/compute_cna_atom.h index eab6fae0f3..d9c1e50afa 100644 --- a/src/compute_cna_atom.h +++ b/src/compute_cna_atom.h @@ -46,40 +46,3 @@ class ComputeCNAAtom : public Compute { #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 cna/atom requires a pair style be defined - -Self-explanatory. - -E: Compute cna/atom cutoff is longer than pairwise cutoff - -Self-explanatory. - -W: Compute cna/atom cutoff may be too large to find ghost atom neighbors - -The neighbor cutoff used may not encompass enough ghost atoms -to perform this operation correctly. - -W: More than one compute cna/atom defined - -It is not efficient to use compute cna/atom more than once. - -W: Too many neighbors in CNA for %d atoms - -More than the maximum # of neighbors was found multiple times. This -was unexpected. - -W: Too many common neighbors in CNA %d times - -More than the maximum # of neighbors was found multiple times. This -was unexpected. - -*/ diff --git a/src/compute_com.h b/src/compute_com.h index 762e63d84a..0966247f1e 100644 --- a/src/compute_com.h +++ b/src/compute_com.h @@ -39,13 +39,3 @@ class ComputeCOM : public Compute { #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. - -*/ diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index 1fac12d9ba..8124a7dccd 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -75,7 +75,7 @@ void ComputeCOMChunk::init() int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for compute com/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute com/chunk does not use chunk/atom compute"); } @@ -180,7 +180,7 @@ void ComputeCOMChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_com_chunk.h b/src/compute_com_chunk.h index 78a74a1937..8e870392db 100644 --- a/src/compute_com_chunk.h +++ b/src/compute_com_chunk.h @@ -58,21 +58,3 @@ class ComputeCOMChunk : public Compute { #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: Chunk/atom compute does not exist for compute com/chunk - -Self-explanatory. - -E: Compute com/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index 4487e82985..7bf749b1be 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -129,7 +129,7 @@ void ComputeCoordAtom::init() { if (cstyle == ORIENT) { int iorientorder = modify->find_compute(id_orientorder); - c_orientorder = (ComputeOrientOrderAtom *) (modify->compute[iorientorder]); + c_orientorder = dynamic_cast(modify->compute[iorientorder]); cutsq = c_orientorder->cutsq; l = c_orientorder->qlcomp; // communicate real and imaginary 2*l+1 components of the normalized vector @@ -259,14 +259,16 @@ void ComputeCoordAtom::compute_peratom() j = jlist[jj]; j &= NEIGHMASK; - jtype = type[j]; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx * delx + dely * dely + delz * delz; - if (rsq < cutsq) { - for (m = 0; m < ncol; m++) - if (jtype >= typelo[m] && jtype <= typehi[m]) count[m] += 1.0; + if (mask[j] & jgroupbit) { + jtype = type[j]; + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq < cutsq) { + for (m = 0; m < ncol; m++) + if (jtype >= typelo[m] && jtype <= typehi[m]) count[m] += 1.0; + } } } } diff --git a/src/compute_coord_atom.h b/src/compute_coord_atom.h index 563baef973..63ffd56c82 100644 --- a/src/compute_coord_atom.h +++ b/src/compute_coord_atom.h @@ -59,42 +59,3 @@ class ComputeCoordAtom : public Compute { #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: Could not find compute coord/atom compute ID - -UNDOCUMENTED - -E: Compute coord/atom compute ID is not orientorder/atom - -UNDOCUMENTED - -E: Compute coord/atom threshold not between -1 and 1 - -UNDOCUMENTED - -E: Invalid cstyle in compute coord/atom - -UNDOCUMENTED - -E: Compute coord/atom requires components option in compute orientorder/atom - -UNDOCUMENTED - -E: Compute coord/atom requires a pair style be defined - -Self-explanatory. - -E: Compute coord/atom cutoff is longer than pairwise cutoff - -Cannot compute coordination at distances longer than the pair cutoff, -since those atoms are not in the neighbor list. - -*/ diff --git a/src/compute_deprecated.h b/src/compute_deprecated.h index 3770a9978e..3267e78880 100644 --- a/src/compute_deprecated.h +++ b/src/compute_deprecated.h @@ -35,11 +35,3 @@ class ComputeDeprecated : public Compute { #endif #endif - -/* ERROR/WARNING messages: - -E: This compute command has been removed from LAMMPS - -UNDOCUMENTED - -*/ diff --git a/src/compute_dihedral.cpp b/src/compute_dihedral.cpp index a411ce1a8b..86fd1b116e 100644 --- a/src/compute_dihedral.cpp +++ b/src/compute_dihedral.cpp @@ -37,10 +37,9 @@ ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : // check if dihedral style hybrid exists - dihedral = (DihedralHybrid *) force->dihedral_match("hybrid"); + dihedral = dynamic_cast( force->dihedral_match("hybrid")); if (!dihedral) - error->all(FLERR, - "Dihedral style for compute dihedral command is not hybrid"); + error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid"); size_vector = nsub = dihedral->nstyles; emine = new double[nsub]; @@ -61,10 +60,9 @@ void ComputeDihedral::init() { // recheck dihedral style in case it has been changed - dihedral = (DihedralHybrid *) force->dihedral_match("hybrid"); + dihedral = dynamic_cast( force->dihedral_match("hybrid")); if (!dihedral) - error->all(FLERR, - "Dihedral style for compute dihedral command is not hybrid"); + error->all(FLERR, "Dihedral style for compute dihedral command is not hybrid"); if (dihedral->nstyles != nsub) error->all(FLERR,"Dihedral style for compute dihedral command has changed"); } diff --git a/src/compute_dihedral.h b/src/compute_dihedral.h index d7e7662ec9..3120734c0f 100644 --- a/src/compute_dihedral.h +++ b/src/compute_dihedral.h @@ -41,35 +41,3 @@ class ComputeDihedral : public Compute { #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: Dihedral style for compute dihedral command is not hybrid - -UNDOCUMENTED - -E: Dihedral style for compute dihedral command has changed - -UNDOCUMENTED - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -U: Compute bond must use group all - -Bond styles accumulate energy on all atoms. - -U: Unrecognized bond style in compute bond command - -Self-explanatory. - -*/ diff --git a/src/compute_dihedral_local.h b/src/compute_dihedral_local.h index 99274a7265..48b24b4465 100644 --- a/src/compute_dihedral_local.h +++ b/src/compute_dihedral_local.h @@ -52,25 +52,3 @@ class ComputeDihedralLocal : public Compute { #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 dihedral/local used when dihedrals are not allowed - -The atom style does not support dihedrals. - -E: Invalid keyword in compute dihedral/local command - -Self-explanatory. - -E: No dihedral style is defined for compute dihedral/local - -Self-explanatory. - -*/ diff --git a/src/compute_dipole.h b/src/compute_dipole.h index 9e16f6c998..61e07f2514 100644 --- a/src/compute_dipole.h +++ b/src/compute_dipole.h @@ -40,13 +40,3 @@ class ComputeDipole : public Compute { #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. - -*/ diff --git a/src/compute_dipole_chunk.cpp b/src/compute_dipole_chunk.cpp index 161f4a5c2b..f1afcc01fd 100644 --- a/src/compute_dipole_chunk.cpp +++ b/src/compute_dipole_chunk.cpp @@ -94,7 +94,7 @@ void ComputeDipoleChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute dipole/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute dipole/chunk does not use chunk/atom compute"); @@ -232,7 +232,7 @@ void ComputeDipoleChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_dipole_chunk.h b/src/compute_dipole_chunk.h index fbe97c481b..c0ae6409de 100644 --- a/src/compute_dipole_chunk.h +++ b/src/compute_dipole_chunk.h @@ -57,21 +57,3 @@ class ComputeDipoleChunk : public Compute { #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: Chunk/atom compute does not exist for compute dipole/chunk - -Self-explanatory. - -E: Compute dipole/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_displace_atom.cpp b/src/compute_displace_atom.cpp index c72570b9c6..ba9b5c997f 100644 --- a/src/compute_displace_atom.cpp +++ b/src/compute_displace_atom.cpp @@ -74,8 +74,8 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // id = compute-ID + COMPUTE_STORE, fix group = compute group id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE"); - fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3", - id_fix, group->names[igroup])); + fix = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE peratom 1 3", + id_fix, group->names[igroup]))); // calculate xu,yu,zu for fix store array // skip if reset from restart file @@ -120,7 +120,7 @@ void ComputeDisplaceAtom::init() { // set fix which stores original atom coords - fix = (FixStore *) modify->get_fix_by_id(id_fix); + fix = dynamic_cast( modify->get_fix_by_id(id_fix)); if (!fix) error->all(FLERR,"Could not find compute displace/atom fix with ID {}", id_fix); if (refreshflag) { diff --git a/src/compute_displace_atom.h b/src/compute_displace_atom.h index 4eac39d5b0..6ba0fb3d9f 100644 --- a/src/compute_displace_atom.h +++ b/src/compute_displace_atom.h @@ -49,25 +49,3 @@ class ComputeDisplaceAtom : public Compute { #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: Variable name for compute displace/atom does not exist - -UNDOCUMENTED - -E: Compute displace/atom variable is not atom-style variable - -UNDOCUMENTED - -E: Could not find compute displace/atom fix ID - -Self-explanatory. - -*/ diff --git a/src/compute_erotate_sphere.h b/src/compute_erotate_sphere.h index 29906b852f..b27b726578 100644 --- a/src/compute_erotate_sphere.h +++ b/src/compute_erotate_sphere.h @@ -39,17 +39,3 @@ class ComputeERotateSphere : public Compute { #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 erotate/sphere requires atom style sphere - -Self-explanatory. - -*/ diff --git a/src/compute_erotate_sphere_atom.h b/src/compute_erotate_sphere_atom.h index 5ec58d44be..eab3410bf2 100644 --- a/src/compute_erotate_sphere_atom.h +++ b/src/compute_erotate_sphere_atom.h @@ -42,21 +42,3 @@ class ComputeErotateSphereAtom : public Compute { #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 erotate/sphere/atom requires atom style sphere - -Self-explanatory. - -W: More than one compute erotate/sphere/atom - -It is not efficient to use compute erorate/sphere/atom more than once. - -*/ diff --git a/src/compute_fragment_atom.h b/src/compute_fragment_atom.h index 5ba430ee30..2e948a9371 100644 --- a/src/compute_fragment_atom.h +++ b/src/compute_fragment_atom.h @@ -44,29 +44,3 @@ class ComputeFragmentAtom : public Compute { #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 fragment/atom used when bonds are not allowed - -UNDOCUMENTED - -E: Cannot use compute fragment/atom unless atoms have IDs - -Atom IDs are used to identify fragments. - -E: Compute fragment/atom requires a bond style to be defined - -This is so that a bond list is generated which is used to find fragments. - -W: More than one compute fragment/atom - -It is not efficient to use compute fragment/atom more than once. - -*/ diff --git a/src/compute_global_atom.h b/src/compute_global_atom.h index 1cf9a7322a..67b499dc3c 100644 --- a/src/compute_global_atom.h +++ b/src/compute_global_atom.h @@ -50,166 +50,3 @@ class ComputeGlobalAtom : public Compute { #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 compute global/atom does not exist - -UNDOCUMENTED - -E: Compute global/atom compute does not calculate a per-atom vector or array - -UNDOCUMENTED - -E: Compute global/atom compute does not calculate a per-atom vector - -UNDOCUMENTED - -E: Compute global/atom compute does not calculate a per-atom array - -UNDOCUMENTED - -E: Compute global/atom compute array is accessed out-of-range - -UNDOCUMENTED - -E: Fix ID for compute global/atom does not exist - -UNDOCUMENTED - -E: Compute global/atom fix does not calculate a per-atom vector or array - -UNDOCUMENTED - -E: Compute global/atom fix does not calculate a per-atom vector - -UNDOCUMENTED - -E: Compute global/atom fix does not calculate a per-atom array - -UNDOCUMENTED - -E: Compute global/atom fix array is accessed out-of-range - -UNDOCUMENTED - -E: Variable name for compute global/atom does not exist - -UNDOCUMENTED - -E: Compute global/atom variable is not atom-style variable - -UNDOCUMENTED - -E: Compute global/atom compute does not calculate a global vector - -UNDOCUMENTED - -E: Compute global/atom compute does not calculate a global array - -UNDOCUMENTED - -E: Compute global/atom fix does not calculate a global vector - -UNDOCUMENTED - -E: Compute global/atom fix does not calculate a global array - -UNDOCUMENTED - -E: Compute global/atom variable is not vector-style variable - -UNDOCUMENTED - -E: Fix used in compute global/atom not computed at compatible time - -UNDOCUMENTED - -U: Region ID for compute reduce/region does not exist - -Self-explanatory. - -U: Compute reduce replace requires min or max mode - -Self-explanatory. - -U: Invalid replace values in compute reduce - -Self-explanatory. - -U: Compute ID for compute reduce does not exist - -Self-explanatory. - -U: Compute reduce compute does not calculate a per-atom vector - -Self-explanatory. - -U: Compute reduce compute does not calculate a per-atom array - -Self-explanatory. - -U: Compute reduce compute array is accessed out-of-range - -An index for the array is out of bounds. - -U: Compute reduce compute does not calculate a local vector - -Self-explanatory. - -U: Compute reduce compute does not calculate a local array - -Self-explanatory. - -U: Compute reduce compute calculates global values - -A compute that calculates peratom or local values is required. - -U: Fix ID for compute reduce does not exist - -Self-explanatory. - -U: Compute reduce fix does not calculate a per-atom vector - -Self-explanatory. - -U: Compute reduce fix does not calculate a per-atom array - -Self-explanatory. - -U: Compute reduce fix array is accessed out-of-range - -An index for the array is out of bounds. - -U: Compute reduce fix does not calculate a local vector - -Self-explanatory. - -U: Compute reduce fix does not calculate a local array - -Self-explanatory. - -U: Compute reduce fix calculates global values - -A fix that calculates peratom or local values is required. - -U: Variable name for compute reduce does not exist - -Self-explanatory. - -U: Compute reduce variable is not atom-style variable - -Self-explanatory. - -U: Fix used in compute reduce not computed at compatible time - -Fixes generate their values on specific timesteps. Compute reduce is -requesting a value on a non-allowed timestep. - -*/ diff --git a/src/compute_group_group.h b/src/compute_group_group.h index c5505f51ee..b813ca1e2c 100644 --- a/src/compute_group_group.h +++ b/src/compute_group_group.h @@ -52,42 +52,3 @@ class ComputeGroupGroup : public Compute { #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 group/group group ID does not exist - -Self-explanatory. - -E: Compute group/group molecule requires molecule IDs - -UNDOCUMENTED - -E: No pair style defined for compute group/group - -Cannot calculate group interactions without a pair style defined. - -E: Pair style does not support compute group/group - -The pair_style does not have a single() function, so it cannot be -invoked by the compute group/group command. - -E: No Kspace style defined for compute group/group - -Self-explanatory. - -E: Kspace style does not support compute group/group - -Self-explanatory. - -W: Both groups in compute group/group have a net charge; the Kspace boundary correction to energy will be non-zero - -Self-explanatory. - -*/ diff --git a/src/compute_gyration.h b/src/compute_gyration.h index f6dd748640..4d014eb31a 100644 --- a/src/compute_gyration.h +++ b/src/compute_gyration.h @@ -40,13 +40,3 @@ class ComputeGyration : public Compute { #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. - -*/ diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index fe6022cd47..f79325274f 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -95,7 +95,7 @@ void ComputeGyrationChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute gyration/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute gyration/chunk does not use chunk/atom compute"); } @@ -286,7 +286,7 @@ void ComputeGyrationChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_gyration_chunk.h b/src/compute_gyration_chunk.h index ce990c9416..0a560a3e39 100644 --- a/src/compute_gyration_chunk.h +++ b/src/compute_gyration_chunk.h @@ -60,21 +60,3 @@ class ComputeGyrationChunk : public Compute { #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: Chunk/atom compute does not exist for compute gyration/chunk - -Self-explanatory. - -E: Compute gyration/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_heat_flux.h b/src/compute_heat_flux.h index bdfc8252a3..83a2c800c3 100644 --- a/src/compute_heat_flux.h +++ b/src/compute_heat_flux.h @@ -40,29 +40,3 @@ class ComputeHeatFlux : public Compute { #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: Could not find compute heat/flux compute ID - -Self-explanatory. - -E: Compute heat/flux compute ID does not compute ke/atom - -Self-explanatory. - -E: Compute heat/flux compute ID does not compute pe/atom - -Self-explanatory. - -E: Compute heat/flux compute ID does not compute stress/atom - -Self-explanatory. - -*/ diff --git a/src/compute_improper.cpp b/src/compute_improper.cpp index 42bb247ac0..3e0780be49 100644 --- a/src/compute_improper.cpp +++ b/src/compute_improper.cpp @@ -37,10 +37,9 @@ ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : // check if improper style hybrid exists - improper = (ImproperHybrid *) force->improper_match("hybrid"); + improper = dynamic_cast( force->improper_match("hybrid")); if (!improper) - error->all(FLERR, - "Improper style for compute improper command is not hybrid"); + error->all(FLERR, "Improper style for compute improper command is not hybrid"); size_vector = nsub = improper->nstyles; emine = new double[nsub]; @@ -61,10 +60,9 @@ void ComputeImproper::init() { // recheck improper style in case it has been changed - improper = (ImproperHybrid *) force->improper_match("hybrid"); + improper = dynamic_cast( force->improper_match("hybrid")); if (!improper) - error->all(FLERR, - "Improper style for compute improper command is not hybrid"); + error->all(FLERR, "Improper style for compute improper command is not hybrid"); if (improper->nstyles != nsub) error->all(FLERR,"Improper style for compute improper command has changed"); } diff --git a/src/compute_improper.h b/src/compute_improper.h index ddafc50e4e..3deb23db77 100644 --- a/src/compute_improper.h +++ b/src/compute_improper.h @@ -41,35 +41,3 @@ class ComputeImproper : public Compute { #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: Improper style for compute improper command is not hybrid - -UNDOCUMENTED - -E: Improper style for compute improper command has changed - -UNDOCUMENTED - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -U: Compute bond must use group all - -Bond styles accumulate energy on all atoms. - -U: Unrecognized bond style in compute bond command - -Self-explanatory. - -*/ diff --git a/src/compute_improper_local.h b/src/compute_improper_local.h index ff27dde4e9..899aaf17f5 100644 --- a/src/compute_improper_local.h +++ b/src/compute_improper_local.h @@ -48,25 +48,3 @@ class ComputeImproperLocal : public Compute { #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 improper/local used when impropers are not allowed - -The atom style does not support impropers. - -E: Invalid keyword in compute improper/local command - -Self-explanatory. - -E: No improper style is defined for compute improper/local - -Self-explanatory. - -*/ diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index e60192b3ab..ceca61c1b7 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -74,7 +74,7 @@ void ComputeInertiaChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute inertia/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute inertia/chunk does not use chunk/atom compute"); } @@ -189,7 +189,7 @@ void ComputeInertiaChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_inertia_chunk.h b/src/compute_inertia_chunk.h index 87e6bedb78..7ada8e634e 100644 --- a/src/compute_inertia_chunk.h +++ b/src/compute_inertia_chunk.h @@ -55,21 +55,3 @@ class ComputeInertiaChunk : public Compute { #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: Chunk/atom compute does not exist for compute inertia/chunk - -Self-explanatory. - -E: Compute inertia/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_ke.h b/src/compute_ke.h index b84ffde1ef..d428aa71da 100644 --- a/src/compute_ke.h +++ b/src/compute_ke.h @@ -38,13 +38,3 @@ class ComputeKE : public Compute { #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. - -*/ diff --git a/src/compute_ke_atom.h b/src/compute_ke_atom.h index 8b773f7f24..e967ef9bc3 100644 --- a/src/compute_ke_atom.h +++ b/src/compute_ke_atom.h @@ -41,17 +41,3 @@ class ComputeKEAtom : public Compute { #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. - -W: More than one compute ke/atom - -It is not efficient to use compute ke/atom more than once. - -*/ diff --git a/src/compute_msd.cpp b/src/compute_msd.cpp index bff9dffd87..9fbaa603ec 100644 --- a/src/compute_msd.cpp +++ b/src/compute_msd.cpp @@ -63,8 +63,8 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, a // id = compute-ID + COMPUTE_STORE, fix group = compute group id_fix = utils::strdup(id + std::string("_COMPUTE_STORE")); - fix = (FixStore *) modify->add_fix( - fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup])); + fix = dynamic_cast( + modify->add_fix(fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup]))); // calculate xu,yu,zu for fix store array // skip if reset from restart file @@ -127,7 +127,7 @@ void ComputeMSD::init() { // set fix which stores reference atom coords - fix = (FixStore *) modify->get_fix_by_id(id_fix); + fix = dynamic_cast(modify->get_fix_by_id(id_fix)); if (!fix) error->all(FLERR, "Could not find compute msd fix with ID {}", id_fix); // nmsd = # of atoms in group diff --git a/src/compute_msd.h b/src/compute_msd.h index 33338b86d4..c7ab7fa083 100644 --- a/src/compute_msd.h +++ b/src/compute_msd.h @@ -46,17 +46,3 @@ class ComputeMSD : public Compute { #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: Could not find compute msd fix ID - -Self-explanatory. - -*/ diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index cea6da100d..8624520cf7 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -57,8 +57,8 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) : // otherwise size reset and init will be done in setup() id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE"); - fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE global 1 1", - id_fix,group->names[igroup])); + fix = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE global 1 1", + id_fix,group->names[igroup]))); } /* ---------------------------------------------------------------------- */ @@ -85,7 +85,7 @@ void ComputeMSDChunk::init() int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for compute msd/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute msd/chunk does not use chunk/atom compute"); @@ -93,7 +93,7 @@ void ComputeMSDChunk::init() // if firstflag, will be created in setup() if (!firstflag) { - fix = (FixStore *) modify->get_fix_by_id(id_fix); + fix = dynamic_cast( modify->get_fix_by_id(id_fix)); if (!fix) error->all(FLERR,"Could not find compute msd/chunk fix with ID {}", id_fix); } } @@ -235,7 +235,7 @@ void ComputeMSDChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_msd_chunk.h b/src/compute_msd_chunk.h index 18fd91b6d5..86fabd5efd 100644 --- a/src/compute_msd_chunk.h +++ b/src/compute_msd_chunk.h @@ -59,31 +59,3 @@ class ComputeMSDChunk : public Compute { #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: Chunk/atom compute does not exist for compute msd/chunk - -Self-explanatory. - -E: Compute msd/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -E: Could not find compute msd/chunk fix ID - -The compute creates an internal fix, which has been deleted. - -E: Compute msd/chunk nchunk is not static - -This is required because the MSD cannot be computed consistently if -the number of chunks is changing. Compute chunk/atom allows setting -nchunk to be static. - -*/ diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 1422614ae1..bf00dda6a8 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -81,7 +81,7 @@ void ComputeOmegaChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute omega/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute omega/chunk does not use chunk/atom compute"); } @@ -313,7 +313,7 @@ void ComputeOmegaChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_omega_chunk.h b/src/compute_omega_chunk.h index b058796067..0184637595 100644 --- a/src/compute_omega_chunk.h +++ b/src/compute_omega_chunk.h @@ -57,25 +57,3 @@ class ComputeOmegaChunk : public Compute { #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: Chunk/atom compute does not exist for compute omega/chunk - -Self-explanatory. - -E: Compute omega/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -E: Insufficient Jacobi rotations for omega/chunk - -UNDOCUMENTED - -*/ diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 163f68e5ac..4f6bda7e2b 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -435,7 +435,7 @@ void ComputeOrientOrderAtom::calc_boop(double **rlist, int ncount, double qn[], for (int ineigh = 0; ineigh < ncount; ineigh++) { const double *const r = rlist[ineigh]; - double rmag = sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]); + double rmag = sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]); if (rmag <= MY_EPSILON) { return; } double costheta = r[2] / rmag; diff --git a/src/compute_orientorder_atom.h b/src/compute_orientorder_atom.h index c762c0e74b..759f385871 100644 --- a/src/compute_orientorder_atom.h +++ b/src/compute_orientorder_atom.h @@ -64,25 +64,3 @@ class ComputeOrientOrderAtom : public Compute { #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 orientorder/atom requires a pair style be defined - -Self-explanatory. - -E: Compute orientorder/atom cutoff is longer than pairwise cutoff - -Cannot compute order parameter beyond cutoff. - -W: More than one compute orientorder/atom - -It is not efficient to use compute orientorder/atom more than once. - -*/ diff --git a/src/compute_pair.h b/src/compute_pair.h index 5918f89111..2a2f42f299 100644 --- a/src/compute_pair.h +++ b/src/compute_pair.h @@ -43,27 +43,3 @@ class ComputePair : public Compute { #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: Unrecognized pair style in compute pair command - -Self-explanatory. - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -U: Compute pair must use group all - -Pair styles accumulate energy on all atoms. - -*/ diff --git a/src/compute_pair_local.h b/src/compute_pair_local.h index 1d356c71a2..84adfaaf50 100644 --- a/src/compute_pair_local.h +++ b/src/compute_pair_local.h @@ -54,35 +54,3 @@ class ComputePairLocal : public Compute { #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: Invalid keyword in compute pair/local command - -Self-explanatory. - -E: Compute pair/local requires atom attribute radius - -UNDOCUMENTED - -E: No pair style is defined for compute pair/local - -Self-explanatory. - -E: Pair style does not support compute pair/local - -The pair style does not have a single() function, so it can -not be invoked by compute pair/local. - -E: Pair style does not have extra field requested by compute pair/local - -The pair style does not support the pN value requested by the compute -pair/local command. - -*/ diff --git a/src/compute_pe.h b/src/compute_pe.h index 31e4747850..0ad8097226 100644 --- a/src/compute_pe.h +++ b/src/compute_pe.h @@ -38,24 +38,3 @@ class ComputePE : public Compute { #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 pe must use group all - -Energies computed by potentials (pair, bond, etc) are computed on all -atoms. - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/compute_pe_atom.h b/src/compute_pe_atom.h index b89be3e853..03e04dfd1a 100644 --- a/src/compute_pe_atom.h +++ b/src/compute_pe_atom.h @@ -45,19 +45,3 @@ class ComputePEAtom : public Compute { #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: Per-atom energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index ef1de29309..ad14b552a4 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -202,7 +202,7 @@ void ComputePressure::init() vptr = new double*[nvirial]; nvirial = 0; if (pairhybridflag && force->pair) { - PairHybrid *ph = (PairHybrid *) force->pair; + auto ph = dynamic_cast( force->pair); ph->no_virial_fdotr_compute = 1; vptr[nvirial++] = pairhybrid->virial; } diff --git a/src/compute_pressure.h b/src/compute_pressure.h index ebffd3a4fc..8338922471 100644 --- a/src/compute_pressure.h +++ b/src/compute_pressure.h @@ -57,42 +57,3 @@ class ComputePressure : public Compute { #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 pressure must use group all - -Virial contributions computed by potentials (pair, bond, etc) are -computed on all atoms. - -E: Could not find compute pressure temperature ID - -The compute ID for calculating temperature does not exist. - -E: Compute pressure temperature ID does not compute temperature - -The compute ID assigned to a pressure computation must compute -temperature. - -E: Compute pressure requires temperature ID to include kinetic energy - -The keflag cannot be used unless a temperature compute is provided. - -E: Virial was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied the virial, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -E: Must use 'kspace_modify pressure/scalar no' for tensor components with kspace_style msm - -Otherwise MSM will compute only a scalar pressure. See the kspace_modify -command for details on this setting. - -*/ diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index d4cec70fe4..606da288de 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -216,40 +216,40 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : pack_choice[i] = &ComputePropertyAtom::pack_angmomz; } else if (strcmp(arg[iarg],"shapex") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_shapex; } else if (strcmp(arg[iarg],"shapey") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_shapey; } else if (strcmp(arg[iarg],"shapez") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); if (!avec_ellipsoid) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_shapez; } else if (strcmp(arg[iarg],"quatw") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_body = dynamic_cast( atom->style_match("body")); + if (!avec_ellipsoid && !avec_body && !atom->quat_flag) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quatw; } else if (strcmp(arg[iarg],"quati") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_body = dynamic_cast( atom->style_match("body")); + if (!avec_ellipsoid && !avec_body && !atom->quat_flag) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quati; } else if (strcmp(arg[iarg],"quatj") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_body = dynamic_cast( atom->style_match("body")); + if (!avec_ellipsoid && !avec_body && !atom->quat_flag) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quatj; } else if (strcmp(arg[iarg],"quatk") == 0) { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_body = (AtomVecBody *) atom->style_match("body"); - if (!avec_ellipsoid && !avec_body) + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_body = dynamic_cast( atom->style_match("body")); + if (!avec_ellipsoid && !avec_body && !atom->quat_flag) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_quatk; @@ -267,65 +267,65 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : pack_choice[i] = &ComputePropertyAtom::pack_tqz; } else if (strcmp(arg[iarg],"end1x") == 0) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_end1x; } else if (strcmp(arg[iarg],"end1y") == 0) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_end1y; } else if (strcmp(arg[iarg],"end1z") == 0) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_end1z; } else if (strcmp(arg[iarg],"end2x") == 0) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_end2x; } else if (strcmp(arg[iarg],"end2y") == 0) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_end2y; } else if (strcmp(arg[iarg],"end2z") == 0) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_end2z; } else if (strcmp(arg[iarg],"corner1x") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner1x; } else if (strcmp(arg[iarg],"corner1y") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner1y; } else if (strcmp(arg[iarg],"corner1z") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner1z; } else if (strcmp(arg[iarg],"corner2x") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner2x; } else if (strcmp(arg[iarg],"corner2y") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner2y; } else if (strcmp(arg[iarg],"corner2z") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner2z; } else if (strcmp(arg[iarg],"corner3x") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner3x; } else if (strcmp(arg[iarg],"corner3y") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner3y; } else if (strcmp(arg[iarg],"corner3z") == 0) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Compute property/atom for atom property that isn't allocated"); pack_choice[i] = &ComputePropertyAtom::pack_corner3z; @@ -409,10 +409,10 @@ ComputePropertyAtom::~ComputePropertyAtom() void ComputePropertyAtom::init() { - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_line = (AtomVecLine *) atom->style_match("line"); - avec_tri = (AtomVecTri *) atom->style_match("tri"); - avec_body = (AtomVecBody *) atom->style_match("body"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_line = dynamic_cast( atom->style_match("line")); + avec_tri = dynamic_cast( atom->style_match("tri")); + avec_body = dynamic_cast( atom->style_match("body")); // NOTE: could reset custom vector/array indices here, like dump custom does // in case have been deleted @@ -1334,7 +1334,7 @@ void ComputePropertyAtom::pack_quatw(int n) n += nvalues; } - } else { + } else if (avec_body) { AtomVecBody::Bonus *bonus = avec_body->bonus; int *body = atom->body; int *mask = atom->mask; @@ -1346,6 +1346,17 @@ void ComputePropertyAtom::pack_quatw(int n) else buf[n] = 0.0; n += nvalues; } + } else { + double **quat = atom->quat; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = quat[i][0]; + else buf[n] = 0.0; + n += nvalues; + } } } @@ -1366,7 +1377,7 @@ void ComputePropertyAtom::pack_quati(int n) n += nvalues; } - } else { + } else if (avec_body) { AtomVecBody::Bonus *bonus = avec_body->bonus; int *body = atom->body; int *mask = atom->mask; @@ -1378,6 +1389,17 @@ void ComputePropertyAtom::pack_quati(int n) else buf[n] = 0.0; n += nvalues; } + } else { + double **quat = atom->quat; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = quat[i][1]; + else buf[n] = 0.0; + n += nvalues; + } } } @@ -1398,7 +1420,7 @@ void ComputePropertyAtom::pack_quatj(int n) n += nvalues; } - } else { + } else if (avec_body) { AtomVecBody::Bonus *bonus = avec_body->bonus; int *body = atom->body; int *mask = atom->mask; @@ -1410,6 +1432,17 @@ void ComputePropertyAtom::pack_quatj(int n) else buf[n] = 0.0; n += nvalues; } + } else { + double **quat = atom->quat; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = quat[i][2]; + else buf[n] = 0.0; + n += nvalues; + } } } @@ -1430,7 +1463,7 @@ void ComputePropertyAtom::pack_quatk(int n) n += nvalues; } - } else { + } else if (avec_body) { AtomVecBody::Bonus *bonus = avec_body->bonus; int *body = atom->body; int *mask = atom->mask; @@ -1442,6 +1475,17 @@ void ComputePropertyAtom::pack_quatk(int n) else buf[n] = 0.0; n += nvalues; } + } else { + double **quat = atom->quat; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) + buf[n] = quat[i][3]; + else buf[n] = 0.0; + n += nvalues; + } } } diff --git a/src/compute_property_atom.h b/src/compute_property_atom.h index 903fece488..0e551e2818 100644 --- a/src/compute_property_atom.h +++ b/src/compute_property_atom.h @@ -141,31 +141,3 @@ class ComputePropertyAtom : public Compute { #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 property/atom for atom property that isn't allocated - -Self-explanatory. - -E: Compute property/atom integer vector does not exist - -The command is accessing a vector added by the fix property/atom -command, that does not exist. - -E: Compute property/atom floating point vector does not exist - -The command is accessing a vector added by the fix property/atom -command, that does not exist. - -E: Invalid keyword in compute property/atom command - -Self-explanatory. - -*/ diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index 1fc430d13c..3154e01516 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -115,7 +115,7 @@ void ComputePropertyChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute property/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute property/chunk does not use chunk/atom compute"); } @@ -196,7 +196,7 @@ void ComputePropertyChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_property_chunk.h b/src/compute_property_chunk.h index 83db5d6256..0d299a6026 100644 --- a/src/compute_property_chunk.h +++ b/src/compute_property_chunk.h @@ -66,41 +66,3 @@ class ComputePropertyChunk : public Compute { #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 chunk/atom stores no IDs for compute property/chunk - -It will only store IDs if its compress option is enabled. - -E: Compute chunk/atom stores no coord1 for compute property/chunk - -Only certain binning options for compute chunk/atom store coordinates. - -E: Compute chunk/atom stores no coord2 for compute property/chunk - -Only certain binning options for compute chunk/atom store coordinates. - -E: Compute chunk/atom stores no coord3 for compute property/chunk - -Only certain binning options for compute chunk/atom store coordinates. - -E: Invalid keyword in compute property/chunk command - -Self-explanatory. - -E: Chunk/atom compute does not exist for compute property/chunk - -Self-explanatory. - -E: Compute property/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_property_local.h b/src/compute_property_local.h index eec8e8ce94..4b669ca72d 100644 --- a/src/compute_property_local.h +++ b/src/compute_property_local.h @@ -87,43 +87,3 @@ class ComputePropertyLocal : public Compute { #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 property/local cannot use these inputs together - -Only inputs that generate the same number of datums can be used -together. E.g. bond and angle quantities cannot be mixed. - -E: Compute property/local does not (yet) work with atom_style template - -Self-explanatory. - -E: Compute property/local for property that isn't allocated - -Self-explanatory. - -E: Compute property/local requires atom attribute radius - -UNDOCUMENTED - -E: No pair style is defined for compute property/local - -Self-explanatory. - -E: Pair style does not support compute property/local - -The pair style does not have a single() function, so it can -not be invoked by fix bond/swap. - -U: Invalid keyword in compute property/local command - -Self-explanatory. - -*/ diff --git a/src/compute_rdf.h b/src/compute_rdf.h index 77dd0cc0c7..a8cdb6b89c 100644 --- a/src/compute_rdf.h +++ b/src/compute_rdf.h @@ -58,29 +58,3 @@ class ComputeRDF : public Compute { #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 rdf requires a pair style be defined or cutoff specified - -UNDOCUMENTED - -E: Compure rdf cutoff exceeds ghost atom range - use comm_modify cutoff command - -UNDOCUMENTED - -W: Compute rdf cutoff less than neighbor cutoff - forcing a needless neighbor list build - -UNDOCUMENTED - -U: Compute rdf requires a pair style be defined - -Self-explanatory. - -*/ diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index b9800ae94e..018f658c61 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -35,41 +34,45 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - nvalues(0), which(nullptr), argindex(nullptr), flavor(nullptr), - value2index(nullptr), ids(nullptr), onevec(nullptr), replace(nullptr), indices(nullptr), - owner(nullptr), idregion(nullptr), varatom(nullptr) + Compute(lmp, narg, arg), nvalues(0), which(nullptr), argindex(nullptr), flavor(nullptr), + value2index(nullptr), ids(nullptr), onevec(nullptr), replace(nullptr), indices(nullptr), + owner(nullptr), idregion(nullptr), region(nullptr), varatom(nullptr) { int iarg = 0; - if (strcmp(style,"reduce") == 0) { - if (narg < 5) error->all(FLERR,"Illegal compute reduce command"); - idregion = nullptr; + if (strcmp(style, "reduce") == 0) { + if (narg < 5) error->all(FLERR, "Illegal compute reduce command"); iarg = 3; - } else if (strcmp(style,"reduce/region") == 0) { - if (narg < 6) error->all(FLERR,"Illegal compute reduce/region command"); - iregion = domain->find_region(arg[3]); - if (iregion == -1) - error->all(FLERR,"Region ID for compute reduce/region does not exist"); + } else if (strcmp(style, "reduce/region") == 0) { + if (narg < 6) error->all(FLERR, "Illegal compute reduce/region command"); + if (!domain->get_region_by_id(arg[3])) + error->all(FLERR, "Region {} for compute reduce/region does not exist", arg[3]); idregion = utils::strdup(arg[3]); iarg = 4; } - if (strcmp(arg[iarg],"sum") == 0) mode = SUM; - else if (strcmp(arg[iarg],"sumsq") == 0) mode = SUMSQ; - else if (strcmp(arg[iarg],"min") == 0) mode = MINN; - else if (strcmp(arg[iarg],"max") == 0) mode = MAXX; - else if (strcmp(arg[iarg],"ave") == 0) mode = AVE; - else if (strcmp(arg[iarg],"avesq") == 0) mode = AVESQ; - else error->all(FLERR,"Illegal compute reduce command"); + if (strcmp(arg[iarg], "sum") == 0) + mode = SUM; + else if (strcmp(arg[iarg], "sumsq") == 0) + mode = SUMSQ; + else if (strcmp(arg[iarg], "min") == 0) + mode = MINN; + else if (strcmp(arg[iarg], "max") == 0) + mode = MAXX; + else if (strcmp(arg[iarg], "ave") == 0) + mode = AVE; + else if (strcmp(arg[iarg], "avesq") == 0) + mode = AVESQ; + else + error->all(FLERR, "Illegal compute {} operation {}", style, arg[iarg]); iarg++; - MPI_Comm_rank(world,&me); + MPI_Comm_rank(world, &me); // expand args if any have wildcard character "*" int expand = 0; char **earg; - int nargnew = utils::expand_args(FLERR,narg-iarg,&arg[iarg],1,earg,lmp); + int nargnew = utils::expand_args(FLERR, narg - iarg, &arg[iarg], 1, earg, lmp); if (earg != &arg[iarg]) expand = 1; arg = earg; @@ -79,9 +82,9 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : which = new int[nargnew]; argindex = new int[nargnew]; flavor = new int[nargnew]; - ids = new char*[nargnew]; + ids = new char *[nargnew]; value2index = new int[nargnew]; - for (int i=0; i < nargnew; ++i) { + for (int i = 0; i < nargnew; ++i) { which[i] = argindex[i] = flavor[i] = value2index[i] = ArgInfo::UNKNOWN; ids[i] = nullptr; } @@ -91,33 +94,33 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : while (iarg < nargnew) { ids[nvalues] = nullptr; - if (strcmp(arg[iarg],"x") == 0) { + if (strcmp(arg[iarg], "x") == 0) { which[nvalues] = ArgInfo::X; argindex[nvalues++] = 0; - } else if (strcmp(arg[iarg],"y") == 0) { + } else if (strcmp(arg[iarg], "y") == 0) { which[nvalues] = ArgInfo::X; argindex[nvalues++] = 1; - } else if (strcmp(arg[iarg],"z") == 0) { + } else if (strcmp(arg[iarg], "z") == 0) { which[nvalues] = ArgInfo::X; argindex[nvalues++] = 2; - } else if (strcmp(arg[iarg],"vx") == 0) { + } else if (strcmp(arg[iarg], "vx") == 0) { which[nvalues] = ArgInfo::V; argindex[nvalues++] = 0; - } else if (strcmp(arg[iarg],"vy") == 0) { + } else if (strcmp(arg[iarg], "vy") == 0) { which[nvalues] = ArgInfo::V; argindex[nvalues++] = 1; - } else if (strcmp(arg[iarg],"vz") == 0) { + } else if (strcmp(arg[iarg], "vz") == 0) { which[nvalues] = ArgInfo::V; argindex[nvalues++] = 2; - } else if (strcmp(arg[iarg],"fx") == 0) { + } else if (strcmp(arg[iarg], "fx") == 0) { which[nvalues] = ArgInfo::F; argindex[nvalues++] = 0; - } else if (strcmp(arg[iarg],"fy") == 0) { + } else if (strcmp(arg[iarg], "fy") == 0) { which[nvalues] = ArgInfo::F; argindex[nvalues++] = 1; - } else if (strcmp(arg[iarg],"fz") == 0) { + } else if (strcmp(arg[iarg], "fz") == 0) { which[nvalues] = ArgInfo::F; argindex[nvalues++] = 2; @@ -130,7 +133,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : ids[nvalues] = argi.copy_name(); if ((which[nvalues] == ArgInfo::UNKNOWN) || (argi.get_dim() > 1)) - error->all(FLERR,"Illegal compute reduce command"); + error->all(FLERR, "Illegal compute reduce command"); if (which[nvalues] == ArgInfo::NONE) break; nvalues++; @@ -145,20 +148,21 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvalues; i++) replace[i] = -1; while (iarg < nargnew) { - if (strcmp(arg[iarg],"replace") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal compute reduce command"); + if (strcmp(arg[iarg], "replace") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal compute reduce command"); if (mode != MINN && mode != MAXX) - error->all(FLERR,"Compute reduce replace requires min or max mode"); - int col1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp) - 1; - int col2 = utils::inumeric(FLERR,arg[iarg+2],false,lmp) - 1; + error->all(FLERR, "Compute reduce replace requires min or max mode"); + int col1 = utils::inumeric(FLERR, arg[iarg + 1], false, lmp) - 1; + int col2 = utils::inumeric(FLERR, arg[iarg + 2], false, lmp) - 1; if (col1 < 0 || col1 >= nvalues || col2 < 0 || col2 >= nvalues) - error->all(FLERR,"Illegal compute reduce command"); - if (col1 == col2) error->all(FLERR,"Illegal compute reduce command"); + error->all(FLERR, "Illegal compute reduce command"); + if (col1 == col2) error->all(FLERR, "Illegal compute reduce command"); if (replace[col1] >= 0 || replace[col2] >= 0) - error->all(FLERR,"Invalid replace values in compute reduce"); + error->all(FLERR, "Invalid replace values in compute reduce"); replace[col1] = col2; iarg += 3; - } else error->all(FLERR,"Illegal compute reduce command"); + } else + error->all(FLERR, "Illegal compute reduce command"); } // delete replace if not set @@ -167,14 +171,14 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < nvalues; i++) if (replace[i] >= 0) flag = 1; if (!flag) { - delete [] replace; + delete[] replace; replace = nullptr; } // if wildcard expansion occurred, free earg memory from expand_args() if (expand) { - for (int i = 0; i < nargnew; i++) delete [] earg[i]; + for (int i = 0; i < nargnew; i++) delete[] earg[i]; memory->sfree(earg); } @@ -186,65 +190,61 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : else if (which[i] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[i]); - if (icompute < 0) - error->all(FLERR,"Compute ID for compute reduce does not exist"); + if (icompute < 0) error->all(FLERR, "Compute ID for compute reduce does not exist"); if (modify->compute[icompute]->peratom_flag) { flavor[i] = PERATOM; - if (argindex[i] == 0 && - modify->compute[icompute]->size_peratom_cols != 0) - error->all(FLERR,"Compute reduce compute does not " + if (argindex[i] == 0 && modify->compute[icompute]->size_peratom_cols != 0) + error->all(FLERR, + "Compute reduce compute does not " "calculate a per-atom vector"); if (argindex[i] && modify->compute[icompute]->size_peratom_cols == 0) - error->all(FLERR,"Compute reduce compute does not " - "calculate a per-atom array"); - if (argindex[i] && - argindex[i] > modify->compute[icompute]->size_peratom_cols) error->all(FLERR, - "Compute reduce compute array is accessed out-of-range"); + "Compute reduce compute does not " + "calculate a per-atom array"); + if (argindex[i] && argindex[i] > modify->compute[icompute]->size_peratom_cols) + error->all(FLERR, "Compute reduce compute array is accessed out-of-range"); } else if (modify->compute[icompute]->local_flag) { flavor[i] = LOCAL; - if (argindex[i] == 0 && - modify->compute[icompute]->size_local_cols != 0) - error->all(FLERR,"Compute reduce compute does not " + if (argindex[i] == 0 && modify->compute[icompute]->size_local_cols != 0) + error->all(FLERR, + "Compute reduce compute does not " "calculate a local vector"); if (argindex[i] && modify->compute[icompute]->size_local_cols == 0) - error->all(FLERR,"Compute reduce compute does not " - "calculate a local array"); - if (argindex[i] && - argindex[i] > modify->compute[icompute]->size_local_cols) error->all(FLERR, - "Compute reduce compute array is accessed out-of-range"); - } else error->all(FLERR, - "Compute reduce compute calculates global values"); + "Compute reduce compute does not " + "calculate a local array"); + if (argindex[i] && argindex[i] > modify->compute[icompute]->size_local_cols) + error->all(FLERR, "Compute reduce compute array is accessed out-of-range"); + } else + error->all(FLERR, "Compute reduce compute calculates global values"); } else if (which[i] == ArgInfo::FIX) { auto ifix = modify->get_fix_by_id(ids[i]); - if (!ifix) - error->all(FLERR,"Fix ID {} for compute reduce does not exist", ids[i]); + if (!ifix) error->all(FLERR, "Fix ID {} for compute reduce does not exist", ids[i]); if (ifix->peratom_flag) { flavor[i] = PERATOM; if (argindex[i] == 0 && (ifix->size_peratom_cols != 0)) - error->all(FLERR,"Compute reduce fix {} does not calculate a per-atom vector", ids[i]); + error->all(FLERR, "Compute reduce fix {} does not calculate a per-atom vector", ids[i]); if (argindex[i] && (ifix->size_peratom_cols == 0)) - error->all(FLERR,"Compute reduce fix {} does not calculate a per-atom array", ids[i]); + error->all(FLERR, "Compute reduce fix {} does not calculate a per-atom array", ids[i]); if (argindex[i] && (argindex[i] > ifix->size_peratom_cols)) - error->all(FLERR,"Compute reduce fix {} array is accessed out-of-range", ids[i]); + error->all(FLERR, "Compute reduce fix {} array is accessed out-of-range", ids[i]); } else if (ifix->local_flag) { flavor[i] = LOCAL; if (argindex[i] == 0 && (ifix->size_local_cols != 0)) - error->all(FLERR,"Compute reduce fix {} does not calculate a local vector", ids[i]); + error->all(FLERR, "Compute reduce fix {} does not calculate a local vector", ids[i]); if (argindex[i] && (ifix->size_local_cols == 0)) - error->all(FLERR,"Compute reduce fix {} does not calculate a local array", ids[i]); + error->all(FLERR, "Compute reduce fix {} does not calculate a local array", ids[i]); if (argindex[i] && (argindex[i] > ifix->size_local_cols)) - error->all(FLERR,"Compute reduce fix {} array is accessed out-of-range", ids[i]); - } else error->all(FLERR,"Compute reduce fix {} calculates global values", ids[i]); + error->all(FLERR, "Compute reduce fix {} array is accessed out-of-range", ids[i]); + } else + error->all(FLERR, "Compute reduce fix {} calculates global values", ids[i]); } else if (which[i] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[i]); - if (ivariable < 0) - error->all(FLERR,"Variable name for compute reduce does not exist"); + if (ivariable < 0) error->all(FLERR, "Variable name for compute reduce does not exist"); if (input->variable->atomstyle(ivariable) == 0) - error->all(FLERR,"Compute reduce variable is not atom-style variable"); + error->all(FLERR, "Compute reduce variable is not atom-style variable"); flavor[i] = PERATOM; } } @@ -253,15 +253,19 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : if (nvalues == 1) { scalar_flag = 1; - if (mode == SUM || mode == SUMSQ) extscalar = 1; - else extscalar = 0; + if (mode == SUM || mode == SUMSQ) + extscalar = 1; + else + extscalar = 0; vector = onevec = nullptr; indices = owner = nullptr; } else { vector_flag = 1; size_vector = nvalues; - if (mode == SUM || mode == SUMSQ) extvector = 1; - else extvector = 0; + if (mode == SUM || mode == SUMSQ) + extvector = 1; + else + extvector = 0; vector = new double[size_vector]; onevec = new double[size_vector]; indices = new int[size_vector]; @@ -276,19 +280,19 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : ComputeReduce::~ComputeReduce() { - delete [] which; - delete [] argindex; - delete [] flavor; - for (int m = 0; m < nvalues; m++) delete [] ids[m]; - delete [] ids; - delete [] value2index; - delete [] replace; - delete [] idregion; + delete[] which; + delete[] argindex; + delete[] flavor; + for (int m = 0; m < nvalues; m++) delete[] ids[m]; + delete[] ids; + delete[] value2index; + delete[] replace; + delete[] idregion; - delete [] vector; - delete [] onevec; - delete [] indices; - delete [] owner; + delete[] vector; + delete[] onevec; + delete[] indices; + delete[] owner; memory->destroy(varatom); } @@ -302,31 +306,28 @@ void ComputeReduce::init() for (int m = 0; m < nvalues; m++) { if (which[m] == ArgInfo::COMPUTE) { int icompute = modify->find_compute(ids[m]); - if (icompute < 0) - error->all(FLERR,"Compute ID for compute reduce does not exist"); + if (icompute < 0) error->all(FLERR, "Compute ID for compute reduce does not exist"); value2index[m] = icompute; } else if (which[m] == ArgInfo::FIX) { int ifix = modify->find_fix(ids[m]); - if (ifix < 0) - error->all(FLERR,"Fix ID for compute reduce does not exist"); + if (ifix < 0) error->all(FLERR, "Fix ID for compute reduce does not exist"); value2index[m] = ifix; } else if (which[m] == ArgInfo::VARIABLE) { int ivariable = input->variable->find(ids[m]); - if (ivariable < 0) - error->all(FLERR,"Variable name for compute reduce does not exist"); + if (ivariable < 0) error->all(FLERR, "Variable name for compute reduce does not exist"); value2index[m] = ivariable; - } else value2index[m] = ArgInfo::UNKNOWN; + } else + value2index[m] = ArgInfo::UNKNOWN; } // set index and check validity of region if (idregion) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for compute reduce/region does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for compute reduce/region does not exist", idregion); } } @@ -336,16 +337,16 @@ double ComputeReduce::compute_scalar() { invoked_scalar = update->ntimestep; - double one = compute_one(0,-1); + double one = compute_one(0, -1); if (mode == SUM || mode == SUMSQ) { - MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&one, &scalar, 1, MPI_DOUBLE, MPI_SUM, world); } else if (mode == MINN) { - MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_MIN,world); + MPI_Allreduce(&one, &scalar, 1, MPI_DOUBLE, MPI_MIN, world); } else if (mode == MAXX) { - MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&one, &scalar, 1, MPI_DOUBLE, MPI_MAX, world); } else if (mode == AVE || mode == AVESQ) { - MPI_Allreduce(&one,&scalar,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&one, &scalar, 1, MPI_DOUBLE, MPI_SUM, world); bigint n = count(0); if (n) scalar /= n; } @@ -361,61 +362,59 @@ void ComputeReduce::compute_vector() for (int m = 0; m < nvalues; m++) if (!replace || replace[m] < 0) { - onevec[m] = compute_one(m,-1); + onevec[m] = compute_one(m, -1); indices[m] = index; } if (mode == SUM || mode == SUMSQ) { for (int m = 0; m < nvalues; m++) - MPI_Allreduce(&onevec[m],&vector[m],1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, MPI_SUM, world); } else if (mode == MINN) { if (!replace) { for (int m = 0; m < nvalues; m++) - MPI_Allreduce(&onevec[m],&vector[m],1,MPI_DOUBLE,MPI_MIN,world); + MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, MPI_MIN, world); } else { for (int m = 0; m < nvalues; m++) if (replace[m] < 0) { pairme.value = onevec[m]; pairme.proc = me; - MPI_Allreduce(&pairme,&pairall,1,MPI_DOUBLE_INT,MPI_MINLOC,world); + MPI_Allreduce(&pairme, &pairall, 1, MPI_DOUBLE_INT, MPI_MINLOC, world); vector[m] = pairall.value; owner[m] = pairall.proc; } for (int m = 0; m < nvalues; m++) if (replace[m] >= 0) { - if (me == owner[replace[m]]) - vector[m] = compute_one(m,indices[replace[m]]); - MPI_Bcast(&vector[m],1,MPI_DOUBLE,owner[replace[m]],world); + if (me == owner[replace[m]]) vector[m] = compute_one(m, indices[replace[m]]); + MPI_Bcast(&vector[m], 1, MPI_DOUBLE, owner[replace[m]], world); } } } else if (mode == MAXX) { if (!replace) { for (int m = 0; m < nvalues; m++) - MPI_Allreduce(&onevec[m],&vector[m],1,MPI_DOUBLE,MPI_MAX,world); + MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, MPI_MAX, world); } else { for (int m = 0; m < nvalues; m++) if (replace[m] < 0) { pairme.value = onevec[m]; pairme.proc = me; - MPI_Allreduce(&pairme,&pairall,1,MPI_DOUBLE_INT,MPI_MAXLOC,world); + MPI_Allreduce(&pairme, &pairall, 1, MPI_DOUBLE_INT, MPI_MAXLOC, world); vector[m] = pairall.value; owner[m] = pairall.proc; } for (int m = 0; m < nvalues; m++) if (replace[m] >= 0) { - if (me == owner[replace[m]]) - vector[m] = compute_one(m,indices[replace[m]]); - MPI_Bcast(&vector[m],1,MPI_DOUBLE,owner[replace[m]],world); + if (me == owner[replace[m]]) vector[m] = compute_one(m, indices[replace[m]]); + MPI_Bcast(&vector[m], 1, MPI_DOUBLE, owner[replace[m]], world); } } } else if (mode == AVE || mode == AVESQ) { for (int m = 0; m < nvalues; m++) { - MPI_Allreduce(&onevec[m],&vector[m],1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&onevec[m], &vector[m], 1, MPI_DOUBLE, MPI_SUM, world); bigint n = count(m); if (n) vector[m] /= n; } @@ -462,22 +461,25 @@ double ComputeReduce::compute_one(int m, int flag) double **x = atom->x; if (flag < 0) { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) combine(one,x[i][aidx],i); - } else one = x[flag][aidx]; + if (mask[i] & groupbit) combine(one, x[i][aidx], i); + } else + one = x[flag][aidx]; } else if (which[m] == ArgInfo::V) { double **v = atom->v; if (flag < 0) { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) combine(one,v[i][aidx],i); - } else one = v[flag][aidx]; + if (mask[i] & groupbit) combine(one, v[i][aidx], i); + } else + one = v[flag][aidx]; } else if (which[m] == ArgInfo::F) { double **f = atom->f; if (flag < 0) { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) combine(one,f[i][aidx],i); - } else one = f[flag][aidx]; + if (mask[i] & groupbit) combine(one, f[i][aidx], i); + } else + one = f[flag][aidx]; - // invoke compute if not previously invoked + // invoke compute if not previously invoked } else if (which[m] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[vidx]; @@ -493,16 +495,18 @@ double ComputeReduce::compute_one(int m, int flag) int n = nlocal; if (flag < 0) { for (i = 0; i < n; i++) - if (mask[i] & groupbit) combine(one,comp_vec[i],i); - } else one = comp_vec[flag]; + if (mask[i] & groupbit) combine(one, comp_vec[i], i); + } else + one = comp_vec[flag]; } else { double **carray_atom = compute->array_atom; int n = nlocal; int aidxm1 = aidx - 1; if (flag < 0) { for (i = 0; i < n; i++) - if (mask[i] & groupbit) combine(one,carray_atom[i][aidxm1],i); - } else one = carray_atom[flag][aidxm1]; + if (mask[i] & groupbit) combine(one, carray_atom[i][aidxm1], i); + } else + one = carray_atom[flag][aidxm1]; } } else if (flavor[m] == LOCAL) { @@ -515,25 +519,26 @@ double ComputeReduce::compute_one(int m, int flag) double *comp_vec = compute->vector_local; int n = compute->size_local_rows; if (flag < 0) - for (i = 0; i < n; i++) - combine(one,comp_vec[i],i); - else one = comp_vec[flag]; + for (i = 0; i < n; i++) combine(one, comp_vec[i], i); + else + one = comp_vec[flag]; } else { double **carray_local = compute->array_local; int n = compute->size_local_rows; int aidxm1 = aidx - 1; if (flag < 0) - for (i = 0; i < n; i++) - combine(one,carray_local[i][aidxm1],i); - else one = carray_local[flag][aidxm1]; + for (i = 0; i < n; i++) combine(one, carray_local[i][aidxm1], i); + else + one = carray_local[flag][aidxm1]; } } - // access fix fields, check if fix frequency is a match + // access fix fields, check if fix frequency is a match } else if (which[m] == ArgInfo::FIX) { if (update->ntimestep % modify->fix[vidx]->peratom_freq) - error->all(FLERR,"Fix used in compute reduce not " + error->all(FLERR, + "Fix used in compute reduce not " "computed at compatible time"); Fix *fix = modify->fix[vidx]; @@ -543,15 +548,17 @@ double ComputeReduce::compute_one(int m, int flag) int n = nlocal; if (flag < 0) { for (i = 0; i < n; i++) - if (mask[i] & groupbit) combine(one,fix_vector[i],i); - } else one = fix_vector[flag]; + if (mask[i] & groupbit) combine(one, fix_vector[i], i); + } else + one = fix_vector[flag]; } else { double **fix_array = fix->array_atom; int aidxm1 = aidx - 1; if (flag < 0) { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) combine(one,fix_array[i][aidxm1],i); - } else one = fix_array[flag][aidxm1]; + if (mask[i] & groupbit) combine(one, fix_array[i][aidxm1], i); + } else + one = fix_array[flag][aidxm1]; } } else if (flavor[m] == LOCAL) { @@ -559,34 +566,35 @@ double ComputeReduce::compute_one(int m, int flag) double *fix_vector = fix->vector_local; int n = fix->size_local_rows; if (flag < 0) - for (i = 0; i < n; i++) - combine(one,fix_vector[i],i); - else one = fix_vector[flag]; + for (i = 0; i < n; i++) combine(one, fix_vector[i], i); + else + one = fix_vector[flag]; } else { double **fix_array = fix->array_local; int n = fix->size_local_rows; int aidxm1 = aidx - 1; if (flag < 0) - for (i = 0; i < n; i++) - combine(one,fix_array[i][aidxm1],i); - else one = fix_array[flag][aidxm1]; + for (i = 0; i < n; i++) combine(one, fix_array[i][aidxm1], i); + else + one = fix_array[flag][aidxm1]; } } - // evaluate atom-style variable + // evaluate atom-style variable } else if (which[m] == ArgInfo::VARIABLE) { if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(varatom); - memory->create(varatom,maxatom,"reduce:varatom"); + memory->create(varatom, maxatom, "reduce:varatom"); } - input->variable->compute_atom(vidx,igroup,varatom,1,0); + input->variable->compute_atom(vidx, igroup, varatom, 1, 0); if (flag < 0) { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) combine(one,varatom[i],i); - } else one = varatom[flag]; + if (mask[i] & groupbit) combine(one, varatom[i], i); + } else + one = varatom[flag]; } return one; @@ -607,7 +615,7 @@ bigint ComputeReduce::count(int m) } else if (flavor[m] == LOCAL) { bigint ncount = compute->size_local_rows; bigint ncountall; - MPI_Allreduce(&ncount,&ncountall,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&ncount, &ncountall, 1, MPI_LMP_BIGINT, MPI_SUM, world); return ncountall; } } else if (which[m] == ArgInfo::FIX) { @@ -617,7 +625,7 @@ bigint ComputeReduce::count(int m) } else if (flavor[m] == LOCAL) { bigint ncount = fix->size_local_rows; bigint ncountall; - MPI_Allreduce(&ncount,&ncountall,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&ncount, &ncountall, 1, MPI_LMP_BIGINT, MPI_SUM, world); return ncountall; } } else if (which[m] == ArgInfo::VARIABLE) @@ -634,8 +642,10 @@ bigint ComputeReduce::count(int m) void ComputeReduce::combine(double &one, double two, int i) { - if (mode == SUM || mode == AVE) one += two; - else if (mode == SUMSQ || mode == AVESQ) one += two*two; + if (mode == SUM || mode == AVE) + one += two; + else if (mode == SUMSQ || mode == AVESQ) + one += two * two; else if (mode == MINN) { if (two < one) { one = two; @@ -655,6 +665,6 @@ void ComputeReduce::combine(double &one, double two, int i) double ComputeReduce::memory_usage() { - double bytes = (double)maxatom * sizeof(double); + double bytes = (double) maxatom * sizeof(double); return bytes; } diff --git a/src/compute_reduce.h b/src/compute_reduce.h index ac2b1e60a2..a7590ccd52 100644 --- a/src/compute_reduce.h +++ b/src/compute_reduce.h @@ -38,14 +38,14 @@ class ComputeReduce : public Compute { protected: int me; - int mode, nvalues, iregion; + int mode, nvalues; int *which, *argindex, *flavor, *value2index; char **ids; double *onevec; int *replace, *indices, *owner; int index; char *idregion; - + class Region *region; int maxatom; double *varatom; @@ -64,94 +64,3 @@ class ComputeReduce : public Compute { #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: Region ID for compute reduce/region does not exist - -Self-explanatory. - -E: Compute reduce replace requires min or max mode - -Self-explanatory. - -E: Invalid replace values in compute reduce - -Self-explanatory. - -E: Compute ID for compute reduce does not exist - -Self-explanatory. - -E: Compute reduce compute does not calculate a per-atom vector - -Self-explanatory. - -E: Compute reduce compute does not calculate a per-atom array - -Self-explanatory. - -E: Compute reduce compute array is accessed out-of-range - -An index for the array is out of bounds. - -E: Compute reduce compute does not calculate a local vector - -Self-explanatory. - -E: Compute reduce compute does not calculate a local array - -Self-explanatory. - -E: Compute reduce compute calculates global values - -A compute that calculates peratom or local values is required. - -E: Fix ID for compute reduce does not exist - -Self-explanatory. - -E: Compute reduce fix does not calculate a per-atom vector - -Self-explanatory. - -E: Compute reduce fix does not calculate a per-atom array - -Self-explanatory. - -E: Compute reduce fix array is accessed out-of-range - -An index for the array is out of bounds. - -E: Compute reduce fix does not calculate a local vector - -Self-explanatory. - -E: Compute reduce fix does not calculate a local array - -Self-explanatory. - -E: Compute reduce fix calculates global values - -A fix that calculates peratom or local values is required. - -E: Variable name for compute reduce does not exist - -Self-explanatory. - -E: Compute reduce variable is not atom-style variable - -Self-explanatory. - -E: Fix used in compute reduce not computed at compatible time - -Fixes generate their values on specific timesteps. Compute reduce is -requesting a value on a non-allowed timestep. - -*/ diff --git a/src/compute_reduce_chunk.cpp b/src/compute_reduce_chunk.cpp index 84af9056aa..1749503254 100644 --- a/src/compute_reduce_chunk.cpp +++ b/src/compute_reduce_chunk.cpp @@ -229,7 +229,7 @@ void ComputeReduceChunk::init_chunk() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute reduce/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute reduce/chunk does not use chunk/atom compute"); } @@ -451,7 +451,7 @@ void ComputeReduceChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_reduce_chunk.h b/src/compute_reduce_chunk.h index b595558bc7..4c83093c6b 100644 --- a/src/compute_reduce_chunk.h +++ b/src/compute_reduce_chunk.h @@ -65,13 +65,3 @@ class ComputeReduceChunk : public Compute { #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. - -*/ diff --git a/src/compute_reduce_region.cpp b/src/compute_reduce_region.cpp index 6e634f9e88..f8a92c7bf3 100644 --- a/src/compute_reduce_region.cpp +++ b/src/compute_reduce_region.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -29,12 +28,14 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ ComputeReduceRegion::ComputeReduceRegion(LAMMPS *lmp, int narg, char **arg) : - ComputeReduce(lmp, narg, arg) {} + ComputeReduce(lmp, narg, arg) +{ +} /* ---------------------------------------------------------------------- calculate reduced value for one input M and return it @@ -47,9 +48,6 @@ ComputeReduceRegion::ComputeReduceRegion(LAMMPS *lmp, int narg, char **arg) : double ComputeReduceRegion::compute_one(int m, int flag) { - int i; - - Region *region = domain->regions[iregion]; region->prematch(); // invoke the appropriate attribute,compute,fix,variable @@ -78,26 +76,29 @@ double ComputeReduceRegion::compute_one(int m, int flag) if (which[m] == ArgInfo::X) { if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,x[i][j],i); - } else one = x[flag][j]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, x[i][j], i); + } else + one = x[flag][j]; } else if (which[m] == ArgInfo::V) { double **v = atom->v; if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,v[i][j],i); - } else one = v[flag][j]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, v[i][j], i); + } else + one = v[flag][j]; } else if (which[m] == ArgInfo::F) { double **f = atom->f; if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,f[i][j],i); - } else one = f[flag][j]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, f[i][j], i); + } else + one = f[flag][j]; - // invoke compute if not previously invoked + // invoke compute if not previously invoked } else if (which[m] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[n]; @@ -111,18 +112,20 @@ double ComputeReduceRegion::compute_one(int m, int flag) if (j == 0) { double *compute_vector = compute->vector_atom; if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,compute_vector[i],i); - } else one = compute_vector[flag]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, compute_vector[i], i); + } else + one = compute_vector[flag]; } else { double **compute_array = compute->array_atom; int jm1 = j - 1; if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,compute_array[i][jm1],i); - } else one = compute_array[flag][jm1]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, compute_array[i][jm1], i); + } else + one = compute_array[flag][jm1]; } } else if (flavor[m] == LOCAL) { @@ -134,76 +137,79 @@ double ComputeReduceRegion::compute_one(int m, int flag) if (j == 0) { double *compute_vector = compute->vector_local; if (flag < 0) - for (i = 0; i < compute->size_local_rows; i++) - combine(one,compute_vector[i],i); - else one = compute_vector[flag]; + for (int i = 0; i < compute->size_local_rows; i++) combine(one, compute_vector[i], i); + else + one = compute_vector[flag]; } else { double **compute_array = compute->array_local; int jm1 = j - 1; if (flag < 0) - for (i = 0; i < compute->size_local_rows; i++) - combine(one,compute_array[i][jm1],i); - else one = compute_array[flag][jm1]; + for (int i = 0; i < compute->size_local_rows; i++) combine(one, compute_array[i][jm1], i); + else + one = compute_array[flag][jm1]; } } - // check if fix frequency is a match + // check if fix frequency is a match } else if (which[m] == ArgInfo::FIX) { if (update->ntimestep % modify->fix[n]->peratom_freq) - error->all(FLERR,"Fix used in compute reduce not computed at compatible time"); + error->all(FLERR, "Fix used in compute reduce not computed at compatible time"); Fix *fix = modify->fix[n]; if (flavor[m] == PERATOM) { if (j == 0) { double *fix_vector = fix->vector_atom; if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,fix_vector[i],i); - } else one = fix_vector[flag]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, fix_vector[i], i); + } else + one = fix_vector[flag]; } else { double **fix_array = fix->array_atom; int jm1 = j - 1; if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,fix_array[i][jm1],i); - } else one = fix_array[flag][jm1]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, fix_array[i][jm1], i); + } else + one = fix_array[flag][jm1]; } } else if (flavor[m] == LOCAL) { if (j == 0) { double *fix_vector = fix->vector_local; if (flag < 0) - for (i = 0; i < fix->size_local_rows; i++) - combine(one,fix_vector[i],i); - else one = fix_vector[flag]; + for (int i = 0; i < fix->size_local_rows; i++) combine(one, fix_vector[i], i); + else + one = fix_vector[flag]; } else { double **fix_array = fix->array_local; int jm1 = j - 1; if (flag < 0) - for (i = 0; i < fix->size_local_rows; i++) - combine(one,fix_array[i][jm1],i); - else one = fix_array[flag][jm1]; + for (int i = 0; i < fix->size_local_rows; i++) combine(one, fix_array[i][jm1], i); + else + one = fix_array[flag][jm1]; } } - // evaluate atom-style variable + // evaluate atom-style variable } else if (which[m] == ArgInfo::VARIABLE) { if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(varatom); - memory->create(varatom,maxatom,"reduce/region:varatom"); + memory->create(varatom, maxatom, "reduce/region:varatom"); } - input->variable->compute_atom(n,igroup,varatom,1,0); + input->variable->compute_atom(n, igroup, varatom, 1, 0); if (flag < 0) { - for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) - combine(one,varatom[i],i); - } else one = varatom[flag]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) + combine(one, varatom[i], i); + } else + one = varatom[flag]; } return one; @@ -216,29 +222,29 @@ bigint ComputeReduceRegion::count(int m) int n = value2index[m]; if (which[m] == ArgInfo::X || which[m] == ArgInfo::V || which[m] == ArgInfo::F) - return group->count(igroup,iregion); + return group->count(igroup, region); else if (which[m] == ArgInfo::COMPUTE) { Compute *compute = modify->compute[n]; if (flavor[m] == PERATOM) { - return group->count(igroup,iregion); + return group->count(igroup, region); } else if (flavor[m] == LOCAL) { bigint ncount = compute->size_local_rows; bigint ncountall; - MPI_Allreduce(&ncount,&ncountall,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&ncount, &ncountall, 1, MPI_DOUBLE, MPI_SUM, world); return ncountall; } } else if (which[m] == ArgInfo::FIX) { Fix *fix = modify->fix[n]; if (flavor[m] == PERATOM) { - return group->count(igroup,iregion); + return group->count(igroup, region); } else if (flavor[m] == LOCAL) { bigint ncount = fix->size_local_rows; bigint ncountall; - MPI_Allreduce(&ncount,&ncountall,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&ncount, &ncountall, 1, MPI_DOUBLE, MPI_SUM, world); return ncountall; } } else if (which[m] == ArgInfo::VARIABLE) - return group->count(igroup,iregion); + return group->count(igroup, region); bigint dummy = 0; return dummy; diff --git a/src/compute_reduce_region.h b/src/compute_reduce_region.h index 04dd8b82e8..05ebc693fe 100644 --- a/src/compute_reduce_region.h +++ b/src/compute_reduce_region.h @@ -37,12 +37,3 @@ class ComputeReduceRegion : public ComputeReduce { #endif #endif - -/* ERROR/WARNING messages: - -E: Fix used in compute reduce not computed at compatible time - -Fixes generate their values on specific timesteps. Compute reduce is -requesting a value on a non-allowed timestep. - -*/ diff --git a/src/compute_slice.h b/src/compute_slice.h index 742f5a9b10..fd82df2d4e 100644 --- a/src/compute_slice.h +++ b/src/compute_slice.h @@ -45,82 +45,3 @@ class ComputeSlice : public Compute { #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 compute slice does not exist - -Self-explanatory. - -E: Compute slice compute does not calculate a global array - -Self-explanatory. - -E: Compute slice compute vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Compute slice compute does not calculate a global vector - -Self-explanatory. - -E: Compute slice compute array is accessed out-of-range - -An index for the array is out of bounds. - -E: Compute slice compute does not calculate global vector or array - -Self-explanatory. - -E: Fix ID for compute slice does not exist - -Self-explanatory. - -E: Compute slice fix does not calculate a global array - -Self-explanatory. - -E: Compute slice fix vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Compute slice fix does not calculate a global vector - -Self-explanatory. - -E: Compute slice fix array is accessed out-of-range - -An index for the array is out of bounds. - -E: Compute slice fix does not calculate global vector or array - -Self-explanatory. - -E: Variable name for compute slice does not exist - -UNDOCUMENTED - -E: Compute slice variable is not vector-style variable - -UNDOCUMENTED - -E: Compute slice vector variable cannot be indexed - -UNDOCUMENTED - -E: Fix used in compute slice not computed at compatible time - -Fixes generate their values on specific timesteps. Compute slice is -requesting a value on a non-allowed timestep. - -E: Compute slice variable is not long enough - -UNDOCUMENTED - -*/ diff --git a/src/compute_stress_atom.h b/src/compute_stress_atom.h index 4f636ed9bd..a160785c3e 100644 --- a/src/compute_stress_atom.h +++ b/src/compute_stress_atom.h @@ -48,27 +48,3 @@ class ComputeStressAtom : public Compute { #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: Could not find compute stress/atom temperature ID - -Self-explanatory. - -E: Compute stress/atom temperature ID does not compute temperature - -The specified compute must compute temperature. - -E: Per-atom virial was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to have -tallied the virial, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -*/ diff --git a/src/compute_temp.h b/src/compute_temp.h index 674144be83..98a5ee8325 100644 --- a/src/compute_temp.h +++ b/src/compute_temp.h @@ -43,18 +43,3 @@ class ComputeTemp : public Compute { #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: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 8798835071..bd17e3995d 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -164,7 +164,7 @@ void ComputeTempChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute temp/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute temp/chunk does not use chunk/atom compute"); @@ -774,7 +774,7 @@ void ComputeTempChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_temp_chunk.h b/src/compute_temp_chunk.h index b283de9dbc..354966039a 100644 --- a/src/compute_temp_chunk.h +++ b/src/compute_temp_chunk.h @@ -73,42 +73,3 @@ class ComputeTempChunk : public Compute { #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: Could not find compute ID for temperature bias - -Self-explanatory. - -E: Bias compute does not calculate temperature - -The specified compute must compute temperature. - -E: Bias compute does not calculate a velocity bias - -The specified compute must compute a bias for temperature. - -E: Cannot use both com and bias with compute temp/chunk - -Self-explanatory. - -E: Chunk/atom compute does not exist for compute temp/chunk - -Self-explanatory. - -E: Compute temp/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_com.h b/src/compute_temp_com.h index 595c50502d..e02a1adce5 100644 --- a/src/compute_temp_com.h +++ b/src/compute_temp_com.h @@ -50,18 +50,3 @@ class ComputeTempCOM : public Compute { #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: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index cd467c0069..a9617596dd 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -67,9 +67,10 @@ void ComputeTempDeform::init() auto fixes = modify->get_fix_by_style("^deform"); if (fixes.size() > 0) { - if (((FixDeform *) fixes[0])->remapflag == Domain::X_REMAP && comm->me == 0) + if ((dynamic_cast(fixes[0]))->remapflag == Domain::X_REMAP && comm->me == 0) error->warning(FLERR, "Using compute temp/deform with inconsistent fix deform remap option"); - } else error->warning(FLERR, "Using compute temp/deform with no fix deform defined"); + } else + error->warning(FLERR, "Using compute temp/deform with no fix deform defined"); } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_temp_deform.h b/src/compute_temp_deform.h index a120108669..ec9b5a4a85 100644 --- a/src/compute_temp_deform.h +++ b/src/compute_temp_deform.h @@ -51,28 +51,3 @@ class ComputeTempDeform : public Compute { #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. - -W: Using compute temp/deform with inconsistent fix deform remap option - -Fix nvt/sllod assumes deforming atoms have a velocity profile provided -by "remap v" or "remap none" as a fix deform option. - -W: Using compute temp/deform with no fix deform defined - -This is probably an error, since it makes little sense to use -compute temp/deform in this case. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_partial.h b/src/compute_temp_partial.h index 55c7ceb5e8..7bd82b7027 100644 --- a/src/compute_temp_partial.h +++ b/src/compute_temp_partial.h @@ -54,22 +54,3 @@ class ComputeTempPartial : public Compute { #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 temp/partial cannot use vz for 2d systemx - -Self-explanatory. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index ff6bc36a08..4b8e77029b 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -119,6 +119,9 @@ ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : nbins = nbinx*nbiny*nbinz; if (nbins <= 0) error->all(FLERR,"Illegal compute temp/profile command"); + nstreaming = (xflag==0 ? 0 : 1) + (yflag==0 ? 0 : 1) + (zflag==0 ? 0 : 1); + reset_extra_dof(); + memory->create(vbin,nbins,ncount,"temp/profile:vbin"); memory->create(binave,nbins,ncount,"temp/profile:binave"); @@ -197,9 +200,10 @@ void ComputeTempProfile::dof_compute() natoms_temp = group->count(igroup); dof = domain->dimension * natoms_temp; - // subtract additional d*Nbins DOF, as in Evans and Morriss paper + // subtract additional Nbins DOF for each adjusted direction, + // as in Evans and Morriss paper - dof -= extra_dof + fix_dof + domain->dimension*nbins; + dof -= extra_dof + fix_dof + nstreaming*nbins; if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); else tfactor = 0.0; } @@ -334,14 +338,19 @@ void ComputeTempProfile::compute_array() MPI_Allreduce(tbin,tbinall,nbins,MPI_DOUBLE,MPI_SUM,world); - int nper = domain->dimension; + double totcount = 0.0; for (i = 0; i < nbins; i++) { array[i][0] = binave[i][ncount-1]; + totcount += array[i][0]; + } + double nper = domain->dimension - (extra_dof + fix_dof)/totcount; + double dofbin, tfactorbin; + for (i = 0; i < nbins; i++) { if (array[i][0] > 0.0) { - dof = nper*array[i][0] - extra_dof; - if (dof > 0) tfactor = force->mvv2e / (dof * force->boltz); - else tfactor = 0.0; - array[i][1] = tfactor*tbinall[i]; + dofbin = nper*array[i][0] - nstreaming; + if (dofbin > 0) tfactorbin = force->mvv2e / (dofbin * force->boltz); + else tfactorbin = 0.0; + array[i][1] = tfactorbin*tbinall[i]; } else array[i][1] = 0.0; } } @@ -576,6 +585,12 @@ void ComputeTempProfile::bin_assign() /* ---------------------------------------------------------------------- */ +void ComputeTempProfile::reset_extra_dof() { + extra_dof = domain->dimension - nstreaming; +} + +/* ---------------------------------------------------------------------- */ + double ComputeTempProfile::memory_usage() { double bytes = (double)maxatom * sizeof(int); diff --git a/src/compute_temp_profile.h b/src/compute_temp_profile.h index f9f2e42156..13c7f030fd 100644 --- a/src/compute_temp_profile.h +++ b/src/compute_temp_profile.h @@ -34,6 +34,7 @@ class ComputeTempProfile : public Compute { void compute_vector() override; void compute_array() override; + void reset_extra_dof() override; void remove_bias(int, double *) override; void remove_bias_thr(int, double *, double *) override; void remove_bias_all() override; @@ -47,6 +48,7 @@ class ComputeTempProfile : public Compute { int nbinx, nbiny, nbinz, nbins; int ivx, ivy, ivz; double tfactor; + double nstreaming; int box_change, triclinic; int *periodicity; @@ -68,26 +70,3 @@ class ComputeTempProfile : public Compute { #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 temp/profile cannot use vz for 2d systemx - -Self-explanatory. - -E: Compute temp/profile cannot bin z for 2d systems - -Self-explanatory. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_ramp.h b/src/compute_temp_ramp.h index e2d790fff1..8cc0e3fd44 100644 --- a/src/compute_temp_ramp.h +++ b/src/compute_temp_ramp.h @@ -56,18 +56,3 @@ class ComputeTempRamp : public Compute { #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: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index 34c0206eeb..d65ac67147 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -28,14 +27,12 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - idregion(nullptr) + Compute(lmp, narg, arg), region(nullptr), idregion(nullptr) { - if (narg != 4) error->all(FLERR,"Illegal compute temp/region command"); + if (narg != 4) error->all(FLERR, "Illegal compute temp/region command"); - iregion = domain->find_region(arg[3]); - if (iregion == -1) - error->all(FLERR,"Region ID for compute temp/region does not exist"); + if (!domain->get_region_by_id(arg[3])) + error->all(FLERR, "Region {} for compute temp/region does not exist", arg[3]); idregion = utils::strdup(arg[3]); scalar_flag = vector_flag = 1; @@ -54,9 +51,9 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : ComputeTempRegion::~ComputeTempRegion() { - delete [] idregion; + delete[] idregion; memory->destroy(vbiasall); - delete [] vector; + delete[] vector; } /* ---------------------------------------------------------------------- */ @@ -65,9 +62,8 @@ void ComputeTempRegion::init() { // set index and check validity of region - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for compute temp/region does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for compute temp/region does not exist", idregion); } /* ---------------------------------------------------------------------- */ @@ -83,7 +79,7 @@ void ComputeTempRegion::setup() void ComputeTempRegion::dof_remove_pre() { - domain->regions[iregion]->prematch(); + region->prematch(); } /* ---------------------------------------------------------------------- */ @@ -91,7 +87,7 @@ void ComputeTempRegion::dof_remove_pre() int ComputeTempRegion::dof_remove(int i) { double *x = atom->x[i]; - if (domain->regions[iregion]->match(x[0],x[1],x[2])) return 0; + if (region->match(x[0], x[1], x[2])) return 0; return 1; } @@ -109,7 +105,6 @@ double ComputeTempRegion::compute_scalar() int *mask = atom->mask; int nlocal = atom->nlocal; - Region *region = domain->regions[iregion]; region->prematch(); int count = 0; @@ -117,28 +112,29 @@ double ComputeTempRegion::compute_scalar() if (rmass) { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { count++; - t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * rmass[i]; + t += (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]) * rmass[i]; } } else { for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { count++; - t += (v[i][0]*v[i][0] + v[i][1]*v[i][1] + v[i][2]*v[i][2]) * - mass[type[i]]; + t += (v[i][0] * v[i][0] + v[i][1] * v[i][1] + v[i][2] * v[i][2]) * mass[type[i]]; } } - double tarray[2],tarray_all[2]; + double tarray[2], tarray_all[2]; tarray[0] = count; tarray[1] = t; - MPI_Allreduce(tarray,tarray_all,2,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(tarray, tarray_all, 2, MPI_DOUBLE, MPI_SUM, world); dof = domain->dimension * tarray_all[0] - extra_dof; if (dof < 0.0 && tarray_all[0] > 0.0) - error->all(FLERR,"Temperature compute degrees of freedom < 0"); - if (dof > 0) scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); - else scalar = 0.0; + error->all(FLERR, "Temperature compute degrees of freedom < 0"); + if (dof > 0) + scalar = force->mvv2e * tarray_all[1] / (dof * force->boltz); + else + scalar = 0.0; return scalar; } @@ -158,25 +154,26 @@ void ComputeTempRegion::compute_vector() int *mask = atom->mask; int nlocal = atom->nlocal; - Region *region = domain->regions[iregion]; region->prematch(); - double massone,t[6]; + double massone, t[6]; for (i = 0; i < 6; i++) t[i] = 0.0; for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { - if (rmass) massone = rmass[i]; - else massone = mass[type[i]]; - t[0] += massone * v[i][0]*v[i][0]; - t[1] += massone * v[i][1]*v[i][1]; - t[2] += massone * v[i][2]*v[i][2]; - t[3] += massone * v[i][0]*v[i][1]; - t[4] += massone * v[i][0]*v[i][2]; - t[5] += massone * v[i][1]*v[i][2]; + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { + if (rmass) + massone = rmass[i]; + else + massone = mass[type[i]]; + t[0] += massone * v[i][0] * v[i][0]; + t[1] += massone * v[i][1] * v[i][1]; + t[2] += massone * v[i][2] * v[i][2]; + t[3] += massone * v[i][0] * v[i][1]; + t[4] += massone * v[i][0] * v[i][2]; + t[5] += massone * v[i][1] * v[i][2]; } - MPI_Allreduce(t,vector,6,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(t, vector, 6, MPI_DOUBLE, MPI_SUM, world); for (i = 0; i < 6; i++) vector[i] *= force->mvv2e; } @@ -187,7 +184,7 @@ void ComputeTempRegion::compute_vector() void ComputeTempRegion::remove_bias(int i, double *v) { double *x = atom->x[i]; - if (domain->regions[iregion]->match(x[0],x[1],x[2])) + if (region->match(x[0], x[1], x[2])) vbias[0] = vbias[1] = vbias[2] = 0.0; else { vbias[0] = v[0]; @@ -204,7 +201,7 @@ void ComputeTempRegion::remove_bias(int i, double *v) void ComputeTempRegion::remove_bias_thr(int i, double *v, double *b) { double *x = atom->x[i]; - if (domain->regions[iregion]->match(x[0],x[1],x[2])) + if (region->match(x[0], x[1], x[2])) b[0] = b[1] = b[2] = 0.0; else { b[0] = v[0]; @@ -228,14 +225,12 @@ void ComputeTempRegion::remove_bias_all() if (atom->nmax > maxbias) { memory->destroy(vbiasall); maxbias = atom->nmax; - memory->create(vbiasall,maxbias,3,"temp/region:vbiasall"); + memory->create(vbiasall, maxbias, 3, "temp/region:vbiasall"); } - Region *region = domain->regions[iregion]; - for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region->match(x[i][0],x[i][1],x[i][2])) + if (region->match(x[i][0], x[i][1], x[i][2])) vbiasall[i][0] = vbiasall[i][1] = vbiasall[i][2] = 0.0; else { vbiasall[i][0] = v[i][0]; @@ -293,6 +288,6 @@ void ComputeTempRegion::restore_bias_all() double ComputeTempRegion::memory_usage() { - double bytes = 3*maxbias * sizeof(double); + double bytes = 3 * maxbias * sizeof(double); return bytes; } diff --git a/src/compute_temp_region.h b/src/compute_temp_region.h index 8129f01023..784af5ddf2 100644 --- a/src/compute_temp_region.h +++ b/src/compute_temp_region.h @@ -45,7 +45,7 @@ class ComputeTempRegion : public Compute { double memory_usage() override; protected: - int iregion; + class Region *region; char *idregion; }; @@ -53,22 +53,3 @@ class ComputeTempRegion : public Compute { #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: Region ID for compute temp/region does not exist - -Self-explanatory. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_temp_sphere.h b/src/compute_temp_sphere.h index 7b91a890a2..483a7e20f1 100644 --- a/src/compute_temp_sphere.h +++ b/src/compute_temp_sphere.h @@ -51,39 +51,3 @@ class ComputeTempSphere : public Compute { #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 temp/sphere requires atom style sphere - -Self-explanatory. - -E: Could not find compute ID for temperature bias - -Self-explanatory. - -E: Bias compute does not calculate temperature - -The specified compute must compute temperature. - -E: Bias compute does not calculate a velocity bias - -The specified compute must compute a bias for temperature. - -E: Bias compute group does not match compute group - -The specified compute must operate on the same group as the parent -compute. - -E: Temperature compute degrees of freedom < 0 - -This should not happen if you are calculating the temperature -on a valid set of atoms. - -*/ diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index 508956bb27..79c0ce5aed 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -73,7 +73,7 @@ void ComputeTorqueChunk::init() if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for " "compute torque/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute torque/chunk does not use chunk/atom compute"); } @@ -185,7 +185,7 @@ void ComputeTorqueChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_torque_chunk.h b/src/compute_torque_chunk.h index a1fce2d0d4..a0b5f72db4 100644 --- a/src/compute_torque_chunk.h +++ b/src/compute_torque_chunk.h @@ -55,21 +55,3 @@ class ComputeTorqueChunk : public Compute { #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: Chunk/atom compute does not exist for compute torque/chunk - -Self-explanatory. - -E: Compute torque/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index b6fbbedc48..ce3ba557aa 100644 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -40,7 +40,7 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) : // id = compute-ID + COMPUTE_STORE, fix group = compute group id_fix = utils::strdup(id + std::string("_COMPUTE_STORE")); - fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup])); + fix = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup]))); // store current velocities in fix store array // skip if reset from restart file @@ -84,7 +84,7 @@ void ComputeVACF::init() { // set fix which stores original atom velocities - fix = (FixStore *) modify->get_fix_by_id(id_fix); + fix = dynamic_cast( modify->get_fix_by_id(id_fix)); if (!fix) error->all(FLERR,"Could not find compute vacf fix ID {}", id_fix); // nvacf = # of atoms in group diff --git a/src/compute_vacf.h b/src/compute_vacf.h index 7bc93dbaaa..00ddb8be0f 100644 --- a/src/compute_vacf.h +++ b/src/compute_vacf.h @@ -42,17 +42,3 @@ class ComputeVACF : public Compute { #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: Could not find compute vacf fix ID - -Self-explanatory. - -*/ diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index 8148ed3356..5ac73f8d1e 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -73,7 +73,7 @@ void ComputeVCMChunk::init() int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for compute vcm/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Compute vcm/chunk does not use chunk/atom compute"); } @@ -175,7 +175,7 @@ void ComputeVCMChunk::lock_disable() { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->lockcount--; } } diff --git a/src/compute_vcm_chunk.h b/src/compute_vcm_chunk.h index 42ae0de7ef..02c280df04 100644 --- a/src/compute_vcm_chunk.h +++ b/src/compute_vcm_chunk.h @@ -56,21 +56,3 @@ class ComputeVCMChunk : public Compute { #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: Chunk/atom compute does not exist for compute vcm/chunk - -Self-explanatory. - -E: Compute vcm/chunk does not use chunk/atom compute - -The style of the specified compute is not chunk/atom. - -*/ diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index f21d1fc23d..8690b7c28e 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -46,10 +45,10 @@ using namespace MathConst; #define EPSILON 1.0e-6 #define LB_FACTOR 1.1 -enum{BOX,REGION,SINGLE,RANDOM}; -enum{ATOM,MOLECULE}; -enum{COUNT,INSERT,INSERT_SELECTED}; -enum{NONE,RATIO,SUBSET}; +enum { BOX, REGION, SINGLE, RANDOM }; +enum { ATOM, MOLECULE }; +enum { COUNT, INSERT, INSERT_SELECTED }; +enum { NONE, RATIO, SUBSET }; /* ---------------------------------------------------------------------- */ @@ -59,70 +58,67 @@ CreateAtoms::CreateAtoms(LAMMPS *lmp) : Command(lmp), basistype(nullptr) {} void CreateAtoms::command(int narg, char **arg) { - MPI_Comm_rank(world,&me); - MPI_Comm_size(world,&nprocs); - if (domain->box_exist == 0) - error->all(FLERR,"Create_atoms command before simulation box is defined"); + error->all(FLERR, "Create_atoms command before simulation box is defined"); if (modify->nfix_restart_peratom) - error->all(FLERR,"Cannot create_atoms after " + error->all(FLERR, + "Cannot create_atoms after " "reading restart file with per-atom info"); // check for compatible lattice int latsty = domain->lattice->style; if (domain->dimension == 2) { - if (latsty == Lattice::SC || latsty == Lattice::BCC - || latsty == Lattice::FCC || latsty == Lattice::HCP - || latsty == Lattice::DIAMOND) - error->all(FLERR,"Lattice style incompatible with simulation dimension"); + if (latsty == Lattice::SC || latsty == Lattice::BCC || latsty == Lattice::FCC || + latsty == Lattice::HCP || latsty == Lattice::DIAMOND) + error->all(FLERR, "Lattice style incompatible with simulation dimension"); } else { - if (latsty == Lattice::SQ ||latsty == Lattice::SQ2 - || latsty == Lattice::HEX) - error->all(FLERR,"Lattice style incompatible with simulation dimension"); + if (latsty == Lattice::SQ || latsty == Lattice::SQ2 || latsty == Lattice::HEX) + error->all(FLERR, "Lattice style incompatible with simulation dimension"); } // parse arguments - if (narg < 2) error->all(FLERR,"Illegal create_atoms command"); - ntype = utils::inumeric(FLERR,arg[0],false,lmp); + if (narg < 2) error->all(FLERR, "Illegal create_atoms command"); + ntype = utils::inumeric(FLERR, arg[0], false, lmp); int iarg; - if (strcmp(arg[1],"box") == 0) { + if (strcmp(arg[1], "box") == 0) { style = BOX; iarg = 2; - nregion = -1; - } else if (strcmp(arg[1],"region") == 0) { + region = nullptr; + } else if (strcmp(arg[1], "region") == 0) { style = REGION; - if (narg < 3) error->all(FLERR,"Illegal create_atoms command"); - nregion = domain->find_region(arg[2]); - if (nregion == -1) error->all(FLERR, - "Create_atoms region ID does not exist"); - domain->regions[nregion]->init(); - domain->regions[nregion]->prematch(); - iarg = 3;; - } else if (strcmp(arg[1],"single") == 0) { + if (narg < 3) error->all(FLERR, "Illegal create_atoms command"); + region = domain->get_region_by_id(arg[2]); + if (!region) error->all(FLERR, "Create_atoms region {} does not exist", arg[2]); + region->init(); + region->prematch(); + iarg = 3; + ; + } else if (strcmp(arg[1], "single") == 0) { style = SINGLE; - if (narg < 5) error->all(FLERR,"Illegal create_atoms command"); - 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); + if (narg < 5) error->all(FLERR, "Illegal create_atoms command"); + 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) { + } else if (strcmp(arg[1], "random") == 0) { style = RANDOM; - if (narg < 5) error->all(FLERR,"Illegal create_atoms command"); - nrandom = utils::inumeric(FLERR,arg[2],false,lmp); - seed = utils::inumeric(FLERR,arg[3],false,lmp); - if (strcmp(arg[4],"NULL") == 0) nregion = -1; + if (narg < 5) error->all(FLERR, "Illegal create_atoms command"); + nrandom = utils::inumeric(FLERR, arg[2], false, lmp); + seed = utils::inumeric(FLERR, arg[3], false, lmp); + if (strcmp(arg[4], "NULL") == 0) + region = nullptr; else { - nregion = domain->find_region(arg[4]); - if (nregion == -1) error->all(FLERR, - "Create_atoms region ID does not exist"); - domain->regions[nregion]->init(); - domain->regions[nregion]->prematch(); + region = domain->get_region_by_id(arg[4]); + if (!region) error->all(FLERR, "Create_atoms region {} does not exist", arg[4]); + region->init(); + region->prematch(); } iarg = 5; - } else error->all(FLERR,"Illegal create_atoms command"); + } else + error->all(FLERR, "Illegal create_atoms command"); // process optional keywords @@ -141,112 +137,115 @@ void CreateAtoms::command(int narg, char **arg) for (int i = 0; i < nbasis; i++) basistype[i] = ntype; while (iarg < narg) { - if (strcmp(arg[iarg],"basis") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); - int ibasis = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - int itype = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + if (strcmp(arg[iarg], "basis") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal create_atoms command"); + 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; + error->all(FLERR, "Invalid basis setting in create_atoms command"); + basistype[ibasis - 1] = itype; iarg += 3; - } else if (strcmp(arg[iarg],"remap") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command"); - remapflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "remap") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command"); + remapflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"mol") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); - int imol = atom->find_molecule(arg[iarg+1]); - if (imol == -1) error->all(FLERR,"Molecule template ID for " - "create_atoms does not exist"); - if (atom->molecules[imol]->nset > 1 && me == 0) - error->warning(FLERR,"Molecule template for " - "create_atoms has multiple molecules"); + } else if (strcmp(arg[iarg], "mol") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal create_atoms command"); + int imol = atom->find_molecule(arg[iarg + 1]); + if (imol == -1) + error->all(FLERR, + "Molecule template ID for " + "create_atoms does not exist"); + if ((atom->molecules[imol]->nset > 1) && (comm->me == 0)) + error->warning(FLERR, "Molecule template for create_atoms has multiple molecules"); mode = MOLECULE; onemol = atom->molecules[imol]; - molseed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + 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"); - if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0; - else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1; - else error->all(FLERR,"Illegal create_atoms command"); + } else if (strcmp(arg[iarg], "units") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command"); + if (strcmp(arg[iarg + 1], "box") == 0) + scaleflag = 0; + else if (strcmp(arg[iarg + 1], "lattice") == 0) + scaleflag = 1; + else + error->all(FLERR, "Illegal create_atoms command"); iarg += 2; - } else if (strcmp(arg[iarg],"var") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal create_atoms command"); - delete [] vstr; - vstr = utils::strdup(arg[iarg+1]); + } else if (strcmp(arg[iarg], "var") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal create_atoms command"); + delete[] vstr; + vstr = utils::strdup(arg[iarg + 1]); varflag = 1; iarg += 2; - } else if (strcmp(arg[iarg],"set") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); - if (strcmp(arg[iarg+1],"x") == 0) { - delete [] xstr; - xstr = utils::strdup(arg[iarg+2]); - } else if (strcmp(arg[iarg+1],"y") == 0) { - delete [] ystr; - ystr = utils::strdup(arg[iarg+2]); - } else if (strcmp(arg[iarg+1],"z") == 0) { - delete [] zstr; - zstr = utils::strdup(arg[iarg+2]); - } else error->all(FLERR,"Illegal create_atoms command"); + } else if (strcmp(arg[iarg], "set") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal create_atoms command"); + if (strcmp(arg[iarg + 1], "x") == 0) { + delete[] xstr; + xstr = utils::strdup(arg[iarg + 2]); + } else if (strcmp(arg[iarg + 1], "y") == 0) { + delete[] ystr; + ystr = utils::strdup(arg[iarg + 2]); + } else if (strcmp(arg[iarg + 1], "z") == 0) { + delete[] zstr; + zstr = utils::strdup(arg[iarg + 2]); + } else + error->all(FLERR, "Illegal create_atoms command"); iarg += 3; - } else if (strcmp(arg[iarg],"rotate") == 0) { - if (iarg+5 > narg) error->all(FLERR,"Illegal create_atoms command"); + } else if (strcmp(arg[iarg], "rotate") == 0) { + if (iarg + 5 > narg) error->all(FLERR, "Illegal create_atoms command"); double thetaone; double axisone[3]; - 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); + 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"); + error->all(FLERR, "Illegal create_atoms command"); if (domain->dimension == 2 && (axisone[0] != 0.0 || axisone[1] != 0.0)) - error->all(FLERR,"Invalid create_atoms rotation vector for 2d model"); + error->all(FLERR, "Invalid create_atoms rotation vector for 2d model"); MathExtra::norm3(axisone); - MathExtra::axisangle_to_quat(axisone,thetaone,quatone); + MathExtra::axisangle_to_quat(axisone, thetaone, quatone); iarg += 5; - } else if (strcmp(arg[iarg],"ratio") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal create_atoms command"); + } else if (strcmp(arg[iarg], "ratio") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal create_atoms command"); subsetflag = RATIO; - subsetfrac = utils::numeric(FLERR,arg[iarg+1],false,lmp); - subsetseed = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + 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"); + 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"); + } else if (strcmp(arg[iarg], "subset") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal create_atoms command"); subsetflag = SUBSET; - 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"); + 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; - } else error->all(FLERR,"Illegal create_atoms command"); + } else + error->all(FLERR, "Illegal create_atoms command"); } // error checks if (mode == ATOM && (ntype <= 0 || ntype > atom->ntypes)) - error->all(FLERR,"Invalid atom type in create_atoms command"); + error->all(FLERR, "Invalid atom type in create_atoms command"); if (style == RANDOM) { - if (nrandom < 0) error->all(FLERR,"Illegal create_atoms command"); - if (seed <= 0) error->all(FLERR,"Illegal create_atoms command"); + if (nrandom < 0) error->all(FLERR, "Illegal create_atoms command"); + if (seed <= 0) error->all(FLERR, "Illegal create_atoms command"); } // error check and further setup for mode = MOLECULE ranmol = nullptr; if (mode == MOLECULE) { - if (onemol->xflag == 0) - error->all(FLERR,"Create_atoms molecule must have coordinates"); - if (onemol->typeflag == 0) - error->all(FLERR,"Create_atoms molecule must have atom types"); - if (ntype+onemol->ntypes <= 0 || ntype+onemol->ntypes > atom->ntypes) - error->all(FLERR,"Invalid atom type in create_atoms mol command"); + if (onemol->xflag == 0) error->all(FLERR, "Create_atoms molecule must have coordinates"); + if (onemol->typeflag == 0) error->all(FLERR, "Create_atoms molecule must have atom types"); + if (ntype + onemol->ntypes <= 0 || ntype + onemol->ntypes > atom->ntypes) + error->all(FLERR, "Invalid atom type in create_atoms mol command"); if (onemol->tag_require && !atom->tag_enable) - error->all(FLERR, - "Create_atoms molecule has atom IDs, but system does not"); + error->all(FLERR, "Create_atoms molecule has atom IDs, but system does not"); onemol->check_attributes(0); // create_atoms uses geoemetric center of molecule for insertion @@ -255,46 +254,42 @@ void CreateAtoms::command(int narg, char **arg) // molecule random number generator, different for each proc - ranmol = new RanMars(lmp,molseed+me); + ranmol = new RanMars(lmp, molseed + comm->me); } ranlatt = nullptr; - if (subsetflag != NONE) ranlatt = new RanMars(lmp,subsetseed+me); + if (subsetflag != NONE) ranlatt = new RanMars(lmp, subsetseed + comm->me); // error check and further setup for variable test if (!vstr && (xstr || ystr || zstr)) - error->all(FLERR,"Incomplete use of variables in create_atoms command"); + error->all(FLERR, "Incomplete use of variables in create_atoms command"); if (vstr && (!xstr && !ystr && !zstr)) - error->all(FLERR,"Incomplete use of variables in create_atoms command"); + error->all(FLERR, "Incomplete use of variables in create_atoms command"); if (varflag) { vvar = input->variable->find(vstr); - if (vvar < 0) - error->all(FLERR,"Variable name for create_atoms does not exist"); + if (vvar < 0) error->all(FLERR, "Variable {} for create_atoms does not exist", vstr); if (!input->variable->equalstyle(vvar)) - error->all(FLERR,"Variable for create_atoms is invalid style"); + error->all(FLERR, "Variable for create_atoms is invalid style"); if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) - error->all(FLERR,"Variable name for create_atoms does not exist"); + if (xvar < 0) error->all(FLERR, "Variable {} for create_atoms does not exist", xstr); if (!input->variable->internalstyle(xvar)) - error->all(FLERR,"Variable for create_atoms is invalid style"); + error->all(FLERR, "Variable for create_atoms is invalid style"); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) - error->all(FLERR,"Variable name for create_atoms does not exist"); + if (yvar < 0) error->all(FLERR, "Variable {} for create_atoms does not exist", ystr); if (!input->variable->internalstyle(yvar)) - error->all(FLERR,"Variable for create_atoms is invalid style"); + error->all(FLERR, "Variable for create_atoms is invalid style"); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) - error->all(FLERR,"Variable name for create_atoms does not exist"); + if (zvar < 0) error->all(FLERR, "Variable {} for create_atoms does not exist", zstr); if (!input->variable->internalstyle(zvar)) - error->all(FLERR,"Variable for create_atoms is invalid style"); + error->all(FLERR, "Variable for create_atoms is invalid style"); } } @@ -305,8 +300,7 @@ void CreateAtoms::command(int narg, char **arg) // triclinic remapping occurs in add_single() if (style == BOX || style == REGION) { - if (nbasis == 0) - error->all(FLERR,"Cannot create atoms with undefined lattice"); + if (nbasis == 0) error->all(FLERR, "Cannot create atoms with undefined lattice"); } else if (scaleflag == 1) { xone[0] *= domain->lattice->xlattice; xone[1] *= domain->lattice->ylattice; @@ -328,7 +322,8 @@ void CreateAtoms::command(int narg, char **arg) triclinic = domain->triclinic; double epsilon[3]; - if (triclinic) epsilon[0] = epsilon[1] = epsilon[2] = EPSILON; + if (triclinic) + epsilon[0] = epsilon[1] = epsilon[2] = EPSILON; else { epsilon[0] = domain->prd[0] * EPSILON; epsilon[1] = domain->prd[1] * EPSILON; @@ -336,41 +331,47 @@ void CreateAtoms::command(int narg, char **arg) } if (triclinic == 0) { - sublo[0] = domain->sublo[0]; subhi[0] = domain->subhi[0]; - sublo[1] = domain->sublo[1]; subhi[1] = domain->subhi[1]; - sublo[2] = domain->sublo[2]; subhi[2] = domain->subhi[2]; + sublo[0] = domain->sublo[0]; + subhi[0] = domain->subhi[0]; + sublo[1] = domain->sublo[1]; + subhi[1] = domain->subhi[1]; + sublo[2] = domain->sublo[2]; + subhi[2] = domain->subhi[2]; } else { - sublo[0] = domain->sublo_lamda[0]; subhi[0] = domain->subhi_lamda[0]; - sublo[1] = domain->sublo_lamda[1]; subhi[1] = domain->subhi_lamda[1]; - sublo[2] = domain->sublo_lamda[2]; subhi[2] = domain->subhi_lamda[2]; + sublo[0] = domain->sublo_lamda[0]; + subhi[0] = domain->subhi_lamda[0]; + sublo[1] = domain->sublo_lamda[1]; + subhi[1] = domain->subhi_lamda[1]; + sublo[2] = domain->sublo_lamda[2]; + subhi[2] = domain->subhi_lamda[2]; } if (style == BOX || style == REGION) { if (comm->layout != Comm::LAYOUT_TILED) { if (domain->xperiodic) { if (comm->myloc[0] == 0) sublo[0] -= epsilon[0]; - if (comm->myloc[0] == comm->procgrid[0]-1) subhi[0] -= 2.0*epsilon[0]; + if (comm->myloc[0] == comm->procgrid[0] - 1) subhi[0] -= 2.0 * epsilon[0]; } if (domain->yperiodic) { if (comm->myloc[1] == 0) sublo[1] -= epsilon[1]; - if (comm->myloc[1] == comm->procgrid[1]-1) subhi[1] -= 2.0*epsilon[1]; + if (comm->myloc[1] == comm->procgrid[1] - 1) subhi[1] -= 2.0 * epsilon[1]; } if (domain->zperiodic) { if (comm->myloc[2] == 0) sublo[2] -= epsilon[2]; - if (comm->myloc[2] == comm->procgrid[2]-1) subhi[2] -= 2.0*epsilon[2]; + if (comm->myloc[2] == comm->procgrid[2] - 1) subhi[2] -= 2.0 * epsilon[2]; } } else { if (domain->xperiodic) { if (comm->mysplit[0][0] == 0.0) sublo[0] -= epsilon[0]; - if (comm->mysplit[0][1] == 1.0) subhi[0] -= 2.0*epsilon[0]; + if (comm->mysplit[0][1] == 1.0) subhi[0] -= 2.0 * epsilon[0]; } if (domain->yperiodic) { if (comm->mysplit[1][0] == 0.0) sublo[1] -= epsilon[1]; - if (comm->mysplit[1][1] == 1.0) subhi[1] -= 2.0*epsilon[1]; + if (comm->mysplit[1][1] == 1.0) subhi[1] -= 2.0 * epsilon[1]; } if (domain->zperiodic) { if (comm->mysplit[2][0] == 0.0) sublo[2] -= epsilon[2]; - if (comm->mysplit[2][1] == 1.0) subhi[2] -= 2.0*epsilon[2]; + if (comm->mysplit[2][1] == 1.0) subhi[2] -= 2.0 * epsilon[2]; } } } @@ -392,20 +393,22 @@ void CreateAtoms::command(int narg, char **arg) bigint natoms_previous = atom->natoms; int nlocal_previous = atom->nlocal; - if (style == SINGLE) add_single(); - else if (style == RANDOM) add_random(); - else add_lattice(); + if (style == SINGLE) + add_single(); + else if (style == RANDOM) + add_random(); + else + add_lattice(); // init per-atom fix/compute/variable values for created atoms - atom->data_fix_compute_variable(nlocal_previous,atom->nlocal); + atom->data_fix_compute_variable(nlocal_previous, atom->nlocal); // set new total # of atoms and error check bigint nblocal = atom->nlocal; - MPI_Allreduce(&nblocal,&atom->natoms,1,MPI_LMP_BIGINT,MPI_SUM,world); - if (atom->natoms < 0 || atom->natoms >= MAXBIGINT) - error->all(FLERR,"Too many total atoms"); + MPI_Allreduce(&nblocal, &atom->natoms, 1, MPI_LMP_BIGINT, MPI_SUM, world); + if (atom->natoms < 0 || atom->natoms >= MAXBIGINT) error->all(FLERR, "Too many total atoms"); // add IDs for newly created atoms // check that atom IDs are valid @@ -443,7 +446,7 @@ void CreateAtoms::command(int narg, char **arg) bigint nmolme = molcreate; bigint nmoltotal; - MPI_Allreduce(&nmolme,&nmoltotal,1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nmolme, &nmoltotal, 1, MPI_LMP_BIGINT, MPI_SUM, world); atom->nbonds += nmoltotal * onemol->nbonds; atom->nangles += nmoltotal * onemol->nangles; atom->ndihedrals += nmoltotal * onemol->ndihedrals; @@ -457,10 +460,10 @@ void CreateAtoms::command(int narg, char **arg) tagint moloffset = 0; if (molecule_flag) { tagint max = 0; - for (int i = 0; i < nlocal_previous; i++) max = MAX(max,molecule[i]); + for (int i = 0; i < nlocal_previous; i++) max = MAX(max, molecule[i]); tagint maxmol; - MPI_Allreduce(&max,&maxmol,1,MPI_LMP_TAGINT,MPI_MAX,world); - MPI_Scan(&molcreate,&moloffset,1,MPI_LMP_TAGINT,MPI_SUM,world); + MPI_Allreduce(&max, &maxmol, 1, MPI_LMP_TAGINT, MPI_MAX, world); + MPI_Scan(&molcreate, &moloffset, 1, MPI_LMP_TAGINT, MPI_SUM, world); moloffset = moloffset - molcreate + maxmol; } @@ -493,7 +496,7 @@ void CreateAtoms::command(int narg, char **arg) int ilocal = nlocal_previous; for (int i = 0; i < molcreate; i++) { - if (tag) offset = tag[ilocal]-1; + if (tag) offset = tag[ilocal] - 1; for (int m = 0; m < natoms; m++) { if (molecule_flag) { if (onemol->moleculeflag) { @@ -507,8 +510,7 @@ void CreateAtoms::command(int narg, char **arg) atom->molatom[ilocal] = m; } else if (molecular != Atom::ATOMIC) { if (onemol->bondflag) - for (int j = 0; j < num_bond[ilocal]; j++) - bond_atom[ilocal][j] += offset; + for (int j = 0; j < num_bond[ilocal]; j++) bond_atom[ilocal][j] += offset; if (onemol->angleflag) for (int j = 0; j < num_angle[ilocal]; j++) { angle_atom1[ilocal][j] += offset; @@ -530,8 +532,7 @@ void CreateAtoms::command(int narg, char **arg) improper_atom4[ilocal][j] += offset; } if (onemol->specialflag) - for (int j = 0; j < nspecial[ilocal][2]; j++) - special[ilocal][j] += offset; + for (int j = 0; j < nspecial[ilocal][2]; j++) special[ilocal][j] += offset; } ilocal++; } @@ -549,11 +550,11 @@ void CreateAtoms::command(int narg, char **arg) double **x = atom->x; imageint *image = atom->image; int nlocal = atom->nlocal; - for (int i = 0; i < nlocal; i++) domain->remap(x[i],image[i]); + for (int i = 0; i < nlocal; i++) domain->remap(x[i], image[i]); if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -564,11 +565,11 @@ void CreateAtoms::command(int narg, char **arg) delete ranmol; delete ranlatt; - delete [] basistype; - delete [] vstr; - delete [] xstr; - delete [] ystr; - delete [] zstr; + delete[] basistype; + delete[] vstr; + delete[] xstr; + delete[] ystr; + delete[] zstr; // for MOLECULE mode: // create special bond lists for molecular systems, @@ -579,19 +580,19 @@ void CreateAtoms::command(int narg, char **arg) if (atom->molecular == Atom::MOLECULAR && onemol->bondflag && !onemol->specialflag) { Special special(lmp); special.build(); - } } // print status MPI_Barrier(world); - if (me == 0) { - utils::logmesg(lmp,"Created {} atoms\n", atom->natoms - natoms_previous); - if (scaleflag) domain->print_box(" using lattice units in "); - else domain->print_box(" using box units in "); - utils::logmesg(lmp," create_atoms CPU = {:.3f} seconds\n", - platform::walltime() - time1); + if (comm->me == 0) { + utils::logmesg(lmp, "Created {} atoms\n", atom->natoms - natoms_previous); + if (scaleflag) + domain->print_box(" using lattice units in "); + else + domain->print_box(" using box units in "); + utils::logmesg(lmp, " create_atoms CPU = {:.3f} seconds\n", platform::walltime() - time1); } } @@ -605,38 +606,36 @@ void CreateAtoms::add_single() // remap atom if requested if (remapflag) { - imageint imagetmp = ((imageint) IMGMAX << IMG2BITS) | - ((imageint) IMGMAX << IMGBITS) | IMGMAX; - domain->remap(xone,imagetmp); + imageint imagetmp = ((imageint) IMGMAX << IMG2BITS) | ((imageint) IMGMAX << IMGBITS) | IMGMAX; + domain->remap(xone, imagetmp); } // if triclinic, convert to lamda coords (0-1) // with remapflag set and periodic dims, // resulting coord must satisfy 0.0 <= coord < 1.0 - double lamda[3],*coord; + double lamda[3], *coord; if (triclinic) { - domain->x2lamda(xone,lamda); + domain->x2lamda(xone, lamda); if (remapflag) { - if (domain->xperiodic && (lamda[0] < 0.0 || lamda[0] >= 1.0)) - lamda[0] = 0.0; - if (domain->yperiodic && (lamda[1] < 0.0 || lamda[1] >= 1.0)) - lamda[1] = 0.0; - if (domain->zperiodic && (lamda[2] < 0.0 || lamda[2] >= 1.0)) - lamda[2] = 0.0; + if (domain->xperiodic && (lamda[0] < 0.0 || lamda[0] >= 1.0)) lamda[0] = 0.0; + if (domain->yperiodic && (lamda[1] < 0.0 || lamda[1] >= 1.0)) lamda[1] = 0.0; + if (domain->zperiodic && (lamda[2] < 0.0 || lamda[2] >= 1.0)) lamda[2] = 0.0; } coord = lamda; - } else coord = xone; + } else + coord = xone; // if atom/molecule is in my subbox, create it - if (coord[0] >= sublo[0] && coord[0] < subhi[0] && - coord[1] >= sublo[1] && coord[1] < subhi[1] && + if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && coord[1] < subhi[1] && coord[2] >= sublo[2] && coord[2] < subhi[2]) { - if (mode == ATOM) atom->avec->create_atom(ntype,xone); + if (mode == ATOM) + atom->avec->create_atom(ntype, xone); else if (quatone[0] == 0.0 && quatone[1] == 0.0 && quatone[2] == 0.0) add_molecule(xone); - else add_molecule(xone,quatone); + else + add_molecule(xone, quatone); } } @@ -646,42 +645,48 @@ void CreateAtoms::add_single() void CreateAtoms::add_random() { - double xlo,ylo,zlo,xhi,yhi,zhi,zmid; - double lamda[3],*coord; - double *boxlo,*boxhi; + double xlo, ylo, zlo, xhi, yhi, zhi, zmid; + double lamda[3], *coord; + double *boxlo, *boxhi; // random number generator, same for all procs // warm up the generator 30x to avoid correlations in first-particle // positions if runs are repeated with consecutive seeds - RanPark *random = new RanPark(lmp,seed); - for (int ii=0; ii < 30; ii++) random->uniform(); + auto random = new RanPark(lmp, seed); + for (int ii = 0; ii < 30; ii++) random->uniform(); // bounding box for atom creation // in real units, even if triclinic // only limit bbox by region if its bboxflag is set (interior region) if (triclinic == 0) { - xlo = domain->boxlo[0]; xhi = domain->boxhi[0]; - ylo = domain->boxlo[1]; yhi = domain->boxhi[1]; - zlo = domain->boxlo[2]; zhi = domain->boxhi[2]; - zmid = zlo + 0.5*(zhi-zlo); + xlo = domain->boxlo[0]; + xhi = domain->boxhi[0]; + ylo = domain->boxlo[1]; + yhi = domain->boxhi[1]; + zlo = domain->boxlo[2]; + zhi = domain->boxhi[2]; + zmid = zlo + 0.5 * (zhi - zlo); } else { - xlo = domain->boxlo_bound[0]; xhi = domain->boxhi_bound[0]; - ylo = domain->boxlo_bound[1]; yhi = domain->boxhi_bound[1]; - zlo = domain->boxlo_bound[2]; zhi = domain->boxhi_bound[2]; - zmid = zlo + 0.5*(zhi-zlo); + xlo = domain->boxlo_bound[0]; + xhi = domain->boxhi_bound[0]; + ylo = domain->boxlo_bound[1]; + yhi = domain->boxhi_bound[1]; + zlo = domain->boxlo_bound[2]; + zhi = domain->boxhi_bound[2]; + zmid = zlo + 0.5 * (zhi - zlo); boxlo = domain->boxlo_lamda; boxhi = domain->boxhi_lamda; } - if (nregion >= 0 && domain->regions[nregion]->bboxflag) { - xlo = MAX(xlo,domain->regions[nregion]->extent_xlo); - xhi = MIN(xhi,domain->regions[nregion]->extent_xhi); - ylo = MAX(ylo,domain->regions[nregion]->extent_ylo); - yhi = MIN(yhi,domain->regions[nregion]->extent_yhi); - zlo = MAX(zlo,domain->regions[nregion]->extent_zlo); - zhi = MIN(zhi,domain->regions[nregion]->extent_zhi); + if (region && region->bboxflag) { + xlo = MAX(xlo, region->extent_xlo); + xhi = MIN(xhi, region->extent_xhi); + ylo = MAX(ylo, region->extent_ylo); + yhi = MIN(yhi, region->extent_yhi); + zlo = MAX(zlo, region->extent_zlo); + zhi = MIN(zhi, region->extent_zhi); } // generate random positions for each new atom/molecule within bounding box @@ -689,41 +694,41 @@ void CreateAtoms::add_random() // if final atom position is in my subbox, create it if (xlo > xhi || ylo > yhi || zlo > zhi) - error->all(FLERR,"No overlap of box and region for create_atoms"); + error->all(FLERR, "No overlap of box and region for create_atoms"); int valid; for (int i = 0; i < nrandom; i++) { while (true) { - xone[0] = xlo + random->uniform() * (xhi-xlo); - xone[1] = ylo + random->uniform() * (yhi-ylo); - xone[2] = zlo + random->uniform() * (zhi-zlo); + xone[0] = xlo + random->uniform() * (xhi - xlo); + xone[1] = ylo + random->uniform() * (yhi - ylo); + xone[2] = zlo + random->uniform() * (zhi - zlo); if (domain->dimension == 2) xone[2] = zmid; valid = 1; - if (nregion >= 0 && - domain->regions[nregion]->match(xone[0],xone[1],xone[2]) == 0) - valid = 0; + if (region && (region->match(xone[0], xone[1], xone[2]) == 0)) valid = 0; if (varflag && vartest(xone) == 0) valid = 0; if (triclinic) { - domain->x2lamda(xone,lamda); + domain->x2lamda(xone, lamda); coord = lamda; - if (coord[0] < boxlo[0] || coord[0] >= boxhi[0] || - coord[1] < boxlo[1] || coord[1] >= boxhi[1] || - coord[2] < boxlo[2] || coord[2] >= boxhi[2]) valid = 0; - } else coord = xone; + if (coord[0] < boxlo[0] || coord[0] >= boxhi[0] || coord[1] < boxlo[1] || + coord[1] >= boxhi[1] || coord[2] < boxlo[2] || coord[2] >= boxhi[2]) + valid = 0; + } else + coord = xone; if (valid) break; } // if triclinic, coord is now in lamda units - if (coord[0] >= sublo[0] && coord[0] < subhi[0] && - coord[1] >= sublo[1] && coord[1] < subhi[1] && - coord[2] >= sublo[2] && coord[2] < subhi[2]) { - if (mode == ATOM) atom->avec->create_atom(ntype,xone); + if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && + coord[1] < subhi[1] && coord[2] >= sublo[2] && coord[2] < subhi[2]) { + if (mode == ATOM) + atom->avec->create_atom(ntype, xone); else if (quatone[0] == 0 && quatone[1] == 0 && quatone[2] == 0) add_molecule(xone); - else add_molecule(xone, quatone); + else + add_molecule(xone, quatone); } } @@ -743,25 +748,29 @@ void CreateAtoms::add_lattice() // for triclinic, use bounding box of my subbox // xyz min to max = bounding box around the domain corners in lattice space - double bboxlo[3],bboxhi[3]; + double bboxlo[3], bboxhi[3]; if (triclinic == 0) { - bboxlo[0] = domain->sublo[0]; bboxhi[0] = domain->subhi[0]; - bboxlo[1] = domain->sublo[1]; bboxhi[1] = domain->subhi[1]; - bboxlo[2] = domain->sublo[2]; bboxhi[2] = domain->subhi[2]; - } else domain->bbox(domain->sublo_lamda,domain->subhi_lamda,bboxlo,bboxhi); + bboxlo[0] = domain->sublo[0]; + bboxhi[0] = domain->subhi[0]; + bboxlo[1] = domain->sublo[1]; + bboxhi[1] = domain->subhi[1]; + bboxlo[2] = domain->sublo[2]; + bboxhi[2] = domain->subhi[2]; + } else + domain->bbox(domain->sublo_lamda, domain->subhi_lamda, bboxlo, bboxhi); // narrow down the subbox by the bounding box of the given region, if available. // for small regions in large boxes, this can result in a significant speedup - if ((style == REGION) && domain->regions[nregion]->bboxflag) { + if ((style == REGION) && region->bboxflag) { - const double rxmin = domain->regions[nregion]->extent_xlo; - const double rxmax = domain->regions[nregion]->extent_xhi; - const double rymin = domain->regions[nregion]->extent_ylo; - const double rymax = domain->regions[nregion]->extent_yhi; - const double rzmin = domain->regions[nregion]->extent_zlo; - const double rzmax = domain->regions[nregion]->extent_zhi; + const double rxmin = region->extent_xlo; + const double rxmax = region->extent_xhi; + const double rymin = region->extent_ylo; + const double rymax = region->extent_yhi; + const double rzmin = region->extent_zlo; + const double rzmax = region->extent_zhi; if (rxmin > bboxlo[0]) bboxlo[0] = (rxmin > bboxhi[0]) ? bboxhi[0] : rxmin; if (rxmax < bboxhi[0]) bboxhi[0] = (rxmax < bboxlo[0]) ? bboxlo[0] : rxmax; @@ -771,27 +780,19 @@ void CreateAtoms::add_lattice() if (rzmax < bboxhi[2]) bboxhi[2] = (rzmax < bboxlo[2]) ? bboxlo[2] : rzmax; } - double xmin,ymin,zmin,xmax,ymax,zmax; + double xmin, ymin, zmin, xmax, ymax, zmax; xmin = ymin = zmin = BIG; xmax = ymax = zmax = -BIG; // convert to lattice coordinates and set bounding box - domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxlo[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxlo[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxlo[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxlo[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxlo[0],bboxlo[1],bboxhi[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxhi[0],bboxlo[1],bboxhi[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxlo[0],bboxhi[1],bboxhi[2], - xmin,ymin,zmin,xmax,ymax,zmax); - domain->lattice->bbox(1,bboxhi[0],bboxhi[1],bboxhi[2], - xmin,ymin,zmin,xmax,ymax,zmax); + domain->lattice->bbox(1, bboxlo[0], bboxlo[1], bboxlo[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxhi[0], bboxlo[1], bboxlo[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxlo[0], bboxhi[1], bboxlo[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxhi[0], bboxhi[1], bboxlo[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxlo[0], bboxlo[1], bboxhi[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxhi[0], bboxlo[1], bboxhi[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxlo[0], bboxhi[1], bboxhi[2], xmin, ymin, zmin, xmax, ymax, zmax); + domain->lattice->bbox(1, bboxhi[0], bboxhi[1], bboxhi[2], xmin, ymin, zmin, xmax, ymax, zmax); // ilo:ihi,jlo:jhi,klo:khi = loop bounds for lattice overlap of my subbox // overlap = any part of a unit cell (face,edge,pt) in common with my subbox @@ -802,12 +803,12 @@ void CreateAtoms::add_lattice() // which can lead to missing atoms in rare cases // extra decrement of lo if min < 0, since static_cast(-1.5) = -1 - ilo = static_cast (xmin) - 1; - jlo = static_cast (ymin) - 1; - klo = static_cast (zmin) - 1; - ihi = static_cast (xmax) + 1; - jhi = static_cast (ymax) + 1; - khi = static_cast (zmax) + 1; + ilo = static_cast(xmin) - 1; + jlo = static_cast(ymin) - 1; + klo = static_cast(zmin) - 1; + ihi = static_cast(xmax) + 1; + jhi = static_cast(ymax) + 1; + khi = static_cast(zmax) + 1; if (xmin < 0.0) ilo--; if (ymin < 0.0) jlo--; @@ -821,42 +822,44 @@ void CreateAtoms::add_lattice() // nadd = # of atoms each proc will insert (estimated if subsetflag) int overflow; - MPI_Allreduce(&nlatt_overflow,&overflow,1,MPI_INT,MPI_SUM,world); - if (overflow) - error->all(FLERR,"Create_atoms lattice size overflow on 1 or more procs"); + MPI_Allreduce(&nlatt_overflow, &overflow, 1, MPI_INT, MPI_SUM, world); + if (overflow) error->all(FLERR, "Create_atoms lattice size overflow on 1 or more procs"); bigint nadd; if (subsetflag == NONE) { - if (nprocs == 1) nadd = nlatt; - else nadd = static_cast (LB_FACTOR * nlatt); + if (comm->nprocs == 1) + nadd = nlatt; + else + nadd = static_cast(LB_FACTOR * nlatt); } else { bigint bnlatt = nlatt; bigint bnlattall; - MPI_Allreduce(&bnlatt,&bnlattall,1,MPI_LMP_BIGINT,MPI_SUM,world); - if (subsetflag == RATIO) - nsubset = static_cast (subsetfrac * bnlattall); - if (nsubset > bnlattall) - error->all(FLERR,"Create_atoms subset size > # of lattice sites"); - if (nprocs == 1) nadd = nsubset; - else nadd = static_cast (LB_FACTOR * nsubset/bnlattall * nlatt); + MPI_Allreduce(&bnlatt, &bnlattall, 1, MPI_LMP_BIGINT, MPI_SUM, world); + if (subsetflag == RATIO) nsubset = static_cast(subsetfrac * bnlattall); + if (nsubset > bnlattall) error->all(FLERR, "Create_atoms subset size > # of lattice sites"); + if (comm->nprocs == 1) + nadd = nsubset; + else + nadd = static_cast(LB_FACTOR * nsubset / bnlattall * nlatt); } // allocate atom arrays to size N, rounded up by AtomVec->DELTA bigint nbig = atom->avec->roundup(nadd + atom->nlocal); - int n = static_cast (nbig); + int n = static_cast(nbig); atom->avec->grow(n); // add atoms or molecules // if no subset: add to all lattice sites // if subset: count lattice sites, select random subset, then add - if (subsetflag == NONE) loop_lattice(INSERT); + if (subsetflag == NONE) + loop_lattice(INSERT); else { - memory->create(flag,nlatt,"create_atoms:flag"); - memory->create(next,nlatt,"create_atoms:next"); - ranlatt->select_subset(nsubset,nlatt,flag,next); + memory->create(flag, nlatt, "create_atoms:flag"); + memory->create(next, nlatt, "create_atoms:next"); + ranlatt->select_subset(nsubset, nlatt, flag, next); loop_lattice(INSERT_SELECTED); memory->destroy(flag); memory->destroy(next); @@ -874,9 +877,9 @@ void CreateAtoms::add_lattice() void CreateAtoms::loop_lattice(int action) { - int i,j,k,m; + int i, j, k, m; - const double * const * const basis = domain->lattice->basis; + const double *const *const basis = domain->lattice->basis; nlatt = 0; @@ -885,7 +888,7 @@ void CreateAtoms::loop_lattice(int action) for (i = ilo; i <= ihi; i++) { for (m = 0; m < nbasis; m++) { double *coord; - double x[3],lamda[3]; + double x[3], lamda[3]; x[0] = i + basis[m][0]; x[1] = j + basis[m][1]; @@ -893,12 +896,12 @@ void CreateAtoms::loop_lattice(int action) // convert from lattice coords to box coords - domain->lattice->lattice2box(x[0],x[1],x[2]); + domain->lattice->lattice2box(x[0], x[1], x[2]); // if a region was specified, test if atom is in it if (style == REGION) - if (!domain->regions[nregion]->match(x[0],x[1],x[2])) continue; + if (!region->match(x[0], x[1], x[2])) continue; // if variable test specified, eval variable @@ -907,30 +910,35 @@ void CreateAtoms::loop_lattice(int action) // test if atom/molecule position is in my subbox if (triclinic) { - domain->x2lamda(x,lamda); + domain->x2lamda(x, lamda); coord = lamda; - } else coord = x; + } else + coord = x; - if (coord[0] < sublo[0] || coord[0] >= subhi[0] || - coord[1] < sublo[1] || coord[1] >= subhi[1] || - coord[2] < sublo[2] || coord[2] >= subhi[2]) continue; + if (coord[0] < sublo[0] || coord[0] >= subhi[0] || coord[1] < sublo[1] || + coord[1] >= subhi[1] || coord[2] < sublo[2] || coord[2] >= subhi[2]) + continue; // this proc owns the lattice site // perform action: add, just count, add if flagged // add = add an atom or entire molecule to my list of atoms if (action == INSERT) { - if (mode == ATOM) atom->avec->create_atom(basistype[m],x); + if (mode == ATOM) + atom->avec->create_atom(basistype[m], x); else if (quatone[0] == 0 && quatone[1] == 0 && quatone[2] == 0) add_molecule(x); - else add_molecule(x,quatone); + else + add_molecule(x, quatone); } else if (action == COUNT) { if (nlatt == MAXSMALLINT) nlatt_overflow = 1; } else if (action == INSERT_SELECTED && flag[nlatt]) { - if (mode == ATOM) atom->avec->create_atom(basistype[m],x); + if (mode == ATOM) + atom->avec->create_atom(basistype[m], x); else if (quatone[0] == 0 && quatone[1] == 0 && quatone[2] == 0) add_molecule(x); - else add_molecule(x,quatone); + else + add_molecule(x, quatone); } nlatt++; @@ -948,11 +956,13 @@ void CreateAtoms::loop_lattice(int action) void CreateAtoms::add_molecule(double *center, double *quat_user) { int n; - double r[3],rotmat[3][3],quat[4],xnew[3]; + double r[3], rotmat[3][3], quat[4], xnew[3]; if (quat_user) { - quat[0] = quat_user[0]; quat[1] = quat_user[1]; - quat[2] = quat_user[2]; quat[3] = quat_user[3]; + quat[0] = quat_user[0]; + quat[1] = quat_user[1]; + quat[2] = quat_user[2]; + quat[3] = quat_user[3]; } else { if (domain->dimension == 3) { r[0] = ranmol->uniform() - 0.5; @@ -964,10 +974,10 @@ void CreateAtoms::add_molecule(double *center, double *quat_user) } MathExtra::norm3(r); double theta = ranmol->uniform() * MY_2PI; - MathExtra::axisangle_to_quat(r,theta,quat); + MathExtra::axisangle_to_quat(r, theta, quat); } - MathExtra::quat_to_mat(quat,rotmat); + MathExtra::quat_to_mat(quat, rotmat); onemol->quat_external = quat; // create atoms in molecule with atom ID = 0 and mol ID = 0 @@ -977,11 +987,11 @@ void CreateAtoms::add_molecule(double *center, double *quat_user) int natoms = onemol->natoms; for (int m = 0; m < natoms; m++) { - MathExtra::matvec(rotmat,onemol->dx[m],xnew); - MathExtra::add3(xnew,center,xnew); - atom->avec->create_atom(ntype+onemol->type[m],xnew); + MathExtra::matvec(rotmat, onemol->dx[m], xnew); + MathExtra::add3(xnew, center, xnew); + atom->avec->create_atom(ntype + onemol->type[m], xnew); n = atom->nlocal - 1; - atom->add_molecule_atom(onemol,m,n,0); + atom->add_molecule_atom(onemol, m, n, 0); } } @@ -992,9 +1002,9 @@ void CreateAtoms::add_molecule(double *center, double *quat_user) int CreateAtoms::vartest(double *x) { - if (xstr) input->variable->internal_set(xvar,x[0]); - if (ystr) input->variable->internal_set(yvar,x[1]); - if (zstr) input->variable->internal_set(zvar,x[2]); + if (xstr) input->variable->internal_set(xvar, x[0]); + if (ystr) input->variable->internal_set(yvar, x[1]); + if (zstr) input->variable->internal_set(zvar, x[2]); double value = input->variable->compute_equal(vvar); diff --git a/src/create_atoms.h b/src/create_atoms.h index 5b71394447..aa21504896 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -30,8 +30,7 @@ class CreateAtoms : public Command { void command(int, char **) override; private: - int me, nprocs; - int ntype, style, mode, nregion, nbasis, nrandom, seed; + int ntype, style, mode, nbasis, nrandom, seed; int remapflag; int subsetflag; bigint nsubset; @@ -51,6 +50,7 @@ class CreateAtoms : public Command { int *flag; // flag subset of particles to insert on lattice int *next; + class Region *region; class Molecule *onemol; class RanMars *ranmol; class RanMars *ranlatt; @@ -70,108 +70,3 @@ class CreateAtoms : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Create_atoms command before simulation box is defined - -The create_atoms command cannot be used before a read_data, -read_restart, or create_box command. - -E: Cannot create_atoms after reading restart file with per-atom info - -The per-atom info was stored to be used when by a fix that you may -re-define. If you add atoms before re-defining the fix, then there -will not be a correct amount of per-atom info. - -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: Create_atoms region ID does not exist - -A region ID used in the create_atoms command does not exist. - -E: Invalid basis setting in create_atoms command - -The basis index must be between 1 to N where N is the number of basis -atoms in the lattice. The type index must be between 1 to N where N -is the number of atom types. - -E: Molecule template ID for create_atoms does not exist - -Self-explanatory. - -W: Molecule template for create_atoms has multiple molecules - -The create_atoms command will only create molecules of a single type, -i.e. the first molecule in the template. - -E: Cannot use create_atoms rotate unless single style - -Self-explanatory. - -E: Invalid create_atoms rotation vector for 2d model - -The rotation vector can only have a z component. - -E: Invalid atom type in create_atoms command - -The create_box command specified the range of valid atom types. -An invalid type is being requested. - -E: Create_atoms molecule must have coordinates - -The defined molecule does not specify coordinates. - -E: Create_atoms molecule must have atom types - -The defined molecule does not specify atom types. - -E: Invalid atom type in create_atoms mol command - -The atom types in the defined molecule are added to the value -specified in the create_atoms command, as an offset. The final value -for each atom must be between 1 to N, where N is the number of atom -types. - -E: Create_atoms molecule has atom IDs, but system does not - -The atom_style id command can be used to force atom IDs to be stored. - -E: Incomplete use of variables in create_atoms command - -The var and set options must be used together. - -E: Variable name for create_atoms does not exist - -Self-explanatory. - -E: Variable for create_atoms is invalid style - -The variables must be equal-style variables. - -E: Cannot create atoms with undefined lattice - -Must use the lattice command before using the create_atoms -command. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -E: No overlap of box and region for create_atoms - -Self-explanatory. - -E: Attempting to insert more particles than available lattice points - -Self-explanatory. - -W: Specifying an 'subset' value of '0' is equivalent to no 'subset' keyword - -Self-explanatory. - -*/ diff --git a/src/create_bonds.h b/src/create_bonds.h index aec0f14c6a..84a853cfde 100644 --- a/src/create_bonds.h +++ b/src/create_bonds.h @@ -46,106 +46,3 @@ class CreateBonds : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Create_bonds command before simulation box is defined - -Self-explanatory. - -E: Cannot use create_bonds unless atoms have IDs - -This command requires a mapping from global atom IDs to local atoms, -but the atoms that have been defined have no IDs. - -E: Cannot use create_bonds with non-molecular system - -Self-explanatory. - -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: Cannot find create_bonds group ID - -Self-explanatory. - -E: Invalid bond type in create_bonds command - -Self-explanatory. - -E: Cannot use special no with create_bonds many - -UNDOCUMENTED - -E: Invalid angle type in create_bonds command - -UNDOCUMENTED - -E: Invalid dihedral type in create_bonds command - -UNDOCUMENTED - -E: Invalid improper type in create_bonds command - -UNDOCUMENTED - -E: Create_bonds requires a pair style be defined - -Self-explanatory. - -E: Create_bonds max distance > neighbor cutoff - -Can only create bonds for atom pairs that will be in neighbor list. - -W: Create_bonds max distance > minimum neighbor cutoff - -This means atom pairs for some atom types may not be in the neighbor -list and thus no bond can be created between them. - -E: Create_bonds command requires special_bonds 1-2 weights be 0.0 - -This is so that atom pairs that are already bonded to not appear in -the neighbor list. - -E: Create_bonds command requires no kspace_style be defined - -This is so that atom pairs that are already bonded to not appear -in the neighbor list. - -E: New bond exceeded bonds per atom in create_bonds - -See the read_data command for info on setting the "extra bond per -atom" header value to allow for additional bonds to be formed. - -E: Create_bonds single/bond atoms do not exist - -UNDOCUMENTED - -E: Create_bonds single/angle atoms do not exist - -UNDOCUMENTED - -E: New angle exceeded angles per atom in create_bonds - -UNDOCUMENTED - -E: Create_bonds single/dihedral atoms do not exist - -UNDOCUMENTED - -E: New dihedral exceeded dihedrals per atom in create_bonds - -UNDOCUMENTED - -E: Create_bonds single/improper atoms do not exist - -UNDOCUMENTED - -E: New improper exceeded impropers per atom in create_bonds - -UNDOCUMENTED - -*/ diff --git a/src/create_box.cpp b/src/create_box.cpp index 34d840dfd3..cd6a63ca44 100644 --- a/src/create_box.cpp +++ b/src/create_box.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -36,23 +35,21 @@ CreateBox::CreateBox(LAMMPS *lmp) : Command(lmp) {} void CreateBox::command(int narg, char **arg) { - if (narg < 2) error->all(FLERR,"Illegal create_box command"); + if (narg < 2) error->all(FLERR, "Illegal create_box command"); - if (domain->box_exist) - error->all(FLERR,"Cannot create_box after simulation box is defined"); + if (domain->box_exist) error->all(FLERR, "Cannot create_box after simulation box is defined"); if (domain->dimension == 2 && domain->zperiodic == 0) - error->all(FLERR,"Cannot run 2d simulation with nonperiodic Z dimension"); + error->all(FLERR, "Cannot run 2d simulation with nonperiodic Z dimension"); domain->box_exist = 1; // region check - int iregion = domain->find_region(arg[1]); - if (iregion == -1) error->all(FLERR,"Create_box region ID does not exist"); - if (domain->regions[iregion]->bboxflag == 0) - error->all(FLERR,"Create_box region does not support a bounding box"); + auto region = domain->get_region_by_id(arg[1]); + if (!region) error->all(FLERR, "Create_box region {} does not exist", arg[1]); + if (region->bboxflag == 0) error->all(FLERR, "Create_box region does not support a bounding box"); - domain->regions[iregion]->init(); + region->init(); // if region not prism: // setup orthogonal domain @@ -61,27 +58,27 @@ void CreateBox::command(int narg, char **arg) // seutp triclinic domain // set simulation domain params from prism params - if (strcmp(domain->regions[iregion]->style,"prism") != 0) { + if (strcmp(region->style, "prism") != 0) { domain->triclinic = 0; - domain->boxlo[0] = domain->regions[iregion]->extent_xlo; - domain->boxhi[0] = domain->regions[iregion]->extent_xhi; - domain->boxlo[1] = domain->regions[iregion]->extent_ylo; - domain->boxhi[1] = domain->regions[iregion]->extent_yhi; - domain->boxlo[2] = domain->regions[iregion]->extent_zlo; - domain->boxhi[2] = domain->regions[iregion]->extent_zhi; + domain->boxlo[0] = region->extent_xlo; + domain->boxhi[0] = region->extent_xhi; + domain->boxlo[1] = region->extent_ylo; + domain->boxhi[1] = region->extent_yhi; + domain->boxlo[2] = region->extent_zlo; + domain->boxhi[2] = region->extent_zhi; } else { domain->triclinic = 1; - RegPrism *region = (RegPrism *) domain->regions[iregion]; - domain->boxlo[0] = region->xlo; - domain->boxhi[0] = region->xhi; - domain->boxlo[1] = region->ylo; - domain->boxhi[1] = region->yhi; - domain->boxlo[2] = region->zlo; - domain->boxhi[2] = region->zhi; - domain->xy = region->xy; - domain->xz = region->xz; - domain->yz = region->yz; + auto prism = dynamic_cast(region); + domain->boxlo[0] = prism->xlo; + domain->boxhi[0] = prism->xhi; + domain->boxlo[1] = prism->ylo; + domain->boxhi[1] = prism->yhi; + domain->boxlo[2] = prism->zlo; + domain->boxhi[2] = prism->zhi; + domain->xy = prism->xy; + domain->xz = prism->xz; + domain->yz = prism->yz; } // if molecular, zero out topology info @@ -99,7 +96,7 @@ void CreateBox::command(int narg, char **arg) // set atom and topology type quantities - atom->ntypes = utils::inumeric(FLERR,arg[0],false,lmp); + atom->ntypes = utils::inumeric(FLERR, arg[0], false, lmp); atom->nbondtypes = 0; atom->nangletypes = 0; atom->ndihedraltypes = 0; @@ -109,60 +106,57 @@ void CreateBox::command(int narg, char **arg) int iarg = 2; while (iarg < narg) { - if (strcmp(arg[iarg],"bond/types") == 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->nbondtypes = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "bond/types") == 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->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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + } 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 = 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"); + } 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "No dihedrals allowed with this atom style"); + 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"); + } 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "No impropers allowed with this atom style"); + 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + } 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 = 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + } 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 = 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"); + } 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "No dihedrals allowed with this atom style"); + 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"); + } 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + error->all(FLERR, "No impropers allowed with this atom style"); + 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "extra/special/per/atom") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal create_box command"); + 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"); + } else + error->all(FLERR, "Illegal create_box command"); } // problem setup using info from header diff --git a/src/create_box.h b/src/create_box.h index dd74755cf8..3aaac1d004 100644 --- a/src/create_box.h +++ b/src/create_box.h @@ -34,47 +34,3 @@ class CreateBox : public Command { #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: Cannot create_box after simulation box is defined - -A simulation box can only be defined once. - -E: Cannot run 2d simulation with non-periodic Z dimension - -Use the boundary command to make the z dimension periodic in order to -run a 2d simulation. - -E: Create_box region ID does not exist - -Self-explanatory. - -E: Create_box region does not support a bounding box - -Not all regions represent bounded volumes. You cannot use -such a region with the create_box command. - -E: No bonds allowed with this atom style - -Self-explanatory. - -E: No angles allowed with this atom style - -Self-explanatory. - -E: No dihedrals allowed with this atom style - -Self-explanatory. - -E: No impropers allowed with this atom style - -Self-explanatory. - -*/ diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 11d3523cd0..8524d44b07 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -132,11 +132,11 @@ void DeleteAtoms::command(int narg, char **arg) // reset bonus data counts - AtomVecEllipsoid *avec_ellipsoid = - (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); - AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); - AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body"); + auto avec_ellipsoid = + dynamic_cast( atom->style_match("ellipsoid")); + auto avec_line = dynamic_cast( atom->style_match("line")); + auto avec_tri = dynamic_cast( atom->style_match("tri")); + auto avec_body = dynamic_cast( atom->style_match("body")); bigint nlocal_bonus; if (atom->nellipsoids > 0) { @@ -428,7 +428,7 @@ void DeleteAtoms::delete_porosity(int narg, char **arg) int seed = utils::inumeric(FLERR,arg[4],false,lmp); options(narg-5,&arg[5]); - RanMars *random = new RanMars(lmp,seed + comm->me); + auto random = new RanMars(lmp,seed + comm->me); // allocate and initialize deletion list @@ -594,8 +594,8 @@ void DeleteAtoms::recount_topology() void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) { - DeleteAtoms *daptr = (DeleteAtoms *) ptr; - tagint *list = (tagint *) cbuf; + auto daptr = (DeleteAtoms *) ptr; + auto list = (tagint *) cbuf; std::map *hash = daptr->hash; int *num_bond = daptr->atom->num_bond; @@ -711,8 +711,8 @@ void DeleteAtoms::bondring(int nbuf, char *cbuf, void *ptr) void DeleteAtoms::molring(int n, char *cbuf, void *ptr) { - DeleteAtoms *daptr = (DeleteAtoms *)ptr; - tagint *list = (tagint *) cbuf; + auto daptr = (DeleteAtoms *)ptr; + auto list = (tagint *) cbuf; int *dlist = daptr->dlist; std::map *hash = daptr->hash; int nlocal = daptr->atom->nlocal; diff --git a/src/delete_atoms.h b/src/delete_atoms.h index 161427e4ef..33333a1ff4 100644 --- a/src/delete_atoms.h +++ b/src/delete_atoms.h @@ -57,66 +57,3 @@ class DeleteAtoms : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Delete_atoms command before simulation box is defined - -The delete_atoms command cannot be used before a read_data, -read_restart, or create_box command. - -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: Cannot use delete_atoms unless atoms have IDs - -Your atoms do not have IDs, so the delete_atoms command cannot be -used. - -W: Attempting to delete atoms in rigid bodies - -UNDOCUMENTED - -W: Ignoring 'compress yes' for molecular system - -UNDOCUMENTED - -E: Could not find delete_atoms group ID - -Group ID used in the delete_atoms command does not exist. - -E: Could not find delete_atoms region ID - -Region ID used in the delete_atoms command does not exist. - -E: Delete_atoms requires a pair style be defined - -This is because atom deletion within a cutoff uses a pairwise -neighbor list. - -E: Delete_atoms cutoff > max neighbor cutoff - -Can only delete atoms in atom pairs that will be in neighbor list. - -W: Delete_atoms cutoff > minimum neighbor cutoff - -This means atom pairs for some atom types may not be in the neighbor -list and thus an atom in that pair cannot be deleted. - -E: Cannot delete_atoms bond yes for non-molecular systems - -Self-explanatory. - -E: Cannot use delete_atoms bond yes with atom_style template - -This is because the bonds for that atom style are hardwired in the -molecule template. - -E: Delete_atoms mol yes requires atom attribute molecule - -Cannot use this option with a non-molecular system. - -*/ diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index 9947434da3..2dcbd4af56 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -19,8 +19,10 @@ #include "comm.h" #include "domain.h" #include "error.h" +#include "fix_bond_history.h" #include "force.h" #include "group.h" +#include "modify.h" #include "special.h" #include @@ -116,6 +118,10 @@ void DeleteBonds::command(int narg, char **arg) iarg++; } + // find instances of bond history to delete data + auto histories = modify->get_fix_by_style("BOND_HISTORY"); + int n_histories = histories.size(); + // border swap to insure type and mask is current for off-proc atoms // enforce PBC before in case atoms are outside box @@ -331,6 +337,11 @@ void DeleteBonds::command(int narg, char **arg) n = atom->num_bond[i]; atom->bond_type[i][m] = atom->bond_type[i][n-1]; atom->bond_atom[i][m] = atom->bond_atom[i][n-1]; + if (n_histories > 0) + for (auto &ihistory: histories) { + dynamic_cast(ihistory)->shift_history(i,m,n-1); + dynamic_cast(ihistory)->delete_history(i,n-1); + } atom->num_bond[i]--; } else m++; } else m++; @@ -431,32 +442,28 @@ void DeleteBonds::command(int narg, char **arg) if (atom->avec->bonds_allow) { bigint nbonds = 0; for (i = 0; i < nlocal; i++) nbonds += atom->num_bond[i]; - MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_LMP_BIGINT, - MPI_SUM,world); + MPI_Allreduce(&nbonds,&atom->nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); if (force->newton_bond == 0) atom->nbonds /= 2; } if (atom->avec->angles_allow) { bigint nangles = 0; for (i = 0; i < nlocal; i++) nangles += atom->num_angle[i]; - MPI_Allreduce(&nangles,&atom->nangles,1,MPI_LMP_BIGINT, - MPI_SUM,world); + MPI_Allreduce(&nangles,&atom->nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); if (force->newton_bond == 0) atom->nangles /= 3; } if (atom->avec->dihedrals_allow) { bigint ndihedrals = 0; for (i = 0; i < nlocal; i++) ndihedrals += atom->num_dihedral[i]; - MPI_Allreduce(&ndihedrals,&atom->ndihedrals, - 1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&ndihedrals,&atom->ndihedrals,1,MPI_LMP_BIGINT,MPI_SUM,world); if (force->newton_bond == 0) atom->ndihedrals /= 4; } if (atom->avec->impropers_allow) { bigint nimpropers = 0; for (i = 0; i < nlocal; i++) nimpropers += atom->num_improper[i]; - MPI_Allreduce(&nimpropers,&atom->nimpropers, - 1,MPI_LMP_BIGINT,MPI_SUM,world); + MPI_Allreduce(&nimpropers,&atom->nimpropers,1,MPI_LMP_BIGINT,MPI_SUM,world); if (force->newton_bond == 0) atom->nimpropers /= 4; } @@ -535,21 +542,18 @@ void DeleteBonds::command(int narg, char **arg) } if (comm->me == 0) { + constexpr auto fmtstr = " {} total {}, {} turned on, {} turned off\n"; if (atom->avec->bonds_allow) - utils::logmesg(lmp," {} total bonds, {} turned on, {} turned off\n", - atom->nbonds,bond_on,bond_off); + utils::logmesg(lmp,fmtstr,atom->nbonds,"bonds",bond_on,bond_off); if (atom->avec->angles_allow) - utils::logmesg(lmp," {} total angles, {} turned on, {} turned off\n", - atom->nangles,angle_on,angle_off); + utils::logmesg(lmp,fmtstr,atom->nangles,"angles",angle_on,angle_off); if (atom->avec->dihedrals_allow) - utils::logmesg(lmp," {} total dihedrals, {} turned on, {} turned off\n", - atom->ndihedrals,dihedral_on,dihedral_off); + utils::logmesg(lmp,fmtstr,atom->ndihedrals,"dihedrals",dihedral_on,dihedral_off); if (atom->avec->impropers_allow) - utils::logmesg(lmp," {} total impropers, {} turned on, {} turned off\n", - atom->nimpropers,improper_on,improper_off); + utils::logmesg(lmp,fmtstr,atom->nimpropers,"impropers",improper_on,improper_off); } // re-compute special list if requested diff --git a/src/delete_bonds.h b/src/delete_bonds.h index aff891e1ca..1b9c011e67 100644 --- a/src/delete_bonds.h +++ b/src/delete_bonds.h @@ -34,54 +34,3 @@ class DeleteBonds : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Delete_bonds command before simulation box is defined - -The delete_bonds command cannot be used before a read_data, -read_restart, or create_box command. - -E: Delete_bonds command with no atoms existing - -No atoms are yet defined so the delete_bonds command cannot be used. - -E: Cannot use delete_bonds with non-molecular system - -Your choice of atom style does not have bonds. - -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: Cannot find delete_bonds group ID - -Group ID used in the delete_bonds command does not exist. - -E: Bond atom missing in delete_bonds - -The delete_bonds command cannot find one or more atoms in a particular -bond on a particular processor. The pairwise cutoff is too short or -the atoms are too far apart to make a valid bond. - -E: Angle atom missing in delete_bonds - -The delete_bonds command cannot find one or more atoms in a particular -angle on a particular processor. The pairwise cutoff is too short or -the atoms are too far apart to make a valid angle. - -E: Dihedral atom missing in delete_bonds - -The delete_bonds command cannot find one or more atoms in a particular -dihedral on a particular processor. The pairwise cutoff is too short -or the atoms are too far apart to make a valid dihedral. - -E: Improper atom missing in delete_bonds - -The delete_bonds command cannot find one or more atoms in a particular -improper on a particular processor. The pairwise cutoff is too short -or the atoms are too far apart to make a valid improper. - -*/ diff --git a/src/deprecated.h b/src/deprecated.h index 9f91a4cc27..0e99512a9d 100644 --- a/src/deprecated.h +++ b/src/deprecated.h @@ -42,36 +42,3 @@ class Deprecated : public Command { #endif #endif - -/* ERROR/WARNING messages: - -W: Ignoring unknown or incorrect info command flag - -Self-explanatory. An unknown argument was given to the info command. -Compare your input with the documentation. - -E: Unknown name for info package category - -Self-explanatory. - -E: Unknown name for info newton category - -Self-explanatory. - -E: Unknown name for info pair category - -Self-explanatory. - -E: Unknown category for info is_active() - -Self-explanatory. - -E: Unknown category for info is_available() - -Self-explanatory. - -E: Unknown category for info is_defined() - -Self-explanatory. - -*/ diff --git a/src/dihedral.cpp b/src/dihedral.cpp index 5b4f923273..b82e1ed84e 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -35,6 +35,7 @@ Dihedral::Dihedral(LAMMPS *_lmp) : Pointers(_lmp) allocated = 0; suffix_flag = Suffix::NONE; + born_matrix_enable = 0; maxeatom = maxvatom = maxcvatom = 0; eatom = nullptr; diff --git a/src/dihedral.h b/src/dihedral.h index 7bb7eb2650..1d0a24338a 100644 --- a/src/dihedral.h +++ b/src/dihedral.h @@ -25,7 +25,8 @@ class Dihedral : protected Pointers { public: int allocated; int *setflag; - int writedata; // 1 if writes coeffs to data file + int writedata; // 1 if writes coeffs to data file + int born_matrix_enable; double energy; // accumulated energy double virial[6]; // accumulated virial: xx,yy,zz,xy,xz,yz double *eatom, **vatom; // accumulated per-atom energy/virial @@ -55,6 +56,12 @@ class Dihedral : protected Pointers { virtual void read_restart_settings(FILE *){}; virtual void write_data(FILE *) {} virtual double memory_usage(); + virtual void born_matrix(int /*dtype*/, int /*at1*/, int /*at2*/, int /*at3*/, int /*at4*/, + double &du, double &du2) + { + du = 0.0; + du2 = 0.0; + } protected: int suffix_flag; // suffix compatibility flag @@ -81,17 +88,3 @@ class Dihedral : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Dihedral coeffs are not set - -No dihedral coefficients have been assigned in the data file or via -the dihedral_coeff command. - -E: All dihedral coeffs are not set - -All dihedral coefficients must be set in the data file or by the -dihedral_coeff command before running a simulation. - -*/ diff --git a/src/dihedral_deprecated.cpp b/src/dihedral_deprecated.cpp index b1964d5210..57ea7f1afa 100644 --- a/src/dihedral_deprecated.cpp +++ b/src/dihedral_deprecated.cpp @@ -37,7 +37,7 @@ void DihedralDeprecated::settings(int, char **) // of the list of substyles if (utils::strmatch(my_style,"^hybrid")) { - DihedralHybrid *hybrid = (DihedralHybrid *)force->dihedral; + auto hybrid = dynamic_cast(force->dihedral); my_style = hybrid->keywords[hybrid->nstyles]; } diff --git a/src/dihedral_deprecated.h b/src/dihedral_deprecated.h index 2ee1544743..10af862990 100644 --- a/src/dihedral_deprecated.h +++ b/src/dihedral_deprecated.h @@ -39,7 +39,3 @@ class DihedralDeprecated : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/dihedral_hybrid.h b/src/dihedral_hybrid.h index bbdeb526b3..5c3ed584bc 100644 --- a/src/dihedral_hybrid.h +++ b/src/dihedral_hybrid.h @@ -54,31 +54,3 @@ class DihedralHybrid : public Dihedral { #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: Dihedral style hybrid cannot use same dihedral style twice - -Self-explanatory. - -E: Dihedral style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Dihedral style hybrid cannot have none as an argument - -Self-explanatory. - -E: Dihedral coeff for hybrid has invalid style - -Dihedral style hybrid uses another dihedral style as one of its -coefficients. The dihedral style used in the dihedral_coeff command -or read from a restart file is not recognized. - -*/ diff --git a/src/dihedral_zero.h b/src/dihedral_zero.h index 6428834a54..b338a92981 100644 --- a/src/dihedral_zero.h +++ b/src/dihedral_zero.h @@ -50,15 +50,3 @@ class DihedralZero : public Dihedral { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Incorrect args for dihedral coefficients - -UNDOCUMENTED - -*/ diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index c63f3c6592..75298604c9 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -177,7 +177,7 @@ void DisplaceAtoms::command(int narg, char **arg) // makes atom result independent of what proc owns it via random->reset() if (style == RANDOM) { - RanPark *random = new RanPark(lmp,1); + auto random = new RanPark(lmp,1); double dx = xscale*utils::numeric(FLERR,arg[2],false,lmp); double dy = yscale*utils::numeric(FLERR,arg[3],false,lmp); @@ -263,11 +263,10 @@ void DisplaceAtoms::command(int narg, char **arg) // AtomVec pointers to retrieve per-atom storage of extra quantities - AtomVecEllipsoid *avec_ellipsoid = - (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); - AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); - AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body"); + auto avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + auto avec_line = dynamic_cast( atom->style_match("line")); + auto avec_tri = dynamic_cast( atom->style_match("tri")); + auto avec_body = dynamic_cast( atom->style_match("body")); double **x = atom->x; int *ellipsoid = atom->ellipsoid; @@ -345,7 +344,7 @@ void DisplaceAtoms::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/displace_atoms.h b/src/displace_atoms.h index 3d04262a73..869f155190 100644 --- a/src/displace_atoms.h +++ b/src/displace_atoms.h @@ -43,52 +43,3 @@ class DisplaceAtoms : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Displace_atoms command before simulation box is defined - -The displace_atoms command cannot be used before a read_data, -read_restart, or create_box command. - -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: Cannot displace_atoms after reading restart file with per-atom info - -This is because the restart file info cannot be migrated with the -atoms. You can get around this by performing a 0-timestep run which -will assign the restart file info to actual atoms. - -E: Could not find displace_atoms group ID - -Group ID used in the displace_atoms command does not exist. - -W: Attempting to displace atoms in rigid bodies - -UNDOCUMENTED - -E: Invalid displace_atoms rotate axis for 2d - -Axis must be in z direction. - -E: Zero length rotation vector with displace_atoms - -Self-explanatory. - -W: Lost atoms via displace_atoms: original %ld current %ld - -The command options you have used caused atoms to be lost. - -E: Variable name for displace_atoms does not exist - -Self-explanatory. - -E: Variable for displace_atoms is invalid style - -It must be an equal-style or atom-style variable. - -*/ diff --git a/src/domain.cpp b/src/domain.cpp index 29244dff6a..ebc468faed 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -100,14 +100,11 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) boxhi_lamda[0] = boxhi_lamda[1] = boxhi_lamda[2] = 1.0; lattice = nullptr; - char **args = new char*[2]; + auto args = new char*[2]; args[0] = (char *) "none"; args[1] = (char *) "1.0"; set_lattice(2,args); - delete [] args; - - nregion = maxregion = 0; - regions = nullptr; + delete[] args; copymode = 0; @@ -128,10 +125,9 @@ Domain::~Domain() { if (copymode) return; + for (auto reg : regions) delete reg; + regions.clear(); delete lattice; - for (int i = 0; i < nregion; i++) delete regions[i]; - memory->sfree(regions); - delete region_map; } @@ -186,7 +182,7 @@ void Domain::init() for (const auto &fix : fixes) if (utils::strmatch(fix->style,"^deform")) { deform_flag = 1; - if (((FixDeform *) fix)->remapflag == Domain::V_REMAP) { + if ((dynamic_cast( fix))->remapflag == Domain::V_REMAP) { deform_vremap = 1; deform_groupbit = fix->groupbit; } @@ -194,7 +190,7 @@ void Domain::init() // region inits - for (int i = 0; i < nregion; i++) regions[i]->init(); + for (auto reg : regions) reg->init(); } /* ---------------------------------------------------------------------- @@ -1758,88 +1754,61 @@ void Domain::add_region(int narg, char **arg) if (strcmp(arg[1],"none") == 0) error->all(FLERR,"Unrecognized region style 'none'"); - if (find_region(arg[0]) >= 0) error->all(FLERR,"Reuse of region ID"); - - // extend Region list if necessary - - if (nregion == maxregion) { - maxregion += DELTAREGION; - regions = (Region **) - memory->srealloc(regions,maxregion*sizeof(Region *),"domain:regions"); - } + if (get_region_by_id(arg[0])) error->all(FLERR,"Reuse of region ID {}", arg[0]); // create the Region + Region *newregion = nullptr; if (lmp->suffix_enable) { if (lmp->suffix) { std::string estyle = std::string(arg[1]) + "/" + lmp->suffix; if (region_map->find(estyle) != region_map->end()) { RegionCreator ®ion_creator = (*region_map)[estyle]; - regions[nregion] = region_creator(lmp, narg, arg); - regions[nregion]->init(); - nregion++; - return; + newregion = region_creator(lmp, narg, arg); } } - if (lmp->suffix2) { + if (!newregion && lmp->suffix2) { std::string estyle = std::string(arg[1]) + "/" + lmp->suffix2; if (region_map->find(estyle) != region_map->end()) { RegionCreator ®ion_creator = (*region_map)[estyle]; - regions[nregion] = region_creator(lmp, narg, arg); - regions[nregion]->init(); - nregion++; - return; + newregion = region_creator(lmp, narg, arg); } } } - if (region_map->find(arg[1]) != region_map->end()) { + if (!newregion && (region_map->find(arg[1]) != region_map->end())) { RegionCreator ®ion_creator = (*region_map)[arg[1]]; - regions[nregion] = region_creator(lmp, narg, arg); - } else error->all(FLERR,utils::check_packages_for_style("region",arg[1],lmp)); + newregion = region_creator(lmp, narg, arg); + } + + if (!newregion) + error->all(FLERR,utils::check_packages_for_style("region",arg[1],lmp)); // initialize any region variables via init() // in case region is used between runs, e.g. to print a variable - regions[nregion]->init(); - nregion++; + newregion->init(); + regions.insert(newregion); } /* ---------------------------------------------------------------------- delete a region ------------------------------------------------------------------------- */ -void Domain::delete_region(int iregion) +void Domain::delete_region(Region *reg) { - if ((iregion < 0) || (iregion >= nregion)) return; + if (!reg) return; - // delete and move other Regions down in list one slot - - delete regions[iregion]; - for (int i = iregion+1; i < nregion; ++i) - regions[i-1] = regions[i]; - nregion--; + regions.erase(reg); + delete reg; } void Domain::delete_region(const std::string &id) { - int iregion = find_region(id); - if (iregion == -1) error->all(FLERR,"Delete region ID does not exist"); - - delete_region(iregion); -} - -/* ---------------------------------------------------------------------- - return region index if name matches existing region ID - return -1 if no such region -------------------------------------------------------------------------- */ - -int Domain::find_region(const std::string &name) const -{ - for (int iregion = 0; iregion < nregion; iregion++) - if (name == regions[iregion]->id) return iregion; - return -1; + auto reg = get_region_by_id(id); + if (!reg) error->all(FLERR,"Delete region {} does not exist", id); + delete_region(reg); } /* ---------------------------------------------------------------------- @@ -1849,8 +1818,8 @@ int Domain::find_region(const std::string &name) const Region *Domain::get_region_by_id(const std::string &name) const { - for (int iregion = 0; iregion < nregion; iregion++) - if (name == regions[iregion]->id) return regions[iregion]; + for (auto ® : regions) + if (name == reg->id) return reg; return nullptr; } @@ -1864,12 +1833,21 @@ const std::vector Domain::get_region_by_style(const std::string &name) std::vector matches; if (name.empty()) return matches; - for (int iregion = 0; iregion < nregion; iregion++) - if (name == regions[iregion]->style) matches.push_back(regions[iregion]); + for (auto ® : regions) + if (name == reg->style) matches.push_back(reg); return matches; } +/* ---------------------------------------------------------------------- + return list of regions as vector +------------------------------------------------------------------------- */ + +const std::vector Domain::get_region_list() +{ + return std::vector(regions.begin(), regions.end()); +} + /* ---------------------------------------------------------------------- (re)set boundary settings flag = 0, called from the input script diff --git a/src/domain.h b/src/domain.h index 68ff5aece5..649849e961 100644 --- a/src/domain.h +++ b/src/domain.h @@ -18,6 +18,8 @@ #include #include +#include +#include namespace LAMMPS_NS { class Region; @@ -98,10 +100,6 @@ class Domain : protected Pointers { class Lattice *lattice; // user-defined lattice - int nregion; // # of defined Regions - int maxregion; // max # list can hold - Region **regions; // list of defined Regions - int copymode; enum { NO_REMAP, X_REMAP, V_REMAP }; @@ -137,11 +135,11 @@ class Domain : protected Pointers { void set_lattice(int, char **); void add_region(int, char **); - void delete_region(int); + void delete_region(Region *); void delete_region(const std::string &); - int find_region(const std::string &) const; Region *get_region_by_id(const std::string &) const; const std::vector get_region_by_style(const std::string &) const; + const std::vector get_region_list(); void set_boundary(int, char **, int); void set_box(int, char **); void print_box(const std::string &); @@ -175,131 +173,9 @@ class Domain : protected Pointers { protected: double small[3]; // fractions of box lengths + std::unordered_set regions; }; } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Box bounds are invalid or missing - -UNDOCUMENTED - -E: Cannot skew triclinic box in z for 2d simulation - -Self-explanatory. - -E: Triclinic box skew is too large - -The displacement in a skewed direction must be less than half the box -length in that dimension. E.g. the xy tilt must be between -half and -+half of the x box length. This constraint can be relaxed by using -the box tilt command. - -W: Triclinic box skew is large - -The displacement in a skewed direction is normally required to be less -than half the box length in that dimension. E.g. the xy tilt must be -between -half and +half of the x box length. You have relaxed the -constraint using the box tilt command, but the warning means that a -LAMMPS simulation may be inefficient as a result. - -E: Illegal simulation box - -The lower bound of the simulation box is greater than the upper bound. - -E: Non-numeric atom coords - simulation unstable - -UNDOCUMENTED - -E: Bond atom missing in image check - -The 2nd atom in a particular bond is missing on this processor. -Typically this is because the pairwise cutoff is set too short or the -bond has blown apart and an atom is too far away. - -W: Inconsistent image flags - -The image flags for a pair on bonded atoms appear to be inconsistent. -Inconsistent means that when the coordinates of the two atoms are -unwrapped using the image flags, the two atoms are far apart. -Specifically they are further apart than half a periodic box length. -Or they are more than a box length apart in a non-periodic dimension. -This is usually due to the initial data file not having correct image -flags for the 2 atoms in a bond that straddles a periodic boundary. -They should be different by 1 in that case. This is a warning because -inconsistent image flags will not cause problems for dynamics or most -LAMMPS simulations. However they can cause problems when such atoms -are used with the fix rigid or replicate commands. - -W: Bond atom missing in image check - -The 2nd atom in a particular bond is missing on this processor. -Typically this is because the pairwise cutoff is set too short or the -bond has blown apart and an atom is too far away. - -E: Bond atom missing in box size check - -The 2nd atoms needed to compute a particular bond is missing on this -processor. Typically this is because the pairwise cutoff is set too -short or the bond has blown apart and an atom is too far away. - -W: Bond atom missing in box size check - -The 2nd atoms needed to compute a particular bond is missing on this -processor. Typically this is because the pairwise cutoff is set too -short or the bond has blown apart and an atom is too far away. - -W: Bond/angle/dihedral extent > half of periodic box length - -This is a restriction because LAMMPS can be confused about which image -of an atom in the bonded interaction is the correct one to use. -"Extent" in this context means the maximum end-to-end length of the -bond/angle/dihedral. LAMMPS computes this by taking the maximum bond -length, multiplying by the number of bonds in the interaction (e.g. 3 -for a dihedral) and adding a small amount of stretch. - -W: Proc sub-domain size < neighbor skin, could lead to lost atoms - -The decomposition of the physical domain (likely due to load -balancing) has led to a processor's sub-domain being smaller than the -neighbor skin in one or more dimensions. Since reneighboring is -triggered by atoms moving the skin distance, this may lead to lost -atoms, if an atom moves all the way across a neighboring processor's -sub-domain before reneighboring is triggered. - -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: Reuse of region ID - -A region ID cannot be used twice. - -E: Unrecognized region style - -The choice of region style is unknown. - -E: Delete region ID does not exist - -Self-explanatory. - -E: Both sides of boundary must be periodic - -Cannot specify a boundary as periodic only on the lo or hi side. Must -be periodic on both sides. - -E: Must not have multiple fixes change box parameter ... - -Self-explanatory. - -U: Box bounds are invalid - -The box boundaries specified in the read_data file are invalid. The -lo value must be less than the hi value for all 3 dimensions. - -*/ diff --git a/src/dump.cpp b/src/dump.cpp index 480bbe666c..c9a98cb239 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -270,12 +270,12 @@ void Dump::init() reorderflag = 1; double range = maxall-minall + EPSILON; idlo = static_cast (range*me/nprocs + minall); - tagint idhi = static_cast (range*(me+1)/nprocs + minall); + auto idhi = static_cast (range*(me+1)/nprocs + minall); - tagint lom1 = static_cast ((idlo-1-minall)/range * nprocs); - tagint lo = static_cast ((idlo-minall)/range * nprocs); - tagint him1 = static_cast ((idhi-1-minall)/range * nprocs); - tagint hi = static_cast ((idhi-minall)/range * nprocs); + auto lom1 = static_cast ((idlo-1-minall)/range * nprocs); + auto lo = static_cast ((idlo-minall)/range * nprocs); + auto him1 = static_cast ((idhi-1-minall)/range * nprocs); + auto hi = static_cast ((idhi-minall)/range * nprocs); if (me && me == lom1) idlo--; else if (me && me != lo) idlo++; if (me+1 == him1) idhi--; @@ -841,7 +841,7 @@ int Dump::idcompare(const int i, const int j, void *ptr) int Dump::bufcompare(const int i, const int j, void *ptr) { - Dump *dptr = (Dump *) ptr; + auto dptr = (Dump *) ptr; double *bufsort = dptr->bufsort; const int size_one = dptr->size_one; const int sortcolm1 = dptr->sortcolm1; @@ -862,7 +862,7 @@ int Dump::bufcompare(const int i, const int j, void *ptr) int Dump::bufcompare_reverse(const int i, const int j, void *ptr) { - Dump *dptr = (Dump *) ptr; + auto dptr = (Dump *) ptr; double *bufsort = dptr->bufsort; const int size_one = dptr->size_one; const int sortcolm1 = dptr->sortcolm1; @@ -938,7 +938,7 @@ void Dump::balance() // post recvs first int nswap = 0; - MPI_Request *request = new MPI_Request[nprocs]; + auto request = new MPI_Request[nprocs]; // find which proc starting atom belongs to @@ -1181,7 +1181,7 @@ void Dump::modify_params(int narg, char **arg) } else if (strcmp(arg[iarg],"header") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal dump_modify command"); - header_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); + write_header_flag = utils::logical(FLERR,arg[iarg+1],false,lmp); iarg += 2; } else if (strcmp(arg[iarg],"maxfiles") == 0) { diff --git a/src/dump.h b/src/dump.h index 34e0677af8..a95029ada8 100644 --- a/src/dump.h +++ b/src/dump.h @@ -21,7 +21,8 @@ namespace LAMMPS_NS { class Dump : protected Pointers { - friend class Output; + friend class Output; + public: char *id; // user-defined name of Dump char *style; // style of Dump @@ -66,7 +67,6 @@ class Dump : protected Pointers { char *multiname; // filename with % converted to cluster ID MPI_Comm clustercomm; // MPI communicator within my cluster of procs - int header_flag; // 0 = item, 2 = xyz int flush_flag; // 0 if no flush, 1 if flush every dump int sort_flag; // 1 if sorted output int balance_flag; // 1 if load balanced output @@ -120,11 +120,11 @@ class Dump : protected Pointers { int fileidx; // index of file in names list char **nameslist; // list of history file names - bigint ntotal; // total # of per-atom lines in snapshot - int reorderflag; // 1 if OK to reorder instead of sort + bigint ntotal; // total # of per-atom lines in snapshot + int reorderflag; // 1 if OK to reorder instead of sort bigint ntotal_reorder; // # of atoms that must be in snapshot - int nme_reorder; // # of atoms I must own in snapshot - tagint idlo; // lowest ID I own when reordering + int nme_reorder; // # of atoms I must own in snapshot + tagint idlo; // lowest ID I own when reordering int maxbuf; // size of buf double *buf; // memory for atom quantities @@ -172,65 +172,3 @@ class Dump : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Dump file MPI-IO output not allowed with % in filename - -This is because a % signifies one file per processor and MPI-IO -creates one large file for all processors. - -E: Cannot dump sort when 'nfile' or 'fileper' keywords are set to non-default values - -Can only dump sort when the number of dump file pieces using % in filename equals the number of processors - -E: Cannot dump sort on atom IDs with no atom IDs defined - -Self-explanatory. - -E: Dump sort column is invalid - -Self-explanatory. - -E: Dump could not find refresh compute ID - -UNDOCUMENTED - -E: Too much per-proc info for dump - -Number of local atoms times number of columns must fit in a 32-bit -integer for dump. - -E: Too much buffered per-proc info for dump - -The size of the buffered string must fit in a 32-bit integer for a -dump. - -E: Cannot open gzipped file - -LAMMPS was compiled without support for reading and writing gzipped -files through a pipeline to the gzip program with -DLAMMPS_GZIP. - -E: Cannot open dump file - -Self-explanatory. - -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: Dump_modify buffer yes not allowed for this style - -Self-explanatory. - -E: Cannot use dump_modify fileper without % in dump file name - -Self-explanatory. - -E: Cannot use dump_modify nfile without % in dump file name - -Self-explanatory. - -*/ diff --git a/src/dump_atom.h b/src/dump_atom.h index 3c67e3de54..335557ea95 100644 --- a/src/dump_atom.h +++ b/src/dump_atom.h @@ -86,13 +86,3 @@ class DumpAtom : public Dump { #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. - -*/ diff --git a/src/dump_cfg.h b/src/dump_cfg.h index 21b5396677..f2df772319 100644 --- a/src/dump_cfg.h +++ b/src/dump_cfg.h @@ -50,24 +50,3 @@ class DumpCFG : public DumpCustom { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump cfg arguments must start with 'mass type xs ys zs' or 'mass type xsu ysu zsu' - -This is a requirement of the CFG output format. See the dump cfg doc -page for more details. - -E: Dump cfg arguments can not mix xs|ys|zs with xsu|ysu|zsu - -Self-explanatory. - -E: Dump cfg requires one snapshot per file - -Use the wildcard "*" character in the filename. - -U: Invalid keyword in dump cfg command - -Self-explanatory. - -*/ diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 606051bc70..87bd04b2a9 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -53,14 +53,13 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; /* ---------------------------------------------------------------------- */ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : - Dump(lmp, narg, arg), - idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr), - thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), thresh_first(nullptr), - earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), columns_default(nullptr), - choose(nullptr), dchoose(nullptr), clist(nullptr), field2index(nullptr), argindex(nullptr), - id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), id_variable(nullptr), - variable(nullptr), vbuf(nullptr), id_custom(nullptr), custom(nullptr), custom_flag(nullptr), - typenames(nullptr), pack_choice(nullptr) + Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), + thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), + thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), + columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr), + field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), + fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr), + custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); @@ -87,39 +86,16 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : buffer_allow = 1; buffer_flag = 1; - iregion = -1; - idregion = nullptr; nthresh = 0; - thresh_array = nullptr; - thresh_op = nullptr; - thresh_value = nullptr; - thresh_last = nullptr; - nthreshlast = 0; - thresh_fix = nullptr; - thresh_fixID = nullptr; - thresh_first = nullptr; // computes, fixes, variables which the dump accesses ncompute = 0; - id_compute = nullptr; - compute = nullptr; - nfix = 0; - id_fix = nullptr; - fix = nullptr; - nvariable = 0; - id_variable = nullptr; - variable = nullptr; - vbuf = nullptr; - ncustom = 0; - id_custom = nullptr; - custom = nullptr; - custom_flag = nullptr; // process attributes // ioptional = start of additional optional args in expanded args @@ -144,9 +120,6 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : // atom selection arrays maxlocal = 0; - choose = nullptr; - dchoose = nullptr; - clist = nullptr; // default element name for all types = C @@ -364,13 +337,10 @@ void DumpCustom::init_style() else if (flag && cols) custom_flag[i] = DARRAY; } - // set index and check validity of region + // check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for dump custom does not exist"); - } + if (idregion && !domain->get_region_by_id(idregion)) + error->all(FLERR,"Region {} for dump custom does not exist", idregion); // open single file, one time only @@ -625,8 +595,8 @@ int DumpCustom::count() // un-choose if not in region - if (iregion >= 0) { - Region *region = domain->regions[iregion]; + if (idregion) { + auto region = domain->get_region_by_id(idregion); region->prematch(); double **x = atom->x; for (i = 0; i < nlocal; i++) @@ -1690,12 +1660,13 @@ int DumpCustom::modify_param(int narg, char **arg) { if (strcmp(arg[0],"region") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); - if (strcmp(arg[1],"none") == 0) iregion = -1; - else { - iregion = domain->find_region(arg[1]); - if (iregion == -1) - error->all(FLERR,"Dump_modify region ID {} does not exist",arg[1]); + if (strcmp(arg[1],"none") == 0) { delete[] idregion; + idregion = nullptr; + } else { + delete[] idregion; + if (!domain->get_region_by_id(arg[1])) + error->all(FLERR,"Dump_modify region {} does not exist", arg[1]); idregion = utils::strdup(arg[1]); } return 2; @@ -1740,7 +1711,7 @@ int DumpCustom::modify_param(int narg, char **arg) int i = utils::inumeric(FLERR,arg[1],false,lmp) - 1; if (i < 0 || i >= nfield) error->all(FLERR,"Illegal dump_modify command"); - if (format_column_user[i]) delete[] format_column_user[i]; + delete[] format_column_user[i]; format_column_user[i] = utils::strdup(arg[2]); } return 3; @@ -2038,7 +2009,7 @@ int DumpCustom::modify_param(int narg, char **arg) std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast); thresh_fixID[nthreshlast] = utils::strdup(threshid); threshid += fmt::format(" {} STORE peratom 1 1", group->names[igroup]); - thresh_fix[nthreshlast] = (FixStore *) modify->add_fix(threshid); + thresh_fix[nthreshlast] = dynamic_cast( modify->add_fix(threshid)); thresh_last[nthreshlast] = nthreshlast; thresh_first[nthreshlast] = 1; diff --git a/src/dump_custom.h b/src/dump_custom.h index 0dcfd82bba..b27a9950cd 100644 --- a/src/dump_custom.h +++ b/src/dump_custom.h @@ -35,8 +35,7 @@ class DumpCustom : public Dump { protected: int nevery; // dump frequency for output - int iregion; // -1 if no region, else which region - char *idregion; // region ID + char *idregion; // region ID, nullptr if no region int nthresh; // # of defined thresholds int nthreshlast; // # of defined thresholds with value = LAST @@ -52,16 +51,16 @@ class DumpCustom : public Dump { char **thresh_fixID; // IDs of thresh_fixes int *thresh_first; // 1 the first time a FixStore values accessed - int expand; // flag for whether field args were expanded - char **earg; // field names with wildcard expansion - int nargnew; // size of earg - // - int *vtype; // type of each vector (INT, DOUBLE) - char **vformat; // format string for each vector element - // - char *columns; // column labels + int expand; // flag for whether field args were expanded + char **earg; // field names with wildcard expansion + int nargnew; // size of earg + // + int *vtype; // type of each vector (INT, DOUBLE) + char **vformat; // format string for each vector element + // + char *columns; // column labels char *columns_default; - // + // int nchoose; // # of selected atoms int maxlocal; // size of atom selection and variable arrays int *choose; // local indices of selected atoms @@ -210,208 +209,3 @@ class DumpCustom : public Dump { #endif #endif - -/* ERROR/WARNING messages: - -E: No dump custom arguments specified - -The dump custom command requires that atom quantities be specified to -output to dump file. - -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: Invalid attribute in dump custom command - -Self-explanatory. - -E: Dump_modify format line is too short - -UNDOCUMENTED - -E: Could not find dump custom compute ID - -Self-explanatory. - -E: Could not find dump custom fix ID - -Self-explanatory. - -E: Dump custom and fix not computed at compatible times - -The fix must produce per-atom quantities on timesteps that dump custom -needs them. - -E: Could not find dump custom variable name - -Self-explanatory. - -E: Could not find custom per-atom property ID - -Self-explanatory. - -E: Region ID for dump custom does not exist - -Self-explanatory. - -E: Compute used in dump between runs is not current - -The compute was not invoked on the current timestep, therefore it -cannot be used in a dump between runs. - -E: Threshold for an atom property that isn't allocated - -A dump threshold has been requested on a quantity that is -not defined by the atom style used in this simulation. - -E: Dumping an atom property that isn't allocated - -The chosen atom style does not define the per-atom quantity being -dumped. - -E: Dump custom compute does not compute per-atom info - -Self-explanatory. - -E: Dump custom compute does not calculate per-atom vector - -Self-explanatory. - -E: Dump custom compute does not calculate per-atom array - -Self-explanatory. - -E: Dump custom compute vector is accessed out-of-range - -Self-explanatory. - -E: Dump custom fix does not compute per-atom info - -Self-explanatory. - -E: Dump custom fix does not compute per-atom vector - -Self-explanatory. - -E: Dump custom fix does not compute per-atom array - -Self-explanatory. - -E: Dump custom fix vector is accessed out-of-range - -Self-explanatory. - -E: Dump custom variable is not atom-style variable - -Only atom-style variables generate per-atom quantities, needed for -dump output. - -E: Custom per-atom property ID is not floating point - -Self-explanatory. - -E: Custom per-atom property ID is not integer - -Self-explanatory. - -E: Dump_modify region ID does not exist - -Self-explanatory. - -E: Dump_modify int format does not contain d character - -UNDOCUMENTED - -E: Dump_modify element names do not match atom types - -UNDOCUMENTED - -E: Dump modify can only have one refresh - -UNDOCUMENTED - -E: Invalid attribute in dump modify command - -Self-explanatory. - -E: Could not find dump modify compute ID - -Self-explanatory. - -E: Dump modify compute ID does not compute per-atom info - -Self-explanatory. - -E: Dump modify compute ID does not compute per-atom vector - -Self-explanatory. - -E: Dump modify compute ID does not compute per-atom array - -Self-explanatory. - -E: Dump modify compute ID vector is not large enough - -Self-explanatory. - -E: Could not find dump modify fix ID - -Self-explanatory. - -E: Dump modify fix ID does not compute per-atom info - -Self-explanatory. - -E: Dump modify fix ID does not compute per-atom vector - -Self-explanatory. - -E: Dump modify fix ID does not compute per-atom array - -Self-explanatory. - -E: Dump modify fix ID vector is not large enough - -Self-explanatory. - -E: Could not find dump modify variable name - -Self-explanatory. - -E: Dump modify variable is not atom-style variable - -Self-explanatory. - -E: Could not find dump modify custom atom floating point property ID - -Self-explanatory. - -E: Could not find dump modify custom atom integer property ID - -Self-explanatory. - -E: Invalid dump_modify thresh attribute - -UNDOCUMENTED - -E: Invalid dump_modify thresh operator - -UNDOCUMENTED - -U: Dump_modify format string is too short - -There are more fields to be dumped in a line of output than your -format string specifies. - -U: Dump modify element names do not match atom types - -Number of element names must equal number of atom types. - -U: Invalid dump_modify threshold operator - -Operator keyword used for threshold specification in not recognized. - -*/ diff --git a/src/dump_deprecated.h b/src/dump_deprecated.h index f8d0c58234..85a4d17d7f 100644 --- a/src/dump_deprecated.h +++ b/src/dump_deprecated.h @@ -39,11 +39,3 @@ class DumpDeprecated : public Dump { #endif #endif - -/* ERROR/WARNING messages: - -E: This dump style has been removed from LAMMPS - -UNDOCUMENTED - -*/ diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 0179878111..7a7f89801a 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -332,17 +332,17 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : // error checks and setup for lineflag, triflag, bodyflag, fixflag if (lineflag) { - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); if (!avec_line) error->all(FLERR,"Dump image line requires atom style line"); } if (triflag) { - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); if (!avec_tri) error->all(FLERR,"Dump image tri requires atom style tri"); } if (bodyflag) { - avec_body = (AtomVecBody *) atom->style_match("body"); + avec_body = dynamic_cast( atom->style_match("body")); if (!avec_body) error->all(FLERR,"Dump image body yes requires atom style body"); } diff --git a/src/dump_image.h b/src/dump_image.h index 6c2f419f2e..dc91d43aea 100644 --- a/src/dump_image.h +++ b/src/dump_image.h @@ -106,117 +106,3 @@ class DumpImage : public DumpCustom { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid dump image filename - -The file produced by dump image cannot be binary and must -be for a single processor. - -E: Support for writing images in JPEG format not included - -LAMMPS was not built with the -DLAMMPS_JPEG switch in the Makefile. - -E: Support for writing images in PNG format not included - -LAMMPS was not built with the -DLAMMPS_PNG switch in the Makefile. - -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: Dump image bond not allowed with no bond types - -Self-explanatory. - -E: Invalid dump image theta value - -Theta must be between 0.0 and 180.0 inclusive. - -E: Dump image line requires atom style line - -Self-explanatory. - -E: Dump image tri requires atom style tri - -Self-explanatory. - -E: Dump image body yes requires atom style body - -Self-explanatory. - -E: Fix ID for dump image does not exist - -UNDOCUMENTED - -E: Dump image requires one snapshot per file - -Use a "*" in the filename. - -E: Dump image cannot perform sorting - -Self-explanatory. - -E: Variable name for dump image theta does not exist - -Self-explanatory. - -E: Variable for dump image theta is invalid style - -Must be an equal-style variable. - -E: Variable name for dump image phi does not exist - -Self-explanatory. - -E: Variable for dump image phi is invalid style - -Must be an equal-style variable. - -E: Variable name for dump image center does not exist - -Self-explanatory. - -E: Variable for dump image center is invalid style - -Must be an equal-style variable. - -E: Variable name for dump image zoom does not exist - -Self-explanatory. - -E: Variable for dump image zoom is invalid style - -Must be an equal-style variable. - -E: Invalid dump image element name - -The specified element name was not in the standard list of elements. -See the dump_modify doc page. - -E: Invalid color map min/max values - -The min/max values are not consistent with either each other or -with values in the color map. - -E: Invalid dump image zoom value - -Zoom value must be > 0.0. - -E: Invalid color in dump_modify command - -The specified color name was not in the list of recognized colors. -See the dump_modify doc page. - -E: Dump modify bcolor not allowed with no bond types - -Self-explanatory. - -E: Dump modify bdiam not allowed with no bond types - -Self-explanatory. - -*/ diff --git a/src/dump_local.cpp b/src/dump_local.cpp index d0344d24c9..012e8b95dd 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -257,7 +257,7 @@ int DumpLocal::modify_param(int narg, char **arg) int i = utils::inumeric(FLERR,arg[1],false,lmp) - 1; if (i < 0 || i >= nfield) error->all(FLERR,"Illegal dump_modify command"); - if (format_column_user[i]) delete[] format_column_user[i]; + delete[] format_column_user[i]; format_column_user[i] = utils::strdup(arg[2]); } return 3; diff --git a/src/dump_local.h b/src/dump_local.h index 7cd441c8e7..160ff87f0a 100644 --- a/src/dump_local.h +++ b/src/dump_local.h @@ -84,91 +84,3 @@ class DumpLocal : public Dump { #endif #endif - -/* ERROR/WARNING messages: - -E: No dump local arguments specified - -Self-explanatory. - -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: Binary files are not supported with dump local - -UNDOCUMENTED - -E: Dump local cannot sort by atom ID - -This is because dump local does not really dump per-atom info. - -E: Dump_modify format line is too short - -UNDOCUMENTED - -E: Could not find dump local compute ID - -Self-explanatory. - -E: Could not find dump local fix ID - -Self-explanatory. - -E: Dump local and fix not computed at compatible times - -The fix must produce per-atom quantities on timesteps that dump local -needs them. - -E: Compute used in dump between runs is not current - -The compute was not invoked on the current timestep, therefore it -cannot be used in a dump between runs. - -E: Dump local count is not consistent across input fields - -Every column of output must be the same length. - -E: Invalid attribute in dump local command - -Self-explanatory. - -E: Dump local compute does not compute local info - -Self-explanatory. - -E: Dump local compute does not calculate local vector - -Self-explanatory. - -E: Dump local compute does not calculate local array - -Self-explanatory. - -E: Dump local compute vector is accessed out-of-range - -Self-explanatory. - -E: Dump local fix does not compute local info - -Self-explanatory. - -E: Dump local fix does not compute local vector - -Self-explanatory. - -E: Dump local fix does not compute local array - -Self-explanatory. - -E: Dump local fix vector is accessed out-of-range - -Self-explanatory. - -E: Dump local attributes contain no compute or fix - -Self-explanatory. - -*/ diff --git a/src/dump_movie.h b/src/dump_movie.h index dd302d40b3..cb0be72cdf 100644 --- a/src/dump_movie.h +++ b/src/dump_movie.h @@ -42,27 +42,3 @@ class DumpMovie : public DumpImage { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid dump movie filename - -The file produced by dump movie cannot be binary or compressed -and must be a single file for a single processor. - -E: Support for writing movies not included - -LAMMPS was not built with the -DLAMMPS_FFMPEG switch in the Makefile - -E: Failed to open FFmpeg pipeline to file %s - -The specified file cannot be opened. Check that the path and name are -correct and writable and that the FFmpeg executable can be found and run. - -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. - -*/ diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index d8819820ec..12ab962a82 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -41,7 +41,7 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), sort_flag = 1; sortcol = 0; - if (format_default) delete [] format_default; + delete[] format_default; format_default = utils::strdup("%s %g %g %g"); diff --git a/src/dump_xyz.h b/src/dump_xyz.h index e9d43a5d91..c85d13bb44 100644 --- a/src/dump_xyz.h +++ b/src/dump_xyz.h @@ -50,22 +50,3 @@ class DumpXYZ : public Dump { #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: Invalid dump xyz filename - -Filenames used with the dump xyz style cannot be binary or cause files -to be written by each processor. - -E: Dump modify element names do not match atom types - -Number of element names must equal number of atom types. - -*/ diff --git a/src/error.h b/src/error.h index b92a8f1e7a..65c4b6e841 100644 --- a/src/error.h +++ b/src/error.h @@ -87,7 +87,3 @@ class Error : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/finish.cpp b/src/finish.cpp index cc0cad7f92..ea472682a2 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -341,7 +341,7 @@ void Finish::end(int flag) } #ifdef LMP_OPENMP - FixOMP *fixomp = (FixOMP *) modify->get_fix_by_id("package_omp"); + FixOMP *fixomp = dynamic_cast( modify->get_fix_by_id("package_omp")); // print thread breakdown only with full timer detail diff --git a/src/finish.h b/src/finish.h index 8eeb4c213d..3e41287680 100644 --- a/src/finish.h +++ b/src/finish.h @@ -30,11 +30,3 @@ class Finish : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -W: Timing breakdown may not be accurate since GPU/CPU overlap is enabled\nUsing 'export CUDA_LAUNCH_BLOCKING=1' will give an accurate timing breakdown but will reduce performance - -UNDOCUMENTED - -*/ diff --git a/src/fix.h b/src/fix.h index 34ef32207d..41a30d2d60 100644 --- a/src/fix.h +++ b/src/fix.h @@ -280,8 +280,8 @@ class Fix : protected Pointers { } void v_setup(int); void v_tally(int, int *, double, double *); - void v_tally(int,int*,double,double*,int,int,int[][2],double*,double[][3]); - void v_tally(int,int*,double,double*,double[][3],double[][3],double[]); + void v_tally(int, int *, double, double *, int, int, int[][2], double *, double[][3]); + void v_tally(int, int *, double, double *, double[][3], double[][3], double[]); void v_tally(int, double *); void v_tally(int, int, double); }; @@ -317,21 +317,3 @@ namespace FixConst { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Fix ID must be alphanumeric or underscore characters - -Self-explanatory. - -E: Could not find fix group ID - -A group ID used in the fix command does not exist. - -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. - -*/ diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 766dc9cd74..edaa5c9866 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -14,6 +14,7 @@ #include "fix_adapt.h" +#include "angle.h" #include "atom.h" #include "bond.h" #include "domain.h" @@ -38,13 +39,14 @@ using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; -enum{PAIR,KSPACE,ATOM,BOND}; +enum{PAIR,KSPACE,ATOM,BOND,ANGLE}; enum{DIAMETER,CHARGE}; /* ---------------------------------------------------------------------- */ -FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) +FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), nadapt(0), anypair(0), anybond(0), anyangle(0), + id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix adapt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -75,6 +77,10 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) if (iarg+5 > narg) error->all(FLERR,"Illegal fix adapt command"); nadapt++; iarg += 5; + } else if (strcmp(arg[iarg],"angle") == 0) { + if (iarg+5 > narg) error->all(FLERR,"Illegal fix adapt command"); + nadapt++; + iarg += 5; } else break; } @@ -119,6 +125,20 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) nadapt++; iarg += 5; + } else if (strcmp(arg[iarg],"angle") == 0) { + if (iarg+5 > narg) error->all(FLERR, "Illegal fix adapt command"); + adapt[nadapt].which = ANGLE; + adapt[nadapt].angle = nullptr; + adapt[nadapt].astyle = utils::strdup(arg[iarg+1]); + adapt[nadapt].aparam = utils::strdup(arg[iarg+2]); + utils::bounds(FLERR,arg[iarg+3],1,atom->nangletypes, + adapt[nadapt].ilo,adapt[nadapt].ihi,error); + if (utils::strmatch(arg[iarg+4],"^v_")) { + adapt[nadapt].var = utils::strdup(arg[iarg+4]+2); + } else error->all(FLERR,"Illegal fix adapt command"); + nadapt++; + iarg += 5; + } else if (strcmp(arg[iarg],"kspace") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix adapt command"); adapt[nadapt].which = KSPACE; @@ -133,12 +153,12 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) adapt[nadapt].which = ATOM; if (strcmp(arg[iarg+1],"diameter") == 0 || strcmp(arg[iarg+1],"diameter/disc") == 0) { - adapt[nadapt].aparam = DIAMETER; + adapt[nadapt].atomparam = DIAMETER; diamflag = 1; discflag = 0; if (strcmp(arg[iarg+1],"diameter/disc") == 0) discflag = 1; } else if (strcmp(arg[iarg+1],"charge") == 0) { - adapt[nadapt].aparam = CHARGE; + adapt[nadapt].atomparam = CHARGE; chgflag = 1; } else error->all(FLERR,"Illegal fix adapt command"); if (utils::strmatch(arg[iarg+2],"^v_")) { @@ -191,6 +211,13 @@ nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) for (int m = 0; m < nadapt; ++m) if (adapt[m].which == BOND) memory->create(adapt[m].vector_orig,n+1,"adapt:vector_orig"); + + // allocate angle style arrays: + + n = atom->nbondtypes; + for (int m = 0; m < nadapt; ++m) + if (adapt[m].which == ANGLE) + memory->create(adapt[m].vector_orig,n+1,"adapt:vector_orig"); } /* ---------------------------------------------------------------------- */ @@ -207,6 +234,10 @@ FixAdapt::~FixAdapt() delete [] adapt[m].bstyle; delete [] adapt[m].bparam; memory->destroy(adapt[m].vector_orig); + } else if (adapt[m].which == ANGLE) { + delete [] adapt[m].astyle; + delete [] adapt[m].aparam; + memory->destroy(adapt[m].vector_orig); } } delete [] adapt; @@ -247,8 +278,8 @@ void FixAdapt::post_constructor() if (diamflag && atom->radius_flag) { id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM")); - fix_diam = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 1", - id_fix_diam,group->names[igroup])); + fix_diam = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE peratom 1 1", + id_fix_diam,group->names[igroup]))); if (fix_diam->restart_reset) fix_diam->restart_reset = 0; else { double *vec = fix_diam->vstore; @@ -265,8 +296,8 @@ void FixAdapt::post_constructor() if (chgflag && atom->q_flag) { id_fix_chg = utils::strdup(id + std::string("_FIX_STORE_CHG")); - fix_chg = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 1", - id_fix_chg,group->names[igroup])); + fix_chg = dynamic_cast( modify->add_fix(fmt::format("{} {} STORE peratom 1 1", + id_fix_chg,group->names[igroup]))); if (fix_chg->restart_reset) fix_chg->restart_reset = 0; else { double *vec = fix_chg->vstore; @@ -299,6 +330,7 @@ void FixAdapt::init() anypair = 0; anybond = 0; + anyangle = 0; for (int m = 0; m < nadapt; m++) { Adapt *ad = &adapt[m]; @@ -348,7 +380,7 @@ void FixAdapt::init() // if pair hybrid, test that ilo,ihi,jlo,jhi are valid for sub-style if (utils::strmatch(force->pair_style,"^hybrid")) { - PairHybrid *pair = (PairHybrid *) force->pair; + auto pair = dynamic_cast( force->pair); for (i = ad->ilo; i <= ad->ihi; i++) for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) if (!pair->check_ijtype(i,j,pstyle)) @@ -357,6 +389,7 @@ void FixAdapt::init() } delete [] pstyle; + } else if (ad->which == BOND) { ad->bond = nullptr; anybond = 1; @@ -383,13 +416,39 @@ void FixAdapt::init() delete [] bstyle; + } else if (ad->which == ANGLE) { + ad->angle = nullptr; + anyangle = 1; + + char *astyle = utils::strdup(ad->astyle); + if (lmp->suffix_enable) + ad->angle = force->angle_match(fmt::format("{}/{}",astyle,lmp->suffix)); + + if (ad->angle == nullptr) ad->angle = force->angle_match(astyle); + if (ad->angle == nullptr ) + error->all(FLERR,"Fix adapt angle style does not exist"); + + void *ptr = ad->angle->extract(ad->aparam,ad->bdim); + + if (ptr == nullptr) + error->all(FLERR,"Fix adapt angle style param not supported"); + + // for angle styles, use a vector + + if (ad->adim == 1) ad->vector = (double *) ptr; + + if (utils::strmatch(force->angle_style,"^hybrid")) + error->all(FLERR,"Fix adapt does not support angle_style hybrid"); + + delete [] astyle; + } else if (ad->which == KSPACE) { if (force->kspace == nullptr) error->all(FLERR,"Fix adapt kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); } else if (ad->which == ATOM) { - if (ad->aparam == DIAMETER) { + if (ad->atomparam == DIAMETER) { if (!atom->radius_flag) error->all(FLERR,"Fix adapt requires atom attribute diameter"); if (!atom->rmass_flag) @@ -398,7 +457,7 @@ void FixAdapt::init() error->all(FLERR,"Fix adapt requires 2d simulation"); if (!restart_reset) previous_diam_scale = 1.0; } - if (ad->aparam == CHARGE) { + if (ad->atomparam == CHARGE) { if (!atom->q_flag) error->all(FLERR,"Fix adapt requires atom attribute charge"); if (!restart_reset) previous_chg_scale = 1.0; @@ -408,7 +467,7 @@ void FixAdapt::init() if (restart_reset) restart_reset = 0; - // make copy of original pair/bond array values + // make copy of original pair/bond/angle array values for (int m = 0; m < nadapt; m++) { Adapt *ad = &adapt[m]; @@ -422,6 +481,10 @@ void FixAdapt::init() } else if (ad->which == BOND && ad->bdim == 1) { for (i = ad->ilo; i <= ad->ihi; ++i ) ad->vector_orig[i] = ad->vector[i]; + + } else if (ad->which == ANGLE && ad->adim == 1) { + for (i = ad->ilo; i <= ad->ihi; ++i ) + ad->vector_orig[i] = ad->vector[i]; } } @@ -431,16 +494,16 @@ void FixAdapt::init() if (id_fix_diam) { int ifix = modify->find_fix(id_fix_diam); if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID"); - fix_diam = (FixStore *) modify->fix[ifix]; + fix_diam = dynamic_cast( modify->fix[ifix]); } if (id_fix_chg) { int ifix = modify->find_fix(id_fix_chg); if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID"); - fix_chg = (FixStore *) modify->fix[ifix]; + fix_chg = dynamic_cast( modify->fix[ifix]); } if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -483,7 +546,7 @@ void FixAdapt::post_run() } /* ---------------------------------------------------------------------- - change pair,kspace,atom parameters based on variable evaluation + change pair,bond,angle,kspace,atom parameters based on variable evaluation ------------------------------------------------------------------------- */ void FixAdapt::change_settings() @@ -527,6 +590,18 @@ void FixAdapt::change_settings() ad->vector[i] = value; } + // set angle type array values: + + } else if (ad->which == ANGLE) { + if (ad->adim == 1) { + if (scaleflag) + for (i = ad->ilo; i <= ad->ihi; ++i ) + ad->vector[i] = value*ad->vector_orig[i]; + else + for (i = ad->ilo; i <= ad->ihi; ++i ) + ad->vector[i] = value; + } + // set kspace scale factor } else if (ad->which == KSPACE) { @@ -540,7 +615,7 @@ void FixAdapt::change_settings() // also reset rmass to new value assuming density remains constant // for scaleflag, previous_diam_scale is the scale factor on previous step - if (ad->aparam == DIAMETER) { + if (ad->atomparam == DIAMETER) { double scale; double *radius = atom->radius; double *rmass = atom->rmass; @@ -567,7 +642,7 @@ void FixAdapt::change_settings() // reset charge to new value, for both owned and ghost atoms // for scaleflag, previous_chg_scale is the scale factor on previous step - } else if (ad->aparam == CHARGE) { + } else if (ad->atomparam == CHARGE) { double scale; double *q = atom->q; int *mask = atom->mask; @@ -591,7 +666,7 @@ void FixAdapt::change_settings() modify->addstep_compute(update->ntimestep + nevery); // re-initialize pair styles if any PAIR settings were changed - // ditto for bond styles if any BOND settings were changed + // ditto for bond/angle styles if any BOND/ANGLE settings were changed // this resets other coeffs that may depend on changed values, // and also offset and tail corrections // we must call force->pair->reinit() instead of the individual @@ -601,6 +676,7 @@ void FixAdapt::change_settings() if (anypair) force->pair->reinit(); if (anybond) force->bond->reinit(); + if (anyangle) force->angle->reinit(); // reset KSpace charges if charges have changed @@ -624,7 +700,13 @@ void FixAdapt::restore_settings() } } else if (ad->which == BOND) { - if (ad->pdim == 1) { + if (ad->bdim == 1) { + for (int i = ad->ilo; i <= ad->ihi; i++) + ad->vector[i] = ad->vector_orig[i]; + } + + } else if (ad->which == ANGLE) { + if (ad->adim == 1) { for (int i = ad->ilo; i <= ad->ihi; i++) ad->vector[i] = ad->vector_orig[i]; } @@ -668,6 +750,7 @@ void FixAdapt::restore_settings() if (anypair) force->pair->reinit(); if (anybond) force->bond->reinit(); + if (anyangle) force->angle->reinit(); if (chgflag && force->kspace) force->kspace->qsum_qsq(); } @@ -700,7 +783,7 @@ void FixAdapt::write_restart(FILE *fp) void FixAdapt::restart(char *buf) { - double *dbuf = (double *) buf; + auto dbuf = (double *) buf; previous_diam_scale = dbuf[0]; previous_chg_scale = dbuf[1]; diff --git a/src/fix_adapt.h b/src/fix_adapt.h index 939f46f8a2..cdd90fc225 100644 --- a/src/fix_adapt.h +++ b/src/fix_adapt.h @@ -45,7 +45,7 @@ class FixAdapt : public Fix { private: int nadapt, resetflag, scaleflag, massflag; - int anypair, anybond; + int anypair, anybond, anyangle; int nlevels_respa; char *id_fix_diam, *id_fix_chg; class FixStore *fix_diam, *fix_chg; @@ -57,14 +57,16 @@ class FixAdapt : public Fix { char *var; char *pstyle, *pparam; char *bstyle, *bparam; + char *astyle, *aparam; int ilo, ihi, jlo, jhi; - int pdim, bdim; + int pdim, bdim, adim; double *scalar, scalar_orig; double *vector, *vector_orig; double **array, **array_orig; - int aparam; + int atomparam; class Pair *pair; class Bond *bond; + class Angle *angle; }; Adapt *adapt; @@ -78,70 +80,3 @@ class FixAdapt : public Fix { #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: Cannot use dynamic group with fix adapt atom - -This is not yet supported. - -E: Variable name for fix adapt does not exist - -Self-explanatory. - -E: Variable for fix adapt is invalid style - -Only equal-style variables can be used. - -E: Fix adapt pair style does not exist - -Self-explanatory - -E: Fix adapt pair style param not supported - -The pair style does not know about the parameter you specified. - -E: Fix adapt pair style param is not compatible - -Self-explanatory - -E: Fix adapt type pair range is not valid for pair hybrid sub-style - -Self-explanatory. - -E: Fix adapt bond style does not exist - -UNDOCUMENTED - -E: Fix adapt bond style param not supported - -UNDOCUMENTED - -E: Fix adapt does not support bond_style hybrid - -UNDOCUMENTED - -E: Fix adapt kspace style does not exist - -Self-explanatory. - -E: Fix adapt requires atom attribute diameter - -The atom style being used does not specify an atom diameter. - -E: Fix adapt requires atom attribute charge - -The atom style being used does not specify an atom charge. - -E: Could not find fix adapt storage fix ID - -This should not happen unless you explicitly deleted -a secondary fix that fix adapt created internally. - -*/ diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 1aff86fb58..48b006eb2d 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -31,16 +30,15 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{NONE,CONSTANT,EQUAL,ATOM}; +enum { NONE, CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), - idregion(nullptr), sforce(nullptr) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), + idregion(nullptr), region(nullptr), sforce(nullptr) { - if (narg < 6) error->all(FLERR,"Illegal fix addforce command"); + if (narg < 6) error->all(FLERR, "Illegal fix addforce command"); dynamic_group_allow = 1; scalar_flag = 1; @@ -54,71 +52,68 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - xstr = ystr = zstr = nullptr; - - if (utils::strmatch(arg[3],"^v_")) { - xstr = utils::strdup(arg[3]+2); + if (utils::strmatch(arg[3], "^v_")) { + xstr = utils::strdup(arg[3] + 2); } else { - xvalue = utils::numeric(FLERR,arg[3],false,lmp); + xvalue = utils::numeric(FLERR, arg[3], false, lmp); xstyle = CONSTANT; } - if (utils::strmatch(arg[4],"^v_")) { - ystr = utils::strdup(arg[4]+2); + if (utils::strmatch(arg[4], "^v_")) { + ystr = utils::strdup(arg[4] + 2); } else { - yvalue = utils::numeric(FLERR,arg[4],false,lmp); + yvalue = utils::numeric(FLERR, arg[4], false, lmp); ystyle = CONSTANT; } - if (utils::strmatch(arg[5],"^v_")) { - zstr = utils::strdup(arg[5]+2); + if (utils::strmatch(arg[5], "^v_")) { + zstr = utils::strdup(arg[5] + 2); } else { - zvalue = utils::numeric(FLERR,arg[5],false,lmp); + zvalue = utils::numeric(FLERR, arg[5], false, lmp); zstyle = CONSTANT; } // optional args nevery = 1; - iregion = -1; - int iarg = 6; while (iarg < narg) { - if (strcmp(arg[iarg],"every") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command"); - nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix addforce command"); + if (strcmp(arg[iarg], "every") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix addforce command"); + nevery = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + if (nevery <= 0) error->all(FLERR, "Illegal fix addforce command"); iarg += 2; - } else if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix addforce does not exist"); - idregion = utils::strdup(arg[iarg+1]); + } else if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix addforce command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix addforce does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else if (strcmp(arg[iarg],"energy") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix addforce command"); - if (utils::strmatch(arg[iarg+1],"^v_")) { - estr = utils::strdup(arg[iarg+1]+2); - } else error->all(FLERR,"Illegal fix addforce command"); + } else if (strcmp(arg[iarg], "energy") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix addforce command"); + if (utils::strmatch(arg[iarg + 1], "^v_")) { + estr = utils::strdup(arg[iarg + 1] + 2); + } else + error->all(FLERR, "Illegal fix addforce command"); iarg += 2; - } else error->all(FLERR,"Illegal fix addforce command"); + } else + error->all(FLERR, "Illegal fix addforce command"); } force_flag = 0; foriginal[0] = foriginal[1] = foriginal[2] = foriginal[3] = 0.0; maxatom = 1; - memory->create(sforce,maxatom,4,"addforce:sforce"); + memory->create(sforce, maxatom, 4, "addforce:sforce"); } /* ---------------------------------------------------------------------- */ FixAddForce::~FixAddForce() { - delete [] xstr; - delete [] ystr; - delete [] zstr; - delete [] estr; - delete [] idregion; + delete[] xstr; + delete[] ystr; + delete[] zstr; + delete[] estr; + delete[] idregion; memory->destroy(sforce); } @@ -143,60 +138,66 @@ void FixAddForce::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) - error->all(FLERR,"Variable name for fix addforce does not exist"); - if (input->variable->equalstyle(xvar)) xstyle = EQUAL; - else if (input->variable->atomstyle(xvar)) xstyle = ATOM; - else error->all(FLERR,"Variable for fix addforce is invalid style"); + if (xvar < 0) error->all(FLERR, "Variable {} for fix addforce does not exist", xstr); + if (input->variable->equalstyle(xvar)) + xstyle = EQUAL; + else if (input->variable->atomstyle(xvar)) + xstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix addforce is invalid style", xstr); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) - error->all(FLERR,"Variable name for fix addforce does not exist"); - if (input->variable->equalstyle(yvar)) ystyle = EQUAL; - else if (input->variable->atomstyle(yvar)) ystyle = ATOM; - else error->all(FLERR,"Variable for fix addforce is invalid style"); + if (yvar < 0) error->all(FLERR, "Variable {} for fix addforce does not exist", ystr); + if (input->variable->equalstyle(yvar)) + ystyle = EQUAL; + else if (input->variable->atomstyle(yvar)) + ystyle = ATOM; + else + error->all(FLERR, "Variable {} for fix addforce is invalid style", ystr); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) - error->all(FLERR,"Variable name for fix addforce does not exist"); - if (input->variable->equalstyle(zvar)) zstyle = EQUAL; - else if (input->variable->atomstyle(zvar)) zstyle = ATOM; - else error->all(FLERR,"Variable for fix addforce is invalid style"); + if (zvar < 0) error->all(FLERR, "Variable {} for fix addforce does not exist", zstr); + if (input->variable->equalstyle(zvar)) + zstyle = EQUAL; + else if (input->variable->atomstyle(zvar)) + zstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix addforce is invalid style", zstr); } if (estr) { evar = input->variable->find(estr); - if (evar < 0) - error->all(FLERR,"Variable name for fix addforce does not exist"); - if (input->variable->atomstyle(evar)) estyle = ATOM; - else error->all(FLERR,"Variable for fix addforce is invalid style"); - } else estyle = NONE; + if (evar < 0) error->all(FLERR, "Variable {} for fix addforce does not exist", estr); + if (input->variable->atomstyle(evar)) + estyle = ATOM; + else + error->all(FLERR, "Variable {} for fix addforce is invalid style", estr); + } else + estyle = NONE; // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix addforce does not exist"); + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix addforce does not exist", idregion); } if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) varflag = ATOM; else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL; - else varflag = CONSTANT; + else + varflag = CONSTANT; if (varflag == CONSTANT && estyle != NONE) - error->all(FLERR,"Cannot use variable energy with " - "constant force in fix addforce"); - if ((varflag == EQUAL || varflag == ATOM) && - update->whichflag == 2 && estyle == NONE) - error->all(FLERR,"Must use variable energy with fix addforce"); + error->all(FLERR, "Cannot use variable energy with constant force in fix addforce"); + if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE) + error->all(FLERR, "Must use variable energy with fix addforce"); - if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; - if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); + if (utils::strmatch(update->integrate_style, "^respa")) { + ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; + if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } } @@ -204,12 +205,12 @@ void FixAddForce::init() void FixAddForce::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); - post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel_respa); + post_force_respa(vflag, ilevel_respa, 0); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel_respa); } } @@ -238,23 +239,18 @@ void FixAddForce::post_force(int vflag) v_init(vflag); if (lmp->kokkos) - atom->sync_modify(Host, (unsigned int) (F_MASK | MASK_MASK), - (unsigned int) F_MASK); + atom->sync_modify(Host, (unsigned int) (F_MASK | MASK_MASK), (unsigned int) F_MASK); // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // reallocate sforce array if necessary if ((varflag == ATOM || estyle == ATOM) && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); - memory->create(sforce,maxatom,4,"addforce:sforce"); + memory->create(sforce, maxatom, 4, "addforce:sforce"); } // foriginal[0] = "potential energy" for added force @@ -270,9 +266,9 @@ void FixAddForce::post_force(int vflag) double unwrap[3]; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - domain->unmap(x[i],image[i],unwrap); - foriginal[0] -= xvalue*unwrap[0] + yvalue*unwrap[1] + zvalue*unwrap[2]; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + domain->unmap(x[i], image[i], unwrap); + foriginal[0] -= xvalue * unwrap[0] + yvalue * unwrap[1] + zvalue * unwrap[2]; foriginal[1] += f[i][0]; foriginal[2] += f[i][1]; foriginal[3] += f[i][2]; @@ -286,37 +282,39 @@ void FixAddForce::post_force(int vflag) v[3] = xvalue * unwrap[1]; v[4] = xvalue * unwrap[2]; v[5] = yvalue * unwrap[2]; - v_tally(i,v); + v_tally(i, v); } } - // variable force, wrap with clear/add - // potential energy = evar if defined, else 0.0 - // wrap with clear/add + // variable force, wrap with clear/add + // potential energy = evar if defined, else 0.0 + // wrap with clear/add } else { double unwrap[3]; modify->clearstep_compute(); - if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar); + if (xstyle == EQUAL) + xvalue = input->variable->compute_equal(xvar); else if (xstyle == ATOM) - input->variable->compute_atom(xvar,igroup,&sforce[0][0],4,0); - if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar); + input->variable->compute_atom(xvar, igroup, &sforce[0][0], 4, 0); + if (ystyle == EQUAL) + yvalue = input->variable->compute_equal(yvar); else if (ystyle == ATOM) - input->variable->compute_atom(yvar,igroup,&sforce[0][1],4,0); - if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar); + input->variable->compute_atom(yvar, igroup, &sforce[0][1], 4, 0); + if (zstyle == EQUAL) + zvalue = input->variable->compute_equal(zvar); else if (zstyle == ATOM) - input->variable->compute_atom(zvar,igroup,&sforce[0][2],4,0); - if (estyle == ATOM) - input->variable->compute_atom(evar,igroup,&sforce[0][3],4,0); + input->variable->compute_atom(zvar, igroup, &sforce[0][2], 4, 0); + if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &sforce[0][3], 4, 0); modify->addstep_compute(update->ntimestep + 1); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - domain->unmap(x[i],image[i],unwrap); + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + domain->unmap(x[i], image[i], unwrap); if (xstyle == ATOM) xvalue = sforce[i][0]; if (ystyle == ATOM) yvalue = sforce[i][1]; if (zstyle == ATOM) zvalue = sforce[i][2]; @@ -324,9 +322,9 @@ void FixAddForce::post_force(int vflag) if (estyle == ATOM) { foriginal[0] += sforce[i][3]; } else { - if (xstyle) foriginal[0] -= xvalue*unwrap[0]; - if (ystyle) foriginal[0] -= yvalue*unwrap[1]; - if (zstyle) foriginal[0] -= zvalue*unwrap[2]; + if (xstyle) foriginal[0] -= xvalue * unwrap[0]; + if (ystyle) foriginal[0] -= yvalue * unwrap[1]; + if (zstyle) foriginal[0] -= zvalue * unwrap[2]; } foriginal[1] += f[i][0]; foriginal[2] += f[i][1]; @@ -336,13 +334,13 @@ void FixAddForce::post_force(int vflag) if (ystyle) f[i][1] += yvalue; if (zstyle) f[i][2] += zvalue; if (evflag) { - v[0] = xstyle ? xvalue*unwrap[0] : 0.0; - v[1] = ystyle ? yvalue*unwrap[1] : 0.0; - v[2] = zstyle ? zvalue*unwrap[2] : 0.0; - v[3] = xstyle ? xvalue*unwrap[1] : 0.0; - v[4] = xstyle ? xvalue*unwrap[2] : 0.0; - v[5] = ystyle ? yvalue*unwrap[2] : 0.0; - v_tally(i,v); + v[0] = xstyle ? xvalue * unwrap[0] : 0.0; + v[1] = ystyle ? yvalue * unwrap[1] : 0.0; + v[2] = zstyle ? zvalue * unwrap[2] : 0.0; + v[3] = xstyle ? xvalue * unwrap[1] : 0.0; + v[4] = xstyle ? xvalue * unwrap[2] : 0.0; + v[5] = ystyle ? yvalue * unwrap[2] : 0.0; + v_tally(i, v); } } } @@ -372,7 +370,7 @@ double FixAddForce::compute_scalar() // only sum across procs one time if (force_flag == 0) { - MPI_Allreduce(foriginal,foriginal_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(foriginal, foriginal_all, 4, MPI_DOUBLE, MPI_SUM, world); force_flag = 1; } return foriginal_all[0]; @@ -387,10 +385,10 @@ double FixAddForce::compute_vector(int n) // only sum across procs one time if (force_flag == 0) { - MPI_Allreduce(foriginal,foriginal_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(foriginal, foriginal_all, 4, MPI_DOUBLE, MPI_SUM, world); force_flag = 1; } - return foriginal_all[n+1]; + return foriginal_all[n + 1]; } /* ---------------------------------------------------------------------- @@ -400,6 +398,6 @@ double FixAddForce::compute_vector(int n) double FixAddForce::memory_usage() { double bytes = 0.0; - if (varflag == ATOM) bytes = maxatom*4 * sizeof(double); + if (varflag == ATOM) bytes = maxatom * 4 * sizeof(double); return bytes; } diff --git a/src/fix_addforce.h b/src/fix_addforce.h index a3d579c495..780d679686 100644 --- a/src/fix_addforce.h +++ b/src/fix_addforce.h @@ -41,9 +41,10 @@ class FixAddForce : public Fix { private: double xvalue, yvalue, zvalue; - int varflag, iregion; + int varflag; char *xstr, *ystr, *zstr, *estr; char *idregion; + class Region *region; int xvar, yvar, zvar, evar, xstyle, ystyle, zstyle, estyle; double foriginal[4], foriginal_all[4]; int force_flag; @@ -57,35 +58,3 @@ class FixAddForce : public Fix { #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: Region ID for fix addforce does not exist - -Self-explanatory. - -E: Variable name for fix addforce does not exist - -Self-explanatory. - -E: Variable for fix addforce is invalid style - -Self-explanatory. - -E: Cannot use variable energy with constant force in fix addforce - -This is because for constant force, LAMMPS can compute the change -in energy directly. - -E: Must use variable energy with fix addforce - -Must define an energy variable when applying a dynamic -force during minimization. - -*/ diff --git a/src/fix_ave_atom.h b/src/fix_ave_atom.h index f55f8abdd1..f285004305 100644 --- a/src/fix_ave_atom.h +++ b/src/fix_ave_atom.h @@ -54,71 +54,3 @@ class FixAveAtom : public Fix { #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 ave/atom does not exist - -Self-explanatory. - -E: Fix ave/atom compute does not calculate per-atom values - -A compute used by fix ave/atom must generate per-atom values. - -E: Fix ave/atom compute does not calculate a per-atom vector - -A compute used by fix ave/atom must generate per-atom values. - -E: Fix ave/atom compute does not calculate a per-atom array - -Self-explanatory. - -E: Fix ave/atom compute array is accessed out-of-range - -Self-explanatory. - -E: Fix ID for fix ave/atom does not exist - -Self-explanatory. - -E: Fix ave/atom fix does not calculate per-atom values - -A fix used by fix ave/atom must generate per-atom values. - -E: Fix ave/atom fix does not calculate a per-atom vector - -A fix used by fix ave/atom must generate per-atom values. - -E: Fix ave/atom fix does not calculate a per-atom array - -Self-explanatory. - -E: Fix ave/atom fix array is accessed out-of-range - -Self-explanatory. - -E: Fix for fix ave/atom not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/atom is -requesting a value on a non-allowed timestep. - -E: Variable name for fix ave/atom does not exist - -Self-explanatory. - -E: Fix ave/atom variable is not atom-style variable - -A variable used by fix ave/atom must generate per-atom values. - -E: Invalid timestep reset for fix ave/atom - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -*/ diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index efe1bd9fdc..46c0abfc8f 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -309,7 +309,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for fix ave/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Fix ave/chunk does not use chunk/atom compute"); @@ -432,7 +432,7 @@ FixAveChunk::~FixAveChunk() if (nrepeat > 1 || ave == RUNNING || ave == WINDOW) { int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (ave == RUNNING || ave == WINDOW) cchunk->unlock(this); cchunk->lockcount--; } @@ -478,7 +478,7 @@ void FixAveChunk::init() int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for fix ave/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (biasflag) { int i = modify->find_compute(id_bias); diff --git a/src/fix_ave_chunk.h b/src/fix_ave_chunk.h index b0089e3871..1183b089e8 100644 --- a/src/fix_ave_chunk.h +++ b/src/fix_ave_chunk.h @@ -82,108 +82,3 @@ class FixAveChunk : public Fix { #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: No values in fix ave/chunk command - -Self-explanatory. - -E: Cannot open fix ave/chunk file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Could not find compute ID for temperature bias - -Self-explanatory. - -E: Bias compute does not calculate temperature - -The specified compute must compute temperature. - -E: Bias compute does not calculate a velocity bias - -The specified compute must compute a bias for temperature. - -E: Compute ID for fix ave/chunk does not exist - -Self-explanatory. - -E: Fix ave/chunk compute does not calculate per-atom values - -Self-explanatory. - -E: Fix ave/chunk compute does not calculate a per-atom vector - -Self-explanatory. - -E: Fix ave/chunk compute does not calculate a per-atom array - -Self-explanatory. - -E: Fix ave/chunk compute vector is accessed out-of-range - -Self-explanatory. - -E: Fix ID for fix ave/chunk does not exist - -Self-explanatory. - -E: Fix ave/chunk fix does not calculate per-atom values - -Self-explanatory. - -E: Fix ave/chunk fix does not calculate a per-atom vector - -Self-explanatory. - -E: Fix ave/chunk fix does not calculate a per-atom array - -Self-explanatory. - -E: Fix ave/chunk fix vector is accessed out-of-range - -Self-explanatory. - -E: Variable name for fix ave/chunk does not exist - -Self-explanatory. - -E: Fix ave/chunk variable is not atom-style variable - -Self-explanatory. - -E: Chunk/atom compute does not exist for fix ave/chunk - -Self-explanatory. - -E: Fix ave/chunk does not use chunk/atom compute - -The specified compute is not for a compute chunk/atom command. - -E: Error writing file header - -Something in the output to the file triggered an error. - -E: Fix for fix ave/chunk not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/chunk is -requesting a value on a non-allowed timestep. - -E: Invalid timestep reset for fix ave/chunk - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -E: Error writing averaged chunk data - -Something in the output to the file triggered an error. - -*/ diff --git a/src/fix_ave_correlate.h b/src/fix_ave_correlate.h index 46781da8c5..517740a121 100644 --- a/src/fix_ave_correlate.h +++ b/src/fix_ave_correlate.h @@ -65,80 +65,3 @@ class FixAveCorrelate : public Fix { #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: Cannot open fix ave/correlate file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Compute ID for fix ave/correlate does not exist - -Self-explanatory. - -E: Fix ave/correlate compute does not calculate a scalar - -Self-explanatory. - -E: Fix ave/correlate compute does not calculate a vector - -Self-explanatory. - -E: Fix ave/correlate compute vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix ID for fix ave/correlate does not exist - -Self-explanatory. - -E: Fix ave/correlate fix does not calculate a scalar - -Self-explanatory. - -E: Fix ave/correlate fix does not calculate a vector - -Self-explanatory. - -E: Fix ave/correlate fix vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix for fix ave/correlate not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/correlate -is requesting a value on a non-allowed timestep. - -E: Variable name for fix ave/correlate does not exist - -Self-explanatory. - -E: Fix ave/correlate variable is not equal-style variable - -Self-explanatory. - -E: Fix ave/correlate variable is not vector-style variable - -UNDOCUMENTED - -E: Error writing file header - -Something in the output to the file triggered an error. - -E: Invalid timestep reset for fix ave/correlate - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -E: Error writing out correlation data - -Something in the output to the file triggered an error. - -*/ diff --git a/src/fix_ave_histo.h b/src/fix_ave_histo.h index cf9f11a8e5..ed64c8562d 100644 --- a/src/fix_ave_histo.h +++ b/src/fix_ave_histo.h @@ -72,181 +72,3 @@ class FixAveHisto : public Fix { #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: No values in fix ave/histo command - -UNDOCUMENTED - -E: Fix ave/histo input is invalid compute - -Self-explanatory. - -E: Fix ave/histo input is invalid fix - -Self-explanatory. - -E: Fix ave/histo input is invalid variable - -Self-explanatory. - -E: Fix ave/histo inputs are not all global, peratom, or local - -All inputs in a single fix ave/histo command must be of the -same style. - -E: Fix ave/histo cannot input per-atom values in scalar mode - -Self-explanatory. - -E: Fix ave/histo cannot input local values in scalar mode - -Self-explanatory. - -E: Compute ID for fix ave/histo does not exist - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a global scalar - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a global vector - -Self-explanatory. - -E: Fix ave/histo compute vector is accessed out-of-range - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a global array - -Self-explanatory. - -E: Fix ave/histo compute array is accessed out-of-range - -Self-explanatory. - -E: Fix ave/histo compute does not calculate per-atom values - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a per-atom vector - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a per-atom array - -Self-explanatory. - -E: Fix ave/histo compute does not calculate local values - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a local vector - -Self-explanatory. - -E: Fix ave/histo compute does not calculate a local array - -Self-explanatory. - -E: Fix ID for fix ave/histo does not exist - -Self-explanatory. - -E: Fix ave/histo fix does not calculate a global scalar - -Self-explanatory. - -E: Fix ave/histo fix does not calculate a global vector - -Self-explanatory. - -E: Fix ave/histo fix vector is accessed out-of-range - -Self-explanatory. - -E: Fix for fix ave/histo not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/histo is -requesting a value on a non-allowed timestep. - -E: Fix ave/histo fix does not calculate a global array - -Self-explanatory. - -E: Fix ave/histo fix array is accessed out-of-range - -Self-explanatory. - -E: Fix ave/histo fix does not calculate per-atom values - -Self-explanatory. - -E: Fix ave/histo fix does not calculate a per-atom vector - -Self-explanatory. - -E: Fix ave/histo fix does not calculate a per-atom array - -Self-explanatory. - -E: Fix ave/histo fix does not calculate local values - -Self-explanatory. - -E: Fix ave/histo fix does not calculate a local vector - -Self-explanatory. - -E: Fix ave/histo fix does not calculate a local array - -Self-explanatory. - -E: Variable name for fix ave/histo does not exist - -Self-explanatory. - -E: Fix ave/histo variable is not equal-style variable - -UNDOCUMENTED - -E: Fix ave/histo variable is not vector-style variable - -UNDOCUMENTED - -E: Fix ave/histo variable cannot be indexed - -UNDOCUMENTED - -E: Fix ave/histo variable is not atom-style variable - -UNDOCUMENTED - -E: Error writing file header - -Something in the output to the file triggered an error. - -E: Invalid timestep reset for fix ave/histo - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -E: Error writing out histogram data - -Something in the output to the file triggered an error. - -E: Cannot open fix ave/histo file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -*/ diff --git a/src/fix_ave_histo_weight.h b/src/fix_ave_histo_weight.h index 95a96b13bb..ea2f42e041 100644 --- a/src/fix_ave_histo_weight.h +++ b/src/fix_ave_histo_weight.h @@ -40,30 +40,3 @@ class FixAveHistoWeight : public FixAveHisto { #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: Fix ave/histo/weight value and weight vector lengths do not match - -Self-explanatory. - -E: Invalid timestep reset for fix ave/histo - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -E: Fix ave/histo/weight option not yet supported - -UNDOCUMENTED - -E: Error writing out histogram data - -Something in the output to the file triggered an error. - -*/ diff --git a/src/fix_ave_time.h b/src/fix_ave_time.h index 01b6440e5c..d2c7b4752b 100644 --- a/src/fix_ave_time.h +++ b/src/fix_ave_time.h @@ -77,134 +77,3 @@ class FixAveTime : public Fix { #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: No values in fix ave/time command - -Self-explanatory. - -E: Invalid fix ave/time off column - -Self-explanatory. - -E: Compute ID for fix ave/time does not exist - -Self-explanatory. - -E: Fix ave/time compute does not calculate a scalar - -Self-explanatory. - -E: Fix ave/time compute does not calculate a vector - -Self-explanatory. - -E: Fix ave/time compute vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix ave/time compute does not calculate an array - -Self-explanatory. - -E: Fix ave/time compute array is accessed out-of-range - -An index for the array is out of bounds. - -E: Fix ID for fix ave/time does not exist - -Self-explanatory. - -E: Fix ave/time fix does not calculate a scalar - -Self-explanatory. - -E: Fix ave/time fix does not calculate a vector - -Self-explanatory. - -E: Fix ave/time fix vector cannot be variable length - -Self-explanatory. - -E: Fix ave/time fix vector is accessed out-of-range - -The index for the vector is out of bounds. - -E: Fix for fix ave/time not computed at compatible time - -Fixes generate their values on specific timesteps. Fix ave/time -is requesting a value on a non-allowed timestep. - -E: Fix ave/time fix does not calculate an array - -Self-explanatory. - -E: Fix ave/time fix array cannot be variable length - -Self-explanatory. - -E: Fix ave/time fix array is accessed out-of-range - -An index for the array is out of bounds. - -E: Variable name for fix ave/time does not exist - -Self-explanatory. - -E: Fix ave/time variable is not equal-style variable - -Self-explanatory. - -E: Fix ave/time variable is not vector-style variable - -UNDOCUMENTED - -E: Fix ave/time mode vector variable cannot be indexed - -UNDOCUMENTED - -E: Error writing file header - -Something in the output to the file triggered an error. - -E: Fix ave/time cannot set output array intensive/extensive from these inputs - -One of more of the vector inputs has individual elements which are -flagged as intensive or extensive. Such an input cannot be flagged as -all intensive/extensive when turned into an array by fix ave/time. - -E: Invalid timestep reset for fix ave/time - -Resetting the timestep has invalidated the sequence of timesteps this -fix needs to process. - -E: Error writing out time averaged data - -Something in the output to the file triggered an error. - -E: Fix ave/time vector-style variable changed length - -UNDOCUMENTED - -E: Fix ave/time columns are inconsistent lengths - -Self-explanatory. - -E: Cannot open fix ave/time file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -U: Fix ave/time cannot use variable with vector mode - -Variables produce scalar values. - -*/ diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index cd8009c81b..e2369697ca 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -29,15 +28,15 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{NONE,CONSTANT,EQUAL}; +enum { NONE, CONSTANT, EQUAL }; /* ---------------------------------------------------------------------- */ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), + region(nullptr) { - if (narg < 6) error->all(FLERR,"Illegal fix aveforce command"); + if (narg < 6) error->all(FLERR, "Illegal fix aveforce command"); dynamic_group_allow = 1; vector_flag = 1; @@ -49,61 +48,56 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : xstr = ystr = zstr = nullptr; - if (utils::strmatch(arg[3],"^v_")) { - xstr = utils::strdup(arg[3]+2); - } else if (strcmp(arg[3],"NULL") == 0) { + if (utils::strmatch(arg[3], "^v_")) { + xstr = utils::strdup(arg[3] + 2); + } else if (strcmp(arg[3], "NULL") == 0) { xstyle = NONE; } else { - xvalue = utils::numeric(FLERR,arg[3],false,lmp); + xvalue = utils::numeric(FLERR, arg[3], false, lmp); xstyle = CONSTANT; } - if (utils::strmatch(arg[4],"^v_")) { - ystr = utils::strdup(arg[4]+2); - } else if (strcmp(arg[4],"NULL") == 0) { + if (utils::strmatch(arg[4], "^v_")) { + ystr = utils::strdup(arg[4] + 2); + } else if (strcmp(arg[4], "NULL") == 0) { ystyle = NONE; } else { - yvalue = utils::numeric(FLERR,arg[4],false,lmp); + yvalue = utils::numeric(FLERR, arg[4], false, lmp); ystyle = CONSTANT; } - if (utils::strmatch(arg[5],"^v_")) { - zstr = utils::strdup(arg[5]+2); - } else if (strcmp(arg[5],"NULL") == 0) { + if (utils::strmatch(arg[5], "^v_")) { + zstr = utils::strdup(arg[5] + 2); + } else if (strcmp(arg[5], "NULL") == 0) { zstyle = NONE; } else { - zvalue = utils::numeric(FLERR,arg[5],false,lmp); + zvalue = utils::numeric(FLERR, arg[5], false, lmp); zstyle = CONSTANT; } // optional args - iregion = -1; - idregion = nullptr; - int iarg = 6; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix aveforce command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix aveforce does not exist"); - idregion = utils::strdup(arg[iarg+1]); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix aveforce command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix aveforce does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else error->all(FLERR,"Illegal fix aveforce command"); - + } else + error->all(FLERR, "Illegal fix aveforce command"); } - foriginal_all[0] = foriginal_all[1] = - foriginal_all[2] = foriginal_all[3] = 0.0; + foriginal_all[0] = foriginal_all[1] = foriginal_all[2] = foriginal_all[3] = 0.0; } /* ---------------------------------------------------------------------- */ FixAveForce::~FixAveForce() { - delete [] xstr; - delete [] ystr; - delete [] zstr; - delete [] idregion; + delete[] xstr; + delete[] ystr; + delete[] zstr; + delete[] idregion; } /* ---------------------------------------------------------------------- */ @@ -125,41 +119,47 @@ void FixAveForce::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) - error->all(FLERR,"Variable name for fix aveforce does not exist"); - if (input->variable->equalstyle(xvar)) xstyle = EQUAL; - else error->all(FLERR,"Variable for fix aveforce is invalid style"); + if (xvar < 0) error->all(FLERR, "Variable name for fix aveforce does not exist"); + if (input->variable->equalstyle(xvar)) + xstyle = EQUAL; + else + error->all(FLERR, "Variable for fix aveforce is invalid style"); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) - error->all(FLERR,"Variable name for fix aveforce does not exist"); - if (input->variable->equalstyle(yvar)) ystyle = EQUAL; - else error->all(FLERR,"Variable for fix aveforce is invalid style"); + if (yvar < 0) error->all(FLERR, "Variable name for fix aveforce does not exist"); + if (input->variable->equalstyle(yvar)) + ystyle = EQUAL; + else + error->all(FLERR, "Variable for fix aveforce is invalid style"); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) - error->all(FLERR,"Variable name for fix aveforce does not exist"); - if (input->variable->equalstyle(zvar)) zstyle = EQUAL; - else error->all(FLERR,"Variable for fix aveforce is invalid style"); + if (zvar < 0) error->all(FLERR, "Variable name for fix aveforce does not exist"); + if (input->variable->equalstyle(zvar)) + zstyle = EQUAL; + else + error->all(FLERR, "Variable for fix aveforce is invalid style"); } // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix aveforce does not exist"); + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix aveforce does not exist", idregion); } - if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL; - else varflag = CONSTANT; + if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) + varflag = EQUAL; + else + varflag = CONSTANT; - if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); - else ilevel_respa = nlevels_respa-1; + if (utils::strmatch(update->integrate_style, "^respa")) { + nlevels_respa = (dynamic_cast(update->integrate))->nlevels; + if (respa_level >= 0) + ilevel_respa = MIN(respa_level, nlevels_respa - 1); + else + ilevel_respa = nlevels_respa - 1; } } @@ -167,13 +167,13 @@ void FixAveForce::init() void FixAveForce::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(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); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel); + post_force_respa(vflag, ilevel, 0); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel); } } @@ -190,11 +190,7 @@ void FixAveForce::post_force(int /*vflag*/) { // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // sum forces on participating atoms @@ -208,7 +204,7 @@ void FixAveForce::post_force(int /*vflag*/) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal[0] += f[i][0]; foriginal[1] += f[i][1]; foriginal[2] += f[i][2]; @@ -219,9 +215,9 @@ void FixAveForce::post_force(int /*vflag*/) // add in requested amount, computed via variable evaluation if necessary // wrap variable evaluation with clear/add - MPI_Allreduce(foriginal,foriginal_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(foriginal, foriginal_all, 4, MPI_DOUBLE, MPI_SUM, world); - int ncount = static_cast (foriginal_all[3]); + int ncount = static_cast(foriginal_all[3]); if (ncount == 0) return; if (varflag == EQUAL) { @@ -233,16 +229,16 @@ void FixAveForce::post_force(int /*vflag*/) } double fave[3]; - fave[0] = foriginal_all[0]/ncount + xvalue; - fave[1] = foriginal_all[1]/ncount + yvalue; - fave[2] = foriginal_all[2]/ncount + zvalue; + fave[0] = foriginal_all[0] / ncount + xvalue; + fave[1] = foriginal_all[1] / ncount + yvalue; + fave[2] = foriginal_all[2] / ncount + zvalue; // set force of all participating atoms to same value // only for active dimensions for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; if (xstyle) f[i][0] = fave[0]; if (ystyle) f[i][1] = fave[1]; if (zstyle) f[i][2] = fave[2]; @@ -256,13 +252,10 @@ void FixAveForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) // ave + extra force on selected RESPA level // just ave on all other levels - if (ilevel == ilevel_respa) post_force(vflag); - else { - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (ilevel == ilevel_respa) { + post_force(vflag); + } else { + if (region) region->prematch(); double **x = atom->x; double **f = atom->f; @@ -274,26 +267,26 @@ void FixAveForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal[0] += f[i][0]; foriginal[1] += f[i][1]; foriginal[2] += f[i][2]; foriginal[3] += 1.0; } - MPI_Allreduce(foriginal,foriginal_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(foriginal, foriginal_all, 4, MPI_DOUBLE, MPI_SUM, world); - int ncount = static_cast (foriginal_all[3]); + int ncount = static_cast(foriginal_all[3]); if (ncount == 0) return; double fave[3]; - fave[0] = foriginal_all[0]/ncount; - fave[1] = foriginal_all[1]/ncount; - fave[2] = foriginal_all[2]/ncount; + fave[0] = foriginal_all[0] / ncount; + fave[1] = foriginal_all[1] / ncount; + fave[2] = foriginal_all[2] / ncount; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; if (xstyle) f[i][0] = fave[0]; if (ystyle) f[i][1] = fave[1]; if (zstyle) f[i][2] = fave[2]; diff --git a/src/fix_aveforce.h b/src/fix_aveforce.h index 88c83064b0..a28566709b 100644 --- a/src/fix_aveforce.h +++ b/src/fix_aveforce.h @@ -42,8 +42,8 @@ class FixAveForce : public Fix { int varflag; char *xstr, *ystr, *zstr; char *idregion; + class Region *region; int xvar, yvar, zvar, xstyle, ystyle, zstyle; - int iregion; double foriginal_all[4]; int nlevels_respa, ilevel_respa; }; @@ -52,25 +52,3 @@ class FixAveForce : public Fix { #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: Region ID for fix aveforce does not exist - -Self-explanatory. - -E: Variable name for fix aveforce does not exist - -Self-explanatory. - -E: Variable for fix aveforce is invalid style - -Only equal-style variables can be used. - -*/ diff --git a/src/fix_balance.h b/src/fix_balance.h index f74ae2dc69..0a67825daa 100644 --- a/src/fix_balance.h +++ b/src/fix_balance.h @@ -64,29 +64,3 @@ class FixBalance : public Fix { #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: Fix balance shift string is invalid - -The string can only contain the characters "x", "y", or "z". - -E: Fix balance rcb cannot be used with comm_style brick - -Comm_style tiled must be used instead. - -E: Fix balance nevery = 0 cannot be used with weight var - -UNDOCUMENTED - -U: Cannot open fix balance output file - -Self-explanatory. - -*/ diff --git a/src/fix_bond_history.cpp b/src/fix_bond_history.cpp new file mode 100644 index 0000000000..a0af563b3b --- /dev/null +++ b/src/fix_bond_history.cpp @@ -0,0 +1,365 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "fix_bond_history.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "group.h" +#include "memory.h" +#include "modify.h" +#include "neighbor.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; + +#define LB_FACTOR 1.5 +#define DELTA 8192 + +/* ---------------------------------------------------------------------- */ + +FixBondHistory::FixBondHistory(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), bondstore(nullptr), id_fix(nullptr), id_array(nullptr) + +{ + if (narg != 5) error->all(FLERR, "Illegal fix bond/history command"); + update_flag = utils::inumeric(FLERR, arg[3], false, lmp); + ndata = utils::inumeric(FLERR, arg[4], false, lmp); + nbond = atom->bond_per_atom; + + if (nbond == 0) error->all(FLERR, "Cannot store bond variables without any bonds"); + + stored_flag = false; + restart_global = 1; + create_attribute = 1; + + // Flag whether bond arrays are updated such that data may need to be + // copied to atom arrays before exchanging atoms + // Prevents sequential calls to pre_exchange() without post_neighbor() + updated_bond_flag = 0; + + maxbond = 0; + allocate(); +} + +/* ---------------------------------------------------------------------- */ + +FixBondHistory::~FixBondHistory() +{ + if (id_fix && modify->nfix) modify->delete_fix(id_fix); + delete[] id_fix; + delete[] id_array; + + memory->destroy(bondstore); +} + +/* ---------------------------------------------------------------------- */ + +int FixBondHistory::setmask() +{ + int mask = 0; + mask |= PRE_EXCHANGE; + mask |= POST_NEIGHBOR; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::post_constructor() +{ + // Store saved bond quantities for each atom using fix property atom + + id_fix = utils::strdup(id + std::string("_FIX_PROP_ATOM")); + id_array = utils::strdup(std::string("d2_") + id); + modify->add_fix(fmt::format("{} {} property/atom {} {}", id_fix, group->names[igroup], id_array, + nbond * ndata)); + int tmp1, tmp2; + index = atom->find_custom(&id_array[3], tmp1, tmp2); +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::update_atom_value(int i, int m, int idata, double value) +{ + if (idata >= ndata || m > nbond) error->all(FLERR, "Index exceeded in fix bond history"); + atom->darray[index][i][m * ndata + idata] = value; +} + +/* ---------------------------------------------------------------------- */ + +double FixBondHistory::get_atom_value(int i, int m, int idata) +{ + if (idata >= ndata || m > nbond) error->all(FLERR, "Index exceeded in fix bond history"); + return atom->darray[index][i][m * ndata + idata]; +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::setup_pre_exchange() +{ + pre_exchange(); +} + +/* ---------------------------------------------------------------------- + If stored values are updated, need to copy to atom arrays before exchanging + If bondstore array has been allocated, call before nlist rebuild + Also call prior to irregular communication in other fixes (e.g. deform) +------------------------------------------------------------------------- */ + +void FixBondHistory::pre_exchange() +{ + if (!update_flag) return; + if (!stored_flag) return; + if (!updated_bond_flag) return; + + int i1, i2, n, m, idata; + int **bondlist = neighbor->bondlist; + int nbondlist = neighbor->nbondlist; + double **stored = atom->darray[index]; + + int nlocal = atom->nlocal; + tagint **bond_atom = atom->bond_atom; + int *num_bond = atom->num_bond; + tagint *tag = atom->tag; + + for (n = 0; n < nbondlist; n++) { + i1 = bondlist[n][0]; + i2 = bondlist[n][1]; + + // skip bond if already broken + if (bondlist[n][2] <= 0) { continue; } + + if (i1 < nlocal) { + for (m = 0; m < num_bond[i1]; m++) { + if (bond_atom[i1][m] == tag[i2]) { + for (idata = 0; idata < ndata; idata++) { + stored[i1][m * ndata + idata] = bondstore[n][idata]; + } + } + } + } + + if (i2 < nlocal) { + for (m = 0; m < num_bond[i2]; m++) { + if (bond_atom[i2][m] == tag[i1]) { + for (idata = 0; idata < ndata; idata++) { + stored[i2][m * ndata + idata] = bondstore[n][idata]; + } + } + } + } + } + + updated_bond_flag = 0; +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::allocate() +{ + //Ideally would just ask ntopo for maxbond, but protected + if (comm->nprocs == 1) + maxbond = atom->nbonds; + else + maxbond = static_cast(LB_FACTOR * atom->nbonds / comm->nprocs); + memory->create(bondstore, maxbond, ndata, "fix_bond_store:bondstore"); +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::setup_post_neighbor() +{ + //Grow array if number of bonds has increased + while (neighbor->nbondlist >= maxbond) { + maxbond += DELTA; + memory->grow(bondstore, maxbond, ndata, "fix_bond_store:bondstore"); + } + + pre_exchange(); + post_neighbor(); +} + +/* ---------------------------------------------------------------------- + called after neighbor list is build + build array of stored bond quantities from fix property atom +------------------------------------------------------------------------- */ + +void FixBondHistory::post_neighbor() +{ + //Grow array if number of bonds has increased + while (neighbor->nbondlist >= maxbond) { + maxbond += DELTA; + memory->grow(bondstore, maxbond, ndata, "fix_bond_store:bondstore"); + } + + int i1, i2, n, m, idata; + int **bondlist = neighbor->bondlist; + int nbondlist = neighbor->nbondlist; + double **stored = atom->darray[index]; + + int nlocal = atom->nlocal; + tagint **bond_atom = atom->bond_atom; + int *num_bond = atom->num_bond; + tagint *tag = atom->tag; + + for (n = 0; n < nbondlist; n++) { + i1 = bondlist[n][0]; + i2 = bondlist[n][1]; + + // skip bond if already broken + if (bondlist[n][2] <= 0) { continue; } + + if (i1 < nlocal) { + for (m = 0; m < num_bond[i1]; m++) { + if (bond_atom[i1][m] == tag[i2]) { + for (idata = 0; idata < ndata; idata++) { + bondstore[n][idata] = stored[i1][m * ndata + idata]; + } + } + } + } + + if (i2 < nlocal) { + for (m = 0; m < num_bond[i2]; m++) { + if (bond_atom[i2][m] == tag[i1]) { + for (idata = 0; idata < ndata; idata++) { + bondstore[n][idata] = stored[i2][m * ndata + idata]; + } + } + } + } + } + + updated_bond_flag = 1; +} + +/* ---------------------------------------------------------------------- */ + +double FixBondHistory::memory_usage() +{ + return (double) maxbond * ndata * sizeof(double); +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::write_restart(FILE *fp) +{ + int n = 0; + double list[1]; + list[n++] = stored_flag; + + if (comm->me == 0) { + int size = n * sizeof(double); + fwrite(&size, sizeof(int), 1, fp); + fwrite(list, sizeof(double), n, fp); + } +} + +/* ---------------------------------------------------------------------- */ + +void FixBondHistory::restart(char *buf) +{ + int n = 0; + double *list = (double *) buf; + stored_flag = static_cast(list[n++]); +} + +/* ---------------------------------------------------------------------- + initialize bond values to zero, called when atom is created +------------------------------------------------------------------------- */ + +void FixBondHistory::set_arrays(int i) +{ + double **stored = atom->darray[index]; + for (int m = 0; m < nbond; m++) + for (int idata = 0; idata < ndata; idata++) stored[i][m * ndata + idata] = 0.0; +} + +/* ---------------------------------------------------------------------- + Delete bond by zeroing data +------------------------------------------------------------------------- */ + +void FixBondHistory::delete_history(int i, int m) +{ + double **stored = atom->darray[index]; + for (int idata = 0; idata < ndata; idata++) stored[i][m * ndata + idata] = 0.0; +} + +/* ---------------------------------------------------------------------- + Shift bond data to a new location +------------------------------------------------------------------------- */ + +void FixBondHistory::shift_history(int i, int m, int k) +{ + if (m == k) return; + + double **stored = atom->darray[index]; + for (int idata = 0; idata < ndata; idata++) + stored[i][m * ndata + idata] = stored[i][k * ndata + idata]; +} + +/* ---------------------------------------------------------------------- + Temporarily caches history for a deleted bond which + could be recreated before the cache is emptied + NOTE: the cache methods still need to be tested, need an example first +------------------------------------------------------------------------- */ + +void FixBondHistory::cache_history(int i, int m) +{ + // Order tags to create a unique key pair + tagint max_tag = MAX(atom->tag[i], atom->bond_atom[i][m]); + tagint min_tag = MIN(atom->tag[i], atom->bond_atom[i][m]); + auto key = std::make_pair(min_tag, max_tag); + + // Copy data to vector + double **stored = atom->darray[index]; + std::vector data; + for (int idata = 0; idata < ndata; idata++) data.push_back(stored[i][m * ndata + idata]); + + // Add data to cache + cached_histories.insert(std::make_pair(key, data)); +} + +/* ---------------------------------------------------------------------- + Checks to see if a newly created bond has cached history +------------------------------------------------------------------------- */ + +void FixBondHistory::check_cache(int i, int m) +{ + // Order tags to create a unique key pair + tagint max_tag = MAX(atom->tag[i], atom->bond_atom[i][m]); + tagint min_tag = MIN(atom->tag[i], atom->bond_atom[i][m]); + auto key = std::make_pair(min_tag, max_tag); + + // Check if it exists, if so, copy data + double **stored = atom->darray[index]; + std::vector data; + auto pos = cached_histories.find(key); + if (pos != cached_histories.end()) { + data = pos->second; + for (int idata = 0; idata < ndata; idata++) stored[i][m * ndata + idata] = data[idata]; + } +} + +/* ---------------------------------------------------------------------- + Delete saved memory +------------------------------------------------------------------------- */ + +void FixBondHistory::clear_cache() +{ + cached_histories.clear(); +} diff --git a/src/fix_bond_history.h b/src/fix_bond_history.h new file mode 100644 index 0000000000..8237f01aea --- /dev/null +++ b/src/fix_bond_history.h @@ -0,0 +1,78 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 +// clang-format off +FixStyle(BOND_HISTORY,FixBondHistory); +// clang-format on +#else + +#ifndef LMP_FIX_BOND_HISTORY_H +#define LMP_FIX_BOND_HISTORY_H + +#include "fix.h" + +#include +#include +#include + +namespace LAMMPS_NS { + +class FixBondHistory : public Fix { + public: + FixBondHistory(class LAMMPS *, int, char **); + ~FixBondHistory() override; + int setmask() override; + void post_constructor() override; + void setup_post_neighbor() override; + void setup_pre_exchange() override; + void post_neighbor() override; + void pre_exchange() override; + double memory_usage() override; + void write_restart(FILE *fp) override; + void restart(char *buf) override; + void set_arrays(int) override; + + void update_atom_value(int, int, int, double); + double get_atom_value(int, int, int); + + // methods to reorder/delete elements of atom->bond_atom + void delete_history(int, int); + void shift_history(int, int, int); + void cache_history(int, int); + void check_cache(int, int); + void clear_cache(); + + // if data is temporarily stored while the bond_atom array + // is being reordered, use map of vectors with pairs for keys + // to enable quick look up + std::map, std::vector> cached_histories; + + double **bondstore; + int stored_flag; + + protected: + void allocate(); + + int update_flag; //Flag whether history values can evolve + int updated_bond_flag; + int nbond, maxbond, ndata; + int index; + char *id_fix; + char *id_array; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/fix_box_relax.h b/src/fix_box_relax.h index 00fd77d9a2..922d3a3190 100644 --- a/src/fix_box_relax.h +++ b/src/fix_box_relax.h @@ -96,101 +96,3 @@ class FixBoxRelax : public Fix { #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: Invalid fix box/relax command for a 2d simulation - -Fix box/relax styles involving the z dimension cannot be used in -a 2d simulation. - -E: Invalid fix box/relax command pressure settings - -If multiple dimensions are coupled, those dimensions must be specified. - -E: Cannot use fix box/relax on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix box/relax on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix box/relax with tilt factor scaling on a 2nd non-periodic dimension - -When specifying scaling on a tilt factor component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix box/relax with both relaxation and scaling on a tilt factor - -When specifying scaling on a tilt factor component, that component can not -also be controlled by the barostat. E.g. if scalexy yes is specified and -also keyword tri or xy, this is wrong. - -E: Can not specify Pxy/Pxz/Pyz in fix box/relax with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix box/relax pressure settings - -Settings for coupled dimensions must be the same. - -E: Temperature ID for fix box/relax does not exist - -Self-explanatory. - -E: Pressure ID for fix box/relax does not exist - -The compute ID needed to compute pressure for the fix does not -exist. - -E: Attempt to push beyond stack limit in fix box/relax - -Internal LAMMPS error. Please report it to the developers. - -E: Attempt to pop empty stack in fix box/relax - -Internal LAMMPS error. Please report it to the developers. - -E: Fix box/relax generated negative box length - -The pressure being applied is likely too large. Try applying -it incrementally, to build to the high pressure. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/fix_deform.h b/src/fix_deform.h index 9d7ddc4683..76f5fc9d4a 100644 --- a/src/fix_deform.h +++ b/src/fix_deform.h @@ -74,68 +74,3 @@ class FixDeform : public Fix { #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: Fix deform tilt factors require triclinic box - -Cannot deform the tilt factors of a simulation box unless it -is a triclinic (non-orthogonal) box. - -E: Cannot use fix deform on a shrink-wrapped boundary - -The x, y, z options cannot be applied to shrink-wrapped -dimensions. - -E: Cannot use fix deform tilt on a shrink-wrapped 2nd dim - -This is because the shrink-wrapping will change the value -of the strain implied by the tilt factor. - -E: Fix deform volume setting is invalid - -Cannot use volume style unless other dimensions are being controlled. - -E: More than one fix deform - -Only one fix deform can be defined at a time. - -E: Variable name for fix deform does not exist - -Self-explanatory. - -E: Variable for fix deform is invalid style - -The variable must be an equal-style variable. - -E: Final box dimension due to fix deform is < 0.0 - -Self-explanatory. - -E: Cannot use fix deform trate on a box with zero tilt - -The trate style alters the current strain. - -E: Fix deform cannot use yz variable with xy - -The yz setting cannot be a variable if xy deformation is also -specified. This is because LAMMPS cannot determine if the yz setting -will induce a box flip which would be invalid if xy is also changing. - -E: Fix deform is changing yz too much with xy - -When both yz and xy are changing, it induces changes in xz if the -box must flip from one tilt extreme to another. Thus it is not -allowed for yz to grow so much that a flip is induced. - -E: Fix deform settings not consistent with restart - -UNDOCUMENTED - -*/ diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 034cecd55a..fd6eb3e36a 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -844,7 +844,7 @@ void FixDeposit::write_restart(FILE *fp) void FixDeposit::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; seed = static_cast(list[n++]); ninserted = static_cast(list[n++]); diff --git a/src/fix_deposit.h b/src/fix_deposit.h index 29f7cbfa43..a9d3d01b34 100644 --- a/src/fix_deposit.h +++ b/src/fix_deposit.h @@ -69,122 +69,3 @@ class FixDeposit : public Fix { #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: Invalid atom type in fix deposit command - -Self-explanatory. - -E: Must specify a region in fix deposit - -The region keyword must be specified with this fix. - -E: Fix deposit region does not support a bounding box - -Not all regions represent bounded volumes. You cannot use -such a region with the fix deposit command. - -E: Fix deposit region cannot be dynamic - -Only static regions can be used with fix deposit. - -E: Deposition region extends outside simulation box - -Self-explanatory. - -E: Cannot use fix_deposit unless atoms have IDs - -Self-explanatory. - -E: Fix deposit molecule must have coordinates - -The defined molecule does not specify coordinates. - -E: Fix deposit molecule must have atom types - -The defined molecule does not specify atom types. - -E: Invalid atom type in fix deposit mol command - -The atom types in the defined molecule are added to the value -specified in the create_atoms command, as an offset. The final value -for each atom must be between 1 to N, where N is the number of atom -types. - -E: Fix deposit molecule template ID must be same as atom_style template ID - -When using atom_style template, you cannot deposit molecules that are -not in that template. - -E: Cannot use fix deposit rigid and not molecule - -Self-explanatory. - -E: Cannot use fix deposit shake and not molecule - -Self-explanatory. - -E: Cannot use fix deposit rigid and shake - -These two attributes are conflicting. - -E: Region ID for fix deposit does not exist - -Self-explanatory. - -E: Fix deposit rigid fix does not exist - -UNDOCUMENTED - -E: Fix deposit and fix rigid/small not using same molecule template ID - -Self-explanatory. - -E: Fix deposit shake fix does not exist - -Self-explanatory. - -E: Fix deposit and fix shake not using same molecule template ID - -Self-explanatory. - -W: Fix deposit near setting < possible overlap separation %g - -This test is performed for finite size particles with a diameter, not -for point particles. The near setting is smaller than the particle -diameter which can lead to overlaps. - -E: Unknown particle distribution in fix deposit - -UNDOCUMENTED - -W: Particle deposition was unsuccessful - -The fix deposit command was not able to insert as many atoms as -needed. The requested volume fraction may be too high, or other atoms -may be in the insertion region. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -E: New atom IDs exceed maximum allowed ID - -See the setting for tagint in the src/lmptype.h file. - -E: Molecule template ID for fix deposit does not exist - -Self-explanatory. - -U: Fix pour rigid fix does not exist - -Self-explanatory. - -*/ diff --git a/src/fix_deprecated.h b/src/fix_deprecated.h index db7f47abcc..e7ee0ba43c 100644 --- a/src/fix_deprecated.h +++ b/src/fix_deprecated.h @@ -42,17 +42,3 @@ class FixDeprecated : public Fix { #endif #endif - -/* ERROR/WARNING messages: - -E: This fix command has been removed from LAMMPS - -UNDOCUMENTED - -U: The fix ave/spatial command has been removed from LAMMPS - -It has been replaced by the more flexible fix ave/chunk and compute -chunk/atom commands. All the fix ave/spatial keywords and options are -available in those two newer commands. - -*/ diff --git a/src/fix_dt_reset.h b/src/fix_dt_reset.h index 533e94b80c..d500f97035 100644 --- a/src/fix_dt_reset.h +++ b/src/fix_dt_reset.h @@ -47,18 +47,3 @@ class FixDtReset : public Fix { #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. - -W: Dump dcd/xtc timestamp may be wrong with fix dt/reset - -If the fix changes the timestep, the dump dcd file will not -reflect the change. - -*/ diff --git a/src/fix_dummy.h b/src/fix_dummy.h index 05be520a32..a7012138be 100644 --- a/src/fix_dummy.h +++ b/src/fix_dummy.h @@ -41,13 +41,3 @@ class FixDummy : public Fix { #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. - -*/ diff --git a/src/fix_efield.cpp b/src/fix_efield.cpp index 6fa3fc5297..3a2d8cfb5c 100644 --- a/src/fix_efield.cpp +++ b/src/fix_efield.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -40,10 +39,10 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), - estr(nullptr), idregion(nullptr), efield(nullptr) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), + idregion(nullptr), region(nullptr), efield(nullptr) { - if (narg < 6) error->all(FLERR,"Illegal fix efield command"); + if (narg < 6) error->all(FLERR, "Illegal fix efield command"); dynamic_group_allow = 1; vector_flag = 1; @@ -60,56 +59,53 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : qe2f = force->qe2f; xstr = ystr = zstr = nullptr; - if (utils::strmatch(arg[3],"^v_")) { - xstr = utils::strdup(arg[3]+2); + if (utils::strmatch(arg[3], "^v_")) { + xstr = utils::strdup(arg[3] + 2); } else { - ex = qe2f * utils::numeric(FLERR,arg[3],false,lmp); + ex = qe2f * utils::numeric(FLERR, arg[3], false, lmp); xstyle = CONSTANT; } - if (utils::strmatch(arg[4],"^v_")) { - ystr = utils::strdup(arg[4]+2); + if (utils::strmatch(arg[4], "^v_")) { + ystr = utils::strdup(arg[4] + 2); } else { - ey = qe2f * utils::numeric(FLERR,arg[4],false,lmp); + ey = qe2f * utils::numeric(FLERR, arg[4], false, lmp); ystyle = CONSTANT; } - if (utils::strmatch(arg[5],"^v_")) { - zstr = utils::strdup(arg[5]+2); + if (utils::strmatch(arg[5], "^v_")) { + zstr = utils::strdup(arg[5] + 2); } else { - ez = qe2f * utils::numeric(FLERR,arg[5],false,lmp); + ez = qe2f * utils::numeric(FLERR, arg[5], false, lmp); zstyle = CONSTANT; } // optional args - iregion = -1; - idregion = nullptr; - estr = nullptr; - int iarg = 6; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix efield command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix efield does not exist"); - idregion = utils::strdup(arg[iarg+1]); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix efield command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix efield does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else if (strcmp(arg[iarg],"energy") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix efield command"); - if (utils::strmatch(arg[iarg+1],"^v_")) { - estr = utils::strdup(arg[iarg+1]+2); - } else error->all(FLERR,"Illegal fix efield command"); + } else if (strcmp(arg[iarg], "energy") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix efield command"); + if (utils::strmatch(arg[iarg + 1], "^v_")) { + estr = utils::strdup(arg[iarg + 1] + 2); + } else + error->all(FLERR, "Illegal fix efield command"); iarg += 2; - } else error->all(FLERR,"Illegal fix efield command"); + } else + error->all(FLERR, "Illegal fix efield command"); } force_flag = 0; fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0; maxatom = atom->nmax; - memory->create(efield,maxatom,4,"efield:efield"); + memory->create(efield, maxatom, 4, "efield:efield"); maxatom_energy = 0; } @@ -118,11 +114,11 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : FixEfield::~FixEfield() { - delete [] xstr; - delete [] ystr; - delete [] zstr; - delete [] estr; - delete [] idregion; + delete[] xstr; + delete[] ystr; + delete[] zstr; + delete[] estr; + delete[] idregion; memory->destroy(efield); } @@ -144,74 +140,78 @@ void FixEfield::init() qflag = muflag = 0; if (atom->q_flag) qflag = 1; if (atom->mu_flag && atom->torque_flag) muflag = 1; - if (!qflag && !muflag) - error->all(FLERR,"Fix efield requires atom attribute q or mu"); + if (!qflag && !muflag) error->all(FLERR, "Fix efield requires atom attribute q or mu"); // check variables if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) - error->all(FLERR,"Variable name for fix efield does not exist"); - if (input->variable->equalstyle(xvar)) xstyle = EQUAL; - else if (input->variable->atomstyle(xvar)) xstyle = ATOM; - else error->all(FLERR,"Variable for fix efield is invalid style"); + if (xvar < 0) error->all(FLERR, "Variable {} for fix efield does not exist", xstr); + if (input->variable->equalstyle(xvar)) + xstyle = EQUAL; + else if (input->variable->atomstyle(xvar)) + xstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix efield is invalid style", xstr); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) - error->all(FLERR,"Variable name for fix efield does not exist"); - if (input->variable->equalstyle(yvar)) ystyle = EQUAL; - else if (input->variable->atomstyle(yvar)) ystyle = ATOM; - else error->all(FLERR,"Variable for fix efield is invalid style"); + if (yvar < 0) error->all(FLERR, "Variable {} for fix efield does not exist", ystr); + if (input->variable->equalstyle(yvar)) + ystyle = EQUAL; + else if (input->variable->atomstyle(yvar)) + ystyle = ATOM; + else + error->all(FLERR, "Variable {} for fix efield is invalid style", ystr); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) - error->all(FLERR,"Variable name for fix efield does not exist"); - if (input->variable->equalstyle(zvar)) zstyle = EQUAL; - else if (input->variable->atomstyle(zvar)) zstyle = ATOM; - else error->all(FLERR,"Variable for fix efield is invalid style"); + if (zvar < 0) error->all(FLERR, "Variable {} for fix efield does not exist", zstr); + if (input->variable->equalstyle(zvar)) + zstyle = EQUAL; + else if (input->variable->atomstyle(zvar)) + zstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix efield is invalid style", zstr); } if (estr) { evar = input->variable->find(estr); - if (evar < 0) - error->all(FLERR,"Variable name for fix efield does not exist"); - if (input->variable->atomstyle(evar)) estyle = ATOM; - else error->all(FLERR,"Variable for fix efield is invalid style"); - } else estyle = NONE; - + if (evar < 0) error->all(FLERR, "Variable {} for fix efield does not exist", estr); + if (input->variable->atomstyle(evar)) + estyle = ATOM; + else + error->all(FLERR, "Variable {} for fix efield is invalid style", estr); + } else + estyle = NONE; // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix aveforce does not exist"); + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix aveforce does not exist", idregion); } if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) varflag = ATOM; else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL; - else varflag = CONSTANT; + else + varflag = CONSTANT; if (muflag && varflag == ATOM) - error->all(FLERR,"Fix efield with dipoles cannot use atom-style variables"); + error->all(FLERR, "Fix efield with dipoles cannot use atom-style variables"); if (muflag && update->whichflag == 2 && comm->me == 0) error->warning(FLERR, "The minimizer does not re-orient dipoles when using fix efield"); if (varflag == CONSTANT && estyle != NONE) - error->all(FLERR,"Cannot use variable energy with " - "constant efield in fix efield"); - if ((varflag == EQUAL || varflag == ATOM) && - update->whichflag == 2 && estyle == NONE) - error->all(FLERR,"Must use variable energy with fix efield"); + error->all(FLERR, "Cannot use variable energy with constant efield in fix efield"); + if ((varflag == EQUAL || varflag == ATOM) && update->whichflag == 2 && estyle == NONE) + error->all(FLERR, "Must use variable energy with fix efield"); - if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; - if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); + if (utils::strmatch(update->integrate_style, "^respa")) { + ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; + if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } } @@ -219,12 +219,13 @@ void FixEfield::init() void FixEfield::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(update->integrate_style, "^respa")) { + auto respa = dynamic_cast(update->integrate); + respa->copy_flevel_f(ilevel_respa); + post_force_respa(vflag, ilevel_respa, 0); + respa->copy_f_flevel(ilevel_respa); + } else { post_force(vflag); - else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); - post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); } } @@ -256,16 +257,12 @@ void FixEfield::post_force(int vflag) if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(efield); - memory->create(efield,maxatom,4,"efield:efield"); + memory->create(efield, maxatom, 4, "efield:efield"); } // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // fsum[0] = "potential energy" for added force // fsum[123] = extra force added to atoms @@ -274,7 +271,7 @@ void FixEfield::post_force(int vflag) force_flag = 0; double **x = atom->x; - double fx,fy,fz; + double fx, fy, fz; double v[6]; // constant efield @@ -288,27 +285,27 @@ void FixEfield::post_force(int vflag) if (qflag) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - fx = q[i]*ex; - fy = q[i]*ey; - fz = q[i]*ez; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + fx = q[i] * ex; + fy = q[i] * ey; + fz = q[i] * ez; f[i][0] += fx; f[i][1] += fy; f[i][2] += fz; - domain->unmap(x[i],image[i],unwrap); - fsum[0] -= fx*unwrap[0]+fy*unwrap[1]+fz*unwrap[2]; + domain->unmap(x[i], image[i], unwrap); + fsum[0] -= fx * unwrap[0] + fy * unwrap[1] + fz * unwrap[2]; fsum[1] += fx; fsum[2] += fy; fsum[3] += fz; if (evflag) { - v[0] = fx*unwrap[0]; - v[1] = fy*unwrap[1]; - v[2] = fz*unwrap[2]; - v[3] = fx*unwrap[1]; - v[4] = fx*unwrap[2]; - v[5] = fy*unwrap[2]; - v_tally(i,v); + v[0] = fx * unwrap[0]; + v[1] = fy * unwrap[1]; + v[2] = fz * unwrap[2]; + v[3] = fx * unwrap[1]; + v[4] = fx * unwrap[2]; + v[5] = fy * unwrap[2]; + v_tally(i, v); } } } @@ -319,38 +316,43 @@ void FixEfield::post_force(int vflag) if (muflag) { double **mu = atom->mu; double **t = atom->torque; - double tx,ty,tz; + double tx, ty, tz; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - tx = ez*mu[i][1] - ey*mu[i][2]; - ty = ex*mu[i][2] - ez*mu[i][0]; - tz = ey*mu[i][0] - ex*mu[i][1]; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + tx = ez * mu[i][1] - ey * mu[i][2]; + ty = ex * mu[i][2] - ez * mu[i][0]; + tz = ey * mu[i][0] - ex * mu[i][1]; t[i][0] += tx; t[i][1] += ty; t[i][2] += tz; - fsum[0] -= mu[i][0]*ex + mu[i][1]*ey + mu[i][2]*ez; + fsum[0] -= mu[i][0] * ex + mu[i][1] * ey + mu[i][2] * ez; } } - // variable efield, wrap with clear/add - // potential energy = evar if defined, else 0.0 + // variable efield, wrap with clear/add + // potential energy = evar if defined, else 0.0 } else { modify->clearstep_compute(); - if (xstyle == EQUAL) ex = qe2f * input->variable->compute_equal(xvar); - else if (xstyle == ATOM) - input->variable->compute_atom(xvar,igroup,&efield[0][0],4,0); - if (ystyle == EQUAL) ey = qe2f * input->variable->compute_equal(yvar); - else if (ystyle == ATOM) - input->variable->compute_atom(yvar,igroup,&efield[0][1],4,0); - if (zstyle == EQUAL) ez = qe2f * input->variable->compute_equal(zvar); - else if (zstyle == ATOM) - input->variable->compute_atom(zvar,igroup,&efield[0][2],4,0); - if (estyle == ATOM) - input->variable->compute_atom(evar,igroup,&efield[0][3],4,0); + if (xstyle == EQUAL) { + ex = qe2f * input->variable->compute_equal(xvar); + } else if (xstyle == ATOM) { + input->variable->compute_atom(xvar, igroup, &efield[0][0], 4, 0); + } + if (ystyle == EQUAL) { + ey = qe2f * input->variable->compute_equal(yvar); + } else if (ystyle == ATOM) { + input->variable->compute_atom(yvar, igroup, &efield[0][1], 4, 0); + } + if (zstyle == EQUAL) { + ez = qe2f * input->variable->compute_equal(zvar); + } else if (zstyle == ATOM) { + input->variable->compute_atom(zvar, igroup, &efield[0][2], 4, 0); + } + if (estyle == ATOM) input->variable->compute_atom(evar, igroup, &efield[0][3], 4, 0); modify->addstep_compute(update->ntimestep + 1); @@ -360,17 +362,26 @@ void FixEfield::post_force(int vflag) if (qflag) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - if (xstyle == ATOM) fx = qe2f * q[i]*efield[i][0]; - else fx = q[i]*ex; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + if (xstyle == ATOM) { + fx = qe2f * q[i] * efield[i][0]; + } else { + fx = q[i] * ex; + } f[i][0] += fx; fsum[1] += fx; - if (ystyle == ATOM) fy = qe2f * q[i]*efield[i][1]; - else fy = q[i]*ey; + if (ystyle == ATOM) { + fy = qe2f * q[i] * efield[i][1]; + } else { + fy = q[i] * ey; + } f[i][1] += fy; fsum[2] += fy; - if (zstyle == ATOM) fz = qe2f * q[i]*efield[i][2]; - else fz = q[i]*ez; + if (zstyle == ATOM) { + fz = qe2f * q[i] * efield[i][2]; + } else { + fz = q[i] * ez; + } f[i][2] += fz; fsum[3] += fz; if (estyle == ATOM) fsum[0] += efield[0][3]; @@ -383,13 +394,13 @@ void FixEfield::post_force(int vflag) if (muflag) { double **mu = atom->mu; double **t = atom->torque; - double tx,ty,tz; + double tx, ty, tz; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; - tx = ez*mu[i][1] - ey*mu[i][2]; - ty = ex*mu[i][2] - ez*mu[i][0]; - tz = ey*mu[i][0] - ex*mu[i][1]; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; + tx = ez * mu[i][1] - ey * mu[i][2]; + ty = ex * mu[i][2] - ez * mu[i][0]; + tz = ey * mu[i][0] - ex * mu[i][1]; t[i][0] += tx; t[i][1] += ty; t[i][2] += tz; @@ -419,7 +430,7 @@ void FixEfield::min_post_force(int vflag) double FixEfield::memory_usage() { double bytes = 0.0; - if (varflag == ATOM) bytes = atom->nmax*4 * sizeof(double); + if (varflag == ATOM) bytes = atom->nmax * 4 * sizeof(double); return bytes; } @@ -430,7 +441,7 @@ double FixEfield::memory_usage() double FixEfield::compute_scalar() { if (force_flag == 0) { - MPI_Allreduce(fsum,fsum_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(fsum, fsum_all, 4, MPI_DOUBLE, MPI_SUM, world); force_flag = 1; } return fsum_all[0]; @@ -443,9 +454,8 @@ double FixEfield::compute_scalar() double FixEfield::compute_vector(int n) { if (force_flag == 0) { - MPI_Allreduce(fsum,fsum_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(fsum, fsum_all, 4, MPI_DOUBLE, MPI_SUM, world); force_flag = 1; } - return fsum_all[n+1]; + return fsum_all[n + 1]; } - diff --git a/src/fix_efield.h b/src/fix_efield.h index 9148a94d99..fc92766b80 100644 --- a/src/fix_efield.h +++ b/src/fix_efield.h @@ -26,6 +26,7 @@ namespace LAMMPS_NS { class FixEfield : public Fix { friend class FixQEqReaxFF; + public: FixEfield(class LAMMPS *, int, char **); ~FixEfield() override; @@ -44,9 +45,10 @@ class FixEfield : public Fix { protected: double ex, ey, ez; - int varflag, iregion; + int varflag; char *xstr, *ystr, *zstr, *estr; char *idregion; + class Region *region; int xvar, yvar, zvar, evar, xstyle, ystyle, zstyle, estyle; int ilevel_respa; double qe2f; @@ -63,51 +65,3 @@ class FixEfield : public Fix { #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: Region ID for fix efield does not exist - -Self-explanatory. - -E: Fix efield requires atom attribute q or mu - -The atom style defined does not have this attribute. - -E: Variable name for fix efield does not exist - -Self-explanatory. - -E: Variable for fix efield is invalid style - -The variable must be an equal- or atom-style variable. - -E: Region ID for fix aveforce does not exist - -Self-explanatory. - -E: Fix efield with dipoles cannot use atom-style variables - -This option is not supported. - -W: The minimizer does not re-orient dipoles when using fix efield - -This means that only the atom coordinates will be minimized, -not the orientation of the dipoles. - -E: Cannot use variable energy with constant efield in fix efield - -LAMMPS computes the energy itself when the E-field is constant. - -E: Must use variable energy with fix efield - -You must define an energy when performing a minimization with a -variable E-field. - -*/ diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index abff16d21e..cc3b79c45d 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -93,11 +93,11 @@ void FixEnforce2D::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - int nlevels_respa = ((Respa *) update->integrate)->nlevels; + int nlevels_respa = (dynamic_cast( update->integrate))->nlevels; for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); post_force_respa(vflag,ilevel,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } } } diff --git a/src/fix_enforce2d.h b/src/fix_enforce2d.h index 5826657f40..ac0b11f611 100644 --- a/src/fix_enforce2d.h +++ b/src/fix_enforce2d.h @@ -45,21 +45,3 @@ class FixEnforce2D : public Fix { #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: Cannot use fix enforce2d with 3d simulation - -Self-explanatory. - -E: Fix enforce2d must be defined after fix %s - -UNDOCUMENTED - -*/ diff --git a/src/fix_evaporate.cpp b/src/fix_evaporate.cpp index 531dcf9ffd..ec3a85b259 100644 --- a/src/fix_evaporate.cpp +++ b/src/fix_evaporate.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -35,32 +34,31 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(nullptr), list(nullptr), mark(nullptr), random(nullptr) + Fix(lmp, narg, arg), idregion(nullptr), region(nullptr), list(nullptr), mark(nullptr), + random(nullptr) { - if (narg < 7) error->all(FLERR,"Illegal fix evaporate command"); + if (narg < 7) error->all(FLERR, "Illegal fix evaporate command"); scalar_flag = 1; global_freq = 1; extscalar = 0; - nevery = utils::inumeric(FLERR,arg[3],false,lmp); - nflux = utils::inumeric(FLERR,arg[4],false,lmp); - iregion = domain->find_region(arg[5]); + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + nflux = utils::inumeric(FLERR, arg[4], false, lmp); + region = domain->get_region_by_id(arg[5]); idregion = utils::strdup(arg[5]); - int seed = utils::inumeric(FLERR,arg[6],false,lmp); + int seed = utils::inumeric(FLERR, arg[6], false, lmp); - if (nevery <= 0 || nflux <= 0) - error->all(FLERR,"Illegal fix evaporate command"); - if (iregion == -1) - error->all(FLERR,"Region ID for fix evaporate does not exist"); - if (seed <= 0) error->all(FLERR,"Illegal fix evaporate command"); + if (nevery <= 0 || nflux <= 0) error->all(FLERR, "Illegal fix evaporate command"); + if (!region) error->all(FLERR, "Region {} for fix evaporate does not exist", idregion); + if (seed <= 0) error->all(FLERR, "Illegal fix evaporate command"); // random number generator, same for all procs // warm up the generator 30x to avoid correlations in first-particle // positions if runs are repeated with consecutive seeds - random = new RanPark(lmp,seed); - for (int ii=0; ii < 30; ii++) random->uniform(); + random = new RanPark(lmp, seed); + for (int ii = 0; ii < 30; ii++) random->uniform(); // optional args @@ -68,17 +66,18 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : int iarg = 7; while (iarg < narg) { - if (strcmp(arg[iarg],"molecule") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix evaporate command"); - molflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "molecule") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix evaporate command"); + molflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix evaporate command"); + } else + error->all(FLERR, "Illegal fix evaporate command"); } // set up reneighboring force_reneighbor = 1; - next_reneighbor = (update->ntimestep/nevery)*nevery + nevery; + next_reneighbor = (update->ntimestep / nevery) * nevery + nevery; ndeleted = 0; nmax = 0; @@ -90,7 +89,7 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : FixEvaporate::~FixEvaporate() { - delete [] idregion; + delete[] idregion; delete random; memory->destroy(list); memory->destroy(mark); @@ -111,9 +110,8 @@ void FixEvaporate::init() { // set index and check validity of region - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix evaporate does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix evaporate does not exist", idregion); // check that no deletable atoms are in atom->firstgroup // deleting such an atom would not leave firstgroup atoms first @@ -128,10 +126,9 @@ void FixEvaporate::init() if ((mask[i] & groupbit) && (mask[i] && firstgroupbit)) flag = 1; int flagall; - MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); - if (flagall) - error->all(FLERR,"Cannot evaporate atoms in atom_modify first group"); + if (flagall) error->all(FLERR, "Cannot evaporate atoms in atom_modify first group"); } // if molflag not set, warn if any deletable atom has a mol ID @@ -145,15 +142,13 @@ void FixEvaporate::init() if (mask[i] & groupbit) if (molecule[i]) flag = 1; int flagall; - MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); if (flagall && comm->me == 0) - error->warning(FLERR, - "Fix evaporate may delete atom with non-zero molecule ID"); + error->warning(FLERR, "Fix evaporate may delete atom with non-zero molecule ID"); } if (molflag && atom->molecule_flag == 0) - error->all(FLERR, - "Fix evaporate molecule requires atom attribute molecule"); + error->all(FLERR, "Fix evaporate molecule requires atom attribute molecule"); } /* ---------------------------------------------------------------------- @@ -164,8 +159,8 @@ void FixEvaporate::init() void FixEvaporate::pre_exchange() { - int i,j,m,iwhichglobal,iwhichlocal; - int ndel,ndeltopo[4]; + int i, j, m, iwhichglobal, iwhichlocal; + int ndel, ndeltopo[4]; if (update->ntimestep != next_reneighbor) return; @@ -175,8 +170,8 @@ void FixEvaporate::pre_exchange() memory->destroy(list); memory->destroy(mark); nmax = atom->nmax; - memory->create(list,nmax,"evaporate:list"); - memory->create(mark,nmax,"evaporate:mark"); + memory->create(list, nmax, "evaporate:list"); + memory->create(mark, nmax, "evaporate:mark"); } // ncount = # of deletable atoms in region that I own @@ -184,7 +179,6 @@ void FixEvaporate::pre_exchange() // nbefore = # on procs before me // list[ncount] = list of local indices of atoms I can delete - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -195,11 +189,11 @@ void FixEvaporate::pre_exchange() int ncount = 0; for (i = 0; i < nlocal; i++) if (mask[i] & groupbit) - if (region->match(x[i][0],x[i][1],x[i][2])) list[ncount++] = i; + if (region->match(x[i][0], x[i][1], x[i][2])) list[ncount++] = i; - int nall,nbefore; - MPI_Allreduce(&ncount,&nall,1,MPI_INT,MPI_SUM,world); - MPI_Scan(&ncount,&nbefore,1,MPI_INT,MPI_SUM,world); + int nall, nbefore; + MPI_Allreduce(&ncount, &nall, 1, MPI_INT, MPI_SUM, world); + MPI_Scan(&ncount, &nbefore, 1, MPI_INT, MPI_SUM, world); nbefore -= ncount; // ndel = total # of atom deletions, in or out of region @@ -216,27 +210,28 @@ void FixEvaporate::pre_exchange() if (molflag == 0) { while (nall && ndel < nflux) { - iwhichglobal = static_cast (nall*random->uniform()); - if (iwhichglobal < nbefore) nbefore--; + iwhichglobal = static_cast(nall * random->uniform()); + if (iwhichglobal < nbefore) + nbefore--; else if (iwhichglobal < nbefore + ncount) { iwhichlocal = iwhichglobal - nbefore; mark[list[iwhichlocal]] = 1; - list[iwhichlocal] = list[ncount-1]; + list[iwhichlocal] = list[ncount - 1]; ncount--; } ndel++; nall--; } - // molecule deletions - // choose one atom in one molecule randomly across all procs - // bcast mol ID and delete all atoms in that molecule on any proc - // update deletion count by total # of atoms in molecule - // shrink list of eligible candidates as any of my atoms get marked - // keep ndel,ndeltopo,ncount,nall,nbefore current after each mol deletion + // molecule deletions + // choose one atom in one molecule randomly across all procs + // bcast mol ID and delete all atoms in that molecule on any proc + // update deletion count by total # of atoms in molecule + // shrink list of eligible candidates as any of my atoms get marked + // keep ndel,ndeltopo,ncount,nall,nbefore current after each mol deletion } else { - int me,proc,iatom,ndelone,ndelall,index; + int me, proc, iatom, ndelone, ndelall, index; tagint imolecule; tagint *molecule = atom->molecule; int *molindex = atom->molindex; @@ -250,13 +245,14 @@ void FixEvaporate::pre_exchange() // pick an iatom,imolecule on proc me to delete - iwhichglobal = static_cast (nall*random->uniform()); + iwhichglobal = static_cast(nall * random->uniform()); if (iwhichglobal >= nbefore && iwhichglobal < nbefore + ncount) { iwhichlocal = iwhichglobal - nbefore; iatom = list[iwhichlocal]; imolecule = molecule[iatom]; me = comm->me; - } else me = -1; + } else + me = -1; // bcast mol ID to delete all atoms from // if mol ID > 0, delete any atom in molecule and decrement counters @@ -265,8 +261,8 @@ void FixEvaporate::pre_exchange() // for atom->molecular = Atom::MOLECULAR, do this for each deleted atom in molecule // for atom->molecular = Atom::TEMPLATE, use Molecule counts for just 1st atom in mol - MPI_Allreduce(&me,&proc,1,MPI_INT,MPI_MAX,world); - MPI_Bcast(&imolecule,1,MPI_LMP_TAGINT,proc,world); + MPI_Allreduce(&me, &proc, 1, MPI_INT, MPI_MAX, world); + MPI_Bcast(&imolecule, 1, MPI_LMP_TAGINT, proc, world); ndelone = 0; for (i = 0; i < nlocal; i++) { if (imolecule && molecule[i] == imolecule) { @@ -275,7 +271,8 @@ void FixEvaporate::pre_exchange() if (molecular == Atom::MOLECULAR) { if (atom->avec->bonds_allow) { - if (force->newton_bond) ndeltopo[0] += atom->num_bond[i]; + if (force->newton_bond) + ndeltopo[0] += atom->num_bond[i]; else { for (j = 0; j < atom->num_bond[i]; j++) { if (tag[i] < atom->bond_atom[i][j]) ndeltopo[0]++; @@ -283,7 +280,8 @@ void FixEvaporate::pre_exchange() } } if (atom->avec->angles_allow) { - if (force->newton_bond) ndeltopo[1] += atom->num_angle[i]; + if (force->newton_bond) + ndeltopo[1] += atom->num_angle[i]; else { for (j = 0; j < atom->num_angle[i]; j++) { m = atom->map(atom->angle_atom2[i][j]); @@ -292,7 +290,8 @@ void FixEvaporate::pre_exchange() } } if (atom->avec->dihedrals_allow) { - if (force->newton_bond) ndeltopo[2] += atom->num_dihedral[i]; + if (force->newton_bond) + ndeltopo[2] += atom->num_dihedral[i]; else { for (j = 0; j < atom->num_dihedral[i]; j++) { m = atom->map(atom->dihedral_atom2[i][j]); @@ -301,7 +300,8 @@ void FixEvaporate::pre_exchange() } } if (atom->avec->impropers_allow) { - if (force->newton_bond) ndeltopo[3] += atom->num_improper[i]; + if (force->newton_bond) + ndeltopo[3] += atom->num_improper[i]; else { for (j = 0; j < atom->num_improper[i]; j++) { m = atom->map(atom->improper_atom2[i][j]); @@ -331,19 +331,20 @@ void FixEvaporate::pre_exchange() i = 0; while (i < ncount) { if (mark[list[i]]) { - list[i] = list[ncount-1]; + list[i] = list[ncount - 1]; ncount--; - } else i++; + } else + i++; } // update ndel,ncount,nall,nbefore // ndelall is total atoms deleted on this iteration // ncount is already correct, so resum to get nall and nbefore - MPI_Allreduce(&ndelone,&ndelall,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&ndelone, &ndelall, 1, MPI_INT, MPI_SUM, world); ndel += ndelall; - MPI_Allreduce(&ncount,&nall,1,MPI_INT,MPI_SUM,world); - MPI_Scan(&ncount,&nbefore,1,MPI_INT,MPI_SUM,world); + MPI_Allreduce(&ncount, &nall, 1, MPI_INT, MPI_SUM, world); + MPI_Scan(&ncount, &nbefore, 1, MPI_INT, MPI_SUM, world); nbefore -= ncount; } } @@ -353,9 +354,9 @@ void FixEvaporate::pre_exchange() AtomVec *avec = atom->avec; - for (i = nlocal-1; i >= 0; i--) { + for (i = nlocal - 1; i >= 0; i--) { if (mark[i]) { - avec->copy(atom->nlocal-1,i,1); + avec->copy(atom->nlocal - 1, i, 1); atom->nlocal--; } } @@ -367,7 +368,7 @@ void FixEvaporate::pre_exchange() atom->natoms -= ndel; if (molflag) { int all[4]; - MPI_Allreduce(ndeltopo,all,4,MPI_INT,MPI_SUM,world); + MPI_Allreduce(ndeltopo, all, 4, MPI_INT, MPI_SUM, world); atom->nbonds -= all[0]; atom->nangles -= all[1]; atom->ndihedrals -= all[2]; @@ -392,7 +393,7 @@ void FixEvaporate::pre_exchange() double FixEvaporate::compute_scalar() { - return 1.0*ndeleted; + return 1.0 * ndeleted; } /* ---------------------------------------------------------------------- @@ -401,6 +402,6 @@ double FixEvaporate::compute_scalar() double FixEvaporate::memory_usage() { - double bytes = 2*nmax * sizeof(int); + double bytes = 2 * nmax * sizeof(int); return bytes; } diff --git a/src/fix_evaporate.h b/src/fix_evaporate.h index e350c91608..776097d3a4 100644 --- a/src/fix_evaporate.h +++ b/src/fix_evaporate.h @@ -35,10 +35,11 @@ class FixEvaporate : public Fix { double memory_usage() override; private: - int nevery, nflux, iregion; + int nevery, nflux; int molflag; int ndeleted; char *idregion; + class Region *region; int nmax; int *list, *mark; @@ -50,31 +51,3 @@ class FixEvaporate : public Fix { #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: Region ID for fix evaporate does not exist - -Self-explanatory. - -E: Cannot evaporate atoms in atom_modify first group - -This is a restriction due to the way atoms are organized in -a list to enable the atom_modify first command. - -W: Fix evaporate may delete atom with non-zero molecule ID - -This is probably an error, since you should not delete only one atom -of a molecule. - -E: Fix evaporate molecule requires atom attribute molecule - -The atom style being used does not define a molecule ID. - -*/ diff --git a/src/fix_external.h b/src/fix_external.h index efc017708c..4ee42da2c7 100644 --- a/src/fix_external.h +++ b/src/fix_external.h @@ -72,21 +72,3 @@ class FixExternal : public Fix { #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: Fix external callback function not set - -This must be done by an external program in order to use this fix. - -E: Invalid set_vector index in fix external - -UNDOCUMENTED - -*/ diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index b206bae5b8..cf559043cf 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -181,7 +181,7 @@ int FixGravity::setmask() void FixGravity::init() { if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } @@ -245,9 +245,9 @@ void FixGravity::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_gravity.h b/src/fix_gravity.h index 90041fdca8..ef92baa377 100644 --- a/src/fix_gravity.h +++ b/src/fix_gravity.h @@ -64,21 +64,3 @@ class FixGravity : public Fix { #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: Variable name for fix gravity does not exist - -Self-explanatory. - -E: Variable for fix gravity is invalid style - -Only equal-style variables can be used. - -*/ diff --git a/src/fix_group.cpp b/src/fix_group.cpp index 672a69cbc3..00deab3ef8 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -34,8 +33,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(nullptr), idvar(nullptr), idprop(nullptr) +FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), idregion(nullptr), idvar(nullptr), idprop(nullptr), region(nullptr) { // dgroupbit = bitmask of dynamic group // group ID is last part of fix ID @@ -44,6 +43,8 @@ idregion(nullptr), idvar(nullptr), idprop(nullptr) gbit = group->bitmask[group->find(dgroupid)]; gbitinverse = group->inversemask[group->find(dgroupid)]; + comm_forward = 1; + // process optional args regionflag = 0; @@ -53,42 +54,44 @@ idregion(nullptr), idvar(nullptr), idprop(nullptr) int iarg = 3; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); - if (domain->find_region(arg[iarg+1]) < 0) - error->all(FLERR,"Region ID for group dynamic does not exist"); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal group command"); + if (!domain->get_region_by_id(arg[iarg + 1])) + error->all(FLERR, "Region {} for group dynamic does not exist", arg[iarg + 1]); regionflag = 1; - delete [] idregion; - idregion = utils::strdup(arg[iarg+1]); + delete[] idregion; + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else if (strcmp(arg[iarg],"var") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); - if (input->variable->find(arg[iarg+1]) < 0) - error->all(FLERR,"Variable name for group dynamic does not exist"); + } else if (strcmp(arg[iarg], "var") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal group command"); + if (input->variable->find(arg[iarg + 1]) < 0) + error->all(FLERR, "Variable name for group dynamic does not exist"); varflag = 1; - delete [] idvar; - idvar = utils::strdup(arg[iarg+1]); + delete[] idvar; + idvar = utils::strdup(arg[iarg + 1]); iarg += 2; - } else if (strcmp(arg[iarg],"property") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); - int flag,cols; - iprop = atom->find_custom(arg[iarg+1],flag,cols); + } else if (strcmp(arg[iarg], "property") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal group command"); + int flag, cols; + iprop = atom->find_custom(arg[iarg + 1], flag, cols); if (iprop < 0 || cols) - error->all(FLERR,"Custom per-atom vector for group dynamic " + error->all(FLERR, + "Custom per-atom vector for group dynamic " "does not exist"); propflag = 1; - delete [] idprop; - idprop = utils::strdup(arg[iarg+1]); + delete[] idprop; + idprop = utils::strdup(arg[iarg + 1]); iarg += 2; - } else if (strcmp(arg[iarg],"every") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal group command"); - nevery = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal group command"); + } else if (strcmp(arg[iarg], "every") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal group command"); + 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"); + } else + error->all(FLERR, "Illegal group command"); } } @@ -96,9 +99,9 @@ idregion(nullptr), idvar(nullptr), idprop(nullptr) FixGroup::~FixGroup() { - delete [] idregion; - delete [] idvar; - delete [] idprop; + delete[] idregion; + delete[] idvar; + delete[] idprop; } /* ---------------------------------------------------------------------- */ @@ -106,8 +109,6 @@ FixGroup::~FixGroup() int FixGroup::setmask() { int mask = 0; - mask |= POST_INTEGRATE; - mask |= POST_INTEGRATE_RESPA; return mask; } @@ -118,58 +119,31 @@ void FixGroup::init() // parent group cannot be dynamic // else order of FixGroup fixes would matter - if (group->dynamic[igroup]) - error->all(FLERR,"Group dynamic parent group cannot be dynamic"); + if (group->dynamic[igroup]) error->all(FLERR, "Group dynamic parent group cannot be dynamic"); - if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + if (utils::strmatch(update->integrate_style, "^respa")) + nlevels_respa = (dynamic_cast(update->integrate))->nlevels; // set current indices for region and variable and custom property if (regionflag) { - iregion = domain->find_region(idregion); - if (iregion < 0) - error->all(FLERR,"Region ID for group dynamic does not exist"); - region = domain->regions[iregion]; + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for group dynamic does not exist", idregion); } if (varflag) { ivar = input->variable->find(idvar); - if (ivar < 0) - error->all(FLERR,"Variable name for group dynamic does not exist"); + if (ivar < 0) error->all(FLERR, "Variable name for group dynamic does not exist"); if (!input->variable->atomstyle(ivar)) - error->all(FLERR,"Variable for group dynamic is invalid style"); + error->all(FLERR, "Variable for group dynamic is invalid style"); } if (propflag) { int cols; - iprop = atom->find_custom(idprop,proptype,cols); + iprop = atom->find_custom(idprop, proptype, cols); if (iprop < 0 || cols) - error->all(FLERR,"Group dynamic command custom property vector does not exist"); + error->all(FLERR, "Group dynamic command custom property vector does not exist"); } - - // warn if any FixGroup is not at tail end of all post_integrate fixes - - Fix **fix = modify->fix; - int *fmask = modify->fmask; - int nfix = modify->nfix; - - int n = 0; - for (int i = 0; i < nfix; i++) if (POST_INTEGRATE & fmask[i]) n++; - int warn = 0; - for (int i = 0; i < nfix; i++) { - if (POST_INTEGRATE & fmask[i]) { - for (int j = i+1; j < nfix; j++) { - if (POST_INTEGRATE & fmask[j]) { - if (strstr(fix[j]->id,"GROUP_") != fix[j]->id) warn = 1; - } - } - } - } - - if (warn && comm->me == 0) - error->warning(FLERR,"One or more dynamic groups may not be " - "updated at correct point in timestep"); } /* ---------------------------------------------------------------------- @@ -183,7 +157,7 @@ void FixGroup::setup(int /*vflag*/) /* ---------------------------------------------------------------------- */ -void FixGroup::post_integrate() +void FixGroup::post_force(int /*vflag*/) { // only assign atoms to group on steps that are multiples of nevery @@ -192,9 +166,9 @@ void FixGroup::post_integrate() /* ---------------------------------------------------------------------- */ -void FixGroup::post_integrate_respa(int ilevel, int /*iloop*/) +void FixGroup::post_force_respa(int vflag, int ilevel, int /*iloop*/) { - if (ilevel == nlevels_respa-1) post_integrate(); + if (ilevel == nlevels_respa - 1) post_force(vflag); } /* ---------------------------------------------------------------------- */ @@ -204,22 +178,20 @@ void FixGroup::set_group() int nlocal = atom->nlocal; // invoke atom-style variable if defined - // set post_integrate flag to 1, then unset after - // this is for any compute to check if it needs to - // operate differently due to invocation this early in timestep - // e.g. perform ghost comm update due to atoms having just moved + // NOTE: after variable invocation could reset invoked computes to not-invoked + // this would avoid an issue where other post-force fixes + // change the compute result since it will not be re-invoked at end-of-step, + // e.g. if compute pe/atom includes pe contributions from fixes double *var = nullptr; int *ivector = nullptr; double *dvector = nullptr; if (varflag) { - update->post_integrate = 1; modify->clearstep_compute(); - memory->create(var,nlocal,"fix/group:varvalue"); - input->variable->compute_atom(ivar,igroup,var,1,0); + memory->create(var, nlocal, "fix/group:var"); + input->variable->compute_atom(ivar, igroup, var, 1, 0); modify->addstep_compute(update->ntimestep + nevery); - update->post_integrate = 0; } // set ptr to custom atom vector @@ -233,8 +205,6 @@ void FixGroup::set_group() // set mask for each atom // only in group if in parent group, in region, variable is non-zero - // if compute, fix, etc needs updated masks of ghost atoms, - // it must do forward_comm() to update them double **x = atom->x; int *mask = atom->mask; @@ -243,27 +213,65 @@ void FixGroup::set_group() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { inflag = 1; - if (regionflag && !region->match(x[i][0],x[i][1],x[i][2])) inflag = 0; + if (regionflag && !region->match(x[i][0], x[i][1], x[i][2])) inflag = 0; if (varflag && var[i] == 0.0) inflag = 0; if (propflag) { if (!proptype && ivector[i] == 0) inflag = 0; if (proptype && dvector[i] == 0.0) inflag = 0; } - } else inflag = 0; + } else + inflag = 0; - if (inflag) mask[i] |= gbit; - else mask[i] &= gbitinverse; + if (inflag) + mask[i] |= gbit; + else + mask[i] &= gbitinverse; } if (varflag) memory->destroy(var); + + // insure ghost atom masks are also updated + + comm->forward_comm(this); } /* ---------------------------------------------------------------------- */ -void *FixGroup::extract(const char *str, int &/*unused*/) +int FixGroup::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { - if (strcmp(str,"property") == 0 && propflag) return (void *) idprop; - if (strcmp(str,"variable") == 0 && varflag) return (void *) idvar; - if (strcmp(str,"region") == 0 && regionflag) return (void *) idregion; + int i, j, m; + + int *mask = atom->mask; + + m = 0; + for (i = 0; i < n; i++) { + j = list[i]; + buf[m++] = ubuf(mask[j]).d; + } + + return m; +} + +/* ---------------------------------------------------------------------- */ + +void FixGroup::unpack_forward_comm(int n, int first, double *buf) +{ + int i, m, last; + + m = 0; + last = first + n; + + int *mask = atom->mask; + + for (i = first; i < last; i++) mask[i] = (int) ubuf(buf[m++]).i; +} + +/* ---------------------------------------------------------------------- */ + +void *FixGroup::extract(const char *str, int & /*unused*/) +{ + if (strcmp(str, "property") == 0 && propflag) return (void *) idprop; + if (strcmp(str, "variable") == 0 && varflag) return (void *) idvar; + if (strcmp(str, "region") == 0 && regionflag) return (void *) idregion; return nullptr; } diff --git a/src/fix_group.h b/src/fix_group.h index ffa2afcfc3..f343be2344 100644 --- a/src/fix_group.h +++ b/src/fix_group.h @@ -31,14 +31,16 @@ class FixGroup : public Fix { int setmask() override; void init() override; void setup(int) override; - void post_integrate() override; - void post_integrate_respa(int, int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + int pack_forward_comm(int, int *, double *, int, int *) override; + void unpack_forward_comm(int, int, double *) override; void *extract(const char *, int &) override; private: int gbit, gbitinverse; int regionflag, varflag, propflag, proptype; - int iregion, ivar, iprop; + int ivar, iprop; char *idregion, *idvar, *idprop; class Region *region; @@ -51,41 +53,3 @@ class FixGroup : public Fix { #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: Region ID for group dynamic does not exist - -Self-explanatory. - -E: Variable name for group dynamic does not exist - -Self-explanatory. - -E: Per atom property for group dynamic does not exist - -Self-explanatory. - -E: Group dynamic parent group cannot be dynamic - -Self-explanatory. - -E: Variable for group dynamic is invalid style - -The variable must be an atom-style variable. - -W: One or more dynamic groups may not be updated at correct point in timestep - -If there are other fixes that act immediately after the initial stage -of time integration within a timestep (i.e. after atoms move), then -the command that sets up the dynamic group should appear after those -fixes. This will insure that dynamic group assignments are made -after all atoms have moved. - -*/ diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index 263386e2b0..08713cf6ad 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -107,15 +107,14 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg],"path") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix halt command"); ++iarg; - int len = strlen(arg[iarg])+1; delete[] dlimit_path; - dlimit_path = new char[len]; - // strip off quotes, if present + // strip off outer quotes, if present + int len = strlen(arg[iarg])+1; if ( ((arg[iarg][0] == '"') || (arg[iarg][0] == '\'')) && (arg[iarg][0] == arg[iarg][len-2])) { - strcpy(dlimit_path,&arg[iarg][1]); - dlimit_path[len-3] = '\0'; - } else strcpy(dlimit_path,arg[iarg]); + arg[iarg][len-2] = '\0'; + dlimit_path = utils::strdup(arg[iarg]+1); + } else dlimit_path = utils::strdup(arg[iarg]); ++iarg; } else error->all(FLERR,"Illegal fix halt command"); } diff --git a/src/fix_halt.h b/src/fix_halt.h index 1776e029e9..648c3b745b 100644 --- a/src/fix_halt.h +++ b/src/fix_halt.h @@ -50,37 +50,3 @@ class FixHalt : public Fix { #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: Could not find fix halt variable name - -Self-explanatory. - -E: Fix halt variable is not equal-style variable - -Self-explanatory. - -E: Invalid fix halt attribute - -Self-explanatory. - -E: Invalid fix halt operator - -Self-explanatory. - -E: Disk limit not supported by OS or illegal path - -Self-explanatory. - -W: Fix halt condition for fix-id %s met on step %ld with value %g - -Self explanatory. - -*/ diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index 6ceaf9c71e..db77dd7bdc 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -36,45 +35,44 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{CONSTANT,EQUAL,ATOM}; +enum { CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ -FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(nullptr), hstr(nullptr), vheat(nullptr), vscale(nullptr) +FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), idregion(nullptr), region(nullptr), hstr(nullptr), vheat(nullptr), + vscale(nullptr) { - if (narg < 4) error->all(FLERR,"Illegal fix heat command"); + if (narg < 4) error->all(FLERR, "Illegal fix heat command"); scalar_flag = 1; global_freq = 1; extscalar = 0; - nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix heat command"); + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + if (nevery <= 0) error->all(FLERR, "Illegal fix heat command"); hstr = nullptr; - if (utils::strmatch(arg[4],"^v_")) { - hstr = utils::strdup(arg[4]+2); + if (utils::strmatch(arg[4], "^v_")) { + hstr = utils::strdup(arg[4] + 2); } else { - heat_input = utils::numeric(FLERR,arg[4],false,lmp); + heat_input = utils::numeric(FLERR, arg[4], false, lmp); hstyle = CONSTANT; } // optional args - iregion = -1; - int iarg = 5; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix heat command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix heat does not exist"); - idregion = utils::strdup(arg[iarg+1]); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix heat command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix heat does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else error->all(FLERR,"Illegal fix heat command"); + } else + error->all(FLERR, "Illegal fix heat command"); } scale = 1.0; @@ -86,8 +84,8 @@ idregion(nullptr), hstr(nullptr), vheat(nullptr), vscale(nullptr) FixHeat::~FixHeat() { - delete [] hstr; - delete [] idregion; + delete[] hstr; + delete[] idregion; memory->destroy(vheat); memory->destroy(vscale); } @@ -107,34 +105,33 @@ void FixHeat::init() { // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix heat does not exist"); + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix heat does not exist", idregion); } // check variable if (hstr) { hvar = input->variable->find(hstr); - if (hvar < 0) - error->all(FLERR,"Variable name for fix heat does not exist"); - if (input->variable->equalstyle(hvar)) hstyle = EQUAL; - else if (input->variable->atomstyle(hvar)) hstyle = ATOM; - else error->all(FLERR,"Variable for fix heat is invalid style"); + if (hvar < 0) error->all(FLERR, "Variable name for fix heat does not exist"); + if (input->variable->equalstyle(hvar)) + hstyle = EQUAL; + else if (input->variable->atomstyle(hvar)) + hstyle = ATOM; + else + error->all(FLERR, "Variable for fix heat is invalid style"); } // check for rigid bodies in region (done here for performance reasons) - if (iregion >= 0 && modify->check_rigid_region_overlap(groupbit,domain->regions[iregion])) - error->warning(FLERR,"Cannot apply fix heat to atoms in rigid bodies"); + if (region && modify->check_rigid_region_overlap(groupbit, region)) + error->warning(FLERR, "Cannot apply fix heat to atoms in rigid bodies"); // cannot have 0 atoms in group - if (group->count(igroup) == 0) - error->all(FLERR,"Fix heat group has no atoms"); + if (group->count(igroup) == 0) error->all(FLERR, "Fix heat group has no atoms"); masstotal = group->mass(igroup); - if (masstotal <= 0.0) - error->all(FLERR,"Fix heat group has invalid mass"); + if (masstotal <= 0.0) error->all(FLERR, "Fix heat group has invalid mass"); } /* ---------------------------------------------------------------------- */ @@ -142,8 +139,8 @@ void FixHeat::init() void FixHeat::end_of_step() { int i; - double heat,ke,massone; - double vsub[3],vcm[3]; + double heat, ke, massone; + double vsub[3], vcm[3]; double **x = atom->x; double **v = atom->v; @@ -159,91 +156,88 @@ void FixHeat::end_of_step() maxatom = atom->nmax; memory->destroy(vheat); memory->destroy(vscale); - memory->create(vheat,maxatom,"heat:vheat"); - memory->create(vscale,maxatom,"heat:vscale"); + memory->create(vheat, maxatom, "heat:vheat"); + memory->create(vscale, maxatom, "heat:vscale"); } // evaluate variable if (hstyle != CONSTANT) { modify->clearstep_compute(); - if (hstyle == EQUAL) heat_input = input->variable->compute_equal(hvar); - else input->variable->compute_atom(hvar,igroup,vheat,1,0); + if (hstyle == EQUAL) + heat_input = input->variable->compute_equal(hvar); + else + input->variable->compute_atom(hvar, igroup, vheat, 1, 0); modify->addstep_compute(update->ntimestep + nevery); } // vcm = center-of-mass velocity of scaled atoms - if (iregion < 0) { - ke = group->ke(igroup)*force->ftm2v; - group->vcm(igroup,masstotal,vcm); + if (region) { + masstotal = group->mass(igroup, region); + if (masstotal == 0.0) error->all(FLERR, "Fix heat group has no atoms"); + ke = group->ke(igroup, region) * force->ftm2v; + group->vcm(igroup, masstotal, vcm, region); } else { - masstotal = group->mass(igroup,iregion); - if (masstotal == 0.0) error->all(FLERR,"Fix heat group has no atoms"); - ke = group->ke(igroup,iregion)*force->ftm2v; - group->vcm(igroup,masstotal,vcm,iregion); + ke = group->ke(igroup) * force->ftm2v; + group->vcm(igroup, masstotal, vcm); } - double vcmsq = vcm[0]*vcm[0] + vcm[1]*vcm[1] + vcm[2]*vcm[2]; + double vcmsq = vcm[0] * vcm[0] + vcm[1] * vcm[1] + vcm[2] * vcm[2]; // add heat via scale factor on velocities for CONSTANT and EQUAL cases // scale = velocity scale factor to accomplish eflux change in energy // vsub = velocity subtracted from each atom to preserve momentum // overall KE cannot go negative - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); if (hstyle != ATOM) { - heat = heat_input*nevery*update->dt*force->ftm2v; - double escale = - (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); - if (escale < 0.0) error->all(FLERR,"Fix heat kinetic energy went negative"); + heat = heat_input * nevery * update->dt * force->ftm2v; + double escale = (ke + heat - 0.5 * vcmsq * masstotal) / (ke - 0.5 * vcmsq * masstotal); + if (escale < 0.0) error->all(FLERR, "Fix heat kinetic energy went negative"); scale = sqrt(escale); - vsub[0] = (scale-1.0) * vcm[0]; - vsub[1] = (scale-1.0) * vcm[1]; - vsub[2] = (scale-1.0) * vcm[2]; + vsub[0] = (scale - 1.0) * vcm[0]; + vsub[1] = (scale - 1.0) * vcm[1]; + vsub[2] = (scale - 1.0) * vcm[2]; - if (iregion < 0) { + if (region) { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - v[i][0] = scale*v[i][0] - vsub[0]; - v[i][1] = scale*v[i][1] - vsub[1]; - v[i][2] = scale*v[i][2] - vsub[2]; + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { + v[i][0] = scale * v[i][0] - vsub[0]; + v[i][1] = scale * v[i][1] - vsub[1]; + v[i][2] = scale * v[i][2] - vsub[2]; } } else { for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { - v[i][0] = scale*v[i][0] - vsub[0]; - v[i][1] = scale*v[i][1] - vsub[1]; - v[i][2] = scale*v[i][2] - vsub[2]; + if (mask[i] & groupbit) { + v[i][0] = scale * v[i][0] - vsub[0]; + v[i][1] = scale * v[i][1] - vsub[1]; + v[i][2] = scale * v[i][2] - vsub[2]; } } - // add heat via per-atom scale factor on velocities for ATOM case - // vscale = velocity scale factor to accomplish eflux change in energy - // vsub = velocity subtracted from each atom to preserve momentum - // KE of an atom cannot go negative + // add heat via per-atom scale factor on velocities for ATOM case + // vscale = velocity scale factor to accomplish eflux change in energy + // vsub = velocity subtracted from each atom to preserve momentum + // KE of an atom cannot go negative } else { vsub[0] = vsub[1] = vsub[2] = 0.0; - if (iregion < 0) { + if (region) { for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - heat = vheat[i]*nevery*update->dt*force->ftm2v; - vscale[i] = - (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { + heat = vheat[i] * nevery * update->dt * force->ftm2v; + vscale[i] = (ke + heat - 0.5 * vcmsq * masstotal) / (ke - 0.5 * vcmsq * masstotal); if (vscale[i] < 0.0) - error->all(FLERR, - "Fix heat kinetic energy of an atom went negative"); + error->all(FLERR, "Fix heat kinetic energy of an atom went negative"); scale = sqrt(vscale[i]); - if (rmass) massone = rmass[i]; - else massone = mass[type[i]]; - vsub[0] += (scale-1.0) * v[i][0]*massone; - vsub[1] += (scale-1.0) * v[i][1]*massone; - vsub[2] += (scale-1.0) * v[i][2]*massone; + if (rmass) + massone = rmass[i]; + else + massone = mass[type[i]]; + vsub[0] += (scale - 1.0) * v[i][0] * massone; + vsub[1] += (scale - 1.0) * v[i][1] * massone; + vsub[2] += (scale - 1.0) * v[i][2] * massone; } } @@ -252,28 +246,27 @@ void FixHeat::end_of_step() vsub[2] /= masstotal; for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { scale = sqrt(vscale[i]); - v[i][0] = scale*v[i][0] - vsub[0]; - v[i][1] = scale*v[i][1] - vsub[1]; - v[i][2] = scale*v[i][2] - vsub[2]; + v[i][0] = scale * v[i][0] - vsub[0]; + v[i][1] = scale * v[i][1] - vsub[1]; + v[i][2] = scale * v[i][2] - vsub[2]; } - } else { for (i = 0; i < nlocal; i++) { - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { - heat = vheat[i]*nevery*update->dt*force->ftm2v; - vscale[i] = - (ke + heat - 0.5*vcmsq*masstotal)/(ke - 0.5*vcmsq*masstotal); + if (mask[i] & groupbit) { + heat = vheat[i] * nevery * update->dt * force->ftm2v; + vscale[i] = (ke + heat - 0.5 * vcmsq * masstotal) / (ke - 0.5 * vcmsq * masstotal); if (vscale[i] < 0.0) - error->all(FLERR, - "Fix heat kinetic energy of an atom went negative"); + error->all(FLERR, "Fix heat kinetic energy of an atom went negative"); scale = sqrt(vscale[i]); - if (rmass) massone = rmass[i]; - else massone = mass[type[i]]; - vsub[0] += (scale-1.0) * v[i][0]*massone; - vsub[1] += (scale-1.0) * v[i][1]*massone; - vsub[2] += (scale-1.0) * v[i][2]*massone; + if (rmass) + massone = rmass[i]; + else + massone = mass[type[i]]; + vsub[0] += (scale - 1.0) * v[i][0] * massone; + vsub[1] += (scale - 1.0) * v[i][1] * massone; + vsub[2] += (scale - 1.0) * v[i][2] * massone; } } @@ -282,11 +275,11 @@ void FixHeat::end_of_step() vsub[2] /= masstotal; for (i = 0; i < nlocal; i++) - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { + if (mask[i] & groupbit) { scale = sqrt(vscale[i]); - v[i][0] = scale*v[i][0] - vsub[0]; - v[i][1] = scale*v[i][1] - vsub[1]; - v[i][2] = scale*v[i][2] - vsub[2]; + v[i][0] = scale * v[i][0] - vsub[0]; + v[i][1] = scale * v[i][1] - vsub[1]; + v[i][2] = scale * v[i][2] - vsub[2]; } } } @@ -304,18 +297,17 @@ double FixHeat::compute_scalar() int *mask = atom->mask; double **x = atom->x; int nlocal = atom->nlocal; - if (iregion < 0) { + if (region) { + region->prematch(); for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { + if (mask[i] & groupbit && region->match(x[i][0], x[i][1], x[i][2])) { scale_sum += sqrt(vscale[i]); ncount++; } } } else { - Region *region = domain->regions[iregion]; - region->prematch(); for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit && region->match(x[i][0],x[i][1],x[i][2])) { + if (mask[i] & groupbit) { scale_sum += sqrt(vscale[i]); ncount++; } @@ -323,10 +315,12 @@ double FixHeat::compute_scalar() } double scale_sum_all = 0.0; int ncount_all = 0; - MPI_Allreduce(&scale_sum,&scale_sum_all,1,MPI_DOUBLE,MPI_SUM,world); - MPI_Allreduce(&ncount,&ncount_all,1,MPI_INT,MPI_SUM,world); - if (ncount_all == 0) average_scale = 0.0; - else average_scale = scale_sum_all/static_cast(ncount_all); + MPI_Allreduce(&scale_sum, &scale_sum_all, 1, MPI_DOUBLE, MPI_SUM, world); + MPI_Allreduce(&ncount, &ncount_all, 1, MPI_INT, MPI_SUM, world); + if (ncount_all == 0) + average_scale = 0.0; + else + average_scale = scale_sum_all / static_cast(ncount_all); } return average_scale; } @@ -338,6 +332,6 @@ double FixHeat::compute_scalar() double FixHeat::memory_usage() { double bytes = 0.0; - if (hstyle == ATOM) bytes = atom->nmax*2 * sizeof(double); + if (hstyle == ATOM) bytes = atom->nmax * 2 * sizeof(double); return bytes; } diff --git a/src/fix_heat.h b/src/fix_heat.h index 5d1d9a5dfd..cc901545ed 100644 --- a/src/fix_heat.h +++ b/src/fix_heat.h @@ -35,11 +35,11 @@ class FixHeat : public Fix { double memory_usage() override; private: - int iregion; double heat_input; double masstotal; double scale; char *idregion; + class Region *region; char *hstr; int hstyle, hvar; @@ -52,47 +52,3 @@ class FixHeat : public Fix { #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: Region ID for fix heat does not exist - -Self-explanatory. - -E: Variable name for fix heat does not exist - -Self-explanatory. - -E: Variable for fix heat is invalid style - -Only equal-style or atom-style variables can be used. - -W: Cannot apply fix heat to atoms in rigid bodies - -UNDOCUMENTED - -E: Fix heat group has no atoms - -Self-explanatory. - -E: Fix heat group has invalid mass - -UNDOCUMENTED - -E: Fix heat kinetic energy went negative - -This will cause the velocity rescaling about to be performed by fix -heat to be invalid. - -E: Fix heat kinetic energy of an atom went negative - -This will cause the velocity rescaling about to be performed by fix -heat to be invalid. - -*/ diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 838d9bdaab..3f99d14a8c 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -155,7 +155,7 @@ void FixIndent::init() } if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -167,9 +167,9 @@ void FixIndent::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_indent.h b/src/fix_indent.h index 1fbfb2a785..d06132b80b 100644 --- a/src/fix_indent.h +++ b/src/fix_indent.h @@ -56,25 +56,3 @@ class FixIndent : public Fix { #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: Variable name for fix indent does not exist - -Self-explanatory. - -E: Variable for fix indent is invalid style - -Only equal-style variables can be used. - -E: Variable for fix indent is not equal style - -Only equal-style variables can be used. - -*/ diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 6e770689dc..98b8f5274a 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -270,7 +270,7 @@ void FixLangevin::init() } if (ascale) { - avec = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec = dynamic_cast( atom->style_match("ellipsoid")); if (!avec) error->all(FLERR,"Fix langevin angmom requires atom style ellipsoid"); @@ -306,7 +306,7 @@ void FixLangevin::init() else tbiasflag = NOBIAS; if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; if (utils::strmatch(update->integrate_style,"^respa") && gjfflag) error->all(FLERR,"Fix langevin gjf and respa are not compatible"); @@ -365,9 +365,9 @@ void FixLangevin::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } if (gjfflag) { double dtfm; diff --git a/src/fix_langevin.h b/src/fix_langevin.h index ca8ded2d0f..9eba98135d 100644 --- a/src/fix_langevin.h +++ b/src/fix_langevin.h @@ -85,76 +85,3 @@ class FixLangevin : public Fix { #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: Fix langevin period must be > 0.0 - -The time window for temperature relaxation must be > 0 - -E: Fix langevin omega requires atom style sphere - -Self-explanatory. - -E: Fix langevin angmom requires atom style ellipsoid - -Self-explanatory. - -E: Variable name for fix langevin does not exist - -Self-explanatory. - -E: Variable for fix langevin is invalid style - -It must be an equal-style variable. - -E: Fix langevin omega requires extended particles - -One of the particles has radius 0.0. - -E: Fix langevin angmom requires extended particles - -This fix option cannot be used with point particles. - -E: Cannot zero Langevin force of 0 atoms - -The group has zero atoms, so you cannot request its force -be zeroed. - -E: Fix langevin variable returned negative temperature - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -E: Fix langevin gjf cannot have period equal to dt/2 - -If the period is equal to dt/2 then division by zero will happen. - -E: Fix langevin gjf should come before fix nve - -Self-explanatory - -E: Fix langevin gjf and respa are not compatible - -Self-explanatory - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/fix_lineforce.cpp b/src/fix_lineforce.cpp index 90901534ad..d9408efb48 100644 --- a/src/fix_lineforce.cpp +++ b/src/fix_lineforce.cpp @@ -62,11 +62,11 @@ void FixLineForce::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - int nlevels_respa = ((Respa *) update->integrate)->nlevels; + int nlevels_respa = (dynamic_cast( update->integrate))->nlevels; for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); post_force_respa(vflag,ilevel,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } } } diff --git a/src/fix_lineforce.h b/src/fix_lineforce.h index b5564a521d..ae0ae3b6a4 100644 --- a/src/fix_lineforce.h +++ b/src/fix_lineforce.h @@ -42,13 +42,3 @@ class FixLineForce : public Fix { #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. - -*/ diff --git a/src/fix_minimize.h b/src/fix_minimize.h index 8b5536dc68..4cafc0e0d6 100644 --- a/src/fix_minimize.h +++ b/src/fix_minimize.h @@ -57,6 +57,3 @@ class FixMinimize : public Fix { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/fix_momentum.h b/src/fix_momentum.h index 4adbf80be8..dcf9b3dbbb 100644 --- a/src/fix_momentum.h +++ b/src/fix_momentum.h @@ -41,17 +41,3 @@ class FixMomentum : public Fix { #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: Fix momentum group has no atoms - -Self-explanatory. - -*/ diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 756292d06b..37e8647671 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -295,10 +295,10 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : // AtomVec pointers to retrieve per-atom storage of extra quantities - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - avec_line = (AtomVecLine *) atom->style_match("line"); - avec_tri = (AtomVecTri *) atom->style_match("tri"); - avec_body = (AtomVecBody *) atom->style_match("body"); + avec_ellipsoid = dynamic_cast(atom->style_match("ellipsoid")); + avec_line = dynamic_cast(atom->style_match("line")); + avec_tri = dynamic_cast(atom->style_match("tri")); + avec_body = dynamic_cast(atom->style_match("body")); // xoriginal = initial unwrapped positions of atoms // toriginal = initial theta of lines @@ -495,7 +495,7 @@ void FixMove::init() velocity = nullptr; if (utils::strmatch(update->integrate_style, "^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast(update->integrate))->nlevels; } /* ---------------------------------------------------------------------- @@ -1218,7 +1218,7 @@ void FixMove::write_restart(FILE *fp) void FixMove::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; time_origin = static_cast(list[n++]); } diff --git a/src/fix_move.h b/src/fix_move.h index b3579db0b7..e6b253a2a2 100644 --- a/src/fix_move.h +++ b/src/fix_move.h @@ -83,53 +83,3 @@ class FixMove : public Fix { #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: Fix move cannot set linear z motion for 2d problem - -Self-explanatory. - -E: Fix move cannot set wiggle z motion for 2d problem - -Self-explanatory. - -E: Fix move cannot rotate around non z-axis for 2d problem - -UNDOCUMENTED - -E: Fix move cannot define z or vz variable for 2d problem - -Self-explanatory. - -E: Zero length rotation vector with fix move - -Self-explanatory. - -E: Variable name for fix move does not exist - -Self-explanatory. - -E: Variable for fix move is invalid style - -Only equal-style variables can be used. - -E: Cannot add atoms to fix move variable - -Atoms can not be added afterwards to this fix option. - -E: Resetting timestep size is not allowed with fix move - -This is because fix move is moving atoms based on elapsed time. - -U: Fix move cannot rotate aroung non z-axis for 2d problem - -Self-explanatory. - -*/ diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index 05df4d078c..7413b590a7 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -628,14 +628,16 @@ void FixNeighHistory::post_neighbor() j = jlist[jj]; if (use_bit_flag) { - rflag = sbmask(j) | pair->beyond_contact; - j &= NEIGHMASK; + rflag = histmask(j) | pair->beyond_contact; + j &= HISTMASK; jlist[jj] = j; } else { rflag = 1; - j &= NEIGHMASK; } + // Remove special bond bits + j &= NEIGHMASK; + // rflag = 1 if r < radsum in npair_size() method or if pair interactions extend further // preserve neigh history info if tag[j] is in old-neigh partner list // this test could be more geometrically precise for two sphere/line/tri diff --git a/src/fix_neigh_history.h b/src/fix_neigh_history.h index ba31f7cd3c..0cfa6c399c 100644 --- a/src/fix_neigh_history.h +++ b/src/fix_neigh_history.h @@ -93,41 +93,11 @@ class FixNeighHistory : public Fix { virtual void pre_exchange_no_newton(); void allocate_pages(); - inline int sbmask(int j) const { return j >> SBBITS & 3; } + // Shift by HISTBITS and check the first bit + inline int histmask(int j) const { return j >> HISTBITS & 1; } }; } // namespace LAMMPS_NS #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Neighbor history requires atoms have IDs - -UNDOCUMENTED - -E: Neighbor history overflow, boost neigh_modify one - -UNDOCUMENTED - -E: Unsupported comm mode in neighbor history - -UNDOCUMENTED - -U: Pair style granular with history requires atoms have IDs - -Atoms in the simulation do not have IDs, so history effects -cannot be tracked by the granular pair potential. - -U: Shear history overflow, boost neigh_modify one - -There are too many neighbors of a single atom. Use the neigh_modify -command to increase the max number of neighbors allowed for one atom. -You may also want to boost the page size. - -*/ diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 28c0cafc60..cb0408a50c 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -648,7 +648,7 @@ void FixNH::init() if (pstat_flag) for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2]) || (p_flag[3] && dimflag[3]) || (p_flag[4] && dimflag[4]) || (p_flag[5] && dimflag[5])) @@ -721,8 +721,8 @@ void FixNH::init() else kspace_flag = 0; if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - step_respa = ((Respa *) update->integrate)->step; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + step_respa = (dynamic_cast( update->integrate))->step; dto = 0.5*step_respa[0]; } @@ -1352,7 +1352,7 @@ int FixNH::pack_restart_data(double *list) void FixNH::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; int flag = static_cast (list[n++]); if (flag) { int m = static_cast (list[n++]); diff --git a/src/fix_nh.h b/src/fix_nh.h index 53fc815bab..422eb9d317 100644 --- a/src/fix_nh.h +++ b/src/fix_nh.h @@ -148,144 +148,3 @@ class FixNH : public Fix { } // namespace LAMMPS_NS #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: Target temperature for fix nvt/npt/nph cannot be 0.0 - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command for a 2d simulation - -Cannot control z dimension in a 2d model. - -E: Fix nvt/npt/nph dilate group ID does not exist - -Self-explanatory. - -E: Invalid fix nvt/npt/nph command pressure settings - -If multiple dimensions are coupled, those dimensions must be -specified. - -E: Cannot use fix nvt/npt/nph on a non-periodic dimension - -When specifying a diagonal pressure component, the dimension must be -periodic. - -E: Cannot use fix nvt/npt/nph on a 2nd non-periodic dimension - -When specifying an off-diagonal pressure component, the 2nd of the two -dimensions must be periodic. E.g. if the xy component is specified, -then the y dimension must be periodic. - -E: Cannot use fix nvt/npt/nph with yz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xz scaling when z is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with xy scaling when y is non-periodic dimension - -The 2nd dimension in the barostatted tilt factor must be periodic. - -E: Cannot use fix nvt/npt/nph with both yz dynamics and yz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xz dynamics and xz scaling - -Self-explanatory. - -E: Cannot use fix nvt/npt/nph with both xy dynamics and xy scaling - -Self-explanatory. - -E: Can not specify Pxy/Pxz/Pyz in fix nvt/npt/nph with non-triclinic box - -Only triclinic boxes can be used with off-diagonal pressure components. -See the region prism command for details. - -E: Invalid fix nvt/npt/nph pressure settings - -Settings for coupled dimensions must be the same. - -E: Using update dipole flag requires atom style sphere - -Self-explanatory. - -E: Using update dipole flag requires atom attribute mu - -Self-explanatory. - -E: Fix nvt/npt/nph damping parameters must be > 0.0 - -Self-explanatory. - -E: Thermostat in fix nvt/npt/nph is incompatible with ptemp command - -Self-explanatory. - -E: Cannot use fix npt and fix deform on same component of stress tensor - -This would be changing the same box dimension twice. - -E: Temperature ID for fix nvt/npt does not exist - -Self-explanatory. - -E: Pressure ID for fix npt/nph does not exist - -Self-explanatory. - -E: Current temperature too close to zero, consider using ptemp setting - -The current temperature is close to zero and may cause numerical instability. The user may want to specify a different target temperature using the ptemp setting. - -E: Non-numeric pressure - simulation unstable - -UNDOCUMENTED - -E: Fix npt/nph has tilted box too far in one step - periodic cell is too far from equilibrium state - -Self-explanatory. The change in the box tilt is too extreme -on a short timescale. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for fix modify is not for group all - -The temperature compute is being used with a pressure calculation -which does operate on group all, so this may be inconsistent. - -E: Pressure ID for fix modify does not exist - -Self-explanatory. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -U: The dlm flag must be used with update dipole - -Self-explanatory. - -*/ diff --git a/src/fix_nh_sphere.h b/src/fix_nh_sphere.h index 5e14bf466c..a63e2e1e11 100644 --- a/src/fix_nh_sphere.h +++ b/src/fix_nh_sphere.h @@ -35,23 +35,3 @@ class FixNHSphere : public FixNH { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Fix nvt/nph/npt sphere requires atom style sphere - -Self-explanatory. - -E: Fix nvt/nph/npt sphere disc option requires 2d simulation - -UNDOCUMENTED - -E: Fix nvt/npt/nph/sphere require extended particles - -UNDOCUMENTED - -U: Fix nvt/sphere requires extended particles - -This fix can only be used for particles of a finite size. - -*/ diff --git a/src/fix_nph.h b/src/fix_nph.h index 576b1afea1..93d94da161 100644 --- a/src/fix_nph.h +++ b/src/fix_nph.h @@ -33,15 +33,3 @@ class FixNPH : public FixNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph - -Self-explanatory. - -E: Pressure control must be used with fix nph - -Self-explanatory. - -*/ diff --git a/src/fix_nph_sphere.h b/src/fix_nph_sphere.h index 32a65b66ae..34eb62387f 100644 --- a/src/fix_nph_sphere.h +++ b/src/fix_nph_sphere.h @@ -33,15 +33,3 @@ class FixNPHSphere : public FixNHSphere { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control can not be used with fix nph/sphere - -Self-explanatory. - -E: Pressure control must be used with fix nph/sphere - -Self-explanatory. - -*/ diff --git a/src/fix_npt.h b/src/fix_npt.h index 9d7b5ad49e..b234a8afd1 100644 --- a/src/fix_npt.h +++ b/src/fix_npt.h @@ -33,15 +33,3 @@ class FixNPT : public FixNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt - -Self-explanatory. - -E: Pressure control must be used with fix npt - -Self-explanatory. - -*/ diff --git a/src/fix_npt_sphere.h b/src/fix_npt_sphere.h index 59f66f47f3..087c47ccb1 100644 --- a/src/fix_npt_sphere.h +++ b/src/fix_npt_sphere.h @@ -33,15 +33,3 @@ class FixNPTSphere : public FixNHSphere { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix npt/sphere - -Self-explanatory. - -E: Pressure control must be used with fix npt/sphere - -Self-explanatory. - -*/ diff --git a/src/fix_nve.cpp b/src/fix_nve.cpp index 0ac89f5e26..728036128a 100644 --- a/src/fix_nve.cpp +++ b/src/fix_nve.cpp @@ -55,7 +55,7 @@ void FixNVE::init() dtf = 0.5 * update->dt * force->ftm2v; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } /* ---------------------------------------------------------------------- diff --git a/src/fix_nve.h b/src/fix_nve.h index 01e52413fa..461455f76c 100644 --- a/src/fix_nve.h +++ b/src/fix_nve.h @@ -46,13 +46,3 @@ class FixNVE : public Fix { #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. - -*/ diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index 9aba474789..cb6d7c7302 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -67,7 +67,7 @@ void FixNVELimit::init() ncount = 0; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; // warn if using fix shake, which will lead to invalid constraint forces diff --git a/src/fix_nve_limit.h b/src/fix_nve_limit.h index bb548d7004..93e2d615eb 100644 --- a/src/fix_nve_limit.h +++ b/src/fix_nve_limit.h @@ -47,18 +47,3 @@ class FixNVELimit : public Fix { #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. - -W: Should not use fix nve/limit with fix shake or fix rattle - -This will lead to invalid constraint forces in the SHAKE/RATTLE -computation. - -*/ diff --git a/src/fix_nve_noforce.cpp b/src/fix_nve_noforce.cpp index de24c7fef0..d043dcbd4a 100644 --- a/src/fix_nve_noforce.cpp +++ b/src/fix_nve_noforce.cpp @@ -49,7 +49,7 @@ void FixNVENoforce::init() dtv = update->dt; if (utils::strmatch(update->integrate_style,"^respa")) - step_respa = ((Respa *) update->integrate)->step; + step_respa = (dynamic_cast( update->integrate))->step; } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_nve_noforce.h b/src/fix_nve_noforce.h index 362f62bb44..0c96dc3503 100644 --- a/src/fix_nve_noforce.h +++ b/src/fix_nve_noforce.h @@ -42,13 +42,3 @@ class FixNVENoforce : public Fix { #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. - -*/ diff --git a/src/fix_nve_sphere.h b/src/fix_nve_sphere.h index 86bcfb6b36..388443e338 100644 --- a/src/fix_nve_sphere.h +++ b/src/fix_nve_sphere.h @@ -42,33 +42,3 @@ class FixNVESphere : public FixNVE { #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: Fix nve/sphere disc requires 2d simulation - -UNDOCUMENTED - -E: Fix nve/sphere requires atom style sphere - -Self-explanatory. - -E: Fix nve/sphere update dipole requires atom attribute mu - -An atom style with this attribute is needed. - -E: Fix nve/sphere requires extended particles - -This fix can only be used for particles of a finite size. - -U: Fix nve/sphere dlm must be used with update dipole - -The DLM algorithm can only be used in conjunction with update dipole. - -*/ diff --git a/src/fix_nvt.h b/src/fix_nvt.h index 375055ac6f..e5f7051015 100644 --- a/src/fix_nvt.h +++ b/src/fix_nvt.h @@ -33,15 +33,3 @@ class FixNVT : public FixNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt - -Self-explanatory. - -E: Pressure control can not be used with fix nvt - -Self-explanatory. - -*/ diff --git a/src/fix_nvt_sllod.cpp b/src/fix_nvt_sllod.cpp index bc5d3f7298..8c5116c070 100644 --- a/src/fix_nvt_sllod.cpp +++ b/src/fix_nvt_sllod.cpp @@ -73,7 +73,7 @@ void FixNVTSllod::init() int i; for (i = 0; i < modify->nfix; i++) if (strncmp(modify->fix[i]->style,"deform",6) == 0) { - if (((FixDeform *) modify->fix[i])->remapflag != Domain::V_REMAP) + if ((dynamic_cast( modify->fix[i]))->remapflag != Domain::V_REMAP) error->all(FLERR,"Using fix nvt/sllod with inconsistent fix deform " "remap option"); break; diff --git a/src/fix_nvt_sllod.h b/src/fix_nvt_sllod.h index 57e17cf3b8..13d002af82 100644 --- a/src/fix_nvt_sllod.h +++ b/src/fix_nvt_sllod.h @@ -40,28 +40,3 @@ class FixNVTSllod : public FixNH { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/sllod - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/sllod - -Self-explanatory. - -E: Temperature for fix nvt/sllod does not have a bias - -The specified compute must compute temperature with a bias. - -E: Using fix nvt/sllod with inconsistent fix deform remap option - -Fix nvt/sllod requires that deforming atoms have a velocity profile -provided by "remap v" as a fix deform option. - -E: Using fix nvt/sllod with no fix deform defined - -Self-explanatory. - -*/ diff --git a/src/fix_nvt_sphere.h b/src/fix_nvt_sphere.h index d2e89bdd0c..f8deede163 100644 --- a/src/fix_nvt_sphere.h +++ b/src/fix_nvt_sphere.h @@ -33,15 +33,3 @@ class FixNVTSphere : public FixNHSphere { #endif #endif - -/* ERROR/WARNING messages: - -E: Temperature control must be used with fix nvt/sphere - -Self-explanatory. - -E: Pressure control can not be used with fix nvt/sphere - -Self-explanatory. - -*/ diff --git a/src/fix_planeforce.cpp b/src/fix_planeforce.cpp index baad522ec6..0d91f2b90e 100644 --- a/src/fix_planeforce.cpp +++ b/src/fix_planeforce.cpp @@ -62,11 +62,11 @@ void FixPlaneForce::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - int nlevels_respa = ((Respa *) update->integrate)->nlevels; + int nlevels_respa = (dynamic_cast( update->integrate))->nlevels; for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) { - ((Respa *) update->integrate)->copy_flevel_f(ilevel); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel); post_force_respa(vflag,ilevel,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel); } } } diff --git a/src/fix_planeforce.h b/src/fix_planeforce.h index 8253192777..3709c25a4c 100644 --- a/src/fix_planeforce.h +++ b/src/fix_planeforce.h @@ -42,13 +42,3 @@ class FixPlaneForce : public Fix { #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. - -*/ diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index e03e943eb5..f80acce8c4 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -270,7 +270,7 @@ void FixPressBerendsen::init() for (int i = 0; i < modify->nfix; i++) if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = ((FixDeform *) modify->fix[i])->dimflag; + int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2])) error->all(FLERR,"Cannot use fix press/berendsen and " diff --git a/src/fix_press_berendsen.h b/src/fix_press_berendsen.h index 33399605fd..87364ac601 100644 --- a/src/fix_press_berendsen.h +++ b/src/fix_press_berendsen.h @@ -60,70 +60,3 @@ class FixPressBerendsen : public Fix { #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: Invalid fix press/berendsen for a 2d simulation - -The z component of pressure cannot be controlled for a 2d model. - -E: Invalid fix press/berendsen pressure settings - -Settings for coupled dimensions must be the same. - -E: Cannot use fix press/berendsen on a non-periodic dimension - -Self-explanatory. - -E: Fix press/berendsen damping parameters must be > 0.0 - -Self-explanatory. - -E: Cannot use fix press/berendsen with triclinic box - -Self-explanatory. - -E: Cannot use fix press/berendsen and fix deform on same component of stress tensor - -These commands both change the box size/shape, so you cannot use both -together. - -E: Temperature ID for fix press/berendsen does not exist - -Self-explanatory. - -E: Pressure ID for fix press/berendsen does not exist - -The compute ID needed to compute pressure for the fix does not -exist. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Temperature for NPT is not for group all - -User-assigned temperature to NPT fix does not compute temperature for -all atoms. Since NPT computes a global pressure, the kinetic energy -contribution from the temperature is assumed to also be for all atoms. -Thus the pressure used by NPT could be inaccurate. - -E: Could not find fix_modify pressure ID - -The compute ID for computing pressure does not exist. - -E: Fix_modify pressure ID does not compute pressure - -The compute ID assigned to the fix must compute pressure. - -*/ diff --git a/src/fix_print.cpp b/src/fix_print.cpp index df5b5f77ff..47810c7e48 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -158,7 +158,7 @@ void FixPrint::end_of_step() modify->clearstep_compute(); - strcpy(copy,text); + strncpy(copy,text,maxcopy); input->substitute(copy,work,maxcopy,maxwork,0); if (var_print) { diff --git a/src/fix_print.h b/src/fix_print.h index 079c339798..c73cd7d28b 100644 --- a/src/fix_print.h +++ b/src/fix_print.h @@ -47,17 +47,3 @@ class FixPrint : public Fix { #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: Cannot open fix print file %s - -The output file generated by the fix print command cannot be opened - -*/ diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index 0e91a5f3fb..a6a1b997e3 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,21 +25,20 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{MOLECULE,CHARGE,RMASS,IVEC,DVEC,IARRAY,DARRAY}; +enum { MOLECULE, CHARGE, RMASS, IVEC, DVEC, IARRAY, DARRAY }; /* ---------------------------------------------------------------------- */ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - nvalue(0), styles(nullptr), index(nullptr), astyle(nullptr) + Fix(lmp, narg, arg), nvalue(0), styles(nullptr), index(nullptr), astyle(nullptr) { - if (narg < 4) error->all(FLERR,"Illegal fix property/atom command"); + if (narg < 4) error->all(FLERR, "Illegal fix property/atom command"); restart_peratom = 1; wd_section = 1; int iarg = 3; - nvalue = narg-iarg; + nvalue = narg - iarg; styles = new int[nvalue]; cols = new int[nvalue]; index = new int[nvalue]; @@ -53,33 +51,30 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : values_peratom = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"mol") == 0) { + if (strcmp(arg[iarg], "mol") == 0) { if (atom->molecule_flag) - error->all(FLERR,"Fix property/atom mol when atom_style already has molecule attribute"); - if (molecule_flag) - error->all(FLERR,"Fix property/atom cannot specify mol twice"); + error->all(FLERR, "Fix property/atom mol when atom_style already has molecule attribute"); + if (molecule_flag) error->all(FLERR, "Fix property/atom cannot specify mol twice"); styles[nvalue] = MOLECULE; cols[nvalue] = 0; atom->molecule_flag = molecule_flag = 1; values_peratom++; nvalue++; iarg++; - } else if (strcmp(arg[iarg],"q") == 0) { + } else if (strcmp(arg[iarg], "q") == 0) { if (atom->q_flag) - error->all(FLERR,"Fix property/atom q when atom_style already has charge attribute"); - if (q_flag) - error->all(FLERR,"Fix property/atom cannot specify q twice"); + error->all(FLERR, "Fix property/atom q when atom_style already has charge attribute"); + if (q_flag) error->all(FLERR, "Fix property/atom cannot specify q twice"); styles[nvalue] = CHARGE; cols[nvalue] = 0; atom->q_flag = q_flag = 1; values_peratom++; nvalue++; iarg++; - } else if (strcmp(arg[iarg],"rmass") == 0) { + } else if (strcmp(arg[iarg], "rmass") == 0) { if (atom->rmass_flag) - error->all(FLERR,"Fix property/atom rmass when atom_style already has rmass attribute"); - if (rmass_flag) - error->all(FLERR,"Fix property/atom cannot specify rmass twice"); + error->all(FLERR, "Fix property/atom rmass when atom_style already has rmass attribute"); + if (rmass_flag) error->all(FLERR, "Fix property/atom cannot specify rmass twice"); styles[nvalue] = RMASS; cols[nvalue] = 0; atom->rmass_flag = rmass_flag = 1; @@ -87,51 +82,49 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : nvalue++; iarg++; - // custom atom vector + // custom atom vector - } else if (utils::strmatch(arg[iarg],"^i_")) { + } else if (utils::strmatch(arg[iarg], "^i_")) { styles[nvalue] = IVEC; - int flag,ncols; - index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols); - if (index[nvalue] >= 0) - error->all(FLERR,"Fix property/atom vector name already exists"); + int flag, ncols; + index[nvalue] = atom->find_custom(&arg[iarg][2], flag, ncols); + if (index[nvalue] >= 0) error->all(FLERR, "Fix property/atom vector name already exists"); if (ReadData::is_data_section(id)) - error->all(FLERR,"Fix property/atom fix ID must not be a data file section name"); - index[nvalue] = atom->add_custom(&arg[iarg][2],0,0); + error->all(FLERR, "Fix property/atom fix ID must not be a data file section name"); + index[nvalue] = atom->add_custom(&arg[iarg][2], 0, 0); cols[nvalue] = 0; values_peratom++; nvalue++; iarg++; - } else if (utils::strmatch(arg[iarg],"^d_")) { + } else if (utils::strmatch(arg[iarg], "^d_")) { styles[nvalue] = DVEC; - int flag,ncols; - index[nvalue] = atom->find_custom(&arg[iarg][2],flag,ncols); - if (index[nvalue] >= 0) - error->all(FLERR,"Fix property/atom vector name already exists"); + int flag, ncols; + index[nvalue] = atom->find_custom(&arg[iarg][2], flag, ncols); + if (index[nvalue] >= 0) error->all(FLERR, "Fix property/atom vector name already exists"); if (ReadData::is_data_section(id)) - error->all(FLERR,"Fix property/atom fix ID must not be a data file section name"); - index[nvalue] = atom->add_custom(&arg[iarg][2],1,0); + error->all(FLERR, "Fix property/atom fix ID must not be a data file section name"); + index[nvalue] = atom->add_custom(&arg[iarg][2], 1, 0); cols[nvalue] = 0; values_peratom++; nvalue++; iarg++; - // custom atom array + // custom atom array - } else if (utils::strmatch(arg[iarg],"^[id]2_")) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); + } else if (utils::strmatch(arg[iarg], "^[id]2_")) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix property/atom command"); - int which,flag,ncols; - which = atom->find_custom(&arg[iarg][3],flag,ncols); + int which, flag, ncols; + which = atom->find_custom(&arg[iarg][3], flag, ncols); if (which >= 0) - error->all(FLERR,"Fix property/atom array name {} already exists", &arg[iarg][3]); + error->all(FLERR, "Fix property/atom array name {} already exists", &arg[iarg][3]); if (ReadData::is_data_section(id)) - error->all(FLERR,"Fix property/atom fix ID must not be a data file section name"); + error->all(FLERR, "Fix property/atom fix ID must not be a data file section name"); - ncols = utils::inumeric(FLERR,arg[iarg+1],true,lmp); + ncols = utils::inumeric(FLERR, arg[iarg + 1], true, lmp); if (ncols < 1) - error->all(FLERR,"Invalid array columns number {} in fix property/atom", ncols); + error->all(FLERR, "Invalid array columns number {} in fix property/atom", ncols); if (arg[iarg][0] == 'i') { which = 0; @@ -140,26 +133,28 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : which = 1; styles[nvalue] = DARRAY; } - index[nvalue] = atom->add_custom(&arg[iarg][3],which,ncols); + index[nvalue] = atom->add_custom(&arg[iarg][3], which, ncols); cols[nvalue] = ncols; values_peratom += ncols; nvalue++; iarg += 2; - // no match + // no match - } else break; + } else + break; } // optional args border = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"ghost") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix property/atom command"); - border = utils::logical(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "ghost") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix property/atom command"); + border = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix property/atom command"); + } else + error->all(FLERR, "Illegal fix property/atom command"); } if (border) comm_border = values_peratom; @@ -169,12 +164,9 @@ FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : if (border == 0) { int flag = 0; for (int i = 0; i < nvalue; i++) - if (styles[i] == MOLECULE - || styles[i] == CHARGE - || styles[i] == RMASS) flag = 1; + if (styles[i] == MOLECULE || styles[i] == CHARGE || styles[i] == RMASS) flag = 1; if (flag && comm->me == 0) - error->warning(FLERR,"Fix property/atom mol or charge or rmass " - "w/out ghost communication"); + error->warning(FLERR, "Fix property/atom mol or charge or rmass w/out ghost communication"); } // store current atom style @@ -197,9 +189,9 @@ FixPropertyAtom::~FixPropertyAtom() { // unregister callbacks to this fix from Atom class - atom->delete_callback(id,Atom::GROW); - atom->delete_callback(id,Atom::RESTART); - if (border) atom->delete_callback(id,Atom::BORDER); + atom->delete_callback(id, Atom::GROW); + atom->delete_callback(id, Atom::RESTART); + if (border) atom->delete_callback(id, Atom::BORDER); // deallocate per-atom vectors in Atom class // set ptrs to a null pointer, so they no longer exist for Atom class @@ -218,20 +210,20 @@ FixPropertyAtom::~FixPropertyAtom() memory->destroy(atom->rmass); atom->rmass = nullptr; } else if (styles[nv] == IVEC) { - atom->remove_custom(index[nv],0,cols[nv]); + atom->remove_custom(index[nv], 0, cols[nv]); } else if (styles[nv] == DVEC) { - atom->remove_custom(index[nv],1,cols[nv]); + atom->remove_custom(index[nv], 1, cols[nv]); } else if (styles[nv] == IARRAY) { - atom->remove_custom(index[nv],0,cols[nv]); + atom->remove_custom(index[nv], 0, cols[nv]); } else if (styles[nv] == DARRAY) { - atom->remove_custom(index[nv],1,cols[nv]); + atom->remove_custom(index[nv], 1, cols[nv]); } } - delete [] styles; - delete [] cols; - delete [] index; - delete [] astyle; + delete[] styles; + delete[] cols; + delete[] index; + delete[] astyle; } /* ---------------------------------------------------------------------- */ @@ -249,8 +241,8 @@ void FixPropertyAtom::init() // error if atom style has changed since fix was defined // don't allow this because user could change to style that defines molecule,q - if (strcmp(astyle,atom->atom_style) != 0) - error->all(FLERR,"Atom style was redefined after using fix property/atom"); + if (strcmp(astyle, atom->atom_style) != 0) + error->all(FLERR, "Atom style was redefined after using fix property/atom"); } /* ---------------------------------------------------------------------- @@ -260,7 +252,7 @@ void FixPropertyAtom::init() void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint id_offset) { - int j,k,m,ncol; + int j, k, m, ncol; tagint itag; char *next; @@ -278,18 +270,18 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint tagint map_tag_max = atom->map_tag_max; for (int i = 0; i < n; i++) { - next = strchr(buf,'\n'); + next = strchr(buf, '\n'); *next = '\0'; try { ValueTokenizer values(buf); - if ((int)values.count() != values_peratom+1) - error->all(FLERR,"Incorrect format in {} section of data file: {}" - " expected {} and got {}",keyword,buf,values_peratom+1,values.count()); + if ((int) values.count() != values_peratom + 1) + error->all(FLERR, "Incorrect format in {} section of data file: {} expected {} and got {}", + keyword, buf, values_peratom + 1, values.count()); itag = values.next_tagint() + id_offset; if (itag <= 0 || itag > map_tag_max) - error->all(FLERR,"Invalid atom ID {} in {} section of data file",itag, keyword); + error->all(FLERR, "Invalid atom ID {} in {} section of data file", itag, keyword); // assign words in line to per-atom vectors @@ -307,17 +299,16 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, tagint atom->dvector[index[j]][m] = values.next_double(); } else if (styles[j] == IARRAY) { ncol = cols[j]; - for (k = 0; k < ncol; k++) - atom->iarray[index[j]][m][k] = values.next_int(); + for (k = 0; k < ncol; k++) atom->iarray[index[j]][m][k] = values.next_int(); } else if (styles[j] == DARRAY) { ncol = cols[j]; - for (k = 0; k < ncol; k++) - atom->darray[index[j]][m][k] = values.next_double(); + for (k = 0; k < ncol; k++) atom->darray[index[j]][m][k] = values.next_double(); } } } } catch (TokenizerException &e) { - error->all(FLERR,"Invalid format in {} section of data file '{}': {}",keyword, buf,e.what()); + error->all(FLERR, "Invalid format in {} section of data file '{}': {}", keyword, buf, + e.what()); } buf = next + 1; } @@ -357,7 +348,7 @@ void FixPropertyAtom::write_data_section_size(int /*mth*/, int &nx, int &ny) void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf) { - int i,k,ncol; + int i, k, ncol; // 1st column = atom tag // rest of columns = per-atom values @@ -393,15 +384,13 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf) int **iarray = atom->iarray[index[nv]]; ncol = cols[nv]; for (i = 0; i < nlocal; i++) - for (k = 0; k < ncol; k++) - buf[i][icol+k] = ubuf(iarray[i][k]).d; + for (k = 0; k < ncol; k++) buf[i][icol + k] = ubuf(iarray[i][k]).d; icol += ncol; } else if (styles[nv] == DARRAY) { double **darray = atom->darray[index[nv]]; ncol = cols[nv]; for (i = 0; i < nlocal; i++) - for (k = 0; k < ncol; k++) - buf[i][icol+k] = darray[i][k]; + for (k = 0; k < ncol; k++) buf[i][icol + k] = darray[i][k]; icol += ncol; } } @@ -416,21 +405,30 @@ void FixPropertyAtom::write_data_section_pack(int /*mth*/, double **buf) void FixPropertyAtom::write_data_section_keyword(int /*mth*/, FILE *fp) { - if (nvalue == 1 && styles[0] == MOLECULE) fprintf(fp,"\nMolecules\n\n"); - else if (nvalue == 1 && styles[0] == CHARGE) fprintf(fp,"\nCharges\n\n"); + if (nvalue == 1 && styles[0] == MOLECULE) + fprintf(fp, "\nMolecules\n\n"); + else if (nvalue == 1 && styles[0] == CHARGE) + fprintf(fp, "\nCharges\n\n"); else { - fprintf(fp,"\n%s #",id); + fprintf(fp, "\n%s #", id); // write column hint as comment for (int i = 0; i < nvalue; ++i) { - if (styles[i] == MOLECULE) fputs(" mol",fp); - else if (styles[i] == CHARGE) fputs(" q",fp); - else if (styles[i] == RMASS) fputs(" rmass",fp); - else if (styles[i] == IVEC) fprintf(fp," i_%s", atom->ivname[index[i]]); - else if (styles[i] == DVEC) fprintf(fp, " d_%s", atom->dvname[index[i]]); - else if (styles[i] == IARRAY) fprintf(fp, " i_%s", atom->ianame[index[i]]); - else if (styles[i] == DARRAY) fprintf(fp, " d_%s", atom->daname[index[i]]); + if (styles[i] == MOLECULE) + fputs(" mol", fp); + else if (styles[i] == CHARGE) + fputs(" q", fp); + else if (styles[i] == RMASS) + fputs(" rmass", fp); + else if (styles[i] == IVEC) + fprintf(fp, " i_%s", atom->ivname[index[i]]); + else if (styles[i] == DVEC) + fprintf(fp, " d_%s", atom->dvname[index[i]]); + else if (styles[i] == IARRAY) + fprintf(fp, " i_%s", atom->ianame[index[i]]); + else if (styles[i] == DARRAY) + fprintf(fp, " d_%s", atom->daname[index[i]]); } - fputs("\n\n",fp); + fputs("\n\n", fp); } } @@ -441,39 +439,36 @@ void FixPropertyAtom::write_data_section_keyword(int /*mth*/, FILE *fp) only called by proc 0 ------------------------------------------------------------------------- */ -void FixPropertyAtom::write_data_section(int /*mth*/, FILE *fp, - int n, double **buf, int /*index*/) +void FixPropertyAtom::write_data_section(int /*mth*/, FILE *fp, int n, double **buf, int /*index*/) { - int k,icol,ncol,nv; + int k, icol, ncol, nv; std::string line; for (int i = 0; i < n; i++) { - line = fmt::format("{}",(tagint) ubuf(buf[i][0]).i); + line = fmt::format("{}", (tagint) ubuf(buf[i][0]).i); icol = 1; for (nv = 0; nv < nvalue; nv++) { if (styles[nv] == MOLECULE) - line += fmt::format(" {}",(tagint) ubuf(buf[i][icol++]).i); + line += fmt::format(" {}", (tagint) ubuf(buf[i][icol++]).i); else if (styles[nv] == CHARGE) - line += fmt::format(" {}",buf[i][icol++]); + line += fmt::format(" {}", buf[i][icol++]); else if (styles[nv] == RMASS) - line += fmt::format(" {}",buf[i][icol++]); + line += fmt::format(" {}", buf[i][icol++]); else if (styles[nv] == IVEC) - line += fmt::format(" {}",(int) ubuf(buf[i][icol++]).i); + line += fmt::format(" {}", (int) ubuf(buf[i][icol++]).i); else if (styles[nv] == DVEC) - line += fmt::format(" {}",buf[i][icol++]); + line += fmt::format(" {}", buf[i][icol++]); else if (styles[nv] == IARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - line += fmt::format(" {}",(int) ubuf(buf[i][icol+k]).i); + for (k = 0; k < ncol; k++) line += fmt::format(" {}", (int) ubuf(buf[i][icol + k]).i); icol += ncol; } else if (styles[nv] == DARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - line += fmt::format(" {}",buf[i][icol+k]); + for (k = 0; k < ncol; k++) line += fmt::format(" {}", buf[i][icol + k]); icol += ncol; } } - fmt::print(fp,line+"\n"); + fmt::print(fp, line + "\n"); } } @@ -485,13 +480,20 @@ double FixPropertyAtom::memory_usage() { double bytes = 0.0; for (int m = 0; m < nvalue; m++) { - if (styles[m] == MOLECULE) bytes = atom->nmax * sizeof(tagint); - else if (styles[m] == CHARGE) bytes = atom->nmax * sizeof(double); - else if (styles[m] == RMASS) bytes = atom->nmax * sizeof(double); - else if (styles[m] == IVEC) bytes = atom->nmax * sizeof(int); - else if (styles[m] == DVEC) bytes = atom->nmax * sizeof(double); - else if (styles[m] == IARRAY) bytes = (size_t) atom->nmax * cols[m] * sizeof(int); - else if (styles[m] == DARRAY) bytes = (size_t) atom->nmax * cols[m] * sizeof(double); + if (styles[m] == MOLECULE) + bytes = atom->nmax * sizeof(tagint); + else if (styles[m] == CHARGE) + bytes = atom->nmax * sizeof(double); + else if (styles[m] == RMASS) + bytes = atom->nmax * sizeof(double); + else if (styles[m] == IVEC) + bytes = atom->nmax * sizeof(int); + else if (styles[m] == DVEC) + bytes = atom->nmax * sizeof(double); + else if (styles[m] == IARRAY) + bytes = (size_t) atom->nmax * cols[m] * sizeof(int); + else if (styles[m] == DARRAY) + bytes = (size_t) atom->nmax * cols[m] * sizeof(double); } return bytes; } @@ -507,33 +509,33 @@ void FixPropertyAtom::grow_arrays(int nmax) { for (int nv = 0; nv < nvalue; nv++) { if (styles[nv] == MOLECULE) { - memory->grow(atom->molecule,nmax,"atom:molecule"); - size_t nbytes = (nmax-nmax_old) * sizeof(tagint); - memset(&atom->molecule[nmax_old],0,nbytes); + memory->grow(atom->molecule, nmax, "atom:molecule"); + size_t nbytes = (nmax - nmax_old) * sizeof(tagint); + memset(&atom->molecule[nmax_old], 0, nbytes); } else if (styles[nv] == CHARGE) { - memory->grow(atom->q,nmax,"atom:q"); - size_t nbytes = (nmax-nmax_old) * sizeof(double); - memset(&atom->q[nmax_old],0,nbytes); + memory->grow(atom->q, nmax, "atom:q"); + size_t nbytes = (nmax - nmax_old) * sizeof(double); + memset(&atom->q[nmax_old], 0, nbytes); } else if (styles[nv] == RMASS) { - memory->grow(atom->rmass,nmax,"atom:rmass"); - size_t nbytes = (nmax-nmax_old) * sizeof(double); - memset(&atom->rmass[nmax_old],0,nbytes); + memory->grow(atom->rmass, nmax, "atom:rmass"); + size_t nbytes = (nmax - nmax_old) * sizeof(double); + memset(&atom->rmass[nmax_old], 0, nbytes); } else if (styles[nv] == IVEC) { - memory->grow(atom->ivector[index[nv]],nmax,"atom:ivector"); - size_t nbytes = (nmax-nmax_old) * sizeof(int); - memset(&atom->ivector[index[nv]][nmax_old],0,nbytes); + memory->grow(atom->ivector[index[nv]], nmax, "atom:ivector"); + size_t nbytes = (nmax - nmax_old) * sizeof(int); + memset(&atom->ivector[index[nv]][nmax_old], 0, nbytes); } else if (styles[nv] == DVEC) { - memory->grow(atom->dvector[index[nv]],nmax,"atom:dvector"); - size_t nbytes = (nmax-nmax_old) * sizeof(double); - memset(&atom->dvector[index[nv]][nmax_old],0,nbytes); + memory->grow(atom->dvector[index[nv]], nmax, "atom:dvector"); + size_t nbytes = (nmax - nmax_old) * sizeof(double); + memset(&atom->dvector[index[nv]][nmax_old], 0, nbytes); } else if (styles[nv] == IARRAY) { - memory->grow(atom->iarray[index[nv]],nmax,cols[nv],"atom:iarray"); - size_t nbytes = (size_t) (nmax-nmax_old) * cols[nv] * sizeof(int); - if (nbytes) memset(&atom->iarray[index[nv]][nmax_old][0],0,nbytes); + memory->grow(atom->iarray[index[nv]], nmax, cols[nv], "atom:iarray"); + size_t nbytes = (size_t) (nmax - nmax_old) * cols[nv] * sizeof(int); + if (nbytes) memset(&atom->iarray[index[nv]][nmax_old][0], 0, nbytes); } else if (styles[nv] == DARRAY) { - memory->grow(atom->darray[index[nv]],nmax,cols[nv],"atom:darray"); - size_t nbytes = (size_t) (nmax-nmax_old) * cols[nv] * sizeof(double); - if (nbytes) memset(&atom->darray[index[nv]][nmax_old][0],0,nbytes); + memory->grow(atom->darray[index[nv]], nmax, cols[nv], "atom:darray"); + size_t nbytes = (size_t) (nmax - nmax_old) * cols[nv] * sizeof(double); + if (nbytes) memset(&atom->darray[index[nv]][nmax_old][0], 0, nbytes); } } @@ -546,7 +548,7 @@ void FixPropertyAtom::grow_arrays(int nmax) void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/) { - int k,ncol; + int k, ncol; for (int nv = 0; nv < nvalue; nv++) { if (styles[nv] == MOLECULE) @@ -561,12 +563,10 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/) atom->dvector[index[nv]][j] = atom->dvector[index[nv]][i]; else if (styles[nv] == IARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k]; + for (k = 0; k < ncol; k++) atom->iarray[index[nv]][j][k] = atom->iarray[index[nv]][i][k]; } else if (styles[nv] == DARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k]; + for (k = 0; k < ncol; k++) atom->darray[index[nv]][j][k] = atom->darray[index[nv]][i][k]; } } } @@ -577,7 +577,7 @@ void FixPropertyAtom::copy_arrays(int i, int j, int /*delflag*/) int FixPropertyAtom::pack_border(int n, int *list, double *buf) { - int i,j,k,ncol; + int i, j, k, ncol; int m = 0; for (int nv = 0; nv < nvalue; nv++) { @@ -616,16 +616,14 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf) ncol = cols[nv]; for (i = 0; i < n; i++) { j = list[i]; - for (k = 0; k < ncol; k++) - buf[m++] = ubuf(iarray[j][k]).d; + for (k = 0; k < ncol; k++) buf[m++] = ubuf(iarray[j][k]).d; } } else if (styles[nv] == DARRAY) { double **darray = atom->darray[index[nv]]; ncol = cols[nv]; for (i = 0; i < n; i++) { j = list[i]; - for (k = 0; k < ncol; k++) - buf[m++] = darray[j][k]; + for (k = 0; k < ncol; k++) buf[m++] = darray[j][k]; } } } @@ -639,49 +637,42 @@ int FixPropertyAtom::pack_border(int n, int *list, double *buf) int FixPropertyAtom::unpack_border(int n, int first, double *buf) { - int i,k,last,ncol; + int i, k, last, ncol; int m = 0; for (int nv = 0; nv < nvalue; nv++) { if (styles[nv] == MOLECULE) { tagint *molecule = atom->molecule; last = first + n; - for (i = first; i < last; i++) - molecule[i] = (tagint) ubuf(buf[m++]).i; + for (i = first; i < last; i++) molecule[i] = (tagint) ubuf(buf[m++]).i; } else if (styles[nv] == CHARGE) { double *q = atom->q; last = first + n; - for (i = first; i < last; i++) - q[i] = buf[m++]; + for (i = first; i < last; i++) q[i] = buf[m++]; } else if (styles[nv] == RMASS) { double *rmass = atom->rmass; last = first + n; - for (i = first; i < last; i++) - rmass[i] = buf[m++]; + for (i = first; i < last; i++) rmass[i] = buf[m++]; } else if (styles[nv] == IVEC) { int *ivector = atom->ivector[index[nv]]; last = first + n; - for (i = first; i < last; i++) - ivector[i] = (int) ubuf(buf[m++]).i; + for (i = first; i < last; i++) ivector[i] = (int) ubuf(buf[m++]).i; } else if (styles[nv] == DVEC) { double *dvector = atom->dvector[index[nv]]; last = first + n; - for (i = first; i < last; i++) - dvector[i] = buf[m++]; + for (i = first; i < last; i++) dvector[i] = buf[m++]; } else if (styles[nv] == IARRAY) { int **iarray = atom->iarray[index[nv]]; ncol = cols[nv]; last = first + n; for (i = first; i < last; i++) - for (k = 0; k < ncol; k++) - iarray[i][k] = (int) ubuf(buf[m++]).i; + for (k = 0; k < ncol; k++) iarray[i][k] = (int) ubuf(buf[m++]).i; } else if (styles[nv] == DARRAY) { double **darray = atom->darray[index[nv]]; ncol = cols[nv]; last = first + n; for (i = first; i < last; i++) - for (k = 0; k < ncol; k++) - darray[i][k] = buf[m++]; + for (k = 0; k < ncol; k++) darray[i][k] = buf[m++]; } } @@ -694,23 +685,26 @@ int FixPropertyAtom::unpack_border(int n, int first, double *buf) int FixPropertyAtom::pack_exchange(int i, double *buf) { - int k,ncol; + int k, ncol; int m = 0; for (int nv = 0; nv < nvalue; nv++) { - if (styles[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; - else if (styles[nv] == CHARGE) buf[m++] = atom->q[i]; - else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i]; - else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; - else if (styles[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; + if (styles[nv] == MOLECULE) + buf[m++] = ubuf(atom->molecule[i]).d; + else if (styles[nv] == CHARGE) + buf[m++] = atom->q[i]; + else if (styles[nv] == RMASS) + buf[m++] = atom->rmass[i]; + else if (styles[nv] == IVEC) + buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; + else if (styles[nv] == DVEC) + buf[m++] = atom->dvector[index[nv]][i]; else if (styles[nv] == IARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; + for (k = 0; k < ncol; k++) buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; } else if (styles[nv] == DARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - buf[m++] = atom->darray[index[nv]][i][k]; + for (k = 0; k < ncol; k++) buf[m++] = atom->darray[index[nv]][i][k]; } } @@ -723,7 +717,7 @@ int FixPropertyAtom::pack_exchange(int i, double *buf) int FixPropertyAtom::unpack_exchange(int nlocal, double *buf) { - int k,ncol; + int k, ncol; int m = 0; for (int nv = 0; nv < nvalue; nv++) { @@ -739,12 +733,10 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf) atom->dvector[index[nv]][nlocal] = buf[m++]; else if (styles[nv] == IARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i; + for (k = 0; k < ncol; k++) atom->iarray[index[nv]][nlocal][k] = (int) ubuf(buf[m++]).i; } else if (styles[nv] == DARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - atom->darray[index[nv]][nlocal][k] = buf[m++]; + for (k = 0; k < ncol; k++) atom->darray[index[nv]][nlocal][k] = buf[m++]; } } @@ -757,31 +749,34 @@ int FixPropertyAtom::unpack_exchange(int nlocal, double *buf) int FixPropertyAtom::pack_restart(int i, double *buf) { - int k,ncol; + int k, ncol; // pack buf[0] this way because other fixes unpack it - buf[0] = values_peratom+1; + buf[0] = values_peratom + 1; int m = 1; for (int nv = 0; nv < nvalue; nv++) { - if (styles[nv] == MOLECULE) buf[m++] = ubuf(atom->molecule[i]).d; - else if (styles[nv] == CHARGE) buf[m++] = atom->q[i]; - else if (styles[nv] == RMASS) buf[m++] = atom->rmass[i]; - else if (styles[nv] == IVEC) buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; - else if (styles[nv] == DVEC) buf[m++] = atom->dvector[index[nv]][i]; + if (styles[nv] == MOLECULE) + buf[m++] = ubuf(atom->molecule[i]).d; + else if (styles[nv] == CHARGE) + buf[m++] = atom->q[i]; + else if (styles[nv] == RMASS) + buf[m++] = atom->rmass[i]; + else if (styles[nv] == IVEC) + buf[m++] = ubuf(atom->ivector[index[nv]][i]).d; + else if (styles[nv] == DVEC) + buf[m++] = atom->dvector[index[nv]][i]; else if (styles[nv] == IARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; + for (k = 0; k < ncol; k++) buf[m++] = ubuf(atom->iarray[index[nv]][i][k]).d; } else if (styles[nv] == DARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - buf[m++] = atom->darray[index[nv]][i][k]; + for (k = 0; k < ncol; k++) buf[m++] = atom->darray[index[nv]][i][k]; } } - return values_peratom+1; + return values_peratom + 1; } /* ---------------------------------------------------------------------- @@ -790,14 +785,14 @@ int FixPropertyAtom::pack_restart(int i, double *buf) void FixPropertyAtom::unpack_restart(int nlocal, int nth) { - int k,ncol; + int k, ncol; double **extra = atom->extra; // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them int m = 0; - for (int i = 0; i < nth; i++) m += static_cast (extra[nlocal][m]); + for (int i = 0; i < nth; i++) m += static_cast(extra[nlocal][m]); m++; for (int nv = 0; nv < nvalue; nv++) { @@ -817,8 +812,7 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth) atom->iarray[index[nv]][nlocal][k] = (int) ubuf(extra[nlocal][m++]).i; } else if (styles[nv] == DARRAY) { ncol = cols[nv]; - for (k = 0; k < ncol; k++) - atom->darray[index[nv]][nlocal][k] = extra[nlocal][m++]; + for (k = 0; k < ncol; k++) atom->darray[index[nv]][nlocal][k] = extra[nlocal][m++]; } } } @@ -829,7 +823,7 @@ void FixPropertyAtom::unpack_restart(int nlocal, int nth) int FixPropertyAtom::maxsize_restart() { - return values_peratom+1; + return values_peratom + 1; } /* ---------------------------------------------------------------------- @@ -838,5 +832,5 @@ int FixPropertyAtom::maxsize_restart() int FixPropertyAtom::size_restart(int /*nlocal*/) { - return values_peratom+1; + return values_peratom + 1; } diff --git a/src/fix_property_atom.h b/src/fix_property_atom.h index 500ad6316c..760daa4b34 100644 --- a/src/fix_property_atom.h +++ b/src/fix_property_atom.h @@ -27,6 +27,7 @@ namespace LAMMPS_NS { class FixPropertyAtom : public Fix { public: FixPropertyAtom(class LAMMPS *, int, char **); + ~FixPropertyAtom() override; int setmask() override; void init() override; @@ -66,67 +67,3 @@ class FixPropertyAtom : public Fix { #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: Fix property/atom mol when atom_style already has molecule attribute - -Self-explanatory. - -E: Fix property/atom cannot specify mol twice - -Self-explanatory. - -E: Fix property/atom q when atom_style already has charge attribute - -Self-explanatory. - -E: Fix property/atom cannot specify q twice - -Self-explanatory. - -E: Fix property/atom rmass when atom_style already has rmass attribute - -UNDOCUMENTED - -E: Fix property/atom cannot specify rmass twice - -UNDOCUMENTED - -E: Fix property/atom vector name already exists - -The name for an integer or floating-point vector must be unique. - -W: Fix property/atom mol or charge or rmass w/out ghost communication - -UNDOCUMENTED - -E: Atom style was redefined after using fix property/atom - -This is not allowed. - -E: Incorrect %s format in data file - -A section of the data file being read by fix property/atom does -not have the correct number of values per line. - -E: Too few lines in %s section of data file - -Self-explanatory. - -E: Invalid atom ID in %s section of data file - -An atom in a section of the data file being read by fix property/atom -has an invalid atom ID that is <= 0 or > the maximum existing atom ID. - -U: Fix property/atom mol or charge w/out ghost communication - -A model typically needs these properties defined for ghost atoms. - -*/ diff --git a/src/fix_read_restart.h b/src/fix_read_restart.h index 49d03db052..0eb740f4d6 100644 --- a/src/fix_read_restart.h +++ b/src/fix_read_restart.h @@ -47,6 +47,3 @@ class FixReadRestart : public Fix { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/fix_recenter.cpp b/src/fix_recenter.cpp index 76e59014be..1f2fedc842 100644 --- a/src/fix_recenter.cpp +++ b/src/fix_recenter.cpp @@ -146,7 +146,7 @@ void FixRecenter::init() } if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_recenter.h b/src/fix_recenter.h index a2c7c9866d..6a4a7f0a2c 100644 --- a/src/fix_recenter.h +++ b/src/fix_recenter.h @@ -46,26 +46,3 @@ class FixRecenter : public Fix { #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: Could not find fix recenter group ID - -A group ID used in the fix recenter command does not exist. - -E: Fix recenter group has no atoms - -Self-explanatory. - -W: Fix recenter should come after all other integration fixes - -Other fixes may change the position of the center-of-mass, so -fix recenter should come last. - -*/ diff --git a/src/fix_respa.h b/src/fix_respa.h index b6b80711de..e5756e6be7 100644 --- a/src/fix_respa.h +++ b/src/fix_respa.h @@ -52,6 +52,3 @@ class FixRespa : public Fix { #endif #endif -/* ERROR/WARNING messages: - -*/ diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 6b190df997..8b97715ff6 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -185,7 +185,7 @@ int FixRestrain::setmask() void FixRestrain::init() { if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -197,9 +197,9 @@ void FixRestrain::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_restrain.h b/src/fix_restrain.h index 607927a5fb..35bb9abc5c 100644 --- a/src/fix_restrain.h +++ b/src/fix_restrain.h @@ -62,40 +62,3 @@ class FixRestrain : public Fix { #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: Fix restrain requires an atom map, see atom_modify - -Self-explanatory. - -E: Restrain atoms %d %d missing on proc %d at step %ld - -The 2 atoms in a restrain bond specified by the fix restrain -command are not all accessible to a processor. This probably means an -atom has moved too far. - -E: Restrain atoms %d %d %d missing on proc %d at step %ld - -The 3 atoms in a restrain angle specified by the fix restrain -command are not all accessible to a processor. This probably means an -atom has moved too far. - -E: Restrain atoms %d %d %d %d missing on proc %d at step %ld - -The 4 atoms in a restrain dihedral specified by the fix restrain -command are not all accessible to a processor. This probably means an -atom has moved too far. - -W: Restrain problem: %d %ld %d %d %d %d - -Conformation of the 4 listed dihedral atoms is extreme; you may want -to check your simulation geometry. - -*/ diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 75b79617b6..6a88e3ab17 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -30,15 +29,15 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{NONE,CONSTANT,EQUAL,ATOM}; +enum { NONE, CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), sforce(nullptr) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), + region(nullptr), sforce(nullptr) { - if (narg < 6) error->all(FLERR,"Illegal fix setforce command"); + if (narg < 6) error->all(FLERR, "Illegal fix setforce command"); dynamic_group_allow = 1; vector_flag = 1; @@ -47,55 +46,51 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : extvector = 1; respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = nullptr; - if (utils::strmatch(arg[3],"^v_")) { - xstr = utils::strdup(arg[3]+2); - } else if (strcmp(arg[3],"NULL") == 0) { + if (utils::strmatch(arg[3], "^v_")) { + xstr = utils::strdup(arg[3] + 2); + } else if (strcmp(arg[3], "NULL") == 0) { xstyle = NONE; } else { - xvalue = utils::numeric(FLERR,arg[3],false,lmp); + xvalue = utils::numeric(FLERR, arg[3], false, lmp); xstyle = CONSTANT; } - if (utils::strmatch(arg[4],"^v_")) { - ystr = utils::strdup(arg[4]+2); - } else if (strcmp(arg[4],"NULL") == 0) { + if (utils::strmatch(arg[4], "^v_")) { + ystr = utils::strdup(arg[4] + 2); + } else if (strcmp(arg[4], "NULL") == 0) { ystyle = NONE; } else { - yvalue = utils::numeric(FLERR,arg[4],false,lmp); + yvalue = utils::numeric(FLERR, arg[4], false, lmp); ystyle = CONSTANT; } - if (utils::strmatch(arg[5],"^v_")) { - zstr = utils::strdup(arg[5]+2); - } else if (strcmp(arg[5],"NULL") == 0) { + if (utils::strmatch(arg[5], "^v_")) { + zstr = utils::strdup(arg[5] + 2); + } else if (strcmp(arg[5], "NULL") == 0) { zstyle = NONE; } else { - zvalue = utils::numeric(FLERR,arg[5],false,lmp); + zvalue = utils::numeric(FLERR, arg[5], false, lmp); zstyle = CONSTANT; } // optional args - iregion = -1; - idregion = nullptr; - int iarg = 6; while (iarg < narg) { - if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix setforce command"); - iregion = domain->find_region(arg[iarg+1]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix setforce does not exist"); - idregion = utils::strdup(arg[iarg+1]); + if (strcmp(arg[iarg], "region") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix setforce command"); + region = domain->get_region_by_id(arg[iarg + 1]); + if (!region) error->all(FLERR, "Region {} for fix setforce does not exist", arg[iarg + 1]); + idregion = utils::strdup(arg[iarg + 1]); iarg += 2; - } else error->all(FLERR,"Illegal fix setforce command"); + } else + error->all(FLERR, "Illegal fix setforce command"); } force_flag = 0; foriginal[0] = foriginal[1] = foriginal[2] = 0.0; maxatom = 1; - memory->create(sforce,maxatom,3,"setforce:sforce"); + memory->create(sforce, maxatom, 3, "setforce:sforce"); } /* ---------------------------------------------------------------------- */ @@ -104,10 +99,10 @@ FixSetForce::~FixSetForce() { if (copymode) return; - delete [] xstr; - delete [] ystr; - delete [] zstr; - delete [] idregion; + delete[] xstr; + delete[] ystr; + delete[] zstr; + delete[] idregion; memory->destroy(sforce); } @@ -130,47 +125,55 @@ void FixSetForce::init() if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) - error->all(FLERR,"Variable name for fix setforce does not exist"); - if (input->variable->equalstyle(xvar)) xstyle = EQUAL; - else if (input->variable->atomstyle(xvar)) xstyle = ATOM; - else error->all(FLERR,"Variable for fix setforce is invalid style"); + if (xvar < 0) error->all(FLERR, "Variable {} for fix setforce does not exist", xstr); + if (input->variable->equalstyle(xvar)) + xstyle = EQUAL; + else if (input->variable->atomstyle(xvar)) + xstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix setforce is invalid style", xstr); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) - error->all(FLERR,"Variable name for fix setforce does not exist"); - if (input->variable->equalstyle(yvar)) ystyle = EQUAL; - else if (input->variable->atomstyle(yvar)) ystyle = ATOM; - else error->all(FLERR,"Variable for fix setforce is invalid style"); + if (yvar < 0) error->all(FLERR, "Variable {} for fix setforce does not exist", ystr); + if (input->variable->equalstyle(yvar)) + ystyle = EQUAL; + else if (input->variable->atomstyle(yvar)) + ystyle = ATOM; + else + error->all(FLERR, "Variable {} for fix setforce is invalid style", ystr); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) - error->all(FLERR,"Variable name for fix setforce does not exist"); - if (input->variable->equalstyle(zvar)) zstyle = EQUAL; - else if (input->variable->atomstyle(zvar)) zstyle = ATOM; - else error->all(FLERR,"Variable for fix setforce is invalid style"); + if (zvar < 0) error->all(FLERR, "Variable {} for fix setforce does not exist", zstr); + if (input->variable->equalstyle(zvar)) + zstyle = EQUAL; + else if (input->variable->atomstyle(zvar)) + zstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix setforce is invalid style", zstr); } // set index and check validity of region - if (iregion >= 0) { - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix setforce does not exist"); + if (idregion) { + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix setforce does not exist", idregion); } if (xstyle == ATOM || ystyle == ATOM || zstyle == ATOM) varflag = ATOM; else if (xstyle == EQUAL || ystyle == EQUAL || zstyle == EQUAL) varflag = EQUAL; - else varflag = CONSTANT; + else + varflag = CONSTANT; - if (utils::strmatch(update->integrate_style,"^respa")) { - nlevels_respa = ((Respa *) update->integrate)->nlevels; - if (respa_level >= 0) ilevel_respa = MIN(respa_level,nlevels_respa-1); - else ilevel_respa = nlevels_respa-1; + if (utils::strmatch(update->integrate_style, "^respa")) { + nlevels_respa = (dynamic_cast(update->integrate))->nlevels; + if (respa_level >= 0) + ilevel_respa = MIN(respa_level, nlevels_respa - 1); + else + ilevel_respa = nlevels_respa - 1; } // cannot use non-zero forces for a minimization since no energy is integrated @@ -185,21 +188,20 @@ void FixSetForce::init() if (ystyle == CONSTANT && yvalue != 0.0) flag = 1; if (zstyle == CONSTANT && zvalue != 0.0) flag = 1; } - if (flag) - error->all(FLERR,"Cannot use non-zero forces in an energy minimization"); + if (flag) error->all(FLERR, "Cannot use non-zero forces in an energy minimization"); } /* ---------------------------------------------------------------------- */ void FixSetForce::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(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); + (dynamic_cast(update->integrate))->copy_flevel_f(ilevel); + post_force_respa(vflag, ilevel, 0); + (dynamic_cast(update->integrate))->copy_f_flevel(ilevel); } } @@ -221,18 +223,14 @@ void FixSetForce::post_force(int /*vflag*/) // update region if necessary - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); // reallocate sforce array if necessary if (varflag == ATOM && atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(sforce); - memory->create(sforce,maxatom,3,"setforce:sforce"); + memory->create(sforce, maxatom, 3, "setforce:sforce"); } foriginal[0] = foriginal[1] = foriginal[2] = 0.0; @@ -241,7 +239,7 @@ void FixSetForce::post_force(int /*vflag*/) if (varflag == CONSTANT) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal[0] += f[i][0]; foriginal[1] += f[i][1]; foriginal[2] += f[i][2]; @@ -250,36 +248,45 @@ void FixSetForce::post_force(int /*vflag*/) if (zstyle) f[i][2] = zvalue; } - // variable force, wrap with clear/add + // variable force, wrap with clear/add } else { modify->clearstep_compute(); - if (xstyle == EQUAL) xvalue = input->variable->compute_equal(xvar); + if (xstyle == EQUAL) + xvalue = input->variable->compute_equal(xvar); else if (xstyle == ATOM) - input->variable->compute_atom(xvar,igroup,&sforce[0][0],3,0); - if (ystyle == EQUAL) yvalue = input->variable->compute_equal(yvar); + input->variable->compute_atom(xvar, igroup, &sforce[0][0], 3, 0); + if (ystyle == EQUAL) + yvalue = input->variable->compute_equal(yvar); else if (ystyle == ATOM) - input->variable->compute_atom(yvar,igroup,&sforce[0][1],3,0); - if (zstyle == EQUAL) zvalue = input->variable->compute_equal(zvar); + input->variable->compute_atom(yvar, igroup, &sforce[0][1], 3, 0); + if (zstyle == EQUAL) + zvalue = input->variable->compute_equal(zvar); else if (zstyle == ATOM) - input->variable->compute_atom(zvar,igroup,&sforce[0][2],3,0); + input->variable->compute_atom(zvar, igroup, &sforce[0][2], 3, 0); modify->addstep_compute(update->ntimestep + 1); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal[0] += f[i][0]; foriginal[1] += f[i][1]; foriginal[2] += f[i][2]; - if (xstyle == ATOM) f[i][0] = sforce[i][0]; - else if (xstyle) f[i][0] = xvalue; - if (ystyle == ATOM) f[i][1] = sforce[i][1]; - else if (ystyle) f[i][1] = yvalue; - if (zstyle == ATOM) f[i][2] = sforce[i][2]; - else if (zstyle) f[i][2] = zvalue; + if (xstyle == ATOM) + f[i][0] = sforce[i][0]; + else if (xstyle) + f[i][0] = xvalue; + if (ystyle == ATOM) + f[i][1] = sforce[i][1]; + else if (ystyle) + f[i][1] = yvalue; + if (zstyle == ATOM) + f[i][2] = sforce[i][2]; + else if (zstyle) + f[i][2] = zvalue; } } } @@ -298,11 +305,7 @@ void FixSetForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) foriginal[1] += foriginal_saved[1]; foriginal[2] += foriginal_saved[2]; } else { - Region *region = nullptr; - if (iregion >= 0) { - region = domain->regions[iregion]; - region->prematch(); - } + if (region) region->prematch(); double **x = atom->x; double **f = atom->f; @@ -311,7 +314,7 @@ void FixSetForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; + if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; foriginal_saved[0] += f[i][0]; foriginal_saved[1] += f[i][1]; foriginal_saved[2] += f[i][2]; @@ -338,7 +341,7 @@ double FixSetForce::compute_vector(int n) // only sum across procs one time if (force_flag == 0) { - MPI_Allreduce(foriginal,foriginal_all,3,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(foriginal, foriginal_all, 3, MPI_DOUBLE, MPI_SUM, world); force_flag = 1; } return foriginal_all[n]; @@ -351,6 +354,6 @@ double FixSetForce::compute_vector(int n) double FixSetForce::memory_usage() { double bytes = 0.0; - if (varflag == ATOM) bytes = maxatom*3 * sizeof(double); + if (varflag == ATOM) bytes = maxatom * 3 * sizeof(double); return bytes; } diff --git a/src/fix_setforce.h b/src/fix_setforce.h index ea242ba954..5dc29509af 100644 --- a/src/fix_setforce.h +++ b/src/fix_setforce.h @@ -41,9 +41,10 @@ class FixSetForce : public Fix { protected: double xvalue, yvalue, zvalue; - int varflag, iregion; + int varflag; char *xstr, *ystr, *zstr; char *idregion; + class Region *region; int xvar, yvar, zvar, xstyle, ystyle, zstyle; double foriginal[3], foriginal_all[3], foriginal_saved[3]; int force_flag; @@ -57,30 +58,3 @@ class FixSetForce : public Fix { #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: Region ID for fix setforce does not exist - -Self-explanatory. - -E: Variable name for fix setforce does not exist - -Self-explanatory. - -E: Variable for fix setforce is invalid style - -Only equal-style variables can be used. - -E: Cannot use non-zero forces in an energy minimization - -Fix setforce cannot be used in this manner. Use fix addforce -instead. - -*/ diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index dc3001c0fc..46310ef181 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -130,7 +130,7 @@ void FixSpring::init() if (styleflag == COUPLE) masstotal2 = group->mass(igroup2); if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -142,9 +142,9 @@ void FixSpring::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_spring.h b/src/fix_spring.h index 4180658a2f..07f9e010f2 100644 --- a/src/fix_spring.h +++ b/src/fix_spring.h @@ -57,25 +57,3 @@ class FixSpring : public Fix { #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: R0 < 0 for fix spring command - -Equilibrium spring length is invalid. - -E: Fix spring couple group ID does not exist - -Self-explanatory. - -E: Two groups cannot be the same in fix spring couple - -Self-explanatory. - -*/ diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index 90db93b9ad..411f056645 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -68,7 +68,7 @@ FixSpringChunk::~FixSpringChunk() int icompute = modify->find_compute(idchunk); if (icompute >= 0) { - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); cchunk->unlock(this); cchunk->lockcount--; } @@ -97,14 +97,14 @@ void FixSpringChunk::init() int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for fix spring/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Fix spring/chunk does not use chunk/atom compute"); icompute = modify->find_compute(idcom); if (icompute < 0) error->all(FLERR,"Com/chunk compute does not exist for fix spring/chunk"); - ccom = (ComputeCOMChunk *) modify->compute[icompute]; + ccom = dynamic_cast( modify->compute[icompute]); if (strcmp(ccom->style,"com/chunk") != 0) error->all(FLERR,"Fix spring/chunk does not use com/chunk compute"); @@ -114,7 +114,7 @@ void FixSpringChunk::init() error->all(FLERR,"Fix spring chunk chunkID not same as comID chunkID"); if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -126,9 +126,9 @@ void FixSpringChunk::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } @@ -262,7 +262,7 @@ void FixSpringChunk::write_restart(FILE *fp) void FixSpringChunk::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; int n = list[0]; memory->destroy(com0); @@ -271,7 +271,7 @@ void FixSpringChunk::restart(char *buf) int icompute = modify->find_compute(idchunk); if (icompute < 0) error->all(FLERR,"Chunk/atom compute does not exist for fix spring/chunk"); - cchunk = (ComputeChunkAtom *) modify->compute[icompute]; + cchunk = dynamic_cast( modify->compute[icompute]); if (strcmp(cchunk->style,"chunk/atom") != 0) error->all(FLERR,"Fix spring/chunk does not use chunk/atom compute"); nchunk = cchunk->setup_chunks(); diff --git a/src/fix_spring_chunk.h b/src/fix_spring_chunk.h index 181bced917..a025a85c28 100644 --- a/src/fix_spring_chunk.h +++ b/src/fix_spring_chunk.h @@ -56,45 +56,3 @@ class FixSpringChunk : public Fix { #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: Chunk/atom compute does not exist for fix spring/chunk - -UNDOCUMENTED - -E: Fix spring/chunk does not use chunk/atom compute - -UNDOCUMENTED - -E: Com/chunk compute does not exist for fix spring/chunk - -UNDOCUMENTED - -E: Fix spring/chunk does not use com/chunk compute - -UNDOCUMENTED - -E: Fix spring chunk chunkID not same as comID chunkID - -UNDOCUMENTED - -U: R0 < 0 for fix spring command - -Equilibrium spring length is invalid. - -U: Fix spring couple group ID does not exist - -Self-explanatory. - -U: Two groups cannot be the same in fix spring couple - -Self-explanatory. - -*/ diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 5ea8bffd01..180f7427ec 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -122,7 +122,7 @@ int FixSpringSelf::setmask() void FixSpringSelf::init() { if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -134,9 +134,9 @@ void FixSpringSelf::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_spring_self.h b/src/fix_spring_self.h index ca957fd845..20d97d80bf 100644 --- a/src/fix_spring_self.h +++ b/src/fix_spring_self.h @@ -58,13 +58,3 @@ class FixSpringSelf : public Fix { #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. - -*/ diff --git a/src/fix_store.cpp b/src/fix_store.cpp index eb23fbad97..759e71a955 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -187,7 +187,7 @@ void FixStore::restart(char *buf) { // first 2 values in buf are vec/array sizes - double *dbuf = (double *) buf; + auto dbuf = (double *) buf; int nrow_restart = dbuf[0]; int ncol_restart = dbuf[1]; diff --git a/src/fix_store.h b/src/fix_store.h index d1b58db155..bde2cdb08f 100644 --- a/src/fix_store.h +++ b/src/fix_store.h @@ -62,13 +62,3 @@ class FixStore : public Fix { #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. - -*/ diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp index f7832cd599..8e696c075c 100644 --- a/src/fix_store_force.cpp +++ b/src/fix_store_force.cpp @@ -70,7 +70,7 @@ int FixStoreForce::setmask() void FixStoreForce::init() { if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = ((Respa *) update->integrate)->nlevels; + nlevels_respa = (dynamic_cast( update->integrate))->nlevels; } /* ---------------------------------------------------------------------- */ @@ -80,9 +80,9 @@ void FixStoreForce::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); - ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); } } diff --git a/src/fix_store_force.h b/src/fix_store_force.h index adbd3573c4..4b5aefcbda 100644 --- a/src/fix_store_force.h +++ b/src/fix_store_force.h @@ -47,13 +47,3 @@ class FixStoreForce : public Fix { #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. - -*/ diff --git a/src/fix_store_local.cpp b/src/fix_store_local.cpp new file mode 100644 index 0000000000..a61e8b58b0 --- /dev/null +++ b/src/fix_store_local.cpp @@ -0,0 +1,125 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/ 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 "fix_store_local.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "memory.h" +#include "update.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +#define DELTA 1024 + +/* ---------------------------------------------------------------------- */ + +FixStoreLocal::FixStoreLocal(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), nvalues(0), vector(nullptr), array(nullptr) +{ + if (narg != 5) error->all(FLERR, "Illegal fix store/local command"); + local_flag = 1; + + nreset = utils::inumeric(FLERR, arg[3], false, lmp); + if (nreset <= 0) error->all(FLERR, "Illegal fix store/local command"); + local_freq = nreset; + + nvalues = utils::inumeric(FLERR, arg[4], false, lmp); + + if (nvalues <= 0) error->all(FLERR, "Illegal fix store/local command"); + if (nvalues == 1) + size_local_cols = 0; + else + size_local_cols = nvalues; + size_local_rows = 0; + + vector = nullptr; + array = nullptr; + nmax = 0; + ncount = 0; +} + +/* ---------------------------------------------------------------------- */ + +FixStoreLocal::~FixStoreLocal() +{ + memory->destroy(vector); + memory->destroy(array); +} + +/* ---------------------------------------------------------------------- */ + +int FixStoreLocal::setmask() +{ + int mask = 0; + mask |= POST_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixStoreLocal::add_data(double *input_data, int i, int j) +{ + int *mask = atom->mask; + if (!(mask[i] & groupbit)) return; + if (!(mask[j] & groupbit)) return; + + if (ncount >= nmax) reallocate(ncount); + + // fill vector or array with local values + if (nvalues == 1) { + vector[ncount] = input_data[0]; + } else { + for (int n = 0; n < nvalues; n++) array[ncount][n] = input_data[n]; + } + + ncount += 1; +} + +/* ---------------------------------------------------------------------- */ + +void FixStoreLocal::post_force(int /*vflag*/) +{ + if (update->ntimestep % nreset == 0) { + size_local_rows = ncount; + ncount = 0; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixStoreLocal::reallocate(int n) +{ + // grow vector or array + while (nmax <= n) nmax += DELTA; + + if (nvalues == 1) { + memory->grow(vector, nmax, "fix_store_local:vector"); + vector_local = vector; + } else { + memory->grow(array, nmax, nvalues, "fix_store_local:array"); + array_local = array; + } +} + +/* ---------------------------------------------------------------------- + memory usage of local data +------------------------------------------------------------------------- */ + +double FixStoreLocal::memory_usage() +{ + double bytes = (double) nmax * (double) nvalues * sizeof(double); + return bytes; +} diff --git a/src/fix_store_local.h b/src/fix_store_local.h new file mode 100644 index 0000000000..6ff867f645 --- /dev/null +++ b/src/fix_store_local.h @@ -0,0 +1,52 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/ 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 +// clang-format off +FixStyle(STORE_LOCAL,FixStoreLocal); +// clang-format on +#else + +#ifndef LMP_FIX_STORE_LOCAL_H +#define LMP_FIX_STORE_LOCAL_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixStoreLocal : public Fix { + public: + FixStoreLocal(class LAMMPS *, int, char **); + ~FixStoreLocal() override; + int setmask() override; + void post_force(int) override; + double memory_usage() override; + void add_data(double *, int, int); + int nvalues; + + private: + int nmax; + + double *vector; + double **array; + + int ncount; + int nreset; + + void reallocate(int); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/fix_store_state.h b/src/fix_store_state.h index b7237dbc14..245d54c8e5 100644 --- a/src/fix_store_state.h +++ b/src/fix_store_state.h @@ -118,82 +118,3 @@ class FixStoreState : public Fix { #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: Fix store/state for atom property that isn't allocated - -Self-explanatory. - -E: Compute ID for fix store/state does not exist - -Self-explanatory. - -E: Fix store/state compute does not calculate per-atom values - -Computes that calculate global or local quantities cannot be used -with fix store/state. - -E: Fix store/state compute does not calculate a per-atom vector - -The compute calculates a per-atom vector. - -E: Fix store/state compute does not calculate a per-atom array - -The compute calculates a per-atom vector. - -E: Fix store/state compute array is accessed out-of-range - -Self-explanatory. - -E: Custom integer vector for fix store/state does not exist - -The command is accessing a vector added by the fix property/atom -command, that does not exist. - -E: Custom floating point vector for fix store/state does not exist - -The command is accessing a vector added by the fix property/atom -command, that does not exist. - -E: Fix ID for fix store/state does not exist - -Self-explanatory - -E: Fix store/state fix does not calculate per-atom values - -Fixes that calculate global or local quantities cannot be used with -fix store/state. - -E: Fix store/state fix does not calculate a per-atom vector - -The fix calculates a per-atom array. - -E: Fix store/state fix does not calculate a per-atom array - -The fix calculates a per-atom vector. - -E: Fix store/state fix array is accessed out-of-range - -Self-explanatory. - -E: Fix for fix store/state not computed at compatible time - -Fixes generate their values on specific timesteps. Fix store/state -is requesting a value on a non-allowed timestep. - -E: Variable name for fix store/state does not exist - -Self-explanatory. - -E: Fix store/state variable is not atom-style variable - -Only atom-style variables calculate per-atom quantities. - -*/ diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 19ec4b52bd..26c14e842d 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -258,7 +258,7 @@ void FixTempBerendsen::write_restart(FILE *fp) void FixTempBerendsen::restart(char *buf) { - double *list = (double *) buf; + auto list = (double *) buf; energy = list[0]; } diff --git a/src/fix_temp_berendsen.h b/src/fix_temp_berendsen.h index ec6381086a..a2fe84ad26 100644 --- a/src/fix_temp_berendsen.h +++ b/src/fix_temp_berendsen.h @@ -54,55 +54,3 @@ class FixTempBerendsen : public Fix { #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: Fix temp/berendsen period must be > 0.0 - -Self-explanatory. - -E: Variable name for fix temp/berendsen does not exist - -Self-explanatory. - -E: Variable for fix temp/berendsen is invalid style - -Only equal-style variables can be used. - -E: Temperature ID for fix temp/berendsen does not exist - -Self-explanatory. - -W: Cannot thermostat atoms in rigid bodies - -UNDOCUMENTED - -E: Computed temperature for fix temp/berendsen cannot be 0.0 - -Self-explanatory. - -E: Fix temp/berendsen variable returned negative temperature - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 2b3db70d4b..41fb49e3f4 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -256,7 +256,7 @@ void FixTempRescale::write_restart(FILE *fp) void FixTempRescale::restart(char *buf) { int n = 0; - double *list = (double *) buf; + auto list = (double *) buf; energy = list[n++]; } diff --git a/src/fix_temp_rescale.h b/src/fix_temp_rescale.h index 058cf7cefe..b1ca81e724 100644 --- a/src/fix_temp_rescale.h +++ b/src/fix_temp_rescale.h @@ -54,48 +54,3 @@ class FixTempRescale : public Fix { #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: Variable name for fix temp/rescale does not exist - -Self-explanatory. - -E: Variable for fix temp/rescale is invalid style - -Only equal-style variables can be used. - -E: Temperature ID for fix temp/rescale does not exist - -Self-explanatory. - -E: Computed temperature for fix temp/rescale cannot be 0.0 - -Cannot rescale the temperature to a new value if the current -temperature is 0.0. - -E: Fix temp/rescale variable returned negative temperature - -Self-explanatory. - -E: Could not find fix_modify temperature ID - -The compute ID for computing temperature does not exist. - -E: Fix_modify temperature ID does not compute temperature - -The compute ID assigned to the fix must compute temperature. - -W: Group for fix_modify temp != fix group - -The fix_modify command is specifying a temperature computation that -computes a temperature on a different group of atoms than the fix -itself operates on. This is probably not what you want to do. - -*/ diff --git a/src/fix_thermal_conductivity.h b/src/fix_thermal_conductivity.h index e502e8496a..6d7cfc39ad 100644 --- a/src/fix_thermal_conductivity.h +++ b/src/fix_thermal_conductivity.h @@ -50,26 +50,3 @@ class FixThermalConductivity : public Fix { #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: Fix thermal/conductivity swap value must be positive - -Self-explanatory. - -W: Fix thermal/conductivity comes before fix ave/spatial - -The order of these 2 fixes in your input script is such that fix -thermal/conductivity comes first. If you are using fix ave/spatial to -measure the temperature profile induced by fix viscosity, then this -may cause a glitch in the profile since you are averaging immediately -after swaps have occurred. Flipping the order of the 2 fixes -typically helps. - -*/ diff --git a/src/fix_update_special_bonds.cpp b/src/fix_update_special_bonds.cpp new file mode 100644 index 0000000000..c31aefd28d --- /dev/null +++ b/src/fix_update_special_bonds.cpp @@ -0,0 +1,176 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 "fix_update_special_bonds.h" + +#include "atom.h" +#include "atom_vec.h" +#include "error.h" +#include "force.h" +#include "neigh_list.h" +#include "neighbor.h" +#include "pair.h" + +#include + +using namespace LAMMPS_NS; +using namespace FixConst; + +/* ---------------------------------------------------------------------- */ + +FixUpdateSpecialBonds::FixUpdateSpecialBonds(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg != 3) error->all(FLERR, "Illegal fix update/special/bonds command"); +} + +/* ---------------------------------------------------------------------- */ + +int FixUpdateSpecialBonds::setmask() +{ + int mask = 0; + mask |= PRE_EXCHANGE; + mask |= PRE_FORCE; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixUpdateSpecialBonds::setup(int /*vflag*/) +{ + // Require atoms know about all of their bonds and if they break + if (force->newton_bond) error->all(FLERR, "Fix update/special/bonds requires Newton bond off"); + + if (!atom->avec->bonds_allow) error->all(FLERR, "Fix update/special/bonds requires atom bonds"); + + // special lj must be 0 1 1 to censor pair forces between bonded particles + // special coulomb must be 1 1 1 to ensure all pairs are included in the + // neighbor list and 1-3 and 1-4 special bond lists are skipped + if (force->special_lj[1] != 0.0 || force->special_lj[2] != 1.0 || force->special_lj[3] != 1.0) + error->all(FLERR, "Fix update/special/bonds requires special LJ weights = 0,1,1"); + if (force->special_coul[1] != 1.0 || force->special_coul[2] != 1.0 || + force->special_coul[3] != 1.0) + error->all(FLERR, "Fix update/special/bonds requires special Coulomb weights = 1,1,1"); + + new_broken_pairs.clear(); + broken_pairs.clear(); +} + +/* ---------------------------------------------------------------------- + Update special bond list and atom bond arrays, empty broken bond list +------------------------------------------------------------------------- */ + +void FixUpdateSpecialBonds::pre_exchange() +{ + int i, j, m, n1, n3; + tagint tagi, tagj; + int nlocal = atom->nlocal; + + tagint *slist; + int **nspecial = atom->nspecial; + tagint **special = atom->special; + + for (auto const &it : broken_pairs) { + tagi = it.first; + tagj = it.second; + + i = atom->map(tagi); + j = atom->map(tagj); + + // remove i from special bond list for atom j and vice versa + if (i < nlocal) { + slist = special[i]; + n1 = nspecial[i][0]; + for (m = 0; m < n1; m++) + if (slist[m] == tagj) break; + n3 = nspecial[i][2]; + for (; m < n3 - 1; m++) slist[m] = slist[m + 1]; + nspecial[i][0]--; + nspecial[i][1]--; + nspecial[i][2]--; + } + + if (j < nlocal) { + slist = special[j]; + n1 = nspecial[j][0]; + for (m = 0; m < n1; m++) + if (slist[m] == tagi) break; + n3 = nspecial[j][2]; + for (; m < n3 - 1; m++) slist[m] = slist[m + 1]; + nspecial[j][0]--; + nspecial[j][1]--; + nspecial[j][2]--; + } + } + + broken_pairs.clear(); +} + +/* ---------------------------------------------------------------------- + Loop neighbor list and update special bond lists for recently broken bonds +------------------------------------------------------------------------- */ + +void FixUpdateSpecialBonds::pre_force(int /*vflag*/) +{ + int i1, i2, j, jj, jnum; + int *jlist, *numneigh, **firstneigh; + tagint tag1, tag2; + + int nlocal = atom->nlocal; + + tagint *tag = atom->tag; + NeighList *list = force->pair->list; // may need to be generalized to work with pair hybrid* + numneigh = list->numneigh; + firstneigh = list->firstneigh; + + // In theory could communicate a list of broken bonds to neighboring processors here + // to remove restriction that users use Newton bond off + + for (auto const &it : new_broken_pairs) { + tag1 = it.first; + tag2 = it.second; + i1 = atom->map(tag1); + i2 = atom->map(tag2); + + // Loop through atoms of owned atoms i j + if (i1 < nlocal) { + jlist = firstneigh[i1]; + jnum = numneigh[i1]; + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= SPECIALMASK; // Clear special bond bits + if (tag[j] == tag2) jlist[jj] = j; + } + } + + if (i2 < nlocal) { + jlist = firstneigh[i2]; + jnum = numneigh[i2]; + for (jj = 0; jj < jnum; jj++) { + j = jlist[jj]; + j &= SPECIALMASK; // Clear special bond bits + if (tag[j] == tag1) jlist[jj] = j; + } + } + } + new_broken_pairs.clear(); +} + +/* ---------------------------------------------------------------------- */ + +void FixUpdateSpecialBonds::add_broken_bond(int i, int j) +{ + auto tag_pair = std::make_pair(atom->tag[i], atom->tag[j]); + new_broken_pairs.push_back(tag_pair); + broken_pairs.push_back(tag_pair); +} diff --git a/src/fix_update_special_bonds.h b/src/fix_update_special_bonds.h new file mode 100644 index 0000000000..52981d4d99 --- /dev/null +++ b/src/fix_update_special_bonds.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, 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 +// clang-format off +FixStyle(UPDATE_SPECIAL_BONDS,FixUpdateSpecialBonds); +// clang-format on +#else + +#ifndef LMP_FIX_UPDATE_SPECIAL_BONDS_H +#define LMP_FIX_UPDATE_SPECIAL_BONDS_H + +#include "fix.h" + +#include +#include + +namespace LAMMPS_NS { + +class FixUpdateSpecialBonds : public Fix { + public: + FixUpdateSpecialBonds(class LAMMPS *, int, char **); + int setmask() override; + void setup(int) override; + void pre_exchange() override; + void pre_force(int) override; + void add_broken_bond(int, int); + + protected: + // Create two arrays to store bonds broken this timestep (new) + // and since the last neighbor list build + std::vector> new_broken_pairs; + std::vector> broken_pairs; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/fix_vector.h b/src/fix_vector.h index c43e287b4c..6d0db294c6 100644 --- a/src/fix_vector.h +++ b/src/fix_vector.h @@ -52,72 +52,3 @@ class FixVector : public Fix { #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 vector does not exist - -Self-explanatory. - -E: Fix vector compute does not calculate a scalar - -Self-explanatory. - -E: Fix vector compute does not calculate a vector - -Self-explanatory. - -E: Fix vector compute vector is accessed out-of-range - -Self-explanatory. - -E: Fix ID for fix vector does not exist - -Self-explanatory. - -E: Fix vector fix does not calculate a scalar - -Self-explanatory. - -E: Fix vector fix does not calculate a vector - -Self-explanatory. - -E: Fix vector fix vector is accessed out-of-range - -Self-explanatory. - -E: Fix for fix vector not computed at compatible time - -Fixes generate their values on specific timesteps. Fix vector is -requesting a value on a non-allowed timestep. - -E: Variable name for fix vector does not exist - -Self-explanatory. - -E: Fix vector variable is not equal-style variable - -Self-explanatory. - -E: Fix vector variable is not vector-style variable - -UNDOCUMENTED - -E: Fix vector cannot set output array intensive/extensive from these inputs - -The inputs to the command have conflicting intensive/extensive attributes. -You need to use more than one fix vector command. - -E: Overflow of allocated fix vector storage - -This should not normally happen if the fix correctly calculated -how long the vector will grow to. Contact the developers. - -*/ diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index a13100ee48..f0c6faa419 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -82,7 +82,7 @@ void FixViscous::init() int max_respa = 0; if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = max_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = max_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,max_respa); } } @@ -94,9 +94,9 @@ void FixViscous::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) post_force(vflag); else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_viscous.h b/src/fix_viscous.h index 0353004911..7d7608621c 100644 --- a/src/fix_viscous.h +++ b/src/fix_viscous.h @@ -45,13 +45,3 @@ class FixViscous : public Fix { #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. - -*/ diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index 0c3623857e..2156ac321c 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -261,7 +261,7 @@ void FixWall::init() for (int m = 0; m < nwall; m++) precompute(m); if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; + ilevel_respa = (dynamic_cast( update->integrate))->nlevels-1; if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); } } @@ -273,9 +273,9 @@ void FixWall::setup(int vflag) if (utils::strmatch(update->integrate_style,"^verlet")) { if (!fldflag) post_force(vflag); } else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); + (dynamic_cast( update->integrate))->copy_flevel_f(ilevel_respa); post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); + (dynamic_cast( update->integrate))->copy_f_flevel(ilevel_respa); } } diff --git a/src/fix_wall.h b/src/fix_wall.h index 99086aac6c..2aeaf040e7 100644 --- a/src/fix_wall.h +++ b/src/fix_wall.h @@ -60,41 +60,3 @@ class FixWall : public Fix { } // namespace LAMMPS_NS #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: Wall defined twice in fix wall command - -Self-explanatory. - -E: Fix wall cutoff <= 0.0 - -Self-explanatory. - -E: Cannot use fix wall zlo/zhi for a 2d simulation - -Self-explanatory. - -E: Cannot use fix wall in periodic dimension - -Self-explanatory. - -E: Variable name for fix wall does not exist - -Self-explanatory. - -E: Variable for fix wall is invalid style - -Only equal-style variables can be used. - -E: Variable evaluation in fix wall gave bad value - -The returned value for epsilon or sigma < 0.0. - -*/ diff --git a/src/fix_wall_harmonic.h b/src/fix_wall_harmonic.h index 629f4eede9..37038fa9ef 100644 --- a/src/fix_wall_harmonic.h +++ b/src/fix_wall_harmonic.h @@ -35,12 +35,3 @@ class FixWallHarmonic : public FixWall { #endif #endif - -/* ERROR/WARNING messages: - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/fix_wall_lj126.h b/src/fix_wall_lj126.h index 9f9e870fd5..93a529e358 100644 --- a/src/fix_wall_lj126.h +++ b/src/fix_wall_lj126.h @@ -38,12 +38,3 @@ class FixWallLJ126 : public FixWall { #endif #endif - -/* ERROR/WARNING messages: - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/fix_wall_lj93.h b/src/fix_wall_lj93.h index 5f0a90773d..8dae6ade30 100644 --- a/src/fix_wall_lj93.h +++ b/src/fix_wall_lj93.h @@ -38,12 +38,3 @@ class FixWallLJ93 : public FixWall { #endif #endif - -/* ERROR/WARNING messages: - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/fix_wall_morse.h b/src/fix_wall_morse.h index 973adfeaf8..518ece2302 100644 --- a/src/fix_wall_morse.h +++ b/src/fix_wall_morse.h @@ -38,12 +38,3 @@ class FixWallMorse : public FixWall { #endif #endif - -/* ERROR/WARNING messages: - -E: Particle on or inside fix wall surface - -Particles must be "exterior" to the wall in order for energy/force to -be calculated. - -*/ diff --git a/src/fix_wall_reflect.h b/src/fix_wall_reflect.h index d708c07180..6021bfa10d 100644 --- a/src/fix_wall_reflect.h +++ b/src/fix_wall_reflect.h @@ -51,37 +51,3 @@ class FixWallReflect : public Fix { #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: Wall defined twice in fix wall/reflect command - -Self-explanatory. - -E: Cannot use fix wall/reflect in periodic dimension - -Self-explanatory. - -E: Cannot use fix wall/reflect zlo/zhi for a 2d simulation - -Self-explanatory. - -E: Variable name for fix wall/reflect does not exist - -Self-explanatory. - -E: Variable for fix wall/reflect is invalid style - -Only equal-style variables can be used. - -W: Should not allow rigid bodies to bounce off relecting walls - -LAMMPS allows this, but their dynamics are not computed correctly. - -*/ diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index 909f777dce..41a96fe374 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,6 +17,7 @@ #include "domain.h" #include "error.h" #include "math_const.h" +#include "math_special.h" #include "region.h" #include "respa.h" #include "update.h" @@ -27,17 +27,18 @@ using namespace LAMMPS_NS; using namespace FixConst; -using namespace MathConst; +using MathConst::MY_2PI; +using MathConst::MY_SQRT2; +using MathSpecial::powint; -enum{LJ93,LJ126,LJ1043,COLLOID,HARMONIC,MORSE}; +enum { LJ93, LJ126, LJ1043, COLLOID, HARMONIC, MORSE }; /* ---------------------------------------------------------------------- */ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - idregion(nullptr) + Fix(lmp, narg, arg), idregion(nullptr), region(nullptr) { - if (narg < 8) error->all(FLERR,"Illegal fix wall/region command"); + if (narg < 8) error->all(FLERR, "Illegal fix wall/region command"); scalar_flag = 1; vector_flag = 1; @@ -52,40 +53,44 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : // parse args - iregion = domain->find_region(arg[3]); - if (iregion == -1) - error->all(FLERR,"Region ID for fix wall/region does not exist"); + region = domain->get_region_by_id(arg[3]); + if (!region) error->all(FLERR, "Region {} for fix wall/region does not exist", arg[3]); idregion = utils::strdup(arg[3]); - if (strcmp(arg[4],"lj93") == 0) style = LJ93; - else if (strcmp(arg[4],"lj126") == 0) style = LJ126; - else if (strcmp(arg[4],"lj1043") == 0) style = LJ1043; - else if (strcmp(arg[4],"colloid") == 0) style = COLLOID; - else if (strcmp(arg[4],"harmonic") == 0) style = HARMONIC; - else if (strcmp(arg[4],"morse") == 0) style = MORSE; - else error->all(FLERR,"Illegal fix wall/region command"); + if (strcmp(arg[4], "lj93") == 0) + style = LJ93; + else if (strcmp(arg[4], "lj126") == 0) + style = LJ126; + else if (strcmp(arg[4], "lj1043") == 0) + style = LJ1043; + else if (strcmp(arg[4], "colloid") == 0) + style = COLLOID; + else if (strcmp(arg[4], "harmonic") == 0) + style = HARMONIC; + else if (strcmp(arg[4], "morse") == 0) + style = MORSE; + else + error->all(FLERR, "Illegal fix wall/region command"); if (style != COLLOID) dynamic_group_allow = 1; if (style == MORSE) { - if (narg != 9) - error->all(FLERR,"Illegal fix wall/region command"); + if (narg != 9) error->all(FLERR, "Illegal fix wall/region command"); - 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); + 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"); + if (narg != 8) error->all(FLERR, "Illegal fix wall/region command"); - epsilon = utils::numeric(FLERR,arg[5],false,lmp); - sigma = utils::numeric(FLERR,arg[6],false,lmp); - cutoff = utils::numeric(FLERR,arg[7],false,lmp); + 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"); + if (cutoff <= 0.0) error->all(FLERR, "Fix wall/region cutoff <= 0.0"); eflag = 0; ewall[0] = ewall[1] = ewall[2] = ewall[3] = 0.0; @@ -95,7 +100,7 @@ FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : FixWallRegion::~FixWallRegion() { - delete [] idregion; + delete[] idregion; } /* ---------------------------------------------------------------------- */ @@ -115,16 +120,14 @@ void FixWallRegion::init() { // set index and check validity of region - iregion = domain->find_region(idregion); - if (iregion == -1) - error->all(FLERR,"Region ID for fix wall/region does not exist"); + region = domain->get_region_by_id(idregion); + if (!region) error->all(FLERR, "Region {} for fix wall/region does not exist", idregion); // error checks for style COLLOID // insure all particles in group are extended particles if (style == COLLOID) { - if (!atom->sphere_flag) - error->all(FLERR,"Fix wall/region colloid requires atom style sphere"); + if (!atom->sphere_flag) error->all(FLERR, "Fix wall/region colloid requires atom style sphere"); double *radius = atom->radius; int *mask = atom->mask; @@ -136,61 +139,59 @@ void FixWallRegion::init() if (radius[i] == 0.0) flag = 1; int flagall; - MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); - if (flagall) - error->all(FLERR,"Fix wall/region colloid requires extended particles"); + MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); + if (flagall) error->all(FLERR, "Fix wall/region colloid requires extended particles"); } // setup coefficients for each style if (style == LJ93) { - coeff1 = 6.0/5.0 * epsilon * pow(sigma,9.0); - coeff2 = 3.0 * epsilon * pow(sigma,3.0); - coeff3 = 2.0/15.0 * epsilon * pow(sigma,9.0); - coeff4 = epsilon * pow(sigma,3.0); - double rinv = 1.0/cutoff; - double r2inv = rinv*rinv; - double r4inv = r2inv*r2inv; - offset = coeff3*r4inv*r4inv*rinv - coeff4*r2inv*rinv; + coeff1 = 6.0 / 5.0 * epsilon * powint(sigma, 9); + coeff2 = 3.0 * epsilon * powint(sigma, 3); + coeff3 = 2.0 / 15.0 * epsilon * powint(sigma, 9); + coeff4 = epsilon * powint(sigma, 3); + double rinv = 1.0 / cutoff; + double r2inv = rinv * rinv; + double r4inv = r2inv * r2inv; + offset = coeff3 * r4inv * r4inv * rinv - coeff4 * r2inv * rinv; } else if (style == LJ126) { - coeff1 = 48.0 * epsilon * pow(sigma,12.0); - coeff2 = 24.0 * epsilon * pow(sigma,6.0); - coeff3 = 4.0 * epsilon * pow(sigma,12.0); - coeff4 = 4.0 * epsilon * pow(sigma,6.0); - double r2inv = 1.0/(cutoff*cutoff); - double r6inv = r2inv*r2inv*r2inv; - offset = r6inv*(coeff3*r6inv - coeff4); + coeff1 = 48.0 * epsilon * powint(sigma, 12); + coeff2 = 24.0 * epsilon * powint(sigma, 6); + coeff3 = 4.0 * epsilon * powint(sigma, 12); + coeff4 = 4.0 * epsilon * powint(sigma, 6); + double r2inv = 1.0 / (cutoff * cutoff); + double r6inv = r2inv * r2inv * r2inv; + offset = r6inv * (coeff3 * r6inv - coeff4); } else if (style == LJ1043) { - coeff1 = MY_2PI * 2.0/5.0 * epsilon * pow(sigma,10.0); - coeff2 = MY_2PI * epsilon * pow(sigma,4.0); - coeff3 = MY_2PI * pow(2.0,1/2.0) / 3 * epsilon * pow(sigma,3.0); - coeff4 = 0.61 / pow(2.0,1/2.0) * sigma; + coeff1 = MY_2PI * 2.0 / 5.0 * epsilon * powint(sigma, 10); + coeff2 = MY_2PI * epsilon * powint(sigma, 4); + coeff3 = MY_2PI * MY_SQRT2 / 3.0 * epsilon * powint(sigma, 3); + coeff4 = 0.61 / MY_SQRT2 * sigma; coeff5 = coeff1 * 10.0; coeff6 = coeff2 * 4.0; coeff7 = coeff3 * 3.0; - double rinv = 1.0/cutoff; - double r2inv = rinv*rinv; - double r4inv = r2inv*r2inv; - offset = coeff1*r4inv*r4inv*r2inv - coeff2*r4inv - - coeff3*pow(cutoff+coeff4,-3.0); + double rinv = 1.0 / cutoff; + double r2inv = rinv * rinv; + double r4inv = r2inv * r2inv; + offset = coeff1 * r4inv * r4inv * r2inv - coeff2 * r4inv - coeff3 * powint(cutoff + coeff4, -3); } else if (style == MORSE) { coeff1 = 2 * epsilon * alpha; double alpha_dr = -alpha * (cutoff - sigma); - offset = epsilon * (exp(2.0*alpha_dr) - 2.0*exp(alpha_dr)); + offset = epsilon * (exp(2.0 * alpha_dr) - 2.0 * exp(alpha_dr)); } else if (style == COLLOID) { - coeff1 = -4.0/315.0 * epsilon * pow(sigma,6.0); - coeff2 = -2.0/3.0 * epsilon; - coeff3 = epsilon * pow(sigma,6.0)/7560.0; - coeff4 = epsilon/6.0; - double rinv = 1.0/cutoff; - double r2inv = rinv*rinv; - double r4inv = r2inv*r2inv; - offset = coeff3*r4inv*r4inv*rinv - coeff4*r2inv*rinv; + coeff1 = -4.0 / 315.0 * epsilon * powint(sigma, 6); + coeff2 = -2.0 / 3.0 * epsilon; + coeff3 = epsilon * powint(sigma, 6) / 7560.0; + coeff4 = epsilon / 6.0; + double rinv = 1.0 / cutoff; + double r2inv = rinv * rinv; + double r4inv = r2inv * r2inv; + offset = coeff3 * r4inv * r4inv * rinv - coeff4 * r2inv * rinv; } - if (utils::strmatch(update->integrate_style,"^respa")) { - ilevel_respa = ((Respa *) update->integrate)->nlevels-1; - if (respa_level >= 0) ilevel_respa = MIN(respa_level,ilevel_respa); + if (utils::strmatch(update->integrate_style, "^respa")) { + ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; + if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); } } @@ -198,12 +199,13 @@ void FixWallRegion::init() void FixWallRegion::setup(int vflag) { - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(update->integrate_style, "^respa")) { + auto respa = dynamic_cast(update->integrate); + respa->copy_flevel_f(ilevel_respa); + post_force_respa(vflag, ilevel_respa, 0); + respa->copy_f_flevel(ilevel_respa); + } else { post_force(vflag); - else { - ((Respa *) update->integrate)->copy_flevel_f(ilevel_respa); - post_force_respa(vflag,ilevel_respa,0); - ((Respa *) update->integrate)->copy_f_flevel(ilevel_respa); } } @@ -218,8 +220,8 @@ void FixWallRegion::min_setup(int vflag) void FixWallRegion::post_force(int vflag) { - int i,m,n; - double rinv,fx,fy,fz,tooclose; + int i, m, n; + double rinv, fx, fy, fz, tooclose; double delx, dely, delz, v[6]; double **x = atom->x; @@ -228,7 +230,6 @@ void FixWallRegion::post_force(int vflag) int *mask = atom->mask; int nlocal = atom->nlocal; - Region *region = domain->regions[iregion]; region->prematch(); int onflag = 0; @@ -247,27 +248,36 @@ void FixWallRegion::post_force(int vflag) for (i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (!region->match(x[i][0],x[i][1],x[i][2])) { + if (!region->match(x[i][0], x[i][1], x[i][2])) { onflag = 1; continue; } - if (style == COLLOID) tooclose = radius[i]; - else tooclose = 0.0; + if (style == COLLOID) + tooclose = radius[i]; + else + tooclose = 0.0; - n = region->surface(x[i][0],x[i][1],x[i][2],cutoff); + n = region->surface(x[i][0], x[i][1], x[i][2], cutoff); for (m = 0; m < n; m++) { if (region->contact[m].r <= tooclose) { onflag = 1; continue; - } else rinv = 1.0/region->contact[m].r; + } else + rinv = 1.0 / region->contact[m].r; - if (style == LJ93) lj93(region->contact[m].r); - else if (style == LJ126) lj126(region->contact[m].r); - else if (style == LJ1043) lj1043(region->contact[m].r); - else if (style == MORSE) morse(region->contact[m].r); - else if (style == COLLOID) colloid(region->contact[m].r,radius[i]); - else harmonic(region->contact[m].r); + if (style == LJ93) + lj93(region->contact[m].r); + else if (style == LJ126) + lj126(region->contact[m].r); + else if (style == LJ1043) + lj1043(region->contact[m].r); + else if (style == MORSE) + morse(region->contact[m].r); + else if (style == COLLOID) + colloid(region->contact[m].r, radius[i]); + else + harmonic(region->contact[m].r); delx = region->contact[m].delx; dely = region->contact[m].dely; @@ -283,19 +293,18 @@ void FixWallRegion::post_force(int vflag) ewall[3] -= fz; ewall[0] += eng; if (evflag) { - v[0] = fx*delx; - v[1] = fy*dely; - v[2] = fz*delz; - v[3] = fx*dely; - v[4] = fx*delz; - v[5] = fy*delz; + v[0] = fx * delx; + v[1] = fy * dely; + v[2] = fz * delz; + v[3] = fx * dely; + v[4] = fx * delz; + v[5] = fy * delz; v_tally(i, v); } } } - if (onflag) error->one(FLERR,"Particle outside surface of region " - "used in fix wall/region"); + if (onflag) error->one(FLERR, "Particle outside surface of region used in fix wall/region"); } /* ---------------------------------------------------------------------- */ @@ -321,7 +330,7 @@ double FixWallRegion::compute_scalar() // only sum across procs one time if (eflag == 0) { - MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(ewall, ewall_all, 4, MPI_DOUBLE, MPI_SUM, world); eflag = 1; } return ewall_all[0]; @@ -336,10 +345,10 @@ double FixWallRegion::compute_vector(int n) // only sum across procs one time if (eflag == 0) { - MPI_Allreduce(ewall,ewall_all,4,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(ewall, ewall_all, 4, MPI_DOUBLE, MPI_SUM, world); eflag = 1; } - return ewall_all[n+1]; + return ewall_all[n + 1]; } /* ---------------------------------------------------------------------- @@ -349,12 +358,12 @@ double FixWallRegion::compute_vector(int n) void FixWallRegion::lj93(double r) { - double rinv = 1.0/r; - double r2inv = rinv*rinv; - double r4inv = r2inv*r2inv; - double r10inv = r4inv*r4inv*r2inv; - fwall = coeff1*r10inv - coeff2*r4inv; - eng = coeff3*r4inv*r4inv*rinv - coeff4*r2inv*rinv - offset; + double rinv = 1.0 / r; + double r2inv = rinv * rinv; + double r4inv = r2inv * r2inv; + double r10inv = r4inv * r4inv * r2inv; + fwall = coeff1 * r10inv - coeff2 * r4inv; + eng = coeff3 * r4inv * r4inv * rinv - coeff4 * r2inv * rinv - offset; } /* ---------------------------------------------------------------------- @@ -364,11 +373,11 @@ void FixWallRegion::lj93(double r) void FixWallRegion::lj126(double r) { - double rinv = 1.0/r; - double r2inv = rinv*rinv; - double r6inv = r2inv*r2inv*r2inv; - fwall = r6inv*(coeff1*r6inv - coeff2) * rinv; - eng = r6inv*(coeff3*r6inv - coeff4) - offset; + double rinv = 1.0 / r; + double r2inv = rinv * rinv; + double r6inv = r2inv * r2inv * r2inv; + fwall = r6inv * (coeff1 * r6inv - coeff2) * rinv; + eng = r6inv * (coeff3 * r6inv - coeff4) - offset; } /* ---------------------------------------------------------------------- @@ -378,14 +387,12 @@ void FixWallRegion::lj126(double r) void FixWallRegion::lj1043(double r) { - double rinv = 1.0/r; - double r2inv = rinv*rinv; - double r4inv = r2inv*r2inv; - double r10inv = r4inv*r4inv*r2inv; - fwall = coeff5*r10inv*rinv - coeff6*r4inv*rinv - - coeff7*pow(r+coeff4,-4.0); - eng = coeff1*r10inv - coeff2*r4inv - - coeff3*pow(r+coeff4,-3.0) - offset; + double rinv = 1.0 / r; + double r2inv = rinv * rinv; + double r4inv = r2inv * r2inv; + double r10inv = r4inv * r4inv * r2inv; + fwall = coeff5 * r10inv * rinv - coeff6 * r4inv * rinv - coeff7 * powint(r + coeff4, -4); + eng = coeff1 * r10inv - coeff2 * r4inv - coeff3 * powint(r + coeff4, -3) - offset; } /* ---------------------------------------------------------------------- @@ -397,8 +404,8 @@ void FixWallRegion::morse(double r) { double dr = r - sigma; double dexp = exp(-alpha * dr); - fwall = coeff1 * (dexp*dexp - dexp); - eng = epsilon * (dexp*dexp - 2.0*dexp) - offset; + fwall = coeff1 * (dexp * dexp - dexp); + eng = epsilon * (dexp * dexp - 2.0 * dexp) - offset; } /* ---------------------------------------------------------------------- @@ -408,33 +415,35 @@ void FixWallRegion::morse(double r) void FixWallRegion::colloid(double r, double rad) { - double new_coeff2 = coeff2*rad*rad*rad; - double diam = 2.0*rad; + double new_coeff2 = coeff2 * rad * rad * rad; + double diam = 2.0 * rad; - double rad2 = rad*rad; - double rad4 = rad2*rad2; - double rad8 = rad4*rad4; - double delta2 = rad2 - r*r; - double rinv = 1.0/delta2; - double r2inv = rinv*rinv; - double r4inv = r2inv*r2inv; - double r8inv = r4inv*r4inv; - fwall = coeff1*(rad8*rad + 27.0*rad4*rad2*rad*pow(r,2.0) - + 63.0*rad4*rad*pow(r,4.0) - + 21.0*rad2*rad*pow(r,6.0))*r8inv - new_coeff2*r2inv; + double rad2 = rad * rad; + double rad4 = rad2 * rad2; + double rad8 = rad4 * rad4; + double delta2 = rad2 - r * r; + double rinv = 1.0 / delta2; + double r2inv = rinv * rinv; + double r4inv = r2inv * r2inv; + double r8inv = r4inv * r4inv; + fwall = coeff1 * + (rad8 * rad + 27.0 * rad4 * rad2 * rad * r * r + 63.0 * rad4 * rad * powint(r, 4) + + 21.0 * rad2 * rad * powint(r, 6)) * + r8inv - + new_coeff2 * r2inv; - double r2 = 0.5*diam - r; - double rinv2 = 1.0/r2; - double r2inv2 = rinv2*rinv2; - double r4inv2 = r2inv2*r2inv2; - double r3 = r + 0.5*diam; - double rinv3 = 1.0/r3; - double r2inv3 = rinv3*rinv3; - double r4inv3 = r2inv3*r2inv3; - eng = coeff3*((-3.5*diam+r)*r4inv2*r2inv2*rinv2 - + (3.5*diam+r)*r4inv3*r2inv3*rinv3) - - coeff4*((-diam*r+r2*r3*(log(-r2)-log(r3)))* - (-rinv2)*rinv3) - offset; + double r2 = 0.5 * diam - r; + double rinv2 = 1.0 / r2; + double r2inv2 = rinv2 * rinv2; + double r4inv2 = r2inv2 * r2inv2; + double r3 = r + 0.5 * diam; + double rinv3 = 1.0 / r3; + double r2inv3 = rinv3 * rinv3; + double r4inv3 = r2inv3 * r2inv3; + eng = coeff3 * + ((-3.5 * diam + r) * r4inv2 * r2inv2 * rinv2 + + (3.5 * diam + r) * r4inv3 * r2inv3 * rinv3) - + coeff4 * ((-diam * r + r2 * r3 * (log(-r2) - log(r3))) * (-rinv2) * rinv3) - offset; } /* ---------------------------------------------------------------------- @@ -445,6 +454,6 @@ void FixWallRegion::colloid(double r, double rad) void FixWallRegion::harmonic(double r) { double dr = cutoff - r; - fwall = 2.0*epsilon*dr; - eng = epsilon*dr*dr; + fwall = 2.0 * epsilon * dr; + eng = epsilon * dr * dr; } diff --git a/src/fix_wall_region.h b/src/fix_wall_region.h index 5da19f6698..43671c83b1 100644 --- a/src/fix_wall_region.h +++ b/src/fix_wall_region.h @@ -39,13 +39,14 @@ class FixWallRegion : public Fix { double compute_vector(int) override; private: - int style, iregion; + int style; double epsilon, sigma, cutoff; double alpha; int eflag; double ewall[4], ewall_all[4]; int ilevel_respa; char *idregion; + class Region *region; double coeff1, coeff2, coeff3, coeff4, offset; double coeff5, coeff6, coeff7; @@ -63,34 +64,3 @@ class FixWallRegion : public Fix { #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: Region ID for fix wall/region does not exist - -Self-explanatory. - -E: Fix wall/region cutoff <= 0.0 - -Self-explanatory. - -E: Fix wall/region colloid requires atom style sphere - -Self-explanatory. - -E: Fix wall/region colloid requires extended particles - -One of the particles has radius 0.0. - -E: Particle outside surface of region used in fix wall/region - -Particles must be inside the region for energy/force to be calculated. -A particle outside the region generates an error. - -*/ diff --git a/src/fmt/core.h b/src/fmt/core.h index b7f9a960c6..8444cd9546 100644 --- a/src/fmt/core.h +++ b/src/fmt/core.h @@ -429,7 +429,9 @@ template inline auto convert_for_visit(T) -> monostate { template FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned::type { - FMT_ASSERT(value >= 0, "negative value"); + // LAMMPS CUSTOMIZATION + // FMT_ASSERT(value >= 0, "negative value"); + // END LAMMPS CUSTOMIZATION return static_cast::type>(value); } diff --git a/src/force.cpp b/src/force.cpp index 35bd8644ee..8bed122451 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -223,7 +223,7 @@ void Force::create_pair(const std::string &style, int trysuffix) { delete[] pair_style; if (pair) delete pair; - if (pair_restart) delete[] pair_restart; + delete[] pair_restart; pair_style = nullptr; pair = nullptr; pair_restart = nullptr; @@ -298,7 +298,7 @@ Pair *Force::pair_match(const std::string &word, int exact, int nsub) else if (!exact && utils::strmatch(pair_style, word)) return pair; else if (utils::strmatch(pair_style, "^hybrid")) { - PairHybrid *hybrid = (PairHybrid *) pair; + auto hybrid = dynamic_cast(pair); count = 0; for (int i = 0; i < hybrid->nstyles; i++) if ((exact && (word == hybrid->keywords[i])) || @@ -324,7 +324,7 @@ char *Force::pair_match_ptr(Pair *ptr) if (ptr == pair) return pair_style; if (utils::strmatch(pair_style, "^hybrid")) { - PairHybrid *hybrid = (PairHybrid *) pair; + auto hybrid = dynamic_cast(pair); for (int i = 0; i < hybrid->nstyles; i++) if (ptr == hybrid->styles[i]) return hybrid->keywords[i]; } @@ -393,7 +393,7 @@ Bond *Force::bond_match(const std::string &style) if (style == bond_style) return bond; else if (strcmp(bond_style, "hybrid") == 0) { - BondHybrid *hybrid = (BondHybrid *) bond; + auto hybrid = dynamic_cast(bond); for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } @@ -461,7 +461,7 @@ Angle *Force::angle_match(const std::string &style) if (style == angle_style) return angle; else if (utils::strmatch(angle_style, "^hybrid")) { - AngleHybrid *hybrid = (AngleHybrid *) angle; + auto hybrid = dynamic_cast(angle); for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } @@ -529,7 +529,7 @@ Dihedral *Force::dihedral_match(const std::string &style) if (style == dihedral_style) return dihedral; else if (utils::strmatch(dihedral_style, "^hybrid")) { - DihedralHybrid *hybrid = (DihedralHybrid *) dihedral; + auto hybrid = dynamic_cast(dihedral); for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } @@ -597,7 +597,7 @@ Improper *Force::improper_match(const std::string &style) if (style == improper_style) return improper; else if (utils::strmatch(improper_style, "^hybrid")) { - ImproperHybrid *hybrid = (ImproperHybrid *) improper; + auto hybrid = dynamic_cast(improper); for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } diff --git a/src/force.h b/src/force.h index 677817f4b3..d196555304 100644 --- a/src/force.h +++ b/src/force.h @@ -158,120 +158,3 @@ class Force : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Must re-specify non-restarted pair style (%s) after read_restart - -For pair styles, that do not store their settings in a restart file, -it must be defined with a new 'pair_style' command after read_restart. - -E: Unrecognized pair style %s - -The choice of pair style is unknown. - -E: Unrecognized bond style %s - -The choice of bond style is unknown. - -E: Unrecognized angle style %s - -The choice of angle style is unknown. - -E: Unrecognized dihedral style %s - -The choice of dihedral style is unknown. - -E: Unrecognized improper style %s - -The choice of improper style is unknown. - -E: Cannot yet use KSpace solver with grid with comm style tiled - -This is current restriction in LAMMPS. - -E: Unrecognized kspace style %s - -The choice of kspace style is unknown. - -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. - -U: Unknown pair style - -The choice of pair style is unknown. - -U: Unknown bond style - -The choice of bond style is unknown. - -U: Unknown angle style - -The choice of angle style is unknown. - -U: Unknown dihedral style - -The choice of dihedral style is unknown. - -U: Unknown improper style - -The choice of improper style is unknown. - -U: Unknown kspace style - -The choice of kspace style is unknown. - -U: Numeric index is out of bounds - -A command with an argument that specifies an integer or range of -integers is using a value that is less than 1 or greater than the -maximum allowed limit. - -W: Bonds are defined but no bond style is set - -The topology contains bonds, but there are no bond forces computed -since there was no bond_style command. - -W: Angles are defined but no angle style is set - -The topology contains angles, but there are no angle forces computed -since there was no angle_style command. - -W: Dihedrals are defined but no dihedral style is set - -The topology contains dihedrals, but there are no dihedral forces computed -since there was no dihedral_style command. - -W: Impropers are defined but no improper style is set - -The topology contains impropers, but there are no improper forces computed -since there was no improper_style command. - -W: Likewise 1-2 special neighbor interactions != 1.0 - -The topology contains bonds, but there is no bond style defined -and a 1-2 special neighbor scaling factor was not 1.0. This -means that pair style interactions may have scaled or missing -pairs in the neighbor list in expectation of interactions for -those pairs being computed from the bond style. - -W: Likewise 1-3 special neighbor interactions != 1.0 - -The topology contains angles, but there is no angle style defined -and a 1-3 special neighbor scaling factor was not 1.0. This -means that pair style interactions may have scaled or missing -pairs in the neighbor list in expectation of interactions for -those pairs being computed from the angle style. - -W: Likewise 1-4 special neighbor interactions != 1.0 - -The topology contains dihedrals, but there is no dihedral style defined -and a 1-4 special neighbor scaling factor was not 1.0. This -means that pair style interactions may have scaled or missing -pairs in the neighbor list in expectation of interactions for -those pairs being computed from the dihedral style. - -*/ diff --git a/src/gridcomm.cpp b/src/gridcomm.cpp index dcf5fc6fe2..57cbb130f5 100644 --- a/src/gridcomm.cpp +++ b/src/gridcomm.cpp @@ -609,10 +609,9 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) } } - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); int nrecv_request = irregular->create_data(nsend_request,proclist,1); - Request *rrequest = - (Request *) memory->smalloc(nrecv_request*sizeof(Request),"GridComm:rrequest"); + auto rrequest = (Request *) memory->smalloc(nrecv_request*sizeof(Request),"GridComm:rrequest"); irregular->exchange_data((char *) srequest,sizeof(Request),(char *) rrequest); irregular->destroy_data(); @@ -620,8 +619,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) // overlap box used to setup my Send data struct and respond to requests send = (Send *) memory->smalloc(nrecv_request*sizeof(Send),"GridComm:send"); - sresponse = (Response *) - memory->smalloc(nrecv_request*sizeof(Response),"GridComm:sresponse"); + sresponse = (Response *) memory->smalloc(nrecv_request*sizeof(Response),"GridComm:sresponse"); memory->destroy(proclist); memory->create(proclist,nrecv_request,"GridComm:proclist"); @@ -652,8 +650,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) int nsend_response = nrecv_request; int nrecv_response = irregular->create_data(nsend_response,proclist,1); - Response *rresponse = - (Response *) memory->smalloc(nrecv_response*sizeof(Response),"GridComm:rresponse"); + auto rresponse = (Response *) memory->smalloc(nrecv_response*sizeof(Response),"GridComm:rresponse"); irregular->exchange_data((char *) sresponse,sizeof(Response),(char *) rresponse); irregular->destroy_data(); delete irregular; @@ -992,7 +989,7 @@ forward_comm_tiled(T *ptr, int nper, int nbyte, int which, { int i,m,offset; - char *buf2 = (char *) vbuf2; + auto buf2 = (char *) vbuf2; // post all receives @@ -1091,7 +1088,7 @@ reverse_comm_tiled(T *ptr, int nper, int nbyte, int which, { int i,m,offset; - char *buf2 = (char *) vbuf2; + auto buf2 = (char *) vbuf2; // post all receives diff --git a/src/group.cpp b/src/group.cpp index 0dc0a560dd..41c24b8f48 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -40,8 +40,8 @@ using namespace LAMMPS_NS; -#define MAX_GROUP 32 -#define EPSILON 1.0e-6 +static constexpr int MAX_GROUP = 32; +static constexpr double EPSILON = 1.0e-6; enum{NONE,TYPE,MOLECULE,ID}; enum{LT,LE,GT,GE,EQ,NEQ,BETWEEN}; @@ -176,13 +176,13 @@ void Group::assign(int narg, char **arg) if (narg != 3) error->all(FLERR,"Illegal group command"); - int iregion = domain->find_region(arg[2]); - if (iregion == -1) error->all(FLERR,"Group region ID does not exist"); - domain->regions[iregion]->init(); - domain->regions[iregion]->prematch(); + auto region = domain->get_region_by_id(arg[2]); + if (!region) error->all(FLERR,"Group region {} does not exist", arg[2]); + region->init(); + region->prematch(); for (i = 0; i < nlocal; i++) - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) + if (region->match(x[i][0],x[i][1],x[i][2])) mask[i] |= bit; // create an empty group @@ -675,8 +675,8 @@ void Group::add_molecules(int /*igroup*/, int bit) void Group::molring(int n, char *cbuf, void *ptr) { - Group *gptr = (Group *) ptr; - tagint *list = (tagint *) cbuf; + auto gptr = (Group *) ptr; + auto list = (tagint *) cbuf; std::map *hash = gptr->hash; int nlocal = gptr->atom->nlocal; tagint *molecule = gptr->atom->molecule; @@ -794,15 +794,14 @@ bigint Group::count(int igroup) count atoms in group and region ------------------------------------------------------------------------- */ -bigint Group::count(int igroup, int iregion) +bigint Group::count(int igroup, Region *region) { - int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); + const int groupbit = bitmask[igroup]; double **x = atom->x; int *mask = atom->mask; - int nlocal = atom->nlocal; + const int nlocal = atom->nlocal; int n = 0; for (int i = 0; i < nlocal; i++) @@ -849,10 +848,9 @@ double Group::mass(int igroup) use either per-type mass or per-atom rmass ------------------------------------------------------------------------- */ -double Group::mass(int igroup, int iregion) +double Group::mass(int igroup, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -904,10 +902,9 @@ double Group::charge(int igroup) compute the total charge of group of atoms in region ------------------------------------------------------------------------- */ -double Group::charge(int igroup, int iregion) +double Group::charge(int igroup, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -973,10 +970,9 @@ void Group::bounds(int igroup, double *minmax) periodic images are not considered, so atoms are NOT unwrapped ------------------------------------------------------------------------- */ -void Group::bounds(int igroup, double *minmax, int iregion) +void Group::bounds(int igroup, double *minmax, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double extent[6]; @@ -1073,10 +1069,9 @@ void Group::xcm(int igroup, double masstotal, double *cm) must unwrap atoms to compute center-of-mass correctly ------------------------------------------------------------------------- */ -void Group::xcm(int igroup, double masstotal, double *cm, int iregion) +void Group::xcm(int igroup, double masstotal, double *cm, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1173,10 +1168,9 @@ void Group::vcm(int igroup, double masstotal, double *cm) return center-of-mass velocity in cm[] ------------------------------------------------------------------------- */ -void Group::vcm(int igroup, double masstotal, double *cm, int iregion) +void Group::vcm(int igroup, double masstotal, double *cm, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1245,10 +1239,9 @@ void Group::fcm(int igroup, double *cm) compute the total force on group of atoms in region ------------------------------------------------------------------------- */ -void Group::fcm(int igroup, double *cm, int iregion) +void Group::fcm(int igroup, double *cm, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1308,10 +1301,9 @@ double Group::ke(int igroup) compute the total kinetic energy of group of atoms in region and return it ------------------------------------------------------------------------- */ -double Group::ke(int igroup, int iregion) +double Group::ke(int igroup, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1387,10 +1379,9 @@ double Group::gyration(int igroup, double masstotal, double *cm) must unwrap atoms to compute Rg correctly ------------------------------------------------------------------------- */ -double Group::gyration(int igroup, double masstotal, double *cm, int iregion) +double Group::gyration(int igroup, double masstotal, double *cm, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1469,10 +1460,9 @@ void Group::angmom(int igroup, double *cm, double *lmom) must unwrap atoms to compute L correctly ------------------------------------------------------------------------- */ -void Group::angmom(int igroup, double *cm, double *lmom, int iregion) +void Group::angmom(int igroup, double *cm, double *lmom, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1548,10 +1538,9 @@ void Group::torque(int igroup, double *cm, double *tq) must unwrap atoms to compute T correctly ------------------------------------------------------------------------- */ -void Group::torque(int igroup, double *cm, double *tq, int iregion) +void Group::torque(int igroup, double *cm, double *tq, Region *region) { int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; @@ -1634,12 +1623,11 @@ void Group::inertia(int igroup, double *cm, double itensor[3][3]) must unwrap atoms to compute itensor correctly ------------------------------------------------------------------------- */ -void Group::inertia(int igroup, double *cm, double itensor[3][3], int iregion) +void Group::inertia(int igroup, double *cm, double itensor[3][3], Region *region) { int i,j; int groupbit = bitmask[igroup]; - Region *region = domain->regions[iregion]; region->prematch(); double **x = atom->x; diff --git a/src/group.h b/src/group.h index 8c4d10a24f..ac6a0736ac 100644 --- a/src/group.h +++ b/src/group.h @@ -19,6 +19,7 @@ #include namespace LAMMPS_NS { +class Region; class Group : protected Pointers { public: @@ -38,31 +39,31 @@ class Group : protected Pointers { void write_restart(FILE *); void read_restart(FILE *); - bigint count_all(); // count atoms in group all - bigint count(int); // count atoms in group - bigint count(int, int); // count atoms in group & region - double mass(int); // total mass of atoms in group - double mass(int, int); + bigint count_all(); // count atoms in group all + bigint count(int); // count atoms in group + bigint count(int, Region *); // count atoms in group & region + double mass(int); // total mass of atoms in group + double mass(int, Region *); double charge(int); // total charge of atoms in group - double charge(int, int); + double charge(int, Region *); void bounds(int, double *); // bounds of atoms in group - void bounds(int, double *, int); + void bounds(int, double *, Region *); void xcm(int, double, double *); // center-of-mass coords of group - void xcm(int, double, double *, int); + void xcm(int, double, double *, Region *); void vcm(int, double, double *); // center-of-mass velocity of group - void vcm(int, double, double *, int); + void vcm(int, double, double *, Region *); void fcm(int, double *); // total force on group - void fcm(int, double *, int); + void fcm(int, double *, Region *); double ke(int); // kinetic energy of group - double ke(int, int); + double ke(int, Region *); double gyration(int, double, double *); // radius-of-gyration of group - double gyration(int, double, double *, int); + double gyration(int, double, double *, Region *); void angmom(int, double *, double *); // angular momentum of group - void angmom(int, double *, double *, int); + void angmom(int, double *, double *, Region *); void torque(int, double *, double *); // torque on group - void torque(int, double *, double *, int); + void torque(int, double *, double *, Region *); void inertia(int, double *, double[3][3]); // inertia tensor - void inertia(int, double *, double[3][3], int); + void inertia(int, double *, double[3][3], Region *); void omega(double *, double[3][3], double *); // angular velocity private: @@ -81,103 +82,3 @@ class Group : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Group command before simulation box is defined - -The group command cannot be used before a read_data, read_restart, or -create_box command. - -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: Could not find group delete group ID - -Self-explanatory. - -E: Cannot delete group all - -Self-explanatory. - -E: Cannot delete group currently used by a fix - -Self-explanatory. - -E: Cannot delete group currently used by a compute - -Self-explanatory. - -E: Cannot delete group currently used by a dump - -Self-explanatory. - -E: Cannot delete group currently used by atom_modify first - -Self-explanatory. - -E: Could not find group clear group ID - -Self-explanatory. - -E: Cannot clear group all - -This operation is not allowed. - -E: Too many groups - -The maximum number of atom groups (including the "all" group) is -given by MAX_GROUP in group.cpp and is 32. - -E: Group region ID does not exist - -A region ID used in the group command does not exist. - -E: Illegal range increment value - -The increment must be >= 1. - -E: Variable name for group does not exist - -Self-explanatory. - -E: Variable for group is invalid style - -Only atom-style variables can be used. - -E: Group ID does not exist - -A group ID used in the group command does not exist. - -E: Cannot subtract groups using a dynamic group - -This operation is not allowed. - -E: Cannot union groups using a dynamic group - -This operation is not allowed. - -E: Cannot intersect groups using a dynamic group - -This operation is not allowed. - -E: Group dynamic cannot reference itself - -Self-explanatory. - -E: Group dynamic parent group does not exist - -Self-explanatory. - -E: Group all cannot be made dynamic - -This operation is not allowed. - -E: Insufficient Jacobi rotations for group::omega - -UNDOCUMENTED - -*/ diff --git a/src/hashlittle.cpp b/src/hashlittle.cpp index 3aeb0825de..37f8cf03b1 100644 --- a/src/hashlittle.cpp +++ b/src/hashlittle.cpp @@ -153,7 +153,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) u.ptr = key; if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) { - const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ + const uint32_t *k = (const uint32_t *)key; /* NOLINT read 32-bit chunks */ /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ while (length > 12) @@ -197,7 +197,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) #else /* make valgrind happy */ - const uint8_t *k8 = (const uint8_t *)k; + const uint8_t *k8 = (const uint8_t *)k; /* NOLINT */ switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; @@ -218,7 +218,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) #endif /* !valgrind */ } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { - const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ + const uint16_t *k = (const uint16_t *)key; /* NOLINT read 16-bit chunks */ const uint8_t *k8; /*--------------- all but last block: aligned reads and different mixing */ @@ -233,7 +233,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) } /*----------------------------- handle the last (probably partial) block */ - k8 = (const uint8_t *)k; + k8 = (const uint8_t *)k; /* NOLINT */ switch(length) { case 12: c+=k[4]+(((uint32_t)k[5])<<16); @@ -265,7 +265,7 @@ uint32_t LAMMPS_NS::hashlittle(const void *key, size_t length, uint32_t initval) } } else { /* need to read the key one byte at a time */ - const uint8_t *k = (const uint8_t *)key; + const uint8_t *k = (const uint8_t *)key; /* NOLINT */ /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ while (length > 12) diff --git a/src/image.cpp b/src/image.cpp index ee686bd653..b542290e0d 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1105,7 +1105,7 @@ void Image::write_PNG(FILE *fp) png_set_text(png_ptr,info_ptr,text_ptr,1); png_write_info(png_ptr,info_ptr); - png_bytep *row_pointers = new png_bytep[height]; + auto row_pointers = new png_bytep[height]; for (int i=0; i < height; ++i) row_pointers[i] = (png_bytep) &writeBuffer[(height-i-1)*3*width]; diff --git a/src/image.h b/src/image.h index 9eb5c899cb..1d2ad272ae 100644 --- a/src/image.h +++ b/src/image.h @@ -177,11 +177,3 @@ class ColorMap : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid image up vector - -Up vector cannot be (0,0,0). - -*/ diff --git a/src/imbalance_group.h b/src/imbalance_group.h index 7d459491a7..d6e80cda7e 100644 --- a/src/imbalance_group.h +++ b/src/imbalance_group.h @@ -39,15 +39,3 @@ class ImbalanceGroup : public Imbalance { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Unknown group in balance weight command - -UNDOCUMENTED - -*/ diff --git a/src/imbalance_neigh.h b/src/imbalance_neigh.h index 1d9ddfb7a3..629e0f39f9 100644 --- a/src/imbalance_neigh.h +++ b/src/imbalance_neigh.h @@ -38,19 +38,3 @@ class ImbalanceNeigh : public Imbalance { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -W: Balance weight neigh skipped b/c no list found - -UNDOCUMENTED - -E: Balance weight <= 0.0 - -UNDOCUMENTED - -*/ diff --git a/src/imbalance_store.h b/src/imbalance_store.h index aa7b80bb1c..6575cf7162 100644 --- a/src/imbalance_store.h +++ b/src/imbalance_store.h @@ -38,11 +38,3 @@ class ImbalanceStore : public Imbalance { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -*/ diff --git a/src/imbalance_time.h b/src/imbalance_time.h index 078124853a..67213ffedd 100644 --- a/src/imbalance_time.h +++ b/src/imbalance_time.h @@ -40,15 +40,3 @@ class ImbalanceTime : public Imbalance { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Balance weight <= 0.0 - -UNDOCUMENTED - -*/ diff --git a/src/imbalance_var.h b/src/imbalance_var.h index dff399dee9..6f158a80e3 100644 --- a/src/imbalance_var.h +++ b/src/imbalance_var.h @@ -41,23 +41,3 @@ class ImbalanceVar : public Imbalance { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Variable name for balance weight does not exist - -UNDOCUMENTED - -E: Variable for balance weight has invalid style - -UNDOCUMENTED - -E: Balance weight <= 0.0 - -UNDOCUMENTED - -*/ diff --git a/src/improper.cpp b/src/improper.cpp index 7ba39368b7..bb3c4d12b5 100644 --- a/src/improper.cpp +++ b/src/improper.cpp @@ -33,6 +33,7 @@ Improper::Improper(LAMMPS *_lmp) : Pointers(_lmp) allocated = 0; suffix_flag = Suffix::NONE; + born_matrix_enable = 0; maxeatom = maxvatom = maxcvatom = 0; eatom = nullptr; diff --git a/src/improper.h b/src/improper.h index dbe8bee3f1..ae478ce14f 100644 --- a/src/improper.h +++ b/src/improper.h @@ -25,7 +25,8 @@ class Improper : protected Pointers { public: int allocated; int *setflag; - int writedata; // 1 if writes coeffs to data file + int writedata; // 1 if writes coeffs to data file + int born_matrix_enable; double energy; // accumulated energies double virial[6]; // accumulated virial: xx,yy,zz,xy,xz,yz double *eatom, **vatom; // accumulated per-atom energy/virial @@ -55,6 +56,12 @@ class Improper : protected Pointers { virtual void read_restart_settings(FILE *){}; virtual void write_data(FILE *) {} virtual double memory_usage(); + virtual void born_matrix(int /*dtype*/, int /*at1*/, int /*at2*/, int /*at3*/, int /*at4*/, + double &du, double &du2) + { + du = 0.0; + du2 = 0.0; + } protected: int suffix_flag; // suffix compatibility flag @@ -81,17 +88,3 @@ class Improper : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Improper coeffs are not set - -No improper coefficients have been assigned in the data file or via -the improper_coeff command. - -E: All improper coeffs are not set - -All improper coefficients must be set in the data file or by the -improper_coeff command before running a simulation. - -*/ diff --git a/src/improper_deprecated.cpp b/src/improper_deprecated.cpp index 7e03825346..b1e3d3511b 100644 --- a/src/improper_deprecated.cpp +++ b/src/improper_deprecated.cpp @@ -37,7 +37,7 @@ void ImproperDeprecated::settings(int, char **) // of the list of substyles if (utils::strmatch(my_style,"^hybrid")) { - ImproperHybrid *hybrid = (ImproperHybrid *)force->improper; + auto hybrid = dynamic_cast(force->improper); my_style = hybrid->keywords[hybrid->nstyles]; } diff --git a/src/improper_deprecated.h b/src/improper_deprecated.h index d2f0be0dc3..214d2ff67c 100644 --- a/src/improper_deprecated.h +++ b/src/improper_deprecated.h @@ -39,7 +39,3 @@ class ImproperDeprecated : public Improper { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/improper_hybrid.h b/src/improper_hybrid.h index caa9e0b762..4317b5e76c 100644 --- a/src/improper_hybrid.h +++ b/src/improper_hybrid.h @@ -54,31 +54,3 @@ class ImproperHybrid : public Improper { #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: Improper style hybrid cannot use same improper style twice - -Self-explanatory. - -E: Improper style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Improper style hybrid cannot have none as an argument - -Self-explanatory. - -E: Improper coeff for hybrid has invalid style - -Improper style hybrid uses another improper style as one of its -coefficients. The improper style used in the improper_coeff command -or read from a restart file is not recognized. - -*/ diff --git a/src/improper_zero.h b/src/improper_zero.h index 5acf34c6d4..16b6f6f316 100644 --- a/src/improper_zero.h +++ b/src/improper_zero.h @@ -46,15 +46,3 @@ class ImproperZero : public Improper { #endif #endif - -/* ERROR/WARNING messages: - -E: Illegal ... command - -UNDOCUMENTED - -E: Incorrect args for improper coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/info.cpp b/src/info.cpp index 1beadff753..d50c45457b 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -414,7 +414,7 @@ void Info::command(int narg, char **arg) atom->natoms, atom->ntypes, force->pair_style); if (force->pair && utils::strmatch(force->pair_style,"^hybrid")) { - PairHybrid *hybrid = (PairHybrid *)force->pair; + auto hybrid = dynamic_cast(force->pair); fmt::print(out,"Hybrid sub-styles:"); for (int i=0; i < hybrid->nstyles; ++i) fmt::print(out," {}", hybrid->keywords[i]); @@ -546,19 +546,17 @@ void Info::command(int narg, char **arg) } if (flags & REGIONS) { - int nreg = domain->nregion; - Region **regs = domain->regions; fputs("\nRegion information:\n",out); - for (int i=0; i < nreg; ++i) { + int i=0; + for (auto ® : domain->get_region_list()) { fmt::print(out,"Region[{:3d}]: {:16} style = {:16} side = {}\n", - i, std::string(regs[i]->id)+',', - std::string(regs[i]->style)+',', - regs[i]->interior ? "in" : "out"); - if (regs[i]->bboxflag) + i, std::string(reg->id)+',', std::string(reg->style)+',', + reg->interior ? "in" : "out"); + if (reg->bboxflag) fmt::print(out," Boundary: lo {:.8} {:.8} {:.8} hi {:.8} {:.8} {:.8}\n", - regs[i]->extent_xlo, regs[i]->extent_ylo, - regs[i]->extent_zlo, regs[i]->extent_xhi, - regs[i]->extent_yhi, regs[i]->extent_zhi); + reg->extent_xlo, reg->extent_ylo, + reg->extent_zlo, reg->extent_xhi, + reg->extent_yhi, reg->extent_zhi); else fputs(" No Boundary\n",out); } } @@ -785,13 +783,13 @@ bool Info::is_active(const char *category, const char *name) if (strcmp(category,"package") == 0) { if (strcmp(name,"gpu") == 0) { - return (modify->get_fix_by_id("package_gpu")) ? true : false; + return modify->get_fix_by_id("package_gpu") != nullptr; } else if (strcmp(name,"intel") == 0) { - return (modify->get_fix_by_id("package_intel")) ? true : false; + return modify->get_fix_by_id("package_intel") != nullptr; } else if (strcmp(name,"kokkos") == 0) { - return (lmp->kokkos && lmp->kokkos->kokkos_exists) ? true : false; + return lmp->kokkos && lmp->kokkos->kokkos_exists; } else if (strcmp(name,"omp") == 0) { - return (modify->get_fix_by_id("package_omp")) ? true : false; + return modify->get_fix_by_id("package_omp") != nullptr; } else error->all(FLERR,"Unknown name for info package category: {}", name); } else if (strcmp(category,"newton") == 0) { @@ -916,12 +914,8 @@ bool Info::is_defined(const char *category, const char *name) return true; } } else if (strcmp(category,"region") == 0) { - int nreg = domain->nregion; - Region **regs = domain->regions; - for (int i=0; i < nreg; ++i) { - if (strcmp(regs[i]->id,name) == 0) - return true; - } + for (auto ® : domain->get_region_list()) + if (strcmp(reg->id,name) == 0) return true; } else if (strcmp(category,"variable") == 0) { int nvar = input->variable->nvar; char **names = input->variable->names; @@ -1053,7 +1047,7 @@ static void print_columns(FILE *fp, std::map *styles) // std::map keys are already sorted int pos = 80; - for (typename std::map::iterator it = styles->begin(); it != styles->end(); ++it) { + for (auto it = styles->begin(); it != styles->end(); ++it) { const std::string &style_name = it->first; // skip "internal" styles diff --git a/src/info.h b/src/info.h index 8c2ebb1167..ffe1907fae 100644 --- a/src/info.h +++ b/src/info.h @@ -77,36 +77,3 @@ class Info : public Command { #endif #endif - -/* ERROR/WARNING messages: - -W: Ignoring unknown or incorrect info command flag - -Self-explanatory. An unknown argument was given to the info command. -Compare your input with the documentation. - -E: Unknown name for info package category - -Self-explanatory. - -E: Unknown name for info newton category - -Self-explanatory. - -E: Unknown name for info pair category - -Self-explanatory. - -E: Unknown category for info is_active() - -Self-explanatory. - -E: Unknown category for info is_available() - -Self-explanatory. - -E: Unknown category for info is_defined() - -Self-explanatory. - -*/ diff --git a/src/input.cpp b/src/input.cpp index 689c016b68..6c4fc56776 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -168,7 +168,7 @@ Input::~Input() memory->sfree(line); memory->sfree(copy); memory->sfree(work); - if (labelstr) delete[] labelstr; + delete[] labelstr; memory->sfree(arg); delete[] infiles; delete variable; @@ -891,7 +891,7 @@ void Input::ifthenelse() int ncommands = last-first + 1; if (ncommands <= 0) error->all(FLERR,"Illegal if command"); - char **commands = new char*[ncommands]; + auto commands = new char*[ncommands]; ncommands = 0; for (int i = first; i <= last; i++) { n = strlen(arg[i]) + 1; @@ -944,7 +944,7 @@ void Input::ifthenelse() int ncommands = last-first + 1; if (ncommands <= 0) error->all(FLERR,"Illegal if command"); - char **commands = new char*[ncommands]; + auto commands = new char*[ncommands]; ncommands = 0; for (int i = first; i <= last; i++) { n = strlen(arg[i]) + 1; @@ -1026,7 +1026,7 @@ void Input::jump() if (narg == 2) { label_active = 1; - if (labelstr) delete[] labelstr; + delete[] labelstr; labelstr = utils::strdup(arg[1]); } } diff --git a/src/input.h b/src/input.h index 3e9edfe0a6..f54d2ea4e5 100644 --- a/src/input.h +++ b/src/input.h @@ -147,258 +147,3 @@ class Input : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Label wasn't found in input script - -Self-explanatory. - -E: Unknown command: %s - -The command is not known to LAMMPS. Check the input script. - -E: Invalid use of library file() function - -This function is called thru the library interface. This -error should not occur. Contact the developers if it does. - -E: Cannot open input script %s - -Self-explanatory. - -E: Unbalanced quotes in input line - -No matching end double quote was found following a leading double -quote. - -E: Incorrect conversion in format string - -An immediate variable with format suffix was not using -either a %f, a %g, or a %e conversion in the format suffix. - -E: Input line quote not followed by white-space - -An end quote must be followed by white-space. - -E: Invalid variable name - -Variable name used in an input script line is invalid. - -E: Invalid immediate variable - -Syntax of immediate value is incorrect. - -E: Substitution for illegal variable %s - -UNDOCUMENTED - -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: Cannot use include command within an if command - -Self-explanatory. - -E: Cannot open logfile %s - -The LAMMPS log file specified in the input script cannot be opened. -Check that the path and name are correct. - -E: Cannot open print file %s - -Self-explanatory. - -W: Shell command '%s' failed with error '%s' - -Self-explanatory. - -W: Shell command returned with non-zero status - -This may indicate the shell command did not operate as expected. - -E: Angle_coeff command before simulation box is defined - -The angle_coeff command cannot be used before a read_data, -read_restart, or create_box command. - -E: Angle_coeff command before angle_style is defined - -Coefficients cannot be set in the data file or via the angle_coeff -command until an angle_style has been assigned. - -E: Angle_coeff command when no angles allowed - -The chosen atom style does not allow for angles to be defined. - -E: Angle_style command when no angles allowed - -The chosen atom style does not allow for angles to be defined. - -E: Atom_style command after simulation box is defined - -The atom_style command cannot be used after a read_data, -read_restart, or create_box command. - -E: Bond_coeff command before simulation box is defined - -The bond_coeff command cannot be used before a read_data, -read_restart, or create_box command. - -E: Bond_coeff command before bond_style is defined - -Coefficients cannot be set in the data file or via the bond_coeff -command until an bond_style has been assigned. - -E: Bond_coeff command when no bonds allowed - -The chosen atom style does not allow for bonds to be defined. - -E: Bond_style command when no bonds allowed - -The chosen atom style does not allow for bonds to be defined. - -E: Bond_write command when no bonds allowed - -UNDOCUMENTED - -E: Bond_write command before bond_style is defined - -UNDOCUMENTED - -E: Boundary command after simulation box is defined - -The boundary command cannot be used after a read_data, read_restart, -or create_box command. - -E: Box command after simulation box is defined - -The box command cannot be used after a read_data, read_restart, or -create_box command. - -E: Dihedral_coeff command before simulation box is defined - -The dihedral_coeff command cannot be used before a read_data, -read_restart, or create_box command. - -E: Dihedral_coeff command before dihedral_style is defined - -Coefficients cannot be set in the data file or via the dihedral_coeff -command until an dihedral_style has been assigned. - -E: Dihedral_coeff command when no dihedrals allowed - -The chosen atom style does not allow for dihedrals to be defined. - -E: Dihedral_style command when no dihedrals allowed - -The chosen atom style does not allow for dihedrals to be defined. - -E: Dimension command after simulation box is defined - -The dimension command cannot be used after a read_data, -read_restart, or create_box command. - -E: Improper_coeff command before simulation box is defined - -The improper_coeff command cannot be used before a read_data, -read_restart, or create_box command. - -E: Improper_coeff command before improper_style is defined - -Coefficients cannot be set in the data file or via the improper_coeff -command until an improper_style has been assigned. - -E: Improper_coeff command when no impropers allowed - -The chosen atom style does not allow for impropers to be defined. - -E: Improper_style command when no impropers allowed - -The chosen atom style does not allow for impropers to be defined. - -E: KSpace style has not yet been set - -Cannot use kspace_modify command until a kspace style is set. - -E: Mass command before simulation box is defined - -The mass command cannot be used before a read_data, read_restart, or -create_box command. - -E: Min_style command before simulation box is defined - -The min_style command cannot be used before a read_data, read_restart, -or create_box command. - -E: Newton bond change after simulation box is defined - -The newton command cannot be used to change the newton bond value -after a read_data, read_restart, or create_box command. - -E: Package command after simulation box is defined - -The package command cannot be used after a read_data, read_restart, or -create_box command. - -E: Package gpu command without GPU package installed - -The GPU package must be installed via "make yes-gpu" before LAMMPS is -built. - -E: Package kokkos command without KOKKOS package enabled - -The KOKKOS package must be installed via "make yes-kokkos" before -LAMMPS is built, and the "-k on" must be used to enable the package. - -E: Package omp command without OPENMP package installed - -The OPENMP package must be installed via "make yes-openmp" before -LAMMPS is built. - -E: Package intel command without INTEL package installed - -The INTEL package must be installed via "make yes-intel" -before LAMMPS is built. - -E: Pair_coeff command before simulation box is defined - -The pair_coeff command cannot be used before a read_data, -read_restart, or create_box command. - -E: Pair_coeff command before pair_style is defined - -Self-explanatory. - -E: Pair_modify command before pair_style is defined - -Self-explanatory. - -E: Pair_write command before pair_style is defined - -Self-explanatory. - -E: Processors command after simulation box is defined - -The processors command cannot be used after a read_data, read_restart, -or create_box command. - -E: Run_style command before simulation box is defined - -The run_style command cannot be used before a read_data, -read_restart, or create_box command. - -E: Units command after simulation box is defined - -The units command cannot be used after a read_data, read_restart, or -create_box command. - -U: Substitution for illegal variable - -Input script line contained a variable that could not be substituted -for. - -*/ diff --git a/src/integrate.h b/src/integrate.h index e2bf3d33e1..e7e1fef837 100644 --- a/src/integrate.h +++ b/src/integrate.h @@ -53,7 +53,3 @@ class Integrate : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/irregular.h b/src/irregular.h index b1abab67f1..c88471017f 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -98,7 +98,3 @@ class Irregular : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/kspace.h b/src/kspace.h index e3fb5047a8..baf984ff74 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -220,75 +220,3 @@ class KSpace : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: KSpace style does not yet support triclinic geometries - -The specified kspace style does not allow for non-orthogonal -simulation boxes. - -E: KSpace solver requires a pair style - -No pair style is defined. - -E: KSpace style is incompatible with Pair style - -Setting a kspace style requires that a pair style with matching -long-range Coulombic or dispersion components be used. - -W: Using kspace solver on system with no charge - -Self-explanatory. - -E: System is not charge neutral, net charge = %g - -The total charge on all atoms on the system is not 0.0. -For some KSpace solvers this is an error. - -W: System is not charge neutral, net charge = %g - -The total charge on all atoms on the system is not 0.0. -For some KSpace solvers this is only a warning. - -W: For better accuracy use 'pair_modify table 0' - -The user-specified force accuracy cannot be achieved unless the table -feature is disabled by using 'pair_modify table 0'. - -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: Bad kspace_modify slab parameter - -Kspace_modify value for the slab/volume keyword must be >= 2.0. - -E: Kspace_modify mesh parameter must be all zero or all positive - -Valid kspace mesh parameters are >0. The code will try to auto-detect -suitable values when all three mesh sizes are set to zero (the default). - -E: Kspace_modify mesh/disp parameter must be all zero or all positive - -Valid kspace mesh/disp parameters are >0. The code will try to auto-detect -suitable values when all three mesh sizes are set to zero [and] -the required accuracy via {force/disp/real} as well as -{force/disp/kspace} is set. - -W: Kspace_modify slab param < 2.0 may cause unphysical behavior - -The kspace_modify slab parameter should be larger to insure periodic -grids padded with empty space do not overlap. - -E: Bad kspace_modify kmax/ewald parameter - -Kspace_modify values for the kmax/ewald keyword must be integers > 0 - -E: Kspace_modify eigtol must be smaller than one - -Self-explanatory. - -*/ diff --git a/src/kspace_deprecated.h b/src/kspace_deprecated.h index cfd1af66de..9c140af808 100644 --- a/src/kspace_deprecated.h +++ b/src/kspace_deprecated.h @@ -38,7 +38,3 @@ class KSpaceDeprecated : public KSpace { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/lammps.h b/src/lammps.h index 5ccc1a90a9..4f3e9cf110 100644 --- a/src/lammps.h +++ b/src/lammps.h @@ -99,125 +99,3 @@ class LAMMPS { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid command-line argument - -One or more command-line arguments is invalid. Check the syntax of -the command you are using to launch LAMMPS. - -E: Cannot use -reorder after -partition - -Self-explanatory. See doc page discussion of command-line switches. - -E: Processor partitions do not match number of allocated processors - -The total number of processors in all partitions must match the number -of processors LAMMPS is running on. - -E: Must use -in switch with multiple partitions - -A multi-partition simulation cannot read the input script from stdin. -The -in command-line option must be used to specify a file. - -E: Can only use -pscreen with multiple partitions - -Self-explanatory. See doc page discussion of command-line switches. - -E: Can only use -plog with multiple partitions - -Self-explanatory. See doc page discussion of command-line switches. - -E: Cannot open universe screen file - -For a multi-partition run, the master screen file cannot be opened. -Check that the directory you are running in allows for files to be -created. - -E: Cannot open log.lammps for writing - -The default LAMMPS log file cannot be opened. Check that the -directory you are running in allows for files to be created. - -E: Cannot open universe log file - -For a multi-partition run, the master log file cannot be opened. -Check that the directory you are running in allows for files to be -created. - -E: Cannot open input script %s - -Self-explanatory. - -E: Cannot open screen file - -The screen file specified as a command-line argument cannot be -opened. Check that the directory you are running in allows for files -to be created. - -E: Cannot open logfile - -The LAMMPS log file named in a command-line argument cannot be opened. -Check that the path and name are correct. - -E: Smallint setting in lmptype.h is invalid - -It has to be the size of an integer. - -E: Imageint setting in lmptype.h is invalid - -Imageint must be as large or larger than smallint. - -E: Tagint setting in lmptype.h is invalid - -Tagint must be as large or larger than smallint. - -E: Bigint setting in lmptype.h is invalid - -Size of bigint is less than size of tagint. - -E: MPI_LMP_TAGINT and tagint in lmptype.h are not compatible - -The size of the MPI datatype does not match the size of a tagint. - -E: MPI_LMP_BIGINT and bigint in lmptype.h are not compatible - -The size of the MPI datatype does not match the size of a bigint. - -E: Small to big integers are not sized correctly - -This error occurs when the sizes of smallint, imageint, tagint, bigint, -as defined in src/lmptype.h are not what is expected. Contact -the developers if this occurs. - -E: Cannot use -kokkos on without KOKKOS installed - -Self-explanatory. - -E: Using suffix gpu without GPU package installed - -Self-explanatory. - -E: Using suffix intel without INTEL package installed - -Self-explanatory. - -E: Using suffix kk without KOKKOS package enabled - -Self-explanatory. - -E: Using suffix omp without OPENMP package installed - -Self-explanatory. - -E: Too many -pk arguments in command line - -The string formed by concatenating the arguments is too long. Use a -package command in the input script instead. - -U: Cannot use -cuda on and -kokkos on together - -This is not allowed since both packages can use GPUs. - -*/ diff --git a/src/lattice.h b/src/lattice.h index 1e81401240..67b9ce61ea 100644 --- a/src/lattice.h +++ b/src/lattice.h @@ -60,59 +60,3 @@ class Lattice : protected Pointers { } // namespace LAMMPS_NS #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: Lattice style incompatible with simulation dimension - -2d simulation can use sq, sq2, or hex lattice. 3d simulation can use -sc, bcc, or fcc lattice. - -E: Invalid option in lattice command for non-custom style - -Certain lattice keywords are not supported unless the -lattice style is "custom". - -E: No basis atoms in lattice - -Basis atoms must be defined for lattice style user. - -E: Lattice orient vectors are not orthogonal - -The three specified lattice orientation vectors must be mutually -orthogonal. - -E: Lattice orient vectors are not right-handed - -The three specified lattice orientation vectors must create a -right-handed coordinate system such that a1 cross a2 = a3. - -E: Lattice primitive vectors are collinear - -The specified lattice primitive vectors do not for a unit cell with -non-zero volume. - -E: Lattice settings are not compatible with 2d simulation - -One or more of the specified lattice vectors has a non-zero z -component. - -E: Lattice spacings are invalid - -Each x,y,z spacing must be > 0. - -E: Degenerate lattice primitive vectors - -Invalid set of 3 lattice vectors for lattice command. - -E: Zero-length lattice orient vector - -Self-explanatory. - -*/ diff --git a/src/library.cpp b/src/library.cpp index c2ae52a809..793c817e9a 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -290,7 +290,7 @@ multiple LAMMPS instances concurrently or sequentially. See void lammps_close(void *handle) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; delete lmp; } @@ -440,7 +440,7 @@ and :cpp:func:`Input::file()`. void lammps_file(void *handle, const char *filename) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -477,7 +477,7 @@ passing a string without a command. char *lammps_command(void *handle, const char *cmd) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; char *result = nullptr; BEGIN_CAPTURE @@ -548,7 +548,7 @@ executing. void lammps_commands_string(void *handle, const char *str) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; // copy str and convert from CR-LF (DOS-style) to LF (Unix style) line int n = strlen(str); @@ -624,9 +624,9 @@ the size of a ``bigint`` integer. double lammps_get_natoms(void *handle) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; - double natoms = static_cast(lmp->atom->natoms); + auto natoms = static_cast(lmp->atom->natoms); if (natoms > 9.0e15) return 0; // TODO:XXX why not -1? return natoms; } @@ -650,7 +650,7 @@ a ``double``, so it can also return information that is computed on-the-fly. double lammps_get_thermo(void *handle, const char *keyword) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; double dval = 0.0; BEGIN_CAPTURE @@ -690,7 +690,7 @@ void lammps_extract_box(void *handle, double *boxlo, double *boxhi, double *xy, double *yz, double *xz, int *pflags, int *boxflag) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Domain *domain = lmp->domain; BEGIN_CAPTURE @@ -752,7 +752,7 @@ are created. void lammps_reset_box(void *handle, double *boxlo, double *boxhi, double xy, double yz, double xz) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Domain *domain = lmp->domain; BEGIN_CAPTURE @@ -813,7 +813,7 @@ system it will be set to zero. void lammps_memory_usage(void *handle, double *meminfo) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); info.get_memory_info(meminfo); } @@ -993,7 +993,7 @@ not recognized, the function returns -1. int lammps_extract_setting(void *handle, const char *keyword) { - LAMMPS *lmp = (LAMMPS *) handle; + auto 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); @@ -1438,7 +1438,7 @@ report the "native" data type. The following tables are provided: void *lammps_extract_global(void *handle, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(name,"units") == 0) return (void *) lmp->update->unit_style; if (strcmp(name,"dt") == 0) return (void *) &lmp->update->dt; @@ -1450,7 +1450,7 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"atimestep") == 0) return (void *) &lmp->update->atimestep; if (utils::strmatch(lmp->update->integrate_style,"^respa")) { - Respa *respa = (Respa *)lmp->update->integrate; + auto respa = dynamic_cast(lmp->update->integrate); if (strcmp(name,"respa_levels") == 0) return (void *) &respa->nlevels; if (strcmp(name,"respa_dt") == 0) return (void *) respa->step; } @@ -1537,7 +1537,7 @@ to then decide how to cast the (void*) pointer and access the data. int lammps_extract_atom_datatype(void *handle, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->atom->extract_datatype(name); } @@ -1571,7 +1571,7 @@ of the :cpp:func:`Atom::extract() ` function. void *lammps_extract_atom(void *handle, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->atom->extract(name); } @@ -1685,7 +1685,7 @@ lists the available options. void *lammps_extract_compute(void *handle, const char *id, int style, int type) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1871,7 +1871,7 @@ The following table lists the available options. void *lammps_extract_fix(void *handle, const char *id, int style, int type, int nrow, int ncol) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -1881,19 +1881,19 @@ void *lammps_extract_fix(void *handle, const char *id, int style, int type, if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { if (!fix->scalar_flag) return nullptr; - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_scalar(); return (void *) dptr; } if (type == LMP_TYPE_VECTOR) { if (!fix->vector_flag) return nullptr; - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_vector(nrow); return (void *) dptr; } if (type == LMP_TYPE_ARRAY) { if (!fix->array_flag) return nullptr; - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_array(nrow,ncol); return (void *) dptr; } @@ -1995,7 +1995,7 @@ a char pointer. void *lammps_extract_variable(void *handle, const char *name, const char *group) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2003,7 +2003,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) if (ivar < 0) return nullptr; if (lmp->input->variable->equalstyle(ivar)) { - double *dptr = (double *) malloc(sizeof(double)); + auto dptr = (double *) malloc(sizeof(double)); *dptr = lmp->input->variable->compute_equal(ivar); return (void *) dptr; } else if (lmp->input->variable->atomstyle(ivar)) { @@ -2011,7 +2011,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) int igroup = lmp->group->find(group); if (igroup < 0) return nullptr; int nlocal = lmp->atom->nlocal; - double *vector = (double *) malloc(nlocal*sizeof(double)); + auto vector = (double *) malloc(nlocal*sizeof(double)); lmp->input->variable->compute_atom(ivar,igroup,vector,1,0); return (void *) vector; } else { @@ -2039,7 +2039,7 @@ void *lammps_extract_variable(void *handle, const char *name, const char *group) */ int lammps_set_variable(void *handle, char *name, char *str) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; int err = -1; BEGIN_CAPTURE @@ -2078,7 +2078,7 @@ int lammps_set_variable(void *handle, char *name, char *str) void lammps_gather_atoms(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2213,7 +2213,7 @@ void lammps_gather_atoms(void *handle, char *name, int type, int count, void *da void lammps_gather_atoms_concat(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2362,7 +2362,7 @@ void lammps_gather_atoms_concat(void *handle, char *name, int type, int count, v void lammps_gather_atoms_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2500,7 +2500,7 @@ void lammps_gather_atoms_subset(void *handle, char *name, int type, int count, void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2576,7 +2576,7 @@ void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *d double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < natoms; i++) @@ -2619,7 +2619,7 @@ void lammps_scatter_atoms(void *handle, char *name, int type, int count, void *d void lammps_scatter_atoms_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -2699,7 +2699,7 @@ void lammps_scatter_atoms_subset(void *handle, char *name, int type, int count, double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < ndata; i++) { @@ -2800,7 +2800,7 @@ Below is a brief C code demonstrating accessing this collected bond information. void lammps_gather_bonds(void *handle, void *data) { - LAMMPS *lmp = (LAMMPS *)handle; + auto lmp = (LAMMPS *)handle; BEGIN_CAPTURE { void *val = lammps_extract_global(handle,"nbonds"); bigint nbonds = *(bigint *)val; @@ -2861,7 +2861,7 @@ void lammps_gather_bonds(void *handle, void *data) void lammps_gather(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3096,7 +3096,7 @@ void lammps_gather(void *handle, char *name, int type, int count, void *data) void lammps_gather_concat(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3350,7 +3350,7 @@ void lammps_gather_subset(void *handle, char *name, int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3596,7 +3596,7 @@ void lammps_gather_subset(void *handle, char *name, void lammps_scatter(void *handle, char *name, int type, int count, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3767,7 +3767,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < natoms; i++) @@ -3814,7 +3814,7 @@ void lammps_scatter(void *handle, char *name, int type, int count, void *data) void lammps_scatter_subset(void *handle, char *name,int type, int count, int ndata, int *ids, void *data) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -3991,7 +3991,7 @@ void lammps_scatter_subset(void *handle, char *name,int type, int count, double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; - double *dptr = (double *) data; + auto dptr = (double *) data; if (count == 1) { for (i = 0; i < ndata; i++) { @@ -4074,7 +4074,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, const double *x, const double *v, const imageint *image, int bexpand) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; bigint natoms_prev = lmp->atom->natoms; BEGIN_CAPTURE @@ -4196,7 +4196,7 @@ int lammps_create_atoms(void *handle, int n, const tagint *id, const int *type, * \return return neighbor list index if found, otherwise -1 */ int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int nsub, int reqid) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Pair *pair = lmp->force->pair_match(style, exact, nsub); if (pair != nullptr) { @@ -4226,7 +4226,7 @@ int lammps_find_pair_neighlist(void *handle, const char *style, int exact, int n * \return return neighbor list index if found, otherwise -1 */ int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; auto fix = lmp->modify->get_fix_by_id(id); if (!fix) return -1; @@ -4255,7 +4255,7 @@ int lammps_find_fix_neighlist(void *handle, const char *id, int reqid) { * \return return neighbor list index if found, otherwise -1 */ int lammps_find_compute_neighlist(void* handle, const char *id, int reqid) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; auto compute = lmp->modify->get_compute_by_id(id); if (!compute) return -1; @@ -4279,7 +4279,7 @@ int lammps_find_compute_neighlist(void* handle, const char *id, int reqid) { * not a valid index */ int lammps_neighlist_num_elements(void *handle, int idx) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; if (idx < 0 || idx >= neighbor->nlist) { @@ -4304,7 +4304,7 @@ int lammps_neighlist_num_elements(void *handle, int idx) { * \param[out] neighbors pointer to array of neighbor atom local indices or NULL */ void lammps_neighlist_element_neighbors(void *handle, int idx, int element, int *iatom, int *numneigh, int **neighbors) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; *iatom = -1; *numneigh = 0; @@ -4348,7 +4348,7 @@ growing with every new LAMMPS release. int lammps_version(void *handle) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->num_ver; } @@ -4662,7 +4662,7 @@ Valid categories are: *atom*\ , *integrate*\ , *minimize*\ , * \return 1 if included, 0 if not. */ int lammps_has_style(void *handle, const char *category, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); return info.has_style(category, name) ? 1 : 0; } @@ -4683,7 +4683,7 @@ categories. * \return number of styles in category */ int lammps_style_count(void *handle, const char *category) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); return info.get_available_styles(category).size(); } @@ -4709,7 +4709,7 @@ int lammps_style_count(void *handle, const char *category) { */ int lammps_style_name(void *handle, const char *category, int idx, char *buffer, int buf_size) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; Info info(lmp); auto styles = info.get_available_styles(category); @@ -4741,7 +4741,7 @@ the given *name* exists. Valid categories are: *compute*\ , *dump*\ , * \return 1 if included, 0 if not. */ int lammps_has_id(void *handle, const char *category, const char *name) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { int ncompute = lmp->modify->ncompute; @@ -4772,10 +4772,8 @@ int lammps_has_id(void *handle, const char *category, const char *name) { if (strcmp(name,molecule[i]->id) == 0) return 1; } } else if (strcmp(category,"region") == 0) { - int nregion = lmp->domain->nregion; - Region **region = lmp->domain->regions; - for (int i=0; i < nregion; ++i) { - if (strcmp(name,region[i]->id) == 0) return 1; + for (auto ® : lmp->domain->get_region_list()) { + if (strcmp(name,reg->id) == 0) return 1; } } else if (strcmp(category,"variable") == 0) { int nvariable = lmp->input->variable->nvar; @@ -4806,7 +4804,7 @@ categories. * \return number of IDs in category */ int lammps_id_count(void *handle, const char *category) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { return lmp->modify->ncompute; } else if (strcmp(category,"dump") == 0) { @@ -4818,7 +4816,7 @@ int lammps_id_count(void *handle, const char *category) { } else if (strcmp(category,"molecule") == 0) { return lmp->atom->nmolecule; } else if (strcmp(category,"region") == 0) { - return lmp->domain->nregion; + return lmp->domain->get_region_list().size(); } else if (strcmp(category,"variable") == 0) { return lmp->input->variable->nvar; } @@ -4848,9 +4846,8 @@ set to an empty string, otherwise 1. * \param buf_size size of the provided string buffer * \return 1 if successful, otherwise 0 */ -int lammps_id_name(void *handle, const char *category, int idx, - char *buffer, int buf_size) { - LAMMPS *lmp = (LAMMPS *) handle; +int lammps_id_name(void *handle, const char *category, int idx, char *buffer, int buf_size) { + auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { if ((idx >=0) && (idx < lmp->modify->ncompute)) { @@ -4878,8 +4875,9 @@ int lammps_id_name(void *handle, const char *category, int idx, return 1; } } else if (strcmp(category,"region") == 0) { - if ((idx >=0) && (idx < lmp->domain->nregion)) { - strncpy(buffer, lmp->domain->regions[idx]->id, buf_size); + auto regions = lmp->domain->get_region_list(); + if ((idx >=0) && (idx < (int) regions.size())) { + strncpy(buffer, regions[idx]->id, buf_size); return 1; } } else if (strcmp(category,"variable") == 0) { @@ -5065,8 +5063,8 @@ external code. void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalFnPtr funcptr, void *ptr) { - LAMMPS *lmp = (LAMMPS *) handle; - FixExternal::FnPtr callback = (FixExternal::FnPtr) funcptr; + auto lmp = (LAMMPS *) handle; + auto callback = (FixExternal::FnPtr) funcptr; BEGIN_CAPTURE { @@ -5076,7 +5074,7 @@ void lammps_set_fix_external_callback(void *handle, const char *id, FixExternalF if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style 'external'", id); - FixExternal *fext = (FixExternal *) fix; + auto fext = dynamic_cast( fix); fext->set_callback(callback, ptr); } END_CAPTURE @@ -5126,7 +5124,7 @@ external code. double **lammps_fix_external_get_force(void *handle, const char *id) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; double **fexternal = nullptr; BEGIN_CAPTURE @@ -5174,7 +5172,7 @@ external code. void lammps_fix_external_set_energy_global(void *handle, const char *id, double eng) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5184,7 +5182,7 @@ void lammps_fix_external_set_energy_global(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal *fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_energy_global(eng); } END_CAPTURE @@ -5222,7 +5220,7 @@ external code. void lammps_fix_external_set_virial_global(void *handle, const char *id, double *virial) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5232,7 +5230,7 @@ void lammps_fix_external_set_virial_global(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_virial_global(virial); } END_CAPTURE @@ -5270,7 +5268,7 @@ external code. void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double *eng) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5280,7 +5278,7 @@ void lammps_fix_external_set_energy_peratom(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal *fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_energy_peratom(eng); } END_CAPTURE @@ -5321,7 +5319,7 @@ external code. void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double **virial) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5331,7 +5329,7 @@ void lammps_fix_external_set_virial_peratom(void *handle, const char *id, double if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_virial_peratom(virial); } END_CAPTURE @@ -5365,7 +5363,7 @@ external code. void lammps_fix_external_set_vector_length(void *handle, const char *id, int len) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5375,7 +5373,7 @@ void lammps_fix_external_set_vector_length(void *handle, const char *id, int len if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal *fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_vector_length(len); } END_CAPTURE @@ -5419,7 +5417,7 @@ external code. void lammps_fix_external_set_vector(void *handle, const char *id, int idx, double val) { - LAMMPS *lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; BEGIN_CAPTURE { @@ -5429,7 +5427,7 @@ void lammps_fix_external_set_vector(void *handle, const char *id, int idx, doubl if (strcmp("external",fix->style) != 0) lmp->error->all(FLERR,"Fix '{}' is not of style external!", id); - FixExternal * fext = (FixExternal*) fix; + auto fext = dynamic_cast( fix); fext->set_vector(idx, val); } END_CAPTURE @@ -5482,7 +5480,7 @@ void lammps_free(void *ptr) int lammps_is_running(void *handle) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->update->whichflag; } @@ -5495,7 +5493,7 @@ int lammps_is_running(void *handle) void lammps_force_timeout(void *handle) { - LAMMPS * lmp = (LAMMPS *) handle; + auto lmp = (LAMMPS *) handle; return lmp->timer->force_timeout(); } diff --git a/src/library.h b/src/library.h index 94fd7f7380..311219e5ba 100644 --- a/src/library.h +++ b/src/library.h @@ -262,57 +262,6 @@ int lammps_get_last_error_message(void *handle, char *buffer, int buf_size); #endif /* LAMMPS_LIBRARY_H */ -/* ERROR/WARNING messages: - -E: Library error: issuing LAMMPS command during run - -UNDOCUMENTED - -W: Library error in lammps_gather_atoms - -This library function cannot be used if atom IDs are not defined -or are not consecutively numbered. - -W: lammps_gather_atoms: unknown property name - -UNDOCUMENTED - -W: Library error in lammps_gather_atoms_subset - -UNDOCUMENTED - -W: lammps_gather_atoms_subset: unknown property name - -UNDOCUMENTED - -W: Library error in lammps_scatter_atoms - -This library function cannot be used if atom IDs are not defined or -are not consecutively numbered, or if no atom map is defined. See the -atom_modify command for details about atom maps. - -W: lammps_scatter_atoms: unknown property name - -UNDOCUMENTED - -W: Library error in lammps_scatter_atoms_subset - -UNDOCUMENTED - -W: lammps_scatter_atoms_subset: unknown property name - -UNDOCUMENTED - -W: Library error in lammps_create_atoms - -UNDOCUMENTED - -W: Library warning in lammps_create_atoms, invalid total atoms %ld %ld - -UNDOCUMENTED - -*/ - /* Local Variables: * fill-column: 72 * End: */ diff --git a/src/lmppython.h b/src/lmppython.h index e923b38808..145c06a6af 100644 --- a/src/lmppython.h +++ b/src/lmppython.h @@ -55,75 +55,3 @@ class Python : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Python support missing! Compile with PYTHON package installed! - -UNDOCUMENTED - -U: Invalid python 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. - -U: Python invoke of undefined function - -Cannot invoke a function that has not been previously defined. - -U: Python variable does not match Python function - -This matching is defined by the python-style variable and the python -command. - -U: Cannot embed Python when also extending Python with LAMMPS - -When running LAMMPS via Python through the LAMMPS library interface -you cannot also user the input script python command. - -U: Could not initialize embedded Python - -The main module in Python was not accessible. - -U: Could not open Python file - -The specified file of Python code cannot be opened. Check that the -path and name are correct. - -U: Could not process Python file - -The Python code in the specified file was not run successfully by -Python, probably due to errors in the Python code. - -U: Could not process Python string - -The Python code in the here string was not run successfully by Python, -probably due to errors in the Python code. - -U: Could not find Python function - -The provided Python code was run successfully, but it not -define a callable function with the required name. - -U: Python function is not callable - -The provided Python code was run successfully, but it not -define a callable function with the required name. - -U: Could not create Python function arguments - -This is an internal Python error, possibly because the number -of inputs to the function is too large. - -U: Could not evaluate Python function input variable - -Self-explanatory. - -U: Python function evaluation failed - -The Python function did not run successfully and/or did not return a -value (if it is supposed to return a value). This is probably due to -some error condition in the function. - -*/ diff --git a/src/lmptype.h b/src/lmptype.h index f46956e7d2..e02cd74734 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -55,11 +55,15 @@ namespace LAMMPS_NS { -// reserve 2 hi bits in molecular system neigh list for special bonds flag -// max local + ghost atoms per processor = 2^30 - 1 +// reserve 2 highest bits in molecular system neigh list for special bonds flag +// reserve 3rd highest bit in neigh list for fix neigh/history flag +// max local + ghost atoms per processor = 2^29 - 1 #define SBBITS 30 -#define NEIGHMASK 0x3FFFFFFF +#define HISTBITS 29 +#define NEIGHMASK 0x1FFFFFFF +#define HISTMASK 0xDFFFFFFF +#define SPECIALMASK 0x3FFFFFFF // default to 32-bit smallint and other ints, 64-bit bigint diff --git a/src/main.cpp b/src/main.cpp index 095e1752da..19ccbb465a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,7 +72,7 @@ int main(int argc, char **argv) #ifdef LAMMPS_EXCEPTIONS try { - LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm); + auto lammps = new LAMMPS(argc, argv, lammps_comm); lammps->input->file(); delete lammps; } catch (LAMMPSAbortException &ae) { @@ -94,7 +94,7 @@ int main(int argc, char **argv) } #else try { - LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm); + auto lammps = new LAMMPS(argc, argv, lammps_comm); lammps->input->file(); delete lammps; } catch (fmt::format_error &fe) { diff --git a/src/math_const.h b/src/math_const.h index 1ad0b3e717..1a6b5c3b47 100644 --- a/src/math_const.h +++ b/src/math_const.h @@ -23,6 +23,7 @@ namespace MathConst { static constexpr double MY_2PI = 6.28318530717958647692; // 2pi static constexpr double MY_3PI = 9.42477796076937971538; // 3pi static constexpr double MY_4PI = 12.56637061435917295384; // 4pi + static constexpr double MY_4PI3 = 4.18879020478639098461; // 4/3pi static constexpr double MY_PI2 = 1.57079632679489661923; // pi/2 static constexpr double MY_PI4 = 0.78539816339744830962; // pi/4 static constexpr double MY_PIS = 1.77245385090551602729; // sqrt(pi) diff --git a/src/math_extra.cpp b/src/math_extra.cpp index 54f6204182..15d6e472c9 100644 --- a/src/math_extra.cpp +++ b/src/math_extra.cpp @@ -143,6 +143,58 @@ void richardson(double *q, double *m, double *w, double *moments, double dtq) MathExtra::qnormalize(q); } +/* ---------------------------------------------------------------------- + Richardson iteration to update quaternion from angular velocity + return new normalized quaternion q + also returns updated omega at 1/2 step + Assumes spherical particles - no need to rotate to match moments +------------------------------------------------------------------------- */ + +void richardson_sphere(double *q, double *w, double dtq) +{ + // full update from dq/dt = 1/2 w q + + double wq[4]; + MathExtra::vecquat(w,q,wq); + + double qfull[4]; + qfull[0] = q[0] + dtq * wq[0]; + qfull[1] = q[1] + dtq * wq[1]; + qfull[2] = q[2] + dtq * wq[2]; + qfull[3] = q[3] + dtq * wq[3]; + MathExtra::qnormalize(qfull); + + // 1st half update from dq/dt = 1/2 w q + + double qhalf[4]; + qhalf[0] = q[0] + 0.5*dtq * wq[0]; + qhalf[1] = q[1] + 0.5*dtq * wq[1]; + qhalf[2] = q[2] + 0.5*dtq * wq[2]; + qhalf[3] = q[3] + 0.5*dtq * wq[3]; + MathExtra::qnormalize(qhalf); + + // re-compute q at 1/2 step + // recompute wq + + MathExtra::vecquat(w,qhalf,wq); + + // 2nd half update from dq/dt = 1/2 w q + + qhalf[0] += 0.5*dtq * wq[0]; + qhalf[1] += 0.5*dtq * wq[1]; + qhalf[2] += 0.5*dtq * wq[2]; + qhalf[3] += 0.5*dtq * wq[3]; + MathExtra::qnormalize(qhalf); + + // corrected Richardson update + + q[0] = 2.0*qhalf[0] - qfull[0]; + q[1] = 2.0*qhalf[1] - qfull[1]; + q[2] = 2.0*qhalf[2] - qfull[2]; + q[3] = 2.0*qhalf[3] - qfull[3]; + MathExtra::qnormalize(q); +} + /* ---------------------------------------------------------------------- apply evolution operators to quat, quat momentum Miller et al., J Chem Phys. 116, 8649-8659 (2002) diff --git a/src/math_extra.h b/src/math_extra.h index 7c71e4c11b..cbf9f78e53 100644 --- a/src/math_extra.h +++ b/src/math_extra.h @@ -76,6 +76,7 @@ void write3(const double mat[3][3]); int mldivide3(const double mat[3][3], const double *vec, double *ans); void rotate(double matrix[3][3], int i, int j, int k, int l, double s, double tau); void richardson(double *q, double *m, double *w, double *moments, double dtq); +void richardson_sphere(double *q, double *w, double dtq); void no_squish_rotate(int k, double *p, double *q, double *inertia, double dt); // shape matrix operations @@ -91,6 +92,7 @@ inline void vecquat(double *a, double *b, double *c); inline void quatvec(double *a, double *b, double *c); inline void quatquat(double *a, double *b, double *c); inline void invquatvec(double *a, double *b, double *c); +inline void quatrotvec(double *a, double *b, double *c); inline void axisangle_to_quat(const double *v, const double angle, double *quat); void angmom_to_omega(double *m, double *ex, double *ey, double *ez, double *idiag, double *w); @@ -651,6 +653,29 @@ inline void MathExtra::invquatvec(double *a, double *b, double *c) c[2] = -a[3] * b[0] + a[2] * b[1] - a[1] * b[2] + a[0] * b[3]; } +/* ---------------------------------------------------------------------- + quaternion rotation of vector: c = a*b*conj(a) + a is a quaternion + b is a three component vector + c is a three component vector +------------------------------------------------------------------------- */ + +inline void MathExtra::quatrotvec(double *a, double *b, double *c) +{ + double temp[4]; + + // temp = a*b + temp[0] = -a[1] * b[0] - a[2] * b[1] - a[3] * b[2]; + temp[1] = a[0] * b[0] + a[2] * b[2] - a[3] * b[1]; + temp[2] = a[0] * b[1] + a[3] * b[0] - a[1] * b[2]; + temp[3] = a[0] * b[2] + a[1] * b[1] - a[2] * b[0]; + + // c = temp*conj(a) + c[0] = -a[1] * temp[0] + a[0] * temp[1] - a[3] * temp[2] + a[2] * temp[3]; + c[1] = -a[2] * temp[0] + a[3] * temp[1] + a[0] * temp[2] - a[1] * temp[3]; + c[2] = -a[3] * temp[0] - a[2] * temp[1] + a[1] * temp[2] + a[0] * temp[3]; +} + /* ---------------------------------------------------------------------- compute quaternion from axis-angle rotation v MUST be a unit vector diff --git a/src/memory.h b/src/memory.h index 5095cbb0a6..b680821d0d 100644 --- a/src/memory.h +++ b/src/memory.h @@ -27,7 +27,7 @@ class Memory : protected Pointers { void sfree(void *); void fail(const char *); -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create/grow/destroy vecs and multidim arrays with contiguous memory blocks only use with primitive data types, e.g. 1d vec of ints, 2d array of doubles fail() prevents use with pointers, @@ -36,7 +36,7 @@ class Memory : protected Pointers { for these other cases, use smalloc/srealloc/sfree directly ------------------------------------------------------------------------- */ -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 1d array ------------------------------------------------------------------------- */ @@ -56,7 +56,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- grow or shrink 1d array ------------------------------------------------------------------------- */ @@ -81,7 +81,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 1d array ------------------------------------------------------------------------- */ @@ -91,7 +91,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 1d array with index from nlo to nhi inclusive cannot grow it ------------------------------------------------------------------------- */ @@ -114,7 +114,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 1d array with index offset ------------------------------------------------------------------------- */ @@ -124,7 +124,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 2d array ------------------------------------------------------------------------- */ @@ -153,7 +153,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 2d array last dim must stay the same ------------------------------------------------------------------------- */ @@ -188,7 +188,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 2d array ------------------------------------------------------------------------- */ @@ -200,7 +200,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 2d array with a ragged 2nd dimension ------------------------------------------------------------------------- */ @@ -226,15 +226,14 @@ class Memory : protected Pointers { } template - TYPE ***create_ragged(TYPE ***& array, int n1, int *n2, int **n3, const char *name) + TYPE ***create_ragged(TYPE ***&array, int n1, int *n2, int **n3, const char *name) { bigint size, nbytes; int i, j; size = 0; for (i = 0; i < n1; i++) - for (j = 0; j < n2[i]; j++) - size += n3[i][j]; + for (j = 0; j < n2[i]; j++) size += n3[i][j]; nbytes = ((bigint) sizeof(TYPE)) * size; TYPE *data = (TYPE *) smalloc(nbytes, name); @@ -260,7 +259,7 @@ class Memory : protected Pointers { return array; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive cannot grow it ------------------------------------------------------------------------- */ @@ -285,7 +284,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset ------------------------------------------------------------------------- */ @@ -297,7 +296,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 3d array ------------------------------------------------------------------------- */ @@ -334,7 +333,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 3d array last 2 dims must stay the same ------------------------------------------------------------------------- */ @@ -377,7 +376,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 3d array ------------------------------------------------------------------------- */ @@ -390,7 +389,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 3d array with 1st index from n1lo to n1hi inclusive cannot grow it ------------------------------------------------------------------------- */ @@ -414,7 +413,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- free a 3d array with 1st index offset ------------------------------------------------------------------------- */ @@ -427,7 +426,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 3d array with 1st index from n1lo to n1hi inclusive, 2nd index from n2lo to n2hi inclusive, @@ -461,7 +460,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- free a 3d array with all 3 indices offset ------------------------------------------------------------------------- */ @@ -475,7 +474,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 4d array ------------------------------------------------------------------------- */ @@ -522,7 +521,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 4d array last 3 dims must stay the same ------------------------------------------------------------------------- */ @@ -575,7 +574,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 4d array ------------------------------------------------------------------------- */ @@ -589,7 +588,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 4d array with indices 2nd index from n2lo to n2hi inclusive 3rd index from n3lo to n3hi inclusive @@ -624,7 +623,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- free a 4d array with indices 2,3,4 offset ------------------------------------------------------------------------- */ @@ -639,7 +638,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- create a 5d array ------------------------------------------------------------------------- */ @@ -693,7 +692,7 @@ class Memory : protected Pointers { return nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- destroy a 5d array ------------------------------------------------------------------------- */ @@ -708,7 +707,7 @@ class Memory : protected Pointers { array = nullptr; } -/* ---------------------------------------------------------------------- + /* ---------------------------------------------------------------------- memory usage of arrays, including pointers ------------------------------------------------------------------------- */ @@ -750,22 +749,3 @@ class Memory : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Failed to allocate %ld bytes for array %s - -Your LAMMPS simulation has run out of memory. You need to run a -smaller simulation or on more processors. - -E: Failed to reallocate %ld bytes for array %s - -Your LAMMPS simulation has run out of memory. You need to run a -smaller simulation or on more processors. - -E: Cannot create/grow a vector/array of pointers for %s - -LAMMPS code is making an illegal call to the templated memory -allocators, to create a vector or array of pointers. - -*/ diff --git a/src/min.cpp b/src/min.cpp index 0c71607bd8..1adb88184a 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -121,7 +121,7 @@ void Min::init() // create fix needed for storing atom-based quantities // will delete it at end of run - fix_minimize = (FixMinimize *) modify->add_fix("MINIMIZE all MINIMIZE"); + fix_minimize = dynamic_cast( modify->add_fix("MINIMIZE all MINIMIZE")); // clear out extra global and per-atom dof // will receive requests for new per-atom dof during pair init() diff --git a/src/min.h b/src/min.h index 82e14910d7..269726e7aa 100644 --- a/src/min.h +++ b/src/min.h @@ -149,53 +149,3 @@ class Min : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -W: Using 'neigh_modify every 1 delay 0 check yes' setting during minimization - -UNDOCUMENTED - -E: Minimization could not find thermo_pe compute - -This compute is created by the thermo command. It must have been -explicitly deleted by a uncompute command. - -E: Cannot use a damped dynamics min style with fix box/relax - -This is a current restriction in LAMMPS. Use another minimizer -style. - -E: Cannot use a damped dynamics min style with per-atom DOF - -This is a current restriction in LAMMPS. Use another minimizer -style. - -E: Cannot use hftn min style with fix box/relax - -UNDOCUMENTED - -E: Cannot use hftn min style with per-atom DOF - -UNDOCUMENTED - -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. - -U: Resetting reneighboring criteria during minimization - -Minimization requires that neigh_modify settings be delay = 0, every = -1, check = yes. Since these settings were not in place, LAMMPS -changed them and will restore them to their original values after the -minimization. - -U: Energy due to X extra global DOFs will be included in minimizer energies - -When using fixes like box/relax, the potential energy used by the minimizer -is augmented by an additional energy provided by the fix. Thus the printed -converged energy may be different from the total potential energy. - -*/ diff --git a/src/minimize.h b/src/minimize.h index 8fa1e6170b..5fbcb8d61e 100644 --- a/src/minimize.h +++ b/src/minimize.h @@ -34,27 +34,3 @@ class Minimize : public Command { #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: Minimize command before simulation box is defined - -The minimize command cannot be used before a read_data, read_restart, -or create_box command. - -E: Too many iterations - -You must use a number of iterations that fit in a 32-bit integer -for minimization. - -E: Cannot yet use minimize with Kokkos - -This feature is not yet supported. - -*/ diff --git a/src/modify.cpp b/src/modify.cpp index 7554079e2a..90b911b9ab 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -51,20 +51,22 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) nfix = maxfix = 0; n_initial_integrate = n_post_integrate = 0; n_pre_exchange = n_pre_neighbor = n_post_neighbor = 0; - n_pre_force = n_pre_reverse = n_post_force = 0; + n_pre_force = n_pre_reverse = n_post_force_any = 0; n_final_integrate = n_end_of_step = 0; n_energy_couple = n_energy_global = n_energy_atom = 0; n_initial_integrate_respa = n_post_integrate_respa = 0; - n_pre_force_respa = n_post_force_respa = n_final_integrate_respa = 0; + n_pre_force_respa = n_post_force_respa_any = n_final_integrate_respa = 0; n_min_pre_exchange = n_min_pre_force = n_min_pre_reverse = 0; n_min_post_force = n_min_energy = 0; + n_timeflag = -1; fix = nullptr; fmask = nullptr; list_initial_integrate = list_post_integrate = nullptr; list_pre_exchange = list_pre_neighbor = list_post_neighbor = nullptr; - list_pre_force = list_pre_reverse = list_post_force = nullptr; + list_pre_force = list_pre_reverse = nullptr; + list_post_force = list_post_force_group = nullptr; list_final_integrate = list_end_of_step = nullptr; list_energy_couple = list_energy_global = list_energy_atom = nullptr; list_initial_integrate_respa = list_post_integrate_respa = nullptr; @@ -139,6 +141,7 @@ Modify::~Modify() delete[] list_pre_force; delete[] list_pre_reverse; delete[] list_post_force; + delete[] list_post_force_group; delete[] list_final_integrate; delete[] list_end_of_step; delete[] list_energy_couple; @@ -221,6 +224,7 @@ void Modify::init() list_init(PRE_FORCE, n_pre_force, list_pre_force); list_init(PRE_REVERSE, n_pre_reverse, list_pre_reverse); list_init(POST_FORCE, n_post_force, list_post_force); + list_init_post_force_group(n_post_force_group, list_post_force_group); list_init(FINAL_INTEGRATE, n_final_integrate, list_final_integrate); list_init_end_of_step(END_OF_STEP, n_end_of_step, list_end_of_step); list_init_energy_couple(n_energy_couple, list_energy_couple); @@ -241,6 +245,11 @@ void Modify::init() list_init(MIN_POST_FORCE, n_min_post_force, list_min_post_force); list_init(MIN_ENERGY, n_min_energy, list_min_energy); + // two post_force_any counters used by integrators add in post_force_group + + n_post_force_any = n_post_force + n_post_force_group; + n_post_force_respa_any = n_post_force_respa + n_post_force_group; + // create list of computes that store invocation times list_init_compute(); @@ -441,11 +450,19 @@ void Modify::pre_reverse(int eflag, int vflag) /* ---------------------------------------------------------------------- post_force call, only for relevant fixes + first call any instances of fix GROUP if they exist + they are not in n_post_force count ------------------------------------------------------------------------- */ void Modify::post_force(int vflag) { - for (int i = 0; i < n_post_force; i++) fix[list_post_force[i]]->post_force(vflag); + if (n_post_force_group) { + for (int i = 0; i < n_post_force_group; i++) fix[list_post_force_group[i]]->post_force(vflag); + } + + if (n_post_force) { + for (int i = 0; i < n_post_force; i++) fix[list_post_force[i]]->post_force(vflag); + } } /* ---------------------------------------------------------------------- @@ -585,12 +602,20 @@ void Modify::pre_force_respa(int vflag, int ilevel, int iloop) /* ---------------------------------------------------------------------- rRESPA post_force call, only for relevant fixes + first call any instances of fix GROUP if they exist ------------------------------------------------------------------------- */ void Modify::post_force_respa(int vflag, int ilevel, int iloop) { - for (int i = 0; i < n_post_force_respa; i++) - fix[list_post_force_respa[i]]->post_force_respa(vflag, ilevel, iloop); + if (n_post_force_group) { + for (int i = 0; i < n_post_force_group; i++) + fix[list_post_force_group[i]]->post_force_respa(vflag, ilevel, iloop); + } + + if (n_post_force_respa) { + for (int i = 0; i < n_post_force_respa; i++) + fix[list_post_force_respa[i]]->post_force_respa(vflag, ilevel, iloop); + } } /* ---------------------------------------------------------------------- @@ -859,7 +884,7 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) fix[ifix]->style = utils::strdup(estyle); } } - if (fix[ifix] == nullptr && lmp->suffix2) { + if ((fix[ifix] == nullptr) && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (fix_map->find(estyle) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[estyle]; @@ -870,7 +895,7 @@ Fix *Modify::add_fix(int narg, char **arg, int trysuffix) } } - if (fix[ifix] == nullptr && fix_map->find(arg[2]) != fix_map->end()) { + if ((fix[ifix] == nullptr) && (fix_map->find(arg[2]) != fix_map->end())) { FixCreator &fix_creator = (*fix_map)[arg[2]]; fix[ifix] = fix_creator(lmp, narg, arg); } @@ -1716,6 +1741,25 @@ void Modify::list_init_energy_atom(int &n, int *&list) if (fix[i]->energy_peratom_flag && fix[i]->thermo_energy) list[n++] = i; } +/* ---------------------------------------------------------------------- + create list of fix indices for fix GROUP + are invoked first in post_force() or post_force_respa() +------------------------------------------------------------------------- */ + +void Modify::list_init_post_force_group(int &n, int *&list) +{ + delete[] list; + + n = 0; + for (int i = 0; i < nfix; i++) + if (strcmp(fix[i]->style, "GROUP") == 0) n++; + list = new int[n]; + + n = 0; + for (int i = 0; i < nfix; i++) + if (strcmp(fix[i]->style, "GROUP") == 0) list[n++] = i; +} + /* ---------------------------------------------------------------------- create list of compute indices for computes which store invocation times ------------------------------------------------------------------------- */ diff --git a/src/modify.h b/src/modify.h index df8e52752f..b339f31530 100644 --- a/src/modify.h +++ b/src/modify.h @@ -33,11 +33,11 @@ class Modify : protected Pointers { public: 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; + int n_pre_force, n_pre_reverse, n_post_force_any; int n_final_integrate, n_end_of_step; int n_energy_couple, n_energy_global, n_energy_atom; int n_initial_integrate_respa, n_post_integrate_respa; - int n_pre_force_respa, n_post_force_respa, n_final_integrate_respa; + int n_pre_force_respa, n_post_force_respa_any, n_final_integrate_respa; int n_min_pre_exchange, n_min_pre_neighbor, n_min_post_neighbor; int n_min_pre_force, n_min_pre_reverse, n_min_post_force, n_min_energy; @@ -147,11 +147,16 @@ class Modify : protected Pointers { double memory_usage(); protected: + // internal fix counts + + int n_post_force, n_post_force_group, n_post_force_respa; + // lists of fixes to apply at different stages of timestep int *list_initial_integrate, *list_post_integrate; int *list_pre_exchange, *list_pre_neighbor, *list_post_neighbor; - int *list_pre_force, *list_pre_reverse, *list_post_force; + int *list_pre_force, *list_pre_reverse; + int *list_post_force, *list_post_force_group; int *list_final_integrate, *list_end_of_step; int *list_energy_couple, *list_energy_global, *list_energy_atom; int *list_initial_integrate_respa, *list_post_integrate_respa; @@ -179,14 +184,16 @@ class Modify : protected Pointers { int index_permanent; // fix/compute index returned to library call // vectors to be used for new-API accessors as wrapper - std::vectorfix_list; - std::vectorcompute_list; + std::vector fix_list; + std::vector compute_list; void list_init(int, int &, int *&); void list_init_end_of_step(int, int &, int *&); void list_init_energy_couple(int &, int *&); void list_init_energy_global(int &, int *&); void list_init_energy_atom(int &, int *&); + void list_init_post_force_group(int &, int *&); + void list_init_post_force_respa_group(int &, int *&); void list_init_dofflag(int &, int *&); void list_init_compute(); @@ -206,85 +213,3 @@ class Modify : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Fix %s does not allow use of dynamic group - -Dynamic groups have not yet been enabled for this fix. - -E: Compute %s does not allow use of dynamic group - -Dynamic groups have not yet been enabled for this compute. - -W: One or more atoms are time integrated more than once - -This is probably an error since you typically do not want to -advance the positions or velocities of an atom more than once -per timestep. - -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: Fix command before simulation box is defined - -The fix command cannot be used before a read_data, read_restart, or -create_box command. - -E: Could not find fix group ID - -A group ID used in the fix command does not exist. - -E: Replacing a fix, but new style != old style - -A fix ID can be used a 2nd time, but only if the style matches the -previous fix. In this case it is assumed you with to reset a fix's -parameters. This error may mean you are mistakenly re-using a fix ID -when you do not intend to. - -W: Replacing a fix, but new group != old group - -The ID and style of a fix match for a fix you are changing with a fix -command, but the new group you are specifying does not match the old -group. - -E: Unrecognized fix style %s - -The choice of fix style is unknown. - -E: Could not find fix_modify ID - -A fix ID used in the fix_modify command does not exist. - -E: Could not find fix ID to delete - -Self-explanatory. - -E: Reuse of compute ID - -A compute ID cannot be used twice. - -E: Unrecognized compute style %s - -The choice of compute style is unknown. - -E: Could not find compute_modify ID - -Self-explanatory. - -E: Could not find compute ID to delete - -Self-explanatory. - -U: Unknown fix style - -The choice of fix style is unknown. - -U: Unknown compute style - -The choice of compute style is unknown. - -*/ diff --git a/src/molecule.cpp b/src/molecule.cpp index d6c839dfc4..816b2686ab 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -477,7 +477,7 @@ void Molecule::read(int flag) itensor[5] *= scale5; } else if (values.contains("body")) { bodyflag = 1; - avec_body = (AtomVecBody *) atom->style_match("body"); + avec_body = dynamic_cast( atom->style_match("body")); if (!avec_body) error->all(FLERR,"Molecule file requires atom style body"); nibody = values.next_int(); diff --git a/src/molecule.h b/src/molecule.h index c1334f6488..69106e5a34 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -169,300 +169,3 @@ class Molecule : protected Pointers { } // namespace LAMMPS_NS #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: Molecule template ID must be alphanumeric or underscore characters - -Self-explanatory. - -E: Insufficient Jacobi rotations for rigid molecule - -Eigensolve for rigid body was not sufficiently accurate. - -E: Unexpected end of molecule file - -Self-explanatory. - -E: Molecule file z center-of-mass must be 0.0 for 2d - -Self-explanatory. - -E: Molecule file requires atom style body - -Self-explanatory. - -E: Invalid header in molecule file - -UNDOCUMENTED - -E: No count or invalid atom count in molecule file - -The number of atoms must be specified. - -E: Invalid bond count in molecule file - -Self-explanatory. - -E: Invalid angle count in molecule file - -Self-explanatory. - -E: Invalid dihedral count in molecule file - -Self-explanatory. - -E: Invalid improper count in molecule file - -Self-explanatory. - -E: Molecule file has bonds but no nbonds setting - -Self-explanatory. - -E: Molecule file has angles but no nangles setting - -Self-explanatory. - -E: Molecule file has dihedrals but no ndihedrals setting - -Self-explanatory. - -E: Molecule file has impropers but no nimpropers setting - -Self-explanatory. - -E: Molecule file has fragments but no nfragments setting - -Self-explanatory. - -E: Molecule file shake flags not before shake atoms - -The order of the two sections is important. - -E: Molecule file shake flags not before shake bonds - -The order of the two sections is important. - -E: Molecule file has body params but no setting for them - -Self-explanatory. - -E: Unknown section in molecule file - -Self-explanatory. - -E: Molecule file needs both Special Bond sections - -Self-explanatory. - -E: Molecule file has special flags but no bonds - -Self-explanatory. - -E: Molecule file shake info is incomplete - -All 3 SHAKE sections are needed. - -E: Molecule file has no Body Integers section - -Self-explanatory. - -E: Molecule file has no Body Doubles section - -Self-explanatory. - -E: Molecule file has no Fragments section - -Self-explanatory. - -E: Cannot auto-generate special bonds before simulation box is defined - -UNDOCUMENTED - -E: Molecule natoms must be 1 for body particle - -Self-explanatory. - -E: Molecule sizescale must be 1.0 for body particle - -Self-explanatory. - -E: Invalid Coords section in molecule file - -Self-explanatory. - -E: Molecule file z coord must be 0.0 for 2d - -Self-explanatory. - -E: Invalid Types section in molecule file - -Self-explanatory. - -E: Invalid atom type in molecule file - -Atom types must range from 1 to specified # of types. - -E: Invalid Charges section in molecule file - -Self-explanatory. - -E: Invalid Diameters section in molecule file - -Self-explanatory. - -E: Invalid atom diameter in molecule file - -Diameters must be >= 0.0. - -E: Invalid Masses section in molecule file - -Self-explanatory. - -E: Invalid atom mass in molecule file - -Masses must be > 0.0. - -E: Invalid Bonds section in molecule file - -Self-explanatory. - -E: Invalid atom ID in Bonds section of molecule file - -Self-explanatory. - -E: Invalid bond type in Bonds section of molecule file - -Self-explanatory. - -E: Invalid Angles section in molecule file - -Self-explanatory. - -E: Invalid atom ID in Angles section of molecule file - -Self-explanatory. - -E: Invalid angle type in Angles section of molecule file - -Self-explanatory. - -E: Invalid Dihedrals section in molecule file - -Self-explanatory. - -E: Invalid atom ID in dihedrals section of molecule file - -Self-explanatory. - -E: Invalid dihedral type in dihedrals section of molecule file - -Self-explanatory. - -E: Invalid Impropers section in molecule file - -Self-explanatory. - -E: Invalid atom ID in impropers section of molecule file - -Self-explanatory. - -E: Invalid improper type in impropers section of molecule file - -Self-explanatory. - -E: Invalid molecule ID in molecule file - -Molecule ID must be a non-zero positive integer. - -E: Invalid Molecules section in molecule file - -Self-explanatory. - -E: Invalid atom ID in Fragments section of molecule file - -Self-explanatory. - -E: Invalid Special Bond Counts section in molecule file - -Self-explanatory. - -E: Molecule file special list does not match special count - -The number of values in an atom's special list does not match count. - -E: Invalid special atom index in molecule file - -Self-explanatory. - -E: Molecule auto special bond generation overflow - -Counts exceed maxspecial setting for other atoms in system. - -E: Invalid Shake Flags section in molecule file - -UNDOCUMENTED - -E: Invalid shake flag in molecule file - -Self-explanatory. - -E: Invalid shake atom in molecule file - -Self-explanatory. - -E: Invalid shake type data in molecule file - -UNDOCUMENTED - -E: Invalid shake bond type in molecule file - -Self-explanatory. - -E: Invalid shake angle type in molecule file - -Self-explanatory. - -E: Too few values in body section of molecule file - -Self-explanatory. - -E: Too many values in body section of molecule file - -Self-explanatory. - -W: Molecule attributes do not match system attributes - -An attribute is specified (e.g. diameter, charge) that is -not defined for the specified atom style. - -E: Molecule topology type exceeds system topology type - -The number of bond, angle, etc types in the molecule exceeds the -system setting. See the create_box command for how to specify these -values. - -E: Molecule topology/atom exceeds system topology/atom - -The number of bonds, angles, etc per-atom in the molecule exceeds the -system setting. See the create_box command for how to specify these -values. - -W: Molecule has bond topology but no special bond settings - -This means the bonded atoms will not be excluded in pair-wise -interactions. - -E: Cannot open molecule file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -*/ diff --git a/src/nbin.h b/src/nbin.h index 40a749fb34..73100d2c34 100644 --- a/src/nbin.h +++ b/src/nbin.h @@ -99,11 +99,3 @@ class NBin : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Non-numeric positions - simulation unstable - -UNDOCUMENTED - -*/ diff --git a/src/nbin_multi.h b/src/nbin_multi.h index ca2e66c28b..057acc72eb 100644 --- a/src/nbin_multi.h +++ b/src/nbin_multi.h @@ -40,23 +40,3 @@ class NBinMulti : public NBin { #endif #endif - -/* ERROR/WARNING messages: - -E: Domain too large for neighbor bins - -UNDOCUMENTED - -E: Cannot use neighbor bins - box size << cutoff - -UNDOCUMENTED - -E: Too many neighbor bins - -UNDOCUMENTED - -E Non-numeric positions - simulation unstable - -UNDOCUMENTED - -*/ diff --git a/src/nbin_standard.h b/src/nbin_standard.h index ebd7d37024..cb5e19517b 100644 --- a/src/nbin_standard.h +++ b/src/nbin_standard.h @@ -40,19 +40,3 @@ class NBinStandard : public NBin { #endif #endif - -/* ERROR/WARNING messages: - -E: Domain too large for neighbor bins - -UNDOCUMENTED - -E: Cannot use neighbor bins - box size << cutoff - -UNDOCUMENTED - -E: Too many neighbor bins - -UNDOCUMENTED - -*/ diff --git a/src/neigh_request.h b/src/neigh_request.h index bf1e8fced7..71c5987dbe 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -19,14 +19,15 @@ namespace LAMMPS_NS { class NeighRequest : protected Pointers { - friend class Neighbor; - friend class NBin; - friend class NeighList; - friend class NPair; - friend class NStencil; - friend class NeighborKokkos; - friend class NPairSkipIntel; - friend class FixIntel; + friend class Neighbor; + friend class NBin; + friend class NeighList; + friend class NPair; + friend class NStencil; + friend class NeighborKokkos; + friend class NPairSkipIntel; + friend class FixIntel; + protected: int index; // index of which neigh request this is void *requestor; // class that made request diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 98c773915b..2c7ce0004b 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -22,6 +22,7 @@ #include "accelerator_kokkos.h" #include "atom.h" #include "atom_vec.h" +#include "bond.h" #include "citeme.h" #include "comm.h" #include "compute.h" @@ -469,12 +470,12 @@ void Neighbor::init() int respa = 0; if (update->whichflag == 1 && utils::strmatch(update->integrate_style,"^respa")) { - if (((Respa *) update->integrate)->level_inner >= 0) respa = 1; - if (((Respa *) update->integrate)->level_middle >= 0) respa = 2; + if ((dynamic_cast( update->integrate))->level_inner >= 0) respa = 1; + if ((dynamic_cast( update->integrate))->level_middle >= 0) respa = 2; } if (respa) { - double *cut_respa = ((Respa *) update->integrate)->cutoff; + double *cut_respa = (dynamic_cast( update->integrate))->cutoff; cut_inner_sq = (cut_respa[1] + skin) * (cut_respa[1] + skin); cut_middle_sq = (cut_respa[3] + skin) * (cut_respa[3] + skin); cut_middle_inside_sq = (cut_respa[0] - skin) * (cut_respa[0] - skin); @@ -880,13 +881,13 @@ int Neighbor::init_pair() } if (requests[i]->pair && i < nrequest_original) { - Pair *pair = (Pair *) requests[i]->requestor; + auto pair = (Pair *) requests[i]->requestor; pair->init_list(requests[i]->id,lists[i]); } else if (requests[i]->fix && i < nrequest_original) { Fix *fix = (Fix *) requests[i]->requestor; fix->init_list(requests[i]->id,lists[i]); } else if (requests[i]->compute && i < nrequest_original) { - Compute *compute = (Compute *) requests[i]->requestor; + auto compute = (Compute *) requests[i]->requestor; compute->init_list(requests[i]->id,lists[i]); } } @@ -1468,7 +1469,7 @@ void Neighbor::init_topology() // bonds,etc can only be broken for atom->molecular = Atom::MOLECULAR, not Atom::TEMPLATE // SHAKE sets bonds and angles negative // gcmc sets all bonds, angles, etc negative - // bond_quartic sets bonds to 0 + // partial_flag sets bonds to 0 // delete_bonds sets all interactions negative int bond_off = 0; @@ -1477,7 +1478,9 @@ void Neighbor::init_topology() if (utils::strmatch(modify->fix[i]->style,"^shake") || utils::strmatch(modify->fix[i]->style,"^rattle")) bond_off = angle_off = 1; - if (force->bond && force->bond_match("quartic")) bond_off = 1; + if (force->bond) + if (force->bond->partial_flag) + bond_off = 1; if (atom->avec->bonds_allow && atom->molecular == Atom::MOLECULAR) { for (i = 0; i < atom->nlocal; i++) { @@ -2677,7 +2680,7 @@ void Neighbor::modify_params(int narg, char **arg) void Neighbor::modify_params(const std::string &modcmd) { auto args = utils::split_words(modcmd); - char **newarg = new char*[args.size()]; + auto newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { newarg[i++] = (char *)arg.c_str(); diff --git a/src/neighbor.h b/src/neighbor.h index 2feafe1bce..06601f96a7 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -159,8 +159,8 @@ class Neighbor : protected Pointers { int any_full(); // Check if any old requests had full neighbor lists void build_collection(int); // build peratom collection array starting at the given index - bigint get_nneigh_full(); // return number of neighbors in a regular full neighbor list - bigint get_nneigh_half(); // return number of neighbors in a regular half neighbor list + bigint get_nneigh_full(); // return number of neighbors in a regular full neighbor list + bigint get_nneigh_half(); // return number of neighbors in a regular half neighbor list double memory_usage(); bigint last_setup_bins; // step of last neighbor::setup_bins() call @@ -340,128 +340,3 @@ namespace NeighConst { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Neighbor delay must be 0 or multiple of every setting - -The delay and every parameters set via the neigh_modify command are -inconsistent. If the delay setting is non-zero, then it must be a -multiple of the every setting. - -E: Neighbor page size must be >= 10x the one atom setting - -This is required to prevent wasting too much memory. - -E: Invalid atom type in neighbor exclusion list - -Atom types must range from 1 to Ntypes inclusive. - -W: Neighbor exclusions used with KSpace solver may give inconsistent Coulombic energies - -This is because excluding specific pair interactions also excludes -them from long-range interactions which may not be the desired effect. -The special_bonds command handles this consistently by insuring -excluded (or weighted) 1-2, 1-3, 1-4 interactions are treated -consistently by both the short-range pair style and the long-range -solver. This is not done for exclusions of charged atom pairs via the -neigh_modify exclude command. - -E: Cannot request an occasional binned neighbor list with ghost info - -UNDOCUMENTED - -E: Requested neighbor bin option does not exist - -UNDOCUMENTED - -E: Requested neighbor stencil method does not exist - -UNDOCUMENTED - -E: Requested neighbor pair method does not exist - -UNDOCUMENTED - -E: Could not assign bin method to neighbor stencil - -UNDOCUMENTED - -E: Could not assign bin method to neighbor pair - -UNDOCUMENTED - -E: Could not assign stencil method to neighbor pair - -UNDOCUMENTED - -E: Neighbor include group not allowed with ghost neighbors - -This is a current restriction within LAMMPS. - -E: Too many local+ghost atoms for neighbor list - -The number of nlocal + nghost atoms on a processor -is limited by the size of a 32-bit integer with 2 bits -removed for masking 1-2, 1-3, 1-4 neighbors. - -E: Trying to build an occasional neighbor list before initialization completed - -This is not allowed. Source code caller needs to be modified. - -E: Neighbor build one invoked on perpetual list - -UNDOCUMENTED - -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: Invalid group ID in neigh_modify command - -A group ID used in the neigh_modify command does not exist. - -E: Neigh_modify include group != atom_modify first group - -Self-explanatory. - -E: Neigh_modify exclude molecule requires atom attribute molecule - -Self-explanatory. - -E: Unable to find group-group exclusion - -UNDOCUMENTED - -U: Neighbor multi not yet enabled for ghost neighbors - -This is a current restriction within LAMMPS. - -U: Neighbor multi not yet enabled for granular - -Self-explanatory. - -U: Neighbor multi not yet enabled for rRESPA - -Self-explanatory. - -U: Domain too large for neighbor bins - -The domain has become extremely large so that neighbor bins cannot be -used. Most likely, one or more atoms have been blown out of the -simulation box to a great distance. - -U: Cannot use neighbor bins - box size << cutoff - -Too many neighbor bins will be created. This typically happens when -the simulation box is very small in some dimension, compared to the -neighbor cutoff. Use the "nsq" style instead of "bin" style. - -U: Too many neighbor bins - -This is likely due to an immense simulation box that has blown up -to a large size. - -*/ diff --git a/src/npair.h b/src/npair.h index b35f93d22b..9e7384ade3 100644 --- a/src/npair.h +++ b/src/npair.h @@ -164,11 +164,3 @@ class NPair : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Non-numeric positions - simulation unstable - -UNDOCUMENTED - -*/ diff --git a/src/npair_copy.h b/src/npair_copy.h index 36b80f83d9..d696206186 100644 --- a/src/npair_copy.h +++ b/src/npair_copy.h @@ -36,7 +36,3 @@ class NPairCopy : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/npair_full_bin.h b/src/npair_full_bin.h index 4d40763271..465bb82786 100644 --- a/src/npair_full_bin.h +++ b/src/npair_full_bin.h @@ -37,11 +37,3 @@ class NPairFullBin : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_full_bin_atomonly.h b/src/npair_full_bin_atomonly.h index 8e3f96e59b..ffb979743d 100644 --- a/src/npair_full_bin_atomonly.h +++ b/src/npair_full_bin_atomonly.h @@ -37,11 +37,3 @@ class NPairFullBinAtomonly : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_full_bin_ghost.h b/src/npair_full_bin_ghost.h index 4b7e08a0e1..9c2e3d2155 100644 --- a/src/npair_full_bin_ghost.h +++ b/src/npair_full_bin_ghost.h @@ -37,11 +37,3 @@ class NPairFullBinGhost : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_full_multi.h b/src/npair_full_multi.h index dcd1b5d8a9..942f9e47c9 100644 --- a/src/npair_full_multi.h +++ b/src/npair_full_multi.h @@ -36,11 +36,3 @@ class NPairFullMulti : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_full_multi_old.h b/src/npair_full_multi_old.h index 0dd825fcce..6697f3163b 100644 --- a/src/npair_full_multi_old.h +++ b/src/npair_full_multi_old.h @@ -36,11 +36,3 @@ class NPairFullMultiOld : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_full_nsq.h b/src/npair_full_nsq.h index 0e65fcd027..78cef5fac3 100644 --- a/src/npair_full_nsq.h +++ b/src/npair_full_nsq.h @@ -36,11 +36,3 @@ class NPairFullNsq : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_full_nsq_ghost.h b/src/npair_full_nsq_ghost.h index 6ae517ccf7..9b97579e74 100644 --- a/src/npair_full_nsq_ghost.h +++ b/src/npair_full_nsq_ghost.h @@ -37,11 +37,3 @@ class NPairFullNsqGhost : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_bin_atomonly_newton.h b/src/npair_half_bin_atomonly_newton.h index 7a3eaf34bc..2033710601 100644 --- a/src/npair_half_bin_atomonly_newton.h +++ b/src/npair_half_bin_atomonly_newton.h @@ -36,11 +36,3 @@ class NPairHalfBinAtomonlyNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_bin_newtoff.h b/src/npair_half_bin_newtoff.h index db240f8bd9..e4d56b79b1 100644 --- a/src/npair_half_bin_newtoff.h +++ b/src/npair_half_bin_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfBinNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_bin_newtoff_ghost.h b/src/npair_half_bin_newtoff_ghost.h index b11e0f4802..e6ae0b216c 100644 --- a/src/npair_half_bin_newtoff_ghost.h +++ b/src/npair_half_bin_newtoff_ghost.h @@ -36,11 +36,3 @@ class NPairHalfBinNewtoffGhost : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_bin_newton.h b/src/npair_half_bin_newton.h index 19f7b93ae4..faf8c90af6 100644 --- a/src/npair_half_bin_newton.h +++ b/src/npair_half_bin_newton.h @@ -36,11 +36,3 @@ class NPairHalfBinNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_bin_newton_tri.h b/src/npair_half_bin_newton_tri.h index ad270ae173..2e733b6ad1 100644 --- a/src/npair_half_bin_newton_tri.h +++ b/src/npair_half_bin_newton_tri.h @@ -36,11 +36,3 @@ class NPairHalfBinNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_multi_newtoff.h b/src/npair_half_multi_newtoff.h index 3142587da6..ccb8763eac 100644 --- a/src/npair_half_multi_newtoff.h +++ b/src/npair_half_multi_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfMultiNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_multi_newton.h b/src/npair_half_multi_newton.h index 55439eacca..315ddde617 100644 --- a/src/npair_half_multi_newton.h +++ b/src/npair_half_multi_newton.h @@ -36,7 +36,3 @@ class NPairHalfMultiNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/npair_half_multi_newton_tri.h b/src/npair_half_multi_newton_tri.h index 2b6d69f332..b16a2a66b6 100644 --- a/src/npair_half_multi_newton_tri.h +++ b/src/npair_half_multi_newton_tri.h @@ -36,7 +36,3 @@ class NPairHalfMultiNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/npair_half_multi_old_newtoff.h b/src/npair_half_multi_old_newtoff.h index 9418cf5a4c..fc6f50557b 100644 --- a/src/npair_half_multi_old_newtoff.h +++ b/src/npair_half_multi_old_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfMultiOldNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_multi_old_newton.h b/src/npair_half_multi_old_newton.h index 5c84b8ef98..e8ca998c25 100644 --- a/src/npair_half_multi_old_newton.h +++ b/src/npair_half_multi_old_newton.h @@ -36,11 +36,3 @@ class NPairHalfMultiOldNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_multi_old_newton_tri.h b/src/npair_half_multi_old_newton_tri.h index 016746cf12..b6d884a708 100644 --- a/src/npair_half_multi_old_newton_tri.h +++ b/src/npair_half_multi_old_newton_tri.h @@ -36,11 +36,3 @@ class NPairHalfMultiOldNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_nsq_newtoff.h b/src/npair_half_nsq_newtoff.h index 45bef5b0b0..348b4fd4fc 100644 --- a/src/npair_half_nsq_newtoff.h +++ b/src/npair_half_nsq_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfNsqNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_nsq_newtoff_ghost.h b/src/npair_half_nsq_newtoff_ghost.h index 5d6cb69450..db2045f512 100644 --- a/src/npair_half_nsq_newtoff_ghost.h +++ b/src/npair_half_nsq_newtoff_ghost.h @@ -36,11 +36,3 @@ class NPairHalfNsqNewtoffGhost : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_nsq_newton.h b/src/npair_half_nsq_newton.h index 6b7ec89b82..befa527ada 100644 --- a/src/npair_half_nsq_newton.h +++ b/src/npair_half_nsq_newton.h @@ -36,11 +36,3 @@ class NPairHalfNsqNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_respa_bin_newtoff.h b/src/npair_half_respa_bin_newtoff.h index 2782ae239e..c0ca235deb 100644 --- a/src/npair_half_respa_bin_newtoff.h +++ b/src/npair_half_respa_bin_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfRespaBinNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_respa_bin_newton.h b/src/npair_half_respa_bin_newton.h index c83ca89891..fd25f1c537 100644 --- a/src/npair_half_respa_bin_newton.h +++ b/src/npair_half_respa_bin_newton.h @@ -36,11 +36,3 @@ class NPairHalfRespaBinNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_respa_bin_newton_tri.h b/src/npair_half_respa_bin_newton_tri.h index a5b573103c..f0af474444 100644 --- a/src/npair_half_respa_bin_newton_tri.h +++ b/src/npair_half_respa_bin_newton_tri.h @@ -36,11 +36,3 @@ class NPairHalfRespaBinNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_respa_nsq_newtoff.h b/src/npair_half_respa_nsq_newtoff.h index d13fb810da..e1ab752d35 100644 --- a/src/npair_half_respa_nsq_newtoff.h +++ b/src/npair_half_respa_nsq_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfRespaNsqNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_respa_nsq_newton.h b/src/npair_half_respa_nsq_newton.h index 9050ca0fde..7b13e5356e 100644 --- a/src/npair_half_respa_nsq_newton.h +++ b/src/npair_half_respa_nsq_newton.h @@ -36,11 +36,3 @@ class NPairHalfRespaNsqNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_bin_newtoff.cpp b/src/npair_half_size_bin_newtoff.cpp index e836503190..de063c1eb9 100644 --- a/src/npair_half_size_bin_newtoff.cpp +++ b/src/npair_half_size_bin_newtoff.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_bin_newtoff.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" @@ -35,7 +38,8 @@ NPairHalfSizeBinNewtoff::NPairHalfSizeBinNewtoff(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeBinNewtoff::build(NeighList *list) { - int i,j,k,n,ibin; + int i,j,jh,k,n,ibin,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -44,17 +48,26 @@ void NPairHalfSizeBinNewtoff::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -68,6 +81,11 @@ void NPairHalfSizeBinNewtoff::build(NeighList *list) ztmp = x[i][2]; radi = radius[i]; ibin = atom2bin[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in surrounding bins in stencil including self // only store pair if i < j @@ -87,10 +105,23 @@ void NPairHalfSizeBinNewtoff::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/npair_half_size_bin_newtoff.h b/src/npair_half_size_bin_newtoff.h index f1f9b2a34b..6dd8914ed7 100644 --- a/src/npair_half_size_bin_newtoff.h +++ b/src/npair_half_size_bin_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfSizeBinNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_bin_newton.cpp b/src/npair_half_size_bin_newton.cpp index b6a786b0cf..fbf5ce14d4 100644 --- a/src/npair_half_size_bin_newton.cpp +++ b/src/npair_half_size_bin_newton.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_bin_newton.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" @@ -34,7 +37,8 @@ NPairHalfSizeBinNewton::NPairHalfSizeBinNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeBinNewton::build(NeighList *list) { - int i,j,k,n,ibin; + int i,j,jh,k,n,ibin,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -43,17 +47,26 @@ void NPairHalfSizeBinNewton::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -66,6 +79,11 @@ void NPairHalfSizeBinNewton::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over rest of atoms in i's bin, ghosts are at end of linked list // if j is owned atom, store it, since j is beyond i in linked list @@ -90,10 +108,23 @@ void NPairHalfSizeBinNewton::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } @@ -112,10 +143,23 @@ void NPairHalfSizeBinNewton::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/npair_half_size_bin_newton.h b/src/npair_half_size_bin_newton.h index a592969c46..65bbf1b5bf 100644 --- a/src/npair_half_size_bin_newton.h +++ b/src/npair_half_size_bin_newton.h @@ -36,11 +36,3 @@ class NPairHalfSizeBinNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_bin_newton_tri.cpp b/src/npair_half_size_bin_newton_tri.cpp index a86feb6f40..15728a596a 100644 --- a/src/npair_half_size_bin_newton_tri.cpp +++ b/src/npair_half_size_bin_newton_tri.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_bin_newton_tri.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" @@ -35,7 +38,8 @@ NPairHalfSizeBinNewtonTri::NPairHalfSizeBinNewtonTri(LAMMPS *lmp) : void NPairHalfSizeBinNewtonTri::build(NeighList *list) { - int i,j,k,n,ibin; + int i,j,jh,k,n,ibin,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -44,17 +48,26 @@ void NPairHalfSizeBinNewtonTri::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -67,6 +80,11 @@ void NPairHalfSizeBinNewtonTri::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in bins in stencil // pairs for atoms j "below" i are excluded @@ -96,10 +114,23 @@ void NPairHalfSizeBinNewtonTri::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/npair_half_size_bin_newton_tri.h b/src/npair_half_size_bin_newton_tri.h index 50861d560e..86e100406a 100644 --- a/src/npair_half_size_bin_newton_tri.h +++ b/src/npair_half_size_bin_newton_tri.h @@ -36,11 +36,3 @@ class NPairHalfSizeBinNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_multi_newtoff.cpp b/src/npair_half_size_multi_newtoff.cpp index 4c9d9b3f62..ecb70cd6c4 100644 --- a/src/npair_half_size_multi_newtoff.cpp +++ b/src/npair_half_size_multi_newtoff.cpp @@ -15,7 +15,10 @@ es certain rights in this software. This software is distributed under #include "npair_half_size_multi_newtoff.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" @@ -37,7 +40,9 @@ NPairHalfSizeMultiNewtoff::NPairHalfSizeMultiNewtoff(LAMMPS *lmp) : NPair(lmp) { void NPairHalfSizeMultiNewtoff::build(NeighList *list) { - int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns; + int which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -48,17 +53,26 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -72,6 +86,11 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } ibin = atom2bin[i]; @@ -92,27 +111,40 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list) ns = nstencil_multi[icollection][jcollection]; for (k = 0; k < ns; k++) { - js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >= 0; j = bins[j]) { - if (j <= i) continue; + js = binhead_multi[jcollection][jbin + s[k]]; + for (j = js; j >= 0; j = bins[j]) { + if (j <= i) continue; jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } - } + if (rsq <= cutdistsq) { + jh = j; + if (history && rsq < radsum*radsum) + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; + } + } } } diff --git a/src/npair_half_size_multi_newtoff.h b/src/npair_half_size_multi_newtoff.h index b33634e5be..06347bf462 100644 --- a/src/npair_half_size_multi_newtoff.h +++ b/src/npair_half_size_multi_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfSizeMultiNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_multi_newton.cpp b/src/npair_half_size_multi_newton.cpp index 8af60aa435..ee100596bc 100644 --- a/src/npair_half_size_multi_newton.cpp +++ b/src/npair_half_size_multi_newton.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_newton.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" @@ -36,7 +39,9 @@ NPairHalfSizeMultiNewton::NPairHalfSizeMultiNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeMultiNewton::build(NeighList *list) { - int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js; + int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js; + int which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -46,17 +51,26 @@ void NPairHalfSizeMultiNewton::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -70,6 +84,11 @@ void NPairHalfSizeMultiNewton::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } ibin = atom2bin[i]; @@ -94,33 +113,46 @@ void NPairHalfSizeMultiNewton::build(NeighList *list) // if j is owned atom, store it if j > i // if j is ghost, only store if j coords are "above and to the right" of i - for (j = js; j >= 0; j = bins[j]) { + for (j = js; j >= 0; j = bins[j]) { if ((icollection != jcollection) && (j < i)) continue; - if (j >= nlocal) { - if (x[j][2] < ztmp) continue; - if (x[j][2] == ztmp) { - if (x[j][1] < ytmp) continue; - if (x[j][1] == ytmp && x[j][0] < xtmp) continue; - } - } + if (j >= nlocal) { + if (x[j][2] < ztmp) continue; + if (x[j][2] == ztmp) { + if (x[j][1] < ytmp) continue; + if (x[j][1] == ytmp && x[j][0] < xtmp) continue; + } + } jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; - delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } + if (rsq <= cutdistsq) { + jh = j; + if (history && rsq < radsum*radsum) + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; + } } } @@ -129,30 +161,43 @@ void NPairHalfSizeMultiNewton::build(NeighList *list) // stencil is half if i same size as j // stencil is full if i smaller than j - s = stencil_multi[icollection][jcollection]; - ns = nstencil_multi[icollection][jcollection]; + s = stencil_multi[icollection][jcollection]; + ns = nstencil_multi[icollection][jcollection]; - for (k = 0; k < ns; k++) { - js = binhead_multi[jcollection][jbin + s[k]]; - for (j = js; j >= 0; j = bins[j]) { + for (k = 0; k < ns; k++) { + js = binhead_multi[jcollection][jbin + s[k]]; + for (j = js; j >= 0; j = bins[j]) { jtype = type[j]; if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue; delx = xtmp - x[j][0]; - dely = ytmp - x[j][1]; - delz = ztmp - x[j][2]; - rsq = delx*delx + dely*dely + delz*delz; - radsum = radi + radius[j]; - cutdistsq = (radsum+skin) * (radsum+skin); + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx*delx + dely*dely + delz*delz; + radsum = radi + radius[j]; + cutdistsq = (radsum+skin) * (radsum+skin); - if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; - } - } + if (rsq <= cutdistsq) { + jh = j; + if (history && rsq < radsum*radsum) + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; + } + } } } diff --git a/src/npair_half_size_multi_newton.h b/src/npair_half_size_multi_newton.h index 32139136e6..dc9f3ebdbf 100644 --- a/src/npair_half_size_multi_newton.h +++ b/src/npair_half_size_multi_newton.h @@ -36,11 +36,3 @@ class NPairHalfSizeMultiNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_multi_newton_tri.cpp b/src/npair_half_size_multi_newton_tri.cpp index 20d4d8b421..9a170948b9 100644 --- a/src/npair_half_size_multi_newton_tri.cpp +++ b/src/npair_half_size_multi_newton_tri.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_newton_tri.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neighbor.h" #include "neigh_list.h" @@ -36,7 +39,9 @@ NPairHalfSizeMultiNewtonTri::NPairHalfSizeMultiNewtonTri(LAMMPS *lmp) : NPair(lm void NPairHalfSizeMultiNewtonTri::build(NeighList *list) { - int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js; + int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js; + int which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -46,17 +51,26 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -70,6 +84,11 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } ibin = atom2bin[i]; @@ -119,10 +138,23 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/npair_half_size_multi_newton_tri.h b/src/npair_half_size_multi_newton_tri.h index 10e7a90d16..7d9c24d604 100644 --- a/src/npair_half_size_multi_newton_tri.h +++ b/src/npair_half_size_multi_newton_tri.h @@ -36,11 +36,3 @@ class NPairHalfSizeMultiNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_multi_old_newtoff.cpp b/src/npair_half_size_multi_old_newtoff.cpp index d98b0a635d..4f8e4a8078 100644 --- a/src/npair_half_size_multi_old_newtoff.cpp +++ b/src/npair_half_size_multi_old_newtoff.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_old_newtoff.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" @@ -36,7 +39,8 @@ NPairHalfSizeMultiOldNewtoff::NPairHalfSizeMultiOldNewtoff(LAMMPS *lmp) : NPair( void NPairHalfSizeMultiOldNewtoff::build(NeighList *list) { - int i,j,k,n,itype,jtype,ibin,ns; + int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -46,17 +50,26 @@ void NPairHalfSizeMultiOldNewtoff::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -70,6 +83,11 @@ void NPairHalfSizeMultiOldNewtoff::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in other bins in stencil including self // only store pair if i < j @@ -98,10 +116,23 @@ void NPairHalfSizeMultiOldNewtoff::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/npair_half_size_multi_old_newtoff.h b/src/npair_half_size_multi_old_newtoff.h index c2ca814129..eaaa3f6cba 100644 --- a/src/npair_half_size_multi_old_newtoff.h +++ b/src/npair_half_size_multi_old_newtoff.h @@ -36,10 +36,3 @@ class NPairHalfSizeMultiOldNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED -*/ diff --git a/src/npair_half_size_multi_old_newton.cpp b/src/npair_half_size_multi_old_newton.cpp index 8ea894db4c..753c8c7d44 100644 --- a/src/npair_half_size_multi_old_newton.cpp +++ b/src/npair_half_size_multi_old_newton.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_old_newton.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" @@ -35,7 +38,8 @@ NPairHalfSizeMultiOldNewton::NPairHalfSizeMultiOldNewton(LAMMPS *lmp) : NPair(lm void NPairHalfSizeMultiOldNewton::build(NeighList *list) { - int i,j,k,n,itype,jtype,ibin,ns; + int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -45,17 +49,26 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -69,6 +82,11 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over rest of atoms in i's bin, ghosts are at end of linked list // if j is owned atom, store it, since j is beyond i in linked list @@ -94,10 +112,23 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } @@ -124,10 +155,22 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { - if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else + if (history && rsq < radsum*radsum) + j = j ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = j; + else if (domain->minimum_image_check(delx,dely,delz)) neighptr[n++] = j; + else if (which > 0) neighptr[n++] = j ^ (which << SBBITS); + } else neighptr[n++] = j; } } } diff --git a/src/npair_half_size_multi_old_newton.h b/src/npair_half_size_multi_old_newton.h index 2322b5bc42..408b4bdb69 100644 --- a/src/npair_half_size_multi_old_newton.h +++ b/src/npair_half_size_multi_old_newton.h @@ -36,10 +36,3 @@ class NPairHalfSizeMultiOldNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED -*/ diff --git a/src/npair_half_size_multi_old_newton_tri.cpp b/src/npair_half_size_multi_old_newton_tri.cpp index cf7495de1b..ee7a11a36e 100644 --- a/src/npair_half_size_multi_old_newton_tri.cpp +++ b/src/npair_half_size_multi_old_newton_tri.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_multi_old_newton_tri.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "my_page.h" #include "neigh_list.h" @@ -34,7 +37,8 @@ NPairHalfSizeMultiOldNewtonTri::NPairHalfSizeMultiOldNewtonTri(LAMMPS *lmp) : NP void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list) { - int i,j,k,n,itype,jtype,ibin,ns; + int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutdistsq; int *neighptr,*s; @@ -44,17 +48,26 @@ void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; if (includegroup) nlocal = atom->nfirst; + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -68,7 +81,11 @@ void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; - + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over all atoms in bins, including self, in stencil // skip if i,j neighbor cutoff is less than bin distance @@ -106,10 +123,23 @@ void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list) cutdistsq = (radsum+skin) * (radsum+skin); if (rsq <= cutdistsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } } diff --git a/src/npair_half_size_multi_old_newton_tri.h b/src/npair_half_size_multi_old_newton_tri.h index 1658abc717..828c2ab7f1 100644 --- a/src/npair_half_size_multi_old_newton_tri.h +++ b/src/npair_half_size_multi_old_newton_tri.h @@ -36,10 +36,3 @@ class NPairHalfSizeMultiOldNewtonTri : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED -*/ diff --git a/src/npair_half_size_nsq_newtoff.cpp b/src/npair_half_size_nsq_newtoff.cpp index e8eac6f54b..9ace347901 100644 --- a/src/npair_half_size_nsq_newtoff.cpp +++ b/src/npair_half_size_nsq_newtoff.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_nsq_newtoff.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "group.h" #include "my_page.h" #include "neigh_list.h" @@ -35,7 +38,8 @@ NPairHalfSizeNsqNewtoff::NPairHalfSizeNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeNsqNewtoff::build(NeighList *list) { - int i,j,n,bitmask; + int i,j,jh,n,bitmask,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -44,7 +48,10 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list) double *radius = atom->radius; int *type = atom->type; int *mask = atom->mask; + tagint *tag = atom->tag; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; if (includegroup) { @@ -52,13 +59,19 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list) bitmask = group->bitmask[includegroup]; } + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -71,6 +84,11 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over remaining atoms, owned and ghost @@ -86,10 +104,23 @@ void NPairHalfSizeNsqNewtoff::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } diff --git a/src/npair_half_size_nsq_newtoff.h b/src/npair_half_size_nsq_newtoff.h index b263a907ed..d0777b16c9 100644 --- a/src/npair_half_size_nsq_newtoff.h +++ b/src/npair_half_size_nsq_newtoff.h @@ -36,11 +36,3 @@ class NPairHalfSizeNsqNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_half_size_nsq_newton.cpp b/src/npair_half_size_nsq_newton.cpp index 7f90596755..05409a0bab 100644 --- a/src/npair_half_size_nsq_newton.cpp +++ b/src/npair_half_size_nsq_newton.cpp @@ -15,7 +15,10 @@ #include "npair_half_size_nsq_newton.h" #include "atom.h" +#include "atom_vec.h" +#include "domain.h" #include "error.h" +#include "molecule.h" #include "group.h" #include "my_page.h" #include "neigh_list.h" @@ -36,7 +39,8 @@ NPairHalfSizeNsqNewton::NPairHalfSizeNsqNewton(LAMMPS *lmp) : NPair(lmp) {} void NPairHalfSizeNsqNewton::build(NeighList *list) { - int i,j,n,itag,jtag,bitmask; + int i,j,jh,n,itag,jtag,bitmask,which,imol,iatom,moltemplate; + tagint tagprev; double xtmp,ytmp,ztmp,delx,dely,delz,rsq; double radi,radsum,cutsq; int *neighptr; @@ -47,6 +51,8 @@ void NPairHalfSizeNsqNewton::build(NeighList *list) int *type = atom->type; int *mask = atom->mask; tagint *molecule = atom->molecule; + tagint **special = atom->special; + int **nspecial = atom->nspecial; int nlocal = atom->nlocal; int nall = nlocal + atom->nghost; if (includegroup) { @@ -54,13 +60,19 @@ void NPairHalfSizeNsqNewton::build(NeighList *list) bitmask = group->bitmask[includegroup]; } + int *molindex = atom->molindex; + int *molatom = atom->molatom; + Molecule **onemols = atom->avec->onemols; + if (molecular == Atom::TEMPLATE) moltemplate = 1; + else moltemplate = 0; + int history = list->history; int *ilist = list->ilist; int *numneigh = list->numneigh; int **firstneigh = list->firstneigh; MyPage *ipage = list->ipage; - int mask_history = 3 << SBBITS; + int mask_history = 1 << HISTBITS; int inum = 0; ipage->reset(); @@ -74,6 +86,11 @@ void NPairHalfSizeNsqNewton::build(NeighList *list) ytmp = x[i][1]; ztmp = x[i][2]; radi = radius[i]; + if (moltemplate) { + imol = molindex[i]; + iatom = molatom[i]; + tagprev = tag[i] - iatom - 1; + } // loop over remaining atoms, owned and ghost @@ -105,10 +122,23 @@ void NPairHalfSizeNsqNewton::build(NeighList *list) cutsq = (radsum+skin) * (radsum+skin); if (rsq <= cutsq) { + jh = j; if (history && rsq < radsum*radsum) - neighptr[n++] = j ^ mask_history; - else - neighptr[n++] = j; + jh = jh ^ mask_history; + + if (molecular != Atom::ATOMIC) { + if (!moltemplate) + which = find_special(special[i],nspecial[i],tag[j]); + else if (imol >= 0) + which = find_special(onemols[imol]->special[iatom], + onemols[imol]->nspecial[iatom], + tag[j]-tagprev); + else which = 0; + if (which == 0) neighptr[n++] = jh; + else if (domain->minimum_image_check(delx,dely,delz)) + neighptr[n++] = jh; + else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS); + } else neighptr[n++] = jh; } } diff --git a/src/npair_half_size_nsq_newton.h b/src/npair_half_size_nsq_newton.h index 17735ccc45..0f058cecb5 100644 --- a/src/npair_half_size_nsq_newton.h +++ b/src/npair_half_size_nsq_newton.h @@ -36,11 +36,3 @@ class NPairHalfSizeNsqNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_halffull_newtoff.h b/src/npair_halffull_newtoff.h index 0a00267449..3254006e2f 100644 --- a/src/npair_halffull_newtoff.h +++ b/src/npair_halffull_newtoff.h @@ -52,11 +52,3 @@ class NPairHalffullNewtoff : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_halffull_newton.h b/src/npair_halffull_newton.h index 95cc09ec0b..736985466a 100644 --- a/src/npair_halffull_newton.h +++ b/src/npair_halffull_newton.h @@ -42,11 +42,3 @@ class NPairHalffullNewton : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_skip.h b/src/npair_skip.h index aa2b14e12a..03e912fcc4 100644 --- a/src/npair_skip.h +++ b/src/npair_skip.h @@ -44,11 +44,3 @@ class NPairSkip : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_skip_respa.h b/src/npair_skip_respa.h index b0938287b5..4d03f33462 100644 --- a/src/npair_skip_respa.h +++ b/src/npair_skip_respa.h @@ -38,11 +38,3 @@ class NPairSkipRespa : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_skip_size.h b/src/npair_skip_size.h index df8d479185..8cc993e2f3 100644 --- a/src/npair_skip_size.h +++ b/src/npair_skip_size.h @@ -37,11 +37,3 @@ class NPairSkipSize : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_skip_size_off2on.h b/src/npair_skip_size_off2on.h index 39aee76b09..ee491700c2 100644 --- a/src/npair_skip_size_off2on.h +++ b/src/npair_skip_size_off2on.h @@ -38,11 +38,3 @@ class NPairSkipSizeOff2on : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/npair_skip_size_off2on_oneside.h b/src/npair_skip_size_off2on_oneside.h index 3f1cd6ef34..7e73b06892 100644 --- a/src/npair_skip_size_off2on_oneside.h +++ b/src/npair_skip_size_off2on_oneside.h @@ -38,11 +38,3 @@ class NPairSkipSizeOff2onOneside : public NPair { #endif #endif - -/* ERROR/WARNING messages: - -E: Neighbor list overflow, boost neigh_modify one - -UNDOCUMENTED - -*/ diff --git a/src/nstencil.h b/src/nstencil.h index d16b10f1b8..ac48eb6316 100644 --- a/src/nstencil.h +++ b/src/nstencil.h @@ -121,7 +121,3 @@ class NStencil : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_bin_2d.h b/src/nstencil_full_bin_2d.h index f4c630d3c2..d30dfac59f 100644 --- a/src/nstencil_full_bin_2d.h +++ b/src/nstencil_full_bin_2d.h @@ -36,7 +36,3 @@ class NStencilFullBin2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_bin_3d.h b/src/nstencil_full_bin_3d.h index 463dda1f62..1939bef184 100644 --- a/src/nstencil_full_bin_3d.h +++ b/src/nstencil_full_bin_3d.h @@ -36,7 +36,3 @@ class NStencilFullBin3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_ghost_bin_2d.h b/src/nstencil_full_ghost_bin_2d.h index 6326aae5ea..558d4af0ef 100644 --- a/src/nstencil_full_ghost_bin_2d.h +++ b/src/nstencil_full_ghost_bin_2d.h @@ -36,7 +36,3 @@ class NStencilFullGhostBin2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_ghost_bin_3d.h b/src/nstencil_full_ghost_bin_3d.h index eed98279aa..7a3479747b 100644 --- a/src/nstencil_full_ghost_bin_3d.h +++ b/src/nstencil_full_ghost_bin_3d.h @@ -36,7 +36,3 @@ class NStencilFullGhostBin3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_multi_2d.h b/src/nstencil_full_multi_2d.h index 2ef43f1999..0ba95c9b02 100644 --- a/src/nstencil_full_multi_2d.h +++ b/src/nstencil_full_multi_2d.h @@ -38,7 +38,3 @@ class NStencilFullMulti2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_multi_3d.h b/src/nstencil_full_multi_3d.h index 894c688a9f..4517ed72cb 100644 --- a/src/nstencil_full_multi_3d.h +++ b/src/nstencil_full_multi_3d.h @@ -38,7 +38,3 @@ class NStencilFullMulti3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_multi_old_2d.h b/src/nstencil_full_multi_old_2d.h index 9b56be0793..ae5967fb9f 100644 --- a/src/nstencil_full_multi_old_2d.h +++ b/src/nstencil_full_multi_old_2d.h @@ -36,7 +36,3 @@ class NStencilFullMultiOld2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_full_multi_old_3d.h b/src/nstencil_full_multi_old_3d.h index d19da9c95f..2dcdcdf9f5 100644 --- a/src/nstencil_full_multi_old_3d.h +++ b/src/nstencil_full_multi_old_3d.h @@ -36,7 +36,3 @@ class NStencilFullMultiOld3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_bin_2d.h b/src/nstencil_half_bin_2d.h index f11138dd54..4ad4d356a2 100644 --- a/src/nstencil_half_bin_2d.h +++ b/src/nstencil_half_bin_2d.h @@ -36,7 +36,3 @@ class NStencilHalfBin2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_bin_2d_tri.h b/src/nstencil_half_bin_2d_tri.h index 5088bc2edc..844f8100a9 100644 --- a/src/nstencil_half_bin_2d_tri.h +++ b/src/nstencil_half_bin_2d_tri.h @@ -36,7 +36,3 @@ class NStencilHalfBin2dTri : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_bin_3d.h b/src/nstencil_half_bin_3d.h index f235d6688b..0347e203b6 100644 --- a/src/nstencil_half_bin_3d.h +++ b/src/nstencil_half_bin_3d.h @@ -36,7 +36,3 @@ class NStencilHalfBin3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_bin_3d_tri.h b/src/nstencil_half_bin_3d_tri.h index fa2975ef0a..2b0e3c9e10 100644 --- a/src/nstencil_half_bin_3d_tri.h +++ b/src/nstencil_half_bin_3d_tri.h @@ -36,7 +36,3 @@ class NStencilHalfBin3dTri : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_2d.h b/src/nstencil_half_multi_2d.h index 043d160b9e..11447c8952 100644 --- a/src/nstencil_half_multi_2d.h +++ b/src/nstencil_half_multi_2d.h @@ -38,7 +38,3 @@ class NStencilHalfMulti2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_2d_tri.h b/src/nstencil_half_multi_2d_tri.h index 1d1a469e72..4e93e940a0 100644 --- a/src/nstencil_half_multi_2d_tri.h +++ b/src/nstencil_half_multi_2d_tri.h @@ -38,7 +38,3 @@ class NStencilHalfMulti2dTri : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_3d.h b/src/nstencil_half_multi_3d.h index 246d71f3e4..30c197e9e4 100644 --- a/src/nstencil_half_multi_3d.h +++ b/src/nstencil_half_multi_3d.h @@ -38,7 +38,3 @@ class NStencilHalfMulti3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_3d_tri.h b/src/nstencil_half_multi_3d_tri.h index 2ced4b0c20..914be51825 100644 --- a/src/nstencil_half_multi_3d_tri.h +++ b/src/nstencil_half_multi_3d_tri.h @@ -38,7 +38,3 @@ class NStencilHalfMulti3dTri : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_old_2d.h b/src/nstencil_half_multi_old_2d.h index 387429d160..13f5579a7d 100644 --- a/src/nstencil_half_multi_old_2d.h +++ b/src/nstencil_half_multi_old_2d.h @@ -35,7 +35,3 @@ class NStencilHalfMultiOld2d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_old_2d_tri.h b/src/nstencil_half_multi_old_2d_tri.h index a81d37062c..9701cbf449 100644 --- a/src/nstencil_half_multi_old_2d_tri.h +++ b/src/nstencil_half_multi_old_2d_tri.h @@ -35,7 +35,3 @@ class NStencilHalfMultiOld2dTri : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_old_3d.h b/src/nstencil_half_multi_old_3d.h index d7d8157afa..e47239ec4a 100644 --- a/src/nstencil_half_multi_old_3d.h +++ b/src/nstencil_half_multi_old_3d.h @@ -35,7 +35,3 @@ class NStencilHalfMultiOld3d : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/nstencil_half_multi_old_3d_tri.h b/src/nstencil_half_multi_old_3d_tri.h index 2a7a5a22bb..53889e1392 100644 --- a/src/nstencil_half_multi_old_3d_tri.h +++ b/src/nstencil_half_multi_old_3d_tri.h @@ -35,7 +35,3 @@ class NStencilHalfMultiOld3dTri : public NStencil { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/ntopo.h b/src/ntopo.h index 0cc1f79139..c60d94d52d 100644 --- a/src/ntopo.h +++ b/src/ntopo.h @@ -48,19 +48,3 @@ class NTopo : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Bond extent > half of periodic box length - -UNDOCUMENTED - -E: Angle extent > half of periodic box length - -UNDOCUMENTED - -E: Dihedral/improper extent > half of periodic box length - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_angle_all.h b/src/ntopo_angle_all.h index 8ef0d17c3b..3c81d6907a 100644 --- a/src/ntopo_angle_all.h +++ b/src/ntopo_angle_all.h @@ -34,15 +34,3 @@ class NTopoAngleAll : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Angle atoms %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Angle atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_angle_partial.h b/src/ntopo_angle_partial.h index 6d12975948..94d5ac09b1 100644 --- a/src/ntopo_angle_partial.h +++ b/src/ntopo_angle_partial.h @@ -34,15 +34,3 @@ class NTopoAnglePartial : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Angle atoms %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Angle atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_angle_template.h b/src/ntopo_angle_template.h index 027659fde3..60bb6d3109 100644 --- a/src/ntopo_angle_template.h +++ b/src/ntopo_angle_template.h @@ -34,15 +34,3 @@ class NTopoAngleTemplate : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Angle atoms %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Angle atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_bond_all.h b/src/ntopo_bond_all.h index a62fc5f43c..52a64da8b3 100644 --- a/src/ntopo_bond_all.h +++ b/src/ntopo_bond_all.h @@ -34,15 +34,3 @@ class NTopoBondAll : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Bond atoms %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Bond atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_bond_partial.h b/src/ntopo_bond_partial.h index e0181e4491..f035143a2a 100644 --- a/src/ntopo_bond_partial.h +++ b/src/ntopo_bond_partial.h @@ -34,15 +34,3 @@ class NTopoBondPartial : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Bond atoms %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Bond atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_bond_template.h b/src/ntopo_bond_template.h index 5899ded8b0..6be277cbbc 100644 --- a/src/ntopo_bond_template.h +++ b/src/ntopo_bond_template.h @@ -34,15 +34,3 @@ class NTopoBondTemplate : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Bond atoms %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Bond atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_dihedral_all.h b/src/ntopo_dihedral_all.h index 002c11a385..420c3962b4 100644 --- a/src/ntopo_dihedral_all.h +++ b/src/ntopo_dihedral_all.h @@ -34,15 +34,3 @@ class NTopoDihedralAll : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Dihedral atoms %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Dihedral atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_dihedral_partial.h b/src/ntopo_dihedral_partial.h index c75b52fa44..b0b540a86e 100644 --- a/src/ntopo_dihedral_partial.h +++ b/src/ntopo_dihedral_partial.h @@ -34,15 +34,3 @@ class NTopoDihedralPartial : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Dihedral atoms %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Dihedral atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_dihedral_template.h b/src/ntopo_dihedral_template.h index e9bb1e355a..484635e6b7 100644 --- a/src/ntopo_dihedral_template.h +++ b/src/ntopo_dihedral_template.h @@ -34,15 +34,3 @@ class NTopoDihedralTemplate : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Dihedral atoms %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Dihedral atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_improper_all.h b/src/ntopo_improper_all.h index af8d10cb44..dd4ba81587 100644 --- a/src/ntopo_improper_all.h +++ b/src/ntopo_improper_all.h @@ -34,15 +34,3 @@ class NTopoImproperAll : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Improper atoms %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Improper atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_improper_partial.h b/src/ntopo_improper_partial.h index da88d81a41..e4e181d09f 100644 --- a/src/ntopo_improper_partial.h +++ b/src/ntopo_improper_partial.h @@ -34,15 +34,3 @@ class NTopoImproperPartial : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Improper atoms %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Improper atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/ntopo_improper_template.h b/src/ntopo_improper_template.h index 1a1a4ade23..1bdc0fe572 100644 --- a/src/ntopo_improper_template.h +++ b/src/ntopo_improper_template.h @@ -34,15 +34,3 @@ class NTopoImproperTemplate : public NTopo { #endif #endif - -/* ERROR/WARNING messages: - -E: Improper atoms %d %d %d %d missing on proc %d at step %ld - -UNDOCUMENTED - -W: Improper atoms missing at step %ld - -UNDOCUMENTED - -*/ diff --git a/src/output.cpp b/src/output.cpp index c9da837f63..9444164b63 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -66,7 +66,7 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp) // create default Thermo class - char **newarg = new char*[1]; + auto newarg = new char*[1]; newarg[0] = (char *) "one"; thermo = new Thermo(lmp,1,newarg); delete[] newarg; @@ -275,7 +275,7 @@ void Output::setup(int memflag) (ntimestep/restart_every_single)*restart_every_single + restart_every_single; else { - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -288,7 +288,7 @@ void Output::setup(int memflag) (ntimestep/restart_every_double)*restart_every_double + restart_every_double; else { - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -401,7 +401,7 @@ void Output::setup(int memflag) if (restart_every_single) next_restart_single += restart_every_single; else { modify->clearstep_compute(); - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -422,7 +422,7 @@ void Output::setup(int memflag) if (restart_every_double) next_restart_double += restart_every_double; else { modify->clearstep_compute(); - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart <= ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -648,7 +648,7 @@ int Output::check_time_dumps(bigint ntimestep) } else { modify->clearstep_compute(); update->ntimestep--; - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_single)); if (nextrestart < ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); @@ -667,7 +667,7 @@ int Output::check_time_dumps(bigint ntimestep) } else { modify->clearstep_compute(); update->ntimestep--; - bigint nextrestart = static_cast + auto nextrestart = static_cast (input->variable->compute_equal(ivar_restart_double)); if (nextrestart < ntimestep) error->all(FLERR,"Restart variable returned a bad timestep"); diff --git a/src/output.h b/src/output.h index 54fc83c380..5142be863c 100644 --- a/src/output.h +++ b/src/output.h @@ -33,20 +33,20 @@ class Output : protected Pointers { int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations - int ndump; // # of Dumps defined - int max_dump; // max size of Dump list - bigint next_dump_any; // next timestep for any dump - bigint next_time_dump_any; // next timestep for any time dump with computes - int any_time_dumps; // 1 if any time dump defined - int *mode_dump; // 0/1 if write every N timesteps or Delta in sim time - int *every_dump; // dump every N timesteps, 0 if variable - double *every_time_dump; // dump every Delta of sim time, 0.0 if variable - bigint *next_dump; // next timestep to perform dump - double *next_time_dump; // next simulation time to perform dump (mode = 1) - bigint *last_dump; // last timestep each snapshot was output - char **var_dump; // variable name for next dump (steps or sim time) - int *ivar_dump; // variable index of var_dump name - Dump **dump; // list of defined Dumps + int ndump; // # of Dumps defined + int max_dump; // max size of Dump list + bigint next_dump_any; // next timestep for any dump + bigint next_time_dump_any; // next timestep for any time dump with computes + int any_time_dumps; // 1 if any time dump defined + int *mode_dump; // 0/1 if write every N timesteps or Delta in sim time + int *every_dump; // dump every N timesteps, 0 if variable + double *every_time_dump; // dump every Delta of sim time, 0.0 if variable + bigint *next_dump; // next timestep to perform dump + double *next_time_dump; // next simulation time to perform dump (mode = 1) + bigint *last_dump; // last timestep each snapshot was output + char **var_dump; // variable name for next dump (steps or sim time) + int *ivar_dump; // variable index of var_dump name + 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 @@ -99,98 +99,3 @@ class Output : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Variable name for thermo every does not exist - -Self-explanatory. - -E: Variable for thermo every is invalid style - -Only equal-style variables can be used. - -E: Variable name for dump every does not exist - -Self-explanatory. - -E: Variable for dump every is invalid style - -Only equal-style variables can be used. - -E: Variable name for restart does not exist - -Self-explanatory. - -E: Variable for restart is invalid style - -Only equal-style variables can be used. - -E: Dump every variable returned a bad timestep - -The variable must return a timestep greater than the current timestep. - -E: Restart variable returned a bad timestep - -The variable must return a timestep greater than the current timestep. - -E: Thermo every variable returned a bad timestep - -The variable must return a timestep greater than the current timestep. - -E: Thermo_modify every variable returned a bad timestep - -The returned timestep is less than or equal to the current timestep. - -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: Reuse of dump ID - -A dump ID cannot be used twice. - -E: Could not find dump group ID - -A group ID used in the dump command does not exist. - -E: Invalid dump frequency - -Dump frequency must be 1 or greater. - -E: Unrecognized dump style - -The choice of dump style is unknown. - -E: Cound not find dump_modify ID - -Self-explanatory. - -E: Could not find undump ID - -A dump ID used in the undump command does not exist. - -E: Thermo_style command before simulation box is defined - -The thermo_style command cannot be used before a read_data, -read_restart, or create_box command. - -W: New thermo_style command, previous thermo_modify settings will be lost - -If a thermo_style command is used after a thermo_modify command, the -settings changed by the thermo_modify command will be reset to their -default values. This is because the thermo_modify command acts on -the currently defined thermo style, and a thermo_style command creates -a new style. - -E: Both restart files must use % or neither - -Self-explanatory. - -E: Both restart files must use MPI-IO or neither - -Self-explanatory. - -*/ diff --git a/src/pair.cpp b/src/pair.cpp index aee89db49e..a8168bd4d7 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -58,6 +58,7 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) comm_forward = comm_reverse = comm_reverse_off = 0; single_enable = 1; + born_matrix_enable = 0; single_hessian_enable = 0; restartinfo = 1; respa_enable = 0; diff --git a/src/pair.h b/src/pair.h index f4aa82a586..4763a225d2 100644 --- a/src/pair.h +++ b/src/pair.h @@ -52,6 +52,7 @@ class Pair : protected Pointers { int comm_reverse_off; // size of reverse comm even if newton off int single_enable; // 1 if single() routine exists + int born_matrix_enable; // 1 if born_matrix() routine exists int single_hessian_enable; // 1 if single_hessian() routine exists int restartinfo; // 1 if pair style writes restart info int respa_enable; // 1 if inner/middle/outer rRESPA routines @@ -169,6 +170,12 @@ class Pair : protected Pointers { return 0.0; } + virtual void born_matrix(int /*i*/, int /*j*/, int /*itype*/, int /*jtype*/, double /*rsq*/, + double /*factor_coul*/, double /*factor_lj*/, double &du, double &du2) + { + du = du2 = 0.0; + } + virtual void settings(int, char **) = 0; virtual void coeff(int, char **) = 0; @@ -286,116 +293,3 @@ class Pair : protected Pointers { } // namespace LAMMPS_NS #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: Too many total bits for bitmapped lookup table - -Table size specified via pair_modify command is too large. Note that -a value of N generates a 2^N size table. - -E: Cannot have both pair_modify shift and tail set to yes - -These 2 options are contradictory. - -E: Cannot use pair tail corrections with 2d simulations - -The correction factors are only currently defined for 3d systems. - -W: Using pair tail corrections with non-periodic system - -This is probably a bogus thing to do, since tail corrections are -computed by integrating the density of a periodic system out to -infinity. - -W: Using pair tail corrections with pair_modify compute no - -The tail corrections will thus not be computed. - -W: Using pair potential shift with pair_modify compute no - -The shift effects will thus not be computed. - -W: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions - -This is likely not what you want to do. The exclusion settings will -eliminate neighbors in the neighbor list, which the manybody potential -needs to calculated its terms correctly. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Fix adapt interface to this pair style not supported - -New coding for the pair style would need to be done. - -E: Pair style requires a KSpace style - -No kspace style is defined. - -E: BUG: restartinfo=1 but no restart support in pair style - -The pair style has a bug, where it does not support reading -and writing information to a restart file, but does not set -the member variable restartinfo to 0 as required in that case. - -E: Cannot yet use compute tally with Kokkos - -This feature is not yet supported. - -E: Pair style does not support pair_write - -The pair style does not have a single() function, so it can -not be invoked by pair write. - -E: Invalid atom types in pair_write command - -Atom types must range from 1 to Ntypes inclusive. - -E: Invalid style in pair_write command - -Self-explanatory. Check the input script. - -E: Invalid cutoffs in pair_write command - -Inner cutoff must be larger than 0.0 and less than outer cutoff. - -E: Cannot open pair_write file - -The specified output file for pair energies and forces cannot be -opened. Check that the path and name are correct. - -E: Bitmapped lookup tables require int/float be same size - -Cannot use pair tables on this machine, because of word sizes. Use -the pair_modify command with table 0 instead. - -W: Table inner cutoff >= outer cutoff - -You specified an inner cutoff for a Coulombic table that is longer -than the global cutoff. Probably not what you wanted. - -E: Too many exponent bits for lookup table - -Table size specified via pair_modify command does not work with your -machine's floating point representation. - -E: Too many mantissa bits for lookup table - -Table size specified via pair_modify command does not work with your -machine's floating point representation. - -E: Too few bits for lookup table - -Table size specified via pair_modify command does not work with your -machine's floating point representation. - -*/ diff --git a/src/pair_born.h b/src/pair_born.h index 491989ee5c..0c6bbb88d4 100644 --- a/src/pair_born.h +++ b/src/pair_born.h @@ -55,22 +55,3 @@ class PairBorn : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/pair_buck.h b/src/pair_buck.h index b972125b06..1df96e09e2 100644 --- a/src/pair_buck.h +++ b/src/pair_buck.h @@ -54,22 +54,3 @@ class PairBuck : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/pair_buck_coul_cut.h b/src/pair_buck_coul_cut.h index 5cb128ad25..9460e89df7 100644 --- a/src/pair_buck_coul_cut.h +++ b/src/pair_buck_coul_cut.h @@ -56,26 +56,3 @@ class PairBuckCoulCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style buck/coul/cut requires atom attribute q - -The atom style defined does not have this attribute. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/pair_coul_cut.h b/src/pair_coul_cut.h index f902ea735f..2eb08e73b2 100644 --- a/src/pair_coul_cut.h +++ b/src/pair_coul_cut.h @@ -53,21 +53,3 @@ class PairCoulCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/cut requires atom attribute q - -The atom style defined does not have these attributes. - -*/ diff --git a/src/pair_coul_debye.h b/src/pair_coul_debye.h index 917edef304..f045849503 100644 --- a/src/pair_coul_debye.h +++ b/src/pair_coul_debye.h @@ -41,13 +41,3 @@ class PairCoulDebye : public PairCoulCut { #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. - -*/ diff --git a/src/pair_coul_dsf.h b/src/pair_coul_dsf.h index 1011bac5e4..8b562ecf02 100644 --- a/src/pair_coul_dsf.h +++ b/src/pair_coul_dsf.h @@ -52,21 +52,3 @@ class PairCoulDSF : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style coul/dsf requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/pair_coul_wolf.h b/src/pair_coul_wolf.h index 508c74b21b..97fe0be429 100644 --- a/src/pair_coul_wolf.h +++ b/src/pair_coul_wolf.h @@ -49,21 +49,3 @@ class PairCoulWolf : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair coul/wolf requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/pair_deprecated.cpp b/src/pair_deprecated.cpp index b691744cd4..691eff124f 100644 --- a/src/pair_deprecated.cpp +++ b/src/pair_deprecated.cpp @@ -36,7 +36,7 @@ void PairDeprecated::settings(int, char **) // called, our style was just added at the end of the list of substyles if (utils::strmatch(my_style,"^hybrid")) { - PairHybrid *hybrid = (PairHybrid *)force->pair; + auto hybrid = dynamic_cast(force->pair); my_style = hybrid->keywords[hybrid->nstyles]; } diff --git a/src/pair_deprecated.h b/src/pair_deprecated.h index 5468b01259..2af100ee74 100644 --- a/src/pair_deprecated.h +++ b/src/pair_deprecated.h @@ -38,7 +38,3 @@ class PairDeprecated : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 5deb35b634..d0a3a2b053 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -51,8 +51,8 @@ PairHybrid::~PairHybrid() for (int m = 0; m < nstyles; m++) { delete styles[m]; delete[] keywords[m]; - if (special_lj[m]) delete[] special_lj[m]; - if (special_coul[m]) delete[] special_coul[m]; + delete[] special_lj[m]; + delete[] special_coul[m]; } } delete[] styles; @@ -115,7 +115,7 @@ void PairHybrid::compute(int eflag, int vflag) Respa *respa = nullptr; respaflag = 0; if (utils::strmatch(update->integrate_style,"^respa")) { - respa = (Respa *) update->integrate; + respa = dynamic_cast( update->integrate); if (respa->nhybrid_styles > 0) respaflag = 1; } @@ -275,8 +275,8 @@ void PairHybrid::settings(int narg, char **arg) for (int m = 0; m < nstyles; m++) { delete styles[m]; delete[] keywords[m]; - if (special_lj[m]) delete[] special_lj[m]; - if (special_coul[m]) delete[] special_coul[m]; + delete[] special_lj[m]; + delete[] special_coul[m]; } delete[] styles; delete[] keywords; @@ -391,6 +391,7 @@ void PairHybrid::flags() // single_enable = 1 if all sub-styles are set // respa_enable = 1 if all sub-styles are set // manybody_flag = 1 if any sub-style is set + // born_matrix_enable = 1 if all sub-styles are set // no_virial_fdotr_compute = 1 if any sub-style is set // ghostneigh = 1 if any sub-style is set // ewaldflag, pppmflag, msmflag, dipoleflag, dispersionflag, tip4pflag = 1 @@ -401,11 +402,13 @@ void PairHybrid::flags() compute_flag = 0; respa_enable = 0; restartinfo = 0; + born_matrix_enable = 0; for (m = 0; m < nstyles; m++) { if (styles[m]->single_enable) ++single_enable; if (styles[m]->respa_enable) ++respa_enable; if (styles[m]->restartinfo) ++restartinfo; + if (styles[m]->born_matrix_enable) ++born_matrix_enable; if (styles[m]->manybody_flag) manybody_flag = 1; if (styles[m]->no_virial_fdotr_compute) no_virial_fdotr_compute = 1; if (styles[m]->ghostneigh) ghostneigh = 1; @@ -422,6 +425,7 @@ void PairHybrid::flags() single_enable = (single_enable == nstyles) ? 1 : 0; respa_enable = (respa_enable == nstyles) ? 1 : 0; restartinfo = (restartinfo == nstyles) ? 1 : 0; + born_matrix_enable = (born_matrix_enable == nstyles) ? 1 : 0; init_svector(); // set centroidstressflag for pair hybrid @@ -867,6 +871,40 @@ double PairHybrid::single(int i, int j, int itype, int jtype, return esum; } +/* ---------------------------------------------------------------------- + call sub-style to compute born matrix interaction + error if sub-style does not support born_matrix call + since overlay could have multiple sub-styles, sum results explicitly +------------------------------------------------------------------------- */ + +void PairHybrid::born_matrix(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_lj, + double &dupair, double &du2pair) +{ + if (nmap[itype][jtype] == 0) + error->one(FLERR,"Invoked pair born_matrix on pair style none"); + + double du, du2; + dupair = du2pair = 0.0; + + for (int m = 0; m < nmap[itype][jtype]; m++) { + if (rsq < styles[map[itype][jtype][m]]->cutsq[itype][jtype]) { + if (styles[map[itype][jtype][m]]->born_matrix_enable == 0) + error->one(FLERR,"Pair hybrid sub-style does not support born_matrix call"); + + if ((special_lj[map[itype][jtype][m]] != nullptr) || + (special_coul[map[itype][jtype][m]] != nullptr)) + error->one(FLERR,"Pair hybrid born_matrix calls do not support" + " per sub-style special bond values"); + + du = du2 = 0.0; + styles[map[itype][jtype][m]]->born_matrix(i,j,itype,jtype,rsq,factor_coul,factor_lj,du,du2); + dupair += du; + du2pair += du2; + } + } +} + /* ---------------------------------------------------------------------- copy Pair::svector data ------------------------------------------------------------------------- */ @@ -1013,7 +1051,7 @@ void PairHybrid::set_special(int m) double * PairHybrid::save_special() { - double *saved = new double[8]; + auto saved = new double[8]; for (int i = 0; i < 4; ++i) { saved[i] = force->special_lj[i]; @@ -1054,7 +1092,7 @@ void *PairHybrid::extract(const char *str, int &dim) if (couldim != -1 && dim != couldim) error->all(FLERR, "Coulomb styles of pair hybrid sub-styles do not match"); - double *p_newvalue = (double *) ptr; + auto p_newvalue = (double *) ptr; double newvalue = *p_newvalue; if (cutptr && (newvalue != cutvalue)) error->all(FLERR, diff --git a/src/pair_hybrid.h b/src/pair_hybrid.h index ee56783700..84056f1e79 100644 --- a/src/pair_hybrid.h +++ b/src/pair_hybrid.h @@ -49,6 +49,8 @@ class PairHybrid : public Pair { void write_restart(FILE *) override; void read_restart(FILE *) override; double single(int, int, int, int, double, double, double, double &) override; + void born_matrix(int, int, int, int, double, double, double, double &, double &) override; + void modify_params(int narg, char **arg) override; double memory_usage() override; @@ -97,72 +99,3 @@ class PairHybrid : public Pair { #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: Pair style hybrid cannot have hybrid as an argument - -Self-explanatory. - -E: Pair style hybrid cannot have none as an argument - -Self-explanatory. - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Cannot yet use pair hybrid with Kokkos - -This feature is not yet supported. - -E: Pair coeff for hybrid has invalid style - -Style in pair coeff must have been listed in pair_style command. - -E: Pair hybrid sub-style is not used - -No pair_coeff command used a sub-style specified in the pair_style -command. - -E: Pair_modify special setting for pair hybrid incompatible with global special_bonds setting - -Cannot override a setting of 0.0 or 1.0 or change a setting between -0.0 and 1.0. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Invoked pair single on pair style none - -A command (e.g. a dump) attempted to invoke the single() function on a -pair style none, which is illegal. You are probably attempting to -compute per-atom quantities with an undefined pair style. - -E: Pair hybrid sub-style does not support single call - -You are attempting to invoke a single() call on a pair style -that doesn't support it. - -E: Pair hybrid single calls do not support per sub-style special bond values - -Self-explanatory. - -E: Unknown pair_modify hybrid sub-style - -The choice of sub-style is unknown. - -E: Coulomb cutoffs of pair hybrid sub-styles do not match - -If using a Kspace solver, all Coulomb cutoffs of long pair styles must -be the same. - -*/ diff --git a/src/pair_hybrid_overlay.h b/src/pair_hybrid_overlay.h index 13b70fa042..8debcb2056 100644 --- a/src/pair_hybrid_overlay.h +++ b/src/pair_hybrid_overlay.h @@ -38,15 +38,3 @@ class PairHybridOverlay : public PairHybrid { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair coeff for hybrid has invalid style - -Style in pair coeff must have been listed in pair_style command. - -*/ diff --git a/src/pair_hybrid_scaled.cpp b/src/pair_hybrid_scaled.cpp index 24158f46a0..2c0c574f70 100644 --- a/src/pair_hybrid_scaled.cpp +++ b/src/pair_hybrid_scaled.cpp @@ -67,7 +67,7 @@ void PairHybridScaled::compute(int eflag, int vflag) const int nvars = scalevars.size(); if (nvars > 0) { - double *vals = new double[nvars]; + auto vals = new double[nvars]; for (int k = 0; k < nvars; ++k) { int m = input->variable->find(scalevars[k].c_str()); if (m < 0) @@ -130,7 +130,7 @@ void PairHybridScaled::compute(int eflag, int vflag) Respa *respa = nullptr; respaflag = 0; if (utils::strmatch(update->integrate_style, "^respa")) { - respa = (Respa *) update->integrate; + respa = dynamic_cast(update->integrate); if (respa->nhybrid_styles > 0) respaflag = 1; } @@ -250,8 +250,8 @@ void PairHybridScaled::settings(int narg, char **arg) for (int m = 0; m < nstyles; m++) { delete styles[m]; delete[] keywords[m]; - if (special_lj[m]) delete[] special_lj[m]; - if (special_coul[m]) delete[] special_coul[m]; + delete[] special_lj[m]; + delete[] special_coul[m]; } delete[] styles; delete[] keywords; @@ -385,7 +385,7 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, const int nvars = scalevars.size(); if (nvars > 0) { - double *vals = new double[nvars]; + auto vals = new double[nvars]; for (int k = 0; k < nvars; ++k) { int m = input->variable->find(scalevars[k].c_str()); if (m < 0) @@ -401,7 +401,6 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, double fone; fforce = 0.0; double esum = 0.0; - double scale; for (int m = 0; m < nmap[itype][jtype]; m++) { auto pstyle = styles[map[itype][jtype][m]]; @@ -413,7 +412,7 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, (special_coul[map[itype][jtype][m]] != nullptr)) error->one(FLERR, "Pair hybrid single() does not support per sub-style special_bond"); - scale = scaleval[map[itype][jtype][m]]; + double scale = scaleval[map[itype][jtype][m]]; esum += scale * pstyle->single(i, j, itype, jtype, rsq, factor_coul, factor_lj, fone); fforce += scale * fone; } @@ -423,6 +422,57 @@ double PairHybridScaled::single(int i, int j, int itype, int jtype, double rsq, return esum; } +/* ---------------------------------------------------------------------- + call sub-style to compute born matrix interaction + error if sub-style does not support born_matrix call + since overlay could have multiple sub-styles, sum results explicitly +------------------------------------------------------------------------- */ + +void PairHybridScaled::born_matrix(int i, int j, int itype, int jtype, double rsq, + double factor_coul, double factor_lj, double &dupair, + double &du2pair) +{ + if (nmap[itype][jtype] == 0) error->one(FLERR, "Invoked pair born_matrix on pair style none"); + + // update scale values from variables where needed + + const int nvars = scalevars.size(); + if (nvars > 0) { + double *vals = new double[nvars]; + for (int k = 0; k < nvars; ++k) { + int m = input->variable->find(scalevars[k].c_str()); + if (m < 0) + error->all(FLERR, "Variable '{}' not found when updating scale factors", scalevars[k]); + vals[k] = input->variable->compute_equal(m); + } + for (int k = 0; k < nstyles; ++k) { + if (scaleidx[k] >= 0) scaleval[k] = vals[scaleidx[k]]; + } + delete[] vals; + } + + double du, du2, scale; + dupair = du2pair = scale = 0.0; + + for (int m = 0; m < nmap[itype][jtype]; m++) { + auto pstyle = styles[map[itype][jtype][m]]; + if (rsq < pstyle->cutsq[itype][jtype]) { + if (pstyle->born_matrix_enable == 0) + error->one(FLERR, "Pair hybrid sub-style does not support born_matrix call"); + + if ((special_lj[map[itype][jtype][m]] != nullptr) || + (special_coul[map[itype][jtype][m]] != nullptr)) + error->one(FLERR, "Pair hybrid born_matrix() does not support per sub-style special_bond"); + + du = du2 = 0.0; + scale = scaleval[map[itype][jtype][m]]; + pstyle->born_matrix(i, j, itype, jtype, rsq, factor_coul, factor_lj, du, du2); + dupair += scale * du; + du2pair += scale * du2; + } + } +} + /* ---------------------------------------------------------------------- set coeffs for one or more type pairs ------------------------------------------------------------------------- */ @@ -477,8 +527,8 @@ void PairHybridScaled::coeff(int narg, char **arg) // ensure that one_coeff flag is honored if (!none && styles[m]->one_coeff) - if ((strcmp(arg[0],"*") != 0) || (strcmp(arg[1],"*") != 0)) - error->all(FLERR,"Incorrect args for pair coefficients"); + if ((strcmp(arg[0], "*") != 0) || (strcmp(arg[1], "*") != 0)) + error->all(FLERR, "Incorrect args for pair coefficients"); // invoke sub-style coeff() starting with 1st remaining arg diff --git a/src/pair_hybrid_scaled.h b/src/pair_hybrid_scaled.h index 9bb8901846..14d8ede71f 100644 --- a/src/pair_hybrid_scaled.h +++ b/src/pair_hybrid_scaled.h @@ -38,6 +38,7 @@ class PairHybridScaled : public PairHybrid { void write_restart(FILE *) override; void read_restart(FILE *) override; double single(int, int, int, int, double, double, double, double &) override; + void born_matrix(int, int, int, int, double, double, double, double &, double &) override; void init_svector() override; void copy_svector(int, int) override; @@ -54,15 +55,3 @@ class PairHybridScaled : public PairHybrid { #endif #endif - -/* ERROR/WARNING messages: - -E: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair coeff for hybrid has invalid style - -Style in pair coeff must have been listed in pair_style command. - -*/ diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index c6751b3505..73d46b26ce 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -39,6 +39,7 @@ using namespace MathConst; PairLJCut::PairLJCut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; + born_matrix_enable = 1; writedata = 1; } @@ -478,7 +479,7 @@ void PairLJCut::init_style() int list_style = NeighConst::REQ_DEFAULT; if (update->whichflag == 1 && utils::strmatch(update->integrate_style, "^respa")) { - auto respa = (Respa *) update->integrate; + auto respa = dynamic_cast(update->integrate); if (respa->level_inner >= 0) list_style = NeighConst::REQ_RESPA_INOUT; if (respa->level_middle >= 0) list_style = NeighConst::REQ_RESPA_ALL; } @@ -487,8 +488,8 @@ void PairLJCut::init_style() // set rRESPA cutoffs if (utils::strmatch(update->integrate_style, "^respa") && - ((Respa *) update->integrate)->level_inner >= 0) - cut_respa = ((Respa *) update->integrate)->cutoff; + (dynamic_cast(update->integrate))->level_inner >= 0) + cut_respa = (dynamic_cast(update->integrate))->cutoff; else cut_respa = nullptr; } @@ -672,6 +673,28 @@ double PairLJCut::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, /* ---------------------------------------------------------------------- */ +void PairLJCut::born_matrix(int /*i*/, int /*j*/, int itype, int jtype, double rsq, + double /*factor_coul*/, double factor_lj, double &dupair, + double &du2pair) +{ + double rinv, r2inv, r6inv, du, du2; + + r2inv = 1.0 / rsq; + rinv = sqrt(r2inv); + r6inv = r2inv * r2inv * r2inv; + + // Reminder: lj1 = 48*e*s^12, lj2 = 24*e*s^6 + // so dupair = -forcelj/r = -fforce*r (forcelj from single method) + + du = r6inv * rinv * (lj2[itype][jtype] - lj1[itype][jtype] * r6inv); + du2 = r6inv * r2inv * (13 * lj1[itype][jtype] * r6inv - 7 * lj2[itype][jtype]); + + dupair = factor_lj * du; + du2pair = factor_lj * du2; +} + +/* ---------------------------------------------------------------------- */ + void *PairLJCut::extract(const char *str, int &dim) { dim = 2; diff --git a/src/pair_lj_cut.h b/src/pair_lj_cut.h index 8ca9a14620..3ab865650f 100644 --- a/src/pair_lj_cut.h +++ b/src/pair_lj_cut.h @@ -40,6 +40,7 @@ class PairLJCut : public Pair { void write_data(FILE *) override; void write_data_all(FILE *) override; double single(int, int, int, int, double, double, double, double &) override; + void born_matrix(int, int, int, int, double, double, double, double &, double &) override; void *extract(const char *, int &) override; void compute_inner() override; @@ -60,22 +61,3 @@ class PairLJCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/pair_lj_cut_coul_cut.h b/src/pair_lj_cut_coul_cut.h index fd4cc22c28..7ad725845a 100644 --- a/src/pair_lj_cut_coul_cut.h +++ b/src/pair_lj_cut_coul_cut.h @@ -56,21 +56,3 @@ class PairLJCutCoulCut : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: Pair style lj/cut/coul/cut requires atom attribute q - -The atom style defined does not have this attribute. - -*/ diff --git a/src/pair_lj_expand.h b/src/pair_lj_expand.h index df31757ad0..84c1aafdd2 100644 --- a/src/pair_lj_expand.h +++ b/src/pair_lj_expand.h @@ -55,17 +55,3 @@ class PairLJExpand : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/pair_morse.h b/src/pair_morse.h index e1b9d4516c..9a818c7d4e 100644 --- a/src/pair_morse.h +++ b/src/pair_morse.h @@ -56,22 +56,3 @@ class PairMorse : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -*/ diff --git a/src/pair_soft.h b/src/pair_soft.h index c2e3044764..08ace01cbc 100644 --- a/src/pair_soft.h +++ b/src/pair_soft.h @@ -56,17 +56,3 @@ class PairSoft : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 7b77a847f1..aefe9c4c4f 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -873,7 +873,7 @@ void PairTable::spline(double *x, double *y, int n, double yp1, double ypn, doub { int i, k; double p, qn, sig, un; - double *u = new double[n]; + auto u = new double[n]; if (yp1 > 0.99e30) y2[0] = u[0] = 0.0; diff --git a/src/pair_table.h b/src/pair_table.h index 87a2fbb055..529a4a93e2 100644 --- a/src/pair_table.h +++ b/src/pair_table.h @@ -74,99 +74,3 @@ class PairTable : public Pair { #endif #endif - -/* ERROR/WARNING messages: - -E: Pair distance < table inner cutoff: ijtype %d %d dist %g - -UNDOCUMENTED - -E: Pair distance > table outer cutoff: ijtype %d %d dist %g - -UNDOCUMENTED - -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: Unknown table style in pair_style command - -Style of table is invalid for use with pair_style table command. - -E: Illegal number of pair table entries - -There must be at least 2 table entries. - -E: Invalid pair table length - -Length of read-in pair table is invalid - -E: Invalid pair table cutoff - -Cutoffs in pair_coeff command are not valid with read-in pair table. - -E: Bitmapped table in file does not match requested table - -Setting for bitmapped table in pair_coeff command must match table -in file exactly. - -E: All pair coeffs are not set - -All pair coefficients must be set in the data file or by the -pair_coeff command before running a simulation. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -E: Did not find keyword in table file - -Keyword used in pair_coeff command was not found in table file. - -E: Bitmapped table is incorrect length in table file - -Number of table entries is not a correct power of 2. - -E: Premature end of file in pair table - -UNDOCUMENTED - -W: %d of %d force values in table are inconsistent with -dE/dr.\n Should only be flagged at inflection points - -UNDOCUMENTED - -W: %d of %d distance values in table with relative error\n over %g to re-computed values - -UNDOCUMENTED - -W: %d of %d lines in table were incomplete\n or could not be parsed completely - -UNDOCUMENTED - -E: Invalid keyword in pair table parameters - -Keyword used in list of table parameters is not recognized. - -E: Pair table parameters did not set N - -List of pair table parameters must include N setting. - -E: Pair distance < table inner cutoff - -Two atoms are closer together than the pairwise table allows. - -E: Pair distance > table outer cutoff - -Two atoms are further apart than the pairwise table allows. - -E: Pair table cutoffs must all be equal to use with KSpace - -When using pair style table with a long-range KSpace solver, the -cutoffs for all atom type pairs must all be the same, since the -long-range solver starts at that cutoff. - -*/ diff --git a/src/pair_yukawa.h b/src/pair_yukawa.h index bb50b42aab..64c7166331 100644 --- a/src/pair_yukawa.h +++ b/src/pair_yukawa.h @@ -53,17 +53,3 @@ class PairYukawa : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/pair_zbl.h b/src/pair_zbl.h index 5927f8e751..f51e6ba93b 100644 --- a/src/pair_zbl.h +++ b/src/pair_zbl.h @@ -58,17 +58,3 @@ class PairZBL : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -*/ diff --git a/src/pair_zero.h b/src/pair_zero.h index e94d301f4e..03b6d096a1 100644 --- a/src/pair_zero.h +++ b/src/pair_zero.h @@ -63,22 +63,3 @@ class PairZero : public Pair { #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: Incorrect args for pair coefficients - -Self-explanatory. Check the input script or data file. - -U: Pair cutoff < Respa interior cutoff - -One or more pairwise cutoffs are too short to use with the specified -rRESPA cutoffs. - -*/ diff --git a/src/platform.cpp b/src/platform.cpp index b2bca69934..d37309c043 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -19,9 +19,9 @@ #include "text_file_reader.h" #include "utils.h" -#include -#include #include +#include +#include //////////////////////////////////////////////////////////////////////// // include system headers and tweak system settings @@ -71,11 +71,11 @@ struct compress_info { /// identifier for the different compression algorithms enum styles { NONE, GZIP, BZIP2, ZSTD, XZ, LZMA, LZ4 }; - const std::string extension; ///< filename extension for the current algorithm - const std::string command; ///< command to perform compression or decompression + const std::string extension; ///< filename extension for the current algorithm + const std::string command; ///< command to perform compression or decompression const std::string compressflags; ///< flags to append to compress from stdin to stdout const std::string uncompressflags; ///< flags to decompress file to stdout - const int style; ///< compression style flag + const int style; ///< compression style flag }; // clang-format off @@ -230,16 +230,16 @@ std::string platform::os_info() if (platform::file_is_readable("/etc/os-release")) { try { - TextFileReader reader("/etc/os-release",""); - while (true) { - auto words = reader.next_values(0,"="); - if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) { - buf += " " + utils::trim(words.next_string()); - break; - } + TextFileReader reader("/etc/os-release", ""); + while (true) { + auto words = reader.next_values(0, "="); + if ((words.count() > 1) && (words.next_string() == "PRETTY_NAME")) { + buf += " " + utils::trim(words.next_string()); + break; } + } } catch (std::exception &e) { - ; // EOF but keyword not found + ; // EOF but keyword not found } } @@ -427,11 +427,11 @@ std::string platform::compress_info() std::string buf = "Available compression formats:\n\n"; bool none_found = true; for (const auto &cmpi : compress_styles) { - if (cmpi.style == ::compress_info::NONE) continue; - if (find_exe_path(cmpi.command).size()) { - none_found = false; - buf += fmt::format("Extension: .{:6} Command: {}\n", cmpi.extension, cmpi.command); - } + if (cmpi.style == ::compress_info::NONE) continue; + if (find_exe_path(cmpi.command).size()) { + none_found = false; + buf += fmt::format("Extension: .{:6} Command: {}\n", cmpi.extension, cmpi.command); + } } if (none_found) buf += "None\n"; return buf; @@ -450,7 +450,7 @@ int platform::putenv(const std::string &vardef) if (found == std::string::npos) return _putenv_s(vardef.c_str(), "1"); else - return _putenv_s(vardef.substr(0, found).c_str(), vardef.substr(found+1).c_str()); + return _putenv_s(vardef.substr(0, found).c_str(), vardef.substr(found + 1).c_str()); #else if (found == std::string::npos) return setenv(vardef.c_str(), "", 1); @@ -472,7 +472,7 @@ int platform::unsetenv(const std::string &variable) const char *ptr = getenv(variable.c_str()); if (!ptr) return -1; // empty _putenv_s() definition deletes variable - return _putenv_s(variable.c_str(),""); + return _putenv_s(variable.c_str(), ""); #else return ::unsetenv(variable.c_str()); #endif @@ -579,8 +579,10 @@ void *platform::dlopen(const std::string &fname) std::string platform::dlerror() { const char *errmesg = ::dlerror(); - if (errmesg) return {errmesg}; - else return {""}; + if (errmesg) + return {errmesg}; + else + return {""}; } // close a shared object @@ -678,7 +680,7 @@ std::string platform::current_directory() if (_getcwd(buf, MAX_PATH)) { cwd = buf; } delete[] buf; #else - char *buf = new char[PATH_MAX]; + auto buf = new char[PATH_MAX]; if (::getcwd(buf, PATH_MAX)) { cwd = buf; } delete[] buf; #endif @@ -758,7 +760,7 @@ int platform::chdir(const std::string &path) int platform::mkdir(const std::string &path) { - std::deque dirlist = { path }; + std::deque dirlist = {path}; std::string dirname = path_dirname(path); while ((dirname != ".") && (dirname != "")) { diff --git a/src/procmap.cpp b/src/procmap.cpp index 3fc8a2263e..801a18c7a5 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -163,7 +163,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, char node_name[MPI_MAX_PROCESSOR_NAME]; MPI_Get_processor_name(node_name,&name_length); node_name[name_length] = '\0'; - char *node_names = new char[MPI_MAX_PROCESSOR_NAME*nprocs]; + auto node_names = new char[MPI_MAX_PROCESSOR_NAME*nprocs]; MPI_Allgather(node_name,MPI_MAX_PROCESSOR_NAME,MPI_CHAR,node_names, MPI_MAX_PROCESSOR_NAME,MPI_CHAR,world); std::string node_string = std::string(node_name); diff --git a/src/procmap.h b/src/procmap.h index f1ad4afc24..df8b9431d3 100644 --- a/src/procmap.h +++ b/src/procmap.h @@ -54,46 +54,3 @@ class ProcMap : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Could not create 3d grid of processors - -The specified constraints did not allow a Px by Py by Pz grid to be -created where Px * Py * Pz = P = total number of processors. - -E: Processors twogrid requires proc count be a multiple of core count - -Self-explanatory. - -E: Could not create twolevel 3d grid of processors - -The specified constraints did not allow this style of grid to be -created. - -E: Could not create numa grid of processors - -The specified constraints did not allow this style of grid to be -created. Usually this is because the total processor count is not a -multiple of the cores/node or the user specified processor count is > -1 in one of the dimensions. - -E: Cannot open custom file - -Self-explanatory. - -E: Unexpected end of custom file - -Self-explanatory. - -E: Processors custom grid file is inconsistent - -The vales in the custom file are not consistent with the number of -processors you are running on or the Px,Py,Pz settings of the -processors command. Or there was not a setting for every processor. - -E: Cannot open processors output file - -Self-explanatory. - -*/ diff --git a/src/random_mars.h b/src/random_mars.h index f2b9e17e8b..91fad5a2f3 100644 --- a/src/random_mars.h +++ b/src/random_mars.h @@ -42,12 +42,3 @@ class RanMars : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid seed for Marsaglia random # generator - -The initial seed for this random number generator must be a positive -integer less than or equal to 900 million. - -*/ diff --git a/src/random_park.cpp b/src/random_park.cpp index 34a5378a35..34f8396e44 100644 --- a/src/random_park.cpp +++ b/src/random_park.cpp @@ -94,7 +94,7 @@ void RanPark::reset(int ibase, double *coord) { int i; - char *str = (char *) &ibase; + auto str = (char *) &ibase; int n = sizeof(int); unsigned int hash = 0; diff --git a/src/random_park.h b/src/random_park.h index d230dfe40b..0abe2e4fd3 100644 --- a/src/random_park.h +++ b/src/random_park.h @@ -35,12 +35,3 @@ class RanPark : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid seed for Park random # generator - -The initial seed for this random number generator must be a positive -integer. - -*/ diff --git a/src/rcb.cpp b/src/rcb.cpp index 92eafebc28..ef326793cc 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -1130,8 +1130,8 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, void box_merge(void *in, void *inout, int * /*len*/, MPI_Datatype * /*dptr*/) { - RCB::BBox *box1 = (RCB::BBox *) in; - RCB::BBox *box2 = (RCB::BBox *) inout; + auto box1 = (RCB::BBox *) in; + auto box2 = (RCB::BBox *) inout; for (int i = 0; i < 3; i++) { if (box1->lo[i] < box2->lo[i]) box2->lo[i] = box1->lo[i]; @@ -1160,8 +1160,8 @@ void box_merge(void *in, void *inout, int * /*len*/, MPI_Datatype * /*dptr*/) void median_merge(void *in, void *inout, int * /*len*/, MPI_Datatype * /*dptr*/) { - RCB::Median *med1 = (RCB::Median *) in; - RCB::Median *med2 = (RCB::Median *) inout; + auto med1 = (RCB::Median *) in; + auto med2 = (RCB::Median *) inout; med2->totallo += med1->totallo; if (med1->valuelo > med2->valuelo) { @@ -1209,8 +1209,7 @@ void RCB::invert(int sortflag) int *proclist; memory->create(proclist,nsend,"RCB:proclist"); - Invert *sinvert = - (Invert *) memory->smalloc(nsend*sizeof(Invert),"RCB:sinvert"); + auto sinvert = (Invert *) memory->smalloc(nsend*sizeof(Invert),"RCB:sinvert"); int m = 0; for (int i = nkeep; i < nfinal; i++) { @@ -1225,8 +1224,7 @@ void RCB::invert(int sortflag) // nrecv = # of my dots to send to other procs int nrecv = irregular->create_data(nsend,proclist,sortflag); - Invert *rinvert = - (Invert *) memory->smalloc(nrecv*sizeof(Invert),"RCB:rinvert"); + auto rinvert = (Invert *) memory->smalloc(nrecv*sizeof(Invert),"RCB:rinvert"); irregular->exchange_data((char *) sinvert,sizeof(Invert),(char *) rinvert); irregular->destroy_data(); diff --git a/src/read_data.cpp b/src/read_data.cpp index 8144414af9..b77394bcb3 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -99,11 +99,11 @@ ReadData::ReadData(LAMMPS *lmp) : Command(lmp) // pointers to atom styles that store bonus info nellipsoids = 0; - avec_ellipsoid = (AtomVecEllipsoid *) atom->style_match("ellipsoid"); + avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); nlines = 0; - avec_line = (AtomVecLine *) atom->style_match("line"); + avec_line = dynamic_cast( atom->style_match("line")); ntris = 0; - avec_tri = (AtomVecTri *) atom->style_match("tri"); + avec_tri = dynamic_cast( atom->style_match("tri")); nbodies = 0; avec_body = (AtomVecBody *) atom->style_match("body"); } @@ -744,9 +744,9 @@ void ReadData::command(int narg, char **arg) break; } if (i == nfix) - error->all(FLERR,"Unknown identifier in data file: {}",keyword); + error->all(FLERR,"Unknown identifier in data file: {}{}", keyword, utils::errorurl(1)); - } else error->all(FLERR,"Unknown identifier in data file: {}",keyword); + } else error->all(FLERR,"Unknown identifier in data file: {}{}", keyword, utils::errorurl(1)); parse_keyword(0); } @@ -871,7 +871,7 @@ void ReadData::command(int narg, char **arg) if (addflag != NONE) { if (domain->triclinic) domain->x2lamda(atom->nlocal); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -887,7 +887,7 @@ void ReadData::command(int narg, char **arg) if (domain->nonperiodic == 2) { if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -1738,7 +1738,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) void ReadData::mass() { char *next; - char *buf = new char[ntypes*MAXLINE]; + auto buf = new char[ntypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,ntypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1758,7 +1758,7 @@ void ReadData::mass() void ReadData::paircoeffs() { char *next; - char *buf = new char[ntypes*MAXLINE]; + auto buf = new char[ntypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,ntypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1784,7 +1784,7 @@ void ReadData::pairIJcoeffs() char *next; int nsq = ntypes * (ntypes+1) / 2; - char *buf = new char[nsq * MAXLINE]; + auto buf = new char[nsq * MAXLINE]; int eof = utils::read_lines_from_file(fp,nsq,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1810,7 +1810,7 @@ void ReadData::bondcoeffs() if (!nbondtypes) return; char *next; - char *buf = new char[nbondtypes*MAXLINE]; + auto buf = new char[nbondtypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,nbondtypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1835,7 +1835,7 @@ void ReadData::anglecoeffs(int which) if (!nangletypes) return; char *next; - char *buf = new char[nangletypes*MAXLINE]; + auto buf = new char[nangletypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,nangletypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1861,7 +1861,7 @@ void ReadData::dihedralcoeffs(int which) if (!ndihedraltypes) return; char *next; - char *buf = new char[ndihedraltypes*MAXLINE]; + auto buf = new char[ndihedraltypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,ndihedraltypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); @@ -1891,7 +1891,7 @@ void ReadData::impropercoeffs(int which) if (!nimpropertypes) return; char *next; - char *buf = new char[nimpropertypes*MAXLINE]; + auto buf = new char[nimpropertypes*MAXLINE]; int eof = utils::read_lines_from_file(fp,nimpropertypes,MAXLINE,buf,me,world); if (eof) error->all(FLERR,"Unexpected end of data file"); diff --git a/src/read_data.h b/src/read_data.h index 2466f2df19..250cdf3178 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -115,458 +115,3 @@ class ReadData : public Command { #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: Read data add atomID offset is too big - -UNDOCUMENTED - -E: Read data add molID offset is too big - -UNDOCUMENTED - -E: Non-zero read_data shift z value for 2d simulation - -Self-explanatory. - -E: No bonds allowed with this atom style - -Self-explanatory. - -E: No angles allowed with this atom style - -Self-explanatory. - -E: No dihedrals allowed with this atom style - -Self-explanatory. - -E: No impropers allowed with this atom style - -Self-explanatory. - -E: No bonded interactions allowed with this atom style - -UNDOCUMENTED - -E: Fix ID for read_data does not exist - -Self-explanatory. - -E: Cannot run 2d simulation with non-periodic Z dimension - -Use the boundary command to make the z dimension periodic in order to -run a 2d simulation. - -E: Cannot read_data without add keyword after simulation box is defined - -Self-explanatory. - -E: Cannot use read_data add before simulation box is defined - -Self-explanatory. - -E: Cannot use read_data offset without add flag - -Self-explanatory. - -E: Cannot use read_data shift without add flag - -Self-explanatory. - -E: Cannot use read_data extra with add flag - -Self-explanatory. - -W: Atom style in data file differs from currently defined atom style - -Self-explanatory. - -E: Must read Atoms before Velocities - -The Atoms section of a data file must come before a Velocities -section. - -E: Invalid data file section: Bonds - -Atom style does not allow bonds. - -E: Must read Atoms before Bonds - -The Atoms section of a data file must come before a Bonds section. - -E: Invalid data file section: Angles - -Atom style does not allow angles. - -E: Must read Atoms before Angles - -The Atoms section of a data file must come before an Angles section. - -E: Invalid data file section: Dihedrals - -Atom style does not allow dihedrals. - -E: Must read Atoms before Dihedrals - -The Atoms section of a data file must come before a Dihedrals section. - -E: Invalid data file section: Impropers - -Atom style does not allow impropers. - -E: Must read Atoms before Impropers - -The Atoms section of a data file must come before an Impropers -section. - -E: Invalid data file section: Ellipsoids - -Atom style does not allow ellipsoids. - -E: Must read Atoms before Ellipsoids - -The Atoms section of a data file must come before a Ellipsoids -section. - -E: Invalid data file section: Lines - -Atom style does not allow lines. - -E: Must read Atoms before Lines - -The Atoms section of a data file must come before a Lines section. - -E: Invalid data file section: Triangles - -Atom style does not allow triangles. - -E: Must read Atoms before Triangles - -The Atoms section of a data file must come before a Triangles section. - -E: Invalid data file section: Bodies - -Atom style does not allow bodies. - -E: Must read Atoms before Bodies - -The Atoms section of a data file must come before a Bodies section. - -E: Must define pair_style before Pair Coeffs - -Must use a pair_style command before reading a data file that defines -Pair Coeffs. - -W: Pair style in data file differs from currently defined pair style - -Self-explanatory. - -E: Must define pair_style before PairIJ Coeffs - -Must use a pair_style command before reading a data file that defines -PairIJ Coeffs. - -E: Invalid data file section: Bond Coeffs - -Atom style does not allow bonds. - -E: Must define bond_style before Bond Coeffs - -Must use a bond_style command before reading a data file that -defines Bond Coeffs. - -W: Bond style in data file differs from currently defined bond style - -Self-explanatory. - -E: Invalid data file section: Angle Coeffs - -Atom style does not allow angles. - -E: Must define angle_style before Angle Coeffs - -Must use an angle_style command before reading a data file that -defines Angle Coeffs. - -W: Angle style in data file differs from currently defined angle style - -Self-explanatory. - -E: Invalid data file section: Dihedral Coeffs - -Atom style does not allow dihedrals. - -E: Must define dihedral_style before Dihedral Coeffs - -Must use a dihedral_style command before reading a data file that -defines Dihedral Coeffs. - -W: Dihedral style in data file differs from currently defined dihedral style - -Self-explanatory. - -E: Invalid data file section: Improper Coeffs - -Atom style does not allow impropers. - -E: Must define improper_style before Improper Coeffs - -Must use an improper_style command before reading a data file that -defines Improper Coeffs. - -W: Improper style in data file differs from currently defined improper style - -Self-explanatory. - -E: Invalid data file section: BondBond Coeffs - -Atom style does not allow angles. - -E: Must define angle_style before BondBond Coeffs - -Must use an angle_style command before reading a data file that -defines Angle Coeffs. - -E: Invalid data file section: BondAngle Coeffs - -Atom style does not allow angles. - -E: Must define angle_style before BondAngle Coeffs - -Must use an angle_style command before reading a data file that -defines Angle Coeffs. - -E: Invalid data file section: MiddleBondTorsion Coeffs - -Atom style does not allow dihedrals. - -E: Must define dihedral_style before MiddleBondTorsion Coeffs - -Must use a dihedral_style command before reading a data file that -defines MiddleBondTorsion Coeffs. - -E: Invalid data file section: EndBondTorsion Coeffs - -Atom style does not allow dihedrals. - -E: Must define dihedral_style before EndBondTorsion Coeffs - -Must use a dihedral_style command before reading a data file that -defines EndBondTorsion Coeffs. - -E: Invalid data file section: AngleTorsion Coeffs - -Atom style does not allow dihedrals. - -E: Must define dihedral_style before AngleTorsion Coeffs - -Must use a dihedral_style command before reading a data file that -defines AngleTorsion Coeffs. - -E: Invalid data file section: AngleAngleTorsion Coeffs - -Atom style does not allow dihedrals. - -E: Must define dihedral_style before AngleAngleTorsion Coeffs - -Must use a dihedral_style command before reading a data file that -defines AngleAngleTorsion Coeffs. - -E: Invalid data file section: BondBond13 Coeffs - -Atom style does not allow dihedrals. - -E: Must define dihedral_style before BondBond13 Coeffs - -Must use a dihedral_style command before reading a data file that -defines BondBond13 Coeffs. - -E: Invalid data file section: AngleAngle Coeffs - -Atom style does not allow impropers. - -E: Must define improper_style before AngleAngle Coeffs - -Must use an improper_style command before reading a data file that -defines AngleAngle Coeffs. - -E: Unknown identifier in data file: %s - -A section of the data file cannot be read by LAMMPS. - -E: No atoms in data file - -The header of the data file indicated that atoms would be included, -but they are not present. - -E: Needed molecular topology not in data file - -The header of the data file indicated bonds, angles, etc would be -included, but they are not present. - -E: Needed bonus data not in data file - -Some atom styles require bonus data. See the read_data doc page for -details. - -E: Read_data shrink wrap did not assign all atoms correctly - -This is typically because the box-size specified in the data file is -large compared to the actual extent of atoms in a shrink-wrapped -dimension. When LAMMPS shrink-wraps the box atoms will be lost if the -processor they are re-assigned to is too far away. Choose a box -size closer to the actual extent of the atoms. - -E: Unexpected end of data file - -LAMMPS hit the end of the data file while attempting to read a -section. Something is wrong with the format of the data file. - -E: No ellipsoids allowed with this atom style - -Self-explanatory. Check data file. - -E: No lines allowed with this atom style - -Self-explanatory. Check data file. - -E: No triangles allowed with this atom style - -Self-explanatory. Check data file. - -E: No bodies allowed with this atom style - -Self-explanatory. Check data file. - -E: System in data file is too big - -See the setting for bigint in the src/lmptype.h file. - -E: Bonds defined but no bond types - -The data file header lists bonds but no bond types. - -E: Angles defined but no angle types - -The data file header lists angles but no angle types. - -E: Dihedrals defined but no dihedral types - -The data file header lists dihedrals but no dihedral types. - -E: Impropers defined but no improper types - -The data file header lists improper but no improper types. - -E: No molecule topology allowed with atom style template - -The data file cannot specify the number of bonds, angles, etc, -because this info if inferred from the molecule templates. - -E: Did not assign all atoms correctly - -Atoms read in from a data file were not assigned correctly to -processors. This is likely due to some atom coordinates being -outside a non-periodic simulation box. - -E: Subsequent read data induced too many bonds per atom - -See the extra/bond/per/atom keyword for the create_box -or the read_data command to set this limit larger. - -E: Bonds assigned incorrectly - -Bonds read in from the data file were not assigned correctly to atoms. -This means there is something invalid about the topology definitions. - -E: Subsequent read data induced too many angles per atom - -See the extra/angle/per/atom keyword for the create_box -or the read_data command to set this limit larger. - -E: Angles assigned incorrectly - -Angles read in from the data file were not assigned correctly to -atoms. This means there is something invalid about the topology -definitions. - -E: Subsequent read data induced too many dihedrals per atom - -See the extra/dihedral/per/atom keyword for the create_box -or the read_data command to set this limit larger. - -E: Dihedrals assigned incorrectly - -Dihedrals read in from the data file were not assigned correctly to -atoms. This means there is something invalid about the topology -definitions. - -E: Subsequent read data induced too many impropers per atom - -See the extra/improper/per/atom keyword for the create_box -or the read_data command to set this limit larger. - -E: Impropers assigned incorrectly - -Impropers read in from the data file were not assigned correctly to -atoms. This means there is something invalid about the topology -definitions. - -E: Too few values in body lines in data file - -Self-explanatory. - -E: Too many values in body lines in data file - -Self-explanatory. - -E: Too many lines in one body in data file - boost MAXBODY - -MAXBODY is a setting at the top of the src/read_data.cpp file. -Set it larger and re-compile the code. - -E: Unexpected empty line in PairCoeffs section - -Read a blank line where there should be coefficient data. - -E: Unexpected empty line in BondCoeffs section - -Read a blank line where there should be coefficient data. - -E: Unexpected empty line in AngleCoeffs section - -Read a blank line where there should be coefficient data. - -E: Unexpected empty line in DihedralCoeffs section - -Read a blank line where there should be coefficient data. - -E: Unexpected empty line in ImproperCoeffs section - -Read a blank line where there should be coefficient data. - -E: Cannot open gzipped file - -LAMMPS was compiled without support for reading and writing gzipped -files through a pipeline to the gzip program with -DLAMMPS_GZIP. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -U: Read data add offset is too big - -It cannot be larger than the size of atom IDs, e.g. the maximum 32-bit -integer. - -*/ diff --git a/src/read_dump.cpp b/src/read_dump.cpp index f3ca55f94f..f1dc8fc62e 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -233,7 +233,7 @@ void ReadDump::setup_reader(int narg, char **arg) // create Nreader reader classes per reader // match readerstyle to options in style_reader.h - if (false) { + if (false) { // NOLINT return; // dummy line to enable else-if macro expansion #define READER_CLASS @@ -1078,7 +1078,7 @@ void ReadDump::migrate_old_atoms() for (int i = 0; i < nlocal; i++) procassign[i] = tag[i] % nprocs; - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1,1,procassign); delete irregular; @@ -1101,7 +1101,7 @@ void ReadDump::migrate_new_atoms() procassign[i] = mtag % nprocs; } - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); newmaxnew = MAX(newmaxnew,1); // avoid null pointer @@ -1138,7 +1138,7 @@ void ReadDump::migrate_atoms_by_coords() if (triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/read_dump.h b/src/read_dump.h index 21c9f8d862..1a94cd1cd3 100644 --- a/src/read_dump.h +++ b/src/read_dump.h @@ -115,78 +115,3 @@ class ReadDump : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Read_dump command before simulation box is defined - -The read_dump command cannot be used before a read_data, read_restart, -or create_box command. - -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: Dump file does not contain requested snapshot - -Self-explanatory. - -E: Unrecognized dump reader style - -The choice of dump reader style via the format keyword is unknown. - -E: No box information in dump, must use 'box no' - -UNDOCUMENTED - -E: Read_dump triclinic status does not match simulation - -Both the dump snapshot and the current LAMMPS simulation must -be using either an orthogonal or triclinic box. - -E: Read_dump field not found in dump file - -Self-explanatory. - -E: Read_dump xyz fields do not have consistent scaling/wrapping - -Self-explanatory. - -E: All read_dump x,y,z fields must be specified for scaled, triclinic coords - -For triclinic boxes and scaled coordinates you must specify all 3 of -the x,y,z fields, else LAMMPS cannot reconstruct the unscaled -coordinates. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -E: Read dump of atom property that isn't allocated - -Self-explanatory. - -E: Duplicate fields in read_dump command - -Self-explanatory. - -E: If read_dump purges it cannot replace or trim - -These operations are not compatible. See the read_dump doc -page for details. - -E: Read_dump cannot use 'add keep' without atom IDs - -UNDOCUMENTED - -E: Cannot add atoms if dump file does not store atom type - -UNDOCUMENTED - -U: No box information in dump. You have to use 'box no' - -Self-explanatory. - -*/ diff --git a/src/read_restart.cpp b/src/read_restart.cpp index f8ac14534b..645f0c1d6d 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -118,6 +118,10 @@ void ReadRestart::command(int narg, char **arg) format_revision(); check_eof_magic(); + if ((comm->me == 0) && (modify->get_fix_by_style("property/atom").size() > 0)) + error->warning(FLERR, "Fix property/atom command must be specified after read_restart " + "to restore its data."); + // read header info which creates simulation box header(); @@ -434,7 +438,7 @@ void ReadRestart::command(int narg, char **arg) atom->map_set(); } if (domain->triclinic) domain->x2lamda(atom->nlocal); - Irregular *irregular = new Irregular(lmp); + auto irregular = new Irregular(lmp); irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); @@ -445,7 +449,7 @@ void ReadRestart::command(int narg, char **arg) if (nextra) { memory->destroy(atom->extra); memory->create(atom->extra,atom->nmax,nextra,"atom:extra"); - auto fix = (FixReadRestart *) modify->get_fix_by_id("_read_restart"); + auto fix = dynamic_cast( modify->get_fix_by_id("_read_restart")); int *count = fix->count; double **extra = fix->extra; double **atom_extra = atom->extra; @@ -759,7 +763,7 @@ void ReadRestart::header() } else if (flag == ATOM_STYLE) { char *style = read_string(); int nargcopy = read_int(); - char **argcopy = new char*[nargcopy]; + auto argcopy = new char*[nargcopy]; for (int i = 0; i < nargcopy; i++) argcopy[i] = read_string(); atom->create_avec(style,nargcopy,argcopy,1); @@ -879,7 +883,7 @@ void ReadRestart::type_arrays() if (flag == MASS) { read_int(); - double *mass = new double[atom->ntypes+1]; + auto mass = new double[atom->ntypes+1]; read_double_vec(atom->ntypes,&mass[1]); atom->set_mass(mass); delete[] mass; @@ -1100,7 +1104,7 @@ void ReadRestart::file_layout() void ReadRestart::magic_string() { int n = strlen(MAGIC_STRING) + 1; - char *str = new char[n]; + auto str = new char[n]; int count; if (me == 0) count = fread(str,sizeof(char),n,fp); @@ -1142,7 +1146,7 @@ void ReadRestart::check_eof_magic() if (revision < 1) return; int n = strlen(MAGIC_STRING) + 1; - char *str = new char[n]; + auto str = new char[n]; // read magic string at end of file and restore file pointer @@ -1210,7 +1214,7 @@ char *ReadRestart::read_string() { int n = read_int(); if (n < 0) error->all(FLERR,"Illegal size string or corrupt restart"); - char *value = new char[n]; + auto value = new char[n]; if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,nullptr,error); MPI_Bcast(value,n,MPI_CHAR,0,world); return value; diff --git a/src/read_restart.h b/src/read_restart.h index 88b8709744..65459fc0cb 100644 --- a/src/read_restart.h +++ b/src/read_restart.h @@ -69,170 +69,3 @@ class ReadRestart : public Command { #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: Cannot read_restart after simulation box is defined - -The read_restart command cannot be used after a read_data, -read_restart, or create_box command. - -E: Read restart MPI-IO input not allowed with % in filename - -This is because a % signifies one file per processor and MPI-IO -creates one large file for all processors. - -E: Reading from MPI-IO filename when MPIIO package is not installed - -Self-explanatory. - -E: Cannot open restart file %s - -Self-explanatory. - -E: Invalid flag in peratom section of restart file - -The format of this section of the file is not correct. - -E: Did not assign all restart atoms correctly - -Atoms read in from the restart file were not assigned correctly to -processors. This is likely due to some atom coordinates being outside -a non-periodic simulation box. Normally this should not happen. You -may wish to use the "remap" option on the read_restart command to see -if this helps. - -E: Cannot open dir to search for restart file - -Using a "*" in the name of the restart file will open the current -directory to search for matching file names. - -E: Found no restart file matching pattern - -When using a "*" in the restart file name, no matching file was found. - -E: Restart file incompatible with current version - -This is probably because you are trying to read a file created with a -version of LAMMPS that is too old compared to the current version. -Use your older version of LAMMPS and convert the restart file -to a data file. - -E: Smallint setting in lmptype.h is not compatible - -Smallint stored in restart file is not consistent with LAMMPS version -you are running. - -E: Imageint setting in lmptype.h is not compatible - -Format of imageint stored in restart file is not consistent with -LAMMPS version you are running. See the settings in src/lmptype.h - -E: Tagint setting in lmptype.h is not compatible - -Format of tagint stored in restart file is not consistent with LAMMPS -version you are running. See the settings in src/lmptype.h - -E: Bigint setting in lmptype.h is not compatible - -Format of bigint stored in restart file is not consistent with LAMMPS -version you are running. See the settings in src/lmptype.h - -E: Cannot run 2d simulation with non-periodic Z dimension - -Use the boundary command to make the z dimension periodic in order to -run a 2d simulation. - -W: Restart file used different # of processors - -The restart file was written out by a LAMMPS simulation running on a -different number of processors. Due to round-off, the trajectories of -your restarted simulation may diverge a little more quickly than if -you ran on the same # of processors. - -W: Restart file used different 3d processor grid - -The restart file was written out by a LAMMPS simulation running on a -different 3d grid of processors. Due to round-off, the trajectories -of your restarted simulation may diverge a little more quickly than if -you ran on the same # of processors. - -W: Restart file used different newton pair setting, using input script value - -The input script value will override the setting in the restart file. - -W: Restart file used different newton bond setting, using restart file value - -The restart file value will override the setting in the input script. - -W: Restart file used different boundary settings, using restart file values - -Your input script cannot change these restart file settings. - -E: Illegal or unset periodicity in restart - -This error should not normally occur unless the restart file is invalid. - -E: Invalid flag in header section of restart file - -Unrecognized entry in restart file. - -E: Invalid flag in type arrays section of restart file - -Unrecognized entry in restart file. - -E: Invalid flag in force field section of restart file - -Unrecognized entry in restart file. - -E: Restart file is not a multi-proc file - -The file is inconsistent with the filename you specified for it. - -E: Restart file is a multi-proc file - -The file is inconsistent with the filename you specified for it. - -E: Restart file is a MPI-IO file - -The file is inconsistent with the filename you specified for it. - -E: Restart file is not a MPI-IO file - -The file is inconsistent with the filename you specified for it. - -E: Invalid LAMMPS restart file - -The file does not appear to be a LAMMPS restart file since -it doesn't contain the correct magic string at the beginning. - -E: Restart file byte ordering is swapped - -The file was written on a machine with different byte-ordering than -the machine you are reading it on. Convert it to a text data file -instead, on the machine you wrote it on. - -E: Restart file byte ordering is not recognized - -The file does not appear to be a LAMMPS restart file since it doesn't -contain a recognized byte-orderomg flag at the beginning. - -E: Illegal size string or corrupt restart - -This error should not normally occur unless the restart file is invalid. - -E: Illegal size integer vector read requested - -This error should not normally occur unless the restart file is invalid. - -E: Illegal size double vector read requested - -This error should not normally occur unless the restart file is invalid. - -*/ diff --git a/src/reader.h b/src/reader.h index adc93c6d7c..93f9197b7a 100644 --- a/src/reader.h +++ b/src/reader.h @@ -36,26 +36,11 @@ class Reader : protected Pointers { virtual void close_file(); protected: - FILE *fp; // pointer to opened file or pipe - bool compressed; // flag for dump file compression - bool binary; // flag for (native) binary files + FILE *fp; // pointer to opened file or pipe + bool compressed; // flag for dump file compression + bool binary; // flag for (native) binary files }; } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Cannot open gzipped file - -LAMMPS was compiled without support for reading and writing gzipped -files through a pipeline to the gzip program with -DLAMMPS_GZIP. - -E: Cannot open file %s - -The specified file cannot be opened. Check that the path and name are -correct. If the file is a compressed file, also check that the gzip -executable can be found and run. - -*/ diff --git a/src/reader_native.h b/src/reader_native.h index 6566df0680..df8eede311 100644 --- a/src/reader_native.h +++ b/src/reader_native.h @@ -24,8 +24,8 @@ ReaderStyle(native,ReaderNative); #include "reader.h" -#include #include +#include namespace LAMMPS_NS { @@ -73,15 +73,3 @@ class ReaderNative : public Reader { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump file is incorrectly formatted - -Self-explanatory. - -E: Unexpected end of dump file - -A read operation from the file failed. - -*/ diff --git a/src/reader_xyz.h b/src/reader_xyz.h index 9a1478a0c6..5f943413b8 100644 --- a/src/reader_xyz.h +++ b/src/reader_xyz.h @@ -52,15 +52,3 @@ class ReaderXYZ : public Reader { #endif #endif - -/* ERROR/WARNING messages: - -E: Dump file is incorrectly formatted - -Self-explanatory. - -E: Unexpected end of dump file - -A read operation from the file failed. - -*/ diff --git a/src/region.cpp b/src/region.cpp index eba9f48510..b533d45ea7 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -30,9 +29,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : - Pointers(lmp), - id(nullptr), style(nullptr), contact(nullptr), list(nullptr), - xstr(nullptr), ystr(nullptr), zstr(nullptr), tstr(nullptr) + Pointers(lmp), id(nullptr), style(nullptr), reglist(nullptr), contact(nullptr), xstr(nullptr), + ystr(nullptr), zstr(nullptr), tstr(nullptr) { id = utils::strdup(arg[0]); style = utils::strdup(arg[1]); @@ -44,7 +42,6 @@ Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : size_restart = 5; Region::reset_vel(); copymode = 0; - list = nullptr; nregion = 1; } @@ -54,13 +51,13 @@ Region::~Region() { if (copymode) return; - delete [] id; - delete [] style; + delete[] id; + delete[] style; - delete [] xstr; - delete [] ystr; - delete [] zstr; - delete [] tstr; + delete[] xstr; + delete[] ystr; + delete[] zstr; + delete[] tstr; } /* ---------------------------------------------------------------------- */ @@ -69,27 +66,27 @@ void Region::init() { if (xstr) { xvar = input->variable->find(xstr); - if (xvar < 0) error->all(FLERR,"Variable name for region does not exist"); + if (xvar < 0) error->all(FLERR, "Variable name for region does not exist"); if (!input->variable->equalstyle(xvar)) - error->all(FLERR,"Variable for region is invalid style"); + error->all(FLERR, "Variable for region is invalid style"); } if (ystr) { yvar = input->variable->find(ystr); - if (yvar < 0) error->all(FLERR,"Variable name for region does not exist"); + if (yvar < 0) error->all(FLERR, "Variable name for region does not exist"); if (!input->variable->equalstyle(yvar)) - error->all(FLERR,"Variable for region is not equal style"); + error->all(FLERR, "Variable for region is not equal style"); } if (zstr) { zvar = input->variable->find(zstr); - if (zvar < 0) error->all(FLERR,"Variable name for region does not exist"); + if (zvar < 0) error->all(FLERR, "Variable name for region does not exist"); if (!input->variable->equalstyle(zvar)) - error->all(FLERR,"Variable for region is not equal style"); + error->all(FLERR, "Variable for region is not equal style"); } if (tstr) { tvar = input->variable->find(tstr); - if (tvar < 0) error->all(FLERR,"Variable name for region does not exist"); + if (tvar < 0) error->all(FLERR, "Variable name for region does not exist"); if (!input->variable->equalstyle(tvar)) - error->all(FLERR,"Variable for region is not equal style"); + error->all(FLERR, "Variable for region is not equal style"); } vel_timestep = -1; } @@ -133,9 +130,9 @@ void Region::prematch() int Region::match(double x, double y, double z) { - if (dynamic) inverse_transform(x,y,z); + if (dynamic) inverse_transform(x, y, z); if (openflag) return 1; - return !(inside(x,y,z) ^ interior); + return !(inside(x, y, z) ^ interior); } /* ---------------------------------------------------------------------- @@ -153,14 +150,14 @@ int Region::match(double x, double y, double z) int Region::surface(double x, double y, double z, double cutoff) { int ncontact; - double xs,ys,zs; - double xnear[3],xorig[3]; + double xs, ys, zs; + double xnear[3], xorig[3]; if (dynamic) { xorig[0] = x; xorig[1] = y; xorig[2] = z; - inverse_transform(x,y,z); + inverse_transform(x, y, z); } xnear[0] = x; @@ -168,12 +165,14 @@ int Region::surface(double x, double y, double z, double cutoff) xnear[2] = z; if (!openflag) { - if (interior) ncontact = surface_interior(xnear,cutoff); - else ncontact = surface_exterior(xnear,cutoff); + if (interior) + ncontact = surface_interior(xnear, cutoff); + else + ncontact = surface_exterior(xnear, cutoff); } else { // one of surface_int/ext() will return 0 // so no need to worry about offset of contact indices - ncontact = surface_exterior(xnear,cutoff) + surface_interior(xnear,cutoff); + ncontact = surface_exterior(xnear, cutoff) + surface_interior(xnear, cutoff); } if (rotateflag && ncontact) { @@ -181,7 +180,7 @@ int Region::surface(double x, double y, double z, double cutoff) xs = xnear[0] - contact[i].delx; ys = xnear[1] - contact[i].dely; zs = xnear[2] - contact[i].delz; - forward_transform(xs,ys,zs); + forward_transform(xs, ys, zs); contact[i].delx = xorig[0] - xs; contact[i].dely = xorig[1] - ys; contact[i].delz = xorig[2] - zs; @@ -202,7 +201,7 @@ void Region::add_contact(int n, double *x, double xp, double yp, double zp) double delx = x[0] - xp; double dely = x[1] - yp; double delz = x[2] - zp; - contact[n].r = sqrt(delx*delx + dely*dely + delz*delz); + contact[n].r = sqrt(delx * delx + dely * dely + delz * delz); contact[n].radius = 0; contact[n].delx = delx; contact[n].dely = dely; @@ -231,7 +230,7 @@ void Region::pretransform() void Region::forward_transform(double &x, double &y, double &z) { - if (rotateflag) rotate(x,y,z,theta); + if (rotateflag) rotate(x, y, z, theta); if (moveflag) { x += dx; y += dy; @@ -251,7 +250,7 @@ void Region::inverse_transform(double &x, double &y, double &z) y -= dy; z -= dz; } - if (rotateflag) rotate(x,y,z,-theta); + if (rotateflag) rotate(x, y, z, -theta); } /* ---------------------------------------------------------------------- @@ -272,26 +271,26 @@ void Region::inverse_transform(double &x, double &y, double &z) void Region::rotate(double &x, double &y, double &z, double angle) { - double a[3],b[3],c[3],d[3],disp[3]; + double a[3], b[3], c[3], d[3], disp[3]; double sine = sin(angle); double cosine = cos(angle); d[0] = x - point[0]; d[1] = y - point[1]; d[2] = z - point[2]; - double x0dotr = d[0]*runit[0] + d[1]*runit[1] + d[2]*runit[2]; + double x0dotr = d[0] * runit[0] + d[1] * runit[1] + d[2] * runit[2]; c[0] = x0dotr * runit[0]; c[1] = x0dotr * runit[1]; c[2] = x0dotr * runit[2]; a[0] = d[0] - c[0]; a[1] = d[1] - c[1]; a[2] = d[2] - c[2]; - b[0] = runit[1]*a[2] - runit[2]*a[1]; - b[1] = runit[2]*a[0] - runit[0]*a[2]; - b[2] = runit[0]*a[1] - runit[1]*a[0]; - disp[0] = a[0]*cosine + b[0]*sine; - disp[1] = a[1]*cosine + b[1]*sine; - disp[2] = a[2]*cosine + b[2]*sine; + b[0] = runit[1] * a[2] - runit[2] * a[1]; + b[1] = runit[2] * a[0] - runit[0] * a[2]; + b[2] = runit[0] * a[1] - runit[1] * a[0]; + disp[0] = a[0] * cosine + b[0] * sine; + disp[1] = a[1] * cosine + b[1] * sine; + disp[2] = a[2] * cosine + b[2] * sine; x = point[0] + c[0] + disp[0]; y = point[1] + c[1] + disp[1]; z = point[2] + c[2] + disp[2]; @@ -303,7 +302,7 @@ void Region::rotate(double &x, double &y, double &z, double angle) void Region::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR,"Illegal region command"); + if (narg < 0) error->all(FLERR, "Illegal region command"); // option defaults @@ -312,74 +311,78 @@ void Region::options(int narg, char **arg) moveflag = rotateflag = 0; openflag = 0; - for (int i = 0; i < 6; i++) open_faces[i] = 0; + for (int i = 0; i < 6; i++) open_faces[i] = 0; int iarg = 0; while (iarg < narg) { - if (strcmp(arg[iarg],"units") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal region command"); - if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0; - else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1; - else error->all(FLERR,"Illegal region command"); + if (strcmp(arg[iarg], "units") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal region command"); + if (strcmp(arg[iarg + 1], "box") == 0) + scaleflag = 0; + else if (strcmp(arg[iarg + 1], "lattice") == 0) + scaleflag = 1; + else + error->all(FLERR, "Illegal region command"); iarg += 2; - } else if (strcmp(arg[iarg],"side") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal region command"); - if (strcmp(arg[iarg+1],"in") == 0) interior = 1; - else if (strcmp(arg[iarg+1],"out") == 0) interior = 0; - else error->all(FLERR,"Illegal region command"); + } else if (strcmp(arg[iarg], "side") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal region command"); + if (strcmp(arg[iarg + 1], "in") == 0) + interior = 1; + else if (strcmp(arg[iarg + 1], "out") == 0) + interior = 0; + else + error->all(FLERR, "Illegal region command"); iarg += 2; - } else if (strcmp(arg[iarg],"move") == 0) { - if (iarg+4 > narg) error->all(FLERR,"Illegal region command"); - if (strcmp(arg[iarg+1],"NULL") != 0) { - if (strstr(arg[iarg+1],"v_") != arg[iarg+1]) - error->all(FLERR,"Illegal region command"); - xstr = utils::strdup(&arg[iarg+1][2]); + } else if (strcmp(arg[iarg], "move") == 0) { + if (iarg + 4 > narg) error->all(FLERR, "Illegal region command"); + if (strcmp(arg[iarg + 1], "NULL") != 0) { + if (strstr(arg[iarg + 1], "v_") != arg[iarg + 1]) + error->all(FLERR, "Illegal region command"); + xstr = utils::strdup(&arg[iarg + 1][2]); } - if (strcmp(arg[iarg+2],"NULL") != 0) { - if (strstr(arg[iarg+2],"v_") != arg[iarg+2]) - error->all(FLERR,"Illegal region command"); - ystr = utils::strdup(&arg[iarg+2][2]); + if (strcmp(arg[iarg + 2], "NULL") != 0) { + if (strstr(arg[iarg + 2], "v_") != arg[iarg + 2]) + error->all(FLERR, "Illegal region command"); + ystr = utils::strdup(&arg[iarg + 2][2]); } - if (strcmp(arg[iarg+3],"NULL") != 0) { - if (strstr(arg[iarg+3],"v_") != arg[iarg+3]) - error->all(FLERR,"Illegal region command"); - zstr = utils::strdup(&arg[iarg+3][2]); + if (strcmp(arg[iarg + 3], "NULL") != 0) { + if (strstr(arg[iarg + 3], "v_") != arg[iarg + 3]) + error->all(FLERR, "Illegal region command"); + zstr = utils::strdup(&arg[iarg + 3][2]); } moveflag = 1; iarg += 4; - } else if (strcmp(arg[iarg],"rotate") == 0) { - if (iarg+8 > narg) error->all(FLERR,"Illegal region command"); - if (strstr(arg[iarg+1],"v_") != arg[iarg+1]) - error->all(FLERR,"Illegal region command"); - tstr = utils::strdup(&arg[iarg+1][2]); - 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); + } else if (strcmp(arg[iarg], "rotate") == 0) { + if (iarg + 8 > narg) error->all(FLERR, "Illegal region command"); + if (strstr(arg[iarg + 1], "v_") != arg[iarg + 1]) error->all(FLERR, "Illegal region command"); + tstr = utils::strdup(&arg[iarg + 1][2]); + 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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (iface < 1 || iface > 6) error->all(FLERR,"Illegal region command"); + } else if (strcmp(arg[iarg], "open") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal region command"); + 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; + open_faces[iface - 1] = 1; openflag = 1; iarg += 2; - } - else error->all(FLERR,"Illegal region command"); + } else + error->all(FLERR, "Illegal region command"); } // error check - if ((moveflag || rotateflag) && - (strcmp(style,"union") == 0 || strcmp(style,"intersect") == 0)) - error->all(FLERR,"Region union or intersect cannot be dynamic"); + if ((moveflag || rotateflag) && (strcmp(style, "union") == 0 || strcmp(style, "intersect") == 0)) + error->all(FLERR, "Region union or intersect cannot be dynamic"); // setup scaling @@ -387,8 +390,8 @@ void Region::options(int narg, char **arg) xscale = domain->lattice->xlattice; yscale = domain->lattice->ylattice; zscale = domain->lattice->zlattice; - } - else xscale = yscale = zscale = 1.0; + } else + xscale = yscale = zscale = 1.0; if (rotateflag) { point[0] *= xscale; @@ -399,16 +402,17 @@ void Region::options(int narg, char **arg) // runit = unit vector along rotation axis if (rotateflag) { - double len = sqrt(axis[0]*axis[0] + axis[1]*axis[1] + axis[2]*axis[2]); - if (len == 0.0) - error->all(FLERR,"Region cannot have 0 length rotation vector"); - runit[0] = axis[0]/len; - runit[1] = axis[1]/len; - runit[2] = axis[2]/len; + double len = sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + if (len == 0.0) error->all(FLERR, "Region cannot have 0 length rotation vector"); + runit[0] = axis[0] / len; + runit[1] = axis[1] / len; + runit[2] = axis[2] / len; } - if (moveflag || rotateflag) dynamic = 1; - else dynamic = 0; + if (moveflag || rotateflag) + dynamic = 1; + else + dynamic = 0; } /* ---------------------------------------------------------------------- @@ -420,14 +424,13 @@ void Region::options(int narg, char **arg) else closest point is between A and B ------------------------------------------------------------------------- */ -void Region::point_on_line_segment(double *a, double *b, - double *c, double *d) +void Region::point_on_line_segment(double *a, double *b, double *c, double *d) { - double ba[3],ca[3]; + double ba[3], ca[3]; - MathExtra::sub3(b,a,ba); - MathExtra::sub3(c,a,ca); - double t = MathExtra::dot3(ca,ba) / MathExtra::dot3(ba,ba); + MathExtra::sub3(b, a, ba); + MathExtra::sub3(c, a, ca); + double t = MathExtra::dot3(ca, ba) / MathExtra::dot3(ba, ba); if (t <= 0.0) { d[0] = a[0]; d[1] = a[1]; @@ -437,9 +440,9 @@ void Region::point_on_line_segment(double *a, double *b, d[1] = b[1]; d[2] = b[2]; } else { - d[0] = a[0] + t*ba[0]; - d[1] = a[1] + t*ba[1]; - d[2] = a[2] + t*ba[2]; + d[0] = a[0] + t * ba[0]; + d[1] = a[1] + t * ba[1]; + d[2] = a[2] + t * ba[2]; } } @@ -460,11 +463,11 @@ void Region::set_velocity() vel_timestep = update->ntimestep; if (moveflag) { if (update->ntimestep > 0) { - v[0] = (dx - prev[0])/update->dt; - v[1] = (dy - prev[1])/update->dt; - v[2] = (dz - prev[2])/update->dt; - } - else v[0] = v[1] = v[2] = 0.0; + v[0] = (dx - prev[0]) / update->dt; + v[1] = (dy - prev[1]) / update->dt; + v[2] = (dz - prev[2]) / update->dt; + } else + v[0] = v[1] = v[2] = 0.0; prev[0] = dx; prev[1] = dy; prev[2] = dz; @@ -475,18 +478,16 @@ void Region::set_velocity() rpoint[1] = point[1] + dy; rpoint[2] = point[2] + dz; if (update->ntimestep > 0) { - double angvel = (theta-prev[3]) / update->dt; - omega[0] = angvel*axis[0]; - omega[1] = angvel*axis[1]; - omega[2] = angvel*axis[2]; - } - else omega[0] = omega[1] = omega[2] = 0.0; + double angvel = (theta - prev[3]) / update->dt; + omega[0] = angvel * axis[0]; + omega[1] = angvel * axis[1]; + omega[2] = angvel * axis[2]; + } else + omega[0] = omega[1] = omega[2] = 0.0; prev[3] = theta; } - if (varshape) { - set_velocity_shape(); - } + if (varshape) { set_velocity_shape(); } } /* ---------------------------------------------------------------------- @@ -511,15 +512,14 @@ void Region::velocity_contact(double *vwall, double *x, int ic) xc[0] = x[0] - contact[ic].delx; xc[1] = x[1] - contact[ic].dely; xc[2] = x[2] - contact[ic].delz; - vwall[0] += omega[1]*(xc[2] - rpoint[2]) - omega[2]*(xc[1] - rpoint[1]); - vwall[1] += omega[2]*(xc[0] - rpoint[0]) - omega[0]*(xc[2] - rpoint[2]); - vwall[2] += omega[0]*(xc[1] - rpoint[1]) - omega[1]*(xc[0] - rpoint[0]); + vwall[0] += omega[1] * (xc[2] - rpoint[2]) - omega[2] * (xc[1] - rpoint[1]); + vwall[1] += omega[2] * (xc[0] - rpoint[0]) - omega[0] * (xc[2] - rpoint[2]); + vwall[2] += omega[0] * (xc[1] - rpoint[1]) - omega[1] * (xc[0] - rpoint[0]); } if (varshape && contact[ic].varflag) velocity_contact_shape(vwall, xc); } - /* ---------------------------------------------------------------------- increment length of restart buffer based on region info used by restart of fix/wall/gran/region @@ -527,9 +527,8 @@ void Region::velocity_contact(double *vwall, double *x, int ic) void Region::length_restart_string(int &n) { - n += sizeof(int) + strlen(id)+1 + - sizeof(int) + strlen(style)+1 + sizeof(int) + - size_restart*sizeof(double); + n += sizeof(int) + strlen(id) + 1 + sizeof(int) + strlen(style) + 1 + sizeof(int) + + size_restart * sizeof(double); } /* ---------------------------------------------------------------------- @@ -539,14 +538,14 @@ void Region::length_restart_string(int &n) void Region::write_restart(FILE *fp) { - int sizeid = (strlen(id)+1); - int sizestyle = (strlen(style)+1); + int sizeid = (strlen(id) + 1); + int sizestyle = (strlen(style) + 1); fwrite(&sizeid, sizeof(int), 1, fp); - fwrite(id,1,sizeid,fp); - fwrite(&sizestyle,sizeof(int),1,fp); - fwrite(style,1,sizestyle,fp); - fwrite(&nregion,sizeof(int),1,fp); - fwrite(prev,sizeof(double),size_restart,fp); + fwrite(id, 1, sizeid, fp); + fwrite(&sizestyle, sizeof(int), 1, fp); + fwrite(style, 1, sizestyle, fp); + fwrite(&nregion, sizeof(int), 1, fp); + fwrite(prev, sizeof(double), size_restart, fp); } /* ---------------------------------------------------------------------- @@ -559,19 +558,19 @@ int Region::restart(char *buf, int &n) { int size = *((int *) (&buf[n])); n += sizeof(int); - if ((size <= 0) || (strcmp(&buf[n],id) != 0)) return 0; + if ((size <= 0) || (strcmp(&buf[n], id) != 0)) return 0; n += size; size = *((int *) (&buf[n])); n += sizeof(int); - if ((size <= 0) || (strcmp(&buf[n],style) != 0)) return 0; + if ((size <= 0) || (strcmp(&buf[n], style) != 0)) return 0; n += size; int restart_nreg = *((int *) (&buf[n])); n += sizeof(int); if (restart_nreg != nregion) return 0; - memcpy(prev,&buf[n],size_restart*sizeof(double)); + memcpy(prev, &buf[n], size_restart * sizeof(double)); return 1; } diff --git a/src/region.h b/src/region.h index 83810f5be3..b74d839049 100644 --- a/src/region.h +++ b/src/region.h @@ -21,6 +21,7 @@ namespace LAMMPS_NS { class Region : protected Pointers { public: char *id, *style; + Region **reglist; int interior; // 1 for interior, 0 for exterior int scaleflag; // 1 for lattice, 0 for box double xscale, yscale, zscale; // scale factors for box/lattice units @@ -66,7 +67,6 @@ class Region : protected Pointers { // prevents multiple fix/wall/gran/region calls int nregion; // For union and intersect int size_restart; - int *list; Region(class LAMMPS *, int, char **); ~Region() override; @@ -115,33 +115,3 @@ class Region : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Variable name for region does not exist - -Self-explanatory. - -E: Variable for region is invalid style - -Only equal-style variables can be used. - -E: Variable for region is not equal style - -Self-explanatory. - -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: Region union or intersect cannot be dynamic - -The sub-regions can be dynamic, but not the combined region. - -E: Region cannot have 0 length rotation vector - -Self-explanatory. - -*/ diff --git a/src/region_block.h b/src/region_block.h index bcd54b5849..c342bebc3d 100644 --- a/src/region_block.h +++ b/src/region_block.h @@ -47,18 +47,3 @@ class RegBlock : public Region { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot use region INF or EDGE when box does not exist - -Regions that extend to the box boundaries can only be used after the -create_box command has been used. - -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. - -*/ diff --git a/src/region_cone.h b/src/region_cone.h index ff03568ea9..7b1a1f7078 100644 --- a/src/region_cone.h +++ b/src/region_cone.h @@ -46,22 +46,3 @@ class RegCone : public Region { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid region cone open setting - -UNDOCUMENTED - -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: Cannot use region INF or EDGE when box does not exist - -Regions that extend to the box boundaries can only be used after the -create_box command has been used. - -*/ diff --git a/src/region_cylinder.h b/src/region_cylinder.h index e293a4f1cc..f9f1e3d4a5 100644 --- a/src/region_cylinder.h +++ b/src/region_cylinder.h @@ -55,34 +55,3 @@ class RegCylinder : public Region { #endif #endif - -/* ERROR/WARNING messages: - -E: Invalid region cylinder open setting - -UNDOCUMENTED - -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: Cannot use region INF or EDGE when box does not exist - -Regions that extend to the box boundaries can only be used after the -create_box command has been used. - -E: Variable evaluation in region gave bad value - -Variable returned a radius < 0.0. - -E: Variable name for region cylinder does not exist - -Self-explanatory. - -E: Variable for region cylinder is invalid style - -Only equal-style variables are allowed. - -*/ diff --git a/src/region_deprecated.h b/src/region_deprecated.h index 6092328ad7..d2ef9cd1b7 100644 --- a/src/region_deprecated.h +++ b/src/region_deprecated.h @@ -39,11 +39,3 @@ class RegionDeprecated : public Region { #endif #endif - -/* ERROR/WARNING messages: - -E: This region command has been removed from LAMMPS - -UNDOCUMENTED - -*/ diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index 24b2da5a16..7e6c79b62e 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -24,36 +23,35 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), idsub(nullptr) + Region(lmp, narg, arg), idsub(nullptr) { nregion = 0; - if (narg < 5) error->all(FLERR,"Illegal region command"); - 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]); + if (narg < 5) error->all(FLERR, "Illegal region command"); + 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]); // build list of regions to intersect // store sub-region IDs in idsub - idsub = new char*[n]; - list = new int[n]; + idsub = new char *[n]; + reglist = new Region *[n]; nregion = 0; for (int iarg = 0; iarg < n; iarg++) { - idsub[nregion] = utils::strdup(arg[iarg+3]); - int iregion = domain->find_region(idsub[nregion]); - if (iregion == -1) - error->all(FLERR,"Region intersect region ID does not exist"); - list[nregion++] = iregion; + idsub[nregion] = utils::strdup(arg[iarg + 3]); + reglist[nregion] = domain->get_region_by_id(idsub[nregion]); + if (!reglist[nregion]) + error->all(FLERR, "Region intersect region {} does not exist", idsub[nregion]); + nregion++; } // this region is variable shape or dynamic if any of sub-regions are - Region **regions = domain->regions; for (int ilist = 0; ilist < nregion; ilist++) { - if (regions[list[ilist]]->varshape) varshape = 1; - if (regions[list[ilist]]->dynamic) dynamic = 1; + if (reglist[ilist]->varshape) varshape = 1; + if (reglist[ilist]->dynamic) dynamic = 1; } // extent of intersection of regions @@ -61,29 +59,29 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : bboxflag = 0; for (int ilist = 0; ilist < nregion; ilist++) - if (regions[list[ilist]]->bboxflag == 1) bboxflag = 1; + if (reglist[ilist]->bboxflag == 1) bboxflag = 1; if (!interior) bboxflag = 0; if (bboxflag) { int first = 1; for (int ilist = 0; ilist < nregion; ilist++) { - if (regions[list[ilist]]->bboxflag == 0) continue; + if (reglist[ilist]->bboxflag == 0) continue; if (first) { - extent_xlo = regions[list[ilist]]->extent_xlo; - extent_ylo = regions[list[ilist]]->extent_ylo; - extent_zlo = regions[list[ilist]]->extent_zlo; - extent_xhi = regions[list[ilist]]->extent_xhi; - extent_yhi = regions[list[ilist]]->extent_yhi; - extent_zhi = regions[list[ilist]]->extent_zhi; + extent_xlo = reglist[ilist]->extent_xlo; + extent_ylo = reglist[ilist]->extent_ylo; + extent_zlo = reglist[ilist]->extent_zlo; + extent_xhi = reglist[ilist]->extent_xhi; + extent_yhi = reglist[ilist]->extent_yhi; + extent_zhi = reglist[ilist]->extent_zhi; first = 0; } - extent_xlo = MAX(extent_xlo,regions[list[ilist]]->extent_xlo); - extent_ylo = MAX(extent_ylo,regions[list[ilist]]->extent_ylo); - extent_zlo = MAX(extent_zlo,regions[list[ilist]]->extent_zlo); - extent_xhi = MIN(extent_xhi,regions[list[ilist]]->extent_xhi); - extent_yhi = MIN(extent_yhi,regions[list[ilist]]->extent_yhi); - extent_zhi = MIN(extent_zhi,regions[list[ilist]]->extent_zhi); + extent_xlo = MAX(extent_xlo, reglist[ilist]->extent_xlo); + extent_ylo = MAX(extent_ylo, reglist[ilist]->extent_ylo); + extent_zlo = MAX(extent_zlo, reglist[ilist]->extent_zlo); + extent_xhi = MIN(extent_xhi, reglist[ilist]->extent_xhi); + extent_yhi = MIN(extent_yhi, reglist[ilist]->extent_yhi); + extent_zhi = MIN(extent_zhi, reglist[ilist]->extent_zhi); } } @@ -91,14 +89,15 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : // for near contacts and touching contacts cmax = 0; - for (int ilist = 0; ilist < nregion; ilist++) - cmax += regions[list[ilist]]->cmax; + for (int ilist = 0; ilist < nregion; ilist++) cmax += reglist[ilist]->cmax; contact = new Contact[cmax]; tmax = 0; for (int ilist = 0; ilist < nregion; ilist++) { - if (interior) tmax += regions[list[ilist]]->tmax; - else tmax++; + if (interior) + tmax += reglist[ilist]->tmax; + else + tmax++; } } @@ -106,10 +105,10 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : RegIntersect::~RegIntersect() { - for (int ilist = 0; ilist < nregion; ilist++) delete [] idsub[ilist]; - delete [] idsub; - delete [] list; - delete [] contact; + for (int ilist = 0; ilist < nregion; ilist++) delete[] idsub[ilist]; + delete[] idsub; + delete[] reglist; + delete[] contact; } /* ---------------------------------------------------------------------- */ @@ -122,17 +121,14 @@ void RegIntersect::init() // error if a sub-region was deleted for (int ilist = 0; ilist < nregion; ilist++) { - int iregion = domain->find_region(idsub[ilist]); - if (iregion == -1) - error->all(FLERR,"Region union region ID does not exist"); - list[ilist] = iregion; + reglist[ilist] = domain->get_region_by_id(idsub[ilist]); + if (!reglist[ilist]) + error->all(FLERR, "Region intersect region {} does not exist", idsub[ilist]); } // init the sub-regions - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->init(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->init(); } /* ---------------------------------------------------------------------- @@ -143,9 +139,8 @@ void RegIntersect::init() int RegIntersect::inside(double x, double y, double z) { int ilist; - Region **regions = domain->regions; for (ilist = 0; ilist < nregion; ilist++) - if (!regions[list[ilist]]->match(x,y,z)) break; + if (!reglist[ilist]->match(x, y, z)) break; if (ilist == nregion) return 1; return 0; @@ -159,39 +154,36 @@ int RegIntersect::inside(double x, double y, double z) int RegIntersect::surface_interior(double *x, double cutoff) { - int m,ilist,jlist,iregion,jregion,ncontacts; - double xs,ys,zs; + int m, ilist, jlist, ncontacts; + double xs, ys, zs; - Region **regions = domain->regions; int n = 0; - int walloffset = 0; for (ilist = 0; ilist < nregion; ilist++) { - iregion = list[ilist]; - ncontacts = regions[iregion]->surface(x[0],x[1],x[2],cutoff); + auto region = reglist[ilist]; + ncontacts = region->surface(x[0], x[1], x[2], cutoff); for (m = 0; m < ncontacts; m++) { - xs = x[0] - regions[iregion]->contact[m].delx; - ys = x[1] - regions[iregion]->contact[m].dely; - zs = x[2] - regions[iregion]->contact[m].delz; + xs = x[0] - region->contact[m].delx; + ys = x[1] - region->contact[m].dely; + zs = x[2] - region->contact[m].delz; for (jlist = 0; jlist < nregion; jlist++) { if (jlist == ilist) continue; - jregion = list[jlist]; - if (!regions[jregion]->match(xs,ys,zs)) break; + if (!reglist[jlist]->match(xs, ys, zs)) break; } if (jlist == nregion) { - contact[n].r = regions[iregion]->contact[m].r; - contact[n].radius = regions[iregion]->contact[m].radius; - contact[n].delx = regions[iregion]->contact[m].delx; - contact[n].dely = regions[iregion]->contact[m].dely; - contact[n].delz = regions[iregion]->contact[m].delz; - contact[n].iwall = regions[iregion]->contact[m].iwall + walloffset; - contact[n].varflag = regions[iregion]->contact[m].varflag; + contact[n].r = region->contact[m].r; + contact[n].radius = region->contact[m].radius; + contact[n].delx = region->contact[m].delx; + contact[n].dely = region->contact[m].dely; + contact[n].delz = region->contact[m].delz; + contact[n].iwall = region->contact[m].iwall + walloffset; + contact[n].varflag = region->contact[m].varflag; n++; } } // increment by cmax instead of tmax to insure // possible wall IDs for sub-regions are non overlapping - walloffset += regions[iregion]->cmax; + walloffset += region->cmax; } return n; @@ -208,42 +200,37 @@ int RegIntersect::surface_interior(double *x, double cutoff) int RegIntersect::surface_exterior(double *x, double cutoff) { - int m,ilist,jlist,iregion,jregion,ncontacts; - double xs,ys,zs; + int m, ilist, jlist, ncontacts; + double xs, ys, zs; - Region **regions = domain->regions; int n = 0; - - for (ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->interior ^= 1; + for (ilist = 0; ilist < nregion; ilist++) reglist[ilist]->interior ^= 1; for (ilist = 0; ilist < nregion; ilist++) { - iregion = list[ilist]; - ncontacts = regions[iregion]->surface(x[0],x[1],x[2],cutoff); + auto region = reglist[ilist]; + ncontacts = region->surface(x[0], x[1], x[2], cutoff); for (m = 0; m < ncontacts; m++) { - xs = x[0] - regions[iregion]->contact[m].delx; - ys = x[1] - regions[iregion]->contact[m].dely; - zs = x[2] - regions[iregion]->contact[m].delz; + xs = x[0] - region->contact[m].delx; + ys = x[1] - region->contact[m].dely; + zs = x[2] - region->contact[m].delz; for (jlist = 0; jlist < nregion; jlist++) { if (jlist == ilist) continue; - jregion = list[jlist]; - if (regions[jregion]->match(xs,ys,zs)) break; + if (reglist[jlist]->match(xs, ys, zs)) break; } if (jlist == nregion) { - contact[n].r = regions[iregion]->contact[m].r; - contact[n].radius = regions[iregion]->contact[m].radius; - contact[n].delx = regions[iregion]->contact[m].delx; - contact[n].dely = regions[iregion]->contact[m].dely; - contact[n].delz = regions[iregion]->contact[m].delz; + contact[n].r = region->contact[m].r; + contact[n].radius = region->contact[m].radius; + contact[n].delx = region->contact[m].delx; + contact[n].dely = region->contact[m].dely; + contact[n].delz = region->contact[m].delz; contact[n].iwall = ilist; - contact[n].varflag = regions[iregion]->contact[m].varflag; + contact[n].varflag = region->contact[m].varflag; n++; } } } - for (ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->interior ^= 1; + for (ilist = 0; ilist < nregion; ilist++) reglist[ilist]->interior ^= 1; return n; } @@ -254,9 +241,7 @@ int RegIntersect::surface_exterior(double *x, double cutoff) void RegIntersect::shape_update() { - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->shape_update(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->shape_update(); } /* ---------------------------------------------------------------------- @@ -265,21 +250,16 @@ void RegIntersect::shape_update() void RegIntersect::pretransform() { - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->pretransform(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->pretransform(); } - /* ---------------------------------------------------------------------- get translational/angular velocities of all subregions ------------------------------------------------------------------------- */ void RegIntersect::set_velocity() { - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->set_velocity(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->set_velocity(); } /* ---------------------------------------------------------------------- @@ -287,13 +267,10 @@ void RegIntersect::set_velocity() used by restart of fix/wall/gran/region ------------------------------------------------------------------------- */ -void RegIntersect::length_restart_string(int& n) +void RegIntersect::length_restart_string(int &n) { - n += sizeof(int) + strlen(id)+1 + - sizeof(int) + strlen(style)+1 + sizeof(int); - for (int ilist = 0; ilist < nregion; ilist++) - domain->regions[list[ilist]]->length_restart_string(n); - + n += sizeof(int) + strlen(id) + 1 + sizeof(int) + strlen(style) + 1 + sizeof(int); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->length_restart_string(n); } /* ---------------------------------------------------------------------- region writes its current position/angle @@ -302,17 +279,15 @@ void RegIntersect::length_restart_string(int& n) void RegIntersect::write_restart(FILE *fp) { - int sizeid = (strlen(id)+1); - int sizestyle = (strlen(style)+1); + int sizeid = (strlen(id) + 1); + int sizestyle = (strlen(style) + 1); fwrite(&sizeid, sizeof(int), 1, fp); fwrite(id, 1, sizeid, fp); fwrite(&sizestyle, sizeof(int), 1, fp); fwrite(style, 1, sizestyle, fp); - fwrite(&nregion,sizeof(int),1,fp); + fwrite(&nregion, sizeof(int), 1, fp); - for (int ilist = 0; ilist < nregion; ilist++) { - domain->regions[list[ilist]]->write_restart(fp); - } + for (int ilist = 0; ilist < nregion; ilist++) { reglist[ilist]->write_restart(fp); } } /* ---------------------------------------------------------------------- @@ -324,12 +299,12 @@ int RegIntersect::restart(char *buf, int &n) { int size = *((int *) (&buf[n])); n += sizeof(int); - if ((size <= 0) || (strcmp(&buf[n],id) != 0)) return 0; + if ((size <= 0) || (strcmp(&buf[n], id) != 0)) return 0; n += size; size = *((int *) (&buf[n])); n += sizeof(int); - if ((size <= 0) || (strcmp(&buf[n],style) != 0)) return 0; + if ((size <= 0) || (strcmp(&buf[n], style) != 0)) return 0; n += size; int restart_nreg = *((int *) (&buf[n])); @@ -337,7 +312,7 @@ int RegIntersect::restart(char *buf, int &n) if (restart_nreg != nregion) return 0; for (int ilist = 0; ilist < nregion; ilist++) - if (!domain->regions[list[ilist]]->restart(buf,n)) return 0; + if (!reglist[ilist]->restart(buf, n)) return 0; return 1; } @@ -348,7 +323,5 @@ int RegIntersect::restart(char *buf, int &n) void RegIntersect::reset_vel() { - for (int ilist = 0; ilist < nregion; ilist++) - domain->regions[list[ilist]]->reset_vel(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->reset_vel(); } - diff --git a/src/region_intersect.h b/src/region_intersect.h index b5eafec861..b4084db633 100644 --- a/src/region_intersect.h +++ b/src/region_intersect.h @@ -48,22 +48,3 @@ class RegIntersect : public Region { #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: Region intersect region ID does not exist - -Self-explanatory. - -E: Region union region ID does not exist - -One or more of the region IDs specified by the region union command -does not exist. - -*/ diff --git a/src/region_plane.h b/src/region_plane.h index a96353ff30..a1f19d151d 100644 --- a/src/region_plane.h +++ b/src/region_plane.h @@ -41,13 +41,3 @@ class RegPlane : public Region { #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. - -*/ diff --git a/src/region_prism.h b/src/region_prism.h index fe021f6dc3..8b92425c86 100644 --- a/src/region_prism.h +++ b/src/region_prism.h @@ -54,18 +54,3 @@ class RegPrism : public Region { #endif #endif - -/* ERROR/WARNING messages: - -E: Cannot use region INF or EDGE when box does not exist - -Regions that extend to the box boundaries can only be used after the -create_box command has been used. - -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. - -*/ diff --git a/src/region_sphere.h b/src/region_sphere.h index 9139a07db7..09f5df386b 100644 --- a/src/region_sphere.h +++ b/src/region_sphere.h @@ -52,25 +52,3 @@ class RegSphere : public Region { #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: Variable evaluation in region gave bad value - -Variable returned a radius < 0.0. - -E: Variable name for region sphere does not exist - -Self-explanatory. - -E: Variable for region sphere is invalid style - -Only equal-style variables are allowed. - -*/ diff --git a/src/region_union.cpp b/src/region_union.cpp index b7e0518d75..f4b26ade4d 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -21,42 +20,41 @@ using namespace LAMMPS_NS; -#define BIG 1.0e20 +static constexpr double BIG = 1.0e20; /* ---------------------------------------------------------------------- */ -RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), - idsub(nullptr) +RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), idsub(nullptr) { nregion = 0; - if (narg < 5) error->all(FLERR,"Illegal region command"); - 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]); + + if (narg < 5) error->all(FLERR, "Illegal region command"); + 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]); // build list of region indices to union // store sub-region IDs in idsub - idsub = new char*[n]; - list = new int[n]; + idsub = new char *[n]; + reglist = new Region *[n]; nregion = 0; for (int iarg = 0; iarg < n; iarg++) { - idsub[nregion] = utils::strdup(arg[iarg+3]); - int iregion = domain->find_region(idsub[nregion]); - if (iregion == -1) - error->all(FLERR,"Region union region ID does not exist"); - list[nregion++] = iregion; + idsub[nregion] = utils::strdup(arg[iarg + 3]); + reglist[nregion] = domain->get_region_by_id(idsub[nregion]); + if (!reglist[nregion]) + error->all(FLERR, "Region union region {} does not exist", idsub[nregion]); + nregion++; } // this region is variable shape or dynamic if any of sub-regions are - Region **regions = domain->regions; for (int ilist = 0; ilist < nregion; ilist++) { - if (regions[list[ilist]]->varshape) varshape = 1; - if (regions[list[ilist]]->dynamic) dynamic = 1; - if (regions[list[ilist]]->moveflag) moveflag = 1; - if (regions[list[ilist]]->rotateflag) rotateflag = 1; + if (reglist[ilist]->varshape) varshape = 1; + if (reglist[ilist]->dynamic) dynamic = 1; + if (reglist[ilist]->moveflag) moveflag = 1; + if (reglist[ilist]->rotateflag) rotateflag = 1; } // extent of union of regions @@ -64,7 +62,7 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), bboxflag = 1; for (int ilist = 0; ilist < nregion; ilist++) - if (regions[list[ilist]]->bboxflag == 0) bboxflag = 0; + if (reglist[ilist]->bboxflag == 0) bboxflag = 0; if (!interior) bboxflag = 0; if (bboxflag) { @@ -72,12 +70,12 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), extent_xhi = extent_yhi = extent_zhi = -BIG; for (int ilist = 0; ilist < nregion; ilist++) { - extent_xlo = MIN(extent_xlo,regions[list[ilist]]->extent_xlo); - extent_ylo = MIN(extent_ylo,regions[list[ilist]]->extent_ylo); - extent_zlo = MIN(extent_zlo,regions[list[ilist]]->extent_zlo); - extent_xhi = MAX(extent_xhi,regions[list[ilist]]->extent_xhi); - extent_yhi = MAX(extent_yhi,regions[list[ilist]]->extent_yhi); - extent_zhi = MAX(extent_zhi,regions[list[ilist]]->extent_zhi); + extent_xlo = MIN(extent_xlo, reglist[ilist]->extent_xlo); + extent_ylo = MIN(extent_ylo, reglist[ilist]->extent_ylo); + extent_zlo = MIN(extent_zlo, reglist[ilist]->extent_zlo); + extent_xhi = MAX(extent_xhi, reglist[ilist]->extent_xhi); + extent_yhi = MAX(extent_yhi, reglist[ilist]->extent_yhi); + extent_zhi = MAX(extent_zhi, reglist[ilist]->extent_zhi); } } @@ -85,14 +83,15 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), // for near contacts and touching contacts cmax = 0; - for (int ilist = 0; ilist < nregion; ilist++) - cmax += regions[list[ilist]]->cmax; + for (int ilist = 0; ilist < nregion; ilist++) cmax += reglist[ilist]->cmax; contact = new Contact[cmax]; tmax = 0; for (int ilist = 0; ilist < nregion; ilist++) { - if (interior) tmax += regions[list[ilist]]->tmax; - else tmax++; + if (interior) + tmax += reglist[ilist]->tmax; + else + tmax++; } } @@ -100,10 +99,10 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), RegUnion::~RegUnion() { - for (int ilist = 0; ilist < nregion; ilist++) delete [] idsub[ilist]; - delete [] idsub; - delete [] list; - delete [] contact; + for (int ilist = 0; ilist < nregion; ilist++) delete[] idsub[ilist]; + delete[] idsub; + delete[] reglist; + delete[] contact; } /* ---------------------------------------------------------------------- */ @@ -116,17 +115,13 @@ void RegUnion::init() // error if a sub-region was deleted for (int ilist = 0; ilist < nregion; ilist++) { - int iregion = domain->find_region(idsub[ilist]); - if (iregion == -1) - error->all(FLERR,"Region union region ID does not exist"); - list[ilist] = iregion; + reglist[ilist] = domain->get_region_by_id(idsub[ilist]); + if (!reglist[ilist]) error->all(FLERR, "Region union region {} does not exist", idsub[ilist]); } // init the sub-regions - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->init(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->init(); } /* ---------------------------------------------------------------------- @@ -137,9 +132,8 @@ void RegUnion::init() int RegUnion::inside(double x, double y, double z) { int ilist; - Region **regions = domain->regions; for (ilist = 0; ilist < nregion; ilist++) - if (regions[list[ilist]]->match(x,y,z)) break; + if (reglist[ilist]->match(x, y, z)) break; if (ilist == nregion) return 0; return 1; @@ -153,40 +147,36 @@ int RegUnion::inside(double x, double y, double z) int RegUnion::surface_interior(double *x, double cutoff) { - int m,ilist,jlist,iregion,jregion,ncontacts; - double xs,ys,zs; + int m, ilist, jlist, ncontacts; + double xs, ys, zs; - Region **regions = domain->regions; int n = 0; - - int walloffset = 0 ; + int walloffset = 0; for (ilist = 0; ilist < nregion; ilist++) { - iregion = list[ilist]; - ncontacts = regions[iregion]->surface(x[0],x[1],x[2],cutoff); + auto region = reglist[ilist]; + ncontacts = region->surface(x[0], x[1], x[2], cutoff); for (m = 0; m < ncontacts; m++) { - xs = x[0] - regions[iregion]->contact[m].delx; - ys = x[1] - regions[iregion]->contact[m].dely; - zs = x[2] - regions[iregion]->contact[m].delz; + xs = x[0] - region->contact[m].delx; + ys = x[1] - region->contact[m].dely; + zs = x[2] - region->contact[m].delz; for (jlist = 0; jlist < nregion; jlist++) { if (jlist == ilist) continue; - jregion = list[jlist]; - if (regions[jregion]->match(xs,ys,zs) && - !regions[jregion]->openflag) break; + if (reglist[jlist]->match(xs, ys, zs) && !reglist[jlist]->openflag) break; } if (jlist == nregion) { - contact[n].r = regions[iregion]->contact[m].r; - contact[n].radius = regions[iregion]->contact[m].radius; - contact[n].delx = regions[iregion]->contact[m].delx; - contact[n].dely = regions[iregion]->contact[m].dely; - contact[n].delz = regions[iregion]->contact[m].delz; - contact[n].iwall = regions[iregion]->contact[m].iwall + walloffset; - contact[n].varflag = regions[iregion]->contact[m].varflag; + contact[n].r = region->contact[m].r; + contact[n].radius = region->contact[m].radius; + contact[n].delx = region->contact[m].delx; + contact[n].dely = region->contact[m].dely; + contact[n].delz = region->contact[m].delz; + contact[n].iwall = region->contact[m].iwall + walloffset; + contact[n].varflag = region->contact[m].varflag; n++; } } // increment by cmax instead of tmax to insure // possible wall IDs for sub-regions are non overlapping - walloffset += regions[iregion]->cmax; + walloffset += region->cmax; } return n; @@ -203,42 +193,37 @@ int RegUnion::surface_interior(double *x, double cutoff) int RegUnion::surface_exterior(double *x, double cutoff) { - int m,ilist,jlist,iregion,jregion,ncontacts; - double xs,ys,zs; + int m, ilist, jlist, ncontacts; + double xs, ys, zs; - Region **regions = domain->regions; int n = 0; - - for (ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->interior ^= 1; + for (ilist = 0; ilist < nregion; ilist++) reglist[ilist]->interior ^= 1; for (ilist = 0; ilist < nregion; ilist++) { - iregion = list[ilist]; - ncontacts = regions[iregion]->surface(x[0],x[1],x[2],cutoff); + auto region = reglist[ilist]; + ncontacts = region->surface(x[0], x[1], x[2], cutoff); for (m = 0; m < ncontacts; m++) { - xs = x[0] - regions[iregion]->contact[m].delx; - ys = x[1] - regions[iregion]->contact[m].dely; - zs = x[2] - regions[iregion]->contact[m].delz; + xs = x[0] - region->contact[m].delx; + ys = x[1] - region->contact[m].dely; + zs = x[2] - region->contact[m].delz; for (jlist = 0; jlist < nregion; jlist++) { if (jlist == ilist) continue; - jregion = list[jlist]; - if (!regions[jregion]->match(xs,ys,zs)) break; + if (reglist[jlist]->match(xs, ys, zs)) break; } if (jlist == nregion) { - contact[n].r = regions[iregion]->contact[m].r; - contact[n].radius = regions[iregion]->contact[m].radius; - contact[n].delx = regions[iregion]->contact[m].delx; - contact[n].dely = regions[iregion]->contact[m].dely; - contact[n].delz = regions[iregion]->contact[m].delz; + contact[n].r = region->contact[m].r; + contact[n].radius = region->contact[m].radius; + contact[n].delx = region->contact[m].delx; + contact[n].dely = region->contact[m].dely; + contact[n].delz = region->contact[m].delz; contact[n].iwall = ilist; - contact[n].r = regions[iregion]->contact[m].varflag; + contact[n].varflag = region->contact[m].varflag; n++; } } } - for (ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->interior ^= 1; + for (ilist = 0; ilist < nregion; ilist++) reglist[ilist]->interior ^= 1; return n; } @@ -249,9 +234,7 @@ int RegUnion::surface_exterior(double *x, double cutoff) void RegUnion::shape_update() { - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->shape_update(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->shape_update(); } /* ---------------------------------------------------------------------- @@ -260,9 +243,7 @@ void RegUnion::shape_update() void RegUnion::pretransform() { - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->pretransform(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->pretransform(); } /* ---------------------------------------------------------------------- @@ -271,9 +252,7 @@ void RegUnion::pretransform() void RegUnion::set_velocity() { - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - regions[list[ilist]]->set_velocity(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->set_velocity(); } /* ---------------------------------------------------------------------- @@ -281,13 +260,10 @@ void RegUnion::set_velocity() used by restart of fix/wall/gran/region ------------------------------------------------------------------------- */ -void RegUnion::length_restart_string(int& n) +void RegUnion::length_restart_string(int &n) { - n += sizeof(int) + strlen(id)+1 + - sizeof(int) + strlen(style)+1 + sizeof(int); - for (int ilist = 0; ilist < nregion; ilist++) - domain->regions[list[ilist]]->length_restart_string(n); - + n += sizeof(int) + strlen(id) + 1 + sizeof(int) + strlen(style) + 1 + sizeof(int); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->length_restart_string(n); } /* ---------------------------------------------------------------------- region writes its current position/angle @@ -296,15 +272,14 @@ void RegUnion::length_restart_string(int& n) void RegUnion::write_restart(FILE *fp) { - int sizeid = (strlen(id)+1); - int sizestyle = (strlen(style)+1); + int sizeid = (strlen(id) + 1); + int sizestyle = (strlen(style) + 1); fwrite(&sizeid, sizeof(int), 1, fp); fwrite(id, 1, sizeid, fp); fwrite(&sizestyle, sizeof(int), 1, fp); fwrite(style, 1, sizestyle, fp); - fwrite(&nregion,sizeof(int),1,fp); - for (int ilist = 0; ilist < nregion; ilist++) - domain->regions[list[ilist]]->write_restart(fp); + fwrite(&nregion, sizeof(int), 1, fp); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->write_restart(fp); } /* ---------------------------------------------------------------------- @@ -316,12 +291,12 @@ int RegUnion::restart(char *buf, int &n) { int size = *((int *) (&buf[n])); n += sizeof(int); - if ((size <= 0) || (strcmp(&buf[n],id) != 0)) return 0; + if ((size <= 0) || (strcmp(&buf[n], id) != 0)) return 0; n += size; size = *((int *) (&buf[n])); n += sizeof(int); - if ((size <= 0) || (strcmp(&buf[n],style) != 0)) return 0; + if ((size <= 0) || (strcmp(&buf[n], style) != 0)) return 0; n += size; int restart_nreg = *((int *) (&buf[n])); @@ -329,7 +304,7 @@ int RegUnion::restart(char *buf, int &n) if (restart_nreg != nregion) return 0; for (int ilist = 0; ilist < nregion; ilist++) - if (!domain->regions[list[ilist]]->restart(buf,n)) return 0; + if (!reglist[ilist]->restart(buf, n)) return 0; return 1; } @@ -340,6 +315,5 @@ int RegUnion::restart(char *buf, int &n) void RegUnion::reset_vel() { - for (int ilist = 0; ilist < nregion; ilist++) - domain->regions[list[ilist]]->reset_vel(); + for (int ilist = 0; ilist < nregion; ilist++) reglist[ilist]->reset_vel(); } diff --git a/src/region_union.h b/src/region_union.h index 32a54b357c..641eac09d4 100644 --- a/src/region_union.h +++ b/src/region_union.h @@ -48,18 +48,3 @@ class RegUnion : public Region { #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: Region union region ID does not exist - -One or more of the region IDs specified by the region union command -does not exist. - -*/ diff --git a/src/replicate.h b/src/replicate.h index 9eaae1d763..d120b18b98 100644 --- a/src/replicate.h +++ b/src/replicate.h @@ -34,50 +34,3 @@ class Replicate : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Replicate command before simulation box is defined - -The replicate command cannot be used before a read_data, read_restart, -or create_box command. - -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: Cannot replicate 2d simulation in z dimension - -The replicate command cannot replicate a 2d simulation in the z -dimension. - -W: Replicating in a non-periodic dimension - -The parameters for a replicate command will cause a non-periodic -dimension to be replicated; this may cause unwanted behavior. - -E: Cannot replicate with fixes that store atom quantities - -Either fixes are defined that create and store atom-based vectors or a -restart file was read which included atom-based vectors for fixes. -The replicate command cannot duplicate that information for new atoms. -You should use the replicate command before fixes are applied to the -system. - -E: Replicated system atom IDs are too big - -See the setting for tagint in the src/lmptype.h file. - -E: Replicated system is too big - -See the setting for bigint in the src/lmptype.h file. - -E: Replicate did not assign all atoms correctly - -Atoms replicated by the replicate command were not assigned correctly -to processors. This is likely due to some atom coordinates being -outside a non-periodic simulation box. - -*/ diff --git a/src/rerun.cpp b/src/rerun.cpp index 83971f6adc..b788cfcaec 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -122,7 +122,7 @@ void Rerun::command(int narg, char **arg) // pass list of filenames to ReadDump // along with post-"dump" args and post-"format" args - ReadDump *rd = new ReadDump(lmp); + auto rd = new ReadDump(lmp); rd->store_files(nfile,arg); if (nremain) diff --git a/src/rerun.h b/src/rerun.h index a3474a1827..d6707078e8 100644 --- a/src/rerun.h +++ b/src/rerun.h @@ -34,26 +34,3 @@ class Rerun : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Rerun command before simulation box is defined - -The rerun command cannot be used before a read_data, read_restart, or -create_box command. - -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: Rerun dump file does not contain requested snapshot - -Self-explanatory. - -E: Read rerun dump file timestep > specified stop - -Self-explanatory. - -*/ diff --git a/src/reset_atom_ids.cpp b/src/reset_atom_ids.cpp index 822490ffc8..5a6e5170bd 100644 --- a/src/reset_atom_ids.cpp +++ b/src/reset_atom_ids.cpp @@ -386,8 +386,7 @@ void ResetIDs::sort() int *proclist; memory->create(proclist,nlocal,"special:proclist"); - AtomRvous *atombuf = (AtomRvous *) - memory->smalloc((bigint) nlocal*sizeof(AtomRvous),"resetIDs:idbuf"); + auto atombuf = (AtomRvous *) memory->smalloc((bigint) nlocal*sizeof(AtomRvous),"resetIDs:idbuf"); int ibinx,ibiny,ibinz,iproc; bigint ibin; @@ -413,10 +412,9 @@ void ResetIDs::sort() // perform rendezvous operation, send atombuf to other procs char *buf; - int nreturn = comm->rendezvous(1,nlocal,(char *) atombuf,sizeof(AtomRvous), - 0,proclist, + int nreturn = comm->rendezvous(1,nlocal,(char *) atombuf,sizeof(AtomRvous),0,proclist, sort_bins,0,buf,sizeof(IDRvous),(void *) this); - IDRvous *outbuf = (IDRvous *) buf; + auto outbuf = (IDRvous *) buf; memory->destroy(proclist); memory->sfree(atombuf); @@ -439,13 +437,11 @@ void ResetIDs::sort() outbuf = list of N IDRvous datums, sent back to sending proc ------------------------------------------------------------------------- */ -int ResetIDs::sort_bins(int n, char *inbuf, - int &flag, int *&proclist, char *&outbuf, - void *ptr) +int ResetIDs::sort_bins(int n, char *inbuf, int &flag, int *&proclist, char *&outbuf, void *ptr) { int i,ibin,index; - ResetIDs *rptr = (ResetIDs *) ptr; + auto rptr = (ResetIDs *) ptr; Memory *memory = rptr->memory; Error *error = rptr->error; MPI_Comm world = rptr->world; @@ -470,7 +466,7 @@ int ResetIDs::sort_bins(int n, char *inbuf, count[ibin] = 0; } - AtomRvous *in = (AtomRvous *) inbuf; + auto in = (AtomRvous *) inbuf; for (i = 0; i < n; i++) { if (in[i].ibin < binlo || in[i].ibin >= binhi) { @@ -530,8 +526,7 @@ int ResetIDs::sort_bins(int n, char *inbuf, int nout = n; memory->create(proclist,nout,"resetIDs:proclist"); - IDRvous *out = (IDRvous *) - memory->smalloc(nout*sizeof(IDRvous),"resetIDs:out"); + auto out = (IDRvous *) memory->smalloc(nout*sizeof(IDRvous),"resetIDs:out"); tagint one = nprev + 1; for (ibin = 0; ibin < nbins; ibin++) { @@ -593,7 +588,7 @@ int compare_coords(const void *iptr, const void *jptr) int compare_coords(const int i, const int j, void *ptr) { - ResetIDs::AtomRvous *rvous = (ResetIDs::AtomRvous *) ptr; + auto rvous = (ResetIDs::AtomRvous *) ptr; double *xi = rvous[i].x; double *xj = rvous[j].x; if (xi[0] < xj[0]) return -1; diff --git a/src/reset_atom_ids.h b/src/reset_atom_ids.h index abb20bae4f..6ba833e7a6 100644 --- a/src/reset_atom_ids.h +++ b/src/reset_atom_ids.h @@ -59,23 +59,3 @@ class ResetIDs : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Reset_ids command before simulation box is defined - -UNDOCUMENTED - -E: Illegal ... command - -UNDOCUMENTED - -E: Cannot use reset_atom_ids unless atoms have IDs - -UNDOCUMENTED - -E: Reset_ids missing %d bond topology atom IDs - use comm_modify cutoff - -UNDOCUMENTED - -*/ diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index a29ea98e18..30a817433e 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -152,13 +152,13 @@ void ResetMolIDs::create_computes(char *fixid, char *groupid) idfrag = fmt::format("{}_reset_mol_ids_FRAGMENT_ATOM",fixid); auto use_single = singleflag ? "yes" : "no"; - cfa = (ComputeFragmentAtom *) - modify->add_compute(fmt::format("{} {} fragment/atom single {}",idfrag,groupid,use_single)); + cfa = dynamic_cast( + modify->add_compute(fmt::format("{} {} fragment/atom single {}",idfrag,groupid,use_single))); idchunk = fmt::format("{}_reset_mol_ids_CHUNK_ATOM",fixid); if (compressflag) - cca = (ComputeChunkAtom *) - modify->add_compute(fmt::format("{} {} chunk/atom molecule compress yes",idchunk,groupid)); + cca = dynamic_cast( + modify->add_compute(fmt::format("{} {} chunk/atom molecule compress yes",idchunk,groupid))); } /* ---------------------------------------------------------------------- @@ -231,7 +231,7 @@ void ResetMolIDs::reset() for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { - tagint newid = static_cast(chunkIDs[i]); + auto newid = static_cast(chunkIDs[i]); if (singleexist) { if (newid == 1) newid = 0; else newid += offset - 1; diff --git a/src/reset_mol_ids.h b/src/reset_mol_ids.h index 787edfc4f6..fb0d507931 100644 --- a/src/reset_mol_ids.h +++ b/src/reset_mol_ids.h @@ -48,27 +48,3 @@ class ResetMolIDs : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Reset_mol_ids command before simulation box is defined - -UNDOCUMENTED - -E: Can only use reset_mol_ids on molecular systems - -UNDOCUMENTED - -E: Illegal ... command - -UNDOCUMENTED - -E: Cannot use reset_mol_ids unless molecules have IDs - -UNDOCUMENTED - -E: Reset_mol_ids missing %d bond topology atom IDs - use comm_modify cutoff - -UNDOCUMENTED - -*/ diff --git a/src/respa.cpp b/src/respa.cpp index 9690105d40..5a715d737f 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -121,7 +121,7 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : // the hybrid keyword requires a hybrid pair style if (!utils::strmatch(force->pair_style, "^hybrid")) error->all(FLERR, "Illegal run_style respa command"); - PairHybrid *hybrid = (PairHybrid *) force->pair; + auto hybrid = dynamic_cast(force->pair); nhybrid_styles = hybrid->nstyles; // each hybrid sub-style needs to be assigned to a respa level if (iarg + nhybrid_styles > narg) error->all(FLERR, "Illegal run_style respa command"); @@ -296,7 +296,7 @@ void Respa::init() std::string cmd = fmt::format("RESPA all RESPA {}", nlevels); if (atom->torque_flag) cmd += " torque"; - fix_respa = (FixRespa *) modify->add_fix(cmd); + fix_respa = dynamic_cast(modify->add_fix(cmd)); // insure respa inner/middle/outer is using Pair class that supports it @@ -372,7 +372,7 @@ void Respa::setup(int flag) mesg += fmt::format(" {}:{}", ilevel + 1, step[ilevel]); mesg += "\n r-RESPA fixes :"; - for (int l = 0; l < modify->n_post_force_respa; ++l) { + for (int l = 0; l < modify->n_post_force_respa_any; ++l) { Fix *f = modify->get_fix_by_index(modify->list_post_force_respa[l]); if (f->respa_level >= 0) mesg += fmt::format(" {}:{}[{}]", MIN(f->respa_level + 1, nlevels), f->style, f->id); @@ -704,7 +704,7 @@ void Respa::recurse(int ilevel) timer->stamp(Timer::COMM); } timer->stamp(); - if (modify->n_post_force_respa) modify->post_force_respa(vflag, ilevel, iloop); + if (modify->n_post_force_respa_any) modify->post_force_respa(vflag, ilevel, iloop); modify->final_integrate_respa(ilevel, iloop); timer->stamp(Timer::MODIFY); } diff --git a/src/respa.h b/src/respa.h index ed3dfa4ba4..5ea2015bc3 100644 --- a/src/respa.h +++ b/src/respa.h @@ -74,68 +74,3 @@ class Respa : public Integrate { #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: Respa levels must be >= 1 - -Self-explanatory. - -E: Cannot set both respa pair and inner/middle/outer - -In the rRESPA integrator, you must compute pairwise potentials either -all together (pair), or in pieces (inner/middle/outer). You can't do -both. - -E: Must set both respa inner and outer - -Cannot use just the inner or outer option with respa without using the -other. - -E: Cannot set respa middle without inner/outer - -In the rRESPA integrator, you must define both a inner and outer -setting in order to use a middle setting. - -E: Cannot set respa hybrid and any of pair/inner/middle/outer - -In the rRESPA integrator, you must compute pairwise potentials either -all together (pair), with different cutoff regions (inner/middle/outer), -or per hybrid sub-style (hybrid). You cannot mix those. - -E: Invalid order of forces within respa levels - -For respa, ordering of force computations within respa levels must -obey certain rules. E.g. bonds cannot be compute less frequently than -angles, pairwise forces cannot be computed less frequently than -kspace, etc. - -W: One or more respa levels compute no forces - -This is computationally inefficient. - -E: Respa inner cutoffs are invalid - -The first cutoff must be <= the second cutoff. - -E: Respa middle cutoffs are invalid - -The first cutoff must be <= the second cutoff. - -W: No fixes defined, atoms won't move - -If you are not using a fix like nve, nvt, npt then atom velocities and -coordinates will not be updated during timestepping. - -E: Pair style does not support rRESPA inner/middle/outer - -You are attempting to use rRESPA options with a pair style that -does not support them. - -*/ diff --git a/src/run.h b/src/run.h index 6b0df49fff..48b99b226f 100644 --- a/src/run.h +++ b/src/run.h @@ -34,47 +34,3 @@ class Run : public Command { #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: Run command before simulation box is defined - -The run command cannot be used before a read_data, read_restart, or -create_box command. - -E: Invalid run command N value - -The number of timesteps must fit in a 32-bit integer. If you want to -run for more steps than this, perform multiple shorter runs. - -E: Invalid run command upto value - -Self-explanatory. - -E: Invalid run command start/stop value - -Self-explanatory. - -E: Run command start value is after start of run - -Self-explanatory. - -E: Run command stop value is before end of run - -Self-explanatory. - -E: Run flag 'pre no' not compatible with r-RESPA - -UNDOCUMENTED - -E: Too many timesteps - -The cumulative timesteps must fit in a 64-bit integer. - -*/ diff --git a/src/set.cpp b/src/set.cpp index d0de0b4e62..2843281d78 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -50,7 +50,7 @@ enum{TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET, THETA,THETA_RANDOM,ANGMOM,OMEGA, DIAMETER,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER, SPH_E,SPH_CV,SPH_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, - SMD_CONTACT_RADIUS,DPDTHETA,IVEC,DVEC,IARRAY,DARRAY}; + SMD_CONTACT_RADIUS,DPDTHETA,EPSILON,IVEC,DVEC,IARRAY,DARRAY}; #define BIG INT_MAX @@ -303,7 +303,7 @@ void Set::command(int narg, char **arg) else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4); else wvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp); - if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag) + if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); set(QUAT); iarg += 5; @@ -311,7 +311,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 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag) + if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag) error->all(FLERR,"Cannot set this attribute for this atom style"); if (ivalue <= 0) error->all(FLERR,"Invalid random number seed in set command"); @@ -568,6 +568,19 @@ void Set::command(int narg, char **arg) set(DPDTHETA); iarg += 2; + } else if (strcmp(arg[iarg],"epsilon") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; + else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); + else { + dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (dvalue < 0.0) error->all(FLERR,"Illegal set command"); + } + if (!atom->dielectric_flag) + error->all(FLERR,"Cannot set epsilon for this atom style"); + set(EPSILON); + iarg += 2; + } else { // set custom per-atom vector or array or error out @@ -700,13 +713,13 @@ void Set::selection(int n) else select[i] = 0; } else if (style == REGION_SELECT) { - int iregion = domain->find_region(id); - if (iregion == -1) error->all(FLERR,"Set region ID does not exist"); - domain->regions[iregion]->prematch(); + auto region = domain->get_region_by_id(id); + if (!region) error->all(FLERR,"Set region {} does not exist", id); + region->prematch(); double **x = atom->x; for (int i = 0; i < n; i++) - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) + if (region->match(x[i][0],x[i][1],x[i][2])) select[i] = 1; else select[i] = 0; } @@ -767,11 +780,10 @@ void Set::set(int keyword) // loop over selected atoms - AtomVecEllipsoid *avec_ellipsoid = - (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); - AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); - AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body"); + auto avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + auto avec_line = dynamic_cast( atom->style_match("line")); + auto avec_tri = dynamic_cast( atom->style_match("tri")); + auto avec_body = dynamic_cast( atom->style_match("body")); int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { @@ -934,31 +946,44 @@ void Set::set(int keyword) sp[i][3] = dvalue; } - // set quaternion orientation of ellipsoid or tri or body particle - // set quaternion orientation of ellipsoid or tri or body particle + // set quaternion orientation of ellipsoid or tri or body particle or sphere/bpm // enforce quat rotation vector in z dir for 2d systems else if (keyword == QUAT) { double *quat = nullptr; + double **quat2 = nullptr; if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) quat = avec_tri->bonus[atom->tri[i]].quat; else if (avec_body && atom->body[i] >= 0) quat = avec_body->bonus[atom->body[i]].quat; + else if (atom->quat_flag) + quat2 = atom->quat; else error->one(FLERR,"Cannot set quaternion for atom that has none"); if (domain->dimension == 2 && (xvalue != 0.0 || yvalue != 0.0)) - error->one(FLERR,"Cannot set quaternion with xy components " - "for 2d system"); + error->one(FLERR,"Cannot set quaternion with xy components for 2d system"); - double theta2 = MY_PI2 * wvalue/180.0; - double sintheta2 = sin(theta2); - quat[0] = cos(theta2); - quat[1] = xvalue * sintheta2; - quat[2] = yvalue * sintheta2; - quat[3] = zvalue * sintheta2; - MathExtra::qnormalize(quat); + const double theta2 = MY_PI2 * wvalue/180.0; + const double sintheta2 = sin(theta2); + double temp[4]; + temp[0] = cos(theta2); + temp[1] = xvalue * sintheta2; + temp[2] = yvalue * sintheta2; + temp[3] = zvalue * sintheta2; + MathExtra::qnormalize(temp); + if (atom->quat_flag) { + quat2[i][0] = temp[0]; + quat2[i][1] = temp[1]; + quat2[i][2] = temp[2]; + quat2[i][3] = temp[3]; + } else { + quat[0] = temp[0]; + quat[1] = temp[1]; + quat[2] = temp[2]; + quat[3] = temp[3]; + } } // set theta of line particle @@ -1000,6 +1025,22 @@ void Set::set(int keyword) (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); } + // set the local dielectric constant + + else if (keyword == EPSILON) { + if (dvalue >= 0.0) { + + // compute the unscaled charge value (i.e. atom->q_unscaled) + // assign the new local dielectric constant + // update both the scaled and unscaled charge values + + double q_unscaled = atom->q[i] * atom->epsilon[i]; + atom->epsilon[i] = dvalue; + atom->q[i] = q_unscaled / dvalue; + atom->q_unscaled[i] = q_unscaled; + } + } + // set value for custom property vector or array else if (keyword == IVEC) { @@ -1055,17 +1096,16 @@ void Set::setrandom(int keyword) { int i; - AtomVecEllipsoid *avec_ellipsoid = - (AtomVecEllipsoid *) atom->style_match("ellipsoid"); - AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line"); - AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri"); - AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body"); + auto avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + auto avec_line = dynamic_cast( atom->style_match("line")); + auto avec_tri = dynamic_cast( atom->style_match("tri")); + auto avec_body = dynamic_cast( atom->style_match("body")); double **x = atom->x; int seed = ivalue; - RanPark *ranpark = new RanPark(lmp,1); - RanMars *ranmars = new RanMars(lmp,seed + comm->me); + auto ranpark = new RanPark(lmp,1); + auto ranmars = new RanMars(lmp,seed + comm->me); // set approx fraction of atom types to newtype @@ -1220,6 +1260,7 @@ void Set::setrandom(int keyword) } else if (keyword == QUAT_RANDOM) { int nlocal = atom->nlocal; double *quat; + double **quat2; if (domain->dimension == 3) { double s,t1,t2,theta1,theta2; @@ -1231,6 +1272,8 @@ void Set::setrandom(int keyword) quat = avec_tri->bonus[atom->tri[i]].quat; else if (avec_body && atom->body[i] >= 0) quat = avec_body->bonus[atom->body[i]].quat; + else if (atom->quat_flag) + quat2 = atom->quat; else error->one(FLERR,"Cannot set quaternion for atom that has none"); @@ -1240,10 +1283,17 @@ void Set::setrandom(int keyword) t2 = sqrt(s); theta1 = 2.0*MY_PI*ranpark->uniform(); theta2 = 2.0*MY_PI*ranpark->uniform(); - quat[0] = cos(theta2)*t2; - quat[1] = sin(theta1)*t1; - quat[2] = cos(theta1)*t1; - quat[3] = sin(theta2)*t2; + if (atom->quat_flag) { + quat2[i][0] = cos(theta2)*t2; + quat2[i][1] = sin(theta1)*t1; + quat2[i][2] = cos(theta1)*t1; + quat2[i][3] = sin(theta2)*t2; + } else { + quat[0] = cos(theta2)*t2; + quat[1] = sin(theta1)*t1; + quat[2] = cos(theta1)*t1; + quat[3] = sin(theta2)*t2; + } count++; } @@ -1255,15 +1305,24 @@ void Set::setrandom(int keyword) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_body && atom->body[i] >= 0) quat = avec_body->bonus[atom->body[i]].quat; + else if (atom->quat_flag) + quat2 = atom->quat; else error->one(FLERR,"Cannot set quaternion for atom that has none"); ranpark->reset(seed,x[i]); theta2 = MY_PI*ranpark->uniform(); - quat[0] = cos(theta2); - quat[1] = 0.0; - quat[2] = 0.0; - quat[3] = sin(theta2); + if (atom->quat_flag) { + quat2[i][0] = cos(theta2); + quat2[i][1] = 0.0; + quat2[i][2] = 0.0; + quat2[i][3] = sin(theta2); + } else { + quat[0] = cos(theta2); + quat[1] = 0.0; + quat[2] = 0.0; + quat[3] = sin(theta2); + } count++; } } diff --git a/src/set.h b/src/set.h index 8831ad131c..fee69a3c86 100644 --- a/src/set.h +++ b/src/set.h @@ -55,184 +55,3 @@ class Set : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Set command before simulation box is defined - -The set command cannot be used before a read_data, read_restart, -or create_box command. - -E: Set command with no atoms existing - -No atoms are yet defined so the set command cannot be used. - -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: Invalid value in set command - -The value specified for the setting is invalid, likely because it is -too small or too large. - -E: Invalid random number seed in set command - -Random number seed must be > 0. - -E: Cannot set this attribute for this atom style - -The attribute being set does not exist for the defined atom style. - -E: Invalid dipole length in set command - -Self-explanatory. - -E: Invalid density in set command - -Density must be > 0.0. - -E: Density/disc option requires 2d simulation - -UNDOCUMENTED - -E: Invalid volume in set command - -Volume must be > 0.0. - -E: Cannot set non-zero image flag for non-periodic dimension - -Self-explanatory. - -E: Cannot set meso/e for this atom style - -Self-explanatory. - -E: Cannot set meso/cv for this atom style - -Self-explanatory. - -E: Cannot set meso/rho for this atom style - -Self-explanatory. - -E: Cannot set edpd/temp for this atom style - -UNDOCUMENTED - -E: Cannot set edpd/cv for this atom style - -UNDOCUMENTED - -E: Cannot set cc for this atom style - -UNDOCUMENTED - -E: Cannot set smd/mass/density for this atom style - -Self-explanatory. - -E: Cannot set smd/contact/radius for this atom style - -Self-explanatory. - -E: Cannot set dpd/theta for this atom style - -Self-explanatory. - -E: Set command integer vector does not exist - -Self-explanatory. - -E: Set command floating point vector does not exist - -Self-explanatory. - -E: Cannot use set atom with no atom IDs defined - -Atom IDs are not defined, so they cannot be used to identify an atom. - -E: Cannot use set mol with no molecule IDs defined - -Self-explanatory. - -E: Could not find set group ID - -Group ID specified in set command does not exist. - -E: Set region ID does not exist - -Region ID specified in set command does not exist. - -W: Changing a property of atoms in rigid bodies that has no effect unless rigid bodies are rebuild - -UNDOCUMENTED - -E: Invalid mass in set command - -Self-explanatory. - -E: Invalid diameter in set command - -Self-explanatory. - -E: Invalid shape in set command - -Self-explanatory. - -E: Invalid length in set command - -Self-explanatory. - -E: Cannot set quaternion for atom that has none - -Self-explanatory. - -E: Cannot set quaternion with xy components for 2d system - -Self-explanatory. - -E: Cannot set theta for atom that is not a line - -Self-explanatory. - -E: Cannot set bond topology types for atom style template - -The bond, angle, etc types cannot be changed for this atom style since -they are static settings in the molecule template files. - -E: Bond atom missing in set command - -The set command cannot find one or more atoms in a particular bond on -a particular processor. The pairwise cutoff is too short or the atoms -are too far apart to make a valid bond. - -E: Angle atom missing in set command - -The set command cannot find one or more atoms in a particular angle on -a particular processor. The pairwise cutoff is too short or the atoms -are too far apart to make a valid angle. - -E: Dihedral atom missing in set command - -The set command cannot find one or more atoms in a particular dihedral -on a particular processor. The pairwise cutoff is too short or the -atoms are too far apart to make a valid dihedral. - -E: Improper atom missing in set command - -The set command cannot find one or more atoms in a particular improper -on a particular processor. The pairwise cutoff is too short or the -atoms are too far apart to make a valid improper. - -E: Variable name for set command does not exist - -Self-explanatory. - -E: Variable for set command is invalid style - -Only atom-style variables can be used. - -*/ diff --git a/src/special.cpp b/src/special.cpp index ceba160be2..4aa80bc443 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -165,8 +165,7 @@ void Special::atom_owners() int *proclist; memory->create(proclist,nlocal,"special:proclist"); - IDRvous *idbuf = (IDRvous *) - memory->smalloc((bigint) nlocal*sizeof(IDRvous),"special:idbuf"); + auto idbuf = (IDRvous *) memory->smalloc((bigint) nlocal*sizeof(IDRvous),"special:idbuf"); // setup input buf for rendezvous comm // one datum for each owned atom: datum = owning proc, atomID @@ -215,8 +214,7 @@ void Special::onetwo_build_newton() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // one datum for each unowned bond partner: bond partner ID, atomID @@ -239,7 +237,7 @@ void Special::onetwo_build_newton() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -341,8 +339,7 @@ void Special::onethree_build() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onetwo partners where either is unknown @@ -371,7 +368,7 @@ void Special::onethree_build() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -444,8 +441,7 @@ void Special::onefour_build() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onethree and onetwo partners where onethree is unknown @@ -473,7 +469,7 @@ void Special::onefour_build() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -688,10 +684,10 @@ void Special::combine() utils::logmesg(lmp,"{:>6} = max # of special neighbors\n",atom->maxspecial); if (lmp->kokkos) { - AtomKokkos* atomKK = (AtomKokkos*) atom; + auto atomKK = dynamic_cast( atom); atomKK->modified(Host,SPECIAL_MASK); atomKK->sync(Device,SPECIAL_MASK); - MemoryKokkos* memoryKK = (MemoryKokkos*) memory; + auto memoryKK = dynamic_cast( memory); memoryKK->grow_kokkos(atomKK->k_special,atom->special, atom->nmax,atom->maxspecial,"atom:special"); atomKK->modified(Device,SPECIAL_MASK); @@ -825,8 +821,7 @@ void Special::angle_trim() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onetwo partners where either is unknown @@ -894,7 +889,7 @@ void Special::angle_trim() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1067,8 +1062,7 @@ void Special::dihedral_trim() int *proclist; memory->create(proclist,nsend,"special:proclist"); - PairRvous *inbuf = (PairRvous *) - memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); + auto inbuf = (PairRvous *) memory->smalloc((bigint) nsend*sizeof(PairRvous),"special:inbuf"); // setup input buf to rendezvous comm // datums = pairs of onefour atom IDs in a dihedral defined for my atoms @@ -1105,7 +1099,7 @@ void Special::dihedral_trim() char *buf; int nreturn = comm->rendezvous(RVOUS,nsend,(char *) inbuf,sizeof(PairRvous), 0,proclist, rendezvous_pairs,0,buf,sizeof(PairRvous), (void *) this); - PairRvous *outbuf = (PairRvous *) buf; + auto outbuf = (PairRvous *) buf; memory->destroy(proclist); memory->sfree(inbuf); @@ -1197,11 +1191,9 @@ void Special::dihedral_trim() no outbuf ------------------------------------------------------------------------- */ -int Special::rendezvous_ids(int n, char *inbuf, - int &flag, int *& /*proclist*/, char *& /*outbuf*/, - void *ptr) +int Special::rendezvous_ids(int n, char *inbuf, int &flag, int *& /*proclist*/, char *& /*outbuf*/, void *ptr) { - Special *sptr = (Special *) ptr; + auto sptr = (Special *) ptr; Memory *memory = sptr->memory; int *procowner; @@ -1210,7 +1202,7 @@ int Special::rendezvous_ids(int n, char *inbuf, memory->create(procowner,n,"special:procowner"); memory->create(atomIDs,n,"special:atomIDs"); - IDRvous *in = (IDRvous *) inbuf; + auto in = (IDRvous *) inbuf; for (int i = 0; i < n; i++) { procowner[i] = in[i].me; @@ -1239,7 +1231,7 @@ int Special::rendezvous_ids(int n, char *inbuf, int Special::rendezvous_pairs(int n, char *inbuf, int &flag, int *&proclist, char *&outbuf, void *ptr) { - Special *sptr = (Special *) ptr; + auto sptr = (Special *) ptr; Atom *atom = sptr->atom; Memory *memory = sptr->memory; @@ -1258,7 +1250,7 @@ int Special::rendezvous_pairs(int n, char *inbuf, int &flag, int *&proclist, // proclist = owner of atomID in caller decomposition - PairRvous *in = (PairRvous *) inbuf; + auto in = (PairRvous *) inbuf; int *procowner = sptr->procowner; memory->create(proclist,n,"special:proclist"); diff --git a/src/special.h b/src/special.h index 58ee0cef3f..d4c8fc587b 100644 --- a/src/special.h +++ b/src/special.h @@ -68,19 +68,3 @@ class Special : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: 1-3 bond count is inconsistent - -An inconsistency was detected when computing the number of 1-3 -neighbors for each atom. This likely means something is wrong with -the bond topologies you have defined. - -E: 1-4 bond count is inconsistent - -An inconsistency was detected when computing the number of 1-4 -neighbors for each atom. This likely means something is wrong with -the bond topologies you have defined. - -*/ diff --git a/src/text_file_reader.h b/src/text_file_reader.h index 017a721e67..e96387d423 100644 --- a/src/text_file_reader.h +++ b/src/text_file_reader.h @@ -18,7 +18,7 @@ #ifndef LMP_TEXT_FILE_READER_H #define LMP_TEXT_FILE_READER_H -#include "tokenizer.h" // IWYU pragma: export +#include "tokenizer.h" // IWYU pragma: export #include diff --git a/src/thermo.cpp b/src/thermo.cpp index a7d76017f8..0a810662ca 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -637,7 +637,7 @@ void Thermo::modify_params(int narg, char **arg) if (iarg + 3 > narg) error->all(FLERR, "Illegal thermo_modify command"); int icol = -1; if (utils::is_integer(arg[iarg + 1])) { - icol = utils::inumeric(FLERR,arg[iarg + 1],false,lmp); + icol = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (icol < 0) icol = nfield_initial + icol + 1; icol--; } else { @@ -647,8 +647,9 @@ void Thermo::modify_params(int narg, char **arg) icol = -1; } } - if ((icol < 0) || (icol >= nfield_initial)) error->all(FLERR, "Illegal thermo_modify command"); - keyword_user[icol] = arg[iarg+2]; + if ((icol < 0) || (icol >= nfield_initial)) + error->all(FLERR, "Illegal thermo_modify command"); + keyword_user[icol] = arg[iarg + 2]; iarg += 3; } } else if (strcmp(arg[iarg], "format") == 0) { @@ -675,7 +676,8 @@ void Thermo::modify_params(int narg, char **arg) found = format_int_user.find('d', found); if (found == std::string::npos) error->all(FLERR, "Thermo_modify int format does not contain a d conversion character"); - format_bigint_user = format_int_user.replace(found, 1, std::string(BIGINT_FORMAT).substr(1)); + format_bigint_user = + format_int_user.replace(found, 1, std::string(BIGINT_FORMAT).substr(1)); } else if (strcmp(arg[iarg + 1], "float") == 0) { format_float_user = arg[iarg + 2]; } else { @@ -691,7 +693,8 @@ void Thermo::modify_params(int narg, char **arg) icol = -1; } } - if (icol < 0 || icol >= nfield_initial + 1) error->all(FLERR, "Illegal thermo_modify command"); + if (icol < 0 || icol >= nfield_initial + 1) + error->all(FLERR, "Illegal thermo_modify command"); format_column_user[icol] = arg[iarg + 2]; } iarg += 3; @@ -746,9 +749,7 @@ void Thermo::allocate() int i = 0; key2col.clear(); - for (auto item : utils::split_words(line)) { - key2col[item] = i++; - } + for (auto item : utils::split_words(line)) { key2col[item] = i++; } } /* ---------------------------------------------------------------------- diff --git a/src/thermo.h b/src/thermo.h index c36eac3d8f..903a103c52 100644 --- a/src/thermo.h +++ b/src/thermo.h @@ -207,207 +207,3 @@ class Thermo : protected Pointers { } // namespace LAMMPS_NS #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: Could not find thermo compute ID - -Compute ID specified in thermo_style command does not exist. - -E: Could not find thermo fix ID - -Fix ID specified in thermo_style command does not exist. - -E: Thermo and fix not computed at compatible times - -Fixes generate values on specific timesteps. The thermo output -does not match these timesteps. - -E: Could not find thermo variable name - -Self-explanatory. - -E: Too many total atoms - -See the setting for bigint in the src/lmptype.h file. - -E: Lost atoms: original %ld current %ld - -Lost atoms are checked for each time thermo output is done. See the -thermo_modify lost command for options. Lost atoms usually indicate -bad dynamics, e.g. atoms have been blown far out of the simulation -box, or moved further than one processor's sub-domain away before -reneighboring. - -W: Lost atoms: original %ld current %ld - -Lost atoms are checked for each time thermo output is done. See the -thermo_modify lost command for options. Lost atoms usually indicate -bad dynamics, e.g. atoms have been blown far out of the simulation -box, or moved further than one processor's sub-domain away before -reneighboring. - -E: Thermo style does not use temp - -Cannot use thermo_modify to set this parameter since the thermo_style -is not computing this quantity. - -E: Could not find thermo_modify temperature ID - -The compute ID needed by thermo style custom to compute temperature does -not exist. - -E: Thermo_modify temperature ID does not compute temperature - -The specified compute ID does not compute temperature. - -W: Temperature for thermo pressure is not for group all - -User-assigned temperature to thermo via the thermo_modify command does -not compute temperature for all atoms. Since thermo computes a global -pressure, the kinetic energy contribution from the temperature is -assumed to also be for all atoms. Thus the pressure printed by thermo -could be inaccurate. - -E: Pressure ID for thermo does not exist - -The compute ID needed to compute pressure for thermodynamics does not -exist. - -E: Thermo style does not use press - -Cannot use thermo_modify to set this parameter since the thermo_style -is not computing this quantity. - -E: Could not find thermo_modify pressure ID - -The compute ID needed by thermo style custom to compute pressure does -not exist. - -E: Thermo_modify pressure ID does not compute pressure - -The specified compute ID does not compute pressure. - -E: Thermo_modify int format does not contain d character - -Self-explanatory. - -E: Could not find thermo custom compute ID - -The compute ID needed by thermo style custom to compute a requested -quantity does not exist. - -E: Thermo compute does not compute scalar - -Self-explanatory. - -E: Thermo compute does not compute vector - -Self-explanatory. - -E: Thermo compute vector is accessed out-of-range - -Self-explanatory. - -E: Thermo compute does not compute array - -Self-explanatory. - -E: Thermo compute array is accessed out-of-range - -Self-explanatory. - -E: Could not find thermo custom fix ID - -The fix ID needed by thermo style custom to compute a requested -quantity does not exist. - -E: Thermo fix does not compute scalar - -Self-explanatory. - -E: Thermo fix does not compute vector - -Self-explanatory. - -E: Thermo fix vector is accessed out-of-range - -Self-explanatory. - -E: Thermo fix does not compute array - -Self-explanatory. - -E: Thermo fix array is accessed out-of-range - -Self-explanatory. - -E: Could not find thermo custom variable name - -Self-explanatory. - -E: Thermo custom variable is not equal-style variable - -Only equal-style variables can be output with thermodynamics, not -atom-style variables. - -E: Thermo custom variable is not vector-style variable - -UNDOCUMENTED - -E: Thermo custom variable cannot have two indices - -UNDOCUMENTED - -E: Unknown keyword in thermo_style custom command - -One or more specified keywords are not recognized. - -E: This variable thermo keyword cannot be used between runs - -Keywords that refer to time (such as cpu, elapsed) do not -make sense in between runs. - -E: Thermo keyword in variable requires thermo to use/init temp - -You are using a thermo keyword in a variable that requires temperature -to be calculated, but your thermo output does not use it. Add it to -your thermo output. - -E: Compute used in variable thermo keyword between runs is not current - -Some thermo keywords rely on a compute to calculate their value(s). -Computes cannot be invoked by a variable in between runs. Thus they -must have been evaluated on the last timestep of the previous run in -order for their value(s) to be accessed. See the doc page for the -variable command for more info. - -E: Thermo keyword in variable requires thermo to use/init press - -You are using a thermo keyword in a variable that requires pressure to -be calculated, but your thermo output does not use it. Add it to your -thermo output. - -E: Thermo keyword in variable requires thermo to use/init pe - -You are using a thermo keyword in a variable that requires -potential energy to be calculated, but your thermo output -does not use it. Add it to your thermo output. - -E: Energy was not tallied on needed timestep - -You are using a thermo keyword that requires potentials to -have tallied energy, but they didn't on this timestep. See the -variable doc page for ideas on how to make this work. - -U: Thermo custom variable cannot be indexed - -Self-explanatory. - -*/ diff --git a/src/timer.h b/src/timer.h index 1cd7b1ce05..a4b48716d5 100644 --- a/src/timer.h +++ b/src/timer.h @@ -126,17 +126,3 @@ class Timer : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -W: Wall time limit reached - -UNDOCUMENTED - -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. - -*/ diff --git a/src/universe.h b/src/universe.h index 3e5710a301..faca04b398 100644 --- a/src/universe.h +++ b/src/universe.h @@ -46,36 +46,3 @@ class Universe : protected Pointers { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -E: Invalid -reorder N value - -Self-explanatory. - -E: Nprocs not a multiple of N for -reorder - -Self-explanatory. - -E: Cannot open -reorder file - -Self-explanatory. - -E: Unexpected end of -reorder file - -Self-explanatory. - -E: Invalid entry in -reorder file - -Self-explanatory. - -E: Invalid command-line argument - -One or more command-line arguments is invalid. Check the syntax of -the command you are using to launch LAMMPS. - -E: Invalid partition string '%s' - -UNDOCUMENTED - -*/ diff --git a/src/update.cpp b/src/update.cpp index 3870f6d38e..297053e39d 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -60,7 +60,6 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) beginstep = endstep = 0; restrict_output = 0; setupflag = 0; - post_integrate = 0; multireplica = 0; eflag_global = vflag_global = -1; diff --git a/src/update.h b/src/update.h index afcafb87cb..8df82eece3 100644 --- a/src/update.h +++ b/src/update.h @@ -35,7 +35,6 @@ class Update : protected Pointers { int max_eval; // max force evaluations for minimizer int restrict_output; // 1 if output should not write dump/restart int setupflag; // set when setup() is computing forces - int post_integrate; // 1 if now at post_integrate() in timestep int multireplica; // 1 if min across replicas, else 0 int dt_default; // 1 if dt is at default value, else 0 @@ -78,32 +77,3 @@ class Update : protected Pointers { } // namespace LAMMPS_NS #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: Illegal integrate style - -Self-explanatory. - -E: Timestep must be >= 0 - -Specified timestep is invalid. - -E: Cannot reset timestep with a time-dependent fix defined - -You cannot reset the timestep when a fix that keeps track of elapsed -time is in place. - -E: Cannot reset timestep with a dynamic region defined - -Dynamic regions (see the region command) have a time dependence. -Thus you cannot change the timestep when one or more of these -are defined. - -*/ diff --git a/src/utils.cpp b/src/utils.cpp index 871baf0645..3bc8c761c6 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -22,8 +22,8 @@ #include "memory.h" #include "modify.h" #include "text_file_reader.h" -#include "update.h" #include "universe.h" +#include "update.h" #include #include @@ -120,6 +120,12 @@ std::string utils::strfind(const std::string &text, const std::string &pattern) return ""; } +void utils::missing_cmd_args(const std::string &file, int line, const std::string &cmd, + Error *error) +{ + if (error) error->all(file, line, "Illegal {} command: missing argument(s)", cmd); +} + /* specialization for the case of just a single string argument */ void utils::logmesg(LAMMPS *lmp, const std::string &mesg) @@ -137,11 +143,16 @@ void utils::fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_ar } } +std::string utils::errorurl(int errorcode) +{ + return fmt::format("\nFor more information see https://docs.lammps.org/err{:04d}", errorcode); +} + void utils::flush_buffers(LAMMPS *lmp) { if (lmp->screen) fflush(lmp->screen); if (lmp->logfile) fflush(lmp->logfile); - if (lmp->universe->uscreen) fflush(lmp->universe->uscreen); + if (lmp->universe->uscreen) fflush(lmp->universe->uscreen); if (lmp->universe->ulogfile) fflush(lmp->universe->ulogfile); } @@ -566,14 +577,14 @@ void utils::bounds(const char *file, int line, const std::string &str, error->all(file, line, fmt::format("Invalid range string: {}", str)); if (nlo < nmin) - error->all(file, line, fmt::format("Numeric index {} is out of bounds " - "({}-{})", nlo, nmin, nmax)); + 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)); + 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)); + error->all(file, line, fmt::format("Numeric index {} is out of bounds ({}-{})", + nlo, nmin, nhi)); } } @@ -744,7 +755,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod char *utils::strdup(const std::string &text) { - char *tmp = new char[text.size() + 1]; + auto tmp = new char[text.size() + 1]; strcpy(tmp, text.c_str()); // NOLINT return tmp; } @@ -805,7 +816,7 @@ std::string utils::star_subst(const std::string &name, bigint step, int pad) auto star = name.find('*'); if (star == std::string::npos) return name; - return fmt::format("{}{:0{}}{}",name.substr(0,star),step,pad,name.substr(star+1)); + return fmt::format("{}{:0{}}{}", name.substr(0, star), step, pad, name.substr(star + 1)); } /* ---------------------------------------------------------------------- @@ -814,7 +825,7 @@ std::string utils::star_subst(const std::string &name, bigint step, int pad) std::string utils::utf8_subst(const std::string &line) { - const unsigned char *const in = (const unsigned char *) line.c_str(); + const auto *const in = (const unsigned char *) line.c_str(); const int len = line.size(); std::string out; diff --git a/src/utils.h b/src/utils.h index 86f31508e7..f7f269a97d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -21,7 +21,7 @@ #include -#include // IWYU pragma: export +#include // IWYU pragma: export namespace LAMMPS_NS { @@ -47,6 +47,18 @@ namespace utils { std::string strfind(const std::string &text, const std::string &pattern); + /*! Print error message about missing arguments for command + * + * This function simplifies the repetitive reporting missing arguments to a command. + * + * \param file name of source file for error message + * \param line line number in source file for error message + * \param cmd name of the failing command + * \param error pointer to Error class instance (for abort) or nullptr */ + + [[noreturn]] void missing_cmd_args(const std::string &file, int line, const std::string &cmd, + Error *error); + /* Internal function handling the argument list for logmesg(). */ void fmtargs_logmesg(LAMMPS *lmp, fmt::string_view format, fmt::format_args args); @@ -74,6 +86,18 @@ namespace utils { void logmesg(LAMMPS *lmp, const std::string &mesg); + /*! Return text redirecting the user to a specific paragraph in the manual + * + * The LAMMPS manual contains detailed detailed explanations for errors and + * warnings where a simple error message may not be sufficient. These can + * be reached through URLs with a numeric code. This function creates the + * corresponding text to be included into the error message that redirects + * the user to that URL. + * + * \param errorcode number pointing to a paragraph in the manual */ + + std::string errorurl(int errorcode); + /*! Flush output buffers * * This function calls fflush() on screen and logfile FILE pointers @@ -647,7 +671,3 @@ namespace utils { } // namespace LAMMPS_NS #endif - -/* ERROR/WARNING messages: - -*/ diff --git a/src/variable.cpp b/src/variable.cpp index dd18854ef5..8455227ad7 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -296,8 +296,8 @@ void Variable::set(int narg, char **arg) int maxcopy = strlen(arg[2]) + 1; int maxwork = maxcopy; - char *scopy = (char *) memory->smalloc(maxcopy,"var:string/copy"); - char *work = (char *) memory->smalloc(maxwork,"var:string/work"); + auto scopy = (char *) memory->smalloc(maxcopy,"var:string/copy"); + auto work = (char *) memory->smalloc(maxwork,"var:string/work"); strcpy(scopy,arg[2]); input->substitute(scopy,work,maxcopy,maxwork,1); memory->sfree(work); @@ -544,7 +544,7 @@ void Variable::set(int narg, char **arg) void Variable::set(const std::string &setcmd) { std::vector args = utils::split_words(setcmd); - char **newarg = new char*[args.size()]; + auto newarg = new char*[args.size()]; int i=0; for (const auto &arg : args) { newarg[i++] = (char *)arg.c_str(); @@ -560,7 +560,7 @@ void Variable::set(const std::string &setcmd) void Variable::set(char *name, int narg, char **arg) { - char **newarg = new char*[2+narg]; + auto newarg = new char*[2+narg]; newarg[0] = name; newarg[1] = (char *) "index"; for (int i = 0; i < narg; i++) newarg[2+i] = arg[i]; @@ -1276,12 +1276,12 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int istop = i - 1; int n = istop - istart + 1; - char *number = new char[n+1]; + auto number = new char[n+1]; strncpy(number,&str[istart],n); number[n] = '\0'; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(number); treestack[ntreestack++] = newtree; @@ -1307,7 +1307,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int istop = i-1; int n = istop - istart + 1; - char *word = new char[n+1]; + auto word = new char[n+1]; strncpy(word,&str[istart],n); word[n] = '\0'; @@ -1365,7 +1365,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = compute->scalar; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1390,7 +1390,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) index1 > compute->size_vector) value1 = 0.0; else value1 = compute->vector[index1-1]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1417,7 +1417,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) index1 > compute->size_array_rows) value1 = 0.0; else value1 = compute->array[index1-1][index2-1]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1441,7 +1441,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_VECTOR; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = compute->vector; newtree->nvector = compute->size_vector; @@ -1466,7 +1466,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_ARRAY; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = &compute->array[0][index1-1]; newtree->nvector = compute->size_array_rows; @@ -1528,7 +1528,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_PERATOM; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = compute->vector_atom; newtree->nstride = 1; @@ -1553,7 +1553,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= Compute::INVOKED_PERATOM; } - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; if (compute->array_atom) newtree->array = &compute->array_atom[0][index1-1]; @@ -1613,7 +1613,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = fix->compute_scalar(); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1631,7 +1631,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = fix->compute_vector(index1-1); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1651,7 +1651,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = fix->compute_array(index1-1,index2-1); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1676,7 +1676,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) for (int m = 0; m < nvec; m++) vec[m] = fix->compute_vector(m); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; newtree->nvector = nvec; @@ -1703,7 +1703,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) for (int m = 0; m < nvec; m++) vec[m] = fix->compute_array(m,index1-1); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; newtree->nvector = nvec; @@ -1752,7 +1752,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) update->ntimestep % fix->peratom_freq) print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = fix->vector_atom; newtree->nstride = 1; @@ -1771,7 +1771,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) update->ntimestep % fix->peratom_freq) print_var_error(FLERR,"Fix in variable not computed at compatible time",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; if (fix->array_atom) newtree->array = &fix->array_atom[0][index1-1]; @@ -1815,7 +1815,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) value1 = dvalue[ivar]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1831,7 +1831,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (var == nullptr) print_var_error(FLERR,"Invalid variable evaluation in variable formula",ivar); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(var); treestack[ntreestack++] = newtree; @@ -1860,7 +1860,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (treetype == VECTOR) print_var_error(FLERR,"Atomfile-style variable in vector-style variable formula",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = reader[ivar]->fixstore->vstore; newtree->nstride = 1; @@ -1879,7 +1879,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) double *vec; int nvec = compute_vector(ivar,&vec); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VECTORARRAY; newtree->array = vec; newtree->nvector = nvec; @@ -1917,7 +1917,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) int m = index; // convert from tagint to int if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = vec[m-1]; treestack[ntreestack++] = newtree; @@ -1979,7 +1979,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (constants.find(word) != constants.end()) { value1 = constants[word]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -1998,7 +1998,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,fmt::format("Invalid thermo keyword '{}' in variable formula", word),ivar); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; treestack[ntreestack++] = newtree; @@ -2075,7 +2075,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) opprevious = opstack[--nopstack]; if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = opprevious; if ((opprevious == UNARY) || (opprevious == NOT)) { newtree->first = treestack[--ntreestack]; @@ -2537,8 +2537,8 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == STAGGER) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); if (tree->first->type != VALUE || tree->second->type != VALUE) return 0.0; tree->type = VALUE; if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue1 <= ivalue2) @@ -2551,9 +2551,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == LOGFREQ) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2571,9 +2571,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == LOGFREQ2) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2595,9 +2595,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == LOGFREQ3) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2624,9 +2624,9 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == STRIDE) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE) return 0.0; tree->type = VALUE; @@ -2642,12 +2642,12 @@ double Variable::collapse_tree(Tree *tree) } if (tree->type == STRIDE2) { - bigint ivalue1 = static_cast (collapse_tree(tree->first)); - bigint ivalue2 = static_cast (collapse_tree(tree->second)); - bigint ivalue3 = static_cast (collapse_tree(tree->extra[0])); - bigint ivalue4 = static_cast (collapse_tree(tree->extra[1])); - bigint ivalue5 = static_cast (collapse_tree(tree->extra[2])); - bigint ivalue6 = static_cast (collapse_tree(tree->extra[3])); + auto ivalue1 = static_cast (collapse_tree(tree->first)); + auto ivalue2 = static_cast (collapse_tree(tree->second)); + auto ivalue3 = static_cast (collapse_tree(tree->extra[0])); + auto ivalue4 = static_cast (collapse_tree(tree->extra[1])); + auto ivalue5 = static_cast (collapse_tree(tree->extra[2])); + auto ivalue6 = static_cast (collapse_tree(tree->extra[3])); if (tree->first->type != VALUE || tree->second->type != VALUE || tree->extra[0]->type != VALUE || tree->extra[1]->type != VALUE || tree->extra[2]->type != VALUE || tree->extra[3]->type != VALUE) @@ -2911,8 +2911,8 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == STAGGER) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue1 <= ivalue2) error->one(FLERR,"Invalid math function in variable formula"); bigint lower = update->ntimestep/ivalue1 * ivalue1; @@ -2923,9 +2923,9 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == LOGFREQ) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 || ivalue2 >= ivalue3) error->one(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; @@ -2940,9 +2940,9 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == LOGFREQ2) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) error->all(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; @@ -2961,9 +2961,9 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == STRIDE) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); if (update->ntimestep < ivalue1) arg = ivalue1; @@ -2976,12 +2976,12 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == STRIDE2) { - bigint ivalue1 = static_cast (eval_tree(tree->first,i)); - bigint ivalue2 = static_cast (eval_tree(tree->second,i)); - bigint ivalue3 = static_cast (eval_tree(tree->extra[0],i)); - bigint ivalue4 = static_cast (eval_tree(tree->extra[1],i)); - bigint ivalue5 = static_cast (eval_tree(tree->extra[2],i)); - bigint ivalue6 = static_cast (eval_tree(tree->extra[3],i)); + auto ivalue1 = static_cast (eval_tree(tree->first,i)); + auto ivalue2 = static_cast (eval_tree(tree->second,i)); + auto ivalue3 = static_cast (eval_tree(tree->extra[0],i)); + auto ivalue4 = static_cast (eval_tree(tree->extra[1],i)); + auto ivalue5 = static_cast (eval_tree(tree->extra[2],i)); + auto ivalue6 = static_cast (eval_tree(tree->extra[3],i)); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); if (ivalue4 < 0 || ivalue5 < 0 || ivalue6 <= 0 || ivalue4 > ivalue5) @@ -3043,18 +3043,18 @@ double Variable::eval_tree(Tree *tree, int i) } if (tree->type == GMASK) { - if (atom->mask[i] & tree->ivalue1) return 1.0; + if (atom->mask[i] & tree->ivalue) return 1.0; else return 0.0; } if (tree->type == RMASK) { - if (domain->regions[tree->ivalue1]->match(atom->x[i][0], atom->x[i][1], atom->x[i][2])) return 1.0; + if (tree->region->match(atom->x[i][0], atom->x[i][1], atom->x[i][2])) return 1.0; else return 0.0; } if (tree->type == GRMASK) { - if ((atom->mask[i] & tree->ivalue1) && - (domain->regions[tree->ivalue2]->match(atom->x[i][0], atom->x[i][1], atom->x[i][2]))) return 1.0; + if ((atom->mask[i] & tree->ivalue) && + (tree->region->match(atom->x[i][0], atom->x[i][1], atom->x[i][2]))) return 1.0; else return 0.0; } @@ -3429,8 +3429,8 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = STAGGER; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue1 <= ivalue2) print_var_error(FLERR,"Invalid math function in variable formula",ivar); bigint lower = update->ntimestep/ivalue1 * ivalue1; @@ -3446,9 +3446,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = LOGFREQ; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 || ivalue2 >= ivalue3) print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; @@ -3468,9 +3468,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = LOGFREQ2; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 <= 0 || ivalue2 <= 0 || ivalue3 <= 0 ) print_var_error(FLERR,"Invalid math function in variable formula",ivar); double value; @@ -3493,9 +3493,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = LOGFREQ3; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 <= 0 || ivalue2 <= 1 || ivalue3 <= 0 || ivalue3-ivalue1+1 < ivalue2 ) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -3524,9 +3524,9 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = STRIDE; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); double value; @@ -3544,12 +3544,12 @@ int Variable::math_function(char *word, char *contents, Tree **tree, Tree **tree print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = STRIDE2; else { - bigint ivalue1 = static_cast (value1); - bigint ivalue2 = static_cast (value2); - bigint ivalue3 = static_cast (values[0]); - bigint ivalue4 = static_cast (values[1]); - bigint ivalue5 = static_cast (values[2]); - bigint ivalue6 = static_cast (values[3]); + auto ivalue1 = static_cast (value1); + auto ivalue2 = static_cast (value2); + auto ivalue3 = static_cast (values[0]); + auto ivalue4 = static_cast (values[1]); + auto ivalue5 = static_cast (values[2]); + auto ivalue6 = static_cast (values[3]); if (ivalue1 < 0 || ivalue2 < 0 || ivalue3 <= 0 || ivalue1 > ivalue2) error->one(FLERR,"Invalid math function in variable formula"); if (ivalue4 < 0 || ivalue5 < 0 || ivalue6 <= 0 || ivalue4 > ivalue5) @@ -3664,32 +3664,31 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre int igroup = group->find(args[0]); if (igroup == -1) { - std::string mesg = "Group ID '"; - mesg += args[0]; - mesg += "' in variable formula does not exist"; - print_var_error(FLERR,mesg,ivar); + const auto errmesg = fmt::format("Group {} in variable formula does not exist", args[0]); + print_var_error(FLERR, errmesg, ivar); } // match word to group function double value = 0.0; + const auto group_errmesg = fmt::format("Invalid {}() function in variable formula", word); if (strcmp(word,"count") == 0) { if (narg == 1) value = group->count(igroup); else if (narg == 2) value = group->count(igroup,region_function(args[1],ivar)); - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"mass") == 0) { if (narg == 1) value = group->mass(igroup); else if (narg == 2) value = group->mass(igroup,region_function(args[1],ivar)); - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"charge") == 0) { if (narg == 1) value = group->charge(igroup); else if (narg == 2) value = group->charge(igroup,region_function(args[1],ivar)); - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"xcm") == 0) { atom->check_mass(FLERR); @@ -3698,14 +3697,14 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre double masstotal = group->mass(igroup); group->xcm(igroup,masstotal,xcm); } else if (narg == 3) { - int iregion = region_function(args[2],ivar); - double masstotal = group->mass(igroup,iregion); - group->xcm(igroup,masstotal,xcm,iregion); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + auto region = region_function(args[2],ivar); + double masstotal = group->mass(igroup,region); + group->xcm(igroup,masstotal,xcm,region); + } else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"x") == 0) value = xcm[0]; else if (strcmp(args[1],"y") == 0) value = xcm[1]; else if (strcmp(args[1],"z") == 0) value = xcm[2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"vcm") == 0) { atom->check_mass(FLERR); @@ -3714,38 +3713,38 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre double masstotal = group->mass(igroup); group->vcm(igroup,masstotal,vcm); } else if (narg == 3) { - int iregion = region_function(args[2],ivar); - double masstotal = group->mass(igroup,iregion); - group->vcm(igroup,masstotal,vcm,iregion); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + auto region = region_function(args[2],ivar); + double masstotal = group->mass(igroup,region); + group->vcm(igroup,masstotal,vcm,region); + } else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"x") == 0) value = vcm[0]; else if (strcmp(args[1],"y") == 0) value = vcm[1]; else if (strcmp(args[1],"z") == 0) value = vcm[2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"fcm") == 0) { double fcm[3]; if (narg == 2) group->fcm(igroup,fcm); else if (narg == 3) group->fcm(igroup,fcm,region_function(args[2],ivar)); - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"x") == 0) value = fcm[0]; else if (strcmp(args[1],"y") == 0) value = fcm[1]; else if (strcmp(args[1],"z") == 0) value = fcm[2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"bound") == 0) { double minmax[6]; if (narg == 2) group->bounds(igroup,minmax); else if (narg == 3) group->bounds(igroup,minmax,region_function(args[2],ivar)); - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"xmin") == 0) value = minmax[0]; else if (strcmp(args[1],"xmax") == 0) value = minmax[1]; else if (strcmp(args[1],"ymin") == 0) value = minmax[2]; else if (strcmp(args[1],"ymax") == 0) value = minmax[3]; else if (strcmp(args[1],"zmin") == 0) value = minmax[4]; else if (strcmp(args[1],"zmax") == 0) value = minmax[5]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"gyration") == 0) { atom->check_mass(FLERR); @@ -3755,16 +3754,16 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre group->xcm(igroup,masstotal,xcm); value = group->gyration(igroup,masstotal,xcm); } else if (narg == 2) { - int iregion = region_function(args[1],ivar); - double masstotal = group->mass(igroup,iregion); - group->xcm(igroup,masstotal,xcm,iregion); - value = group->gyration(igroup,masstotal,xcm,iregion); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + auto region = region_function(args[1],ivar); + double masstotal = group->mass(igroup,region); + group->xcm(igroup,masstotal,xcm,region); + value = group->gyration(igroup,masstotal,xcm,region); + } else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"ke") == 0) { if (narg == 1) value = group->ke(igroup); else if (narg == 2) value = group->ke(igroup,region_function(args[1],ivar)); - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"angmom") == 0) { atom->check_mass(FLERR); @@ -3774,15 +3773,15 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre group->xcm(igroup,masstotal,xcm); group->angmom(igroup,xcm,lmom); } else if (narg == 3) { - int iregion = region_function(args[2],ivar); - double masstotal = group->mass(igroup,iregion); - group->xcm(igroup,masstotal,xcm,iregion); - group->angmom(igroup,xcm,lmom,iregion); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + auto region = region_function(args[2],ivar); + double masstotal = group->mass(igroup,region); + group->xcm(igroup,masstotal,xcm,region); + group->angmom(igroup,xcm,lmom,region); + } else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"x") == 0) value = lmom[0]; else if (strcmp(args[1],"y") == 0) value = lmom[1]; else if (strcmp(args[1],"z") == 0) value = lmom[2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"torque") == 0) { atom->check_mass(FLERR); @@ -3792,15 +3791,15 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre group->xcm(igroup,masstotal,xcm); group->torque(igroup,xcm,tq); } else if (narg == 3) { - int iregion = region_function(args[2],ivar); - double masstotal = group->mass(igroup,iregion); - group->xcm(igroup,masstotal,xcm,iregion); - group->torque(igroup,xcm,tq,iregion); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + auto region = region_function(args[2],ivar); + double masstotal = group->mass(igroup,region); + group->xcm(igroup,masstotal,xcm,region); + group->torque(igroup,xcm,tq,region); + } else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"x") == 0) value = tq[0]; else if (strcmp(args[1],"y") == 0) value = tq[1]; else if (strcmp(args[1],"z") == 0) value = tq[2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"inertia") == 0) { atom->check_mass(FLERR); @@ -3810,18 +3809,18 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre group->xcm(igroup,masstotal,xcm); group->inertia(igroup,xcm,inertia); } else if (narg == 3) { - int iregion = region_function(args[2],ivar); - double masstotal = group->mass(igroup,iregion); - group->xcm(igroup,masstotal,xcm,iregion); - group->inertia(igroup,xcm,inertia,iregion); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + auto region = region_function(args[2],ivar); + double masstotal = group->mass(igroup,region); + group->xcm(igroup,masstotal,xcm,region); + group->inertia(igroup,xcm,inertia,region); + } else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"xx") == 0) value = inertia[0][0]; else if (strcmp(args[1],"yy") == 0) value = inertia[1][1]; else if (strcmp(args[1],"zz") == 0) value = inertia[2][2]; else if (strcmp(args[1],"xy") == 0) value = inertia[0][1]; else if (strcmp(args[1],"yz") == 0) value = inertia[1][2]; else if (strcmp(args[1],"xz") == 0) value = inertia[0][2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } else if (strcmp(word,"omega") == 0) { atom->check_mass(FLERR); @@ -3833,17 +3832,17 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre group->inertia(igroup,xcm,inertia); group->omega(angmom,inertia,omega); } else if (narg == 3) { - int iregion = region_function(args[2],ivar); - double masstotal = group->mass(igroup,iregion); - group->xcm(igroup,masstotal,xcm,iregion); - group->angmom(igroup,xcm,angmom,iregion); - group->inertia(igroup,xcm,inertia,iregion); + auto region = region_function(args[2],ivar); + double masstotal = group->mass(igroup,region); + group->xcm(igroup,masstotal,xcm,region); + group->angmom(igroup,xcm,angmom,region); + group->inertia(igroup,xcm,inertia,region); group->omega(angmom,inertia,omega); - } else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + } else print_var_error(FLERR,group_errmesg,ivar); if (strcmp(args[1],"x") == 0) value = omega[0]; else if (strcmp(args[1],"y") == 0) value = omega[1]; else if (strcmp(args[1],"z") == 0) value = omega[2]; - else print_var_error(FLERR,"Invalid group function in variable formula",ivar); + else print_var_error(FLERR,group_errmesg,ivar); } // delete stored args @@ -3853,7 +3852,7 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -3864,21 +3863,16 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree **tre /* ---------------------------------------------------------------------- */ -int Variable::region_function(char *id, int ivar) +Region *Variable::region_function(char *id, int ivar) { - int iregion = domain->find_region(id); - if (iregion == -1) { - std::string mesg = "Region ID '"; - mesg += id; - mesg += "' in variable formula does not exist"; - print_var_error(FLERR,mesg,ivar); - } + auto region = domain->get_region_by_id(id); + if (!region) + print_var_error(FLERR, fmt::format("Region {} in variable formula does not exist", id), ivar); // init region in case sub-regions have been deleted - domain->regions[iregion]->init(); - - return iregion; + region->init(); + return region; } /* ---------------------------------------------------------------------- @@ -4129,7 +4123,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4147,9 +4141,9 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t if (igroup == -1) print_var_error(FLERR,"Group ID in variable formula does not exist",ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = GMASK; - newtree->ivalue1 = group->bitmask[igroup]; + newtree->ivalue = group->bitmask[igroup]; treestack[ntreestack++] = newtree; } else if (strcmp(word,"rmask") == 0) { @@ -4158,12 +4152,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t if (narg != 1) print_var_error(FLERR,"Invalid special function in variable formula",ivar); - int iregion = region_function(args[0],ivar); - domain->regions[iregion]->prematch(); + auto region = region_function(args[0],ivar); + region->prematch(); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = RMASK; - newtree->ivalue1 = iregion; + newtree->region = region; treestack[ntreestack++] = newtree; } else if (strcmp(word,"grmask") == 0) { @@ -4175,13 +4169,13 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t int igroup = group->find(args[0]); if (igroup == -1) print_var_error(FLERR,"Group ID in variable formula does not exist",ivar); - int iregion = region_function(args[1],ivar); - domain->regions[iregion]->prematch(); + auto region = region_function(args[1],ivar); + region->prematch(); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = GRMASK; - newtree->ivalue1 = group->bitmask[igroup]; - newtree->ivalue2 = iregion; + newtree->ivalue = group->bitmask[igroup]; + newtree->region = region; treestack[ntreestack++] = newtree; // special function for file-style or atomfile-style variables @@ -4207,7 +4201,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t if (done) remove(ivar); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4228,7 +4222,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t int done = reader[ivar]->read_peratom(); if (done) remove(ivar); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->array = result; newtree->nstride = 1; @@ -4247,7 +4241,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4263,7 +4257,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4279,7 +4273,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4296,7 +4290,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4310,7 +4304,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree **t // save value in tree or on argstack if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4390,7 +4384,7 @@ void Variable::peratom2global(int flag, char *word, double *vector, int nstride, MPI_Allreduce(&mine,&value,1,MPI_DOUBLE,MPI_SUM,world); if (tree) { - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = VALUE; newtree->value = value; treestack[ntreestack++] = newtree; @@ -4436,7 +4430,7 @@ void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntree if (tree == nullptr) error->all(FLERR,"Atom vector in equal-style variable formula"); - Tree *newtree = new Tree(); + auto newtree = new Tree(); newtree->type = ATOMARRAY; newtree->nstride = 3; treestack[ntreestack++] = newtree; @@ -4856,7 +4850,7 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : error->all(FLERR,"Cannot use atomfile-style variable unless an atom map exists"); id_fix = utils::strdup(std::string(name) + "_VARIABLE_STORE"); - fixstore = (FixStore *) modify->add_fix(std::string(id_fix) + " all STORE peratom 0 1"); + fixstore = dynamic_cast( modify->add_fix(std::string(id_fix) + " all STORE peratom 0 1")); buffer = new char[CHUNK*MAXLINE]; } } diff --git a/src/variable.h b/src/variable.h index 7b51b45f38..7a79f50582 100644 --- a/src/variable.h +++ b/src/variable.h @@ -17,6 +17,7 @@ #include "pointers.h" namespace LAMMPS_NS { +class Region; class Variable : protected Pointers { friend class Info; @@ -110,14 +111,15 @@ class Variable : protected Pointers { int nvector; // length of array for vector-style variable int nstride; // stride between atoms if array is a 2d array int selfalloc; // 1 if array is allocated here, else 0 - int ivalue1, ivalue2; // extra values needed for gmask,rmask,grmask + int ivalue; // extra value needed for gmask, grmask int nextra; // # of additional args beyond first 2 + Region *region; // region pointer for rmask, grmask Tree *first, *second; // ptrs further down tree for first 2 args Tree **extra; // ptrs further down tree for nextra args Tree() : - array(nullptr), iarray(nullptr), barray(nullptr), selfalloc(0), ivalue1(0), ivalue2(0), - nextra(0), first(nullptr), second(nullptr), extra(nullptr) + array(nullptr), iarray(nullptr), barray(nullptr), selfalloc(0), ivalue(0), nextra(0), + region(nullptr), first(nullptr), second(nullptr), extra(nullptr) { } }; @@ -135,7 +137,7 @@ class Variable : protected Pointers { int find_matching_paren(char *, int, char *&, int); int math_function(char *, char *, Tree **, Tree **, int &, double *, int &, int); int group_function(char *, char *, Tree **, Tree **, int &, double *, int &, int); - int region_function(char *, int); + Region *region_function(char *, int); int special_function(char *, char *, Tree **, Tree **, int &, double *, int &, int); void peratom2global(int, char *, double *, int, tagint, Tree **, Tree **, int &, double *, int &); int is_atom_vector(char *); @@ -165,366 +167,3 @@ class VarReader : protected Pointers { } // namespace LAMMPS_NS #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: World variable count doesn't match # of partitions - -A world-style variable must specify a number of values equal to the -number of processor partitions. - -E: Universe/uloop variable count < # of partitions - -A universe or uloop style variable must specify a number of values >= to the -number of processor partitions. - -E: Cannot open temporary file for world counter. - -Self-explanatory. - -E: All universe/uloop variables must have same # of values - -Self-explanatory. - -E: Cannot redefine variable as a different style - -An equal-style variable can be re-defined but only if it was -originally an equal-style variable. - -E: File variable could not read value - -Check the file assigned to the variable. - -E: Atomfile variable could not read values - -Check the file assigned to the variable. - -E: LAMMPS is not built with Python embedded - -This is done by including the PYTHON package before LAMMPS is built. -This is required to use python-style variables. - -E: Variable name '%s' must have only alphanumeric characters or underscore - -UNDOCUMENTED - -E: Invalid variable '%s' in next command - -UNDOCUMENTED - -E: All variables in next command must have same style - -UNDOCUMENTED - -E: Invalid variable style with next command - -Variable styles {equal} and {world} cannot be used in a next -command. - -E: Incorrect conversion in format string - -A format style variable was not using either a %f, a %g, or a %e conversion. - -E: Next command must list all universe and uloop variables - -This is to insure they stay in sync. - -E: Python variable '%s' does not match Python function - -UNDOCUMENTED - -E: Divide by 0 in variable formula - -Self-explanatory. - -E: Modulo 0 in variable formula - -Self-explanatory. - -E: Power by 0 in variable formula - -Self-explanatory. - -E: Sqrt of negative value in variable formula - -Self-explanatory. - -E: Log of zero/negative value in variable formula - -Self-explanatory. - -E: Arcsin of invalid value in variable formula - -Argument of arcsin() must be between -1 and 1. - -E: Arccos of invalid value in variable formula - -Argument of arccos() must be between -1 and 1. - -E: Invalid math function in variable formula - -Self-explanatory. - -E: Variable name between brackets must be alphanumeric or underscore characters - -Self-explanatory. - -E: Non digit character between brackets in variable - -Self-explanatory. - -E: Mismatched brackets in variable - -Self-explanatory. - -E: Empty brackets in variable - -There is no variable syntax that uses empty brackets. Check -the variable doc page. - -E: Invalid variable name in variable formula - -Variable name is not recognized. - -E: Invalid variable evaluation in variable formula - -A variable used in a formula could not be evaluated. - -E: Index between variable brackets must be positive - -Self-explanatory. - -E: Indexed per-atom vector in variable formula without atom map - -Accessing a value from an atom vector requires the ability to lookup -an atom index, which is provided by an atom map. An atom map does not -exist (by default) for non-molecular problems. Using the atom_modify -map command will force an atom map to be created. - -E: Variable atom ID is too large - -Specified ID is larger than the maximum allowed atom ID. - -E: Variable uses atom property that isn't allocated - -Self-explanatory. - -E: Invalid atom vector in variable formula - -The atom vector is not recognized. - -E: Atom vector in equal-style variable formula - -Atom vectors generate one value per atom which is not allowed -in an equal-style variable. - -E: Too many args in variable function - -More args are used than any variable function allows. - -E: Invalid Boolean syntax in if command - -Self-explanatory. - -E: Cannot open file variable file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -E: Cannot use atomfile-style variable unless atom map exists - -Self-explanatory. See the atom_modify command to create a map. - -E: Invalid atom ID in variable file - -Self-explanatory. - -U: Variable name must be alphanumeric or underscore characters - -Self-explanatory. - -U: Invalid variable in next command - -Self-explanatory. - -U: All variables in next command must be same style - -Self-explanatory. - -U: Variable has circular dependency - -A circular dependency is when variable "a" in used by variable "b" and -variable "b" is also used by variable "a". Circular dependencies with -longer chains of dependence are also not allowed. - -U: Python variable does not match Python function - -This matching is defined by the python-style variable and the python -command. - -U: Python variable has no function - -No python command was used to define the function associated with the -python-style variable. - -U: Invalid syntax in variable formula - -Self-explanatory. - -U: Variable evaluation before simulation box is defined - -Cannot evaluate a compute or fix or atom-based value in a variable -before the simulation has been setup. - -U: Invalid compute ID in variable formula - -The compute is not recognized. - -U: Compute used in variable between runs is not current - -Computes cannot be invoked by a variable in between runs. Thus they -must have been evaluated on the last timestep of the previous run in -order for their value(s) to be accessed. See the doc page for the -variable command for more info. - -U: Variable formula compute vector is accessed out-of-range - -Self-explanatory. - -U: Variable formula compute array is accessed out-of-range - -Self-explanatory. - -U: Per-atom compute in equal-style variable formula - -Equal-style variables cannot use per-atom quantities. - -U: Mismatched compute in variable formula - -A compute is referenced incorrectly or a compute that produces per-atom -values is used in an equal-style variable formula. - -U: Invalid fix ID in variable formula - -The fix is not recognized. - -U: Fix in variable not computed at compatible time - -Fixes generate their values on specific timesteps. The variable is -requesting the values on a non-allowed timestep. - -U: Variable formula fix vector is accessed out-of-range - -Self-explanatory. - -U: Variable formula fix array is accessed out-of-range - -Self-explanatory. - -U: Per-atom fix in equal-style variable formula - -Equal-style variables cannot use per-atom quantities. - -U: Mismatched fix in variable formula - -A fix is referenced incorrectly or a fix that produces per-atom -values is used in an equal-style variable formula. - -U: Atom-style variable in equal-style variable formula - -Atom-style variables generate one value per atom which is not allowed -in an equal-style variable. - -U: Atomfile-style variable in equal-style variable formula - -Self-explanatory. - -U: Mismatched variable in variable formula - -A variable is referenced incorrectly or an atom-style variable that -produces per-atom values is used in an equal-style variable -formula. - -U: Invalid math/group/special function in variable formula - -Self-explanatory. - -U: Invalid thermo keyword in variable formula - -The keyword is not recognized. - -U: Cannot use ramp in variable formula between runs - -This is because the ramp() function is time dependent. - -U: Cannot use vdisplace in variable formula between runs - -This is a function of elapsed time. - -U: Cannot use swiggle in variable formula between runs - -This is a function of elapsed time. - -U: Cannot use cwiggle in variable formula between runs - -This is a function of elapsed time. - -U: Group ID in variable formula does not exist - -Self-explanatory. - -U: Invalid group function in variable formula - -Group function is not recognized. - -U: Region ID in variable formula does not exist - -Self-explanatory. - -U: Invalid special function in variable formula - -Self-explanatory. - -U: Gmask function in equal-style variable formula - -Gmask is per-atom operation. - -U: Rmask function in equal-style variable formula - -Rmask is per-atom operation. - -U: Grmask function in equal-style variable formula - -Grmask is per-atom operation. - -U: Variable ID in variable formula does not exist - -Self-explanatory. - -U: Atomfile variable in equal-style variable formula - -Self-explanatory. - -U: Invalid variable style in special function next - -Only file-style or atomfile-style variables can be used with next(). - -U: Invalid is_active() function in variable formula - -Self-explanatory. - -U: Invalid is_available() function in variable formula - -Self-explanatory. - -U: Invalid is_defined() function in variable formula - -Self-explanatory. - -*/ diff --git a/src/velocity.h b/src/velocity.h index 2f27cd9152..669a0f947f 100644 --- a/src/velocity.h +++ b/src/velocity.h @@ -55,102 +55,3 @@ class Velocity : public Command { #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: Velocity command before simulation box is defined - -The velocity command cannot be used before a read_data, read_restart, -or create_box command. - -E: Velocity command with no atoms existing - -A velocity command has been used, but no atoms yet exist. - -E: Could not find velocity group ID - -A group ID used in the velocity command does not exist. - -W: Changing velocities of atoms in rigid bodies. This has no effect unless rigid bodies are rebuild - -UNDOCUMENTED - -W: Mismatch between velocity and compute groups - -The temperature computation used by the velocity command will not be -on the same group of atoms that velocities are being set for. - -E: Too big a problem to use velocity create loop all - -The system size must fit in a 32-bit integer to use this option. - -E: Cannot use velocity create loop all unless atoms have IDs - -Atoms in the simulation to do not have IDs, so this style -of velocity creation cannot be performed. - -E: Atom IDs must be consecutive for velocity create loop all - -Self-explanatory. - -E: Variable name for velocity set does not exist - -Self-explanatory. - -E: Variable for velocity set is invalid style - -Only atom-style variables can be used. - -E: Cannot set non-zero z velocity for 2d simulation - -Self-explanatory. - -E: Cannot set variable z velocity for 2d simulation - -Self-explanatory. - -E: Velocity ramp in z for a 2d problem - -Self-explanatory. - -E: Velocity rigid used with non-rigid fix-ID - -Self-explanatory. - -E: Attempting to rescale a 0.0 temperature - -Cannot rescale a temperature that is already 0.0. - -E: Cannot zero momentum of no atoms - -Self-explanatory. - -E: Could not find velocity temperature ID - -The compute ID needed by the velocity command to compute temperature -does not exist. - -E: Velocity temperature ID does not compute temperature - -The compute ID given to the velocity command must compute -temperature. - -E: Fix ID for velocity does not exist - -Self-explanatory. - -E: Cannot use velocity bias command without temp keyword - -Self-explanatory. - -E: Velocity temperature ID does calculate a velocity bias - -The specified compute must compute a bias for temperature. - -*/ diff --git a/src/verlet.cpp b/src/verlet.cpp index 342dc3d951..15e1ab0800 100644 --- a/src/verlet.cpp +++ b/src/verlet.cpp @@ -237,7 +237,7 @@ void Verlet::run(int n) int n_post_neighbor = modify->n_post_neighbor; int n_pre_force = modify->n_pre_force; int n_pre_reverse = modify->n_pre_reverse; - int n_post_force = modify->n_post_force; + int n_post_force_any = modify->n_post_force_any; int n_end_of_step = modify->n_end_of_step; if (atom->sortfreq > 0) sortflag = 1; @@ -344,7 +344,7 @@ void Verlet::run(int n) // force modifications, final time integration, diagnostics - if (n_post_force) modify->post_force(vflag); + if (n_post_force_any) modify->post_force(vflag); modify->final_integrate(); if (n_end_of_step) modify->end_of_step(); timer->stamp(Timer::MODIFY); diff --git a/src/verlet.h b/src/verlet.h index e93f5917de..f02e5859f6 100644 --- a/src/verlet.h +++ b/src/verlet.h @@ -45,17 +45,3 @@ class Verlet : public Integrate { #endif #endif - -/* ERROR/WARNING messages: - -W: No fixes defined, atoms won't move - -If you are not using a fix like nve, nvt, npt then atom velocities and -coordinates will not be updated during timestepping. - -E: KOKKOS package requires run_style verlet/kk - -The KOKKOS package requires the Kokkos version of run_style verlet; the -regular version cannot be used. - -*/ diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 0aca596ae6..f71cab0fdd 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -30,6 +30,8 @@ using namespace LAMMPS_NS; enum { REGULAR_MODE, CLASS2_MODE }; +static constexpr int BUF_SIZE = 256; + /* ---------------------------------------------------------------------- called as write_coeff command in input script ------------------------------------------------------------------------- */ @@ -47,7 +49,7 @@ void WriteCoeff::command(int narg, char **arg) lmp->init(); if (comm->me == 0) { - char str[256], coeff[256]; + char str[BUF_SIZE], coeff[BUF_SIZE]; FILE *one = fopen(file, "wb+"); if (one == nullptr) @@ -88,7 +90,7 @@ void WriteCoeff::command(int narg, char **arg) while (true) { int coeff_mode = REGULAR_MODE; - if (fgets(str, 256, one) == nullptr) break; + if (fgets(str, BUF_SIZE, one) == nullptr) break; // some coeffs need special treatment if (strstr(str, "class2") != nullptr) { @@ -100,20 +102,20 @@ void WriteCoeff::command(int narg, char **arg) coeff_mode = CLASS2_MODE; } - const char *section = (const char *) ""; - fputs(str, two); // style - utils::sfgets(FLERR, str, 256, one, file, error); // coeff + const char *section = (const char *) ""; // NOLINT + fputs(str, two); // style + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); // coeff int n = strlen(str); - strcpy(coeff, str); + strncpy(coeff, str, BUF_SIZE); coeff[n - 1] = '\0'; - utils::sfgets(FLERR, str, 256, one, file, error); + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); while (strcmp(str, "end\n") != 0) { if (coeff_mode == REGULAR_MODE) { fprintf(two, "%s %s", coeff, str); - utils::sfgets(FLERR, str, 256, one, file, error); + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); } else if (coeff_mode == CLASS2_MODE) { @@ -125,7 +127,7 @@ void WriteCoeff::command(int narg, char **arg) // all but the the last section end with an empty line. // skip it and read and parse the next section title - utils::sfgets(FLERR, str, 256, one, file, error); + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); if (strcmp(str, "BondBond Coeffs\n") == 0) section = (const char *) "bb"; @@ -145,8 +147,8 @@ void WriteCoeff::command(int narg, char **arg) section = (const char *) "aa"; // gobble up one more empty line - utils::sfgets(FLERR, str, 256, one, file, error); - utils::sfgets(FLERR, str, 256, one, file, error); + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); } // parse type number and skip over it @@ -156,7 +158,7 @@ void WriteCoeff::command(int narg, char **arg) while ((*p != '\0') && isdigit(*p)) ++p; fprintf(two, "%s %d %s %s", coeff, type, section, p); - utils::sfgets(FLERR, str, 256, one, file, error); + utils::sfgets(FLERR, str, BUF_SIZE, one, file, error); } } fputc('\n', two); diff --git a/src/write_coeff.h b/src/write_coeff.h index 5381a9fe0b..55c88c8149 100644 --- a/src/write_coeff.h +++ b/src/write_coeff.h @@ -34,31 +34,3 @@ class WriteCoeff : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Write_coeff command before simulation box is defined - -UNDOCUMENTED - -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: Cannot open coeff file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -U: write_coeff command before simulation box is defined - -Self-explanatory. - -U: Atom count is inconsistent, cannot write data file - -The sum of atoms across processors does not equal the global number -of atoms. Probably some atoms have been lost. - -*/ diff --git a/src/write_data.h b/src/write_data.h index 023d270b43..bd98a962a3 100644 --- a/src/write_data.h +++ b/src/write_data.h @@ -58,27 +58,3 @@ class WriteData : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Write_data command before simulation box is defined - -Self-explanatory. - -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: Atom count is inconsistent, cannot write data file - -The sum of atoms across processors does not equal the global number -of atoms. Probably some atoms have been lost. - -E: Cannot open data file %s - -The specified file cannot be opened. Check that the path and name are -correct. - -*/ diff --git a/src/write_dump.cpp b/src/write_dump.cpp index eba081582e..b29da81463 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -47,7 +47,7 @@ void WriteDump::command(int narg, char **arg) Dump *dump = nullptr; - char **dumpargs = new char*[modindex+2]; + auto dumpargs = new char*[modindex+2]; dumpargs[0] = (char *) "WRITE_DUMP"; // dump id dumpargs[1] = arg[0]; // group dumpargs[2] = arg[1]; // dump style @@ -56,7 +56,7 @@ void WriteDump::command(int narg, char **arg) for (int i = 2; i < modindex; ++i) dumpargs[i+2] = arg[i]; - if (false) { + if (false) { // NOLINT return; // dummy branch to enable else-if macro expansion #define DUMP_CLASS @@ -74,10 +74,10 @@ void WriteDump::command(int narg, char **arg) // set multifile_override for DumpImage so that filename needs no "*" if (strcmp(arg[1],"image") == 0) - ((DumpImage *) dump)->multifile_override = 1; + (dynamic_cast( dump))->multifile_override = 1; if (strcmp(arg[1],"cfg") == 0) - ((DumpCFG *) dump)->multifile_override = 1; + (dynamic_cast( dump))->multifile_override = 1; if ((update->first_update == 0) && (comm->me == 0)) error->warning(FLERR,"Calling write_dump before a full system init."); diff --git a/src/write_dump.h b/src/write_dump.h index c2e75b2484..f8bbfefd13 100644 --- a/src/write_dump.h +++ b/src/write_dump.h @@ -34,25 +34,3 @@ class WriteDump : public Command { #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: Unrecognized dump style - -The choice of dump style is unknown. - -W: Calling write_dump before a full system init. - -The write_dump command is used before the system has been fully -initialized as part of a 'run' or 'minimize' command. Not all dump -styles and features are fully supported at this point and thus the -command may fail or produce incomplete or incorrect output. Insert -a "run 0" command, if a full system init is required. - -*/ diff --git a/src/write_restart.h b/src/write_restart.h index a01d61863c..e1146653a5 100644 --- a/src/write_restart.h +++ b/src/write_restart.h @@ -71,44 +71,3 @@ class WriteRestart : public Command { #endif #endif - -/* ERROR/WARNING messages: - -E: Write_restart command before simulation box is defined - -The write_restart command cannot be used before a read_data, -read_restart, or create_box command. - -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: Restart file MPI-IO output not allowed with % in filename - -This is because a % signifies one file per processor and MPI-IO -creates one large file for all processors. - -E: Writing to MPI-IO filename when MPIIO package is not installed - -Self-explanatory. - -E: Cannot use write_restart fileper without % in restart file name - -Self-explanatory. - -E: Cannot use write_restart nfile without % in restart file name - -Self-explanatory. - -E: Atom count is inconsistent, cannot write restart file - -Sum of atoms across processors does not equal initial total count. -This is probably because you have lost some atoms. - -E: Cannot open restart file %s - -Self-explanatory. - -*/ diff --git a/tools/README b/tools/README index eb329e27cd..22e50b55fe 100644 --- a/tools/README +++ b/tools/README @@ -16,7 +16,6 @@ amber2lmp python scripts for using AMBER to setup LAMMPS input binary2txt convert a LAMMPS dump file from binary to ASCII text ch2lmp convert CHARMM files to LAMMPS input chain create a data file of bead-spring chains -cmake tools and scripts for use with CMake coding_standard python scripts to detect and fix some LAMMPS conventions colvars post-process output of the fix colvars command createatoms generate lattices of atoms within a geometry diff --git a/tools/binary2txt.cpp b/tools/binary2txt.cpp index d3c5dba1b5..b675fb5b5d 100644 --- a/tools/binary2txt.cpp +++ b/tools/binary2txt.cpp @@ -83,7 +83,7 @@ int main(int narg, char **arg) } n = strlen(arg[iarg]) + 1 + 4; - char *filetxt = new char[n]; + auto filetxt = new char[n]; strcpy(filetxt, arg[iarg]); strcat(filetxt, ".txt"); FILE *fptxt = fopen(filetxt, "w"); @@ -226,7 +226,7 @@ int main(int narg, char **arg) // extend buffer to fit chunk size if (n > maxbuf) { - if (buf) delete[] buf; + delete[] buf; buf = new double[n]; maxbuf = n; } @@ -260,6 +260,6 @@ int main(int narg, char **arg) unit_style = nullptr; } - if (buf) delete[] buf; + delete[] buf; return 0; } diff --git a/tools/cmake/cmbuild b/tools/cmake/cmbuild deleted file mode 100755 index f9e0f87390..0000000000 --- a/tools/cmake/cmbuild +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# make like wrapper around "cmake --build" -# (c) 2020 Axel Kohlmeyer -# This file is in the public domain - -WORKDIR="${PWD}" -PARAMS="" -MYARGS="" - -usage() -{ - echo "Usage: cmbuild [-v] [-h] [-C ] [-j ] []" >&2 -} - -help() -{ - usage - cat >&2 < allow processing of NUM concurrent tasks - -C DIRECTORY execute build in folder DIRECTORY - -v produce verbose output -EOF -} - -while (( "$#" )); do - case "$1" in - -C) - WORKDIR="$2" - shift 2 - ;; - -v) - MYARGS="${MYARGS} -v" - shift - ;; - -h) - help - exit 2 - ;; - -j) - MYARGS="${MYARGS} -j $2" - shift 2 - ;; - --) - shift - break - ;; - -*) - echo "Error: Unsupported flag $1" >&2 - echo - usage - exit 1 - ;; - *) - PARAMS="${PARAMS} $1" - shift - ;; - esac -done - -if [ ! -f "${WORKDIR}/CMakeCache.txt" ] ; then - echo "Must execute in a CMake build directory or use -C flag to select one" >&2 - exit 3 -fi - -eval set -- "${PARAMS} $@" -exec cmake --build "${WORKDIR}" ${MYARGS} --target "$@" diff --git a/tools/coding_standard/README b/tools/coding_standard/README index d0cd2872df..b5e483f38e 100644 --- a/tools/coding_standard/README +++ b/tools/coding_standard/README @@ -2,4 +2,6 @@ These Python scripts help to detect whether files in the repository conform to LAMMPS coding conventions or not, and can fix those issues, too. permissions.py detects if sources have executable permissions and scripts have not -whitespace.py (currently) detects trailing whitespace +whitespace.py detects TAB characters and trailing whitespace +homepage.py detects outdated LAMMPS homepage URLs (pointing to sandia.gov instead of lammps.org) +errordocs.py detects deprecated error docs in header files diff --git a/tools/coding_standard/errordocs.py b/tools/coding_standard/errordocs.py new file mode 100644 index 0000000000..07c0064e6c --- /dev/null +++ b/tools/coding_standard/errordocs.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python3 +# Utility for detecting leftover error/warning docs in header files +# +# Written by Axel Kohlmeyer (Temple University) +from __future__ import print_function +import sys + +if sys.version_info.major < 3: + sys.exit('This script must be run with Python 3.5 or later') + +if sys.version_info.minor < 5: + sys.exit('This script must be run with Python 3.5 or later') + +import os +import glob +import re +import yaml +import argparse +import shutil + +DEFAULT_CONFIG = """ +recursive: true +include: + - src/** +patterns: + - "*.h" +""" + +def check_errordocs(f): + pattern = re.compile(r'^ */\* *ERROR/WARNING messag') + lineno = 1 + errors = set() + + for line in f: + if pattern.match(line): + errors.add(lineno) + lineno += 1 + + return errors + +def check_file(path): + if path.find('errordocs.py') >= 0: return { 'errordocs_errors' : '' } + encoding = 'UTF-8' + errordocs_errors = set() + try: + with open(path, 'r') as f: + errordocs_errors = check_errordocs(f) + except UnicodeDecodeError: + encoding = 'ISO-8859-1' + try: + with open(path, 'r', encoding=encoding) as f: + errordocs_errors = check_errordocs(f) + except Exception: + encoding = 'unknown' + + return { + 'errordocs_errors': errordocs_errors, + 'encoding': encoding + } + +def fix_file(path, check_result): + if path.find('errordocs.py') >= 0: return + newfile = path + ".modified" + pattern = re.compile(r'[\n\r ]* */\* *ERROR/WARNING *messag.*\*/', re.DOTALL) + with open(newfile, 'w', encoding='UTF-8') as out: + with open(path, 'r', encoding=check_result['encoding']) as src: + filetxt = re.sub(pattern,'', src.read()); + print(filetxt, end='', file=out) + shutil.copymode(path, newfile) + shutil.move(newfile, path) + +def check_folder(directory, config, fix=False, verbose=False): + success = True + files = [] + + for base_path in config['include']: + for pattern in config['patterns']: + path = os.path.join(directory, base_path, pattern) + files += glob.glob(path, recursive=config['recursive']) + + for f in files: + path = os.path.normpath(f) + + if verbose: + print("Checking file:", path) + + result = check_file(path) + + has_resolvable_errors = False + + for lineno in result['errordocs_errors']: + print("[Error] Found LAMMPS errordocs @ {}:{}".format(path, lineno)) + has_resolvable_errors = True + + if has_resolvable_errors: + if fix: + print("Applying automatic fixes to file:", path) + fix_file(path, result) + else: + success = False + + return success + +def main(): + parser = argparse.ArgumentParser(description='Utility for detecting and fixing whitespace issues in LAMMPS') + parser.add_argument('-c', '--config', metavar='CONFIG_FILE', help='location of a optional configuration file') + parser.add_argument('-f', '--fix', action='store_true', help='automatically fix URLs') + parser.add_argument('-v', '--verbose', action='store_true', help='verbose output') + parser.add_argument('DIRECTORY', help='directory (or file) that should be checked') + args = parser.parse_args() + lammpsdir = os.path.abspath(os.path.expanduser(args.DIRECTORY)) + + if args.config: + with open(args.config, 'r') as cfile: + config = yaml.load(cfile, Loader=yaml.FullLoader) + else: + config = yaml.load(DEFAULT_CONFIG, Loader=yaml.FullLoader) + + if os.path.isdir(lammpsdir): + if not check_folder(lammpsdir, config, args.fix, args.verbose): + sys.exit(1) + else: + success = True + path = os.path.normpath(lammpsdir) + + if args.verbose: + print("Checking file:", path) + + result = check_file(path) + + has_resolvable_errors = False + + for lineno in result['errordocs_errors']: + print("[Error] Found LAMMPS errordocs @ {}:{}".format(path, lineno)) + has_resolvable_errors = True + + if has_resolvable_errors: + if args.fix: + print("Applying automatic fixes to file:", path) + fix_file(path, result) + else: + success = False + + if not success: + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/tools/msi2lmp/README b/tools/msi2lmp/README index bd658d897e..401ec536fd 100644 --- a/tools/msi2lmp/README +++ b/tools/msi2lmp/README @@ -81,13 +81,10 @@ This program uses the .car and .mdf files from MSI/Biosyms's INSIGHT -- msi2lmp.exe is the name of the executable -- is the base name of the .car and .mdf files - -- -2001 - Output lammps files for LAMMPS version 2001 (F90 version) - Default is to write output for the C++ version of LAMMPS -- -print (or -p) - # is the print level 0 - silent except for error messages - 1 - minimal (default) + # is the print level 0 - silent except for error messages + 1 - minimal (default) 2 - verbose (usual for developing and checking new data files for consistency) 3 - even more verbose (additional debug info) diff --git a/tools/singularity/ubuntu16.04.def b/tools/singularity/ubuntu16.04.def index 35e4e26138..f22826cabd 100644 --- a/tools/singularity/ubuntu16.04.def +++ b/tools/singularity/ubuntu16.04.def @@ -14,7 +14,7 @@ From: ubuntu:16.04 libfftw3-dev libjpeg-dev libpng12-dev libblas-dev liblapack-dev \ python-dev libeigen3-dev libgsl-dev libopenblas-dev libreadline-dev \ virtualenv python3-dev python3-pip python3-pkg-resources \ - python3-setuptools python3-virtualenv \ + python3-setuptools python3-virtualenv python3-venv \ enchant # create missing readline pkgconfig file diff --git a/tools/singularity/ubuntu18.04.def b/tools/singularity/ubuntu18.04.def index ebea335d6b..456d3add56 100644 --- a/tools/singularity/ubuntu18.04.def +++ b/tools/singularity/ubuntu18.04.def @@ -107,7 +107,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_amd_rocm.def b/tools/singularity/ubuntu18.04_amd_rocm.def index f1d327052d..e2a9adc9d9 100644 --- a/tools/singularity/ubuntu18.04_amd_rocm.def +++ b/tools/singularity/ubuntu18.04_amd_rocm.def @@ -137,7 +137,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_gpu.def b/tools/singularity/ubuntu18.04_gpu.def index 452a3eaee8..6aa37ccf84 100644 --- a/tools/singularity/ubuntu18.04_gpu.def +++ b/tools/singularity/ubuntu18.04_gpu.def @@ -174,7 +174,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_intel_opencl.def b/tools/singularity/ubuntu18.04_intel_opencl.def index fd7363dbae..1f7c136fac 100644 --- a/tools/singularity/ubuntu18.04_intel_opencl.def +++ b/tools/singularity/ubuntu18.04_intel_opencl.def @@ -108,7 +108,7 @@ From: ubuntu:18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu18.04_nvidia.def b/tools/singularity/ubuntu18.04_nvidia.def index f834e1a91e..70f41708de 100644 --- a/tools/singularity/ubuntu18.04_nvidia.def +++ b/tools/singularity/ubuntu18.04_nvidia.def @@ -107,7 +107,7 @@ From: nvidia/cuda:11.4.2-devel-ubuntu18.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04.def b/tools/singularity/ubuntu20.04.def index 53690fd1b9..5665546eda 100644 --- a/tools/singularity/ubuntu20.04.def +++ b/tools/singularity/ubuntu20.04.def @@ -52,6 +52,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ texlive \ @@ -101,7 +102,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_amd_rocm.def b/tools/singularity/ubuntu20.04_amd_rocm.def index e52ff02798..21f1ecc77b 100644 --- a/tools/singularity/ubuntu20.04_amd_rocm.def +++ b/tools/singularity/ubuntu20.04_amd_rocm.def @@ -82,6 +82,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -122,7 +123,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_gpu.def b/tools/singularity/ubuntu20.04_gpu.def index abb43f46df..23bddeb14f 100644 --- a/tools/singularity/ubuntu20.04_gpu.def +++ b/tools/singularity/ubuntu20.04_gpu.def @@ -87,6 +87,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -160,7 +161,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_intel_opencl.def b/tools/singularity/ubuntu20.04_intel_opencl.def index 0e3cae67d7..c02d2cd3a4 100644 --- a/tools/singularity/ubuntu20.04_intel_opencl.def +++ b/tools/singularity/ubuntu20.04_intel_opencl.def @@ -52,6 +52,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -100,7 +101,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_nvidia.def b/tools/singularity/ubuntu20.04_nvidia.def index 274efecadc..e0995301f4 100644 --- a/tools/singularity/ubuntu20.04_nvidia.def +++ b/tools/singularity/ubuntu20.04_nvidia.def @@ -55,6 +55,7 @@ From: nvidia/cuda:11.4.2-devel-ubuntu20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ vim-nox \ @@ -102,7 +103,7 @@ From: nvidia/cuda:11.4.2-devel-ubuntu20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/tools/singularity/ubuntu20.04_oneapi.def b/tools/singularity/ubuntu20.04_oneapi.def index e5077fe184..a5d59efbc5 100644 --- a/tools/singularity/ubuntu20.04_oneapi.def +++ b/tools/singularity/ubuntu20.04_oneapi.def @@ -51,6 +51,7 @@ From: ubuntu:20.04 python3-pkg-resources \ python3-setuptools \ python3-virtualenv \ + python3-venv \ rsync \ ssh \ texlive \ @@ -139,7 +140,7 @@ From: ubuntu:20.04 # Plumed ########################################################################### - export PLUMED_PKG_VERSION=2.7.3 + export PLUMED_PKG_VERSION=2.7.4 mkdir plumed cd plumed diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index a166ad792a..40ef8204aa 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -20,6 +20,12 @@ add_library(GTest::GMock ALIAS gmock) add_library(GTest::GTestMain ALIAS gtest_main) add_library(GTest::GMockMain ALIAS gmock_main) +# import +foreach(_FLAG ${CMAKE_TUNE_FLAGS}) + add_compile_options(${_FLAG}) +endforeach() + + ######################################## # General tests using the LAMMPS executable itself ######################################## diff --git a/unittest/commands/test_compute_global.cpp b/unittest/commands/test_compute_global.cpp index 1c9be99ba4..e21acdbca0 100644 --- a/unittest/commands/test_compute_global.cpp +++ b/unittest/commands/test_compute_global.cpp @@ -102,24 +102,24 @@ TEST_F(ComputeGlobalTest, Energy) EXPECT_DOUBLE_EQ(get_scalar("pe1"), 24155.155261642241); EXPECT_DOUBLE_EQ(get_scalar("pe2"), 361.37528652881286); EXPECT_DOUBLE_EQ(get_scalar("pe3"), 0.0); - EXPECT_DOUBLE_EQ(get_scalar("pr1"), 1956948.4735454607); - EXPECT_DOUBLE_EQ(get_scalar("pr2"), 1956916.7725807722); + EXPECT_NEAR(get_scalar("pr1"), 1956948.4735454607, 0.0000000005); + EXPECT_NEAR(get_scalar("pr2"), 1956916.7725807722, 0.0000000005); EXPECT_DOUBLE_EQ(get_scalar("pr3"), 0.0); auto pr1 = get_vector("pr1"); auto pr2 = get_vector("pr2"); auto pr3 = get_vector("pr3"); - EXPECT_DOUBLE_EQ(pr1[0], 2150600.9207200543); - EXPECT_DOUBLE_EQ(pr1[1], 1466949.7512112649); - EXPECT_DOUBLE_EQ(pr1[2], 2253294.7487050635); - EXPECT_DOUBLE_EQ(pr1[3], 856643.16926486336); - EXPECT_DOUBLE_EQ(pr1[4], 692710.86929464422); - EXPECT_DOUBLE_EQ(pr1[5], -44403.909298603547); - EXPECT_DOUBLE_EQ(pr2[0], 2150575.6989334146); - EXPECT_DOUBLE_EQ(pr2[1], 1466911.3911461537); - EXPECT_DOUBLE_EQ(pr2[2], 2253263.2276627473); - EXPECT_DOUBLE_EQ(pr2[3], 856632.34707690508); - EXPECT_DOUBLE_EQ(pr2[4], 692712.89222328411); - EXPECT_DOUBLE_EQ(pr2[5], -44399.277068014424); + EXPECT_NEAR(pr1[0], 2150600.9207200543, 0.0000000005); + EXPECT_NEAR(pr1[1], 1466949.7512112649, 0.0000000005); + EXPECT_NEAR(pr1[2], 2253294.7487050635, 0.0000000005); + EXPECT_NEAR(pr1[3], 856643.16926486336, 0.0000000005); + EXPECT_NEAR(pr1[4], 692710.86929464422, 0.0000000005); + EXPECT_NEAR(pr1[5], -44403.909298603547, 0.0000000005); + EXPECT_NEAR(pr2[0], 2150575.6989334146, 0.0000000005); + EXPECT_NEAR(pr2[1], 1466911.3911461537, 0.0000000005); + EXPECT_NEAR(pr2[2], 2253263.2276627473, 0.0000000005); + EXPECT_NEAR(pr2[3], 856632.34707690508, 0.0000000005); + EXPECT_NEAR(pr2[4], 692712.89222328411, 0.0000000005); + EXPECT_NEAR(pr2[5], -44399.277068014424, 0.0000000005); EXPECT_DOUBLE_EQ(pr3[0], 0.0); EXPECT_DOUBLE_EQ(pr3[1], 0.0); EXPECT_DOUBLE_EQ(pr3[2], 0.0); diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index a356a02cca..b0706ea775 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -151,7 +151,8 @@ TEST_F(GroupTest, RegionClear) ASSERT_EQ(group->count_all(), lmp->atom->natoms); TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three region left xxx");); - TEST_FAILURE(".*ERROR: Group region ID does not exist.*", command("group four region dummy");); + TEST_FAILURE(".*ERROR: Group region dummy does not exist.*", + command("group four region dummy");); BEGIN_HIDE_OUTPUT(); command("group one clear"); @@ -196,8 +197,8 @@ TEST_F(GroupTest, SelectRestart) ASSERT_EQ(group->count(group->find("four")), 32); ASSERT_EQ(group->count(group->find("five")), 16); ASSERT_EQ(group->count(group->find("six")), 8); - ASSERT_EQ(group->count(group->find("half"), domain->find_region("top")), 8); - ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->find_region("top")), 8.0); + ASSERT_EQ(group->count(group->find("half"), domain->get_region_by_id("top")), 8); + ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->get_region_by_id("top")), 8.0); BEGIN_HIDE_OUTPUT(); command("write_restart group.restart"); @@ -243,9 +244,9 @@ TEST_F(GroupTest, Molecular) ASSERT_EQ(group->count(group->find("two")), 16); ASSERT_EQ(group->count(group->find("three")), 15); ASSERT_DOUBLE_EQ(group->mass(group->find("half")), 40); - ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->find_region("top")), 10); + ASSERT_DOUBLE_EQ(group->mass(group->find("half"), domain->get_region_by_id("top")), 10); ASSERT_NEAR(group->charge(group->find("top")), 0, 1.0e-14); - ASSERT_NEAR(group->charge(group->find("right"), domain->find_region("top")), 0, 1.0e-14); + ASSERT_NEAR(group->charge(group->find("right"), domain->get_region_by_id("top")), 0, 1.0e-14); TEST_FAILURE(".*ERROR: Illegal group command.*", command("group three include xxx");); } diff --git a/unittest/force-styles/tests/angle-cosine.yaml b/unittest/force-styles/tests/angle-cosine.yaml index 5a59fcce86..43629712d4 100644 --- a/unittest/force-styles/tests/angle-cosine.yaml +++ b/unittest/force-styles/tests/angle-cosine.yaml @@ -16,7 +16,8 @@ angle_coeff: ! | 3 50.0 4 100.0 equilibrium: 4 3.141592653589793 3.141592653589793 3.141592653589793 3.141592653589793 -extract: ! "" +extract: ! | + k 1 natoms: 29 init_energy: 1347.8670856939623 init_stress: ! |2- diff --git a/unittest/force-styles/tests/angle-harmonic.yaml b/unittest/force-styles/tests/angle-harmonic.yaml index dee700aa2c..d2164af8c5 100644 --- a/unittest/force-styles/tests/angle-harmonic.yaml +++ b/unittest/force-styles/tests/angle-harmonic.yaml @@ -16,7 +16,9 @@ angle_coeff: ! | 3 50.0 120.0 4 100.0 108.5 equilibrium: 4 1.9216075064457567 1.9373154697137058 2.0943951023931953 1.8936822384138476 -extract: ! "" +extract: ! | + k 1 + theta0 1 natoms: 29 init_energy: 41.53081789649104 init_stress: ! |2- diff --git a/unittest/force-styles/tests/bond-fene.yaml b/unittest/force-styles/tests/bond-fene.yaml index 88c02574cb..e5077eda0e 100644 --- a/unittest/force-styles/tests/bond-fene.yaml +++ b/unittest/force-styles/tests/bond-fene.yaml @@ -18,7 +18,7 @@ bond_coeff: ! | 5 450 2 0.018 1 equilibrium: 5 1.455 1.067 1.261 1.164 0.97 extract: ! | - kappa 1 + k 1 r0 1 natoms: 29 init_energy: 7104.900486467235 diff --git a/unittest/force-styles/tests/bond-fene_nm.yaml b/unittest/force-styles/tests/bond-fene_nm.yaml index c6be31a1c3..892d26c7aa 100644 --- a/unittest/force-styles/tests/bond-fene_nm.yaml +++ b/unittest/force-styles/tests/bond-fene_nm.yaml @@ -18,7 +18,7 @@ bond_coeff: ! | 5 450 2 0.018 1 12 6 equilibrium: 5 1.455 1.067 1.261 1.164 0.97 extract: ! | - kappa 1 + k 1 r0 1 natoms: 29 init_energy: 7104.538647187164 diff --git a/unittest/force-styles/tests/bond-gromos.yaml b/unittest/force-styles/tests/bond-gromos.yaml index a2f7e7ef3e..18abc99a3c 100644 --- a/unittest/force-styles/tests/bond-gromos.yaml +++ b/unittest/force-styles/tests/bond-gromos.yaml @@ -18,7 +18,7 @@ bond_coeff: ! | 5 450.0 1.0 equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | - kappa 1 + k 1 r0 1 natoms: 29 init_energy: 33.70930417641326 diff --git a/unittest/force-styles/tests/bond-harmonic.yaml b/unittest/force-styles/tests/bond-harmonic.yaml index 9ee14c07b9..bf686558d7 100644 --- a/unittest/force-styles/tests/bond-harmonic.yaml +++ b/unittest/force-styles/tests/bond-harmonic.yaml @@ -18,7 +18,7 @@ bond_coeff: ! | 5 450.0 1.0 equilibrium: 5 1.5 1.1 1.3 1.2 1 extract: ! | - kappa 1 + k 1 r0 1 natoms: 29 init_energy: 4.789374024601252 diff --git a/unittest/force-styles/tests/mol-pair-dpd.yaml b/unittest/force-styles/tests/mol-pair-dpd.yaml index 52aa755489..9fab36f51a 100644 --- a/unittest/force-styles/tests/mol-pair-dpd.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd.yaml @@ -2,7 +2,7 @@ lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:29 2022 epsilon: 5e-14 -skip_tests: gpu intel single +skip_tests: gpu intel kokkos_omp single prerequisites: ! | atom full pair dpd diff --git a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml index 09d52366ba..2619c97e0b 100644 --- a/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml +++ b/unittest/force-styles/tests/mol-pair-dpd_tstat.yaml @@ -2,7 +2,7 @@ lammps_version: 10 Feb 2021 date_generated: Fri Feb 26 23:08:44 2021 epsilon: 5e-14 -skip_tests: gpu intel single +skip_tests: gpu intel kokkos_omp single prerequisites: ! | atom full pair dpd/tstat diff --git a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml index a032e501dd..29cd06c4a9 100644 --- a/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_cut_tip4p_long_soft.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:32 2022 -epsilon: 2.5e-13 +epsilon: 1.0e-12 skip_tests: prerequisites: ! | atom full diff --git a/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml b/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml index 91c42f3bbd..78a20a9d19 100644 --- a/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml +++ b/unittest/force-styles/tests/mol-pair-tip4p_cut.yaml @@ -1,7 +1,7 @@ --- lammps_version: 17 Feb 2022 date_generated: Fri Mar 18 22:17:36 2022 -epsilon: 7.5e-13 +epsilon: 1.0e-11 skip_tests: prerequisites: ! | atom full