diff --git a/.github/release_steps.md b/.github/release_steps.md index 1ffd3cb291..b08c8e892a 100644 --- a/.github/release_steps.md +++ b/.github/release_steps.md @@ -104,8 +104,8 @@ with a future release) from the `lammps-static` folder. rm -rf release-packages mkdir release-packages cd release-packages -wget https://download.lammps.org/static/fedora41_musl.sif -apptainer shell fedora41_musl.sif +wget https://download.lammps.org/static/fedora41_musl_mingw.sif +apptainer shell fedora41_musl_mingw.sif git clone -b release --depth 10 https://github.com/lammps/lammps.git lammps-release cmake -S lammps-release/cmake -B build-release -G Ninja -D CMAKE_INSTALL_PREFIX=$PWD/lammps-static -D CMAKE_TOOLCHAIN_FILE=/usr/musl/share/cmake/linux-musl.cmake -C lammps-release/cmake/presets/most.cmake -C lammps-release/cmake/presets/kokkos-openmp.cmake -D DOWNLOAD_POTENTIALS=OFF -D BUILD_MPI=OFF -D BUILD_TESTING=OFF -D CMAKE_BUILD_TYPE=Release -D PKG_ATC=ON -D PKG_AWPMD=ON -D PKG_MANIFOLD=ON -D PKG_MESONT=ON -D PKG_MGPT=ON -D PKG_ML-PACE=ON -D PKG_ML-RANN=ON -D PKG_MOLFILE=ON -D PKG_PTM=ON -D PKG_QTB=ON -D PKG_SMTBQ=ON cmake --build build-release --target all @@ -204,7 +204,7 @@ cd .. rm -r release-packages ``` -#### Build Multi-arch App-bundle for macOS +#### Build Multi-arch App-bundle with GUI for macOS Building app-bundles for macOS is not as easily automated and portable as some of the other steps. It requires a machine actually running @@ -251,7 +251,7 @@ attached to the GitHub release page. We are currently building the application images on macOS 12 (aka Monterey). -#### Build Linux x86_64 binary tarball on Ubuntu 20.04LTS +#### Build Linux x86_64 binary tarball with GUI on Ubuntu 20.04LTS While the flatpak Linux version uses portable runtime libraries provided by the flatpak environment, we also build regular Linux executables that diff --git a/.github/workflows/check-cpp23.yml b/.github/workflows/check-cpp23.yml index 2cd53f2208..15b16e71e4 100644 --- a/.github/workflows/check-cpp23.yml +++ b/.github/workflows/check-cpp23.yml @@ -1,4 +1,4 @@ -# GitHub action to build LAMMPS on Linux with gcc and C++23 +# GitHub action to build LAMMPS on Linux with gcc or clang and C++23 name: "Check for C++23 Compatibility" on: @@ -11,11 +11,19 @@ on: workflow_dispatch: +concurrency: + group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{github.event_name == 'pull_request'}} + jobs: build: name: Build with C++23 support enabled if: ${{ github.repository == 'lammps/lammps' }} runs-on: ubuntu-latest + strategy: + max-parallel: 2 + matrix: + idx: [ gcc, clang ] env: CCACHE_DIR: ${{ github.workspace }}/.ccache @@ -29,8 +37,11 @@ jobs: run: | sudo apt-get update sudo apt-get install -y ccache \ - libeigen3-dev \ + clang \ libcurl4-openssl-dev \ + libeigen3-dev \ + libfftw3-dev \ + libomp-dev \ mold \ mpi-default-bin \ mpi-default-dev \ @@ -58,14 +69,14 @@ jobs: cmake -S cmake -B build \ -C cmake/presets/most.cmake \ -C cmake/presets/kokkos-openmp.cmake \ + -C cmake/presets/${{ matrix.idx }}.cmake \ -D CMAKE_CXX_STANDARD=23 \ - -D CMAKE_CXX_COMPILER=g++ \ - -D CMAKE_C_COMPILER=gcc \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_BUILD_TYPE=Debug \ -D CMAKE_CXX_FLAGS_DEBUG="-Og -g" \ -D DOWNLOAD_POTENTIALS=off \ + -D FFT=KISS \ -D BUILD_MPI=on \ -D BUILD_SHARED_LIBS=on \ -D BUILD_TOOLS=off \ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index a639c1d993..954bd7b4ac 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -7,6 +7,10 @@ if(CMAKE_VERSION VERSION_LESS 3.20) message(WARNING "LAMMPS is planning to require at least CMake version 3.20 by Summer 2025. Please upgrade!") endif() ######################################## +# initialize version variables with project command +if(POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +endif() # set policy to silence warnings about ignoring _ROOT but use it if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) @@ -27,7 +31,10 @@ endif() ######################################## -project(lammps CXX) +project(lammps + DESCRIPTION "The LAMMPS Molecular Dynamics Simulator" + HOMEPAGE_URL "https://www.lammps.org" + LANGUAGES CXX C) set(SOVERSION 0) get_property(BUILD_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -196,6 +203,10 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() +# do not include the (obsolete) MPI C++ bindings which makes for leaner object files +# and avoids namespace conflicts. Put this early to increase its visbility. +set(MPI_CXX_SKIP_MPICXX TRUE CACHE BOOL "Skip MPI C++ Bindings" FORCE) + ######################################################################## # User input options # ######################################################################## @@ -379,7 +390,6 @@ if(PKG_ADIOS) # The search for ADIOS2 must come before MPI because # it includes its own MPI search with the latest FindMPI.cmake # script that defines the MPI::MPI_C target - enable_language(C) find_package(ADIOS2 REQUIRED) if(BUILD_MPI) if(NOT ADIOS2_HAVE_MPI) @@ -394,21 +404,18 @@ if(PKG_ADIOS) endif() if(NOT CMAKE_CROSSCOMPILING) - find_package(MPI QUIET) + find_package(MPI QUIET COMPONENTS CXX) option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) else() option(BUILD_MPI "Build MPI version" OFF) endif() if(BUILD_MPI) - # do not include the (obsolete) MPI C++ bindings which makes - # for leaner object files and avoids namespace conflicts - set(MPI_CXX_SKIP_MPICXX TRUE) # We use a non-standard procedure to cross-compile with MPI on Windows if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) include(MPI4WIN) else() - find_package(MPI REQUIRED) + find_package(MPI REQUIRED COMPONENTS CXX) option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) if(LAMMPS_LONGLONG_TO_LONG) target_compile_definitions(lammps PRIVATE -DLAMMPS_LONGLONG_TO_LONG) @@ -535,7 +542,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_STANDARD GREATER_EQUA endif() if(PKG_ATC OR PKG_AWPMD OR PKG_ML-QUIP OR PKG_ML-POD OR PKG_ELECTRODE OR PKG_RHEO OR BUILD_TOOLS) - enable_language(C) if (NOT USE_INTERNAL_LINALG) find_package(LAPACK) find_package(BLAS) diff --git a/cmake/Modules/LAMMPSInterfacePlugin.cmake b/cmake/Modules/LAMMPSInterfacePlugin.cmake index 5b7444f62c..a449f5b3dd 100644 --- a/cmake/Modules/LAMMPSInterfacePlugin.cmake +++ b/cmake/Modules/LAMMPSInterfacePlugin.cmake @@ -62,6 +62,9 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") endif() set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +# skip over obsolete MPI-2 C++ bindings +set(MPI_CXX_SKIP_MPICXX TRUE) + ####### # helper functions from LAMMPSUtils.cmake function(validate_option name values) @@ -128,8 +131,7 @@ endif() ################################################################################ # MPI configuration if(NOT CMAKE_CROSSCOMPILING) - set(MPI_CXX_SKIP_MPICXX TRUE) - find_package(MPI QUIET) + find_package(MPI QUIET COMPONENTS CXX) option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) else() option(BUILD_MPI "Build MPI version" OFF) @@ -141,78 +143,38 @@ if(BUILD_MPI) set(MPI_CXX_SKIP_MPICXX TRUE) # We use a non-standard procedure to cross-compile with MPI on Windows if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) - # Download and configure MinGW compatible MPICH development files for Windows - option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF) - if(USE_MSMPI) - message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation") - set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball") - set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball") - mark_as_advanced(MPICH2_WIN64_DEVEL_URL) - mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) + message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation") + set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball") + set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball") + mark_as_advanced(MPICH2_WIN64_DEVEL_URL) + mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) - include(ExternalProject) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN64_DEVEL_URL} - URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmsmpi.a) - else() - message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI") - endif() - - ExternalProject_get_property(mpi4win_build SOURCE_DIR) - file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - add_library(MPI::MPI_CXX UNKNOWN IMPORTED) - set_target_properties(MPI::MPI_CXX PROPERTIES - IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a" - INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" - INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - add_dependencies(MPI::MPI_CXX mpi4win_build) - - # set variables for status reporting at the end of CMake run - set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") - set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a") + include(ExternalProject) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + ExternalProject_Add(mpi4win_build + URL ${MPICH2_WIN64_DEVEL_URL} + URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} + CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" + BUILD_BYPRODUCTS /lib/libmsmpi.a) else() - # Download and configure custom MPICH files for Windows - message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows") - set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball") - set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball") - mark_as_advanced(MPICH2_WIN64_DEVEL_URL) - mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) - - include(ExternalProject) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN64_DEVEL_URL} - URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmpi.a) - else() - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN32_DEVEL_URL} - URL_MD5 ${MPICH2_WIN32_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmpi.a) - endif() - - ExternalProject_get_property(mpi4win_build SOURCE_DIR) - file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - add_library(MPI::MPI_CXX UNKNOWN IMPORTED) - set_target_properties(MPI::MPI_CXX PROPERTIES - IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a" - INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" - INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - add_dependencies(MPI::MPI_CXX mpi4win_build) - - # set variables for status reporting at the end of CMake run - set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") - set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a") + message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI") endif() + + ExternalProject_get_property(mpi4win_build SOURCE_DIR) + file(MAKE_DIRECTORY "${SOURCE_DIR}/include") + add_library(MPI::MPI_CXX UNKNOWN IMPORTED) + set_target_properties(MPI::MPI_CXX PROPERTIES + IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a" + INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" + INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1") + add_dependencies(MPI::MPI_CXX mpi4win_build) + + # set variables for status reporting at the end of CMake run + set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") + set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1") + set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a") else() - find_package(MPI REQUIRED) + find_package(MPI REQUIRED COMPONENTS CXX) option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) if(LAMMPS_LONGLONG_TO_LONG) target_compile_definitions(lammps INTERFACE -DLAMMPS_LONGLONG_TO_LONG) diff --git a/cmake/Modules/LAMMPSUtils.cmake b/cmake/Modules/LAMMPSUtils.cmake index 4675788647..93f541f921 100644 --- a/cmake/Modules/LAMMPSUtils.cmake +++ b/cmake/Modules/LAMMPSUtils.cmake @@ -75,13 +75,25 @@ function(get_lammps_version version_header variable) list(FIND MONTHS "${month}" month) string(LENGTH ${day} day_length) string(LENGTH ${month} month_length) - if(day_length EQUAL 1) - set(day "0${day}") + # no leading zero needed for new version string with dots + # if(day_length EQUAL 1) + # set(day "0${day}") + # endif() + # if(month_length EQUAL 1) + # set(month "0${month}") + #endif() + file(STRINGS ${version_header} line REGEX LAMMPS_UPDATE) + string(REGEX REPLACE "#define LAMMPS_UPDATE \"Update ([0-9]+)\"" "\\1" tweak "${line}") + if (line MATCHES "#define LAMMPS_UPDATE \"(Maintenance|Development)\"") + set(tweak "99") endif() - if(month_length EQUAL 1) - set(month "0${month}") + if(NOT tweak) + set(tweak "0") endif() - set(${variable} "${year}${month}${day}" PARENT_SCOPE) + # new version string with dots + set(${variable} "${year}.${month}.${day}.${tweak}" PARENT_SCOPE) + # old version string without dots + # set(${variable} "${year}${month}${day}" PARENT_SCOPE) endfunction() function(check_for_autogen_files source_dir) diff --git a/cmake/Modules/MPI4WIN.cmake b/cmake/Modules/MPI4WIN.cmake index 02db6d4744..cd48ab279e 100644 --- a/cmake/Modules/MPI4WIN.cmake +++ b/cmake/Modules/MPI4WIN.cmake @@ -1,74 +1,31 @@ -# Download and configure MinGW compatible MPICH development files for Windows -option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF) +# set-up MS-MPI library for Windows with MinGW compatibility +message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation") +set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball") +set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball") +mark_as_advanced(MPICH2_WIN64_DEVEL_URL) +mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) -if(USE_MSMPI) - message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation") - set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball") - set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball") - mark_as_advanced(MPICH2_WIN64_DEVEL_URL) - mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) - - include(ExternalProject) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN64_DEVEL_URL} - URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmsmpi.a) - else() - message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI") - endif() - - ExternalProject_get_property(mpi4win_build SOURCE_DIR) - file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - add_library(MPI::MPI_CXX UNKNOWN IMPORTED) - set_target_properties(MPI::MPI_CXX PROPERTIES - IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a" - INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" - INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - add_dependencies(MPI::MPI_CXX mpi4win_build) - - # set variables for status reporting at the end of CMake run - set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") - set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a") +include(ExternalProject) +if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + ExternalProject_Add(mpi4win_build + URL ${MPICH2_WIN64_DEVEL_URL} + URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} + CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" + BUILD_BYPRODUCTS /lib/libmsmpi.a) else() - message(STATUS "Downloading and configuring MPICH2-1.4.1 for Windows cross-compilation") - set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball") - set(MPICH2_WIN32_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win32-devel.tar.gz" CACHE STRING "URL for MPICH2 (win32) tarball") - set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball") - set(MPICH2_WIN32_DEVEL_MD5 "a61d153500dce44e21b755ee7257e031" CACHE STRING "MD5 checksum of MPICH2 (win32) tarball") - mark_as_advanced(MPICH2_WIN64_DEVEL_URL) - mark_as_advanced(MPICH2_WIN32_DEVEL_URL) - mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) - mark_as_advanced(MPICH2_WIN32_DEVEL_MD5) - - include(ExternalProject) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN64_DEVEL_URL} - URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmpi.a) - else() - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN32_DEVEL_URL} - URL_MD5 ${MPICH2_WIN32_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmpi.a) - endif() - - ExternalProject_get_property(mpi4win_build SOURCE_DIR) - file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - add_library(MPI::MPI_CXX UNKNOWN IMPORTED) - set_target_properties(MPI::MPI_CXX PROPERTIES - IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a" - INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" - INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - add_dependencies(MPI::MPI_CXX mpi4win_build) - - # set variables for status reporting at the end of CMake run - set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") - set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a") + message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI") endif() + +ExternalProject_get_property(mpi4win_build SOURCE_DIR) +file(MAKE_DIRECTORY "${SOURCE_DIR}/include") +add_library(MPI::MPI_CXX UNKNOWN IMPORTED) +set_target_properties(MPI::MPI_CXX PROPERTIES + IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a" + INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" + INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1") +add_dependencies(MPI::MPI_CXX mpi4win_build) + +# set variables for status reporting at the end of CMake run +set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") +set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1") +set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a") diff --git a/cmake/Modules/Packages/COLVARS.cmake b/cmake/Modules/Packages/COLVARS.cmake index b4dc738626..afef315120 100644 --- a/cmake/Modules/Packages/COLVARS.cmake +++ b/cmake/Modules/Packages/COLVARS.cmake @@ -27,7 +27,6 @@ if(BUILD_OMP) endif() if(BUILD_MPI) - target_compile_definitions(colvars PUBLIC -DCOLVARS_MPI) target_link_libraries(colvars PUBLIC MPI::MPI_CXX) endif() diff --git a/cmake/Modules/Packages/GPU.cmake b/cmake/Modules/Packages/GPU.cmake index 6d0ce303a5..dd4ac31025 100644 --- a/cmake/Modules/Packages/GPU.cmake +++ b/cmake/Modules/Packages/GPU.cmake @@ -189,7 +189,7 @@ if(GPU_API STREQUAL "CUDA") endif() add_executable(nvc_get_devices ${LAMMPS_LIB_SOURCE_DIR}/gpu/geryon/ucl_get_devices.cpp) - target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR) + target_compile_definitions(nvc_get_devices PRIVATE -DUCL_CUDADR -DLAMMPS_${LAMMPS_SIZES}) target_link_libraries(nvc_get_devices PRIVATE ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY}) target_include_directories(nvc_get_devices PRIVATE ${CUDA_INCLUDE_DIRS}) @@ -489,7 +489,7 @@ else() target_link_libraries(gpu PRIVATE mpi_stubs) endif() -target_compile_definitions(gpu PRIVATE -DLAMMPS_${LAMMPS_SIZES}) set_target_properties(gpu PROPERTIES OUTPUT_NAME lammps_gpu${LAMMPS_MACHINE}) +target_compile_definitions(gpu PRIVATE -DLAMMPS_${LAMMPS_SIZES}) target_sources(lammps PRIVATE ${GPU_SOURCES}) target_include_directories(lammps PRIVATE ${GPU_SOURCES_DIR}) diff --git a/cmake/Modules/Testing.cmake b/cmake/Modules/Testing.cmake index a72ce17e1b..7aa3506642 100644 --- a/cmake/Modules/Testing.cmake +++ b/cmake/Modules/Testing.cmake @@ -21,11 +21,11 @@ if(ENABLE_TESTING) # also only verified with Fedora Linux > 30 and Ubuntu 18.04 or 22.04+(Ubuntu 20.04 fails) if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))) - if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND - ((CMAKE_DISTRO_VERSION VERSION_LESS_EQUAL 18.04) OR (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04))) + if(((CMAKE_LINUX_DISTRO STREQUAL "Ubuntu") AND (CMAKE_DISTRO_VERSION VERSION_GREATER_EQUAL 22.04)) OR ((CMAKE_LINUX_DISTRO STREQUAL "Fedora") AND (CMAKE_DISTRO_VERSION VERSION_GREATER 30))) include(CheckCXXCompilerFlag) set(CMAKE_CUSTOM_LINKER_DEFAULT default) + check_cxx_compiler_flag(--ld-path=${CMAKE_LINKER} HAVE_LD_PATH_FLAG) check_cxx_compiler_flag(-fuse-ld=mold HAVE_MOLD_LINKER_FLAG) check_cxx_compiler_flag(-fuse-ld=lld HAVE_LLD_LINKER_FLAG) check_cxx_compiler_flag(-fuse-ld=gold HAVE_GOLD_LINKER_FLAG) @@ -50,6 +50,17 @@ if(ENABLE_TESTING) if(NOT "${CMAKE_CUSTOM_LINKER}" STREQUAL "default") target_link_options(lammps PUBLIC -fuse-ld=${CMAKE_CUSTOM_LINKER}) endif() + if(HAVE_LD_PATH_FLAG) + if("${CMAKE_CUSTOM_LINKER}" STREQUAL "mold") + target_link_options(lammps PUBLIC --ld-path=${HAVE_MOLD_LINKER_BIN}) + elseif("${CMAKE_CUSTOM_LINKER}" STREQUAL "lld") + target_link_options(lammps PUBLIC --ld-path=${HAVE_LLD_LINKER_BIN}) + elseif("${CMAKE_CUSTOM_LINKER}" STREQUAL "gold") + target_link_options(lammps PUBLIC --ld-path=${HAVE_GOLD_LINKER_BIN}) + elseif("${CMAKE_CUSTOM_LINKER}" STREQUAL "bfd") + target_link_options(lammps PUBLIC --ld-path=${HAVE_BFD_LINKER_BIN}) + endif() + endif() endif() endif() diff --git a/cmake/presets/hip_amd.cmake b/cmake/presets/hip_amd.cmake index 4b8945e0c7..2cf28c05c4 100644 --- a/cmake/presets/hip_amd.cmake +++ b/cmake/presets/hip_amd.cmake @@ -19,12 +19,19 @@ set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "" FORCE) set(MPI_CXX "hipcc" CACHE STRING "" FORCE) set(MPI_CXX_COMPILER "mpicxx" CACHE STRING "" FORCE) +set(MPI_C "hipcc" CACHE STRING "" FORCE) +set(MPI_C_COMPILER "mpicc" CACHE STRING "" FORCE) + +# change as needed. This is for Fedora Linux 41 and 42 +set(_libomp_root "/usr/lib/clang/18") +# we need to explicitly specify the include dir, since hipcc will +# compile each file twice and doesn't find omp.h the second time unset(HAVE_OMP_H_INCLUDE CACHE) set(OpenMP_C "hipcc" CACHE STRING "" FORCE) -set(OpenMP_C_FLAGS "-fopenmp" CACHE STRING "" FORCE) +set(OpenMP_C_FLAGS "-fopenmp=libomp -I${_libomp_root}/include" CACHE STRING "" FORCE) set(OpenMP_C_LIB_NAMES "omp" CACHE STRING "" FORCE) set(OpenMP_CXX "hipcc" CACHE STRING "" FORCE) -set(OpenMP_CXX_FLAGS "-fopenmp" CACHE STRING "" FORCE) +set(OpenMP_CXX_FLAGS "-fopenmp=libomp -I${_libomp_root}/include" CACHE STRING "" FORCE) set(OpenMP_CXX_LIB_NAMES "omp" CACHE STRING "" FORCE) set(OpenMP_omp_LIBRARY "libomp.so" CACHE PATH "" FORCE) diff --git a/cmake/presets/kokkos-hip.cmake b/cmake/presets/kokkos-hip.cmake index c1968c0ffa..58b09020fb 100644 --- a/cmake/presets/kokkos-hip.cmake +++ b/cmake/presets/kokkos-hip.cmake @@ -1,8 +1,8 @@ -# preset that enables KOKKOS and selects HIP compilation with OpenMP -# enabled as well. Also sets some performance related compiler flags. +# preset that enables KOKKOS and selects HIP compilation withOUT OpenMP. +# Kokkos OpenMP is not compatible with the second pass of hipcc. 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_OPENMP OFF CACHE BOOL "" FORCE) set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "" FORCE) set(Kokkos_ENABLE_HIP ON CACHE BOOL "" FORCE) set(Kokkos_ARCH_VEGA90A on CACHE BOOL "" FORCE) @@ -11,11 +11,11 @@ set(BUILD_OMP ON CACHE BOOL "" FORCE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -munsafe-fp-atomics" CACHE STRING "" FORCE) -# If KSPACE is also enabled, use CUFFT for FFTs +# If KSPACE is also enabled, use HIPFFT for FFTs set(FFT_KOKKOS "HIPFFT" CACHE STRING "" FORCE) # hide deprecation warnings temporarily for stable release -set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) +#set(Kokkos_ENABLE_DEPRECATION_WARNINGS OFF CACHE BOOL "" FORCE) # these flags are needed to build with Cray MPICH on OLCF Crusher #-D CMAKE_CXX_FLAGS="-I/${MPICH_DIR}/include" diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 0da6796430..700abe0c2b 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -29,6 +29,7 @@ OPT. * :doc:`ave/grid ` * :doc:`ave/histo ` * :doc:`ave/histo/weight ` + * :doc:`ave/moments ` * :doc:`ave/time ` * :doc:`aveforce ` * :doc:`balance ` @@ -218,6 +219,7 @@ OPT. * :doc:`rigid/small (o) ` * :doc:`rx (k) ` * :doc:`saed/vtk ` + * :doc:`set ` * :doc:`setforce (k) ` * :doc:`setforce/spin ` * :doc:`sgcmc ` diff --git a/doc/src/Developer_updating.rst b/doc/src/Developer_updating.rst index 21980be3d8..ff914b2777 100644 --- a/doc/src/Developer_updating.rst +++ b/doc/src/Developer_updating.rst @@ -29,6 +29,7 @@ Available topics in mostly chronological order are: - `Rename of fix STORE/PERATOM to fix STORE/ATOM and change of arguments`_ - `Use Output::get_dump_by_id() instead of Output::find_dump()`_ - `Refactored grid communication using Grid3d/Grid2d classes instead of GridComm`_ +- `FLERR as first argument to minimum image functions in Domain class`_ ---- @@ -610,3 +611,47 @@ KSpace solvers which use distributed FFT grids: - ``src/KSPACE/pppm.cpp`` This change is **required** or else the code will not compile. + +FLERR as first argument to minimum image functions in Domain class +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionchanged:: TBD + +The ``Domain::minimum_image()`` and ``Domain::minimum_image_big()`` +functions were changed to take the ``FLERR`` macros as first argument. +This way the error message indicates *where* the function was called +instead of pointing to the implementation of the function. Example: + +Old: + +.. code-block:: c++ + + 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_big(delx2, dely2, delz2); + double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); + +New: + +.. code-block:: c++ + + 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(FLERR, 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_big(FLERR, delx2, dely2, delz2); + double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); + +This change is **required** or else the code will not compile. diff --git a/doc/src/Speed_compare.rst b/doc/src/Speed_compare.rst index 3f72e5d715..d59c37c34d 100644 --- a/doc/src/Speed_compare.rst +++ b/doc/src/Speed_compare.rst @@ -75,15 +75,34 @@ section below for examples where this has been done. **Differences between the GPU and KOKKOS packages:** * The GPU package accelerates only pair force, neighbor list, and (parts - of) PPPM calculations. The KOKKOS package attempts to run most of the + of) PPPM calculations (and runs the remaining force computations on + the CPU concurrently). The KOKKOS package attempts to run most of the calculation on the GPU, but can transparently support non-accelerated code (with a performance penalty due to having data transfers between host and GPU). +* The list of which styles are accelerated by the GPU or KOKKOS package + differs with some overlap. * The GPU package requires neighbor lists to be built on the CPU when using hybrid pair styles, exclusion lists, or a triclinic simulation box. -* The GPU package can be compiled for CUDA, HIP, or OpenCL and thus supports - NVIDIA, AMD, and Intel GPUs well. On NVIDIA hardware, using CUDA is - typically resulting in equal or better performance over OpenCL. -* OpenCL in the GPU package does theoretically also support Intel CPUs or - Intel Xeon Phi, but the native support for those in KOKKOS (or INTEL) - is superior. +* The GPU package benefits from running multiple MPI processes (2-8) per + GPU to parallelize the non-GPU accelerated styles. The KOKKOS package + usually not, especially when all parts of the calculation have KOKKOS + support. +* The GPU package can be compiled for CUDA, HIP, or OpenCL and thus + supports NVIDIA, AMD, and Intel GPUs well. On NVIDIA or AMD hardware, + using native CUDA or HIP compilation, respectively, with either GPU or + KOKKOS results in equal or better performance over OpenCL. +* OpenCL in the GPU package supports NVIDIA, AMD, and Intel GPUs at the + *same time* and with the *same executable*. KOKKOS currently does not + support OpenCL. +* The GPU package supports single precision floating point, mixed + precision floating point, and double precision floating point math on + the GPU. This must be chosen at compile time. KOKKOS currently only + supports double precision floating point math. Using single or mixed + precision (recommended) results in significantly improved performance + on consumer GPUs for some loss in accuracy (which is rather small with + mixed precision). Single and mixed precision support for KOKKOS is in + development (no ETA yet). +* Some pair styles (for example :doc:`snap `, :doc:`mliap + ` or :doc:`reaxff ` in the KOKKOS package have + seen extensive optimizations and specializations for GPUs and CPUs. diff --git a/doc/src/Speed_measure.rst b/doc/src/Speed_measure.rst index 888e8d9790..2fe838cb22 100644 --- a/doc/src/Speed_measure.rst +++ b/doc/src/Speed_measure.rst @@ -1,16 +1,218 @@ Measuring performance ===================== -Before trying to make your simulation run faster, you should -understand how it currently performs and where the bottlenecks are. +Factors that influence performance +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The best way to do this is run the your system (actual number of -atoms) for a modest number of timesteps (say 100 steps) on several -different processor counts, including a single processor if possible. -Do this for an equilibrium version of your system, so that the -100-step timings are representative of a much longer run. There is -typically no need to run for 1000s of timesteps to get accurate -timings; you can simply extrapolate from short runs. +Before trying to make your simulation run faster, you should understand +how it currently performs and where the bottlenecks are. We generally +distinguish between serial performance (how fast can a single process do +the calculations?) and parallel efficiency (how much faster does a +calculation get by using more processes?). There are many factors +affecting either and below are some lists discussing some commonly +known but also some less known factors. + +Factors affecting serial performance (in no specific order): + +* CPU hardware: clock rate, cache sizes, CPU architecture (instructions + per clock, vectorization support, fused multiply-add support and more) +* RAM speed and number of channels that the CPU can use to access RAM +* Cooling: CPUs can change the CPU clock based on thermal load, thus the + degree of cooling can affect the speed of a CPU. Sometimes even the + temperature of neighboring compute nodes in a cluster can make a + difference. +* Compiler optimization: most of LAMMPS is written to be easy to modify + and thus compiler optimization can speed up calculations. However, too + aggressive compiler optimization can produce incorrect results or + crashes (during compilation or at runtime). +* Source code improvements: styles in the OPT, OPENMP, and INTEL package + can be faster than their base implementation due to improved data + access patterns, cache efficiency, or vectorization. Compiler optimization + is required to take full advantage of these. +* Number and kind of fixes, computes, or variables used during a simulation, + especially if they result in collective communication operations +* Pair style cutoffs and system density: calculations get slower the more + neighbors are in the neighbor list and thus for which interactions need + to be computed. Force fields with pair styles that compute interactions + between triples or quadruples of atoms or that use embedding energies or + charge equilibration will need to walk the neighbor lists multiple times. +* Neighbor list settings: tradeoff between neighbor list skin (larger + skin = more neighbors, more distances to compute before applying the + cutoff) and frequency of neighbor list builds (larger skin = fewer + neighbor list builds). +* Proximity of per-atom data in physical memory that for atoms that are + close in space improves cache efficiency (thus LAMMPS will by default + sort atoms in local storage accordingly) +* Using r-RESPA multi-timestepping or a SHAKE or RATTLE fix to constrain + bonds with higher-frequency vibrations may allow a larger (outer) timestep + and thus fewer force evaluations (usually the most time consuming step in + MD) for the same simulated time (with some tradeoff in accuracy). + +Factors affecting parallel efficiency (in no specific order): + +* Bandwidth and latency of communication between processes. This can vary a + lot between processes on the same CPU or physical node and processes + on different physical nodes and there vary between different + communication technologies (like Ethernet or InfiniBand or other + high-speed interconnects) +* Frequency and complexity of communication patterns required +* Number of "work units" (usually correlated with the number of atoms + and choice of force field) per MPI-process required for one time step + (if this number becomes too small, the cost of communication becomes + dominant). +* Choice of parallelization method (MPI-only, OpenMP-only, MPI+OpenMP, + MPI+GPU, MPI+GPU+OpenMP) +* Algorithmic complexity of the chosen force field (pair-wise vs. many-body + potential, Ewald vs. PPPM vs. (compensated or smoothed) cutoff-Coulomb) +* Communication cutoff: a larger cutoff results in more ghost atoms and + thus more data that needs to be communicated +* Frequency of neighbor list builds: during a neighbor list build the + domain decomposition is updated and the list of ghost atoms rebuilt + which requires multiple global communication steps +* FFT-grid settings and number of MPI processes for kspace style PPPM: + PPPM uses parallel 3d FFTs which will drop much faster in parallel + efficiency with respect to the number of MPI processes than other + parts of the force computation. Thus using MPI+OpenMP parallelization + or :doc:`run style verlet/split ` can improve parallel + efficiency by limiting the number of MPI processes used for the FFTs. +* Load (im-)balance: LAMMPS' domain decomposition assumes that atoms are + evenly distributed across the entire simulation box. If there are + areas of vacuum, this may lead to different amounts of work for + different MPI processes. Using the :doc:`processors command + ` to change the spatial decomposition, or MPI+OpenMP + parallelization instead of only-MPI to have larger sub-domains, or the + (fix) balance command (without or with switching to communication style + tiled) to change the sub-domain volumes are all methods that + can help to avoid load imbalances. + +Examples comparing serial performance +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Before looking at your own input deck(s), you should get some reference +data from a known input so that you know what kind of performance you +should expect from your input. For the following we therefore use the +``in.rhodo.scaled`` input file and ``data.rhodo`` data file from the +``bench`` folder. This is a system of 32000 atoms using the CHARMM force +field and long-range electrostatics running for 100 MD steps. The +performance data is printed at the end of a run and only measures the +performance during propagation and excludes the setup phase. + +Running with a single MPI process on an AMD Ryzen Threadripper PRO +9985WX CPU (64 cores, 128 threads, base clock: 3.2GHz, max. clock +5.4GHz, L1/L2/L3 cache 5MB/64MB/256MB, 8 DDR5-6400 memory channels) one +gets the following performance report: + +.. code-block:: + + Performance: 1.232 ns/day, 19.476 hours/ns, 7.131 timesteps/s, 228.197 katom-step/s + 99.2% CPU use with 1 MPI tasks x 1 OpenMP threads + +The %CPU value should be at 100% or very close. Lower values would +be an indication that there are *other* processes also using the same +CPU core and thus invalidating the performance data. The katom-step/s +value is best suited for comparisons, since it is fairly independent +from the system size. The `in.rhodo.scaled` input can be easily made +larger through replication in the three dimensions by settings variables +"x", "y", "z" to values other than 1 from the command line with the +"-var" flag. Example: + +- 32000 atoms: 228.8 katom-step/s +- 64000 atoms: 231.6 katom-step/s +- 128000 atoms: 231.1 katom-step/s +- 256000 atoms: 226.4 katom-step/s +- 864000 atoms: 229.6 katom-step/s + +Comparing to an AMD Ryzen 7 7840HS CPU (8 cores, 16 threads, base clock +3.8GHz, max. clock 5.1GHz, L1/L2/L3 cache 512kB/8MB/16MB, 2 DDR5-5600 +memory channels), we get similar single core performance (~220 +katom-step/s vs. ~230 katom-step/s) due to the similar clock and +architecture: + +- 32000 atoms: 219.8 katom-step/s +- 64000 atoms: 222.5 katom-step/s +- 128000 atoms: 216.8 katom-step/s +- 256000 atoms: 221.0 katom-step/s +- 864000 atoms: 221.1 katom-step/s + +Switching to an older Intel Xeon E5-2650 v4 CPU (12 cores, 12 threads, +base clock 2.2GHz, max. clock 2.9GHz, L1/L2/L3 cache (64kB/256kB/30MB, 4 +DDR4-2400 memory channels) leads to a lower performance of approximately +109 katom-step/s due to differences in architecture and clock. In all +cases, when looking at multiple runs, the katom-step/s property +fluctuates by approximately 1% around the average. + +From here on we are looking at the performance for the 256000 atom system only +and change several settings incrementally: + +#. No compiler optimization GCC (-Og -g): 183.8 katom-step/s +#. Moderate optimization with debug info GCC (-O2 -g): 231.1 katom-step/s +#. Full compiler optimization GCC (-DNDEBUG -O3): 236.0 katom-step/s +#. Aggressive compiler optimization GCC (-O3 -ffast-math -march=native): 239.9 katom-step/s +#. Source code optimization in OPENMP package (1 thread): 266.7 katom-step/s +#. Use *fix nvt* instead of *fix npt* (compute virial only every 50 steps): 272.9 katom-step/s +#. Increase pair style cutoff by 2 :math:`\AA`: 181.2 katom-step/s +#. Use tight PPPM convergence (1.0e-6 instead of 1.0e-4): 161.9 katom-step/s +#. Use Ewald summation instead of PPPM (at 1.0e-4 convergence): 19.9 katom-step/s + +The numbers show that gains from aggressive compiler optimizations are +rather small in LAMMPS, the data access optimizations in the OPENMP (and +OPT) packages are more prominent. On the other side, using more +accurate force field settings causes, not unexpectedly, a significant +slowdown (to about half the speed). Finally, using regular Ewald +summation causes a massive slowdown due to the bad algorithmic scaling +with system size. + +Examples comparing parallel performance +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The parallel performance usually goes on top of the serial performance. +Using twice as many processors should increase the performance metric +by up to a factor of two. With the number of processors *N* and the +serial performance :math:`p_1` and the performance for *N* processors +:math:`p_N` we can define a *parallel efficiency* in percent as follows: + +.. math:: + + P_{eff} = \frac{p_N}{p_1 \cdot N} \cdot 100\% + +For the AMD Ryzen Threadripper PRO 9985WX CPU and the serial +simulation settings of point 6. from above, we get the following +parallel efficiency data for the 256000 atom system: + +- 1 MPI task: 273.6 katom-step/s, :math:`P_{eff} = 100\%` +- 2 MPI tasks: 530.6 katom-step/s, :math:`P_{eff} = 97\%` +- 4 MPI tasks: 1.021 Matom-step/s, :math:`P_{eff} = 93\%` +- 8 MPI tasks: 1.837 Matom-step/s, :math:`P_{eff} = 84\%` +- 16 MPI tasks: 3.574 Matom-step/s, :math:`P_{eff} = 82\%` +- 32 MPI tasks: 6.479 Matom-step/s, :math:`P_{eff} = 74\%` +- 64 MPI tasks: 9.032 Matom-step/s, :math:`P_{eff} = 52\%` +- 128 MPI tasks: 12.03 Matom-step/s, :math:`P_{eff} = 34\%` + +The 128 MPI tasks run uses CPU cores from hyper-threading. + +For a small system with only 32000 atoms the parallel efficiency +drops off earlier when the number of work units is too small relative +to the communication overhead: + +- 1 MPI task: 270.8 katom-step/s, :math:`P_{eff} = 100\%` +- 2 MPI tasks: 529.3 katom-step/s, :math:`P_{eff} = 98\%` +- 4 MPI tasks: 989.8 katom-step/s, :math:`P_{eff} = 91\%` +- 8 MPI tasks: 1.832 Matom-step/s, :math:`P_{eff} = 85\%` +- 16 MPI tasks: 3.463 Matom-step/s, :math:`P_{eff} = 80\%` +- 32 MPI tasks: 5.970 Matom-step/s, :math:`P_{eff} = 69\%` +- 64 MPI tasks: 7.477 Matom-step/s, :math:`P_{eff} = 42\%` +- 128 MPI tasks: 8.069 Matom-step/s, :math:`P_{eff} = 23\%` + +Measuring performance of your input deck +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The best way to do this is run the your system (actual number of atoms) +for a modest number of timesteps (say 100 steps) on several different +processor counts, including a single processor if possible. Do this for +an equilibrium version of your system, so that the 100-step timings are +representative of a much longer run. There is typically no need to run +for 1000s of timesteps to get accurate timings; you can simply +extrapolate from short runs. For the set of runs, look at the timing data printed to the screen and log file at the end of each LAMMPS run. The @@ -28,12 +230,15 @@ breakdown and relative percentages. For example, trying different options for speeding up the long-range solvers will have little impact if they only consume 10% of the run time. If the pairwise time is dominating, you may want to look at GPU or OMP versions of the pair -style, as discussed below. Comparing how the percentages change as -you increase the processor count gives you a sense of how different -operations within the timestep are scaling. Note that if you are -running with a Kspace solver, there is additional output on the -breakdown of the Kspace time. For PPPM, this includes the fraction -spent on FFTs, which can be communication intensive. +style, as discussed below. Comparing how the percentages change as you +increase the processor count gives you a sense of how different +operations within the timestep are scaling. If you are using PPPM as +Kspace solver, you can turn on an additional output with +:doc:`kspace_modify fftbench yes ` which measures the +time spent during PPPM on the 3d FFTs, which can be communication +intensive for larger processor counts. This provides an indication +whether it is worth trying out alternatives to the default FFT settings +for additional performance. Another important detail in the timing info are the histograms of atoms counts and neighbor counts. If these vary widely across diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 0bd91adaac..bb0545e406 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -208,6 +208,7 @@ accelerated styles exist. * :doc:`ave/grid ` - compute per-grid time-averaged quantities * :doc:`ave/histo ` - compute/output time-averaged histograms * :doc:`ave/histo/weight ` - weighted version of fix ave/histo +* :doc:`ave/moments ` - compute moments of scalar quantities * :doc:`ave/time ` - compute/output global time-averaged quantities * :doc:`aveforce ` - add an averaged force to each atom * :doc:`balance ` - perform dynamic load-balancing @@ -397,6 +398,7 @@ accelerated styles exist. * :doc:`rigid/small ` - constrain many small clusters of atoms to move as a rigid body with NVE integration * :doc:`rx ` - solve reaction kinetic ODEs for a defined reaction set * :doc:`saed/vtk ` - time-average the intensities from :doc:`compute saed ` +* :doc:`set ` - reset an atom property via an atom-style variable every N steps * :doc:`setforce ` - set the force on each atom * :doc:`setforce/spin ` - set magnetic precession vectors on each atom * :doc:`sgcmc ` - fix for hybrid semi-grand canonical MD/MC simulations diff --git a/doc/src/fix_ave_correlate_long.rst b/doc/src/fix_ave_correlate_long.rst index 22fac89706..97b68fe14f 100644 --- a/doc/src/fix_ave_correlate_long.rst +++ b/doc/src/fix_ave_correlate_long.rst @@ -82,10 +82,9 @@ specified values may represent calculations performed by computes and fixes which store their own "group" definitions. Each listed value can be the result of a compute or fix or the -evaluation of an equal-style or vector-style variable. For -vector-style variables, the specified indices can include a wildcard -character. See the :doc:`fix ave/correlate ` page -for details. +evaluation of an equal-style or vector-style variable. The specified +indices can include a wildcard string. See the +:doc:`fix ave/correlate ` page for details on that. The *Nevery* and *Nfreq* arguments specify on what time steps the input values will be used to calculate correlation data and the frequency diff --git a/doc/src/fix_ave_moments.rst b/doc/src/fix_ave_moments.rst new file mode 100644 index 0000000000..b80cdf5db9 --- /dev/null +++ b/doc/src/fix_ave_moments.rst @@ -0,0 +1,296 @@ +.. index:: fix ave/moments + +fix ave/moments command +======================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + fix ID group-ID ave/moments Nevery Nrepeat Nfreq value1 value2 ... moment1 moment2 ... keyword args ... + +* ID, group-ID are documented in :doc:`fix ` command +* ave/moments = style name of this fix command +* Nevery = use input values every this many time steps +* Nrepeat = # of times to use input values for calculating averages +* Nfreq = calculate averages every this many time steps +* one or more input variables can be listed +* value = v_name + + .. parsed-literal:: + + c_ID = global scalar calculated by a compute with ID + c_ID[I] = Ith component of global vector calculated by a compute with ID, I can include wildcard (see below) + f_ID = global scalar calculated by a fix with ID + f_ID[I] = Ith component of global vector calculated by a fix with ID, I can include wildcard (see below) + v_name = value calculated by an equal-style variable with name + v_name[I] = value calculated by a vector-style variable with name, I can include wildcard (see below) + +* one or more moments to compute can be listed +* moment = *mean* or *stddev* or *variance* or *skew* or *kurtosis*, see exact definitions below. +* zero or more keyword/arg pairs may be appended +* keyword = *start* or *history* + + .. parsed-literal:: + + *start* args = Nstart + Nstart = invoke first after this time step + *history* args = Nrecent + Nrecent = keep a history of up to Nrecent outputs + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all ave/moments 1 1000 100 v_volume mean stddev + fix 1 all ave/moments 1 200 1000 v_volume variance kurtosis history 10 + +Description +""""""""""" + +.. versionadded:: TBD + +Using one or more values as input, calculate the moments of the underlying +(population) distributions based on samples collected every few time +steps over a time step window. The definitions of the moments calculated +are given below. + +The group specified with this command is ignored. However, note that +specified values may represent calculations performed by computes and +fixes which store their own "group" definitions. + +Each listed value can be the result of a :doc:`compute ` or +:doc:`fix ` or the evaluation of an equal-style or vector-style +:doc:`variable `. In each case, the compute, fix, or variable +must produce a global quantity, not a per-atom or local quantity. +If you wish to spatial- or time-average or histogram per-atom +quantities from a compute, fix, or variable, then see the :doc:`fix +ave/chunk `, :doc:`fix ave/atom `, or +:doc:`fix ave/histo ` commands. If you wish to sum a +per-atom quantity into a single global quantity, see the :doc:`compute +reduce ` command. + +Many :doc:`computes ` and :doc:`fixes ` produce global +quantities. See their doc pages for details. :doc:`Variables ` +of style *equal* and *vector* are the only ones that can be used with +this fix. Variables of style *atom* cannot be used, since they produce +per-atom values. + +The input values must all be scalars or vectors with a bracketed term +appended, indicating the :math:`I^\text{th}` value of the vector is +used. + +The result of this fix can be accessed as a vector, containing the +interleaved moments of each input in order. If M moments are requested, +then the moments of input 1 will be the first M values in the vector +output by this fix. The moments of input 2 will the next M values, etc. +If there are N values, the vector length will be N*M. + +---------- + +For input values from a compute or fix or variable, the bracketed index +I can be specified using a wildcard asterisk with the index to +effectively specify multiple values. This takes the form "\*" or "\*n" +or "m\*" or "m\*n". If :math:`N` is the size of the vector, then an +asterisk with no numeric values means all indices from 1 to :math:`N`. +A leading asterisk means all indices from 1 to n (inclusive). A +trailing asterisk means all indices from n to :math:`N` (inclusive). A +middle asterisk means all indices from m to n (inclusive). + +Using a wildcard is the same as if the individual elements of the vector +or cells of the array had been listed one by one. For examples, see the +description of this capability in :doc:`fix ave/time `. + +---------- + +The :math:`N_\text{every}`, :math:`N_\text{repeat}`, and +:math:`N_\text{freq}` arguments specify on what time steps the input +values will be used in order to contribute to the average. The final +statistics are generated on time steps that are a multiple of +:math:`N_\text{freq}`\ . The average is over a window of up to +:math:`N_\text{repeat}` quantities, computed in the preceding portion of +the simulation once every :math:`N_\text{every}` time steps. + +.. note:: + + Contrary to most fix ave/* commands, it is not required that Nevery * + Nrepeat <= Nfreq. This is to allow the user to choose the time + window and number of samples contributing to the output at each + Nfreq interval. + +For example, if :math:`N_\text{freq}=100` and :math:`N_\text{repeat}=5` +(and :math:`N_\text{every}=1`), then on step 100 values from time steps +96, 97, 98, 99, and 100 will be used. The fix does not compute its +inputs on steps that are not required. If :math:`N_\text{freq}=5`, +:math:`N_\text{repeat}=8` and :math:`N_\text{every}=1`, then values +will first be calculated on step 5 from steps 1-5, on step 10 from 3-10, +on step 15 from 8-15 and so on, forming a rolling average over +timesteps that span a time window larger than Nfreq. + +---------- + +If a value begins with "c\_", a compute ID must follow which has been +previously defined in the input script. If no bracketed term is +appended, the global scalar calculated by the compute is used. If a +bracketed term is appended, the Ith element of the global vector +calculated by the compute is used. See the discussion above for how I +can be specified with a wildcard asterisk to effectively specify +multiple values. + +If a value begins with "f\_", a fix ID must follow which has been +previously defined in the input script. If no bracketed term is +appended, the global scalar calculated by the fix is used. If a +bracketed term is appended, the Ith element of the global vector +calculated by the fix is used. See the discussion above for how I can +be specified with a wildcard asterisk to effectively specify multiple +values. + +Note that some fixes only produce their values on certain time steps, +which must be compatible with *Nevery*, else an error will result. +Users can also write code for their own fix styles and :doc:`add them to +LAMMPS `. + +If a value begins with "v\_", a variable name must follow which has been +previously defined in the input script. Only equal-style or vector-style +variables can be used, which both produce global values. Vector-style +variables require a bracketed term to specify the Ith element of the +vector calculated by the variable. + +Note that variables of style *equal* and *vector* define a formula which +can reference individual atom properties or thermodynamic keywords, or +they can invoke other computes, fixes, or variables when they are +evaluated, so this is a very general means of specifying quantities to +time average. + +---------- + +The moments are output in the order requested in the arguments following +the last input. Any number and order of moments can be specified, +although it does not make much sense to specify the same moment multiple +times. All moments are computed using a correction of the sample estimators +used to obtain unbiased cumulants :math:`k_{1..4}` (see :ref:`(Cramer) +`). The correction for variance is the standard Bessel +correction. For other moments, see :ref:`(Joanes)`. + +For *mean*, the arithmetic mean :math:`\bar{x} = \frac{1}{n} +\sum_{i=1}^{n} x_i` is calculated. + +For *variance*, the Bessel-corrected sample variance :math:`var = k_2 = +\frac{1}{n - 1} \sum_{i=1}^{n} (x_i - \bar{x})^2` is calculated. + +For *stddev*, the Bessel-corrected sample standard deviation +:math:`stddev = \sqrt{k_2}` is calculated. + +For *skew*, the adjusted Fisher--Pearson standardized moment :math:`G_1 += \frac{k_3}{k_2^{3/2}} = \frac{k_3}{stddev^3}` is calculated. + +For *kurtosis*, the adjusted Fisher--Pearson standardized moment +:math:`G_2 = \frac{k_4}{k_2^2}` is calculated. + +---------- + +Fix invocation and output can be modified by optional keywords. + +The *start* keyword specifies that the first computation should be no +earlier than the step number given (but will still occur on a multiple +of *Nfreq*). The default is step 0. Often input values can be 0.0 at +time 0, so setting *start* to a larger value can avoid including a 0.0 +in a longer series. + +The *history* keyword stores the Nrecent most recent outputs on Nfreq +timesteps, so they can be accessed as global outputs of the fix. Nrecent +must be >= 1. The default is 1, meaning only the most recent output is +accessible. For example, if history 10 is specified and Nfreq = 1000, +then on timestep 20000, the Nfreq outputs from steps 20000, 19000, ... +11000 are available for access. See below for details on how to access +the history values. + +For example, this will store the outputs of the previous 10 Nfreq +time steps, i.e. a window of 10000 time steps: + +.. code-block:: LAMMPS + + fix 1 all ave/moments 1 200 1000 v_volume mean history 10 + +The previous results can be accessed as values in a global array output +by this fix. Each column of the array is the vector output of the N-th +preceding Nfreq timestep. For example, assuming a single moment is +calculated, the most recent result corresponding to the third input +value would be accessed as "f_name[3][1]", "f_name[3][4]" is the 4th +most recent and so on. The current vector output is always the first +column of the array, corresponding to the most recent result. + +To illustrate the utility of keeping output history, consider using +this fix in conjunction with :doc:`fix halt ` to stop a run +automatically if a quantity is converged to within some desired tolerance: + +.. code-block:: LAMMPS + + variable target equal etot + fix aveg all ave/moments 1 200 1000 v_target mean stddev history 10 + variable stopcond equal "abs(f_aveg[1]-f_aveg[1][10])`. + +This fix produces a global vector and global array which can be accessed +by various :doc:`output commands `. The values can be +accessed on any time step, but may not be current. + +A global vector is produced with the # of elements = number of moments * +number of inputs. The moments are output in the order given in the fix +definition. An array is produced having # of rows = length of vector +output (with an ordering which matches the vector) and # of columns = +value of *history*. There is always at least one column. + +Each element of the global vector or array can be either "intensive" or +"extensive", depending on whether the values contributing to the element +are "intensive" or "extensive". If a compute or fix provides the value +being time averaged, then the compute or fix determines whether the value +is intensive or extensive; see the page for that compute or fix for +further info. Values produced by a variable are treated as intensive. + +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 compute is part of the EXTRA-FIX package. It is only enabled if +LAMMPS was built with that package. See the :doc:`Build package +` page for more info. + +Related commands +"""""""""""""""" + +:doc:`fix ave/time `, + +Default +""""""" + +The option defaults are history = 1, start = 0. + +---------- + +.. _Cramer1: + +**(Cramer)** Cramer, Mathematical Methods of Statistics, Princeton University Press (1946). + +.. _Joanes1: + +**(Joanes)** Joanes, Gill, The Statistician, 47, 183--189 (1998). diff --git a/doc/src/fix_set.rst b/doc/src/fix_set.rst new file mode 100644 index 0000000000..cfa8231ccd --- /dev/null +++ b/doc/src/fix_set.rst @@ -0,0 +1,173 @@ +.. index:: fix set + +fix set command +=============== + +Syntax +"""""" + +.. code-block:: LAMMPS + + fix ID group-ID set Nfreq rnflag set-args + +* ID, group-ID are documented in :doc:`fix ` command +* set = style name of this fix command +* Nfreq = reset per-atom properties every this many timesteps +* rnflag = 1 to reneighbor on next timestep, 0 to not +* set-args = identical to args for the :doc:`set ` command + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 10 all set 1 0 group all i_dump v_new + fix 10 all set 1 0 group all i_dump v_turnoff + +Description +""""""""""" + +Reset one or more properties of one or more atoms once every *Nfreq* +steps during a simulation. + +If the *rnflag* for reneighboring is set to 1, then a reneighboring +will be triggered on the next timestep (since the fix set operation +occurs at the end of the current timestep). This is important to do +if this command changes per-atom properties that need to be +communicated to ghost atoms. If this is not the case, an *rnflag* +setting of 0 can be used; reneighboring will only be triggered on +subsequent timesteps by the usual neighbor list criteria; see the +:doc:`neigh_modify command `. + +Here are two examples where an *rnflag* setting of 1 are needed. If a +custom per-atom property is changed and the :doc:`fix property/atom +` command to create the property used the *ghost +yes* keyword. Or if per-atom charges are changed, all pair styles +which compute Coulombic interactions require charge values for ghost +atoms. In both these examples, the re-neighboring will trigger the +changes in the owned atom properties to be immediately communicated to +ghost atoms. + +The arguments following *Nfreq* and *rnflag* are identical to those +allowed for the :doc:`set ` command, as in the examples above and +below. + +Note that the group-ID setting for this command is ignored. The +syntax for the :doc:`set ` arguments allows selection of which +atoms have their properties reset. + +This command can only be used to reset an atom property using a +per-atom variable. This option in allowed by many, but not all, of +the keyword/value pairs supported by the :doc:`set ` command. +The reason for this restriction is that if a per-atom variable is not +used, this command will typically not change atom properties during +the simulation. + +The :doc:`set ` command can be used with similar syntax to this +command to reset atom properties once before or between simulations. + +---------- + +Here is an example of input script commands which will output atoms +into a dump file only when their x-velocity crosses a threshold value +*vthresh* for the first time. Their position and x-velocity will then +be output every step for *twindow* timesteps. + +.. code-block:: LAMMPS + + variable vthresh equal 2 # threshold velocity + variable twindow equal 10 # dump for this many steps + # + # define custom property i_dump to store timestep threshold is crossed + # + fix 2 all property/atom i_dump + set group all i_dump -1 + # + # fix set command checks for threshold crossings every step + # resets i_dump from -1 to current timestep when crossing occurs + # + variable start atom "vx > v_vthresh && i_dump == -1" + variable new atom ternary(v_start,step,i_dump) + fix 3 all set 1 0 group all i_dump v_new + # + # dump command with thresh which enforces twindow + # + dump 1 all custom 1 tmp.dump id x y vx i_dump + variable dumpflag atom "i_dump >= 0 && (step-i_dump) < v_twindow" + dump_modify 1 thresh v_dumpflag == 1 + # + # run the simulation + # final dump with all atom IDs which crossed threshold on which timestep + # + run 1000 + write_dump all custom tmp.dump.final id i_dump modify thresh i_dump >= 0 + +The tmp.dump.final file lists which atoms crossed the velocity +threshold. This command will print the *twindow* timesteps when a +specific atom ID (104 in this case) was output in the tmp.dump file: + +.. code-block:: LAMMPS + + % grep "^104 " tmp.dump + +If these commands are used instead of the above, then an atom can +cross the velocity threshold multiple times, and will be output for +*twindow* timesteps each time. However the write_dump command is no +longer useful. + +.. code-block:: LAMMPS + + variable vthresh equal 2 # threshold velocity + variable twindow equal 10 # dump for this many steps + # + # define custom property i_dump to store timestep threshold is crossed + # + fix 2 all property/atom i_dump + set group all i_dump -1 + # + # fix set command checks for threshold crossings every step + # resets i_dump from -1 to current timestep when crossing occurs + # + variable start atom "vx > v_vthresh && i_dump == -1" + variable turnon atom ternary(v_start,step,i_dump) + variable stop atom "v_turnon >= 0 && (step-v_turnon) < v_twindow" + variable turnoff atom ternary(v_stop,v_turnon,-1) + fix 3 all set 1 0 group all i_dump v_turnoff + # + # dump command with thresh which enforces twindow + # + dump 1 all custom 1 tmp.dump id x y vx i_dump + variable dumpflag atom "i_dump >= 0 && (step-i_dump) < v_twindow" + dump_modify 1 thresh v_dumpflag == 1 + # + # run the simulation + # + run 1000 + +---------- + +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 +"""""""""""" + +none + +Related commands +"""""""""""""""" + +:doc:`set ` + +Default +""""""" + +none diff --git a/doc/src/pair_hybrid.rst b/doc/src/pair_hybrid.rst index 93e5621736..05cc8ddf24 100644 --- a/doc/src/pair_hybrid.rst +++ b/doc/src/pair_hybrid.rst @@ -100,6 +100,56 @@ first is assigned to intra-molecular interactions (i.e. both atoms have the same molecule ID), the second to inter-molecular interactions (i.e. interacting atoms have different molecule IDs). +.. admonition:: When **NOT** to use a hybrid pair style + :class: warning + + Using pair style *hybrid* can be very tempting to use if you need a + **many-body potential** supporting a mix of elements for which you + cannot find a potential file that covers *all* of them. Regardless + of how this is set up, there will be *errors*. The major use case + where the error is *small*, is when the many-body sub-styles are used + on different objects (for example a slab and a liquid, a metal and a + nano-machining work piece). In that case the *mixed* terms + **should** be provided by a pair-wise additive potential (like + Lennard-Jones or Morse) to avoid unexpected behavior and reduce + errors. LAMMPS cannot easily check for this condition and thus will + accept good and bad choices alike. + + Outside of this, we *strongly* recommend *against* using pair style + hybrid with many-body potentials for the following reasons: + + 1. When trying to combine EAM or MEAM potentials, there is a *large* + error in the embedding term, since it is computed separately for + each sub-style only. + + 2. When trying to combine many-body potentials like Stillinger-Weber, + Tersoff, AIREBO, Vashishta, or similar, you have to understand + that the potential of a sub-style cannot be applied in a pair-wise + fashion but will need to be applied to multiples of atoms + (e.g. a Tersoff potential of elements A and B includes the + interactions A-A, B-B, A-B, A-A-A, A-A-B, A-B-B, A-B-A, B-A-A, + B-A-B, B-B-A, B-B-B; AIREBO also considers all quadruples of + atom elements). + + 3. When one of the sub-styles uses charge-equilibration (= QEq; like + in ReaxFF or COMB) you have inconsistent QEq behavior because + either you try to apply QEq to *all* atoms but then you are + missing the QEq parameters for the non-QEq pair style (and it + would be inconsistent to apply QEq for pair styles that are not + parameterized for QEq) or else you would have either no charges or + fixed charges interacting with the QEq which also leads to + inconsistent behavior between two sub-styles. When attempting to + use multiple ReaxFF instances to combine different potential + files, you might be able to work around the QEq limitations, but + point 2. still applies. + + We understand that it is frustrating to not be able to run simulations + due to lack of available potential files, but that does not justify + combining potentials in a broken way via pair style hybrid. This is + not what the hybrid pair styles are designed for. + +---------- + Here are two examples of hybrid simulations. The *hybrid* style could be used for a simulation of a metal droplet on a LJ surface. The metal atoms interact with each other via an *eam* potential, the surface atoms @@ -374,12 +424,11 @@ selected sub-style. ---------- -.. note:: - - Several of the potentials defined via the pair_style command in - LAMMPS are really many-body potentials, such as Tersoff, AIREBO, MEAM, - ReaxFF, etc. The way to think about using these potentials in a - hybrid setting is as follows. +Even though the command name "pair_style" would suggest that these are +pair-wise interactions, several of the potentials defined via the +pair_style command in LAMMPS are really many-body potentials, such as +Tersoff, AIREBO, MEAM, ReaxFF, etc. The way to think about using these +potentials in a hybrid setting is as follows. A subset of atom types is assigned to the many-body potential with a single :doc:`pair_coeff ` command, using "\* \*" to include diff --git a/doc/src/run.rst b/doc/src/run.rst index c3dd171f6b..95e2f037db 100644 --- a/doc/src/run.rst +++ b/doc/src/run.rst @@ -103,14 +103,16 @@ must be done. .. note:: - If your input script changes the system between 2 runs, then the - initial setup must be performed to ensure the change is recognized by - all parts of the code that are affected. Examples are adding a - :doc:`fix ` or :doc:`dump ` or :doc:`compute `, changing - a :doc:`neighbor ` list parameter, or writing restart file - which can migrate atoms between processors. LAMMPS has no easy way to - check if this has happened, but it is an error to use the *pre no* - option in this case. + If your input script "changes" the system between 2 runs, then the + initial setup typically needs to be performed to ensure the change + is recognized by all parts of the code that are affected. Examples + are adding a :doc:`fix ` or :doc:`dump ` or + :doc:`compute `, changing a :doc:`neighbor ` + list parameter, using the :doc:`set ` command, or writing a + restart file via the :doc:`write_restart ` command, + which can migrate atoms between processors. LAMMPS has no easy way + to check if this has happened, but it is an error to use the *pre + no* option in these cases. If *post* is specified as "no", the full timing summary is skipped; only a one-line summary timing is printed. diff --git a/doc/src/set.rst b/doc/src/set.rst index 6be590e9b6..d2c865dfbb 100644 --- a/doc/src/set.rst +++ b/doc/src/set.rst @@ -22,21 +22,110 @@ Syntax for style = *region*, ID = a region ID * one or more keyword/value pairs may be appended -* keyword = *type* or *type/fraction* or *type/ratio* or *type/subset* - or *mol* or *x* or *y* or *z* or *vx* or *vy* or *vz* or *charge* or - *dipole* or *dipole/random* or *quat* or *spin/atom* or *spin/atom/random* or - *spin/electron* or *radius/electron* or - *quat* or *quat/random* or *diameter* or *shape* or *length* or *tri* or - *theta* or *theta/random* or *angmom* or *omega* or - *mass* or *density* or *density/disc* or *temperature* or - *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 *epsilon* or - *i_name* or *d_name* or *i2_name* or *d2_name* + +* keyword = *angle* or *angmom* or *bond* or *cc* or *charge* or + *density* or *density/disc* or *diameter* or *dihedral* or *dipole* + or *dipole/random* or *dpd/theta* or *edpd/cv* or *edpd/temp* or + *epsilon* or *image* or *improper* or *length* or *mass* or *mol* or + *omega* or *quat* or *quat/random* or *radius/electron* or *shape* or + *smd/contact/radius* or *smd/mass/density* or *sph/cv* or *sph/e* or + *sph/rho* or *spin/atom* or *spin/atom/random* or *spin/electron* or + *temperature* or *theta* or *theta/random* or *tri* or *type* or + *type/fraction* or *type/ratio* or *type/subset* or *volume* or *vx* + or *vy* or *vz* or *x* or *y* or *z* or *i_name* or *d_name* or + *i2_name* or *d2_name* .. parsed-literal:: + *angle* value = numeric angle type or angle type label, for all angles between selected atoms + *angmom* values = Lx Ly Lz + Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units) + any of Lx,Ly,Lz can be an atom-style variable (see below) + *bond* value = numeric bond type or bond type label, for all bonds between selected atoms + *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) + cc can be an atom-style variable (see below) + *charge* value = atomic charge (charge units) + value can be an atom-style variable (see below) + *density* value = particle density for a sphere or ellipsoid (mass/distance\^3 units), or for a triangle (mass/distance\^2 units) or line (mass/distance units) particle + value can be an atom-style variable (see below) + *density/disc* value = particle density for a 2d disc or ellipse (mass/distance\^2 units) + value can be an atom-style variable (see below) + *diameter* value = diameter of spherical particle (distance units) + value can be an atom-style variable (see below) + *dihedral* value = numeric dihedral type or dihedral type label, for all dihedrals between selected atoms + *dipole* values = x y z + x,y,z = orientation of dipole moment vector + any of x,y,z can be an atom-style variable (see below) + *dipole/random* values = seed Dlen + seed = random # seed (positive integer) for dipole moment orientations + Dlen = magnitude of dipole moment (dipole units) + *dpd/theta* value = internal temperature of DPD particles (temperature units) + value can be an atom-style variable (see below) + value can be NULL which sets internal temp of each particle to KE temp + *edpd/cv* value = volumetric heat capacity of eDPD particles (energy/temperature/volume units) + value can be an atom-style variable (see below) + *edpd/temp* value = temperature of eDPD particles (temperature units) + value can be an atom-style variable (see below) + *epsilon* value = dielectric constant of the medium where the atoms reside + value can be an atom-style variable (see below) + *image* values = nx ny nz + nx,ny,nz = which periodic image of the simulation box the atom is in + any of nx,ny,nz can be an atom-style variable (see below) + *improper* value = numeric improper type or improper type label, for all impropers between selected atoms + *length* value = len + len = length of line segment (distance units) + len can be an atom-style variable (see below) + *mass* value = per-atom mass (mass units) + value can be an atom-style variable (see below) + *mol* value = molecule ID + the moleclue ID can be an atom-style variable (see below) + *omega* values = Wx Wy Wz + Wx,Wy,Wz = components of angular velocity vector (radians/time units) + any of Wx,Wy,Wz can be an atom-style variable (see below) + *quat* values = a b c theta + a,b,c = unit vector to rotate particle around via right-hand rule + theta = rotation angle (degrees) + any of a,b,c,theta values can be an atom-style variable (see below) + *quat/random* value = seed + seed = random # seed (positive integer) for quaternion orientations + *radius/electron* value = eradius + eradius = electron radius (or fixed-core radius) (distance units) + value can be an atom-style variable (see below) + *shape* values = Sx Sy Sz + Sx,Sy,Sz = 3 diameters of ellipsoid (distance units) + any of Sx,Sy,Sz can be an atom-style variable (see below) + *smd/contact/radius* value = radius for short range interactions, i.e. contact and friction + value can be an atom-style variable (see below) + *smd/mass/density* value = set particle mass based on volume by providing a mass density + value can be an atom-style variable (see below) + *sph/cv* value = heat capacity of SPH particles (need units) + value can be an atom-style variable (see below) + *sph/e* value = energy of SPH particles (need units) + value can be an atom-style variable (see below) + *sph/rho* value = density of SPH particles (need units) + value can be an atom-style variable (see below) + *spin/atom* values = g x y z + g = magnitude of magnetic spin vector (in Bohr magneton's unit) + x,y,z = orientation of magnetic spin vector + any of x,y,z can be an atom-style variable (see below) + *spin/atom/random* values = seed Dlen + seed = random # seed (positive integer) for magnetic spin orientations + Dlen = magnitude of magnetic spin vector (in Bohr magneton's unit) + *spin/electron* value = espin + espin = electron spin (+1/-1), 0 = nuclei, 2 = fixed-core, 3 = pseudo-cores (i.e. ECP) + value can be an atom-style variable (see below) + *temperature* value = temperature for finite-size particles (temperature units) + value can be an atom-style variable (see below) + *theta* value = angle (degrees) + angle = orientation of line segment with respect to x-axis + value can be an atom-style variable (see below) + *theta/random* value = seed + seed = random # seed (positive integer) for line segment orienations + *tri* value = side + side = side length of equilateral triangle (distance units) + value can be an atom-style variable (see below) *type* value = numeric atom type or type label value can be an atom-style variable (see below) *type/fraction* values = type fraction seed @@ -51,104 +140,22 @@ Syntax type = numeric atom type or type label Nsubset = exact number of selected atoms to set to new atom type seed = random # seed (positive integer) - *mol* value = molecule ID - value can be an atom-style variable (see below) - *x*,\ *y*,\ *z* value = atom coordinate (distance units) + *volume* value = particle volume for Peridynamic particle (distance\^3 units) value can be an atom-style variable (see below) *vx*,\ *vy*,\ *vz* value = atom velocity (velocity units) value can be an atom-style variable (see below) - *charge* value = atomic charge (charge units) + *x*,\ *y*,\ *z* value = atom coordinate (distance units) value can be an atom-style variable (see below) - *dipole* values = x y z - x,y,z = orientation of dipole moment vector - any of x,y,z can be an atom-style variable (see below) - *dipole/random* value = seed Dlen - seed = random # seed (positive integer) for dipole moment orientations - Dlen = magnitude of dipole moment (dipole units) - *spin/atom* values = g x y z - g = magnitude of magnetic spin vector (in Bohr magneton's unit) - x,y,z = orientation of magnetic spin vector - any of x,y,z can be an atom-style variable (see below) - *spin/atom/random* value = seed Dlen - seed = random # seed (positive integer) for magnetic spin orientations - Dlen = magnitude of magnetic spin vector (in Bohr magneton's unit) - *radius/electron* values = eradius - eradius = electron radius (or fixed-core radius) (distance units) - *spin/electron* value = espin - espin = electron spin (+1/-1), 0 = nuclei, 2 = fixed-core, 3 = pseudo-cores (i.e. ECP) - *quat* values = a b c theta - a,b,c = unit vector to rotate particle around via right-hand rule - theta = rotation angle (degrees) - any of a,b,c,theta can be an atom-style variable (see below) - *quat/random* value = seed - seed = random # seed (positive integer) for quaternion orientations - *diameter* value = diameter of spherical particle (distance units) - value can be an atom-style variable (see below) - *shape* value = Sx Sy Sz - Sx,Sy,Sz = 3 diameters of ellipsoid (distance units) - *length* value = len - len = length of line segment (distance units) - len can be an atom-style variable (see below) - *tri* value = side - side = side length of equilateral triangle (distance units) - side can be an atom-style variable (see below) - *theta* value = angle (degrees) - angle = orientation of line segment with respect to x-axis - angle can be an atom-style variable (see below) - *theta/random* value = seed - seed = random # seed (positive integer) for line segment orienations - *angmom* values = Lx Ly Lz - Lx,Ly,Lz = components of angular momentum vector (distance-mass-velocity units) - any of Lx,Ly,Lz can be an atom-style variable (see below) - *omega* values = Wx Wy Wz - Wx,Wy,Wz = components of angular velocity vector (radians/time units) - any of wx,wy,wz can be an atom-style variable (see below) - *mass* value = per-atom mass (mass units) - value can be an atom-style variable (see below) - *density* value = particle density for a sphere or ellipsoid (mass/distance\^3 units), or for a triangle (mass/distance\^2 units) or line (mass/distance units) particle - value can be an atom-style variable (see below) - *density/disc* value = particle density for a 2d disc or ellipse (mass/distance\^2 units) - value can be an atom-style variable (see below) - *temperature* value = temperature for finite-size particles (temperature units) - value can be an atom-style variable (see below) - *volume* value = particle volume for Peridynamic particle (distance\^3 units) - value can be an atom-style variable (see below) - *image* nx ny nz - nx,ny,nz = which periodic image of the simulation box the atom is in - any of nx,ny,nz can be an atom-style variable (see below) - *bond* value = numeric bond type or bond type label, for all bonds between selected atoms - *angle* value = numeric angle type or angle type label, for all angles between selected atoms - *dihedral* value = numeric dihedral type or dihedral type label, for all dihedrals between selected atoms - *improper* value = numeric improper type or improper type label, for all impropers between selected atoms - *rheo/rho* value = density of RHEO particles (mass/distance\^3) - *rheo/status* value = status or phase of RHEO particles (unitless) - *sph/e* value = energy of SPH particles (need units) - value can be an atom-style variable (see below) - *sph/cv* value = heat capacity of SPH particles (need units) - value can be an atom-style variable (see below) - *sph/rho* value = density of SPH particles (need units) - value can be an atom-style variable (see below) - *smd/contact/radius* = radius for short range interactions, i.e. contact and friction - value can be an atom-style variable (see below) - *smd/mass/density* = set particle mass based on volume by providing a mass density - value can be an atom-style variable (see below) - *dpd/theta* value = internal temperature of DPD particles (temperature units) - value can be an atom-style variable (see below) - value can be NULL which sets internal temp of each particle to KE temp - *edpd/temp* value = temperature of eDPD particles (temperature units) - value can be an atom-style variable (see below) - *edpd/cv* value = volumetric heat capacity of eDPD particles (energy/temperature/volume units) - value can be an atom-style variable (see below) - *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 + value can be an atom-style variable (see below) *d_name* value = custom floating-point vector with name - *i2_name* value = column of a custom integer array with name + value can be an atom-style variable (see below) + *i2_name* value = custom integer array with name column specified as i2_name[N] where N is 1 to Ncol - *d2_name* value = column of a custom floating-point array with name + value can be an atom-style variable (see below) + *d2_name* value = custom floating-point array with name column specified as d2_name[N] where N is 1 to Ncol + value can be an atom-style variable (see below) Examples """""""" @@ -177,22 +184,26 @@ Description Set one or more properties of one or more atoms. Since atom properties are initially assigned by the :doc:`read_data `, -:doc:`read_restart ` or :doc:`create_atoms ` -commands, this command changes those assignments. This can be useful -for overriding the default values assigned by the -:doc:`create_atoms ` command (e.g. charge = 0.0). It can -be useful for altering pairwise and molecular force interactions, +:doc:`read_restart ` or :doc:`create_atoms +` commands, this command changes those assignments. +This can be useful for overriding the default values assigned by the +:doc:`create_atoms ` command (e.g. charge = 0.0). It +can be useful for altering pairwise and molecular force interactions, since force-field coefficients are defined in terms of types. It can be used to change the labeling of atoms by atom type or molecule ID -when they are output in :doc:`dump ` files. It can also be useful -for debugging purposes; i.e. positioning an atom at a precise location -to compute subsequent forces or energy. +when they are output in :doc:`dump ` files. It can also be +useful for debugging purposes; i.e. positioning an atom at a precise +location to compute subsequent forces or energy. Note that the *style* and *ID* arguments determine which atoms have their properties reset. The remaining keywords specify which properties to reset and what the new values are. Some strings like *type* or *mol* can be used as a style and/or a keyword. +The :doc:`fix set ` command can be used with similar syntax +to this command to reset atom properties once every *N* steps during a +simulation using via atom-style variables. + ---------- This section describes how to select which atoms to change @@ -211,8 +222,8 @@ can be specified, e.g. "C". The style *mol* selects all the atoms in a range of molecule IDs. In each of the range cases, 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 +numeric value, or with a wildcard asterisk to specify a range of +values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For example, for the style *type*, 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 @@ -222,25 +233,25 @@ means all types from m to n (inclusive). For all the styles except The style *group* selects all the atoms in the specified group. The style *region* selects all the atoms in the specified geometric -region. See the :doc:`group ` and :doc:`region ` commands -for details of how to specify a group or region. +region. See the :doc:`group ` and :doc:`region ` +commands for details of how to specify a group or region. ---------- -This section describes the keyword options for which properties to +The next section describes the keyword options for which properties to change, for the selected atoms. Note that except where explicitly prohibited below, all of the keywords allow an :doc:`atom-style or atomfile-style variable ` to be used as the specified value(s). If the value is a -variable, it should be specified as v_name, where name is the -variable name. In this case, the variable will be evaluated, and its -resulting per-atom value used to determine the value assigned to each -selected atom. Note that the per-atom value from the variable will be -ignored for atoms that are not selected via the *style* and *ID* -settings explained above. A simple way to use per-atom values from -the variable to reset a property for all atoms is to use style *atom* -with *ID* = "\*"; this selects all atom IDs. +variable, it should be specified as v_name, where name is the variable +name. In this case, the variable will be evaluated, and its resulting +per-atom value used to determine the value assigned to each selected +atom. Note that the per-atom value from the variable will be ignored +for atoms that are not selected via the *style* and *ID* settings +explained above. A simple way to use per-atom values from the +variable to reset a property for all atoms is to use style *atom* with +*ID* = "\*"; this selects all atom IDs. Atom-style variables can specify formulas with various mathematical functions, and include :doc:`thermo_style ` command @@ -256,52 +267,110 @@ from a file. .. note:: Atom-style and atomfile-style variables return floating point - per-atom values. If the values are assigned to an integer variable, - such as the molecule ID, then the floating point value is truncated to - its integer portion, e.g. a value of 2.6 would become 2. + per-atom values. If the values are assigned to an integer + variable, such as the molecule ID, then the floating point value is + truncated to its integer portion, e.g. a value of 2.6 would + become 2. + +---------- .. versionchanged:: 28Mar2023 - Support for type labels was added for setting atom, bond, angle, - dihedral, and improper types + Support for type labels was added for setting angle types -Keyword *type* sets the atom type for all selected atoms. A specified -value can be either a numeric atom type or an atom type label. When -using a numeric type, the specified value must be from 1 to ntypes, -where ntypes was set by the :doc:`create_box ` command or -the *atom types* field in the header of the data file read by the -:doc:`read_data ` command. When using a type label it must -have been defined previously. See the :doc:`Howto type labels -` doc page for the allowed syntax of type labels -and a general discussion of how type labels can be used. +Keyword *angle* sets the angle type of all angles of selected atoms to +the specified value. The value can be a numeric type from 1 to +nangletypes. Or it can be a angle type label. See the :doc:`Howto +type labels ` doc page for the allowed syntax of +type labels and a general discussion of how type labels can be used. +All atoms in a particular angle must be selected atoms in order for +the change to be made. The value of nangletypes was set by the *angle +types* field in the header of the data file read by the +:doc:`read_data ` command. This keyword does NOT allow use +of an atom-style variable. -Keyword *type/fraction* sets the atom type for a fraction of the selected -atoms. The actual number of atoms changed is not guaranteed -to be exactly the specified fraction (0 <= *fraction* <= 1), but -should be statistically close. Random numbers are used in such a way -that a particular atom is changed or not changed, regardless of how -many processors are being used. This keyword does not allow use of an -atom-style variable. +Keyword *angmom* sets the angular momentum of selected atoms. The +particles must be ellipsoids as defined by the :doc:`atom_style +ellipsoid ` command or triangles as defined by the +:doc:`atom_style tri ` command. The angular momentum +vector of the particles is set to the 3 specified components. -Keywords *type/ratio* and *type/subset* also set the atom type for a -fraction of the selected atoms. The actual number of atoms changed -will be exactly the requested number. For *type/ratio* the specified -fraction (0 <= *fraction* <= 1) determines the number. For -*type/subset*, the specified *Nsubset* is the number. An iterative -algorithm is used which ensures the correct number of atoms are -selected, in a perfectly random fashion. Which atoms are selected -will change with the number of processors used. These keywords do not -allow use of an atom-style variable. +.. versionchanged:: 28Mar2023 -Keyword *mol* sets the molecule ID for all selected atoms. The -:doc:`atom style ` being used must support the use of -molecule IDs. + Support for type labels was added for setting bond types -Keywords *x*, *y*, *z*, and *charge* set the coordinates or -charge of all selected atoms. For *charge*, the :doc:`atom style -` being used must support the use of atomic -charge. Keywords *vx*, *vy*, and *vz* set the velocities of all -selected atoms. +Keyword *bond* sets the bond type of all bonds of selected atoms to +the specified value. The value can be a numeric type from 1 to +nbondtypes. Or it can be a bond type label. See the :doc:`Howto type +labels ` doc page for the allowed syntax of type +labels and a general discussion of how type labels can be used. All +atoms in a particular bond must be selected atoms in order for the +change to be made. The value of nbondtypes was set by the *bond +types* field in the header of the data file read by the +:doc:`read_data ` command. This keyword does NOT allow use +of an atom-style variable. + +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. + +Keyword *charge* set the charge of all selected atoms. The :doc:`atom +style ` being used must support the use of atomic charge. + +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 +mass attribute, as defined by the :doc:`atom_style ` +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). + +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. + +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 +: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). + +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 *diameter* sets the size of the selected atoms. The particles +must be finite-size spheres as defined by the :doc:`atom_style sphere +` command. The diameter of a particle can be set to 0.0, +which means they will be treated as point particles. Note that this +command does not adjust the particle mass, even if it was defined with +a density, e.g. via the :doc:`read_data ` command. + +.. versionchanged:: 28Mar2023 + + Support for type labels was added for setting dihedral types + +Keyword *dihedral* sets the dihedral type of all dihedrals of selected +atoms to the specified value. The value can be a numeric type from 1 +to ndihedraltypes. Or it can be a dihedral type label. See the +:doc:`Howto type labels ` doc page for the allowed +syntax of type labels and a general discussion of how type labels can +be used. All atoms in a particular dihedral must be selected atoms in +order for the change to be made. The value of ndihedraltypes was set +by the *dihedral types* field in the header of the data file read by +the :doc:`read_data ` command. This keyword does NOT allow +use of an atom-style variable. Keyword *dipole* uses the specified x,y,z values as components of a vector to set as the orientation of the dipole moment vectors of the @@ -313,40 +382,106 @@ moment vectors for the selected atoms and sets the magnitude of each to the specified *Dlen* value. For 2d systems, the z component of the orientation is set to 0.0. Random numbers are used in such a way that the orientation of a particular atom is the same, regardless of how -many processors are being used. This keyword does not allow use of an +many processors are being used. This keyword does NOT allow use of an atom-style variable. -.. versionchanged:: 15Sep2022 +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 +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. -Keyword *spin/atom* uses the specified g value to set the magnitude of the -magnetic spin vectors, and the x,y,z values as components of a vector -to set as the orientation of the magnetic spin vectors of the selected -atoms. This keyword was previously called *spin*. +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. -.. versionchanged:: 15Sep2022 +Keyword *epsilon* sets the dielectric constant of a particle to be +that 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 the dielectric constants are consistent. -Keyword *spin/atom/random* randomizes the orientation of the magnetic spin -vectors for the selected atoms and sets the magnitude of each to the -specified *Dlen* value. This keyword was previously called *spin/random*. +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. -.. versionadded:: 15Sep2022 +.. versionchanged:: 28Mar2023 -Keyword *radius/electron* uses the specified value to set the radius of -electrons or fixed cores. + Support for type labels was added for setting improper types -.. versionadded:: 15Sep2022 +Keyword *improper* sets the improper type of all impropers of selected +atoms to the specified value. The value can be a numeric type from 1 +to nimpropertypes. Or it can be a improper type label. See the +:doc:`Howto type labels ` doc page for the allowed +syntax of type labels and a general discussion of how type labels can +be used. All atoms in a particular improper must be selected atoms in +order for the change to be made. The value of nimpropertypes was set +by the *improper types* field in the header of the data file read by +the :doc:`read_data ` command. This keyword does NOT allow +use of an atom-style variable. -Keyword *spin/electron* sets the spin of an electron (+/- 1) or indicates -nuclei (=0), fixed-cores (=2), or pseudo-cores (= 3). +Keyword *length* sets the length of selected atoms. The particles +must be line segments as defined by the :doc:`atom_style line +` command. If the specified value is non-zero the line +segment is (re)set to a length = the specified value, centered around +the particle position, with an orientation along the x-axis. If the +specified value is 0.0, the particle will become a point particle. +Note that this command does not adjust the particle mass, even if it +was defined with a density, e.g. via the :doc:`read_data ` +command. + +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. + +Keyword *mol* sets the molecule ID for all selected atoms. The +:doc:`atom style ` being used must support the use of +molecule IDs. + +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. Keyword *quat* uses the specified values to create a quaternion (4-vector) that represents the orientation of the selected atoms. The particles must define a quaternion for their orientation (e.g. ellipsoids, triangles, body particles) as defined by the -:doc:`atom_style ` command. Note that particles defined by -:doc:`atom_style ellipsoid ` have 3 shape parameters. The 3 -values must be non-zero for each particle set by this command. They -are used to specify the aspect ratios of an ellipsoidal particle, +:doc:`atom_style ` command. Note that particles defined +by :doc:`atom_style ellipsoid ` have 3 shape parameters. +The 3 values must be non-zero for each particle set by this command. +They are used to specify the aspect ratios of an ellipsoidal particle, which is oriented by default with its x-axis along the simulation box's x-axis, and similarly for y and z. If this body is rotated (via the right-hand rule) by an angle theta around a unit rotation vector @@ -360,51 +495,77 @@ ignored, since a rotation vector of (0,0,1) is the only valid choice. Keyword *quat/random* randomizes the orientation of the quaternion for the selected atoms. The particles must define a quaternion for their orientation (e.g. ellipsoids, triangles, body particles) as defined by -the :doc:`atom_style ` command. Random numbers are used in -such a way that the orientation of a particular atom is the same, +the :doc:`atom_style ` command. Random numbers are used +in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. For 2d systems, only orientations in the xy plane are generated. As with keyword *quat*, for ellipsoidal particles, the 3 shape values must be non-zero -for each particle set by this command. This keyword does not allow +for each particle set by this command. This keyword does NOT allow use of an atom-style variable. -Keyword *diameter* sets the size of the selected atoms. The particles -must be finite-size spheres as defined by the :doc:`atom_style sphere -` command. The diameter of a particle can be set to 0.0, -which means they will be treated as point particles. Note that this -command does not adjust the particle mass, even if it was defined with -a density, e.g. via the :doc:`read_data ` command. +.. versionadded:: 15Sep2022 + +Keyword *radius/electron* uses the specified value to set the radius +of electrons or fixed cores. Keyword *shape* sets the size and shape of the selected atoms. The particles must be ellipsoids as defined by the :doc:`atom_style -ellipsoid ` command. The *Sx*, *Sy*, *Sz* settings -are the 3 diameters of the ellipsoid in each direction. All 3 can be -set to the same value, which means the ellipsoid is effectively a -sphere. They can also all be set to 0.0 which means the particle will -be treated as a point particle. Note that this command does not -adjust the particle mass, even if it was defined with a density, -e.g. via the :doc:`read_data ` command. +ellipsoid ` command. The *Sx*, *Sy*, *Sz* settings are +the 3 diameters of the ellipsoid in each direction. All 3 can be set +to the same value, which means the ellipsoid is effectively a sphere. +They can also all be set to 0.0 which means the particle will be +treated as a point particle. Note that this command does not adjust +the particle mass, even if it was defined with a density, e.g. via the +:doc:`read_data ` command. -Keyword *length* sets the length of selected atoms. The particles -must be line segments as defined by the :doc:`atom_style line -` command. If the specified value is non-zero the line -segment is (re)set to a length = the specified value, centered around -the particle position, with an orientation along the x-axis. If the -specified value is 0.0, the particle will become a point particle. -Note that this command does not adjust the particle mass, even if it -was defined with a density, e.g. via the :doc:`read_data ` -command. +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 *tri* sets the size of selected atoms. The particles must be -triangles as defined by the :doc:`atom_style tri ` command. -If the specified value is non-zero the triangle is (re)set to be an -equilateral triangle in the xy plane with side length = the specified -value, with a centroid at the particle position, with its base -parallel to the x axis, and the y-axis running from the center of the -base to the top point of the triangle. If the specified value is 0.0, -the particle will become a point particle. Note that this command -does not adjust the particle mass, even if it was defined with a -density, e.g. via the :doc:`read_data ` command. +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. + +Keywords *sph/cv*, *sph/e*, and *sph/rho* set the heat capacity, +energy, and density of smoothed particle hydrodynamics (SPH) +particles. See `this PDF guide `_ to +using SPH in LAMMPS. + +.. note:: + + Note that the SPH PDF guide file has not been updated for many + years and thus does not reflect the current *syntax* of the SPH + package commands. For that, please refer to the LAMMPS manual. + +.. versionchanged:: 15Sep2022 + +Keyword *spin/atom* uses the specified g value to set the magnitude of +the magnetic spin vectors, and the x,y,z values as components of a +vector to set as the orientation of the magnetic spin vectors of the +selected atoms. This keyword was previously called *spin*. + +.. versionchanged:: 15Sep2022 + +Keyword *spin/atom/random* randomizes the orientation of the magnetic +spin vectors for the selected atoms and sets the magnitude of each to +the specified *Dlen* value. This keyword does NOT allow use of an +atom-style variable. This keyword was previously called +*spin/random*. + +.. versionadded:: 15Sep2022 + +Keyword *spin/electron* sets the spin of an electron (+/- 1) or +indicates nuclei (=0), fixed-cores (=2), or pseudo-cores (= 3). + +Keyword *temperature* sets the temperature of a finite-size particle. +Currently, only the GRANULAR package supports this attribute. The +temperature must be added using an instance of :doc:`fix property/atom +` The values for the temperature must be positive. Keyword *theta* sets the orientation of selected atoms. The particles must be line segments as defined by the :doc:`atom_style line @@ -413,169 +574,71 @@ orientation angle of the line segments with respect to the x axis. Keyword *theta/random* randomizes the orientation of theta for the selected atoms. The particles must be line segments as defined by the -:doc:`atom_style line ` command. Random numbers are used in -such a way that the orientation of a particular atom is the same, +:doc:`atom_style line ` command. Random numbers are used +in such a way that the orientation of a particular atom is the same, regardless of how many processors are being used. This keyword does -not allow use of an atom-style variable. +NOT allow use of an atom-style variable. -Keyword *angmom* sets the angular momentum of selected atoms. The -particles must be ellipsoids as defined by the :doc:`atom_style -ellipsoid ` command or triangles as defined by the -:doc:`atom_style tri ` command. The angular momentum -vector of the particles is set to the 3 specified components. +Keyword *tri* sets the size of selected atoms. The particles must be +triangles as defined by the :doc:`atom_style tri ` +command. If the specified value is non-zero the triangle is (re)set +to be an equilateral triangle in the xy plane with side length = the +specified value, with a centroid at the particle position, with its +base parallel to the x axis, and the y-axis running from the center of +the base to the top point of the triangle. If the specified value is +0.0, the particle will become a point particle. Note that this +command does not adjust the particle mass, even if it was defined with +a density, e.g. via the :doc:`read_data ` command. -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. +.. versionchanged:: 28Mar2023 -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. + Support for type labels was added for setting atom types -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 -mass attribute, as defined by the :doc:`atom_style ` -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). - -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. - -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 -: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). - -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 *temperature* sets the temperature of a finite-size particle. -Currently, only the GRANULAR package supports this attribute. The -temperature must be added using an instance of -:doc:`fix property/atom ` The values for the -temperature must be positive. - -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. - -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. The value can be a numeric type from 1 to -nbondtypes (nangletypes, etc). Or it can be a type label (bond type -label, angle type label, etc). See the :doc:`Howto type labels +Keyword *type* sets the atom type for all selected atoms. A specified +value can be either a numeric atom type or an atom type label. When +using a numeric type, the specified value must be from 1 to ntypes, +where ntypes was set by the :doc:`create_box ` command or +the *atom types* field in the header of the data file read by the +:doc:`read_data ` command. When using a type label it must +have been defined previously. See the :doc:`Howto type labels ` doc page for the allowed syntax of type labels -and a general discussion of how type labels can be used. All atoms in -a particular bond (angle, etc) must be selected atoms in order for the -change to be made. The value of nbondtypes (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. +and a general discussion of how type labels can be used. -Keywords *rheo/rho* and *rheo/status* set the density and the status of -rheo particles. In particular, one can only set the phase in the status -as described by the :doc:`RHEO howto page `. +Keyword *type/fraction* sets the atom type for a fraction of the +selected atoms. The actual number of atoms changed is not guaranteed +to be exactly the specified fraction (0 <= *fraction* <= 1), but +should be statistically close. Random numbers are used in such a way +that a particular atom is changed or not changed, regardless of how +many processors are being used. This keyword does 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 *type/ratio* and *type/subset* also set the atom type for a +fraction of the selected atoms. The actual number of atoms changed +will be exactly the requested number. For *type/ratio* the specified +fraction (0 <= *fraction* <= 1) determines the number. For +*type/subset*, the specified *Nsubset* is the number. An iterative +algorithm is used which ensures the correct number of atoms are +selected, in a perfectly random fashion. Which atoms are selected +will change with the number of processors used. These keywords do not +allow use of an atom-style variable. -.. note:: +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. - Please note that the SPH PDF guide file has not been updated for - many years and thus does not reflect the current *syntax* of the - SPH package commands. For that please refer to the LAMMPS manual. +Keywords *vx*, *vy*, and *vz* set the velocities of all selected +atoms. -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 *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 -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. - -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. - -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. - -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 *x*, *y*, *z* set the coordinates of all selected atoms. Keywords *i_name*, *d_name*, *i2_name*, *d2_name* refer to custom per-atom integer and floating-point vectors or arrays that have been added via the :doc:`fix property/atom ` command. When that command is used specific names are given to each attribute which are the "name" portion of these keywords. For arrays *i2_name* -and *d2_name*, the column of the array must also be included following -the name in brackets: e.g. d2_xyz[2], i2_mySpin[3]. +and *d2_name*, the column of the array to set must also be included +following the name in brackets: e.g. d2_xyz[2] or i2_mySpin[3]. Restrictions """""""""""" @@ -584,7 +647,7 @@ You cannot set an atom attribute (e.g. *mol* or *q* or *volume*\ ) if the :doc:`atom_style ` does not have that attribute. This command requires inter-processor communication to coordinate the -setting of bond types (angle types, etc). This means that your system +setting of bond types (angle types, etc). This means that the system must be ready to perform a simulation before using one of these keywords (force fields set, atom mass set, etc). This is not necessary for other keywords. @@ -599,7 +662,7 @@ Related commands """""""""""""""" :doc:`create_box `, :doc:`create_atoms `, -:doc:`read_data ` +:doc:`read_data `, :doc:`fix set ` Default """"""" diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index f23d74c6a0..afdc01a0f4 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -82,6 +82,7 @@ Alessandro Alexey ali aliceblue +aliphatic Allera Allinger allocatable @@ -630,6 +631,7 @@ cp cpp cpu cradius +Cramer createatoms createAtoms CreateIDs @@ -670,6 +672,7 @@ cuFFT CuH Cui Cummins +cumulants Cundall cundall Curk @@ -1174,6 +1177,7 @@ Fermionic Ferrand fexternal Fexternal +ffast ffield ffl fflush @@ -1770,6 +1774,7 @@ jik JIK jku jN +Joanes Joannopoulos Jochim Jonsson @@ -1814,6 +1819,7 @@ Karniadakis Karplus Karttunen kate +katom Katsnelson Katsura Kaufmann @@ -2192,6 +2198,7 @@ Materias mathbf mathjax matlab +Matom Matous matplotlib Matsubara @@ -2701,6 +2708,7 @@ Nprocs npt nr Nr +Nrecent Nrecompute Nrepeat nreset @@ -2779,6 +2787,7 @@ ocl octahedral octants Odegard +Og Ohara O'Hearn ohenrich @@ -3361,6 +3370,7 @@ Rmin RMS rmsd rnage +rnflag rng rNEMD ro @@ -3416,6 +3426,7 @@ ry Ryckaert Rycroft Rydbergs +Ryzen rz Rz Sabry @@ -3835,6 +3846,7 @@ Thiaville Thibaudeau Thijsse Thirumalai +Threadripper threebody thrid ThunderX diff --git a/examples/COUPLE/plugin/CMakeLists.txt b/examples/COUPLE/plugin/CMakeLists.txt index 00f86058fb..4f7ab41847 100644 --- a/examples/COUPLE/plugin/CMakeLists.txt +++ b/examples/COUPLE/plugin/CMakeLists.txt @@ -27,10 +27,7 @@ if(MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() -find_package(MPI REQUIRED) -# do not include the (obsolete) MPI C++ bindings which makes -# for leaner object files and avoids namespace conflicts -set(MPI_CXX_SKIP_MPICXX TRUE) +find_package(MPI REQUIRED COMPONENTS C) ########################## diff --git a/examples/COUPLE/simple/CMakeLists.txt b/examples/COUPLE/simple/CMakeLists.txt index c09b372183..8396e5fb72 100644 --- a/examples/COUPLE/simple/CMakeLists.txt +++ b/examples/COUPLE/simple/CMakeLists.txt @@ -25,10 +25,10 @@ if(MSVC) add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif() -find_package(MPI QUIET) # do not include the (obsolete) MPI C++ bindings which makes # for leaner object files and avoids namespace conflicts set(MPI_CXX_SKIP_MPICXX TRUE) +find_package(MPI QUIET COMPONENTS C CXX) ########################## diff --git a/examples/PACKAGES/moments/in.converge b/examples/PACKAGES/moments/in.converge new file mode 100644 index 0000000000..4c77f249c2 --- /dev/null +++ b/examples/PACKAGES/moments/in.converge @@ -0,0 +1,35 @@ +# Detect convergence in a simulation using the relative change in +# moments. This demonstrates the "history" option. +# --------------------------------------------------------------------- + +# create pure copper system +units metal +lattice fcc 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box + +timestep 0.002 +create_atoms 1 box + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) + +# compute mean and stddev over the preceding 5000 steps, every 20 steps +variable toteng equal "etotal" +fix 2 all ave/moments 10 500 200 v_toteng mean stddev history 5 + +# Convergence criterion: stddev is smaller than threshold and was previously larger +# This avoids issues with system oscillations in the order of the averaging window +# that would otherwise lead to "nodes" in the stddev. +variable conv equal "(f_2[2] < 2.0) && (f_2[2][1] < f_2[2][5])" +fix 3 all halt 100 v_conv == 1 + +thermo_style custom step temp press etotal f_2[*][1] f_2[*][5] v_conv + +thermo 100 +run 10000 + diff --git a/examples/PACKAGES/moments/in.simple b/examples/PACKAGES/moments/in.simple new file mode 100644 index 0000000000..d82b8438c6 --- /dev/null +++ b/examples/PACKAGES/moments/in.simple @@ -0,0 +1,27 @@ +# Perform a simple simulation and output the moments of the total energy +# --------------------------------------------------------------------- + +# create pure copper system +units metal +lattice fcc 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box + +timestep 0.002 +create_atoms 1 box + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) + +variable toteng equal "etotal" +fix 2 all ave/moments 5 200 100 v_toteng mean stddev variance skew kurtosis + +thermo_style custom step temp press etotal f_2[*] + +thermo 100 +run 10000 + diff --git a/examples/PACKAGES/moments/in.valtest b/examples/PACKAGES/moments/in.valtest new file mode 100644 index 0000000000..214391909b --- /dev/null +++ b/examples/PACKAGES/moments/in.valtest @@ -0,0 +1,28 @@ +# Output raw and computed data. This can be used to perform the moment +# calculation in some external tool and validate our results +# --------------------------------------------------------------------- + +# create pure copper system +units metal +lattice fcc 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box + +timestep 0.002 +create_atoms 1 box + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) + +variable toteng equal "etotal" +fix 2 all ave/moments 1 10 10 v_toteng mean variance skew kurtosis + +thermo_style custom step etotal f_2[*] +thermo_modify format float %14.8f + +thermo 1 +run 100 diff --git a/examples/PACKAGES/moments/log.02May2025.converge.g++.1 b/examples/PACKAGES/moments/log.02May2025.converge.g++.1 new file mode 100644 index 0000000000..c6781927b2 --- /dev/null +++ b/examples/PACKAGES/moments/log.02May2025.converge.g++.1 @@ -0,0 +1,171 @@ +LAMMPS (2 Apr 2025 - Development - patch_4Feb2025-645-gba166d42e1-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# create pure copper system +units metal +lattice fcc 3.75 +Lattice spacing in x,y,z = 3.75 3.75 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box +Created orthogonal box = (0 0 0) to (22.5 22.5 22.5) + 1 by 1 by 1 MPI processor grid + +timestep 0.002 +create_atoms 1 box +Created 864 atoms + using lattice units in orthogonal box = (0 0 0) to (22.5 22.5 22.5) + create_atoms CPU = 0.001 seconds + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 0.2000000000000000111 + +variable toteng equal "etotal" +fix 2 all ave/moments 10 500 200 v_toteng mean stddev history 5 + +variable conv equal "(f_2[2] < 2) && (f_2[2][1] < f_2[2][5])" +fix 3 all halt 1000 v_conv == 1 + +thermo_style custom step temp press etotal f_2[*][1] f_2[*][5] v_conv + +thermo 100 +run 10000 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6825 + ghost atom cutoff = 8.6825 + binsize = 4.34125, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/alloy, 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) = 3.484 | 3.484 | 3.484 Mbytes + Step Temp Press TotEng f_2[1][1] f_2[2][1] f_2[1][5] f_2[2][5] v_conv + 0 1000 -107410.22 -2884.9159 0 0 0 0 0 + 100 512.04214 -124.66263 -2928.6 0 0 0 0 0 + 200 479.34328 -136.26635 -2931.3905 -2928.6251 2.1584834 0 0 0 + 300 480.05298 128.92946 -2933.9233 -2928.6251 2.1584834 0 0 0 + 400 471.83641 -29.253334 -2936.8631 -2931.3742 3.3668783 0 0 0 + 500 456.96309 -274.69336 -2939.9081 -2931.3742 3.3668783 0 0 0 + 600 450.32413 14.606227 -2942.973 -2934.277 5.0681849 0 0 0 + 700 431.71192 -45.641261 -2946.006 -2934.277 5.0681849 0 0 0 + 800 436.4217 589.91981 -2948.8885 -2937.2386 6.823233 0 0 0 + 900 407.84688 -3728.1499 -2951.6643 -2937.2386 6.823233 0 0 0 + 1000 401.69178 6695.3653 -2954.2959 -2940.1463 8.4728269 -2928.6251 2.1584834 0 + 1100 370.87469 -2294.843 -2956.9413 -2940.1463 8.4728269 -2928.6251 2.1584834 0 + 1200 375.15562 704.6568 -2959.3841 -2942.9613 10.001542 -2931.3742 3.3668783 0 + 1300 371.09077 -493.04016 -2961.6803 -2942.9613 10.001542 -2931.3742 3.3668783 0 + 1400 365.88512 490.98174 -2963.8365 -2945.6475 11.378724 -2934.277 5.0681849 0 + 1500 358.42655 -218.94911 -2965.8652 -2945.6475 11.378724 -2934.277 5.0681849 0 + 1600 329.08402 56.411923 -2967.7662 -2948.1844 12.597017 -2937.2386 6.823233 0 + 1700 317.74207 1192.918 -2969.557 -2948.1844 12.597017 -2937.2386 6.823233 0 + 1800 331.98966 -2205.7213 -2971.1465 -2950.559 13.653575 -2940.1463 8.4728269 0 + 1900 330.96814 1401.3066 -2972.6923 -2950.559 13.653575 -2940.1463 8.4728269 0 + 2000 315.41816 -909.41909 -2974.0785 -2952.7764 14.568194 -2942.9613 10.001542 0 + 2100 320.4269 1226.2006 -2975.3676 -2952.7764 14.568194 -2942.9613 10.001542 0 + 2200 302.88235 -1238.8052 -2976.5099 -2954.8327 15.341787 -2945.6475 11.378724 0 + 2300 300.4349 2667.202 -2977.5329 -2954.8327 15.341787 -2945.6475 11.378724 0 + 2400 292.94691 -5532.1854 -2978.3724 -2956.7266 15.978754 -2948.1844 12.597017 0 + 2500 286.12064 4647.3841 -2979.2217 -2956.7266 15.978754 -2948.1844 12.597017 0 + 2600 290.74305 -1950.526 -2979.9142 -2958.4592 16.485773 -2950.559 13.653575 0 + 2700 281.51347 937.60472 -2980.4808 -2958.4592 16.485773 -2950.559 13.653575 0 + 2800 279.71836 -801.62498 -2980.8899 -2960.032 16.869365 -2952.7764 14.568194 0 + 2900 277.41241 609.21495 -2981.1721 -2960.032 16.869365 -2952.7764 14.568194 0 + 3000 281.31161 -760.27203 -2981.3003 -2961.4399 17.128547 -2954.8327 15.341787 0 + 3100 284.72904 315.53038 -2981.297 -2961.4399 17.128547 -2954.8327 15.341787 0 + 3200 278.39445 516.25074 -2981.1224 -2962.6768 17.263037 -2956.7266 15.978754 0 + 3300 294.46998 -655.06212 -2980.8266 -2962.6768 17.263037 -2956.7266 15.978754 0 + 3400 290.04647 788.30424 -2980.3963 -2963.7417 17.280979 -2958.4592 16.485773 0 + 3500 283.218 -844.33188 -2979.8504 -2963.7417 17.280979 -2958.4592 16.485773 0 + 3600 288.76031 1339.2734 -2979.2382 -2964.6345 17.192698 -2960.032 16.869365 0 + 3700 289.44519 -3015.7161 -2978.5394 -2964.6345 17.192698 -2960.032 16.869365 0 + 3800 309.04206 5579.3265 -2977.8282 -2965.3649 17.01845 -2961.4399 17.128547 0 + 3900 309.34588 -4255.5213 -2977.1281 -2965.3649 17.01845 -2961.4399 17.128547 0 + 4000 305.79444 2358.1383 -2976.5251 -2965.9537 16.784519 -2962.6768 17.263037 0 + 4100 309.12957 -1401.6484 -2975.9173 -2965.9537 16.784519 -2962.6768 17.263037 0 + 4200 309.41928 1180.4111 -2975.3857 -2966.4277 16.516135 -2963.7417 17.280979 0 + 4300 299.88949 -1549.6591 -2974.927 -2966.4277 16.516135 -2963.7417 17.280979 0 + 4400 319.09918 1937.7006 -2974.5598 -2966.8138 16.232551 -2964.6345 17.192698 0 + 4500 326.48719 -1489.2073 -2974.311 -2966.8138 16.232551 -2964.6345 17.192698 0 + 4600 310.93392 37.586899 -2974.1959 -2967.1394 15.948448 -2965.3649 17.01845 0 + 4700 314.28994 317.12347 -2974.1763 -2967.1394 15.948448 -2965.3649 17.01845 0 + 4800 309.88756 -698.72705 -2974.2892 -2967.4334 15.675606 -2965.9537 16.784519 0 + 4900 309.53444 962.42921 -2974.5261 -2967.4334 15.675606 -2965.9537 16.784519 0 + 5000 316.06666 -1869.3275 -2974.8492 -2967.7182 15.421633 -2966.4277 16.516135 0 + 5100 304.82485 4042.6797 -2975.2715 -2967.7182 15.421633 -2966.4277 16.516135 0 + 5200 307.75342 -5058.4814 -2975.7195 -2969.5853 13.236776 -2966.8138 16.232551 0 + 5300 298.83511 3096.4566 -2976.3329 -2969.5853 13.236776 -2966.8138 16.232551 0 + 5400 296.85413 -1929.1654 -2976.8797 -2971.2747 11.121537 -2967.1394 15.948448 0 + 5500 295.88343 1449.3005 -2977.4488 -2971.2747 11.121537 -2967.1394 15.948448 0 + 5600 305.59328 -1504.0321 -2977.9573 -2972.77 9.1579616 -2967.4334 15.675606 0 + 5700 293.40683 2579.0134 -2978.4364 -2972.77 9.1579616 -2967.4334 15.675606 0 + 5800 297.93644 -2742.705 -2978.8276 -2974.0625 7.4101102 -2967.7182 15.421633 0 + 5900 290.39408 1189.4042 -2979.2224 -2974.0625 7.4101102 -2967.7182 15.421633 0 + 6000 293.73148 -232.54292 -2979.503 -2975.1594 5.8959922 -2969.5853 13.236776 0 + 6100 292.04933 -168.30971 -2979.6898 -2975.1594 5.8959922 -2969.5853 13.236776 0 + 6200 299.23747 839.17828 -2979.7883 -2976.0647 4.6378408 -2971.2747 11.121537 0 + 6300 294.92201 -1597.9426 -2979.7975 -2976.0647 4.6378408 -2971.2747 11.121537 0 + 6400 291.7185 3411.2916 -2979.6978 -2976.7848 3.643826 -2972.77 9.1579616 0 + 6500 285.34227 -4280.7968 -2979.4874 -2976.7848 3.643826 -2972.77 9.1579616 0 + 6600 295.53838 2138.7496 -2979.2799 -2977.3265 2.9178925 -2974.0625 7.4101102 0 + 6700 288.54718 -1818.7662 -2978.9379 -2977.3265 2.9178925 -2974.0625 7.4101102 0 + 6800 290.41342 2175.3559 -2978.543 -2977.7009 2.4532223 -2975.1594 5.8959922 0 + 6900 296.34456 -4782.08 -2978.0362 -2977.7009 2.4532223 -2975.1594 5.8959922 0 + 7000 303.74314 5905.219 -2977.577 -2977.9137 2.2279716 -2976.0647 4.6378408 0 + 7100 303.90284 -3291.7627 -2977.1308 -2977.9137 2.2279716 -2976.0647 4.6378408 0 + 7200 296.13966 2209.574 -2976.7001 -2977.9829 2.1708943 -2976.7848 3.643826 0 + 7300 295.79694 -1609.1898 -2976.2816 -2977.9829 2.1708943 -2976.7848 3.643826 0 + 7400 306.53289 988.50902 -2975.8992 -2977.931 2.1935882 -2977.3265 2.9178925 0 + 7500 303.89992 -631.22838 -2975.5597 -2977.931 2.1935882 -2977.3265 2.9178925 0 + 7600 303.83684 -348.48744 -2975.3074 -2977.7831 2.2226664 -2977.7009 2.4532223 0 + 7700 309.67313 1350.9414 -2975.1279 -2977.7831 2.2226664 -2977.7009 2.4532223 0 + 7800 309.74314 -1182.8905 -2975.0174 -2977.5683 2.2106484 -2977.9137 2.2279716 0 + 7900 309.42429 999.08033 -2975.0089 -2977.5683 2.2106484 -2977.9137 2.2279716 0 + 8000 315.51872 -1337.8894 -2975.0791 -2977.3233 2.1379295 -2977.9829 2.1708943 0 + 8100 314.80533 2392.3424 -2975.25 -2977.3233 2.1379295 -2977.9829 2.1708943 0 + 8200 303.80236 -3224.5976 -2975.4744 -2977.0851 2.0176342 -2977.931 2.1935882 0 + 8300 295.0505 3296.6912 -2975.8196 -2977.0851 2.0176342 -2977.931 2.1935882 0 + 8400 302.4154 -3314.5096 -2976.1586 -2976.8877 1.883051 -2977.7831 2.2226664 1 + 8500 300.95491 2971.1291 -2976.5859 -2976.8877 1.883051 -2977.7831 2.2226664 1 + 8600 301.68919 -2297.6673 -2976.9953 -2976.7596 1.785401 -2977.5683 2.2106484 1 + 8700 291.21002 1477.5703 -2977.4323 -2976.7596 1.785401 -2977.5683 2.2106484 1 + 8800 305.87126 -1085.459 -2977.8247 -2976.7169 1.7541517 -2977.3233 2.1379295 1 + 8900 296.17567 777.95805 -2978.2081 -2976.7169 1.7541517 -2977.3233 2.1379295 1 +Fix halt condition for fix-id 3 met on step 9000 with value 1 (src/fix_halt.cpp:310) + 9000 295.71917 -425.00708 -2978.5264 -2976.7595 1.7755885 -2977.0851 2.0176342 1 +Loop time of 42.1758 on 1 procs for 9000 steps with 864 atoms + +Performance: 36.874 ns/day, 0.651 hours/ns, 213.393 timesteps/s, 184.371 katom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 41.126 | 41.126 | 41.126 | 0.0 | 97.51 +Neigh | 0.0078787 | 0.0078787 | 0.0078787 | 0.0 | 0.02 +Comm | 0.26508 | 0.26508 | 0.26508 | 0.0 | 0.63 +Output | 0.0096224 | 0.0096224 | 0.0096224 | 0.0 | 0.02 +Modify | 0.65597 | 0.65597 | 0.65597 | 0.0 | 1.56 +Other | | 0.1108 | | | 0.26 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3767 ave 3767 max 3767 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 96746 ave 96746 max 96746 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 96746 +Ave neighs/atom = 111.97454 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:42 diff --git a/examples/PACKAGES/moments/log.02May2025.converge.g++.4 b/examples/PACKAGES/moments/log.02May2025.converge.g++.4 new file mode 100644 index 0000000000..172f14d4f4 --- /dev/null +++ b/examples/PACKAGES/moments/log.02May2025.converge.g++.4 @@ -0,0 +1,171 @@ +LAMMPS (2 Apr 2025 - Development - patch_4Feb2025-645-gba166d42e1-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# create pure copper system +units metal +lattice fcc 3.75 +Lattice spacing in x,y,z = 3.75 3.75 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box +Created orthogonal box = (0 0 0) to (22.5 22.5 22.5) + 1 by 2 by 2 MPI processor grid + +timestep 0.002 +create_atoms 1 box +Created 864 atoms + using lattice units in orthogonal box = (0 0 0) to (22.5 22.5 22.5) + create_atoms CPU = 0.001 seconds + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 0.2000000000000000111 + +variable toteng equal "etotal" +fix 2 all ave/moments 10 500 200 v_toteng mean stddev history 5 + +variable conv equal "(f_2[2] < 2) && (f_2[2][1] < f_2[2][5])" +fix 3 all halt 1000 v_conv == 1 + +thermo_style custom step temp press etotal f_2[*][1] f_2[*][5] v_conv + +thermo 100 +run 10000 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6825 + ghost atom cutoff = 8.6825 + binsize = 4.34125, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/alloy, 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) = 3.42 | 3.42 | 3.42 Mbytes + Step Temp Press TotEng f_2[1][1] f_2[2][1] f_2[1][5] f_2[2][5] v_conv + 0 1000 -107410.22 -2884.9159 0 0 0 0 0 + 100 492.38014 -134.33622 -2928.6874 0 0 0 0 0 + 200 484.82396 -214.26318 -2931.4603 -2928.6979 2.1805063 0 0 0 + 300 476.69743 15.78678 -2934.0022 -2928.6979 2.1805063 0 0 0 + 400 482.51415 141.67184 -2936.9347 -2931.4437 3.3715811 0 0 0 + 500 455.45411 2.4424602 -2939.9649 -2931.4437 3.3715811 0 0 0 + 600 455.20054 -6.8170934 -2943.0454 -2934.339 5.0598781 0 0 0 + 700 429.81168 -75.812923 -2946.0438 -2934.339 5.0598781 0 0 0 + 800 428.22097 604.18705 -2948.9285 -2937.2965 6.813037 0 0 0 + 900 399.10914 -3622.6904 -2951.7252 -2937.2965 6.813037 0 0 0 + 1000 394.62543 7905.9041 -2954.2925 -2940.2044 8.4668749 -2928.6979 2.1805063 0 + 1100 404.27007 -2565.5508 -2956.9736 -2940.2044 8.4668749 -2928.6979 2.1805063 0 + 1200 368.47178 741.43707 -2959.4264 -2943.0151 9.9914785 -2931.4437 3.3715811 0 + 1300 360.91266 -267.08372 -2961.69 -2943.0151 9.9914785 -2931.4437 3.3715811 0 + 1400 356.74405 158.09093 -2963.8501 -2945.696 11.36357 -2934.339 5.0598781 0 + 1500 335.45696 -71.007783 -2965.8817 -2945.696 11.36357 -2934.339 5.0598781 0 + 1600 331.01199 -454.90004 -2967.7708 -2948.2278 12.577884 -2937.2965 6.813037 0 + 1700 329.223 2428.4284 -2969.5452 -2948.2278 12.577884 -2937.2965 6.813037 0 + 1800 327.61481 -4757.648 -2971.1105 -2950.5985 13.632251 -2940.2044 8.4668749 0 + 1900 318.18741 2226.7765 -2972.6906 -2950.5985 13.632251 -2940.2044 8.4668749 0 + 2000 308.79313 -1089.8603 -2974.0899 -2952.8123 14.545164 -2943.0151 9.9914785 0 + 2100 303.32047 757.53534 -2975.3597 -2952.8123 14.545164 -2943.0151 9.9914785 0 + 2200 307.41102 -837.97246 -2976.4966 -2954.8654 15.317558 -2945.696 11.36357 0 + 2300 303.01088 1618.29 -2977.5454 -2954.8654 15.317558 -2945.696 11.36357 0 + 2400 297.59385 -3233.8282 -2978.4064 -2956.7565 15.953758 -2948.2278 12.577884 0 + 2500 288.72232 5209.2099 -2979.1999 -2956.7565 15.953758 -2948.2278 12.577884 0 + 2600 298.92201 -2193.618 -2979.8873 -2958.4845 16.457635 -2950.5985 13.632251 0 + 2700 282.61818 765.88178 -2980.4563 -2958.4845 16.457635 -2950.5985 13.632251 0 + 2800 273.63104 -389.49749 -2980.8636 -2960.0533 16.839029 -2952.8123 14.545164 0 + 2900 274.12166 -9.2552992 -2981.1421 -2960.0533 16.839029 -2952.8123 14.545164 0 + 3000 279.43592 212.25445 -2981.2716 -2961.4578 17.096628 -2954.8654 15.317558 0 + 3100 291.10071 -1139.205 -2981.2475 -2961.4578 17.096628 -2954.8654 15.317558 0 + 3200 281.53171 3124.6411 -2981.0818 -2962.6921 17.230604 -2956.7565 15.953758 0 + 3300 277.0223 -2795.9494 -2980.7825 -2962.6921 17.230604 -2956.7565 15.953758 0 + 3400 284.8443 1587.8876 -2980.3701 -2963.754 17.247489 -2958.4845 16.457635 0 + 3500 281.19 -1143.0785 -2979.8374 -2963.754 17.247489 -2958.4845 16.457635 0 + 3600 296.58287 1156.4706 -2979.2182 -2964.645 17.159411 -2960.0533 16.839029 0 + 3700 297.24517 -1888.4993 -2978.5352 -2964.645 17.159411 -2960.0533 16.839029 0 + 3800 290.81586 3843.3483 -2977.8509 -2965.3746 16.985916 -2961.4578 17.096628 0 + 3900 300.39456 -5584.8386 -2977.0837 -2965.3746 16.985916 -2961.4578 17.096628 0 + 4000 306.15811 3310.0105 -2976.5086 -2965.9619 16.752214 -2962.6921 17.230604 0 + 4100 295.907 -1475.0458 -2975.9096 -2965.9619 16.752214 -2962.6921 17.230604 0 + 4200 322.70162 933.76586 -2975.3867 -2966.4348 16.484219 -2963.754 17.247489 0 + 4300 306.69631 -512.7048 -2974.9324 -2966.4348 16.484219 -2963.754 17.247489 0 + 4400 309.23776 226.77219 -2974.5791 -2966.8208 16.201471 -2964.645 17.159411 0 + 4500 313.15783 508.29785 -2974.3263 -2966.8208 16.201471 -2964.645 17.159411 0 + 4600 316.26151 -2043.7571 -2974.1697 -2967.1463 15.918137 -2965.3746 16.985916 0 + 4700 312.27329 1831.682 -2974.1732 -2967.1463 15.918137 -2965.3746 16.985916 0 + 4800 307.61066 -1476.0019 -2974.2885 -2967.4397 15.645834 -2965.9619 16.752214 0 + 4900 305.73489 1303.4848 -2974.5506 -2967.4397 15.645834 -2965.9619 16.752214 0 + 5000 309.3774 -1574.6812 -2974.8687 -2967.7249 15.392787 -2966.4348 16.484219 0 + 5100 304.8602 2679.7476 -2975.3082 -2967.7249 15.392787 -2966.4348 16.484219 0 + 5200 297.54226 -5008.0905 -2975.7443 -2969.5904 13.211657 -2966.8208 16.201471 0 + 5300 306.18872 4840.4175 -2976.324 -2969.5904 13.211657 -2966.8208 16.201471 0 + 5400 299.57661 -2513.1706 -2976.8842 -2971.2774 11.099846 -2967.1463 15.918137 0 + 5500 302.30844 1301.3525 -2977.4539 -2971.2774 11.099846 -2967.1463 15.918137 0 + 5600 302.11038 -760.79712 -2977.9764 -2972.7712 9.1381778 -2967.4397 15.645834 0 + 5700 294.49825 718.67318 -2978.4584 -2972.7712 9.1381778 -2967.4397 15.645834 0 + 5800 305.97636 -478.64224 -2978.8638 -2974.0628 7.3929182 -2967.7249 15.392787 0 + 5900 291.93868 -419.74179 -2979.2292 -2974.0628 7.3929182 -2967.7249 15.392787 0 + 6000 289.50667 859.85085 -2979.5018 -2975.1575 5.8837236 -2969.5904 13.211657 0 + 6100 305.70118 -933.35917 -2979.6877 -2975.1575 5.8837236 -2969.5904 13.211657 0 + 6200 284.37805 1526.0707 -2979.806 -2976.062 4.6281363 -2971.2774 11.099846 0 + 6300 291.08863 -2156.6708 -2979.8064 -2976.062 4.6281363 -2971.2774 11.099846 0 + 6400 295.99073 2819.8245 -2979.7378 -2976.7827 3.6358684 -2972.7712 9.1381778 0 + 6500 298.06769 -3396.3504 -2979.5428 -2976.7827 3.6358684 -2972.7712 9.1381778 0 + 6600 301.78514 5496.6525 -2979.2768 -2977.3261 2.9112079 -2974.0628 7.3929182 0 + 6700 290.80665 -5229.4989 -2978.9177 -2977.3261 2.9112079 -2974.0628 7.3929182 0 + 6800 296.75761 2401.7807 -2978.5996 -2977.7014 2.4473856 -2975.1575 5.8837236 0 + 6900 295.77553 -1521.6269 -2978.1619 -2977.7014 2.4473856 -2975.1575 5.8837236 0 + 7000 303.59015 1530.7255 -2977.7097 -2977.9176 2.2219164 -2976.062 4.6281363 0 + 7100 297.51038 -3016.4426 -2977.2025 -2977.9176 2.2219164 -2976.062 4.6281363 0 + 7200 293.53789 2705.9808 -2976.7651 -2977.9894 2.1638143 -2976.7827 3.6358684 0 + 7300 301.78809 -1042.1076 -2976.3388 -2977.9894 2.1638143 -2976.7827 3.6358684 0 + 7400 307.50053 214.56923 -2975.9581 -2977.9394 2.1852009 -2977.3261 2.9112079 0 + 7500 301.98985 281.86495 -2975.6146 -2977.9394 2.1852009 -2977.3261 2.9112079 0 + 7600 318.37347 -1145.7795 -2975.3473 -2977.7949 2.2136707 -2977.7014 2.4473856 0 + 7700 314.94512 4536.9887 -2975.1351 -2977.7949 2.2136707 -2977.7014 2.4473856 0 + 7800 312.91485 -2980.6408 -2975.0156 -2977.5818 2.2038198 -2977.9176 2.2219164 0 + 7900 310.06854 2244.3877 -2975.0094 -2977.5818 2.2038198 -2977.9176 2.2219164 0 + 8000 308.55007 -2427.1464 -2975.0491 -2977.3378 2.1348358 -2977.9894 2.1638143 0 + 8100 323.02796 3187.4728 -2975.2081 -2977.3378 2.1348358 -2977.9894 2.1638143 0 + 8200 327.05029 -6447.7875 -2975.3162 -2977.0986 2.0196599 -2977.9394 2.1852009 0 + 8300 311.194 4273.1174 -2975.7217 -2977.0986 2.0196599 -2977.9394 2.1852009 0 + 8400 290.61931 -2301.019 -2976.0963 -2976.8989 1.8918948 -2977.7949 2.2136707 1 + 8500 314.00559 1966.1297 -2976.5206 -2976.8989 1.8918948 -2977.7949 2.2136707 1 + 8600 288.26541 -1608.4524 -2976.9304 -2976.7685 1.7971228 -2977.5818 2.2038198 1 + 8700 298.92083 1353.9988 -2977.355 -2976.7685 1.7971228 -2977.5818 2.2038198 1 + 8800 299.97274 -638.68301 -2977.766 -2976.722 1.7650747 -2977.3378 2.1348358 1 + 8900 300.66443 -279.62514 -2978.1476 -2976.722 1.7650747 -2977.3378 2.1348358 1 +Fix halt condition for fix-id 3 met on step 9000 with value 1 (src/fix_halt.cpp:310) + 9000 290.44715 489.06352 -2978.4892 -2976.7631 1.7846181 -2977.0986 2.0196599 1 +Loop time of 14.7347 on 4 procs for 9000 steps with 864 atoms + +Performance: 105.547 ns/day, 0.227 hours/ns, 610.804 timesteps/s, 527.735 katom-step/s +92.8% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 10.565 | 11.474 | 12.015 | 16.1 | 77.87 +Neigh | 0.0020313 | 0.0020966 | 0.002163 | 0.1 | 0.01 +Comm | 2.008 | 2.5374 | 3.4278 | 33.5 | 17.22 +Output | 0.0030284 | 0.0036299 | 0.0051776 | 1.5 | 0.02 +Modify | 0.42442 | 0.43307 | 0.44329 | 1.0 | 2.94 +Other | | 0.2849 | | | 1.93 + +Nlocal: 216 ave 224 max 204 min +Histogram: 1 0 0 0 0 0 0 2 0 1 +Nghost: 2147 ave 2159 max 2139 min +Histogram: 1 0 0 2 0 0 0 0 0 1 +Neighs: 24185.8 ave 26045 max 21309 min +Histogram: 1 0 0 0 0 1 0 0 0 2 + +Total # of neighbors = 96743 +Ave neighs/atom = 111.97106 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:14 diff --git a/examples/PACKAGES/moments/log.02May2025.simple.g++.1 b/examples/PACKAGES/moments/log.02May2025.simple.g++.1 new file mode 100644 index 0000000000..3a2fe80beb --- /dev/null +++ b/examples/PACKAGES/moments/log.02May2025.simple.g++.1 @@ -0,0 +1,177 @@ +LAMMPS (2 Apr 2025 - Development - patch_4Feb2025-645-gba166d42e1-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# create pure copper system +units metal +lattice fcc 3.75 +Lattice spacing in x,y,z = 3.75 3.75 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box +Created orthogonal box = (0 0 0) to (22.5 22.5 22.5) + 1 by 1 by 1 MPI processor grid + +timestep 0.002 +create_atoms 1 box +Created 864 atoms + using lattice units in orthogonal box = (0 0 0) to (22.5 22.5 22.5) + create_atoms CPU = 0.001 seconds + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 0.2000000000000000111 + +variable toteng equal "etotal" +fix 2 all ave/moments 5 200 100 v_toteng mean stddev variance skew kurtosis + +thermo_style custom step temp press etotal f_2[*] + +thermo 100 +run 10000 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6825 + ghost atom cutoff = 8.6825 + binsize = 4.34125, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/alloy, 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) = 3.484 | 3.484 | 3.484 Mbytes + Step Temp Press TotEng f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] + 0 1000 -107410.22 -2884.9159 0 0 0 0 0 + 100 512.04214 -124.66263 -2928.6 -2927.1688 1.6797138 2.8214386 2.5218138 6.164012 + 200 479.34328 -136.26635 -2931.3905 -2928.6374 1.9791406 3.9169976 1.3377745 3.2426285 + 300 480.05298 128.92946 -2933.9233 -2929.9825 2.5401119 6.4521682 0.66415393 0.77130236 + 400 471.83641 -29.253334 -2936.8631 -2931.346 3.2640831 10.654239 0.29075579 -0.26904542 + 500 456.96309 -274.69336 -2939.9081 -2932.7721 4.1077082 16.873267 0.094954709 -0.72240572 + 600 450.32413 14.606227 -2942.973 -2934.2328 4.9928765 24.928816 0.0090731063 -0.93757177 + 700 431.71192 -45.641261 -2946.006 -2935.7111 5.8871117 34.658084 -0.024573652 -1.0540107 + 800 436.4217 589.91981 -2948.8885 -2937.1871 6.762411 45.730202 -0.028553126 -1.1275153 + 900 407.84688 -3728.1499 -2951.6643 -2938.652 7.6129868 57.957569 -0.020186137 -1.172618 + 1000 401.69178 6695.3653 -2954.2959 -2940.0921 8.423174 70.949861 -0.0018224075 -1.2051609 + 1100 370.87469 -2294.843 -2956.9413 -2942.9469 8.384346 70.297257 0.016964628 -1.2643199 + 1200 375.15562 704.6568 -2959.3841 -2945.7589 8.3201293 69.224551 0.070500644 -1.2400262 + 1300 371.09077 -493.04016 -2961.6803 -2948.5516 8.1425118 66.300499 0.11183042 -1.2099873 + 1400 365.88512 490.98174 -2963.8365 -2951.2897 7.8673969 61.895934 0.13639588 -1.198071 + 1500 358.42655 -218.94911 -2965.8652 -2953.9337 7.5491659 56.989906 0.15564307 -1.1896984 + 1600 329.08402 56.411923 -2967.7662 -2956.467 7.2016413 51.863637 0.17198437 -1.186472 + 1700 317.74207 1192.918 -2969.557 -2958.8765 6.8379658 46.757776 0.19041811 -1.1812241 + 1800 331.98966 -2205.7213 -2971.1465 -2961.1601 6.4614065 41.749774 0.20925197 -1.1714131 + 1900 330.96814 1401.3066 -2972.6923 -2963.3191 6.0867317 37.048302 0.22552163 -1.1523125 + 2000 315.41816 -909.41909 -2974.0785 -2965.3567 5.7020261 32.513101 0.2328316 -1.1454375 + 2100 320.4269 1226.2006 -2975.3676 -2967.2609 5.3260556 28.366869 0.24130517 -1.1432352 + 2200 302.88235 -1238.8052 -2976.5099 -2969.0355 4.9584282 24.58601 0.25200271 -1.141699 + 2300 300.4349 2667.202 -2977.5329 -2970.6815 4.5986371 21.147463 0.26764984 -1.1380521 + 2400 292.94691 -5532.1854 -2978.3724 -2972.201 4.2403749 17.980779 0.28797864 -1.1357902 + 2500 286.12064 4647.3841 -2979.2217 -2973.5946 3.8875889 15.113348 0.31556585 -1.1249025 + 2600 290.74305 -1950.526 -2979.9142 -2974.8686 3.5422986 12.547879 0.34719546 -1.0987558 + 2700 281.51347 937.60472 -2980.4808 -2976.0235 3.1955646 10.211633 0.38268676 -1.0664838 + 2800 279.71836 -801.62498 -2980.8899 -2977.0588 2.844105 8.0889331 0.41930147 -1.0460672 + 2900 277.41241 609.21495 -2981.1721 -2977.9673 2.4956133 6.2280855 0.47337432 -1.0140054 + 3000 281.31161 -760.27203 -2981.3003 -2978.7489 2.1466012 4.6078967 0.55325134 -0.95161956 + 3100 284.72904 315.53038 -2981.297 -2979.4023 1.7929581 3.2146986 0.66481771 -0.84726207 + 3200 278.39445 516.25074 -2981.1224 -2979.9226 1.4369984 2.0649644 0.82583409 -0.63830994 + 3300 294.46998 -655.06212 -2980.8266 -2980.3134 1.0905211 1.1892364 1.0357766 -0.22841943 + 3400 290.04647 788.30424 -2980.3963 -2980.5732 0.77030961 0.59337689 1.1867647 0.34447355 + 3500 283.218 -844.33188 -2979.8504 -2980.6995 0.54590076 0.29800764 0.78163948 -0.42619888 + 3600 288.76031 1339.2734 -2979.2382 -2980.6921 0.56032295 0.31396181 0.83603869 -0.30853278 + 3700 289.44519 -3015.7161 -2978.5394 -2980.5581 0.77708069 0.60385439 1.0796997 -0.022962365 + 3800 309.04206 5579.3265 -2977.8282 -2980.3052 1.0531468 1.1091181 0.890018 -0.56034495 + 3900 309.34588 -4255.5213 -2977.1281 -2979.9487 1.3153981 1.7302721 0.65242676 -0.95498589 + 4000 305.79444 2358.1383 -2976.5251 -2979.5068 1.5325477 2.3487025 0.44420123 -1.1839975 + 4100 309.12957 -1401.6484 -2975.9173 -2978.9985 1.6923829 2.86416 0.26850538 -1.3006942 + 4200 309.41928 1180.4111 -2975.3857 -2978.4446 1.7941259 3.2188877 0.11443933 -1.3365167 + 4300 299.88949 -1549.6591 -2974.927 -2977.8616 1.8268192 3.3372683 -0.018659059 -1.3293426 + 4400 319.09918 1937.7006 -2974.5598 -2977.273 1.7942266 3.219249 -0.13743367 -1.2958767 + 4500 326.48719 -1489.2073 -2974.311 -2976.7017 1.7042328 2.9044096 -0.25309558 -1.2385503 + 4600 310.93392 37.586899 -2974.1959 -2976.1697 1.5590672 2.4306905 -0.3757949 -1.1641151 + 4700 314.28994 317.12347 -2974.1763 -2975.6978 1.3661244 1.8662958 -0.51792367 -1.0609001 + 4800 309.88756 -698.72705 -2974.2892 -2975.3021 1.1422822 1.3048085 -0.69587053 -0.87319738 + 4900 309.53444 962.42921 -2974.5261 -2974.9944 0.89961859 0.80931361 -0.91892105 -0.49661907 + 5000 316.06666 -1869.3275 -2974.8492 -2974.7804 0.65817496 0.43319428 -1.0974595 0.048447651 + 5100 304.82485 4042.6797 -2975.2715 -2974.6661 0.47073268 0.22158926 -0.82059377 -0.31531887 + 5200 307.75342 -5058.4814 -2975.7195 -2974.6547 0.44733518 0.20010876 -0.68956594 -0.65171579 + 5300 298.83511 3096.4566 -2976.3329 -2974.7467 0.60599527 0.36723026 -1.0652601 0.032591262 + 5400 296.85413 -1929.1654 -2976.8797 -2974.9367 0.82832935 0.68612952 -0.91576774 -0.50322222 + 5500 295.88343 1449.3005 -2977.4488 -2975.215 1.044317 1.090598 -0.67574925 -0.92510515 + 5600 305.59328 -1504.0321 -2977.9573 -2975.5653 1.2243609 1.4990595 -0.46160433 -1.1708115 + 5700 293.40683 2579.0134 -2978.4364 -2975.97 1.3577316 1.843435 -0.27746111 -1.2993802 + 5800 297.93644 -2742.705 -2978.8276 -2976.411 1.4332742 2.054275 -0.11245859 -1.3584974 + 5900 290.39408 1189.4042 -2979.2224 -2976.8733 1.4576633 2.1247823 0.030209056 -1.3466833 + 6000 293.73148 -232.54292 -2979.503 -2977.3408 1.4300816 2.0451335 0.15663025 -1.2965878 + 6100 292.04933 -168.30971 -2979.6898 -2977.7936 1.3523929 1.8289665 0.28027258 -1.2214523 + 6200 299.23747 839.17828 -2979.7883 -2978.2154 1.2284868 1.5091798 0.40149929 -1.1382373 + 6300 294.92201 -1597.9426 -2979.7975 -2978.589 1.072002 1.1491883 0.53769821 -1.0262094 + 6400 291.7185 3411.2916 -2979.6978 -2978.9013 0.89165749 0.79505308 0.70748196 -0.83601078 + 6500 285.34227 -4280.7968 -2979.4874 -2979.1407 0.69727552 0.48619315 0.91500724 -0.4890805 + 6600 295.53838 2138.7496 -2979.2799 -2979.3084 0.50938648 0.25947459 1.0827149 -0.0043801382 + 6700 288.54718 -1818.7662 -2978.9379 -2979.3979 0.3658125 0.13381879 0.85573626 -0.20104653 + 6800 290.41342 2175.3559 -2978.543 -2979.4085 0.34439248 0.11860618 0.70989241 -0.55138716 + 6900 296.34456 -4782.08 -2978.0362 -2979.3362 0.47081063 0.22166265 1.1051059 0.16381282 + 7000 303.74314 5905.219 -2977.577 -2979.182 0.65635739 0.43080502 0.97456755 -0.34269231 + 7100 303.90284 -3291.7627 -2977.1308 -2978.9595 0.83412944 0.69577192 0.71973637 -0.85687335 + 7200 296.13966 2209.574 -2976.7001 -2978.6767 0.98885368 0.97783159 0.50554418 -1.124705 + 7300 295.79694 -1609.1898 -2976.2816 -2978.3446 1.1093729 1.2307082 0.32952142 -1.2657581 + 7400 306.53289 988.50902 -2975.8992 -2977.977 1.1910167 1.4185209 0.17936365 -1.331845 + 7500 303.89992 -631.22838 -2975.5597 -2977.5901 1.2352698 1.5258915 0.033110856 -1.3362459 + 7600 303.83684 -348.48744 -2975.3074 -2977.1915 1.2312686 1.5160224 -0.094817417 -1.3063491 + 7700 309.67313 1350.9414 -2975.1279 -2976.7984 1.1829266 1.3993154 -0.21343083 -1.2573517 + 7800 309.74314 -1182.8905 -2975.0174 -2976.4294 1.0913021 1.1909402 -0.3401118 -1.198459 + 7900 309.42429 999.08033 -2975.0089 -2976.0995 0.96393318 0.92916717 -0.48456322 -1.1149956 + 8000 315.51872 -1337.8894 -2975.0791 -2975.822 0.81535467 0.66480324 -0.67906685 -0.90499956 + 8100 314.80533 2392.3424 -2975.25 -2975.6019 0.64582022 0.41708376 -0.90521871 -0.5328796 + 8200 303.80236 -3224.5976 -2975.4744 -2975.4481 0.47449379 0.22514436 -1.0884377 -0.00018150871 + 8300 295.0505 3296.6912 -2975.8196 -2975.3667 0.34164698 0.11672266 -0.83269043 -0.31809119 + 8400 302.4154 -3314.5096 -2976.1586 -2975.3606 0.32904826 0.10827276 -0.73500255 -0.57861735 + 8500 300.95491 2971.1291 -2976.5859 -2975.4288 0.44584452 0.19877734 -1.0760301 0.014924509 + 8600 301.68919 -2297.6673 -2976.9953 -2975.5682 0.60852433 0.37030186 -0.91802963 -0.5143582 + 8700 291.21002 1477.5703 -2977.4323 -2975.7733 0.76843347 0.59048999 -0.68059043 -0.92051715 + 8800 305.87126 -1085.459 -2977.8247 -2976.0327 0.90672273 0.82214612 -0.47413162 -1.1492716 + 8900 296.17567 777.95805 -2978.2081 -2976.3349 1.0129061 1.0259789 -0.29734681 -1.271416 + 9000 295.71917 -425.00708 -2978.5264 -2976.6672 1.0786137 1.1634075 -0.14055755 -1.3302079 + 9100 296.85578 -533.46289 -2978.8197 -2977.0152 1.1000855 1.2101882 0.0045950751 -1.3434868 + 9200 293.949 605.27065 -2979.0349 -2977.3702 1.0854405 1.1781811 0.123965 -1.3093197 + 9300 289.11704 -896.44753 -2979.1981 -2977.7166 1.0353526 1.071955 0.23898813 -1.2558296 + 9400 285.34521 1181.7542 -2979.2879 -2978.0404 0.95298596 0.90818224 0.36461645 -1.1736585 + 9500 296.17714 -2503.9848 -2979.2668 -2978.3301 0.8407037 0.70678272 0.50841734 -1.0540275 + 9600 296.43744 4912.6395 -2979.1829 -2978.5736 0.70352404 0.49494608 0.68312042 -0.86335848 + 9700 288.63317 -3935.8902 -2979.0381 -2978.7635 0.55322477 0.30605764 0.88509388 -0.54108379 + 9800 296.27133 1365.4106 -2978.8723 -2978.8969 0.40665162 0.16536554 1.0460992 -0.092552905 + 9900 299.37628 -1267.2668 -2978.5934 -2978.9673 0.29467695 0.086834506 0.80391757 -0.38307943 + 10000 296.60645 1950.1018 -2978.2725 -2978.9739 0.28169006 0.079349287 0.70171659 -0.62026504 +Loop time of 47.4814 on 1 procs for 10000 steps with 864 atoms + +Performance: 36.393 ns/day, 0.659 hours/ns, 210.609 timesteps/s, 181.966 katom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 46.299 | 46.299 | 46.299 | 0.0 | 97.51 +Neigh | 0.010908 | 0.010908 | 0.010908 | 0.0 | 0.02 +Comm | 0.29643 | 0.29643 | 0.29643 | 0.0 | 0.62 +Output | 0.0090682 | 0.0090682 | 0.0090682 | 0.0 | 0.02 +Modify | 0.7406 | 0.7406 | 0.7406 | 0.0 | 1.56 +Other | | 0.1254 | | | 0.26 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3767 ave 3767 max 3767 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 96746 ave 96746 max 96746 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 96746 +Ave neighs/atom = 111.97454 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:47 diff --git a/examples/PACKAGES/moments/log.02May2025.simple.g++.4 b/examples/PACKAGES/moments/log.02May2025.simple.g++.4 new file mode 100644 index 0000000000..dde6be4aa3 --- /dev/null +++ b/examples/PACKAGES/moments/log.02May2025.simple.g++.4 @@ -0,0 +1,177 @@ +LAMMPS (2 Apr 2025 - Development - patch_4Feb2025-645-gba166d42e1-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# create pure copper system +units metal +lattice fcc 3.75 +Lattice spacing in x,y,z = 3.75 3.75 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box +Created orthogonal box = (0 0 0) to (22.5 22.5 22.5) + 1 by 2 by 2 MPI processor grid + +timestep 0.002 +create_atoms 1 box +Created 864 atoms + using lattice units in orthogonal box = (0 0 0) to (22.5 22.5 22.5) + create_atoms CPU = 0.010 seconds + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 0.2000000000000000111 + +variable toteng equal "etotal" +fix 2 all ave/moments 5 200 100 v_toteng mean stddev variance skew kurtosis + +thermo_style custom step temp press etotal f_2[*] + +thermo 100 +run 10000 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6825 + ghost atom cutoff = 8.6825 + binsize = 4.34125, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/alloy, 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) = 3.42 | 3.42 | 3.42 Mbytes + Step Temp Press TotEng f_2[1] f_2[2] f_2[3] f_2[4] f_2[5] + 0 1000 -107410.22 -2884.9159 0 0 0 0 0 + 100 492.38014 -134.33622 -2928.6874 -2927.2291 1.7092959 2.9216925 2.5081594 6.099781 + 200 484.82396 -214.26318 -2931.4603 -2928.71 2.0003214 4.0012857 1.3645049 3.3103886 + 300 476.69743 15.78678 -2934.0022 -2930.0515 2.5470901 6.4876682 0.6954232 0.86102766 + 400 482.51415 141.67184 -2936.9347 -2931.4152 3.2681043 10.680505 0.30641098 -0.22337036 + 500 455.45411 2.4424602 -2939.9649 -2932.8397 4.1076295 16.87262 0.10483325 -0.6997127 + 600 455.20054 -6.8170934 -2943.0454 -2934.2947 4.9842257 24.842506 0.018003661 -0.92490336 + 700 429.81168 -75.812923 -2946.0438 -2935.7704 5.8766819 34.53539 -0.019539731 -1.0444564 + 800 428.22097 604.18705 -2948.9285 -2937.2449 6.7522047 45.592268 -0.026384526 -1.1194924 + 900 399.10914 -3622.6904 -2951.7252 -2938.7094 7.6043904 57.826753 -0.019997758 -1.1658244 + 1000 394.62543 7905.9041 -2954.2925 -2940.15 8.4168551 70.84345 -0.0026187371 -1.2004009 + 1100 404.27007 -2565.5508 -2956.9736 -2943.0009 8.3722389 70.094384 0.015852037 -1.2665587 + 1200 368.47178 741.43707 -2959.4264 -2945.8091 8.3127243 69.101386 0.069744698 -1.2412651 + 1300 360.91266 -267.08372 -2961.69 -2948.5981 8.1334656 66.153263 0.1116445 -1.2129213 + 1400 356.74405 158.09093 -2963.8501 -2951.3302 7.8574973 61.740264 0.13825232 -1.1999727 + 1500 335.45696 -71.007783 -2965.8817 -2953.9689 7.5384846 56.82875 0.15915227 -1.1877331 + 1600 331.01199 -454.90004 -2967.7708 -2956.5 7.1862592 51.642321 0.17403957 -1.1840985 + 1700 329.223 2428.4284 -2969.5452 -2958.9073 6.8228029 46.55064 0.19027454 -1.1778276 + 1800 327.61481 -4757.648 -2971.1105 -2961.1863 6.4445074 41.531675 0.20819854 -1.1712539 + 1900 318.18741 2226.7765 -2972.6906 -2963.3396 6.0703365 36.848986 0.22378928 -1.1556732 + 2000 308.79313 -1089.8603 -2974.0899 -2965.3712 5.6913723 32.391718 0.23279863 -1.1445916 + 2100 303.32047 757.53534 -2975.3597 -2967.2741 5.3153102 28.252523 0.23857925 -1.1465858 + 2200 307.41102 -837.97246 -2976.4966 -2969.0433 4.9515105 24.517456 0.25216298 -1.1426077 + 2300 303.01088 1618.29 -2977.5454 -2970.6862 4.593227 21.097734 0.26914071 -1.1356519 + 2400 297.59385 -3233.8282 -2978.4064 -2972.2049 4.235209 17.936995 0.28804295 -1.1332908 + 2500 288.72232 5209.2099 -2979.1999 -2973.5963 3.8804647 15.058006 0.31533205 -1.1258312 + 2600 298.92201 -2193.618 -2979.8873 -2974.8649 3.5301507 12.461964 0.34927897 -1.1048024 + 2700 282.61818 765.88178 -2980.4563 -2976.0148 3.1852407 10.145758 0.3879755 -1.0655899 + 2800 273.63104 -389.49749 -2980.8636 -2977.0468 2.8322558 8.021673 0.4259426 -1.0370247 + 2900 274.12166 -9.2552992 -2981.1421 -2977.9525 2.4816703 6.1586877 0.47721359 -1.0061337 + 3000 279.43592 212.25445 -2981.2716 -2978.7309 2.1328425 4.5490171 0.5532015 -0.94983292 + 3100 291.10071 -1139.205 -2981.2475 -2979.3812 1.7828537 3.1785674 0.66452451 -0.83906914 + 3200 281.53171 3124.6411 -2981.0818 -2979.9003 1.4287164 2.0412304 0.81952022 -0.6386061 + 3300 277.0223 -2795.9494 -2980.7825 -2980.287 1.0830229 1.1729385 1.0186688 -0.26502454 + 3400 284.8443 1587.8876 -2980.3701 -2980.5435 0.76893619 0.59126286 1.1646672 0.27529682 + 3500 281.19 -1143.0785 -2979.8374 -2980.6693 0.54860209 0.30096426 0.79069857 -0.36626891 + 3600 296.58287 1156.4706 -2979.2182 -2980.6646 0.55745952 0.31076112 0.81914175 -0.31895116 + 3700 297.24517 -1888.4993 -2978.5352 -2980.5318 0.77195451 0.59591377 1.0713124 -0.027796216 + 3800 290.81586 3843.3483 -2977.8509 -2980.2819 1.0444771 1.0909324 0.88270245 -0.57339499 + 3900 300.39456 -5584.8386 -2977.0837 -2979.9273 1.3073719 1.7092212 0.65444496 -0.94023014 + 4000 306.15811 3310.0105 -2976.5086 -2979.4859 1.5269967 2.3317191 0.45120199 -1.1665402 + 4100 295.907 -1475.0458 -2975.9096 -2978.9779 1.6878413 2.8488082 0.27738537 -1.2909517 + 4200 322.70162 933.76586 -2975.3867 -2978.425 1.7872637 3.1943116 0.12322364 -1.3421568 + 4300 306.69631 -512.7048 -2974.9324 -2977.8465 1.8221493 3.3202281 -0.016769435 -1.3380921 + 4400 309.23776 226.77219 -2974.5791 -2977.2621 1.788532 3.1988469 -0.14279249 -1.3044784 + 4500 313.15783 508.29785 -2974.3263 -2976.6947 1.6959722 2.8763217 -0.26351575 -1.2425552 + 4600 316.26151 -2043.7571 -2974.1697 -2976.1635 1.5525328 2.4103582 -0.38443906 -1.156175 + 4700 312.27329 1831.682 -2974.1732 -2975.6917 1.3614048 1.8534231 -0.52504872 -1.0383081 + 4800 307.61066 -1476.0019 -2974.2885 -2975.296 1.1354139 1.2891647 -0.69734331 -0.84719677 + 4900 305.73489 1303.4848 -2974.5506 -2974.9905 0.8913743 0.79454814 -0.90609876 -0.50216921 + 5000 309.3774 -1574.6812 -2974.8687 -2974.7812 0.65272109 0.42604482 -1.0613188 0.00291608 + 5100 304.8602 2679.7476 -2975.3082 -2974.6718 0.4727141 0.22345862 -0.75321909 -0.42028824 + 5200 297.54226 -5008.0905 -2975.7443 -2974.6646 0.45797515 0.20974124 -0.66557441 -0.64583954 + 5300 306.18872 4840.4175 -2976.324 -2974.7575 0.61348896 0.3763687 -1.0084709 -0.10258503 + 5400 299.57661 -2513.1706 -2976.8842 -2974.9472 0.83376011 0.69515592 -0.88189118 -0.55222188 + 5500 302.30844 1301.3525 -2977.4539 -2975.2244 1.0486412 1.0996484 -0.65075151 -0.94687541 + 5600 302.11038 -760.79712 -2977.9764 -2975.5765 1.2259535 1.502962 -0.44510538 -1.1709493 + 5700 294.49825 718.67318 -2978.4584 -2975.9844 1.357155 1.8418697 -0.27309672 -1.2848748 + 5800 305.97636 -478.64224 -2978.8638 -2976.429 1.4331646 2.0539608 -0.1197893 -1.3417863 + 5900 291.93868 -419.74179 -2979.2292 -2976.8905 1.4535887 2.1129201 0.024018983 -1.349863 + 6000 289.50667 859.85085 -2979.5018 -2977.3557 1.4249736 2.0305497 0.15271261 -1.3095465 + 6100 305.70118 -933.35917 -2979.6877 -2977.8064 1.3480601 1.8172659 0.27785119 -1.2402584 + 6200 284.37805 1526.0707 -2979.806 -2978.2265 1.2296781 1.5121082 0.40681415 -1.1355005 + 6300 291.08863 -2156.6708 -2979.8064 -2978.6017 1.0733214 1.1520189 0.54137333 -1.0156432 + 6400 295.99073 2819.8245 -2979.7378 -2978.9165 0.8941904 0.79957647 0.7073501 -0.82385123 + 6500 298.06769 -3396.3504 -2979.5428 -2979.1626 0.70228297 0.49320137 0.91043588 -0.48653641 + 6600 301.78514 5496.6525 -2979.2768 -2979.3329 0.51276653 0.26292952 1.0681056 -0.036293782 + 6700 290.80665 -5229.4989 -2978.9177 -2979.4217 0.36990055 0.13682642 0.81466085 -0.37332419 + 6800 296.75761 2401.7807 -2978.5996 -2979.4338 0.34589164 0.11964103 0.65253856 -0.7737558 + 6900 295.77553 -1521.6269 -2978.1619 -2979.3685 0.46007271 0.21166689 1.0427138 -0.013014477 + 7000 303.59015 1530.7255 -2977.7097 -2979.225 0.63320287 0.40094588 0.93012255 -0.45527217 + 7100 297.51038 -3016.4426 -2977.2025 -2979.0103 0.81101521 0.65774567 0.7114444 -0.84465178 + 7200 293.53789 2705.9808 -2976.7651 -2978.7294 0.97512025 0.95085951 0.52979295 -1.0479526 + 7300 301.78809 -1042.1076 -2976.3388 -2978.3998 1.1024575 1.2154126 0.35564664 -1.2137023 + 7400 307.50053 214.56923 -2975.9581 -2978.0341 1.188001 1.4113463 0.20025025 -1.3077784 + 7500 301.98985 281.86495 -2975.6146 -2977.6451 1.2301918 1.5133718 0.063886193 -1.3465506 + 7600 318.37347 -1145.7795 -2975.3473 -2977.2486 1.2295055 1.5116837 -0.066939137 -1.3475567 + 7700 314.94512 4536.9887 -2975.1351 -2976.8564 1.1948121 1.427576 -0.19450637 -1.2864658 + 7800 312.91485 -2980.6408 -2975.0156 -2976.4828 1.1134406 1.2397499 -0.32749726 -1.207718 + 7900 310.06854 2244.3877 -2975.0094 -2976.1462 0.99080702 0.98169854 -0.48336959 -1.0840695 + 8000 308.55007 -2427.1464 -2975.0491 -2975.8566 0.83800849 0.70225823 -0.65822117 -0.89212512 + 8100 323.02796 3187.4728 -2975.2081 -2975.6251 0.66510054 0.44235872 -0.84857729 -0.62984027 + 8200 327.05029 -6447.7875 -2975.3162 -2975.4608 0.49730291 0.24731018 -1.0534735 -0.14095413 + 8300 311.194 4273.1174 -2975.7217 -2975.3642 0.35491458 0.12596436 -0.95967595 -0.04445204 + 8400 290.61931 -2301.019 -2976.0963 -2975.3446 0.31530296 0.09941596 -0.69056625 -0.72257435 + 8500 314.00559 1966.1297 -2976.5206 -2975.3995 0.41659574 0.17355201 -1.1134124 0.18107632 + 8600 288.26541 -1608.4524 -2976.9304 -2975.526 0.57968749 0.33603759 -1.0014591 -0.34698354 + 8700 298.92083 1353.9988 -2977.355 -2975.7203 0.74176087 0.55020919 -0.74109062 -0.86227705 + 8800 299.97274 -638.68301 -2977.766 -2975.9682 0.87950613 0.77353104 -0.50839929 -1.1555064 + 8900 300.66443 -279.62514 -2978.1476 -2976.262 0.99526406 0.99055054 -0.33059914 -1.261881 + 9000 290.44715 489.06352 -2978.4892 -2976.5918 1.0763797 1.1585932 -0.17871557 -1.3082755 + 9100 289.06733 -1063.4482 -2978.784 -2976.943 1.1174524 1.2486999 -0.037767225 -1.3120851 + 9200 297.63931 2664.6535 -2979.0202 -2977.3033 1.1127042 1.2381106 0.090936095 -1.2913777 + 9300 297.9983 -4684.428 -2979.1316 -2977.6563 1.0596342 1.1228247 0.20756305 -1.2867214 + 9400 285.14009 2779.1548 -2979.2804 -2977.9868 0.98034602 0.96107833 0.33668495 -1.2294268 + 9500 284.11569 -2437.5003 -2979.2918 -2978.2852 0.87286876 0.76189987 0.48407552 -1.1274969 + 9600 291.97193 2772.1396 -2979.2473 -2978.5402 0.74294711 0.55197041 0.67450455 -0.91152584 + 9700 292.59563 -3615.4496 -2979.0801 -2978.7442 0.59448857 0.35341666 0.91630006 -0.47180257 + 9800 296.1785 4869.2744 -2978.8849 -2978.891 0.43463281 0.18890568 1.1020846 0.093881572 + 9900 298.44745 -3587.7391 -2978.5978 -2978.9712 0.30680426 0.094128854 0.8532075 -0.19634913 + 10000 297.99863 1312.5643 -2978.3205 -2978.9854 0.27829395 0.077447522 0.60818263 -0.79004935 +Loop time of 15.3108 on 4 procs for 10000 steps with 864 atoms + +Performance: 112.862 ns/day, 0.213 hours/ns, 653.136 timesteps/s, 564.309 katom-step/s +92.4% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 11.428 | 12.158 | 12.621 | 13.0 | 79.41 +Neigh | 0.0019158 | 0.0020708 | 0.002163 | 0.2 | 0.01 +Comm | 1.936 | 2.3948 | 3.0967 | 28.3 | 15.64 +Output | 0.0026067 | 0.0037308 | 0.0066123 | 2.7 | 0.02 +Modify | 0.44688 | 0.45929 | 0.47131 | 1.6 | 3.00 +Other | | 0.2928 | | | 1.91 + +Nlocal: 216 ave 224 max 204 min +Histogram: 1 0 0 0 0 0 0 2 0 1 +Nghost: 2147 ave 2159 max 2139 min +Histogram: 1 0 0 2 0 0 0 0 0 1 +Neighs: 24185.8 ave 26045 max 21309 min +Histogram: 1 0 0 0 0 1 0 0 0 2 + +Total # of neighbors = 96743 +Ave neighs/atom = 111.97106 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:15 diff --git a/examples/PACKAGES/moments/log.02May2025.valtest.g++.1 b/examples/PACKAGES/moments/log.02May2025.valtest.g++.1 new file mode 100644 index 0000000000..86cbeee12b --- /dev/null +++ b/examples/PACKAGES/moments/log.02May2025.valtest.g++.1 @@ -0,0 +1,178 @@ +LAMMPS (2 Apr 2025 - Development - patch_4Feb2025-645-gba166d42e1-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# create pure copper system +units metal +lattice fcc 3.75 +Lattice spacing in x,y,z = 3.75 3.75 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box +Created orthogonal box = (0 0 0) to (22.5 22.5 22.5) + 1 by 1 by 1 MPI processor grid + +timestep 0.002 +create_atoms 1 box +Created 864 atoms + using lattice units in orthogonal box = (0 0 0) to (22.5 22.5 22.5) + create_atoms CPU = 0.001 seconds + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 0.2000000000000000111 + +variable toteng equal "etotal" +fix 2 all ave/moments 1 10 10 v_toteng mean variance skew kurtosis + +thermo_style custom step etotal f_2[*] +thermo_modify format float %14.8f + +thermo 1 +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6825 + ghost atom cutoff = 8.6825 + binsize = 4.34125, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/alloy, 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) = 3.484 | 3.484 | 3.484 Mbytes + Step TotEng f_2[1] f_2[2] f_2[3] f_2[4] + 0 -2884.91592826 0.00000000 0.00000000 0.00000000 0.00000000 + 1 -2888.74461907 0.00000000 0.00000000 0.00000000 0.00000000 + 2 -2898.78491936 0.00000000 0.00000000 0.00000000 0.00000000 + 3 -2910.70619667 0.00000000 0.00000000 0.00000000 0.00000000 + 4 -2919.41734302 0.00000000 0.00000000 0.00000000 0.00000000 + 5 -2923.24980175 0.00000000 0.00000000 0.00000000 0.00000000 + 6 -2923.79800148 0.00000000 0.00000000 0.00000000 0.00000000 + 7 -2922.97580252 0.00000000 0.00000000 0.00000000 0.00000000 + 8 -2921.95601941 0.00000000 0.00000000 0.00000000 0.00000000 + 9 -2921.45319499 0.00000000 0.00000000 0.00000000 0.00000000 + 10 -2921.81460149 -2915.29004998 148.32538381 1.60272422 1.50844200 + 11 -2923.00059466 -2915.29004998 148.32538381 1.60272422 1.50844200 + 12 -2924.63075671 -2915.29004998 148.32538381 1.60272422 1.50844200 + 13 -2926.18037946 -2915.29004998 148.32538381 1.60272422 1.50844200 + 14 -2927.22356281 -2915.29004998 148.32538381 1.60272422 1.50844200 + 15 -2927.62053073 -2915.29004998 148.32538381 1.60272422 1.50844200 + 16 -2927.49949128 -2915.29004998 148.32538381 1.60272422 1.50844200 + 17 -2927.12292174 -2915.29004998 148.32538381 1.60272422 1.50844200 + 18 -2926.73637250 -2915.29004998 148.32538381 1.60272422 1.50844200 + 19 -2926.49482990 -2915.29004998 148.32538381 1.60272422 1.50844200 + 20 -2926.44714720 -2926.29565870 2.07215006 1.62317861 2.37019300 + 21 -2926.56102718 -2926.29565870 2.07215006 1.62317861 2.37019300 + 22 -2926.76734347 -2926.29565870 2.07215006 1.62317861 2.37019300 + 23 -2926.98403044 -2926.29565870 2.07215006 1.62317861 2.37019300 + 24 -2927.15193693 -2926.29565870 2.07215006 1.62317861 2.37019300 + 25 -2927.24498540 -2926.29565870 2.07215006 1.62317861 2.37019300 + 26 -2927.26914121 -2926.29565870 2.07215006 1.62317861 2.37019300 + 27 -2927.25021402 -2926.29565870 2.07215006 1.62317861 2.37019300 + 28 -2927.21637817 -2926.29565870 2.07215006 1.62317861 2.37019300 + 29 -2927.19085616 -2926.29565870 2.07215006 1.62317861 2.37019300 + 30 -2927.18360687 -2927.08195198 0.05722486 1.54894969 1.44984748 + 31 -2927.19243579 -2927.08195198 0.05722486 1.54894969 1.44984748 + 32 -2927.20805612 -2927.08195198 0.05722486 1.54894969 1.44984748 + 33 -2927.22285606 -2927.08195198 0.05722486 1.54894969 1.44984748 + 34 -2927.23274852 -2927.08195198 0.05722486 1.54894969 1.44984748 + 35 -2927.23953263 -2927.08195198 0.05722486 1.54894969 1.44984748 + 36 -2927.24805761 -2927.08195198 0.05722486 1.54894969 1.44984748 + 37 -2927.26215638 -2927.08195198 0.05722486 1.54894969 1.44984748 + 38 -2927.28298252 -2927.08195198 0.05722486 1.54894969 1.44984748 + 39 -2927.31025065 -2927.08195198 0.05722486 1.54894969 1.44984748 + 40 -2927.33874897 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 41 -2927.36224413 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 42 -2927.37729800 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 43 -2927.38671916 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 44 -2927.39115082 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 45 -2927.39614318 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 46 -2927.40444730 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 47 -2927.41888601 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 48 -2927.43954388 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 49 -2927.46210058 -2927.25378252 0.00209108 -0.65432756 -0.21113798 + 50 -2927.48270024 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 51 -2927.49822500 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 52 -2927.50765361 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 53 -2927.51223225 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 54 -2927.51510653 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 55 -2927.52035921 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 56 -2927.53170012 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 57 -2927.54910408 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 58 -2927.57357292 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 59 -2927.60356966 -2927.41212333 0.00148630 -0.72914987 -0.39161968 + 60 -2927.63344447 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 61 -2927.66186165 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 62 -2927.68810360 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 63 -2927.71163480 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 64 -2927.73036225 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 65 -2927.74726656 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 66 -2927.76525638 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 67 -2927.78432762 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 68 -2927.80305095 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 69 -2927.82406714 -2927.54449679 0.00204640 -1.06571776 0.04430271 + 70 -2927.84622122 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 71 -2927.86886493 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 72 -2927.89150302 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 73 -2927.91480122 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 74 -2927.93739399 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 75 -2927.96075707 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 76 -2927.98525702 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 77 -2928.00918972 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 78 -2928.03266453 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 79 -2928.05673430 -2927.75621522 0.00356092 0.06232090 -0.94076248 + 80 -2928.08120268 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 81 -2928.10618717 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 82 -2928.13191751 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 83 -2928.15675025 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 84 -2928.18178044 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 85 -2928.20538210 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 86 -2928.22991006 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 87 -2928.25238345 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 88 -2928.27490378 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 89 -2928.29697980 -2927.97383685 0.00511363 -0.03242365 -1.20956903 + 90 -2928.31902032 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 91 -2928.34079951 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 92 -2928.36448072 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 93 -2928.38918869 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 94 -2928.41578734 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 95 -2928.44466633 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 96 -2928.47414034 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 97 -2928.50507273 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 98 -2928.53751007 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 99 -2928.56947939 -2928.21552149 0.00511983 0.08421866 -1.19120544 + 100 -2928.60000318 -2928.46411283 0.00779929 -0.14908790 -1.24292534 +Loop time of 0.579661 on 1 procs for 100 steps with 864 atoms + +Performance: 29.811 ns/day, 0.805 hours/ns, 172.515 timesteps/s, 149.053 katom-step/s +96.3% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.54316 | 0.54316 | 0.54316 | 0.0 | 93.70 +Neigh | 0.0041212 | 0.0041212 | 0.0041212 | 0.0 | 0.71 +Comm | 0.0034702 | 0.0034702 | 0.0034702 | 0.0 | 0.60 +Output | 0.014085 | 0.014085 | 0.014085 | 0.0 | 2.43 +Modify | 0.01321 | 0.01321 | 0.01321 | 0.0 | 2.28 +Other | | 0.001612 | | | 0.28 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 3767 ave 3767 max 3767 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 96746 ave 96746 max 96746 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 96746 +Ave neighs/atom = 111.97454 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/moments/log.02May2025.valtest.g++.4 b/examples/PACKAGES/moments/log.02May2025.valtest.g++.4 new file mode 100644 index 0000000000..f7321d2326 --- /dev/null +++ b/examples/PACKAGES/moments/log.02May2025.valtest.g++.4 @@ -0,0 +1,178 @@ +LAMMPS (2 Apr 2025 - Development - patch_4Feb2025-645-gba166d42e1-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# create pure copper system +units metal +lattice fcc 3.75 +Lattice spacing in x,y,z = 3.75 3.75 3.75 +region box block 0 6 0 6 0 6 +create_box 2 box +Created orthogonal box = (0 0 0) to (22.5 22.5 22.5) + 1 by 2 by 2 MPI processor grid + +timestep 0.002 +create_atoms 1 box +Created 864 atoms + using lattice units in orthogonal box = (0 0 0) to (22.5 22.5 22.5) + create_atoms CPU = 0.001 seconds + +pair_style eam/alloy +pair_coeff * * AlCu.eam.alloy Cu Al + +# Initialize to a high temperature, then cool in npt ensemble +velocity all create 1000.0 6567345 +fix 1 all npt temp 300.0 300.0 $(500*dt) iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 $(100*dt) +fix 1 all npt temp 300.0 300.0 1 iso 0.0 0.0 0.2000000000000000111 + +variable toteng equal "etotal" +fix 2 all ave/moments 1 10 10 v_toteng mean variance skew kurtosis + +thermo_style custom step etotal f_2[*] +thermo_modify format float %14.8f + +thermo 1 +run 100 +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 8.6825 + ghost atom cutoff = 8.6825 + binsize = 4.34125, bins = 6 6 6 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair eam/alloy, 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) = 3.42 | 3.42 | 3.42 Mbytes + Step TotEng f_2[1] f_2[2] f_2[3] f_2[4] + 0 -2884.91592826 0.00000000 0.00000000 0.00000000 0.00000000 + 1 -2888.74473521 0.00000000 0.00000000 0.00000000 0.00000000 + 2 -2898.78463435 0.00000000 0.00000000 0.00000000 0.00000000 + 3 -2910.70366466 0.00000000 0.00000000 0.00000000 0.00000000 + 4 -2919.40999553 0.00000000 0.00000000 0.00000000 0.00000000 + 5 -2923.23570887 0.00000000 0.00000000 0.00000000 0.00000000 + 6 -2923.77707961 0.00000000 0.00000000 0.00000000 0.00000000 + 7 -2922.94386730 0.00000000 0.00000000 0.00000000 0.00000000 + 8 -2921.92251474 0.00000000 0.00000000 0.00000000 0.00000000 + 9 -2921.42476103 0.00000000 0.00000000 0.00000000 0.00000000 + 10 -2921.79501042 -2915.27419717 148.08574615 1.60354430 1.51194865 + 11 -2922.99498349 -2915.27419717 148.08574615 1.60354430 1.51194865 + 12 -2924.64023395 -2915.27419717 148.08574615 1.60354430 1.51194865 + 13 -2926.19980790 -2915.27419717 148.08574615 1.60354430 1.51194865 + 14 -2927.25022454 -2915.27419717 148.08574615 1.60354430 1.51194865 + 15 -2927.64953875 -2915.27419717 148.08574615 1.60354430 1.51194865 + 16 -2927.52804735 -2915.27419717 148.08574615 1.60354430 1.51194865 + 17 -2927.14916045 -2915.27419717 148.08574615 1.60354430 1.51194865 + 18 -2926.76078244 -2915.27419717 148.08574615 1.60354430 1.51194865 + 19 -2926.51878380 -2915.27419717 148.08574615 1.60354430 1.51194865 + 20 -2926.47129883 -2926.31628615 2.10313655 1.62594474 2.38000930 + 21 -2926.59030835 -2926.31628615 2.10313655 1.62594474 2.38000930 + 22 -2926.80121221 -2926.31628615 2.10313655 1.62594474 2.38000930 + 23 -2927.02526150 -2926.31628615 2.10313655 1.62594474 2.38000930 + 24 -2927.20079704 -2926.31628615 2.10313655 1.62594474 2.38000930 + 25 -2927.30192483 -2926.31628615 2.10313655 1.62594474 2.38000930 + 26 -2927.33194351 -2926.31628615 2.10313655 1.62594474 2.38000930 + 27 -2927.31647527 -2926.31628615 2.10313655 1.62594474 2.38000930 + 28 -2927.28391864 -2926.31628615 2.10313655 1.62594474 2.38000930 + 29 -2927.25821953 -2926.31628615 2.10313655 1.62594474 2.38000930 + 30 -2927.25085808 -2927.13609190 0.06387000 1.52055179 1.31247839 + 31 -2927.25723201 -2927.13609190 0.06387000 1.52055179 1.31247839 + 32 -2927.27197789 -2927.13609190 0.06387000 1.52055179 1.31247839 + 33 -2927.28667044 -2927.13609190 0.06387000 1.52055179 1.31247839 + 34 -2927.29879455 -2927.13609190 0.06387000 1.52055179 1.31247839 + 35 -2927.30701891 -2927.13609190 0.06387000 1.52055179 1.31247839 + 36 -2927.31785921 -2927.13609190 0.06387000 1.52055179 1.31247839 + 37 -2927.33272014 -2927.13609190 0.06387000 1.52055179 1.31247839 + 38 -2927.35282056 -2927.13609190 0.06387000 1.52055179 1.31247839 + 39 -2927.37849130 -2927.13609190 0.06387000 1.52055179 1.31247839 + 40 -2927.40448350 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 41 -2927.42423249 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 42 -2927.43769919 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 43 -2927.44493813 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 44 -2927.44923137 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 45 -2927.45439729 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 46 -2927.46365674 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 47 -2927.48173952 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 48 -2927.50371663 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 49 -2927.52750629 -2927.32080685 0.00219675 -0.52051260 -0.50322958 + 50 -2927.54872274 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 51 -2927.56277664 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 52 -2927.57050508 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 53 -2927.57241043 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 54 -2927.57517748 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 55 -2927.58161786 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 56 -2927.59393740 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 57 -2927.61367876 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 58 -2927.64096296 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 59 -2927.67356621 -2927.47358404 0.00168128 -0.79883601 -0.48497973 + 60 -2927.70625176 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 61 -2927.73673853 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 62 -2927.76292153 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 63 -2927.78541405 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 64 -2927.80292853 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 65 -2927.81988675 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 66 -2927.83680256 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 67 -2927.85379296 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 68 -2927.87418119 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 69 -2927.89451588 -2927.60908846 0.00241645 -1.10903745 0.07175615 + 70 -2927.91602570 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 71 -2927.93874793 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 72 -2927.96195498 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 73 -2927.98521535 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 74 -2928.01060565 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 75 -2928.03584561 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 76 -2928.06090892 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 77 -2928.08509438 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 78 -2928.11095399 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 79 -2928.13711339 -2927.82832077 0.00334657 0.04700770 -0.91589129 + 80 -2928.16413424 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 81 -2928.19005959 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 82 -2928.21654649 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 83 -2928.24249986 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 84 -2928.26861892 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 85 -2928.29480718 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 86 -2928.32144325 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 87 -2928.34727619 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 88 -2928.37131285 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 89 -2928.39531126 -2928.04905744 0.00575008 -0.05409710 -1.19501222 + 90 -2928.41739503 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 91 -2928.43978811 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 92 -2928.46316822 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 93 -2928.48654219 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 94 -2928.51132482 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 95 -2928.53938009 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 96 -2928.56852408 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 97 -2928.59814410 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 98 -2928.62787940 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 99 -2928.65853178 -2928.30652706 0.00595440 0.06693205 -1.24851322 + 100 -2928.68735978 -2928.55806426 0.00711607 -0.13829819 -1.25519738 +Loop time of 0.327437 on 4 procs for 100 steps with 864 atoms + +Performance: 52.774 ns/day, 0.455 hours/ns, 305.402 timesteps/s, 263.868 katom-step/s +91.9% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.27213 | 0.27259 | 0.27312 | 0.1 | 83.25 +Neigh | 0.00096945 | 0.0015991 | 0.0022533 | 1.5 | 0.49 +Comm | 0.026726 | 0.027088 | 0.027516 | 0.2 | 8.27 +Output | 0.0029839 | 0.0048706 | 0.0097487 | 4.0 | 1.49 +Modify | 0.012374 | 0.016834 | 0.018623 | 2.0 | 5.14 +Other | | 0.004455 | | | 1.36 + +Nlocal: 216 ave 224 max 204 min +Histogram: 1 0 0 0 0 0 0 2 0 1 +Nghost: 2147 ave 2159 max 2139 min +Histogram: 1 0 0 2 0 0 0 0 0 1 +Neighs: 24185.8 ave 26045 max 21309 min +Histogram: 1 0 0 0 0 1 0 0 0 2 + +Total # of neighbors = 96743 +Ave neighs/atom = 111.97106 +Neighbor list builds = 1 +Dangerous builds = 0 + +Total wall time: 0:00:00 diff --git a/examples/PACKAGES/neighbor-swap/MoCoNiVFeAlCr_2nn.meam b/examples/PACKAGES/neighbor-swap/MoCoNiVFeAlCr_2nn.meam new file mode 120000 index 0000000000..160501aee4 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/MoCoNiVFeAlCr_2nn.meam @@ -0,0 +1 @@ +../../../potentials/MoCoNiVFeAlCr_2nn.meam \ No newline at end of file diff --git a/examples/PACKAGES/neighbor-swap/in.KMC_pulse_center b/examples/PACKAGES/neighbor-swap/in.KMC_pulse_center new file mode 100644 index 0000000000..29993fab29 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/in.KMC_pulse_center @@ -0,0 +1,46 @@ +# May 2025 +# Test script for MD-KMC accelerated diffusion testing in LAMMPS +# Created by Jacob Tavenner, Baylor University + +# Initiation ------------------------------------- +units metal +dimension 3 +boundary p p p +atom_style atomic + +# Atom Definition -------------------------------- +lattice fcc 3.762 +region whole block 0 1 0 1 0 1 +create_box 2 whole +create_atoms 1 region whole + +replicate 6 16 6 + +region puck block INF INF 7 9 INF INF +set region puck type 2 + +# Force Fields ----------------------------------- +pair_style meam +pair_coeff * * library_2nn.meam Mo Co Ni V Fe Al Cr MoCoNiVFeAlCr_2nn.meam Ni Cr + +# Settings --------------------------------------- +timestep 0.002 +thermo 100 + +# Computations ----------------------------------- +compute voroN all voronoi/atom neighbors yes + +run 0 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe + +# Execution -------------------------------------- + +velocity all create 2400 908124 loop geom +fix temp all npt temp 1000 1000 1000 aniso 0 0 1 +fix mc all neighbor/swap 50 12 1340723 1000 3 voroN diff 2 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe f_mc[*] +#dump dump2 all custom 5000 dump.edge-3_Ni-Cr.* id type x y z c_eng c_csym + +run 1000 + +#write_data pulse_center.data diff --git a/examples/PACKAGES/neighbor-swap/in.KMC_pulse_edge b/examples/PACKAGES/neighbor-swap/in.KMC_pulse_edge new file mode 100644 index 0000000000..5bf51d2ed1 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/in.KMC_pulse_edge @@ -0,0 +1,47 @@ +# May 2025 +# Test script for MD-KMC accelerated diffusion testing in LAMMPS +# Created by Jacob Tavenner, Baylor University + +# Initiation ------------------------------------- +units metal +dimension 3 +boundary p p p +atom_style atomic + + +# Atom Definition -------------------------------- +lattice fcc 3.762 +region whole block 0 1 0 1 0 1 +create_box 2 whole +create_atoms 1 region whole + +replicate 6 16 6 + +region puck block INF INF INF 2 INF INF +set region puck type 2 + +# Force Fields ----------------------------------- +pair_style meam +pair_coeff * * library_2nn.meam Mo Co Ni V Fe Al Cr MoCoNiVFeAlCr_2nn.meam Ni Cr + +# Settings --------------------------------------- +timestep 0.002 +thermo 100 + +# Computations ----------------------------------- +compute voroN all voronoi/atom neighbors yes + +run 0 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe + +# Execution -------------------------------------- + +velocity all create 2400 908124 loop geom +fix temp all npt temp 1000 1000 1000 aniso 0 0 1 +fix mc all neighbor/swap 50 12 1340723 1000 3 voroN diff 2 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe f_mc[*] +#dump dump2 all custom 5000 dump.edge-3_Ni-Cr.* id type x y z c_eng c_csym + +run 1000 + +#write_data pulse_end.data diff --git a/examples/PACKAGES/neighbor-swap/library_2nn.meam b/examples/PACKAGES/neighbor-swap/library_2nn.meam new file mode 120000 index 0000000000..278b81be6a --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/library_2nn.meam @@ -0,0 +1 @@ +../../../potentials/library_2nn.meam \ No newline at end of file diff --git a/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_center.g++.1 b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_center.g++.1 new file mode 100644 index 0000000000..1f1bd00a71 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_center.g++.1 @@ -0,0 +1,154 @@ +LAMMPS (2 Apr 2025 - Development - patch_2Apr2025-384-g88bc7dc720-modified) + using 1 OpenMP thread(s) per MPI task +# May 2025 +# Test script for MD-KMC accelerated diffusion testing in LAMMPS +# Created by Jacob Tavenner, Baylor University + +# Initiation ------------------------------------- +units metal +dimension 3 +boundary p p p +atom_style atomic + +# Atom Definition -------------------------------- +lattice fcc 3.762 +Lattice spacing in x,y,z = 3.762 3.762 3.762 +region whole block 0 1 0 1 0 1 +create_box 2 whole +Created orthogonal box = (0 0 0) to (3.762 3.762 3.762) + 1 by 1 by 1 MPI processor grid +create_atoms 1 region whole +Created 4 atoms + using lattice units in orthogonal box = (0 0 0) to (3.762 3.762 3.762) + create_atoms CPU = 0.000 seconds + +replicate 6 16 6 +Replication is creating a 6x16x6 = 576 times larger system... + orthogonal box = (0 0 0) to (22.572 60.192 22.572) + 1 by 1 by 1 MPI processor grid + 2304 atoms + replicate CPU = 0.000 seconds + +region puck block INF INF 7 9 INF INF +set region puck type 2 +Setting atom values ... + 360 settings made for type + +# Force Fields ----------------------------------- +pair_style meam +pair_coeff * * library_2nn.meam Mo Co Ni V Fe Al Cr MoCoNiVFeAlCr_2nn.meam Ni Cr +Reading MEAM library file library_2nn.meam with DATE: 2024-08-08 +Reading MEAM potential file MoCoNiVFeAlCr_2nn.meam with DATE: 2024-08-08 + +# Settings --------------------------------------- +timestep 0.002 +thermo 100 + +# Computations ----------------------------------- +compute voroN all voronoi/atom neighbors yes + +run 0 +WARNING: No fixes with time integration, atoms won't move +For more information see https://docs.lammps.org/err0028 (src/verlet.cpp:60) +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.8 + ghost atom cutoff = 6.8 + binsize = 3.4, bins = 7 18 7 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair meam, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard + (2) pair meam, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.32 | 13.32 | 13.32 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 0 -9674.3728 0 -9674.3728 -212400.94 +Loop time of 1.202e-06 on 1 procs for 0 steps with 2304 atoms + +0.0% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 1.202e-06 | | |100.00 + +Nlocal: 2304 ave 2304 max 2304 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 4735 ave 4735 max 4735 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 99072 ave 99072 max 99072 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 198144 ave 198144 max 198144 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 198144 +Ave neighs/atom = 86 +Neighbor list builds = 0 +Dangerous builds = 0 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe + +# Execution -------------------------------------- + +velocity all create 2400 908124 +fix temp all npt temp 1000 1000 1000 aniso 0 0 1 +fix mc all neighbor/swap 50 12 1340723 1000 3 voroN diff 2 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe f_mc[*] +#dump dump2 all custom 5000 dump.edge-3_Ni-Cr.* id type x y z c_eng c_csym + +run 1000 +Per MPI rank memory allocation (min/avg/max) = 13.32 | 13.32 | 13.32 Mbytes + Step Temp Press Pxx Pyy Pzz Lx Ly Lz Volume PotEng f_mc[1] f_mc[2] + 0 2400 -187517.52 -187403.07 -187750.14 -187399.35 22.572 60.192 22.572 30667.534 -9674.3728 0 0 + 100 1664.9956 14000 14280.682 15095.077 12624.241 21.635315 57.726568 21.64791 27036.778 -9592.8978 24 22 + 200 1560.0093 -5452.2434 -5749.5816 -2957.4228 -7649.7258 21.734212 58.085959 21.724853 27426.596 -9562.8822 48 45 + 300 1586.4553 2030.9253 2776.4677 775.50538 2540.803 21.678654 58.101753 21.654423 27275.215 -9571.1308 72 66 + 400 1603.6896 -223.16773 156.17673 -478.47929 -347.20061 21.701021 58.098904 21.657752 27306.213 -9576.4456 96 90 + 500 1618.236 -925.51874 -1640.9078 451.6228 -1587.2713 21.718334 58.042685 21.666081 27312.054 -9581.2045 120 110 + 600 1581.9995 290.10126 1359.1314 1407.5434 -1896.371 21.679813 58.086147 21.692118 27316.815 -9570.4803 144 132 + 700 1568.3261 1387.3472 938.81523 2159.3686 1063.8577 21.685928 58.075626 21.67273 27295.153 -9566.2914 168 155 + 800 1607.1531 46.792964 -453.90265 -1533.3908 2127.6723 21.685188 58.202356 21.628338 27297.753 -9577.7848 192 177 + 900 1573.4747 -84.225488 548.90935 -1356.7479 555.16208 21.69634 58.150052 21.651847 27316.908 -9567.7039 216 196 + 1000 1609.2136 1215.0833 764.08936 3301.0811 -419.92053 21.683731 58.000401 21.68726 27275.31 -9578.2843 240 219 +Loop time of 31.6263 on 1 procs for 1000 steps with 2304 atoms + +Performance: 5.464 ns/day, 4.393 hours/ns, 31.619 timesteps/s, 72.851 katom-step/s +99.2% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 28.487 | 28.487 | 28.487 | 0.0 | 90.07 +Neigh | 0.22789 | 0.22789 | 0.22789 | 0.0 | 0.72 +Comm | 0.010808 | 0.010808 | 0.010808 | 0.0 | 0.03 +Output | 0.00033526 | 0.00033526 | 0.00033526 | 0.0 | 0.00 +Modify | 2.8963 | 2.8963 | 2.8963 | 0.0 | 9.16 +Other | | 0.003905 | | | 0.01 + +Nlocal: 2304 ave 2304 max 2304 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 4750 ave 4750 max 4750 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 130023 ave 130023 max 130023 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 260046 ave 260046 max 260046 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 260046 +Ave neighs/atom = 112.86719 +Neighbor list builds = 65 +Dangerous builds = 0 + +#write_data pulse_center.data +Total wall time: 0:00:31 diff --git a/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_center.g++.4 b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_center.g++.4 new file mode 100644 index 0000000000..54c372d0f7 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_center.g++.4 @@ -0,0 +1,154 @@ +LAMMPS (2 Apr 2025 - Development - patch_2Apr2025-384-g88bc7dc720-modified) + using 1 OpenMP thread(s) per MPI task +# May 2025 +# Test script for MD-KMC accelerated diffusion testing in LAMMPS +# Created by Jacob Tavenner, Baylor University + +# Initiation ------------------------------------- +units metal +dimension 3 +boundary p p p +atom_style atomic + +# Atom Definition -------------------------------- +lattice fcc 3.762 +Lattice spacing in x,y,z = 3.762 3.762 3.762 +region whole block 0 1 0 1 0 1 +create_box 2 whole +Created orthogonal box = (0 0 0) to (3.762 3.762 3.762) + 1 by 2 by 2 MPI processor grid +create_atoms 1 region whole +Created 4 atoms + using lattice units in orthogonal box = (0 0 0) to (3.762 3.762 3.762) + create_atoms CPU = 0.000 seconds + +replicate 6 16 6 +Replication is creating a 6x16x6 = 576 times larger system... + orthogonal box = (0 0 0) to (22.572 60.192 22.572) + 1 by 4 by 1 MPI processor grid + 2304 atoms + replicate CPU = 0.000 seconds + +region puck block INF INF 7 9 INF INF +set region puck type 2 +Setting atom values ... + 360 settings made for type + +# Force Fields ----------------------------------- +pair_style meam +pair_coeff * * library_2nn.meam Mo Co Ni V Fe Al Cr MoCoNiVFeAlCr_2nn.meam Ni Cr +Reading MEAM library file library_2nn.meam with DATE: 2024-08-08 +Reading MEAM potential file MoCoNiVFeAlCr_2nn.meam with DATE: 2024-08-08 + +# Settings --------------------------------------- +timestep 0.002 +thermo 100 + +# Computations ----------------------------------- +compute voroN all voronoi/atom neighbors yes + +run 0 +WARNING: No fixes with time integration, atoms won't move +For more information see https://docs.lammps.org/err0028 (src/verlet.cpp:60) +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.8 + ghost atom cutoff = 6.8 + binsize = 3.4, bins = 7 18 7 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair meam, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard + (2) pair meam, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 9.636 | 9.636 | 9.636 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 0 -9674.3728 0 -9674.3728 -212400.94 +Loop time of 1.422e-06 on 4 procs for 0 steps with 2304 atoms + +35.2% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 1.422e-06 | | |100.00 + +Nlocal: 576 ave 576 max 576 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 2131 ave 2131 max 2131 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 24768 ave 24768 max 24768 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 49536 ave 49536 max 49536 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 198144 +Ave neighs/atom = 86 +Neighbor list builds = 0 +Dangerous builds = 0 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe + +# Execution -------------------------------------- + +velocity all create 2400 908124 +fix temp all npt temp 1000 1000 1000 aniso 0 0 1 +fix mc all neighbor/swap 50 12 1340723 1000 3 voroN diff 2 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe f_mc[*] +#dump dump2 all custom 5000 dump.edge-3_Ni-Cr.* id type x y z c_eng c_csym + +run 1000 +Per MPI rank memory allocation (min/avg/max) = 9.636 | 9.636 | 9.636 Mbytes + Step Temp Press Pxx Pyy Pzz Lx Ly Lz Volume PotEng f_mc[1] f_mc[2] + 0 2400 -187517.52 -187403.09 -187750.05 -187399.42 22.572 60.192 22.572 30667.534 -9674.3728 0 0 + 100 1668.8754 13300.763 12419.304 15568.772 11914.212 21.636248 57.724775 21.647685 27036.823 -9594.7526 24 23 + 200 1584.9699 -5686.0414 -4741.8496 -5914.7681 -6401.5064 21.729384 58.060532 21.730736 27415.923 -9571.0639 48 46 + 300 1582.0473 2806.2983 3413.4122 2716.0124 2289.4702 21.6679 58.033587 21.694744 27280.402 -9570.5549 72 69 + 400 1582.5825 845.29268 -849.61221 2123.5339 1261.9563 21.676298 58.14253 21.656418 27293.905 -9570.7948 96 93 + 500 1591.7285 -501.17955 1151.9743 -1719.3712 -936.14174 21.696367 58.157211 21.648308 27315.839 -9573.5089 120 116 + 600 1610.708 -821.74669 -1002.4957 291.88502 -1754.6294 21.730338 58.008213 21.661226 27304.8 -9579.5573 144 138 + 700 1598.5176 -590.00633 -1844.42 408.97706 -334.57602 21.712908 57.96131 21.698129 27307.281 -9575.8973 168 162 + 800 1584.3478 330.16711 666.88818 74.698331 248.91482 21.650908 58.045055 21.719838 27295.933 -9571.9268 192 186 + 900 1557.9946 1471.1207 2124.6512 1526.9937 761.71731 21.645578 58.156083 21.681637 27293.323 -9564.4385 216 207 + 1000 1582.5312 379.57005 -602.96446 2696.737 -955.06238 21.655418 58.231248 21.649581 27300.598 -9571.9879 240 227 +Loop time of 9.1632 on 4 procs for 1000 steps with 2304 atoms + +Performance: 18.858 ns/day, 1.273 hours/ns, 109.132 timesteps/s, 251.440 katom-step/s +98.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 7.867 | 7.9923 | 8.1311 | 4.3 | 87.22 +Neigh | 0.054997 | 0.057518 | 0.060145 | 1.0 | 0.63 +Comm | 0.017529 | 0.14801 | 0.27408 | 29.5 | 1.62 +Output | 0.00015963 | 0.00017216 | 0.00020869 | 0.0 | 0.00 +Modify | 0.95227 | 0.96325 | 0.9917 | 1.7 | 10.51 +Other | | 0.001983 | | | 0.02 + +Nlocal: 576 ave 609 max 540 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 2161.5 ave 2173 max 2151 min +Histogram: 1 0 1 0 0 0 1 0 0 1 +Neighs: 32450.2 ave 35422 max 29271 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +FullNghs: 64900.5 ave 70800 max 58684 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 259602 +Ave neighs/atom = 112.67448 +Neighbor list builds = 62 +Dangerous builds = 0 + +#write_data pulse_center.data +Total wall time: 0:00:09 diff --git a/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_edge.g++.1 b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_edge.g++.1 new file mode 100644 index 0000000000..c7ee0d41b5 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_edge.g++.1 @@ -0,0 +1,155 @@ +LAMMPS (2 Apr 2025 - Development - patch_2Apr2025-384-g88bc7dc720-modified) + using 1 OpenMP thread(s) per MPI task +# May 2025 +# Test script for MD-KMC accelerated diffusion testing in LAMMPS +# Created by Jacob Tavenner, Baylor University + +# Initiation ------------------------------------- +units metal +dimension 3 +boundary p p p +atom_style atomic + + +# Atom Definition -------------------------------- +lattice fcc 3.762 +Lattice spacing in x,y,z = 3.762 3.762 3.762 +region whole block 0 1 0 1 0 1 +create_box 2 whole +Created orthogonal box = (0 0 0) to (3.762 3.762 3.762) + 1 by 1 by 1 MPI processor grid +create_atoms 1 region whole +Created 4 atoms + using lattice units in orthogonal box = (0 0 0) to (3.762 3.762 3.762) + create_atoms CPU = 0.000 seconds + +replicate 6 16 6 +Replication is creating a 6x16x6 = 576 times larger system... + orthogonal box = (0 0 0) to (22.572 60.192 22.572) + 1 by 1 by 1 MPI processor grid + 2304 atoms + replicate CPU = 0.000 seconds + +region puck block INF INF INF 2 INF INF +set region puck type 2 +Setting atom values ... + 360 settings made for type + +# Force Fields ----------------------------------- +pair_style meam +pair_coeff * * library_2nn.meam Mo Co Ni V Fe Al Cr MoCoNiVFeAlCr_2nn.meam Ni Cr +Reading MEAM library file library_2nn.meam with DATE: 2024-08-08 +Reading MEAM potential file MoCoNiVFeAlCr_2nn.meam with DATE: 2024-08-08 + +# Settings --------------------------------------- +timestep 0.002 +thermo 100 + +# Computations ----------------------------------- +compute voroN all voronoi/atom neighbors yes + +run 0 +WARNING: No fixes with time integration, atoms won't move +For more information see https://docs.lammps.org/err0028 (src/verlet.cpp:60) +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.8 + ghost atom cutoff = 6.8 + binsize = 3.4, bins = 7 18 7 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair meam, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard + (2) pair meam, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 13.32 | 13.32 | 13.32 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 0 -9674.3728 0 -9674.3728 -212400.94 +Loop time of 1.232e-06 on 1 procs for 0 steps with 2304 atoms + +81.2% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 1.232e-06 | | |100.00 + +Nlocal: 2304 ave 2304 max 2304 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 4735 ave 4735 max 4735 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 99072 ave 99072 max 99072 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 198144 ave 198144 max 198144 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 198144 +Ave neighs/atom = 86 +Neighbor list builds = 0 +Dangerous builds = 0 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe + +# Execution -------------------------------------- + +velocity all create 2400 908124 loop geom +fix temp all npt temp 1000 1000 1000 aniso 0 0 1 +fix mc all neighbor/swap 50 12 1340723 1000 3 voroN diff 2 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe f_mc[*] +#dump dump2 all custom 5000 dump.edge-3_Ni-Cr.* id type x y z c_eng c_csym + +run 1000 +Per MPI rank memory allocation (min/avg/max) = 13.32 | 13.32 | 13.32 Mbytes + Step Temp Press Pxx Pyy Pzz Lx Ly Lz Volume PotEng f_mc[1] f_mc[2] + 0 2400 -187517.52 -187464.47 -188202.62 -186885.48 22.572 60.192 22.572 30667.534 -9674.3728 0 0 + 100 1665.6154 14281.316 14426.547 14555.867 13861.534 21.637238 57.719793 21.637281 27022.733 -9594.4303 24 24 + 200 1603.3309 -7325.7341 -8878.1524 -5333.0485 -7766.0015 21.710246 58.122827 21.725933 27415.106 -9577.4545 48 48 + 300 1603.2974 207.19165 1983.4565 -1841.9518 480.07024 21.678227 58.079126 21.674033 27288.745 -9577.6391 72 69 + 400 1600.1515 810.95054 1087.969 802.04946 542.83316 21.683731 58.045848 21.678505 27285.662 -9576.6508 96 92 + 500 1629.8313 -2808.1005 -3197.9357 310.89931 -5537.265 21.683924 58.090375 21.697076 27330.229 -9585.5435 120 113 + 600 1598.8232 -67.845623 -1573.0718 -1526.7607 2896.2957 21.70213 58.12191 21.653853 27313.504 -9576.4147 144 137 + 700 1607.2185 154.66718 -1777.2469 2566.4705 -325.22208 21.712408 57.971553 21.678708 27287.033 -9579.1772 168 158 + 800 1582.559 -891.23631 -632.46037 -636.88203 -1404.3665 21.671936 58.127004 21.678224 27308.594 -9571.6663 192 180 + 900 1586.7172 -617.17083 -2495.5378 -2302.8766 2946.9018 21.658489 58.181921 21.668968 27305.771 -9572.9641 216 204 + 1000 1607.563 -389.8113 810.4908 298.84287 -2278.7676 21.624573 58.076745 21.724272 27283.183 -9579.5034 240 227 +Loop time of 31.7733 on 1 procs for 1000 steps with 2304 atoms + +Performance: 5.439 ns/day, 4.413 hours/ns, 31.473 timesteps/s, 72.514 katom-step/s +99.2% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 28.604 | 28.604 | 28.604 | 0.0 | 90.02 +Neigh | 0.21293 | 0.21293 | 0.21293 | 0.0 | 0.67 +Comm | 0.010645 | 0.010645 | 0.010645 | 0.0 | 0.03 +Output | 0.00033194 | 0.00033194 | 0.00033194 | 0.0 | 0.00 +Modify | 2.9411 | 2.9411 | 2.9411 | 0.0 | 9.26 +Other | | 0.00448 | | | 0.01 + +Nlocal: 2304 ave 2304 max 2304 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 4748 ave 4748 max 4748 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 130301 ave 130301 max 130301 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +FullNghs: 260602 ave 260602 max 260602 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 260602 +Ave neighs/atom = 113.10851 +Neighbor list builds = 62 +Dangerous builds = 0 + +#write_data pulse_end.data +Total wall time: 0:00:31 diff --git a/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_edge.g++.4 b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_edge.g++.4 new file mode 100644 index 0000000000..da7976d867 --- /dev/null +++ b/examples/PACKAGES/neighbor-swap/log.22May22.KMC_pulse_edge.g++.4 @@ -0,0 +1,155 @@ +LAMMPS (2 Apr 2025 - Development - patch_2Apr2025-384-g88bc7dc720-modified) + using 1 OpenMP thread(s) per MPI task +# May 2025 +# Test script for MD-KMC accelerated diffusion testing in LAMMPS +# Created by Jacob Tavenner, Baylor University + +# Initiation ------------------------------------- +units metal +dimension 3 +boundary p p p +atom_style atomic + + +# Atom Definition -------------------------------- +lattice fcc 3.762 +Lattice spacing in x,y,z = 3.762 3.762 3.762 +region whole block 0 1 0 1 0 1 +create_box 2 whole +Created orthogonal box = (0 0 0) to (3.762 3.762 3.762) + 1 by 2 by 2 MPI processor grid +create_atoms 1 region whole +Created 4 atoms + using lattice units in orthogonal box = (0 0 0) to (3.762 3.762 3.762) + create_atoms CPU = 0.000 seconds + +replicate 6 16 6 +Replication is creating a 6x16x6 = 576 times larger system... + orthogonal box = (0 0 0) to (22.572 60.192 22.572) + 1 by 4 by 1 MPI processor grid + 2304 atoms + replicate CPU = 0.000 seconds + +region puck block INF INF INF 2 INF INF +set region puck type 2 +Setting atom values ... + 360 settings made for type + +# Force Fields ----------------------------------- +pair_style meam +pair_coeff * * library_2nn.meam Mo Co Ni V Fe Al Cr MoCoNiVFeAlCr_2nn.meam Ni Cr +Reading MEAM library file library_2nn.meam with DATE: 2024-08-08 +Reading MEAM potential file MoCoNiVFeAlCr_2nn.meam with DATE: 2024-08-08 + +# Settings --------------------------------------- +timestep 0.002 +thermo 100 + +# Computations ----------------------------------- +compute voroN all voronoi/atom neighbors yes + +run 0 +WARNING: No fixes with time integration, atoms won't move +For more information see https://docs.lammps.org/err0028 (src/verlet.cpp:60) +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.8 + ghost atom cutoff = 6.8 + binsize = 3.4, bins = 7 18 7 + 2 neighbor lists, perpetual/occasional/extra = 2 0 0 + (1) pair meam, perpetual + attributes: full, newton on + pair build: full/bin/atomonly + stencil: full/bin/3d + bin: standard + (2) pair meam, perpetual, half/full from (1) + attributes: half, newton on + pair build: halffull/newton + stencil: none + bin: none +Per MPI rank memory allocation (min/avg/max) = 9.636 | 9.636 | 9.636 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 0 -9674.3728 0 -9674.3728 -212400.94 +Loop time of 1.53e-06 on 4 procs for 0 steps with 2304 atoms + +65.4% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0 | 0 | 0 | 0.0 | 0.00 +Neigh | 0 | 0 | 0 | 0.0 | 0.00 +Comm | 0 | 0 | 0 | 0.0 | 0.00 +Output | 0 | 0 | 0 | 0.0 | 0.00 +Modify | 0 | 0 | 0 | 0.0 | 0.00 +Other | | 1.53e-06 | | |100.00 + +Nlocal: 576 ave 576 max 576 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 2131 ave 2131 max 2131 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Neighs: 24768 ave 24768 max 24768 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +FullNghs: 49536 ave 49536 max 49536 min +Histogram: 4 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 198144 +Ave neighs/atom = 86 +Neighbor list builds = 0 +Dangerous builds = 0 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe + +# Execution -------------------------------------- + +velocity all create 2400 908124 loop geom +fix temp all npt temp 1000 1000 1000 aniso 0 0 1 +fix mc all neighbor/swap 50 12 1340723 1000 3 voroN diff 2 +thermo_style custom step temp press pxx pyy pzz lx ly lz vol pe f_mc[*] +#dump dump2 all custom 5000 dump.edge-3_Ni-Cr.* id type x y z c_eng c_csym + +run 1000 +Per MPI rank memory allocation (min/avg/max) = 9.636 | 9.636 | 9.636 Mbytes + Step Temp Press Pxx Pyy Pzz Lx Ly Lz Volume PotEng f_mc[1] f_mc[2] + 0 2400 -187517.52 -187464.47 -188202.62 -186885.48 22.572 60.192 22.572 30667.534 -9674.3728 0 0 + 100 1665.569 14271.813 14638.855 14316.569 13860.016 21.63675 57.721065 21.637799 27023.366 -9594.291 24 24 + 200 1598.6479 -6990.8349 -8574.1986 -5033.6147 -7364.6916 21.708963 58.123129 21.724821 27412.223 -9575.7322 48 47 + 300 1604.388 456.43285 1926.408 -1214.1721 657.0626 21.673369 58.090421 21.671716 27285.018 -9577.698 72 70 + 400 1601.1591 1303.6721 703.88473 1137.6607 2069.471 21.684004 58.049595 21.671161 27278.522 -9576.4811 96 94 + 500 1623.6044 -2243.2478 -2084.532 320.87709 -4966.0885 21.686171 58.097101 21.695911 27334.758 -9583.1878 120 118 + 600 1587.2041 421.60034 190.88741 -328.76599 1402.6796 21.712439 58.086039 21.655927 27312.229 -9572.559 144 141 + 700 1591.2923 32.327829 -2893.2353 1839.7574 1150.4614 21.719102 57.999862 21.666164 27292.974 -9573.9009 168 165 + 800 1580.8587 -105.51079 654.26389 -160.04168 -810.75457 21.670225 58.109245 21.684683 27306.229 -9570.6482 192 186 + 900 1570.7648 1290.088 1252.3689 255.62548 2362.2695 21.68101 58.100507 21.658755 27283.051 -9567.9864 216 209 + 1000 1598.1483 -125.35291 -3626.5479 3404.789 -154.29983 21.720146 57.952942 21.686111 27297.313 -9576.2975 240 231 +Loop time of 9.17241 on 4 procs for 1000 steps with 2304 atoms + +Performance: 18.839 ns/day, 1.274 hours/ns, 109.023 timesteps/s, 251.188 katom-step/s +98.1% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 7.7477 | 8.0143 | 8.1344 | 5.5 | 87.37 +Neigh | 0.050543 | 0.056882 | 0.05986 | 1.6 | 0.62 +Comm | 0.069784 | 0.16898 | 0.40996 | 34.2 | 1.84 +Output | 0.00015612 | 0.0001707 | 0.00021249 | 0.0 | 0.00 +Modify | 0.90628 | 0.93003 | 0.96157 | 2.2 | 10.14 +Other | | 0.002053 | | | 0.02 + +Nlocal: 576 ave 614 max 505 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +Nghost: 2165.75 ave 2204 max 2132 min +Histogram: 1 0 0 0 2 0 0 0 0 1 +Neighs: 32430.8 ave 35552 max 26564 min +Histogram: 1 0 0 0 0 0 1 0 0 2 +FullNghs: 64861.5 ave 71111 max 53164 min +Histogram: 1 0 0 0 0 0 1 0 0 2 + +Total # of neighbors = 259446 +Ave neighs/atom = 112.60677 +Neighbor list builds = 62 +Dangerous builds = 0 + +#write_data pulse_end.data +Total wall time: 0:00:09 diff --git a/examples/plugins/LAMMPSInterfaceCXX.cmake b/examples/plugins/LAMMPSInterfaceCXX.cmake index 4cd4510a61..6ff154dec4 100644 --- a/examples/plugins/LAMMPSInterfaceCXX.cmake +++ b/examples/plugins/LAMMPSInterfaceCXX.cmake @@ -33,90 +33,49 @@ endif() ################################################################################ # MPI configuration +# do not include the (obsolete) MPI C++ bindings which makes +# for leaner object files and avoids namespace conflicts +set(MPI_CXX_SKIP_MPICXX TRUE) if(NOT CMAKE_CROSSCOMPILING) - set(MPI_CXX_SKIP_MPICXX TRUE) - find_package(MPI QUIET) + find_package(MPI QUIET COMPONENTS CXX) option(BUILD_MPI "Build MPI version" ${MPI_FOUND}) else() option(BUILD_MPI "Build MPI version" OFF) endif() if(BUILD_MPI) - # do not include the (obsolete) MPI C++ bindings which makes - # for leaner object files and avoids namespace conflicts - set(MPI_CXX_SKIP_MPICXX TRUE) # We use a non-standard procedure to cross-compile with MPI on Windows if((CMAKE_SYSTEM_NAME STREQUAL "Windows") AND CMAKE_CROSSCOMPILING) - # Download and configure MinGW compatible MPICH development files for Windows - option(USE_MSMPI "Use Microsoft's MS-MPI SDK instead of MPICH2-1.4.1" OFF) - if(USE_MSMPI) - message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation") - set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball") - set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball") - mark_as_advanced(MPICH2_WIN64_DEVEL_URL) - mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) + message(STATUS "Downloading and configuring MS-MPI 10.1 for Windows cross-compilation") + set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/msmpi-win64-devel.tar.gz" CACHE STRING "URL for MS-MPI (win64) tarball") + set(MPICH2_WIN64_DEVEL_MD5 "86314daf1bffb809f1fcbefb8a547490" CACHE STRING "MD5 checksum of MS-MPI (win64) tarball") + mark_as_advanced(MPICH2_WIN64_DEVEL_URL) + mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) - include(ExternalProject) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN64_DEVEL_URL} - URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmsmpi.a) - else() - message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI") - endif() - - ExternalProject_get_property(mpi4win_build SOURCE_DIR) - file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - add_library(MPI::MPI_CXX UNKNOWN IMPORTED) - set_target_properties(MPI::MPI_CXX PROPERTIES - IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a" - INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" - INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - add_dependencies(MPI::MPI_CXX mpi4win_build) - - # set variables for status reporting at the end of CMake run - set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") - set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a") + include(ExternalProject) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + ExternalProject_Add(mpi4win_build + URL ${MPICH2_WIN64_DEVEL_URL} + URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} + CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" + BUILD_BYPRODUCTS /lib/libmsmpi.a) else() - # Download and configure custom MPICH files for Windows - message(STATUS "Downloading and configuring MPICH-1.4.1 for Windows") - set(MPICH2_WIN64_DEVEL_URL "${LAMMPS_THIRDPARTY_URL}/mpich2-win64-devel.tar.gz" CACHE STRING "URL for MPICH2 (win64) tarball") - set(MPICH2_WIN64_DEVEL_MD5 "4939fdb59d13182fd5dd65211e469f14" CACHE STRING "MD5 checksum of MPICH2 (win64) tarball") - mark_as_advanced(MPICH2_WIN64_DEVEL_URL) - mark_as_advanced(MPICH2_WIN64_DEVEL_MD5) - - include(ExternalProject) - if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN64_DEVEL_URL} - URL_MD5 ${MPICH2_WIN64_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmpi.a) - else() - ExternalProject_Add(mpi4win_build - URL ${MPICH2_WIN32_DEVEL_URL} - URL_MD5 ${MPICH2_WIN32_DEVEL_MD5} - CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" - BUILD_BYPRODUCTS /lib/libmpi.a) - endif() - - ExternalProject_get_property(mpi4win_build SOURCE_DIR) - file(MAKE_DIRECTORY "${SOURCE_DIR}/include") - add_library(MPI::MPI_CXX UNKNOWN IMPORTED) - set_target_properties(MPI::MPI_CXX PROPERTIES - IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmpi.a" - INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" - INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - add_dependencies(MPI::MPI_CXX mpi4win_build) - - # set variables for status reporting at the end of CMake run - set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") - set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX") - set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmpi.a") + message(FATAL_ERROR "Only x86 64-bit builds are supported with MS-MPI") endif() + + ExternalProject_get_property(mpi4win_build SOURCE_DIR) + file(MAKE_DIRECTORY "${SOURCE_DIR}/include") + add_library(MPI::MPI_CXX UNKNOWN IMPORTED) + set_target_properties(MPI::MPI_CXX PROPERTIES + IMPORTED_LOCATION "${SOURCE_DIR}/lib/libmsmpi.a" + INTERFACE_INCLUDE_DIRECTORIES "${SOURCE_DIR}/include" + INTERFACE_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1") + add_dependencies(MPI::MPI_CXX mpi4win_build) + + # set variables for status reporting at the end of CMake run + set(MPI_CXX_INCLUDE_PATH "${SOURCE_DIR}/include") + set(MPI_CXX_COMPILE_DEFINITIONS "MPICH_SKIP_MPICXX=1") + set(MPI_CXX_LIBRARIES "${SOURCE_DIR}/lib/libmsmpi.a") else() find_package(MPI REQUIRED) option(LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF) diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 07b3ca6426..3912961b9d 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -561,7 +561,7 @@ bool LammpsInterface::region_bounds(const char * regionName, } void LammpsInterface::minimum_image(double & dx, double & dy, double & dz) const { - lammps_->domain->minimum_image(dx,dy,dz); + lammps_->domain->minimum_image(FLERR,dx,dy,dz); } void LammpsInterface::closest_image(const double * const xi, const double * const xj, double * const xjImage) const { diff --git a/lib/gpu/lal_eam.cpp b/lib/gpu/lal_eam.cpp index 0a2ed21ab3..08b5f7e9b7 100644 --- a/lib/gpu/lal_eam.cpp +++ b/lib/gpu/lal_eam.cpp @@ -61,7 +61,7 @@ int EAMT::init(const int ntypes, double host_cutforcesq, int **host_type2rhor, if (onetype>0) onetype=-1; else if (onetype==0) - onetype=i*max_shared_types+i; + onetype=i; } if (onetype<0) onetype=0; #endif @@ -109,7 +109,7 @@ int EAMT::init(const int ntypes, double host_cutforcesq, int **host_type2rhor, int lj_types=ntypes; shared_types=false; - if (lj_types<=max_shared_types && this->_block_size>=max_shared_types) { + if (lj_types<=max_shared_types && this->_block_size>=max_shared_types*max_shared_types) { lj_types=max_shared_types; shared_types=true; } diff --git a/lib/voronoi/voro-make.patch b/lib/voronoi/voro-make.patch index f51bd08614..f2811e3adb 100644 --- a/lib/voronoi/voro-make.patch +++ b/lib/voronoi/voro-make.patch @@ -1,5 +1,35 @@ ---- src/Makefile.orig 2020-05-03 03:50:23.501557199 -0400 -+++ src/Makefile 2020-05-03 03:53:32.147681674 -0400 +--- Makefile.orig 2025-06-04 12:16:01.056286325 -0400 ++++ Makefile 2025-06-04 12:18:47.454879006 -0400 +@@ -11,8 +11,7 @@ + + # Build all of the executable files + all: +- $(MAKE) -C src +- $(MAKE) -C examples ++ $(MAKE) -C src depend libvoro++.a + + # Build the help files (with Doxygen) + help: +@@ -24,16 +23,12 @@ + $(MAKE) -C examples clean + + # Install the executable, man page, and shared library +-install: +- $(MAKE) -C src +- $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/bin ++install: all + $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/lib + $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/man + $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/man/man1 + $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/include + $(INSTALL) -d $(IFLAGS_EXEC) $(PREFIX)/include/voro++ +- $(INSTALL) $(IFLAGS_EXEC) src/voro++ $(PREFIX)/bin +- $(INSTALL) $(IFLAGS) man/voro++.1 $(PREFIX)/man/man1 + $(INSTALL) $(IFLAGS) src/libvoro++.a $(PREFIX)/lib + $(INSTALL) $(IFLAGS) src/voro++.hh $(PREFIX)/include/voro++ + $(INSTALL) $(IFLAGS) src/c_loops.hh $(PREFIX)/include/voro++ +--- src/Makefile.orig 2013-10-17 13:54:13.000000000 -0400 ++++ src/Makefile 2025-06-04 12:16:47.293104880 -0400 @@ -10,10 +10,10 @@ # List of the common source files objs=cell.o common.o container.o unitcell.o v_compute.o c_loops.o \ diff --git a/src/AMOEBA/angle_amoeba.cpp b/src/AMOEBA/angle_amoeba.cpp index e2d26dd047..bf3bc179bc 100644 --- a/src/AMOEBA/angle_amoeba.cpp +++ b/src/AMOEBA/angle_amoeba.cpp @@ -834,13 +834,13 @@ double AngleAmoeba::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/BPM/bond_bpm.cpp b/src/BPM/bond_bpm.cpp index 284626464e..c47614afff 100644 --- a/src/BPM/bond_bpm.cpp +++ b/src/BPM/bond_bpm.cpp @@ -352,7 +352,7 @@ double BondBPM::equilibrium_distance(int /*i*/) 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); + domain->minimum_image(FLERR, delx, dely, delz); r = sqrt(delx * delx + dely * dely + delz * delz); if (r > r0_max_estimate) r0_max_estimate = r; diff --git a/src/BPM/bond_bpm_rotational.cpp b/src/BPM/bond_bpm_rotational.cpp index b1e6163d97..0e8f822a6d 100644 --- a/src/BPM/bond_bpm_rotational.cpp +++ b/src/BPM/bond_bpm_rotational.cpp @@ -177,7 +177,7 @@ void BondBPMRotational::store_data() } // Get closest image in case bonded with ghost - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); r = sqrt(delx * delx + dely * dely + delz * delz); rinv = 1.0 / r; diff --git a/src/BPM/bond_bpm_spring.cpp b/src/BPM/bond_bpm_spring.cpp index a5c31ea1b2..f5094ffbcb 100644 --- a/src/BPM/bond_bpm_spring.cpp +++ b/src/BPM/bond_bpm_spring.cpp @@ -140,7 +140,7 @@ void BondBPMSpring::store_data() delz = x[i][2] - x[j][2]; // Get closest image in case bonded with ghost - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); r = sqrt(delx * delx + dely * dely + delz * delz); fix_bond_history->update_atom_value(i, m, 0, r); diff --git a/src/BPM/bond_bpm_spring_plastic.cpp b/src/BPM/bond_bpm_spring_plastic.cpp index 21ef0f12fb..8ef8ef63c7 100644 --- a/src/BPM/bond_bpm_spring_plastic.cpp +++ b/src/BPM/bond_bpm_spring_plastic.cpp @@ -148,7 +148,7 @@ void BondBPMSpringPlastic::store_data() delz = x[i][2] - x[j][2]; // Get closest image in case bonded with ghost - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); r = sqrt(delx * delx + dely * dely + delz * delz); fix_bond_history->update_atom_value(i, m, 0, r); diff --git a/src/CG-SPICA/angle_spica.cpp b/src/CG-SPICA/angle_spica.cpp index 08e4217483..5f198f6d76 100644 --- a/src/CG-SPICA/angle_spica.cpp +++ b/src/CG-SPICA/angle_spica.cpp @@ -458,13 +458,13 @@ double AngleSPICA::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; @@ -479,7 +479,7 @@ double AngleSPICA::single(int type, int i1, int i2, int i3) double delx3 = x[i1][0] - x[i3][0]; double dely3 = x[i1][1] - x[i3][1]; double delz3 = x[i1][2] - x[i3][2]; - domain->minimum_image(delx3,dely3,delz3); + domain->minimum_image(FLERR, delx3,dely3,delz3); const int type1 = atom->type[i1]; const int type3 = atom->type[i3]; diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index 04b7a9238c..7d345dac85 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -436,13 +436,13 @@ double AngleClass2::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/COLVARS/colvarproxy_lammps.cpp b/src/COLVARS/colvarproxy_lammps.cpp index c92d835cf6..29b9cbfcd0 100644 --- a/src/COLVARS/colvarproxy_lammps.cpp +++ b/src/COLVARS/colvarproxy_lammps.cpp @@ -188,7 +188,7 @@ cvm::rvector colvarproxy_lammps::position_distance(cvm::atom_pos const &pos1, double xtmp = pos2.x - pos1.x; double ytmp = pos2.y - pos1.y; double ztmp = pos2.z - pos1.z; - _lmp->domain->minimum_image_big(xtmp,ytmp,ztmp); + _lmp->domain->minimum_image_big(FLERR, xtmp,ytmp,ztmp); return {xtmp, ytmp, ztmp}; } diff --git a/src/DIELECTRIC/fix_polarize_functional.cpp b/src/DIELECTRIC/fix_polarize_functional.cpp index dd0c0eb648..2d2b1cb35e 100644 --- a/src/DIELECTRIC/fix_polarize_functional.cpp +++ b/src/DIELECTRIC/fix_polarize_functional.cpp @@ -652,7 +652,7 @@ void FixPolarizeFunctional::calculate_Rww_cutoff() double delx = xtmp - x[k][0]; double dely = ytmp - x[k][1]; double delz = ztmp - x[k][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); int mk = tag2mat[tag[k]]; // G1ww[mi][mk] = calculate_greens_ewald(delx, dely, delz); @@ -861,7 +861,7 @@ void FixPolarizeFunctional::calculate_qiRqw_cutoff() delx = xtmp - x[k][0]; dely = ytmp - x[k][1]; delz = ztmp - x[k][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); r = sqrt(delx * delx + dely * dely + delz * delz); int mk = tag2mat[tag[k]]; @@ -902,7 +902,7 @@ void FixPolarizeFunctional::calculate_qiRqw_cutoff() delx = x[i][0] - xtmp; dely = x[i][1] - ytmp; delz = x[i][2] - ztmp; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); int mi = tag2mat_ions[tag[i]]; //ion_idx[i]; diff --git a/src/DIPOLE/angle_dipole.cpp b/src/DIPOLE/angle_dipole.cpp index 530f23f844..00e55bbbcc 100644 --- a/src/DIPOLE/angle_dipole.cpp +++ b/src/DIPOLE/angle_dipole.cpp @@ -251,7 +251,7 @@ double AngleDipole::single(int type, int iRef, int iDip, int /*iDummy*/) double dely = x[iRef][1] - x[iDip][1]; double delz = x[iRef][2] - x[iDip][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); double r = sqrt(delx * delx + dely * dely + delz * delz); if (r < SMALL) return 0.0; diff --git a/src/EXTRA-COMPUTE/compute_born_matrix.cpp b/src/EXTRA-COMPUTE/compute_born_matrix.cpp index 26dcedcf55..c9967f9a46 100644 --- a/src/EXTRA-COMPUTE/compute_born_matrix.cpp +++ b/src/EXTRA-COMPUTE/compute_born_matrix.cpp @@ -764,7 +764,7 @@ void ComputeBornMatrix::compute_bonds() 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); + domain->minimum_image(FLERR, dx, dy, dz); rsq = dx * dx + dy * dy + dz * dz; rij[0] = dx; rij[1] = dy; @@ -870,7 +870,7 @@ void ComputeBornMatrix::compute_angles() 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); + domain->minimum_image(FLERR, delx1, dely1, delz1); del1[0] = delx1; del1[1] = dely1; del1[2] = delz1; @@ -882,7 +882,7 @@ void ComputeBornMatrix::compute_angles() 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); del2[0] = delx2; del2[1] = dely2; del2[2] = delz2; @@ -1046,7 +1046,7 @@ void ComputeBornMatrix::compute_dihedrals() 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); + domain->minimum_image(FLERR, vb1x, vb1y, vb1z); b1[0] = vb1x; b1[1] = vb1y; b1[2] = vb1z; @@ -1055,7 +1055,7 @@ void ComputeBornMatrix::compute_dihedrals() 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); + domain->minimum_image(FLERR, vb2x, vb2y, vb2z); b2[0] = vb2x; b2[1] = vb2y; b2[2] = vb2z; @@ -1064,7 +1064,7 @@ void ComputeBornMatrix::compute_dihedrals() 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); + domain->minimum_image(FLERR, vb3x, vb3y, vb3z); b3[0] = vb3x; b3[1] = vb3y; b3[2] = vb3z; diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 9d3bcb92ca..5a59c7a175 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -480,7 +480,7 @@ void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi tmp1[dir1] = (bin1 + 1) * bin_width1 - xi; else tmp1[dir1] = bin1 * bin_width1 - xi; - domain->minimum_image(tmp1[0],tmp1[1],tmp1[2]); + domain->minimum_image(FLERR, tmp1[0],tmp1[1],tmp1[2]); l1 = tmp1[dir1] / rij1; double l2; @@ -489,7 +489,7 @@ void ComputeStressCartesian::compute_pressure(double fpair, double xi, double yi tmp2[dir2] = (bin2 + 1) * bin_width2 - yi; else tmp2[dir2] = bin2 * bin_width2 - yi; - domain->minimum_image(tmp2[0],tmp2[1],tmp2[2]); + domain->minimum_image(FLERR, tmp2[0],tmp2[1],tmp2[2]); l2 = tmp2[dir2] / rij2; if ((dims == 1 || l1 < l2 || l2 < lb + SMALL) && l1 <= 1.0 && l1 > lb) { diff --git a/src/EXTRA-COMPUTE/compute_stress_mop.cpp b/src/EXTRA-COMPUTE/compute_stress_mop.cpp index 6f96debd40..d362fe657d 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop.cpp @@ -82,7 +82,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : Compute( error->warning(FLERR, "The specified initial plane lies outside of the simulation box"); double dx[3] = {0.0, 0.0, 0.0}; dx[dir] = pos - 0.5 * (domain->boxhi[dir] + domain->boxlo[dir]); - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); pos = 0.5 * (domain->boxhi[dir] + domain->boxlo[dir]) + dx[dir]; if ((pos > domain->boxhi[dir]) || (pos < domain->boxlo[dir])) @@ -478,7 +478,7 @@ void ComputeStressMop::compute_pairs() // minimum image of xi with respect to the plane xi[dir] -= pos; - domain->minimum_image(xi[0], xi[1], xi[2]); + domain->minimum_image(FLERR, xi[0], xi[1], xi[2]); xi[dir] += pos; //velocities at t @@ -601,7 +601,7 @@ void ComputeStressMop::compute_bonds() dx[1] = x[atom1][1]; dx[2] = x[atom1][2]; dx[dir] -= pos; - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); x_bond_1[0] = dx[0]; x_bond_1[1] = dx[1]; x_bond_1[2] = dx[2]; @@ -612,7 +612,7 @@ void ComputeStressMop::compute_bonds() dx[0] = x[atom2][0] - x_bond_1[0]; dx[1] = x[atom2][1] - x_bond_1[1]; dx[2] = x[atom2][2] - x_bond_1[2]; - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); x_bond_2[0] = x_bond_1[0] + dx[0]; x_bond_2[1] = x_bond_1[1] + dx[1]; x_bond_2[2] = x_bond_1[2] + dx[2]; @@ -728,7 +728,7 @@ void ComputeStressMop::compute_angles() dx[1] = x[atom1][1]; dx[2] = x[atom1][2]; dx[dir] -= pos; - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); x_angle_left[0] = dx[0]; x_angle_left[1] = dx[1]; x_angle_left[2] = dx[2]; @@ -739,7 +739,7 @@ void ComputeStressMop::compute_angles() dx_left[0] = x[atom2][0] - x_angle_left[0]; dx_left[1] = x[atom2][1] - x_angle_left[1]; dx_left[2] = x[atom2][2] - x_angle_left[2]; - domain->minimum_image(dx_left[0], dx_left[1], dx_left[2]); + domain->minimum_image(FLERR, dx_left[0], dx_left[1], dx_left[2]); x_angle_middle[0] = x_angle_left[0] + dx_left[0]; x_angle_middle[1] = x_angle_left[1] + dx_left[1]; x_angle_middle[2] = x_angle_left[2] + dx_left[2]; @@ -749,7 +749,7 @@ void ComputeStressMop::compute_angles() dx_right[0] = x[atom3][0] - x_angle_middle[0]; dx_right[1] = x[atom3][1] - x_angle_middle[1]; dx_right[2] = x[atom3][2] - x_angle_middle[2]; - domain->minimum_image(dx_right[0], dx_right[1], dx_right[2]); + domain->minimum_image(FLERR, dx_right[0], dx_right[1], dx_right[2]); x_angle_right[0] = x_angle_middle[0] + dx_right[0]; x_angle_right[1] = x_angle_middle[1] + dx_right[1]; x_angle_right[2] = x_angle_middle[2] + dx_right[2]; @@ -920,14 +920,14 @@ void ComputeStressMop::compute_dihedrals() x_atom_1[1] = x[atom1][1]; x_atom_1[2] = x[atom1][2]; x_atom_1[dir] -= pos; - domain->minimum_image(x_atom_1[0], x_atom_1[1], x_atom_1[2]); + domain->minimum_image(FLERR, x_atom_1[0], x_atom_1[1], x_atom_1[2]); x_atom_1[dir] += pos; // minimum image of atom2 with respect to atom1 diffx[0] = x[atom2][0] - x_atom_1[0]; diffx[1] = x[atom2][1] - x_atom_1[1]; diffx[2] = x[atom2][2] - x_atom_1[2]; - domain->minimum_image(diffx[0], diffx[1], diffx[2]); + domain->minimum_image(FLERR, diffx[0], diffx[1], diffx[2]); x_atom_2[0] = x_atom_1[0] + diffx[0]; x_atom_2[1] = x_atom_1[1] + diffx[1]; x_atom_2[2] = x_atom_1[2] + diffx[2]; @@ -936,7 +936,7 @@ void ComputeStressMop::compute_dihedrals() diffx[0] = x[atom3][0] - x_atom_2[0]; diffx[1] = x[atom3][1] - x_atom_2[1]; diffx[2] = x[atom3][2] - x_atom_2[2]; - domain->minimum_image(diffx[0], diffx[1], diffx[2]); + domain->minimum_image(FLERR, diffx[0], diffx[1], diffx[2]); x_atom_3[0] = x_atom_2[0] + diffx[0]; x_atom_3[1] = x_atom_2[1] + diffx[1]; x_atom_3[2] = x_atom_2[2] + diffx[2]; @@ -945,7 +945,7 @@ void ComputeStressMop::compute_dihedrals() diffx[0] = x[atom4][0] - x_atom_3[0]; diffx[1] = x[atom4][1] - x_atom_3[1]; diffx[2] = x[atom4][2] - x_atom_3[2]; - domain->minimum_image(diffx[0], diffx[1], diffx[2]); + domain->minimum_image(FLERR, diffx[0], diffx[1], diffx[2]); x_atom_4[0] = x_atom_3[0] + diffx[0]; x_atom_4[1] = x_atom_3[1] + diffx[1]; x_atom_4[2] = x_atom_3[2] + diffx[2]; diff --git a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp index c8087b60a9..a6bf661a9e 100644 --- a/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_mop_profile.cpp @@ -537,14 +537,14 @@ void ComputeStressMopProfile::compute_pairs() // minimum image of xi with respect to the plane xi[dir] -= pos; - domain->minimum_image(xi[0], xi[1], xi[2]); + domain->minimum_image(FLERR, xi[0], xi[1], xi[2]); xi[dir] += pos; // minimum image of xj with respect to xi xj[0] -= xi[0]; xj[1] -= xi[1]; xj[2] -= xi[2]; - domain->minimum_image(xi[0], xi[1], xi[2]); + domain->minimum_image(FLERR, xj[0], xj[1], xj[2]); xj[0] += xi[0]; xj[1] += xi[1]; xj[2] += xi[2]; @@ -649,7 +649,7 @@ void ComputeStressMopProfile::compute_bonds() dx[1] = x[atom1][1]; dx[2] = x[atom1][2]; dx[dir] -= pos; - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); x_bond_1[0] = dx[0]; x_bond_1[1] = dx[1]; x_bond_1[2] = dx[2]; @@ -660,7 +660,7 @@ void ComputeStressMopProfile::compute_bonds() dx[0] = x[atom2][0] - x_bond_1[0]; dx[1] = x[atom2][1] - x_bond_1[1]; dx[2] = x[atom2][2] - x_bond_1[2]; - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); x_bond_2[0] = x_bond_1[0] + dx[0]; x_bond_2[1] = x_bond_1[1] + dx[1]; x_bond_2[2] = x_bond_1[2] + dx[2]; @@ -783,7 +783,7 @@ void ComputeStressMopProfile::compute_angles() dx[1] = x[atom1][1]; dx[2] = x[atom1][2]; dx[dir] -= pos; - domain->minimum_image(dx[0], dx[1], dx[2]); + domain->minimum_image(FLERR, dx[0], dx[1], dx[2]); x_angle_left[0] = dx[0]; x_angle_left[1] = dx[1]; x_angle_left[2] = dx[2]; @@ -793,7 +793,7 @@ void ComputeStressMopProfile::compute_angles() dx_left[0] = x[atom2][0] - x_angle_left[0]; dx_left[1] = x[atom2][1] - x_angle_left[1]; dx_left[2] = x[atom2][2] - x_angle_left[2]; - domain->minimum_image(dx_left[0], dx_left[1], dx_left[2]); + domain->minimum_image(FLERR, dx_left[0], dx_left[1], dx_left[2]); x_angle_middle[0] = x_angle_left[0] + dx_left[0]; x_angle_middle[1] = x_angle_left[1] + dx_left[1]; x_angle_middle[2] = x_angle_left[2] + dx_left[2]; @@ -802,7 +802,7 @@ void ComputeStressMopProfile::compute_angles() dx_right[0] = x[atom3][0] - x_angle_middle[0]; dx_right[1] = x[atom3][1] - x_angle_middle[1]; dx_right[2] = x[atom3][2] - x_angle_middle[2]; - domain->minimum_image(dx_right[0], dx_right[1], dx_right[2]); + domain->minimum_image(FLERR, dx_right[0], dx_right[1], dx_right[2]); x_angle_right[0] = x_angle_middle[0] + dx_right[0]; x_angle_right[1] = x_angle_middle[1] + dx_right[1]; x_angle_right[2] = x_angle_middle[2] + dx_right[2]; @@ -971,14 +971,14 @@ void ComputeStressMopProfile::compute_dihedrals() x_atom_1[1] = x[atom1][1]; x_atom_1[2] = x[atom1][2]; x_atom_1[dir] -= pos; - domain->minimum_image(x_atom_1[0], x_atom_1[1], x_atom_1[2]); + domain->minimum_image(FLERR, x_atom_1[0], x_atom_1[1], x_atom_1[2]); x_atom_1[dir] += pos; // minimum image of atom2 with respect to atom1 diffx[0] = x[atom2][0] - x_atom_1[0]; diffx[1] = x[atom2][1] - x_atom_1[1]; diffx[2] = x[atom2][2] - x_atom_1[2]; - domain->minimum_image(diffx[0], diffx[1], diffx[2]); + domain->minimum_image(FLERR, diffx[0], diffx[1], diffx[2]); x_atom_2[0] = x_atom_1[0] + diffx[0]; x_atom_2[1] = x_atom_1[1] + diffx[1]; x_atom_2[2] = x_atom_1[2] + diffx[2]; @@ -987,7 +987,7 @@ void ComputeStressMopProfile::compute_dihedrals() diffx[0] = x[atom3][0] - x_atom_2[0]; diffx[1] = x[atom3][1] - x_atom_2[1]; diffx[2] = x[atom3][2] - x_atom_2[2]; - domain->minimum_image(diffx[0], diffx[1], diffx[2]); + domain->minimum_image(FLERR, diffx[0], diffx[1], diffx[2]); x_atom_3[0] = x_atom_2[0] + diffx[0]; x_atom_3[1] = x_atom_2[1] + diffx[1]; x_atom_3[2] = x_atom_2[2] + diffx[2]; @@ -996,7 +996,7 @@ void ComputeStressMopProfile::compute_dihedrals() diffx[0] = x[atom4][0] - x_atom_3[0]; diffx[1] = x[atom4][1] - x_atom_3[1]; diffx[2] = x[atom4][2] - x_atom_3[2]; - domain->minimum_image(diffx[0], diffx[1], diffx[2]); + domain->minimum_image(FLERR, diffx[0], diffx[1], diffx[2]); x_atom_4[0] = x_atom_3[0] + diffx[0]; x_atom_4[1] = x_atom_3[1] + diffx[1]; x_atom_4[2] = x_atom_3[2] + diffx[2]; diff --git a/src/EXTRA-FIX/fix_ave_moments.cpp b/src/EXTRA-FIX/fix_ave_moments.cpp new file mode 100644 index 0000000000..882aaa7f28 --- /dev/null +++ b/src/EXTRA-FIX/fix_ave_moments.cpp @@ -0,0 +1,636 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Sebastian Huetter (OvGU) +------------------------------------------------------------------------- */ + +#include "fix_ave_moments.h" + +#include "arg_info.h" +#include "compute.h" +#include "error.h" +#include "input.h" +#include "math_special.h" +#include "memory.h" +#include "modify.h" +#include "update.h" +#include "variable.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; +using MathSpecial::square; +using MathSpecial::cube; + +enum { MEAN, STDDEV, VARIANCE, SKEW, KURTOSIS }; + +/* ---------------------------------------------------------------------- */ + +FixAveMoments::FixAveMoments(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), nvalues(0), result_list(nullptr), window_list(nullptr) +{ + // this fix's data is always accessible (but might be meaningless) + global_freq = 1; + dynamic_group_allow = 1; + time_depend = 1; + + // EXAMPLE: + // fix ID group-ID ave/moments Nevery Nrepeat Nfreq value1 ... valueN moment1 ... momentM keyword value ... + + // the first six arguments are fixed & need at least one input and moment + const int nfixedargs = 6; + if (narg < nfixedargs + 2) utils::missing_cmd_args(FLERR, "fix ave/moments", error); + + nevery = utils::inumeric(FLERR,arg[3],false,lmp); + nrepeat = utils::inumeric(FLERR,arg[4],false,lmp); + nfreq = utils::inumeric(FLERR,arg[5],false,lmp); + + // scan values to count them + + nvalues = 0; + // first input name is position after the fixed args + int iarg = nfixedargs; + while (iarg < narg) { + if (utils::strmatch(arg[iarg],"^[cfv]_")) { + nvalues++; + iarg++; + } else break; + } + if (nvalues == 0) + error->all(FLERR, nfixedargs, + "No values from computes, fixes, or variables used in fix ave/moments command"); + + // next, the moments + iarg = consume_moments(iarg, narg, arg); + if (moments.empty()) + error->all(FLERR, nfixedargs, + "No values from computes, fixes, or variables used in fix ave/moments command"); + + // parse optional keywords which must follow the data + + options(iarg,narg,arg); + + // expand args if any have wildcard character "*" + // this can reset nvalues + + int expand = 0; + char **earg; + int *amap = nullptr; + nvalues = utils::expand_args(FLERR, nvalues, &arg[nfixedargs], /* mode=scalar */ 0, earg, lmp, &amap); + + if (earg != &arg[nfixedargs]) expand = 1; + arg = earg; + + // parse values + + values.clear(); + for (int i = 0; i < nvalues; i++) { + ArgInfo argi(arg[i]); + + value_t val; + val.keyword = arg[i]; + val.which = argi.get_type(); + + val.argindex = argi.get_index1(); + val.iarg = (expand ? amap[i] : i) + nfixedargs; + val.varlen = 0; + val.id = argi.get_name(); + val.val.c = nullptr; + + if ((val.which == ArgInfo::NONE) || (val.which == ArgInfo::UNKNOWN) || (argi.get_dim() > 1)) + error->all(FLERR, val.iarg, "Invalid fix ave/moments argument: {}", arg[i]); + + values.push_back(std::move(val)); + } + if (nvalues != (int)values.size()) + error->all(FLERR, Error::NOPOINTER, + "Could not parse value data consistently for fix ave/moments"); + + // setup and error check + // for fix inputs, check that fix frequency is acceptable + + if (nevery <= 0) error->all(FLERR, 3, "Illegal fix ave/moments nevery value: {}", nevery); + if (nrepeat <= 0) error->all(FLERR, 4, "Illegal fix ave/moments nrepeat value: {}", nrepeat); + if (nfreq <= 0) error->all(FLERR, 5, "Illegal fix ave/moments nfreq value: {}", nfreq); + + for (auto &val : values) { + switch (val.which) { + case ArgInfo::COMPUTE: + val.val.c = modify->get_compute_by_id(val.id); + if (!val.val.c) + error->all(FLERR, val.iarg, "Compute ID {} for fix ave/moments does not exist", val.id); + if (val.argindex == 0 && (val.val.c->scalar_flag == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments compute {} does not calculate a scalar", val.id); + if (val.argindex && (val.val.c->vector_flag == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments compute {} does not calculate a vector", val.id); + if (val.argindex && (val.argindex > val.val.c->size_vector) && + (val.val.c->size_vector_variable == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments compute {} vector is accessed out-of-range{}", + val.id, utils::errorurl(20)); + if (val.argindex && val.val.c->size_vector_variable) val.varlen = 1; + break; + + case ArgInfo::FIX: + val.val.f = modify->get_fix_by_id(val.id); + if (!val.val.f) error->all(FLERR,"Fix ID {} for fix ave/moments does not exist", val.id); + if ((val.argindex == 0) && (val.val.f->scalar_flag == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments fix {} does not calculate a scalar", val.id); + if (val.argindex && (val.val.f->vector_flag == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments fix {} does not calculate a vector", val.id); + if (val.argindex && (val.val.f->size_vector_variable)) + error->all(FLERR, val.iarg, "Fix ave/moments fix {} vector cannot be variable length", val.id); + if (val.argindex && (val.argindex > val.val.f->size_vector)) + error->all(FLERR, val.iarg, "Fix ave/moments fix {} vector is accessed out-of-range{}", + val.id, utils::errorurl(20)); + if (nevery % val.val.f->global_freq) + error->all(FLERR, val.iarg, "Fix {} for fix ave/moments not computed at compatible time{}", + val.id, utils::errorurl(7)); + break; + + case ArgInfo::VARIABLE: + int ivariable = input->variable->find(val.id.c_str()); + if (ivariable < 0) + error->all(FLERR, val.iarg, "Variable name {} for fix ave/moments does not exist", val.id); + if ((val.argindex == 0) && (input->variable->equalstyle(ivariable) == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments variable {} is not equal-style variable", val.id); + if ((val.argindex) && (input->variable->vectorstyle(ivariable) == 0)) + error->all(FLERR, val.iarg, "Fix ave/moments variable {} is not vector-style variable", + val.id); + break; + } + } + + // if wildcard expansion occurred, free earg memory from expand_args() + // wait to do this until after file comment lines are printed + + if (expand) { + for (int i = 0; i < nvalues; i++) delete[] earg[i]; + memory->sfree(earg); + memory->sfree(amap); + } + + // allocate memory for averaging + + window_list = nullptr; + result_list = nullptr; + + // one window of nvalues columns and nrepeat rows (=all scalars of one value are consecutive) + memory->create(window_list, nvalues, nrepeat, "ave/moments:window_list"); + for (int i = 0; i < nvalues; i++) + for (int j = 0; j < nrepeat; j++) + window_list[i][j] = 0.0; + + // this fix produces a global vector and array + + vector_flag = 1; + size_vector = nvalues * moments.size(); + array_flag = 1; + size_array_rows = size_vector; + size_array_cols = nhistory; + + // produce nmoments outputs per value with nhistory depth + memory->create(result_list, nhistory, size_vector, "ave/moments:result_list"); + for (int i = 0; i < nhistory; i++) + for (int j = 0; j < size_vector; j++) + result_list[i][j] = 0.0; + + // intensive/extensive flags set by compute,fix,variable that produces value + + extvector = -1; + extarray = -2; + extlist = new int[size_vector]; + int extvalue = 0; + int i = 0; + for (auto &val : values) { + switch (val.which) { + case ArgInfo::COMPUTE: + if (val.argindex == 0) extvalue = val.val.c->extscalar; + else if (val.val.f->extvector >= 0) extvalue = val.val.c->extvector; + else extvalue = val.val.c->extlist[val.argindex-1]; + break; + + case ArgInfo::FIX: + if (val.argindex == 0) extvalue = val.val.f->extscalar; + else if (val.val.f->extvector >= 0) extvalue = val.val.f->extvector; + else extvalue = val.val.f->extlist[val.argindex-1]; + break; + + case ArgInfo::VARIABLE: + extvalue = 0; + break; + } + if (extvalue == -1) + error->all(FLERR, Error::NOLASTLINE, "Fix ave/moments cannot set output array " + "intensive/extensive from these inputs"); + if (extarray < -1) extarray = extvalue; + else if (extvalue != extarray) + error->all(FLERR, Error::NOLASTLINE, "Fix ave/moments cannot set output array " + "intensive/extensive from these inputs"); + for (int j=0; j < (int)moments.size(); j++) + extlist[i + j] = extvalue; + i += moments.size(); + } + + // initializations + + iwindow = window_filled = 0; + iresult = 0; + + // nvalid = next step on which end_of_step does something + // add nvalid to all computes that store invocation times + // since don't know a priori which are invoked by this fix + // once in end_of_step() can set timestep for ones actually invoked + + nvalid_comp_next = -1; + nvalid = -1; + setnextvalid(); + modify->addstep_compute_all(nvalid); +} + +/* ---------------------------------------------------------------------- */ + +FixAveMoments::~FixAveMoments() +{ + values.clear(); + moments.clear(); + delete[] extlist; + + memory->destroy(window_list); + memory->destroy(result_list); +} + +/* ---------------------------------------------------------------------- */ + +int FixAveMoments::setmask() +{ + int mask = 0; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixAveMoments::init() +{ + // update indices/pointers for all computes,fixes,variables + + for (auto &val : values) { + switch (val.which) { + case ArgInfo::COMPUTE: + val.val.c = modify->get_compute_by_id(val.id); + if (!val.val.c) + error->all(FLERR, Error::NOLASTLINE, "Compute ID {} for fix ave/moments does not exist", + val.id); + break; + + case ArgInfo::FIX: + val.val.f = modify->get_fix_by_id(val.id); + if (!val.val.f) + error->all(FLERR, Error::NOLASTLINE, "Fix ID {} for fix ave/moments does not exist", val.id); + break; + + case ArgInfo::VARIABLE: + val.val.v = input->variable->find(val.id.c_str()); + if (val.val.v < 0) + error->all(FLERR, Error::NOLASTLINE, "Variable name {} for fix ave/moments does not exist", + val.id); + break; + } + } + + // need to reset nvalid if nvalid < ntimestep b/c minimize was performed + + if (nvalid < update->ntimestep) { + setnextvalid(); + modify->addstep_compute_all(nvalid); + } +} + +/* ---------------------------------------------------------------------- + only does something if nvalid = current timestep +------------------------------------------------------------------------- */ + +void FixAveMoments::setup(int /*vflag*/) +{ + end_of_step(); +} + +/* ---------------------------------------------------------------------- */ + +void FixAveMoments::end_of_step() +{ + // skip if not step which requires doing something + + bigint ntimestep = update->ntimestep; + if (ntimestep != nvalid) return; + + // always take new values + append_values(); + + // if window boundary reached, do a compute, otherwise just schedule next take + if (ntimestep == nvalid_comp_next) { + update_results(); + setnextvalid(); + } else { + nvalid += nevery; + } + + modify->addstep_compute(nvalid); +} + +/* ---------------------------------------------------------------------- + return scalar value +------------------------------------------------------------------------- */ + +double FixAveMoments::compute_scalar() +{ + return 0.0; +} + +/* ---------------------------------------------------------------------- + return Ith vector value +------------------------------------------------------------------------- */ + +double FixAveMoments::compute_vector(int i) +{ + return compute_array(i, 0); +} + +/* ---------------------------------------------------------------------- + return I,J array value +------------------------------------------------------------------------- */ + +double FixAveMoments::compute_array(int i, int j) +{ + if (i >= size_vector) return 0.0; + if (j >= nhistory) return 0.0; + // locate the j'th previous result in the ring buffer, relative to the + // row before iresult (the current insert cursor) + int row = (iresult - 1 - j + nhistory) % nhistory; + return result_list[row][i]; +} + +/* ---------------------------------------------------------------------- + parse moment names +------------------------------------------------------------------------- */ + +int FixAveMoments::consume_moments(int iarg, int narg, char **arg) +{ + moments.clear(); + + while (iarg < narg) { + if (strcmp(arg[iarg],"mean") == 0) + moments.push_back(MEAN); + else if (strcmp(arg[iarg],"stddev") == 0) + moments.push_back(STDDEV); + else if (strcmp(arg[iarg],"variance") == 0) + moments.push_back(VARIANCE); + else if (strcmp(arg[iarg],"skew") == 0) + moments.push_back(SKEW); + else if (strcmp(arg[iarg],"kurtosis") == 0) + moments.push_back(KURTOSIS); + else + break; + iarg++; + } + return iarg; +} + +/* ---------------------------------------------------------------------- + parse optional args +------------------------------------------------------------------------- */ + +void FixAveMoments::options(int iarg, int narg, char **arg) +{ + // option defaults + + nhistory = 1; + startstep = 0; + + // optional args + + while (iarg < narg) { + if (strcmp(arg[iarg],"history") == 0) { + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/moments history", error); + nhistory = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (nhistory <= 0) + error->all(FLERR, iarg+2, "Illegal ave/moments history argument {}; must be > 0", + nhistory); + iarg += 2; + } else if (strcmp(arg[iarg],"start") == 0) { + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix ave/moments start", error); + startstep = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + iarg += 2; + } else error->all(FLERR,"Unknown fix ave/moments keyword {}", arg[iarg]); + } +} + +/* ---------------------------------------------------------------------- + return next timestep no earlier than `after`, rounded to next + multiple of freq +------------------------------------------------------------------------- */ + +bigint next_after(const bigint ts, const bigint after, const int freq) +{ + if (ts >= after) return ts; + return ts + ((after - ts) / freq + 1) * freq; +} + +/* ---------------------------------------------------------------------- + calculate nvalid = next step on which end_of_step does something + this is either a step to take data + or a step to take and compute the values (nfreq multiple) + startstep is lower bound on nfreq multiple +------------------------------------------------------------------------- */ + +void FixAveMoments::setnextvalid() +{ + bigint ntimestep = update->ntimestep; + + if (nvalid_comp_next > ntimestep) { + // next window end boundary is still in the future, just increment + nvalid = ntimestep + nevery; + return; + } + + // get next window end first + bigint next_comp = (ntimestep/nfreq)*nfreq + nfreq; + nvalid_comp_next = next_after(next_comp, startstep, nfreq); + + // from there, calculate the first time we have to take a value + bigint ntake = nvalid_comp_next - static_cast(nrepeat-1)*nevery; + nvalid = next_after(ntake, ntimestep, nevery); +} + +/* ---------------------------------------------------------------------- */ + +void FixAveMoments::get_values(std::vector& scalars) +{ + // accumulate results of computes,fixes,variables to local copy + int i = 0; + double scalar = 0.0; + for (auto &val : values) { + switch (val.which) { + case ArgInfo::COMPUTE: + // invoke compute if not previously invoked + // ensure no out-of-range access to variable-length compute vector + if (val.argindex == 0) { + if (!(val.val.c->invoked_flag & Compute::INVOKED_SCALAR)) { + val.val.c->compute_scalar(); + val.val.c->invoked_flag |= Compute::INVOKED_SCALAR; + } + scalar = val.val.c->scalar; + } else { + if (!(val.val.c->invoked_flag & Compute::INVOKED_VECTOR)) { + val.val.c->compute_vector(); + val.val.c->invoked_flag |= Compute::INVOKED_VECTOR; + } + if (val.varlen && (val.val.c->size_vector < val.argindex)) scalar = 0.0; + else scalar = val.val.c->vector[val.argindex-1]; + } + break; + + case ArgInfo::FIX: + // access fix fields, guaranteed to be ready + if (val.argindex == 0) + scalar = val.val.f->compute_scalar(); + else + scalar = val.val.f->compute_vector(val.argindex-1); + break; + + case ArgInfo::VARIABLE: + // evaluate equal-style or vector-style variable + // if index exceeds vector length, use a zero value + // this can be useful if vector length is not known a priori + if (val.argindex == 0) + scalar = input->variable->compute_equal(val.val.v); + else { + double *varvec; + int nvec = input->variable->compute_vector(val.val.v,&varvec); + if (val.argindex > nvec) scalar = 0.0; + else scalar = varvec[val.argindex-1]; + } + break; + } + + scalars[i] = scalar; + ++i; + } +} + +/* ---------------------------------------------------------------------- */ + +void FixAveMoments::append_values() +{ + // accumulate results of computes,fixes,variables to local copy + // compute/fix/variable may invoke computes so wrap with clear/add + + modify->clearstep_compute(); + + std::vector scalars(nvalues); + get_values(scalars); + + // transpose for faster access later + for (int i=0; i= nrepeat) { + window_filled = 1; + iwindow = 0; + } +} + +void FixAveMoments::update_results() +{ + const int count = window_filled ? nrepeat : iwindow; + // Delay until we can safely do all moments. Avoids branching in the hot loop. + if (count<3) return; + + double *result = result_list[iresult]; + + // zero out previous values + + for (int i = 0; i < size_vector; i++) + result[i] = 0.0; + + const double inv_n = 1.0 / count; + const double fk2 = (double)count / (count - 1); + const double fk3 = square((double)count) / ((count - 1) * (count - 2)); + const double np1_nm3 = (count+1.0)/(count-3.0); + const double _3_nm1_nm3 = 3.0 * (count-1.0)/(count-3.0); + + // Each value is a series that can be processed individually + for (int i = 0; i < nvalues; i++) { + const double* series = window_list[i]; + + // first pass: mean + double mean = 0.0; + for (int j = 0; j= nhistory) + iresult = 0; +} diff --git a/src/EXTRA-FIX/fix_ave_moments.h b/src/EXTRA-FIX/fix_ave_moments.h new file mode 100644 index 0000000000..30b3565ac8 --- /dev/null +++ b/src/EXTRA-FIX/fix_ave_moments.h @@ -0,0 +1,78 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(ave/moments,FixAveMoments); +// clang-format on +#else + +#ifndef LMP_FIX_AVE_MOMENTS_H +#define LMP_FIX_AVE_MOMENTS_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixAveMoments : public Fix { + public: + FixAveMoments(class LAMMPS *, int, char **); + ~FixAveMoments() override; + int setmask() override; + void init() override; + void setup(int) override; + void end_of_step() override; + double compute_scalar() override; + double compute_vector(int) override; + double compute_array(int, int) override; + + private: + struct value_t { + int which; // type of data: COMPUTE, FIX, VARIABLE + int argindex; // 1-based index if data is vector, else 0 + int iarg; // argument index in original argument list + int varlen; // 1 if value is from variable-length compute + std::string id; // compute/fix/variable ID + std::string keyword; // column keyword in output + union { + class Compute *c; + class Fix *f; + int v; + } val; + }; + std::vector values; + std::vector moments; + + int nrepeat, nfreq; + int nvalues; + bigint nvalid, nvalid_comp_next; + + int startstep; + + int nhistory, iresult; + double **result_list; + + int iwindow, window_filled; + double **window_list; + + int consume_moments(int iarg, int narg, char **arg); + void options(int, int, char **); + void setnextvalid(); + + void get_values(std::vector& scalars); + void append_values(); + void update_results(); +}; +} // namespace LAMMPS_NS +#endif +#endif diff --git a/src/EXTRA-FIX/fix_drag.cpp b/src/EXTRA-FIX/fix_drag.cpp index 45143fb665..d45342e07b 100644 --- a/src/EXTRA-FIX/fix_drag.cpp +++ b/src/EXTRA-FIX/fix_drag.cpp @@ -114,7 +114,7 @@ void FixDrag::post_force(int /*vflag*/) if (!xflag) dx = 0.0; if (!yflag) dy = 0.0; if (!zflag) dz = 0.0; - domain->minimum_image(dx,dy,dz); + domain->minimum_image(FLERR, dx,dy,dz); r = sqrt(dx*dx + dy*dy + dz*dz); if (r > delta) { prefactor = f_mag/r; diff --git a/src/EXTRA-FIX/fix_filter_corotate.cpp b/src/EXTRA-FIX/fix_filter_corotate.cpp index 872ebd1772..24376448a3 100644 --- a/src/EXTRA-FIX/fix_filter_corotate.cpp +++ b/src/EXTRA-FIX/fix_filter_corotate.cpp @@ -547,17 +547,17 @@ void FixFilterCorotate::pre_neighbor() del1[0] = x[atom1][0]-x[oxy][0]; del1[1] = x[atom1][1]-x[oxy][1]; del1[2] = x[atom1][2]-x[oxy][2]; - domain->minimum_image(del1); + domain->minimum_image(FLERR, del1); del2[0] = x[atom2][0]-x[atom1][0]; del2[1] = x[atom2][1]-x[atom1][1]; del2[2] = x[atom2][2]-x[atom1][2]; - domain->minimum_image(del2); + domain->minimum_image(FLERR, del2); del3[0] = x[atom3][0]-x[atom1][0]; del3[1] = x[atom3][1]-x[atom1][1]; del3[2] = x[atom3][2]-x[atom1][2]; - domain->minimum_image(del3); + domain->minimum_image(FLERR, del3); double a = (del2[1])*(del3[2]) - (del2[2])*(del3[1]); double b = (del2[2])*(del3[0]) - (del2[0])*(del3[2]); @@ -620,17 +620,17 @@ void FixFilterCorotate::pre_neighbor() del1[0] = x[atom1][0]-x[oxy][0]; del1[1] = x[atom1][1]-x[oxy][1]; del1[2] = x[atom1][2]-x[oxy][2]; - domain->minimum_image(del1); + domain->minimum_image(FLERR, del1); del2[0] = x[atom2][0]-x[atom1][0]; del2[1] = x[atom2][1]-x[atom1][1]; del2[2] = x[atom2][2]-x[atom1][2]; - domain->minimum_image(del2); + domain->minimum_image(FLERR, del2); del3[0] = x[atom3][0]-x[atom1][0]; del3[1] = x[atom3][1]-x[atom1][1]; del3[2] = x[atom3][2]-x[atom1][2]; - domain->minimum_image(del3); + domain->minimum_image(FLERR, del3); double a = (del2[1])*(del3[2]) - (del2[2])*(del3[1]); double b = (del2[2])*(del3[0]) - (del2[0])*(del3[2]); @@ -1414,7 +1414,7 @@ void FixFilterCorotate::general_cluster(int index, int index_in_list) del[i][0] = x[list_cluster[i]][0] - x[list_cluster[0]][0]; del[i][1] = x[list_cluster[i]][1] - x[list_cluster[0]][1]; del[i][2] = x[list_cluster[i]][2] - x[list_cluster[0]][2]; - domain->minimum_image(del[i]); + domain->minimum_image(FLERR, del[i]); r[i] = 1.0/sqrt(del[i][0]*del[i][0]+del[i][1]*del[i][1]+ del[i][2]*del[i][2]); } diff --git a/src/EXTRA-FIX/fix_pafi.cpp b/src/EXTRA-FIX/fix_pafi.cpp index 05ee6b90da..fb39e2e48d 100644 --- a/src/EXTRA-FIX/fix_pafi.cpp +++ b/src/EXTRA-FIX/fix_pafi.cpp @@ -261,7 +261,7 @@ void FixPAFI::post_force(int /*vflag*/) deviation[0] = x[i][0]-path[i][0]; // x-path deviation[1] = x[i][1]-path[i][1]; // x-path deviation[2] = x[i][2]-path[i][2]; // x-path - domain->minimum_image(deviation); + domain->minimum_image(FLERR, deviation); proj[3] += path[i][6]*deviation[0]; // (x-path).dn/nn = psi proj[3] += path[i][7]*deviation[1]; // (x-path).dn/nn = psi @@ -424,7 +424,7 @@ void FixPAFI::min_post_force(int /*vflag*/) deviation[0] = x[i][0]-path[i][0]; // x-path deviation[1] = x[i][1]-path[i][1]; // x-path deviation[2] = x[i][2]-path[i][2]; // x-path - domain->minimum_image(deviation); + domain->minimum_image(FLERR, deviation); proj[3] += path[i][6]*deviation[0]; // (x-path).dn/nn = psi proj[3] += path[i][7]*deviation[1]; // (x-path).dn/nn = psi diff --git a/src/EXTRA-MOLECULE/angle_cosine_delta.cpp b/src/EXTRA-MOLECULE/angle_cosine_delta.cpp index 56dd6da88d..43092876dc 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_delta.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_delta.cpp @@ -155,13 +155,13 @@ double AngleCosineDelta::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; @@ -185,13 +185,13 @@ void AngleCosineDelta::born_matrix(int type, int i1, int i2, int i3, double &du, 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp b/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp index e0e7f31f39..c0ae868576 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_periodic.cpp @@ -284,13 +284,13 @@ double AngleCosinePeriodic::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; @@ -311,13 +311,13 @@ void AngleCosinePeriodic::born_matrix(int type, int i1, int i2, int i3, double & 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/angle_cosine_shift.cpp b/src/EXTRA-MOLECULE/angle_cosine_shift.cpp index 14640a5e12..9ac6fb9ba3 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_shift.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_shift.cpp @@ -258,13 +258,13 @@ double AngleCosineShift::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp b/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp index 185adea37d..34768652d9 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_shift_exp.cpp @@ -297,13 +297,13 @@ double AngleCosineShiftExp::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp b/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp index 37003b5b05..6c8a27d13d 100644 --- a/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp +++ b/src/EXTRA-MOLECULE/angle_cosine_squared_restricted.cpp @@ -242,13 +242,13 @@ double AngleCosineSquaredRestricted::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; @@ -272,13 +272,13 @@ void AngleCosineSquaredRestricted::born_matrix(int type, int i1, int i2, int i3, 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/EXTRA-MOLECULE/angle_fourier.cpp b/src/EXTRA-MOLECULE/angle_fourier.cpp index f6cd9f4c80..ca643bd57b 100644 --- a/src/EXTRA-MOLECULE/angle_fourier.cpp +++ b/src/EXTRA-MOLECULE/angle_fourier.cpp @@ -263,13 +263,13 @@ double AngleFourier::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; @@ -291,13 +291,13 @@ void AngleFourier::born_matrix(int type, int i1, int i2, int i3, double &du, dou 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/angle_fourier_simple.cpp b/src/EXTRA-MOLECULE/angle_fourier_simple.cpp index e3497b5e81..0dc6cbad04 100644 --- a/src/EXTRA-MOLECULE/angle_fourier_simple.cpp +++ b/src/EXTRA-MOLECULE/angle_fourier_simple.cpp @@ -269,13 +269,13 @@ double AngleFourierSimple::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; @@ -297,13 +297,13 @@ void AngleFourierSimple::born_matrix(int type, int i1, int i2, int i3, double &d 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/angle_gaussian.cpp b/src/EXTRA-MOLECULE/angle_gaussian.cpp index 1272ada0bb..17a3cb3b29 100644 --- a/src/EXTRA-MOLECULE/angle_gaussian.cpp +++ b/src/EXTRA-MOLECULE/angle_gaussian.cpp @@ -325,13 +325,13 @@ double AngleGaussian::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/EXTRA-MOLECULE/angle_mwlc.cpp b/src/EXTRA-MOLECULE/angle_mwlc.cpp index 804627cfa3..0853708e24 100644 --- a/src/EXTRA-MOLECULE/angle_mwlc.cpp +++ b/src/EXTRA-MOLECULE/angle_mwlc.cpp @@ -260,13 +260,13 @@ double AngleMWLC::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; @@ -289,12 +289,12 @@ void AngleMWLC::born_matrix(int type, int i1, int i2, int i3, double &du, double 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); + domain->minimum_image(FLERR, delx1, dely1, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; c /= sqrt((delx1 * delx1 + dely1 * dely1 + delz1 * delz1) * diff --git a/src/EXTRA-MOLECULE/angle_quartic.cpp b/src/EXTRA-MOLECULE/angle_quartic.cpp index 92e84e79a5..87e3d6a662 100644 --- a/src/EXTRA-MOLECULE/angle_quartic.cpp +++ b/src/EXTRA-MOLECULE/angle_quartic.cpp @@ -269,13 +269,13 @@ double AngleQuartic::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; @@ -299,13 +299,13 @@ void AngleQuartic::born_matrix(int type, int i1, int i2, int i3, double &du, dou 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/EXTRA-MOLECULE/bond_harmonic_restrain.cpp b/src/EXTRA-MOLECULE/bond_harmonic_restrain.cpp index 2a9a1e4e7f..0fc9f5d981 100644 --- a/src/EXTRA-MOLECULE/bond_harmonic_restrain.cpp +++ b/src/EXTRA-MOLECULE/bond_harmonic_restrain.cpp @@ -74,7 +74,7 @@ void BondHarmonicRestrain::compute(int eflag, int vflag) delx = x0[i1][0] - x0[i2][0]; dely = x0[i1][1] - x0[i2][1]; delz = x0[i1][2] - x0[i2][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); rsq = delx * delx + dely * dely + delz * delz; r0 = sqrt(rsq); @@ -235,7 +235,7 @@ double BondHarmonicRestrain::single(int type, double rsq, int i, int j, double & double delx = x0[i][0] - x0[j][0]; double dely = x0[i][1] - x0[j][1]; double delz = x0[i][2] - x0[j][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); double r0 = sqrt(delx * delx + dely * dely + delz * delz); double r = sqrt(rsq); diff --git a/src/EXTRA-MOLECULE/dihedral_spherical.cpp b/src/EXTRA-MOLECULE/dihedral_spherical.cpp index 15e403ef03..0d66a6bbf0 100644 --- a/src/EXTRA-MOLECULE/dihedral_spherical.cpp +++ b/src/EXTRA-MOLECULE/dihedral_spherical.cpp @@ -110,9 +110,9 @@ static double Phi(double const *x1, //array holding x,y,z coords atom 1 } //Consider periodic boundary conditions: - domain->minimum_image(vb12[0], vb12[1], vb12[2]); - domain->minimum_image(vb23[0], vb23[1], vb23[2]); - domain->minimum_image(vb34[0], vb34[1], vb34[2]); + domain->minimum_image(FLERR, vb12[0], vb12[1], vb12[2]); + domain->minimum_image(FLERR, vb23[0], vb23[1], vb23[2]); + domain->minimum_image(FLERR, vb34[0], vb34[1], vb34[2]); //--- Compute the normal to the planes formed by atoms 1,2,3 and 2,3,4 --- diff --git a/src/EXTRA-MOLECULE/improper_distance.cpp b/src/EXTRA-MOLECULE/improper_distance.cpp index ec55abaf2b..de9a8f9a7b 100644 --- a/src/EXTRA-MOLECULE/improper_distance.cpp +++ b/src/EXTRA-MOLECULE/improper_distance.cpp @@ -94,31 +94,31 @@ void ImproperDistance::compute(int eflag, int vflag) xab = x[i2][0] - x[i1][0]; yab = x[i2][1] - x[i1][1]; zab = x[i2][2] - x[i1][2]; - domain->minimum_image(xab,yab,zab); + domain->minimum_image(FLERR, xab,yab,zab); // bond 1->3 xac = x[i3][0] - x[i1][0]; yac = x[i3][1] - x[i1][1]; zac = x[i3][2] - x[i1][2]; - domain->minimum_image(xac,yac,zac); + domain->minimum_image(FLERR, xac,yac,zac); // bond 1->4 xad = x[i4][0] - x[i1][0]; yad = x[i4][1] - x[i1][1]; zad = x[i4][2] - x[i1][2]; - domain->minimum_image(xad,yad,zad); + domain->minimum_image(FLERR, xad,yad,zad); // bond 2-3 xbc = x[i3][0] - x[i2][0]; ybc = x[i3][1] - x[i2][1]; zbc = x[i3][2] - x[i2][2]; - domain->minimum_image(xbc,ybc,zbc); + domain->minimum_image(FLERR, xbc,ybc,zbc); // bond 2-4 xbd = x[i4][0] - x[i2][0]; ybd = x[i4][1] - x[i2][1]; zbd = x[i4][2] - x[i2][2]; - domain->minimum_image(xbd,ybd,zbd); + domain->minimum_image(FLERR, xbd,ybd,zbd); xna = ybc*zbd - zbc*ybd; yna = -(xbc*zbd - zbc*xbd); diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 65cc356739..2d4090ea53 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -540,7 +540,7 @@ 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); + domain->minimum_image(FLERR, delx, dely, delz); rsq = delx * delx + dely * dely + delz * delz; radsum = coords[m][3] + xnear[i][3]; if (rsq <= radsum * radsum) break; @@ -781,7 +781,7 @@ int FixPour::overlap(int i) double delx = x[0] - xc; double dely = x[1] - yc; double delz = 0.0; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); double rsq = delx * delx + dely * dely; double r = rc + delta; if (rsq > r * r) return 0; diff --git a/src/KOKKOS/fix_minimize_kokkos.cpp b/src/KOKKOS/fix_minimize_kokkos.cpp index 585c357992..f1bd218bfa 100644 --- a/src/KOKKOS/fix_minimize_kokkos.cpp +++ b/src/KOKKOS/fix_minimize_kokkos.cpp @@ -121,7 +121,7 @@ void FixMinimizeKokkos::reset_coords() double dx = dx0; double dy = dy0; double dz = dz0; - // domain->minimum_image(dx,dy,dz); + // domain->minimum_image(FLERR, dx,dy,dz); { if (triclinic == 0) { if (xperiodic) { @@ -175,7 +175,7 @@ void FixMinimizeKokkos::reset_coords() } } } - } // end domain->minimum_image(dx,dy,dz); + } // end domain->minimum_image(FLERR, dx,dy,dz); if (dx != dx0) l_x0[n] = l_x(i,0) - dx; if (dy != dy0) l_x0[n+1] = l_x(i,1) - dy; if (dz != dz0) l_x0[n+2] = l_x(i,2) - dz; diff --git a/src/KOKKOS/mliap_model_python_kokkos.h b/src/KOKKOS/mliap_model_python_kokkos.h index 4f56ecb0ab..76b4a9d42a 100644 --- a/src/KOKKOS/mliap_model_python_kokkos.h +++ b/src/KOKKOS/mliap_model_python_kokkos.h @@ -29,7 +29,7 @@ class MLIAPModelPythonKokkos : public MLIAPModelPython, public MLIAPModelKokkos< public: MLIAPModelPythonKokkos(LAMMPS *, char * = nullptr); ~MLIAPModelPythonKokkos(); - void read_coeffs(char *fname); + void read_coeffs(char *fname) override; void compute_gradients(class MLIAPData *) override; void compute_gradgrads(class MLIAPData *) override; diff --git a/src/KOKKOS/pair_pace_extrapolation_kokkos.cpp b/src/KOKKOS/pair_pace_extrapolation_kokkos.cpp index 746055f28c..4595843477 100644 --- a/src/KOKKOS/pair_pace_extrapolation_kokkos.cpp +++ b/src/KOKKOS/pair_pace_extrapolation_kokkos.cpp @@ -37,15 +37,9 @@ #include +// prototype repeated from base class implementation namespace LAMMPS_NS { struct ACEALImpl { - ACEALImpl() : basis_set(nullptr), ace(nullptr) {} - - ~ACEALImpl() { - delete basis_set; - delete ace; - } - ACEBBasisSet *basis_set; ACEBEvaluator *ace; }; diff --git a/src/KOKKOS/pair_pace_kokkos.cpp b/src/KOKKOS/pair_pace_kokkos.cpp index 0afbb7540e..577f77ba8b 100644 --- a/src/KOKKOS/pair_pace_kokkos.cpp +++ b/src/KOKKOS/pair_pace_kokkos.cpp @@ -38,14 +38,9 @@ #include +// prototype repeated from base class implementation namespace LAMMPS_NS { struct ACEImpl { - ACEImpl() : basis_set(nullptr), ace(nullptr) {} - ~ACEImpl() - { - delete basis_set; - delete ace; - } ACECTildeBasisSet *basis_set; ACERecursiveEvaluator *ace; }; diff --git a/src/LEPTON/angle_lepton.cpp b/src/LEPTON/angle_lepton.cpp index 4907086ab1..08d1ea9a83 100644 --- a/src/LEPTON/angle_lepton.cpp +++ b/src/LEPTON/angle_lepton.cpp @@ -395,13 +395,13 @@ double AngleLepton::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/LEPTON/dihedral_lepton.cpp b/src/LEPTON/dihedral_lepton.cpp index 2cee9fba8a..912896254b 100644 --- a/src/LEPTON/dihedral_lepton.cpp +++ b/src/LEPTON/dihedral_lepton.cpp @@ -508,9 +508,9 @@ double DihedralLepton::get_phi(double const *x1, //array holding x,y,z coords } //Consider periodic boundary conditions: - domain->minimum_image(vb12[0], vb12[1], vb12[2]); - domain->minimum_image(vb23[0], vb23[1], vb23[2]); - domain->minimum_image(vb34[0], vb34[1], vb34[2]); + domain->minimum_image(FLERR, vb12[0], vb12[1], vb12[2]); + domain->minimum_image(FLERR, vb23[0], vb23[1], vb23[2]); + domain->minimum_image(FLERR, vb34[0], vb34[1], vb34[2]); //--- Compute the normal to the planes formed by atoms 1,2,3 and 2,3,4 --- diff --git a/src/MACHDYN/pair_smd_hertz.cpp b/src/MACHDYN/pair_smd_hertz.cpp index fcdaae76bd..0c2444618f 100644 --- a/src/MACHDYN/pair_smd_hertz.cpp +++ b/src/MACHDYN/pair_smd_hertz.cpp @@ -145,7 +145,7 @@ void PairHertz::compute(int eflag, int vflag) { dely0 = x0[j][1] - x0[i][1]; delz0 = x0[j][2] - x0[i][2]; if (periodic) { - domain->minimum_image(delx0, dely0, delz0); + domain->minimum_image(FLERR, delx0, dely0, delz0); } rSq0 = delx0 * delx0 + dely0 * dely0 + delz0 * delz0; // initial distance sphCut = sph_radius[i] + sph_radius[j]; diff --git a/src/MACHDYN/pair_smd_tlsph.cpp b/src/MACHDYN/pair_smd_tlsph.cpp index 72ea1b4d5f..4c2f56eb48 100644 --- a/src/MACHDYN/pair_smd_tlsph.cpp +++ b/src/MACHDYN/pair_smd_tlsph.cpp @@ -220,7 +220,7 @@ void PairTlsph::PreCompute() { dx = xj - xi; if (periodic) - domain->minimum_image(dx0(0), dx0(1), dx0(2)); + domain->minimum_image(FLERR, dx0(0), dx0(1), dx0(2)); r0Sq = dx0.squaredNorm(); h = irad + radius[j]; @@ -488,7 +488,7 @@ void PairTlsph::ComputeForces(int eflag, int vflag) { } if (periodic) - domain->minimum_image(dx0(0), dx0(1), dx0(2)); + domain->minimum_image(FLERR, dx0(0), dx0(1), dx0(2)); // check that distance between i and j (in the reference config) is less than cutoff dx0 = x0j - x0i; diff --git a/src/MACHDYN/pair_smd_triangulated_surface.cpp b/src/MACHDYN/pair_smd_triangulated_surface.cpp index c50b7700f6..cded66e644 100644 --- a/src/MACHDYN/pair_smd_triangulated_surface.cpp +++ b/src/MACHDYN/pair_smd_triangulated_surface.cpp @@ -154,7 +154,7 @@ void PairTriSurf::compute(int eflag, int vflag) { x4(2) = x[particle][2]; dx = x_center - x4; // if (periodic) { - domain->minimum_image(dx(0), dx(1), dx(2)); + domain->minimum_image(FLERR, dx(0), dx(1), dx(2)); } rsq = dx.squaredNorm(); diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index ff90b81695..1e0b20a2d7 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -723,7 +723,7 @@ double FixBondSwap::dist_rsq(int i, int j) double delx = x[i][0] - x[j][0]; double dely = x[i][1] - x[j][1]; double delz = x[i][2] - x[j][2]; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); return (delx*delx + dely*dely + delz*delz); } diff --git a/src/MC/fix_neighbor_swap.cpp b/src/MC/fix_neighbor_swap.cpp index d44181a981..0fedfc460e 100644 --- a/src/MC/fix_neighbor_swap.cpp +++ b/src/MC/fix_neighbor_swap.cpp @@ -20,6 +20,7 @@ #include "angle.h" #include "atom.h" #include "bond.h" +#include "citeme.h" #include "comm.h" #include "compute.h" #include "compute_voronoi_atom.h" @@ -31,6 +32,7 @@ #include "group.h" #include "improper.h" #include "kspace.h" +#include "math_extra.h" #include "math_special.h" #include "memory.h" #include "modify.h" @@ -40,15 +42,17 @@ #include "region.h" #include "update.h" -#include #include #include #include +#include using namespace LAMMPS_NS; using namespace FixConst; +using MathExtra::distsq3; +using MathSpecial::square; -static const char cite_fix_neighbor_swap_c[] = +static const char cite_fix_neighbor_swap[] = "fix neighbor/swap command: doi:10.1016/j.commatsci.2022.111929\n\n" "@Article{Tavenner2023111929,\n" " author = {Jacob P. Tavenner and Mikhail I. Mendelev and John W. Lawson},\n" @@ -58,15 +62,17 @@ static const char cite_fix_neighbor_swap_c[] = " year = {2023},\n" " volume = {218},\n" " pages = {111929}\n" - " url = {https://www.sciencedirect.com/science/article/pii/S0927025622006401}\n" + " url = {https://dx.doi.org/10.1016/j.commatsci.2022.111929}\n" "}\n\n"; /* ---------------------------------------------------------------------- */ FixNeighborSwap::FixNeighborSwap(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), region(nullptr), idregion(nullptr), type_list(nullptr), qtype(nullptr), - c_voro(nullptr), voro_neighbor_list(nullptr), sqrt_mass_ratio(nullptr), - local_swap_iatom_list(nullptr), random_equal(nullptr), c_pe(nullptr) + Fix(lmp, narg, arg), region(nullptr), idregion(nullptr), type_list(nullptr), rate_list(nullptr), + qtype(nullptr), sqrt_mass_ratio(nullptr), voro_neighbor_list(nullptr), + local_swap_iatom_list(nullptr), local_swap_neighbor_list(nullptr), + local_swap_type_list(nullptr), local_swap_probability(nullptr), random_equal(nullptr), + id_voro(nullptr), c_voro(nullptr), c_pe(nullptr) { if (narg < 10) utils::missing_cmd_args(FLERR, "fix neighbor/swap", error); @@ -79,37 +85,49 @@ FixNeighborSwap::FixNeighborSwap(LAMMPS *lmp, int narg, char **arg) : restart_global = 1; time_depend = 1; + ke_flag = 1; + diff_flag = 0; + rates_flag = 0; + nswaptypes = 0; + + if (lmp->citeme) lmp->citeme->add(cite_fix_neighbor_swap); + // 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); - r_0 = utils::inumeric(FLERR, arg[7], false, lmp); + double r_0 = utils::inumeric(FLERR, arg[7], false, lmp); + + if (nevery <= 0) + error->all(FLERR, 3, "Illegal fix neighbor/swap command nevery value: {}", nevery); + if (ncycles < 0) + error->all(FLERR, 4, "Illegal fix neighbor/swap command ncycles value: {}", ncycles); + if (seed <= 0) error->all(FLERR, 5, "Illegal fix neighbor/swap command seed value: {}", seed); + if (temperature <= 0.0) + error->all(FLERR, 6, "Illegal fix neighbor/swap command temperature value: {}", temperature); + if (r_0 <= 0.0) error->all(FLERR, 7, "Illegal fix neighbor/swap command R0 value: {}", r_0); // Voro compute check - int icompute = modify->find_compute(utils::strdup(arg[8])); - if (icompute < 0) error->all(FLERR, "Could not find neighbor compute ID"); - c_voro = modify->compute[icompute]; + id_voro = utils::strdup(arg[8]); + c_voro = modify->get_compute_by_id(id_voro); + if (!c_voro) error->all(FLERR, 8, "Could not find compute voronoi ID {}", id_voro); if (c_voro->local_flag == 0) - error->all(FLERR, "Neighbor compute does not compute local info"); + error->all(FLERR, 8, "Voronoi compute {} does not compute local info", id_voro); if (c_voro->size_local_cols != 3) - error->all(FLERR, "Neighbor compute does not give i, j, size as expected"); - - if (nevery <= 0) error->all(FLERR, "Illegal fix neighbor/swap command nevery value"); - if (ncycles < 0) error->all(FLERR, "Illegal fix neighbor/swap command ncycles value"); - if (seed <= 0) error->all(FLERR, "Illegal fix neighbor/swap command seed value"); - if (temperature <= 0.0) error->all(FLERR, "Illegal fix neighbor/swap command temperature value"); + error->all(FLERR, 8, "Voronoi compute {} does not compute i, j, sizes as expected", id_voro); beta = 1.0 / (force->boltz * temperature); + inv_r_0 = 1.0 / r_0; memory->create(type_list, atom->ntypes, "neighbor/swap:type_list"); memory->create(rate_list, atom->ntypes, "neighbor/swap:rate_list"); // read options from end of input line - options(narg - 8, &arg[8]); + options(narg - 9, &arg[9]); // random number generator, same for all procs @@ -126,11 +144,6 @@ FixNeighborSwap::FixNeighborSwap(LAMMPS *lmp, int narg, char **arg) : nswap_successes = 0.0; atom_swap_nmax = 0; - voro_neighbor_list = nullptr; - local_swap_iatom_list = nullptr; - local_swap_neighbor_list = nullptr; - local_swap_probability = nullptr; - local_swap_type_list = nullptr; // set comm size needed by this Fix @@ -153,6 +166,7 @@ FixNeighborSwap::~FixNeighborSwap() memory->destroy(local_swap_probability); memory->destroy(local_swap_type_list); delete[] idregion; + delete[] id_voro; delete random_equal; } @@ -160,62 +174,85 @@ FixNeighborSwap::~FixNeighborSwap() parse optional parameters at end of input line ------------------------------------------------------------------------- */ +static const std::unordered_set known_keywords = {"region", "ke", "types", "diff", + "rates"}; +static bool is_keyword(const std::string &arg) +{ + return known_keywords.find(arg) != known_keywords.end(); +} + void FixNeighborSwap::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR, "Illegal fix neighbor/swap command\n"); - - ke_flag = 1; - diff_flag = 0; - rates_flag = 0; - nswaptypes = 0; + if (narg < 0) utils::missing_cmd_args(FLERR, "fix neighbor/swap", error); + int ioffset = 9; // first 9 arguments are fixed and handled in constructor int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg], "region") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix neighbor/swap command"); - region = domain->get_region_by_id(arg[iarg + 1]); - if (!region) error->all(FLERR, "Region ID for fix neighbor/swap does not exist"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix neighbor/swap region", error); + delete[] idregion; idregion = utils::strdup(arg[iarg + 1]); + region = domain->get_region_by_id(idregion); + if (!region) + error->all(FLERR, iarg + 1 + ioffset, "Region ID {} for fix neighbor/swap does not exist", + idregion); iarg += 2; } else if (strcmp(arg[iarg], "ke") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix neighbor/swap command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix neighbor/swap ke", error); ke_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 neighbor/swap command"); - if (diff_flag != 0) error->all(FLERR, "Illegal fix neighbor/swap command"); + if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "fix neighbor/swap types", error); + if (diff_flag) + error->all(FLERR, iarg + ioffset, "Cannot use 'diff' and 'types' keywords together"); iarg++; nswaptypes = 0; while (iarg < narg) { - if (isalpha(arg[iarg][0])) break; - if (nswaptypes >= atom->ntypes) error->all(FLERR, "Illegal fix neighbor/swap command"); - type_list[nswaptypes] = utils::numeric(FLERR, arg[iarg], false, lmp); + if (is_keyword(arg[iarg])) break; + if (nswaptypes >= atom->ntypes) + error->all(FLERR, iarg + ioffset, "Too many arguments to fix neighbor/swap types"); + type_list[nswaptypes] = utils::expand_type_int(FLERR, arg[iarg], Atom::ATOM, lmp); nswaptypes++; iarg++; } } else if (strcmp(arg[iarg], "diff") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix neighbor/swap command"); - if (nswaptypes != 0) error->all(FLERR, "Illegal fix neighbor/swap command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix neighbor/swap diff", error); + if (diff_flag) error->all(FLERR, iarg + ioffset, "Cannot use 'diff' keyword multiple times"); + if (nswaptypes != 0) + error->all(FLERR, iarg + ioffset, "Cannot use 'diff' and 'types' keywords together"); type_list[nswaptypes] = utils::numeric(FLERR, arg[iarg + 1], false, lmp); diff_flag = 1; nswaptypes++; iarg += 2; } else if (strcmp(arg[iarg], "rates") == 0) { - if (iarg + atom->ntypes >= narg) error->all(FLERR, "Illegal fix neighbor/swap command"); + if (iarg + atom->ntypes >= narg) + utils::missing_cmd_args(FLERR, "fix neighbor/swap rates", error); iarg++; int i = 0; while (iarg < narg) { - if (isalpha(arg[iarg][0])) break; - if (i >= atom->ntypes) error->all(FLERR, "Illegal fix neighbor/swap command"); + if (is_keyword(arg[iarg])) break; + if (i >= atom->ntypes) error->all(FLERR, "Too many values for fix neighbor/swap rates"); rate_list[i] = utils::numeric(FLERR, arg[iarg], false, lmp); i++; iarg++; } rates_flag = 1; - if (i != atom->ntypes) error->all(FLERR, "Illegal fix neighbor/swap command"); - } else - error->all(FLERR, "Illegal fix neighbor/swap command"); + if (i != atom->ntypes) + error->all(FLERR, "Fix neighbor/swap rates keyword must have exactly {} arguments", + atom->ntypes); + } else { + error->all(FLERR, "Unknown fix neighbor/swap keyword: {}", arg[iarg]); + } } + + // checks + if (!nswaptypes && !diff_flag) + error->all(FLERR, Error::NOLASTLINE, + "Must specify at either 'types' or 'diff' keyword with fix neighbor/swap"); + + if (nswaptypes < 2 && !diff_flag) + error->all(FLERR, Error::NOLASTLINE, + "Must specify at least 2 atom types in fix neighbor/swap 'types' keyword"); } /* ---------------------------------------------------------------------- */ @@ -232,23 +269,26 @@ int FixNeighborSwap::setmask() void FixNeighborSwap::init() { c_pe = modify->get_compute_by_id("thermo_pe"); + if (!c_pe) error->all(FLERR, Error::NOLASTLINE, "Could not find 'thermo_pe' compute"); - int *type = atom->type; - - if (nswaptypes < 2 && !diff_flag) - error->all(FLERR, "Must specify at least 2 types in fix neighbor/swap command"); + c_voro = modify->get_compute_by_id(id_voro); + if (!c_voro) + error->all(FLERR, Error::NOLASTLINE, "Could not find compute voronoi ID {}", id_voro); // 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); + if (!region) + error->all(FLERR, Error::NOLASTLINE, "Region {} for fix neighbor/swap 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 neighbor/swap command"); + error->all(FLERR, Error::NOLASTLINE, "Invalid atom type in fix neighbor/swap command"); + int *type = atom->type; if (atom->q_flag) { double qmax, qmin; int firstall, first; @@ -258,23 +298,27 @@ void FixNeighborSwap::init() for (int i = 0; i < atom->nlocal; i++) { if (atom->mask[i] & groupbit) { if (type[i] == type_list[iswaptype]) { - if (first) { + if (first > 0) { 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."); + first = -1; } } } 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 (firstall < 0) + error->all(FLERR, Error::NOLASTLINE, + "All atoms of a swapped type must have the same charge"); + if (firstall > 0) + error->all(FLERR, Error::NOLASTLINE, + "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); 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."); + if (qmax != qmin) + error->all(FLERR, Error::NOLASTLINE, "All atoms of a swapped type must have same charge."); } } @@ -308,8 +352,9 @@ void FixNeighborSwap::init() int flagall; MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world); - - if (flagall) error->all(FLERR, "Cannot do neighbor/swap on atoms in atom_modify first group"); + if (flagall) + error->all(FLERR, Error::NOLASTLINE, + "Cannot use fix neighbor/swap on atoms in atom_modify first group"); } } @@ -359,9 +404,6 @@ void FixNeighborSwap::pre_exchange() int FixNeighborSwap::attempt_swap() { - // int nlocal = atom->nlocal; - tagint *id = atom->tag; - if (niswap == 0) return 0; // pre-swap energy @@ -372,9 +414,6 @@ int FixNeighborSwap::attempt_swap() int i = pick_i_swap_atom(); - // get global id and position of atom i - // get_global_i(i); - // build nearest-neighbor list based on atom i build_i_neighbor_list(i); @@ -382,7 +421,7 @@ int FixNeighborSwap::attempt_swap() // pick a neighbor atom j based on i neighbor list jtype_selected = -1; - int j = pick_j_swap_neighbor(i); + int j = pick_j_swap_neighbor(); int itype = type_list[0]; int jtype = jtype_selected; @@ -494,26 +533,23 @@ double FixNeighborSwap::energy_full() int FixNeighborSwap::pick_i_swap_atom() { tagint *id = atom->tag; - int id_center_local = -1; int i = -1; 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]; - id_center_local = id[i]; MPI_Allreduce(&id[i], &id_center, 1, MPI_INT, MPI_MAX, world); } else { - MPI_Allreduce(&id[i], &id_center, 1, MPI_INT, MPI_MAX, world); + id_center = -1; } - return i; } /* ---------------------------------------------------------------------- ------------------------------------------------------------------------- */ -int FixNeighborSwap::pick_j_swap_neighbor(int i) +int FixNeighborSwap::pick_j_swap_neighbor() { int j = -1; int jtype_selected_local = -1; @@ -535,7 +571,7 @@ int FixNeighborSwap::pick_j_swap_neighbor(int i) return j; } } - error->all(FLERR, "Did not select local neighbor swap atom"); + error->all(FLERR, Error::NOLASTLINE, "Did not select local neighbor swap atom"); } MPI_Allreduce(&jtype_selected_local, &jtype_selected, 1, MPI_INT, MPI_MAX, world); @@ -545,16 +581,6 @@ int FixNeighborSwap::pick_j_swap_neighbor(int i) /* ---------------------------------------------------------------------- ------------------------------------------------------------------------- */ -double FixNeighborSwap::get_distance(double *i, double *j) -{ - double r = sqrt(MathSpecial::square((i[0] - j[0])) + MathSpecial::square((i[1] - j[1])) + - MathSpecial::square((i[2] - j[2]))); - return r; -} - -/* ---------------------------------------------------------------------- -------------------------------------------------------------------------- */ - void FixNeighborSwap::build_i_neighbor_list(int i_center) { int nghost = atom->nghost; @@ -621,20 +647,18 @@ void FixNeighborSwap::build_i_neighbor_list(int i_center) // Get distance if own center atom double r = INFINITY; - if (i_center >= 0) { double r = get_distance(x[temp_j], x[i_center]); } // Get local id of ghost center atom when ghost for (int i = nlocal; i < nlocal + nghost; i++) { - if ((id[i] == id_center) && (get_distance(x[temp_j], x[i]) < r)) { - r = get_distance(x[temp_j], x[i]); - } + double rtmp = sqrt(distsq3(x[temp_j], x[i])); + if ((id[i] == id_center) && (rtmp < r)) r = rtmp; } if (rates_flag) { local_swap_probability[njswap_local] = - rate_list[type[temp_j] - 1] * exp(-MathSpecial::square(r / r_0)); + rate_list[type[temp_j] - 1] * exp(-square(r * inv_r_0)); } else { - local_swap_probability[njswap_local] = exp(-MathSpecial::square(r / r_0)); + local_swap_probability[njswap_local] = exp(-square(r * inv_r_0)); } local_probability += local_swap_probability[njswap_local]; local_swap_type_list[njswap_local] = type[temp_j]; @@ -646,20 +670,18 @@ void FixNeighborSwap::build_i_neighbor_list(int i_center) // Calculate distance from i to each j, adjust probability of selection // Get distance if own center atom double r = INFINITY; - if (i_center >= 0) { double r = get_distance(x[temp_j], x[i_center]); } // Get local id of ghost center atom when ghost for (int i = nlocal; i < nlocal + nghost; i++) { - if ((id[i] == id_center) && (get_distance(x[temp_j], x[i]) < r)) { - r = get_distance(x[temp_j], x[i]); - } + double rtmp = sqrt(distsq3(x[temp_j], x[i])); + if ((id[i] == id_center) && (rtmp < r)) r = rtmp; } if (rates_flag) { local_swap_probability[njswap_local] = - rate_list[type[temp_j] - 1] * exp(-MathSpecial::square(r / r_0)); + rate_list[type[temp_j] - 1] * exp(-square(r * inv_r_0)); } else { - local_swap_probability[njswap_local] = exp(-MathSpecial::square(r / r_0)); + local_swap_probability[njswap_local] = exp(-square(r * inv_r_0)); } local_probability += local_swap_probability[njswap_local]; @@ -677,19 +699,18 @@ void FixNeighborSwap::build_i_neighbor_list(int i_center) // Calculate distance from i to each j, adjust probability of selection // Get distance if own center atom double r = INFINITY; - if (i_center >= 0) { r = get_distance(x[temp_j], x[i_center]); } // Get local id of ghost center atoms for (int i = nlocal; i < nlocal + nghost; i++) { - if ((id[i] == id_center) && (get_distance(x[temp_j], x[i]) < r)) - r = get_distance(x[temp_j], x[i]); + double rtmp = sqrt(distsq3(x[temp_j], x[i])); + if ((id[i] == id_center) && (rtmp < r)) r = rtmp; } if (rates_flag) { local_swap_probability[njswap_local] = - rate_list[type[temp_j] - 1] * exp(-MathSpecial::square(r / r_0)); + rate_list[type[temp_j] - 1] * exp(-square(r * inv_r_0)); } else { - local_swap_probability[njswap_local] = exp(-MathSpecial::square(r / r_0)); + local_swap_probability[njswap_local] = exp(-square(r * inv_r_0)); } local_probability += local_swap_probability[njswap_local]; @@ -702,20 +723,18 @@ void FixNeighborSwap::build_i_neighbor_list(int i_center) // Calculate distance from i to each j, adjust probability of selection // Get distance if own center atom double r = INFINITY; - if (i_center >= 0) { double r = get_distance(x[temp_j], x[i_center]); } // Get local id of ghost center atom when ghost for (int i = nlocal; i < nlocal + nghost; i++) { - if ((id[i] == id_center) && (get_distance(x[temp_j], x[i]) < r)) { - r = get_distance(x[temp_j], x[i]); - } + double rtmp = sqrt(distsq3(x[temp_j], x[i])); + if ((id[i] == id_center) && (rtmp < r)) r = rtmp; } if (rates_flag) { local_swap_probability[njswap_local] = - rate_list[type[temp_j] - 1] * exp(-MathSpecial::square(r / r_0)); + rate_list[type[temp_j] - 1] * exp(-square(r * inv_r_0)); } else { - local_swap_probability[njswap_local] = exp(-MathSpecial::square(r / r_0)); + local_swap_probability[njswap_local] = exp(-square(r * inv_r_0)); } local_probability += local_swap_probability[njswap_local]; @@ -897,5 +916,6 @@ void FixNeighborSwap::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 neighbor/swap"); + error->all(FLERR, Error::NOLASTLINE, + "Must not reset timestep when restarting fix neighbor/swap"); } diff --git a/src/MC/fix_neighbor_swap.h b/src/MC/fix_neighbor_swap.h index 821eda1bdc..f5d208f764 100644 --- a/src/MC/fix_neighbor_swap.h +++ b/src/MC/fix_neighbor_swap.h @@ -47,7 +47,6 @@ class FixNeighborSwap : public Fix { int niswap, njswap; // # of i,j swap atoms on all procs int niswap_local, njswap_local; // # of swap atoms on this proc int niswap_before, njswap_before; // # of swap atoms on procs < this proc - // int global_i_ID; // global id of selected i atom class Region *region; // swap region char *idregion; // swap region id @@ -66,7 +65,7 @@ class FixNeighborSwap : public Fix { bool unequal_cutoffs; int atom_swap_nmax; - double beta, r_0; + double beta, inv_r_0; double local_probability; // Total swap probability stored on this proc double global_probability; // Total swap probability across all proc double prev_probability; // Swap probability on proc < this proc @@ -81,15 +80,14 @@ class FixNeighborSwap : public Fix { class RanPark *random_equal; - class Compute *c_voro; - class Compute *c_pe; + char *id_voro; + class Compute *c_voro, *c_pe; void options(int, char **); int attempt_swap(); double energy_full(); int pick_i_swap_atom(); - int pick_j_swap_neighbor(int); - double get_distance(double[3], double[3]); + int pick_j_swap_neighbor(); void build_i_neighbor_list(int); void update_iswap_atoms_list(); }; diff --git a/src/MDI/fix_mdi_qmmm.cpp b/src/MDI/fix_mdi_qmmm.cpp index dc5653bfce..d14c837cba 100644 --- a/src/MDI/fix_mdi_qmmm.cpp +++ b/src/MDI/fix_mdi_qmmm.cpp @@ -687,7 +687,7 @@ void FixMDIQMMM::pre_force(int vflag) double delx = xqm[i][0] - xqm[j][0]; double dely = xqm[i][1] - xqm[j][1]; double delz = xqm[i][2] - xqm[j][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); rsq = delx * delx + dely * dely + delz * delz; qpotential_mine[i] -= qqrd2e * qqm[j] / sqrt(rsq); } diff --git a/src/MESONT/angle_mesocnt.cpp b/src/MESONT/angle_mesocnt.cpp index 1394edc4c1..0e2ec7aa10 100644 --- a/src/MESONT/angle_mesocnt.cpp +++ b/src/MESONT/angle_mesocnt.cpp @@ -371,13 +371,13 @@ double AngleMesoCNT::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/MISC/fix_ipi.cpp b/src/MISC/fix_ipi.cpp index a571066b35..a713b9844b 100644 --- a/src/MISC/fix_ipi.cpp +++ b/src/MISC/fix_ipi.cpp @@ -399,7 +399,7 @@ void FixIPI::initial_integrate(int /*vflag*/) auto dely = x[i][1] - xhold[i][1]; auto delz = x[i][2] - xhold[i][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); x[i][0] = xhold[i][0] + delx; x[i][1] = xhold[i][1] + dely; diff --git a/src/MOFFF/angle_class2_p6.cpp b/src/MOFFF/angle_class2_p6.cpp index d7cedb0bcf..15a10eebcc 100644 --- a/src/MOFFF/angle_class2_p6.cpp +++ b/src/MOFFF/angle_class2_p6.cpp @@ -453,13 +453,13 @@ double AngleClass2P6::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/MOFFF/angle_cosine_buck6d.cpp b/src/MOFFF/angle_cosine_buck6d.cpp index bf7390a6f8..bc6b8eb51a 100644 --- a/src/MOFFF/angle_cosine_buck6d.cpp +++ b/src/MOFFF/angle_cosine_buck6d.cpp @@ -365,13 +365,13 @@ double AngleCosineBuck6d::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 92f4d65723..78ce011d73 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -282,19 +282,19 @@ double AngleCharmm::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double delxUB = x[i3][0] - x[i1][0]; double delyUB = x[i3][1] - x[i1][1]; double delzUB = x[i3][2] - x[i1][2]; - domain->minimum_image(delxUB, delyUB, delzUB); + domain->minimum_image(FLERR, delxUB, delyUB, delzUB); double rUB = sqrt(delxUB * delxUB + delyUB * delyUB + delzUB * delzUB); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 6a6d838bc0..1faabfa5d7 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -222,13 +222,13 @@ double AngleCosine::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 2074b822eb..3f48eb712b 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -245,13 +245,13 @@ double AngleCosineSquared::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; @@ -273,13 +273,13 @@ void AngleCosineSquared::born_matrix(int type, int i1, int i2, int i3, double &d 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index e04cecfe0d..db134de357 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -248,13 +248,13 @@ double AngleHarmonic::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; @@ -276,13 +276,13 @@ void AngleHarmonic::born_matrix(int type, int i1, int i2, int i3, double &du, do 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index b1984a6918..3923231690 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -330,13 +330,13 @@ double AngleTable::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); double r2 = sqrt(delx2 * delx2 + dely2 * dely2 + delz2 * delz2); double c = delx1 * delx2 + dely1 * dely2 + delz1 * delz2; diff --git a/src/MOLECULE/dihedral_table.cpp b/src/MOLECULE/dihedral_table.cpp index a731a03b5e..eae7c36eeb 100644 --- a/src/MOLECULE/dihedral_table.cpp +++ b/src/MOLECULE/dihedral_table.cpp @@ -381,9 +381,9 @@ static double Phi(double const *x1, //array holding x,y,z coords atom 1 } //Consider periodic boundary conditions: - domain->minimum_image(vb12[0],vb12[1],vb12[2]); - domain->minimum_image(vb23[0],vb23[1],vb23[2]); - domain->minimum_image(vb34[0],vb34[1],vb34[2]); + domain->minimum_image(FLERR, vb12[0],vb12[1],vb12[2]); + domain->minimum_image(FLERR, vb23[0],vb23[1],vb23[2]); + domain->minimum_image(FLERR, vb34[0],vb34[1],vb34[2]); //--- Compute the normal to the planes formed by atoms 1,2,3 and 2,3,4 --- diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index 2de43b6215..4ec45b16cb 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -162,14 +162,14 @@ void PairHbondDreidingLJ::compute(int eflag, int vflag) delr1[0] = x[i][0] - x[k][0]; delr1[1] = x[i][1] - x[k][1]; delr1[2] = x[i][2] - x[k][2]; - domain->minimum_image(delr1); + domain->minimum_image(FLERR, delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); delr2[0] = x[j][0] - x[k][0]; delr2[1] = x[j][1] - x[k][1]; delr2[2] = x[j][2] - x[k][2]; - domain->minimum_image(delr2); + domain->minimum_image(FLERR, delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); @@ -540,14 +540,14 @@ double PairHbondDreidingLJ::single(int i, int j, int itype, int jtype, delr1[0] = x[i][0] - x[k][0]; delr1[1] = x[i][1] - x[k][1]; delr1[2] = x[i][2] - x[k][2]; - domain->minimum_image(delr1); + domain->minimum_image(FLERR, delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); delr2[0] = x[j][0] - x[k][0]; delr2[1] = x[j][1] - x[k][1]; delr2[2] = x[j][2] - x[k][2]; - domain->minimum_image(delr2); + domain->minimum_image(FLERR, delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); diff --git a/src/MOLECULE/pair_hbond_dreiding_morse.cpp b/src/MOLECULE/pair_hbond_dreiding_morse.cpp index c5465a076a..f238087f30 100644 --- a/src/MOLECULE/pair_hbond_dreiding_morse.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_morse.cpp @@ -129,14 +129,14 @@ void PairHbondDreidingMorse::compute(int eflag, int vflag) delr1[0] = x[i][0] - x[k][0]; delr1[1] = x[i][1] - x[k][1]; delr1[2] = x[i][2] - x[k][2]; - domain->minimum_image(delr1); + domain->minimum_image(FLERR, delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); delr2[0] = x[j][0] - x[k][0]; delr2[1] = x[j][1] - x[k][1]; delr2[2] = x[j][2] - x[k][2]; - domain->minimum_image(delr2); + domain->minimum_image(FLERR, delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); @@ -434,14 +434,14 @@ double PairHbondDreidingMorse::single(int i, int j, int itype, int jtype, delr1[0] = x[i][0] - x[k][0]; delr1[1] = x[i][1] - x[k][1]; delr1[2] = x[i][2] - x[k][2]; - domain->minimum_image(delr1); + domain->minimum_image(FLERR, delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); delr2[0] = x[j][0] - x[k][0]; delr2[1] = x[j][1] - x[k][1]; delr2[2] = x[j][2] - x[k][2]; - domain->minimum_image(delr2); + domain->minimum_image(FLERR, delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); diff --git a/src/OPENMP/dihedral_table_omp.cpp b/src/OPENMP/dihedral_table_omp.cpp index df1ca292c9..5a815a4cc6 100644 --- a/src/OPENMP/dihedral_table_omp.cpp +++ b/src/OPENMP/dihedral_table_omp.cpp @@ -64,9 +64,9 @@ static double Phi(double const *x1, //array holding x,y,z coords atom 1 } //Consider periodic boundary conditions: - domain->minimum_image(vb12[0],vb12[1],vb12[2]); - domain->minimum_image(vb23[0],vb23[1],vb23[2]); - domain->minimum_image(vb34[0],vb34[1],vb34[2]); + domain->minimum_image(FLERR, vb12[0],vb12[1],vb12[2]); + domain->minimum_image(FLERR, vb23[0],vb23[1],vb23[2]); + domain->minimum_image(FLERR, vb34[0],vb34[1],vb34[2]); //--- Compute the normal to the planes formed by atoms 1,2,3 and 2,3,4 --- diff --git a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp index 60ec8938fe..933b18a732 100644 --- a/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_lj_omp.cpp @@ -201,14 +201,14 @@ void PairHbondDreidingLJOMP::eval(int iifrom, int iito, ThrData * const thr) delr1[0] = xtmp - x[k].x; delr1[1] = ytmp - x[k].y; delr1[2] = ztmp - x[k].z; - domain->minimum_image(delr1); + domain->minimum_image(FLERR, delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); delr2[0] = x[j].x - x[k].x; delr2[1] = x[j].y - x[k].y; delr2[2] = x[j].z - x[k].z; - domain->minimum_image(delr2); + domain->minimum_image(FLERR, delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); diff --git a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp index 7772ea69fa..1626988f75 100644 --- a/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/OPENMP/pair_hbond_dreiding_morse_omp.cpp @@ -202,14 +202,14 @@ void PairHbondDreidingMorseOMP::eval(int iifrom, int iito, ThrData * const thr) delr1[0] = xtmp - x[k].x; delr1[1] = ytmp - x[k].y; delr1[2] = ztmp - x[k].z; - domain->minimum_image(delr1); + domain->minimum_image(FLERR, delr1); rsq1 = delr1[0]*delr1[0] + delr1[1]*delr1[1] + delr1[2]*delr1[2]; r1 = sqrt(rsq1); delr2[0] = x[j].x - x[k].x; delr2[1] = x[j].y - x[k].y; delr2[2] = x[j].z - x[k].z; - domain->minimum_image(delr2); + domain->minimum_image(FLERR, delr2); rsq2 = delr2[0]*delr2[0] + delr2[1]*delr2[1] + delr2[2]*delr2[2]; r2 = sqrt(rsq2); diff --git a/src/OPENMP/pair_peri_lps_omp.cpp b/src/OPENMP/pair_peri_lps_omp.cpp index c34f3ac236..2a4289fdf2 100644 --- a/src/OPENMP/pair_peri_lps_omp.cpp +++ b/src/OPENMP/pair_peri_lps_omp.cpp @@ -161,7 +161,7 @@ void PairPeriLPSOMP::eval(int iifrom, int iito, ThrData * const thr) delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -285,12 +285,12 @@ void PairPeriLPSOMP::eval(int iifrom, int iito, ThrData * const thr) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); jtype = type[j]; delta = cut[itype][jtype]; r = sqrt(rsq); diff --git a/src/OPENMP/pair_peri_pmb_omp.cpp b/src/OPENMP/pair_peri_pmb_omp.cpp index 0b903272fa..eb5911b294 100644 --- a/src/OPENMP/pair_peri_pmb_omp.cpp +++ b/src/OPENMP/pair_peri_pmb_omp.cpp @@ -156,7 +156,7 @@ void PairPeriPMBOMP::eval(int iifrom, int iito, ThrData * const thr) delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -244,7 +244,7 @@ void PairPeriPMBOMP::eval(int iifrom, int iito, ThrData * const thr) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; delta = cut[itype][jtype]; diff --git a/src/PERI/pair_peri.cpp b/src/PERI/pair_peri.cpp index 6606f36c6f..da761952fe 100644 --- a/src/PERI/pair_peri.cpp +++ b/src/PERI/pair_peri.cpp @@ -189,12 +189,12 @@ void PairPeri::compute_dilatation(int ifrom, int ito) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx, dely, delz); + if (periodic) domain->minimum_image(FLERR, delx, dely, delz); rsq = delx * delx + dely * dely + delz * delz; delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0, dely0, delz0); + if (periodic) domain->minimum_image(FLERR, delx0, dely0, delz0); r = sqrt(rsq); dr = r - r0[i][jj]; diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index c0732d48e4..11d9ee646b 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -124,7 +124,7 @@ void PairPeriEPS::compute(int eflag, int vflag) delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -262,12 +262,12 @@ void PairPeriEPS::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); jtype = type[j]; delta = cut[itype][jtype]; r = sqrt(rsq); @@ -514,12 +514,12 @@ double PairPeriEPS::compute_DeviatoricForceStateNorm(int i) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); r = sqrt(rsq); dr = r - r0[i][jj]; if (fabs(dr) < NEAR_ZERO) dr = 0.0; diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index b7b7e6577a..bd0eb9651f 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -116,7 +116,7 @@ void PairPeriLPS::compute(int eflag, int vflag) delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -225,12 +225,12 @@ void PairPeriLPS::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); jtype = type[j]; delta = cut[itype][jtype]; r = sqrt(rsq); diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 0bacb3a2f0..c17336b8cf 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -110,7 +110,7 @@ void PairPeriPMB::compute(int eflag, int vflag) delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -189,7 +189,7 @@ void PairPeriPMB::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; jtype = type[j]; delta = cut[itype][jtype]; @@ -361,7 +361,7 @@ double PairPeriPMB::single(int i, int j, int itype, int jtype, double rsq, dely0 = x0[i][1] - x0[j][1]; delz0 = x0[i][2] - x0[j][2]; int periodic = domain->xperiodic || domain->yperiodic || domain->zperiodic; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; d_ij = MIN(0.9*sqrt(rsq0),1.35*lc); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index d814ce6f05..be9967436e 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -121,7 +121,7 @@ void PairPeriVES::compute(int eflag, int vflag) delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); rsq0 = delx0*delx0 + dely0*dely0 + delz0*delz0; jtype = type[j]; @@ -233,12 +233,12 @@ void PairPeriVES::compute(int eflag, int vflag) delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - if (periodic) domain->minimum_image(delx,dely,delz); + if (periodic) domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; delx0 = xtmp0 - x0[j][0]; dely0 = ytmp0 - x0[j][1]; delz0 = ztmp0 - x0[j][2]; - if (periodic) domain->minimum_image(delx0,dely0,delz0); + if (periodic) domain->minimum_image(FLERR, delx0,dely0,delz0); jtype = type[j]; delta = cut[itype][jtype]; r = sqrt(rsq); diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp index 37f84b6f12..4669253401 100644 --- a/src/PHONON/fix_phonon.cpp +++ b/src/PHONON/fix_phonon.cpp @@ -400,7 +400,7 @@ void FixPhonon::end_of_step() ndim = sysdim; for (i = 1; i < nucell; ++i) { for (idim = 0; idim < sysdim; ++idim) dist2orig[idim] = Rnow[idx][ndim++] - Rnow[idx][idim]; - domain->minimum_image_big(dist2orig); + domain->minimum_image_big(FLERR, dist2orig); for (idim = 0; idim < sysdim; ++idim) basis[i][idim] += dist2orig[idim]; } } diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index b70092296f..6ba6954541 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -1190,7 +1190,7 @@ void FixBondReact::far_partner() delx = xtmp - x[j][0]; dely = ytmp - x[j][1]; delz = ztmp - x[j][2]; - domain->minimum_image(delx,dely,delz); // ghost location fix + domain->minimum_image(FLERR, delx,dely,delz); // ghost location fix rsq = delx*delx + dely*dely + delz*delz; if (var_flag[RMIN][rxnID]) { @@ -1260,7 +1260,7 @@ void FixBondReact::close_partner() delx = x[i1][0] - x[i2][0]; dely = x[i1][1] - x[i2][1]; delz = x[i1][2] - x[i2][2]; - domain->minimum_image(delx,dely,delz); // ghost location fix + domain->minimum_image(FLERR, delx,dely,delz); // ghost location fix rsq = delx*delx + dely*dely + delz*delz; if (var_flag[RMIN][rxnID]) { @@ -1972,7 +1972,7 @@ int FixBondReact::check_constraints() delx = x1[0] - x2[0]; dely = x1[1] - x2[1]; delz = x1[2] - x2[2]; - domain->minimum_image(delx,dely,delz); // ghost location fix + domain->minimum_image(FLERR, delx,dely,delz); // ghost location fix rsq = delx*delx + dely*dely + delz*delz; if (rsq < constraints[i][rxnID].par[0] || rsq > constraints[i][rxnID].par[1]) satisfied[i] = 0; } else if (constraints[i][rxnID].type == ANGLE) { @@ -1984,7 +1984,7 @@ int FixBondReact::check_constraints() delx1 = x1[0] - x2[0]; dely1 = x1[1] - x2[1]; delz1 = x1[2] - x2[2]; - domain->minimum_image(delx1,dely1,delz1); // ghost location fix + domain->minimum_image(FLERR, delx1,dely1,delz1); // ghost location fix rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); @@ -1992,7 +1992,7 @@ int FixBondReact::check_constraints() delx2 = x3[0] - x2[0]; dely2 = x3[1] - x2[1]; delz2 = x3[2] - x2[2]; - domain->minimum_image(delx2,dely2,delz2); // ghost location fix + domain->minimum_image(FLERR, delx2,dely2,delz2); // ghost location fix rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -2012,22 +2012,22 @@ int FixBondReact::check_constraints() vb1x = x1[0] - x2[0]; vb1y = x1[1] - x2[1]; vb1z = x1[2] - x2[2]; - domain->minimum_image(vb1x,vb1y,vb1z); + domain->minimum_image(FLERR, vb1x,vb1y,vb1z); vb2x = x3[0] - x2[0]; vb2y = x3[1] - x2[1]; vb2z = x3[2] - x2[2]; - domain->minimum_image(vb2x,vb2y,vb2z); + domain->minimum_image(FLERR, vb2x,vb2y,vb2z); vb2xm = -vb2x; vb2ym = -vb2y; vb2zm = -vb2z; - domain->minimum_image(vb2xm,vb2ym,vb2zm); + domain->minimum_image(FLERR, vb2xm,vb2ym,vb2zm); vb3x = x4[0] - x3[0]; vb3y = x4[1] - x3[1]; vb3z = x4[2] - x3[2]; - domain->minimum_image(vb3x,vb3y,vb3z); + domain->minimum_image(FLERR, vb3x,vb3y,vb3z); ax = vb1y*vb2zm - vb1z*vb2ym; ay = vb1z*vb2xm - vb1x*vb2zm; @@ -3908,7 +3908,7 @@ int FixBondReact::insert_atoms_setup(tagint **my_update_mega_glove, int iupdate) delx = coords[m][0] - x[i][0]; dely = coords[m][1] - x[i][1]; delz = coords[m][2] - x[i][2]; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; if (rsq < overlapsq[rxnID]) { abortflag = 1; @@ -3926,7 +3926,7 @@ int FixBondReact::insert_atoms_setup(tagint **my_update_mega_glove, int iupdate) delx = coords[m][0] - myaddatom.x[0]; dely = coords[m][1] - myaddatom.x[1]; delz = coords[m][2] - myaddatom.x[2]; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; if (rsq < overlapsq[rxnID]) { abortflag = 1; diff --git a/src/REPLICA/bosonic_exchange.cpp b/src/REPLICA/bosonic_exchange.cpp index 6ffbeb8eb7..261ba9d185 100644 --- a/src/REPLICA/bosonic_exchange.cpp +++ b/src/REPLICA/bosonic_exchange.cpp @@ -87,7 +87,7 @@ void BosonicExchange::diff_two_beads(const double *x1, int l1, const double *x2, double delx2 = x2[3 * l2 + 0] - x1[3 * l1 + 0]; double dely2 = x2[3 * l2 + 1] - x1[3 * l1 + 1]; double delz2 = x2[3 * l2 + 2] - x1[3 * l1 + 2]; - if (apply_minimum_image) { domain->minimum_image(delx2, dely2, delz2); } + if (apply_minimum_image) { domain->minimum_image(FLERR, delx2, dely2, delz2); } diff[0] = delx2; diff[1] = dely2; diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index 409c108628..181100b11b 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -348,7 +348,7 @@ void FixNEB::min_post_force(int /*vflag*/) delxp = x[i][0] - xprev[i][0]; delyp = x[i][1] - xprev[i][1]; delzp = x[i][2] - xprev[i][2]; - domain->minimum_image(delxp, delyp, delzp); + domain->minimum_image(FLERR, delxp, delyp, delzp); plen += delxp * delxp + delyp * delyp + delzp * delzp; dottangrad += delxp * f[i][0] + delyp * f[i][1] + delzp * f[i][2]; gradlen += f[i][0] * f[i][0] + f[i][1] * f[i][1] + f[i][2] * f[i][2]; @@ -368,7 +368,7 @@ void FixNEB::min_post_force(int /*vflag*/) delxn = xnext[i][0] - x[i][0]; delyn = xnext[i][1] - x[i][1]; delzn = xnext[i][2] - x[i][2]; - domain->minimum_image(delxn, delyn, delzn); + domain->minimum_image(FLERR, delxn, delyn, delzn); nlen += delxn * delxn + delyn * delyn + delzn * delzn; gradnextlen += fnext[i][0] * fnext[i][0] + fnext[i][1] * fnext[i][1] + fnext[i][2] * fnext[i][2]; @@ -396,13 +396,13 @@ void FixNEB::min_post_force(int /*vflag*/) delxp = x[i][0] - xprev[i][0]; delyp = x[i][1] - xprev[i][1]; delzp = x[i][2] - xprev[i][2]; - domain->minimum_image(delxp, delyp, delzp); + domain->minimum_image(FLERR, delxp, delyp, delzp); plen += delxp * delxp + delyp * delyp + delzp * delzp; delxn = xnext[i][0] - x[i][0]; delyn = xnext[i][1] - x[i][1]; delzn = xnext[i][2] - x[i][2]; - domain->minimum_image(delxn, delyn, delzn); + domain->minimum_image(FLERR, delxn, delyn, delzn); if (vnext > veng && veng > vprev) { tangent[i][0] = delxn; diff --git a/src/REPLICA/fix_pimd_nvt.cpp b/src/REPLICA/fix_pimd_nvt.cpp index d11bc34337..53a4b779ae 100644 --- a/src/REPLICA/fix_pimd_nvt.cpp +++ b/src/REPLICA/fix_pimd_nvt.cpp @@ -579,13 +579,13 @@ void FixPIMDNVT::spring_force() double dely1 = xlast[1] - x[i][1]; double delz1 = xlast[2] - x[i][2]; xlast += 3; - domain->minimum_image(delx1, dely1, delz1); + domain->minimum_image(FLERR, delx1, dely1, delz1); double delx2 = xnext[0] - x[i][0]; double dely2 = xnext[1] - x[i][1]; double delz2 = xnext[2] - x[i][2]; xnext += 3; - domain->minimum_image(delx2, dely2, delz2); + domain->minimum_image(FLERR, delx2, dely2, delz2); double ff = fbond * _mass[type[i]]; diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index a65fc9a58f..0226755778 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -83,7 +83,7 @@ NEB::NEB(LAMMPS *lmp, double etol_in, double ftol_in, int n1steps_in, int n2step delx = buf_final[ii] - buf_init[ii]; dely = buf_final[ii + 1] - buf_init[ii + 1]; delz = buf_final[ii + 2] - buf_init[ii + 2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); x[i][0] = buf_init[ii] + fraction * delx; x[i][1] = buf_init[ii + 1] + fraction * dely; x[i][2] = buf_init[ii + 2] + fraction * delz; @@ -529,7 +529,7 @@ void NEB::readfile(char *file, int flag) dely = values.next_double() - x[m][1]; delz = values.next_double() - x[m][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); if (flag == 0) { x[m][0] += fraction * delx; diff --git a/src/RHEO/compute_rheo_kernel.cpp b/src/RHEO/compute_rheo_kernel.cpp index 61aad6a9b8..e44e356133 100644 --- a/src/RHEO/compute_rheo_kernel.cpp +++ b/src/RHEO/compute_rheo_kernel.cpp @@ -227,7 +227,7 @@ double ComputeRHEOKernel::calc_dw(int i, int j, double delx, double dely, double int corrections_i = check_corrections(i); int corrections_j = check_corrections(j); - wp = calc_dw_scalar_quintic(delx, dely, delz, r); + wp = calc_dw_scalar_quintic(r); // Overwrite if there are corrections double dxij[3] = {delx, dely, delz}; @@ -279,7 +279,7 @@ double ComputeRHEOKernel::calc_w_quintic(double r) /* ---------------------------------------------------------------------- */ -double ComputeRHEOKernel::calc_dw_scalar_quintic(double delx, double dely, double delz, double r) +double ComputeRHEOKernel::calc_dw_scalar_quintic(double r) { double wp, tmp1, tmp2, tmp3, tmp1sq, tmp2sq, tmp3sq, s; @@ -312,7 +312,7 @@ double ComputeRHEOKernel::calc_dw_scalar_quintic(double delx, double dely, doubl double ComputeRHEOKernel::calc_dw_quintic(double delx, double dely, double delz, double r, double *dW1, double *dW2) { - double wp = calc_dw_scalar_quintic(delx, dely, delz, r); + double wp = calc_dw_scalar_quintic(r); double wprinv = wp / r; dW1[0] = delx * wprinv; diff --git a/src/RHEO/compute_rheo_kernel.h b/src/RHEO/compute_rheo_kernel.h index 037e9e3683..10f7baf425 100644 --- a/src/RHEO/compute_rheo_kernel.h +++ b/src/RHEO/compute_rheo_kernel.h @@ -40,7 +40,7 @@ class ComputeRHEOKernel : public Compute { double calc_w(int, int, double, double, double, double); double calc_dw(int, int, double, double, double, double); double calc_w_quintic(double); - double calc_dw_scalar_quintic(double, double, double, double); + double calc_dw_scalar_quintic(double); double calc_dw_quintic(double, double, double, double, double *, double *); double calc_w_wendlandc4(double); double calc_dw_wendlandc4(double, double, double, double, double *, double *); diff --git a/src/RHEO/fix_rheo_pressure.cpp b/src/RHEO/fix_rheo_pressure.cpp index 6088c44348..16a96ef430 100644 --- a/src/RHEO/fix_rheo_pressure.cpp +++ b/src/RHEO/fix_rheo_pressure.cpp @@ -289,7 +289,7 @@ double FixRHEOPressure::calc_rho(double p, int i) /* ---------------------------------------------------------------------- */ -double FixRHEOPressure::calc_csq(double p, int i) +double FixRHEOPressure::calc_csq(double /*p*/, int i) { int type = atom->type[i]; double csq2 = csq[type]; diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index 313bd3b59a..ceca4e8a47 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -434,7 +434,7 @@ bool FixEHEX::check_cluster(tagint *shake_atom, int n, Region *region) // take into account pbc - domain->minimum_image_big(xtemp); + domain->minimum_image_big(FLERR, xtemp); for (int k = 0; k < 3; k++) xcom[k] += mi * (x[lid[0]][k] + xtemp[k]); } diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index 5a85902609..f7673194a9 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -248,9 +248,9 @@ void FixRattle::vrattle3angle(int m) // take into account periodicity - domain->minimum_image(r01); - domain->minimum_image(r02); - domain->minimum_image(r12); + domain->minimum_image(FLERR, r01); + domain->minimum_image(FLERR, r02); + domain->minimum_image(FLERR, r12); // v01,v02,v12 = velocity differences @@ -323,7 +323,7 @@ void FixRattle::vrattle2(int m) // r01 = distance vec between atoms, with PBC MathExtra::sub3(x[i1],x[i0],r01); - domain->minimum_image(r01); + domain->minimum_image(FLERR, r01); // v01 = distance vectors for velocities @@ -375,8 +375,8 @@ void FixRattle::vrattle3(int m) MathExtra::sub3(x[i1],x[i0],r01); MathExtra::sub3(x[i2],x[i0],r02); - domain->minimum_image(r01); - domain->minimum_image(r02); + domain->minimum_image(FLERR, r01); + domain->minimum_image(FLERR, r02); // vp01,vp02 = distance vectors between velocities @@ -446,9 +446,9 @@ void FixRattle::vrattle4(int m) MathExtra::sub3(x[i2],x[i0],r02); MathExtra::sub3(x[i3],x[i0],r03); - domain->minimum_image(r01); - domain->minimum_image(r02); - domain->minimum_image(r03); + domain->minimum_image(FLERR, r01); + domain->minimum_image(FLERR, r02); + domain->minimum_image(FLERR, r03); // vp01,vp02,vp03 = distance vectors between velocities @@ -828,7 +828,7 @@ bool FixRattle::check2(double **v, int m, bool checkr, bool checkv) tagint i1 = atom->map(shake_atom[m][1]); MathExtra::sub3(x[i1],x[i0],r01); - domain->minimum_image(r01); + domain->minimum_image(FLERR, r01); MathExtra::sub3(v[i1],v[i0],v01); stat = !checkr || (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) <= tol); @@ -857,8 +857,8 @@ bool FixRattle::check3(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(x[i1],x[i0],r01); MathExtra::sub3(x[i2],x[i0],r02); - domain->minimum_image(r01); - domain->minimum_image(r02); + domain->minimum_image(FLERR, r01); + domain->minimum_image(FLERR, r02); MathExtra::sub3(v[i1],v[i0],v01); MathExtra::sub3(v[i2],v[i0],v02); @@ -893,9 +893,9 @@ bool FixRattle::check4(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(x[i2],x[i0],r02); MathExtra::sub3(x[i3],x[i0],r03); - domain->minimum_image(r01); - domain->minimum_image(r02); - domain->minimum_image(r03); + domain->minimum_image(FLERR, r01); + domain->minimum_image(FLERR, r02); + domain->minimum_image(FLERR, r03); MathExtra::sub3(v[i1],v[i0],v01); MathExtra::sub3(v[i2],v[i0],v02); @@ -932,9 +932,9 @@ bool FixRattle::check3angle(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(x[i2],x[i0],r02); MathExtra::sub3(x[i2],x[i1],r12); - domain->minimum_image(r01); - domain->minimum_image(r02); - domain->minimum_image(r12); + domain->minimum_image(FLERR, r01); + domain->minimum_image(FLERR, r02); + domain->minimum_image(FLERR, r12); MathExtra::sub3(v[i1],v[i0],v01); MathExtra::sub3(v[i2],v[i0],v02); diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index d55b1fadd9..e6abda2dcf 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -2180,7 +2180,7 @@ void FixRigidSmall::setup_bodies_static() xgc = body[ibody].xgc; double delta[3]; MathExtra::sub3(xgc,xcm,delta); - domain->minimum_image_big(delta); + domain->minimum_image_big(FLERR, delta); MathExtra::transpose_matvec(ex,ey,ez,delta,body[ibody].xgc_body); MathExtra::add3(xcm,delta,xgc); } diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index 12ea173a23..f6de73e73e 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -40,10 +40,9 @@ static constexpr int FACESDELTA = 10000; /* ---------------------------------------------------------------------- */ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), con_mono(nullptr), con_poly(nullptr), - radstr(nullptr), voro(nullptr), edge(nullptr), sendvector(nullptr), - rfield(nullptr), tags(nullptr), occvec(nullptr), sendocc(nullptr), - lroot(nullptr), lnext(nullptr), faces(nullptr) + Compute(lmp, narg, arg), con_mono(nullptr), con_poly(nullptr), radstr(nullptr), + voro(nullptr), edge(nullptr), sendvector(nullptr), rfield(nullptr), tags(nullptr), + occvec(nullptr), lroot(nullptr), lnext(nullptr), faces(nullptr) { int sgroup; @@ -156,9 +155,6 @@ ComputeVoronoi::~ComputeVoronoi() memory->destroy(lroot); memory->destroy(lnext); memory->destroy(occvec); -#ifdef NOTINPLACE - memory->destroy(sendocc); -#endif memory->destroy(tags); memory->destroy(faces); } @@ -211,9 +207,6 @@ void ComputeVoronoi::compute_peratom() oldnatoms = atom->natoms; oldmaxtag = atom->map_tag_max; memory->create(occvec,oldmaxtag,"voronoi/atom:occvec"); -#ifdef NOTINPLACE - memory->create(sendocc,oldmaxtag,"voronoi/atom:sendocc"); -#endif } // get the occupation of each original voronoi cell @@ -429,12 +422,7 @@ void ComputeVoronoi::checkOccupation() // MPI sum occupation -#ifdef NOTINPLACE - memcpy(sendocc, occvec, oldnatoms*sizeof(*occvec)); - MPI_Allreduce(sendocc, occvec, oldnatoms, MPI_INT, MPI_SUM, world); -#else MPI_Allreduce(MPI_IN_PLACE, occvec, oldnatoms, MPI_INT, MPI_SUM, world); -#endif // determine the total number of atoms in this atom's currently occupied cell diff --git a/src/VORONOI/compute_voronoi_atom.h b/src/VORONOI/compute_voronoi_atom.h index fbcf14c9bc..717928b054 100644 --- a/src/VORONOI/compute_voronoi_atom.h +++ b/src/VORONOI/compute_voronoi_atom.h @@ -61,7 +61,7 @@ class ComputeVoronoi : public Compute { bool onlyGroup, occupation; tagint *tags, oldmaxtag; - int *occvec, *sendocc, *lroot, *lnext, lmax, oldnatoms, oldnall; + int *occvec, *lroot, *lnext, lmax, oldnatoms, oldnall; int faces_flag, nfaces, nfacesmax; double **faces; }; diff --git a/src/YAFF/angle_cross.cpp b/src/YAFF/angle_cross.cpp index 0ff3580715..3013885b3f 100644 --- a/src/YAFF/angle_cross.cpp +++ b/src/YAFF/angle_cross.cpp @@ -318,13 +318,13 @@ double AngleCross::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/YAFF/angle_mm3.cpp b/src/YAFF/angle_mm3.cpp index 9cc53e21de..bce4607caa 100644 --- a/src/YAFF/angle_mm3.cpp +++ b/src/YAFF/angle_mm3.cpp @@ -260,13 +260,13 @@ double AngleMM3::single(int type, int i1, int i2, int i3) 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; @@ -297,13 +297,13 @@ void AngleMM3::born_matrix(int type, int i1, int i2, int i3, double &du, double 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); + domain->minimum_image(FLERR, 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); + domain->minimum_image(FLERR, delx2,dely2,delz2); double r2 = sqrt(delx2*delx2 + dely2*dely2 + delz2*delz2); double c = delx1*delx2 + dely1*dely2 + delz1*delz2; diff --git a/src/YAFF/improper_distharm.cpp b/src/YAFF/improper_distharm.cpp index 69d14cc997..0230ae54e0 100644 --- a/src/YAFF/improper_distharm.cpp +++ b/src/YAFF/improper_distharm.cpp @@ -94,37 +94,37 @@ void ImproperDistHarm::compute(int eflag, int vflag) xab = x[i2][0] - x[i1][0]; yab = x[i2][1] - x[i1][1]; zab = x[i2][2] - x[i1][2]; - domain->minimum_image(xab,yab,zab); + domain->minimum_image(FLERR, xab,yab,zab); // bond 1->3 xac = x[i3][0] - x[i1][0]; yac = x[i3][1] - x[i1][1]; zac = x[i3][2] - x[i1][2]; - domain->minimum_image(xac,yac,zac); + domain->minimum_image(FLERR, xac,yac,zac); // bond 1->4 xad = x[i4][0] - x[i1][0]; yad = x[i4][1] - x[i1][1]; zad = x[i4][2] - x[i1][2]; - domain->minimum_image(xad,yad,zad); + domain->minimum_image(FLERR, xad,yad,zad); // bond 2-3 xbc = x[i3][0] - x[i2][0]; ybc = x[i3][1] - x[i2][1]; zbc = x[i3][2] - x[i2][2]; - domain->minimum_image(xbc,ybc,zbc); + domain->minimum_image(FLERR, xbc,ybc,zbc); // bond 2-4 xbd = x[i4][0] - x[i2][0]; ybd = x[i4][1] - x[i2][1]; zbd = x[i4][2] - x[i2][2]; - domain->minimum_image(xbd,ybd,zbd); + domain->minimum_image(FLERR, xbd,ybd,zbd); // bond 3-4 xcd = x[i4][0] - x[i3][0]; ycd = x[i4][1] - x[i3][1]; zcd = x[i4][2] - x[i3][2]; - domain->minimum_image(xcd,ycd,zcd); + domain->minimum_image(FLERR, xcd,ycd,zcd); xna = ybc*zcd - zbc*ycd; yna = -(xbc*zcd - zbc*xcd); diff --git a/src/YAFF/improper_sqdistharm.cpp b/src/YAFF/improper_sqdistharm.cpp index 1981c61f38..b7b699059c 100644 --- a/src/YAFF/improper_sqdistharm.cpp +++ b/src/YAFF/improper_sqdistharm.cpp @@ -94,37 +94,37 @@ void ImproperSQDistHarm::compute(int eflag, int vflag) xab = x[i2][0] - x[i1][0]; yab = x[i2][1] - x[i1][1]; zab = x[i2][2] - x[i1][2]; - domain->minimum_image(xab,yab,zab); + domain->minimum_image(FLERR, xab,yab,zab); // bond 1->3 xac = x[i3][0] - x[i1][0]; yac = x[i3][1] - x[i1][1]; zac = x[i3][2] - x[i1][2]; - domain->minimum_image(xac,yac,zac); + domain->minimum_image(FLERR, xac,yac,zac); // bond 1->4 xad = x[i4][0] - x[i1][0]; yad = x[i4][1] - x[i1][1]; zad = x[i4][2] - x[i1][2]; - domain->minimum_image(xad,yad,zad); + domain->minimum_image(FLERR, xad,yad,zad); // bond 2-3 xbc = x[i3][0] - x[i2][0]; ybc = x[i3][1] - x[i2][1]; zbc = x[i3][2] - x[i2][2]; - domain->minimum_image(xbc,ybc,zbc); + domain->minimum_image(FLERR, xbc,ybc,zbc); // bond 2-4 xbd = x[i4][0] - x[i2][0]; ybd = x[i4][1] - x[i2][1]; zbd = x[i4][2] - x[i2][2]; - domain->minimum_image(xbd,ybd,zbd); + domain->minimum_image(FLERR, xbd,ybd,zbd); // bond 3-4 xcd = x[i4][0] - x[i3][0]; ycd = x[i4][1] - x[i3][1]; zcd = x[i4][2] - x[i3][2]; - domain->minimum_image(xcd,ycd,zcd); + domain->minimum_image(FLERR, xcd,ycd,zcd); xna = ybc*zcd - zbc*ycd; yna = -(xbc*zcd - zbc*xcd); diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index 53266b831f..3129f05b56 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -266,7 +266,7 @@ int ComputeAngleLocal::compute_angles(int flag) 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); + domain->minimum_image(FLERR, delx1, dely1, delz1); rsq1 = delx1 * delx1 + dely1 * dely1 + delz1 * delz1; r1 = sqrt(rsq1); @@ -274,7 +274,7 @@ int ComputeAngleLocal::compute_angles(int flag) 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); + domain->minimum_image(FLERR, delx2, dely2, delz2); rsq2 = delx2 * delx2 + dely2 * dely2 + delz2 * delz2; r2 = sqrt(rsq2); diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index 9b7aedd218..586508b1d3 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -347,7 +347,7 @@ int ComputeBondLocal::compute_bonds(int flag) dx = x[atom1][0] - x[atom2][0]; dy = x[atom1][1] - x[atom2][1]; dz = x[atom1][2] - x[atom2][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); rsq = dx * dx + dy * dy + dz * dz; if (btype == 0) { diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index 3f84360913..ab03ba74fc 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -255,22 +255,22 @@ int ComputeDihedralLocal::compute_dihedrals(int flag) vb1x = x[atom1][0] - x[atom2][0]; vb1y = x[atom1][1] - x[atom2][1]; vb1z = x[atom1][2] - x[atom2][2]; - domain->minimum_image(vb1x, vb1y, vb1z); + domain->minimum_image(FLERR, vb1x, vb1y, vb1z); 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); + domain->minimum_image(FLERR, vb2x, vb2y, vb2z); vb2xm = -vb2x; vb2ym = -vb2y; vb2zm = -vb2z; - domain->minimum_image(vb2xm, vb2ym, vb2zm); + domain->minimum_image(FLERR, vb2xm, vb2ym, vb2zm); 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); + domain->minimum_image(FLERR, vb3x, vb3y, vb3z); ax = vb1y * vb2zm - vb1z * vb2ym; ay = vb1z * vb2xm - vb1x * vb2zm; diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index ff8f069a03..fe5e373789 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -183,17 +183,17 @@ int ComputeImproperLocal::compute_impropers(int flag) vb1x = x[atom1][0] - x[atom2][0]; vb1y = x[atom1][1] - x[atom2][1]; vb1z = x[atom1][2] - x[atom2][2]; - domain->minimum_image(vb1x, vb1y, vb1z); + domain->minimum_image(FLERR, vb1x, vb1y, vb1z); 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); + domain->minimum_image(FLERR, vb2x, vb2y, vb2z); 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); + domain->minimum_image(FLERR, vb3x, vb3y, vb3z); ss1 = 1.0 / (vb1x * vb1x + vb1y * vb1y + vb1z * vb1z); ss2 = 1.0 / (vb2x * vb2x + vb2y * vb2y + vb2z * vb2z); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index b055e3827a..ebbe2f9035 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -881,7 +881,7 @@ void CreateAtoms::add_random() delx = xone[0] - x[i][0]; dely = xone[1] - x[i][1]; delz = xone[2] - x[i][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); distsq = delx * delx + dely * dely + delz * delz; if (distsq < odistsq) { reject = 1; @@ -897,7 +897,7 @@ void CreateAtoms::add_random() delx = xmol[j][0] - x[i][0]; dely = xmol[j][1] - x[i][1]; delz = xmol[j][2] - x[i][2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); distsq = delx * delx + dely * dely + delz * delz; if (distsq < odistsq) { reject = 1; diff --git a/src/domain.cpp b/src/domain.cpp index 31350482bd..33764d70cc 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -1136,7 +1136,7 @@ void Domain::box_too_small_check() delx = x[i][0] - x[k][0]; dely = x[i][1] - x[k][1]; delz = x[i][2] - x[k][2]; - minimum_image(delx,dely,delz); + minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; maxbondme = MAX(maxbondme,rsq); } @@ -1205,6 +1205,7 @@ void Domain::subbox_too_small_check(double thresh) "could lead to lost atoms"); } +// clang-format on /* ---------------------------------------------------------------------- minimum image convention in periodic dimensions use 1/2 of box size as test @@ -1218,39 +1219,45 @@ void Domain::subbox_too_small_check(double thresh) ------------------------------------------------------------------------- */ static constexpr double MAXIMGCOUNT = 16; - -void Domain::minimum_image(double &dx, double &dy, double &dz) const +void Domain::minimum_image(const std::string &file, int line, double &dx, double &dy, + double &dz) const { if (triclinic == 0) { if (xperiodic) { if (fabs(dx) > (MAXIMGCOUNT * xprd)) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dx); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dx); while (fabs(dx) > xprd_half) { - if (dx < 0.0) dx += xprd; - else dx -= xprd; + if (dx < 0.0) + dx += xprd; + else + dx -= xprd; } } if (yperiodic) { if (fabs(dy) > (MAXIMGCOUNT * yprd)) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dy); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dy); while (fabs(dy) > yprd_half) { - if (dy < 0.0) dy += yprd; - else dy -= yprd; + if (dy < 0.0) + dy += yprd; + else + dy -= yprd; } } if (zperiodic) { if (fabs(dz) > (MAXIMGCOUNT * zprd)) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dz); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dz); while (fabs(dz) > zprd_half) { - if (dz < 0.0) dz += zprd; - else dz -= zprd; + if (dz < 0.0) + dz += zprd; + else + dz -= zprd; } } } else { if (zperiodic) { if (fabs(dz) > (MAXIMGCOUNT * zprd)) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dz); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dz); while (fabs(dz) > zprd_half) { if (dz < 0.0) { dz += zprd; @@ -1265,7 +1272,7 @@ void Domain::minimum_image(double &dx, double &dy, double &dz) const } if (yperiodic) { if (fabs(dy) > (MAXIMGCOUNT * yprd)) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dy); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dy); while (fabs(dy) > yprd_half) { if (dy < 0.0) { dy += yprd; @@ -1278,10 +1285,12 @@ void Domain::minimum_image(double &dx, double &dy, double &dz) const } if (xperiodic) { if (fabs(dx) > (MAXIMGCOUNT * xprd)) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dx); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dx); while (fabs(dx) > xprd_half) { - if (dx < 0.0) dx += xprd; - else dx -= xprd; + if (dx < 0.0) + dx += xprd; + else + dx -= xprd; } } } @@ -1298,61 +1307,63 @@ void Domain::minimum_image(double &dx, double &dy, double &dz) const this applies for example to fix rigid/small ------------------------------------------------------------------------- */ -void Domain::minimum_image_big(double &dx, double &dy, double &dz) const +void Domain::minimum_image_big(const std::string &file, int line, double &dx, double &dy, + double &dz) const { if (triclinic == 0) { if (xperiodic) { - double dfactor = dx/xprd + 0.5; + double dfactor = dx / xprd + 0.5; if (dx < 0) dfactor -= 1.0; if (dfactor > MAXSMALLINT) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dx); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dx); dx -= xprd * static_cast(dfactor); } if (yperiodic) { - double dfactor = dy/yprd + 0.5; + double dfactor = dy / yprd + 0.5; if (dy < 0) dfactor -= 1.0; if (dfactor > MAXSMALLINT) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dy); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dy); dy -= yprd * static_cast(dfactor); } if (zperiodic) { - double dfactor = dz/zprd + 0.5; + double dfactor = dz / zprd + 0.5; if (dz < 0) dfactor -= 1.0; if (dfactor > MAXSMALLINT) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dz); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dz); dz -= zprd * static_cast(dfactor); } } else { if (zperiodic) { - double dfactor = dz/zprd + 0.5; + double dfactor = dz / zprd + 0.5; if (dz < 0) dfactor -= 1.0; if (dfactor > MAXSMALLINT) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dz); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dz); int factor = static_cast(dfactor); dz -= zprd * factor; dy -= yz * factor; dx -= xz * factor; } if (yperiodic) { - double dfactor = dy/yprd + 0.5; + double dfactor = dy / yprd + 0.5; if (dy < 0) dfactor -= 1.0; if (dfactor > MAXSMALLINT) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dy); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dy); int factor = static_cast(dfactor); dy -= yprd * factor; dx -= xy * factor; } if (xperiodic) { - double dfactor = dx/xprd + 0.5; + double dfactor = dx / xprd + 0.5; if (dx < 0) dfactor -= 1.0; if (dfactor > MAXSMALLINT) - error->one(FLERR, "Atoms have moved too far apart ({}) for minimum image\n", dx); + error->one(file, line, "Atoms have moved too far apart ({}) for minimum image\n", dx); dx -= xprd * static_cast(dfactor); } } } +// clang-format off /* ---------------------------------------------------------------------- return local index of atom J or any of its images that is closest to atom I if J is not a valid index like -1, just return it diff --git a/src/domain.h b/src/domain.h index 9c745f05b8..f2e6c0632e 100644 --- a/src/domain.h +++ b/src/domain.h @@ -127,10 +127,16 @@ class Domain : protected Pointers { void image_check(); void box_too_small_check(); void subbox_too_small_check(double); - void minimum_image(double &, double &, double &) const; - void minimum_image(double *delta) const { minimum_image(delta[0], delta[1], delta[2]); } - void minimum_image_big(double &, double &, double &) const; - void minimum_image_big(double *delta) const { minimum_image_big(delta[0], delta[1], delta[2]); } + void minimum_image(const std::string &, int, double &, double &, double &) const; + void minimum_image(const std::string &file, int line, double *delta) const + { + minimum_image(file, line, delta[0], delta[1], delta[2]); + } + void minimum_image_big(const std::string &, int, double &, double &, double &) const; + void minimum_image_big(const std::string &file, int line, double *delta) const + { + minimum_image_big(file, line, delta[0], delta[1], delta[2]); + } int closest_image(int, int); int closest_image(const double *const, int); void closest_image(const double *const, const double *const, double *const); @@ -185,7 +191,7 @@ class Domain : protected Pointers { // but is a far-away image that should be treated as an unbonded neighbor // inline since called from neighbor build inner loop - inline int minimum_image_check(double dx, double dy, double dz) + inline int minimum_image_check(double dx, double dy, double dz) const { if (xperiodic && fabs(dx) > xprd_half) return 1; if (yperiodic && fabs(dy) > yprd_half) return 1; diff --git a/src/dump_image.cpp b/src/dump_image.cpp index 609223a9ec..83f4999f43 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1245,7 +1245,7 @@ void DumpImage::create_image() delz = x[atom2][2] - x[atom1][2]; if (bcolor == ATOM || domain->minimum_image_check(delx,dely,delz)) { - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); xmid[0] = x[atom1][0] + 0.5*delx; xmid[1] = x[atom1][1] + 0.5*dely; xmid[2] = x[atom1][2] + 0.5*delz; diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index 66d03a76cf..f1c80f42a4 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -401,7 +401,7 @@ void FixDeposit::pre_exchange() delx = coord[0] - x[i][0]; dely = coord[1] - x[i][1]; delz = 0.0; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); if (dimension == 2) rsq = delx*delx; else rsq = delx*delx + dely*dely; if (rsq > deltasq) continue; @@ -476,7 +476,7 @@ void FixDeposit::pre_exchange() delx = coords[m][0] - x[i][0]; dely = coords[m][1] - x[i][1]; delz = coords[m][2] - x[i][2]; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; if (rsq < nearsq) flag = 1; } diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 05aaf321a7..608708ce6d 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -273,7 +273,7 @@ void FixIndent::post_force(int /*vflag*/) delx = x[i][0] - ctr[0]; dely = x[i][1] - ctr[1]; delz = x[i][2] - ctr[2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); r = sqrt(delx * delx + dely * dely + delz * delz); if (side == OUTSIDE) { dr = r - radius; @@ -313,7 +313,7 @@ void FixIndent::post_force(int /*vflag*/) if (mask[i] & groupbit) { double del[3] = {x[i][0] - ctr[0], x[i][1] - ctr[1], x[i][2] - ctr[2]}; del[cdim] = 0; - domain->minimum_image(del[0], del[1], del[2]); + domain->minimum_image(FLERR, del[0], del[1], del[2]); r = sqrt(del[0] * del[0] + del[1] * del[1] + del[2] * del[2]); if (side == OUTSIDE) { dr = r - radius; @@ -360,7 +360,7 @@ void FixIndent::post_force(int /*vflag*/) delx = x[i][0] - ctr[0]; dely = x[i][1] - ctr[1]; delz = x[i][2] - ctr[2]; - domain->minimum_image(delx, dely, delz); + domain->minimum_image(FLERR, delx, dely, delz); double x0[3] = {delx + ctr[0], dely + ctr[1], delz + ctr[2]}; r = sqrt(delx * delx + dely * dely + delz * delz); diff --git a/src/fix_minimize.cpp b/src/fix_minimize.cpp index e011c79d9d..5b537303dd 100644 --- a/src/fix_minimize.cpp +++ b/src/fix_minimize.cpp @@ -119,7 +119,7 @@ void FixMinimize::reset_coords() dx = dx0 = x[i][0] - x0[n]; dy = dy0 = x[i][1] - x0[n+1]; dz = dz0 = x[i][2] - x0[n+2]; - domain->minimum_image(dx,dy,dz); + domain->minimum_image(FLERR, dx,dy,dz); if (dx != dx0) x0[n] = x[i][0] - dx; if (dy != dy0) x0[n+1] = x[i][1] - dy; if (dz != dz0) x0[n+2] = x[i][2] - dz; diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 9b157ee90f..8900d68a3c 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -284,7 +284,7 @@ void FixRestrain::restrain_bond(int m) delx = x[i1][0] - x[i2][0]; dely = x[i1][1] - x[i2][1]; delz = x[i1][2] - x[i2][2]; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -357,7 +357,7 @@ void FixRestrain::restrain_lbound(int m) delx = x[i1][0] - x[i2][0]; dely = x[i1][1] - x[i2][1]; delz = x[i1][2] - x[i2][2]; - domain->minimum_image(delx,dely,delz); + domain->minimum_image(FLERR, delx,dely,delz); rsq = delx*delx + dely*dely + delz*delz; r = sqrt(rsq); @@ -442,7 +442,7 @@ void FixRestrain::restrain_angle(int m) delx1 = x[i1][0] - x[i2][0]; dely1 = x[i1][1] - x[i2][1]; delz1 = x[i1][2] - x[i2][2]; - domain->minimum_image(delx1,dely1,delz1); + domain->minimum_image(FLERR, delx1,dely1,delz1); rsq1 = delx1*delx1 + dely1*dely1 + delz1*delz1; r1 = sqrt(rsq1); @@ -452,7 +452,7 @@ void FixRestrain::restrain_angle(int m) delx2 = x[i3][0] - x[i2][0]; dely2 = x[i3][1] - x[i2][1]; delz2 = x[i3][2] - x[i2][2]; - domain->minimum_image(delx2,dely2,delz2); + domain->minimum_image(FLERR, delx2,dely2,delz2); rsq2 = delx2*delx2 + dely2*dely2 + delz2*delz2; r2 = sqrt(rsq2); @@ -564,26 +564,26 @@ void FixRestrain::restrain_dihedral(int m) vb1x = x[i1][0] - x[i2][0]; vb1y = x[i1][1] - x[i2][1]; vb1z = x[i1][2] - x[i2][2]; - domain->minimum_image(vb1x,vb1y,vb1z); + domain->minimum_image(FLERR, vb1x,vb1y,vb1z); // 2nd bond vb2x = x[i3][0] - x[i2][0]; vb2y = x[i3][1] - x[i2][1]; vb2z = x[i3][2] - x[i2][2]; - domain->minimum_image(vb2x,vb2y,vb2z); + domain->minimum_image(FLERR, vb2x,vb2y,vb2z); vb2xm = -vb2x; vb2ym = -vb2y; vb2zm = -vb2z; - domain->minimum_image(vb2xm,vb2ym,vb2zm); + domain->minimum_image(FLERR, vb2xm,vb2ym,vb2zm); // 3rd bond vb3x = x[i4][0] - x[i3][0]; vb3y = x[i4][1] - x[i3][1]; vb3z = x[i4][2] - x[i3][2]; - domain->minimum_image(vb3x,vb3y,vb3z); + domain->minimum_image(FLERR, vb3x,vb3y,vb3z); ax = vb1y*vb2zm - vb1z*vb2ym; ay = vb1z*vb2xm - vb1x*vb2zm; diff --git a/src/fix_set.cpp b/src/fix_set.cpp new file mode 100644 index 0000000000..ac4400c1a9 --- /dev/null +++ b/src/fix_set.cpp @@ -0,0 +1,85 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "fix_set.h" + +#include "atom.h" +#include "error.h" +#include "set.h" +#include "update.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +enum{SETCOMMAND,FIXSET}; // also used in Set class + +/* ---------------------------------------------------------------------- */ + +FixSet::FixSet(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) +{ + if (narg < 8) error->all(FLERR, 1, "Illegal fix set command: need at least eight arguments"); + + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + if (nevery <= 0) error->all(FLERR, "Fix {} Nevery must be > 0", style); + + reneighbor = utils::inumeric(FLERR, arg[4], false, lmp); + if (reneighbor < 0 || reneighbor > 1) + error->all(FLERR, "Fix {} rnflag must be 0/1", style); + + // create instance of Set class + + set = new Set(lmp); + + // pass remaining args to Set class + // only keywords which use per-atom variables are currently allowed + // NOTE: could also allow when set style = region, + // since atoms may move in/out of regions + + set->process_args(FIXSET,narg-5,&arg[5]); +} + +/* ---------------------------------------------------------------------- */ + +FixSet::~FixSet() +{ + delete set; +} + +/* ---------------------------------------------------------------------- */ + +int FixSet::setmask() +{ + int mask = 0; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- + use the Set instance to update per-atom properties + NOTE: could return count of updated atoms from Set for use as fix output +---------------------------------------------------------------------- */ + +void FixSet::end_of_step() +{ + // select which atoms to act on + + set->selection(atom->nlocal); + + // loop over list of actions to reset atom attributes + + set->invoke_actions(); + + // trigger reneighboring on next timestep if requested + + if (reneighbor) next_reneighbor = update->ntimestep + 1; +} diff --git a/src/fix_set.h b/src/fix_set.h new file mode 100644 index 0000000000..7328ebd144 --- /dev/null +++ b/src/fix_set.h @@ -0,0 +1,43 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(set,FixSet); +// clang-format on +#else + +#ifndef LMP_FIX_SET_H +#define LMP_FIX_SET_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixSet : public Fix { + public: + FixSet(class LAMMPS *, int, char **); + ~FixSet() override; + int setmask() override; + void end_of_step() override; + + private: + int reneighbor; + + class Set *set; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/fmt/core.h b/src/fmt/core.h index 6a53b8c52c..d715fe18ac 100644 --- a/src/fmt/core.h +++ b/src/fmt/core.h @@ -219,6 +219,9 @@ # define FMT_UNICODE !FMT_MSC_VERSION #endif +// LAMMPS customization: avoid problems with consteval altogether +#define FMT_CONSTEVAL + #ifndef FMT_CONSTEVAL # if ((FMT_GCC_VERSION >= 1000 || FMT_CLANG_VERSION >= 1101) && \ (!defined(__apple_build_version__) || \ diff --git a/src/input.cpp b/src/input.cpp index bc9a55052c..ae2c9f0874 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -585,7 +585,6 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) int i,n,paren_count,nchars; char immediate[256]; char *var,*value,*beyond; - int quoteflag = 0; char *ptrmatch; char *ptr = str; @@ -599,7 +598,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // variable substitution - if (*ptr == '$' && !quoteflag) { + if (*ptr == '$') { // value = ptr to expanded variable // variable name between curly braces, e.g. ${a} diff --git a/src/ntopo.cpp b/src/ntopo.cpp index a6c7a199e2..7358e7d72f 100644 --- a/src/ntopo.cpp +++ b/src/ntopo.cpp @@ -109,7 +109,7 @@ void NTopo::bond_check() dxstart = dx = x[i][0] - x[j][0]; dystart = dy = x[i][1] - x[j][1]; dzstart = dz = x[i][2] - x[j][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; } @@ -138,17 +138,17 @@ void NTopo::angle_check() dxstart = dx = x[i][0] - x[j][0]; dystart = dy = x[i][1] - x[j][1]; dzstart = dz = x[i][2] - x[j][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[i][0] - x[k][0]; dystart = dy = x[i][1] - x[k][1]; dzstart = dz = x[i][2] - x[k][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[j][0] - x[k][0]; dystart = dy = x[j][1] - x[k][1]; dzstart = dz = x[j][2] - x[k][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; } @@ -178,32 +178,32 @@ void NTopo::dihedral_check(int nlist, int **list) dxstart = dx = x[i][0] - x[j][0]; dystart = dy = x[i][1] - x[j][1]; dzstart = dz = x[i][2] - x[j][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[i][0] - x[k][0]; dystart = dy = x[i][1] - x[k][1]; dzstart = dz = x[i][2] - x[k][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[i][0] - x[l][0]; dystart = dy = x[i][1] - x[l][1]; dzstart = dz = x[i][2] - x[l][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[j][0] - x[k][0]; dystart = dy = x[j][1] - x[k][1]; dzstart = dz = x[j][2] - x[k][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[j][0] - x[l][0]; dystart = dy = x[j][1] - x[l][1]; dzstart = dz = x[j][2] - x[l][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; dxstart = dx = x[k][0] - x[l][0]; dystart = dy = x[k][1] - x[l][1]; dzstart = dz = x[k][2] - x[l][2]; - domain->minimum_image(dx, dy, dz); + domain->minimum_image(FLERR, dx, dy, dz); if (dx != dxstart || dy != dystart || dz != dzstart) flag = 1; } diff --git a/src/read_data.cpp b/src/read_data.cpp index cf7b224db2..1afcd76dac 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -174,13 +174,13 @@ void ReadData::command(int narg, char **arg) addflag = VALUE; bigint offset = utils::bnumeric(FLERR, arg[iarg + 1], false, lmp); if (offset > MAXTAGINT) - error->all(FLERR, "Read data add IDoffset {} is too big", offset); + error->all(FLERR, iarg, "Read data add IDoffset {} is too big", offset); id_offset = offset; if (atom->molecule_flag) { offset = utils::bnumeric(FLERR, arg[iarg + 2], false, lmp); if (offset > MAXTAGINT) - error->all(FLERR, "Read data add MOLoffset {} is too big", offset); + error->all(FLERR, iarg, "Read data add MOLoffset {} is too big", offset); mol_offset = offset; iarg++; } @@ -195,7 +195,7 @@ void ReadData::command(int narg, char **arg) doffset = utils::inumeric(FLERR, arg[iarg + 4], false, lmp); ioffset = utils::inumeric(FLERR, arg[iarg + 5], false, lmp); if (toffset < 0 || boffset < 0 || aoffset < 0 || doffset < 0 || ioffset < 0) - error->all(FLERR, "Illegal read_data offset value(s)"); + error->all(FLERR, iarg, "Illegal read_data offset value(s)"); iarg += 6; } else if (strcmp(arg[iarg], "shift") == 0) { if (iarg + 4 > narg) utils::missing_cmd_args(FLERR, "read_data shift", error); @@ -204,7 +204,8 @@ void ReadData::command(int narg, char **arg) shift[1] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); shift[2] = utils::numeric(FLERR, arg[iarg + 3], false, lmp); if (domain->dimension == 2 && shift[2] != 0.0) - error->all(FLERR, "Non-zero read_data shift z value for 2d simulation not allowed"); + error->all(FLERR, iarg + 2, + "Non-zero read_data shift z value for 2d simulation not allowed"); iarg += 4; } else if (strcmp(arg[iarg], "nocoeff") == 0) { coeffflag = 0; @@ -213,86 +214,92 @@ void ReadData::command(int narg, char **arg) if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/atom/types", error); extra_atom_types = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (extra_atom_types < 0) - error->all(FLERR, "Illegal read_data extra/atom/types value {}", extra_atom_types); + error->all(FLERR, iarg + 1, "Illegal read_data extra/atom/types value {}", + extra_atom_types); iarg += 2; } else if (strcmp(arg[iarg], "extra/bond/types") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/bond/types", error); if (!atom->avec->bonds_allow) - error->all(FLERR, "No bonds allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No bonds allowed with atom style {}", atom->get_style()); extra_bond_types = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (extra_bond_types < 0) - error->all(FLERR, "Illegal read_data extra/bond/types value {}", extra_bond_types); + error->all(FLERR, iarg + 1, "Illegal read_data extra/bond/types value {}", + extra_bond_types); iarg += 2; } else if (strcmp(arg[iarg], "extra/angle/types") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/angle/types", error); if (!atom->avec->angles_allow) - error->all(FLERR, "No angles allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No angles allowed with atom style {}", atom->get_style()); extra_angle_types = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (extra_angle_types < 0) - error->all(FLERR, "Illegal read_data extra/angle/types value {}", extra_angle_types); + error->all(FLERR, iarg + 1, "Illegal read_data extra/angle/types value {}", + extra_angle_types); iarg += 2; } else if (strcmp(arg[iarg], "extra/dihedral/types") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/dihedral/types", error); if (!atom->avec->dihedrals_allow) - error->all(FLERR, "No dihedrals allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No dihedrals allowed with atom style {}", atom->get_style()); extra_dihedral_types = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (extra_dihedral_types < 0) - error->all(FLERR, "Illegal read_data extra/dihedral/types value {}", extra_dihedral_types); + error->all(FLERR, iarg + 1, "Illegal read_data extra/dihedral/types value {}", + extra_dihedral_types); iarg += 2; } else if (strcmp(arg[iarg], "extra/improper/types") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/improper/types", error); if (!atom->avec->impropers_allow) - error->all(FLERR, "No impropers allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No impropers allowed with atom style {}", atom->get_style()); extra_improper_types = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (extra_improper_types < 0) - error->all(FLERR, "Illegal read_data extra/improper/types value {}", extra_improper_types); + error->all(FLERR, iarg + 1, "Illegal read_data extra/improper/types value {}", + extra_improper_types); iarg += 2; } else if (strcmp(arg[iarg], "extra/bond/per/atom") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/bond/per/atom", error); if (atom->molecular == Atom::ATOMIC) - error->all(FLERR, "No bonds allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No bonds allowed with atom style {}", atom->get_style()); atom->extra_bond_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (atom->extra_bond_per_atom < 0) - error->all(FLERR, "Illegal read_data extra/bond/per/atom value {}", + error->all(FLERR, iarg + 1, "Illegal read_data extra/bond/per/atom value {}", atom->extra_bond_per_atom); iarg += 2; } else if (strcmp(arg[iarg], "extra/angle/per/atom") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/angle/per/atom", error); if (atom->molecular == Atom::ATOMIC) - error->all(FLERR, "No angles allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No angles allowed with atom style {}", atom->get_style()); atom->extra_angle_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (atom->extra_angle_per_atom < 0) - error->all(FLERR, "Illegal read_data extra/angle/per/atom value {}", + error->all(FLERR, iarg + 1, "Illegal read_data extra/angle/per/atom value {}", atom->extra_angle_per_atom); iarg += 2; } else if (strcmp(arg[iarg], "extra/dihedral/per/atom") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/dihedral/per/atom", error); if (atom->molecular == Atom::ATOMIC) - error->all(FLERR, "No dihedrals allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No dihedrals allowed with atom style {}", atom->get_style()); atom->extra_dihedral_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (atom->extra_dihedral_per_atom < 0) - error->all(FLERR, "Illegal read_data extra/dihedral/per/atom value {}", + error->all(FLERR, iarg + 1, "Illegal read_data extra/dihedral/per/atom value {}", atom->extra_dihedral_per_atom); iarg += 2; } else if (strcmp(arg[iarg], "extra/improper/per/atom") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/improper/per/atom", error); if (atom->molecular == Atom::ATOMIC) - error->all(FLERR, "No impropers allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No impropers allowed with atom style {}", atom->get_style()); atom->extra_improper_per_atom = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (atom->extra_improper_per_atom < 0) - error->all(FLERR, "Illegal read_data extra/improper/per/atom value {}", + error->all(FLERR, iarg + 1, "Illegal read_data extra/improper/per/atom value {}", atom->extra_improper_per_atom); iarg += 2; } else if (strcmp(arg[iarg], "extra/special/per/atom") == 0) { if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "read_data extra/special/per/atom", error); if (atom->molecular == Atom::ATOMIC) - error->all(FLERR, "No bonded interactions allowed with atom style {}", atom->get_style()); + error->all(FLERR, iarg + 1, "No bonded interactions allowed with atom style {}", + atom->get_style()); force->special_extra = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (force->special_extra < 0) - error->all(FLERR, "Illegal read_data extra/special/per/atom value {}", + error->all(FLERR, iarg + 1, "Illegal read_data extra/special/per/atom value {}", force->special_extra); iarg += 2; } else if (strcmp(arg[iarg], "group") == 0) { @@ -309,12 +316,12 @@ void ReadData::command(int narg, char **arg) fix_section = (char **) memory->srealloc(fix_section, (nfix + 1) * sizeof(char *), "read_data:fix_section"); if (is_data_section(arg[iarg + 3])) - error->all(FLERR, + error->all(FLERR, iarg + 3, "Custom data section name {} for fix {} collides with existing data section", arg[iarg + 3], arg[iarg + 1]); fix_index[nfix] = modify->get_fix_by_id(arg[iarg + 1]); if (!fix_index[nfix]) - error->all(FLERR, "Fix ID {} for read_data does not exist", arg[iarg + 1]); + error->all(FLERR, iarg + 1, "Fix ID {} for read_data does not exist", arg[iarg + 1]); if (strcmp(arg[iarg + 2], "NULL") == 0) fix_header[nfix] = nullptr; else @@ -327,7 +334,7 @@ void ReadData::command(int narg, char **arg) iarg += 4; } else - error->all(FLERR, "Unknown read_data keyword {}", arg[iarg]); + error->all(FLERR, iarg, "Unknown read_data keyword {}", arg[iarg]); } // error checks @@ -339,11 +346,12 @@ void ReadData::command(int narg, char **arg) "Reading a data file with shrinkwrap boundaries is not " "compatible with a MSM KSpace style"); if (domain->box_exist && !addflag) - error->all(FLERR, "Cannot use read_data without add keyword after simulation box is defined" - + utils::errorurl(34)); + error->all(FLERR, + "Cannot use read_data without add keyword after simulation box is defined" + + utils::errorurl(34)); if (!domain->box_exist && addflag) - error->all(FLERR, "Cannot use read_data add before simulation box is defined" - + utils::errorurl(33)); + error->all(FLERR, + "Cannot use read_data add before simulation box is defined" + utils::errorurl(33)); if (offsetflag) { if (addflag == NONE) { error->all(FLERR, "Cannot use read_data offset without add keyword"); @@ -366,7 +374,7 @@ void ReadData::command(int narg, char **arg) // check if data file is available and readable if (!platform::file_is_readable(arg[0])) - error->all(FLERR, "Cannot open file {}: {}", arg[0], utils::getsyserror()); + error->all(FLERR, Error::ARGZERO, "Cannot open file {}: {}", arg[0], utils::getsyserror()); // reset so we can warn about reset image flags exactly once per data file @@ -528,7 +536,7 @@ void ReadData::command(int narg, char **arg) if (tilt_flag) triclinic = 1; } else { if (xloxhi_flag || yloyhi_flag || zlozhi_flag || tilt_flag) - error->all(FLERR, + error->all(FLERR, Error::ARGZERO, "Read_data header cannot specify simulation box lo/hi/tilt and ABC vectors"); triclinic = triclinic_general = 1; } @@ -538,10 +546,11 @@ void ReadData::command(int narg, char **arg) if (domain->dimension == 2) { if (triclinic_general == 0) { if (boxlo[2] >= 0.0 || boxhi[2] <= 0.0) - error->all(FLERR, "Read_data zlo/zhi for 2d simulation must straddle 0.0"); + error->all(FLERR, Error::ARGZERO, + "Read_data zlo/zhi for 2d simulation must straddle 0.0"); } else if (triclinic_general == 1) { if (cvec[0] != 0.0 || cvec[1] != 0.0 || cvec[2] != 1.0 || abc_origin[2] != -0.5) - error->all(FLERR, + error->all(FLERR, Error::ARGZERO, "Read_data cvec and/or abc_origin is invalid for " "2d simulation with general triclinic box"); } @@ -619,7 +628,8 @@ void ReadData::command(int narg, char **arg) if (triclinic_general) { if (!domain->triclinic_general) - error->all(FLERR, "Read_data subsequent file cannot switch to general triclinic"); + error->all(FLERR, Error::ARGZERO, + "Read_data subsequent file cannot switch to general triclinic"); int errflag = 0; if (avec[0] != domain->avec[0] || avec[1] != domain->avec[1] || avec[2] != domain->avec[2]) errflag = 1; @@ -631,7 +641,8 @@ void ReadData::command(int narg, char **arg) abc_origin[2] != domain->boxlo[2]) errflag = 1; if (errflag) - error->all(FLERR, "Read_data subsequent file ABC vectors must be same as first file"); + error->all(FLERR, Error::ARGZERO, + "Read_data subsequent file ABC vectors must be same as first file"); if (shift[0] != 0.0 || shift[1] != 0.0 || shift[2] != 0.0) error->all(FLERR, "Read_data subsequent file with ABC vectors cannot define shift"); @@ -640,13 +651,15 @@ void ReadData::command(int narg, char **arg) } else if (triclinic) { if (!domain->triclinic || domain->triclinic_general) - error->all(FLERR, "Read_data subsequent file cannot switch to restricted triclinic"); + error->all(FLERR, Error::ARGZERO, + "Read_data subsequent file cannot switch to restricted triclinic"); if (xy != domain->xy || xz != domain->xz || yz != domain->yz) error->all(FLERR, "Read_data subsequent file tilt factors must be same as first file"); } else { if (domain->triclinic) - error->all(FLERR, "Read_data subsequent file cannot switch to orthogonal"); + error->all(FLERR, Error::ARGZERO, + "Read_data subsequent file cannot switch to orthogonal"); } double oldboxlo[3] = {domain->boxlo[0], domain->boxlo[1], domain->boxlo[2]}; @@ -715,7 +728,7 @@ void ReadData::command(int narg, char **arg) skip_lines(natoms); } else if (strcmp(keyword, "Velocities") == 0) { - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Velocities"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Velocities"); if (firstpass) velocities(); else @@ -723,32 +736,35 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Bonds") == 0) { topoflag = bondflag = 1; - if (nbonds == 0) error->all(FLERR, "Invalid data file section: Bonds"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Bonds"); + if (nbonds == 0) error->all(FLERR, Error::ARGZERO, "Invalid data file section: Bonds"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Bonds"); bonds(firstpass); } else if (strcmp(keyword, "Angles") == 0) { topoflag = angleflag = 1; - if (nangles == 0) error->all(FLERR, "Invalid data file section: Angles"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Angles"); + if (nangles == 0) error->all(FLERR, Error::ARGZERO, "Invalid data file section: Angles"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Angles"); angles(firstpass); } else if (strcmp(keyword, "Dihedrals") == 0) { topoflag = dihedralflag = 1; - if (ndihedrals == 0) error->all(FLERR, "Invalid data file section: Dihedrals"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Dihedrals"); + if (ndihedrals == 0) + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Dihedrals"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Dihedrals"); dihedrals(firstpass); } else if (strcmp(keyword, "Impropers") == 0) { topoflag = improperflag = 1; - if (nimpropers == 0) error->all(FLERR, "Invalid data file section: Impropers"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Impropers"); + if (nimpropers == 0) + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Impropers"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Impropers"); impropers(firstpass); } else if (strcmp(keyword, "Ellipsoids") == 0) { ellipsoidflag = 1; - if (!avec_ellipsoid) error->all(FLERR, "Invalid data file section: Ellipsoids"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Ellipsoids"); + if (!avec_ellipsoid) + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Ellipsoids"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Ellipsoids"); if (firstpass) bonus(nellipsoids, (AtomVec *) avec_ellipsoid, "ellipsoids"); else @@ -756,8 +772,8 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Lines") == 0) { lineflag = 1; - if (!avec_line) error->all(FLERR, "Invalid data file section: Lines"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Lines"); + if (!avec_line) error->all(FLERR, Error::ARGZERO, "Invalid data file section: Lines"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Lines"); if (firstpass) bonus(nlines, (AtomVec *) avec_line, "lines"); else @@ -765,8 +781,8 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Triangles") == 0) { triflag = 1; - if (!avec_tri) error->all(FLERR, "Invalid data file section: Triangles"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Triangles"); + if (!avec_tri) error->all(FLERR, Error::ARGZERO, "Invalid data file section: Triangles"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Triangles"); if (firstpass) bonus(ntris, (AtomVec *) avec_tri, "triangles"); else @@ -774,8 +790,8 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Bodies") == 0) { bodyflag = 1; - if (!avec_body) error->all(FLERR, "Invalid data file section: Bodies"); - if (atomflag == 0) error->all(FLERR, "Must read Atoms before Bodies"); + if (!avec_body) error->all(FLERR, Error::ARGZERO, "Invalid data file section: Bodies"); + if (atomflag == 0) error->all(FLERR, Error::ARGZERO, "Must read Atoms before Bodies"); bodies(firstpass, (AtomVec *) avec_body); } else if (strcmp(keyword, "Masses") == 0) { @@ -784,7 +800,8 @@ void ReadData::command(int narg, char **arg) else skip_lines(ntypes); } else if (strcmp(keyword, "Pair Coeffs") == 0) { - if (force->pair == nullptr) error->all(FLERR, "Must define pair_style before Pair Coeffs"); + if (force->pair == nullptr) + error->all(FLERR, Error::ARGZERO, "Must define pair_style before Pair Coeffs"); if (firstpass) { if (me == 0 && !style_match(style, force->pair_style)) error->warning( @@ -795,7 +812,7 @@ void ReadData::command(int narg, char **arg) skip_lines(ntypes); } else if (strcmp(keyword, "PairIJ Coeffs") == 0) { if (force->pair == nullptr) - error->all(FLERR, "Must define pair_style before PairIJ Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define pair_style before PairIJ Coeffs"); if (firstpass) { if (me == 0 && !style_match(style, force->pair_style)) error->warning( @@ -806,8 +823,9 @@ void ReadData::command(int narg, char **arg) skip_lines(ntypes * (ntypes + 1) / 2); } else if (strcmp(keyword, "Bond Coeffs") == 0) { if (atom->avec->bonds_allow == 0) - error->all(FLERR, "Invalid data file section: Bond Coeffs"); - if (force->bond == nullptr) error->all(FLERR, "Must define bond_style before Bond Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Bond Coeffs"); + if (force->bond == nullptr) + error->all(FLERR, Error::ARGZERO, "Must define bond_style before Bond Coeffs"); if (firstpass) { if (me == 0 && !style_match(style, force->bond_style)) error->warning( @@ -818,9 +836,9 @@ void ReadData::command(int narg, char **arg) skip_lines(nbondtypes); } else if (strcmp(keyword, "Angle Coeffs") == 0) { if (atom->avec->angles_allow == 0) - error->all(FLERR, "Invalid data file section: Angle Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Angle Coeffs"); if (force->angle == nullptr) - error->all(FLERR, "Must define angle_style before Angle Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define angle_style before Angle Coeffs"); if (firstpass) { if (me == 0 && !style_match(style, force->angle_style)) error->warning( @@ -831,9 +849,9 @@ void ReadData::command(int narg, char **arg) skip_lines(nangletypes); } else if (strcmp(keyword, "Dihedral Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, "Invalid data file section: Dihedral Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Dihedral Coeffs"); if (force->dihedral == nullptr) - error->all(FLERR, "Must define dihedral_style before Dihedral Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define dihedral_style before Dihedral Coeffs"); if (firstpass) { if (me == 0 && !style_match(style, force->dihedral_style)) error->warning( @@ -845,9 +863,9 @@ void ReadData::command(int narg, char **arg) skip_lines(ndihedraltypes); } else if (strcmp(keyword, "Improper Coeffs") == 0) { if (atom->avec->impropers_allow == 0) - error->all(FLERR, "Invalid data file section: Improper Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: Improper Coeffs"); if (force->improper == nullptr) - error->all(FLERR, "Must define improper_style before Improper Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define improper_style before Improper Coeffs"); if (firstpass) { if (me == 0 && !style_match(style, force->improper_style)) error->warning( @@ -860,9 +878,9 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "BondBond Coeffs") == 0) { if (atom->avec->angles_allow == 0) - error->all(FLERR, "Invalid data file section: BondBond Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: BondBond Coeffs"); if (force->angle == nullptr) - error->all(FLERR, "Must define angle_style before BondBond Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define angle_style before BondBond Coeffs"); if (firstpass) anglecoeffs(1); else @@ -870,18 +888,18 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "BondAngle Coeffs") == 0) { if (atom->avec->angles_allow == 0) - error->all(FLERR, "Invalid data file section: BondAngle Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: BondAngle Coeffs"); if (force->angle == nullptr) - error->all(FLERR, "Must define angle_style before BondAngle Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define angle_style before BondAngle Coeffs"); if (firstpass) anglecoeffs(2); else skip_lines(nangletypes); } else if (strcmp(keyword, "UreyBradley Coeffs") == 0) { if (atom->avec->angles_allow == 0) - error->all(FLERR, "Invalid data file section: UreyBradley Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: UreyBradley Coeffs"); if (force->angle == nullptr) - error->all(FLERR, "Must define angle_style before UreyBradley Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define angle_style before UreyBradley Coeffs"); if (firstpass) anglecoeffs(3); else @@ -889,9 +907,10 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "MiddleBondTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, "Invalid data file section: MiddleBondTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: MiddleBondTorsion Coeffs"); if (force->dihedral == nullptr) - error->all(FLERR, "Must define dihedral_style before MiddleBondTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, + "Must define dihedral_style before MiddleBondTorsion Coeffs"); if (firstpass) dihedralcoeffs(1); else @@ -899,9 +918,10 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "EndBondTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, "Invalid data file section: EndBondTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: EndBondTorsion Coeffs"); if (force->dihedral == nullptr) - error->all(FLERR, "Must define dihedral_style before EndBondTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, + "Must define dihedral_style before EndBondTorsion Coeffs"); if (firstpass) dihedralcoeffs(2); else @@ -909,9 +929,10 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "AngleTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, "Invalid data file section: AngleTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: AngleTorsion Coeffs"); if (force->dihedral == nullptr) - error->all(FLERR, "Must define dihedral_style before AngleTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, + "Must define dihedral_style before AngleTorsion Coeffs"); if (firstpass) dihedralcoeffs(3); else @@ -919,9 +940,10 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "AngleAngleTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, "Invalid data file section: AngleAngleTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: AngleAngleTorsion Coeffs"); if (force->dihedral == nullptr) - error->all(FLERR, "Must define dihedral_style before AngleAngleTorsion Coeffs"); + error->all(FLERR, Error::ARGZERO, + "Must define dihedral_style before AngleAngleTorsion Coeffs"); if (firstpass) dihedralcoeffs(4); else @@ -929,9 +951,9 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "BondBond13 Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, "Invalid data file section: BondBond13 Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: BondBond13 Coeffs"); if (force->dihedral == nullptr) - error->all(FLERR, "Must define dihedral_style before BondBond13 Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define dihedral_style before BondBond13 Coeffs"); if (firstpass) dihedralcoeffs(5); else @@ -939,9 +961,9 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "AngleAngle Coeffs") == 0) { if (atom->avec->impropers_allow == 0) - error->all(FLERR, "Invalid data file section: AngleAngle Coeffs"); + error->all(FLERR, Error::ARGZERO, "Invalid data file section: AngleAngle Coeffs"); if (force->improper == nullptr) - error->all(FLERR, "Must define improper_style before AngleAngle Coeffs"); + error->all(FLERR, Error::ARGZERO, "Must define improper_style before AngleAngle Coeffs"); if (firstpass) impropercoeffs(1); else @@ -949,7 +971,8 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Atom Type Labels") == 0) { if (firstpass) { - if (atomflag == 1) error->all(FLERR, "Must read Atom Type Labels before Atoms"); + if (atomflag == 1) + error->all(FLERR, Error::ARGZERO, "Must read Atom Type Labels before Atoms"); tlabelflag = 1; typelabels(Atom::ATOM); } else @@ -958,7 +981,8 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Bond Type Labels") == 0) { if (nbondtypes) { if (firstpass) { - if (bondflag == 1) error->all(FLERR, "Must read Bond Type Labels before Bonds"); + if (bondflag == 1) + error->all(FLERR, Error::ARGZERO, "Must read Bond Type Labels before Bonds"); blabelflag = 1; typelabels(Atom::BOND); } else @@ -968,7 +992,8 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword, "Angle Type Labels") == 0) { if (nangletypes) { if (firstpass) { - if (angleflag == 1) error->all(FLERR, "Must read Angle Type Labels before Angles"); + if (angleflag == 1) + error->all(FLERR, Error::ARGZERO, "Must read Angle Type Labels before Angles"); alabelflag = 1; typelabels(Atom::ANGLE); } else @@ -979,7 +1004,7 @@ void ReadData::command(int narg, char **arg) if (ndihedraltypes) { if (firstpass) { if (dihedralflag == 1) - error->all(FLERR, "Must read Dihedral Type Labels before Dihedrals"); + error->all(FLERR, Error::ARGZERO, "Must read Dihedral Type Labels before Dihedrals"); dlabelflag = 1; typelabels(Atom::DIHEDRAL); } else @@ -990,7 +1015,7 @@ void ReadData::command(int narg, char **arg) if (nimpropertypes) { if (firstpass) { if (improperflag == 1) - error->all(FLERR, "Must read Improper Type Labels before Impropers"); + error->all(FLERR, Error::ARGZERO, "Must read Improper Type Labels before Impropers"); ilabelflag = 1; typelabels(Atom::IMPROPER); } else @@ -1013,17 +1038,20 @@ void ReadData::command(int narg, char **arg) break; } if (i == nfix) - error->all(FLERR, "Unknown identifier in data file: {}{}", keyword, utils::errorurl(1)); + error->all(FLERR, Error::ARGZERO, "Unknown identifier in data file: {}{}", keyword, + utils::errorurl(1)); } else - error->all(FLERR, "Unknown identifier in data file: {}{}", keyword, utils::errorurl(1)); + error->all(FLERR, Error::ARGZERO, "Unknown identifier in data file: {}{}", keyword, + utils::errorurl(1)); parse_keyword(0); } // error if natoms > 0 yet no atoms were read - if (natoms > 0 && atomflag == 0) error->all(FLERR, "No valid atoms found in data file"); + if (natoms > 0 && atomflag == 0) + error->all(FLERR, Error::ARGZERO, "No valid atoms found in data file"); // close file diff --git a/src/set.cpp b/src/set.cpp index 7ae41e9246..f42dd175ab 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -42,739 +42,418 @@ using namespace LAMMPS_NS; using namespace MathConst; +enum{SETCOMMAND,FIXSET}; // also used in FixSet class + enum{ATOM_SELECT,MOL_SELECT,TYPE_SELECT,GROUP_SELECT,REGION_SELECT}; -enum{TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET, - MOLECULE,X,Y,Z,VX,VY,VZ,CHARGE,MASS,SHAPE,LENGTH,TRI, - DIPOLE,DIPOLE_RANDOM,SPIN_ATOM,SPIN_RANDOM,SPIN_ELECTRON,RADIUS_ELECTRON, - QUAT,QUAT_RANDOM,THETA,THETA_RANDOM,ANGMOM,OMEGA,TEMPERATURE, - DIAMETER,RADIUS_ATOM,DENSITY,VOLUME,IMAGE,BOND,ANGLE,DIHEDRAL,IMPROPER, - RHEO_STATUS,SPH_E,SPH_CV,SPH_RHO,EDPD_TEMP,EDPD_CV,CC,SMD_MASS_DENSITY, - SMD_CONTACT_RADIUS,DPDTHETA,EPSILON,IVEC,DVEC,IARRAY,DARRAY}; +enum{ANGLE,ANGMOM,BOND,CC,CHARGE,DENSITY,DIAMETER,DIHEDRAL,DIPOLE, + DIPOLE_RANDOM,DPD_THETA,EDPD_CV,EDPD_TEMP,EPSILON,IMAGE,IMPROPER,LENGTH, + MASS,MOLECULE,OMEGA,QUAT,QUAT_RANDOM,RADIUS_ELECTRON,SHAPE, + SMD_CONTACT_RADIUS,SMD_MASS_DENSITY,SPH_CV,SPH_E,SPH_RHO, + SPIN_ATOM,SPIN_ATOM_RANDOM,SPIN_ELECTRON,TEMPERATURE,THETA,THETA_RANDOM, + TRI,TYPE,TYPE_FRACTION,TYPE_RATIO,TYPE_SUBSET,VOLUME,VX,VY,VZ,X,Y,Z, + IVEC,DVEC,IARRAY,DARRAY}; + +#define DELTA 4 + +/* ---------------------------------------------------------------------- */ + +Set::Set(class LAMMPS *lmp) : + Command(lmp), id(nullptr), region(nullptr), actions(nullptr), invoke_choice(nullptr), + vec1(nullptr), vec2(nullptr), vec3(nullptr), vec4(nullptr), select(nullptr) +{ + maxselect = maxvariable = 0; +} + +/* ---------------------------------------------------------------------- */ + +Set::~Set() +{ + memory->sfree(actions); + memory->sfree(invoke_choice); + + memory->destroy(select); + memory->destroy(vec1); + memory->destroy(vec2); + memory->destroy(vec3); + memory->destroy(vec4); +} /* ---------------------------------------------------------------------- */ void Set::command(int narg, char **arg) { if (domain->box_exist == 0) - error->all(FLERR, Error::NOLASTLINE, "Set command before simulation box is defined" - + utils::errorurl(0)); + error->all(FLERR, Error::NOLASTLINE, + "Set command before simulation box is defined" + utils::errorurl(0)); if (atom->natoms == 0) error->all(FLERR, Error::NOLASTLINE, "Set command on system without atoms"); if (narg < 4) error->all(FLERR, 1, "Illegal set command: need at least four arguments"); - // style and ID info + process_args(SETCOMMAND, narg, arg); - if (strcmp(arg[0],"atom") == 0) style = ATOM_SELECT; - else if (strcmp(arg[0],"mol") == 0) style = MOL_SELECT; - else if (strcmp(arg[0],"type") == 0) style = TYPE_SELECT; - else if (strcmp(arg[0],"group") == 0) style = GROUP_SELECT; - else if (strcmp(arg[0],"region") == 0) style = REGION_SELECT; - else error->all(FLERR, Error::ARGZERO, "Unknown set command style: {}", arg[0]); + if (comm->me == 0) utils::logmesg(lmp, "Setting atom values ...\n"); + + // select which atoms to act on - id = utils::strdup(arg[1]); - select = nullptr; selection(atom->nlocal); - // loop over keyword/value pairs - // call appropriate routine to reset attributes + // loop over list of actions to reset atom attributes - if (comm->me == 0) utils::logmesg(lmp,"Setting atom values ...\n"); + invoke_actions(); - int allcount,origarg; + // print stats for each action + // for CC option, include species index + + bigint bcount, allcount; + + for (int i = 0; i < naction; i++) { + Action *action = &actions[i]; + int iarg = action->argindex; + + if (action->count_action < 0) { + bcount = action->count_select; + } else { + bcount = action->count_action; + } + MPI_Allreduce(&bcount, &allcount, 1, MPI_LMP_BIGINT, MPI_SUM, world); + + if (comm->me == 0) { + if (strcmp(arg[iarg], "cc") == 0) { + utils::logmesg(lmp, " {} settings made for {} index {}\n", allcount, arg[iarg], + arg[iarg + 1]); + } else { + utils::logmesg(lmp, " {} settings made for {}\n", allcount, arg[iarg]); + } + } + } +} + +/* ---------------------------------------------------------------------- + process args of set command or fix set command +------------------------------------------------------------------------- */ + +void Set::process_args(int caller_flag, int narg, char **arg) +{ + caller = caller_flag; + + // style and ID info + + id = utils::strdup(arg[1]); + + if (strcmp(arg[0], "atom") == 0) { + style = ATOM_SELECT; + if (atom->tag_enable == 0) error->all(FLERR, "Cannot use set atom with no atom IDs defined"); + utils::bounds(FLERR, id, 1, MAXTAGINT, nlobig, nhibig, error); + + } else if (strcmp(arg[0], "mol") == 0) { + style = MOL_SELECT; + if (atom->molecule_flag == 0) + error->all(FLERR, "Cannot use set mol with no molecule IDs defined"); + utils::bounds(FLERR, id, 1, MAXTAGINT, nlobig, nhibig, error); + + } else if (strcmp(arg[0], "type") == 0) { + style = TYPE_SELECT; + if (char *typestr = utils::expand_type(FLERR, id, Atom::ATOM, lmp)) { + delete[] id; + id = typestr; + } + utils::bounds(FLERR, id, 1, atom->ntypes, nlo, nhi, error); + + } else if (strcmp(arg[0], "group") == 0) { + style = GROUP_SELECT; + int igroup = group->find(id); + if (igroup == -1) error->all(FLERR, "Could not find set group ID {}", id); + groupbit = group->bitmask[igroup]; + + } else if (strcmp(arg[0], "region") == 0) { + style = REGION_SELECT; + region = domain->get_region_by_id(id); + if (!region) error->all(FLERR, "Set region {} does not exist", id); + + } else + error->all(FLERR, "Unknown set or fix set command style: {}", arg[0]); + + delete[] id; + + // loop over remaining keyword/value pairs to create list of actions + // one action = keyword/value pair + + naction = maxaction = 0; + actions = nullptr; + Action *action; int iarg = 2; while (iarg < narg) { - varflag = varflag1 = varflag2 = varflag3 = varflag4 = 0; - count = 0; - origarg = iarg; - if (strcmp(arg[iarg],"type") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set type", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1], 1); - else ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp); - set(TYPE); - iarg += 2; + // grow list of actions if needed - } else if (strcmp(arg[iarg],"type/fraction") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/fraction", error); - newtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp); - fraction = utils::numeric(FLERR, arg[iarg+2], false, lmp); - ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp); - if (newtype <= 0 || newtype > atom->ntypes) - error->all(FLERR, iarg + 1, "Invalid type value {} in set type/fraction command", newtype); - if (fraction < 0.0 || fraction > 1.0) - error->all(FLERR, iarg + 2, "Invalid fraction value {} in set type/fraction command", - fraction); - if (ivalue <= 0) - error->all(FLERR, iarg + 3, "Invalid random number seed {} in set type/fraction command", - ivalue); - setrandom(TYPE_FRACTION); - iarg += 4; - - } else if (strcmp(arg[iarg],"type/ratio") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/ratio", error); - newtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp); - fraction = utils::numeric(FLERR, arg[iarg+2], false, lmp); - ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp); - if (newtype <= 0 || newtype > atom->ntypes) - error->all(FLERR, iarg + 1, "Invalid type value {} in set type/ratio command", newtype); - if (fraction < 0.0 || fraction > 1.0) - error->all(FLERR, iarg + 2, "Invalid fraction value {} in set type/ratio command", - fraction); - if (ivalue <= 0) - error->all(FLERR, iarg + 3, "Invalid random number seed {} in set type/ratio command", - ivalue); - setrandom(TYPE_RATIO); - iarg += 4; - - } else if (strcmp(arg[iarg],"type/subset") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/subset", error); - newtype = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ATOM, lmp); - nsubset = utils::bnumeric(FLERR, arg[iarg+2], false, lmp); - ivalue = utils::inumeric(FLERR, arg[iarg+3], false, lmp); - if (newtype <= 0 || newtype > atom->ntypes) - error->all(FLERR, iarg + 1, "Invalid type value {} in set type/subset command", newtype); - if (nsubset < 0) - error->all(FLERR, iarg + 2, "Invalid subset size {} in set type/subset command", nsubset); - if (ivalue <= 0) - error->all(FLERR, iarg + 3, "Invalid random number seed {} in set type/subset command", - ivalue); - setrandom(TYPE_SUBSET); - iarg += 4; - - } else if (strcmp(arg[iarg],"mol") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set mol", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->molecule_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(MOLECULE); - iarg += 2; - - } else if (strcmp(arg[iarg],"x") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set x", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - set(X); - iarg += 2; - - } else if (strcmp(arg[iarg],"y") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set y", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - set(Y); - iarg += 2; - - } else if (strcmp(arg[iarg],"z") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set z", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - set(Z); - iarg += 2; - - } else if (strcmp(arg[iarg],"vx") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vx", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - set(VX); - iarg += 2; - - } else if (strcmp(arg[iarg],"vy") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vy", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - set(VY); - iarg += 2; - - } else if (strcmp(arg[iarg],"vz") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vz", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - set(VZ); - iarg += 2; - - } else if (strcmp(arg[iarg],"charge") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set charge", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->q_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(CHARGE); - iarg += 2; - - } else if (strcmp(arg[iarg],"mass") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set mass", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->rmass_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(MASS); - iarg += 2; - - } else if (strcmp(arg[iarg],"shape") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set shape", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); - if (!atom->ellipsoid_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SHAPE); - iarg += 4; - - } else if (strcmp(arg[iarg],"length") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set length", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->line_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(LENGTH); - iarg += 2; - - } else if (strcmp(arg[iarg],"tri") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set tri", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->tri_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(TRI); - iarg += 2; - - } else if (strcmp(arg[iarg],"dipole") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set dipole", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); - if (!atom->mu_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(DIPOLE); - iarg += 4; - - } else if (strcmp(arg[iarg],"dipole/random") == 0) { - if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set dipole/random", error); - ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (!atom->mu_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0) - error->all(FLERR, iarg + 1, "Invalid random number seed in set command"); - if (dvalue <= 0.0) - error->all(FLERR, iarg + 2, "Invalid dipole length in set command"); - setrandom(DIPOLE_RANDOM); - iarg += 3; - - } else if ((strcmp(arg[iarg],"spin") == 0) || (strcmp(arg[iarg],"spin/atom") == 0)) { - if ((strcmp(arg[iarg],"spin") == 0) && (comm->me == 0)) - error->warning(FLERR, "Set attribute spin is deprecated. Please use spin/atom instead."); - if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "set spin/atom", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else xvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - else yvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); - if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4); - else zvalue = utils::numeric(FLERR,arg[iarg+4],false,lmp); - if ((xvalue == 0.0) && (yvalue == 0.0) && (zvalue == 0.0)) - error->all(FLERR, Error::NOPOINTER, "At least one spin vector component must be non-zero"); - if (!atom->sp_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (dvalue <= 0.0) - error->all(FLERR, iarg + 1, "Invalid spin magnitude {} in set {} command", dvalue, - arg[iarg]); - set(SPIN_ATOM); - iarg += 5; - - } else if ((strcmp(arg[iarg],"spin/random") == 0) || - (strcmp(arg[iarg],"spin/atom/random") == 0)) { - if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set spin/atom/random", error); - ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if ((strcmp(arg[iarg],"spin/random") == 0) && (comm->me == 0)) - error->warning(FLERR, "Set attribute spin/random is deprecated. " - "Please use spin/atom/random instead."); - if (!atom->sp_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0) - error->all(FLERR, iarg + 1, "Invalid random number seed {} in set {} command", ivalue, - arg[iarg]); - if (dvalue <= 0.0) - error->all(FLERR, iarg + 2, "Invalid spin magnitude {} in set {} command", dvalue, - arg[iarg]); - setrandom(SPIN_RANDOM); - iarg += 3; - - } else if (strcmp(arg[iarg],"radius/electron") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set radius/electron", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->eradius_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(RADIUS_ELECTRON); - iarg += 2; - - } else if (strcmp(arg[iarg],"spin/electron") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set spin/electron", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->spin_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SPIN_ELECTRON); - iarg += 2; - - } else if (strcmp(arg[iarg],"quat") == 0) { - if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "set quat", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - 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 && !atom->quat_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(QUAT); - iarg += 5; - - } else if (strcmp(arg[iarg],"quat/random") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set quat/random", error); - ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0) - error->all(FLERR, iarg + 1, "Invalid random number seed in set command"); - setrandom(QUAT_RANDOM); - iarg += 2; - - } else if (strcmp(arg[iarg],"theta") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = DEG2RAD * utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->line_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(THETA); - iarg += 2; - - } else if (strcmp(arg[iarg],"theta/random") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta/random", error); - ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->line_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0) - error->all(FLERR, iarg + 1, "Invalid random number seed in set command"); - set(THETA_RANDOM); - iarg += 2; - - } else if (strcmp(arg[iarg],"angmom") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set angmom", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); - if (!atom->angmom_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(ANGMOM); - iarg += 4; - - } else if (strcmp(arg[iarg],"omega") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set omega", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else xvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else yvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - else zvalue = utils::numeric(FLERR,arg[iarg+3],false,lmp); - if (!atom->omega_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(OMEGA); - iarg += 4; - - } else if (strcmp(arg[iarg],"radius/atom") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set radius/atom", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->radius_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(RADIUS_ATOM); - iarg += 2; - - } else if (strcmp(arg[iarg],"diameter") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set diameter", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->radius_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(DIAMETER); - iarg += 2; - - } else if (strcmp(arg[iarg],"density") == 0 || - (strcmp(arg[iarg],"density/disc") == 0)) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set density", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->rmass_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (dvalue <= 0.0) error->all(FLERR, iarg + 1, "Invalid density in set command"); - discflag = 0; - if (strcmp(arg[iarg],"density/disc") == 0) { - discflag = 1; - if (domain->dimension != 2) - error->all(FLERR, Error::NOLASTLINE, "Density/disc option requires 2d simulation"); - } - set(DENSITY); - iarg += 2; - - } else if (strcmp(arg[iarg],"temperature") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->temperature_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(TEMPERATURE); - iarg += 2; - - } else if (strcmp(arg[iarg],"volume") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set volume", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->vfrac_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (dvalue <= 0.0) error->all(FLERR, iarg + 1, "Invalid volume in set command"); - set(VOLUME); - iarg += 2; - - } else if (strcmp(arg[iarg],"image") == 0) { - if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set image", error); - ximageflag = yimageflag = zimageflag = 0; - if (strcmp(arg[iarg+1],"NULL") != 0) { - ximageflag = 1; - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else ximage = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - } - if (strcmp(arg[iarg+2],"NULL") != 0) { - yimageflag = 1; - if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2); - else yimage = utils::inumeric(FLERR,arg[iarg+2],false,lmp); - } - if (strcmp(arg[iarg+3],"NULL") != 0) { - zimageflag = 1; - if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3); - else zimage = utils::inumeric(FLERR,arg[iarg+3],false,lmp); - } - if (ximageflag && ximage && !domain->xperiodic) - error->all(FLERR, iarg + 1,"Cannot set non-zero image flag for non-periodic dimension"); - if (yimageflag && yimage && !domain->yperiodic) - error->all(FLERR, iarg + 2, "Cannot set non-zero image flag for non-periodic dimension"); - if (zimageflag && zimage && !domain->zperiodic) - error->all(FLERR, iarg + 3, "Cannot set non-zero image flag for non-periodic dimension"); - set(IMAGE); - iarg += 4; - - } else if (strcmp(arg[iarg],"bond") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set bond", error); - ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::BOND, lmp); - if (atom->avec->bonds_allow == 0) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0 || ivalue > atom->nbondtypes) - error->all(FLERR, iarg + 1, "Invalid value {} in set bond command", ivalue); - topology(BOND); - iarg += 2; - - } else if (strcmp(arg[iarg],"angle") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set angle", error); - ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::ANGLE, lmp); - if (atom->avec->angles_allow == 0) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0 || ivalue > atom->nangletypes) - error->all(FLERR, iarg + 1, "Invalid value {} in set angle command", ivalue); - topology(ANGLE); - iarg += 2; - - } else if (strcmp(arg[iarg],"dihedral") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dihedral", error); - ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::DIHEDRAL, lmp); - if (atom->avec->dihedrals_allow == 0) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0 || ivalue > atom->ndihedraltypes) - error->all(FLERR, iarg + 1, "Invalid value {} in set dihedral command", ivalue); - topology(DIHEDRAL); - iarg += 2; - - } else if (strcmp(arg[iarg],"improper") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set improper", error); - ivalue = utils::expand_type_int(FLERR, arg[iarg+1], Atom::IMPROPER, lmp); - if (atom->avec->impropers_allow == 0) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - if (ivalue <= 0 || ivalue > atom->nimpropertypes) - error->all(FLERR, iarg + 1, "Invalid value {} in set improper command", ivalue); - topology(IMPROPER); - iarg += 2; - - } else if (strcmp(arg[iarg],"rheo/rho") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set rheo/rho", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->rho_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SPH_RHO); - iarg += 2; - - } else if (strcmp(arg[iarg],"rheo/status") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set rheo/status", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->rheo_status_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(RHEO_STATUS); - iarg += 2; - - } else if (strcmp(arg[iarg],"sph/e") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/e", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->esph_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SPH_E); - iarg += 2; - - } else if (strcmp(arg[iarg],"sph/cv") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/cv", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->cv_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SPH_CV); - iarg += 2; - - } else if (strcmp(arg[iarg],"sph/rho") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/rho", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->rho_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SPH_RHO); - iarg += 2; - - } else if (strcmp(arg[iarg],"edpd/temp") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set edpd/temp", error); - 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, iarg + 1, "Invalid value {} in set edpd/temp command", dvalue); - } - if (!atom->edpd_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(EDPD_TEMP); - iarg += 2; - - } else if (strcmp(arg[iarg],"edpd/cv") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set edpd/cv", error); - 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, iarg + 1, "Invalid value {} in set edpd/cv command", dvalue); - } - if (!atom->edpd_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(EDPD_CV); - iarg += 2; - - } else if (strcmp(arg[iarg],"cc") == 0) { - if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set cc", error); - if (strcmp(arg[iarg+1],"NULL") == 0) dvalue = -1.0; - else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else { - cc_index = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - dvalue = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (cc_index < 1) error->all(FLERR,"Illegal set command"); - error->all(FLERR, iarg + 1, "Invalid index value {} in set cc command", cc_index); - } - if (!atom->tdpd_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(CC); - iarg += 3; - - } else if (strcmp(arg[iarg],"smd/mass/density") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set smd/mass/density", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->smd_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SMD_MASS_DENSITY); - iarg += 2; - - } else if (strcmp(arg[iarg],"smd/contact/radius") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set smd/contact/radius", error); - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (!atom->smd_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(SMD_CONTACT_RADIUS); - iarg += 2; - - } else if (strcmp(arg[iarg],"dpd/theta") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dpd/theta", error); - 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, iarg + 1, "Invalid value {} in set dpd/theta command", dvalue); - } - if (!atom->dpd_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(DPDTHETA); - iarg += 2; - - } else if (strcmp(arg[iarg],"epsilon") == 0) { - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set epsilon", error); - 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, iarg + 1, "Invalid value {} in set epsilon command", dvalue); - } - if (!atom->dielectric_flag) - error->all(FLERR, iarg, "Cannot set attribute {} for atom style {}", arg[iarg], - atom->get_style()); - set(EPSILON); - iarg += 2; - - } else { - - // set custom per-atom vector or array or error out - - int flag,cols; - ArgInfo argi(arg[iarg],ArgInfo::DNAME|ArgInfo::INAME); - const char *pname = argi.get_name(); - if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set", error); - index_custom = atom->find_custom(argi.get_name(),flag,cols); - if (index_custom < 0) - error->all(FLERR, iarg, "Set keyword or custom property {} does not exist", pname); - - switch (argi.get_type()) { - - case ArgInfo::INAME: - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else ivalue = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - if (flag != 0) - error->all(FLERR, iarg + 1, "Set command custom property {} is not integer", pname); - - if (argi.get_dim() == 0) { - if (cols > 0) - error->all(FLERR, iarg, "Set command custom integer property {} is not a vector", - pname); - set(IVEC); - } else if (argi.get_dim() == 1) { - if (cols == 0) - error->all(FLERR, iarg, "Set command custom integer property {} is not an array", - pname); - icol_custom = argi.get_index1(); - if (icol_custom <= 0 || icol_custom > cols) - error->all(FLERR, iarg, "Set command per-atom custom integer array {} is accessed " - "out-of-range{}", pname, utils::errorurl(20)); - set(IARRAY); - } else error->all(FLERR,"Illegal set command"); - break; - - case ArgInfo::DNAME: - if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1); - else dvalue = utils::numeric(FLERR,arg[iarg+1],false,lmp); - if (flag != 1) error->all(FLERR,"Custom property {} is not floating-point",argi.get_name()); - - if (argi.get_dim() == 0) { - if (cols > 0) - error->all(FLERR, iarg, "Set command custom double property {} is not a vector", pname); - set(DVEC); - } else if (argi.get_dim() == 1) { - if (cols == 0) - error->all(FLERR, iarg, "Set command custom double property {} is not an array", pname); - icol_custom = argi.get_index1(); - if (icol_custom <= 0 || icol_custom > cols) - error->all(FLERR, iarg, "Set command per-atom custom double array {} is accessed " - "out-of-range{}", pname, utils::errorurl(20)); - set(DARRAY); - } else error->all(FLERR,"Illegal set command"); - break; - - default: - error->all(FLERR,"Illegal set command"); - break; - } - iarg += 2; + if (naction == maxaction) { + maxaction += DELTA; + actions = (Action *) memory->srealloc(actions,maxaction*sizeof(Action),"set:actions"); + invoke_choice = (FnPtrPack *) + memory->srealloc(invoke_choice,maxaction*sizeof(FnPtrPack),"set:invoke_choice"); } - // statistics - // for CC option, include species index + action = &actions[naction]; + action->argindex = iarg; + action->varflag = 0; + action->varflag1 = action->varflag2 = action->varflag3 = action->varflag4 = 0; - MPI_Allreduce(&count,&allcount,1,MPI_INT,MPI_SUM,world); + if (strcmp(arg[iarg],"angle") == 0) { + action->keyword = ANGLE; + process_angle(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_angle; + } else if (strcmp(arg[iarg],"angmom") == 0) { + action->keyword = ANGMOM; + process_angmom(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_angmom; + } else if (strcmp(arg[iarg],"bond") == 0) { + action->keyword = BOND; + process_bond(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_bond; + } else if (strcmp(arg[iarg],"cc") == 0) { + action->keyword = CC; + process_cc(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_cc; + } else if (strcmp(arg[iarg],"charge") == 0) { + action->keyword = CHARGE; + process_charge(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_charge; + } else if (strcmp(arg[iarg],"density") == 0 ||(strcmp(arg[iarg],"density/disc") == 0)) { + action->keyword = DENSITY; + process_density(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_density; + } else if (strcmp(arg[iarg],"diameter") == 0) { + action->keyword = DIAMETER; + process_diameter(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_diameter; + } else if (strcmp(arg[iarg],"dihedral") == 0) { + action->keyword = DIHEDRAL; + process_dihedral(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_dihedral; + } else if (strcmp(arg[iarg],"dipole") == 0) { + action->keyword = DIPOLE; + process_dipole(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_dipole; + } else if (strcmp(arg[iarg],"dipole/random") == 0) { + action->keyword = DIPOLE_RANDOM; + process_dipole_random(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_dipole_random; + } else if (strcmp(arg[iarg],"dpd/theta") == 0) { + action->keyword = DPD_THETA; + process_dpd_theta(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_dpd_theta; + } else if (strcmp(arg[iarg],"edpd/cv") == 0) { + action->keyword = EDPD_CV; + process_edpd_cv(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_edpd_cv; + } else if (strcmp(arg[iarg],"edpd/temp") == 0) { + action->keyword = EDPD_TEMP; + process_edpd_temp(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_edpd_temp; + } else if (strcmp(arg[iarg],"epsilon") == 0) { + action->keyword = EPSILON; + process_epsilon(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_epsilon; + } else if (strcmp(arg[iarg],"image") == 0) { + action->keyword = IMAGE; + process_image(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_image; + } else if (strcmp(arg[iarg],"improper") == 0) { + action->keyword = IMPROPER; + process_improper(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_improper; + } else if (strcmp(arg[iarg],"length") == 0) { + action->keyword = LENGTH; + process_length(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_length; + } else if (strcmp(arg[iarg],"mass") == 0) { + action->keyword = MASS; + process_mass(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_mass; + } else if (strcmp(arg[iarg],"mol") == 0) { + action->keyword = MOLECULE; + process_mol(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_mol; + } else if (strcmp(arg[iarg],"omega") == 0) { + action->keyword = OMEGA; + process_omega(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_omega; + } else if (strcmp(arg[iarg],"quat") == 0) { + action->keyword = QUAT; + process_quat(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_quat; + } else if (strcmp(arg[iarg],"quat/random") == 0) { + action->keyword = QUAT_RANDOM; + process_quat_random(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_quat_random; + } else if (strcmp(arg[iarg],"radius/electron") == 0) { + action->keyword = RADIUS_ELECTRON; + process_radius_election(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_radius_election; + } else if (strcmp(arg[iarg],"shape") == 0) { + action->keyword = SHAPE; + process_shape(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_shape; + } else if (strcmp(arg[iarg],"smd/contact/radius") == 0) { + action->keyword = SMD_CONTACT_RADIUS; + process_smd_contact_radius(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_smd_contact_radius; + } else if (strcmp(arg[iarg],"smd/mass/density") == 0) { + action->keyword = SMD_MASS_DENSITY; + process_smd_mass_density(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_smd_mass_density; + } else if (strcmp(arg[iarg],"sph/cv") == 0) { + action->keyword = SPH_CV; + process_sph_cv(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_sph_cv; + } else if (strcmp(arg[iarg],"sph/e") == 0) { + action->keyword = SPH_E; + process_sph_e(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_sph_e; + } else if (strcmp(arg[iarg],"sph/rho") == 0) { + action->keyword = SPH_RHO; + process_sph_rho(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_sph_rho; + } else if ((strcmp(arg[iarg],"spin/atom") == 0) || (strcmp(arg[iarg],"spin") == 0)) { + action->keyword = SPIN_ATOM; + process_spin_atom(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_spin_atom; + } else if ((strcmp(arg[iarg],"spin/atom/random") == 0) || (strcmp(arg[iarg],"spin/random") == 0)) { + action->keyword = SPIN_ATOM_RANDOM; + process_spin_atom_random(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_spin_atom_random; + } else if (strcmp(arg[iarg],"spin/electron") == 0) { + action->keyword = SPIN_ELECTRON; + process_spin_electron(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_spin_electron; + } else if (strcmp(arg[iarg],"temperature") == 0) { + action->keyword = TEMPERATURE; + process_temperature(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_temperature; + } else if (strcmp(arg[iarg],"theta") == 0) { + action->keyword = THETA; + process_theta(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_theta; + } else if (strcmp(arg[iarg],"theta/random") == 0) { + action->keyword = THETA_RANDOM; + process_theta_random(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_theta_random; + } else if (strcmp(arg[iarg],"tri") == 0) { + action->keyword = TRI; + process_tri(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_tri; + } else if (strcmp(arg[iarg],"type") == 0) { + action->keyword = TYPE; + process_type(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_type; + } else if (strcmp(arg[iarg],"type/fraction") == 0) { + action->keyword = TYPE_FRACTION; + process_type_fraction(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_type_fraction; + } else if (strcmp(arg[iarg],"type/ratio") == 0) { + action->keyword = TYPE_RATIO; + process_type_ratio(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_type_ratio; + } else if (strcmp(arg[iarg],"type/subset") == 0) { + action->keyword = TYPE_SUBSET; + process_type_subset(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_type_subset; + } else if (strcmp(arg[iarg],"volume") == 0) { + action->keyword = VOLUME; + process_volume(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_volume; + } else if (strcmp(arg[iarg],"vx") == 0) { + action->keyword = VX; + process_vx(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_vx; + } else if (strcmp(arg[iarg],"vy") == 0) { + action->keyword = VY; + process_vy(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_vy; + } else if (strcmp(arg[iarg],"vz") == 0) { + action->keyword = VZ; + process_vz(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_vz; + } else if (strcmp(arg[iarg],"x") == 0) { + action->keyword = X; + process_x(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_x; + } else if (strcmp(arg[iarg],"y") == 0) { + action->keyword = Y; + process_y(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_y; + } else if (strcmp(arg[iarg],"z") == 0) { + action->keyword = Z; + process_z(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_z; - if (comm->me == 0) { - if (strcmp(arg[origarg],"cc") == 0) - utils::logmesg(lmp," {} settings made for {} index {}\n", - allcount,arg[origarg],arg[origarg+1]); - else - utils::logmesg(lmp," {} settings made for {}\n", - allcount,arg[origarg]); + } else if (utils::strmatch(arg[iarg],"^[id]2?_")) { + process_custom(iarg,narg,arg,action); + invoke_choice[naction++] = &Set::invoke_custom; + + // unrecognized keyword + + } else error->all(FLERR,"Unrecognized set or fix set command keyword {}",arg[iarg]); + } + + // varflag = 1 if any action uses a per-atom variable + // varflag1234 = 1 if any action uses a specific per-atom variable + + varflag = 0; + varflag1 = varflag2 = varflag3 = varflag4 = 0; + for (int i = 0; i < naction; i++) { + action = &actions[i]; + if (action->varflag) varflag = 1; + if (action->varflag1) varflag1 = 1; + if (action->varflag2) varflag2 = 1; + if (action->varflag3) varflag3 = 1; + if (action->varflag4) varflag4 = 1; + } + + // error if any action of fix set command does not use a per-atom variable + // b/c fix set is then effectivly a no-op + + if (caller == FIXSET) { + for (int i = 0; i < naction; i++) { + action = &actions[i]; + if (!action->varflag) + error->all(FLERR,"Fix set command keyword {} does not invoke a per-atom variable", + arg[action->argindex]); } } - // free local memory + // warn if a keyword sets properties for atoms in rigid bodies + // assume no conflict for properties not in this list of cases - delete[] id; - delete[] select; + for (int i = 0; i < naction; i++) { + switch (actions[i].keyword) { + case X: + case Y: + case Z: + case MOLECULE: + case MASS: + case ANGMOM: + case SHAPE: + case DIAMETER: + case DENSITY: + case TEMPERATURE: + case QUAT: + case IMAGE: + if (modify->check_rigid_list_overlap(select)) + error->warning(FLERR,"Setting a property of atoms in rigid bodies " + "that has no effect unless rigid bodies are re-initialized"); + break; + default: + break; + } + } + + // in future, could return index to next arg to process + // i.e. if fix set command appends its own options + + // return iarg; } /* ---------------------------------------------------------------------- @@ -784,468 +463,143 @@ void Set::command(int narg, char **arg) void Set::selection(int n) { - delete[] select; - select = new int[n]; - int nlo,nhi; + // reallocate select vector if needed + // this method could be called many times by fix set command + + if (n > maxselect) { + memory->destroy(select); + memory->create(select,n,"set:select"); + maxselect = n; + } if (style == ATOM_SELECT) { - if (atom->tag_enable == 0) - error->all(FLERR, Error::NOLASTLINE, "Cannot use set atom with no atom IDs defined"); - bigint nlobig,nhibig; - utils::bounds(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error); - tagint *tag = atom->tag; for (int i = 0; i < n; i++) if (tag[i] >= nlobig && tag[i] <= nhibig) select[i] = 1; else select[i] = 0; } else if (style == MOL_SELECT) { - if (atom->molecule_flag == 0) - error->all(FLERR, Error::NOLASTLINE, "Cannot use set mol with no molecule IDs defined"); - bigint nlobig,nhibig; - utils::bounds(FLERR,id,1,MAXTAGINT,nlobig,nhibig,error); - tagint *molecule = atom->molecule; for (int i = 0; i < n; i++) if (molecule[i] >= nlobig && molecule[i] <= nhibig) select[i] = 1; else select[i] = 0; } else if (style == TYPE_SELECT) { - utils::bounds_typelabel(FLERR,id,1,atom->ntypes,nlo,nhi,lmp,Atom::ATOM); - int *type = atom->type; for (int i = 0; i < n; i++) if (type[i] >= nlo && type[i] <= nhi) select[i] = 1; else select[i] = 0; } else if (style == GROUP_SELECT) { - int igroup = group->find(id); - if (igroup == -1) error->all(FLERR, Error::NOLASTLINE, "Could not find set group ID {}", id); - int groupbit = group->bitmask[igroup]; - int *mask = atom->mask; for (int i = 0; i < n; i++) if (mask[i] & groupbit) select[i] = 1; else select[i] = 0; } else if (style == REGION_SELECT) { - auto region = domain->get_region_by_id(id); - if (!region) error->all(FLERR, Error::NOLASTLINE, "Set region {} does not exist", id); region->prematch(); - double **x = atom->x; for (int i = 0; i < n; i++) - if (region->match(x[i][0],x[i][1],x[i][2])) - select[i] = 1; + if (region->match(x[i][0],x[i][1],x[i][2])) select[i] = 1; else select[i] = 0; } + + // count_select = count of selected owned atoms + + count_select = 0; + for (int i = 0; i < n; i++) + if (select[i]) count_select++; } /* ---------------------------------------------------------------------- - set owned atom properties directly - either scalar or per-atom values from atom-style variable(s) + loop over list of actions + perform each action on all selected atoms via call to invoke_choice() method ------------------------------------------------------------------------- */ -void Set::set(int keyword) +void Set::invoke_actions() { - // evaluate atom-style variable(s) if necessary + // reallocate per-atom variable storage if needed - vec1 = vec2 = vec3 = vec4 = nullptr; - - if (varflag) { - int nlocal = atom->nlocal; + if (varflag && atom->nlocal > maxvariable) { + maxvariable = atom->nlocal; if (varflag1) { - memory->create(vec1,nlocal,"set:vec1"); - input->variable->compute_atom(ivar1,0,vec1,1,0); + memory->destroy(vec1); + memory->create(vec1,maxvariable,"set:var1"); } if (varflag2) { - memory->create(vec2,nlocal,"set:vec2"); - input->variable->compute_atom(ivar2,0,vec2,1,0); + memory->destroy(vec2); + memory->create(vec2,maxvariable,"set:var2"); } if (varflag3) { - memory->create(vec3,nlocal,"set:vec3"); - input->variable->compute_atom(ivar3,0,vec3,1,0); + memory->destroy(vec3); + memory->create(vec3,maxvariable,"set:var3"); } if (varflag4) { - memory->create(vec4,nlocal,"set:vec4"); - input->variable->compute_atom(ivar4,0,vec4,1,0); + memory->destroy(vec4); + memory->create(vec4,maxvariable,"set:var4"); } } - // check if properties of atoms in rigid bodies are updated - // that are cached as per-body data. - switch (keyword) { - case X: - case Y: - case Z: - case MOLECULE: - case MASS: - case ANGMOM: - case SHAPE: - case DIAMETER: - case DENSITY: - case TEMPERATURE: - case QUAT: - case IMAGE: - if (modify->check_rigid_list_overlap(select)) - error->warning(FLERR,"Changing a property of atoms in rigid bodies " - "that has no effect unless rigid bodies are rebuild"); - break; - default: // assume no conflict for all other properties - break; - } + // loop over actions - // loop over selected atoms + for (int i = 0; i < naction; i++) { - 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")); + Action *action = &actions[i]; - int nlocal = atom->nlocal; - for (int i = 0; i < nlocal; i++) { - if (!select[i]) continue; + // use count_action to optionally override count_select + // if stays -1, count_select is used by caller + // if overwritten by an invoke method, count_action is used + // only a handful of invoke methods tally their own count - // overwrite dvalue, ivalue, xyzw value if variables defined - // else the input script scalar value remains in place + count_action = -1; - if (varflag) { - if (varflag1) { - dvalue = xvalue = vec1[i]; - ivalue = static_cast (dvalue); + // evaluate atom-style variable(s) if necessary + + if (action->varflag) { + if (action->varflag1) { + input->variable->compute_atom(action->ivar1,0,vec1,1,0); } - if (varflag2) yvalue = vec2[i]; - if (varflag3) zvalue = vec3[i]; - if (varflag4) wvalue = vec4[i]; - } - - // set values in per-atom arrays - // error check here in case atom-style variables generated bogus value - - if (keyword == TYPE) { - if (ivalue <= 0 || ivalue > atom->ntypes) - error->one(FLERR, Error::NOLASTLINE, "Invalid value {} in set type command", ivalue); - atom->type[i] = ivalue; - } - else if (keyword == MOLECULE) atom->molecule[i] = ivalue; - else if (keyword == X) atom->x[i][0] = dvalue; - else if (keyword == Y) atom->x[i][1] = dvalue; - else if (keyword == Z) atom->x[i][2] = dvalue; - else if (keyword == VX) atom->v[i][0] = dvalue; - else if (keyword == VY) atom->v[i][1] = dvalue; - else if (keyword == VZ) atom->v[i][2] = dvalue; - else if (keyword == CHARGE) { - atom->q[i] = dvalue; - // ensure that scaled charges are consistent the new charge value - if (atom->epsilon) atom->q_scaled[i] = dvalue / atom->epsilon[i]; - } else if (keyword == MASS) { - if (dvalue <= 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid mass {} in set command", dvalue); - atom->rmass[i] = dvalue; - } - else if (keyword == DIAMETER) { - if (dvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid diameter {} in set command", dvalue); - atom->radius[i] = 0.5 * dvalue; - } - else if (keyword == VOLUME) { - if (dvalue <= 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid volume {} in set command", dvalue); - atom->vfrac[i] = dvalue; - } - - else if (keyword == RHEO_STATUS) { - if (ivalue != 0 && ivalue != 1) - error->one(FLERR, Error::NOLASTLINE, "Invalid value {} in set command for rheo/status", - ivalue); - atom->rheo_status[i] = ivalue; - } - - else if (keyword == SPH_E) atom->esph[i] = dvalue; - else if (keyword == SPH_CV) atom->cv[i] = dvalue; - else if (keyword == SPH_RHO) atom->rho[i] = dvalue; - - else if (keyword == EDPD_TEMP) atom->edpd_temp[i] = dvalue; - else if (keyword == EDPD_CV) atom->edpd_cv[i] = dvalue; - else if (keyword == CC) atom->cc[i][cc_index-1] = dvalue; - - else if (keyword == SMD_MASS_DENSITY) { - // set mass from volume and supplied mass density - atom->rmass[i] = atom->vfrac[i] * dvalue; - } - else if (keyword == SMD_CONTACT_RADIUS) atom->contact_radius[i] = dvalue; - - else if (keyword == DPDTHETA) { - if (dvalue >= 0.0) atom->dpdTheta[i] = dvalue; - else { - double onemass; - if (atom->rmass) onemass = atom->rmass[i]; - else onemass = atom->mass[atom->type[i]]; - double vx = atom->v[i][0]; - double vy = atom->v[i][1]; - double vz = atom->v[i][2]; - double tfactor = force->mvv2e / (domain->dimension * force->boltz); - atom->dpdTheta[i] = tfactor * onemass * (vx*vx + vy*vy + vz*vz); + if (action->varflag2) { + input->variable->compute_atom(action->ivar2,0,vec2,1,0); + } + if (action->varflag3) { + input->variable->compute_atom(action->ivar3,0,vec3,1,0); + } + if (action->varflag4) { + input->variable->compute_atom(action->ivar4,0,vec4,1,0); } } - // set shape of ellipsoidal particle + // invoke the action to reset per-atom or per-topology values - else if (keyword == SHAPE) { - if (xvalue < 0.0 || yvalue < 0.0 || zvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid ellipsoid shape {} {} {} in set command", - xvalue, yvalue, zvalue); - if (xvalue > 0.0 || yvalue > 0.0 || zvalue > 0.0) { - if (xvalue == 0.0 || yvalue == 0.0 || zvalue == 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid ellipsoid shape {} {} {} in set command", - xvalue, yvalue, zvalue); - } - avec_ellipsoid->set_shape(i,0.5*xvalue,0.5*yvalue,0.5*zvalue); - } + (this->*invoke_choice[i])(action); - // set length of line particle - - else if (keyword == LENGTH) { - if (dvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid length {} in set command", dvalue); - avec_line->set_length(i,dvalue); - } - - // set corners of tri particle - - else if (keyword == TRI) { - if (dvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid length {} in set command", dvalue); - avec_tri->set_equilateral(i,dvalue); - } - - // set rmass via density - // if radius > 0.0, treat as sphere or disc - // if shape > 0.0, treat as ellipsoid (or ellipse, when uncomment below) - // if length > 0.0, treat as line - // if area > 0.0, treat as tri - // else set rmass to density directly - - else if (keyword == DENSITY) { - if (dvalue <= 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid density {} in set command", dvalue); - if (atom->radius_flag && atom->radius[i] > 0.0) - if (discflag) - atom->rmass[i] = MY_PI*atom->radius[i]*atom->radius[i] * dvalue; - else - atom->rmass[i] = 4.0*MY_PI/3.0 * - atom->radius[i]*atom->radius[i]*atom->radius[i] * dvalue; - else if (atom->ellipsoid_flag && atom->ellipsoid[i] >= 0) { - double *shape = avec_ellipsoid->bonus[atom->ellipsoid[i]].shape; - // enable 2d ellipse (versus 3d ellipsoid) when time integration - // options (fix nve/asphere, fix nh/asphere) are also implemented - // if (discflag) - // atom->rmass[i] = MY_PI*shape[0]*shape[1] * dvalue; - // else - atom->rmass[i] = 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2] * dvalue; - } else if (atom->line_flag && atom->line[i] >= 0) { - double length = avec_line->bonus[atom->line[i]].length; - atom->rmass[i] = length * dvalue; - } else if (atom->tri_flag && atom->tri[i] >= 0) { - double *c1 = avec_tri->bonus[atom->tri[i]].c1; - double *c2 = avec_tri->bonus[atom->tri[i]].c2; - double *c3 = avec_tri->bonus[atom->tri[i]].c3; - double c2mc1[3],c3mc1[3]; - MathExtra::sub3(c2,c1,c2mc1); - MathExtra::sub3(c3,c1,c3mc1); - double norm[3]; - MathExtra::cross3(c2mc1,c3mc1,norm); - double area = 0.5 * MathExtra::len3(norm); - atom->rmass[i] = area * dvalue; - } else atom->rmass[i] = dvalue; - } - - // set dipole moment - - else if (keyword == DIPOLE) { - double **mu = atom->mu; - mu[i][0] = xvalue; - mu[i][1] = yvalue; - mu[i][2] = zvalue; - mu[i][3] = sqrt(mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + - mu[i][2]*mu[i][2]); - } - - // set magnetic moments - - else if (keyword == SPIN_ATOM) { - if (dvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Incorrect value for atomic spin magnitude: {}", - dvalue); - double **sp = atom->sp; - double inorm = 1.0/sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue); - sp[i][0] = inorm*xvalue; - sp[i][1] = inorm*yvalue; - sp[i][2] = inorm*zvalue; - sp[i][3] = dvalue; - } - - // set electron radius - - else if (keyword == RADIUS_ELECTRON) { - atom->eradius[i] = dvalue; - if (dvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Incorrect value for electron radius: {}", dvalue); - } - - // set electron spin - - else if (keyword == SPIN_ELECTRON) { - if ((dvalue == -1) || (dvalue == 1) || (dvalue == 0) || (dvalue == 2) || (dvalue == 3)) - atom->spin[i] = (int)dvalue; - else - error->one(FLERR, Error::NOLASTLINE, "Incorrect value for electron spin: {}", dvalue); - } - - // 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, Error::NOLASTLINE, "Cannot set quaternion for atom that has none"); - if (domain->dimension == 2 && (xvalue != 0.0 || yvalue != 0.0)) - error->one(FLERR, Error::NOLASTLINE, - "Cannot set quaternion with xy components for 2d system"); - - 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 - - else if (keyword == THETA) { - if (atom->line[i] < 0) - error->one(FLERR, Error::NOLASTLINE, "Cannot set theta for atom that is not a line"); - avec_line->bonus[atom->line[i]].theta = dvalue; - } - - // set angmom or omega of particle - - else if (keyword == ANGMOM) { - atom->angmom[i][0] = xvalue; - atom->angmom[i][1] = yvalue; - atom->angmom[i][2] = zvalue; - } - - else if (keyword == OMEGA) { - atom->omega[i][0] = xvalue; - atom->omega[i][1] = yvalue; - atom->omega[i][2] = zvalue; - } - - // set temperature of particle - - else if (keyword == TEMPERATURE) { - if (dvalue < 0.0) - error->one(FLERR, Error::NOLASTLINE, "Invalid temperature {} in set command", dvalue); - atom->temperature[i] = dvalue; - } - - // reset any or all of 3 image flags - - else if (keyword == IMAGE) { - int xbox = (atom->image[i] & IMGMASK) - IMGMAX; - int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX; - int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX; - if (varflag1) ximage = static_cast(xvalue); - if (varflag2) yimage = static_cast(yvalue); - if (varflag3) zimage = static_cast(zvalue); - if (ximageflag) xbox = ximage; - if (yimageflag) ybox = yimage; - if (zimageflag) zbox = zimage; - atom->image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | - (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | - (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); - } - - // set the local dielectric constant - - else if (keyword == EPSILON) { - if (dvalue >= 0.0) { - - // assign the new local dielectric constant - // update both the scaled charge value - - atom->epsilon[i] = dvalue; - atom->q_scaled[i] = atom->q[i] / dvalue; - } - } - - // set value for custom property vector or array - - else if (keyword == IVEC) { - atom->ivector[index_custom][i] = ivalue; - } - - else if (keyword == DVEC) { - atom->dvector[index_custom][i] = dvalue; - } - - else if (keyword == IARRAY) { - atom->iarray[index_custom][i][icol_custom-1] = ivalue; - } - - else if (keyword == DARRAY) { - atom->darray[index_custom][i][icol_custom-1] = dvalue; - } - - count++; + action->count_select = count_select; + action->count_action = count_action; } +} - // update bonus data numbers +/* ---------------------------------------------------------------------- */ - if (keyword == SHAPE) { - bigint nlocal_bonus = avec_ellipsoid->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->nellipsoids,1, - MPI_LMP_BIGINT,MPI_SUM,world); +void Set::varparse(const char *name, int m, Action *action) +{ + int ivar = input->variable->find(name+2); + if (ivar < 0) + error->all(FLERR,"Variable name {} for set command does not exist", name); + if (!input->variable->atomstyle(ivar)) + error->all(FLERR,"Variable {} for set command is invalid style", name); + + action->varflag = 1; + + if (m == 1) { + action->varflag1 = 1; action->ivar1 = ivar; + } else if (m == 2) { + action->varflag2 = 1; action->ivar2 = ivar; + } else if (m == 3) { + action->varflag3 = 1; action->ivar3 = ivar; + } else if (m == 4) { + action->varflag4 = 1; action->ivar4 = ivar; } - if (keyword == LENGTH) { - bigint nlocal_bonus = avec_line->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->nlines,1,MPI_LMP_BIGINT,MPI_SUM,world); - } - if (keyword == TRI) { - bigint nlocal_bonus = avec_tri->nlocal_bonus; - MPI_Allreduce(&nlocal_bonus,&atom->ntris,1,MPI_LMP_BIGINT,MPI_SUM,world); - } - - // clear up per-atom memory if allocated - - memory->destroy(vec1); - memory->destroy(vec2); - memory->destroy(vec3); - memory->destroy(vec4); } /* ---------------------------------------------------------------------- @@ -1254,7 +608,7 @@ void Set::set(int keyword) make atom result independent of what proc owns it ------------------------------------------------------------------------- */ -void Set::setrandom(int keyword) +void Set::setrandom(int keyword, Action *action) { int i; @@ -1264,7 +618,10 @@ void Set::setrandom(int keyword) auto avec_body = dynamic_cast(atom->style_match("body")); double **x = atom->x; - int seed = ivalue; + + // seed is always set to ivalue1 in process() methods + + int seed = action->ivalue1; auto ranpark = new RanPark(lmp,1); auto ranmars = new RanMars(lmp,seed + comm->me); @@ -1273,6 +630,9 @@ void Set::setrandom(int keyword) if (keyword == TYPE_FRACTION) { int nlocal = atom->nlocal; + double fraction = action->dvalue1; + int newtype = action->ivalue2; + int count = 0; for (i = 0; i < nlocal; i++) if (select[i]) { @@ -1282,44 +642,45 @@ void Set::setrandom(int keyword) count++; } + count_action = count; + // set exact count of atom types to newtype // for TYPE_RATIO, exact = fraction out of total eligible // for TYPE_SUBSET, exact = nsubset out of total eligible } else if (keyword == TYPE_RATIO || keyword == TYPE_SUBSET) { int nlocal = atom->nlocal; + int newtype = action->ivalue2; - // count = number of eligible atoms I own + // convert specified fraction to nsubset of all selected atoms - count = 0; - for (i = 0; i < nlocal; i++) - if (select[i]) count++; - - // convert specified fraction to nsubset - - bigint bcount = count; + bigint bcount = count_select; bigint allcount; MPI_Allreduce(&bcount,&allcount,1,MPI_LMP_BIGINT,MPI_SUM,world); + bigint nsubset; if (keyword == TYPE_RATIO) { + double fraction = action->dvalue1; nsubset = static_cast (fraction * allcount); } else if (keyword == TYPE_SUBSET) { + nsubset = action->bvalue1; if (nsubset > allcount) - error->all(FLERR, Error::NOLASTLINE, "Set type/subset value exceeds eligible atoms"); + error->all(FLERR,"Set type/subset value exceeds eligible atoms"); } // make selection - int *flag = memory->create(flag,count,"set:flag"); - int *work = memory->create(work,count,"set:work"); + int *flag = memory->create(flag,count_select,"set:flag"); + int *work = memory->create(work,count_select,"set:work"); - ranmars->select_subset(nsubset,count,flag,work); + ranmars->select_subset(nsubset,count_select,flag,work); // change types of selected atoms // flag vector from select_subset() is only for eligible atoms - count = 0; + int count = 0; int eligible = 0; + for (i = 0; i < nlocal; i++) { if (!select[i]) continue; if (flag[eligible]) { @@ -1329,6 +690,8 @@ void Set::setrandom(int keyword) eligible++; } + count_action = count; + // clean up memory->destroy(flag); @@ -1340,7 +703,7 @@ void Set::setrandom(int keyword) } else if (keyword == DIPOLE_RANDOM) { double **mu = atom->mu; int nlocal = atom->nlocal; - + double dmag = action->dvalue1; double msq,scale; if (domain->dimension == 3) { @@ -1351,12 +714,11 @@ void Set::setrandom(int keyword) mu[i][1] = ranpark->uniform() - 0.5; mu[i][2] = ranpark->uniform() - 0.5; msq = mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]; - scale = dvalue/sqrt(msq); + scale = dmag/sqrt(msq); mu[i][0] *= scale; mu[i][1] *= scale; mu[i][2] *= scale; - mu[i][3] = dvalue; - count++; + mu[i][3] = dmag; } } else { @@ -1367,22 +729,20 @@ void Set::setrandom(int keyword) mu[i][1] = ranpark->uniform() - 0.5; mu[i][2] = 0.0; msq = mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1]; - scale = dvalue/sqrt(msq); + scale = dmag/sqrt(msq); mu[i][0] *= scale; mu[i][1] *= scale; - mu[i][3] = dvalue; - count++; + mu[i][3] = dmag; } } - // set spin moments to random orientations in 3d or 2d // spin length is fixed to unity - } else if (keyword == SPIN_RANDOM) { + } else if (keyword == SPIN_ATOM_RANDOM) { double **sp = atom->sp; int nlocal = atom->nlocal; - + double dlen = action->dvalue1; double sp_sq,scale; if (domain->dimension == 3) { @@ -1397,8 +757,7 @@ void Set::setrandom(int keyword) sp[i][0] *= scale; sp[i][1] *= scale; sp[i][2] *= scale; - sp[i][3] = dvalue; - count++; + sp[i][3] = dlen; } } else { @@ -1412,32 +771,35 @@ void Set::setrandom(int keyword) scale = 1.0/sqrt(sp_sq); sp[i][0] *= scale; sp[i][1] *= scale; - sp[i][3] = dvalue; - count++; + sp[i][3] = dlen; } } // set quaternions to random orientations in 3d and 2d } else if (keyword == QUAT_RANDOM) { + int *ellipsoid = atom->ellipsoid; + int *tri = atom->tri; + int *body = atom->body; + double **quat = atom->quat; int nlocal = atom->nlocal; - double *quat; - double **quat2; + int quat_flag = atom->quat_flag; + double *quat_one; if (domain->dimension == 3) { double s,t1,t2,theta1,theta2; for (i = 0; i < nlocal; i++) if (select[i]) { - 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; + if (avec_ellipsoid && ellipsoid[i] >= 0) + quat_one = avec_ellipsoid->bonus[ellipsoid[i]].quat; + else if (avec_tri && tri[i] >= 0) + quat_one = avec_tri->bonus[tri[i]].quat; + else if (avec_body && body[i] >= 0) + quat_one = avec_body->bonus[body[i]].quat; + else if (quat_flag) + quat_one = quat[i]; else - error->one(FLERR, Error::NOLASTLINE, "Cannot set quaternion for atom that has none"); + error->one(FLERR,"Cannot set quaternion for atom that has none"); ranpark->reset(seed,x[i]); s = ranpark->uniform(); @@ -1445,61 +807,46 @@ void Set::setrandom(int keyword) t2 = sqrt(s); theta1 = 2.0*MY_PI*ranpark->uniform(); theta2 = 2.0*MY_PI*ranpark->uniform(); - 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++; + quat_one[0] = cos(theta2)*t2; + quat_one[1] = sin(theta1)*t1; + quat_one[2] = cos(theta1)*t1; + quat_one[3] = sin(theta2)*t2; } } else { double theta2; for (i = 0; i < nlocal; i++) if (select[i]) { - if (avec_ellipsoid && atom->ellipsoid[i] >= 0) - 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; + if (avec_ellipsoid && ellipsoid[i] >= 0) + quat_one = avec_ellipsoid->bonus[ellipsoid[i]].quat; + else if (avec_body && body[i] >= 0) + quat_one = avec_body->bonus[body[i]].quat; + else if (quat_flag) + quat_one = quat[i]; else - error->one(FLERR, Error::NOLASTLINE, "Cannot set quaternion for atom that has none"); + error->one(FLERR,"Cannot set quaternion for atom that has none"); ranpark->reset(seed,x[i]); theta2 = MY_PI*ranpark->uniform(); - 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++; + quat_one[0] = cos(theta2); + quat_one[1] = 0.0; + quat_one[2] = 0.0; + quat_one[3] = sin(theta2); } } // set theta to random orientation in 2d } else if (keyword == THETA_RANDOM) { + int *line = atom->line; int nlocal = atom->nlocal; + for (i = 0; i < nlocal; i++) { if (select[i]) { - if (atom->line[i] < 0) - error->one(FLERR, Error::NOLASTLINE, "Cannot set theta for atom that is not a line"); + if (line[i] < 0) + error->one(FLERR,"Cannot set theta for atom that is not a line"); ranpark->reset(seed,x[i]); - avec_line->bonus[atom->line[i]].theta = MY_2PI*ranpark->uniform(); - count++; + avec_line->bonus[line[i]].theta = MY_2PI*ranpark->uniform(); } } } @@ -1510,14 +857,14 @@ void Set::setrandom(int keyword) /* ---------------------------------------------------------------------- */ -void Set::topology(int keyword) +void Set::topology(int keyword, Action *action) { int m,atom1,atom2,atom3,atom4; // error check if (atom->molecular == Atom::TEMPLATE) - error->all(FLERR, Error::NOLASTLINE, "Cannot set bond topology types for atom style template"); + error->all(FLERR,"Cannot set bond topology types for atom style template"); // border swap to acquire ghost atom info // enforce PBC before in case atoms are outside box @@ -1539,18 +886,23 @@ void Set::topology(int keyword) selection(atom->nlocal + atom->nghost); + int count = 0; + // for BOND, each of 2 atoms must be in group if (keyword == BOND) { + int *num_bond = atom->num_bond; + int **bond_type = atom->bond_type; + tagint **bond_atom = atom->bond_atom; int nlocal = atom->nlocal; + + int itype = action->ivalue1; for (int i = 0; i < nlocal; i++) - for (m = 0; m < atom->num_bond[i]; m++) { - atom1 = atom->map(atom->bond_atom[i][m]); - if (atom1 == -1) - error->one(FLERR, Error::NOLASTLINE, "Bond atom missing in set command" - + utils::errorurl(5)); + for (m = 0; m < num_bond[i]; m++) { + atom1 = atom->map(bond_atom[i][m]); + if (atom1 == -1) error->one(FLERR,"Bond atom missing in set command"); if (select[i] && select[atom1]) { - atom->bond_type[i][m] = ivalue; + bond_type[i][m] = itype; count++; } } @@ -1559,17 +911,23 @@ void Set::topology(int keyword) // for ANGLE, each of 3 atoms must be in group if (keyword == ANGLE) { + int *num_angle = atom->num_angle; + int **angle_type = atom->angle_type; + tagint **angle_atom1 = atom->angle_atom1; + tagint **angle_atom2 = atom->angle_atom2; + tagint **angle_atom3 = atom->angle_atom3; int nlocal = atom->nlocal; + + int itype = action->ivalue1; for (int i = 0; i < nlocal; i++) - for (m = 0; m < atom->num_angle[i]; m++) { - atom1 = atom->map(atom->angle_atom1[i][m]); - atom2 = atom->map(atom->angle_atom2[i][m]); - atom3 = atom->map(atom->angle_atom3[i][m]); + for (m = 0; m < num_angle[i]; m++) { + atom1 = atom->map(angle_atom1[i][m]); + atom2 = atom->map(angle_atom2[i][m]); + atom3 = atom->map(angle_atom3[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) - error->one(FLERR, Error::NOLASTLINE, "Angle atom missing in set command" - + utils::errorurl(5)); + error->one(FLERR,"Angle atom missing in set command"); if (select[atom1] && select[atom2] && select[atom3]) { - atom->angle_type[i][m] = ivalue; + angle_type[i][m] = itype; count++; } } @@ -1578,18 +936,25 @@ void Set::topology(int keyword) // for DIHEDRAL, each of 4 atoms must be in group if (keyword == DIHEDRAL) { + int *num_dihedral = atom->num_dihedral; + int **dihedral_type = atom->dihedral_type; + 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 nlocal = atom->nlocal; + + int itype = action->ivalue1; for (int i = 0; i < nlocal; i++) - for (m = 0; m < atom->num_dihedral[i]; m++) { - atom1 = atom->map(atom->dihedral_atom1[i][m]); - atom2 = atom->map(atom->dihedral_atom2[i][m]); - atom3 = atom->map(atom->dihedral_atom3[i][m]); - atom4 = atom->map(atom->dihedral_atom4[i][m]); + for (m = 0; m < num_dihedral[i]; m++) { + atom1 = atom->map(dihedral_atom1[i][m]); + atom2 = atom->map(dihedral_atom2[i][m]); + atom3 = atom->map(dihedral_atom3[i][m]); + atom4 = atom->map(dihedral_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) - error->one(FLERR, Error::NOLASTLINE, "Dihedral atom missing in set command" - + utils::errorurl(5)); + error->one(FLERR,"Dihedral atom missing in set command"); if (select[atom1] && select[atom2] && select[atom3] && select[atom4]) { - atom->dihedral_type[i][m] = ivalue; + dihedral_type[i][m] = itype; count++; } } @@ -1598,43 +963,1976 @@ void Set::topology(int keyword) // for IMPROPER, each of 4 atoms must be in group if (keyword == IMPROPER) { + int *num_improper = atom->num_improper; + int **improper_type = atom->improper_type; + tagint **improper_atom1 = atom->improper_atom1; + tagint **improper_atom2 = atom->improper_atom2; + tagint **improper_atom3 = atom->improper_atom3; + tagint **improper_atom4 = atom->improper_atom4; int nlocal = atom->nlocal; + + int itype = action->ivalue1; for (int i = 0; i < nlocal; i++) - for (m = 0; m < atom->num_improper[i]; m++) { - atom1 = atom->map(atom->improper_atom1[i][m]); - atom2 = atom->map(atom->improper_atom2[i][m]); - atom3 = atom->map(atom->improper_atom3[i][m]); - atom4 = atom->map(atom->improper_atom4[i][m]); + for (m = 0; m < num_improper[i]; m++) { + atom1 = atom->map(improper_atom1[i][m]); + atom2 = atom->map(improper_atom2[i][m]); + atom3 = atom->map(improper_atom3[i][m]); + atom4 = atom->map(improper_atom4[i][m]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) - error->one(FLERR, Error::NOLASTLINE, "Improper atom missing in set command" - + utils::errorurl(5)); + error->one(FLERR,"Improper atom missing in set command"); if (select[atom1] && select[atom2] && select[atom3] && select[atom4]) { - atom->improper_type[i][m] = ivalue; + improper_type[i][m] = itype; count++; } } } + + // set count_action for all topology actions + + count_action = count; +} + +// ---------------------------------------------------------------------- +// pairs of process/invoke methods for each keyword +// process method reads args, stores parameters in Action instance +// invoke method resets atoms properties using Action instance +// separate two operations so can be called by either set or fix set command +// ---------------------------------------------------------------------- + +/* ---------------------------------------------------------------------- */ + +void Set::process_angle(int &iarg, int narg, char **arg, Action *action) +{ + if (atom->avec->angles_allow == 0) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set angle", error); + + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ANGLE,lmp); + action->ivalue1 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue1 <= 0 || action->ivalue1 > atom->nangletypes) + error->all(FLERR,"Invalid angle type in set command"); + iarg += 2; +} + +void Set::invoke_angle(Action *action) +{ + topology(ANGLE,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_angmom(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->angmom_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set angmom", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2,action); + else action->dvalue2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3,action); + else action->dvalue3 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + + iarg += 4; +} + +void Set::invoke_angmom(Action *action) +{ + int nlocal = atom->nlocal; + double **angmom = atom->angmom; + + int varflag = action->varflag; + double xvalue,yvalue,zvalue; + if (!action->varflag1) xvalue = action->dvalue1; + if (!action->varflag2) yvalue = action->dvalue2; + if (!action->varflag3) zvalue = action->dvalue3; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + if (action->varflag1) xvalue = vec1[i]; + if (action->varflag1) yvalue = vec2[i]; + if (action->varflag1) zvalue = vec3[i]; + } + + angmom[i][0] = xvalue; + angmom[i][1] = yvalue; + angmom[i][2] = zvalue; + } } /* ---------------------------------------------------------------------- */ -void Set::varparse(const char *name, int m) +void Set::process_bond(int &iarg, int narg, char **arg, Action *action) { - varflag = 1; - int ivar = input->variable->find(name+2); + if (atom->avec->bonds_allow == 0) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set bond", error); - if (ivar < 0) - error->all(FLERR, Error::NOLASTLINE, "Variable name {} for set command does not exist", name); - if (!input->variable->atomstyle(ivar)) - error->all(FLERR, Error::NOLASTLINE, "Variable {} for set command is invalid style", name); + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::BOND,lmp); + action->ivalue1 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue1 <= 0 || action->ivalue1 > atom->nbondtypes) + error->all(FLERR,"Invalid bond type in set command"); - if (m == 1) { - varflag1 = 1; ivar1 = ivar; - } else if (m == 2) { - varflag2 = 1; ivar2 = ivar; - } else if (m == 3) { - varflag3 = 1; ivar3 = ivar; - } else if (m == 4) { - varflag4 = 1; ivar4 = ivar; + iarg += 2; +} + +void Set::invoke_bond(Action *action) +{ + topology(BOND,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_cc(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->tdpd_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set cc", error); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (action->ivalue1 < 1) error->all(FLERR,"Invalid cc index in set command"); + + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (action->dvalue1 < 0.0) error->all(FLERR,"Invalid cc value in set command"); + } + + iarg += 3; +} + +void Set::invoke_cc(Action *action) +{ + int nlocal = atom->nlocal; + double **cc = atom->cc; + + int cc_index = action->ivalue1 - 1; + // NOTE: need to check if cc_index exceeds cc array allocation + + int varflag = action->varflag; + double ccvalue; + if (!action->varflag1) ccvalue = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + ccvalue = vec1[i]; + if (ccvalue < 0.0) error->all(FLERR,"Invalid cc value in set command"); + } + + cc[i][cc_index] = ccvalue; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_charge(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->q_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set charge", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_charge(Action *action) +{ + int nlocal = atom->nlocal; + double *q = atom->q; + double *q_scaled = atom->q_scaled; + double *epsilon = atom->epsilon; + + int varflag = action->varflag; + double qvalue; + if (!action->varflag1) qvalue = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) qvalue = vec1[i]; + q[i] = qvalue; + + // ensure scaled charges are consistent with new charge value + + if (epsilon) q_scaled[i] = qvalue / epsilon[i]; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_density(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->rmass_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set density", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 <= 0.0) error->all(FLERR,"Invalid density in set command"); + } + + action->ivalue1 = 0; + if (strcmp(arg[iarg],"density/disc") == 0) { + action->ivalue1 = 1; + if (domain->dimension != 2) error->all(FLERR,"Set density/disc requires 2d simulation"); + } + + iarg += 2; +} + +void Set::invoke_density(Action *action) +{ + int nlocal = atom->nlocal; + double *rmass = atom->rmass; + double *radius = atom->radius; + int *ellipsoid = atom->ellipsoid; + int *line = atom->line; + int *tri = atom->tri; + + int radius_flag = atom->radius_flag; + int ellipsoid_flag = atom->ellipsoid_flag; + int line_flag = atom->line_flag; + int tri_flag = atom->tri_flag; + + 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")); + + int varflag = action->varflag; + double density; + if (!action->varflag1) density = action->dvalue1; + int discflag = action->ivalue1; + + // set rmass via density + // if radius > 0.0, treat as sphere or disc + // if shape > 0.0, treat as ellipsoid (or ellipse, when uncomment below) + // if length > 0.0, treat as line + // if area > 0.0, treat as tri + // else set rmass to density directly + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + density = vec1[i]; + if (density <= 0.0) error->one(FLERR,"Invalid density in set command"); + } + + if (radius_flag && radius[i] > 0.0) + if (discflag) rmass[i] = MY_PI*radius[i]*radius[i] * density; + else rmass[i] = 4.0*MY_PI/3.0 * radius[i]*radius[i]*radius[i] * density; + + else if (ellipsoid_flag && ellipsoid[i] >= 0) { + double *shape = avec_ellipsoid->bonus[ellipsoid[i]].shape; + // could enable 2d ellipse (versus 3d ellipsoid) when time integration + // options (fix nve/asphere, fix nh/asphere) are also implemented + // if (discflag) + // atom->rmass[i] = MY_PI*shape[0]*shape[1] * dvalue; + // else + rmass[i] = 4.0*MY_PI/3.0 * shape[0]*shape[1]*shape[2] * density; + + } else if (line_flag && line[i] >= 0) { + double length = avec_line->bonus[line[i]].length; + rmass[i] = length * density; + + } else if (tri_flag && tri[i] >= 0) { + double *c1 = avec_tri->bonus[tri[i]].c1; + double *c2 = avec_tri->bonus[tri[i]].c2; + double *c3 = avec_tri->bonus[tri[i]].c3; + double c2mc1[3],c3mc1[3]; + MathExtra::sub3(c2,c1,c2mc1); + MathExtra::sub3(c3,c1,c3mc1); + double norm[3]; + MathExtra::cross3(c2mc1,c3mc1,norm); + double area = 0.5 * MathExtra::len3(norm); + rmass[i] = area * density; + + } else rmass[i] = density; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_diameter(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->radius_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set diameter", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid diameter in set command"); + } + + iarg += 2; +} + +void Set::invoke_diameter(Action *action) +{ + int nlocal = atom->nlocal; + double *radius = atom->radius; + + int varflag = action->varflag; + double diam; + if (!action->varflag1) diam = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + diam = vec1[i]; + if (diam < 0.0) error->one(FLERR,"Invalid diameter in set command"); + } + + radius[i] = 0.5 * diam; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_dihedral(int &iarg, int narg, char **arg, Action *action) +{ + if (atom->avec->dihedrals_allow == 0) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dihedral", error); + + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::DIHEDRAL,lmp); + action->ivalue1 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue1 <= 0 || action->ivalue1 > atom->ndihedraltypes) + error->all(FLERR,"Invalid dihedral type in set command"); + + iarg += 2; +} + +void Set::invoke_dihedral(Action *action) +{ + topology(DIHEDRAL,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_dipole(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->mu_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set dipole", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2,action); + else action->dvalue2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3,action); + else action->dvalue3 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + + iarg += 4; +} + +void Set::invoke_dipole(Action *action) +{ + int nlocal = atom->nlocal; + double **mu = atom->mu; + + int varflag = action->varflag; + double xvalue,yvalue,zvalue; + if (!action->varflag1) xvalue = action->dvalue1; + if (!action->varflag2) yvalue = action->dvalue2; + if (!action->varflag3) zvalue = action->dvalue3; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + if (action->varflag1) xvalue = vec1[i]; + if (action->varflag1) yvalue = vec2[i]; + if (action->varflag1) zvalue = vec3[i]; + } + + mu[i][0] = xvalue; + mu[i][1] = yvalue; + mu[i][2] = zvalue; + mu[i][3] = sqrt(mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]); + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_dipole_random(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->mu_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "set dipole/random", error); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + action->dvalue1 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (action->ivalue1 <= 0) + error->all(FLERR,"Invalid random number seed in set command"); + if (action->dvalue1 <= 0.0) + error->all(FLERR,"Invalid dipole length in set command"); + + iarg += 3; +} + +void Set::invoke_dipole_random(Action *action) +{ + setrandom(DIPOLE_RANDOM,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_dpd_theta(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->dpd_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set dpd/theta", error); + + if (strcmp(arg[iarg+1],"NULL") == 0) action->dvalue1 = -1.0; + else if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->all(FLERR,"Invalid dpd/theta value in set command"); + } + + iarg += 2; +} + +void Set::invoke_dpd_theta(Action *action) +{ + int nlocal = atom->nlocal; + int *type = atom->type; + double **v = atom->v; + double *mass = atom->mass; + double *rmass = atom->rmass; + double *dpdTheta = atom->dpdTheta; + + double tfactor = force->mvv2e / (domain->dimension * force->boltz); + double onemass; + double vx,vy,vz; + + int varflag = action->varflag; + double theta; + if (!action->varflag1) theta = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + theta = vec1[i]; + if (theta < 0.0) error->one(FLERR,"Invalid dpd/theta value in set command"); + } + + // if theta is negative, NULL was used, set dpdTheta to KE of particle + + if (theta >= 0.0) dpdTheta[i] = theta; + else { + if (rmass) onemass = rmass[i]; + else onemass = mass[type[i]]; + vx = v[i][0]; + vy = v[i][1]; + vz = v[i][2]; + dpdTheta[i] = tfactor * onemass * (vx*vx + vy*vy + vz*vz); + } + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_edpd_cv(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->edpd_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set edpd/cv", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->all(FLERR,"Invalid edpd/cv value in set command"); + } + + iarg += 2; +} + +void Set::invoke_edpd_cv(Action *action) +{ + int nlocal = atom->nlocal; + double *edpd_cv = atom->edpd_cv; + + int varflag = action->varflag; + double cv; + if (!action->varflag1) cv = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + cv = vec1[i]; + if (cv < 0.0) error->one(FLERR,"Invalid edpd/cv value in set command"); + } + + edpd_cv[i] = cv; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_edpd_temp(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->edpd_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set edpd/temp", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->all(FLERR,"Invalid edpd/temp value in set command"); + } + iarg += 2; +} + +void Set::invoke_edpd_temp(Action *action) +{ + int nlocal = atom->nlocal; + double *edpd_temp = atom->edpd_temp; + + int varflag = action->varflag; + double temp; + if (!action->varflag1) temp = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + temp = vec1[i]; + if (temp < 0.0) error->one(FLERR,"Invalid edpd/temp value in set command"); + } + + edpd_temp[i] = temp; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_epsilon(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->dielectric_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set epsilon", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 <= 0.0) error->all(FLERR,"Invalid epsilon in set command"); + } + + iarg += 2; +} + +void Set::invoke_epsilon(Action *action) +{ + int nlocal = atom->nlocal; + double *epsilon = atom->epsilon; + double *q = atom->q; + double *q_scaled = atom->q_scaled; + + int varflag = action->varflag; + double eps; + if (!action->varflag1) eps = action->dvalue1; + + // assign local dielectric constant + // also update scaled charge value + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + eps = vec1[i]; + if (eps <= 0.0) error->one(FLERR,"Invalid epsilon in set command"); + } + + epsilon[i] = eps; + q_scaled[i] = q[i] / eps; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_image(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set image", error); + + if (strcmp(arg[iarg+1],"NULL") == 0) action->ivalue4 = 0; + else { + action->ivalue4 = 1; + if (utils::strmatch(arg[iarg+1],"^v_")) { + if (!domain->xperiodic) + error->all(FLERR,"Cannot set variable image flag for non-periodic dimension"); + varparse(arg[iarg+1],1,action); + } else { + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (action->ivalue1 && !domain->xperiodic) + error->all(FLERR,"Cannot set non-zero image flag for non-periodic dimension"); + } + } + + if (strcmp(arg[iarg+2],"NULL") == 0) action->ivalue5 = 0; + else { + action->ivalue5 = 1; + if (utils::strmatch(arg[iarg+2],"^v_")) { + if (!domain->yperiodic) + error->all(FLERR,"Cannot set variable image flag for non-periodic dimension"); + varparse(arg[iarg+2],2,action); + } else { + action->ivalue2 = utils::inumeric(FLERR,arg[iarg+2],false,lmp); + if (action->ivalue2 && !domain->yperiodic) + error->all(FLERR,"Cannot set non-zero image flag for non-periodic dimension"); + } + } + + if (strcmp(arg[iarg+1],"NULL") == 0) action->ivalue6 = 0; + else { + action->ivalue6 = 1; + if (utils::strmatch(arg[iarg+3],"^v_")) { + if (!domain->zperiodic) + error->all(FLERR,"Cannot set variable image flag for non-periodic dimension"); + varparse(arg[iarg+3],3,action); + } else { + action->ivalue3 = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + if (action->ivalue3 && !domain->zperiodic) + error->all(FLERR,"Cannot set non-zero image flag for non-periodic dimension"); + } + } + + iarg += 4; +} + +void Set::invoke_image(Action *action) +{ + int nlocal = atom->nlocal; + imageint *image = atom->image; + int xbox,ybox,zbox; + + int ximageflag = action->ivalue4; + int yimageflag = action->ivalue5; + int zimageflag = action->ivalue6; + + int varflag = action->varflag; + int ximage,yimage,zimage; + if (!action->varflag1) ximage = action->ivalue1; + if (!action->varflag2) yimage = action->ivalue2; + if (!action->varflag3) zimage = action->ivalue3; + + // reset any or all of 3 image flags + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + if (action->varflag1) ximage = static_cast (vec1[i]); + if (action->varflag2) yimage = static_cast (vec2[i]); + if (action->varflag3) zimage = static_cast (vec3[i]); + } + + xbox = (image[i] & IMGMASK) - IMGMAX; + ybox = (image[i] >> IMGBITS & IMGMASK) - IMGMAX; + zbox = (image[i] >> IMG2BITS) - IMGMAX; + if (ximageflag) xbox = ximage; + if (yimageflag) ybox = yimage; + if (zimageflag) zbox = zimage; + image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) | + (((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) | + (((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS); + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_improper(int &iarg, int narg, char **arg, Action *action) +{ + if (atom->avec->impropers_allow == 0) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set improper", error); + + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::IMPROPER,lmp); + action->ivalue1 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue1 <= 0 || action->ivalue1 > atom->nimpropertypes) + error->all(FLERR,"Invalid value in set command"); + + iarg += 2; +} + +void Set::invoke_improper(Action *action) +{ + topology(IMPROPER,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_length(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->line_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set length", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid length in set command"); + } + + iarg += 2; +} + +void Set::invoke_length(Action *action) +{ + int nlocal = atom->nlocal; + auto avec_line = dynamic_cast(atom->style_match("line")); + + int varflag = action->varflag; + double length; + if (!action->varflag1) length = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + length = vec1[i]; + if (length < 0.0) error->one(FLERR,"Invalid length in set command"); + } + + avec_line->set_length(i,length); + } + + // update global line count + + bigint nlocal_bonus = avec_line->nlocal_bonus; + MPI_Allreduce(&nlocal_bonus,&atom->nlines,1,MPI_LMP_BIGINT,MPI_SUM,world); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_mass(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->rmass_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set mass", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 <= 0.0) error->one(FLERR,"Invalid mass in set command"); + } + + iarg += 2; +} + +void Set::invoke_mass(Action *action) +{ + int nlocal = atom->nlocal; + double *rmass = atom->rmass; + + int varflag = action->varflag; + double mass_one; + if (!action->varflag1) mass_one = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + mass_one = vec1[i]; + if (mass_one < 0.0) error->one(FLERR,"Invalid mass in set command"); + } + + rmass[i] = mass_one; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_mol(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->molecule_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set mol", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->tvalue1 = utils::tnumeric(FLERR,arg[iarg+1],false,lmp); + if (action->tvalue1 < 0) error->one(FLERR,"Invalid molecule ID in set command"); + } + + iarg += 2; +} + +void Set::invoke_mol(Action *action) +{ + int nlocal = atom->nlocal; + tagint *molecule = atom->molecule; + + int varflag = action->varflag; + tagint molID; + if (!action->varflag1) molID = action->tvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + molID = vec1[i]; + if (molID < 0) error->one(FLERR,"Invalid molecule ID in set command"); + } + + molecule[i] = molID; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_omega(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->omega_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set omega", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2,action); + else action->dvalue2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3,action); + else action->dvalue3 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + + iarg += 4; +} + +void Set::invoke_omega(Action *action) +{ + int nlocal = atom->nlocal; + double **omega = atom->omega; + + int varflag = action->varflag; + double xvalue,yvalue,zvalue; + if (!action->varflag1) xvalue = action->dvalue1; + if (!action->varflag2) yvalue = action->dvalue2; + if (!action->varflag3) zvalue = action->dvalue3; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + if (action->varflag1) xvalue = vec1[i]; + if (action->varflag2) yvalue = vec2[i]; + if (action->varflag3) zvalue = vec3[i]; + } + + omega[i][0] = xvalue; + omega[i][1] = yvalue; + omega[i][2] = zvalue; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_quat(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "set quat", error); + int dimension = domain->dimension; + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (dimension == 2 && action->dvalue1 != 0.0) + error->one(FLERR,"Cannot set quaternion with xy components for 2d system"); + } + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2,action); + else { + action->dvalue2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (dimension == 2 && action->dvalue2 != 0.0) + error->one(FLERR,"Cannot set quaternion with xy components for 2d system"); + } + if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3,action); + else action->dvalue3 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4,action); + else action->dvalue4 = utils::numeric(FLERR,arg[iarg+4],false,lmp); + + iarg += 5; +} + +void Set::invoke_quat(Action *action) +{ + int nlocal = atom->nlocal; + int *ellipsoid = atom->ellipsoid; + int *tri = atom->tri; + int *body = atom->body; + double **quat = atom->quat; + int quat_flag = atom->quat_flag; + + auto avec_ellipsoid = dynamic_cast(atom->style_match("ellipsoid")); + auto avec_tri = dynamic_cast(atom->style_match("tri")); + auto avec_body = dynamic_cast(atom->style_match("body")); + + int dimension = domain->dimension; + double radians,sintheta; + double *quat_one; + + int varflag = action->varflag; + double xvalue,yvalue,zvalue,theta; + if (!action->varflag1) xvalue = action->dvalue1; + if (!action->varflag2) yvalue = action->dvalue2; + if (!action->varflag3) zvalue = action->dvalue3; + if (!action->varflag4) theta = action->dvalue4; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (avec_ellipsoid && ellipsoid[i] >= 0) + quat_one = avec_ellipsoid->bonus[ellipsoid[i]].quat; + else if (avec_tri && tri[i] >= 0) + quat_one = avec_tri->bonus[tri[i]].quat; + else if (avec_body && body[i] >= 0) + quat_one = avec_body->bonus[body[i]].quat; + else if (quat_flag) + quat_one = quat[i]; + else + error->one(FLERR,"Cannot set quaternion for atom that has none"); + + if (varflag) { + if (action->varflag1) xvalue = vec1[i]; + if (action->varflag2) yvalue = vec2[i]; + if (action->varflag3) zvalue = vec3[i]; + if (action->varflag4) theta = vec4[i]; + if (dimension == 2 && (xvalue != 0.0 || yvalue != 0.0)) + error->one(FLERR,"Cannot set quaternion with xy components for 2d system"); + } + + radians = MY_PI2 * theta/180.0; + sintheta = sin(radians); + quat_one[0] = cos(radians); + quat_one[1] = xvalue * sintheta; + quat_one[2] = yvalue * sintheta; + quat_one[3] = zvalue * sintheta; + MathExtra::qnormalize(quat_one); + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_quat_random(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->ellipsoid_flag && !atom->tri_flag && !atom->body_flag && !atom->quat_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set quat/random", error); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (action->ivalue1 <= 0) error->all(FLERR,"Invalid random number seed in set command"); + + iarg += 2; +} + +void Set::invoke_quat_random(Action *action) +{ + setrandom(QUAT_RANDOM,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_radius_election(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->eradius_flag) + error->all(FLERR, "Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "set radius/electron", error); + + if (utils::strmatch(arg[iarg + 1], "^v_")) + varparse(arg[iarg + 1], 1, action); + else { + action->dvalue1 = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + if (action->dvalue1 < 0.0) + error->one(FLERR, iarg + 1, "Invalid electron radius {} in set radius/electron command", + action->dvalue1); + } + + iarg += 2; +} + +void Set::invoke_radius_election(Action *action) +{ + int nlocal = atom->nlocal; + double *eradius = atom->eradius; + + int varflag = action->varflag; + double radius; + if (!action->varflag1) radius = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + radius = vec1[i]; + if (radius < 0.0) error->one(FLERR,"Invalid electron radius in set command"); + } + + eradius[i] = radius; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_shape(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->ellipsoid_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set shape", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid shape in set command"); + } + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2,action); + else { + action->dvalue2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (action->dvalue2 < 0.0) error->one(FLERR,"Invalid shape in set command"); + } + if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3,action); + else { + action->dvalue3 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + if (action->dvalue3 < 0.0) error->one(FLERR,"Invalid shape in set command"); + } + + iarg += 4; +} + +void Set::invoke_shape(Action *action) +{ + int nlocal = atom->nlocal; + auto avec_ellipsoid = dynamic_cast(atom->style_match("ellipsoid")); + + int varflag = action->varflag; + double xvalue,yvalue,zvalue; + if (!action->varflag1) xvalue = action->dvalue1; + if (!action->varflag2) yvalue = action->dvalue2; + if (!action->varflag3) zvalue = action->dvalue3; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + if (action->varflag1) xvalue = vec1[i]; + if (action->varflag1) yvalue = vec2[i]; + if (action->varflag1) zvalue = vec3[i]; + if (xvalue < 0.0 || yvalue < 0.0 || zvalue < 0.0) + error->one(FLERR,"Invalid shape in set command"); + } + + if (xvalue > 0.0 || yvalue > 0.0 || zvalue > 0.0) + if (xvalue == 0.0 || yvalue == 0.0 || zvalue == 0.0) + error->one(FLERR,"Invalid shape in set command"); + + avec_ellipsoid->set_shape(i,0.5*xvalue,0.5*yvalue,0.5*zvalue); + } + + // update global ellipsoid count + + bigint nlocal_bonus = avec_ellipsoid->nlocal_bonus; + MPI_Allreduce(&nlocal_bonus,&atom->nellipsoids,1,MPI_LMP_BIGINT,MPI_SUM,world); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_smd_contact_radius(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->smd_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set smd/contact/radius", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid smd/contact/radius in set command"); + } + + iarg += 2; +} + +void Set::invoke_smd_contact_radius(Action *action) +{ + int nlocal = atom->nlocal; + double *contact_radius = atom->contact_radius; + + int varflag = action->varflag; + double radius; + if (!action->varflag1) radius = action->dvalue1; + + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + radius = vec1[i]; + if (radius < 0.0) error->one(FLERR,"Invalid smd/contact/radius in set command"); + } + + contact_radius[i] = radius; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_smd_mass_density(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->smd_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set smd/mass/density", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 <= 0.0) error->one(FLERR,"Invalid smd/mass/density in set command"); + } + + iarg += 2; +} + +void Set::invoke_smd_mass_density(Action *action) +{ + int nlocal = atom->nlocal; + double *rmass = atom->rmass; + double *vfrac = atom->vfrac; + + int varflag = action->varflag; + double density; + if (!action->varflag1) density = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + density = vec1[i]; + if (density < 0.0) error->one(FLERR,"Invalid smd/mass/density in set command"); + } + + rmass[i] = vfrac[i] * density; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_sph_cv(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->cv_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/cv", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_sph_cv(Action *action) +{ + int nlocal = atom->nlocal; + double *cv = atom->cv; + + int varflag = action->varflag; + double sph_cv; + if (!action->varflag1) sph_cv = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) sph_cv = vec1[i]; + cv[i] = sph_cv; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_sph_e(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->esph_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/e", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_sph_e(Action *action) +{ + int nlocal = atom->nlocal; + double *esph = atom->esph; + + int varflag = action->varflag; + double sph_e; + if (!action->varflag1) sph_e = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) sph_e = vec1[i]; + esph[i] = sph_e; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_sph_rho(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->rho_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set sph/rho", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_sph_rho(Action *action) +{ + int nlocal = atom->nlocal; + double *rho = atom->rho; + + int varflag = action->varflag; + double sph_rho; + if (!action->varflag1) sph_rho = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) sph_rho = vec1[i]; + rho[i] = sph_rho; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_spin_atom(int &iarg, int narg, char **arg, Action *action) +{ + if ((strcmp(arg[iarg],"spin") == 0) && (comm->me == 0)) + error->warning(FLERR, "Set attribute spin is deprecated -- use spin/atom instead"); + if (!atom->sp_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+5 > narg) utils::missing_cmd_args(FLERR, "set spin/atom", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 <= 0.0) + error->all(FLERR,"Invalid spin magnitude {} in set {} command", action->dvalue1, arg[iarg]); + } + + if (utils::strmatch(arg[iarg+2],"^v_")) varparse(arg[iarg+2],2,action); + else action->dvalue2 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (utils::strmatch(arg[iarg+3],"^v_")) varparse(arg[iarg+3],3,action); + else action->dvalue3 = utils::numeric(FLERR,arg[iarg+3],false,lmp); + if (utils::strmatch(arg[iarg+4],"^v_")) varparse(arg[iarg+4],4,action); + else action->dvalue4 = utils::numeric(FLERR,arg[iarg+4],false,lmp); + + iarg += 5; +} + +void Set::invoke_spin_atom(Action *action) +{ + int nlocal = atom->nlocal; + double **sp = atom->sp; + double norm; + + int varflag = action->varflag; + double magnitude,xvalue,yvalue,zvalue; + if (!action->varflag1) magnitude = action->dvalue1; + if (!action->varflag2) xvalue = action->dvalue2; + if (!action->varflag3) yvalue = action->dvalue3; + if (!action->varflag4) zvalue = action->dvalue4; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + if (action->varflag1) magnitude = vec1[i]; + if (magnitude < 0.0) + error->one(FLERR,"Invalid spin magnitude in set command"); + if (action->varflag2) xvalue = vec2[i]; + if (action->varflag3) yvalue = vec3[i]; + if (action->varflag4) zvalue = vec4[i]; + } + + if ((xvalue == 0.0) && (yvalue == 0.0) && (zvalue == 0.0)) + error->all(FLERR,"At least one spin vector component must be non-zero"); + + norm = 1.0/sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue); + sp[i][0] = norm*xvalue; + sp[i][1] = norm*yvalue; + sp[i][2] = norm*zvalue; + sp[i][3] = magnitude; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_spin_atom_random(int &iarg, int narg, char **arg, Action *action) +{ + if ((strcmp(arg[iarg], "spin/random") == 0) && (comm->me == 0)) + error->warning(FLERR, + "Set attribute spin/random is deprecated -- use spin/atom/random instead"); + if (!atom->sp_flag) + error->all(FLERR, "Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "set spin/atom/random", error); + + action->ivalue1 = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + action->dvalue1 = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + + if (action->ivalue1 <= 0) + error->all(FLERR, iarg + 1, "Invalid random number seed {} in set {} command", action->ivalue1, + arg[iarg]); + if (action->dvalue1 <= 0.0) + error->all(FLERR, iarg + 2, "Invalid spin magnitude {} in set {} command", action->dvalue1, + arg[iarg]); + iarg += 3; +} + +void Set::invoke_spin_atom_random(Action *action) +{ + setrandom(SPIN_ATOM_RANDOM, action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_spin_electron(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->spin_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set spin/electron", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (action->ivalue1 < -1 || action->ivalue1 > 3) + error->one(FLERR,"Invalid electron spin {} in set command", action->ivalue1); + } + + iarg += 2; +} + +void Set::invoke_spin_electron(Action *action) +{ + int nlocal = atom->nlocal; + int *spin = atom->spin; + + int varflag = action->varflag; + int ispin; + if (!action->varflag1) ispin = action->ivalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + ispin = static_cast (vec1[i]); + if (ispin < -1 || ispin > 3) + error->one(FLERR,"Invalid electron spin in set command"); + } + + atom->spin[i] = ispin; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_temperature(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->temperature_flag) + error->all(FLERR,"Cannot set this attribute for this atom style"); + if (iarg+2 > narg) error->all(FLERR,"Illegal set command"); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid temperature in set command"); + } + + iarg += 2; +} + +void Set::invoke_temperature(Action *action) +{ + int nlocal = atom->nlocal; + double *temperature = atom->temperature; + + int varflag = action->varflag; + double temp; + if (!action->varflag1) temp = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + temp = vec1[i]; + if (temp < 0.0) error->one(FLERR,"Invalid temperature in set command"); + } + + temperature[i] = temp; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_theta(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->line_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = DEG2RAD * utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_theta(Action *action) +{ + int nlocal = atom->nlocal; + int *line = atom->line; + + auto avec_line = dynamic_cast(atom->style_match("line")); + + int varflag = action->varflag; + double theta; + if (!action->varflag1) theta = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (line[i] < 0) error->one(FLERR,"Cannot set theta for atom which is not a line"); + if (varflag) theta = vec1[i]; + avec_line->bonus[atom->line[i]].theta = theta; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_theta_random(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->line_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set theta/random", error); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + if (action->ivalue1 <= 0) error->all(FLERR,"Invalid random number seed in set command"); + + iarg += 2; +} + +void Set::invoke_theta_random(Action *action) +{ + setrandom(THETA_RANDOM,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_tri(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->tri_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set tri", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 < 0.0) error->one(FLERR,"Invalid tri size in set command"); + } + + iarg += 2; +} + +void Set::invoke_tri(Action *action) +{ + int nlocal = atom->nlocal; + int *tri = atom->tri; + + auto avec_tri = dynamic_cast(atom->style_match("tri")); + + int varflag = action->varflag; + double trisize; + if (!action->varflag1) trisize = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; +#if 0 + // AK: this seems wrong. Isn't the set command supposed *make* this a triangle? + if (tri[i] < 0) error->one(FLERR,"Cannot set tri for atom which is not a triangle"); +#endif + + if (varflag) { + trisize = vec1[i]; + if (trisize < 0.0) error->one(FLERR,"Invalid tri size in set command"); + } + + avec_tri->set_equilateral(i,trisize); + } + + // update bonus tri count + + bigint nlocal_bonus = avec_tri->nlocal_bonus; + MPI_Allreduce(&nlocal_bonus,&atom->ntris,1,MPI_LMP_BIGINT,MPI_SUM,world); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_type(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set type", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp); + action->ivalue1 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue1 <= 0 || action->ivalue1 > atom->ntypes) + error->one(FLERR,"Invalid atom type in set command"); + } + + iarg += 2; +} + +void Set::invoke_type(Action *action) +{ + int nlocal = atom->nlocal; + int *type = atom->type; + + int varflag = action->varflag; + int itype; + if (!action->varflag1) itype = action->ivalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (action->varflag) { + itype = static_cast (vec1[i]); + if (itype <= 0 || itype > atom->ntypes) + error->one(FLERR,"Invalid atom type in set command"); + } + + type[i] = itype; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_type_fraction(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/fraction", error); + + // random seed must be ivalue1 for use in setrandom() + + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp); + action->ivalue2 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue2 <= 0 || action->ivalue2 > atom->ntypes) + error->one(FLERR,"Invalid atom type in set command"); + + action->dvalue1 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (action->dvalue1 < 0.0 || action->dvalue1 > 1.0) + error->all(FLERR,"Invalid fraction in set command"); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + if (action->ivalue1 <= 0) + error->all(FLERR,"Invalid random number seed in set command"); + + iarg += 4; +} + +void Set::invoke_type_fraction(Action *action) +{ + setrandom(TYPE_FRACTION,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_type_ratio(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/ratio", error); + + // random seed must be ivalue1 for use in setrandom() + + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp); + action->ivalue2 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue2 <= 0 || action->ivalue2 > atom->ntypes) + error->all(FLERR,"Invalid atom type in set command"); + + action->dvalue1 = utils::numeric(FLERR,arg[iarg+2],false,lmp); + if (action->dvalue1 < 0.0 || action->dvalue1 > 1.0) + error->all(FLERR,"Invalid fraction in set command"); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + if (action->ivalue1 <= 0) + error->all(FLERR,"Invalid random number seed in set command"); + + iarg += 4; +} + +void Set::invoke_type_ratio(Action *action) +{ + setrandom(TYPE_RATIO,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_type_subset(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+4 > narg) utils::missing_cmd_args(FLERR, "set type/subset", error); + + // random seed must be ivalue1 for use in setrandom() + + char *typestr = utils::expand_type(FLERR,arg[iarg+1],Atom::ATOM,lmp); + action->ivalue2 = utils::inumeric(FLERR,typestr?typestr:arg[iarg+1],false,lmp); + delete[] typestr; + if (action->ivalue2 <= 0 || action->ivalue2 > atom->ntypes) + error->all(FLERR,"Invalid atom type in set command"); + + action->bvalue1 = utils::bnumeric(FLERR,arg[iarg+2],false,lmp); + if (action->bvalue1 < 0) + error->all(FLERR,"Invalid subset size in set command"); + + action->ivalue1 = utils::inumeric(FLERR,arg[iarg+3],false,lmp); + if (action->ivalue1 <= 0) + error->all(FLERR,"Invalid random number seed in set command"); + + iarg += 4; +} + +void Set::invoke_type_subset(Action *action) +{ + setrandom(TYPE_SUBSET,action); +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_volume(int &iarg, int narg, char **arg, Action *action) +{ + if (!atom->vfrac_flag) + error->all(FLERR,"Cannot set attribute {} for atom style {}", arg[iarg], atom->get_style()); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set volume", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else { + action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (action->dvalue1 <= 0.0) error->all(FLERR,"Invalid volume in set command"); + } + + iarg += 2; +} + +void Set::invoke_volume(Action *action) +{ + int nlocal = atom->nlocal; + double *vfrac = atom->vfrac; + + int varflag = action->varflag; + double vol; + if (!action->varflag1) vol = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + + if (varflag) { + vol = vec1[i]; + if (vol < 0.0) error->one(FLERR,"Invalid volume in set command"); + } + + vfrac[i] = vol; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_vx(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vx", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_vx(Action *action) +{ + int nlocal = atom->nlocal; + double **v = atom->v; + + int varflag = action->varflag; + double vx; + if (!action->varflag1) vx = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) vx = vec1[i]; + v[i][0] = vx; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_vy(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vy", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_vy(Action *action) +{ + int nlocal = atom->nlocal; + double **v = atom->v; + + int varflag = action->varflag; + double vy; + if (!action->varflag1) vy = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) vy = vec1[i]; + v[i][1] = vy; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_vz(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set vz", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_vz(Action *action) +{ + int nlocal = atom->nlocal; + double **v = atom->v; + + int varflag = action->varflag; + double vz; + if (!action->varflag1) vz = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) vz = vec1[i]; + v[i][2] = vz; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_x(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set x", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_x(Action *action) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + + int varflag = action->varflag; + double coord; + if (!action->varflag1) coord = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) coord = vec1[i]; + x[i][0] = coord; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_y(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set y", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_y(Action *action) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + + int varflag = action->varflag; + double coord; + if (!action->varflag1) coord = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) coord = vec1[i]; + x[i][1] = coord; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_z(int &iarg, int narg, char **arg, Action *action) +{ + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set z", error); + + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + iarg += 2; +} + +void Set::invoke_z(Action *action) +{ + int nlocal = atom->nlocal; + double **x = atom->x; + + int varflag = action->varflag; + double coord; + if (!action->varflag1) coord = action->dvalue1; + + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) coord = vec1[i]; + x[i][2] = coord; + } +} + +/* ---------------------------------------------------------------------- */ + +void Set::process_custom(int &iarg, int narg, char **arg, Action *action) +{ + int flag,cols; + ArgInfo argi(arg[iarg],ArgInfo::DNAME|ArgInfo::INAME); + const char *pname = argi.get_name(); + + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "set", error); + int index_custom = atom->find_custom(argi.get_name(),flag,cols); + if (index_custom < 0) + error->all(FLERR,"Set keyword or custom property {} does not exist",pname); + action->ivalue2 = index_custom; + + switch (argi.get_type()) { + + case ArgInfo::INAME: + if (flag != 0) error->all(FLERR,"Set command custom property {} is not integer",pname); + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->ivalue1 = utils::inumeric(FLERR,arg[iarg+1],false,lmp); + + if (argi.get_dim() == 0) { + if (cols > 0) + error->all(FLERR,"Set command custom integer property {} is not a vector",pname); + action->keyword = IVEC; + } else if (argi.get_dim() == 1) { + if (cols == 0) + error->all(FLERR,"Set command custom integer property {} is not an array",pname); + int icol_custom = argi.get_index1(); + if (icol_custom <= 0 || icol_custom > cols) + error->all(FLERR,"Set command per-atom custom integer array {} is accessed " + "out-of-range",pname); + action->ivalue3 = icol_custom; + action->keyword = IARRAY; + } else error->all(FLERR,"Illegal set command"); + break; + + case ArgInfo::DNAME: + if (flag != 1) error->all(FLERR,"Custom property {} is not floating-point",argi.get_name()); + if (utils::strmatch(arg[iarg+1],"^v_")) varparse(arg[iarg+1],1,action); + else action->dvalue1 = utils::numeric(FLERR,arg[iarg+1],false,lmp); + + if (argi.get_dim() == 0) { + if (cols > 0) + error->all(FLERR,"Set command custom double property {} is not a vector",pname); + action->keyword = DVEC; + } else if (argi.get_dim() == 1) { + if (cols == 0) + error->all(FLERR,"Set command custom double property {} is not an array",pname); + int icol_custom = argi.get_index1(); + if (icol_custom <= 0 || icol_custom > cols) + error->all(FLERR,"Set command per-atom custom double array {} is " + "accessed out-of-range",pname); + action->ivalue3 = icol_custom; + action->keyword = DARRAY; + } else error->all(FLERR,"Illegal set command"); + break; + + default: + error->all(FLERR,"Illegal set command"); + break; + } + + iarg += 2; +} + +void Set::invoke_custom(Action *action) +{ + int nlocal = atom->nlocal; + int ivalue; + double dvalue; + + int varflag = action->varflag; + int index_custom = action->ivalue2; + + if (action->keyword == IVEC) { + if (!varflag) ivalue = action->ivalue1; + int *ivector = atom->ivector[index_custom]; + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) ivalue = static_cast (vec1[i]); + ivector[i] = ivalue; + } + + } else if (action->keyword == DVEC) { + if (!varflag) dvalue = action->dvalue1; + double *dvector = atom->dvector[index_custom]; + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) dvalue = vec1[i]; + dvector[i] = dvalue; + } + + } else if (action->keyword == IARRAY) { + if (!varflag) ivalue = action->ivalue1; + int **iarray = atom->iarray[index_custom]; + int icol_custom = action->ivalue3 - 1; + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) ivalue = static_cast (vec1[i]); + iarray[i][icol_custom] = ivalue; + } + + } else if (action->keyword == DARRAY) { + if (!varflag) dvalue = action->dvalue1; + double **darray = atom->darray[index_custom]; + int icol_custom = action->ivalue3 - 1; + for (int i = 0; i < nlocal; i++) { + if (!select[i]) continue; + if (varflag) dvalue = vec1[i]; + darray[i][icol_custom] = dvalue; + } } } diff --git a/src/set.h b/src/set.h index e2be5d5c1e..65489d9932 100644 --- a/src/set.h +++ b/src/set.h @@ -26,29 +26,168 @@ namespace LAMMPS_NS { class Set : public Command { public: - Set(class LAMMPS *lmp) : Command(lmp) {}; + Set(class LAMMPS *lmp); + ~Set() override; + void command(int, char **) override; - private: - char *id; - int *select; - int style, ivalue, newtype, count, index_custom, icol_custom; - int ximage, yimage, zimage, ximageflag, yimageflag, zimageflag; - int cc_index; - bigint nsubset; - double dvalue, xvalue, yvalue, zvalue, wvalue, fraction; - - int varflag, varflag1, varflag2, varflag3, varflag4; - int ivar1, ivar2, ivar3, ivar4; - double *vec1, *vec2, *vec3, *vec4; - - int discflag; - + void process_args(int, int, char **); void selection(int); - void set(int); - void setrandom(int); - void topology(int); - void varparse(const char *, int); + void invoke_actions(); + + private: + int caller; // SETCOMMAND or FIXSET + + // params for atom selection + + int style; + char *id; + int nlo, nhi; + bigint nlobig, nhibig; + int groupbit; + class Region *region; + + // one Action = one keyword/value pair + + struct Action { + int keyword; + int argindex; + int count_select, count_action; + int varflag; + int varflag1, varflag2, varflag3, varflag4; + int ivar1, ivar2, ivar3, ivar4; + int ivalue1, ivalue2, ivalue3, ivalue4, ivalue5, ivalue6; + tagint tvalue1; + bigint bvalue1; + double dvalue1, dvalue2, dvalue3, dvalue4; + }; + + int naction, maxaction; + Action *actions; + + typedef void (Set::*FnPtrPack)(Action *); + FnPtrPack *invoke_choice; // list of ptrs to invoke functions + + double *vec1, *vec2, *vec3, *vec4; // storage for evaluated peratom variables + int varflag; // 1 if any action uses a per-atom variable + int varflag1, varflag2, varflag3, varflag4; // 1 if any action uses this variable + int maxvariable; // size of peratom variable vectors + + int *select; // flag for selected atoms + int maxselect; // size of select vector + + int count_select; // count of selected atoms on this proc + int count_action; // count of actions on this proc, only if different than selected + + // private functions + + void varparse(const char *, int, Action *); + void setrandom(int, Action *); + void topology(int, Action *); + + // customize by adding a process method + + void process_angle(int &, int, char **, Action *); + void process_angmom(int &, int, char **, Action *); + void process_bond(int &, int, char **, Action *); + void process_cc(int &, int, char **, Action *); + void process_charge(int &, int, char **, Action *); + void process_density(int &, int, char **, Action *); + void process_diameter(int &, int, char **, Action *); + void process_dihedral(int &, int, char **, Action *); + void process_dipole(int &, int, char **, Action *); + void process_dipole_random(int &, int, char **, Action *); + void process_dpd_theta(int &, int, char **, Action *); + void process_edpd_cv(int &, int, char **, Action *); + void process_edpd_temp(int &, int, char **, Action *); + void process_epsilon(int &, int, char **, Action *); + void process_image(int &, int, char **, Action *); + void process_improper(int &, int, char **, Action *); + void process_length(int &, int, char **, Action *); + void process_mass(int &, int, char **, Action *); + void process_mol(int &, int, char **, Action *); + void process_omega(int &, int, char **, Action *); + void process_quat(int &, int, char **, Action *); + void process_quat_random(int &, int, char **, Action *); + void process_radius_election(int &, int, char **, Action *); + void process_shape(int &, int, char **, Action *); + void process_smd_contact_radius(int &, int, char **, Action *); + void process_smd_mass_density(int &, int, char **, Action *); + void process_sph_cv(int &, int, char **, Action *); + void process_sph_e(int &, int, char **, Action *); + void process_sph_rho(int &, int, char **, Action *); + void process_spin_atom(int &, int, char **, Action *); + void process_spin_atom_random(int &, int, char **, Action *); + void process_spin_electron(int &, int, char **, Action *); + void process_temperature(int &, int, char **, Action *); + void process_theta(int &, int, char **, Action *); + void process_theta_random(int &, int, char **, Action *); + void process_tri(int &, int, char **, Action *); + void process_type(int &, int, char **, Action *); + void process_type_fraction(int &, int, char **, Action *); + void process_type_ratio(int &, int, char **, Action *); + void process_type_subset(int &, int, char **, Action *); + void process_volume(int &, int, char **, Action *); + void process_vx(int &, int, char **, Action *); + void process_vy(int &, int, char **, Action *); + void process_vz(int &, int, char **, Action *); + void process_x(int &, int, char **, Action *); + void process_y(int &, int, char **, Action *); + void process_z(int &, int, char **, Action *); + + void process_custom(int &, int, char **, Action *); + + // customize by adding an invoke method + + void invoke_angle(Action *); + void invoke_angmom(Action *); + void invoke_bond(Action *); + void invoke_cc(Action *); + void invoke_charge(Action *); + void invoke_density(Action *); + void invoke_diameter(Action *); + void invoke_dihedral(Action *); + void invoke_dipole(Action *); + void invoke_dipole_random(Action *); + void invoke_dpd_theta(Action *); + void invoke_edpd_cv(Action *); + void invoke_edpd_temp(Action *); + void invoke_epsilon(Action *); + void invoke_image(Action *); + void invoke_improper(Action *); + void invoke_length(Action *); + void invoke_mass(Action *); + void invoke_mol(Action *); + void invoke_omega(Action *); + void invoke_quat(Action *); + void invoke_quat_random(Action *); + void invoke_radius_election(Action *); + void invoke_shape(Action *); + void invoke_smd_contact_radius(Action *); + void invoke_smd_mass_density(Action *); + void invoke_sph_cv(Action *); + void invoke_sph_e(Action *); + void invoke_sph_rho(Action *); + void invoke_spin_atom(Action *); + void invoke_spin_atom_random(Action *); + void invoke_spin_electron(Action *); + void invoke_temperature(Action *); + void invoke_theta(Action *); + void invoke_theta_random(Action *); + void invoke_tri(Action *); + void invoke_type(Action *); + void invoke_type_fraction(Action *); + void invoke_type_ratio(Action *); + void invoke_type_subset(Action *); + void invoke_volume(Action *); + void invoke_vx(Action *); + void invoke_vy(Action *); + void invoke_vz(Action *); + void invoke_x(Action *); + void invoke_y(Action *); + void invoke_z(Action *); + + void invoke_custom(Action *); }; } // namespace LAMMPS_NS diff --git a/src/utils.cpp b/src/utils.cpp index 1c26dcf3b0..31fcb5867e 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -902,7 +902,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod // match grids if (strmatch(word, "^[cf]_\\w+:\\w+:\\w+\\[\\d*\\*\\d*\\]")) { - auto gridid = utils::parse_grid_id(FLERR, word, lmp->error); + auto gridid = utils::parse_grid_id(file, line, word, lmp->error); size_t first = gridid[2].find('['); size_t second = gridid[2].find(']', first + 1); @@ -1046,6 +1046,9 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int mod if (nhi < MAXSMALLINT) { nmax = nhi; expandflag = 1; + } else { + lmp->error->all(file, line, ioffset + iarg, + "Upper bound required to expand vector style variable {}", id); } } } diff --git a/tools/lammps-gui/CMakeLists.txt b/tools/lammps-gui/CMakeLists.txt index b396a01494..5d3f3c0bb3 100644 --- a/tools/lammps-gui/CMakeLists.txt +++ b/tools/lammps-gui/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.16) -project(lammps-gui VERSION 1.6.13 LANGUAGES CXX) +project(lammps-gui VERSION 1.6.14 LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) diff --git a/tools/lammps-gui/lammps-gui.appdata.xml b/tools/lammps-gui/lammps-gui.appdata.xml index 3061e973ea..1366b0262b 100644 --- a/tools/lammps-gui/lammps-gui.appdata.xml +++ b/tools/lammps-gui/lammps-gui.appdata.xml @@ -55,6 +55,11 @@ + + + ... + + Change working directory to user's home dir if initial directory is "/" or the Application folder @@ -68,7 +73,7 @@ Double-click on highlighted URL opens it in web browser. Also available via context menu. - + Update Tutorial menu entries to cover all 8 tutorials Highlight warnings and error messages in Output window diff --git a/tools/magic b/tools/magic index 43e8affbd3..5a0c2ccfbb 100644 --- a/tools/magic +++ b/tools/magic @@ -1,30 +1,23 @@ -# Add the contents of this file to either $HOME/.magic -# or /etc/magic so that the file(1) command can recognize + +# These definitions are included in file since version 5.41. +# https://www.darwinsys.com/file/ https://github.com/file/file +# If you have an older version of the software, add the +# contents of this file to either $HOME/.magic or +# /etc/magic so that the file(1) command can recognize # your LAMMPS files and print some useful information. -# Last change: 2021-03-15 by akohlmey@gmail.com +# +# Last change: 2025-05-28 by akohlmey@gmail.com -# Binary restart file for the LAMMPS MD code, https://www.lammps.org - -# written on a little endian machine +# Binary restart file for the LAMMPS MD code 0 string LammpS\ RestartT LAMMPS binary restart file ->16 lelong 0x0001 ->>20 lelong x (rev %d), ->>>32 string x Version %s, ->>>>&41 string x Units %s, ->>>>>&5 lequad x Timestep %lld, ->>>>>>0x10 lelong 0x0001 Little Endian - -# written on a big endian machine -0 string LammpS\ RestartT LAMMPS binary restart file ->16 lelong 0x1000 Big Endian ->>20 belong x (rev %d), ->>>32 string x Version %s, ->>>>&41 string x Units %s, ->>>>>&5 bequad x Timestep %lld, ->>>>>>0x10 lelong 0x1000 Big Endian +>0x14 long x (rev %d), +>>0x20 string x Version %s, +>>>&41 string x Units %s, +>>>>&5 quad x Timestep %lld, +>>>>>0x10 lelong 0x0001 Little Endian +>>>>>0x10 lelong 0x1000 Big Endian # Atom style binary dump file for the LAMMPS MD code, https://www.lammps.org - # written on a little endian machine 0 lequad -8 >0x08 string DUMPATOM LAMMPS atom style binary dump @@ -39,7 +32,7 @@ >>>0x10 lelong 0x1000 Big Endian, >>>>0x18 bequad x First time step: %lld -# Atom style binary dump file for the LAMMPS MD code, https://www.lammps.org +# Atom style binary dump file for the LAMMPS MD code # written on a little endian machine 0 lequad -10 >0x08 string DUMPCUSTOM LAMMPS custom style binary dump @@ -64,7 +57,7 @@ >0x12 string msi2lmp written by msi2lmp >0x11 string via\ write_data written by LAMMPS -# Data file written by OVITO +# LAMMPS data file written by OVITO 0 string #\ LAMMPS\ data\ file LAMMPS data file >0x13 string written\ by\ OVITO written by OVITO diff --git a/tools/singularity/fedora41_musl_mingw.def b/tools/singularity/fedora41_musl_mingw.def index 7e15f6590b..a2cf77dab8 100644 --- a/tools/singularity/fedora41_musl_mingw.def +++ b/tools/singularity/fedora41_musl_mingw.def @@ -2,8 +2,8 @@ BootStrap: docker From: fedora:41 %setup - curl -L -o musl-gcc-f37.tar.gz https://download.lammps.org/static/musl-gcc-f37.tar.gz - cp musl-gcc-f37.tar.gz ${APPTAINER_ROOTFS} + curl -L -o musl-gcc-f41.tar.gz https://download.lammps.org/static/musl-gcc-f41.tar.gz + cp musl-gcc-f41.tar.gz ${APPTAINER_ROOTFS} %post dnf -y update @@ -52,8 +52,8 @@ From: fedora:41 dnf clean all # install musl-libc Linux-2-Linux cross-compiler - tar -C /usr/ -xvf /musl-gcc-f37.tar.gz - rm -f /musl-gcc-f37.tar.gz + tar -C /usr/ -xvf /musl-gcc-f41.tar.gz + rm -f /musl-gcc-f41.tar.gz # install NSIS EnVar plugin curl -L -o EnVar_plugin.zip https://nsis.sourceforge.io/mediawiki/images/7/7f/EnVar_plugin.zip diff --git a/unittest/c-library/CMakeLists.txt b/unittest/c-library/CMakeLists.txt index 62ec750a3f..169aea91df 100644 --- a/unittest/c-library/CMakeLists.txt +++ b/unittest/c-library/CMakeLists.txt @@ -31,28 +31,28 @@ target_compile_definitions(test_library_scatter_gather PRIVATE -DTEST_INPUT_FOLD add_test(NAME LibraryScatterGather COMMAND test_library_scatter_gather) set_tests_properties(LibraryScatterGather PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") -set(TEST_CONFIG_DEFS "-DTEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR};-DLAMMPS_${LAMMPS_SIZES}") +set(TEST_CONFIG_DEFS "TEST_INPUT_FOLDER=${CMAKE_CURRENT_SOURCE_DIR};LAMMPS_${LAMMPS_SIZES}") set(PKG_COUNT 0) foreach(PKG ${STANDARD_PACKAGES} ${EXTRA_PACKAGES} ${SUFFIX_PACKAGES}) if(PKG_${PKG}) MATH(EXPR PKG_COUNT "${PKG_COUNT}+1") endif() endforeach() -list(APPEND TEST_CONFIG_DEFS -DNUM_LAMMPS_PACKAGES=${PKG_COUNT}) +list(APPEND TEST_CONFIG_DEFS NUM_LAMMPS_PACKAGES=${PKG_COUNT}) if(PKG_MANYBODY) set(HAS_MANYBODY 1) else() set(HAS_MANYBODY 0) endif() -list(APPEND TEST_CONFIG_DEFS -DLAMMPS_HAS_MANYBODY=${HAS_MANYBODY}) +list(APPEND TEST_CONFIG_DEFS LAMMPS_HAS_MANYBODY=${HAS_MANYBODY}) if(BUILD_MPI) set(HAS_MPI 1) else() set(HAS_MPI 0) endif() -list(APPEND TEST_CONFIG_DEFS -DLAMMPS_HAS_MPI=${HAS_MPI}) +list(APPEND TEST_CONFIG_DEFS LAMMPS_HAS_MPI=${HAS_MPI}) foreach(WITH "JPEG" "PNG" "GZIP" "FFMPEG") if(WITH_${WITH}) @@ -60,7 +60,7 @@ foreach(WITH "JPEG" "PNG" "GZIP" "FFMPEG") else() set(HAS_${WITH} 0) endif() - list(APPEND TEST_CONFIG_DEFS -DLAMMPS_HAS_${WITH}=${HAS_${WITH}}) + list(APPEND TEST_CONFIG_DEFS LAMMPS_HAS_${WITH}=${HAS_${WITH}}) endforeach() add_executable(test_library_config test_library_config.cpp test_main.cpp) @@ -70,7 +70,7 @@ add_test(NAME LibraryConfig COMMAND test_library_config) add_executable(test_library_mpi test_library_mpi.cpp) target_link_libraries(test_library_mpi PRIVATE lammps GTest::GMock) -target_compile_definitions(test_library_mpi PRIVATE ${TEST_CONFIG_DEFS}) +target_compile_definitions(test_library_mpi PRIVATE "${TEST_CONFIG_DEFS};MPICH_SKIP_MPICXX=1;OMPI_SKIP_MPICXX=1") add_mpi_test(NAME LibraryMPI NUM_PROCS 4 COMMAND $) # simple run tests for coupling to the LAMMPS library diff --git a/unittest/commands/test_set_property.cpp b/unittest/commands/test_set_property.cpp index c306ea4739..26635d225f 100644 --- a/unittest/commands/test_set_property.cpp +++ b/unittest/commands/test_set_property.cpp @@ -90,8 +90,9 @@ TEST_F(SetTest, NoBoxNoAtoms) ASSERT_EQ(compute->vector_atom[0], 0); TEST_FAILURE(".*ERROR: Illegal set command: need at least four.*", command("set type 1 x");); - TEST_FAILURE(".*ERROR: Unknown set command style: xxx.*", command("set xxx 1 x 0.0");); - TEST_FAILURE(".*ERROR: Set keyword or custom property yyy does not exist.*", + TEST_FAILURE(".*ERROR: Unknown set or fix set command style: xxx.*", + command("set xxx 1 x 0.0");); + TEST_FAILURE(".*ERROR: Unrecognized set or fix set command keyword yyy.*", command("set type 1 yyy 0.0");); TEST_FAILURE(".*ERROR: Cannot set attribute spin/atom for atom style atomic.*", @@ -447,9 +448,9 @@ TEST_F(SetTest, EffPackage) EXPECT_EQ(compute->array_atom[6][1], 0.5); EXPECT_EQ(compute->array_atom[7][1], 1.0); - TEST_FAILURE(".*ERROR on proc 0: Incorrect value for electron spin: 0.5.*", + TEST_FAILURE(".*Expected integer parameter instead of '0.5' in input script.*", command("set atom * spin/electron 0.5");); - TEST_FAILURE(".*ERROR on proc 0: Incorrect value for electron radius: -0.5.*", + TEST_FAILURE(".*ERROR on proc 0: Invalid electron radius -0.5 in set.*", command("set atom * radius/electron -0.5");); } diff --git a/unittest/cplusplus/test_advanced_utils.cpp b/unittest/cplusplus/test_advanced_utils.cpp index 468f353080..e863296e3e 100644 --- a/unittest/cplusplus/test_advanced_utils.cpp +++ b/unittest/cplusplus/test_advanced_utils.cpp @@ -153,7 +153,7 @@ TEST_F(Advanced_utils, expand_args) // disable use of input->command and input->arg which point to the last run command right now lmp->input->command = nullptr; - lmp->input->arg = nullptr; + lmp->input->arg = nullptr; auto narg = utils::expand_args(FLERR, oarg, args, 0, earg, lmp); EXPECT_EQ(narg, 16); @@ -214,8 +214,13 @@ TEST_F(Advanced_utils, expand_args) args[5][7] = '3'; delete[] args[4]; args[4] = utils::strdup("v_temp[2*]"); + TEST_FAILURE("ERROR: Upper bound required to expand vector style variable temp.*", + utils::expand_args(FLERR, oarg, args, 0, earg, lmp);); + + delete[] args[4]; + args[4] = utils::strdup("v_temp[*2]"); narg = utils::expand_args(FLERR, oarg, args, 0, earg, lmp); - EXPECT_EQ(narg, 13); + EXPECT_EQ(narg, 14); EXPECT_STREQ(earg[0], "v_step"); EXPECT_STREQ(earg[1], "c_temp"); EXPECT_STREQ(earg[2], "f_1[1]"); @@ -224,11 +229,12 @@ TEST_F(Advanced_utils, expand_args) EXPECT_STREQ(earg[5], "c_temp[2]"); EXPECT_STREQ(earg[6], "c_temp[3]"); EXPECT_STREQ(earg[7], "c_temp[4]"); - EXPECT_STREQ(earg[8], "v_temp[2*]"); - EXPECT_STREQ(earg[9], "c_gofr[3*]"); - EXPECT_STREQ(earg[10], "c_gofr[1][*]"); - EXPECT_STREQ(earg[11], "c_gofr[*2][2]"); - EXPECT_STREQ(earg[12], "c_gofr[*][*]"); + EXPECT_STREQ(earg[8], "v_temp[1]"); + EXPECT_STREQ(earg[9], "v_temp[2]"); + EXPECT_STREQ(earg[10], "c_gofr[3*]"); + EXPECT_STREQ(earg[11], "c_gofr[1][*]"); + EXPECT_STREQ(earg[12], "c_gofr[*2][2]"); + EXPECT_STREQ(earg[13], "c_gofr[*][*]"); for (int i = 0; i < narg; ++i) delete[] earg[i]; diff --git a/unittest/force-styles/tests/angle-cosine_delta.yaml b/unittest/force-styles/tests/angle-cosine_delta.yaml index 0ac97119e7..db0a05438c 100644 --- a/unittest/force-styles/tests/angle-cosine_delta.yaml +++ b/unittest/force-styles/tests/angle-cosine_delta.yaml @@ -1,6 +1,5 @@ --- lammps_version: 4 Feb 2025 -tags: generated date_generated: Fri Feb 21 16:17:55 2025 epsilon: 5e-13 skip_tests: numdiff diff --git a/unittest/force-styles/tests/angle-mwlc.yaml b/unittest/force-styles/tests/angle-mwlc.yaml index dc4d817456..707f6ff881 100644 --- a/unittest/force-styles/tests/angle-mwlc.yaml +++ b/unittest/force-styles/tests/angle-mwlc.yaml @@ -1,6 +1,5 @@ --- lammps_version: 19 Nov 2024 -tags: generated date_generated: Fri Jan 10 13:54:41 2025 epsilon: 2.5e-13 skip_tests: diff --git a/unittest/force-styles/tests/bond-fene.yaml b/unittest/force-styles/tests/bond-fene.yaml index e5077eda0e..b9430a75fc 100644 --- a/unittest/force-styles/tests/bond-fene.yaml +++ b/unittest/force-styles/tests/bond-fene.yaml @@ -7,7 +7,8 @@ prerequisites: ! | atom full bond fene pre_commands: ! "" -post_commands: ! "" +post_commands: ! | + special_bonds lj/coul 0.0 1.0 1.0 input_file: in.fourmol bond_style: fene bond_coeff: ! | diff --git a/unittest/force-styles/tests/bond-fene_expand.yaml b/unittest/force-styles/tests/bond-fene_expand.yaml index 250f89af15..2be87fc3d3 100644 --- a/unittest/force-styles/tests/bond-fene_expand.yaml +++ b/unittest/force-styles/tests/bond-fene_expand.yaml @@ -7,7 +7,8 @@ prerequisites: ! | atom full bond fene/expand pre_commands: ! "" -post_commands: ! "" +post_commands: ! | + special_bonds lj/coul 0.0 1.0 1.0 input_file: in.fourmol bond_style: fene/expand bond_coeff: ! | diff --git a/unittest/force-styles/tests/bond-fene_nm.yaml b/unittest/force-styles/tests/bond-fene_nm.yaml index 892d26c7aa..77f79fe780 100644 --- a/unittest/force-styles/tests/bond-fene_nm.yaml +++ b/unittest/force-styles/tests/bond-fene_nm.yaml @@ -7,7 +7,8 @@ prerequisites: ! | atom full bond fene/nm pre_commands: ! "" -post_commands: ! "" +post_commands: ! | + special_bonds lj/coul 0.0 1.0 1.0 input_file: in.fourmol bond_style: fene/nm bond_coeff: ! | diff --git a/unittest/force-styles/tests/fix-timestep-efield_lepton.yaml b/unittest/force-styles/tests/fix-timestep-efield_lepton.yaml index 7928c81c45..a3539e1af1 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_lepton.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_lepton.yaml @@ -1,6 +1,5 @@ --- lammps_version: 29 Aug 2024 -tags: generated date_generated: Tue Nov 12 08:53:18 2024 epsilon: 2e-13 skip_tests: diff --git a/unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml b/unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml index f0a6b121a4..b7be61782e 100644 --- a/unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml @@ -1,6 +1,5 @@ --- lammps_version: 29 Aug 2024 -tags: generated date_generated: Tue Nov 12 08:53:32 2024 epsilon: 2e-13 skip_tests: diff --git a/unittest/force-styles/tests/mol-pair-lj_pirani.yaml b/unittest/force-styles/tests/mol-pair-lj_pirani.yaml index d745fd788b..06e7940c67 100644 --- a/unittest/force-styles/tests/mol-pair-lj_pirani.yaml +++ b/unittest/force-styles/tests/mol-pair-lj_pirani.yaml @@ -1,6 +1,5 @@ --- lammps_version: 2 Apr 2025 -tags: generated date_generated: Fri Apr 18 00:29:06 2025 epsilon: 5e-14 skip_tests: